From 6b7b8a69d8290ef053d9923bd6dae8e5baceb5fc Mon Sep 17 00:00:00 2001 From: Sainan Date: Wed, 26 Feb 2025 03:54:31 +0100 Subject: [PATCH] handle CollectibleScans in missionInventoryUpdate --- src/services/missionInventoryUpdateService.ts | 32 +++++++++++++++++++ src/types/requestTypes.ts | 4 ++- .../kuriaMessages/fiftyPercent.json | 7 ++++ .../kuriaMessages/oneHundredPercent.json | 8 +++++ .../kuriaMessages/seventyFivePercent.json | 7 ++++ 5 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 static/fixed_responses/kuriaMessages/fiftyPercent.json create mode 100644 static/fixed_responses/kuriaMessages/oneHundredPercent.json create mode 100644 static/fixed_responses/kuriaMessages/seventyFivePercent.json diff --git a/src/services/missionInventoryUpdateService.ts b/src/services/missionInventoryUpdateService.ts index c1803a64..64814e4b 100644 --- a/src/services/missionInventoryUpdateService.ts +++ b/src/services/missionInventoryUpdateService.ts @@ -34,6 +34,10 @@ import { IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryType import { handleStoreItemAcquisition } from "./purchaseService"; import { IMissionReward } from "../types/missionTypes"; import { crackRelic } from "@/src/helpers/relicHelper"; +import { createMessage } from "./inboxService"; +import kuriaMessage50 from "@/static/fixed_responses/kuriaMessages/fiftyPercent.json"; +import kuriaMessage75 from "@/static/fixed_responses/kuriaMessages/seventyFivePercent.json"; +import kuriaMessage100 from "@/static/fixed_responses/kuriaMessages/oneHundredPercent.json"; const getRotations = (rotationCount: number): number[] => { if (rotationCount === 0) return [0]; @@ -201,6 +205,34 @@ export const addMissionInventoryUpdates = ( } }); break; + case "CollectibleScans": + value.forEach(scan => { + const entry = inventory.CollectibleSeries?.find(x => x.CollectibleType == scan.CollectibleType); + if (entry) { + entry.Count = scan.Count; + entry.Tracking = scan.Tracking; + if (entry.CollectibleType == "/Lotus/Objects/Orokin/Props/CollectibleSeriesOne") { + const progress = entry.Count / entry.ReqScans; + entry.IncentiveStates.forEach(gate => { + gate.complete = progress >= gate.threshold; + if (gate.complete && !gate.sent) { + gate.sent = true; + if (gate.threshold == 0.5) { + void createMessage(inventory.accountOwnerId.toString(), [kuriaMessage50]); + } else { + void createMessage(inventory.accountOwnerId.toString(), [kuriaMessage75]); + } + } + }); + if (progress >= 1.0) { + void createMessage(inventory.accountOwnerId.toString(), [kuriaMessage100]); + } + } + } else { + logger.warn(`${scan.CollectibleType} was not found in inventory, ignoring scans`); + } + }); + break; case "Upgrades": value.forEach(clientUpgrade => { const upgrade = inventory.Upgrades.id(clientUpgrade.ItemId.$oid)!; diff --git a/src/types/requestTypes.ts b/src/types/requestTypes.ts index 9ebf3adb..2584bd77 100644 --- a/src/types/requestTypes.ts +++ b/src/types/requestTypes.ts @@ -15,7 +15,8 @@ import { IPlayerSkills, IQuestKeyDatabase, ILoreFragmentScan, - IUpgradeClient + IUpgradeClient, + ICollectibleEntry } from "./inventoryTypes/inventoryTypes"; export interface IThemeUpdateRequest { @@ -99,6 +100,7 @@ export type IMissionInventoryUpdateRequest = { CodexScanCount: number; Standing: number; }[]; + CollectibleScans?: ICollectibleEntry[]; Upgrades?: IUpgradeClient[]; // riven challenge progress } & { [K in TEquipmentKey]?: IEquipmentClient[]; diff --git a/static/fixed_responses/kuriaMessages/fiftyPercent.json b/static/fixed_responses/kuriaMessages/fiftyPercent.json new file mode 100644 index 00000000..8466a215 --- /dev/null +++ b/static/fixed_responses/kuriaMessages/fiftyPercent.json @@ -0,0 +1,7 @@ +{ + "sub": "/Lotus/Language/Oddities/SeriesOne50PercentInboxMessageSubject", + "sndr": "/Lotus/Language/Menu/ScribeName", + "msg": "/Lotus/Language/Oddities/SeriesOne50PercentInboxMessage", + "icon": "/Lotus/Interface/Icons/Syndicates/FactionOddityGold.png", + "att": ["/Lotus/Upgrades/Skins/Clan/OrokittyBadgeItem"] +} diff --git a/static/fixed_responses/kuriaMessages/oneHundredPercent.json b/static/fixed_responses/kuriaMessages/oneHundredPercent.json new file mode 100644 index 00000000..3e73e97a --- /dev/null +++ b/static/fixed_responses/kuriaMessages/oneHundredPercent.json @@ -0,0 +1,8 @@ +{ + "sub": "/Lotus/Language/Oddities/SeriesOneRewardSubject", + "sndr": "/Lotus/Language/Menu/ScribeName", + "msg": "/Lotus/Language/Oddities/SeriesOneRewardInboxMessage", + "icon": "/Lotus/Interface/Icons/Syndicates/FactionOddityGold.png", + "att": ["/Lotus/Types/Items/ShipDecos/OrokinFelisBobbleHead"], + "highPriority": true +} diff --git a/static/fixed_responses/kuriaMessages/seventyFivePercent.json b/static/fixed_responses/kuriaMessages/seventyFivePercent.json new file mode 100644 index 00000000..fe496790 --- /dev/null +++ b/static/fixed_responses/kuriaMessages/seventyFivePercent.json @@ -0,0 +1,7 @@ +{ + "sub": "/Lotus/Language/Oddities/SeriesOne75PercentInboxMessageSubject", + "sndr": "/Lotus/Language/Menu/ScribeName", + "msg": "/Lotus/Language/Oddities/SeriesOne75PercentInboxMessage", + "icon": "/Lotus/Interface/Icons/Syndicates/FactionOddityGold.png", + "att": ["/Lotus/Types/StoreItems/AvatarImages/AvatarImageOroKitty"] +}