From 62e4a7ec54e4fdee78503adfd55cd44c00e3b399 Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Wed, 18 Dec 2024 12:01:19 -0800 Subject: [PATCH 1/7] [Misc] Update CREDITS.md (#5003) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add muscode and geeilhan to CREDITS.md * Sort list alphabetically * Change subcategory to "Other Code Contributors" * Add Lugiadrien and Zé Ricardo Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> --------- Co-authored-by: Moka <54149968+MokaStitcher@users.noreply.github.com> --- CREDITS.md | 98 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 51 insertions(+), 47 deletions(-) diff --git a/CREDITS.md b/CREDITS.md index cded7ea90a2..fd9a3d7bde3 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -372,63 +372,67 @@ In addition to the lists below, please check [the PokéRogue wiki](https://wiki. - Lily - PigeonBar -## Past Contributors -- Fontbane -- sodaMelon -- schmidtc1 -- shayebeadling +## Other Code Contributors +- Admiral-Billy +- allen925 +- arColm +- Arxalc +- AsdarDevelops +- bennybroseph +- Brain Frog +- Corrade +- Dakurei - DustinLin -- lucfd -- madibye +- ElizaAlex - EmberCM -- Mewtwo2387 +- EmoUsedHM01 +- EvasiveAce +- Fontbane +- francktrouillez +- FredeX +- geeilhan +- Greenlamp +- happinyz - hayuna -- sirzento -- ReneGV -- mattrossdev -- zacharied -- NxKarim -- td76099 -- Xiaphear +- InfernoVulpix - j-diefenbach - jaimefd -- EvasiveAce -- EmoUsedHM01 -- francktrouillez - JakubHanko -- FredeX -- PigeonBar -- prime-dialga -- rnicar245 -- rationality6 -- Neverblade -- Corrade -- Admiral-Billy -- okimin -- Arxalc -- PrabbyDD - JonStudders - karl-police -- prateau -- meepen -- arColm -- allen925 -- InfernoVulpix -- snoozbuster -- zaccie -- happinyz -- PyGaVS +- lucfd +- Lugiadrien +- madibye +- mattrossdev - mcmontag -- ElizaAlex -- AsdarDevelops -- Vassiat -- RedstonewolfX -- Sam/Flashfyre (initial developer, started PokéRogue) -- Greenlamp -- bennybroseph +- meepen +- Mewtwo2387 +- muscode +- Neverblade +- NxKarim +- okimin - OrangeRed -- Dakurei -- Brain Frog +- PigeonBar +- PrabbyDD +- prateau +- prime-dialga +- PyGaVS +- rationality6 +- RedstonewolfX +- ReneGV +- rnicar245 +- Sam aka Flashfyre (initial developer, started PokéRogue) +- schmidtc1 +- shayebeadling +- sirzento +- snoozbuster +- sodaMelon +- td76099 +- Vassiat +- Xiaphear +- zaccie +- zacharied +- Zé Ricardo # 🌎 Translation From 708e58d0839b0debd4f26ff04bfe62a1d3ab4e87 Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Thu, 19 Dec 2024 11:44:24 -0800 Subject: [PATCH 2/7] [i18n] Update locales submodule --- public/locales | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/locales b/public/locales index 1dc4d5dd238..6592ec05fce 160000 --- a/public/locales +++ b/public/locales @@ -1 +1 @@ -Subproject commit 1dc4d5dd238db8bbf64535c3274056abd199d404 +Subproject commit 6592ec05fce7035ee93aad253279e97ab6cdc1ab From 806585f1a69a8059444c00aa87ca5ecedc71cf9b Mon Sep 17 00:00:00 2001 From: AJ Fontaine <36677462+Fontbane@users.noreply.github.com> Date: Thu, 19 Dec 2024 15:01:40 -0500 Subject: [PATCH 3/7] [UI/UX] Refactor and enable seasonal splash messages (#5009) * Refactor and enable seasonal splash texts * Update splash text test --- src/constants.ts | 2 +- src/data/splash-messages.ts | 180 +++++--------------------- src/test/data/splash_messages.test.ts | 18 +-- src/ui/title-ui-handler.ts | 3 +- 4 files changed, 42 insertions(+), 161 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index 63f00b9f33f..927575c0a28 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -2,7 +2,7 @@ export const PLAYER_PARTY_MAX_SIZE: number = 6; /** Whether to use seasonal splash messages in general */ -export const USE_SEASONAL_SPLASH_MESSAGES: boolean = false; +export const USE_SEASONAL_SPLASH_MESSAGES: boolean = true; /** Name of the session ID cookie */ export const SESSION_ID_COOKIE_NAME: string = "pokerogue_sessionId"; diff --git a/src/data/splash-messages.ts b/src/data/splash-messages.ts index 1f00ce0d555..086a55189d0 100644 --- a/src/data/splash-messages.ts +++ b/src/data/splash-messages.ts @@ -1,4 +1,5 @@ import { USE_SEASONAL_SPLASH_MESSAGES } from "#app/constants"; +import i18next from "i18next"; //#region Interfaces/Types @@ -37,8 +38,6 @@ interface Season { start: `${Month}-${Day}`; /** The end day and month of the season. Format `MM-DD` */ end: `${Month}-${Day}`; - /** Collection of the messages to display (without the `i18next.t()` call!) */ - messages: string[]; } //#region Constants @@ -46,176 +45,57 @@ interface Season { /** The weight multiplier for the battles-won splash message */ const BATTLES_WON_WEIGHT_MULTIPLIER = 10; /** The weight multiplier for the seasonal splash messages */ -const SEASONAL_WEIGHT_MULTIPLIER = 10; - -//#region Common Messages - -const commonSplashMessages = [ - ...Array(BATTLES_WON_WEIGHT_MULTIPLIER).fill("battlesWon"), - "joinTheDiscord", - "infiniteLevels", - "everythingIsStackable", - "optionalSaveScumming", - "biomes", - "openSource", - "playWithSpeed", - "liveBugTesting", - "heavyInfluence", - "pokemonRiskAndPokemonRain", - "nowWithMoreSalt", - "infiniteFusionAtHome", - "brokenEggMoves", - "magnificent", - "doPeopleReadThis", - "thatsCrazy", - "gottaCatchEmAll", - "questionableBalancing", - "coolShaders", - "aiFree", - "suddenDifficultySpikes", - "basedOnAnUnfinishedFlashGame", - "moreAddictiveThanIntended", - "mostlyConsistentSeeds", - "achievementPointsDontDoAnything", - "nothingBeatsAJellyFilledDonut", - "dontTalkAboutTheTinkatonIncident", - "alsoTryPokengine", - "alsoTryEmeraldRogue", - "alsoTryRadicalRed", - "eeveeExpo", - "checkOutYnoproject", - "breedersInSpace", - "alsoTryPokemonUnbound", - "tryTheJohtoDragonChallenge", - "basicReadingAbilityRecommended", - "shoutoutsToTheArtists", - "gamblingNotEncouraged", - "dontForgetToTakeABreak", - "wEvent", - "ifItsNotAccurateItsAccurate", - "everyLossIsProgressMade", - "liveWoChienReaction", - "itsAFeatureNotABug", - "theEggsAreNotForEating", - "7.8outOf10TooManyWaterBiomes", - "butNothingHappened", - "thePowerOfScienceIsAmazing", - "freeToPlay", - "theresATimeAndPlaceForEverything", - "nowWithShinierShinies", - "smilesGoForMiles", - "certainlyNotDragonFree", - "haveANiceDay", - "redacted", - "hi", - "transRights", - "shinyOddsHigherThanYouThink", - "noFalseTrades", - "notForProfit", - "timeForYourDailyRun", - "moreEggsThanADaycare", - "disclaimerHarshSunDoesNotGiveVitaminD", - "whoNeedsAMap", - "luxrayIsNotADarkType", - "selfDestructiveEncounters", - "mostOptionsAreViable", - "pokerogueMorse", - "smiley", - "beAwareOfPassives", - "asSeenOnTheWorldWideWeb", - "vaultinVeluzas", - "tooManyStarters", - "checkTheWiki", - "winWithYourFavorites", - "alsoTryPokerogueWait", - "theWayISeeItKyogreIsSurrounded", - "tryOutHoneyGather", - "notForTheFaintOfHeart", - "p", - "flipYourDeviceToEvolveInkay", - "inArceusWeTrust", - "whyDidTheTorchicCrossTheRoad", - "goodLuck", - "fuseWisely", - "compensation", - "prepareForTroubleAndMakeItDouble", - "anEggForYourTroubles", - "regirock", - "hereForAGoodTime", - "getGoodOrDont", - "checkTheSubreddit", - "betterNerfGreninja", - "inCaseOfUpdateClearYourCache", - "insertTextHere", - "endingEndlessNotFound", - "iLikeMyEggsVouchered", - "YOU", - "noAddedSugar", - "notSponsored", - "notRated", - "justOneMoreWaveMom", - "saltCured", - "onlyOnPokerogueNet", - "pixelPerfection", - "openSource", - "probablyGood", - "itsAMonsterHouse", - "dontForgetYourPassword", - "tripleTripleTripleAxel", - "questionExclamation", - "clownEncounters", - "fullOfBerries", - "limitsAreMeantToBeBrokenSometimes", - "keepItCasual", - "serversProbablyWorking", - "mew", - "makeItRainAndYourProblemsGoAway", - "customMusicTracks", - "youAreValid", - "number591IsLookingOff", - "timeForYourDeliDelivery", - "goodFirstImpression", - "iPreferRarerCandies", -]; +const SEASONAL_WEIGHT_MULTIPLIER = 20; //#region Seasonal Messages const seasonalSplashMessages: Season[] = [ { - name: "Halloween", - start: "09-15", - end: "10-31", - messages: [ "halloween.pumpkabooAbout", "halloween.mayContainSpiders", "halloween.spookyScarySkeledirge", "halloween.gourgeistUsedTrickOrTreat", "halloween.letsSnuggleForever" ], + name: "halloween", + start: "10-15", + end: "10-31" }, { - name: "XMAS", - start: "12-01", - end: "12-26", - messages: [ "xmas.happyHolidays", "xmas.unaffilicatedWithDelibirdServices", "xmas.delibirdSeason", "xmas.diamondsFromTheSky", "xmas.holidayStylePikachuNotIncluded" ], + name: "xmas", + start: "12-16", + end: "12-31" }, { - name: "New Year's", - start: "01-01", - end: "01-31", - messages: [ "newYears.happyNewYear" ], + name: "newYears", + start: "12-31", + end: "01-14" }, ]; //#endregion export function getSplashMessages(): string[] { - const splashMessages: string[] = [ ...commonSplashMessages ]; + const existingKeys = i18next.getResourceBundle(i18next.language, "splashMessages"); + const splashMessages: string[] = [ ...Object.keys(existingKeys["common"]) ].map((message) => `common.${message}`); + if (splashMessages.includes("common.battlesWon")) { + splashMessages.push(...Array(Math.max(BATTLES_WON_WEIGHT_MULTIPLIER - 1, 1)).fill("common.battlesWon")); + } + console.log("use seasonal splash messages", USE_SEASONAL_SPLASH_MESSAGES); if (USE_SEASONAL_SPLASH_MESSAGES) { // add seasonal splash messages if the season is active - for (const { name, start, end, messages } of seasonalSplashMessages) { + for (const { name, start, end } of seasonalSplashMessages) { const now = new Date(); const startDate = new Date(`${start}-${now.getFullYear()}`); const endDate = new Date(`${end}-${now.getFullYear()}`); + if (endDate < startDate) { // If the end date is earlier in the year, that means it's next year + if (now >= startDate) { + endDate.setFullYear(endDate.getFullYear() + 1); //Ends next year + } else if (now <= endDate) { + startDate.setFullYear(startDate.getFullYear() - 1); //Started last year + } + } + console.log(`${name} event starts ${startDate} and ends ${endDate}`); - if (now >= startDate && now <= endDate) { - console.log(`Adding ${messages.length} ${name} splash messages (weight: x${SEASONAL_WEIGHT_MULTIPLIER})`); - messages.forEach((message) => { + if (existingKeys.hasOwnProperty(name) && now >= startDate && now <= endDate) { + const existingMessages: string[] = [ ...Object.keys(existingKeys[name]) ].map(m=>`${name}.${m}`); + console.log(`Adding ${existingMessages.length} ${name} splash messages from ${i18next.language} (weight: x${SEASONAL_WEIGHT_MULTIPLIER})`); + existingMessages.forEach((message) => { const weightedMessage = Array(SEASONAL_WEIGHT_MULTIPLIER).fill(message); splashMessages.push(...weightedMessage); }); diff --git a/src/test/data/splash_messages.test.ts b/src/test/data/splash_messages.test.ts index b9ed5b9d365..e4ad547b704 100644 --- a/src/test/data/splash_messages.test.ts +++ b/src/test/data/splash_messages.test.ts @@ -9,7 +9,7 @@ describe("Data - Splash Messages", () => { // make sure to adjust this test if the weight it changed! it("should add contain 10 `battlesWon` splash messages", () => { - const battlesWonMessages = getSplashMessages().filter((message) => message === "splashMessages:battlesWon"); + const battlesWonMessages = getSplashMessages().filter((message) => message === "splashMessages:common.battlesWon"); expect(battlesWonMessages).toHaveLength(10); }); @@ -22,16 +22,16 @@ describe("Data - Splash Messages", () => { vi.useRealTimers(); // reset system time }); - it("should contain halloween messages from Sep 15 to Oct 31", () => { - testSeason(new Date("2024-09-15"), new Date("2024-10-31"), "halloween"); + it("should contain halloween messages from Oct 15 to Oct 31", () => { + testSeason(new Date("2024-10-15"), new Date("2024-10-31"), "halloween"); }); - it("should contain xmas messages from Dec 1 to Dec 26", () => { - testSeason(new Date("2024-12-01"), new Date("2024-12-26"), "xmas"); + it("should contain xmas messages from Dec 16 to Dec 31", () => { + testSeason(new Date("2024-12-16"), new Date("2024-12-31"), "xmas"); }); - it("should contain new years messages frm Jan 1 to Jan 31", () => { - testSeason(new Date("2024-01-01"), new Date("2024-01-31"), "newYears"); + it("should contain new years messages from Dec 31 '24 to Jan 14 '25", () => { + testSeason(new Date("2024-12-31"), new Date("2025-01-14"), "newYears"); }); }); }); @@ -60,7 +60,7 @@ function testSeason(startDate: Date, endDate: Date, prefix: string) { }); expect(before).toBe(0); - expect(start).toBeGreaterThanOrEqual(10); // make sure to adjust if weight is changed! - expect(end).toBeGreaterThanOrEqual(10); // make sure to adjust if weight is changed! + expect(start).toBeGreaterThanOrEqual(20); // make sure to adjust if weight is changed! + expect(end).toBeGreaterThanOrEqual(20); // make sure to adjust if weight is changed! expect(after).toBe(0); } diff --git a/src/ui/title-ui-handler.ts b/src/ui/title-ui-handler.ts index aec80f049c9..f1b0a673ea0 100644 --- a/src/ui/title-ui-handler.ts +++ b/src/ui/title-ui-handler.ts @@ -83,7 +83,7 @@ export default class TitleUiHandler extends OptionSelectUiHandler { .then(stats => { if (stats) { this.playerCountLabel.setText(`${stats.playerCount} ${i18next.t("menu:playersOnline")}`); - if (this.splashMessage === "splashMessages:battlesWon") { + if (this.splashMessage === "splashMessages:common.battlesWon") { this.splashMessageText.setText(i18next.t(this.splashMessage, { count: stats.battleCount })); } } @@ -98,6 +98,7 @@ export default class TitleUiHandler extends OptionSelectUiHandler { if (ret) { this.splashMessage = Utils.randItem(getSplashMessages()); + console.log(this.splashMessage); this.splashMessageText.setText(i18next.t(this.splashMessage, { count: TitleUiHandler.BATTLES_WON_FALLBACK })); this.appVersionText.setText("v" + version); From 29a079cfd3f188c3975ab0eff1ae9f73e44e139d Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Thu, 19 Dec 2024 16:04:12 -0800 Subject: [PATCH 4/7] Revert "[UI/UX] Refactor and enable seasonal splash messages (#5009)" (#5014) This reverts commit 806585f1a69a8059444c00aa87ca5ecedc71cf9b. --- src/constants.ts | 2 +- src/data/splash-messages.ts | 180 +++++++++++++++++++++----- src/test/data/splash_messages.test.ts | 18 +-- src/ui/title-ui-handler.ts | 3 +- 4 files changed, 161 insertions(+), 42 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index 927575c0a28..63f00b9f33f 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -2,7 +2,7 @@ export const PLAYER_PARTY_MAX_SIZE: number = 6; /** Whether to use seasonal splash messages in general */ -export const USE_SEASONAL_SPLASH_MESSAGES: boolean = true; +export const USE_SEASONAL_SPLASH_MESSAGES: boolean = false; /** Name of the session ID cookie */ export const SESSION_ID_COOKIE_NAME: string = "pokerogue_sessionId"; diff --git a/src/data/splash-messages.ts b/src/data/splash-messages.ts index 086a55189d0..1f00ce0d555 100644 --- a/src/data/splash-messages.ts +++ b/src/data/splash-messages.ts @@ -1,5 +1,4 @@ import { USE_SEASONAL_SPLASH_MESSAGES } from "#app/constants"; -import i18next from "i18next"; //#region Interfaces/Types @@ -38,6 +37,8 @@ interface Season { start: `${Month}-${Day}`; /** The end day and month of the season. Format `MM-DD` */ end: `${Month}-${Day}`; + /** Collection of the messages to display (without the `i18next.t()` call!) */ + messages: string[]; } //#region Constants @@ -45,57 +46,176 @@ interface Season { /** The weight multiplier for the battles-won splash message */ const BATTLES_WON_WEIGHT_MULTIPLIER = 10; /** The weight multiplier for the seasonal splash messages */ -const SEASONAL_WEIGHT_MULTIPLIER = 20; +const SEASONAL_WEIGHT_MULTIPLIER = 10; + +//#region Common Messages + +const commonSplashMessages = [ + ...Array(BATTLES_WON_WEIGHT_MULTIPLIER).fill("battlesWon"), + "joinTheDiscord", + "infiniteLevels", + "everythingIsStackable", + "optionalSaveScumming", + "biomes", + "openSource", + "playWithSpeed", + "liveBugTesting", + "heavyInfluence", + "pokemonRiskAndPokemonRain", + "nowWithMoreSalt", + "infiniteFusionAtHome", + "brokenEggMoves", + "magnificent", + "doPeopleReadThis", + "thatsCrazy", + "gottaCatchEmAll", + "questionableBalancing", + "coolShaders", + "aiFree", + "suddenDifficultySpikes", + "basedOnAnUnfinishedFlashGame", + "moreAddictiveThanIntended", + "mostlyConsistentSeeds", + "achievementPointsDontDoAnything", + "nothingBeatsAJellyFilledDonut", + "dontTalkAboutTheTinkatonIncident", + "alsoTryPokengine", + "alsoTryEmeraldRogue", + "alsoTryRadicalRed", + "eeveeExpo", + "checkOutYnoproject", + "breedersInSpace", + "alsoTryPokemonUnbound", + "tryTheJohtoDragonChallenge", + "basicReadingAbilityRecommended", + "shoutoutsToTheArtists", + "gamblingNotEncouraged", + "dontForgetToTakeABreak", + "wEvent", + "ifItsNotAccurateItsAccurate", + "everyLossIsProgressMade", + "liveWoChienReaction", + "itsAFeatureNotABug", + "theEggsAreNotForEating", + "7.8outOf10TooManyWaterBiomes", + "butNothingHappened", + "thePowerOfScienceIsAmazing", + "freeToPlay", + "theresATimeAndPlaceForEverything", + "nowWithShinierShinies", + "smilesGoForMiles", + "certainlyNotDragonFree", + "haveANiceDay", + "redacted", + "hi", + "transRights", + "shinyOddsHigherThanYouThink", + "noFalseTrades", + "notForProfit", + "timeForYourDailyRun", + "moreEggsThanADaycare", + "disclaimerHarshSunDoesNotGiveVitaminD", + "whoNeedsAMap", + "luxrayIsNotADarkType", + "selfDestructiveEncounters", + "mostOptionsAreViable", + "pokerogueMorse", + "smiley", + "beAwareOfPassives", + "asSeenOnTheWorldWideWeb", + "vaultinVeluzas", + "tooManyStarters", + "checkTheWiki", + "winWithYourFavorites", + "alsoTryPokerogueWait", + "theWayISeeItKyogreIsSurrounded", + "tryOutHoneyGather", + "notForTheFaintOfHeart", + "p", + "flipYourDeviceToEvolveInkay", + "inArceusWeTrust", + "whyDidTheTorchicCrossTheRoad", + "goodLuck", + "fuseWisely", + "compensation", + "prepareForTroubleAndMakeItDouble", + "anEggForYourTroubles", + "regirock", + "hereForAGoodTime", + "getGoodOrDont", + "checkTheSubreddit", + "betterNerfGreninja", + "inCaseOfUpdateClearYourCache", + "insertTextHere", + "endingEndlessNotFound", + "iLikeMyEggsVouchered", + "YOU", + "noAddedSugar", + "notSponsored", + "notRated", + "justOneMoreWaveMom", + "saltCured", + "onlyOnPokerogueNet", + "pixelPerfection", + "openSource", + "probablyGood", + "itsAMonsterHouse", + "dontForgetYourPassword", + "tripleTripleTripleAxel", + "questionExclamation", + "clownEncounters", + "fullOfBerries", + "limitsAreMeantToBeBrokenSometimes", + "keepItCasual", + "serversProbablyWorking", + "mew", + "makeItRainAndYourProblemsGoAway", + "customMusicTracks", + "youAreValid", + "number591IsLookingOff", + "timeForYourDeliDelivery", + "goodFirstImpression", + "iPreferRarerCandies", +]; //#region Seasonal Messages const seasonalSplashMessages: Season[] = [ { - name: "halloween", - start: "10-15", - end: "10-31" + name: "Halloween", + start: "09-15", + end: "10-31", + messages: [ "halloween.pumpkabooAbout", "halloween.mayContainSpiders", "halloween.spookyScarySkeledirge", "halloween.gourgeistUsedTrickOrTreat", "halloween.letsSnuggleForever" ], }, { - name: "xmas", - start: "12-16", - end: "12-31" + name: "XMAS", + start: "12-01", + end: "12-26", + messages: [ "xmas.happyHolidays", "xmas.unaffilicatedWithDelibirdServices", "xmas.delibirdSeason", "xmas.diamondsFromTheSky", "xmas.holidayStylePikachuNotIncluded" ], }, { - name: "newYears", - start: "12-31", - end: "01-14" + name: "New Year's", + start: "01-01", + end: "01-31", + messages: [ "newYears.happyNewYear" ], }, ]; //#endregion export function getSplashMessages(): string[] { - const existingKeys = i18next.getResourceBundle(i18next.language, "splashMessages"); - const splashMessages: string[] = [ ...Object.keys(existingKeys["common"]) ].map((message) => `common.${message}`); - if (splashMessages.includes("common.battlesWon")) { - splashMessages.push(...Array(Math.max(BATTLES_WON_WEIGHT_MULTIPLIER - 1, 1)).fill("common.battlesWon")); - } - + const splashMessages: string[] = [ ...commonSplashMessages ]; console.log("use seasonal splash messages", USE_SEASONAL_SPLASH_MESSAGES); if (USE_SEASONAL_SPLASH_MESSAGES) { // add seasonal splash messages if the season is active - for (const { name, start, end } of seasonalSplashMessages) { + for (const { name, start, end, messages } of seasonalSplashMessages) { const now = new Date(); const startDate = new Date(`${start}-${now.getFullYear()}`); const endDate = new Date(`${end}-${now.getFullYear()}`); - if (endDate < startDate) { // If the end date is earlier in the year, that means it's next year - if (now >= startDate) { - endDate.setFullYear(endDate.getFullYear() + 1); //Ends next year - } else if (now <= endDate) { - startDate.setFullYear(startDate.getFullYear() - 1); //Started last year - } - } - console.log(`${name} event starts ${startDate} and ends ${endDate}`); - if (existingKeys.hasOwnProperty(name) && now >= startDate && now <= endDate) { - const existingMessages: string[] = [ ...Object.keys(existingKeys[name]) ].map(m=>`${name}.${m}`); - console.log(`Adding ${existingMessages.length} ${name} splash messages from ${i18next.language} (weight: x${SEASONAL_WEIGHT_MULTIPLIER})`); - existingMessages.forEach((message) => { + if (now >= startDate && now <= endDate) { + console.log(`Adding ${messages.length} ${name} splash messages (weight: x${SEASONAL_WEIGHT_MULTIPLIER})`); + messages.forEach((message) => { const weightedMessage = Array(SEASONAL_WEIGHT_MULTIPLIER).fill(message); splashMessages.push(...weightedMessage); }); diff --git a/src/test/data/splash_messages.test.ts b/src/test/data/splash_messages.test.ts index e4ad547b704..b9ed5b9d365 100644 --- a/src/test/data/splash_messages.test.ts +++ b/src/test/data/splash_messages.test.ts @@ -9,7 +9,7 @@ describe("Data - Splash Messages", () => { // make sure to adjust this test if the weight it changed! it("should add contain 10 `battlesWon` splash messages", () => { - const battlesWonMessages = getSplashMessages().filter((message) => message === "splashMessages:common.battlesWon"); + const battlesWonMessages = getSplashMessages().filter((message) => message === "splashMessages:battlesWon"); expect(battlesWonMessages).toHaveLength(10); }); @@ -22,16 +22,16 @@ describe("Data - Splash Messages", () => { vi.useRealTimers(); // reset system time }); - it("should contain halloween messages from Oct 15 to Oct 31", () => { - testSeason(new Date("2024-10-15"), new Date("2024-10-31"), "halloween"); + it("should contain halloween messages from Sep 15 to Oct 31", () => { + testSeason(new Date("2024-09-15"), new Date("2024-10-31"), "halloween"); }); - it("should contain xmas messages from Dec 16 to Dec 31", () => { - testSeason(new Date("2024-12-16"), new Date("2024-12-31"), "xmas"); + it("should contain xmas messages from Dec 1 to Dec 26", () => { + testSeason(new Date("2024-12-01"), new Date("2024-12-26"), "xmas"); }); - it("should contain new years messages from Dec 31 '24 to Jan 14 '25", () => { - testSeason(new Date("2024-12-31"), new Date("2025-01-14"), "newYears"); + it("should contain new years messages frm Jan 1 to Jan 31", () => { + testSeason(new Date("2024-01-01"), new Date("2024-01-31"), "newYears"); }); }); }); @@ -60,7 +60,7 @@ function testSeason(startDate: Date, endDate: Date, prefix: string) { }); expect(before).toBe(0); - expect(start).toBeGreaterThanOrEqual(20); // make sure to adjust if weight is changed! - expect(end).toBeGreaterThanOrEqual(20); // make sure to adjust if weight is changed! + expect(start).toBeGreaterThanOrEqual(10); // make sure to adjust if weight is changed! + expect(end).toBeGreaterThanOrEqual(10); // make sure to adjust if weight is changed! expect(after).toBe(0); } diff --git a/src/ui/title-ui-handler.ts b/src/ui/title-ui-handler.ts index f1b0a673ea0..aec80f049c9 100644 --- a/src/ui/title-ui-handler.ts +++ b/src/ui/title-ui-handler.ts @@ -83,7 +83,7 @@ export default class TitleUiHandler extends OptionSelectUiHandler { .then(stats => { if (stats) { this.playerCountLabel.setText(`${stats.playerCount} ${i18next.t("menu:playersOnline")}`); - if (this.splashMessage === "splashMessages:common.battlesWon") { + if (this.splashMessage === "splashMessages:battlesWon") { this.splashMessageText.setText(i18next.t(this.splashMessage, { count: stats.battleCount })); } } @@ -98,7 +98,6 @@ export default class TitleUiHandler extends OptionSelectUiHandler { if (ret) { this.splashMessage = Utils.randItem(getSplashMessages()); - console.log(this.splashMessage); this.splashMessageText.setText(i18next.t(this.splashMessage, { count: TitleUiHandler.BATTLES_WON_FALLBACK })); this.appVersionText.setText("v" + version); From 6ef15eca4a01d5669aee411b594129c6e6c7796a Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Thu, 19 Dec 2024 16:18:32 -0800 Subject: [PATCH 5/7] [i18n] Update locales submodule --- public/locales | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/locales b/public/locales index 6592ec05fce..3a141b9faed 160000 --- a/public/locales +++ b/public/locales @@ -1 +1 @@ -Subproject commit 6592ec05fce7035ee93aad253279e97ab6cdc1ab +Subproject commit 3a141b9faed725d2f160c38e441cad1d38d9d5bd From 0022972be919bc502b4a0dc00b12e20fb4d22049 Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:24:09 -0800 Subject: [PATCH 6/7] [i18n] Update locales submodule --- public/locales | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/locales b/public/locales index 3a141b9faed..6c6f0af398a 160000 --- a/public/locales +++ b/public/locales @@ -1 +1 @@ -Subproject commit 3a141b9faed725d2f160c38e441cad1d38d9d5bd +Subproject commit 6c6f0af398ae11f8d96c6ac064f171d927812c85 From ba285110467e7f7ee1e2015db2adf0e46efaca3a Mon Sep 17 00:00:00 2001 From: NightKev <34855794+DayKev@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:25:34 -0800 Subject: [PATCH 7/7] Bump version number to 1.4.0 (#5013) --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index a4568b3f5ac..ca6041e7048 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pokemon-rogue-battle", - "version": "1.3.0", + "version": "1.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "pokemon-rogue-battle", - "version": "1.3.0", + "version": "1.4.0", "hasInstallScript": true, "dependencies": { "@material/material-color-utilities": "^0.2.7", diff --git a/package.json b/package.json index a8641bb0b98..fd756fd3937 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "pokemon-rogue-battle", "private": true, - "version": "1.3.0", + "version": "1.4.0", "type": "module", "scripts": { "start": "vite",