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

feat: year rollover kiss emails (#2376)

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

1d60745f
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

4 个文件 +75 -2
Modified src/controllers/api/inventoryController.ts +52 -0
@@ -9,6 +9,7 @@ import { IPolarity, ArtifactPolarity, EquipmentFeatures } from "@/src/types/inve
9 9 import { ExportCustoms, ExportFlavour, ExportResources, ExportVirtuals } from "warframe-public-export-plus";
10 10 import { applyCheatsToInfestedFoundry, handleSubsumeCompletion } from "@/src/services/infestedFoundryService";
11 11 import {
12 addEmailItem,
12 13 addMiscItems,
13 14 allDailyAffiliationKeys,
14 15 cleanupInventory,
@@ -110,7 +111,58 @@ export const inventoryController: RequestHandler = async (request, response) =>
110 111 }
111 112
112 113 if (inventory.CalendarProgress) {
114 const previousYearIteration = inventory.CalendarProgress.Iteration;
113 115 getCalendarProgress(inventory); // handle year rollover; the client expects to receive an inventory with an up-to-date CalendarProgress
116
117 // also handle sending of kiss cinematic at year rollover
118 if (
119 inventory.CalendarProgress.Iteration != previousYearIteration &&
120 inventory.DialogueHistory &&
121 inventory.DialogueHistory.Dialogues
122 ) {
123 let kalymos = false;
124 for (const { dialogueName, kissEmail } of [
125 {
126 dialogueName: "/Lotus/Types/Gameplay/1999Wf/Dialogue/ArthurDialogue_rom.dialogue",
127 kissEmail: "/Lotus/Types/Items/EmailItems/ArthurKissEmailItem"
128 },
129 {
130 dialogueName: "/Lotus/Types/Gameplay/1999Wf/Dialogue/EleanorDialogue_rom.dialogue",
131 kissEmail: "/Lotus/Types/Items/EmailItems/EleanorKissEmailItem"
132 },
133 {
134 dialogueName: "/Lotus/Types/Gameplay/1999Wf/Dialogue/LettieDialogue_rom.dialogue",
135 kissEmail: "/Lotus/Types/Items/EmailItems/LettieKissEmailItem"
136 },
137 {
138 dialogueName: "/Lotus/Types/Gameplay/1999Wf/Dialogue/JabirDialogue_rom.dialogue",
139 kissEmail: "/Lotus/Types/Items/EmailItems/AmirKissEmailItem"
140 },
141 {
142 dialogueName: "/Lotus/Types/Gameplay/1999Wf/Dialogue/AoiDialogue_rom.dialogue",
143 kissEmail: "/Lotus/Types/Items/EmailItems/AoiKissEmailItem"
144 },
145 {
146 dialogueName: "/Lotus/Types/Gameplay/1999Wf/Dialogue/QuincyDialogue_rom.dialogue",
147 kissEmail: "/Lotus/Types/Items/EmailItems/QuincyKissEmailItem"
148 }
149 ]) {
150 const dialogue = inventory.DialogueHistory.Dialogues.find(x => x.DialogueName == dialogueName);
151 if (dialogue) {
152 if (dialogue.Rank == 7) {
153 await addEmailItem(inventory, kissEmail);
154 kalymos = false;
155 break;
156 }
157 if (dialogue.Rank == 6) {
158 kalymos = true;
159 }
160 }
161 }
162 if (kalymos) {
163 await addEmailItem(inventory, "/Lotus/Types/Items/EmailItems/KalymosKissEmailItem");
164 }
165 }
114 166 }
115 167
116 168 cleanupInventory(inventory);
Modified src/models/inboxModel.ts +4 -0
@@ -23,7 +23,9 @@ export interface IMessageDatabase extends IMessage {
23 23 export interface IMessage {
24 24 sndr: string;
25 25 msg: string;
26 cinematic?: string;
26 27 sub: string;
28 customData?: string;
27 29 icon?: string;
28 30 highPriority?: boolean;
29 31 lowPrioNewPlayers?: boolean;
@@ -102,7 +104,9 @@ const messageSchema = new Schema<IMessageDatabase>(
102 104 ownerId: Schema.Types.ObjectId,
103 105 sndr: String,
104 106 msg: String,
107 cinematic: String,
105 108 sub: String,
109 customData: String,
106 110 icon: String,
107 111 highPriority: Boolean,
108 112 lowPrioNewPlayers: Boolean,
Modified src/services/inventoryService.ts +17 -2
@@ -83,7 +83,7 @@ import { addQuestKey, completeQuest } from "@/src/services/questService";
83 83 import { handleBundleAcqusition } from "./purchaseService";
84 84 import libraryDailyTasks from "@/static/fixed_responses/libraryDailyTasks.json";
85 85 import { getRandomElement, getRandomInt, getRandomWeightedReward, SRng } from "./rngService";
86 import { createMessage } from "./inboxService";
86 import { createMessage, IMessageCreationTemplate } from "./inboxService";
87 87 import { getMaxStanding, getMinStanding } from "@/src/helpers/syndicateStandingHelper";
88 88 import { getNightwaveSyndicateTag, getWorldState } from "./worldStateService";
89 89 import { ICalendarSeason } from "@/src/types/worldStateTypes";
@@ -1563,7 +1563,22 @@ export const addEmailItem = async (
1563 1563 const meta = ExportEmailItems[typeName];
1564 1564 const emailItem = inventory.EmailItems.find(x => x.ItemType == typeName);
1565 1565 if (!emailItem || !meta.sendOnlyOnce) {
1566 await createMessage(inventory.accountOwnerId, [convertInboxMessage(meta.message)]);
1566 const msg: IMessageCreationTemplate = convertInboxMessage(meta.message);
1567 if (msg.cinematic == "/Lotus/Levels/1999/PlayerHomeBalconyCinematics.level") {
1568 msg.customData = JSON.stringify({
1569 Tag: msg.customData + "KissCin",
1570 CinLoadout: {
1571 Skins: inventory.AdultOperatorLoadOuts[0].Skins,
1572 Upgrades: inventory.AdultOperatorLoadOuts[0].Upgrades,
1573 attcol: inventory.AdultOperatorLoadOuts[0].attcol,
1574 cloth: inventory.AdultOperatorLoadOuts[0].cloth,
1575 eyecol: inventory.AdultOperatorLoadOuts[0].eyecol,
1576 pricol: inventory.AdultOperatorLoadOuts[0].pricol,
1577 syancol: inventory.AdultOperatorLoadOuts[0].syancol
1578 }
1579 });
1580 }
1581 await createMessage(inventory.accountOwnerId, [msg]);
1567 1582
1568 1583 if (emailItem) {
1569 1584 emailItem.ItemCount += 1;
Modified src/services/itemDataService.ts +2 -0
@@ -251,7 +251,9 @@ export const convertInboxMessage = (message: IInboxMessage): IMessage => {
251 251 return {
252 252 sndr: message.sender,
253 253 msg: message.body,
254 cinematic: message.cinematic,
254 255 sub: message.title,
256 customData: message.customData,
255 257 att: message.attachments.length > 0 ? message.attachments : undefined,
256 258 countedAtt: message.countedAttachments.length > 0 ? message.countedAttachments : undefined,
257 259 icon: message.icon ?? "",