commit 1ab9c2bb20df721b62f5a7f90d977c97e1a51a4b
parent 68a5331c1d9ccb3a5bda8708d681300416514db0
Author: anon <anon@example.com>
Date: Wed, 11 Nov 2026 04:27:30 +0000
Distinguish source marker colors and compact item overviews
Diffstat:
6 files changed, 52 insertions(+), 9 deletions(-)
diff --git a/docs/maps.md b/docs/maps.md
@@ -42,6 +42,8 @@ Individual catalog items include an overworld overview fitted to all known
source positions. Markers are deduplicated by playfield and X/Z, including
different loot sources sharing an indoor entrance. Sources without a known
overworld position remain in the details below the map.
+The compact overview uses amber for loot, blue for vending and green for other
+sources; a shared loot/vending position has one split-color marker.
## Shipped planet imagery
diff --git a/server/assets/map.js b/server/assets/map.js
@@ -568,10 +568,15 @@ class AOMap {
const point = this.playerPoint(source);
if (!point) continue;
const [x, y] = this.toScreen(...point);
- ctx.fillStyle = "#21db87";
+ ctx.fillStyle = source.loot ? "#f4b942" : source.vending ? "#55b8ff" : "#21db87";
ctx.strokeStyle = "#102b20";
ctx.lineWidth = 2;
- ctx.beginPath(); ctx.arc(x, y, 6, 0, Math.PI * 2); ctx.fill(); ctx.stroke();
+ ctx.beginPath(); ctx.arc(x, y, 6, 0, Math.PI * 2); ctx.fill();
+ if (source.loot && source.vending) {
+ ctx.fillStyle = "#55b8ff";
+ ctx.beginPath(); ctx.arc(x, y, 6, -Math.PI / 2, Math.PI / 2); ctx.fill();
+ }
+ ctx.beginPath(); ctx.arc(x, y, 6, 0, Math.PI * 2); ctx.stroke();
if (this.scale >= 0.6) ctx.fillText(source.name, x + 9, y - 9);
}
diff --git a/server/item_source_pages.go b/server/item_source_pages.go
@@ -16,6 +16,8 @@ type sourceMapLocation struct {
Name string `json:"name"`
Playfield uint32 `json:"playfield"`
Position [3]float32 `json:"position"`
+ Loot bool `json:"loot,omitempty"`
+ Vending bool `json:"vending,omitempty"`
}
func sourceOverview(w http.ResponseWriter, sources []itemSource) {
@@ -25,7 +27,7 @@ func sourceOverview(w http.ResponseWriter, sources []itemSource) {
playfield uint32
x, z float32
}
- seen := make(map[mapPoint]bool)
+ seen := make(map[mapPoint]int)
unmapped := false
for _, source := range sources {
for _, location := range source.locations {
@@ -34,10 +36,14 @@ func sourceOverview(w http.ResponseWriter, sources []itemSource) {
continue
}
key := mapPoint{location.playfield, location.position[0], location.position[2]}
- if !seen[key] {
- locations = append(locations, sourceMapLocation{location.name, location.playfield, location.position})
- seen[key] = true
+ index, exists := seen[key]
+ if !exists {
+ index = len(locations)
+ locations = append(locations, sourceMapLocation{Name: location.name, Playfield: location.playfield, Position: location.position})
+ seen[key] = index
}
+ locations[index].Loot = locations[index].Loot || source.kind == "Loot"
+ locations[index].Vending = locations[index].Vending || source.kind == "Shop"
}
}
if len(locations) == 0 {
@@ -48,11 +54,12 @@ func sourceOverview(w http.ResponseWriter, sources []itemSource) {
panic(err)
}
fmt.Fprintf(w, "<section><h2>Source locations on Rubi-Ka</h2><p>%d unique mapped locations. Indoor sources are shown at their outdoor entrances.</p>", len(locations))
+ fmt.Fprint(w, "<p aria-label='Map legend'><span aria-hidden='true' style='display:inline-block;width:12px;height:12px;border:1px solid #222;border-radius:50%;background:#f4b942'></span> Loot <span aria-hidden='true' style='display:inline-block;width:12px;height:12px;border:1px solid #222;border-radius:50%;background:#55b8ff'></span> Vending <span aria-hidden='true' style='display:inline-block;width:12px;height:12px;border:1px solid #222;border-radius:50%;background:#21db87'></span> Other. Split markers have both loot and vending.</p>")
if unmapped {
fmt.Fprint(w, "<p>Locations without a known overworld position are listed in the source details below.</p>")
}
fmt.Fprintf(w, "<script type='application/json' data-item-sources>%s</script>", data)
- fmt.Fprint(w, "<div data-world-map data-map-overview><p data-map-status>Loading maps...</p><p data-map-location></p><canvas data-map-canvas width='1000' height='480' aria-label='Item source overworld overview'></canvas></div><script src='admin/control-map.js' defer></script></section>")
+ fmt.Fprint(w, "<div data-world-map data-map-overview><p data-map-status>Loading maps...</p><p data-map-location></p><canvas data-map-canvas width='1000' height='480' style='height:240px;min-height:0' aria-label='Item source overworld overview'></canvas></div><script src='admin/control-map.js' defer></script></section>")
}
func sourceMap(w http.ResponseWriter, sources []itemSource) {
@@ -60,7 +67,7 @@ func sourceMap(w http.ResponseWriter, sources []itemSource) {
seen := make(map[sourceMapLocation]bool)
for _, source := range sources {
for _, location := range source.locations {
- marker := sourceMapLocation{source.kind + ": " + location.name, location.playfield, location.position}
+ marker := sourceMapLocation{source.kind + ": " + location.name, location.playfield, location.position, source.kind == "Loot", source.kind == "Shop"}
if !seen[marker] {
locations = append(locations, marker)
seen[marker] = true
diff --git a/server/item_sources_test.go b/server/item_sources_test.go
@@ -163,6 +163,9 @@ func TestShopSourceMapUsesOutdoorEntrancesAndLocationLinks(t *testing.T) {
var placements []mapEntrance
for _, location := range locations {
if strings.Contains(location.Name, "(machine ") {
+ if !location.Vending || location.Loot {
+ t.Fatal("vendor location lost its source type", location)
+ }
placements = append(placements, mapEntrance{location.Playfield, location.Position})
}
}
diff --git a/server/map_test.js b/server/map_test.js
@@ -294,3 +294,22 @@ test('a single overview location has a finite useful zoom', () => {
assert.deepEqual(Array.from(map.center), [37306, 48388]);
assert.equal(map.scale, 1);
});
+
+test('loot and vending markers use distinct colors and shared markers show both', () => {
+ const map = mapWithTiles(500, 1, () => {});
+ map.zones.get(950).levels = [];
+ map.sources = [
+ {playfield: 950, position: [100, 0, 100], loot: true},
+ {playfield: 950, position: [200, 0, 100], vending: true},
+ {playfield: 950, position: [300, 0, 100], loot: true, vending: true},
+ ];
+ const fills = [];
+ Object.assign(map.context, {
+ beginPath() {}, arc() {}, stroke() {}, fillText() {},
+ fill() { fills.push(this.fillStyle); },
+ });
+
+ map.render();
+
+ assert.deepEqual(fills, ['#f4b942', '#55b8ff', '#f4b942', '#55b8ff']);
+});
diff --git a/tools/client/test_item_sources.mjs b/tools/client/test_item_sources.mjs
@@ -39,6 +39,7 @@ try {
await page.goto(url + path);
if (path === 'admin/items/catalog/95577') {
assert.equal(await page.locator('[data-world-map], [data-item-sources]').count(), 2);
+ assert(JSON.parse(await page.locator('[data-item-sources]').textContent()).some(source => source.vending));
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();
@@ -71,7 +72,7 @@ try {
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;
+ return pixel[0] === 85 && pixel[1] === 184 && pixel[2] === 255;
});
assert.equal(page.url(), url + path);
}
@@ -93,8 +94,14 @@ try {
const markers = overview.map(source => `${source.playfield}:${source.position[0]}:${source.position[2]}`);
assert.deepEqual(markers.toSorted(), [...new Set(expected)].toSorted());
assert.equal(markers.filter(point => point === '505:2092.2458:3821.6997').length, 1);
+ assert.equal(overview.find(source => source.playfield === 505 && source.position[0] === 2092.2458).loot, true);
+ assert.match(await page.getByLabel('Map legend', {exact: true}).textContent(), /Loot.*Vending/);
assert.equal(await page.locator('[data-world-map]').count(), 1);
assert.equal(await page.locator('[data-map-source]').count(), 0, 'overview must not repeat the source list');
+ assert.equal(await page.locator('[data-map-overview] canvas').evaluate(canvas => canvas.clientHeight), 240);
+ await page.setViewportSize({width: 390, height: 844});
+ assert.equal(await page.locator('[data-map-overview] canvas').evaluate(canvas => canvas.clientHeight), 240);
+ await page.setViewportSize({width: 1280, height: 720});
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&'));