forked from OpenWF/SpaceNinjaServer
		
	feat: year rollover kiss emails (#2376)
Closes #2375 Reviewed-on: OpenWF/SpaceNinjaServer#2376 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									a9b3b16d31
								
							
						
					
					
						commit
						1d60745f18
					
				@ -9,6 +9,7 @@ import { IPolarity, ArtifactPolarity, EquipmentFeatures } from "@/src/types/inve
 | 
				
			|||||||
import { ExportCustoms, ExportFlavour, ExportResources, ExportVirtuals } from "warframe-public-export-plus";
 | 
					import { ExportCustoms, ExportFlavour, ExportResources, ExportVirtuals } from "warframe-public-export-plus";
 | 
				
			||||||
import { applyCheatsToInfestedFoundry, handleSubsumeCompletion } from "@/src/services/infestedFoundryService";
 | 
					import { applyCheatsToInfestedFoundry, handleSubsumeCompletion } from "@/src/services/infestedFoundryService";
 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
 | 
					    addEmailItem,
 | 
				
			||||||
    addMiscItems,
 | 
					    addMiscItems,
 | 
				
			||||||
    allDailyAffiliationKeys,
 | 
					    allDailyAffiliationKeys,
 | 
				
			||||||
    cleanupInventory,
 | 
					    cleanupInventory,
 | 
				
			||||||
@ -110,7 +111,58 @@ export const inventoryController: RequestHandler = async (request, response) =>
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (inventory.CalendarProgress) {
 | 
					        if (inventory.CalendarProgress) {
 | 
				
			||||||
 | 
					            const previousYearIteration = inventory.CalendarProgress.Iteration;
 | 
				
			||||||
            getCalendarProgress(inventory); // handle year rollover; the client expects to receive an inventory with an up-to-date CalendarProgress
 | 
					            getCalendarProgress(inventory); // handle year rollover; the client expects to receive an inventory with an up-to-date CalendarProgress
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            // also handle sending of kiss cinematic at year rollover
 | 
				
			||||||
 | 
					            if (
 | 
				
			||||||
 | 
					                inventory.CalendarProgress.Iteration != previousYearIteration &&
 | 
				
			||||||
 | 
					                inventory.DialogueHistory &&
 | 
				
			||||||
 | 
					                inventory.DialogueHistory.Dialogues
 | 
				
			||||||
 | 
					            ) {
 | 
				
			||||||
 | 
					                let kalymos = false;
 | 
				
			||||||
 | 
					                for (const { dialogueName, kissEmail } of [
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        dialogueName: "/Lotus/Types/Gameplay/1999Wf/Dialogue/ArthurDialogue_rom.dialogue",
 | 
				
			||||||
 | 
					                        kissEmail: "/Lotus/Types/Items/EmailItems/ArthurKissEmailItem"
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        dialogueName: "/Lotus/Types/Gameplay/1999Wf/Dialogue/EleanorDialogue_rom.dialogue",
 | 
				
			||||||
 | 
					                        kissEmail: "/Lotus/Types/Items/EmailItems/EleanorKissEmailItem"
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        dialogueName: "/Lotus/Types/Gameplay/1999Wf/Dialogue/LettieDialogue_rom.dialogue",
 | 
				
			||||||
 | 
					                        kissEmail: "/Lotus/Types/Items/EmailItems/LettieKissEmailItem"
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        dialogueName: "/Lotus/Types/Gameplay/1999Wf/Dialogue/JabirDialogue_rom.dialogue",
 | 
				
			||||||
 | 
					                        kissEmail: "/Lotus/Types/Items/EmailItems/AmirKissEmailItem"
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        dialogueName: "/Lotus/Types/Gameplay/1999Wf/Dialogue/AoiDialogue_rom.dialogue",
 | 
				
			||||||
 | 
					                        kissEmail: "/Lotus/Types/Items/EmailItems/AoiKissEmailItem"
 | 
				
			||||||
 | 
					                    },
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        dialogueName: "/Lotus/Types/Gameplay/1999Wf/Dialogue/QuincyDialogue_rom.dialogue",
 | 
				
			||||||
 | 
					                        kissEmail: "/Lotus/Types/Items/EmailItems/QuincyKissEmailItem"
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                ]) {
 | 
				
			||||||
 | 
					                    const dialogue = inventory.DialogueHistory.Dialogues.find(x => x.DialogueName == dialogueName);
 | 
				
			||||||
 | 
					                    if (dialogue) {
 | 
				
			||||||
 | 
					                        if (dialogue.Rank == 7) {
 | 
				
			||||||
 | 
					                            await addEmailItem(inventory, kissEmail);
 | 
				
			||||||
 | 
					                            kalymos = false;
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        if (dialogue.Rank == 6) {
 | 
				
			||||||
 | 
					                            kalymos = true;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (kalymos) {
 | 
				
			||||||
 | 
					                    await addEmailItem(inventory, "/Lotus/Types/Items/EmailItems/KalymosKissEmailItem");
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        cleanupInventory(inventory);
 | 
					        cleanupInventory(inventory);
 | 
				
			||||||
 | 
				
			|||||||
@ -23,7 +23,9 @@ export interface IMessageDatabase extends IMessage {
 | 
				
			|||||||
export interface IMessage {
 | 
					export interface IMessage {
 | 
				
			||||||
    sndr: string;
 | 
					    sndr: string;
 | 
				
			||||||
    msg: string;
 | 
					    msg: string;
 | 
				
			||||||
 | 
					    cinematic?: string;
 | 
				
			||||||
    sub: string;
 | 
					    sub: string;
 | 
				
			||||||
 | 
					    customData?: string;
 | 
				
			||||||
    icon?: string;
 | 
					    icon?: string;
 | 
				
			||||||
    highPriority?: boolean;
 | 
					    highPriority?: boolean;
 | 
				
			||||||
    lowPrioNewPlayers?: boolean;
 | 
					    lowPrioNewPlayers?: boolean;
 | 
				
			||||||
@ -102,7 +104,9 @@ const messageSchema = new Schema<IMessageDatabase>(
 | 
				
			|||||||
        ownerId: Schema.Types.ObjectId,
 | 
					        ownerId: Schema.Types.ObjectId,
 | 
				
			||||||
        sndr: String,
 | 
					        sndr: String,
 | 
				
			||||||
        msg: String,
 | 
					        msg: String,
 | 
				
			||||||
 | 
					        cinematic: String,
 | 
				
			||||||
        sub: String,
 | 
					        sub: String,
 | 
				
			||||||
 | 
					        customData: String,
 | 
				
			||||||
        icon: String,
 | 
					        icon: String,
 | 
				
			||||||
        highPriority: Boolean,
 | 
					        highPriority: Boolean,
 | 
				
			||||||
        lowPrioNewPlayers: Boolean,
 | 
					        lowPrioNewPlayers: Boolean,
 | 
				
			||||||
 | 
				
			|||||||
@ -83,7 +83,7 @@ import { addQuestKey, completeQuest } from "@/src/services/questService";
 | 
				
			|||||||
import { handleBundleAcqusition } from "./purchaseService";
 | 
					import { handleBundleAcqusition } from "./purchaseService";
 | 
				
			||||||
import libraryDailyTasks from "@/static/fixed_responses/libraryDailyTasks.json";
 | 
					import libraryDailyTasks from "@/static/fixed_responses/libraryDailyTasks.json";
 | 
				
			||||||
import { getRandomElement, getRandomInt, getRandomWeightedReward, SRng } from "./rngService";
 | 
					import { getRandomElement, getRandomInt, getRandomWeightedReward, SRng } from "./rngService";
 | 
				
			||||||
import { createMessage } from "./inboxService";
 | 
					import { createMessage, IMessageCreationTemplate } from "./inboxService";
 | 
				
			||||||
import { getMaxStanding, getMinStanding } from "@/src/helpers/syndicateStandingHelper";
 | 
					import { getMaxStanding, getMinStanding } from "@/src/helpers/syndicateStandingHelper";
 | 
				
			||||||
import { getNightwaveSyndicateTag, getWorldState } from "./worldStateService";
 | 
					import { getNightwaveSyndicateTag, getWorldState } from "./worldStateService";
 | 
				
			||||||
import { ICalendarSeason } from "@/src/types/worldStateTypes";
 | 
					import { ICalendarSeason } from "@/src/types/worldStateTypes";
 | 
				
			||||||
@ -1563,7 +1563,22 @@ export const addEmailItem = async (
 | 
				
			|||||||
    const meta = ExportEmailItems[typeName];
 | 
					    const meta = ExportEmailItems[typeName];
 | 
				
			||||||
    const emailItem = inventory.EmailItems.find(x => x.ItemType == typeName);
 | 
					    const emailItem = inventory.EmailItems.find(x => x.ItemType == typeName);
 | 
				
			||||||
    if (!emailItem || !meta.sendOnlyOnce) {
 | 
					    if (!emailItem || !meta.sendOnlyOnce) {
 | 
				
			||||||
        await createMessage(inventory.accountOwnerId, [convertInboxMessage(meta.message)]);
 | 
					        const msg: IMessageCreationTemplate = convertInboxMessage(meta.message);
 | 
				
			||||||
 | 
					        if (msg.cinematic == "/Lotus/Levels/1999/PlayerHomeBalconyCinematics.level") {
 | 
				
			||||||
 | 
					            msg.customData = JSON.stringify({
 | 
				
			||||||
 | 
					                Tag: msg.customData + "KissCin",
 | 
				
			||||||
 | 
					                CinLoadout: {
 | 
				
			||||||
 | 
					                    Skins: inventory.AdultOperatorLoadOuts[0].Skins,
 | 
				
			||||||
 | 
					                    Upgrades: inventory.AdultOperatorLoadOuts[0].Upgrades,
 | 
				
			||||||
 | 
					                    attcol: inventory.AdultOperatorLoadOuts[0].attcol,
 | 
				
			||||||
 | 
					                    cloth: inventory.AdultOperatorLoadOuts[0].cloth,
 | 
				
			||||||
 | 
					                    eyecol: inventory.AdultOperatorLoadOuts[0].eyecol,
 | 
				
			||||||
 | 
					                    pricol: inventory.AdultOperatorLoadOuts[0].pricol,
 | 
				
			||||||
 | 
					                    syancol: inventory.AdultOperatorLoadOuts[0].syancol
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        await createMessage(inventory.accountOwnerId, [msg]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (emailItem) {
 | 
					        if (emailItem) {
 | 
				
			||||||
            emailItem.ItemCount += 1;
 | 
					            emailItem.ItemCount += 1;
 | 
				
			||||||
 | 
				
			|||||||
@ -251,7 +251,9 @@ export const convertInboxMessage = (message: IInboxMessage): IMessage => {
 | 
				
			|||||||
    return {
 | 
					    return {
 | 
				
			||||||
        sndr: message.sender,
 | 
					        sndr: message.sender,
 | 
				
			||||||
        msg: message.body,
 | 
					        msg: message.body,
 | 
				
			||||||
 | 
					        cinematic: message.cinematic,
 | 
				
			||||||
        sub: message.title,
 | 
					        sub: message.title,
 | 
				
			||||||
 | 
					        customData: message.customData,
 | 
				
			||||||
        att: message.attachments.length > 0 ? message.attachments : undefined,
 | 
					        att: message.attachments.length > 0 ? message.attachments : undefined,
 | 
				
			||||||
        countedAtt: message.countedAttachments.length > 0 ? message.countedAttachments : undefined,
 | 
					        countedAtt: message.countedAttachments.length > 0 ? message.countedAttachments : undefined,
 | 
				
			||||||
        icon: message.icon ?? "",
 | 
					        icon: message.icon ?? "",
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user