Apply prettier changes
This commit is contained in:
parent
54e2a47bdf
commit
d5a7857649
File diff suppressed because it is too large
Load Diff
@ -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,7 +565,8 @@ 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(
|
||||||
|
node =>
|
||||||
randomState.regions[randomIndex].systemIndex === node.systemIndex &&
|
randomState.regions[randomIndex].systemIndex === node.systemIndex &&
|
||||||
randomState.regions[randomIndex].missionIndex.includes(node.missionIndex)
|
randomState.regions[randomIndex].missionIndex.includes(node.missionIndex)
|
||||||
);
|
);
|
||||||
@ -610,8 +606,8 @@ const updateCircuit = async () => {
|
|||||||
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,8 +627,9 @@ 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)
|
||||||
|
season = {
|
||||||
Activation: 1715796000000,
|
Activation: 1715796000000,
|
||||||
Expiry: 9999999999999,
|
Expiry: 9999999999999,
|
||||||
AffiliationTag: "RadioLegionIntermission10Syndicate",
|
AffiliationTag: "RadioLegionIntermission10Syndicate",
|
||||||
@ -641,9 +638,9 @@ const updateNigthWave = async () => {
|
|||||||
Params: "",
|
Params: "",
|
||||||
ActiveChallenges: [],
|
ActiveChallenges: [],
|
||||||
UsedChallenges: []
|
UsedChallenges: []
|
||||||
}
|
};
|
||||||
const activeChallenges = season.ActiveChallenges.filter(challenge => currentDate < challenge.Expiry)
|
const activeChallenges = season.ActiveChallenges.filter(challenge => currentDate < challenge.Expiry);
|
||||||
const usedChallenges = season.UsedChallenges
|
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,10 +659,17 @@ 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,
|
||||||
@ -672,7 +678,7 @@ const updateNigthWave = async () => {
|
|||||||
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}`);
|
||||||
}
|
}
|
||||||
@ -707,22 +713,22 @@ const updateNodeOverrides = async () => {
|
|||||||
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}`);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user