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
nanahira
windbot
Commits
fabdff0e
Commit
fabdff0e
authored
Jun 22, 2016
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge
https://github.com/IceYGO/windbot
parents
5363702a
560ccf09
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
110 additions
and
81 deletions
+110
-81
Game/AI/DefaultExecutor.cs
Game/AI/DefaultExecutor.cs
+1
-1
Game/AI/Executor.cs
Game/AI/Executor.cs
+2
-0
Game/ClientCard.cs
Game/ClientCard.cs
+2
-1
Game/GameAI.cs
Game/GameAI.cs
+0
-3
Game/GameBehavior.cs
Game/GameBehavior.cs
+64
-63
Game/GameClient.cs
Game/GameClient.cs
+21
-13
Game/GamePacketFactory.cs
Game/GamePacketFactory.cs
+15
-0
Program.cs
Program.cs
+1
-0
WindBot.csproj
WindBot.csproj
+4
-0
YGOSharp.Network.dll
YGOSharp.Network.dll
+0
-0
No files found.
Game/AI/DefaultExecutor.cs
View file @
fabdff0e
...
@@ -134,7 +134,7 @@ namespace WindBot.Game.AI
...
@@ -134,7 +134,7 @@ namespace WindBot.Game.AI
protected
bool
DefaultTrap
()
protected
bool
DefaultTrap
()
{
{
return
LastChainPlayer
==
1
;
return
LastChainPlayer
==
-
1
||
LastChainPlayer
==
1
;
}
}
protected
bool
DefaultUniqueTrap
()
protected
bool
DefaultUniqueTrap
()
...
...
Game/AI/Executor.cs
View file @
fabdff0e
...
@@ -26,6 +26,8 @@ namespace WindBot.Game.AI
...
@@ -26,6 +26,8 @@ namespace WindBot.Game.AI
Duel
=
duel
;
Duel
=
duel
;
AI
=
ai
;
AI
=
ai
;
Executors
=
new
List
<
CardExecutor
>();
Executors
=
new
List
<
CardExecutor
>();
LastChainPlayer
=
-
1
;
CurrentChain
=
new
List
<
ClientCard
>();
CurrentChain
=
new
List
<
ClientCard
>();
}
}
...
...
Game/ClientCard.cs
View file @
fabdff0e
using
OCGWrapper
;
using
OCGWrapper
;
using
OCGWrapper.Enums
;
using
OCGWrapper.Enums
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.IO
;
using
YGOSharp.Network
;
using
YGOSharp.Network
;
namespace
WindBot.Game
namespace
WindBot.Game
...
@@ -54,7 +55,7 @@ namespace WindBot.Game
...
@@ -54,7 +55,7 @@ namespace WindBot.Game
Name
=
Data
.
Name
;
Name
=
Data
.
Name
;
}
}
public
void
Update
(
GamePacket
Reader
packet
,
Duel
duel
)
public
void
Update
(
Binary
Reader
packet
,
Duel
duel
)
{
{
int
flag
=
packet
.
ReadInt32
();
int
flag
=
packet
.
ReadInt32
();
if
((
flag
&
(
int
)
Query
.
Code
)
!=
0
)
if
((
flag
&
(
int
)
Query
.
Code
)
!=
0
)
...
...
Game/GameAI.cs
View file @
fabdff0e
using
OCGWrapper.Enums
;
using
OCGWrapper.Enums
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
WindBot.Game.AI
;
using
WindBot.Game.AI
;
using
YGOSharp.Network
;
namespace
WindBot.Game
namespace
WindBot.Game
{
{
public
class
GameAI
public
class
GameAI
{
{
public
GameClient
Game
{
get
;
private
set
;
}
public
GameClient
Game
{
get
;
private
set
;
}
public
CoreClient
Connection
{
get
;
private
set
;
}
public
Duel
Duel
{
get
;
private
set
;
}
public
Duel
Duel
{
get
;
private
set
;
}
public
Executor
Executor
{
get
;
set
;
}
public
Executor
Executor
{
get
;
set
;
}
public
AIFunctions
Utils
{
get
;
private
set
;
}
public
AIFunctions
Utils
{
get
;
private
set
;
}
...
@@ -18,7 +16,6 @@ namespace WindBot.Game
...
@@ -18,7 +16,6 @@ namespace WindBot.Game
public
GameAI
(
GameClient
game
,
Duel
duel
)
public
GameAI
(
GameClient
game
,
Duel
duel
)
{
{
Game
=
game
;
Game
=
game
;
Connection
=
game
.
Connection
;
Duel
=
duel
;
Duel
=
duel
;
Utils
=
new
AIFunctions
(
duel
);
Utils
=
new
AIFunctions
(
duel
);
...
...
Game/GameBehavior.cs
View file @
fabdff0e
This diff is collapsed.
Click to expand it.
Game/GameClient.cs
View file @
fabdff0e
using
System.Text
;
using
System.IO
;
using
System.Net
;
using
System.Text
;
using
YGOSharp.Network
;
using
YGOSharp.Network
;
using
YGOSharp.Network.Enums
;
using
YGOSharp.Network.Enums
;
using
YGOSharp.Network.Utils
;
namespace
WindBot.Game
namespace
WindBot.Game
{
{
public
class
GameClient
public
class
GameClient
{
{
public
Core
Client
Connection
{
get
;
private
set
;
}
public
YGO
Client
Connection
{
get
;
private
set
;
}
public
string
Username
;
public
string
Username
;
public
string
Deck
;
public
string
Deck
;
...
@@ -27,40 +30,45 @@ namespace WindBot.Game
...
@@ -27,40 +30,45 @@ namespace WindBot.Game
public
void
Start
()
public
void
Start
()
{
{
Connection
=
new
CoreClient
(
_serverHost
,
_serverPort
);
Connection
=
new
YGOClient
();
Connection
.
MessageReceived
+=
OnMessageReceived
;
_behavior
=
new
GameBehavior
(
this
);
_behavior
=
new
GameBehavior
(
this
);
GamePacketWriter
packet
=
new
GamePacketWriter
(
CtosMessage
.
PlayerInfo
);
Connection
.
Connected
+=
OnConnected
;
packet
.
Write
(
Username
,
20
);
Connection
.
PacketReceived
+=
OnPacketReceived
;
Connection
.
Connect
(
IPAddress
.
Parse
(
_serverHost
),
_serverPort
);
}
private
void
OnConnected
()
{
BinaryWriter
packet
=
GamePacketFactory
.
Create
(
CtosMessage
.
PlayerInfo
);
packet
.
WriteUnicode
(
Username
,
Program
.
PlayerNameSize
);
Connection
.
Send
(
packet
);
Connection
.
Send
(
packet
);
byte
[]
junk
=
{
0xCC
,
0xCC
,
0x00
,
0x00
,
0x00
,
0x00
};
byte
[]
junk
=
{
0xCC
,
0xCC
,
0x00
,
0x00
,
0x00
,
0x00
};
packet
=
new
GamePacketWriter
(
CtosMessage
.
JoinGame
);
packet
=
GamePacketFactory
.
Create
(
CtosMessage
.
JoinGame
);
packet
.
Write
(
Program
.
ProVersion
);
packet
.
Write
(
Program
.
ProVersion
);
packet
.
Write
(
junk
);
packet
.
Write
(
junk
);
packet
.
Write
(
_roomInfos
,
30
);
packet
.
Write
Unicode
(
_roomInfos
,
30
);
Connection
.
Send
(
packet
);
Connection
.
Send
(
packet
);
}
}
public
void
Tick
()
public
void
Tick
()
{
{
Connection
.
UpdateNetwork
();
Connection
.
Update
();
Connection
.
Update
();
}
}
public
void
Chat
(
string
message
)
public
void
Chat
(
string
message
)
{
{
byte
[]
content
=
Encoding
.
Unicode
.
GetBytes
(
message
+
"\0"
);
byte
[]
content
=
Encoding
.
Unicode
.
GetBytes
(
message
+
"\0"
);
GamePacketWriter
chat
=
new
GamePacketWriter
(
CtosMessage
.
Chat
);
BinaryWriter
chat
=
GamePacketFactory
.
Create
(
CtosMessage
.
Chat
);
chat
.
Write
(
content
);
chat
.
Write
(
content
);
Connection
.
Send
(
chat
);
Connection
.
Send
(
chat
);
}
}
private
void
On
MessageReceived
(
object
sender
,
MessageEventArgs
e
)
private
void
On
PacketReceived
(
BinaryReader
reader
)
{
{
_behavior
.
OnPacket
(
e
.
Message
);
_behavior
.
OnPacket
(
reader
);
}
}
}
}
}
}
\ No newline at end of file
Game/GamePacketFactory.cs
0 → 100644
View file @
fabdff0e
using
System.IO
;
using
YGOSharp.Network.Enums
;
namespace
WindBot.Game
{
public
class
GamePacketFactory
{
public
static
BinaryWriter
Create
(
CtosMessage
message
)
{
BinaryWriter
writer
=
new
BinaryWriter
(
new
MemoryStream
());
writer
.
Write
((
byte
)
message
);
return
writer
;
}
}
}
Program.cs
View file @
fabdff0e
...
@@ -10,6 +10,7 @@ namespace WindBot
...
@@ -10,6 +10,7 @@ namespace WindBot
public
class
Program
public
class
Program
{
{
public
static
short
ProVersion
=
Int16
.
Parse
(
Environment
.
GetEnvironmentVariable
(
"YGOPRO_VERSION"
));
public
static
short
ProVersion
=
Int16
.
Parse
(
Environment
.
GetEnvironmentVariable
(
"YGOPRO_VERSION"
));
public
static
int
PlayerNameSize
=
20
;
internal
static
Random
Rand
;
internal
static
Random
Rand
;
...
...
WindBot.csproj
View file @
fabdff0e
...
@@ -31,6 +31,9 @@
...
@@ -31,6 +31,9 @@
<ErrorReport>
prompt
</ErrorReport>
<ErrorReport>
prompt
</ErrorReport>
<CodeAnalysisRuleSet>
MinimumRecommendedRules.ruleset
</CodeAnalysisRuleSet>
<CodeAnalysisRuleSet>
MinimumRecommendedRules.ruleset
</CodeAnalysisRuleSet>
</PropertyGroup>
</PropertyGroup>
<PropertyGroup>
<StartupObject
/>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<Reference
Include=
"Mono.Data.Sqlite"
>
<Reference
Include=
"Mono.Data.Sqlite"
>
<HintPath>
.\Mono.Data.Sqlite.dll
</HintPath>
<HintPath>
.\Mono.Data.Sqlite.dll
</HintPath>
...
@@ -82,6 +85,7 @@
...
@@ -82,6 +85,7 @@
<Compile
Include=
"Game\GameAI.cs"
/>
<Compile
Include=
"Game\GameAI.cs"
/>
<Compile
Include=
"Game\GameBehavior.cs"
/>
<Compile
Include=
"Game\GameBehavior.cs"
/>
<Compile
Include=
"Game\GameClient.cs"
/>
<Compile
Include=
"Game\GameClient.cs"
/>
<Compile
Include=
"Game\GamePacketFactory.cs"
/>
<Compile
Include=
"Game\MainPhase.cs"
/>
<Compile
Include=
"Game\MainPhase.cs"
/>
<Compile
Include=
"Game\MainPhaseAction.cs"
/>
<Compile
Include=
"Game\MainPhaseAction.cs"
/>
<Compile
Include=
"Game\Room.cs"
/>
<Compile
Include=
"Game\Room.cs"
/>
...
...
YGOSharp.Network.dll
View file @
fabdff0e
No preview for this file type
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