mirror of
https://github.com/shadoll/sLogos.git
synced 2025-12-20 03:26:59 +00:00
Add new achievements for "Star Performer" and "City Expert" with tracking logic in CapitalsQuiz
This commit is contained in:
@@ -29,6 +29,13 @@
|
|||||||
iconColor: "#fbbf24", // gold
|
iconColor: "#fbbf24", // gold
|
||||||
requirement: () => currentStreak >= 5,
|
requirement: () => currentStreak >= 5,
|
||||||
},
|
},
|
||||||
|
star_performer: {
|
||||||
|
name: "Star Performer",
|
||||||
|
description: "Get 5 perfect rounds in a row",
|
||||||
|
icon: "star.svg",
|
||||||
|
iconColor: "#ffd700",
|
||||||
|
requirement: () => achievements.perfectRounds >= 5,
|
||||||
|
},
|
||||||
dedication: {
|
dedication: {
|
||||||
name: "Dedicated Learner",
|
name: "Dedicated Learner",
|
||||||
description: "Answer 10 questions in total",
|
description: "Answer 10 questions in total",
|
||||||
@@ -50,6 +57,13 @@
|
|||||||
iconColor: "#fbbf24", // gold
|
iconColor: "#fbbf24", // gold
|
||||||
requirement: () => achievements.consecutive_skips >= 10,
|
requirement: () => achievements.consecutive_skips >= 10,
|
||||||
},
|
},
|
||||||
|
city_expert: {
|
||||||
|
name: "City Expert",
|
||||||
|
description: "Answer 10 capital city questions correctly",
|
||||||
|
icon: "buildings.svg",
|
||||||
|
iconColor: "#4f8cff",
|
||||||
|
requirement: () => gameStats.capitalsCorrect >= 10,
|
||||||
|
},
|
||||||
persistent: {
|
persistent: {
|
||||||
name: "Persistent Scholar",
|
name: "Persistent Scholar",
|
||||||
description: "Answer 25 questions (correct or wrong)",
|
description: "Answer 25 questions (correct or wrong)",
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
// Check if we're in game mode
|
// Check if we're in game mode
|
||||||
$: isGameMode = $location && $location.startsWith('/game');
|
$: isGameMode = $location && $location.startsWith('/game');
|
||||||
$: isQuizPage = $location && $location.startsWith('/game/flags');
|
$: isQuizPage = $location && ($location.startsWith('/game/flags') || $location.startsWith('/game/capitals'));
|
||||||
|
|
||||||
// Determine default stats view based on quiz state
|
// Determine default stats view based on quiz state
|
||||||
$: {
|
$: {
|
||||||
|
|||||||
@@ -48,6 +48,10 @@
|
|||||||
let showAchievements = false;
|
let showAchievements = false;
|
||||||
let achievementsComponent;
|
let achievementsComponent;
|
||||||
let achievementCount = { unlocked: 0, total: 0 };
|
let achievementCount = { unlocked: 0, total: 0 };
|
||||||
|
// New achievement tracking
|
||||||
|
let capitalsCorrect = 0;
|
||||||
|
let perfectRounds = 0;
|
||||||
|
let mapChallengeCompleted = false;
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
let autoAdvance = true;
|
let autoAdvance = true;
|
||||||
@@ -449,6 +453,7 @@
|
|||||||
gameStats.correct++;
|
gameStats.correct++;
|
||||||
sessionStats.correct++;
|
sessionStats.correct++;
|
||||||
currentStreak++;
|
currentStreak++;
|
||||||
|
capitalsCorrect++;
|
||||||
|
|
||||||
// Play correct sound
|
// Play correct sound
|
||||||
playCorrectSound();
|
playCorrectSound();
|
||||||
@@ -648,6 +653,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function endSession() {
|
function endSession() {
|
||||||
|
// Track perfect rounds for achievements
|
||||||
|
if (sessionStats.correct === sessionLength && sessionStats.wrong === 0 && sessionStats.skipped === 0) {
|
||||||
|
perfectRounds++;
|
||||||
|
}
|
||||||
|
|
||||||
// Clear session state
|
// Clear session state
|
||||||
sessionInProgress = false;
|
sessionInProgress = false;
|
||||||
clearSessionState();
|
clearSessionState();
|
||||||
@@ -960,6 +970,9 @@
|
|||||||
{gameStats}
|
{gameStats}
|
||||||
{currentStreak}
|
{currentStreak}
|
||||||
show={showAchievements}
|
show={showAchievements}
|
||||||
|
capitalsCorrect={capitalsCorrect}
|
||||||
|
perfectRounds={perfectRounds}
|
||||||
|
mapChallengeCompleted={mapChallengeCompleted}
|
||||||
on:close={() => (showAchievements = false)}
|
on:close={() => (showAchievements = false)}
|
||||||
on:achievementsUnlocked={handleAchievementsUnlocked}
|
on:achievementsUnlocked={handleAchievementsUnlocked}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user