server: 0009-setup-pairs
TICKET-258: ygol.<key>=<value> tokens after slot 11 go into the duel registry before special.lua, into the replay pairs block and to every joiner as STOC 0x43; argv sized from the token count. Replayed from Tools/YGOLegacy/patches/0009-setup-pairs.patch in the Unity repo. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
00a715f181
commit
76e359f6cf
7 files changed
+94
-8
No files matched your search
@@ -68,7 +68,7 @@ void SingleDuel::Dialogue(DuelPlayer* dp, unsigned char* pdata, int len) {
|
||||
void SingleDuel::SendServerCapability(DuelPlayer* dp) {
|
||||
CTOS_Capability cap;
|
||||
cap.protocol = FEATURE_PROTOCOL;
|
||||
cap.flags = FEATURE_APPEARANCE | FEATURE_DIALOGUE;
|
||||
cap.flags = FEATURE_APPEARANCE | FEATURE_DIALOGUE | FEATURE_SETUP_PAIRS; // YGOL setup pairs
|
||||
unsigned char buf[SIZE_STOC_FEATURE];
|
||||
const auto size = NetServer::CreateStampedPacket((unsigned char*)&cap, sizeof cap, buf, FEATURE_SENDER_SERVER);
|
||||
NetServer::SendBufferToPlayer(dp, STOC_CAPABILITY, buf, size);
|
||||
@@ -199,6 +199,7 @@ void SingleDuel::JoinGame(DuelPlayer* dp, unsigned char* pdata, bool is_creater)
|
||||
}
|
||||
NetServer::SendPacketToPlayer(dp, STOC_JOIN_GAME, scjg);
|
||||
SendServerCapability(dp); // YGOL feature messages: the host build speaks first
|
||||
NetServer::SendSetupPairs(dp); // YGOL setup pairs
|
||||
NetServer::SendPacketToPlayer(dp, STOC_TYPE_CHANGE, sctc);
|
||||
if(players[0]) {
|
||||
STOC_HS_PlayerEnter scpe;
|
||||
@@ -645,8 +646,16 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
|
||||
for (auto& x : rh.seed_sequence)
|
||||
x = rd();
|
||||
mtrandom rnd(rh.seed_sequence, SEED_COUNT);
|
||||
if(!setup_pairs.empty()) // YGOL setup pairs
|
||||
rh.base.flag |= REPLAY_YGOL_SETUP_PAIRS;
|
||||
last_replay.BeginRecord();
|
||||
last_replay.WriteHeader(rh);
|
||||
if(!setup_pairs.empty()) {
|
||||
unsigned char block[SETUP_PAIRS_BLOCK_MAX];
|
||||
const auto size = WriteSetupPairsBlock(block);
|
||||
last_replay.WriteInt32((int32_t)size, false);
|
||||
last_replay.WriteData(block, size, false);
|
||||
}
|
||||
last_replay.WriteData(players[0]->name, 40, false);
|
||||
last_replay.WriteData(players[1]->name, 40, false);
|
||||
if(!host_info.no_shuffle_deck) {
|
||||
@@ -682,6 +691,10 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
|
||||
}
|
||||
set_registry_value(pduel, "player_type_0", swapped ? "1" : "0");
|
||||
set_registry_value(pduel, "player_type_1", swapped ? "0" : "1");
|
||||
for(const auto& pair : setup_pairs) { // YGOL setup pairs: before special.lua, every duel of a series
|
||||
const auto eq = pair.find('=');
|
||||
set_registry_value(pduel, pair.substr(0, eq).c_str(), pair.c_str() + eq + 1);
|
||||
}
|
||||
set_player_info(pduel, 0, host_info.start_lp, host_info.start_hand, host_info.draw_count);
|
||||
set_player_info(pduel, 1, host_info.start_lp, host_info.start_hand, host_info.draw_count);
|
||||
preload_script(pduel, "./script/patches/entry.lua");
|
||||
|
||||
Reference in new issue
Block a user