tag partner cards: ygol_query_tag_cards + STOC_TAG_PARTNER_CARDS 0x5F, capability 0x2000, protocol 9 (TICKET-405)

Core: ygol_query_tag_cards(pduel, playerid, out) reads the waiting tag
partner's tag_list_hand / tag_list_extra (bit 31 = face-up, like
MSG_TAG_SWAP) and tag_list_main sorted ascending; returns the byte length,
0 when not a tag duel. Read only.

Server: STOC_TAG_PARTNER_CARDS 0x5F = u8 side + those bytes, no stamp, to
that side's two seats only (never the other team, never an observer):
after start_duel, after every MSG_TAG_SWAP, and in a seated duelist's
field resync. FEATURE_TAG_PARTNER_CARDS 0x2000 advertised by single_duel
and tag_duel; FEATURE_PROTOCOL 8 -> 9. 0x800 / 0x1000 stay reserved for
proposals 44 / 45.

Binding: StocMessage.TagPartnerCards, FeatureFlags.TagPartnerCards, the
TagPartnerCards record + StocCodecs.TagPartnerCards,
EngineApi.ygol_query_tag_cards, Capability.ProtocolVersion 9, tests.

Contract rows, CHANGELOG v1.2.0, the probe's tag partner cards room, the
export gates 334 / 855 / 849 -> 335 / 856 / 850.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
donnyandClaude Fable 5.1 committed 2026-10-15 23:26:39 -07:00
1 parent c3b5e6e13b
commit 2344e5dae1
20 files changed
+444 -36

No files matched your search

+28
View File
@@ -441,6 +441,34 @@ OCGCORE_API int32_t ygol_preview_attack(intptr_t pduel, uint8_t playerid, uint8_
buffer_write<int32_t>(ptr, 0);
return 1;
}
// [YGOL] v1.2.0 (tag partner cards) -- see ocgapi.h. Reads the three tag_list_* vectors the core keeps for the
// waiting member; nothing is moved, nothing is written to the duel.
OCGCORE_API int32_t ygol_query_tag_cards(intptr_t pduel, uint8_t playerid, uint8_t* out) {
duel* pd = (duel*)pduel;
if(!pd || !out || !duel_set.count(pd) || !pd->game_field)
return 0;
if(!check_playerid(playerid) || !(pd->game_field->core.duel_options & DUEL_TAG_MODE))
return 0;
const auto& p = pd->game_field->player[playerid];
std::vector<uint32_t> deck;
deck.reserve(p.tag_list_main.size());
for(auto& pcard : p.tag_list_main)
deck.push_back(pcard->data.code);
std::sort(deck.begin(), deck.end());
byte* ptr = out;
buffer_write<uint8_t>(ptr, 1);
buffer_write<uint8_t>(ptr, (uint8_t)p.tag_list_hand.size());
buffer_write<uint8_t>(ptr, (uint8_t)p.tag_list_extra.size());
buffer_write<uint8_t>(ptr, 0);
buffer_write<uint16_t>(ptr, (uint16_t)deck.size());
for(auto& pcard : p.tag_list_hand)
buffer_write<uint32_t>(ptr, pcard->data.code | (pcard->is_position(POS_FACEUP) ? 0x80000000 : 0));
for(auto& pcard : p.tag_list_extra)
buffer_write<uint32_t>(ptr, pcard->data.code | (pcard->is_position(POS_FACEUP) ? 0x80000000 : 0));
for(auto code : deck)
buffer_write<uint32_t>(ptr, code);
return (int32_t)(ptr - out);
}
OCGCORE_API int32_t get_registry_value(intptr_t pduel, const char* key, byte* out_buf) {
if (!pduel || !key || !out_buf) return -1;
+7
View File
@@ -80,6 +80,13 @@ OCGCORE_API byte* default_script_reader(const char* script_name, int* len);
// the duel is byte-identical afterwards (proposal 43).
OCGCORE_API int32_t ygol_preview_attack(intptr_t pduel, uint8_t playerid, uint8_t location, uint8_t sequence, uint8_t target_location, uint8_t target_sequence, uint8_t* out);
// [YGOL] v1.2.0 (tag partner cards, TICKET-405): the waiting tag partner's cards of playerid's side, read
// only. out: version (1), hand count, extra count, one pad byte, uint16 deck count, then the uint32 hand
// codes, the uint32 extra codes (bit 31 = face-up, like MSG_TAG_SWAP) and the uint32 deck codes sorted
// ascending (the order stays secret). Returns the byte length, 0 refused (bad pointer, bad player, not a
// tag duel); a refusal writes nothing. The duel is byte-identical afterwards (proposal 33 Rule 11).
OCGCORE_API int32_t ygol_query_tag_cards(intptr_t pduel, uint8_t playerid, uint8_t* out);
// koishi specific
OCGCORE_API int32_t get_registry_value(intptr_t pduel, const char* key, byte* out_buf);
OCGCORE_API void set_registry_value(intptr_t pduel, const char* key, const char* value);