From 4f50f2008f4d7c2a635f7f26861fcfc7f7504423 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Sun, 15 Nov 2026 13:45:21 +0100 Subject: Phase 3: web UI core loop (M3) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Browser game UI on top of the Phase 2 protocol: server-driven, input-only clients with per-connection secret visibility. Web (Svelte 5): - Layout: TopBar (element buttons with use/imbue long-press, title, menu), MainList (character/monster/note rows), BottomBar (draw/next-round + level widget with T/H/X/C values). - CharacterRow with the secret initiative input: own value editable, server-masked values render as ??, revealed on draw. - Per-figure StatusMenu: health/max/xp/bless/curse/empower/enfeeble steppers, condition grid, turn-done — all server commands, player-gated. - Menu dialogs: select scenario, add section, add/remove character, set level/difficulty/solo/auto-level, add/remove monster, note row, action log with rollback, settings (style theme + language). - Player vs spectator UI gated on the live seat table; reconnecting banner, error toasts, connection status plumbing. - i18n: English ported, locale store with localStorage persistence. - Design tokens + the three style themes (frosthaven/gloomhaven/original). - Unit tests: level values, game logic (elements/conditions/art/stats), i18n, the reactive player store, the data client (sections keyed by scenario number), plus the existing connection/protocol/state tests. Server: - Serve the engine's data JSON at /data/ and artwork at /images/ so the client menus and rows read the same assets the engine loads. --- web/src/lib/game/art.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 web/src/lib/game/art.ts (limited to 'web/src/lib/game/art.ts') diff --git a/web/src/lib/game/art.ts b/web/src/lib/game/art.ts new file mode 100644 index 0000000..4be6637 --- /dev/null +++ b/web/src/lib/game/art.ts @@ -0,0 +1,27 @@ +/** + * Artwork helpers. The Dart server serves the engine's image assets under + * `/images/` (mirroring the reference app's `assets/images/`). + */ + +/** Character-class icon (the reference row art). */ +export function classIcon(className: string): string { + return `/images/class-icons/${className}.png`; +} + +/** Monster / summon artwork. */ +export function monsterImage(gfx: string): string { + return `/images/monsters/${gfx}.png`; +} + +/** + * A character-class background colour. The data stores a Flutter ARGB hex + * string (e.g. `"ffa28b7c"`); CSS wants `#rrggbb` with the alpha dropped + * (the reference uses it at full opacity as the row backdrop). + */ +export function classColor(argb: string): string { + if (/^[0-9a-f]{8}$/i.test(argb)) { + return `#${argb.slice(2)}`; + } + if (/^#[0-9a-f]{6}$/i.test(argb)) return argb; + return '#3a3f47'; +} -- cgit v1.3.1