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:
donnyandClaude Opus 5.5 committed 2026-11-08 16:46:05 -07:00
1 parent 3f84b0b50b
commit 954fbfc65b
12 files changed
+70 -40

No files matched your search

@@ -287,27 +287,28 @@ namespace YGOLegacy.Protocol.Tests
}
[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)StocMessage.PromptContext, Is.EqualTo(0x44));
Assert.That(FeatureFlags.PromptContext, Is.EqualTo(0x8000));
Assert.That(FeatureFlags.All & FeatureFlags.PromptContext, Is.EqualTo(FeatureFlags.PromptContext));
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 }));
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));
Assert.That(bytes.Length, Is.EqualTo(23));
Assert.That(bytes.Length, Is.EqualTo(24));
Assert.That(bytes[0], Is.EqualTo(1));
Assert.That(bytes[1], Is.EqualTo(1));
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(BitConverter.ToUInt64(bytes, 10), Is.EqualTo(description));
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));
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.Phase, Is.EqualTo(PromptContext.PhaseOperation));
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)));
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);
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.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]