Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
W
windbot
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaoye
windbot
Commits
09b9678c
Commit
09b9678c
authored
Jul 27, 2016
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update 4 ways to run WindBot
parent
ad74a5cc
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
286 additions
and
159 deletions
+286
-159
Game/AI/Decks/BlueEyesExecutor.cs
Game/AI/Decks/BlueEyesExecutor.cs
+86
-86
Game/GameAI.cs
Game/GameAI.cs
+4
-4
Game/GameBehavior.cs
Game/GameBehavior.cs
+2
-1
Game/GameClient.cs
Game/GameClient.cs
+14
-12
Logger.cs
Logger.cs
+5
-0
Program.cs
Program.cs
+148
-56
WindBot.csproj
WindBot.csproj
+1
-0
WindBotInfo.cs
WindBotInfo.cs
+26
-0
No files found.
Game/AI/Decks/BlueEyesExecutor.cs
View file @
09b9678c
This diff is collapsed.
Click to expand it.
Game/GameAI.cs
View file @
09b9678c
...
...
@@ -366,8 +366,8 @@ namespace WindBot.Game
}
selected
.
Add
(
card
);
trysum
+=
card
.
Level
;
//Logger.WriteLine(card.Id + "");
//Logger.WriteLine(trysum + " selected " + sum);
//Logger.
Debug
WriteLine(card.Id + "");
//Logger.
Debug
WriteLine(trysum + " selected " + sum);
if
(
trysum
==
sum
)
{
return
selected
;
...
...
@@ -384,8 +384,8 @@ namespace WindBot.Game
// try level sub
selected2
.
Remove
(
card
);
trysum
-=
card
.
Level
;
//Logger.WriteLine(card.Id + "");
//Logger.WriteLine(trysum + " selected2 " + sum);
//Logger.
Debug
WriteLine(card.Id + "");
//Logger.
Debug
WriteLine(trysum + " selected2 " + sum);
if
(
trysum
==
sum
)
{
return
selected2
;
...
...
Game/GameBehavior.cs
View file @
09b9678c
...
...
@@ -146,7 +146,7 @@ namespace WindBot.Game
private
void
OnPlayerEnter
(
BinaryReader
packet
)
{
string
name
=
packet
.
ReadUnicode
(
Program
.
PlayerNameSize
);
string
name
=
packet
.
ReadUnicode
(
20
);
int
pos
=
packet
.
ReadByte
();
if
(
pos
<
8
)
_room
.
Names
[
pos
]
=
name
;
...
...
@@ -230,6 +230,7 @@ namespace WindBot.Game
private
void
OnRetry
(
BinaryReader
packet
)
{
Connection
.
Close
();
throw
new
Exception
(
"Got MSG_RETRY."
);
}
...
...
Game/GameClient.cs
View file @
09b9678c
...
...
@@ -16,19 +16,21 @@ namespace WindBot.Game
private
string
_serverHost
;
private
int
_serverPort
;
private
string
_roomInfos
;
private
short
_proVersion
;
private
string
_roomInfo
;
private
GameBehavior
_behavior
;
public
GameClient
(
string
username
=
"Windbot"
,
string
deck
=
"Blue-Eyes"
,
string
serverHost
=
"127.0.0.1"
,
int
serverPort
=
7911
,
string
dialog
=
"default"
,
string
roomInfos
=
""
)
public
GameClient
(
WindBotInfo
Info
)
{
Username
=
username
;
Deck
=
deck
;
Dialog
=
dialog
;
_serverHost
=
serverHost
;
_serverPort
=
serverPort
;
_roomInfos
=
roomInfos
;
Username
=
Info
.
Name
;
Deck
=
Info
.
Deck
;
Dialog
=
Info
.
Dialog
;
_serverHost
=
Info
.
Host
;
_serverPort
=
Info
.
Port
;
_roomInfo
=
Info
.
HostInfo
;
_proVersion
=
(
short
)
Info
.
Version
;
}
public
void
Start
()
...
...
@@ -45,14 +47,14 @@ namespace WindBot.Game
private
void
OnConnected
()
{
BinaryWriter
packet
=
GamePacketFactory
.
Create
(
CtosMessage
.
PlayerInfo
);
packet
.
WriteUnicode
(
Username
,
Program
.
PlayerNameSize
);
packet
.
WriteUnicode
(
Username
,
20
);
Connection
.
Send
(
packet
);
byte
[]
junk
=
{
0xCC
,
0xCC
,
0x00
,
0x00
,
0x00
,
0x00
};
packet
=
GamePacketFactory
.
Create
(
CtosMessage
.
JoinGame
);
packet
.
Write
(
Program
.
P
roVersion
);
packet
.
Write
(
_p
roVersion
);
packet
.
Write
(
junk
);
packet
.
WriteUnicode
(
_roomInfo
s
,
30
);
packet
.
WriteUnicode
(
_roomInfo
,
30
);
Connection
.
Send
(
packet
);
}
...
...
Logger.cs
View file @
09b9678c
...
...
@@ -8,6 +8,11 @@ namespace WindBot
{
Console
.
WriteLine
(
"["
+
DateTime
.
Now
.
ToString
(
"HH:mm:ss"
)
+
"] "
+
message
);
}
public
static
void
DebugWriteLine
(
string
message
)
{
if
(
Program
.
DebugMode
)
Console
.
WriteLine
(
"["
+
DateTime
.
Now
.
ToString
(
"HH:mm:ss"
)
+
"] "
+
message
);
}
public
static
void
WriteErrorLine
(
string
message
)
{
Console
.
Error
.
WriteLine
(
"["
+
DateTime
.
Now
.
ToString
(
"HH:mm:ss"
)
+
"] "
+
message
);
...
...
Program.cs
View file @
09b9678c
This diff is collapsed.
Click to expand it.
WindBot.csproj
View file @
09b9678c
...
...
@@ -95,6 +95,7 @@
<Compile
Include=
"Logger.cs"
/>
<Compile
Include=
"Program.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<Compile
Include=
"WindBotInfo.cs"
/>
</ItemGroup>
<ItemGroup>
<None
Include=
"App.config"
/>
...
...
WindBotInfo.cs
0 → 100644
View file @
09b9678c
using
System
;
namespace
WindBot
{
public
class
WindBotInfo
{
public
string
Name
{
get
;
set
;
}
public
string
Deck
{
get
;
set
;
}
public
string
Dialog
{
get
;
set
;
}
public
string
Host
{
get
;
set
;
}
public
int
Port
{
get
;
set
;
}
public
string
HostInfo
{
get
;
set
;
}
public
int
Version
{
get
;
set
;
}
public
WindBotInfo
()
{
Name
=
"WindBot"
;
Deck
=
"Blue-Eyes"
;
Dialog
=
"default"
;
Host
=
"127.0.0.1"
;
Port
=
7911
;
HostInfo
=
""
;
Version
=
0x133A
;
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment