prompt context: announce kind byte, record 23 bytes, STOC 0x44 24 bytes (TICKET-451, v1.7.0)
u8 announce_kind after chain_link, set only while MSG_ANNOUNCE_NUMBER is open: 1 when the script called Duel.AnnounceLevel (it passes playerid + 0x10000 to the unit), else 2 when the asking effect has CATEGORY_DICE and is visible to the answering player, else 0. Contract, changelog, binding PromptContext.AnnounceKind + AnnouncePlain / Level / Dice, codec 24 bytes, probe: plain 0, AnnounceLevel 1, a dice effect's AnnounceNumber 2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3f84b0b50b
commit
954fbfc65b
12 files changed
+70
-40
No files matched your search
+3
-3
@@ -12,9 +12,9 @@ One export, one message, capability `0x8000`, protocol 12: exports 336 / 857 / 8
|
|||||||
|
|
||||||
| Date | Change | Ticket | Contract part |
|
| Date | Change | Ticket | Contract part |
|
||||||
|---|---|---|---|
|
|---|---|---|---|
|
||||||
| 2026-11-08 | Core: `ygol_query_prompt_context(pduel, playerid, out)` (22 bytes: version, has effect, code, controller, location, sequence, position, u64 description, u16 effect index, phase, chain link). `field::execute_cost` / `execute_target` / `execute_operation` push the running effect (handler, description, index, phase 1 / 2 / 3, chain link) on `core.ygol_running` at step 0 and pop it when the function finishes; the innermost one answers. The core's own "use this effect?" asks (optional trigger, lone quick trigger desc 221, desc 94, replacements 218 / 219 / 220, Scrap Chimera) carry the asked effect in their `PROCESSOR_SELECT_EFFECTYN` / `SELECT_YESNO` unit and push it as phase 4 (ask) while the prompt is open. `effect::ygol_script_index`: `card::add_effect` stamps `initial_effect.size()` while the card loads (`STATUS_INITIALIZING`), `0xFFFF` otherwise. A handler the asking player does not control and that is not face-up answers code 0, index `0xFFFF`, description 0. | TICKET-451 | (a) new export |
|
| 2026-11-08 | Core: `ygol_query_prompt_context(pduel, playerid, out)` (23 bytes: version, has effect, code, controller, location, sequence, position, u64 description, u16 effect index, phase, chain link, announce kind: 1 `Duel.AnnounceLevel`, 2 a visible `CATEGORY_DICE` effect, on `MSG_ANNOUNCE_NUMBER` only). `field::execute_cost` / `execute_target` / `execute_operation` push the running effect (handler, description, index, phase 1 / 2 / 3, chain link) on `core.ygol_running` at step 0 and pop it when the function finishes; the innermost one answers. The core's own "use this effect?" asks (optional trigger, lone quick trigger desc 221, desc 94, replacements 218 / 219 / 220, Scrap Chimera) carry the asked effect in their `PROCESSOR_SELECT_EFFECTYN` / `SELECT_YESNO` unit and push it as phase 4 (ask) while the prompt is open. `effect::ygol_script_index`: `card::add_effect` stamps `initial_effect.size()` while the card loads (`STATUS_INITIALIZING`), `0xFFFF` otherwise. A handler the asking player does not control and that is not face-up answers code 0, index `0xFFFF`, description 0. | TICKET-451 | (a) new export |
|
||||||
| 2026-11-08 | Server: `STOC_PROMPT_CONTEXT` `0x44` = those 22 bytes + the prompt's `MSG_*` id, to the answering seat (Tag: `cur_player`) right before every relayed prompt but rock-paper-scissors, only when its capability has the bit; never observers, recorders or replays. `FEATURE_PROMPT_CONTEXT` `0x8000` advertised by Single and Tag rooms, protocol 11 -> 12; no room refuses a joiner without it. Export gates 335 / 856 / 850 -> 336 / 857 / 851. | TICKET-451 | Wire: message `0x44`, capability bit `0x8000`, protocol 12 |
|
| 2026-11-08 | Server: `STOC_PROMPT_CONTEXT` `0x44` = those 23 bytes + the prompt's `MSG_*` id (24 bytes), to the answering seat (Tag: `cur_player`) right before every relayed prompt but rock-paper-scissors, only when its capability has the bit; never observers, recorders or replays. `FEATURE_PROMPT_CONTEXT` `0x8000` advertised by Single and Tag rooms, protocol 11 -> 12; no room refuses a joiner without it. Export gates 335 / 856 / 850 -> 336 / 857 / 851. | TICKET-451 | Wire: message `0x44`, capability bit `0x8000`, protocol 12 |
|
||||||
| 2026-11-08 | Binding: `StocMessage.PromptContext`, `FeatureFlags.PromptContext` (in `All`), the `PromptContext` record + `StocCodecs.PromptContext`, `EngineApi.ygol_query_prompt_context`, `Capability.ProtocolVersion` 12. Probe: the prompt context rooms (Single, a second Single duel whose opponent lacks the bit, Tag): a card asks in its cost, target and operation, a Fusion's material procedure asks inside that operation and the outer context comes back, the Fusion's optional End Phase trigger is asked with phase 4, then the card hides itself in the Deck and asks both players; a second duel with another deck order has the same indexes. | TICKET-451 | (e) C# binding |
|
| 2026-11-08 | Binding: `StocMessage.PromptContext`, `FeatureFlags.PromptContext` (in `All`), the `PromptContext` record + `StocCodecs.PromptContext`, `EngineApi.ygol_query_prompt_context`, `Capability.ProtocolVersion` 12. Probe: the prompt context rooms (Single, a second Single duel whose opponent lacks the bit, Tag): a card asks in its cost, target and operation, a Fusion's material procedure asks inside that operation and the outer context comes back, the Fusion's optional End Phase trigger is asked with phase 4, announces say kind 0 / 1 / 2, then the card hides itself in the Deck and asks both players; a second duel with another deck order has the same indexes. | TICKET-451 | (e) C# binding |
|
||||||
|
|
||||||
## v1.6.0 — 2026-11-02
|
## v1.6.0 — 2026-11-02
|
||||||
|
|
||||||
|
|||||||
@@ -287,27 +287,28 @@ namespace YGOLegacy.Protocol.Tests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void PromptContext_Id_Flag_Protocol_AndRoundTrip_ArePinned_0x44_0x8000_12_23()
|
public void PromptContext_Id_Flag_Protocol_AndRoundTrip_ArePinned_0x44_0x8000_12_24()
|
||||||
{
|
{
|
||||||
Assert.That((int)StocCodecs.PromptContext.Id, Is.EqualTo(0x44));
|
Assert.That((int)StocCodecs.PromptContext.Id, Is.EqualTo(0x44));
|
||||||
Assert.That((int)StocMessage.PromptContext, Is.EqualTo(0x44));
|
Assert.That((int)StocMessage.PromptContext, Is.EqualTo(0x44));
|
||||||
Assert.That(FeatureFlags.PromptContext, Is.EqualTo(0x8000));
|
Assert.That(FeatureFlags.PromptContext, Is.EqualTo(0x8000));
|
||||||
Assert.That(FeatureFlags.All & FeatureFlags.PromptContext, Is.EqualTo(FeatureFlags.PromptContext));
|
Assert.That(FeatureFlags.All & FeatureFlags.PromptContext, Is.EqualTo(FeatureFlags.PromptContext));
|
||||||
Assert.That(Capability.ProtocolVersion, Is.EqualTo(12));
|
Assert.That(Capability.ProtocolVersion, Is.EqualTo(12));
|
||||||
Assert.That(PromptContextCodec.Size, Is.EqualTo(23));
|
Assert.That(PromptContextCodec.Size, Is.EqualTo(24));
|
||||||
|
Assert.That(new[] { PromptContext.AnnouncePlain, PromptContext.AnnounceLevel, PromptContext.AnnounceDice }, Is.EqualTo(new byte[] { 0, 1, 2 }));
|
||||||
Assert.That(new[] { PromptContext.PhaseOther, PromptContext.PhaseCost, PromptContext.PhaseTarget, PromptContext.PhaseOperation, PromptContext.PhaseAsk }, Is.EqualTo(new byte[] { 0, 1, 2, 3, 4 }));
|
Assert.That(new[] { PromptContext.PhaseOther, PromptContext.PhaseCost, PromptContext.PhaseTarget, PromptContext.PhaseOperation, PromptContext.PhaseAsk }, Is.EqualTo(new byte[] { 0, 1, 2, 3, 4 }));
|
||||||
|
|
||||||
const ulong description = 12960005233ul;
|
const ulong description = 12960005233ul;
|
||||||
var payload = new PromptContext(true, 16178681u, 1, 0x04, 2, 0x1, description, 3, PromptContext.PhaseOperation, 2, 13);
|
var payload = new PromptContext(true, 16178681u, 1, 0x04, 2, 0x1, description, 3, PromptContext.PhaseOperation, 2, PromptContext.AnnounceDice, 143);
|
||||||
var bytes = Bytes(w => StocCodecs.PromptContext.Write(w, payload));
|
var bytes = Bytes(w => StocCodecs.PromptContext.Write(w, payload));
|
||||||
Assert.That(bytes.Length, Is.EqualTo(23));
|
Assert.That(bytes.Length, Is.EqualTo(24));
|
||||||
Assert.That(bytes[0], Is.EqualTo(1));
|
Assert.That(bytes[0], Is.EqualTo(1));
|
||||||
Assert.That(bytes[1], Is.EqualTo(1));
|
Assert.That(bytes[1], Is.EqualTo(1));
|
||||||
Assert.That(BitConverter.ToUInt32(bytes, 2), Is.EqualTo(16178681u));
|
Assert.That(BitConverter.ToUInt32(bytes, 2), Is.EqualTo(16178681u));
|
||||||
Assert.That(bytes.Skip(6).Take(4).ToArray(), Is.EqualTo(new byte[] { 1, 0x04, 2, 0x1 }));
|
Assert.That(bytes.Skip(6).Take(4).ToArray(), Is.EqualTo(new byte[] { 1, 0x04, 2, 0x1 }));
|
||||||
Assert.That(BitConverter.ToUInt64(bytes, 10), Is.EqualTo(description));
|
Assert.That(BitConverter.ToUInt64(bytes, 10), Is.EqualTo(description));
|
||||||
Assert.That(BitConverter.ToUInt16(bytes, 18), Is.EqualTo(3));
|
Assert.That(BitConverter.ToUInt16(bytes, 18), Is.EqualTo(3));
|
||||||
Assert.That(bytes.Skip(20).ToArray(), Is.EqualTo(new byte[] { 3, 2, 13 }));
|
Assert.That(bytes.Skip(20).ToArray(), Is.EqualTo(new byte[] { 3, 2, 2, 143 }));
|
||||||
|
|
||||||
var read = StocCodecs.PromptContext.Read(Reader(bytes));
|
var read = StocCodecs.PromptContext.Read(Reader(bytes));
|
||||||
Assert.That(read.Version, Is.EqualTo(1));
|
Assert.That(read.Version, Is.EqualTo(1));
|
||||||
@@ -322,15 +323,16 @@ namespace YGOLegacy.Protocol.Tests
|
|||||||
Assert.That(read.EffectIndex, Is.EqualTo(3));
|
Assert.That(read.EffectIndex, Is.EqualTo(3));
|
||||||
Assert.That(read.Phase, Is.EqualTo(PromptContext.PhaseOperation));
|
Assert.That(read.Phase, Is.EqualTo(PromptContext.PhaseOperation));
|
||||||
Assert.That(read.ChainLink, Is.EqualTo(2));
|
Assert.That(read.ChainLink, Is.EqualTo(2));
|
||||||
Assert.That(read.Prompt, Is.EqualTo(13));
|
Assert.That(read.AnnounceKind, Is.EqualTo(PromptContext.AnnounceDice));
|
||||||
|
Assert.That(read.Prompt, Is.EqualTo(143));
|
||||||
|
|
||||||
var none = Bytes(w => StocCodecs.PromptContext.Write(w, PromptContext.None(10)));
|
var none = Bytes(w => StocCodecs.PromptContext.Write(w, PromptContext.None(10)));
|
||||||
Assert.That(none, Is.EqualTo(new byte[] { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0, 0, 10 }));
|
Assert.That(none, Is.EqualTo(new byte[] { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0, 0, 0, 10 }));
|
||||||
Assert.That(StocCodecs.PromptContext.Read(Reader(none)).HasEffect, Is.False);
|
Assert.That(StocCodecs.PromptContext.Read(Reader(none)).HasEffect, Is.False);
|
||||||
var hidden = StocCodecs.PromptContext.Read(Reader(Bytes(w => StocCodecs.PromptContext.Write(w, new PromptContext(true, 0, 1, 0x02, 0, 0x8, 0, PromptContext.UnknownIndex, PromptContext.PhaseCost, 1, 13)))));
|
var hidden = StocCodecs.PromptContext.Read(Reader(Bytes(w => StocCodecs.PromptContext.Write(w, new PromptContext(true, 0, 1, 0x02, 0, 0x8, 0, PromptContext.UnknownIndex, PromptContext.PhaseCost, 1, PromptContext.AnnouncePlain, 13)))));
|
||||||
Assert.That(hidden.IsHidden, Is.True);
|
Assert.That(hidden.IsHidden, Is.True);
|
||||||
Assert.That(hidden.EffectIndex, Is.EqualTo(PromptContext.UnknownIndex));
|
Assert.That(hidden.EffectIndex, Is.EqualTo(PromptContext.UnknownIndex));
|
||||||
Assert.Throws<EndOfStreamException>(() => StocCodecs.PromptContext.Read(Reader(bytes.Take(22).ToArray())));
|
Assert.Throws<EndOfStreamException>(() => StocCodecs.PromptContext.Read(Reader(bytes.Take(23).ToArray())));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|||||||
@@ -214,10 +214,10 @@ namespace YGOLegacy.Protocol.Codecs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The 22-byte ygol_query_prompt_context record (version, has effect, uint32 code, controller, location, sequence, position, uint64 description, uint16 effect index, phase, chain link) + the prompt's MSG id; no sender stamp (v1.7.0, TICKET-451).
|
// The 23-byte ygol_query_prompt_context record (version, has effect, uint32 code, controller, location, sequence, position, uint64 description, uint16 effect index, phase, chain link, announce kind) + the prompt's MSG id; no sender stamp (v1.7.0, TICKET-451).
|
||||||
public sealed class PromptContextCodec : IStocCodec<PromptContext>
|
public sealed class PromptContextCodec : IStocCodec<PromptContext>
|
||||||
{
|
{
|
||||||
public const int Size = 23;
|
public const int Size = 24;
|
||||||
|
|
||||||
public StocMessage Id => StocMessage.PromptContext;
|
public StocMessage Id => StocMessage.PromptContext;
|
||||||
|
|
||||||
@@ -235,8 +235,9 @@ namespace YGOLegacy.Protocol.Codecs
|
|||||||
var effectIndex = reader.ReadUInt16();
|
var effectIndex = reader.ReadUInt16();
|
||||||
var phase = reader.ReadByte();
|
var phase = reader.ReadByte();
|
||||||
var chainLink = reader.ReadByte();
|
var chainLink = reader.ReadByte();
|
||||||
|
var announceKind = reader.ReadByte();
|
||||||
var prompt = reader.ReadByte();
|
var prompt = reader.ReadByte();
|
||||||
return new PromptContext(version, hasEffect, code, controller, location, sequence, position, description, effectIndex, phase, chainLink, prompt);
|
return new PromptContext(version, hasEffect, code, controller, location, sequence, position, description, effectIndex, phase, chainLink, announceKind, prompt);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Write(BinaryWriter writer, PromptContext payload)
|
public void Write(BinaryWriter writer, PromptContext payload)
|
||||||
@@ -252,6 +253,7 @@ namespace YGOLegacy.Protocol.Codecs
|
|||||||
writer.Write(payload.EffectIndex);
|
writer.Write(payload.EffectIndex);
|
||||||
writer.Write(payload.Phase);
|
writer.Write(payload.Phase);
|
||||||
writer.Write(payload.ChainLink);
|
writer.Write(payload.ChainLink);
|
||||||
|
writer.Write(payload.AnnounceKind);
|
||||||
writer.Write(payload.Prompt);
|
writer.Write(payload.Prompt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -598,6 +598,9 @@ namespace YGOLegacy.Protocol.Contracts
|
|||||||
public const byte PhaseTarget = 2;
|
public const byte PhaseTarget = 2;
|
||||||
public const byte PhaseOperation = 3;
|
public const byte PhaseOperation = 3;
|
||||||
public const byte PhaseAsk = 4;
|
public const byte PhaseAsk = 4;
|
||||||
|
public const byte AnnouncePlain = 0;
|
||||||
|
public const byte AnnounceLevel = 1;
|
||||||
|
public const byte AnnounceDice = 2;
|
||||||
|
|
||||||
public byte Version { get; }
|
public byte Version { get; }
|
||||||
// False: no effect function runs (battle and idle commands, a plain summon); every other value is zero and EffectIndex is UnknownIndex.
|
// False: no effect function runs (battle and idle commands, a plain summon); every other value is zero and EffectIndex is UnknownIndex.
|
||||||
@@ -616,13 +619,15 @@ namespace YGOLegacy.Protocol.Contracts
|
|||||||
public byte Phase { get; }
|
public byte Phase { get; }
|
||||||
// The chain link the effect is, 0 when it is not on the chain.
|
// The chain link the effect is, 0 when it is not on the chain.
|
||||||
public byte ChainLink { get; }
|
public byte ChainLink { get; }
|
||||||
|
// MSG_ANNOUNCE_NUMBER only: AnnounceLevel (the script called Duel.AnnounceLevel), AnnounceDice (the asking effect is a visible dice effect); AnnouncePlain everywhere else.
|
||||||
|
public byte AnnounceKind { get; }
|
||||||
// The MSG_* id of the prompt this context belongs to.
|
// The MSG_* id of the prompt this context belongs to.
|
||||||
public byte Prompt { get; }
|
public byte Prompt { get; }
|
||||||
|
|
||||||
public PromptContext(bool hasEffect, uint code, byte controller, byte location, byte sequence, byte position, ulong description, ushort effectIndex, byte phase, byte chainLink, byte prompt)
|
public PromptContext(bool hasEffect, uint code, byte controller, byte location, byte sequence, byte position, ulong description, ushort effectIndex, byte phase, byte chainLink, byte announceKind, byte prompt)
|
||||||
: this(CurrentVersion, hasEffect, code, controller, location, sequence, position, description, effectIndex, phase, chainLink, prompt) { }
|
: this(CurrentVersion, hasEffect, code, controller, location, sequence, position, description, effectIndex, phase, chainLink, announceKind, prompt) { }
|
||||||
|
|
||||||
public PromptContext(byte version, bool hasEffect, uint code, byte controller, byte location, byte sequence, byte position, ulong description, ushort effectIndex, byte phase, byte chainLink, byte prompt)
|
public PromptContext(byte version, bool hasEffect, uint code, byte controller, byte location, byte sequence, byte position, ulong description, ushort effectIndex, byte phase, byte chainLink, byte announceKind, byte prompt)
|
||||||
{
|
{
|
||||||
Version = version;
|
Version = version;
|
||||||
HasEffect = hasEffect;
|
HasEffect = hasEffect;
|
||||||
@@ -635,10 +640,11 @@ namespace YGOLegacy.Protocol.Contracts
|
|||||||
EffectIndex = effectIndex;
|
EffectIndex = effectIndex;
|
||||||
Phase = phase;
|
Phase = phase;
|
||||||
ChainLink = chainLink;
|
ChainLink = chainLink;
|
||||||
|
AnnounceKind = announceKind;
|
||||||
Prompt = prompt;
|
Prompt = prompt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PromptContext None(byte prompt) => new PromptContext(false, 0, 0, 0, 0, 0, 0, UnknownIndex, PhaseOther, 0, prompt);
|
public static PromptContext None(byte prompt) => new PromptContext(false, 0, 0, 0, 0, 0, 0, UnknownIndex, PhaseOther, 0, AnnouncePlain, prompt);
|
||||||
|
|
||||||
public bool IsHidden => HasEffect && Code == 0;
|
public bool IsHidden => HasEffect && Code == 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ The host string is space-separated tokens, in this order (`server/gframe/gframe.
|
|||||||
| `default_script_reader` | `byte* default_script_reader(const char* script_name, int* len)` | Upstream |
|
| `default_script_reader` | `byte* default_script_reader(const char* script_name, int* len)` | Upstream |
|
||||||
| `ygol_preview_attack` | `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)` | Patch 0022 (TICKET-374) + 0024 (TICKET-379), 2026-10-13. A read-only dry run of the damage step. Returns 1 answered, 0 refused (bad pointer, no such card, attacker not a face-up monster on `playerid`'s field, target not a monster on the other field); a refusal writes nothing. `target_location` `0xFF` = direct. `out` is 24 bytes: version (1), flags (bit 0 direct, bit 1 unknown, bit 2 attacker destroyed, bit 3 target destroyed, bit 4 pierce, bit 5 illegal), 2 pad bytes, then five `int32`: attacker value, target value, damage to player 0, damage to player 1, reserved 0. A face-down target answers unknown with every number 0. A pair the battle menu (`field::get_attack_target`) would not offer answers illegal alone with every number 0. Call it only while the engine is parked on a prompt; the duel is byte-identical afterwards. |
|
| `ygol_preview_attack` | `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)` | Patch 0022 (TICKET-374) + 0024 (TICKET-379), 2026-10-13. A read-only dry run of the damage step. Returns 1 answered, 0 refused (bad pointer, no such card, attacker not a face-up monster on `playerid`'s field, target not a monster on the other field); a refusal writes nothing. `target_location` `0xFF` = direct. `out` is 24 bytes: version (1), flags (bit 0 direct, bit 1 unknown, bit 2 attacker destroyed, bit 3 target destroyed, bit 4 pierce, bit 5 illegal), 2 pad bytes, then five `int32`: attacker value, target value, damage to player 0, damage to player 1, reserved 0. A face-down target answers unknown with every number 0. A pair the battle menu (`field::get_attack_target`) would not offer answers illegal alone with every number 0. Call it only while the engine is parked on a prompt; the duel is byte-identical afterwards. |
|
||||||
| `ygol_query_tag_cards` | `int32_t ygol_query_tag_cards(intptr_t pduel, uint8_t playerid, uint8_t* out)` | v1.2.0 (TICKET-405), 2026-10-15. The waiting tag partner's cards of `playerid`'s side, read only. Returns the byte length written, 0 refused (bad pointer, bad player, not a tag duel); a refusal writes nothing. `out`: `u8 version` (1), `u8 hand_count`, `u8 extra_count`, `u8 pad` (0), `u16 deck_count`, then `u32 hand[hand_count]`, `u32 extra[extra_count]` (bit 31 = face-up, as in `MSG_TAG_SWAP`), `u32 deck[deck_count]` sorted ascending (the order stays secret). At most 7 + 4 x (255 + 255 + 250) bytes in practice; size the buffer for your deck limits. The duel is byte-identical afterwards. |
|
| `ygol_query_tag_cards` | `int32_t ygol_query_tag_cards(intptr_t pduel, uint8_t playerid, uint8_t* out)` | v1.2.0 (TICKET-405), 2026-10-15. The waiting tag partner's cards of `playerid`'s side, read only. Returns the byte length written, 0 refused (bad pointer, bad player, not a tag duel); a refusal writes nothing. `out`: `u8 version` (1), `u8 hand_count`, `u8 extra_count`, `u8 pad` (0), `u16 deck_count`, then `u32 hand[hand_count]`, `u32 extra[extra_count]` (bit 31 = face-up, as in `MSG_TAG_SWAP`), `u32 deck[deck_count]` sorted ascending (the order stays secret). At most 7 + 4 x (255 + 255 + 250) bytes in practice; size the buffer for your deck limits. The duel is byte-identical afterwards. |
|
||||||
| `ygol_query_prompt_context` | `int32_t ygol_query_prompt_context(intptr_t pduel, uint8_t playerid, uint8_t* out)` | v1.7.0 (TICKET-451), 2026-11-08. Which effect asks the prompt the engine is parked on, read only; `playerid` is the answering player. Returns 22 (the bytes written), 0 refused (bad pointer, bad player); a refusal writes nothing. `out` (22 bytes, little-endian): `u8 version` (1), `u8 has_effect`, `u32 code` (the handler's `get_code()` now), `u8 controller`, `u8 location`, `u8 sequence`, `u8 position` (the handler now), `u64 description` (the effect's, 0 when none), `u16 effect_index`, `u8 phase` (1 cost, 2 target, 3 operation, 4 ask), `u8 chain_link` (the newest chain link whose effect it is, 0 when none). The effect is the innermost frame on `core.ygol_running`: a cost / target / operation function running (`field::execute_cost` / `execute_target` / `execute_operation`, the core's only coroutine calls; phases 1 / 2 / 3), or an effect the core itself asks about (phase 4, "ask"): the frame lives while that `MSG_SELECT_EFFECTYN` / `MSG_SELECT_YESNO` is open, at the optional trigger (`processor.cpp`, desc 0), the lone quick trigger (desc 221), the cost-time activation ask (desc 94), the three replacement asks (`operations.cpp`, desc 218 / 220 / 219) and Scrap Chimera's material ask (its own description). Other prompts the core builds itself either list several effects (`MSG_SELECT_CHAIN`, `IDLECMD`, `BATTLECMD`, the `SELECT_OPTION` among replacement effects or activation ways) or ask about no effect (attack, desc 31; the Pendulum / Spell-zone redirect, desc 97; Tribute and material prompts): they push nothing and show whatever runs around them. None running (battle and idle commands, chain prompts, a Summon without an effect) = `has_effect` 0, every other byte 0 and `effect_index` `0xFFFF`. **`effect_index`** is the order the card's script registered the effect while the card loaded (`card::add_effect` under `STATUS_INITIALIZING` stamps `initial_effect.size()`): the same in every duel and on every machine for that card's script; an effect registered at any other time (a clone, a copy, a grant, an effect made during the duel) is `0xFFFF`. **Hidden**: when the handler is not controlled by `playerid` and is not face-up (`is_position(POS_FACEUP)`: a face-down card, the other player's hand, Deck or face-down Extra Deck), `code` is 0, `effect_index` `0xFFFF` and `description` 0; the other fields stay. The duel is byte-identical afterwards. |
|
| `ygol_query_prompt_context` | `int32_t ygol_query_prompt_context(intptr_t pduel, uint8_t playerid, uint8_t* out)` | v1.7.0 (TICKET-451), 2026-11-08. Which effect asks the prompt the engine is parked on, read only; `playerid` is the answering player. Returns 23 (the bytes written), 0 refused (bad pointer, bad player); a refusal writes nothing. `out` (23 bytes, little-endian): `u8 version` (1), `u8 has_effect`, `u32 code` (the handler's `get_code()` now), `u8 controller`, `u8 location`, `u8 sequence`, `u8 position` (the handler now), `u64 description` (the effect's, 0 when none), `u16 effect_index`, `u8 phase` (1 cost, 2 target, 3 operation, 4 ask), `u8 chain_link` (the newest chain link whose effect it is, 0 when none), `u8 announce_kind` (only while a `MSG_ANNOUNCE_NUMBER` is open: 1 the script called `Duel.AnnounceLevel`, which passes `playerid + 0x10000` to the unit; else 2 when the asking effect has `CATEGORY_DICE` and is visible to `playerid`; else 0; always 0 for any other prompt). The effect is the innermost frame on `core.ygol_running`: a cost / target / operation function running (`field::execute_cost` / `execute_target` / `execute_operation`, the core's only coroutine calls; phases 1 / 2 / 3), or an effect the core itself asks about (phase 4, "ask"): the frame lives while that `MSG_SELECT_EFFECTYN` / `MSG_SELECT_YESNO` is open, at the optional trigger (`processor.cpp`, desc 0), the lone quick trigger (desc 221), the cost-time activation ask (desc 94), the three replacement asks (`operations.cpp`, desc 218 / 220 / 219) and Scrap Chimera's material ask (its own description). Other prompts the core builds itself either list several effects (`MSG_SELECT_CHAIN`, `IDLECMD`, `BATTLECMD`, the `SELECT_OPTION` among replacement effects or activation ways) or ask about no effect (attack, desc 31; the Pendulum / Spell-zone redirect, desc 97; Tribute and material prompts): they push nothing and show whatever runs around them. None running (battle and idle commands, chain prompts, a Summon without an effect) = `has_effect` 0, every other byte 0 but `announce_kind`, and `effect_index` `0xFFFF`. **`effect_index`** is the order the card's script registered the effect while the card loaded (`card::add_effect` under `STATUS_INITIALIZING` stamps `initial_effect.size()`): the same in every duel and on every machine for that card's script; an effect registered at any other time (a clone, a copy, a grant, an effect made during the duel) is `0xFFFF`. **Hidden**: when the handler is not controlled by `playerid` and is not face-up (`is_position(POS_FACEUP)`: a face-down card, the other player's hand, Deck or face-down Extra Deck), `code` is 0, `effect_index` `0xFFFF` and `description` 0; the other fields stay. The duel is byte-identical afterwards. |
|
||||||
| `get_registry_value` | `int32_t get_registry_value(intptr_t pduel, const char* key, byte* out_buf)` | Upstream (koishi) |
|
| `get_registry_value` | `int32_t get_registry_value(intptr_t pduel, const char* key, byte* out_buf)` | Upstream (koishi) |
|
||||||
| `set_registry_value` | `void set_registry_value(intptr_t pduel, const char* key, const char* value)` | Upstream (koishi). The server writes every setup pair here before `special.lua` (patch 0009). |
|
| `set_registry_value` | `void set_registry_value(intptr_t pduel, const char* key, const char* value)` | Upstream (koishi). The server writes every setup pair here before `special.lua` (patch 0009). |
|
||||||
| `get_registry_keys` | `int32_t get_registry_keys(intptr_t pduel, byte* out_buf)` | Upstream (koishi) |
|
| `get_registry_keys` | `int32_t get_registry_keys(intptr_t pduel, byte* out_buf)` | Upstream (koishi) |
|
||||||
@@ -207,7 +207,7 @@ duelist's own side (v1.2.0), both sides for an observer when spectators see all
|
|||||||
| `0x41` | `STOC_APPEARANCE` | `u16 sender` + `CTOS_Appearance` (354) | Yes | Everyone; stored per seat, replayed to joiners, dropped when the seat empties or moves to the watchers | `0x1` | 1 | 0006 |
|
| `0x41` | `STOC_APPEARANCE` | `u16 sender` + `CTOS_Appearance` (354) | Yes | Everyone; stored per seat, replayed to joiners, dropped when the seat empties or moves to the watchers | `0x1` | 1 | 0006 |
|
||||||
| `0x42` | `STOC_DIALOGUE` | `u16 sender` + `CTOS_Dialogue` (206) | Yes | Everyone | `0x2` | 1 | 0006 |
|
| `0x42` | `STOC_DIALOGUE` | `u16 sender` + `CTOS_Dialogue` (206) | Yes | Everyone | `0x2` | 1 | 0006 |
|
||||||
| `0x43` | `STOC_SETUP_PAIRS` | `u16 0xFF`, `u16 count`, then per pair `u16 length` + `key=value` bytes (no terminator) | Yes (`0xFF`) | Every joiner, in the snapshot | `0x4` | 1 | 0009 |
|
| `0x43` | `STOC_SETUP_PAIRS` | `u16 0xFF`, `u16 count`, then per pair `u16 length` + `key=value` bytes (no terminator) | Yes (`0xFF`) | Every joiner, in the snapshot | `0x4` | 1 | 0009 |
|
||||||
| `0x44` | `STOC_PROMPT_CONTEXT` | The 22 `ygol_query_prompt_context` bytes (section (a)) + `u8 prompt` (the `MSG_*` id of the prompt it belongs to); 23 bytes | No | The seat that answers the prompt (Tag: the team's current hand), and only when its `CTOS_CAPABILITY` had `0x8000`; the packet right before that prompt's `STOC_GAME_MSG`. Sent before every prompt the server relays but `MSG_ROCK_PAPER_SCISSORS`: `MSG_SELECT_BATTLECMD`, `IDLECMD`, `EFFECTYN`, `YESNO`, `OPTION`, `CARD`, `TRIBUTE`, `UNSELECT_CARD`, `CHAIN`, `PLACE`, `DISFIELD`, `POSITION`, `COUNTER`, `SUM`, `MSG_SORT_CARD`, `MSG_ANNOUNCE_RACE`, `ATTRIB`, `CARD`, `NUMBER`. A prompt with no effect running gets `has_effect` 0, so a client never keeps a stale context. Never to observers, the waiting Tag partner or the server-mode recorders, never in a replay; a `MSG_RETRY` re-ask gets none (the context still stands) | `0x8000` | 12 | v1.7.0 |
|
| `0x44` | `STOC_PROMPT_CONTEXT` | The 23 `ygol_query_prompt_context` bytes (section (a)) + `u8 prompt` (the `MSG_*` id of the prompt it belongs to); 24 bytes | No | The seat that answers the prompt (Tag: the team's current hand), and only when its `CTOS_CAPABILITY` had `0x8000`; the packet right before that prompt's `STOC_GAME_MSG`. Sent before every prompt the server relays but `MSG_ROCK_PAPER_SCISSORS`: `MSG_SELECT_BATTLECMD`, `IDLECMD`, `EFFECTYN`, `YESNO`, `OPTION`, `CARD`, `TRIBUTE`, `UNSELECT_CARD`, `CHAIN`, `PLACE`, `DISFIELD`, `POSITION`, `COUNTER`, `SUM`, `MSG_SORT_CARD`, `MSG_ANNOUNCE_RACE`, `ATTRIB`, `CARD`, `NUMBER`. A prompt with no effect running gets `has_effect` 0, so a client never keeps a stale context. Never to observers, the waiting Tag partner or the server-mode recorders, never in a replay; a `MSG_RETRY` re-ask gets none (the context still stands) | `0x8000` | 12 | v1.7.0 |
|
||||||
| `0x50` | `STOC_SEAT_PLAN` | `u16 0xFF` + `STOC_SeatPlan` (23): `u8 restart_id[16]`, `u16 revision`, `u8 seat_count`, `u8 kind[4]` (25 total; no token on the wire) | Yes (`0xFF`) | Everyone after a plan, swap or move; joiners in the snapshot | `0x8` | 2 | 0011 |
|
| `0x50` | `STOC_SEAT_PLAN` | `u16 0xFF` + `STOC_SeatPlan` (23): `u8 restart_id[16]`, `u16 revision`, `u8 seat_count`, `u8 kind[4]` (25 total; no token on the wire) | Yes (`0xFF`) | Everyone after a plan, swap or move; joiners in the snapshot | `0x8` | 2 | 0011 |
|
||||||
| `0x54` | `STOC_ROOM_RESTARTING` | `u16 0xFF` + `STOC_RoomRestarting` (38): `u8 phase` (1 Prepare, 2 Commit, 3 Abort), `u8 restart_id[16]`, `u8 seat`, `u8 token[16]`, `u32 timeout_ms` | Yes (`0xFF`) | Each participant, with ITS OWN seat and token only | `0x10` | 2 | 0012 |
|
| `0x54` | `STOC_ROOM_RESTARTING` | `u16 0xFF` + `STOC_RoomRestarting` (38): `u8 phase` (1 Prepare, 2 Commit, 3 Abort), `u8 restart_id[16]`, `u8 seat`, `u8 token[16]`, `u32 timeout_ms` | Yes (`0xFF`) | Each participant, with ITS OWN seat and token only | `0x10` | 2 | 0012 |
|
||||||
| `0x56` | `STOC_RESTART_STATUS` | `u16 0xFF` + `STOC_RestartStatus` (21): `u8 phase`, `u8 restart_id[16]`, `u8 acked`, `u8 expected`, `u8 complete`, `u8 reason` (0 none, 1 incompatible, 2 ack timeout, 3 not lobby, 4 not host, 5 busy, 6 bad request) | Yes (`0xFF`) | The host only | `0x10` | 2 | 0012 |
|
| `0x56` | `STOC_RESTART_STATUS` | `u16 0xFF` + `STOC_RestartStatus` (21): `u8 phase`, `u8 restart_id[16]`, `u8 acked`, `u8 expected`, `u8 complete`, `u8 reason` (0 none, 1 incompatible, 2 ack timeout, 3 not lobby, 4 not host, 5 busy, 6 bad request) | Yes (`0xFF`) | The host only | `0x10` | 2 | 0012 |
|
||||||
@@ -458,7 +458,7 @@ Namespaces:
|
|||||||
|
|
||||||
| Namespace | What |
|
| Namespace | What |
|
||||||
|---|---|
|
|---|---|
|
||||||
| `YGOLegacy.Protocol.{Contracts, Codecs, Framing, Routing}` | Section (b) in C#: the message ids and payload records, the CTOS / STOC codecs, the frame codec and the STOC router. Unchanged from the Unity repo (TICKET-397); v1.2.0 adds `StocMessage.TagPartnerCards`, `FeatureFlags.TagPartnerCards`, the `TagPartnerCards` record and `StocCodecs.TagPartnerCards`, and `Capability.ProtocolVersion` is 9; v1.4.0 adds `ReplayFlags` (`SetupPairs` = `0x40000000`, `SideLp` = `0x20000000`); v1.5.0 adds `FeatureFlags.TagTwoFields` (`0x1000`, in `All`) and `Capability.ProtocolVersion` is 10; v1.6.0 adds `FeatureFlags.TagSharedExtra` (`0x4000`, in `All`) and `Capability.ProtocolVersion` is 11; v1.7.0 adds `StocMessage.PromptContext` (`0x44`), `FeatureFlags.PromptContext` (`0x8000`, in `All`), the `PromptContext` record (`HasEffect`, `Code`, `Controller`, `Location`, `Sequence`, `Position`, `Description`, `EffectIndex`, `Phase`, `ChainLink`, `Prompt`, `IsHidden`, `None(prompt)`, `UnknownIndex` `0xFFFF`, `PhaseCost` / `PhaseTarget` / `PhaseOperation` 1 / 2 / 3) and `StocCodecs.PromptContext` (`PromptContextCodec`, 23 bytes), and `Capability.ProtocolVersion` is 12. |
|
| `YGOLegacy.Protocol.{Contracts, Codecs, Framing, Routing}` | Section (b) in C#: the message ids and payload records, the CTOS / STOC codecs, the frame codec and the STOC router. Unchanged from the Unity repo (TICKET-397); v1.2.0 adds `StocMessage.TagPartnerCards`, `FeatureFlags.TagPartnerCards`, the `TagPartnerCards` record and `StocCodecs.TagPartnerCards`, and `Capability.ProtocolVersion` is 9; v1.4.0 adds `ReplayFlags` (`SetupPairs` = `0x40000000`, `SideLp` = `0x20000000`); v1.5.0 adds `FeatureFlags.TagTwoFields` (`0x1000`, in `All`) and `Capability.ProtocolVersion` is 10; v1.6.0 adds `FeatureFlags.TagSharedExtra` (`0x4000`, in `All`) and `Capability.ProtocolVersion` is 11; v1.7.0 adds `StocMessage.PromptContext` (`0x44`), `FeatureFlags.PromptContext` (`0x8000`, in `All`), the `PromptContext` record (`HasEffect`, `Code`, `Controller`, `Location`, `Sequence`, `Position`, `Description`, `EffectIndex`, `Phase`, `ChainLink`, `AnnounceKind`, `Prompt`, `IsHidden`, `None(prompt)`, `UnknownIndex` `0xFFFF`, `PhaseCost` / `PhaseTarget` / `PhaseOperation` / `PhaseAsk` 1 / 2 / 3 / 4, `AnnouncePlain` / `AnnounceLevel` / `AnnounceDice` 0 / 1 / 2) and `StocCodecs.PromptContext` (`PromptContextCodec`, 24 bytes), and `Capability.ProtocolVersion` is 12. |
|
||||||
| `YGOLegacy.Engine` | The four types below (TICKET-398). |
|
| `YGOLegacy.Engine` | The four types below (TICKET-398). |
|
||||||
|
|
||||||
| Type | What |
|
| Type | What |
|
||||||
|
|||||||
+4
-3
@@ -91,12 +91,13 @@ OCGCORE_API int32_t ygol_preview_attack(intptr_t pduel, uint8_t playerid, uint8_
|
|||||||
OCGCORE_API int32_t ygol_query_tag_cards(intptr_t pduel, uint8_t playerid, uint8_t* out);
|
OCGCORE_API int32_t ygol_query_tag_cards(intptr_t pduel, uint8_t playerid, uint8_t* out);
|
||||||
|
|
||||||
// [YGOL] v1.7.0 (prompt context, TICKET-451): which effect asks the prompt the engine is parked on, read only.
|
// [YGOL] v1.7.0 (prompt context, TICKET-451): which effect asks the prompt the engine is parked on, read only.
|
||||||
// playerid = the answering player. out (22 bytes): version (1), has_effect, uint32 code (the handler's current
|
// playerid = the answering player. out (23 bytes): version (1), has_effect, uint32 code (the handler's current
|
||||||
// code), controller, location, sequence, position, uint64 description, uint16 effect_index (the order the
|
// code), controller, location, sequence, position, uint64 description, uint16 effect_index (the order the
|
||||||
// card's script registered the effect in initial_effect; 0xffff unknown), phase (1 cost, 2 target, 3 operation, 4 the core asks whether to use the effect),
|
// card's script registered the effect in initial_effect; 0xffff unknown), phase (1 cost, 2 target, 3 operation, 4 the core asks whether to use the effect),
|
||||||
// chain link (0 none). has_effect 0 = no effect function runs: every other byte 0, effect_index 0xffff. A
|
// chain link (0 none), announce kind (MSG_ANNOUNCE_NUMBER only: 1 Duel.AnnounceLevel, 2 the effect has
|
||||||
|
// CATEGORY_DICE and is visible, else 0). has_effect 0 = no effect runs: every other byte 0 but announce kind, effect_index 0xffff. A
|
||||||
// handler playerid does not control and that is not face-up writes code 0, effect_index 0xffff, description 0.
|
// handler playerid does not control and that is not face-up writes code 0, effect_index 0xffff, description 0.
|
||||||
// Returns 22, 0 refused (bad pointer, bad player); a refusal writes nothing.
|
// Returns 23, 0 refused (bad pointer, bad player); a refusal writes nothing.
|
||||||
OCGCORE_API int32_t ygol_query_prompt_context(intptr_t pduel, uint8_t playerid, uint8_t* out);
|
OCGCORE_API int32_t ygol_query_prompt_context(intptr_t pduel, uint8_t playerid, uint8_t* out);
|
||||||
|
|
||||||
// koishi specific
|
// koishi specific
|
||||||
|
|||||||
@@ -178,10 +178,11 @@
|
|||||||
# that never run, then an Activate that asks a yes/no in its cost, an option in its target and a yes/no in its
|
# that never run, then an Activate that asks a yes/no in its cost, an option in its target and a yes/no in its
|
||||||
# operation, runs a Fusion Monster's material procedure (which asks) inside that operation and asks again, shuffles
|
# operation, runs a Fusion Monster's material procedure (which asks) inside that operation and asks again, shuffles
|
||||||
# itself into the deck and asks the opponent, then its controller. Every prompt a seat with
|
# itself into the deck and asks the opponent, then its controller. Every prompt a seat with
|
||||||
# 0x8000 gets comes right after one 23-byte PROMPT_CONTEXT (0x44) naming that prompt: idle, chain and battle
|
# 0x8000 gets comes right after one 24-byte PROMPT_CONTEXT (0x44) naming that prompt: idle, chain and battle
|
||||||
# prompts say no effect; cost / target / operation say Probe Ask, phase 1 / 2 / 3, effect index 2, its
|
# prompts say no effect; cost / target / operation say Probe Ask, phase 1 / 2 / 3, effect index 2, its
|
||||||
# description, chain link 1; the nested procedure names the Fusion (index 1, chain link 0) and the operation's
|
# description, chain link 1; the nested procedure names the Fusion (index 1, chain link 0) and the operation's
|
||||||
# next prompt names Probe Ask again; the Fusion's optional End Phase trigger is asked with phase 4 (ask), index 2;
|
# next prompt names Probe Ask again; an announce says kind 0 (plain), 1 (Duel.AnnounceLevel) or 2 (a dice effect);
|
||||||
|
# the Fusion's optional End Phase trigger is asked with phase 4 (ask), index 2;
|
||||||
# the opponent's yes/no names the card in the deck as hidden (code 0, index 0xFFFF,
|
# the opponent's yes/no names the card in the deck as hidden (code 0, index 0xFFFF,
|
||||||
# description 0) while its controller's next one still names it. A watcher with 0x8000, a seat without it and
|
# description 0) while its controller's next one still names it. A watcher with 0x8000, a seat without it and
|
||||||
# the waiting Tag partners get none; a second duel with another deck order reports the same indexes.
|
# the waiting Tag partners get none; a second duel with another deck order reports the same indexes.
|
||||||
@@ -3633,6 +3634,7 @@ NAMES.update({0x44: "PROMPT_CONTEXT"})
|
|||||||
PROBE_ASK = PROBE_CARD + 1000
|
PROBE_ASK = PROBE_CARD + 1000
|
||||||
PROBE_ASK_FUSION = PROBE_CARD + 1001
|
PROBE_ASK_FUSION = PROBE_CARD + 1001
|
||||||
LOCATION_DECK = 0x01
|
LOCATION_DECK = 0x01
|
||||||
|
MSG_ANNOUNCE_NUMBER = 143
|
||||||
PROMPT_MSGS = {10, 11, 12, 13, 14, 15, 16, 18, 19, 20, 22, 23, 24, 25, 26, 140, 141, 142, 143}
|
PROMPT_MSGS = {10, 11, 12, 13, 14, 15, 16, 18, 19, 20, 22, 23, 24, 25, 26, 140, 141, 142, 143}
|
||||||
ASK_LUA = """--Probe Ask (TICKET-451): two effects that never run, then an Activate that asks in its cost, target and operation,
|
ASK_LUA = """--Probe Ask (TICKET-451): two effects that never run, then an Activate that asks in its cost, target and operation,
|
||||||
--runs Probe Ask Fusion's material procedure (which asks too) and asks again, shuffles itself into the deck and asks
|
--runs Probe Ask Fusion's material procedure (which asks too) and asks again, shuffles itself into the deck and asks
|
||||||
@@ -3650,6 +3652,7 @@ function s.initial_effect(c)
|
|||||||
c:RegisterEffect(e1)
|
c:RegisterEffect(e1)
|
||||||
local e2=Effect.CreateEffect(c)
|
local e2=Effect.CreateEffect(c)
|
||||||
e2:SetDescription(id*16+1)
|
e2:SetDescription(id*16+1)
|
||||||
|
e2:SetCategory(CATEGORY_DICE)
|
||||||
e2:SetType(EFFECT_TYPE_ACTIVATE)
|
e2:SetType(EFFECT_TYPE_ACTIVATE)
|
||||||
e2:SetCode(EVENT_FREE_CHAIN)
|
e2:SetCode(EVENT_FREE_CHAIN)
|
||||||
e2:SetCost(s.cost)
|
e2:SetCost(s.cost)
|
||||||
@@ -3671,6 +3674,8 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp)
|
|||||||
local fc=Duel.GetFirstMatchingCard(Card.IsCode,tp,LOCATION_EXTRA,0,nil,id+1)
|
local fc=Duel.GetFirstMatchingCard(Card.IsCode,tp,LOCATION_EXTRA,0,nil,id+1)
|
||||||
if fc then Duel.SelectFusionMaterial(tp,fc,Duel.GetFieldGroup(tp,LOCATION_HAND,0)) end
|
if fc then Duel.SelectFusionMaterial(tp,fc,Duel.GetFieldGroup(tp,LOCATION_HAND,0)) end
|
||||||
Duel.SelectYesNo(tp,id*16+8)
|
Duel.SelectYesNo(tp,id*16+8)
|
||||||
|
Duel.AnnounceLevel(tp,1,12)
|
||||||
|
Duel.AnnounceNumber(tp,1,2,3,4,5,6)
|
||||||
c:CancelToGrave()
|
c:CancelToGrave()
|
||||||
Duel.SendtoDeck(c,nil,0,REASON_EFFECT)
|
Duel.SendtoDeck(c,nil,0,REASON_EFFECT)
|
||||||
Duel.SelectYesNo(1-tp,id*16+6)
|
Duel.SelectYesNo(1-tp,id*16+6)
|
||||||
@@ -3717,6 +3722,7 @@ function s.fcon(e,g,gc,chkf)
|
|||||||
end
|
end
|
||||||
function s.fop(e,tp,eg,ep,ev,re,r,rp,gc,chkf)
|
function s.fop(e,tp,eg,ep,ev,re,r,rp,gc,chkf)
|
||||||
Duel.SelectYesNo(tp,id*16+2)
|
Duel.SelectYesNo(tp,id*16+2)
|
||||||
|
Duel.AnnounceNumber(tp,7,8)
|
||||||
Duel.SetFusionMaterial(Group.CreateGroup())
|
Duel.SetFusionMaterial(Group.CreateGroup())
|
||||||
end
|
end
|
||||||
"""
|
"""
|
||||||
@@ -3725,10 +3731,10 @@ ASK_TRIGGER_INDEX = 2
|
|||||||
|
|
||||||
|
|
||||||
def prompt_context(d):
|
def prompt_context(d):
|
||||||
# 22-byte record + the prompt's MSG id: version, has effect, u32 code, controller, location, sequence, position,
|
# 23-byte record + the prompt's MSG id: version, has effect, u32 code, controller, location, sequence, position,
|
||||||
# u64 description, u16 effect index, phase, chain link, prompt
|
# u64 description, u16 effect index, phase, chain link, announce kind, prompt
|
||||||
keys = ("version", "has", "code", "controller", "location", "sequence", "position", "description", "index", "phase", "chain", "prompt")
|
keys = ("version", "has", "code", "controller", "location", "sequence", "position", "description", "index", "phase", "chain", "announce", "prompt")
|
||||||
return dict(zip(keys, struct.unpack("<BBIBBBBQHBBB", d)))
|
return dict(zip(keys, struct.unpack("<BBIBBBBQHBBBB", d)))
|
||||||
|
|
||||||
|
|
||||||
def prompts_with_context(c):
|
def prompts_with_context(c):
|
||||||
@@ -3737,7 +3743,7 @@ def prompts_with_context(c):
|
|||||||
for i, (p, d) in enumerate(c.log):
|
for i, (p, d) in enumerate(c.log):
|
||||||
if p == 0x01 and d and d[0] in PROMPT_MSGS:
|
if p == 0x01 and d and d[0] in PROMPT_MSGS:
|
||||||
prev = c.log[i - 1] if i else (None, b"")
|
prev = c.log[i - 1] if i else (None, b"")
|
||||||
ctx = prompt_context(prev[1]) if prev[0] == STOC_PROMPT_CONTEXT and len(prev[1]) == 23 else None
|
ctx = prompt_context(prev[1]) if prev[0] == STOC_PROMPT_CONTEXT and len(prev[1]) == 24 else None
|
||||||
out.append((d[0], d, ctx))
|
out.append((d[0], d, ctx))
|
||||||
return out
|
return out
|
||||||
|
|
||||||
@@ -3748,7 +3754,7 @@ def contexts_of(c):
|
|||||||
|
|
||||||
def is_none_context(ctx, prompt):
|
def is_none_context(ctx, prompt):
|
||||||
return ctx == {"version": 1, "has": 0, "code": 0, "controller": 0, "location": 0, "sequence": 0, "position": 0,
|
return ctx == {"version": 1, "has": 0, "code": 0, "controller": 0, "location": 0, "sequence": 0, "position": 0,
|
||||||
"description": 0, "index": 0xFFFF, "phase": 0, "chain": 0, "prompt": prompt}
|
"description": 0, "index": 0xFFFF, "phase": 0, "chain": 0, "announce": 0, "prompt": prompt}
|
||||||
|
|
||||||
|
|
||||||
def prompt_context_room(dll_path, port, label, mode, opponent_bit=True, fusion_first=False):
|
def prompt_context_room(dll_path, port, label, mode, opponent_bit=True, fusion_first=False):
|
||||||
@@ -3841,7 +3847,7 @@ def prompt_context_room(dll_path, port, label, mode, opponent_bit=True, fusion_f
|
|||||||
answer(c, first_free_zone(d))
|
answer(c, first_free_zone(d))
|
||||||
elif t in (MSG_SELECT_EFFECTYN, MSG_SELECT_YESNO):
|
elif t in (MSG_SELECT_EFFECTYN, MSG_SELECT_YESNO):
|
||||||
answer(c, struct.pack("<i", 1))
|
answer(c, struct.pack("<i", 1))
|
||||||
elif t == MSG_SELECT_OPTION:
|
elif t in (MSG_SELECT_OPTION, MSG_ANNOUNCE_NUMBER):
|
||||||
answer(c, struct.pack("<i", 0))
|
answer(c, struct.pack("<i", 0))
|
||||||
if state["done"]:
|
if state["done"]:
|
||||||
return True
|
return True
|
||||||
@@ -3861,7 +3867,7 @@ def prompt_context_room(dll_path, port, label, mode, opponent_bit=True, fusion_f
|
|||||||
check(not contexts_of(c), "%s: %s advertised no 0x8000 and got no PROMPT_CONTEXT (%d)" % (label, c.name, len(contexts_of(c))))
|
check(not contexts_of(c), "%s: %s advertised no 0x8000 and got no PROMPT_CONTEXT (%d)" % (label, c.name, len(contexts_of(c))))
|
||||||
continue
|
continue
|
||||||
missing = [hex(t) for t, _, ctx in got if ctx is None or ctx["prompt"] != t]
|
missing = [hex(t) for t, _, ctx in got if ctx is None or ctx["prompt"] != t]
|
||||||
check(not missing, "%s: %s: each of its %d prompts came right after a 23-byte PROMPT_CONTEXT naming that prompt (missing: %s)" % (label, c.name, len(got), missing))
|
check(not missing, "%s: %s: each of its %d prompts came right after a 24-byte PROMPT_CONTEXT naming that prompt (missing: %s)" % (label, c.name, len(got), missing))
|
||||||
check(len(contexts_of(c)) == len(got), "%s: %s: one PROMPT_CONTEXT per prompt, none on its own (%d contexts, %d prompts)" % (label, c.name, len(contexts_of(c)), len(got)))
|
check(len(contexts_of(c)) == len(got), "%s: %s: one PROMPT_CONTEXT per prompt, none on its own (%d contexts, %d prompts)" % (label, c.name, len(contexts_of(c)), len(got)))
|
||||||
check(not contexts_of(w), "%s: the watcher advertised 0x8000 and got no PROMPT_CONTEXT (%d)" % (label, len(contexts_of(w))))
|
check(not contexts_of(w), "%s: the watcher advertised 0x8000 and got no PROMPT_CONTEXT (%d)" % (label, len(contexts_of(w))))
|
||||||
|
|
||||||
@@ -3896,6 +3902,11 @@ def prompt_context_room(dll_path, port, label, mode, opponent_bit=True, fusion_f
|
|||||||
"%s: the End Phase \"use this effect?\" for the optional trigger names Probe Ask Fusion in the Extra Deck, effect index 2, its description, phase 4 (ask), chain link 0 (%s)" % (label, optional))
|
"%s: the End Phase \"use this effect?\" for the optional trigger names Probe Ask Fusion in the Extra Deck, effect index 2, its description, phase 4 (ask), chain link 0 (%s)" % (label, optional))
|
||||||
if optional:
|
if optional:
|
||||||
seen["index"] = seen.get("index", []) + [optional[0]["index"]]
|
seen["index"] = seen.get("index", []) + [optional[0]["index"]]
|
||||||
|
announces = [(ctx["code"], ctx["phase"], ctx["announce"]) for t, d, ctx in mine if t == MSG_ANNOUNCE_NUMBER]
|
||||||
|
check(announces == [(PROBE_ASK_FUSION, 3, 0), (PROBE_ASK, 3, 1), (PROBE_ASK, 3, 2)],
|
||||||
|
"%s: announce kind: the Fusion's plain Duel.AnnounceNumber says 0, Probe Ask's Duel.AnnounceLevel 1 (level wins over dice), its dice effect's Duel.AnnounceNumber 2 (%s)" % (label, announces))
|
||||||
|
others = [ctx["announce"] for c in seated for t, d, ctx in prompts_with_context(c) if ctx and t != MSG_ANNOUNCE_NUMBER]
|
||||||
|
check(others and not any(others), "%s: every other prompt's context has announce kind 0 (%d prompts)" % (label, len(others)))
|
||||||
opponent = [c for c in seated if c is not a and any(t == MSG_SELECT_YESNO for t, _, _ in prompts_with_context(c))]
|
opponent = [c for c in seated if c is not a and any(t == MSG_SELECT_YESNO for t, _, _ in prompts_with_context(c))]
|
||||||
check(len(opponent) == 1, "%s: exactly one other seat answered the operation's yes/no (%s)" % (label, [c.name for c in opponent]))
|
check(len(opponent) == 1, "%s: exactly one other seat answered the operation's yes/no (%s)" % (label, [c.name for c in opponent]))
|
||||||
if opponent and opponent[0] not in bitless:
|
if opponent and opponent[0] not in bitless:
|
||||||
|
|||||||
@@ -349,6 +349,7 @@ struct processor {
|
|||||||
uint16_t script_index{ 0xffff };
|
uint16_t script_index{ 0xffff };
|
||||||
uint8_t phase{ 0 };
|
uint8_t phase{ 0 };
|
||||||
uint8_t chain_link{ 0 };
|
uint8_t chain_link{ 0 };
|
||||||
|
uint64_t category{ 0 };
|
||||||
};
|
};
|
||||||
std::vector<ygol_running_effect> ygol_running;
|
std::vector<ygol_running_effect> ygol_running;
|
||||||
uint8_t shuffle_check_disabled{ FALSE };
|
uint8_t shuffle_check_disabled{ FALSE };
|
||||||
|
|||||||
@@ -492,6 +492,9 @@ OCGCORE_API int32_t ygol_query_prompt_context(intptr_t pduel, uint8_t playerid,
|
|||||||
card* handler = running.empty() ? nullptr : running.back().handler;
|
card* handler = running.empty() ? nullptr : running.back().handler;
|
||||||
if(handler && !pd->cards.count(handler))
|
if(handler && !pd->cards.count(handler))
|
||||||
handler = nullptr;
|
handler = nullptr;
|
||||||
|
const auto& units = pd->game_field->core.units;
|
||||||
|
const bool announce = !units.empty() && units.front().type == PROCESSOR_ANNOUNCE_NUMBER;
|
||||||
|
const bool announce_level = announce && (units.front().arg1 >> 16) == 1; // Duel.AnnounceLevel passes playerid + 0x10000
|
||||||
byte* ptr = out;
|
byte* ptr = out;
|
||||||
buffer_write<uint8_t>(ptr, 1);
|
buffer_write<uint8_t>(ptr, 1);
|
||||||
if(!handler) {
|
if(!handler) {
|
||||||
@@ -505,6 +508,7 @@ OCGCORE_API int32_t ygol_query_prompt_context(intptr_t pduel, uint8_t playerid,
|
|||||||
buffer_write<uint16_t>(ptr, 0xffff);
|
buffer_write<uint16_t>(ptr, 0xffff);
|
||||||
buffer_write<uint8_t>(ptr, 0);
|
buffer_write<uint8_t>(ptr, 0);
|
||||||
buffer_write<uint8_t>(ptr, 0);
|
buffer_write<uint8_t>(ptr, 0);
|
||||||
|
buffer_write<uint8_t>(ptr, announce_level ? 1 : 0);
|
||||||
return (int32_t)(ptr - out);
|
return (int32_t)(ptr - out);
|
||||||
}
|
}
|
||||||
const auto& top = running.back();
|
const auto& top = running.back();
|
||||||
@@ -519,6 +523,7 @@ OCGCORE_API int32_t ygol_query_prompt_context(intptr_t pduel, uint8_t playerid,
|
|||||||
buffer_write<uint16_t>(ptr, visible ? top.script_index : 0xffff);
|
buffer_write<uint16_t>(ptr, visible ? top.script_index : 0xffff);
|
||||||
buffer_write<uint8_t>(ptr, top.phase);
|
buffer_write<uint8_t>(ptr, top.phase);
|
||||||
buffer_write<uint8_t>(ptr, top.chain_link);
|
buffer_write<uint8_t>(ptr, top.chain_link);
|
||||||
|
buffer_write<uint8_t>(ptr, announce_level ? 1 : (announce && visible && (top.category & CATEGORY_DICE)) ? 2 : 0);
|
||||||
return (int32_t)(ptr - out);
|
return (int32_t)(ptr - out);
|
||||||
}
|
}
|
||||||
OCGCORE_API int32_t get_registry_value(intptr_t pduel, const char* key, byte* out_buf) {
|
OCGCORE_API int32_t get_registry_value(intptr_t pduel, const char* key, byte* out_buf) {
|
||||||
|
|||||||
+4
-3
@@ -88,12 +88,13 @@ OCGCORE_API int32_t ygol_preview_attack(intptr_t pduel, uint8_t playerid, uint8_
|
|||||||
OCGCORE_API int32_t ygol_query_tag_cards(intptr_t pduel, uint8_t playerid, uint8_t* out);
|
OCGCORE_API int32_t ygol_query_tag_cards(intptr_t pduel, uint8_t playerid, uint8_t* out);
|
||||||
|
|
||||||
// [YGOL] v1.7.0 (prompt context, TICKET-451): which effect asks the prompt the engine is parked on, read only.
|
// [YGOL] v1.7.0 (prompt context, TICKET-451): which effect asks the prompt the engine is parked on, read only.
|
||||||
// playerid = the answering player. out (22 bytes): version (1), has_effect, uint32 code (the handler's current
|
// playerid = the answering player. out (23 bytes): version (1), has_effect, uint32 code (the handler's current
|
||||||
// code), controller, location, sequence, position, uint64 description, uint16 effect_index (the order the
|
// code), controller, location, sequence, position, uint64 description, uint16 effect_index (the order the
|
||||||
// card's script registered the effect in initial_effect; 0xffff unknown), phase (1 cost, 2 target, 3 operation, 4 the core asks whether to use the effect),
|
// card's script registered the effect in initial_effect; 0xffff unknown), phase (1 cost, 2 target, 3 operation, 4 the core asks whether to use the effect),
|
||||||
// chain link (0 none). has_effect 0 = no effect function runs: every other byte 0, effect_index 0xffff. A
|
// chain link (0 none), announce kind (MSG_ANNOUNCE_NUMBER only: 1 Duel.AnnounceLevel, 2 the effect has
|
||||||
|
// CATEGORY_DICE and is visible, else 0). has_effect 0 = no effect runs: every other byte 0 but announce kind, effect_index 0xffff. A
|
||||||
// handler playerid does not control and that is not face-up writes code 0, effect_index 0xffff, description 0.
|
// handler playerid does not control and that is not face-up writes code 0, effect_index 0xffff, description 0.
|
||||||
// Returns 22, 0 refused (bad pointer, bad player); a refusal writes nothing.
|
// Returns 23, 0 refused (bad pointer, bad player); a refusal writes nothing.
|
||||||
OCGCORE_API int32_t ygol_query_prompt_context(intptr_t pduel, uint8_t playerid, uint8_t* out);
|
OCGCORE_API int32_t ygol_query_prompt_context(intptr_t pduel, uint8_t playerid, uint8_t* out);
|
||||||
|
|
||||||
// koishi specific
|
// koishi specific
|
||||||
|
|||||||
@@ -744,6 +744,7 @@ void ygol_push_running(field* pfield, effect* peffect, uint8_t phase) {
|
|||||||
running.description = peffect->description;
|
running.description = peffect->description;
|
||||||
running.script_index = peffect->ygol_script_index;
|
running.script_index = peffect->ygol_script_index;
|
||||||
running.phase = phase;
|
running.phase = phase;
|
||||||
|
running.category = peffect->category;
|
||||||
auto& chain = pfield->core.current_chain;
|
auto& chain = pfield->core.current_chain;
|
||||||
for(auto it = chain.rbegin(); it != chain.rend(); ++it) {
|
for(auto it = chain.rbegin(); it != chain.rend(); ++it) {
|
||||||
if(it->triggering_effect == peffect) {
|
if(it->triggering_effect == peffect) {
|
||||||
|
|||||||
@@ -476,7 +476,7 @@ constexpr uint32_t FEATURE_TAG_SHARED_EXTRA = 0x4000;
|
|||||||
// YGOL prompt context (proposal 55): which card and which effect asks (ygol_query_prompt_context), sent to the answering seat right
|
// YGOL prompt context (proposal 55): which card and which effect asks (ygol_query_prompt_context), sent to the answering seat right
|
||||||
// before every relayed prompt but rock-paper-scissors; never to observers, never in a replay; a room does not refuse a joiner without it
|
// before every relayed prompt but rock-paper-scissors; never to observers, never in a replay; a room does not refuse a joiner without it
|
||||||
constexpr uint32_t FEATURE_PROMPT_CONTEXT = 0x8000;
|
constexpr uint32_t FEATURE_PROMPT_CONTEXT = 0x8000;
|
||||||
constexpr int PROMPT_CONTEXT_RECORD_SIZE = 22; // the ygol_query_prompt_context answer; the message adds the prompt's MSG id after it
|
constexpr int PROMPT_CONTEXT_RECORD_SIZE = 23; // the ygol_query_prompt_context answer; the message adds the prompt's MSG id after it
|
||||||
constexpr uint8_t TAG_PARTNER_CARDS_VERSION = 1;
|
constexpr uint8_t TAG_PARTNER_CARDS_VERSION = 1;
|
||||||
// the one-use bootstrap secret of a replacement server: a host-string token parsed apart from the ygol.* pairs, never stored anywhere else
|
// the one-use bootstrap secret of a replacement server: a host-string token parsed apart from the ygol.* pairs, never stored anywhere else
|
||||||
extern uint8_t bootstrap_secret[16];
|
extern uint8_t bootstrap_secret[16];
|
||||||
@@ -672,7 +672,7 @@ inline bool IsFeatureMessage(unsigned char pktType) {
|
|||||||
#define STOC_APPEARANCE 0x41 // uint16_t + CTOS_Appearance
|
#define STOC_APPEARANCE 0x41 // uint16_t + CTOS_Appearance
|
||||||
#define STOC_DIALOGUE 0x42 // uint16_t + CTOS_Dialogue
|
#define STOC_DIALOGUE 0x42 // uint16_t + CTOS_Dialogue
|
||||||
#define STOC_SETUP_PAIRS 0x43 // uint16_t (0xff) + uint16_t count, then per pair uint16_t length + "key=value"
|
#define STOC_SETUP_PAIRS 0x43 // uint16_t (0xff) + uint16_t count, then per pair uint16_t length + "key=value"
|
||||||
#define STOC_PROMPT_CONTEXT 0x44 // the 22-byte ygol_query_prompt_context record + uint8_t prompt MSG id, no sender stamp, to the answering seat only (YGOL prompt context)
|
#define STOC_PROMPT_CONTEXT 0x44 // the 23-byte ygol_query_prompt_context record + uint8_t prompt MSG id, no sender stamp, to the answering seat only (YGOL prompt context)
|
||||||
#define STOC_SEAT_PLAN 0x50 // uint16_t (0xff) + STOC_SeatPlan (YGOL host seats)
|
#define STOC_SEAT_PLAN 0x50 // uint16_t (0xff) + STOC_SeatPlan (YGOL host seats)
|
||||||
// YGOL rules restart: uint16_t (0xff) + the struct
|
// YGOL rules restart: uint16_t (0xff) + the struct
|
||||||
#define STOC_ROOM_RESTARTING 0x54 // STOC_RoomRestarting, to each participant with its own seat and token
|
#define STOC_ROOM_RESTARTING 0x54 // STOC_RoomRestarting, to each participant with its own seat and token
|
||||||
|
|||||||
Reference in new issue
Block a user