aorecomp

Anarchy Online classic in the browser

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


commit 43bc058747abbe67b52d8943eea3afe275dd1d45
parent 9304147e817f88b94252c9218d0999d2a4f50a38
Author: anon <anon@example.com>
Date:   Mon,  9 Nov 2026 13:06:56 +0000

Correct browser combat fixtures and synchronize drop camera input

Diffstat:
Mserver/browser_pet_attack_test.go | 6++++--
Mserver/browser_team_loot_order_test.go | 4++--
Mtools/client/test_pending_stale_drop.mjs | 8+++++---
Mtools/client/test_traded_weapon.mjs | 5+++--
4 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/server/browser_pet_attack_test.go b/server/browser_pet_attack_test.go @@ -22,12 +22,14 @@ func TestBrowserPetAttack(t *testing.T) { root := filepath.Dir(filepath.Dir(source)) output := filepath.Join(root, "local/pet-attack", time.Now().Format("20060102-150405")) world := newBrowserOwnedPetWorld(t) - // A weakened enemy makes the two-hit/one-retaliation outcome a short fixture. + // Use a controlled target for the two-hit/one-retaliation outcome. target := world.characters[1000000] target.level, target.health, target.position = 1, 32, [3]float32{950, 16.5, 511} target.geometry = world.geometry target.walkSurface(target.position, 2) - target.combatProfile = gamedata.NPCCombatProfiles[17655][1] + profile := *gamedata.NPCCombatProfiles[17655][1] + profile.Health = 32 + target.combatProfile = &profile target.motion = &npcMotion{home: target.position} world.mobileNPCs = map[uint32][]*character{705: {target}} world.combatRoll = landedCombatRoll diff --git a/server/browser_team_loot_order_test.go b/server/browser_team_loot_order_test.go @@ -42,7 +42,7 @@ func TestBrowserTeamLootOrders(t *testing.T) { if _, err := world.changeTeam(teamCommand{actor: 1, action: 28, member: 2}, make(map[*worldClient][][]byte)); err != nil { t.Fatal(err) } - // Keep transfer fixtures to one known Monster Part. + // Keep transfer fixtures to one known Monster Part and defer recovery before their controlled kills. profile := *gamedata.NPCCombatProfiles[17655][1] profile.Loot = []gamedata.NPCLoot{{Template: 42640, Quality: [2]uint32{1, 1}, Chance: 50}} positions := [][3]float32{{960, 16.5, 514}, {958.8, 16.5, 514}, {961.2, 16.5, 514}, {959.4, 16.5, 515.5}, {960.6, 16.5, 515.5}} @@ -51,7 +51,7 @@ func TestBrowserTeamLootOrders(t *testing.T) { world.characters[id] = &character{id: id, name: "Loot-order Leet", npc: true, level: 1, playfield: 705, position: position, rotation: [4]float32{0, 0, 0, 1}, health: 1, appearance: 229, monsterData: 17655, npcDefinitionID: "950/district/2/group/0/authored_point", - combatProfile: &profile} + combatProfile: &profile, regenerationAt: time.Now().Add(5 * time.Minute)} } world.combatRoll = func(uint32) uint32 { return 0 } if err := world.flushWorld(); err != nil { diff --git a/tools/client/test_pending_stale_drop.mjs b/tools/client/test_pending_stale_drop.mjs @@ -37,12 +37,14 @@ try { await page.keyboard.press('Control+1'); await game.wait('both fixture weapons visible', () => cell(48) && cell(49)); if (!game.state.camera.firstPerson) await game.key('F8'); - const point = await game.point(500, 400); + const point = await game.point(500, 150); await page.mouse.move(point.x, point.y); + const press = game.sequence; await page.mouse.down({button: 'right'}); try { - await page.mouse.move(point.x, point.y + 150, {steps: 8}); - await game.snapshot(); + await game.waitInput(press, 1025); + await page.mouse.move(point.x, point.y + 400, {steps: 8}); + await game.wait('ground view below the character', state => state.camera.angles[1] >= 0.55); } finally { const release = game.sequence; await page.mouse.up({button: 'right'}); diff --git a/tools/client/test_traded_weapon.mjs b/tools/client/test_traded_weapon.mjs @@ -30,6 +30,7 @@ try { const state = async () => (await owner.page.request.get(url + '/test-state')).json(); evidence.initial = await state(); if (evidence.initial.owner.Items.length === 2) { + assert.equal(evidence.initial.health, 20); // Instantiate the loaded weapon in both native worlds before offering it. await owner.key('KeyI'); await owner.page.keyboard.press('Control+1'); @@ -109,9 +110,9 @@ try { event.sequence > sequence && event.direction === 'framereceived' && event.opcode === '46002f16' && event.actor[1] === 2)); await recipient.key('KeyQ'); await Promise.all(games.map(game => game.wait('both clients see the impact', snapshot => - snapshot.actors.some(actor => actor.id === evidence.initial.target && actor.stats[27] === 98)))); + snapshot.actors.some(actor => actor.id === evidence.initial.target && actor.stats[27] === 18)))); evidence.hit = await state(); - assert.equal(evidence.hit.health, 98); + assert.equal(evidence.hit.health, 18); assert.equal(evidence.hit.recipient.Items[0].Ammo, 12); assert.equal(evidence.hit.owner.Items[0].Count, 100); await recipient.save(output + '/hit');