aorecomp

Anarchy Online classic in the browser

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


commit bdfb93c8f5261c44fe84f5b121cd5f3a5ab12978
parent a121ac321ac439f91c2c2c262d033ffc04b7a38d
Author: anon <anon@example.com>
Date:   Wed, 11 Nov 2026 04:11:53 +0000

Resolve indoor loot map links to outdoor entrances

Diffstat:
Mdocs/maps.md | 8++++++++
Mserver/item_pool_sources.go | 8++++----
Mserver/item_sources.go | 26++++++++++++++++----------
Mserver/loot_distribution_test.go | 6+++---
Mtools/client/test_item_sources.mjs | 23++++++++++++++---------
5 files changed, 45 insertions(+), 26 deletions(-)

diff --git a/docs/maps.md b/docs/maps.md @@ -30,6 +30,14 @@ when a return entrance is known. It does not make the interior's local coordinates part of the outdoor coordinate system. There is no verified planet placement for every playfield. +Item-source links resolve indoor shops, loot and pickups to known outdoor +entrances. Camelot's entrance is the original 14.9.1 resource `1000026/505`, +statel `0xc00101f9` (Camelot Castle): its unconditional OnEnter TeleportProxy +53082 specifies destination category 51102 and playfield 120. Its Avalon +position is `[2092.245849609375, 52.798404693603516, 3821.69970703125]`. +The source map uses this entrance independently of the unresolved gameplay +arrival; it does not place Tarasque's interior coordinates on Rubi-Ka. + ## Shipped planet imagery The default map is in diff --git a/server/item_pool_sources.go b/server/item_pool_sources.go @@ -8,7 +8,7 @@ import ( "strings" ) -func addTableLootSources(sources map[uint32][]itemSource) { +func addTableLootSources(sources map[uint32][]itemSource, entrances map[uint32][]itemSourceLocation) { // Coalesce shared pools across encounters. Per-item copies of every spawn // would make the catalog index much larger than the underlying world data. populations := make(map[gamedata.LootPoolRoll][]string) @@ -20,7 +20,7 @@ func addTableLootSources(sources map[uint32][]itemSource) { group := gamedata.NPCGroups[id] levels[0], levels[1] = min(levels[0], group.Levels[0]), max(levels[1], group.Levels[1]) for _, position := range group.Positions { - locations = append(locations, itemSourceLocation{group.Name, npcSourcePlayfield(id), position}) + locations = append(locations, itemSourceLocations(itemSourceLocation{group.Name, npcSourcePlayfield(id), position}, entrances)...) } } for _, drop := range table.Drops { @@ -74,8 +74,8 @@ func addTableLootSources(sources map[uint32][]itemSource) { continue } for _, position := range group.Positions { - locations[source.level] = append(locations[source.level], itemSourceLocation{ - fmt.Sprintf("%s (levels %d-%d)", group.Name, max(group.Levels[0], source.level[0]), min(group.Levels[1], source.level[1])), npcSourcePlayfield(id), position}) + locations[source.level] = append(locations[source.level], itemSourceLocations(itemSourceLocation{ + fmt.Sprintf("%s (levels %d-%d)", group.Name, max(group.Levels[0], source.level[0]), min(group.Levels[1], source.level[1])), npcSourcePlayfield(id), position}, entrances)...) } } } diff --git a/server/item_sources.go b/server/item_sources.go @@ -47,30 +47,36 @@ func npcSourcePlayfield(id string) uint32 { // Build one family index per page, never scan all sources separately for each catalog row. func (server *server) itemSources() map[uint32][]itemSource { sources := make(map[uint32][]itemSource) - addTableLootSources(sources) sellers := make(map[uint32][]itemSourceLocation) - // Reverse authored doors so shared and nested shops expose every entrance. + // Reverse authored doors so shared and nested interiors expose every entrance. entrances := make(map[uint32][]itemSourceLocation) for _, playfield := range slices.Sorted(maps.Keys(server.zoneLinks["target"])) { for _, door := range server.zoneLinks["target"][playfield].Doors { - if door.Destination != 0 && !door.Return { - entrances[door.Destination] = append(entrances[door.Destination], itemSourceLocation{"", playfield, door.Position}) + destination := door.Destination + // 14.9.1 resource 1000026/505, statel 0xc00101f9 declares Camelot (120). + // Its entrance is known even though the gameplay arrival is unresolved. + if playfield == 505 && door.ID == 0xc00101f9 { + destination = 120 + } + if destination != 0 && !door.Return { + entrances[destination] = append(entrances[destination], itemSourceLocation{"", playfield, door.Position}) } } } + addTableLootSources(sources, entrances) for _, id := range slices.Sorted(maps.Keys(gamedata.ShopMachines)) { machine := gamedata.ShopMachines[id] if itemStat(gamedata.ItemTemplates[machine.Template], 30)&8 == 0 { continue } - sellers[machine.Template] = append(sellers[machine.Template], shopSourceLocations(itemSourceLocation{ + sellers[machine.Template] = append(sellers[machine.Template], itemSourceLocations(itemSourceLocation{ fmt.Sprintf("%s (machine %d)", gamedata.ItemTemplates[machine.Template].Name, id), machine.Playfield, machine.Position}, entrances)...) } for _, id := range slices.Sorted(maps.Keys(gamedata.NPCGroups)) { group := gamedata.NPCGroups[id] if group.ShopTemplate != 0 { for _, position := range group.Positions { - sellers[group.ShopTemplate] = append(sellers[group.ShopTemplate], shopSourceLocations(itemSourceLocation{group.Name, npcSourcePlayfield(id), position}, entrances)...) + sellers[group.ShopTemplate] = append(sellers[group.ShopTemplate], itemSourceLocations(itemSourceLocation{group.Name, npcSourcePlayfield(id), position}, entrances)...) } } // Use only profiles admitted for this group at levels it can actually spawn at. @@ -95,7 +101,7 @@ func (server *server) itemSources() map[uint32][]itemSource { if !exists { source = itemSource{kind: "Loot", name: group.Name + " (" + id + ")", quality: drop.Quality, chance: drop.Chance, evidence: drop.Evidence, inference: drop.Inference, level: [2]uint16{level, level}} for _, position := range group.Positions { - source.locations = append(source.locations, itemSourceLocation{group.Name, npcSourcePlayfield(id), position}) + source.locations = append(source.locations, itemSourceLocations(itemSourceLocation{group.Name, npcSourcePlayfield(id), position}, entrances)...) } } else { source.quality[0] = min(source.quality[0], drop.Quality[0]) @@ -116,7 +122,7 @@ func (server *server) itemSources() map[uint32][]itemSource { template := gamedata.NPCNames.Templates[group.TemplateCode].ItemTemplate source := itemSource{kind: "World pickup", name: group.Name, quality: [2]uint32{uint32(group.Levels[0]), min(uint32(group.Levels[1]), uint32(group.Levels[0])+uint32(len(group.Positions))-1)}} for _, position := range group.Positions { - source.locations = append(source.locations, itemSourceLocation{group.Name, npcSourcePlayfield(id), position}) + source.locations = append(source.locations, itemSourceLocations(itemSourceLocation{group.Name, npcSourcePlayfield(id), position}, entrances)...) } sources[itemFamily(template)] = append(sources[itemFamily(template)], source) } @@ -167,12 +173,12 @@ func (server *server) itemSources() map[uint32][]itemSource { return sources } -func shopSourceLocations(location itemSourceLocation, entrances map[uint32][]itemSourceLocation) []itemSourceLocation { +func itemSourceLocations(location itemSourceLocation, entrances map[uint32][]itemSourceLocation) []itemSourceLocation { if gamedata.Playfields[location.playfield].Outdoor { return []itemSourceLocation{location} } - // Walk outward through nested interiors, stopping at outdoor shop doors. + // Walk outward through nested interiors, stopping at outdoor doors. var locations []itemSourceLocation pending := []uint32{location.playfield} visited := make(map[uint32]bool) diff --git a/server/loot_distribution_test.go b/server/loot_distribution_test.go @@ -111,12 +111,12 @@ func TestDistributedCatalogShowsItemOddsAndNamedLocations(t *testing.T) { t.Fatal("documented Temple drop lost") } if !slices.ContainsFunc(sources[157856], func(s itemSource) bool { - return strings.Contains(s.name, "Tarasque") && s.locations[0].playfield == 120 + return strings.Contains(s.name, "Tarasque") && s.locations[0].playfield == 505 && strings.Contains(s.locations[0].name, "Camelot entrance") }) { - t.Fatal("Tarasque reward not at Camelot") + t.Fatal("Tarasque reward does not link to the Camelot entrance") } if !slices.ContainsFunc(sources[158601], func(s itemSource) bool { - return strings.Contains(s.name, "Tarasque") && strings.Contains(s.evidence, "item 158601 description") && s.locations[0].playfield == 120 + return strings.Contains(s.name, "Tarasque") && strings.Contains(s.evidence, "item 158601 description") && s.locations[0].playfield == 505 && strings.Contains(s.locations[0].name, "Camelot entrance") }) { t.Fatal("original description's Gall Stone source lost") } diff --git a/tools/client/test_item_sources.mjs b/tools/client/test_item_sources.mjs @@ -81,10 +81,10 @@ try { assert.deepEqual(liveFeeds, []); assert.deepEqual(errors, []); - // Interior source links must focus their coordinates even without extracted map imagery. + // Interior loot links must focus the outdoor entrance on the Rubi-Ka map. await page.goto(url + 'admin/items/catalog/200199'); - const tarasque = page.getByRole('link', {name: 'Tarasque (levels 200-200) - Camelot (120), X 111.3 Z 307.0', exact: true}).first(); - const viewportRequest = page.waitForRequest(request => request.url().includes('admin/map-entities?view=120&')); + const tarasque = page.getByRole('link', {name: 'Tarasque (levels 200-200) - Camelot entrance - Avalon (505), X 2092.2 Z 3821.7', exact: true}).first(); + const viewportRequest = page.waitForRequest(request => request.url().includes('admin/map-entities?view=world&')); await tarasque.click(); const viewport = new URL((await viewportRequest).url()).searchParams; @@ -93,13 +93,18 @@ try { const pixel = canvas.getContext('2d').getImageData(canvas.width / 2, canvas.height / 2, 1, 1).data; return pixel[0] === 33 && pixel[1] === 219 && pixel[2] === 135; }); + await page.waitForFunction(() => { + const canvas = document.querySelector('canvas'); + const pixel = canvas.getContext('2d').getImageData(canvas.width / 2 + 100, canvas.height / 2 + 100, 1, 1).data; + return pixel[0] !== 34 || pixel[1] !== 34 || pixel[2] !== 34; + }); - assert.equal(page.url(), url + 'admin/map?playfield=120&x=111.25214&z=307.01544'); - assert.equal(await page.locator('[data-map-view]').inputValue(), '120'); - assert.match(await page.locator('[data-map-status]').textContent(), /No extracted imagery for this playfield/); - assert.match(await page.locator('[data-map-location]').textContent(), /playfield 120, X 111.3, Z 307.0/); - assert(Math.abs((Number(viewport.get('left')) + Number(viewport.get('right'))) / 2 - 111.25214) < 0.00001); - assert(Math.abs((Number(viewport.get('bottom')) + Number(viewport.get('top'))) / 2 - 307.01544) < 0.00001); + assert.equal(page.url(), url + 'admin/map?playfield=505&x=2092.2458&z=3821.6997'); + assert.equal(await page.locator('[data-map-view]').inputValue(), 'world'); + assert.doesNotMatch(await page.locator('[data-map-status]').textContent(), /No extracted imagery/); + assert.match(await page.locator('[data-map-location]').textContent(), /Avalon \(505\), X 2092.2, Z 3821.7/); + assert(Math.abs((Number(viewport.get('left')) + Number(viewport.get('right'))) / 2 - 37306.2458) < 0.00001); + assert(Math.abs((Number(viewport.get('bottom')) + Number(viewport.get('top'))) / 2 - 48387.6997) < 0.00001); assert.equal(Number(viewport.get('right')) - Number(viewport.get('left')), await page.locator('canvas').evaluate(canvas => canvas.clientWidth)); assert.deepEqual(errors, []);