blob: af81facc5b9342c6229dc669269fb4fe49dfde36 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
/**
* 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 summon standee's artwork (the reference `summon/${gfx}.png`; the gfx is
* a colour name or an item-summon art name). Empty gfx falls back to green,
* like the reference.
*/
export function summonImage(gfx: string): string {
return `/images/summon/${gfx || 'green'}.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';
}
|