From aaa985e1ae16a357930a8bfcf91100f02de304ab Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Tue, 22 Apr 2025 21:33:11 +0200 Subject: [PATCH 01/10] feat: conquest progression --- .../api/missionInventoryUpdateController.ts | 10 ++++++++-- src/services/missionInventoryUpdateService.ts | 9 +-------- src/types/missionTypes.ts | 19 +++++++++++++++++++ src/types/requestTypes.ts | 1 + 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/src/controllers/api/missionInventoryUpdateController.ts b/src/controllers/api/missionInventoryUpdateController.ts index ead3b56e..d8bf8ac9 100644 --- a/src/controllers/api/missionInventoryUpdateController.ts +++ b/src/controllers/api/missionInventoryUpdateController.ts @@ -6,6 +6,7 @@ import { addMissionInventoryUpdates, addMissionRewards } from "@/src/services/mi import { getInventory } from "@/src/services/inventoryService"; import { getInventoryResponse } from "./inventoryController"; import { logger } from "@/src/utils/logger"; +import { IMissionInventoryUpdateResponse } from "@/src/types/missionTypes"; /* **** INPUT **** @@ -78,7 +79,7 @@ export const missionInventoryUpdateController: RequestHandler = async (req, res) const inventoryResponse = await getInventoryResponse(inventory, true); //TODO: figure out when to send inventory. it is needed for many cases. - res.json({ + const response: IMissionInventoryUpdateResponse = { InventoryJson: JSON.stringify(inventoryResponse), InventoryChanges: inventoryChanges, MissionRewards, @@ -87,7 +88,12 @@ export const missionInventoryUpdateController: RequestHandler = async (req, res) //FusionPoints: inventoryChanges?.FusionPoints, // This in combination with InventoryJson or InventoryChanges seems to just double the number of endo shown, so unsure when this is needed. SyndicateXPItemReward, AffiliationMods - }); + }; + if (missionReport.ConquestMissionsCompleted !== undefined) { + response.ConquestCompletedMissionsCount = + missionReport.ConquestMissionsCompleted == 2 ? 0 : missionReport.ConquestMissionsCompleted + 1; + } + res.json(response); }; /* diff --git a/src/services/missionInventoryUpdateService.ts b/src/services/missionInventoryUpdateService.ts index 46d039c1..0b6cb5ff 100644 --- a/src/services/missionInventoryUpdateService.ts +++ b/src/services/missionInventoryUpdateService.ts @@ -43,7 +43,7 @@ import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/invento import { getEntriesUnsafe } from "@/src/utils/ts-utils"; import { IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes"; import { handleStoreItemAcquisition } from "./purchaseService"; -import { IMissionReward } from "../types/missionTypes"; +import { IMissionCredits, IMissionReward } from "../types/missionTypes"; import { crackRelic } from "@/src/helpers/relicHelper"; import { createMessage } from "./inboxService"; import kuriaMessage50 from "@/static/fixed_responses/kuriaMessages/fiftyPercent.json"; @@ -885,13 +885,6 @@ export const addMissionRewards = async ( return { inventoryChanges, MissionRewards, credits, AffiliationMods, SyndicateXPItemReward }; }; -interface IMissionCredits { - MissionCredits: number[]; - CreditBonus: number[]; - TotalCredits: number[]; - DailyMissionBonus?: boolean; -} - //creditBonus is not entirely accurate. //TODO: consider ActiveBoosters export const addCredits = ( diff --git a/src/types/missionTypes.ts b/src/types/missionTypes.ts index c8cab373..be1d08bc 100644 --- a/src/types/missionTypes.ts +++ b/src/types/missionTypes.ts @@ -1,3 +1,5 @@ +import { IAffiliationMods, IInventoryChanges } from "./purchaseTypes"; + export const inventoryFields = ["RawUpgrades", "MiscItems", "Consumables", "Recipes"] as const; export type IInventoryFieldType = (typeof inventoryFields)[number]; @@ -11,3 +13,20 @@ export interface IMissionReward { FromEnemyCache?: boolean; IsStrippedItem?: boolean; } + +export interface IMissionCredits { + MissionCredits: number[]; + CreditBonus: number[]; + TotalCredits: number[]; + DailyMissionBonus?: boolean; +} + +export interface IMissionInventoryUpdateResponse extends Partial { + ConquestCompletedMissionsCount?: number; + InventoryJson?: string; + MissionRewards?: IMissionReward[]; + InventoryChanges?: IInventoryChanges; + FusionPoints?: number; + SyndicateXPItemReward?: number; + AffiliationMods?: IAffiliationMods[]; +} diff --git a/src/types/requestTypes.ts b/src/types/requestTypes.ts index b81fa064..652ea65e 100644 --- a/src/types/requestTypes.ts +++ b/src/types/requestTypes.ts @@ -125,6 +125,7 @@ export type IMissionInventoryUpdateRequest = { wagerTier?: number; // the index creditsFee?: number; // the index InvasionProgress?: IInvasionProgressClient[]; + ConquestMissionsCompleted?: number; } & { [K in TEquipmentKey]?: IEquipmentClient[]; }; -- 2.47.2 From 5da66a1b3bfc2fb49824f0d6ea9a312ef1744ddd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=81nis?= Date: Tue, 22 Apr 2025 15:23:28 -0700 Subject: [PATCH 02/10] feat: conquest research points (#1796) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1796 Co-authored-by: Jānis Co-committed-by: Jānis --- .../api/missionInventoryUpdateController.ts | 23 +++++----- src/services/missionInventoryUpdateService.ts | 45 ++++++++++++++++++- src/types/requestTypes.ts | 7 ++- 3 files changed, 62 insertions(+), 13 deletions(-) diff --git a/src/controllers/api/missionInventoryUpdateController.ts b/src/controllers/api/missionInventoryUpdateController.ts index d8bf8ac9..d3f0978b 100644 --- a/src/controllers/api/missionInventoryUpdateController.ts +++ b/src/controllers/api/missionInventoryUpdateController.ts @@ -72,14 +72,19 @@ export const missionInventoryUpdateController: RequestHandler = async (req, res) return; } - const { MissionRewards, inventoryChanges, credits, AffiliationMods, SyndicateXPItemReward } = - await addMissionRewards(inventory, missionReport, firstCompletion); + const { + MissionRewards, + inventoryChanges, + credits, + AffiliationMods, + SyndicateXPItemReward, + ConquestCompletedMissionsCount + } = await addMissionRewards(inventory, missionReport, firstCompletion); await inventory.save(); const inventoryResponse = await getInventoryResponse(inventory, true); - //TODO: figure out when to send inventory. it is needed for many cases. - const response: IMissionInventoryUpdateResponse = { + res.json({ InventoryJson: JSON.stringify(inventoryResponse), InventoryChanges: inventoryChanges, MissionRewards, @@ -87,13 +92,9 @@ export const missionInventoryUpdateController: RequestHandler = async (req, res) ...inventoryUpdates, //FusionPoints: inventoryChanges?.FusionPoints, // This in combination with InventoryJson or InventoryChanges seems to just double the number of endo shown, so unsure when this is needed. SyndicateXPItemReward, - AffiliationMods - }; - if (missionReport.ConquestMissionsCompleted !== undefined) { - response.ConquestCompletedMissionsCount = - missionReport.ConquestMissionsCompleted == 2 ? 0 : missionReport.ConquestMissionsCompleted + 1; - } - res.json(response); + AffiliationMods, + ConquestCompletedMissionsCount + } satisfies IMissionInventoryUpdateResponse); }; /* diff --git a/src/services/missionInventoryUpdateService.ts b/src/services/missionInventoryUpdateService.ts index 0b6cb5ff..257be812 100644 --- a/src/services/missionInventoryUpdateService.ts +++ b/src/services/missionInventoryUpdateService.ts @@ -586,6 +586,7 @@ interface AddMissionRewardsReturnType { credits?: IMissionCredits; AffiliationMods?: IAffiliationMods[]; SyndicateXPItemReward?: number; + ConquestCompletedMissionsCount?: number; } //TODO: return type of partial missioninventoryupdate response @@ -620,6 +621,7 @@ export const addMissionRewards = async ( const inventoryChanges: IInventoryChanges = {}; const AffiliationMods: IAffiliationMods[] = []; let SyndicateXPItemReward; + let ConquestCompletedMissionsCount; let missionCompletionCredits = 0; //inventory change is what the client has not rewarded itself, also the client needs to know the credit changes for display @@ -882,7 +884,48 @@ export const addMissionRewards = async ( } } - return { inventoryChanges, MissionRewards, credits, AffiliationMods, SyndicateXPItemReward }; + if (rewardInfo.ConquestCompleted !== undefined) { + let score = 1; + if (rewardInfo.ConquestHardModeActive === 1) score += 3; + + if (rewardInfo.ConquestPersonalModifiersActive !== undefined) + score += rewardInfo.ConquestPersonalModifiersActive; + if (rewardInfo.ConquestEquipmentSuggestionsFulfilled !== undefined) + score += rewardInfo.ConquestEquipmentSuggestionsFulfilled; + + score *= rewardInfo.ConquestCompleted + 1; + + if (rewardInfo.ConquestCompleted == 2 && rewardInfo.ConquestHardModeActive === 1) score += 1; + + const conquestType = rewardInfo.ConquestType; + const conquestNode = + conquestType == "HexConquest" ? "EchoesHexConquestHardModeUnlocked" : "EntratiLabConquestHardModeUnlocked"; + if (score >= 25 && inventory.NodeIntrosCompleted.find(x => x == conquestNode) === undefined) + inventory.NodeIntrosCompleted.push(conquestNode); + + if (conquestType == "HexConquest") { + inventory.EchoesHexConquestCacheScoreMission ??= 0; + + if (score > inventory.EchoesHexConquestCacheScoreMission) + inventory.EchoesHexConquestCacheScoreMission = score; + } else { + inventory.EntratiLabConquestCacheScoreMission ??= 0; + + if (score > inventory.EntratiLabConquestCacheScoreMission) + inventory.EntratiLabConquestCacheScoreMission = score; + } + + ConquestCompletedMissionsCount = rewardInfo.ConquestCompleted == 2 ? 0 : rewardInfo.ConquestCompleted + 1; + } + + return { + inventoryChanges, + MissionRewards, + credits, + AffiliationMods, + SyndicateXPItemReward, + ConquestCompletedMissionsCount + }; }; //creditBonus is not entirely accurate. diff --git a/src/types/requestTypes.ts b/src/types/requestTypes.ts index 652ea65e..441bf03e 100644 --- a/src/types/requestTypes.ts +++ b/src/types/requestTypes.ts @@ -151,7 +151,12 @@ export interface IRewardInfo { PurgatoryRewardQualifications?: string; rewardSeed?: number | bigint; periodicMissionTag?: string; - + ConquestType?: string; + ConquestCompleted?: number; + ConquestEquipmentSuggestionsFulfilled?: number; + ConquestPersonalModifiersActive?: number; + ConquestStickersActive?: number; + ConquestHardModeActive?: number; // for bounties, only EOM_AFK and node are given from above, plus: JobTier?: number; jobId?: string; -- 2.47.2 From f609850c0c612a078267d33bdefa263e7e8fbbba Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Wed, 23 Apr 2025 00:27:16 +0200 Subject: [PATCH 03/10] reset 'high score' at week rollover --- src/controllers/api/entratiLabConquestModeController.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/controllers/api/entratiLabConquestModeController.ts b/src/controllers/api/entratiLabConquestModeController.ts index ae7b5845..e5b6c818 100644 --- a/src/controllers/api/entratiLabConquestModeController.ts +++ b/src/controllers/api/entratiLabConquestModeController.ts @@ -21,10 +21,12 @@ export const entratiLabConquestModeController: RequestHandler = async (req, res) inventory.EntratiVaultCountResetDate = new Date(weekEnd); if (inventory.EntratiLabConquestUnlocked) { inventory.EntratiLabConquestUnlocked = 0; + inventory.EntratiLabConquestCacheScoreMission = 0; inventory.EntratiLabConquestActiveFrameVariants = []; } if (inventory.EchoesHexConquestUnlocked) { inventory.EchoesHexConquestUnlocked = 0; + inventory.EchoesHexConquestCacheScoreMission = 0; inventory.EchoesHexConquestActiveFrameVariants = []; inventory.EchoesHexConquestActiveStickers = []; } -- 2.47.2 From ad2e13c1a8ca69686fe1d38661db7abc7725bc80 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Wed, 23 Apr 2025 03:28:35 +0200 Subject: [PATCH 04/10] move this logic before MissionRewards are discharged --- src/services/missionInventoryUpdateService.ts | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/src/services/missionInventoryUpdateService.ts b/src/services/missionInventoryUpdateService.ts index 257be812..1d985a1e 100644 --- a/src/services/missionInventoryUpdateService.ts +++ b/src/services/missionInventoryUpdateService.ts @@ -693,6 +693,40 @@ export const addMissionRewards = async ( }); } + if (rewardInfo.ConquestCompleted !== undefined) { + let score = 1; + if (rewardInfo.ConquestHardModeActive === 1) score += 3; + + if (rewardInfo.ConquestPersonalModifiersActive !== undefined) + score += rewardInfo.ConquestPersonalModifiersActive; + if (rewardInfo.ConquestEquipmentSuggestionsFulfilled !== undefined) + score += rewardInfo.ConquestEquipmentSuggestionsFulfilled; + + score *= rewardInfo.ConquestCompleted + 1; + + if (rewardInfo.ConquestCompleted == 2 && rewardInfo.ConquestHardModeActive === 1) score += 1; + + const conquestType = rewardInfo.ConquestType; + const conquestNode = + conquestType == "HexConquest" ? "EchoesHexConquestHardModeUnlocked" : "EntratiLabConquestHardModeUnlocked"; + if (score >= 25 && inventory.NodeIntrosCompleted.find(x => x == conquestNode) === undefined) + inventory.NodeIntrosCompleted.push(conquestNode); + + if (conquestType == "HexConquest") { + inventory.EchoesHexConquestCacheScoreMission ??= 0; + + if (score > inventory.EchoesHexConquestCacheScoreMission) + inventory.EchoesHexConquestCacheScoreMission = score; + } else { + inventory.EntratiLabConquestCacheScoreMission ??= 0; + + if (score > inventory.EntratiLabConquestCacheScoreMission) + inventory.EntratiLabConquestCacheScoreMission = score; + } + + ConquestCompletedMissionsCount = rewardInfo.ConquestCompleted == 2 ? 0 : rewardInfo.ConquestCompleted + 1; + } + for (const reward of MissionRewards) { const inventoryChange = await handleStoreItemAcquisition( reward.StoreItem, @@ -884,40 +918,6 @@ export const addMissionRewards = async ( } } - if (rewardInfo.ConquestCompleted !== undefined) { - let score = 1; - if (rewardInfo.ConquestHardModeActive === 1) score += 3; - - if (rewardInfo.ConquestPersonalModifiersActive !== undefined) - score += rewardInfo.ConquestPersonalModifiersActive; - if (rewardInfo.ConquestEquipmentSuggestionsFulfilled !== undefined) - score += rewardInfo.ConquestEquipmentSuggestionsFulfilled; - - score *= rewardInfo.ConquestCompleted + 1; - - if (rewardInfo.ConquestCompleted == 2 && rewardInfo.ConquestHardModeActive === 1) score += 1; - - const conquestType = rewardInfo.ConquestType; - const conquestNode = - conquestType == "HexConquest" ? "EchoesHexConquestHardModeUnlocked" : "EntratiLabConquestHardModeUnlocked"; - if (score >= 25 && inventory.NodeIntrosCompleted.find(x => x == conquestNode) === undefined) - inventory.NodeIntrosCompleted.push(conquestNode); - - if (conquestType == "HexConquest") { - inventory.EchoesHexConquestCacheScoreMission ??= 0; - - if (score > inventory.EchoesHexConquestCacheScoreMission) - inventory.EchoesHexConquestCacheScoreMission = score; - } else { - inventory.EntratiLabConquestCacheScoreMission ??= 0; - - if (score > inventory.EntratiLabConquestCacheScoreMission) - inventory.EntratiLabConquestCacheScoreMission = score; - } - - ConquestCompletedMissionsCount = rewardInfo.ConquestCompleted == 2 ? 0 : rewardInfo.ConquestCompleted + 1; - } - return { inventoryChanges, MissionRewards, -- 2.47.2 From ed21f454916f89873e70404087dd4d0eb3871f4a Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Wed, 23 Apr 2025 03:29:23 +0200 Subject: [PATCH 05/10] remove needless lambda --- src/services/missionInventoryUpdateService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/missionInventoryUpdateService.ts b/src/services/missionInventoryUpdateService.ts index 1d985a1e..f4e0e323 100644 --- a/src/services/missionInventoryUpdateService.ts +++ b/src/services/missionInventoryUpdateService.ts @@ -709,7 +709,7 @@ export const addMissionRewards = async ( const conquestType = rewardInfo.ConquestType; const conquestNode = conquestType == "HexConquest" ? "EchoesHexConquestHardModeUnlocked" : "EntratiLabConquestHardModeUnlocked"; - if (score >= 25 && inventory.NodeIntrosCompleted.find(x => x == conquestNode) === undefined) + if (score >= 25 && inventory.NodeIntrosCompleted.indexOf(conquestNode) == -1) inventory.NodeIntrosCompleted.push(conquestNode); if (conquestType == "HexConquest") { -- 2.47.2 From bff08c4767d2f3bb4e3308114b1965116b92dcc2 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Wed, 23 Apr 2025 03:37:31 +0200 Subject: [PATCH 06/10] lab conquest rewards --- src/services/missionInventoryUpdateService.ts | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/src/services/missionInventoryUpdateService.ts b/src/services/missionInventoryUpdateService.ts index f4e0e323..88350e5e 100644 --- a/src/services/missionInventoryUpdateService.ts +++ b/src/services/missionInventoryUpdateService.ts @@ -589,6 +589,74 @@ interface AddMissionRewardsReturnType { ConquestCompletedMissionsCount?: number; } +interface IConquestReward { + at: number; + pool: IRngResult[]; +} + +const labConquestRewards: IConquestReward[] = [ + { + at: 5, + pool: ExportRewards[ + "/Lotus/Types/Game/MissionDecks/EntratiLabConquestRewards/EntratiLabConquestSilverRewards" + ][0] as IRngResult[] + }, + { + at: 10, + pool: ExportRewards[ + "/Lotus/Types/Game/MissionDecks/EntratiLabConquestRewards/EntratiLabConquestSilverRewards" + ][0] as IRngResult[] + }, + { + at: 15, + pool: [ + { + type: "/Lotus/StoreItems/Types/Gameplay/EntratiLab/Resources/EntratiLanthornBundle", + itemCount: 3, + probability: 1 + } + ] + }, + { + at: 20, + pool: ExportRewards[ + "/Lotus/Types/Game/MissionDecks/EntratiLabConquestRewards/EntratiLabConquestGoldRewards" + ][0] as IRngResult[] + }, + { + at: 28, + pool: [ + { + type: "/Lotus/StoreItems/Types/Items/MiscItems/DistillPoints", + itemCount: 20, + probability: 1 + } + ] + }, + { + at: 31, + pool: ExportRewards[ + "/Lotus/Types/Game/MissionDecks/EntratiLabConquestRewards/EntratiLabConquestGoldRewards" + ][0] as IRngResult[] + }, + { + at: 34, + pool: ExportRewards[ + "/Lotus/Types/Game/MissionDecks/EntratiLabConquestRewards/EntratiLabConquestArcaneRewards" + ][0] as IRngResult[] + }, + { + at: 37, + pool: [ + { + type: "/Lotus/StoreItems/Types/Items/MiscItems/DistillPoints", + itemCount: 20, + probability: 1 + } + ] + } +]; + //TODO: return type of partial missioninventoryupdate response export const addMissionRewards = async ( inventory: TInventoryDatabaseDocument, @@ -706,6 +774,8 @@ export const addMissionRewards = async ( if (rewardInfo.ConquestCompleted == 2 && rewardInfo.ConquestHardModeActive === 1) score += 1; + logger.debug(`completed conquest mission ${rewardInfo.ConquestCompleted + 1} for a score of ${score}`); + const conquestType = rewardInfo.ConquestType; const conquestNode = conquestType == "HexConquest" ? "EchoesHexConquestHardModeUnlocked" : "EntratiLabConquestHardModeUnlocked"; @@ -720,6 +790,17 @@ export const addMissionRewards = async ( } else { inventory.EntratiLabConquestCacheScoreMission ??= 0; + for (const reward of labConquestRewards) { + if (score >= reward.at && inventory.EntratiLabConquestCacheScoreMission < reward.at) { + const rolled = getRandomReward(reward.pool)!; + logger.debug(`rolled lab conquest reward for reaching ${reward.at} points`, rolled); + MissionRewards.push({ + StoreItem: rolled.type, + ItemCount: rolled.itemCount + }); + } + } + if (score > inventory.EntratiLabConquestCacheScoreMission) inventory.EntratiLabConquestCacheScoreMission = score; } -- 2.47.2 From 837d4816334e18862f144d181701cca00b75a5a2 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Wed, 23 Apr 2025 03:49:51 +0200 Subject: [PATCH 07/10] fix 37 points reward --- src/services/missionInventoryUpdateService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/missionInventoryUpdateService.ts b/src/services/missionInventoryUpdateService.ts index 88350e5e..7c8a7f6a 100644 --- a/src/services/missionInventoryUpdateService.ts +++ b/src/services/missionInventoryUpdateService.ts @@ -650,7 +650,7 @@ const labConquestRewards: IConquestReward[] = [ pool: [ { type: "/Lotus/StoreItems/Types/Items/MiscItems/DistillPoints", - itemCount: 20, + itemCount: 50, probability: 1 } ] -- 2.47.2 From 38112dcdf4d26af001a49e6f40a3c6f6cdc37a3d Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Wed, 23 Apr 2025 03:52:11 +0200 Subject: [PATCH 08/10] don't even try for rewards if score is not a new PB --- src/services/missionInventoryUpdateService.ts | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/services/missionInventoryUpdateService.ts b/src/services/missionInventoryUpdateService.ts index 7c8a7f6a..aafff902 100644 --- a/src/services/missionInventoryUpdateService.ts +++ b/src/services/missionInventoryUpdateService.ts @@ -789,20 +789,19 @@ export const addMissionRewards = async ( inventory.EchoesHexConquestCacheScoreMission = score; } else { inventory.EntratiLabConquestCacheScoreMission ??= 0; - - for (const reward of labConquestRewards) { - if (score >= reward.at && inventory.EntratiLabConquestCacheScoreMission < reward.at) { - const rolled = getRandomReward(reward.pool)!; - logger.debug(`rolled lab conquest reward for reaching ${reward.at} points`, rolled); - MissionRewards.push({ - StoreItem: rolled.type, - ItemCount: rolled.itemCount - }); + if (score > inventory.EntratiLabConquestCacheScoreMission) { + for (const reward of labConquestRewards) { + if (score >= reward.at && inventory.EntratiLabConquestCacheScoreMission < reward.at) { + const rolled = getRandomReward(reward.pool)!; + logger.debug(`rolled lab conquest reward for reaching ${reward.at} points`, rolled); + MissionRewards.push({ + StoreItem: rolled.type, + ItemCount: rolled.itemCount + }); + } } - } - - if (score > inventory.EntratiLabConquestCacheScoreMission) inventory.EntratiLabConquestCacheScoreMission = score; + } } ConquestCompletedMissionsCount = rewardInfo.ConquestCompleted == 2 ? 0 : rewardInfo.ConquestCompleted + 1; -- 2.47.2 From cbfbb1e903001255ea9098baf7b5e1add09ee0fd Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Wed, 23 Apr 2025 03:52:28 +0200 Subject: [PATCH 09/10] add hex conquest rewards --- package-lock.json | 8 +- package.json | 2 +- src/services/missionInventoryUpdateService.ts | 77 ++++++++++++++++++- 3 files changed, 80 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 081c89a6..573523c5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "morgan": "^1.10.0", "ncp": "^2.0.0", "typescript": "^5.5", - "warframe-public-export-plus": "^0.5.56", + "warframe-public-export-plus": "^0.5.57", "warframe-riven-info": "^0.1.2", "winston": "^3.17.0", "winston-daily-rotate-file": "^5.0.0" @@ -3789,9 +3789,9 @@ } }, "node_modules/warframe-public-export-plus": { - "version": "0.5.56", - "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.56.tgz", - "integrity": "sha512-px+J7tUm6fkSzwKkvL73ySQReDq9oM1UrHSLM3vbYGBvELM892iBgPYG45okIhScCSdwmmXTiWZTf4x/I4qiNQ==" + "version": "0.5.57", + "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.57.tgz", + "integrity": "sha512-CKbg7/2hSDH7I7yYSWwkrP4N2rEAEK1vNEuehj+RD9vMvl1c4u6klHLMwdh+ULxXiW4djWIlNIhs5bi/fm58Mg==" }, "node_modules/warframe-riven-info": { "version": "0.1.2", diff --git a/package.json b/package.json index 15f4597c..330ed606 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "morgan": "^1.10.0", "ncp": "^2.0.0", "typescript": "^5.5", - "warframe-public-export-plus": "^0.5.56", + "warframe-public-export-plus": "^0.5.57", "warframe-riven-info": "^0.1.2", "winston": "^3.17.0", "winston-daily-rotate-file": "^5.0.0" diff --git a/src/services/missionInventoryUpdateService.ts b/src/services/missionInventoryUpdateService.ts index aafff902..f03dda81 100644 --- a/src/services/missionInventoryUpdateService.ts +++ b/src/services/missionInventoryUpdateService.ts @@ -657,6 +657,69 @@ const labConquestRewards: IConquestReward[] = [ } ]; +const hexConquestRewards: IConquestReward[] = [ + { + at: 5, + pool: ExportRewards[ + "/Lotus/Types/Game/MissionDecks/1999ConquestRewards/1999ConquestSilverRewards" + ][0] as IRngResult[] + }, + { + at: 10, + pool: ExportRewards[ + "/Lotus/Types/Game/MissionDecks/1999ConquestRewards/1999ConquestSilverRewards" + ][0] as IRngResult[] + }, + { + at: 15, + pool: [ + { + type: "/Lotus/StoreItems/Types/BoosterPacks/1999StickersPackEchoesArchimedea", + itemCount: 1, + probability: 1 + } + ] + }, + { + at: 20, + pool: ExportRewards[ + "/Lotus/Types/Game/MissionDecks/1999ConquestRewards/1999ConquestGoldRewards" + ][0] as IRngResult[] + }, + { + at: 28, + pool: [ + { + type: "/Lotus/StoreItems/Types/Items/MiscItems/1999ConquestBucks", + itemCount: 6, + probability: 1 + } + ] + }, + { + at: 31, + pool: ExportRewards[ + "/Lotus/Types/Game/MissionDecks/1999ConquestRewards/1999ConquestGoldRewards" + ][0] as IRngResult[] + }, + { + at: 34, + pool: ExportRewards[ + "/Lotus/Types/Game/MissionDecks/1999ConquestRewards/1999ConquestArcaneRewards" + ][0] as IRngResult[] + }, + { + at: 37, + pool: [ + { + type: "/Lotus/StoreItems/Types/Items/MiscItems/1999ConquestBucks", + itemCount: 9, + probability: 1 + } + ] + } +]; + //TODO: return type of partial missioninventoryupdate response export const addMissionRewards = async ( inventory: TInventoryDatabaseDocument, @@ -784,9 +847,19 @@ export const addMissionRewards = async ( if (conquestType == "HexConquest") { inventory.EchoesHexConquestCacheScoreMission ??= 0; - - if (score > inventory.EchoesHexConquestCacheScoreMission) + if (score > inventory.EchoesHexConquestCacheScoreMission) { + for (const reward of hexConquestRewards) { + if (score >= reward.at && inventory.EchoesHexConquestCacheScoreMission < reward.at) { + const rolled = getRandomReward(reward.pool)!; + logger.debug(`rolled hex conquest reward for reaching ${reward.at} points`, rolled); + MissionRewards.push({ + StoreItem: rolled.type, + ItemCount: rolled.itemCount + }); + } + } inventory.EchoesHexConquestCacheScoreMission = score; + } } else { inventory.EntratiLabConquestCacheScoreMission ??= 0; if (score > inventory.EntratiLabConquestCacheScoreMission) { -- 2.47.2 From c58a9e5229ac9af3bb320b0c8eb7cfaff9eb5ceb Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Wed, 23 Apr 2025 06:24:21 +0200 Subject: [PATCH 10/10] this should not have been removed --- src/controllers/api/missionInventoryUpdateController.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/controllers/api/missionInventoryUpdateController.ts b/src/controllers/api/missionInventoryUpdateController.ts index d3f0978b..bde1c3cf 100644 --- a/src/controllers/api/missionInventoryUpdateController.ts +++ b/src/controllers/api/missionInventoryUpdateController.ts @@ -84,6 +84,7 @@ export const missionInventoryUpdateController: RequestHandler = async (req, res) await inventory.save(); const inventoryResponse = await getInventoryResponse(inventory, true); + //TODO: figure out when to send inventory. it is needed for many cases. res.json({ InventoryJson: JSON.stringify(inventoryResponse), InventoryChanges: inventoryChanges, -- 2.47.2