diff --git a/src/lib/server/daily-character.ts b/src/lib/server/daily-character.ts index 6b79532..f391559 100644 --- a/src/lib/server/daily-character.ts +++ b/src/lib/server/daily-character.ts @@ -168,6 +168,17 @@ export async function getDailyModeCharacters(): Promise { + const characters = (await db + .select(characterWithRelationsSelect) + .from(character) + .leftJoin(arc, eq(character.arcId, arc.id)) + .leftJoin(devilFruit, eq(character.devilFruitId, devilFruit.id)) + .all()) as CharacterWithRelations[]; + + return applyCharacterOverrides(characters); +} + export async function getCharacterById(characterId: string): Promise { const [found] = await db .select(characterWithRelationsSelect) diff --git a/src/routes/(game)/+page.svelte b/src/routes/(game)/+page.svelte index 09d0f2a..5b11528 100644 --- a/src/routes/(game)/+page.svelte +++ b/src/routes/(game)/+page.svelte @@ -37,12 +37,15 @@
-

Partie libre

-

Entraine-toi avec des pirates legendaires

-

Choisis une epoque, regle la difficulte et vogue a ton rythme.

- +

Mode Infini

+

Des defis sans fin

+

Enchaine les personnages et croise ton score. Pas de limite, que du plaisir.

+ + Jouer +
diff --git a/src/routes/(game)/daily/+page.svelte b/src/routes/(game)/daily/+page.svelte index 7798dac..341f4ed 100644 --- a/src/routes/(game)/daily/+page.svelte +++ b/src/routes/(game)/daily/+page.svelte @@ -21,11 +21,11 @@ // Load from localStorage on mount onMount(() => { - const storedDailyCharacterId = localStorage.getItem('currentDailyCharacterId'); - const currentDailyCharacterId = dailyCharacter?.id; + const storedDailyCharacterId = localStorage.getItem('dailyCurrentCharacterId'); + const dailyCurrentCharacterId = dailyCharacter?.id; // If the daily character has changed, clear the history - if (storedDailyCharacterId && storedDailyCharacterId !== currentDailyCharacterId) { + if (storedDailyCharacterId && storedDailyCharacterId !== dailyCurrentCharacterId) { localStorage.removeItem('dailyCharacterHistory'); selectedCharacters = []; } else { @@ -47,8 +47,8 @@ } // Store the current daily character ID - if (currentDailyCharacterId) { - localStorage.setItem('currentDailyCharacterId', currentDailyCharacterId); + if (dailyCurrentCharacterId) { + localStorage.setItem('dailyCurrentCharacterId', dailyCurrentCharacterId); } isLoaded = true; diff --git a/src/routes/(game)/infinite/+page.server.ts b/src/routes/(game)/infinite/+page.server.ts new file mode 100644 index 0000000..ef4f5ba --- /dev/null +++ b/src/routes/(game)/infinite/+page.server.ts @@ -0,0 +1,28 @@ +import { db } from '$lib/server/db'; +import { config } from '$lib/server/db/schema'; +import { getAllCharacters } from '$lib/server/daily-character'; +import { like } from 'drizzle-orm'; + +export async function load() { + const characters = await getAllCharacters(); + + // Load column visibility config + const columnConfig = await db + .select() + .from(config) + .where(like(config.key, 'characterHistory.column.%.visible')); + + // Convert to object for easier access + const columnVisibility: Record = {}; + columnConfig.forEach(row => { + const match = row.key.match(/characterHistory\.column\.(.+)\.visible/); + if (match) { + columnVisibility[match[1]] = row.value === 'true'; + } + }); + + return { + characters, + columnVisibility + }; +} diff --git a/src/routes/(game)/infinite/+page.svelte b/src/routes/(game)/infinite/+page.svelte new file mode 100644 index 0000000..52dd6f6 --- /dev/null +++ b/src/routes/(game)/infinite/+page.svelte @@ -0,0 +1,400 @@ + + + + OnePieceDle - Mode Infini + + + +
+
+
+ +
+
+
+
+

+ Mode Infini +

+

Score: {score}

+
+ {#if score > 0} + + {/if} +
+

+ Devine des personnages à l'infini ! Chaque indice se débloque après un certain nombre de + tentatives. Bonne chance ! +

+
+ +
+ {#if currentCharacter} + {#if hasWon} +
+
+
🎉
+

Bien joué !

+

+ Vous avez trouvé le personnage en {selectedCharacters.length} + {selectedCharacters.length > 1 ? 'tentatives' : 'tentative'} ! +

+
+ {#if currentCharacter.pictureUrl} + + {currentCharacter.name} + + {/if} +

{currentCharacter.name}

+
+ +
+
+ {:else} +
+
+ + + +
+
+ + {/if} + {:else} +
+

Chargement du personnage...

+
+ {/if} +
+ + {#if currentCharacter} + +
+
+

Colonnes visibles

+
+ {#each Object.entries(columnVisibility) as [column, isVisible] (column)} + + {/each} +
+
+
+ + + {/if} +
+
+ +