From b4da4575011c85e723beaf71c5d8f236e8d1ddc1 Mon Sep 17 00:00:00 2001 From: Sainan Date: Mon, 17 Mar 2025 12:23:17 -0700 Subject: [PATCH] feat: mastery rank up inbox message (#1206) Closes #1203 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1206 Co-authored-by: Sainan Co-committed-by: Sainan --- .../api/trainingResultController.ts | 20 +++++++++++++++++++ src/models/inboxModel.ts | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/controllers/api/trainingResultController.ts b/src/controllers/api/trainingResultController.ts index 022d6c10..a9bc196e 100644 --- a/src/controllers/api/trainingResultController.ts +++ b/src/controllers/api/trainingResultController.ts @@ -5,6 +5,7 @@ import { IMongoDate } from "@/src/types/commonTypes"; import { RequestHandler } from "express"; import { unixTimesInMs } from "@/src/constants/timeConstants"; import { IInventoryChanges } from "@/src/types/purchaseTypes"; +import { createMessage } from "@/src/services/inboxService"; interface ITrainingResultsRequest { numLevelsGained: number; @@ -26,6 +27,25 @@ const trainingResultController: RequestHandler = async (req, res): Promise if (trainingResults.numLevelsGained == 1) { inventory.TrainingDate = new Date(Date.now() + unixTimesInMs.hour * 23); inventory.PlayerLevel += 1; + + await createMessage(accountId, [ + { + sndr: "/Lotus/Language/Menu/Mailbox_WarframeSender", + msg: "/Lotus/Language/Inbox/MasteryRewardMsg", + arg: [ + { + Key: "NEW_RANK", + Tag: inventory.PlayerLevel + } + ], + att: [ + `/Lotus/Types/Items/ShipDecos/MasteryTrophies/Rank${inventory.PlayerLevel.toString().padStart(2, "0")}Trophy` + ], + sub: "/Lotus/Language/Inbox/MasteryRewardTitle", + icon: "/Lotus/Interface/Icons/Npcs/Lotus_d.png", + highPriority: true + } + ]); } const changedinventory = await inventory.save(); diff --git a/src/models/inboxModel.ts b/src/models/inboxModel.ts index c7c5e563..c3ad8add 100644 --- a/src/models/inboxModel.ts +++ b/src/models/inboxModel.ts @@ -40,7 +40,7 @@ export interface IMessage { export interface Arg { Key: string; - Tag: string; + Tag: string | number; } //types are wrong @@ -99,7 +99,7 @@ const messageSchema = new Schema( type: [ { Key: String, - Tag: String, + Tag: Schema.Types.Mixed, _id: false } ],