aorecomp

Anarchy Online classic in the browser

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


commit e647f1504c23bc7526be278dd16b169542cd97b2
parent c747b4d8d1859b4753ab2d69c49a6658126f4dd3
Author: anon <anon@example.com>
Date:   Wed,  4 Nov 2026 12:57:58 +0000

Learn supported nano crystals from carried backpacks

Diffstat:
MTODO.md | 10++++++++++
Mdocs/nano-learning.md | 46++++++++++++++++++++++++++++++++++++++++++++++
Aserver/backpack_nano_learning_test.go | 186+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mserver/backpacks.go | 5++++-
Aserver/browser_backpack_nano_learning_test.go | 71+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mserver/nano_learning.go | 31+++++++++++++++++++++++++------
Atools/client/test_backpack_nano_learning.mjs | 81+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 423 insertions(+), 7 deletions(-)

diff --git a/TODO.md b/TODO.md @@ -2136,6 +2136,16 @@ introduction and starting-item gameplay remain open below. The Doctor startup crystal now uploads Improved Healing with its exact skill/profession gates; learned execution uses the shared direct-heal path below. See [Doctor healing](docs/nano-healing.md). +- [x] [P1] Upload supported nano crystals from carried backpacks. The original + quantity callback resolves page107 children, but the server routed eligible + crystal Use only to remote-bank rejection. Share the existing atomic learning + path and preserve the actual packed source in completion/action/removal. + Public-handler checks cover three crystal families, open/closed bags, + nonzero/boundary slots, requirements, duplicates and child-removal failure/retry + without map/slice mutation. A 15-second controlled WASM check uploads Improved + Healing, shows its native icon, preserves the spare and withdraws a companion + through the same window. Page replay/cold loading retain the exact remaining + items and one program; see [contained uploads](docs/nano-learning.md#learning-from-carried-backpacks). - [x] [P1] Cast one self-heal. Check: cast time, nano cost, health gain and recharge agree with the chosen program and appear correctly in the native client. Complete contracts admit 85 ordinary programs/crystals, with authored gates, diff --git a/docs/nano-learning.md b/docs/nano-learning.md @@ -101,6 +101,52 @@ Failure publishes no success and changes neither state; an output failure after commit is recovered through the next FullCharacter. Program learning is private to the owner. Other players receive no learned-entry effect. +## Learning from carried backpacks + +Supported crystals now use the same learning transaction from page107. The +source is a known session handle packed above the child slot; its bag must be +carried and owned. A known closed bag remains a valid source. Authored upload +requirements, exact crystal quality, supported-program admission and duplicate +refusal are unchanged. Banked/foreign bags and unknown or out-of-range handles +retain the shared owned-Use guards. + +Learning clones the affected contents map/slice, consumes only the selected +child and commits its removal with the learned program. The bag and other +children remain owned. Success, UseTemplateAction and DeleteItem preserve the +request's actual page107/packed position; an ordinary source still uses page104. +Failed storage publishes no success and leaves the live contents untouched. + +Original KKR quantity callback1005e790 explicitly resolves page107 through the +Chest handle and debits its child. UseTemplateAction1005e980 executes action3 +through the template, and LearnNano53019 handler100be540 updates the actor's +program list. These paths establish the native contained upload/consumption +contract; they do not provide a recording of every original-server policy. +The original DLL hash matches the evidence above. New source-bound REA records +are `ev_8734c392a58b8613f98a50084dc344d08e0d3f9ca70fcd86c502d226e4f66560`, +`ev_ef16356081561272f7408627ba96c97b766c43ece5c07c1c166debdd17258051` +and `ev_a13205c5898c003b488c0e79a6039fe235f60643754a667c4cae1cfc99b9b231`, +retained under `local/backpack-nano-learning/`. + +Public-handler regressions cover Doctor/Meta-Physicist startup and Strength Boost +crystals, open/closed bags, first/last/nonzero slots, authored requirements and +duplicates. A forced child-placement deletion failure checks independent live +map/slice and durable rollback with zero success output, then a one-time retry; +both last-child and retained-companion cases cold-load exact ownership. + +A controlled Doctor WASM fixture reproduces the former failure2 reply to a real +contained-crystal right-click. The final check takes 14.72 seconds, displays +"Improved Healing uploaded" and its Medical-tab icon, preserves the spare on a +duplicate Use, and withdraws the companion through the same window. Page replay +and fresh Go loading retain one learned program, both unconsumed instances and +the bag. This verifies the upload protocol with controlled skills/location, +separately from earned starting progression. Captures and verification are in +`local/backpack-nano-learning/`. +The focused Go and race runs each pass 15 roots and 62 results; vet and driver +syntax checks pass. `local/backpack-nano-learning/verification.json` independently +checks the exact packed action/removal, one native program entry before replay, +duplicate refusal and final item ledger. The maintained driver also requires +that Medical-tab entry before reconnect, so replay cannot hide a missing effect. + ## Reconnect layout The native FullCharacter reader `1007f5b0` consumes inventory, an intermediate diff --git a/server/backpack_nano_learning_test.go b/server/backpack_nano_learning_test.go @@ -0,0 +1,186 @@ +package main + +import ( + "bytes" + "encoding/binary" + "fmt" + "maps" + "reflect" + "slices" + "testing" +) + +func TestBackpackNanoCrystalLearnsAndConsumesItsExactChild(t *testing.T) { + for _, fixture := range []struct{ crystal, program, profession, slot uint32 }{{28778, 28665, 10, 0}, {43330, 43324, 12, 20}, {27305, 27169, 1, 7}} { + for _, closed := range []bool{false, true} { + t.Run(fmt.Sprintf("%d/closed%v", fixture.crystal, closed), func(t *testing.T) { + world, output := newBackpackWorld(t) + player, client := world.characters[1], world.clients[1] + player.profession = uint16(fixture.profession) + player.stats.NanoAiding.BiologicalMetamorphosis, player.stats.NanoAiding.MatterMetamorphosis = 50, 50 + player.stats.NanoAiding.MatterCreation, player.stats.NanoAiding.TimeAndSpace = 10, 10 + if err := world.saveUser_locked(player); err != nil { + t.Fatal(err) + } + if granted, err := world.grantItem_locked(player, fixture.crystal); err != nil || !granted { + t.Fatal(granted, err) + } + if err := world.handleOwnedItemUse(client, backpackUseRequest(1, 66, 1)[20:]); err != nil { + t.Fatal(err) + } + if err := world.handleInventory(client, backpackMoveRequest(104, 69, 51017, 3, 111)[20:]); err != nil { + t.Fatal(err) + } + player.inventory.Containers[3][0].Slot = fixture.slot + if err := world.saveInventory_locked(player, player.inventory); err != nil { + t.Fatal(err) + } + if closed { + if err := world.handleOwnedItemUse(client, backpackUseRequest(1, 66, 2)[20:]); err != nil { + t.Fatal(err) + } + } + source := 1<<16 | fixture.slot + request := backpackUseRequest(1, source, 10)[20:] + binary.BigEndian.PutUint32(request[40:44], 107) + output.packets = nil + + err := world.handleOwnedItemUse(client, request) + cold := newTestInventoryServer(t) + + if err != nil || !slices.Equal(player.inventory.LearnedNanos, []uint32{fixture.program}) || + !slices.Equal(cold.characters[1].inventory.LearnedNanos, []uint32{fixture.program}) || + len(player.inventory.Containers) != 0 || len(cold.characters[1].inventory.Containers) != 0 || + len(player.inventory.Items) != 5 || len(cold.items) != 5 || world.nextItem != 6 || len(output.packets) != 3 || + client.backpacks[1] != (backpackHandle{3, !closed}) { + t.Fatal("contained crystal was not learned/consumed atomically with its bag retained", err) + } + if binary.BigEndian.Uint32(output.packets[0][29:33]) != 1 || binary.BigEndian.Uint32(output.packets[0][33:37]) != 10 || + binary.BigEndian.Uint32(output.packets[1][16:20]) != 0x35505644 || + binary.BigEndian.Uint32(output.packets[1][49:53]) != 107 || binary.BigEndian.Uint32(output.packets[1][53:57]) != source || + binary.BigEndian.Uint32(output.packets[2][29:33]) != 112 || + binary.BigEndian.Uint32(output.packets[2][33:37]) != 107 || binary.BigEndian.Uint32(output.packets[2][37:41]) != source { + t.Fatal("contained upload lost its actual source or exact completion reference") + } + }) + } + } +} + +func TestBackpackNanoCrystalFailedConsumptionRetainsChildrenForRetry(t *testing.T) { + for _, companion := range []bool{false, true} { + t.Run(fmt.Sprint(companion), func(t *testing.T) { + world, output := newBackpackWorld(t) + player, client := world.characters[1], world.clients[1] + player.profession = 10 + player.stats.NanoAiding.BiologicalMetamorphosis, player.stats.NanoAiding.MatterMetamorphosis = 20, 20 + if err := world.saveUser_locked(player); err != nil { + t.Fatal(err) + } + if granted, err := world.grantItem_locked(player, 28778); err != nil || !granted { + t.Fatal(granted, err) + } + if err := world.handleOwnedItemUse(client, backpackUseRequest(1, 66, 1)[20:]); err != nil { + t.Fatal(err) + } + if err := world.handleInventory(client, backpackMoveRequest(104, 69, 51017, 3, 111)[20:]); err != nil { + t.Fatal(err) + } + if companion { + if err := world.handleInventory(client, backpackMoveRequest(104, 68, 51017, 3, 111)[20:]); err != nil { + t.Fatal(err) + } + } + before, err := readTestItemStore(world) + if err != nil { + t.Fatal(err) + } + original := player.inventory + original.Items = slices.Clone(original.Items) + original.LearnedNanos = slices.Clone(original.LearnedNanos) + original.Containers = maps.Clone(original.Containers) + original.Containers[3] = slices.Clone(original.Containers[3]) + if _, err := world.db.Exec("CREATE TRIGGER reject_contained_upload BEFORE DELETE ON item_locations WHEN OLD.item_id=6 BEGIN SELECT RAISE(ABORT, 'contained consumption'); END"); err != nil { + t.Fatal(err) + } + request := backpackUseRequest(1, 1<<16, 10)[20:] + binary.BigEndian.PutUint32(request[40:44], 107) + output.packets = nil + + failed := world.handleOwnedItemUse(client, request) + after, err := readTestItemStore(world) + + if failed == nil || err != nil || !bytes.Equal(before, after) || !reflect.DeepEqual(player.inventory, original) || len(output.packets) != 0 || + client.backpacks[1] != (backpackHandle{3, true}) || world.nextItem != 6 { + t.Fatal("failed contained consumption changed its map/slice, learned list, ownership or output", failed, err) + } + if _, err := world.db.Exec("DROP TRIGGER reject_contained_upload"); err != nil { + t.Fatal(err) + } + binary.BigEndian.PutUint32(request[20:24], 11) + if err := world.handleOwnedItemUse(client, request); err != nil { + t.Fatal(err) + } + cold := newTestInventoryServer(t) + var contents []ownedItem + if companion { + contents = []ownedItem{{ID: 5, Type: 51018, Template: 121567, Quality: 1, Slot: 1, Count: 1}} + } + if !reflect.DeepEqual(player.inventory, cold.characters[1].inventory) || !slices.Equal(player.inventory.LearnedNanos, []uint32{28665}) || + !slices.Equal(player.inventory.Containers[3], contents) || len(cold.items) != 5 || world.nextItem != 6 { + t.Fatal("contained retry/cold recovery lost the bag, companion or one-time upload") + } + }) + } +} + +func TestBackpackNanoCrystalKeepsItsAuthoredUploadRequirements(t *testing.T) { + for _, scenario := range []string{"Biological Metamorphosis equality", "wrong profession", "duplicate", "wrong quality"} { + t.Run(scenario, func(t *testing.T) { + world, output := newBackpackWorld(t) + player, client := world.characters[1], world.clients[1] + player.profession = 10 + player.stats.NanoAiding.BiologicalMetamorphosis, player.stats.NanoAiding.MatterMetamorphosis = 20, 20 + if granted, err := world.grantItem_locked(player, 28778); err != nil || !granted { + t.Fatal(granted, err) + } + if err := world.handleOwnedItemUse(client, backpackUseRequest(1, 66, 1)[20:]); err != nil { + t.Fatal(err) + } + if err := world.handleInventory(client, backpackMoveRequest(104, 69, 51017, 3, 111)[20:]); err != nil { + t.Fatal(err) + } + switch scenario { + case "Biological Metamorphosis equality": + player.stats.NanoAiding.BiologicalMetamorphosis = 6 + case "wrong profession": + player.profession = 1 + case "duplicate": + player.inventory.LearnedNanos = []uint32{28665} + case "wrong quality": + player.inventory.Containers[3][0].Quality = 2 + } + if err := world.saveUser_locked(player); err != nil { + t.Fatal(err) + } + if err := world.saveInventory_locked(player, player.inventory); err != nil { + t.Fatal(err) + } + before, err := readTestItemStore(world) + if err != nil { + t.Fatal(err) + } + request := backpackUseRequest(1, 1<<16, 10)[20:] + binary.BigEndian.PutUint32(request[40:44], 107) + output.packets = nil + + err = world.handleOwnedItemUse(client, request) + after, readErr := readTestItemStore(world) + + if err != nil || readErr != nil || !bytes.Equal(before, after) || len(output.packets) != 1 || + binary.BigEndian.Uint32(output.packets[0][29:33]) != 2 || world.nextItem != 6 { + t.Fatal("contained upload bypassed requirements or consumed a refused crystal", err, readErr) + } + }) + } +} diff --git a/server/backpacks.go b/server/backpacks.go @@ -87,8 +87,11 @@ func (server *server) handleOwnedItemUse(client *worldClient, body []byte) error if bag == 0 || slot&65535 >= 21 || !slices.ContainsFunc(player.inventory.Items, func(item ownedItem) bool { return item.ID == bag && item.isPortableContainer() }) { return nil } - for _, item := range player.inventory.Containers[bag] { + for index, item := range player.inventory.Containers[bag] { if item.Slot == slot&65535 { + if item.Template == 43330 || nanoCrystalProgram(item.Template) != 0 { + return server.learnNano_locked(client, index, body) + } return server.useRemoteBank_locked(client, item, body) } } diff --git a/server/browser_backpack_nano_learning_test.go b/server/browser_backpack_nano_learning_test.go @@ -0,0 +1,71 @@ +package main + +import ( + "context" + "crypto/sha256" + "encoding/json" + "fmt" + "net/http" + "net/http/httptest" + "os" + "os/exec" + "path/filepath" + "reflect" + "runtime" + "slices" + "testing" + "time" +) + +func TestBrowserBackpackNanoLearning(t *testing.T) { + if os.Getenv("AO_GAME_TEST") != "1" { + t.Skip("set AO_GAME_TEST=1 for carried-backpack nano learning") + } + _, source, _, _ := runtime.Caller(0) + root := filepath.Dir(filepath.Dir(source)) + output := filepath.Join(root, "local/backpack-nano-learning", time.Now().Format("20060102-150405")) + world := newTestServer(t) + player := world.newCharacter() + player.profession = 10 + player.stats.NanoAiding.BiologicalMetamorphosis, player.stats.NanoAiding.MatterMetamorphosis = 20, 20 + player.playfield, player.position = 1183, [3]float32{193.79826, 5.01, 136.83983} + player.browserTokenHash = fmt.Sprintf("%x", sha256.Sum256([]byte("backpack-nano-learning"))) + if err := world.saveUser_locked(player); err != nil { + t.Fatal(err) + } + inventory := playerInventory{LastID: 4, Items: []ownedItem{{ID: 1, Type: 51017, Template: 99228, Quality: 1, Slot: 64, Count: 1}}, + Containers: map[uint32][]ownedItem{1: { + {ID: 2, Type: 51005, Template: 28778, Quality: 1, Slot: 0, Count: 1}, + {ID: 3, Type: 51005, Template: 28778, Quality: 1, Slot: 1, Count: 1}, + {ID: 4, Type: 51005, Template: 42640, Quality: 1, Slot: 2, Count: 1}}}} + if err := world.saveInventory_locked(player, inventory); err != nil { + t.Fatal(err) + } + mux := http.NewServeMux() + mux.Handle("/", world.httpHandler()) + mux.HandleFunc("GET /test-state", func(w http.ResponseWriter, r *http.Request) { + world.mutex.Lock() + defer world.mutex.Unlock() + json.NewEncoder(w).Encode(player.inventory) + }) + host := httptest.NewServer(mux) + t.Cleanup(host.Close) + closeTestBrowserStreams(t, world) + ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute) + defer cancel() + + command := exec.CommandContext(ctx, "node", filepath.Join(root, "tools/client/test_backpack_nano_learning.mjs"), host.URL, output) + command.Dir, command.Stdout, command.Stderr = root, os.Stdout, os.Stderr + err := command.Run() + t.Logf("Browser artifacts: %s", output) + + if err != nil { + t.Fatal(err) + } + cold := newTestInventoryServer(t) + if !reflect.DeepEqual(player.inventory, cold.characters[1].inventory) || !slices.Equal(player.inventory.LearnedNanos, []uint32{28665}) || + len(player.inventory.Items) != 2 || len(player.inventory.Containers[1]) != 1 || + player.inventory.Containers[1][0].ID != 3 || len(cold.items) != 3 || world.nextItem != 4 { + t.Fatal("contained upload/duplicate/replay lost the spare crystal, companion or learned program") + } +} diff --git a/server/nano_learning.go b/server/nano_learning.go @@ -3,6 +3,7 @@ package main import ( "ao/server/gamedata" "encoding/binary" + "maps" "slices" ) @@ -51,10 +52,16 @@ func nanoCrystalProgram(template uint32) uint32 { func (server *server) learnNano_locked(client *worldClient, index int, body []byte) error { player := server.characters[client.id] - item := player.inventory.Items[index] + page, source := binary.BigEndian.Uint32(body[40:44]), binary.BigEndian.Uint32(body[44:48]) + items, bag := player.inventory.Items, uint32(0) + if page == 107 { + bag = client.backpacks[source>>16].id + items = player.inventory.Containers[bag] + } + item := items[index] stats := player.baseStats() var program uint32 - accepted := item.Type == 51005 && item.Slot >= 64 && item.Slot < 94 + accepted := item.Type == 51005 && (bag != 0 || item.Slot >= 64 && item.Slot < 94) switch item.Template { case 43330: program = 43324 @@ -70,8 +77,20 @@ func (server *server) learnNano_locked(client *worldClient, index int, body []by if accepted { // Consume the crystal and grant the program in one atomic save. inventory := player.inventory - inventory.Items = slices.Clone(inventory.Items) - inventory.Items = slices.Delete(inventory.Items, index, index+1) + remaining := slices.Delete(slices.Clone(items), index, index+1) + if bag == 0 { + inventory.Items = remaining + } else { + inventory.Containers = maps.Clone(inventory.Containers) + if len(remaining) == 0 { + delete(inventory.Containers, bag) + } else { + inventory.Containers[bag] = remaining + } + if len(inventory.Containers) == 0 { + inventory.Containers = nil + } + } inventory.LearnedNanos = append(slices.Clone(inventory.LearnedNanos), program) if err := server.saveInventory_locked(player, inventory); err != nil { return err @@ -93,14 +112,14 @@ func (server *server) learnNano_locked(client *worldClient, index int, body []by // OnUse adds the learned entry before DeleteItem removes the empty proxy. var action []byte - for _, value := range []uint32{item.Template, item.Template, item.Quality, 1, 3, 104, item.Slot, 50000, client.id} { + for _, value := range []uint32{item.Template, item.Template, item.Quality, 1, 3, page, source, 50000, client.id} { action = binary.BigEndian.AppendUint32(action, value) } if err := client.send(n3Packet(0x35505644, 50000, client.id, action)); err != nil { return err } var removal []byte - for _, value := range []uint32{112, 104, item.Slot, item.Template, item.Template} { + for _, value := range []uint32{112, page, source, item.Template, item.Template} { removal = binary.BigEndian.AppendUint32(removal, value) } return client.send(n3Packet(0x5e477770, 50000, client.id, removal)) diff --git a/tools/client/test_backpack_nano_learning.mjs b/tools/client/test_backpack_nano_learning.mjs @@ -0,0 +1,81 @@ +import assert from 'node:assert/strict'; +import fs from 'node:fs/promises'; +import {createRequire} from 'node:module'; +import {GameTest} from './game_test.mjs'; + +const {chromium} = createRequire(import.meta.url)('playwright'); +const [url, output] = process.argv.slice(2); +const browser = await chromium.launch({executablePath: '/usr/bin/chromium', args: [ + '--enable-gpu', '--use-gl=angle', '--use-angle=gl', '--no-sandbox', '--disable-dev-shm-usage', + '--disable-background-timer-throttling', '--disable-renderer-backgrounding']}); +let game; +const evidence = {}; +try { + const context = await browser.newContext({viewport: {width: 1024, height: 768}}); + await context.addCookies([{name: 'ao_client', value: 'backpack-nano-learning', url}]); + const page = await context.newPage(); + game = await GameTest.attach(page); + await page.goto(url); + await game.ready(); + const server = async () => (await page.request.get(url + '/test-state')).json(); + const cell = (page, slot) => game.state.grids.flatMap(grid => grid.cells).find(cell => + cell.identity[0] === page && cell.identity[1] === slot && !cell.dummy); + const click = async (source, button) => { + assert(source, 'exact source cell is usable'); + await game.click((source.bounds[0] + source.bounds[2]) / 2, (source.bounds[1] + source.bounds[3]) / 2, button); + }; + const use = async slot => { + const sequence = game.sequence; + await click(cell(107, 65536 | slot), 'right'); + await game.wait('actual native crystal Use', () => game.events.some(event => event.sequence > sequence && + event.direction === 'framesent' && event.opcode === '52526858' && Buffer.from(event.hex, 'hex').readUInt32BE(53) === 107)); + const request = game.events.find(event => event.sequence > sequence && event.direction === 'framesent' && event.opcode === '52526858'); + const reference = Buffer.from(request.hex, 'hex').readUInt32BE(33); + await game.wait('exact crystal completion', () => game.events.some(event => event.sequence > sequence && + event.direction === 'framereceived' && event.opcode === '52526858' && Buffer.from(event.hex, 'hex').readUInt32BE(33) === reference)); + const reply = game.events.find(event => event.sequence > sequence && event.direction === 'framereceived' && + event.opcode === '52526858' && Buffer.from(event.hex, 'hex').readUInt32BE(33) === reference); + return {reference, result: Buffer.from(reply.hex, 'hex').readUInt32BE(29)}; + }; + await game.key('KeyI'); + await click(cell(104, 48), 'right'); + await game.wait('all three contained items visible', () => cell(107, 65536) && cell(107, 65537) && cell(107, 65538)); + evidence.before = await server(); + evidence.upload = await use(0); + await game.save(output + '/upload-result'); + assert.equal(evidence.upload.result, 1); + await game.wait('only the used crystal disappears', () => !cell(107, 65536) && cell(107, 65537) && cell(107, 65538)); + evidence.learned = await server(); + assert.deepEqual(evidence.learned.LearnedNanos, [28665]); + assert.deepEqual(evidence.learned.Containers[1].map(item => [item.ID, item.Slot]), [[3, 1], [4, 2]]); + evidence.duplicate = await use(1); + assert.equal(evidence.duplicate.result, 2); + assert.deepEqual(await server(), evidence.learned); + await game.save(output + '/duplicate'); + + // The companion remains usable through the same native window. + await click(cell(107, 65538), 'left'); + await game.wait('companion picked', state => state.dragged[0] === 107 && state.dragged[1] === 65538); + await click(game.state.grids.find(grid => grid.totalCells === 30).cells.find(cell => cell.identity[0] === 0), 'left'); + await game.wait('exact companion withdraws', state => game.local(state).inventory.some(item => item.id === 4 && item.slot === 49)); + evidence.after = await server(); + await page.keyboard.press('Control+8'); + await game.wait('uploaded program in native Medical list', state => state.grids.some(grid => grid.cells.some(cell => + cell.identity[0] === 53019 && cell.identity[1] === 28665 && !cell.dummy))); + assert.equal(game.state.grids.flatMap(grid => grid.cells).filter(cell => + cell.identity[0] === 53019 && cell.identity[1] === 28665 && !cell.dummy).length, 1); + await game.save(output + '/learned-program'); + await page.reload(); + await game.ready(); + assert.deepEqual(await server(), evidence.after); + assert.deepEqual(game.local().inventory.map(item => [item.id, item.slot]), [[1, 48], [4, 49]]); + assert.deepEqual(game.errors, []); + assert.equal(game.dropped, 0); + console.log('PASS: carried crystal uploads once, preserves its spare/companion, and survives page/cold recovery'); +} finally { + try { + await fs.mkdir(output, {recursive: true}); + await fs.writeFile(output + '/verification.json', JSON.stringify(evidence, null, 2) + '\n'); + if (game) await game.save(output + '/final'); + } finally { await browser.close(); } +}