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
YGOPRO-520DIY
ygopro
Commits
bd0fe468
Commit
bd0fe468
authored
Jul 07, 2019
by
mercury233
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/Fluorohydride/ygopro
into server
parents
9c07d44a
6641bb30
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
42 additions
and
136 deletions
+42
-136
gframe/client_field.cpp
gframe/client_field.cpp
+4
-64
gframe/client_field.h
gframe/client_field.h
+2
-5
gframe/duelclient.cpp
gframe/duelclient.cpp
+18
-24
gframe/duelclient.h
gframe/duelclient.h
+2
-0
gframe/event_handler.cpp
gframe/event_handler.cpp
+4
-4
gframe/game.cpp
gframe/game.cpp
+1
-1
gframe/replay_mode.cpp
gframe/replay_mode.cpp
+2
-7
gframe/single_duel.cpp
gframe/single_duel.cpp
+2
-9
gframe/single_mode.cpp
gframe/single_mode.cpp
+2
-11
gframe/tag_duel.cpp
gframe/tag_duel.cpp
+2
-9
ocgcore
ocgcore
+1
-1
script
script
+1
-1
strings.conf
strings.conf
+1
-0
No files found.
gframe/client_field.cpp
View file @
bd0fe468
...
...
@@ -1271,13 +1271,6 @@ bool ClientField::check_sum(std::set<ClientCard*>::const_iterator index, std::se
||
check_sum
(
index
,
end
,
acc
,
count
);
}
template
<
class
T
>
static
bool
is_declarable
(
T
const
&
cd
,
int
declarable_type
)
{
if
(
!
(
cd
.
type
&
declarable_type
))
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
));
}
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
)
{
...
...
@@ -1418,59 +1411,12 @@ static bool is_declarable(T const& cd, const std::vector<int>& opcode) {
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
()
{
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
,
declarable_type
))
{
mainGame
->
lstANCard
->
clear
();
ancard
.
clear
();
mainGame
->
lstANCard
->
addItem
(
cstr
.
name
.
c_str
());
ancard
.
push_back
(
trycode
);
return
;
}
if
(
pname
[
0
]
==
0
)
{
std
::
vector
<
int
>
cache
;
cache
.
swap
(
ancard
);
int
sel
=
mainGame
->
lstANCard
->
getSelected
();
int
selcode
=
(
sel
==
-
1
)
?
0
:
cache
[
sel
];
mainGame
->
lstANCard
->
clear
();
for
(
const
auto
&
trycode
:
cache
)
{
if
(
dataManager
.
GetString
(
trycode
,
&
cstr
)
&&
dataManager
.
GetData
(
trycode
,
&
cd
)
&&
is_declarable
(
cd
,
declarable_type
))
{
ancard
.
push_back
(
trycode
);
mainGame
->
lstANCard
->
addItem
(
cstr
.
name
.
c_str
());
if
(
trycode
==
selcode
)
mainGame
->
lstANCard
->
setSelected
(
cstr
.
name
.
c_str
());
}
}
if
(
!
ancard
.
empty
())
return
;
}
mainGame
->
lstANCard
->
clear
();
ancard
.
clear
();
for
(
auto
cit
=
dataManager
.
_strings
.
begin
();
cit
!=
dataManager
.
_strings
.
end
();
++
cit
)
{
if
(
cit
->
second
.
name
.
find
(
pname
)
!=
std
::
wstring
::
npos
)
{
auto
cp
=
dataManager
.
GetCodePointer
(
cit
->
first
);
//verified by _strings
//datas.alias can be double card names or alias
if
(
is_declarable
(
cp
->
second
,
declarable_type
))
{
if
(
pname
==
cit
->
second
.
name
)
{
//exact match
mainGame
->
lstANCard
->
insertItem
(
0
,
cit
->
second
.
name
.
c_str
(),
-
1
);
ancard
.
insert
(
ancard
.
begin
(),
cit
->
first
);
}
else
{
mainGame
->
lstANCard
->
addItem
(
cit
->
second
.
name
.
c_str
());
ancard
.
push_back
(
cit
->
first
);
}
}
}
}
}
void
ClientField
::
UpdateDeclarableCodeOpcode
()
{
void
ClientField
::
UpdateDeclarableList
()
{
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
))
{
if
(
dataManager
.
GetString
(
trycode
,
&
cstr
)
&&
dataManager
.
GetData
(
trycode
,
&
cd
)
&&
is_declarable
(
cd
,
declare_opcodes
))
{
mainGame
->
lstANCard
->
clear
();
ancard
.
clear
();
mainGame
->
lstANCard
->
addItem
(
cstr
.
name
.
c_str
());
...
...
@@ -1484,7 +1430,7 @@ void ClientField::UpdateDeclarableCodeOpcode() {
int
selcode
=
(
sel
==
-
1
)
?
0
:
cache
[
sel
];
mainGame
->
lstANCard
->
clear
();
for
(
const
auto
&
trycode
:
cache
)
{
if
(
dataManager
.
GetString
(
trycode
,
&
cstr
)
&&
dataManager
.
GetData
(
trycode
,
&
cd
)
&&
is_declarable
(
cd
,
opcode
))
{
if
(
dataManager
.
GetString
(
trycode
,
&
cstr
)
&&
dataManager
.
GetData
(
trycode
,
&
cd
)
&&
is_declarable
(
cd
,
declare_opcodes
))
{
ancard
.
push_back
(
trycode
);
mainGame
->
lstANCard
->
addItem
(
cstr
.
name
.
c_str
());
if
(
trycode
==
selcode
)
...
...
@@ -1500,7 +1446,7 @@ void ClientField::UpdateDeclarableCodeOpcode() {
if
(
cit
->
second
.
name
.
find
(
pname
)
!=
std
::
wstring
::
npos
)
{
auto
cp
=
dataManager
.
GetCodePointer
(
cit
->
first
);
//verified by _strings
//datas.alias can be double card names or alias
if
(
is_declarable
(
cp
->
second
,
opcode
))
{
if
(
is_declarable
(
cp
->
second
,
declare_opcodes
))
{
if
(
pname
==
cit
->
second
.
name
)
{
//exact match
mainGame
->
lstANCard
->
insertItem
(
0
,
cit
->
second
.
name
.
c_str
(),
-
1
);
ancard
.
insert
(
ancard
.
begin
(),
cit
->
first
);
...
...
@@ -1512,10 +1458,4 @@ void ClientField::UpdateDeclarableCodeOpcode() {
}
}
}
void
ClientField
::
UpdateDeclarableCode
()
{
if
(
opcode
.
size
()
==
0
)
UpdateDeclarableCodeType
();
else
UpdateDeclarableCodeOpcode
();
}
}
gframe/client_field.h
View file @
bd0fe468
...
...
@@ -60,14 +60,13 @@ public:
bool
select_panalmode
;
bool
select_ready
;
int
announce_count
;
int
declarable_type
;
int
select_counter_count
;
int
select_counter_type
;
std
::
vector
<
ClientCard
*>
selectable_cards
;
std
::
vector
<
ClientCard
*>
selected_cards
;
std
::
set
<
ClientCard
*>
selectsum_cards
;
std
::
vector
<
ClientCard
*>
selectsum_all
;
std
::
vector
<
int
>
opcode
;
std
::
vector
<
int
>
declare_opcodes
;
std
::
vector
<
ClientCard
*>
display_cards
;
std
::
vector
<
int
>
sort_list
;
std
::
map
<
int
,
int
>
player_desc_hints
[
2
];
...
...
@@ -112,9 +111,7 @@ public:
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
();
void
UpdateDeclarableCodeOpcode
();
void
UpdateDeclarableCode
();
void
UpdateDeclarableList
();
irr
::
gui
::
IGUIElement
*
panel
;
std
::
vector
<
int
>
ancard
;
...
...
gframe/duelclient.cpp
View file @
bd0fe468
...
...
@@ -23,6 +23,7 @@ bufferevent* DuelClient::client_bev = 0;
char
DuelClient
::
duel_client_read
[
0x2000
];
char
DuelClient
::
duel_client_write
[
0x2000
];
bool
DuelClient
::
is_closing
=
false
;
bool
DuelClient
::
is_swapping
=
false
;
int
DuelClient
::
select_hint
=
0
;
int
DuelClient
::
select_unselect_hint
=
0
;
int
DuelClient
::
last_select_hint
=
0
;
...
...
@@ -889,6 +890,12 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
if
(
mainGame
->
dInfo
.
time_player
==
1
)
mainGame
->
dInfo
.
time_player
=
2
;
if
(
is_swapping
)
{
mainGame
->
gMutex
.
Lock
();
mainGame
->
dField
.
ReplaySwap
();
mainGame
->
gMutex
.
Unlock
();
is_swapping
=
false
;
}
switch
(
mainGame
->
dInfo
.
curMsg
)
{
case
MSG_RETRY
:
{
if
(
last_successful_msg_length
)
{
...
...
@@ -897,7 +904,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
int
err_desc
=
1421
;
switch
(
last_msg
)
{
case
MSG_ANNOUNCE_CARD
:
case
MSG_ANNOUNCE_CARD_FILTER
:
err_desc
=
1422
;
break
;
case
MSG_ANNOUNCE_ATTRIB
:
...
...
@@ -2162,8 +2168,10 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
mainGame
->
WaitFrameSignal
(
11
);
}
for
(
auto
cit
=
mainGame
->
dField
.
hand
[
player
].
begin
();
cit
!=
mainGame
->
dField
.
hand
[
player
].
end
();
++
cit
)
for
(
auto
cit
=
mainGame
->
dField
.
hand
[
player
].
begin
();
cit
!=
mainGame
->
dField
.
hand
[
player
].
end
();
++
cit
)
{
(
*
cit
)
->
SetCode
(
BufferIO
::
ReadInt32
(
pbuf
));
(
*
cit
)
->
desc_hints
.
clear
();
}
if
(
!
mainGame
->
dInfo
.
isReplay
||
!
mainGame
->
dInfo
.
isReplaySkiping
)
{
for
(
auto
cit
=
mainGame
->
dField
.
hand
[
player
].
begin
();
cit
!=
mainGame
->
dField
.
hand
[
player
].
end
();
++
cit
)
{
(
*
cit
)
->
is_hovered
=
false
;
...
...
@@ -3468,8 +3476,10 @@ 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
();
int
count
=
BufferIO
::
ReadUInt8
(
pbuf
);
mainGame
->
dField
.
declare_opcodes
.
clear
();
for
(
int
i
=
0
;
i
<
count
;
++
i
)
mainGame
->
dField
.
declare_opcodes
.
push_back
(
BufferIO
::
ReadInt32
(
pbuf
));
if
(
select_hint
)
myswprintf
(
textBuffer
,
L"%ls"
,
dataManager
.
GetDesc
(
select_hint
));
else
myswprintf
(
textBuffer
,
dataManager
.
GetSysString
(
564
));
...
...
@@ -3477,7 +3487,7 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame
->
gMutex
.
Lock
();
mainGame
->
ebANCard
->
setText
(
L""
);
mainGame
->
wANCard
->
setText
(
textBuffer
);
mainGame
->
dField
.
UpdateDeclarable
Code
();
mainGame
->
dField
.
UpdateDeclarable
List
();
mainGame
->
PopupElement
(
mainGame
->
wANCard
);
mainGame
->
gMutex
.
Unlock
();
return
false
;
...
...
@@ -3502,25 +3512,6 @@ 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
::
ReadUInt8
(
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
();
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
);
...
...
@@ -3804,6 +3795,9 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
}
return
true
;
}
void
DuelClient
::
SwapField
()
{
is_swapping
=
true
;
}
void
DuelClient
::
SetResponseI
(
int
respI
)
{
*
((
int
*
)
response_buf
)
=
respI
;
response_len
=
4
;
...
...
gframe/duelclient.h
View file @
bd0fe468
...
...
@@ -29,6 +29,7 @@ private:
static
char
duel_client_read
[
0x2000
];
static
char
duel_client_write
[
0x2000
];
static
bool
is_closing
;
static
bool
is_swapping
;
static
int
select_hint
;
static
int
select_unselect_hint
;
static
int
last_select_hint
;
...
...
@@ -45,6 +46,7 @@ public:
static
int
ClientThread
(
void
*
param
);
static
void
HandleSTOCPacketLan
(
char
*
data
,
unsigned
int
len
);
static
int
ClientAnalyze
(
char
*
msg
,
unsigned
int
len
);
static
void
SwapField
();
static
void
SetResponseI
(
int
respI
);
static
void
SetResponseB
(
void
*
respB
,
unsigned
char
len
);
static
void
SendResponse
();
...
...
gframe/event_handler.cpp
View file @
bd0fe468
...
...
@@ -91,8 +91,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
soundManager
.
PlaySoundEffect
(
SOUND_BUTTON
);
if
(
mainGame
->
dInfo
.
isReplay
)
ReplayMode
::
SwapField
();
else
if
(
mainGame
->
dInfo
.
player_type
==
7
)
mainGame
->
dField
.
ReplaySwap
();
else
if
(
mainGame
->
dInfo
.
player_type
==
7
)
DuelClient
::
SwapField
();
break
;
}
case
BUTTON_REPLAY_UNDO
:
{
...
...
@@ -963,7 +963,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case
irr
:
:
gui
::
EGET_EDITBOX_CHANGED
:
{
switch
(
id
)
{
case
EDITBOX_ANCARD
:
{
UpdateDeclarable
Code
();
UpdateDeclarable
List
();
break
;
}
}
...
...
@@ -972,7 +972,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case
irr
:
:
gui
::
EGET_EDITBOX_ENTER
:
{
switch
(
id
)
{
case
EDITBOX_ANCARD
:
{
UpdateDeclarable
Code
();
UpdateDeclarable
List
();
break
;
}
}
...
...
gframe/game.cpp
View file @
bd0fe468
...
...
@@ -16,7 +16,7 @@
#include "single_mode.h"
#endif //YGOPRO_SERVER_MODE
const
unsigned
short
PRO_VERSION
=
0x134
A
;
const
unsigned
short
PRO_VERSION
=
0x134
B
;
namespace
ygo
{
...
...
gframe/replay_mode.cpp
View file @
bd0fe468
...
...
@@ -773,13 +773,8 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
pbuf
+=
5
;
return
ReadReplayResponse
();
}
case
MSG_ANNOUNCE_CARD
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
pbuf
+=
4
;
return
ReadReplayResponse
();
}
case
MSG_ANNOUNCE_NUMBER
:
case
MSG_ANNOUNCE_CARD_FILTER
:
{
case
MSG_ANNOUNCE_CARD
:
case
MSG_ANNOUNCE_NUMBER
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
count
=
BufferIO
::
ReadUInt8
(
pbuf
);
pbuf
+=
4
*
count
;
...
...
gframe/single_duel.cpp
View file @
bd0fe468
...
...
@@ -1673,15 +1673,8 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) {
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_ANNOUNCE_CARD
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
WaitforResponse
(
player
);
pbuf
+=
4
;
NetServer
::
SendBufferToPlayer
(
players
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_ANNOUNCE_NUMBER
:
case
MSG_ANNOUNCE_CARD_FILTER
:
{
case
MSG_ANNOUNCE_CARD
:
case
MSG_ANNOUNCE_NUMBER
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
count
=
BufferIO
::
ReadUInt8
(
pbuf
);
pbuf
+=
4
*
count
;
...
...
gframe/single_mode.cpp
View file @
bd0fe468
...
...
@@ -679,17 +679,8 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
}
break
;
}
case
MSG_ANNOUNCE_CARD
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
pbuf
+=
4
;
if
(
!
DuelClient
::
ClientAnalyze
(
offset
,
pbuf
-
offset
))
{
mainGame
->
singleSignal
.
Reset
();
mainGame
->
singleSignal
.
Wait
();
}
break
;
}
case
MSG_ANNOUNCE_NUMBER
:
case
MSG_ANNOUNCE_CARD_FILTER
:
{
case
MSG_ANNOUNCE_CARD
:
case
MSG_ANNOUNCE_NUMBER
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
count
=
BufferIO
::
ReadUInt8
(
pbuf
);
pbuf
+=
4
*
count
;
...
...
gframe/tag_duel.cpp
View file @
bd0fe468
...
...
@@ -1710,15 +1710,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_CARD
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
pbuf
+=
4
;
WaitforResponse
(
player
);
NetServer
::
SendBufferToPlayer
(
cur_player
[
player
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
return
1
;
}
case
MSG_ANNOUNCE_NUMBER
:
case
MSG_ANNOUNCE_CARD_FILTER
:
{
case
MSG_ANNOUNCE_CARD
:
case
MSG_ANNOUNCE_NUMBER
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
count
=
BufferIO
::
ReadUInt8
(
pbuf
);
pbuf
+=
4
*
count
;
...
...
ocgcore
@
f79332d7
Subproject commit
79345ca980c5c933dbec08a0b0f6fb1af1a8da20
Subproject commit
f79332d76d1b5774fe0105e541d34c7b40e3e54a
script
@
573645ee
Subproject commit
35562e466d6ae7816bf32a2cc2b5bc37deed4aaa
Subproject commit
573645ee990be70d8e7c7ae2fa8a8fad33e9d62e
strings.conf
View file @
bd0fe468
...
...
@@ -36,6 +36,7 @@
!
system
64
二重状态
!
system
65
使用效果
!
system
66
持续公开
!
system
67
原本持有者为对方
!
system
70
怪兽卡
!
system
71
魔法卡
!
system
72
陷阱卡
...
...
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