aorecomp

Anarchy Online classic in the browser

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


commit 1ead79ea3263e62f0971a7eec9ea88b5ea3006b5
parent 7c0dbcdbb51bf3752f0b99884981d5c1b43149b6
Author: anon <anon@example.com>
Date:   Sun,  8 Nov 2026 19:21:37 +0000

Remove duplicate acquisition map from item pages

Diffstat:
MTODO.md | 3++-
Mserver/item_source_pages.go | 1-
Mserver/item_sources_test.go | 21++++++++++++++++++++-
Mtools/client/test_item_sources.mjs | 18+++++++++++++++++-
4 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/TODO.md b/TODO.md @@ -174,7 +174,8 @@ research separately. More screenshots and test cases do not count as new gamepla 30-minute restocking are documented in [shop stock](docs/shop-stock-expansion.md). Shop changes remain embedded YAML plus a rebuild. November 8: indoor seller locations now resolve to outdoor shop entrances, - including shared interiors and nested shops. Acquisition maps use clickable + including shared interiors and nested shops. Item pages link to the map from + Possible sources without a duplicate embedded map. Shop-page maps use clickable location links without general map controls or live player/NPC feeds. Server regressions cover entrance routing and unchanged outdoor vendors; Chromium verifies link clicks center the entrance marker and general map controls work. diff --git a/server/item_source_pages.go b/server/item_source_pages.go @@ -56,7 +56,6 @@ func (server *server) itemTemplatePage(w http.ResponseWriter, r *http.Request) { sources := server.itemSources()[itemFamily(definition.ID)] server.adminPageStart(w, adminName(definition.Name), "Items") fmt.Fprintf(w, "<p><a href='admin/items/catalog'>Item catalog</a></p><h1>%s%s</h1><table><tr><th scope='row'>Description</th><td>%s</td></tr><tr><th scope='row'>Mapped sources (QL family)</th><td>%s</td></tr></table>", itemIcon(definition), html.EscapeString(adminName(definition.Name)), html.EscapeString(definition.Description), html.EscapeString(itemSourceSummary(sources))) - sourceMap(w, sources) fmt.Fprint(w, "<h2>Possible sources (QL family)</h2><table><tr><th>Type</th><th>Icon</th><th>Source</th><th>Offered QL</th><th>Details</th></tr>") for _, source := range sources { name := html.EscapeString(adminName(source.name)) diff --git a/server/item_sources_test.go b/server/item_sources_test.go @@ -45,7 +45,7 @@ func TestItemSourcePagesAreReadOnlyAndFilterFamilies(t *testing.T) { for _, path := range []string{"/admin/items/catalog/85595", "/admin/shops/99491"} { page := httptest.NewRecorder() handler.ServeHTTP(page, httptest.NewRequest("GET", path, nil)) - if page.Code != 200 || !strings.Contains(page.Body.String(), "data-item-sources") || !strings.Contains(page.Body.String(), "class='item-icon'") || strings.Contains(page.Body.String(), "method='post'") && strings.Contains(page.Body.String(), "name='data'") { + if page.Code != 200 || !strings.Contains(page.Body.String(), "admin/map?playfield=") || !strings.Contains(page.Body.String(), "class='item-icon'") || strings.Contains(page.Body.String(), "method='post'") && strings.Contains(page.Body.String(), "name='data'") { t.Fatal(path, "lost read-only source data or icons") } post := httptest.NewRecorder() @@ -87,6 +87,25 @@ func TestShopSourceMapUsesOutdoorEntrancesAndLocationLinks(t *testing.T) { page := httptest.NewRecorder() handler.ServeHTTP(page, httptest.NewRequest("GET", path, nil)) + if path == "/admin/items/catalog/95577" { + for _, link := range []string{ + "admin/map?playfield=705&amp;x=100&amp;z=200", + "admin/map?playfield=705&amp;x=300&amp;z=400", + "admin/map?playfield=710&amp;x=500&amp;z=600", + "admin/map?playfield=950&amp;x=50&amp;z=60", + } { + if !strings.Contains(page.Body.String(), "href='"+link+"'") { + t.Fatal("missing possible-source location link", link) + } + } + for _, removed := range []string{"Acquisition locations", "<div data-world-map", "data-item-sources", "admin/map?playfield=1183"} { + if strings.Contains(page.Body.String(), removed) { + t.Fatal("item page retains duplicate map or indoor machine link", removed) + } + } + continue + } + _, data, found := strings.Cut(page.Body.String(), "data-item-sources>") data, _, _ = strings.Cut(data, "</script>") var locations []sourceMapLocation diff --git a/tools/client/test_item_sources.mjs b/tools/client/test_item_sources.mjs @@ -15,6 +15,22 @@ try { for (const path of ['admin/items/catalog/95577', 'admin/shops/99491']) { await page.goto(url + path); + if (path === 'admin/items/catalog/95577') { + assert.equal(await page.locator('[data-world-map], [data-item-sources]').count(), 0); + const link = page.locator('a[href^="admin/map?playfield=705&"]').filter({hasText: 'entrance'}).first(); + const destination = new URL(await link.getAttribute('href'), url); + await link.click(); + assert.equal(page.url(), destination.href); + await page.waitForFunction(({x, z}) => document.querySelector('[data-map-location]').textContent.includes( + `(705), X ${Number(x).toFixed(1)}, Z ${Number(z).toFixed(1)}.`), Object.fromEntries(destination.searchParams)); + await page.waitForFunction(() => { + const canvas = document.querySelector('canvas'); + 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; + }); + continue; + } + liveFeeds.length = 0; await page.waitForFunction(() => document.querySelector('[data-map-status]').textContent.startsWith('Drag to pan.')); const sources = JSON.parse(await page.locator('[data-item-sources]').textContent()); const trade = sources.findIndex(source => source.playfield === 705 && source.name.includes('entrance')); @@ -51,7 +67,7 @@ try { await page.locator('[data-map-find]').selectOption('705'); await page.waitForFunction(() => document.querySelector('[data-map-view]').value === 'world'); assert.deepEqual(errors, []); - console.log('Acquisition links focus shared shop entrances without map controls or live feeds; general map controls still work.'); + console.log('Possible-source links open outdoor shop entrances without a duplicate item map; shop maps and general map controls still work.'); } finally { await browser.close(); }