Rename variables/comments for clarity

This commit is contained in:
Dev 2024-02-06 09:49:51 +00:00
parent 4fc012b422
commit c6de12e6f8
2 changed files with 12 additions and 10 deletions

View File

@ -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)
{

View File

@ -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;
}