Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
ygopro
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
baichixing
ygopro
Commits
4770a4fb
Commit
4770a4fb
authored
Sep 25, 2016
by
VanillaSalt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update MSG_ANNOUNCE_CARD_FILTER
parent
9808111f
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
212 additions
and
9 deletions
+212
-9
gframe/client_field.cpp
gframe/client_field.cpp
+177
-2
gframe/client_field.h
gframe/client_field.h
+4
-1
gframe/duelclient.cpp
gframe/duelclient.cpp
+21
-0
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+2
-1
gframe/single_duel.cpp
gframe/single_duel.cpp
+2
-1
gframe/single_mode.cpp
gframe/single_mode.cpp
+2
-1
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+2
-1
ocgcore
ocgcore
+1
-1
script
script
+1
-1
No files found.
gframe/client_field.cpp
View file @
4770a4fb
#include <stack>
#include "client_field.h"
#include "client_card.h"
#include "duelclient.h"
...
...
@@ -1329,7 +1330,148 @@ static bool is_declarable(T const& cd, int declarable_type) {
return
cd
.
code
==
CARD_MARINE_DOLPHIN
||
cd
.
code
==
CARD_TWINKLE_MOSS
||
(
!
cd
.
alias
&&
(
cd
.
type
&
(
TYPE_MONSTER
+
TYPE_TOKEN
))
!=
(
TYPE_MONSTER
+
TYPE_TOKEN
));
}
void
ClientField
::
UpdateDeclarableCode
(
bool
enter
)
{
template
<
class
T
>
static
bool
is_declarable
(
T
const
&
cd
,
const
std
::
vector
<
int
>&
opcode
)
{
std
::
stack
<
int
>
stack
;
for
(
auto
it
=
opcode
.
begin
();
it
!=
opcode
.
end
();
++
it
)
{
switch
(
*
it
)
{
case
OPCODE_ADD
:
{
if
(
stack
.
size
()
>=
2
)
{
int
rhs
=
stack
.
top
();
stack
.
pop
();
int
lhs
=
stack
.
top
();
stack
.
pop
();
stack
.
push
(
lhs
+
rhs
);
}
break
;
}
case
OPCODE_SUB
:
{
if
(
stack
.
size
()
>=
2
)
{
int
rhs
=
stack
.
top
();
stack
.
pop
();
int
lhs
=
stack
.
top
();
stack
.
pop
();
stack
.
push
(
lhs
-
rhs
);
}
break
;
}
case
OPCODE_MUL
:
{
if
(
stack
.
size
()
>=
2
)
{
int
rhs
=
stack
.
top
();
stack
.
pop
();
int
lhs
=
stack
.
top
();
stack
.
pop
();
stack
.
push
(
lhs
*
rhs
);
}
break
;
}
case
OPCODE_DIV
:
{
if
(
stack
.
size
()
>=
2
)
{
int
rhs
=
stack
.
top
();
stack
.
pop
();
int
lhs
=
stack
.
top
();
stack
.
pop
();
stack
.
push
(
lhs
/
rhs
);
}
break
;
}
case
OPCODE_AND
:
{
if
(
stack
.
size
()
>=
2
)
{
int
rhs
=
stack
.
top
();
stack
.
pop
();
int
lhs
=
stack
.
top
();
stack
.
pop
();
stack
.
push
(
lhs
&&
rhs
);
}
break
;
}
case
OPCODE_OR
:
{
if
(
stack
.
size
()
>=
2
)
{
int
rhs
=
stack
.
top
();
stack
.
pop
();
int
lhs
=
stack
.
top
();
stack
.
pop
();
stack
.
push
(
lhs
||
rhs
);
}
break
;
}
case
OPCODE_NEG
:
{
if
(
stack
.
size
()
>=
1
)
{
int
val
=
stack
.
top
();
stack
.
pop
();
stack
.
push
(
-
val
);
}
break
;
}
case
OPCODE_NOT
:
{
if
(
stack
.
size
()
>=
1
)
{
int
val
=
stack
.
top
();
stack
.
pop
();
stack
.
push
(
!
val
);
}
break
;
}
case
OPCODE_ISCODE
:
{
if
(
stack
.
size
()
>=
1
)
{
int
code
=
stack
.
top
();
stack
.
pop
();
stack
.
push
(
cd
.
code
==
code
);
}
break
;
}
case
OPCODE_ISSETCARD
:
{
if
(
stack
.
size
()
>=
1
)
{
int
set_code
=
stack
.
top
();
stack
.
pop
();
unsigned
long
long
sc
=
cd
.
setcode
;
bool
res
=
false
;
int
settype
=
set_code
&
0xfff
;
int
setsubtype
=
set_code
&
0xf000
;
while
(
sc
)
{
if
((
sc
&
0xfff
)
==
settype
&&
(
sc
&
0xf000
&
setsubtype
)
==
setsubtype
)
res
=
true
;
sc
=
sc
>>
16
;
}
stack
.
push
(
res
);
}
break
;
}
case
OPCODE_ISTYPE
:
{
if
(
stack
.
size
()
>=
1
)
{
int
val
=
stack
.
top
();
stack
.
pop
();
stack
.
push
(
cd
.
type
&
val
);
}
break
;
}
case
OPCODE_ISRACE
:
{
if
(
stack
.
size
()
>=
1
)
{
int
race
=
stack
.
top
();
stack
.
pop
();
stack
.
push
(
cd
.
race
&
race
);
}
break
;
}
case
OPCODE_ISATTRIBUTE
:
{
if
(
stack
.
size
()
>=
1
)
{
int
attribute
=
stack
.
top
();
stack
.
pop
();
stack
.
push
(
cd
.
attribute
&
attribute
);
}
break
;
}
default:
{
stack
.
push
(
*
it
);
break
;
}
}
}
if
(
stack
.
size
()
!=
1
||
stack
.
top
()
==
0
)
return
false
;
return
cd
.
code
==
CARD_MARINE_DOLPHIN
||
cd
.
code
==
CARD_TWINKLE_MOSS
||
(
!
cd
.
alias
&&
(
cd
.
type
&
(
TYPE_MONSTER
+
TYPE_TOKEN
))
!=
(
TYPE_MONSTER
+
TYPE_TOKEN
));
}
void
ClientField
::
UpdateDeclarableCodeType
(
bool
enter
)
{
const
wchar_t
*
pname
=
mainGame
->
ebANCard
->
getText
();
int
trycode
=
BufferIO
::
GetVal
(
pname
);
CardString
cstr
;
...
...
@@ -1341,7 +1483,7 @@ void ClientField::UpdateDeclarableCode(bool enter) {
ancard
.
push_back
(
trycode
);
return
;
}
if
(
pname
[
0
]
==
0
||
(
pname
[
1
]
==
0
&&
!
enter
)
)
if
(
(
pname
[
0
]
==
0
||
pname
[
1
]
==
0
)
&&
!
enter
)
return
;
mainGame
->
lstANCard
->
clear
();
ancard
.
clear
();
...
...
@@ -1356,4 +1498,37 @@ void ClientField::UpdateDeclarableCode(bool enter) {
}
}
}
void
ClientField
::
UpdateDeclarableCodeOpcode
(
bool
enter
)
{
const
wchar_t
*
pname
=
mainGame
->
ebANCard
->
getText
();
int
trycode
=
BufferIO
::
GetVal
(
pname
);
CardString
cstr
;
CardData
cd
;
if
(
dataManager
.
GetString
(
trycode
,
&
cstr
)
&&
dataManager
.
GetData
(
trycode
,
&
cd
)
&&
is_declarable
(
cd
,
opcode
))
{
mainGame
->
lstANCard
->
clear
();
ancard
.
clear
();
mainGame
->
lstANCard
->
addItem
(
cstr
.
name
);
ancard
.
push_back
(
trycode
);
return
;
}
if
((
pname
[
0
]
==
0
||
pname
[
1
]
==
0
)
&&
!
enter
)
return
;
mainGame
->
lstANCard
->
clear
();
ancard
.
clear
();
for
(
auto
cit
=
dataManager
.
_strings
.
begin
();
cit
!=
dataManager
.
_strings
.
end
();
++
cit
)
{
if
(
wcsstr
(
cit
->
second
.
name
,
pname
)
!=
0
)
{
auto
cp
=
dataManager
.
GetCodePointer
(
cit
->
first
);
//verified by _strings
//datas.alias can be double card names or alias
if
(
is_declarable
(
cp
->
second
,
opcode
))
{
mainGame
->
lstANCard
->
addItem
(
cit
->
second
.
name
);
ancard
.
push_back
(
cit
->
first
);
}
}
}
}
void
ClientField
::
UpdateDeclarableCode
(
bool
enter
)
{
if
(
opcode
.
size
()
==
0
)
UpdateDeclarableCodeType
(
enter
);
else
UpdateDeclarableCodeOpcode
(
enter
);
}
}
gframe/client_field.h
View file @
4770a4fb
...
...
@@ -63,6 +63,7 @@ public:
std
::
vector
<
ClientCard
*>
selected_cards
;
std
::
set
<
ClientCard
*>
selectsum_cards
;
std
::
vector
<
ClientCard
*>
selectsum_all
;
std
::
vector
<
int
>
opcode
;
std
::
vector
<
ClientCard
*>
display_cards
;
std
::
vector
<
int
>
sort_list
;
std
::
map
<
int
,
int
>
player_desc_hints
[
2
];
...
...
@@ -104,7 +105,9 @@ public:
bool
check_sel_sum_s
(
const
std
::
set
<
ClientCard
*>&
left
,
int
index
,
int
acc
);
void
check_sel_sum_t
(
const
std
::
set
<
ClientCard
*>&
left
,
int
acc
);
bool
check_sum
(
std
::
set
<
ClientCard
*>::
const_iterator
index
,
std
::
set
<
ClientCard
*>::
const_iterator
end
,
int
acc
,
int
count
);
void
UpdateDeclarableCodeType
(
bool
enter
);
void
UpdateDeclarableCodeOpcode
(
bool
enter
);
void
UpdateDeclarableCode
(
bool
enter
);
irr
::
gui
::
IGUIElement
*
panel
;
...
...
gframe/duelclient.cpp
View file @
4770a4fb
...
...
@@ -2928,6 +2928,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
case
MSG_ANNOUNCE_CARD
:
{
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
mainGame
->
dField
.
declarable_type
=
BufferIO
::
ReadInt32
(
pbuf
);
mainGame
->
dField
.
opcode
.
clear
();
if
(
select_hint
)
myswprintf
(
textBuffer
,
L"%ls"
,
dataManager
.
GetDesc
(
select_hint
));
else
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
564
));
...
...
@@ -2935,6 +2936,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
gMutex
.
Lock
();
mainGame
->
ebANCard
->
setText
(
L""
);
mainGame
->
wANCard
->
setText
(
textBuffer
);
mainGame
->
dField
.
UpdateDeclarableCode
(
true
);
mainGame
->
PopupElement
(
mainGame
->
wANCard
);
mainGame
->
gMutex
.
Unlock
();
return
false
;
...
...
@@ -2959,6 +2961,25 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
gMutex
.
Unlock
();
return
false
;
}
case
MSG_ANNOUNCE_CARD_FILTER
:
{
/*int player = */
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
count
=
BufferIO
::
ReadInt8
(
pbuf
);
mainGame
->
dField
.
declarable_type
=
0
;
mainGame
->
dField
.
opcode
.
clear
();
for
(
int
i
=
0
;
i
<
count
;
++
i
)
mainGame
->
dField
.
opcode
.
push_back
(
BufferIO
::
ReadInt32
(
pbuf
));
if
(
select_hint
)
myswprintf
(
textBuffer
,
L"%ls"
,
dataManager
.
GetDesc
(
select_hint
));
else
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
564
));
select_hint
=
0
;
mainGame
->
gMutex
.
Lock
();
mainGame
->
ebANCard
->
setText
(
L""
);
mainGame
->
wANCard
->
setText
(
textBuffer
);
mainGame
->
dField
.
UpdateDeclarableCode
(
true
);
mainGame
->
PopupElement
(
mainGame
->
wANCard
);
mainGame
->
gMutex
.
Unlock
();
return
false
;
}
case
MSG_CARD_HINT
:
{
int
c
=
mainGame
->
LocalPlayer
(
BufferIO
::
ReadInt8
(
pbuf
));
int
l
=
BufferIO
::
ReadInt8
(
pbuf
);
...
...
gframe/replay_mode.cpp
View file @
4770a4fb
...
...
@@ -756,7 +756,8 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
pbuf
+=
4
;
return
ReadReplayResponse
();
}
case
MSG_ANNOUNCE_NUMBER
:
{
case
MSG_ANNOUNCE_NUMBER
:
case
MSG_ANNOUNCE_CARD_FILTER
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
count
=
BufferIO
::
ReadInt8
(
pbuf
);
pbuf
+=
4
*
count
;
...
...
gframe/single_duel.cpp
View file @
4770a4fb
...
...
@@ -1273,7 +1273,8 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) {
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_ANNOUNCE_NUMBER
:
{
case
MSG_ANNOUNCE_NUMBER
:
case
MSG_ANNOUNCE_CARD_FILTER
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
count
=
BufferIO
::
ReadInt8
(
pbuf
);
pbuf
+=
4
*
count
;
...
...
gframe/single_mode.cpp
View file @
4770a4fb
...
...
@@ -588,7 +588,8 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
}
break
;
}
case
MSG_ANNOUNCE_NUMBER
:
{
case
MSG_ANNOUNCE_NUMBER
:
case
MSG_ANNOUNCE_CARD_FILTER
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
count
=
BufferIO
::
ReadInt8
(
pbuf
);
pbuf
+=
4
*
count
;
...
...
gframe/tag_duel.cpp
View file @
4770a4fb
...
...
@@ -1312,7 +1312,8 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_ANNOUNCE_NUMBER
:
{
case
MSG_ANNOUNCE_NUMBER
:
case
MSG_ANNOUNCE_CARD_FILTER
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
count
=
BufferIO
::
ReadInt8
(
pbuf
);
pbuf
+=
4
*
count
;
...
...
ocgcore
@
b2d98347
Subproject commit
9b3dbc2c28d1e4f37d24cd1779cac93f59674e4
5
Subproject commit
b2d983470ed5da3989e2b217c3e13b3c4e9352f
5
script
@
95e77491
Subproject commit
caba7e1f82e5286e5ed165f9aea46cb798e019df
Subproject commit
95e774916b34e4aaf47972742854cf4f30eec505
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