diff --git a/project/src/controllers/InraidController.ts b/project/src/controllers/InraidController.ts index 019feb44..5929a1a9 100644 --- a/project/src/controllers/InraidController.ts +++ b/project/src/controllers/InraidController.ts @@ -209,7 +209,7 @@ export class InraidController } /** - * Make changes to pmc profile after they've died in raid, + * Make changes to PMC profile after they've died in raid, * Alter body part hp, handle insurance, delete inventory items, remove carried quest items * @param postRaidSaveRequest Post-raid save request * @param pmcData Pmc profile @@ -230,8 +230,8 @@ export class InraidController // Find and remove the completed condition from profile if player died, otherwise quest is stuck in limbo // and quest items cannot be picked up again const allQuests = this.questHelper.getQuestsFromDb(); - const activeQuestIdsInProfile = pmcData.Quests.filter((x) => - ![QuestStatus.AvailableForStart, QuestStatus.Success, QuestStatus.Expired].includes(x.status) + const activeQuestIdsInProfile = pmcData.Quests.filter((profileQuest) => + ![QuestStatus.AvailableForStart, QuestStatus.Success, QuestStatus.Expired].includes(profileQuest.status) ).map((x) => x.qid); for (const questItem of postRaidSaveRequest.profile.Stats.Eft.CarriedQuestItems) { diff --git a/project/src/helpers/InRaidHelper.ts b/project/src/helpers/InRaidHelper.ts index a9a1ec76..605cf706 100644 --- a/project/src/helpers/InRaidHelper.ts +++ b/project/src/helpers/InRaidHelper.ts @@ -603,19 +603,19 @@ export class InRaidHelper } /** - * Clear pmc inventory of all items except those that are exempt + * Clear PMC inventory of all items except those that are exempt * Used post-raid to remove items after death * @param pmcData Player profile - * @param sessionID Session id + * @param sessionId Session id */ - public deleteInventory(pmcData: IPmcData, sessionID: string): void + public deleteInventory(pmcData: IPmcData, sessionId: string): void { // Get inventory item ids to remove from players profile - const itemIdsToDeleteFromProfile = this.getInventoryItemsLostOnDeath(pmcData).map((x) => x._id); - for (const x of itemIdsToDeleteFromProfile) + const itemIdsToDeleteFromProfile = this.getInventoryItemsLostOnDeath(pmcData).map((item) => item._id); + for (const itemIdToDelete of itemIdsToDeleteFromProfile) { // Items inside containers are handled as part of function - this.inventoryHelper.removeItem(pmcData, x, sessionID); + this.inventoryHelper.removeItem(pmcData, itemIdToDelete, sessionId); } // Remove contents of fast panel @@ -693,12 +693,14 @@ export class InRaidHelper if (itemToCheck.parentId === pmcData.Inventory.equipment) { // Check slot id against config, true = delete, false = keep, undefined = delete - const discard = this.lostOnDeathConfig.equipment[itemToCheck.slotId]; + const discard: boolean = this.lostOnDeathConfig.equipment[itemToCheck.slotId]; if (discard === undefined) { + // Not kept after death return false; } + // True === item is lost on death, return the opposite as we return if item is kept after death return !discard; }