commit ec0ee20a3ecbd8e862d0015596ed66c7415c8504
parent 1bcbadb5a1b7511227b622b06eaa8b0959e7b5e7
Author: anon <anon@example.com>
Date: Wed, 4 Nov 2026 01:40:28 +0000
Supply mission key duplicators through Tools shops
Diffstat:
9 files changed, 169 insertions(+), 30 deletions(-)
diff --git a/TODO.md b/TODO.md
@@ -2467,8 +2467,12 @@ client rendering fixes and checks are in [nano damage](docs/nano-damage.md).
now preserves both inputs and atomically binds a distinct key to the same
assignment. Focused handler checks cover traded-key copying and copied-key-only
cold entry; a short WASM check verifies usable inputs/result and page replay.
- Native destination metadata and ordinary duplicator shop acquisition remain
- unimplemented. See [mission keys](docs/mission-keys.md).
+ A native Tools purchase now supplies the original reusable QL1 duplicator for
+ twenty credits and immediately copies the held key, with exact page/cold
+ retention. Controlled funds/location isolate this acquisition check from earned
+ progression. Tools placement follows the later wiki; original per-terminal
+ stock remains unrecovered. Native destination metadata remains unimplemented.
+ See [mission keys](docs/mission-keys.md).
Cover held, banked, traded, deleted and reclaimed keys; possession
of an unrelated template28577 must never admit a player to another mission.
- [x] [P1] Trace zero native identities on simple mission inventory proxies.
diff --git a/docs/mission-keys.md b/docs/mission-keys.md
@@ -51,12 +51,37 @@ entry, invalid inputs and unavailable assignments, full inventory, eight
transaction failures and retry, concurrent copies, lost output, and an actual
player trade followed by guest copying and entry. `TestBrowserMissionKeyCopy`
verifies the real native gesture, exact packet, newly usable key, restored
-reusable inputs, unchanged cash, page replay and cold database loading. Its
-accepted contract and provisioned tool isolate copying; this is not earned
-progression or evidence of ordinary tool acquisition.
+reusable inputs, page replay and cold database loading. The original controlled
+copy check provisioned its tool; the purchase check below now obtains it through
+the native shop instead.
-Destination-specific native naming and ordinary duplicator shop acquisition
-remain open. Copies still display the original base name. The bounded naming
+## Shop acquisition
+
+Original item28564 has value/stat74 equal to20. The shipped mission-window help
+establishes shop acquisition; the later scraped
+[Missions wiki](https://anarchyonline.fandom.com/wiki/Missions) identifies the
+Tools kiosk. Applying its QL1 entry to the nine existing original Tools
+templates is a bounded stock policy. A period per-terminal membership list,
+complete inventories and stock generation remain unrecovered; the later
+placement evidence does not establish those original server details.
+
+The fixed subset retains Lock Pick at catalog index0 and adds the original
+duplicator at index1. Delivery uses its original type51054, QL1 and count1
+through the shared purchase transaction; it needs no separate live weapon
+object or package charges. Other vendor categories do not inherit the entry.
+
+The native check opens actual OT Basic Tools3221488799 in playfield1183,
+selects the duplicator, pays20 of its controlled100 credits, and immediately
+uses that newly delivered instance3 on accepted key2. The same tool and original
+key remain, and copy4 binds to assignment2. Page replay and cold loading retain
+all four instances, both bindings and80 credits. The accepted contract, shop
+position and funds are controlled; this does not prove earned travel or income.
+The two focused public-handler checks protect the nine-template stock boundary,
+purchase/repeated Accept, immediate copy and cold ownership. Captures are in
+`local/mission-key-acquisition/`.
+
+Destination-specific native naming remains open. Copies still display the
+original base name. The bounded naming
investigation is retained in `local/mission-key-metadata/`; do not invent an
instance identity or name message to conceal that evidence gap. Historical key
retention after completion/abandonment remains separately unresolved.
diff --git a/docs/shops.md b/docs/shops.md
@@ -85,6 +85,7 @@ record. Existing fixed entries keep QL1:
| Terminal family | Templates | Item | Native type | QL | Base price |
| --- | --- | --- | --- | --- | --- |
| Tools | 9 | Lock Pick 95577 | 51005 | 1 | 230 |
+| Tools | 9 | Mission Key Duplicator 28564 | 51054 | 1 | 20 |
| Devices | 9 | Nano Programming Interface 161699 | 51022 | 1 | 900 |
| General Tools and Bases | 3 | Expendable Hologram Camera 156054 | 51005 | 1 | 1300 |
| General Tools and Bases | 3 | ID-extractor 156339 | 51005 | 1 | 9500 |
@@ -94,6 +95,12 @@ record. Existing fixed entries keep QL1:
| Basic medical supplies | 3 | Basic Nano Recharger 25820 | 51005 | 1 | 250 |
| Omni clothing | 1 | Seven Omni-Med designs 27381..27387 | 51022 | 1 | 500..1500 |
+The duplicator uses its original QL1 definition. Shipped mission-window help
+establishes shop acquisition; the later Missions wiki supplies its Tools-kiosk
+placement. This bounded entry does not recover the period per-terminal stock
+list. Native purchase and immediate use of the same instance, exact debit and
+cold ownership are documented in [mission keys](mission-keys.md#shop-acquisition).
+
The Omni clothing subset follows a May 2002 account and the original seven
garment records. Purchases, two separate sleeves, wear bonuses and laboratory
eligibility use the shared item rules. See [Omni-Med suit stock](shop-med-suit.md)
diff --git a/server/browser_mission_key_copy_test.go b/server/browser_mission_key_copy_test.go
@@ -22,16 +22,24 @@ func TestBrowserMissionKeyCopy(t *testing.T) {
}
_, source, _, _ := runtime.Caller(0)
root := filepath.Dir(filepath.Dir(source))
- output := filepath.Join(root, "local/mission-key-copy", time.Now().Format("20060102-150405"))
+ output := filepath.Join(root, "local/mission-key-acquisition", time.Now().Format("20060102-150405"))
world, _ := newAcceptedMissionWorld(t)
player := world.characters[1]
- if granted, err := world.grantItem_locked(player, 28564); err != nil || !granted {
- t.Fatal(granted, err)
+ // Controlled shop position and funds isolate purchase from earned travel/income.
+ player.playfield, player.position, player.appearance = 1183, [3]float32{188, 5.751, 135.5}, 0x515
+ player.rotation = [4]float32{0, .70710677, 0, .70710677}
+ inventory := player.inventory
+ inventory.Credits = 100
+ if err := world.saveInventory_locked(player, inventory); err != nil {
+ t.Fatal(err)
}
player.browserTokenHash = fmt.Sprintf("%x", sha256.Sum256([]byte("mission-key-copy")))
if err := world.saveUser_locked(player); err != nil {
t.Fatal(err)
}
+ if err := world.savePosition_locked(player); err != nil {
+ t.Fatal(err)
+ }
before := player.inventory
if err := world.db.Close(); err != nil {
t.Fatal(err)
@@ -80,9 +88,10 @@ func TestBrowserMissionKeyCopy(t *testing.T) {
}
cold := newTestInventoryServer(t)
items := cold.characters[1].inventory.Items
- if len(items) != 4 || !reflect.DeepEqual(items[:3], before.Items) ||
+ if len(items) != 4 || !reflect.DeepEqual(items[:2], before.Items) ||
+ items[2] != (ownedItem{ID: 3, Type: 51054, Template: 28564, Quality: 1, Slot: 66, Count: 1}) ||
items[3] != (ownedItem{ID: 4, Type: 51053, Template: 28577, Quality: 1, Slot: 67, Count: 1}) ||
- cold.nextItem != 4 || cold.characters[1].inventory.Credits != before.Credits {
+ cold.nextItem != 4 || cold.characters[1].inventory.Credits != 80 {
t.Fatal("copy lost the tool, original key, selected assignment or cold ownership")
}
var mission uint32
diff --git a/server/gamedata/shop_stock.yaml b/server/gamedata/shop_stock.yaml
@@ -3,16 +3,17 @@
# (28 August 2002). Original medical-family descriptions support the basic
# medical subset. See docs/shops.md for source provenance and remaining gaps.
-# Tools: Lock Pick.
-99491: [{template: 95577, quality: 1}]
-99492: [{template: 95577, quality: 1}]
-99493: [{template: 95577, quality: 1}]
-99527: [{template: 95577, quality: 1}]
-99528: [{template: 95577, quality: 1}]
-99530: [{template: 95577, quality: 1}]
-99601: [{template: 95577, quality: 1}]
-152008: [{template: 95577, quality: 1}]
-152012: [{template: 95577, quality: 1}]
+# Tools: Lock Pick and Mission Key Duplicator. See docs/mission-keys.md for
+# the shop-acquisition source and the later Tools-kiosk placement evidence.
+99491: [{template: 95577, quality: 1}, {template: 28564, quality: 1}]
+99492: [{template: 95577, quality: 1}, {template: 28564, quality: 1}]
+99493: [{template: 95577, quality: 1}, {template: 28564, quality: 1}]
+99527: [{template: 95577, quality: 1}, {template: 28564, quality: 1}]
+99528: [{template: 95577, quality: 1}, {template: 28564, quality: 1}]
+99530: [{template: 95577, quality: 1}, {template: 28564, quality: 1}]
+99601: [{template: 95577, quality: 1}, {template: 28564, quality: 1}]
+152008: [{template: 95577, quality: 1}, {template: 28564, quality: 1}]
+152012: [{template: 95577, quality: 1}, {template: 28564, quality: 1}]
# Devices: Nano Programming Interface.
155602: [{template: 161699, quality: 1}]
diff --git a/server/mission_key_purchase_test.go b/server/mission_key_purchase_test.go
@@ -0,0 +1,72 @@
+package main
+
+import (
+ "ao/server/gamedata"
+ "encoding/binary"
+ "slices"
+ "testing"
+)
+
+func TestMissionKeyDuplicatorStockStaysInTheToolsSubset(t *testing.T) {
+ expected := []gamedata.ShopItem{{Template: 95577, Quality: 1}, {Template: 28564, Quality: 1}}
+
+ var vendors int
+ for _, stock := range gamedata.ShopStock {
+ if slices.Contains(stock, gamedata.ShopItem{Template: 28564, Quality: 1}) {
+ vendors++
+ }
+ }
+
+ if vendors != 9 {
+ t.Fatal("duplicator stock escaped the nine Tools templates", vendors)
+ }
+ for _, template := range []uint32{99491, 99492, 99493, 99527, 99528, 99530, 99601, 152008, 152012} {
+ if !slices.Equal(gamedata.ShopStock[template], expected) {
+ t.Fatal("Tools subset omitted the original QL1 duplicator or changed the Lock Pick", template)
+ }
+ }
+}
+
+func TestMissionKeyDuplicatorPurchaseCanImmediatelyCopyTheHeldKey(t *testing.T) {
+ world, _ := newAcceptedMissionWorld(t)
+ player, client := world.characters[1], world.clients[1]
+ player.playfield, player.position, player.appearance = 1183, [3]float32{188, 5.75, 135.5}, 0x515
+ inventory := player.inventory
+ inventory.Credits = 100
+ if err := world.saveUser_locked(player); err != nil {
+ t.Fatal(err)
+ }
+ if err := world.saveInventory_locked(player, inventory); err != nil {
+ t.Fatal(err)
+ }
+ request := shopUseRequest(1)
+ binary.BigEndian.PutUint32(request[44:48], 3221488799)
+ if err := world.handleShopUse(client, request); err != nil {
+ t.Fatal(err)
+ }
+
+ for _, request := range [][]byte{
+ shopTradePacket([2]uint32{50000, 1}, 4, [2]uint32{51035, 3221488799}, [2]uint32{111, 1})[20:],
+ shopTradePacket([2]uint32{50000, 1}, 1, [2]uint32{}, [2]uint32{})[20:],
+ shopTradePacket([2]uint32{50000, 1}, 1, [2]uint32{}, [2]uint32{})[20:],
+ } {
+ if err := world.handleTrade(client, request); err != nil {
+ t.Fatal(err)
+ }
+ }
+ if err := world.handleItemCombination(client, combinationRequest(1, 66, 65)); err != nil {
+ t.Fatal(err)
+ }
+ cold := newTestInventoryServer(t)
+ var mission uint32
+ err := cold.db.QueryRow("SELECT mission_id FROM mission_keys WHERE item_id=4").Scan(&mission)
+
+ if err != nil || mission != 2 || cold.characters[1].inventory.Credits != 80 || cold.nextItem != 4 ||
+ !slices.Equal(cold.characters[1].inventory.Items, []ownedItem{
+ {ID: 1, Type: 51018, Template: 209283, Quality: 1, Slot: 64, Count: 1},
+ {ID: 2, Type: 51053, Template: 28577, Quality: 1, Slot: 65, Count: 1},
+ {ID: 3, Type: 51054, Template: 28564, Quality: 1, Slot: 66, Count: 1},
+ {ID: 4, Type: 51053, Template: 28577, Quality: 1, Slot: 67, Count: 1}}) {
+ t.Fatal("tool purchase/repeated Accept or immediate copy lost debit, reusable inputs or binding", err)
+ }
+}
diff --git a/server/shop_purchases_test.go b/server/shop_purchases_test.go
@@ -44,7 +44,7 @@ func TestShopCatalogUsesOriginalPageIndicesAndExactTemplates(t *testing.T) {
if binary.BigEndian.Uint32(packet[16:20]) != 0x58362220 || binary.BigEndian.Uint32(packet[20:24]) != 51035 || binary.BigEndian.Uint32(packet[24:28]) != 3221488799 {
t.Fatal("catalog belongs to the wrong machine")
}
- for index, expected := range []uint32{2018, 95577, 95577, 1} {
+ for index, expected := range []uint32{3027, 95577, 95577, 1, 28564, 28564, 1} {
if binary.BigEndian.Uint32(packet[29+index*4:]) != expected {
t.Fatalf("catalog field %d changed", index)
}
@@ -67,7 +67,7 @@ func TestShopKnownStockOnlyAdmitsSupportedItemQualities(t *testing.T) {
for _, entry := range templates {
template := entry.Template
definition := gamedata.ItemTemplates[template]
- if !gamedata.ItemQualitySupported(template, entry.Quality) || (definition.HeaderWords[0] != 51005 && definition.HeaderWords[0] != 51022) {
+ if !gamedata.ItemQualitySupported(template, entry.Quality) || (definition.HeaderWords[0] != 51005 && definition.HeaderWords[0] != 51022 && definition.HeaderWords[0] != 51054) {
t.Fatalf("stock %d needs a separately verified delivery/packing path", template)
}
item := ownedItem{Type: definition.HeaderWords[0], Template: template, Quality: entry.Quality}
@@ -225,7 +225,7 @@ func TestShopPurchaseRejectsForgedCatalogReferences(t *testing.T) {
action := uint32(4)
switch scenario {
case "unknown index":
- second[1] = 1
+ second[1] = 2
case "wrong page":
second[0] = 104
case "wrong machine":
diff --git a/server/shop_stock_test.go b/server/shop_stock_test.go
@@ -13,7 +13,7 @@ func TestShopDocumentedStockUsesTerminalBindings(t *testing.T) {
machine uint32
stock []gamedata.ShopItem
}{
- {3221488799, []gamedata.ShopItem{{Template: 95577, Quality: 1}}},
+ {3221488799, []gamedata.ShopItem{{Template: 95577, Quality: 1}, {Template: 28564, Quality: 1}}},
{3221816479, []gamedata.ShopItem{{Template: 161699, Quality: 1}}},
{3225158815, []gamedata.ShopItem{{Template: 156054, Quality: 1}, {Template: 156339, Quality: 1}}},
{3225093279, []gamedata.ShopItem{{Template: 154331, Quality: 1}}},
diff --git a/tools/client/test_mission_key_copy.mjs b/tools/client/test_mission_key_copy.mjs
@@ -29,10 +29,31 @@ try {
await page.waitForFunction(() => touchRegion(500, 400)?.world === true);
await game.snapshot();
await game.key('i');
- await game.wait('original key and duplicator visible', () => cell(49) && cell(50));
+ await game.wait('original key visible', () => cell(49));
evidence.initial = await server();
await game.save(output + '/initial');
+ // Buy the original tool from the actual Tools terminal, then use that same item.
+ if (!game.state.camera.firstPerson) await game.key('F8');
+ await game.click(...await game.pick(51035, 3221488799), 'right');
+ await game.wait('duplicator catalog entry visible', state => state.grids.flatMap(grid => grid.cells).some(cell =>
+ cell.identity[0] === 111 && cell.identity[1] === 1 && !cell.dummy));
+ const tool = game.state.grids.flatMap(grid => grid.cells).find(cell => cell.identity[0] === 111 && cell.identity[1] === 1);
+ await game.click((tool.bounds[0] + tool.bounds[2]) / 2, (tool.bounds[1] + tool.bounds[3]) / 2);
+ await game.wait('duplicator displayed in the BUY basket', state => state.grids.some(grid =>
+ grid.position[1] === 303 && grid.cells.some(cell => !cell.dummy)));
+ await game.save(output + '/selected');
+ await game.click(873, 475);
+ await game.wait('purchased duplicator delivered', state => game.local(state).inventory.some(item =>
+ item.templates[0] === 28564 && item.slot === 50) && cell(50));
+ evidence.purchased = await server();
+ assert.deepEqual(evidence.purchased.bindings, evidence.initial.bindings);
+ assert.deepEqual(evidence.purchased.inventory.Items.slice(0, 2), evidence.initial.inventory.Items);
+ assert.equal(evidence.purchased.inventory.Credits, 80);
+ assert.deepEqual(evidence.purchased.inventory.Items[2],
+ {ID: 3, Type: 51054, Template: 28564, Quality: 1, Slot: 66, Count: 1, Ammo: 0});
+ await game.save(output + '/purchased');
+
// Native item combination uses the picked tool and Shift-right-click of the key.
const start = game.sequence;
await click(50);
@@ -52,10 +73,10 @@ try {
game.local(state).inventory.filter(item => item.templates[0] === 28577).length === 2 && cell(51));
evidence.copied = await server();
assert.deepEqual(evidence.copied.bindings, {'2': 2, '4': 2});
- assert.deepEqual(evidence.copied.inventory.Items.slice(0, 3), evidence.initial.inventory.Items);
+ assert.deepEqual(evidence.copied.inventory.Items.slice(0, 3), evidence.purchased.inventory.Items);
assert.deepEqual(evidence.copied.inventory.Items[3],
{ID: 4, Type: 51053, Template: 28577, Quality: 1, Slot: 67, Count: 1, Ammo: 0});
- assert.equal(evidence.copied.inventory.Credits, evidence.initial.inventory.Credits);
+ assert.equal(evidence.copied.inventory.Credits, evidence.purchased.inventory.Credits);
await game.key('Escape');
await game.wait('both reusable inputs remain usable', state => state.dragged[0] === 0 && cell(49) && cell(50));
await game.save(output + '/copied');
@@ -70,7 +91,7 @@ try {
evidence.replayed = await server();
assert.deepEqual(evidence.replayed, evidence.copied);
assert.deepEqual(game.errors, []);
- console.log('PASS: native tool-on-key copy, reusable inputs, exact assignment and page/cold persistence');
+ console.log('PASS: native Tools purchase, immediate key copy, reusable inputs, exact debit and page/cold persistence');
} finally {
try {
await fs.mkdir(output, {recursive: true});