Refactor addSpawnedInSessionPropertyToitems()
This commit is contained in:
parent
8c3924baab
commit
95fbd07473
@ -237,7 +237,7 @@ export class InRaidHelper
|
|||||||
* @param preRaidProfile profile to update
|
* @param preRaidProfile profile to update
|
||||||
* @param postRaidProfile profile to update inventory contents of
|
* @param postRaidProfile profile to update inventory contents of
|
||||||
* @param isPlayerScav Was this a p scav raid
|
* @param isPlayerScav Was this a p scav raid
|
||||||
* @returns
|
* @returns profile with FiR items properly tagged
|
||||||
*/
|
*/
|
||||||
public addSpawnedInSessionPropertyToItems(preRaidProfile: IPmcData, postRaidProfile: IPmcData, isPlayerScav: boolean): IPmcData
|
public addSpawnedInSessionPropertyToItems(preRaidProfile: IPmcData, postRaidProfile: IPmcData, isPlayerScav: boolean): IPmcData
|
||||||
{
|
{
|
||||||
@ -247,26 +247,17 @@ export class InRaidHelper
|
|||||||
{
|
{
|
||||||
const itemExistsInProfile = preRaidProfile.Inventory.items.find((itemData) => item._id === itemData._id);
|
const itemExistsInProfile = preRaidProfile.Inventory.items.find((itemData) => item._id === itemData._id);
|
||||||
if (itemExistsInProfile)
|
if (itemExistsInProfile)
|
||||||
{
|
|
||||||
if ("upd" in item && "SpawnedInSession" in item.upd)
|
|
||||||
{
|
{
|
||||||
// if the item exists and is taken inside the raid, remove the taken in raid status
|
// if the item exists and is taken inside the raid, remove the taken in raid status
|
||||||
delete item.upd.SpawnedInSession;
|
delete item.upd?.SpawnedInSession;
|
||||||
}
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("upd" in item)
|
item.upd = item.upd ?? {};
|
||||||
{
|
|
||||||
item.upd.SpawnedInSession = true;
|
item.upd.SpawnedInSession = true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
item.upd = { SpawnedInSession: true };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return postRaidProfile;
|
return postRaidProfile;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user