Apply prettier changes

This commit is contained in:
AMelonInsideLemon 2024-06-25 23:29:45 +00:00 committed by AMelonInsideLemon
parent 54e2a47bdf
commit d5a7857649
2 changed files with 1096 additions and 3778 deletions

File diff suppressed because it is too large Load Diff

View File

@ -470,10 +470,7 @@ const updateVoidFisures = async () => {
const getRandomFisureNode = (isRailJack: boolean, isOmnia: boolean) => { const getRandomFisureNode = (isRailJack: boolean, isOmnia: boolean) => {
const validNodes = Object.entries(ExportRegions) const validNodes = Object.entries(ExportRegions)
.map(([key, node]) => ({ ...node, nodeKey: key })) .map(([key, node]) => ({ ...node, nodeKey: key }))
.filter(node => .filter(node => validFisureMissionIndex.includes(node.missionIndex) && !node.missionName.includes("Archwing"));
validFisureMissionIndex.includes(node.missionIndex) &&
!node.missionName.includes("Archwing")
);
if (isRailJack) { if (isRailJack) {
const railJackNodes = Object.keys(ExportRailjack.nodes); const railJackNodes = Object.keys(ExportRailjack.nodes);
@ -542,13 +539,11 @@ const updateSorties = async () => {
}); });
const filteredLiteSortiesNodes = liteSortiesMissionIndex.map(missionIndexArray => const filteredLiteSortiesNodes = liteSortiesMissionIndex.map(missionIndexArray =>
liteSortiesSystemIndex.filter(node => liteSortiesSystemIndex.filter(node => missionIndexArray.includes(node.missionIndex))
missionIndexArray.includes(node.missionIndex)
)
); );
const selectedLiteSortiesNodes = filteredLiteSortiesNodes.map(filteredNodes => const selectedLiteSortiesNodes = filteredLiteSortiesNodes.map(
filteredNodes[Math.floor(Math.random() * filteredNodes.length)] filteredNodes => filteredNodes[Math.floor(Math.random() * filteredNodes.length)]
); );
const sortie = { const sortie = {
@ -570,9 +565,10 @@ const updateSorties = async () => {
const randomState = endStates[Math.floor(Math.random() * endStates.length)]; const randomState = endStates[Math.floor(Math.random() * endStates.length)];
const selectedSortieNodes = Array.from({ length: 3 }, () => { const selectedSortieNodes = Array.from({ length: 3 }, () => {
const randomIndex = Math.floor(Math.random() * randomState.regions.length); const randomIndex = Math.floor(Math.random() * randomState.regions.length);
const filteredNodes = nodes.filter(node => const filteredNodes = nodes.filter(
randomState.regions[randomIndex].systemIndex === node.systemIndex && node =>
randomState.regions[randomIndex].missionIndex.includes(node.missionIndex) randomState.regions[randomIndex].systemIndex === node.systemIndex &&
randomState.regions[randomIndex].missionIndex.includes(node.missionIndex)
); );
return filteredNodes[Math.floor(Math.random() * filteredNodes.length)]; return filteredNodes[Math.floor(Math.random() * filteredNodes.length)];
}); });
@ -606,12 +602,12 @@ const updateCircuit = async () => {
try { try {
const ws = await WorldState.findOne(); const ws = await WorldState.findOne();
if (!ws) throw new Error("Missing worldState"); if (!ws) throw new Error("Missing worldState");
const curWeek = Math.floor(Date.now()/(7*unixTimesInMs.day)); const curWeek = Math.floor(Date.now() / (7 * unixTimesInMs.day));
const normalIndex = curWeek % 11; const normalIndex = curWeek % 11;
const hardIndex = curWeek % 7; const hardIndex = curWeek % 7;
ws.EndlessXpChoices = [ ws.EndlessXpChoices = [
{ "Category": "EXC_NORMAL", "Choices": normalCircutRotations[normalIndex] }, { Category: "EXC_NORMAL", Choices: normalCircutRotations[normalIndex] },
{ "Category": "EXC_HARD", "Choices": hardCircutRotations[hardIndex] } { Category: "EXC_HARD", Choices: hardCircutRotations[hardIndex] }
]; ];
await ws.save(); await ws.save();
return ws; return ws;
@ -631,19 +627,20 @@ const updateNigthWave = async () => {
try { try {
const ws = await WorldState.findOne(); const ws = await WorldState.findOne();
if (!ws) throw new Error("Missing worldState"); if (!ws) throw new Error("Missing worldState");
let season = ws.SeasonInfo let season = ws.SeasonInfo;
if(!season) season = { if (!season)
Activation: 1715796000000, season = {
Expiry: 9999999999999, Activation: 1715796000000,
AffiliationTag: "RadioLegionIntermission10Syndicate", Expiry: 9999999999999,
Season: 12, AffiliationTag: "RadioLegionIntermission10Syndicate",
Phase: 0, Season: 12,
Params: "", Phase: 0,
ActiveChallenges: [], Params: "",
UsedChallenges: [] ActiveChallenges: [],
} UsedChallenges: []
const activeChallenges = season.ActiveChallenges.filter(challenge => currentDate < challenge.Expiry) };
const usedChallenges = season.UsedChallenges const activeChallenges = season.ActiveChallenges.filter(challenge => currentDate < challenge.Expiry);
const usedChallenges = season.UsedChallenges;
const exportChallenges = Object.keys(ExportNightwave.challenges); const exportChallenges = Object.keys(ExportNightwave.challenges);
const filterChallenges = (prefix: string) => exportChallenges.filter(challenge => challenge.startsWith(prefix)); const filterChallenges = (prefix: string) => exportChallenges.filter(challenge => challenge.startsWith(prefix));
@ -652,7 +649,9 @@ const updateNigthWave = async () => {
const weeklyChallenges = filterChallenges("/Lotus/Types/Challenges/Seasons/Weekly/"); const weeklyChallenges = filterChallenges("/Lotus/Types/Challenges/Seasons/Weekly/");
const weeklyHardChallenges = filterChallenges("/Lotus/Types/Challenges/Seasons/WeeklyHard/"); const weeklyHardChallenges = filterChallenges("/Lotus/Types/Challenges/Seasons/WeeklyHard/");
let dailyCount = 0, weeklyCount = 0, weeklyHardCount = 0; let dailyCount = 0,
weeklyCount = 0,
weeklyHardCount = 0;
activeChallenges.forEach(challenge => { activeChallenges.forEach(challenge => {
if (challenge.Challenge.startsWith("/Lotus/Types/Challenges/Seasons/Daily/")) dailyCount++; if (challenge.Challenge.startsWith("/Lotus/Types/Challenges/Seasons/Daily/")) dailyCount++;
@ -660,19 +659,26 @@ const updateNigthWave = async () => {
else if (challenge.Challenge.startsWith("/Lotus/Types/Challenges/Seasons/WeeklyHard/")) weeklyHardCount++; else if (challenge.Challenge.startsWith("/Lotus/Types/Challenges/Seasons/WeeklyHard/")) weeklyHardCount++;
}); });
const addChallenges = (count: number, limit: number, intervalStart: number, intervalEnd: number, challengesArray: string[], isDaily = false) => { const addChallenges = async (
count: number,
limit: number,
intervalStart: number,
intervalEnd: number,
challengesArray: string[],
isDaily = false
) => {
while (count < limit) { while (count < limit) {
challengesArray = challengesArray.filter(challenge => !usedChallenges.includes(challenge)) challengesArray = challengesArray.filter(challenge => !usedChallenges.includes(challenge));
const uniqueName = challengesArray[Math.floor(Math.random() * challengesArray.length)] const uniqueName = challengesArray[Math.floor(Math.random() * challengesArray.length)];
const challenge: IActiveChallenge = { const challenge: IActiveChallenge = {
Activation: intervalStart, Activation: intervalStart,
Expiry: intervalEnd, Expiry: intervalEnd,
Challenge: uniqueName Challenge: uniqueName
}; };
if (isDaily){ if (isDaily) {
challenge.Daily = true; challenge.Daily = true;
} else { } else {
usedChallenges.push(uniqueName) usedChallenges.push(uniqueName);
} }
activeChallenges.push(challenge); activeChallenges.push(challenge);
count++; count++;
@ -692,11 +698,11 @@ const updateNigthWave = async () => {
Params: season.Params || "", Params: season.Params || "",
ActiveChallenges: activeChallenges, ActiveChallenges: activeChallenges,
UsedChallenges: usedChallenges UsedChallenges: usedChallenges
} };
ws.SeasonInfo = season ws.SeasonInfo = season;
await ws.save(); await ws.save();
return ws return ws;
} catch (error) { } catch (error) {
throw new Error(`Error while updating NigthWave ${error}`); throw new Error(`Error while updating NigthWave ${error}`);
} }
@ -706,23 +712,23 @@ const updateNodeOverrides = async () => {
try { try {
const ws = await WorldState.findOne(); const ws = await WorldState.findOne();
if (!ws) throw new Error("Missing worldState"); if (!ws) throw new Error("Missing worldState");
const curWeek = Math.floor(Date.now()/(7*unixTimesInMs.day)); const curWeek = Math.floor(Date.now() / (7 * unixTimesInMs.day));
let overrides = ws.NodeOverrides let overrides = ws.NodeOverrides;
if(overrides == undefined || overrides.length<1 ){ if (overrides == undefined || overrides.length < 1) {
overrides = [ overrides = [
{ "Node": "EuropaHUB", "Hide": true }, { Node: "EuropaHUB", Hide: true },
{ "Node": "ErisHUB", "Hide": true }, { Node: "ErisHUB", Hide: true },
{ "Node": "VenusHUB", "Hide": true }, { Node: "VenusHUB", Hide: true },
{ "Node": "SolNode802", "Seed": curWeek }, // Elite santuary onnslaught { Node: "SolNode802", Seed: curWeek }, // Elite santuary onnslaught
{ {
"Node": "EarthHUB", Node: "EarthHUB",
"Hide": false, Hide: false,
"LevelOverride": "/Lotus/Levels/Proc/Hub/RelayStationHubTwoB", LevelOverride: "/Lotus/Levels/Proc/Hub/RelayStationHubTwoB"
}, },
{ {
"Node": "MercuryHUB", Node: "MercuryHUB",
"Hide": true, Hide: true,
"LevelOverride": "/Lotus/Levels/Proc/Hub/RelayStationHubHydroid", LevelOverride: "/Lotus/Levels/Proc/Hub/RelayStationHubHydroid"
} }
]; ];
} else { } else {
@ -731,13 +737,13 @@ const updateNodeOverrides = async () => {
if (solNodeIndex !== -1) { if (solNodeIndex !== -1) {
if (overrides[solNodeIndex].Seed !== curWeek) overrides[solNodeIndex].Seed = curWeek; if (overrides[solNodeIndex].Seed !== curWeek) overrides[solNodeIndex].Seed = curWeek;
} else { } else {
overrides.push({ "Node": "SolNode802", "Seed": curWeek }); overrides.push({ Node: "SolNode802", Seed: curWeek });
} }
} }
ws.NodeOverrides = overrides ws.NodeOverrides = overrides;
await ws.save(); await ws.save();
return ws; return ws;
} catch (error) { } catch (error) {
throw new Error(`Error while updating NodeOverrides ${error}`); throw new Error(`Error while updating NodeOverrides ${error}`);
} }
} };