From 015619110c0f0f38462792e5bfec7dafcb571763 Mon Sep 17 00:00:00 2001 From: Sainan Date: Sat, 22 Jun 2024 17:55:30 +0200 Subject: [PATCH 1/4] fix: unbinding both focus upgrades costs 750k focus instead of 1.5M (#360) --- src/controllers/api/focusController.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controllers/api/focusController.ts b/src/controllers/api/focusController.ts index 0c7a7a3e..ff0a9616 100644 --- a/src/controllers/api/focusController.ts +++ b/src/controllers/api/focusController.ts @@ -78,7 +78,7 @@ export const focusController: RequestHandler = async (req, res) => { const request = JSON.parse(req.body.toString()) as IUnbindUpgradeRequest; const focusPolarity = focusTypeToPolarity(request.FocusTypes[0]); const inventory = await getInventory(accountId); - inventory.FocusXP[focusPolarity] -= 750_000; + inventory.FocusXP[focusPolarity] -= 750_000 * request.FocusTypes.length; addMiscItems(inventory, [ { ItemType: "/Lotus/Types/Gameplay/Eidolon/Resources/SentientShards/SentientShardBrilliantItem", @@ -93,7 +93,7 @@ export const focusController: RequestHandler = async (req, res) => { res.json({ FocusTypes: request.FocusTypes, FocusPointCosts: { - [focusPolarity]: 750_000 + [focusPolarity]: 750_000 * request.FocusTypes.length }, MiscItemCosts: [ { -- 2.47.2 From d0b8c8a1d3c98afb94bce4bc2ad7fb442d06da92 Mon Sep 17 00:00:00 2001 From: Sainan Date: Sat, 22 Jun 2024 17:56:36 +0200 Subject: [PATCH 2/4] fix: endo pickups (#359) --- .../api/missionInventoryUpdateController.ts | 5 ++- src/services/missionInventoryUpdateService.ts | 33 ++++++++++++------- src/types/requestTypes.ts | 5 ++- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/src/controllers/api/missionInventoryUpdateController.ts b/src/controllers/api/missionInventoryUpdateController.ts index 46acdd34..e2723a51 100644 --- a/src/controllers/api/missionInventoryUpdateController.ts +++ b/src/controllers/api/missionInventoryUpdateController.ts @@ -4,6 +4,7 @@ import { combineRewardAndLootInventory, getRewards } from "@/src/services/missio import { getJSONfromString } from "@/src/helpers/stringHelpers"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { IMissionInventoryUpdateRequest } from "@/src/types/requestTypes"; +import { logger } from "@/src/utils/logger"; /* **** INPUT **** - [ ] crossPlaySetting @@ -52,6 +53,8 @@ const missionInventoryUpdateController: RequestHandler = async (req, res): Promi // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call const lootInventory = getJSONfromString(req.body.toString()) as IMissionInventoryUpdateRequest; + logger.debug("missionInventoryUpdate with lootInventory =", lootInventory); + const { InventoryChanges, MissionRewards } = getRewards(lootInventory); const { combinedInventoryChanges, TotalCredits, CreditsBonus, MissionCredits, FusionPoints } = @@ -66,7 +69,7 @@ const missionInventoryUpdateController: RequestHandler = async (req, res): Promi TotalCredits, CreditsBonus, MissionCredits, - ...(FusionPoints !== undefined && { FusionPoints }) + FusionPoints }); } catch (err) { console.error("Error parsing JSON data:", err); diff --git a/src/services/missionInventoryUpdateService.ts b/src/services/missionInventoryUpdateService.ts index f7300837..ba8ec93c 100644 --- a/src/services/missionInventoryUpdateService.ts +++ b/src/services/missionInventoryUpdateService.ts @@ -54,12 +54,22 @@ const combineRewardAndLootInventory = ( const missionCredits = lootInventory.RegularCredits || 0; const creditsBonus = rewardInventory.RegularCredits || 0; const totalCredits = missionCredits + creditsBonus; - const FusionPoints = (lootInventory.FusionPoints || 0) + (rewardInventory.FusionPoints || 0) || undefined; + let FusionPoints = rewardInventory.FusionPoints || 0; + + // Discharge Endo picked up during the mission + if (lootInventory.FusionBundles) { + for (const fusionBundle of lootInventory.FusionBundles) { + if (fusionBundle.ItemType in fusionBundles) { + FusionPoints += fusionBundles[fusionBundle.ItemType] * fusionBundle.ItemCount; + } else { + logger.error(`unknown fusion bundle: ${fusionBundle.ItemType}`); + } + } + lootInventory.FusionBundles = undefined; + } lootInventory.RegularCredits = totalCredits; - if (FusionPoints) { - lootInventory.FusionPoints = FusionPoints; - } + lootInventory.FusionPoints = FusionPoints; inventoryFields.forEach((field: IInventoryFieldType) => { if (rewardInventory[field] && !lootInventory[field]) { lootInventory[field] = []; @@ -72,7 +82,7 @@ const combineRewardAndLootInventory = ( TotalCredits: [totalCredits, totalCredits], CreditsBonus: [creditsBonus, creditsBonus], MissionCredits: [missionCredits, missionCredits], - ...(FusionPoints !== undefined && { FusionPoints }) + FusionPoints: FusionPoints }; }; @@ -123,8 +133,9 @@ const creditBundles: Record = { }; const fusionBundles: Record = { - "/Lotus/StoreItems/Upgrades/Mods/FusionBundles/UncommonFusionBundle": 50, - "/Lotus/StoreItems/Upgrades/Mods/FusionBundles/RareFusionBundle": 80 + "/Lotus/Upgrades/Mods/FusionBundles/CommonFusionBundle": 15, + "/Lotus/Upgrades/Mods/FusionBundles/UncommonFusionBundle": 50, + "/Lotus/Upgrades/Mods/FusionBundles/RareFusionBundle": 80 }; const formatRewardsToInventoryType = ( @@ -136,12 +147,12 @@ const formatRewardsToInventoryType = ( if (reward.type in creditBundles) { InventoryChanges.RegularCredits ??= 0; InventoryChanges.RegularCredits += creditBundles[reward.type] * reward.itemCount; - } else if (reward.type in fusionBundles) { - InventoryChanges.FusionPoints ??= 0; - InventoryChanges.FusionPoints += fusionBundles[reward.type] * reward.itemCount; } else { const type = reward.type.replace("/Lotus/StoreItems/", "/Lotus/"); - if (type in ExportUpgrades) { + if (type in fusionBundles) { + InventoryChanges.FusionPoints ??= 0; + InventoryChanges.FusionPoints += fusionBundles[type] * reward.itemCount; + } else if (type in ExportUpgrades) { addRewardResponse(InventoryChanges, MissionRewards, type, reward.itemCount, "RawUpgrades"); } else if (type in ExportGear) { addRewardResponse(InventoryChanges, MissionRewards, type, reward.itemCount, "Consumables"); diff --git a/src/types/requestTypes.ts b/src/types/requestTypes.ts index 7beb7a4e..c63052c0 100644 --- a/src/types/requestTypes.ts +++ b/src/types/requestTypes.ts @@ -7,6 +7,7 @@ import { ICrewShipSalvagedWeaponSkin, IEvolutionProgress, IMiscItem, + ITypeCount, IMission, IRawUpgrade, ISeasonChallenge @@ -45,6 +46,7 @@ export interface IMissionInventoryUpdateRequest { Pistols?: IEquipmentClient[]; Suits?: IEquipmentClient[]; Melee?: IEquipmentClient[]; + FusionBundles?: ITypeCount[]; RawUpgrades?: IRawUpgrade[]; MiscItems?: IMiscItem[]; Consumables?: IConsumable[]; @@ -52,9 +54,10 @@ export interface IMissionInventoryUpdateRequest { RegularCredits?: number; ChallengeProgress?: IChallengeProgress[]; RewardInfo?: IMissionInventoryUpdateRequestRewardInfo; - FusionPoints?: number; Missions?: IMission; EvolutionProgress?: IEvolutionProgress[]; + + FusionPoints?: number; // Not a part of the request, but we put it in this struct as an intermediate storage. } export interface IMissionInventoryUpdateRequestRewardInfo { -- 2.47.2 From e34cb305ada3b593aed99398179a12b3033f130f Mon Sep 17 00:00:00 2001 From: Sainan Date: Sat, 22 Jun 2024 18:40:51 +0200 Subject: [PATCH 3/4] feat: gravimag installation (#366) --- src/controllers/api/upgradesController.ts | 26 +++++++++++++------ .../inventoryTypes/commonInventoryTypes.ts | 1 + src/types/inventoryTypes/inventoryTypes.ts | 3 ++- src/types/requestTypes.ts | 5 ++-- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/controllers/api/upgradesController.ts b/src/controllers/api/upgradesController.ts index 9d89da70..d2f44558 100644 --- a/src/controllers/api/upgradesController.ts +++ b/src/controllers/api/upgradesController.ts @@ -1,7 +1,7 @@ import { RequestHandler } from "express"; import { IUpgradesRequest } from "@/src/types/requestTypes"; import { FocusSchool, IEquipmentDatabase, EquipmentFeatures } from "@/src/types/inventoryTypes/commonInventoryTypes"; -import { IMiscItem, TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; +import { IMiscItem } from "@/src/types/inventoryTypes/inventoryTypes"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { addMiscItems, getInventory, updateCurrency } from "@/src/services/inventoryService"; @@ -29,7 +29,7 @@ export const upgradesController: RequestHandler = async (req, res) => { switch (operation.UpgradeRequirement) { case "/Lotus/Types/Items/MiscItems/OrokinReactor": case "/Lotus/Types/Items/MiscItems/OrokinCatalyst": - for (const item of inventory[payload.ItemCategory as TEquipmentKey] as IEquipmentDatabase[]) { + for (const item of inventory[payload.ItemCategory]) { if (item._id.toString() == payload.ItemId.$oid) { item.Features ??= 0; item.Features |= EquipmentFeatures.DOUBLE_CAPACITY; @@ -39,7 +39,7 @@ export const upgradesController: RequestHandler = async (req, res) => { break; case "/Lotus/Types/Items/MiscItems/UtilityUnlocker": case "/Lotus/Types/Items/MiscItems/WeaponUtilityUnlocker": - for (const item of inventory[payload.ItemCategory as TEquipmentKey] as IEquipmentDatabase[]) { + for (const item of inventory[payload.ItemCategory]) { if (item._id.toString() == payload.ItemId.$oid) { item.Features ??= 0; item.Features |= EquipmentFeatures.UTILITY_SLOT; @@ -47,10 +47,20 @@ export const upgradesController: RequestHandler = async (req, res) => { } } break; + case "/Lotus/Types/Items/MiscItems/HeavyWeaponCatalyst": + console.assert(payload.ItemCategory == "SpaceGuns"); + for (const item of inventory[payload.ItemCategory]) { + if (item._id.toString() == payload.ItemId.$oid) { + item.Features ??= 0; + item.Features |= EquipmentFeatures.GRAVIMAG_INSTALLED; + break; + } + } + break; case "/Lotus/Types/Items/MiscItems/WeaponPrimaryArcaneUnlocker": case "/Lotus/Types/Items/MiscItems/WeaponSecondaryArcaneUnlocker": case "/Lotus/Types/Items/MiscItems/WeaponMeleeArcaneUnlocker": - for (const item of inventory[payload.ItemCategory as TEquipmentKey] as IEquipmentDatabase[]) { + for (const item of inventory[payload.ItemCategory]) { if (item._id.toString() == payload.ItemId.$oid) { item.Features ??= 0; item.Features |= EquipmentFeatures.ARCANE_SLOT; @@ -62,7 +72,7 @@ export const upgradesController: RequestHandler = async (req, res) => { case "/Lotus/Types/Items/MiscItems/FormaUmbra": case "/Lotus/Types/Items/MiscItems/FormaAura": case "/Lotus/Types/Items/MiscItems/FormaStance": - for (const item of inventory[payload.ItemCategory as TEquipmentKey] as IEquipmentDatabase[]) { + for (const item of inventory[payload.ItemCategory]) { if (item._id.toString() == payload.ItemId.$oid) { item.XP = 0; setSlotPolarity(item, operation.PolarizeSlot, operation.PolarizeValue); @@ -73,7 +83,7 @@ export const upgradesController: RequestHandler = async (req, res) => { } break; case "/Lotus/Types/Items/MiscItems/ModSlotUnlocker": - for (const item of inventory[payload.ItemCategory as TEquipmentKey] as IEquipmentDatabase[]) { + for (const item of inventory[payload.ItemCategory]) { if (item._id.toString() == payload.ItemId.$oid) { item.ModSlotPurchases ??= 0; item.ModSlotPurchases += 1; @@ -88,7 +98,7 @@ export const upgradesController: RequestHandler = async (req, res) => { } break; case "/Lotus/Types/Items/MiscItems/CustomizationSlotUnlocker": - for (const item of inventory[payload.ItemCategory as TEquipmentKey] as IEquipmentDatabase[]) { + for (const item of inventory[payload.ItemCategory]) { if (item._id.toString() == payload.ItemId.$oid) { item.CustomizationSlotPurchases ??= 0; item.CustomizationSlotPurchases += 1; @@ -104,7 +114,7 @@ export const upgradesController: RequestHandler = async (req, res) => { break; case "": console.assert(operation.OperationType == "UOT_SWAP_POLARITY"); - for (const item of inventory[payload.ItemCategory as TEquipmentKey] as IEquipmentDatabase[]) { + for (const item of inventory[payload.ItemCategory]) { if (item._id.toString() == payload.ItemId.$oid) { for (let i = 0; i != operation.PolarityRemap.length; ++i) { if (operation.PolarityRemap[i].Slot != i) { diff --git a/src/types/inventoryTypes/commonInventoryTypes.ts b/src/types/inventoryTypes/commonInventoryTypes.ts index 2c434311..758038c6 100644 --- a/src/types/inventoryTypes/commonInventoryTypes.ts +++ b/src/types/inventoryTypes/commonInventoryTypes.ts @@ -85,6 +85,7 @@ export interface IEquipmentClient extends Omit { export enum EquipmentFeatures { DOUBLE_CAPACITY = 1, UTILITY_SLOT = 2, + GRAVIMAG_INSTALLED = 4, ARCANE_SLOT = 32, INCARNON_GENESIS = 512 } diff --git a/src/types/inventoryTypes/inventoryTypes.ts b/src/types/inventoryTypes/inventoryTypes.ts index 1555799b..b6570acd 100644 --- a/src/types/inventoryTypes/inventoryTypes.ts +++ b/src/types/inventoryTypes/inventoryTypes.ts @@ -66,7 +66,8 @@ export type TEquipmentKey = | "Melee" | "SpecialItems" | "Sentinels" - | "SentinelWeapons"; + | "SentinelWeapons" + | "SpaceGuns"; export interface IDuviriInfo { Seed: number; diff --git a/src/types/requestTypes.ts b/src/types/requestTypes.ts index c63052c0..3da74724 100644 --- a/src/types/requestTypes.ts +++ b/src/types/requestTypes.ts @@ -10,7 +10,8 @@ import { ITypeCount, IMission, IRawUpgrade, - ISeasonChallenge + ISeasonChallenge, + TEquipmentKey } from "./inventoryTypes/inventoryTypes"; export interface IArtifactsRequest { @@ -85,7 +86,7 @@ export interface IUpdateGlyphRequest { } export interface IUpgradesRequest { - ItemCategory: string; + ItemCategory: TEquipmentKey; ItemId: IOid; ItemFeatures: number; UpgradeVersion: number; -- 2.47.2 From aebd99a88432e2545779b570331e959658274458 Mon Sep 17 00:00:00 2001 From: VampireKitten Date: Sat, 22 Jun 2024 21:10:42 +0200 Subject: [PATCH 4/4] Changed the tables for visibility Put the item lists below the buttons to add items, because otherwise adding large quantities of things gets increasingly more annoying with the constant scroll down. --- static/webui/index.html | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/static/webui/index.html b/static/webui/index.html index d19f125a..de20bf0f 100644 --- a/static/webui/index.html +++ b/static/webui/index.html @@ -112,9 +112,6 @@
Warframes
- - -
+ + +
@@ -130,13 +130,13 @@
Weapons
- - -
+ + +
@@ -191,13 +191,13 @@
Mods
- - -
+ + +
-- 2.47.2