simplify worldState logic

This commit is contained in:
Sainan 2025-10-08 08:34:34 +02:00
parent e9e8eea801
commit 8d4abe863c
2 changed files with 13 additions and 18 deletions

View File

@ -113,8 +113,8 @@ const sortieBossNode: Record<Exclude<TSortieBoss, "SORTIE_BOSS_CORRUPTED_VOR">,
SORTIE_BOSS_VOR: "SolNode108" SORTIE_BOSS_VOR: "SolNode108"
}; };
const voidCorruptionAlerts = [ const configAlerts: Record<string, IAlert> = {
{ voidCorruptionWeek1: {
_id: { $oid: "677d452e2f324ee7b90f8ccf" }, _id: { $oid: "677d452e2f324ee7b90f8ccf" },
Activation: { $date: { $numberLong: "1736524800000" } }, Activation: { $date: { $numberLong: "1736524800000" } },
Expiry: { $date: { $numberLong: "2000000000000" } }, Expiry: { $date: { $numberLong: "2000000000000" } },
@ -134,7 +134,7 @@ const voidCorruptionAlerts = [
maxEnemyLevel: 15 maxEnemyLevel: 15
} }
}, },
{ voidCorruptionWeek2: {
_id: { $oid: "677d45811daeae9de40e8c0f" }, _id: { $oid: "677d45811daeae9de40e8c0f" },
Activation: { $date: { $numberLong: "1737129600000" } }, Activation: { $date: { $numberLong: "1737129600000" } },
Expiry: { $date: { $numberLong: "2000000000000" } }, Expiry: { $date: { $numberLong: "2000000000000" } },
@ -154,7 +154,7 @@ const voidCorruptionAlerts = [
maxWaveNum: 6 maxWaveNum: 6
} }
}, },
{ voidCorruptionWeek3: {
_id: { $oid: "677d45a494ad716c90006b9a" }, _id: { $oid: "677d45a494ad716c90006b9a" },
Activation: { $date: { $numberLong: "1737734400000" } }, Activation: { $date: { $numberLong: "1737734400000" } },
Expiry: { $date: { $numberLong: "2000000000000" } }, Expiry: { $date: { $numberLong: "2000000000000" } },
@ -175,7 +175,7 @@ const voidCorruptionAlerts = [
maxEnemyLevel: 35 maxEnemyLevel: 35
} }
}, },
{ voidCorruptionWeek4: {
_id: { $oid: "677d4700682d173abb0e19fe" }, _id: { $oid: "677d4700682d173abb0e19fe" },
Activation: { $date: { $numberLong: "1738339200000" } }, Activation: { $date: { $numberLong: "1738339200000" } },
Expiry: { $date: { $numberLong: "2000000000000" } }, Expiry: { $date: { $numberLong: "2000000000000" } },
@ -194,7 +194,7 @@ const voidCorruptionAlerts = [
maxEnemyLevel: 45 maxEnemyLevel: 45
} }
} }
] satisfies readonly IAlert[]; };
const eidolonJobs: readonly string[] = [ const eidolonJobs: readonly string[] = [
"/Lotus/Types/Gameplay/Eidolon/Jobs/AssassinateBountyAss", "/Lotus/Types/Gameplay/Eidolon/Jobs/AssassinateBountyAss",
@ -1566,17 +1566,12 @@ export const getWorldState = (buildLabel?: string): IWorldState => {
fullyStockBaro(vt); fullyStockBaro(vt);
} }
const vcWeeks = [ if (config.worldState) {
["voidCorruptionWeek1", 0], for (const [key, alert] of Object.entries(configAlerts)) {
["voidCorruptionWeek2", 1], if (config.worldState[key as keyof typeof config.worldState]) {
["voidCorruptionWeek3", 2], worldState.Alerts.push(alert);
["voidCorruptionWeek4", 3] }
] as const; }
const selected = vcWeeks.filter(([flag]) => config.worldState?.[flag]).map(([, idx]) => voidCorruptionAlerts[idx]);
if (selected.length) {
worldState.Alerts = [...worldState.Alerts, ...selected];
} }
const isFebruary = date.getUTCMonth() == 1; const isFebruary = date.getUTCMonth() == 1;

View File

@ -7,7 +7,7 @@ export interface IWorldState {
Time: number; Time: number;
InGameMarket: IInGameMarket; InGameMarket: IInGameMarket;
Goals: IGoal[]; Goals: IGoal[];
Alerts: readonly IAlert[]; Alerts: IAlert[];
Sorties: ISortie[]; Sorties: ISortie[];
LiteSorties: ILiteSortie[]; LiteSorties: ILiteSortie[];
SyndicateMissions: ISyndicateMissionInfo[]; SyndicateMissions: ISyndicateMissionInfo[];