feat: stripped rewards

Eidolon kill & captures will be handled like this with the next PE+ update, otherwise this should work as all the stripped rewards I'm aware of are enemy drops.
This commit is contained in:
Sainan 2025-03-08 19:27:19 +01:00
parent 6bf365ddc5
commit 10ab36701a
2 changed files with 30 additions and 2 deletions

View File

@ -1,4 +1,5 @@
import {
ExportEnemies,
ExportFusionBundles,
ExportRegions,
ExportRewards,
@ -18,6 +19,7 @@ import {
addFocusXpIncreases,
addFusionTreasures,
addGearExpByCategory,
addItem,
addMiscItems,
addMissionComplete,
addMods,
@ -28,7 +30,7 @@ import {
import { updateQuestKey } from "@/src/services/questService";
import { HydratedDocument } from "mongoose";
import { IInventoryChanges } from "@/src/types/purchaseTypes";
import { getLevelKeyRewards, getNode } from "@/src/services/itemDataService";
import { getLevelKeyRewards, getNode, toStoreItem } from "@/src/services/itemDataService";
import { InventoryDocumentProps, TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel";
import { getEntriesUnsafe } from "@/src/utils/ts-utils";
import { IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes";
@ -319,7 +321,8 @@ export const addMissionRewards = async (
LevelKeyName: levelKeyName,
Missions: missions,
RegularCredits: creditDrops,
VoidTearParticipantsCurrWave: voidTearWave
VoidTearParticipantsCurrWave: voidTearWave,
StrippedItems: strippedItems
}: IMissionInventoryUpdateRequest
) => {
if (!rewardInfo) {
@ -406,6 +409,27 @@ export const addMissionRewards = async (
MissionRewards.push({ StoreItem: reward.type, ItemCount: reward.itemCount });
}
if (strippedItems) {
for (const si of strippedItems) {
const droptable = ExportEnemies.droptables[si.DropTable];
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (!droptable) {
logger.error(`unknown droptable ${si.DropTable}`);
} else {
for (const pool of droptable) {
const reward = getRandomReward(pool.items)!;
logger.debug(`stripped droptable rolled`, reward);
await addItem(inventory, reward.type);
MissionRewards.push({
StoreItem: toStoreItem(reward.type),
ItemCount: 1,
FromEnemyCache: true // to show "identified"
});
}
}
}
}
return { inventoryChanges, MissionRewards, credits };
};

View File

@ -103,6 +103,10 @@ export type IMissionInventoryUpdateRequest = {
}[];
CollectibleScans?: ICollectibleEntry[];
Upgrades?: IUpgradeClient[]; // riven challenge progress
StrippedItems?: {
DropTable: string;
DROP_MOD: number[];
}[];
} & {
[K in TEquipmentKey]?: IEquipmentClient[];
};