Name and color join the preferences

Your wizard's name pre-fills the lobby (and is remembered whenever you
create or join), and a preferred color — six swatches in the slip, tap
again for none — is claimed quietly in any lobby where it is free and
you have not chosen. First-come still wins a contested color; the
preference never bumps anyone.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0138A8CjeQRpvzKxuMfz1Bqc
This commit is contained in:
Eric Wagoner
2026-08-19 18:53:44 -04:00
co-authored by Claude Fable 5
parent 62c4680d1f
commit b7f93fe454
2 changed files with 44 additions and 4 deletions
+7 -1
View File
@@ -10,12 +10,16 @@ export interface Prefs {
autoGrab: boolean;
/** Spell flourishes (the animated effects layer). */
flourishes: boolean;
/** Pre-filled wizard name for creating and joining games. */
wizardName: string;
/** Preferred wizard color (0-5), claimed in lobbies when free. */
color: number | null;
}
const KEY = "wizwar-prefs";
function load(): Prefs {
const fallback: Prefs = { art: "photo", autoGrab: false, flourishes: true };
const fallback: Prefs = { art: "photo", autoGrab: false, flourishes: true, wizardName: "", color: null };
try {
const raw = localStorage.getItem(KEY);
if (!raw) return fallback;
@@ -24,6 +28,8 @@ function load(): Prefs {
art: p.art === "drawn" ? "drawn" : "photo",
autoGrab: p.autoGrab === true,
flourishes: p.flourishes !== false,
wizardName: typeof p.wizardName === "string" ? p.wizardName.slice(0, 20) : "",
color: typeof p.color === "number" && p.color >= 0 && p.color <= 5 ? p.color : null,
};
} catch {
return fallback;