This commit is contained in:
Dev 2024-01-23 20:25:34 +00:00
commit 45484227df

View File

@ -285,22 +285,23 @@ export class InsuranceService
* Take preraid item and update properties to ensure its ready to be given to player in insurance return mail * Take preraid item and update properties to ensure its ready to be given to player in insurance return mail
* @param pmcData Player profile * @param pmcData Player profile
* @param preRaidItemWithChildren Insured item (with children) as it was pre-raid * @param preRaidItemWithChildren Insured item (with children) as it was pre-raid
* @param insuredItemFromClient Item data when player left raid (durability values) * @param allItemsFromClient Item data when player left raid (durability values)
* @returns Item (with children) to send to player * @returns Item (with children) to send to player
*/ */
protected getInsuredItemDetails( protected getInsuredItemDetails(
pmcData: IPmcData, pmcData: IPmcData,
preRaidItemWithChildren: Item[], preRaidItemWithChildren: Item[],
insuredItemsFromClient: IInsuredItemsData[] allItemsFromClient: IInsuredItemsData[]
): Item[] ): Item[]
{ {
const itemsToReturn: Item[] = []; const itemsToReturn: Item[] = [];
for (const preRaidItem of preRaidItemWithChildren) for (const preRaidItem of preRaidItemWithChildren)
{ {
const itemClientInsuranceData = insuredItemsFromClient?.find((x) => x.id === preRaidItem._id); const isInsured = pmcData.InsuredItems.some(item => item.itemId === preRaidItem._id);
const itemClientInsuranceData = allItemsFromClient?.find((x) => x.id === preRaidItem._id);
const itemIsSoftInsert = this.itemHelper.isOfBaseclass(preRaidItem._tpl, BaseClasses.BUILT_IN_INSERTS); const itemIsSoftInsert = this.itemHelper.isOfBaseclass(preRaidItem._tpl, BaseClasses.BUILT_IN_INSERTS);
if (itemClientInsuranceData || itemIsSoftInsert) if (isInsured || itemIsSoftInsert)
{ {
// Check if item should always be lost // Check if item should always be lost
if (this.insuranceConfig.slotIdsToAlwaysRemove.includes(preRaidItem.slotId.toLowerCase())) if (this.insuranceConfig.slotIdsToAlwaysRemove.includes(preRaidItem.slotId.toLowerCase()))