diff --git a/src/controllers/custom/changeModularPartsController.ts b/src/controllers/custom/changeModularPartsController.ts new file mode 100644 index 00000000..ee1fd8f3 --- /dev/null +++ b/src/controllers/custom/changeModularPartsController.ts @@ -0,0 +1,65 @@ +import { getInventory } from "@/src/services/inventoryService"; +import { getAccountIdForRequest } from "@/src/services/loginService"; +import { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; +import { RequestHandler } from "express"; + +export const changeModularPartsController: RequestHandler = async (req, res) => { + const accountId = await getAccountIdForRequest(req); + const request = req.body as IUpdateFingerPrintRequest; + const inventory = await getInventory(accountId, request.category); + const item = inventory[request.category].id(request.oid); + if (item) { + item.ModularParts = request.modularParts; + + request.modularParts.forEach(part => { + const categoryMap = mapping[part]; + if (categoryMap && categoryMap[request.category]) { + item.ItemType = categoryMap[request.category]!; + } + }); + await inventory.save(); + } + res.end(); +}; + +interface IUpdateFingerPrintRequest { + category: TEquipmentKey; + oid: string; + modularParts: string[]; +} + +const mapping: Partial>>> = { + "/Lotus/Weapons/SolarisUnited/Secondary/SUModularSecondarySet1/Barrel/SUModularSecondaryBarrelAPart": { + LongGuns: "/Lotus/Weapons/SolarisUnited/Primary/LotusModularPrimaryShotgun", + Pistols: "/Lotus/Weapons/SolarisUnited/Secondary/LotusModularSecondaryShotgun" + }, + "/Lotus/Weapons/Infested/Pistols/InfKitGun/Barrels/InfBarrelEgg/InfModularBarrelEggPart": { + LongGuns: "/Lotus/Weapons/SolarisUnited/Primary/LotusModularPrimaryShotgun", + Pistols: "/Lotus/Weapons/SolarisUnited/Secondary/LotusModularSecondaryShotgun" + }, + "/Lotus/Weapons/SolarisUnited/Secondary/SUModularSecondarySet1/Barrel/SUModularSecondaryBarrelBPart": { + LongGuns: "/Lotus/Weapons/SolarisUnited/Primary/LotusModularPrimary", + Pistols: "/Lotus/Weapons/SolarisUnited/Secondary/LotusModularSecondary" + }, + "/Lotus/Weapons/SolarisUnited/Secondary/SUModularSecondarySet1/Barrel/SUModularSecondaryBarrelCPart": { + LongGuns: "/Lotus/Weapons/SolarisUnited/Primary/LotusModularPrimary", + Pistols: "/Lotus/Weapons/SolarisUnited/Secondary/LotusModularSecondary" + }, + "/Lotus/Weapons/SolarisUnited/Secondary/SUModularSecondarySet1/Barrel/SUModularSecondaryBarrelDPart": { + LongGuns: "/Lotus/Weapons/SolarisUnited/Primary/LotusModularPrimaryBeam", + Pistols: "/Lotus/Weapons/SolarisUnited/Secondary/LotusModularSecondaryBeam" + }, + "/Lotus/Weapons/Infested/Pistols/InfKitGun/Barrels/InfBarrelBeam/InfModularBarrelBeamPart": { + LongGuns: "/Lotus/Weapons/SolarisUnited/Primary/LotusModularPrimaryBeam", + Pistols: "/Lotus/Weapons/SolarisUnited/Secondary/LotusModularSecondaryBeam" + }, + "/Lotus/Types/Friendly/Pets/ZanukaPets/ZanukaPetParts/ZanukaPetPartHeadA": { + MoaPets: "/Lotus/Types/Friendly/Pets/ZanukaPets/ZanukaPetAPowerSuit" + }, + "/Lotus/Types/Friendly/Pets/ZanukaPets/ZanukaPetParts/ZanukaPetPartHeadB": { + MoaPets: "/Lotus/Types/Friendly/Pets/ZanukaPets/ZanukaPetBPowerSuit" + }, + "/Lotus/Types/Friendly/Pets/ZanukaPets/ZanukaPetParts/ZanukaPetPartHeadC": { + MoaPets: "/Lotus/Types/Friendly/Pets/ZanukaPets/ZanukaPetCPowerSuit" + } +}; diff --git a/src/controllers/custom/configController.ts b/src/controllers/custom/configController.ts index 0cc28698..9f3c17e3 100644 --- a/src/controllers/custom/configController.ts +++ b/src/controllers/custom/configController.ts @@ -3,6 +3,7 @@ import { config } from "@/src/services/configService"; import { getAccountForRequest, isAdministrator } from "@/src/services/loginService"; import { saveConfig } from "@/src/services/configWriterService"; import { sendWsBroadcastExcept } from "@/src/services/wsService"; +import { syncConfigWithDatabase } from "@/src/services/configWatcherService"; export const getConfigController: RequestHandler = async (req, res) => { const account = await getAccountForRequest(req); @@ -26,6 +27,7 @@ export const setConfigController: RequestHandler = async (req, res) => { obj[idx] = value; } sendWsBroadcastExcept(parseInt(String(req.query.wsid)), { config_reloaded: true }); + syncConfigWithDatabase(); await saveConfig(); res.end(); } else { diff --git a/src/routes/custom.ts b/src/routes/custom.ts index 99536459..bc0427f4 100644 --- a/src/routes/custom.ts +++ b/src/routes/custom.ts @@ -25,6 +25,7 @@ import { manageQuestsController } from "@/src/controllers/custom/manageQuestsCon import { setEvolutionProgressController } from "@/src/controllers/custom/setEvolutionProgressController"; import { setBoosterController } from "@/src/controllers/custom/setBoosterController"; import { updateFingerprintController } from "@/src/controllers/custom/updateFingerprintController"; +import { changeModularPartsController } from "@/src/controllers/custom/changeModularPartsController"; import { getConfigController, setConfigController } from "@/src/controllers/custom/configController"; @@ -55,6 +56,7 @@ customRouter.post("/manageQuests", manageQuestsController); customRouter.post("/setEvolutionProgress", setEvolutionProgressController); customRouter.post("/setBooster", setBoosterController); customRouter.post("/updateFingerprint", updateFingerprintController); +customRouter.post("/changeModularParts", changeModularPartsController); customRouter.post("/getConfig", getConfigController); customRouter.post("/setConfig", setConfigController); diff --git a/src/services/worldStateService.ts b/src/services/worldStateService.ts index 60db22b1..7f5268c9 100644 --- a/src/services/worldStateService.ts +++ b/src/services/worldStateService.ts @@ -261,7 +261,8 @@ export const getSortie = (day: number): ISortie => { if ( sortieFactionToSystemIndexes[sortieBossToFaction[boss]].includes(value.systemIndex) && sortieFactionToFactionIndexes[sortieBossToFaction[boss]].includes(value.factionIndex!) && - key in sortieTilesets + key in sortieTilesets && + (key != "SolNode228" || sortieBossToFaction[boss] == "FC_GRINEER") // PoE does not work for non-infested enemies ) { nodes.push(key); } diff --git a/static/webui/index.html b/static/webui/index.html index 55676cd8..c6f6baa3 100644 --- a/static/webui/index.html +++ b/static/webui/index.html @@ -478,6 +478,12 @@ +
+
+
+
+
+
diff --git a/static/webui/script.js b/static/webui/script.js index bb557ff3..8b041836 100644 --- a/static/webui/script.js +++ b/static/webui/script.js @@ -730,7 +730,10 @@ function updateInventory() { td.appendChild(a); } - if (["Suits", "LongGuns", "Pistols", "Melee", "SpaceGuns", "SpaceMelee"].includes(category)) { + if ( + ["Suits", "LongGuns", "Pistols", "Melee", "SpaceGuns", "SpaceMelee"].includes(category) || + modularWeapons.includes(item.ItemType) + ) { const a = document.createElement("a"); a.href = "/webui/detailedView?productCategory=" + category + "&itemId=" + item.ItemId.$oid; a.innerHTML = ``; @@ -1017,13 +1020,19 @@ function updateInventory() { if (item.ItemType.substr(0, 32) == "/Lotus/Upgrades/Mods/Randomized/") { const rivenType = item.ItemType.substr(32); const fingerprint = JSON.parse(item.UpgradeFingerprint); - if (fingerprint.buffs) { + if ("buffs" in fingerprint) { // Riven has been revealed? const tr = document.createElement("tr"); { const td = document.createElement("td"); td.textContent = itemMap[fingerprint.compat]?.name ?? fingerprint.compat; - td.textContent += " " + RivenParser.parseRiven(rivenType, fingerprint, 1).name; + td.textContent += " "; + try { + td.textContent += RivenParser.parseRiven(rivenType, fingerprint, 1).name; + } catch (e) { + console.warn("malformed riven", { rivenType, fingerprint }); + td.textContent += " [Malformed Riven]"; + } td.innerHTML += "