fix(net): Phase L.1c conform combat wire events
This commit is contained in:
parent
460f95cb42
commit
29afc94b94
8 changed files with 241 additions and 177 deletions
|
|
@ -241,28 +241,32 @@ public sealed class GameEventWiringTests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void WireAll_KillerNotification_FiresKillLandedOnCombatState()
|
||||
public void WireAll_KillerNotification_AppendsCombatLine()
|
||||
{
|
||||
// Issue #10 — orphan parser at GameEvents.ParseKillerNotification
|
||||
// existed but was never registered for dispatch until 2026-04-25.
|
||||
// Now wired: 0x01AD lands on CombatState.OnKillerNotification +
|
||||
// fires the KillLanded event.
|
||||
var (d, _, combat, _, _) = MakeAll();
|
||||
string? gotVictimName = null;
|
||||
uint gotVictimGuid = 0;
|
||||
combat.KillLanded += (name, guid) => { gotVictimName = name; gotVictimGuid = guid; };
|
||||
|
||||
// Wire shape: string16L victimName + u32 victimGuid
|
||||
byte[] nameBytes = MakeString16L("Drudge");
|
||||
byte[] payload = new byte[nameBytes.Length + 4];
|
||||
Array.Copy(nameBytes, payload, nameBytes.Length);
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(payload.AsSpan(nameBytes.Length), 0x80001234u);
|
||||
var (d, _, _, _, chat) = MakeAll();
|
||||
byte[] payload = MakeString16L("You killed the drudge!");
|
||||
|
||||
var env = GameEventEnvelope.TryParse(WrapEnvelope(GameEventType.KillerNotification, payload));
|
||||
d.Dispatch(env!.Value);
|
||||
|
||||
Assert.Equal("Drudge", gotVictimName);
|
||||
Assert.Equal(0x80001234u, gotVictimGuid);
|
||||
Assert.Equal(1, chat.Count);
|
||||
var entry = chat.Snapshot()[0];
|
||||
Assert.Equal(ChatKind.Combat, entry.Kind);
|
||||
Assert.Equal(CombatLineKind.Info, entry.CombatKind);
|
||||
Assert.Equal("You killed the drudge!", entry.Text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WireAll_CombatCommenceAttack_FiresCombatStateEvent()
|
||||
{
|
||||
var (d, _, combat, _, _) = MakeAll();
|
||||
bool commenced = false;
|
||||
combat.AttackCommenced += () => commenced = true;
|
||||
|
||||
var env = GameEventEnvelope.TryParse(WrapEnvelope(GameEventType.CombatCommenceAttack, Array.Empty<byte>()));
|
||||
d.Dispatch(env!.Value);
|
||||
|
||||
Assert.True(commenced);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue