diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2026-11-17 23:12:38 +0100 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2026-11-17 23:12:38 +0100 |
| commit | d64cf3514e5ff1ddb1c7f3ddac9a769db3e7dde0 (patch) | |
| tree | 781ec9f63220f3c15b309658e9b32ad7d9c70b3a /web/src/lib/ui/menus/SpecialUnlocksMenu.svelte | |
| parent | 94e2850fb73005f3fb30af8489905e5cdfb6fac5 (diff) | |
Phase 5: campaign meta, notes, special rules (M5)
Web:
- Note rows: create/edit menu (text, 12-swatch palette, player/monster
link with per-standee selection, delete) with the reference's
create-vs-edit commit semantics; row rendering with target-derived
gradient colour, link indent + connector, standee N:/All: prefixes,
tap-to-edit; whole-list drag-to-reorder (reorderList); quick
per-figure note (setFigureNote) from the status menu
- Special monsters: Ice Wraith "Switch Form" (deck == "Ice Wraith"
gate), summon mark toggle (round-green/summon standee artwork,
standee-nr badges, per-owner grayscale), character summon boxes +
AddSummonMenu (class summons gated by level and standee cap, item
summons from summons.json)
- Ally deck show/hide in the main menu (shouldShowAlliesDeck gate);
settings "clear unlocked" + Special Unlocks menu
- AddSectionMenu parity: search filter, findNrFromScenarioName numeric
ordering, added sections greyed + no-op, #Random Dungeon label
- gameData.ts: SummonModel, ClassData.summons, summons() fetch
Server:
- unlock_special_command_test (last command without a test; ally-deck
hide and remove-sanctuary were already covered)
PLAN.md: Phase 5 boxes checked, M5 progress-log entry
Diffstat (limited to 'web/src/lib/ui/menus/SpecialUnlocksMenu.svelte')
| -rw-r--r-- | web/src/lib/ui/menus/SpecialUnlocksMenu.svelte | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/web/src/lib/ui/menus/SpecialUnlocksMenu.svelte b/web/src/lib/ui/menus/SpecialUnlocksMenu.svelte new file mode 100644 index 0000000..e565c33 --- /dev/null +++ b/web/src/lib/ui/menus/SpecialUnlocksMenu.svelte @@ -0,0 +1,83 @@ +<!-- + Special Unlocks (the reference `SpecialUnlocksMenu`): toggles the special + characters available in the add-character menu (`unlockSpecial`). Locked + entries show as "???"; the icon is always visible. +--> +<script lang="ts"> + import type { GameSession } from '$lib/state/session'; + import { t } from '$lib/i18n'; + import Menu from '../Menu.svelte'; + + /** The unlockable specials (the reference hard-codes this list). */ + const UNLOCKS: { id: string; icon: string }[] = [ + { id: 'Demons', icon: '/images/demons.png' }, + { id: 'Merchant-Guild', icon: '/images/merchant-guild.png' }, + { id: 'Military', icon: '/images/military.png' }, + { id: 'Bladeswarm', icon: '/images/class-icons/Bladeswarm.png' } + ]; + + let { + session, + open = $bindable(true) + }: { + session: GameSession; + open?: boolean; + } = $props(); + + const gameState = session.state; + const player = session.player; + + const unlocked = $derived($gameState?.unlockedClasses ?? []); + + function isEnabled(id: string): boolean { + return unlocked.includes(id); + } + + function toggle(id: string) { + if (!$player) return; + session.command('unlockSpecial', { id }); + } +</script> + +<Menu {open} title={t('specialUnlocks')}> + <ul class="unlocklist"> + {#each UNLOCKS as u (u.id)} + <li> + <label class="unlocklist__item" class:unlocklist__item--disabled={!$player}> + <input + type="checkbox" + checked={isEnabled(u.id)} + disabled={!$player} + onchange={() => toggle(u.id)} + /> + <img class="unlocklist__icon" src={u.icon} alt="" /> + <span>{isEnabled(u.id) ? u.id : '???'}</span> + </label> + </li> + {/each} + </ul> +</Menu> + +<style> + .unlocklist { + list-style: none; + margin: 0; + padding: 0; + } + .unlocklist__item { + display: flex; + align-items: center; + gap: 10px; + padding: 8px 4px; + font-size: 14px; + cursor: pointer; + } + .unlocklist__item--disabled { + cursor: default; + } + .unlocklist__icon { + width: 40px; + height: 40px; + object-fit: contain; + } +</style> |
