From 651ab5f6f1c2578e25a97f74896fc84fcb4fafc2 Mon Sep 17 00:00:00 2001 From: Sainan Date: Sun, 16 Mar 2025 04:33:21 -0700 Subject: [PATCH] feat: death marks (#1205) Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1205 --- src/models/inventoryModels/inventoryModel.ts | 2 +- src/services/missionInventoryUpdateService.ts | 19 +++++++++++++++++++ src/types/requestTypes.ts | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/models/inventoryModels/inventoryModel.ts b/src/models/inventoryModels/inventoryModel.ts index b0a84f5f..86b9c2c8 100644 --- a/src/models/inventoryModels/inventoryModel.ts +++ b/src/models/inventoryModels/inventoryModel.ts @@ -1400,7 +1400,7 @@ const inventorySchema = new Schema( //Discount Coupon PendingCoupon: pendingCouponSchema, //Like BossAladV,BossCaptainVor come for you on missions % chance - DeathMarks: [String], + DeathMarks: { type: [String], default: [] }, //Zanuka Harvestable: Boolean, //Grustag three diff --git a/src/services/missionInventoryUpdateService.ts b/src/services/missionInventoryUpdateService.ts index fb4a936e..17f94c84 100644 --- a/src/services/missionInventoryUpdateService.ts +++ b/src/services/missionInventoryUpdateService.ts @@ -294,6 +294,25 @@ export const addMissionInventoryUpdates = async ( inventory.SeasonChallengeHistory.push(...processedCompletions); break; } + case "DeathMarks": { + for (const deathMark of value) { + if (!inventory.DeathMarks.find(x => x == deathMark)) { + // It's a new death mark; we have to say the line. + await createMessage(inventory.accountOwnerId.toString(), [ + { + sub: "/Lotus/Language/G1Quests/DeathMarkTitle", + sndr: "/Lotus/Language/G1Quests/DeathMarkSender", + msg: "/Lotus/Language/G1Quests/DeathMarkMessage", + icon: "/Lotus/Interface/Icons/Npcs/Stalker_d.png", + highPriority: true + } + ]); + // TODO: This type of inbox message seems to automatically delete itself. Figure out under which conditions. + } + } + inventory.DeathMarks = value; + break; + } default: // Equipment XP updates if (equipmentKeys.includes(key as TEquipmentKey)) { diff --git a/src/types/requestTypes.ts b/src/types/requestTypes.ts index c3777112..8d1026bf 100644 --- a/src/types/requestTypes.ts +++ b/src/types/requestTypes.ts @@ -107,6 +107,7 @@ export type IMissionInventoryUpdateRequest = { DropTable: string; DROP_MOD: number[]; }[]; + DeathMarks?: string[]; } & { [K in TEquipmentKey]?: IEquipmentClient[]; };