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
alstroemeria-silentlove
windbot
Commits
72c9fbf8
Commit
72c9fbf8
authored
Apr 05, 2018
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add OnSelectUnselectCard from Gideon9212
parent
480c2e12
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
3 deletions
+79
-3
Game/GameAI.cs
Game/GameAI.cs
+5
-3
Game/GameBehavior.cs
Game/GameBehavior.cs
+74
-0
YGOSharp.OCGWrapper.Enums.dll
YGOSharp.OCGWrapper.Enums.dll
+0
-0
YGOSharp.OCGWrapper.dll
YGOSharp.OCGWrapper.dll
+0
-0
No files found.
Game/GameAI.cs
View file @
72c9fbf8
...
...
@@ -220,9 +220,11 @@ namespace WindBot.Game
// Always select the first available cards and choose the minimum.
IList
<
ClientCard
>
selected
=
new
List
<
ClientCard
>();
for
(
int
i
=
0
;
i
<
min
;
++
i
)
selected
.
Add
(
cards
[
i
]);
if
(
cards
.
Count
>=
min
)
{
for
(
int
i
=
0
;
i
<
min
;
++
i
)
selected
.
Add
(
cards
[
i
]);
}
return
selected
;
}
...
...
Game/GameBehavior.cs
View file @
72c9fbf8
...
...
@@ -108,6 +108,7 @@ namespace WindBot.Game
_messages
.
Add
(
GameMessage
.
BecomeTarget
,
OnBecomeTarget
);
_messages
.
Add
(
GameMessage
.
SelectBattleCmd
,
OnSelectBattleCmd
);
_messages
.
Add
(
GameMessage
.
SelectCard
,
OnSelectCard
);
_messages
.
Add
(
GameMessage
.
SelectUnselectCard
,
OnSelectUnselectCard
);
_messages
.
Add
(
GameMessage
.
SelectChain
,
OnSelectChain
);
_messages
.
Add
(
GameMessage
.
SelectCounter
,
OnSelectCounter
);
_messages
.
Add
(
GameMessage
.
SelectDisfield
,
OnSelectDisfield
);
...
...
@@ -750,11 +751,84 @@ namespace WindBot.Game
Connection
.
Send
(
reply
);
}
private
void
InternalOnSelectUnselectCard
(
BinaryReader
packet
,
Func
<
IList
<
ClientCard
>,
int
,
int
,
int
,
bool
,
IList
<
ClientCard
>>
func
)
{
packet
.
ReadByte
();
// player
packet
.
ReadByte
();
// buttonok
bool
cancelable
=
packet
.
ReadByte
()
!=
0
;
int
min
=
packet
.
ReadByte
();
int
max
=
packet
.
ReadByte
();
IList
<
ClientCard
>
cards
=
new
List
<
ClientCard
>();
int
count
=
packet
.
ReadByte
();
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
int
id
=
packet
.
ReadInt32
();
int
player
=
GetLocalPlayer
(
packet
.
ReadByte
());
CardLocation
loc
=
(
CardLocation
)
packet
.
ReadByte
();
int
seq
=
packet
.
ReadByte
();
packet
.
ReadByte
();
// pos
ClientCard
card
;
if
(((
int
)
loc
&
(
int
)
CardLocation
.
Overlay
)
!=
0
)
card
=
new
ClientCard
(
id
,
CardLocation
.
Overlay
);
else
card
=
_duel
.
GetCard
(
player
,
loc
,
seq
);
if
(
card
==
null
)
continue
;
if
(
card
.
Id
==
0
)
card
.
SetId
(
id
);
cards
.
Add
(
card
);
}
int
count2
=
packet
.
ReadByte
();
for
(
int
i
=
0
;
i
<
count2
;
++
i
)
{
int
id
=
packet
.
ReadInt32
();
int
player
=
GetLocalPlayer
(
packet
.
ReadByte
());
CardLocation
loc
=
(
CardLocation
)
packet
.
ReadByte
();
int
seq
=
packet
.
ReadByte
();
packet
.
ReadByte
();
// pos
}
IList
<
ClientCard
>
selected
=
func
(
cards
,
min
,
max
,
_select_hint
,
cancelable
);
_select_hint
=
0
;
if
(
selected
.
Count
==
0
&&
cancelable
)
{
Connection
.
Send
(
CtosMessage
.
Response
,
-
1
);
return
;
}
byte
[]
result
=
new
byte
[
selected
.
Count
+
1
];
result
[
0
]
=
(
byte
)
selected
.
Count
;
for
(
int
i
=
0
;
i
<
selected
.
Count
;
++
i
)
{
int
id
=
0
;
for
(
int
j
=
0
;
j
<
count
;
++
j
)
{
if
(
cards
[
j
]
==
null
)
continue
;
if
(
cards
[
j
].
Equals
(
selected
[
i
]))
{
id
=
j
;
break
;
}
}
result
[
i
+
1
]
=
(
byte
)
id
;
}
BinaryWriter
reply
=
GamePacketFactory
.
Create
(
CtosMessage
.
Response
);
reply
.
Write
(
result
);
Connection
.
Send
(
reply
);
}
private
void
OnSelectCard
(
BinaryReader
packet
)
{
InternalOnSelectCard
(
packet
,
_ai
.
OnSelectCard
);
}
private
void
OnSelectUnselectCard
(
BinaryReader
packet
)
{
InternalOnSelectUnselectCard
(
packet
,
_ai
.
OnSelectCard
);
}
private
void
OnSelectChain
(
BinaryReader
packet
)
{
packet
.
ReadByte
();
// player
...
...
YGOSharp.OCGWrapper.Enums.dll
View file @
72c9fbf8
No preview for this file type
YGOSharp.OCGWrapper.dll
View file @
72c9fbf8
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