aorecomp

Anarchy Online classic in the browser

git clone https://aorecomp.ubeagle.com/code/aorecomp.git


commit 8ae7f5f3db49ed7bcfa5063a0d56bd588d70451a
parent 217051f4fd64a92a8d09e6c4c2d5df05572ce704
Author: anon <anon@example.com>
Date:   Wed,  4 Nov 2026 11:21:42 +0000

Align protocol regression assertions with current replies

Diffstat:
Mserver/portable_containers_test.go | 9+++++++--
Mserver/resurrection_reconnect_test.go | 4++--
Mserver/street_insurance_test.go | 7++++++-
Mserver/target_protocol_test.go | 5++++-
4 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/server/portable_containers_test.go b/server/portable_containers_test.go @@ -117,8 +117,13 @@ func TestPortableContainerCapacityOverflowAndLastSlot(t *testing.T) { after, readErr := readTestItemStore(world) restarted := newTestInventoryServer(t) - if err != nil || readErr != nil || !bytes.Equal(before, after) || len(conn.packets) != packets { - t.Fatal("overflow changed item accounting or sent success", err, readErr) + if err != nil || readErr != nil || !bytes.Equal(before, after) || len(conn.packets) != packets+2 { + t.Fatal("overflow changed item accounting or omitted source correction", err, readErr) + } + for index, packet := range equipmentCorrectionPackets(1, 67) { + if !bytes.Equal(conn.packets[packets+index], targetPacket(packet)) { + t.Fatal("overflow did not restore its carried source") + } } contents := restarted.characters[1].inventory.Containers[3] if len(contents) != 21 || contents[20] != (ownedItem{ID: 24, Type: 51018, Template: 121567, Quality: 1, Slot: 20, Count: 1}) || diff --git a/server/resurrection_reconnect_test.go b/server/resurrection_reconnect_test.go @@ -112,8 +112,8 @@ func TestResurrectionReconnectResumesPendingDeath(t *testing.T) { if !reflect.DeepEqual(observerStats, expectedStats) { t.Fatal("pending reconnect omitted or changed the other player's combat foundations", observerStats) } - if !reflect.DeepEqual(ownStats, [][2]uint32{{1, player.maximumHealth()}, {221, player.maximumNano()}}) { - t.Fatal("pending reconnect changed more than its resource foundations", ownStats) + if !reflect.DeepEqual(ownStats, [][2]uint32{{1, player.maximumHealth()}, {221, player.maximumNano()}, {22, 7}}) { + t.Fatal("pending reconnect changed its resource or attack foundations", ownStats) } if death != 1 { t.Fatalf("repeated ready produced %d death notifications", death) diff --git a/server/street_insurance_test.go b/server/street_insurance_test.go @@ -1,6 +1,7 @@ package main import ( + "bytes" "encoding/binary" "reflect" "slices" @@ -130,11 +131,15 @@ func TestStreetReclaimCollectsTheSameInstanceOnceAcrossColdLoad(t *testing.T) { {ID: 2, Type: 51018, Template: 121567, Quality: 1, Slot: 64, Count: 1}, {ID: 3, Type: 51005, Template: 42640, Quality: 1, Slot: 65, Count: 1}, } - if packets != 3 || len(output.packets) != packets || binary.BigEndian.Uint32(output.packets[0][29:33]) != 1 || + if packets != 3 || len(output.packets) != packets+2 || binary.BigEndian.Uint32(output.packets[0][29:33]) != 1 || !slices.Equal(player.inventory.Items, expected) || !slices.Equal(restored.inventory.Items, expected) || len(player.inventory.Reclaim) != 0 || len(restored.inventory.Reclaim) != 0 { t.Fatal("street reclaim lost or duplicated its item or native response") } + if !bytes.Equal(output.packets[packets], targetPacket(characterActionPacket(1, [5]uint32{146, 106, 0}))) || + !bytes.Equal(output.packets[packets+1], targetPacket(reclaimInventoryPacket(player, []uint32{0}))) { + t.Fatal("repeat street reclaim did not cancel and refresh the empty source") + } } func TestStreetReclaimUseRequiresTheRequestedBooth(t *testing.T) { diff --git a/server/target_protocol_test.go b/server/target_protocol_test.go @@ -113,12 +113,15 @@ initialized: if hex.EncodeToString(npc[60:89]) != "000005cb0b456469746564204e50430000000000000000000000000007" { t.Fatalf("target NPC appearance, name and new stats: %x", npc[60:89]) } - if hex.EncodeToString(full[57:105]) != "000003f1000192060000003600000001000000340000000000000039000000000000015e000005aa000000ec00000000" { + if hex.EncodeToString(full[57:105]) != "000003f1000195f70000003600000001000000340000000000000039000000000000015e000005aa000000ec00000000" { t.Fatalf("target seventh list and initial progression/insurance stats: %x", full[57:105]) } if hex.EncodeToString(full[105:121]) != "0000003e000000000000004b00000000" { t.Fatalf("initial Clan/Omni token stats: %x", full[105:121]) } + if hex.EncodeToString(full[121:129]) != "000000fb00000000" { + t.Fatalf("initial pet count: %x", full[121:129]) + } } func TestTargetFullInventoryUsesAllThirtyNativeSlots(t *testing.T) {