commit d6f8a63f617be66f91dc517bc7f46a414219e2bf
parent fbff0f312053714b2ec21c3764bec4e63cca3670
Author: anon <anon@example.com>
Date: Mon, 2 Nov 2026 20:32:11 +0000
Align regression expectations with resource replay and armor exchange
Diffstat:
3 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/server/main_test.go b/server/main_test.go
@@ -377,8 +377,14 @@ func TestWorldCookieThenPing(t *testing.T) {
if len(leet) < 94 || hex.EncodeToString(leet[36:45]) != "0100000241000003b6" || hex.EncodeToString(leet[67:94]) != "00e5054c65657400010000006400000064000044f700640000001c" {
t.Fatalf("original NPC fields: %x", leet)
}
- if hex.EncodeToString(updates[len(updates)-2][36:40]) != "00000010" {
- t.Fatalf("full character version: %x", updates[len(updates)-2])
+ var full []byte
+ for _, update := range updates {
+ if binary.BigEndian.Uint32(update[20:24]) == 0x29304349 {
+ full = update
+ }
+ }
+ if len(full) < 40 || hex.EncodeToString(full[36:40]) != "00000010" {
+ t.Fatalf("full character version: %x", full)
}
if hex.EncodeToString(updates[len(updates)-1][20:36]) != "5f52412e0000c3500000000100000000" || len(updates[len(updates)-1]) != 48 {
t.Fatalf("original game clock: %x", updates[len(updates)-1])
diff --git a/server/metaplast_test.go b/server/metaplast_test.go
@@ -113,7 +113,7 @@ func TestMetaplastNativeWearRemoveAndRestart(t *testing.T) {
func TestMetaplastRejectedWearPreservesOwnedItem(t *testing.T) {
for _, template := range []uint32{85511, 85512, 85556, 85557, 85595, 85596, 85637, 85638, 85685, 85686, 85741, 85742} {
- for _, scenario := range []string{"strength", "agility", "quality", "identity", "wrong slot", "foreign owner", "occupied", "changed requirement", "failed save"} {
+ for _, scenario := range []string{"strength", "agility", "quality", "identity", "wrong slot", "foreign owner", "changed requirement", "failed save"} {
t.Run(gamedata.ItemTemplates[template].Name+"/"+scenario, func(t *testing.T) {
world, _ := newEquipmentWorld(t)
player := world.characters[1]
@@ -141,11 +141,6 @@ func TestMetaplastRejectedWearPreservesOwnedItem(t *testing.T) {
destination = 31
case "foreign owner":
owner = 2
- case "occupied":
- occupied := player.inventory.Items[1]
- occupied.ID, occupied.Slot = 3, destination
- player.inventory.LastID = 3
- player.inventory.Items = append(player.inventory.Items, occupied)
}
before := append([]ownedItem(nil), player.inventory.Items...)
stored, err := readTestItemStore(world)
diff --git a/server/resurrection_reconnect_test.go b/server/resurrection_reconnect_test.go
@@ -81,7 +81,7 @@ func TestResurrectionReconnectResumesPendingDeath(t *testing.T) {
t.Fatal("reconnect bypassed death or changed its committed outcome")
}
death, seenReady, seenFull := 0, false, false
- var observerStats [][2]uint32
+ var observerStats, ownStats [][2]uint32
for _, packet := range packets {
switch binary.BigEndian.Uint32(packet[16:20]) {
case 0x5f52412e:
@@ -96,6 +96,10 @@ func TestResurrectionReconnectResumesPendingDeath(t *testing.T) {
death++
}
case 0x2b333d6e:
+ if binary.BigEndian.Uint32(packet[24:28]) == 1 {
+ ownStats = append(ownStats, [2]uint32{binary.BigEndian.Uint32(packet[29:33]), binary.BigEndian.Uint32(packet[33:37])})
+ continue
+ }
if binary.BigEndian.Uint32(packet[24:28]) != 2 {
t.Fatalf("pending reconnect changed the dead player's stats: %x", packet)
}
@@ -109,6 +113,9 @@ 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 death != 1 {
t.Fatalf("repeated ready produced %d death notifications", death)
}