summaryrefslogtreecommitdiff
path: root/web/src/lib/game/art.ts
diff options
context:
space:
mode:
Diffstat (limited to 'web/src/lib/game/art.ts')
-rw-r--r--web/src/lib/game/art.ts27
1 files changed, 27 insertions, 0 deletions
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';
+}