aorecomp

Anarchy Online classic in the browser

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


commit 1fb7b0e84d2d8400be5e9b4947758fef2fc39e9c
parent 8892023643d260d501d351330d0d699d4875cc5d
Author: anon <anon@example.com>
Date:   Sun, 25 Oct 2026 10:42:06 +0000

Reply to unsupported worn item use

Diffstat:
MTODO.md | 9+++++++++
Mdocs/combat-client-effect-handlers.md | 2+-
Mdocs/tradeskills.md | 39+++++++++++++++++++++++++++++++++++++++
Mserver/backpacks.go | 7+++++--
Aserver/owned_item_use_test.go | 84+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 138 insertions(+), 3 deletions(-)

diff --git a/TODO.md b/TODO.md @@ -1003,6 +1003,15 @@ and unresolved indoor lifecycle are explicit in [flight](docs/vehicles.md#yalmah preserving items/cash. No null-ID delivery workaround is justified by that evidence. Keep fresh-result Use in the upgrade regressions; the earlier missing request remains unexplained. See [inventory combinations](docs/tradeskills.md). + Original53130 is now traced to current-use-item deletion. SimpleItemFullUpdate + creates items but cannot change an existing row's QL/endpoints; its explicit + slot path only changes identity/flags. Period guides leave the cash amount + unspecified, and later reports disagree. Keep the fee, replacement ID/slot, + cap and worn-use policy open; see [upgrade research](docs/tradeskills.md#manual-upgrade-research). +- [x] Reply to unsupported worn weapon/HUD Use requests. Check: native + page101/slot15 receives failure2 with its original sequence and source; + replay/invalid references do not change items, equipment or bonuses, and + supported backpack Use still works afterward. - [x] Support NCU Hacker Interface equipment at QL1..200. Use original endpoints158416/158417 and shared interpolation for all six nano skills and the Fixer/level wear requirement. Keep source Interface161699 separate. diff --git a/docs/combat-client-effect-handlers.md b/docs/combat-client-effect-handlers.md @@ -215,7 +215,7 @@ render/text/appearance call; an evocative name alone was not enough. | 53121 unnamed | `100c2480` | Partial: native text identifies fear; NPC controller state 2 apply/reset. | | 53127 unnamed | `100c2680` | Partial: native text identifies mind control; NPC controller state 4 apply/reset. | | 53128 unnamed | `100c2760` | Partial: native text identifies daze; NPC controller state 5 and feature bit 0x200. | -| 53130 unnamed | `100c2810` | Partial: invokes `10061bc0`, clearing a controller identity via `1005f270`. | +| 53130 unnamed | `100c2810` | Decoded client operation: deletes the current-use item through `10061bc0`/`1005f270`, then clears that reference; see [inventory combinations](tradeskills.md#manual-upgrade-research). | | 53132 GenerateName | `100bdf60` | Decoded presentation: applies supplied name strings through `10070f40`. | | 53134 unnamed | `100c2840` | Decoded presentation: text to local actor or within an argument-specified 3D radius. | | 53138 flight | `100c1cc0` | Movement events 27/35 enter flight mode 7 and restore the saved ground mode; see [vehicles](vehicles.md#yalmaha-flight). | diff --git a/docs/tradeskills.md b/docs/tradeskills.md @@ -137,3 +137,42 @@ restart; removal cleared both clients again. The owner initializes its effect from the restored character, while the observer receives one explicit wear message. Exact packet tuples, native/SQLite snapshots, negative cases and fixture-only cleanup evidence are in `local/ncu-quality-smoke/`. + +## Manual upgrade research + +Original OnUse contains function53064 with code `FINC`, followed by53130. +The FINC integer interpolates from2 at QL1 to201 at QL200; this is an authored +parameter, not proof of the server's cap or replacement policy. Function53064 +is rejected by the inspected local effect executor, so its server behavior +cannot be reconstructed from that dispatch alone. + +Effect53130 is current-use-item deletion. Template prediction1005e4e0 saves +the action's page/slot into the actor's inventory/attributes helper atE4/E8. +Handler100c2810 resolves the subject character and invokes10061bc0 on that +helper. The latter calls the established Delete helper1005f270 on the saved +reference, then clears both words. It is not an NPC controller operation. +Any replacement and source consumption must commit together before clients +receive a deletion effect. This does not prove original server instance-ID or +destination rules. + +SimpleItemFullUpdate key3b11256f has a verified original registration, reader +and generic51022 factory. It ignores an already existing subject dynel. +Explicit-slot attachment changes only the row identity and flags, preserving +the old QL/templates. Slot111 instead creates a count1 row first-free with +the transmitted QL/templates. Neither path automatically replaces worn NCU +modifiers. InventoryUpdated only notifies the GUI. These are protocol facts, +not a reason to use an in-place FullUpdate as an upgrade implementation. + +The November2002/February2003 Arcanum guides describe a small cash charge but +give no amount or insufficient-credit rule. Later2006/2007 player comments +disagree about fees. Neither original endpoint contains a Cash effect or +requirement; absence there does not establish a free server operation. +Historical fee, cap, destination and worn-use outcome remain open. No explosion +roll is established by the description or a player's report of no explosions. +Evidence, original bytes, source dates and exact limits are retained in +`local/ncu-upgrade-research/{root,native,sources}/`. + +Unsupported ordinary and worn weapon/HUD Use requests receive GenericCmd +failure2 with the original sequence/page/slot. This preserves the item and +its modifiers without enabling upgrades. Native verification uses actual +page101/slot15 requests; it does not substitute an unequip action. diff --git a/server/backpacks.go b/server/backpacks.go @@ -121,10 +121,13 @@ func (server *server) handleOwnedItemUse(client *worldClient, body []byte) error } } } - if page == 101 { + // Unsupported worn use still needs a reply for its actual owned source. + slot := binary.BigEndian.Uint32(body[44:48]) + if page == 101 && (slot == 0 || slot >= 16 || !slices.ContainsFunc(player.inventory.Items, func(item ownedItem) bool { + return item.Slot == slot && item.fitsEquipmentSlot(slot) + })) { return nil } - slot := binary.BigEndian.Uint32(body[44:48]) if page == 104 && (slot < 64 || slot >= 94) { return nil } diff --git a/server/owned_item_use_test.go b/server/owned_item_use_test.go @@ -0,0 +1,84 @@ +package main + +import ( + "bytes" + "encoding/binary" + "fmt" + "testing" +) + +func TestUnsupportedWornItemUseRepliesWithoutChangingEquipment(t *testing.T) { + world, owner := newEquipmentWorld(t) + player, client := world.characters[1], world.clients[1] + player.profession = 4 + if err := world.saveUser_locked(player); err != nil { + t.Fatal(err) + } + for _, template := range []uint32{158416, 99228} { + if granted, err := world.grantItem_locked(player, template); err != nil || !granted { + t.Fatal("grant", granted, err) + } + } + if err := world.handleInventory(client, inventoryMovePacket(1, 65, 15)[20:]); err != nil || client.equipment == nil { + t.Fatal("wear", err) + } + world.advanceEquipment(client.equipment.readyAt) + observer := &combatTestConn{} + world.characters[2] = &character{id: 2, playfield: player.playfield, health: 100} + world.clients[2] = &worldClient{id: 2, conn: observer, target: true, ready: true} + before, err := readTestItemStore(world) + if err != nil { + t.Fatal(err) + } + request := backpackUseRequest(1, 15, 1)[20:] + binary.BigEndian.PutUint32(request[40:44], 101) + owner.packets = nil + + if err := world.handleOwnedItemUse(client, request); err != nil { + t.Fatal(err) + } + if err := world.handleOwnedItemUse(client, request); err != nil { + t.Fatal(err) + } + if err := world.handleOwnedItemUse(client, backpackUseRequest(1, 66, 2)[20:]); err != nil { + t.Fatal(err) + } + after, readErr := readTestItemStore(world) + + expected := bytes.Clone(request[16:]) + binary.BigEndian.PutUint32(expected, 2) + if readErr != nil || !bytes.Equal(before, after) || len(owner.packets) != 4 || len(observer.packets) != 0 || + !bytes.Equal(owner.packets[0][29:61], expected) || binary.BigEndian.Uint32(owner.packets[0][16:20]) != 0x52526858 || + binary.BigEndian.Uint32(owner.packets[1][29:33]) != 1 || client.backpacks[1] != (backpackHandle{3, true}) { + t.Fatal("unsupported worn use was unanswered, replayed, or blocked subsequent backpack use", readErr) + } + if player.inventory.Items[1].Slot != 15 || newTestInventoryServer(t).characters[1].inventory.Items[1].Slot != 15 { + t.Fatal("unsupported use unequipped the item") + } + for _, stat := range []uint32{122, 127, 128, 129, 130, 131} { + if player.equipmentBonus(stat) != 1 { + t.Fatal("unsupported use changed a worn effect") + } + } +} + +func TestWornItemUseIgnoresInvalidSourcePagesAndSlots(t *testing.T) { + for _, reference := range [][2]uint32{{101, 0}, {101, 6}, {101, 15}, {101, 16}, {101, 64}, {104, 15}, {102, 15}, {103, 15}} { + t.Run(fmt.Sprintf("page%d/slot%d", reference[0], reference[1]), func(t *testing.T) { + world, owner := newEquipmentWorld(t) + request := backpackUseRequest(1, reference[1], 1)[20:] + binary.BigEndian.PutUint32(request[40:44], reference[0]) + before, err := readTestItemStore(world) + if err != nil { + t.Fatal(err) + } + + err = world.handleOwnedItemUse(world.clients[1], request) + after, readErr := readTestItemStore(world) + + if err != nil || readErr != nil || !bytes.Equal(before, after) || len(owner.packets) != 0 { + t.Fatal("invalid worn reference changed state or produced a reply", err, readErr) + } + }) + } +}