aorecomp

Anarchy Online classic in the browser

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


commit b04d21581f796b80487c14c565395f90c916ae1c
parent e122813f451660d724a1574f1ea31e4e02d7650f
Author: anon <anon@example.com>
Date:   Thu, 22 Oct 2026 23:24:13 +0000

Correct compact player snapshot ability fields

Diffstat:
Mdocs/combat-client-stats.md | 41+++++++++++++++++++++++++++++++++++++++++
Mserver/target_protocol_test.go | 16++++++++++++++++
Mserver/world.go | 4++--
3 files changed, 59 insertions(+), 2 deletions(-)

diff --git a/docs/combat-client-stats.md b/docs/combat-client-stats.md @@ -42,6 +42,47 @@ Some requested addresses are interior aliases: the update requested as `1006f0a0` or `1006ee30` is the canonical function `1006ea50`. Generated aliases may likewise contain a larger shared body. +## Character snapshot ability fields + +The player branch of SimpleCharFullUpdate `271b3a6b` contains three DWORDs +and four signed shorts immediately after the NUL-terminated name. Reader +`10082da0` loads the shorts at `1008315a` through `10083184`; activation +`100821d0` sign-extends them at `10082550` through `10082594` into these stats: + +| Offset after name | Stat | Value supplied by the server | +| --- | --- | --- | +| 12 | Swimming 138 | Native starting base 5 | +| 14 | Strength 16 | Saved base Strength | +| 16 | Agility 17 | Saved base Agility | +| 18 | Stamina 18 | Saved base Stamina | + +The original name table identifies Swimming at `10037ff2`; initializer +`100728c6` sets its base to 5. Swimming is not currently editable in player +profiles. Intelligence, Sense and Psychic are absent from this compact block; +the owner's FullCharacter separately supplies all six abilities. The NPC +branch skips these player setters and uses its own fields. + +The source and original-byte audit is retained in +`local/scfu-ability-research/native-source-audit.json`. The regression test +`TestTargetCharacterSnapshotPreservesPhysicalAbilities` failed against the +previous serializer, which supplied Strength/Agility/Stamina/Intelligence +in these four fields. Unequal abilities expose that displacement. + +Two WASM clients reproduced the old mapping and verified the correction using +players with abilities `11/22/33/44/55/66` and `70/80/90/100/110/120`. +Read-only native probes confirmed both local and remote physical abilities +and Swimming 5 after the change, including both clients reloading after a +full server restart. The native Skills window showed the owner's six saved +abilities, and ordinary forward movement still reached the server. The run +passed 47 checks in `local/scfu-ability-smoke/verification.json`. Shared packet +traces are explicitly distinguished from native object reads. All temporary +clients and servers were closed before the full test runs. + +The focused layout tests passed in 7.561 seconds, and the full +`go test ./server/...` run passed (server 115.760 seconds). Five repeated race +runs of the compact ability and player/NPC weapon-layout tests passed in +94.622 seconds. Logs are retained under `local/scfu-ability-research/`. + ## Skills and attack/defense ratings Ability trickle is a weighted sum divided by four, converted to integer before diff --git a/server/target_protocol_test.go b/server/target_protocol_test.go @@ -42,6 +42,22 @@ func TestTargetCharactersIncludeUnarmedWeapon(t *testing.T) { } } +func TestTargetCharacterSnapshotPreservesPhysicalAbilities(t *testing.T) { + player := &character{id: 1, name: "Player", appearance: 0x315, level: 1, health: 100} + player.stats = defaultCharacterStats() + player.stats.Strength, player.stats.Agility, player.stats.Stamina = 11, 22, 33 + player.stats.Intelligence = 44 + + packet := targetPacket(characterPacket(player)) + + if got := hex.EncodeToString(packet[84:92]); got != "0005000b00160021" { + t.Fatalf("native Swimming, Strength, Agility and Stamina: %s", got) + } + if packet[92] != 1 { + t.Fatal("compact ability fields displaced the following level") + } +} + func TestTargetWorldInitializationUsesRecoveredLayouts(t *testing.T) { useNPCData(t, testNPCData()) world := newTestServer(t) diff --git a/server/world.go b/server/world.go @@ -84,13 +84,13 @@ func characterPacket(character *character) []byte { body = append(body, character.name...) body = append(body, 0) - // Flags, auxiliary state, core abilities, level, and health. + // Flags, auxiliary state, Swimming, physical abilities, level and health. if !character.npc { for _, value := range []uint32{0, 0, 0} { body = binary.BigEndian.AppendUint32(body, value) } stats := character.baseStats() - for _, value := range []uint16{stats.Strength, stats.Agility, stats.Stamina, stats.Intelligence} { + for _, value := range []uint16{5, stats.Strength, stats.Agility, stats.Stamina} { body = binary.BigEndian.AppendUint16(body, value) } }