Technique swapping implementation
This commit is contained in:
@@ -94,6 +94,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Admin escape hatch: hand out every technique randomly and auto-assign J/Q/K
|
||||
async function autoAssignTechniques() {
|
||||
try {
|
||||
await apiRequest(`/game/${gameId}/player/${playerId}/auto-assign-techniques`, 'POST');
|
||||
} catch (err) {
|
||||
error = err.message;
|
||||
}
|
||||
}
|
||||
|
||||
// Admins get the admin key in their state blob; stash it so the Admin page works for them too
|
||||
$: if (state?.player?.is_admin && state?.game?.admin_key) {
|
||||
localStorage.setItem(`admin_key_${gameId}`, state.game.admin_key);
|
||||
@@ -107,13 +116,20 @@
|
||||
action: toggleDevMode,
|
||||
title: 'Toggle Dev Mode testing shortcuts for the whole table',
|
||||
});
|
||||
if (state.game.dev_mode && (state.game.phase === 'character_creation' || state.game.phase === 'swap_techniques')) {
|
||||
if (state.game.dev_mode && ['character_creation', 'swap_techniques', 'assign_techniques'].includes(state.game.phase)) {
|
||||
items.push({
|
||||
label: '⏭️ Skip Character Creation',
|
||||
action: skipCharacterCreation,
|
||||
title: 'Auto-fill anything unfinished for all players and jump to scene setup',
|
||||
});
|
||||
}
|
||||
if (state.game.phase === 'swap_techniques' || state.game.phase === 'assign_techniques') {
|
||||
items.push({
|
||||
label: '🎲 Auto-Assign Techniques',
|
||||
action: autoAssignTechniques,
|
||||
title: 'Randomly distribute all techniques to eligible players and assign them to J/Q/K',
|
||||
});
|
||||
}
|
||||
items.push({ label: '🛠️ Admin', href: `#/game/${gameId}/admin`, title: 'Open the Admin Panel' });
|
||||
}
|
||||
extraMenuLinks.set(items);
|
||||
@@ -138,7 +154,7 @@
|
||||
<div class="dashboard-container {state.player.is_ghost ? 'ghost-world' : ''}">
|
||||
{#if state.game.phase === 'lobby'}
|
||||
<LobbyPhase {state} />
|
||||
{:else if state.game.phase === 'character_creation' || state.game.phase === 'swap_techniques'}
|
||||
{:else if state.game.phase === 'character_creation' || state.game.phase === 'swap_techniques' || state.game.phase === 'assign_techniques'}
|
||||
<CharacterCreationPhase {state} />
|
||||
{:else if state.game.phase === 'scene_setup'}
|
||||
<SceneSetupPhase {state} />
|
||||
|
||||
Reference in New Issue
Block a user