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
4b6d74e0
Commit
4b6d74e0
authored
Dec 31, 2017
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
match_pick_test
parent
b4155ba0
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
59 additions
and
0 deletions
+59
-0
gframe/single_duel.cpp
gframe/single_duel.cpp
+31
-0
gframe/single_duel.h
gframe/single_duel.h
+4
-0
ocgcore/field.h
ocgcore/field.h
+2
-0
ocgcore/interpreter.cpp
ocgcore/interpreter.cpp
+2
-0
ocgcore/libduel.cpp
ocgcore/libduel.cpp
+18
-0
ocgcore/scriptlib.h
ocgcore/scriptlib.h
+2
-0
No files found.
gframe/single_duel.cpp
View file @
4b6d74e0
...
@@ -456,6 +456,9 @@ void SingleDuel::StartDuel(DuelPlayer* dp) {
...
@@ -456,6 +456,9 @@ void SingleDuel::StartDuel(DuelPlayer* dp) {
hand_result
[
1
]
=
0
;
hand_result
[
1
]
=
0
;
players
[
0
]
->
state
=
CTOS_HAND_RESULT
;
players
[
0
]
->
state
=
CTOS_HAND_RESULT
;
players
[
1
]
->
state
=
CTOS_HAND_RESULT
;
players
[
1
]
->
state
=
CTOS_HAND_RESULT
;
//2pick
pick_deck
[
0
]
=
0
;
pick_deck
[
1
]
=
0
;
}
}
void
SingleDuel
::
HandResult
(
DuelPlayer
*
dp
,
unsigned
char
res
)
{
void
SingleDuel
::
HandResult
(
DuelPlayer
*
dp
,
unsigned
char
res
)
{
if
(
res
>
3
)
if
(
res
>
3
)
...
@@ -514,8 +517,13 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
...
@@ -514,8 +517,13 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
Deck
d
=
pdeck
[
0
];
Deck
d
=
pdeck
[
0
];
pdeck
[
0
]
=
pdeck
[
1
];
pdeck
[
0
]
=
pdeck
[
1
];
pdeck
[
1
]
=
d
;
pdeck
[
1
]
=
d
;
SwapPickDeck
();
swapped
=
true
;
swapped
=
true
;
}
}
if
(
pick_deck
[
0
]
&&
pick_deck
[
1
])
{
pdeck
[
0
]
=
pick_deck
[
0
];
pdeck
[
1
]
=
pick_deck
[
1
];
}
dp
->
state
=
CTOS_RESPONSE
;
dp
->
state
=
CTOS_RESPONSE
;
ReplayHeader
rh
;
ReplayHeader
rh
;
rh
.
id
=
0x31707279
;
rh
.
id
=
0x31707279
;
...
@@ -657,6 +665,7 @@ void SingleDuel::DuelEndProc() {
...
@@ -657,6 +665,7 @@ void SingleDuel::DuelEndProc() {
Deck
d
=
pdeck
[
0
];
Deck
d
=
pdeck
[
0
];
pdeck
[
0
]
=
pdeck
[
1
];
pdeck
[
0
]
=
pdeck
[
1
];
pdeck
[
1
]
=
d
;
pdeck
[
1
]
=
d
;
SwapPickDeck
();
}
}
ready
[
0
]
=
false
;
ready
[
0
]
=
false
;
ready
[
1
]
=
false
;
ready
[
1
]
=
false
;
...
@@ -708,6 +717,21 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) {
...
@@ -708,6 +717,21 @@ int SingleDuel::Analyze(char* msgbuffer, unsigned int len) {
offset
=
pbuf
;
offset
=
pbuf
;
unsigned
char
engType
=
BufferIO
::
ReadUInt8
(
pbuf
);
unsigned
char
engType
=
BufferIO
::
ReadUInt8
(
pbuf
);
switch
(
engType
)
{
switch
(
engType
)
{
//2pick
case
MSG_SAVE_PICK_DECK
:
{
player
=
BufferIO
::
ReadInt8
(
pbuf
);
count
=
BufferIO
::
ReadInt8
(
pbuf
);
int
cardlist
[
128
];
int
counter
=
0
;
Deck
tdeck
;
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
int
code
=
BufferIO
::
ReadInt32
(
pbuf
);
cardlist
[
counter
++
]
=
code
;
}
deckManager
.
LoadDeck
(
tdeck
,
cardlist
,
count
,
0
);
pick_deck
[
player
]
=
tdeck
;
break
;
}
case
MSG_RETRY
:
{
case
MSG_RETRY
:
{
WaitforResponse
(
last_response
);
WaitforResponse
(
last_response
);
NetServer
::
SendBufferToPlayer
(
players
[
last_response
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
NetServer
::
SendBufferToPlayer
(
players
[
last_response
],
STOC_GAME_MSG
,
offset
,
pbuf
-
offset
);
...
@@ -1942,5 +1966,12 @@ void SingleDuel::SingleTimer(evutil_socket_t fd, short events, void* arg) {
...
@@ -1942,5 +1966,12 @@ void SingleDuel::SingleTimer(evutil_socket_t fd, short events, void* arg) {
event_del
(
sd
->
etimer
);
event_del
(
sd
->
etimer
);
}
}
}
}
void
SingleDuel
::
SwapPickDeck
()
{
if
(
pick_deck
[
0
]
&&
pick_deck
[
0
])
{
Deck
d
=
pick_deck
[
0
];
pick_deck
[
0
]
=
pick_deck
[
1
];
pick_deck
[
1
]
=
d
;
}
}
}
}
gframe/single_duel.h
View file @
4b6d74e0
...
@@ -40,12 +40,16 @@ public:
...
@@ -40,12 +40,16 @@ public:
static
int
MessageHandler
(
long
fduel
,
int
type
);
static
int
MessageHandler
(
long
fduel
,
int
type
);
static
void
SingleTimer
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
);
static
void
SingleTimer
(
evutil_socket_t
fd
,
short
events
,
void
*
arg
);
//2pick
void
SwapPickDeck
();
protected:
protected:
DuelPlayer
*
players
[
2
];
DuelPlayer
*
players
[
2
];
DuelPlayer
*
pplayer
[
2
];
DuelPlayer
*
pplayer
[
2
];
bool
ready
[
2
];
bool
ready
[
2
];
Deck
pdeck
[
2
];
Deck
pdeck
[
2
];
//2pick
Deck
pick_deck
[
2
];
int
deck_error
[
2
];
int
deck_error
[
2
];
unsigned
char
hand_result
[
2
];
unsigned
char
hand_result
[
2
];
unsigned
char
last_response
;
unsigned
char
last_response
;
...
...
ocgcore/field.h
View file @
4b6d74e0
...
@@ -912,4 +912,6 @@ public:
...
@@ -912,4 +912,6 @@ public:
#define MSG_CUSTOM_MSG 180
#define MSG_CUSTOM_MSG 180
#define MSG_SELECT_UNSELECT_CARD 190
#define MSG_SELECT_UNSELECT_CARD 190
//2pick
#define MSG_SAVE_PICK_DECK 222
#endif
/* FIELD_H_ */
#endif
/* FIELD_H_ */
ocgcore/interpreter.cpp
View file @
4b6d74e0
...
@@ -369,6 +369,8 @@ static const struct luaL_Reg grouplib[] = {
...
@@ -369,6 +369,8 @@ static const struct luaL_Reg grouplib[] = {
};
};
static
const
struct
luaL_Reg
duellib
[]
=
{
static
const
struct
luaL_Reg
duellib
[]
=
{
//2pick
{
"SavePickDeck"
,
scriptlib
::
duel_save_pick_deck
},
//modded
//modded
{
"SelectField"
,
scriptlib
::
duel_select_field
},
{
"SelectField"
,
scriptlib
::
duel_select_field
},
{
"GetMasterRule"
,
scriptlib
::
duel_get_master_rule
},
{
"GetMasterRule"
,
scriptlib
::
duel_get_master_rule
},
...
...
ocgcore/libduel.cpp
View file @
4b6d74e0
...
@@ -13,6 +13,24 @@
...
@@ -13,6 +13,24 @@
#include "group.h"
#include "group.h"
#include "ocgapi.h"
#include "ocgapi.h"
//2pick
int32
scriptlib
::
duel_save_pick_deck
(
lua_State
*
L
)
{
check_param_count
(
L
,
2
);
check_param
(
L
,
PARAM_TYPE_GROUP
,
2
)
int32
playerid
=
lua_tonumberint
(
L
,
1
);
if
(
playerid
!=
0
&&
playerid
!=
1
)
return
0
;
group
*
pgroup
=
*
(
group
**
)
lua_touserdata
(
L
,
2
);
duel
*
pduel
=
pgroup
->
pduel
;
if
(
pgroup
->
container
.
size
()
==
0
)
luaL_error
(
L
,
"Deck empty."
,
2
);
pduel
->
write_buffer8
(
MSG_SAVE_PICK_DECK
);
pduel
->
write_buffer8
(
playerid
);
pduel
->
write_buffer8
(
pgroup
->
container
.
size
());
for
(
auto
cit
=
pgroup
->
container
.
begin
();
cit
!=
pgroup
->
container
.
end
();
++
cit
)
{
pduel
->
write_buffer32
((
*
cit
)
->
data
.
code
);
}
}
//modded
//modded
int32
scriptlib
::
duel_select_field
(
lua_State
*
L
)
{
int32
scriptlib
::
duel_select_field
(
lua_State
*
L
)
{
check_action_permission
(
L
);
check_action_permission
(
L
);
...
...
ocgcore/scriptlib.h
View file @
4b6d74e0
...
@@ -16,6 +16,8 @@ public:
...
@@ -16,6 +16,8 @@ public:
static
int32
check_param
(
lua_State
*
L
,
int32
param_type
,
int32
index
,
BOOL
retfalse
=
FALSE
);
static
int32
check_param
(
lua_State
*
L
,
int32
param_type
,
int32
index
,
BOOL
retfalse
=
FALSE
);
static
int32
check_param_count
(
lua_State
*
L
,
int32
count
);
static
int32
check_param_count
(
lua_State
*
L
,
int32
count
);
static
int32
check_action_permission
(
lua_State
*
L
);
static
int32
check_action_permission
(
lua_State
*
L
);
//2pick
static
int32
duel_save_pick_deck
(
lua_State
*
L
);
//millux
//millux
static
int32
card_is_ritual_type
(
lua_State
*
L
);
static
int32
card_is_ritual_type
(
lua_State
*
L
);
//modded
//modded
...
...
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