feat: handle acquisition of EmailItems #1064

Merged
OrdisPrime merged 2 commits from add-emailitem into main 2025-03-02 04:18:59 -08:00
Showing only changes of commit 60cae3d5de - Show all commits

View File

@ -35,7 +35,7 @@ import {
IUpdateChallengeProgressRequest IUpdateChallengeProgressRequest
} from "../types/requestTypes"; } from "../types/requestTypes";
import { logger } from "@/src/utils/logger"; import { logger } from "@/src/utils/logger";
import { getExalted, getKeyChainItems } from "@/src/services/itemDataService"; import { convertInboxMessage, getExalted, getKeyChainItems } from "@/src/services/itemDataService";
import { import {
EquipmentFeatures, EquipmentFeatures,
IEquipmentClient, IEquipmentClient,
@ -47,6 +47,7 @@ import {
ExportBundles, ExportBundles,
ExportCustoms, ExportCustoms,
ExportDrones, ExportDrones,
ExportEmailItems,
ExportEnemies, ExportEnemies,
ExportFlavour, ExportFlavour,
ExportFusionBundles, ExportFusionBundles,
@ -71,6 +72,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 } from "./rngService"; import { getRandomElement, getRandomInt } from "./rngService";
import { createMessage } from "./inboxService";
export const createInventory = async ( export const createInventory = async (
accountOwnerId: Types.ObjectId, accountOwnerId: Types.ObjectId,
@ -425,6 +427,13 @@ export const addItem = async (
InventoryChanges: inventoryChanges InventoryChanges: inventoryChanges
}; };
} }
if (typeName in ExportEmailItems) {
const emailItem = ExportEmailItems[typeName];
await createMessage(inventory.accountOwnerId.toString(), [convertInboxMessage(emailItem.message)]);
return {
InventoryChanges: {}
};
}
// Path-based duck typing // Path-based duck typing
switch (typeName.substr(1).split("/")[1]) { switch (typeName.substr(1).split("/")[1]) {