|
1 | | -import fs from "fs/promises"; |
2 | | -import { fetchEndpoint } from "./warframe_exports.mjs"; |
3 | | - |
4 | | -const existingNodes = JSON.parse( |
5 | | - await fs.readFile("src/resources/nodes.json", "utf-8") |
6 | | -); |
7 | | - |
8 | | -const rawNodes = (await fetchEndpoint("Regions")).ExportRegions; |
9 | | -const newNodes = { |
10 | | - Earth: {}, |
11 | | - Venus: {}, |
12 | | - Mercury: {}, |
13 | | - Mars: {}, |
14 | | - Deimos: {}, |
15 | | - Phobos: {}, |
16 | | - Ceres: {}, |
17 | | - Jupiter: {}, |
18 | | - Europa: {}, |
19 | | - Saturn: {}, |
20 | | - Uranus: {}, |
21 | | - Neptune: {}, |
22 | | - Pluto: {}, |
23 | | - Eris: {}, |
24 | | - Sedna: {}, |
25 | | - Lua: {}, |
26 | | - "Kuva Fortress": {}, |
27 | | - Zariman: {}, |
28 | | - Duviri: {}, |
29 | | - Void: {}, |
30 | | - "Höllvania": {} |
31 | | -}; |
32 | | - |
33 | | -// ExportRegions has incorrect node names for Höllvania |
34 | | -const hollvaniaNodeNames = { |
35 | | - "SolNode850": "Köbinn West", |
36 | | - "SolNode851": "Mischta Ramparts", |
37 | | - "SolNode852": "Old Konderuk", |
38 | | - "SolNode853": "Mausoleum East", |
39 | | - "SolNode854": "Rhu Manor", |
40 | | - "SolNode855": "Lower Vehrvod", |
41 | | - "SolNode856": "Victory Plaza", |
42 | | - "SolNode857": "Vehrvod District", |
43 | | -} |
44 | | - |
45 | | -rawNodes.forEach(rawNode => { |
46 | | - if (!newNodes[rawNode.systemName]) { |
47 | | - throw new Error("Unknown Planet: " + rawNode.systemName); |
48 | | - } |
49 | | - if (!existingNodes[rawNode.systemName]?.[rawNode.uniqueName]) { |
50 | | - console.log("New Node: " + JSON.stringify(rawNode)); |
51 | | - } |
52 | | - |
53 | | - newNodes[rawNode.systemName][rawNode.uniqueName] = { |
54 | | - name: hollvaniaNodeNames[rawNode.uniqueName] ?? rawNode.name, |
55 | | - type: rawNode.missionIndex, |
56 | | - faction: rawNode.factionIndex, |
57 | | - lvl: [rawNode.minEnemyLevel, rawNode.maxEnemyLevel], |
58 | | - xp: existingNodes[rawNode.systemName]?.[rawNode.uniqueName]?.xp |
59 | | - }; |
60 | | -}); |
61 | | - |
62 | | -await fs.writeFile( |
63 | | - "src/resources/nodes.json", |
64 | | - JSON.stringify(newNodes, undefined, "\t") |
65 | | -); |
| 1 | +import fs from "fs/promises"; |
| 2 | +import { fetchEndpoint } from "./warframe_exports.mjs"; |
| 3 | + |
| 4 | +const existingNodes = JSON.parse( |
| 5 | + await fs.readFile("src/resources/nodes.json", "utf-8") |
| 6 | +); |
| 7 | + |
| 8 | +const rawNodes = (await fetchEndpoint("Regions")).ExportRegions; |
| 9 | +const newNodes = { |
| 10 | + Earth: {}, |
| 11 | + Venus: {}, |
| 12 | + Mercury: {}, |
| 13 | + Mars: {}, |
| 14 | + Deimos: {}, |
| 15 | + Phobos: {}, |
| 16 | + Ceres: {}, |
| 17 | + Jupiter: {}, |
| 18 | + Europa: {}, |
| 19 | + Saturn: {}, |
| 20 | + Uranus: {}, |
| 21 | + Neptune: {}, |
| 22 | + Pluto: {}, |
| 23 | + Eris: {}, |
| 24 | + Sedna: {}, |
| 25 | + Lua: {}, |
| 26 | + "Kuva Fortress": {}, |
| 27 | + Zariman: {}, |
| 28 | + Duviri: {}, |
| 29 | + Void: {}, |
| 30 | + Höllvania: {}, |
| 31 | + "Dark Refractory": {} |
| 32 | +}; |
| 33 | + |
| 34 | +// ExportRegions has incorrect node names for Höllvania |
| 35 | +const hollvaniaNodeNames = { |
| 36 | + "SolNode850": "Köbinn West", |
| 37 | + "SolNode851": "Mischta Ramparts", |
| 38 | + "SolNode852": "Old Konderuk", |
| 39 | + "SolNode853": "Mausoleum East", |
| 40 | + "SolNode854": "Rhu Manor", |
| 41 | + "SolNode855": "Lower Vehrvod", |
| 42 | + "SolNode856": "Victory Plaza", |
| 43 | + "SolNode857": "Vehrvod District", |
| 44 | + "SolNode858": "Solstice Square" |
| 45 | +} |
| 46 | + |
| 47 | +// ExportRegions names for The Descendia/The Perita Rebellion nodes aren't great |
| 48 | +const darkRefactoryNodeNames = { |
| 49 | + "SolNode250": "The Perita Rebellion: Hunhullus", |
| 50 | + "SolNode251": "The Perita Rebellion: Dactolyst", |
| 51 | + "SolNode252": "The Perita Rebellion: Vanguard", |
| 52 | + "SolNode256": "The Descendia" |
| 53 | +}; |
| 54 | + |
| 55 | +rawNodes.forEach(rawNode => { |
| 56 | + let planetName = rawNode.systemName; |
| 57 | + let nodeName = rawNode.name; |
| 58 | + const nodeId = rawNode.uniqueName; |
| 59 | + |
| 60 | + if (planetName === "Dark Refractory, Deimos") { |
| 61 | + planetName = "Dark Refractory"; |
| 62 | + |
| 63 | + // Filter out the Descendia checkpoint nodes |
| 64 | + if ( |
| 65 | + rawNode.uniqueName === "SolNode253" || |
| 66 | + rawNode.uniqueName === "SolNode254" || |
| 67 | + rawNode.uniqueName === "SolNode255" |
| 68 | + ) { |
| 69 | + return; |
| 70 | + } |
| 71 | + |
| 72 | + nodeName = darkRefactoryNodeNames[nodeId]; |
| 73 | + } |
| 74 | + if (planetName === "Höllvania") { |
| 75 | + nodeName = hollvaniaNodeNames[nodeId]; |
| 76 | + } |
| 77 | + |
| 78 | + if (!newNodes[planetName]) { |
| 79 | + throw new Error("Unknown Planet: " + planetName); |
| 80 | + } |
| 81 | + if (!existingNodes[planetName]?.[nodeId]) { |
| 82 | + console.log("New Node: " + JSON.stringify(rawNode)); |
| 83 | + } |
| 84 | + |
| 85 | + newNodes[planetName][nodeId] = { |
| 86 | + name: nodeName, |
| 87 | + type: rawNode.missionIndex, |
| 88 | + faction: rawNode.factionIndex, |
| 89 | + lvl: [rawNode.minEnemyLevel, rawNode.maxEnemyLevel], |
| 90 | + xp: existingNodes[planetName]?.[nodeId]?.xp |
| 91 | + }; |
| 92 | +}); |
| 93 | + |
| 94 | +await fs.writeFile( |
| 95 | + "src/resources/nodes.json", |
| 96 | + JSON.stringify(newNodes, undefined, "\t") |
| 97 | +); |
0 commit comments