Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro-2pick
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
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
MyCard
ygopro-2pick
Commits
d3b1a797
Commit
d3b1a797
authored
Oct 07, 2017
by
Momobako
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
selectunselect
parent
b36211be
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
366 additions
and
20 deletions
+366
-20
gframe/client_field.cpp
gframe/client_field.cpp
+23
-19
gframe/client_field.h
gframe/client_field.h
+1
-0
gframe/duelclient.cpp
gframe/duelclient.cpp
+81
-1
gframe/event_handler.cpp
gframe/event_handler.cpp
+47
-0
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+9
-0
gframe/single_duel.cpp
gframe/single_duel.cpp
+28
-0
gframe/single_mode.cpp
gframe/single_mode.cpp
+13
-0
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+28
-0
ocgcore/field.h
ocgcore/field.h
+7
-0
ocgcore/interpreter.cpp
ocgcore/interpreter.cpp
+1
-0
ocgcore/libgroup.cpp
ocgcore/libgroup.cpp
+48
-0
ocgcore/playerop.cpp
ocgcore/playerop.cpp
+50
-0
ocgcore/processor.cpp
ocgcore/processor.cpp
+29
-0
ocgcore/scriptlib.h
ocgcore/scriptlib.h
+1
-0
No files found.
gframe/client_field.cpp
View file @
d3b1a797
...
@@ -406,6 +406,9 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
...
@@ -406,6 +406,9 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
selectable_cards
[
i
]
->
sequence
+
1
);
selectable_cards
[
i
]
->
sequence
+
1
);
mainGame
->
stCardPos
[
i
]
->
setText
(
formatBuffer
);
mainGame
->
stCardPos
[
i
]
->
setText
(
formatBuffer
);
// color
// color
if
(
selectable_cards
[
i
]
->
is_selected
)
mainGame
->
stCardPos
[
i
]
->
setBackgroundColor
(
0xffffff00
);
else
{
if
(
conti_selecting
)
if
(
conti_selecting
)
mainGame
->
stCardPos
[
i
]
->
setBackgroundColor
(
0xffffffff
);
mainGame
->
stCardPos
[
i
]
->
setBackgroundColor
(
0xffffffff
);
else
if
(
selectable_cards
[
i
]
->
location
==
LOCATION_OVERLAY
)
{
else
if
(
selectable_cards
[
i
]
->
location
==
LOCATION_OVERLAY
)
{
...
@@ -427,6 +430,7 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
...
@@ -427,6 +430,7 @@ void ClientField::ShowSelectCard(bool buttonok, bool chain) {
else
else
mainGame
->
stCardPos
[
i
]
->
setBackgroundColor
(
0xffffffff
);
mainGame
->
stCardPos
[
i
]
->
setBackgroundColor
(
0xffffffff
);
}
}
}
}
else
{
}
else
{
if
(
sort_list
[
i
])
{
if
(
sort_list
[
i
])
{
wchar_t
formatBuffer
[
2048
];
wchar_t
formatBuffer
[
2048
];
...
...
gframe/client_field.h
View file @
d3b1a797
...
@@ -64,6 +64,7 @@ public:
...
@@ -64,6 +64,7 @@ public:
int
select_counter_type
;
int
select_counter_type
;
std
::
vector
<
ClientCard
*>
selectable_cards
;
std
::
vector
<
ClientCard
*>
selectable_cards
;
std
::
vector
<
ClientCard
*>
selected_cards
;
std
::
vector
<
ClientCard
*>
selected_cards
;
std
::
vector
<
ClientCard
*>
unselected_cards
;
std
::
set
<
ClientCard
*>
selectsum_cards
;
std
::
set
<
ClientCard
*>
selectsum_cards
;
std
::
vector
<
ClientCard
*>
selectsum_all
;
std
::
vector
<
ClientCard
*>
selectsum_all
;
std
::
vector
<
int
>
opcode
;
std
::
vector
<
int
>
opcode
;
...
...
gframe/duelclient.cpp
View file @
d3b1a797
...
@@ -1252,6 +1252,85 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
...
@@ -1252,6 +1252,85 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
}
return
false
;
return
false
;
}
}
case
MSG_SELECT_UNSELECT_CARD
:
{
/*int selecting_player = */
BufferIO
::
ReadInt8
(
pbuf
);
bool
buttonok
=
BufferIO
::
ReadInt8
(
pbuf
);
mainGame
->
dField
.
select_cancelable
=
BufferIO
::
ReadInt8
(
pbuf
);
mainGame
->
dField
.
select_min
=
BufferIO
::
ReadInt8
(
pbuf
);
mainGame
->
dField
.
select_max
=
BufferIO
::
ReadInt8
(
pbuf
);
int
count1
=
BufferIO
::
ReadInt8
(
pbuf
);
mainGame
->
dField
.
selectable_cards
.
clear
();
mainGame
->
dField
.
selected_cards
.
clear
();
mainGame
->
dField
.
unselected_cards
.
clear
();
int
c
,
l
,
s
,
ss
;
unsigned
int
code
;
bool
panelmode
=
false
;
mainGame
->
dField
.
select_ready
=
false
;
ClientCard
*
pcard
;
for
(
int
i
=
0
;
i
<
count1
;
++
i
)
{
code
=
(
unsigned
int
)
BufferIO
::
ReadInt32
(
pbuf
);
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
l
=
BufferIO
::
ReadInt8
(
pbuf
);
s
=
BufferIO
::
ReadInt8
(
pbuf
);
ss
=
BufferIO
::
ReadInt8
(
pbuf
);
if
((
l
&
LOCATION_OVERLAY
)
>
0
)
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
&
0x7f
,
s
)
->
overlayed
[
ss
];
else
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
);
if
(
code
!=
0
&&
pcard
->
code
!=
code
)
pcard
->
SetCode
(
code
);
pcard
->
select_seq
=
i
;
mainGame
->
dField
.
selectable_cards
.
push_back
(
pcard
);
pcard
->
is_selectable
=
true
;
pcard
->
is_selected
=
false
;
if
(
l
&
0xf1
)
panelmode
=
true
;
}
int
count2
=
BufferIO
::
ReadInt8
(
pbuf
);
for
(
int
i
=
count1
;
i
<
count1
+
count2
;
++
i
)
{
code
=
(
unsigned
int
)
BufferIO
::
ReadInt32
(
pbuf
);
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
l
=
BufferIO
::
ReadInt8
(
pbuf
);
s
=
BufferIO
::
ReadInt8
(
pbuf
);
ss
=
BufferIO
::
ReadInt8
(
pbuf
);
if
((
l
&
LOCATION_OVERLAY
)
>
0
)
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
&
0x7f
,
s
)
->
overlayed
[
ss
];
else
pcard
=
mainGame
->
dField
.
GetCard
(
c
,
l
,
s
);
if
(
code
!=
0
&&
pcard
->
code
!=
code
)
pcard
->
SetCode
(
code
);
pcard
->
select_seq
=
i
;
mainGame
->
dField
.
selectable_cards
.
push_back
(
pcard
);
pcard
->
is_selectable
=
true
;
pcard
->
is_selected
=
true
;
if
(
l
&
0xf1
)
panelmode
=
true
;
}
std
::
sort
(
mainGame
->
dField
.
selectable_cards
.
begin
(),
mainGame
->
dField
.
selectable_cards
.
end
(),
ClientCard
::
client_card_sort
);
if
(
select_hint
)
myswprintf
(
textBuffer
,
L"%ls(%d-%d)"
,
dataManager
.
GetDesc
(
select_hint
),
mainGame
->
dField
.
select_min
,
mainGame
->
dField
.
select_max
);
else
myswprintf
(
textBuffer
,
L"%ls(%d-%d)"
,
dataManager
.
GetSysString
(
560
),
mainGame
->
dField
.
select_min
,
mainGame
->
dField
.
select_max
);
select_hint
=
0
;
if
(
panelmode
)
{
mainGame
->
gMutex
.
Lock
();
mainGame
->
wCardSelect
->
setText
(
textBuffer
);
mainGame
->
dField
.
ShowSelectCard
(
buttonok
);
mainGame
->
gMutex
.
Unlock
();
}
else
{
mainGame
->
stHintMsg
->
setText
(
textBuffer
);
mainGame
->
stHintMsg
->
setVisible
(
true
);
}
if
(
mainGame
->
dField
.
select_cancelable
)
{
if
(
count2
==
0
)
mainGame
->
dField
.
ShowCancelOrFinishButton
(
1
);
else
mainGame
->
dField
.
ShowCancelOrFinishButton
(
2
);
}
else
mainGame
->
dField
.
ShowCancelOrFinishButton
(
0
);
return
false
;
}
case
MSG_SELECT_CHAIN
:
{
case
MSG_SELECT_CHAIN
:
{
/*int selecting_player = */
BufferIO
::
ReadInt8
(
pbuf
);
/*int selecting_player = */
BufferIO
::
ReadInt8
(
pbuf
);
int
count
=
BufferIO
::
ReadInt8
(
pbuf
);
int
count
=
BufferIO
::
ReadInt8
(
pbuf
);
...
@@ -3413,7 +3492,8 @@ void DuelClient::SendResponse() {
...
@@ -3413,7 +3492,8 @@ void DuelClient::SendResponse() {
mainGame
->
btnShuffle
->
setVisible
(
false
);
mainGame
->
btnShuffle
->
setVisible
(
false
);
break
;
break
;
}
}
case
MSG_SELECT_CARD
:
{
case
MSG_SELECT_CARD
:
case
MSG_SELECT_UNSELECT_CARD
:
{
mainGame
->
dField
.
ClearSelect
();
mainGame
->
dField
.
ClearSelect
();
break
;
break
;
}
}
...
...
gframe/event_handler.cpp
View file @
d3b1a797
...
@@ -219,6 +219,14 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -219,6 +219,14 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
}
break
;
break
;
}
}
case
MSG_SELECT_UNSELECT_CARD
:
{
DuelClient
::
SetResponseI
(
-
1
);
ShowCancelOrFinishButton
(
0
);
if
(
mainGame
->
wCardSelect
->
isVisible
())
mainGame
->
HideElement
(
mainGame
->
wCardSelect
,
true
);
else
DuelClient
::
SendResponse
();
}
case
MSG_SELECT_TRIBUTE
:
{
case
MSG_SELECT_TRIBUTE
:
{
if
(
selected_cards
.
size
()
==
0
)
{
if
(
selected_cards
.
size
()
==
0
)
{
if
(
select_cancelable
)
{
if
(
select_cancelable
)
{
...
@@ -783,6 +791,24 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -783,6 +791,24 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
}
break
;
break
;
}
}
case
MSG_SELECT_UNSELECT_CARD
:
{
command_card
=
selectable_cards
[
id
-
BUTTON_CARD_0
+
mainGame
->
scrCardList
->
getPos
()
/
10
];
if
(
command_card
->
is_selected
)
{
command_card
->
is_selected
=
false
;
if
(
command_card
->
controler
)
mainGame
->
stCardPos
[
id
-
BUTTON_CARD_0
]
->
setBackgroundColor
(
0xffd0d0d0
);
else
mainGame
->
stCardPos
[
id
-
BUTTON_CARD_0
]
->
setBackgroundColor
(
0xffffffff
);
}
else
{
command_card
->
is_selected
=
true
;
mainGame
->
stCardPos
[
id
-
BUTTON_CARD_0
]
->
setBackgroundColor
(
0xffffff00
);
}
selected_cards
.
push_back
(
command_card
);
if
(
selected_cards
.
size
()
>
0
)
{
SetResponseSelectedCards
();
ShowCancelOrFinishButton
(
0
);
mainGame
->
HideElement
(
mainGame
->
wCardSelect
,
true
);}
break
;
}
case
MSG_SELECT_SUM
:
{
case
MSG_SELECT_SUM
:
{
command_card
=
selectable_cards
[
id
-
BUTTON_CARD_0
+
mainGame
->
scrCardList
->
getPos
()
/
10
];
command_card
=
selectable_cards
[
id
-
BUTTON_CARD_0
+
mainGame
->
scrCardList
->
getPos
()
/
10
];
selected_cards
.
push_back
(
command_card
);
selected_cards
.
push_back
(
command_card
);
...
@@ -844,6 +870,10 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -844,6 +870,10 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame
->
HideElement
(
mainGame
->
wCardSelect
);
mainGame
->
HideElement
(
mainGame
->
wCardSelect
);
mainGame
->
actionSignal
.
Set
();
mainGame
->
actionSignal
.
Set
();
break
;
break
;
}
else
if
(
mainGame
->
dInfo
.
curMsg
==
MSG_SELECT_UNSELECT_CARD
){
DuelClient
::
SetResponseI
(
-
1
);
ShowCancelOrFinishButton
(
0
);
mainGame
->
HideElement
(
mainGame
->
wCardSelect
,
true
);
}
else
{
}
else
{
mainGame
->
HideElement
(
mainGame
->
wCardSelect
);
mainGame
->
HideElement
(
mainGame
->
wCardSelect
);
if
(
mainGame
->
dInfo
.
curMsg
==
MSG_SELECT_CHAIN
&&
!
chain_forced
)
if
(
mainGame
->
dInfo
.
curMsg
==
MSG_SELECT_CHAIN
&&
!
chain_forced
)
...
@@ -1438,6 +1468,22 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -1438,6 +1468,22 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
}
break
;
break
;
}
}
case
MSG_SELECT_UNSELECT_CARD
:
{
if
(
!
(
hovered_location
&
0xe
)
||
!
clicked_card
||
!
clicked_card
->
is_selectable
)
break
;
if
(
clicked_card
->
is_selected
)
{
clicked_card
->
is_selected
=
false
;
}
else
{
clicked_card
->
is_selected
=
true
;
}
selected_cards
.
push_back
(
clicked_card
);
if
(
selected_cards
.
size
()
>
0
)
{
ShowCancelOrFinishButton
(
0
);
SetResponseSelectedCards
();
DuelClient
::
SendResponse
();
}
break
;
}
case
MSG_SELECT_COUNTER
:
{
case
MSG_SELECT_COUNTER
:
{
if
(
!
clicked_card
||
!
clicked_card
->
is_selectable
)
if
(
!
clicked_card
||
!
clicked_card
->
is_selectable
)
break
;
break
;
...
@@ -1533,6 +1579,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
...
@@ -1533,6 +1579,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame
->
HideElement
(
mainGame
->
wQuery
,
true
);
mainGame
->
HideElement
(
mainGame
->
wQuery
,
true
);
break
;
break
;
}
}
case
MSG_SELECT_UNSELECT_CARD
:
case
MSG_SELECT_CARD
:
{
case
MSG_SELECT_CARD
:
{
if
(
selected_cards
.
size
()
==
0
)
{
if
(
selected_cards
.
size
()
==
0
)
{
if
(
select_cancelable
)
{
if
(
select_cancelable
)
{
...
...
gframe/replay_mode.cpp
View file @
d3b1a797
...
@@ -395,6 +395,15 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
...
@@ -395,6 +395,15 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
pbuf
+=
count
*
8
;
pbuf
+=
count
*
8
;
return
ReadReplayResponse
();
return
ReadReplayResponse
();
}
}
case
MSG_SELECT_UNSELECT_CARD
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
pbuf
+=
4
;
count
=
BufferIO
::
ReadInt8
(
pbuf
);
pbuf
+=
count
*
8
;
count
=
BufferIO
::
ReadInt8
(
pbuf
);
pbuf
+=
count
*
8
;
return
ReadReplayResponse
();
}
case
MSG_SELECT_CHAIN
:
{
case
MSG_SELECT_CHAIN
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
player
=
BufferIO
::
ReadInt8
(
pbuf
);
count
=
BufferIO
::
ReadInt8
(
pbuf
);
count
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
gframe/single_duel.cpp
View file @
d3b1a797
...
@@ -849,6 +849,34 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) {
...
@@ -849,6 +849,34 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) {
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
return
1
;
}
}
case
MSG_SELECT_UNSELECT_CARD
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
pbuf
+=
4
;
count
=
BufferIO
::
ReadInt8
(
pbuf
);
int
c
/*, l, s, ss, code*/
;
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
pbufw
=
pbuf
;
/*code = */
BufferIO
::
ReadInt32
(
pbuf
);
c
=
BufferIO
::
ReadInt8
(
pbuf
);
/*l = */
BufferIO
::
ReadInt8
(
pbuf
);
/*s = */
BufferIO
::
ReadInt8
(
pbuf
);
/*ss = */
BufferIO
::
ReadInt8
(
pbuf
);
if
(
c
!=
player
)
BufferIO
::
WriteInt32
(
pbufw
,
0
);
}
count
=
BufferIO
::
ReadInt8
(
pbuf
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
pbufw
=
pbuf
;
/*code = */
BufferIO
::
ReadInt32
(
pbuf
);
c
=
BufferIO
::
ReadInt8
(
pbuf
);
/*l = */
BufferIO
::
ReadInt8
(
pbuf
);
/*s = */
BufferIO
::
ReadInt8
(
pbuf
);
/*ss = */
BufferIO
::
ReadInt8
(
pbuf
);
if
(
c
!=
player
)
BufferIO
::
WriteInt32
(
pbufw
,
0
);
}
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_SELECT_CHAIN
:
{
case
MSG_SELECT_CHAIN
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
player
=
BufferIO
::
ReadInt8
(
pbuf
);
count
=
BufferIO
::
ReadInt8
(
pbuf
);
count
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
gframe/single_mode.cpp
View file @
d3b1a797
...
@@ -223,6 +223,19 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
...
@@ -223,6 +223,19 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
}
}
break
;
break
;
}
}
case
MSG_SELECT_UNSELECT_CARD
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
pbuf
+=
4
;
count
=
BufferIO
::
ReadInt8
(
pbuf
);
pbuf
+=
count
*
8
;
count
=
BufferIO
::
ReadInt8
(
pbuf
);
pbuf
+=
count
*
8
;
if
(
!
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
))
{
mainGame
->
singleSignal
.
Reset
();
mainGame
->
singleSignal
.
Wait
();
}
break
;
}
case
MSG_SELECT_CHAIN
:
{
case
MSG_SELECT_CHAIN
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
player
=
BufferIO
::
ReadInt8
(
pbuf
);
count
=
BufferIO
::
ReadInt8
(
pbuf
);
count
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
gframe/tag_duel.cpp
View file @
d3b1a797
...
@@ -769,6 +769,34 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
...
@@ -769,6 +769,34 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
return
1
;
}
}
case
MSG_SELECT_UNSELECT_CARD
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
pbuf
+=
4
;
count
=
BufferIO
::
ReadInt8
(
pbuf
);
int
c
/*, l, s, ss, code*/
;
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
pbufw
=
pbuf
;
/*code = */
BufferIO
::
ReadInt32
(
pbuf
);
c
=
BufferIO
::
ReadInt8
(
pbuf
);
/*l = */
BufferIO
::
ReadInt8
(
pbuf
);
/*s = */
BufferIO
::
ReadInt8
(
pbuf
);
/*ss = */
BufferIO
::
ReadInt8
(
pbuf
);
if
(
c
!=
player
)
BufferIO
::
WriteInt32
(
pbufw
,
0
);
}
count
=
BufferIO
::
ReadInt8
(
pbuf
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
pbufw
=
pbuf
;
/*code = */
BufferIO
::
ReadInt32
(
pbuf
);
c
=
BufferIO
::
ReadInt8
(
pbuf
);
/*l = */
BufferIO
::
ReadInt8
(
pbuf
);
/*s = */
BufferIO
::
ReadInt8
(
pbuf
);
/*ss = */
BufferIO
::
ReadInt8
(
pbuf
);
if
(
c
!=
player
)
BufferIO
::
WriteInt32
(
pbufw
,
0
);
}
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_SELECT_CHAIN
:
{
case
MSG_SELECT_CHAIN
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
player
=
BufferIO
::
ReadInt8
(
pbuf
);
count
=
BufferIO
::
ReadInt8
(
pbuf
);
count
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
ocgcore/field.h
View file @
d3b1a797
...
@@ -171,6 +171,7 @@ struct processor {
...
@@ -171,6 +171,7 @@ struct processor {
processor_list
subunits
;
processor_list
subunits
;
processor_unit
reserved
;
processor_unit
reserved
;
card_vector
select_cards
;
card_vector
select_cards
;
card_vector
unselect_cards
;
card_vector
summonable_cards
;
card_vector
summonable_cards
;
card_vector
spsummonable_cards
;
card_vector
spsummonable_cards
;
card_vector
repositionable_cards
;
card_vector
repositionable_cards
;
...
@@ -573,6 +574,7 @@ public:
...
@@ -573,6 +574,7 @@ public:
int32
select_yes_no
(
uint16
step
,
uint8
playerid
,
uint32
description
);
int32
select_yes_no
(
uint16
step
,
uint8
playerid
,
uint32
description
);
int32
select_option
(
uint16
step
,
uint8
playerid
);
int32
select_option
(
uint16
step
,
uint8
playerid
);
int32
select_card
(
uint16
step
,
uint8
playerid
,
uint8
cancelable
,
uint8
min
,
uint8
max
);
int32
select_card
(
uint16
step
,
uint8
playerid
,
uint8
cancelable
,
uint8
min
,
uint8
max
);
int32
select_unselect_card
(
uint16
step
,
uint8
playerid
,
uint8
cancelable
,
uint8
min
,
uint8
max
,
uint8
ok
);
int32
select_chain
(
uint16
step
,
uint8
playerid
,
uint8
spe_count
,
uint8
forced
);
int32
select_chain
(
uint16
step
,
uint8
playerid
,
uint8
spe_count
,
uint8
forced
);
int32
select_place
(
uint16
step
,
uint8
playerid
,
uint32
flag
,
uint8
count
);
int32
select_place
(
uint16
step
,
uint8
playerid
,
uint32
flag
,
uint8
count
);
int32
select_position
(
uint16
step
,
uint8
playerid
,
uint32
code
,
uint8
positions
);
int32
select_position
(
uint16
step
,
uint8
playerid
,
uint32
code
,
uint8
positions
);
...
@@ -763,6 +765,9 @@ public:
...
@@ -763,6 +765,9 @@ public:
#define PROCESSOR_REMOVEOL_S 160
#define PROCESSOR_REMOVEOL_S 160
#define PROCESSOR_MOVETOFIELD_S 161
#define PROCESSOR_MOVETOFIELD_S 161
#define PROCESSOR_SELECT_UNSELECT_CARD 180
#define PROCESSOR_SELECT_UNSELECT_CARD_S 181
//Hints
//Hints
#define HINT_EVENT 1
#define HINT_EVENT 1
#define HINT_MESSAGE 2
#define HINT_MESSAGE 2
...
@@ -895,4 +900,6 @@ public:
...
@@ -895,4 +900,6 @@ public:
#define MSG_PLAYER_HINT 165
#define MSG_PLAYER_HINT 165
#define MSG_MATCH_KILL 170
#define MSG_MATCH_KILL 170
#define MSG_CUSTOM_MSG 180
#define MSG_CUSTOM_MSG 180
#define MSG_SELECT_UNSELECT_CARD 190
#endif
/* FIELD_H_ */
#endif
/* FIELD_H_ */
ocgcore/interpreter.cpp
View file @
d3b1a797
...
@@ -337,6 +337,7 @@ static const struct luaL_Reg grouplib[] = {
...
@@ -337,6 +337,7 @@ static const struct luaL_Reg grouplib[] = {
{
"FilterCount"
,
scriptlib
::
group_filter_count
},
{
"FilterCount"
,
scriptlib
::
group_filter_count
},
{
"FilterSelect"
,
scriptlib
::
group_filter_select
},
{
"FilterSelect"
,
scriptlib
::
group_filter_select
},
{
"Select"
,
scriptlib
::
group_select
},
{
"Select"
,
scriptlib
::
group_select
},
{
"SelectUnselect"
,
scriptlib
::
group_select_unselect
},
{
"RandomSelect"
,
scriptlib
::
group_random_select
},
{
"RandomSelect"
,
scriptlib
::
group_random_select
},
{
"IsExists"
,
scriptlib
::
group_is_exists
},
{
"IsExists"
,
scriptlib
::
group_is_exists
},
{
"CheckWithSumEqual"
,
scriptlib
::
group_check_with_sum_equal
},
{
"CheckWithSumEqual"
,
scriptlib
::
group_check_with_sum_equal
},
...
...
ocgcore/libgroup.cpp
View file @
d3b1a797
...
@@ -244,6 +244,54 @@ int32 scriptlib::group_select(lua_State *L) {
...
@@ -244,6 +244,54 @@ int32 scriptlib::group_select(lua_State *L) {
pduel
->
game_field
->
add_process
(
PROCESSOR_SELECT_CARD_S
,
0
,
0
,
0
,
playerid
,
min
+
(
max
<<
16
));
pduel
->
game_field
->
add_process
(
PROCESSOR_SELECT_CARD_S
,
0
,
0
,
0
,
playerid
,
min
+
(
max
<<
16
));
return
lua_yield
(
L
,
0
);
return
lua_yield
(
L
,
0
);
}
}
int32
scriptlib
::
group_select_unselect
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_param_count
(
L
,
3
);
check_param
(
L
,
PARAM_TYPE_GROUP
,
1
);
check_param
(
L
,
PARAM_TYPE_GROUP
,
2
);
group
*
pgroup1
=
*
(
group
**
)
lua_touserdata
(
L
,
1
);
group
*
pgroup2
=
*
(
group
**
)
lua_touserdata
(
L
,
2
);
duel
*
pduel
=
pgroup1
->
pduel
;
uint32
playerid
=
lua_tointeger
(
L
,
3
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
for
(
auto
it
=
pgroup2
->
container
.
begin
();
it
!=
pgroup2
->
container
.
end
();
++
it
)
{
card
*
pcard
=
*
it
;
for
(
auto
it2
=
pgroup1
->
container
.
begin
();
it2
!=
pgroup1
->
container
.
end
();
++
it2
)
{
if
((
*
it2
)
==
pcard
)
{
return
0
;
}
}
}
bool
buttonok
=
false
;
if
(
lua_gettop
(
L
)
>
3
)
{
buttonok
=
lua_toboolean
(
L
,
4
);
}
bool
cancelable
=
false
;
if
(
lua_gettop
(
L
)
>
4
)
{
cancelable
=
lua_toboolean
(
L
,
5
);
}
uint32
min
=
1
;
if
(
lua_gettop
(
L
)
>
5
)
{
min
=
lua_tointeger
(
L
,
6
);
}
uint32
max
=
1
;
if
(
lua_gettop
(
L
)
>
6
)
{
max
=
lua_tointeger
(
L
,
7
);
}
if
(
min
>
max
)
min
=
max
;
pduel
->
game_field
->
core
.
select_cards
.
clear
();
pduel
->
game_field
->
core
.
unselect_cards
.
clear
();
for
(
auto
it
=
pgroup1
->
container
.
begin
();
it
!=
pgroup1
->
container
.
end
();
++
it
)
{
pduel
->
game_field
->
core
.
select_cards
.
push_back
(
*
it
);
}
for
(
auto
it
=
pgroup2
->
container
.
begin
();
it
!=
pgroup2
->
container
.
end
();
++
it
)
{
pduel
->
game_field
->
core
.
unselect_cards
.
push_back
(
*
it
);
}
pduel
->
game_field
->
add_process
(
PROCESSOR_SELECT_UNSELECT_CARD_S
,
0
,
0
,
0
,
playerid
+
(
cancelable
<<
16
),
min
+
(
max
<<
16
),
buttonok
);
return
lua_yield
(
L
,
0
);
}
int32
scriptlib
::
group_random_select
(
lua_State
*
L
)
{
int32
scriptlib
::
group_random_select
(
lua_State
*
L
)
{
check_param_count
(
L
,
3
);
check_param_count
(
L
,
3
);
check_param
(
L
,
PARAM_TYPE_GROUP
,
1
);
check_param
(
L
,
PARAM_TYPE_GROUP
,
1
);
...
...
ocgcore/playerop.cpp
View file @
d3b1a797
...
@@ -281,6 +281,56 @@ int32 field::select_card(uint16 step, uint8 playerid, uint8 cancelable, uint8 mi
...
@@ -281,6 +281,56 @@ int32 field::select_card(uint16 step, uint8 playerid, uint8 cancelable, uint8 mi
return
TRUE
;
return
TRUE
;
}
}
}
}
int32
field
::
select_unselect_card
(
uint16
step
,
uint8
playerid
,
uint8
cancelable
,
uint8
min
,
uint8
max
,
uint8
buttonok
)
{
if
(
step
==
0
)
{
returns
.
bvalue
[
0
]
=
0
;
if
(
core
.
select_cards
.
empty
()
&&
core
.
unselect_cards
.
empty
())
return
TRUE
;
if
((
playerid
==
1
)
&&
(
core
.
duel_options
&
DUEL_SIMPLE_AI
))
{
returns
.
bvalue
[
0
]
=
1
;
for
(
uint8
i
=
0
;
i
<
1
;
++
i
)
returns
.
bvalue
[
i
+
1
]
=
i
;
return
TRUE
;
}
pduel
->
write_buffer8
(
MSG_SELECT_UNSELECT_CARD
);
pduel
->
write_buffer8
(
playerid
);
pduel
->
write_buffer8
(
buttonok
);
pduel
->
write_buffer8
(
cancelable
);
pduel
->
write_buffer8
(
min
);
pduel
->
write_buffer8
(
max
);
pduel
->
write_buffer8
(
core
.
select_cards
.
size
());
card
*
pcard
;
std
::
sort
(
core
.
select_cards
.
begin
(),
core
.
select_cards
.
end
(),
card
::
card_operation_sort
);
for
(
uint32
i
=
0
;
i
<
core
.
select_cards
.
size
();
++
i
)
{
pcard
=
core
.
select_cards
[
i
];
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
get_info_location
());
}
pduel
->
write_buffer8
(
core
.
unselect_cards
.
size
());
for
(
uint32
i
=
0
;
i
<
core
.
unselect_cards
.
size
();
++
i
)
{
pcard
=
core
.
unselect_cards
[
i
];
pduel
->
write_buffer32
(
pcard
->
data
.
code
);
pduel
->
write_buffer32
(
pcard
->
get_info_location
());
}
return
FALSE
;
}
else
{
if
(
returns
.
ivalue
[
0
]
==
-
1
)
return
TRUE
;
byte
c
[
64
];
memset
(
c
,
0
,
64
);
uint8
m
=
core
.
select_cards
.
size
()
+
core
.
unselect_cards
.
size
(),
v
=
0
;
for
(
int32
i
=
0
;
i
<
returns
.
bvalue
[
0
];
++
i
)
{
v
=
returns
.
bvalue
[
i
+
1
];
if
(
v
<
0
||
v
>=
m
||
v
>=
63
||
c
[
v
])
{
pduel
->
write_buffer8
(
MSG_RETRY
);
return
FALSE
;
}
c
[
v
]
=
1
;
}
return
TRUE
;
}
}
int32
field
::
select_chain
(
uint16
step
,
uint8
playerid
,
uint8
spe_count
,
uint8
forced
)
{
int32
field
::
select_chain
(
uint16
step
,
uint8
playerid
,
uint8
spe_count
,
uint8
forced
)
{
if
(
step
==
0
)
{
if
(
step
==
0
)
{
returns
.
ivalue
[
0
]
=
-
1
;
returns
.
ivalue
[
0
]
=
-
1
;
...
...
ocgcore/processor.cpp
View file @
d3b1a797
...
@@ -115,6 +115,15 @@ int32 field::process() {
...
@@ -115,6 +115,15 @@ int32 field::process() {
return
PROCESSOR_WAITING
+
pduel
->
bufferlen
;
return
PROCESSOR_WAITING
+
pduel
->
bufferlen
;
}
}
}
}
case
PROCESSOR_SELECT_UNSELECT_CARD
:
{
if
(
select_unselect_card
(
it
->
step
,
it
->
arg1
&
0xff
,
(
it
->
arg1
>>
16
)
&
0xff
,
(
it
->
arg2
)
&
0xff
,
(
it
->
arg2
>>
16
)
&
0xff
,
(
it
->
arg3
)
&
0xff
))
{
core
.
units
.
pop_front
();
return
pduel
->
bufferlen
;
}
else
{
it
->
step
=
1
;
return
PROCESSOR_WAITING
+
pduel
->
bufferlen
;
}
}
case
PROCESSOR_SELECT_CHAIN
:
{
case
PROCESSOR_SELECT_CHAIN
:
{
if
(
select_chain
(
it
->
step
,
it
->
arg1
,
(
it
->
arg2
&
0xffff
),
it
->
arg2
>>
16
))
{
if
(
select_chain
(
it
->
step
,
it
->
arg1
,
(
it
->
arg2
&
0xffff
),
it
->
arg2
>>
16
))
{
core
.
units
.
pop_front
();
core
.
units
.
pop_front
();
...
@@ -682,6 +691,26 @@ int32 field::process() {
...
@@ -682,6 +691,26 @@ int32 field::process() {
}
}
return
pduel
->
bufferlen
;
return
pduel
->
bufferlen
;
}
}
case
PROCESSOR_SELECT_UNSELECT_CARD_S
:
{
if
(
it
->
step
==
0
)
{
add_process
(
PROCESSOR_SELECT_UNSELECT_CARD
,
0
,
it
->
peffect
,
it
->
ptarget
,
it
->
arg1
,
it
->
arg2
,
it
->
arg3
);
it
->
step
++
;
}
else
{
if
(
returns
.
bvalue
[
0
]
==
-
1
)
pduel
->
lua
->
add_param
((
void
*
)
0
,
PARAM_TYPE_GROUP
);
else
{
group
*
pgroup
=
pduel
->
new_group
();
card
*
pcard
;
if
(
returns
.
bvalue
[
1
]
<
core
.
select_cards
.
size
())
pcard
=
core
.
select_cards
[
returns
.
bvalue
[
1
]];
else
pcard
=
core
.
unselect_cards
[
returns
.
bvalue
[
1
]
-
core
.
select_cards
.
size
()];
pduel
->
lua
->
add_param
(
pcard
,
PARAM_TYPE_CARD
);
}
core
.
units
.
pop_front
();
}
return
pduel
->
bufferlen
;
}
case
PROCESSOR_SELECT_POSITION_S
:
{
case
PROCESSOR_SELECT_POSITION_S
:
{
if
(
it
->
step
==
0
)
{
if
(
it
->
step
==
0
)
{
add_process
(
PROCESSOR_SELECT_POSITION
,
0
,
it
->
peffect
,
it
->
ptarget
,
it
->
arg1
,
it
->
arg2
);
add_process
(
PROCESSOR_SELECT_POSITION
,
0
,
it
->
peffect
,
it
->
ptarget
,
it
->
arg1
,
it
->
arg2
);
...
...
ocgcore/scriptlib.h
View file @
d3b1a797
...
@@ -338,6 +338,7 @@ public:
...
@@ -338,6 +338,7 @@ public:
static
int32
group_filter_count
(
lua_State
*
L
);
static
int32
group_filter_count
(
lua_State
*
L
);
static
int32
group_filter_select
(
lua_State
*
L
);
static
int32
group_filter_select
(
lua_State
*
L
);
static
int32
group_select
(
lua_State
*
L
);
static
int32
group_select
(
lua_State
*
L
);
static
int32
group_select_unselect
(
lua_State
*
L
);
static
int32
group_random_select
(
lua_State
*
L
);
static
int32
group_random_select
(
lua_State
*
L
);
static
int32
group_is_exists
(
lua_State
*
L
);
static
int32
group_is_exists
(
lua_State
*
L
);
static
int32
group_check_with_sum_equal
(
lua_State
*
L
);
static
int32
group_check_with_sum_equal
(
lua_State
*
L
);
...
...
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