From 5f979f27900ffbc617a36baca6671e082d8d25ae Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Thu, 5 Jan 2023 14:48:45 +0000 Subject: [PATCH] checkpoint: 8 --- bot/src/utils/misc.ts | 2 +- bot/src/utils/options.ts | 2 +- bot/src/webhookHandlers/goalsAchieved.ts | 2 +- bot/src/webhookHandlers/questAchieved.ts | 2 +- .../dashboard/games/_game/PlaytypeSelect.tsx | 2 +- .../dashboard/import/BatchManualPage.tsx | 2 +- .../app/pages/dashboard/utils/QuestEditor.tsx | 2 +- client/src/app/routes/GameRoutes.tsx | 4 +- client/src/app/routes/UserRoutes.tsx | 4 +- .../src/components/layout/header/AllGames.tsx | 2 +- .../components/layout/header/HeaderMenu.tsx | 2 +- .../components/layout/header/SearchBar.tsx | 4 +- .../components/targets/AddNewQuestModal.tsx | 2 +- client/src/util/asserts.ts | 2 +- client/src/util/site.ts | 2 +- common/src/config/config.test.ts | 47 +- common/src/config/game-support/bms.ts | 4 +- common/src/config/game-support/chunithm.ts | 2 +- common/src/config/game-support/gitadora.ts | 2 +- common/src/config/game-support/iidx.ts | 2 +- common/src/config/game-support/itg.ts | 2 +- common/src/config/game-support/jubeat.ts | 2 +- common/src/config/game-support/maimai-dx.ts | 2 +- common/src/config/game-support/museca.ts | 2 +- common/src/config/game-support/pms.ts | 16 +- common/src/config/game-support/popn.ts | 2 +- common/src/config/game-support/sdvx.ts | 2 +- common/src/config/game-support/usc.ts | 2 +- common/src/config/game-support/wacca.ts | 2 +- common/src/config/old-config.ts | 2146 ----------------- common/src/constants/bms-tables.test.ts | 2 +- common/src/index.test.ts | 1 - common/src/index.ts | 4 +- common/src/lib/schemas.ts | 20 +- common/src/seeds/types.ts | 41 +- common/src/types.ts | 12 +- common/src/types/documents.ts | 96 +- common/src/types/game-config.ts | 23 +- common/src/types/internals.ts | 2 +- common/src/utils/util.ts | 82 +- .../score-importing/score-import-main.ts | 2 +- .../common/batch-manual/parser.ts | 2 +- .../server/router/api/v1/activity/router.ts | 2 +- .../v1/games/_game/_playtype/middleware.ts | 4 +- .../src/utils/calculations/recalc-scores.ts | 2 +- server/src/utils/misc.ts | 2 +- 46 files changed, 239 insertions(+), 2329 deletions(-) delete mode 100644 common/src/config/old-config.ts diff --git a/bot/src/utils/misc.ts b/bot/src/utils/misc.ts index 894fe2d9c..30257be97 100644 --- a/bot/src/utils/misc.ts +++ b/bot/src/utils/misc.ts @@ -70,7 +70,7 @@ export function ParseGPT(str: string) { // this is an interesting way of game checking noah const gameConfig = GetGameConfig(game) as GameConfig | undefined; - if (!gameConfig || !gameConfig.validPlaytypes.includes(playtype)) { + if (!gameConfig || !gameConfig.playtypes.includes(playtype)) { throw new Error(`Invalid GPT Combination '${str}'.`); } diff --git a/bot/src/utils/options.ts b/bot/src/utils/options.ts index 41e42fefe..3be1a8ba2 100644 --- a/bot/src/utils/options.ts +++ b/bot/src/utils/options.ts @@ -11,7 +11,7 @@ const GPTChoices: Array<[string, string]> = []; for (const game of ServerConfig.games) { const gameConfig = GetGameConfig(game); - for (const playtype of gameConfig.validPlaytypes) { + for (const playtype of gameConfig.playtypes) { GPTChoices.push([FormatGame(game, playtype), `${game}:${playtype}`]); } } diff --git a/bot/src/webhookHandlers/goalsAchieved.ts b/bot/src/webhookHandlers/goalsAchieved.ts index d30ca4491..c2ba5202a 100644 --- a/bot/src/webhookHandlers/goalsAchieved.ts +++ b/bot/src/webhookHandlers/goalsAchieved.ts @@ -36,7 +36,7 @@ export async function HandleGoalAchievedV1( const gameConfig = GetGameConfig(game); - const shouldShowPlaytype = gameConfig.validPlaytypes.length !== 1; + const shouldShowPlaytype = gameConfig.playtypes.length !== 1; const embed = CreateEmbed(userDoc.id) .setTitle( diff --git a/bot/src/webhookHandlers/questAchieved.ts b/bot/src/webhookHandlers/questAchieved.ts index 4b6a2d841..87d66e77a 100644 --- a/bot/src/webhookHandlers/questAchieved.ts +++ b/bot/src/webhookHandlers/questAchieved.ts @@ -27,7 +27,7 @@ export async function HandleQuestAchievedV1( const quest = await GetQuestWithID(event.questID, game, playtype); const gameConfig = GetGameConfig(game); - const shouldShowPlaytype = gameConfig.validPlaytypes.length > 1 ? ` (${playtype})` : ""; + const shouldShowPlaytype = gameConfig.playtypes.length > 1 ? ` (${playtype})` : ""; const embed = CreateEmbed(userDoc.id).setTitle( `${userDoc.username} just completed the ${quest.name}${shouldShowPlaytype} quest!` diff --git a/client/src/app/pages/dashboard/games/_game/PlaytypeSelect.tsx b/client/src/app/pages/dashboard/games/_game/PlaytypeSelect.tsx index 72e6bc8e7..54ab67933 100644 --- a/client/src/app/pages/dashboard/games/_game/PlaytypeSelect.tsx +++ b/client/src/app/pages/dashboard/games/_game/PlaytypeSelect.tsx @@ -29,7 +29,7 @@ export default function PlaytypeSelect({
- {gameConfig.validPlaytypes.map((pt) => ( + {gameConfig.playtypes.map((pt) => ( { const gameConfig = GetGameConfig(parent.game as any); - if (!gameConfig.validPlaytypes.includes(self)) { + if (!gameConfig.playtypes.includes(self)) { return `Invalid playtype '${self}' for ${parent.game}`; } diff --git a/client/src/app/routes/GameRoutes.tsx b/client/src/app/routes/GameRoutes.tsx index 9783af583..007466f2c 100644 --- a/client/src/app/routes/GameRoutes.tsx +++ b/client/src/app/routes/GameRoutes.tsx @@ -59,8 +59,8 @@ export default function GameRoutes() { return ( - {gameConfig.validPlaytypes.length === 1 ? ( - + {gameConfig.playtypes.length === 1 ? ( + ) : ( - {gameConfig.validPlaytypes.length === 1 ? ( + {gameConfig.playtypes.length === 1 ? ( ) : ( { const gameConfig = GetGameConfig(game); - return gameConfig.validPlaytypes.map((playtype) => ( + return gameConfig.playtypes.map((playtype) => (