XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFESpaceNinjaServer

fix: also dispatch platinum inbox message in missionInventoryUpdate (#4189)

Closes #4188 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/4189 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

90899f47
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

3 个文件 +22 -12
Modified src/controllers/api/inventoryController.ts +2 -11
@@ -31,6 +31,7 @@ import {
31 31 checkCalendarAutoAdvance,
32 32 cleanupInventory,
33 33 createLibraryDailyTask,
34 dispatchPendingPremiumCredits,
34 35 ensureUserHasFounderHonoria,
35 36 ensureUserHasSteelPathRewards,
36 37 getCalendarProgress,
@@ -262,17 +263,7 @@ export const inventoryController: RequestHandler = async (request, response) =>
262 263 const forWebui = "wsid" in request.query;
263 264
264 265 if (inventory.pendingPremiumCredits && !forWebui) {
265 await createMessage(inventory.accountOwnerId, [
266 {
267 sndr: "/Lotus/Language/Bosses/Ordis",
268 msg: "/Lotus/Language/Inbox/FoundItemsBody",
269 sub: "/Lotus/Language/Inbox/FoundItemsTitle",
270 icon: "/Lotus/Interface/Icons/Npcs/Ordis.png",
271 PremiumCredits: inventory.pendingPremiumCredits,
272 highPriority: true // FoundItems messages on live have this flag, tho as we are reusing it here for platinum rewards, it's maybe questionable if it's needed, but whatever.
273 }
274 ]);
275 inventory.pendingPremiumCredits = undefined;
266 await dispatchPendingPremiumCredits(inventory);
276 267 //await inventory.save();
277 268 }
278 269
Modified src/controllers/api/missionInventoryUpdateController.ts +6 -1
@@ -7,7 +7,7 @@ import {
7 7 addMissionRewards,
8 8 handleConservation
9 9 } from "../../services/missionInventoryUpdateService.ts";
10 import { getInventory } from "../../services/inventoryService.ts";
10 import { dispatchPendingPremiumCredits, getInventory } from "../../services/inventoryService.ts";
11 11 import { getInventoryResponse } from "./inventoryController.ts";
12 12 import { logger } from "../../utils/logger.ts";
13 13 import type {
@@ -107,6 +107,11 @@ export const missionInventoryUpdateController: RequestHandler = async (req, res)
107 107 } = await addMissionRewards(account, buildLabel, inventory, missionReport, firstCompletion);
108 108 await handleConservation(inventory, buildLabel, missionReport, AffiliationMods); // Conservation reports have GS_SUCCESS
109 109
110 if (inventory.pendingPremiumCredits) {
111 await dispatchPendingPremiumCredits(inventory);
112 //await inventory.save();
113 }
114
110 115 if (missionReport.EndOfMatchUpload) {
111 116 inventory.RewardSeed = generateRewardSeed();
112 117 }
Modified src/services/inventoryService.ts +14 -0
@@ -3505,3 +3505,17 @@ export const ensureUserHasSteelPathRewards = async (
3505 3505 }
3506 3506 }
3507 3507 };
3508
3509 export const dispatchPendingPremiumCredits = async (inventory: TInventoryDatabaseDocument): Promise<void> => {
3510 await createMessage(inventory.accountOwnerId, [
3511 {
3512 sndr: "/Lotus/Language/Bosses/Ordis",
3513 msg: "/Lotus/Language/Inbox/FoundItemsBody",
3514 sub: "/Lotus/Language/Inbox/FoundItemsTitle",
3515 icon: "/Lotus/Interface/Icons/Npcs/Ordis.png",
3516 PremiumCredits: inventory.pendingPremiumCredits,
3517 highPriority: true // FoundItems messages on live have this flag, tho as we are reusing it here for platinum rewards, it's maybe questionable if it's needed, but whatever.
3518 }
3519 ]);
3520 inventory.pendingPremiumCredits = undefined;
3521 };