Make players PMC equipment id unique on profile creation
This commit is contained in:
parent
43699d6416
commit
43cbe45376
@ -157,6 +157,8 @@ export class ProfileController
|
|||||||
pmcData.CoopExtractCounts = {};
|
pmcData.CoopExtractCounts = {};
|
||||||
pmcData.Achievements = {};
|
pmcData.Achievements = {};
|
||||||
|
|
||||||
|
this.updateInventoryEquipmentId(pmcData);
|
||||||
|
|
||||||
if (!pmcData.UnlockedInfo)
|
if (!pmcData.UnlockedInfo)
|
||||||
{
|
{
|
||||||
pmcData.UnlockedInfo = { unlockedProductionRecipe: [] };
|
pmcData.UnlockedInfo = { unlockedProductionRecipe: [] };
|
||||||
@ -227,6 +229,31 @@ export class ProfileController
|
|||||||
return pmcData._id;
|
return pmcData._id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* make profiles pmcData.Inventory.equipment unique
|
||||||
|
* @param pmcData Profile to update
|
||||||
|
*/
|
||||||
|
protected updateInventoryEquipmentId(pmcData: IPmcData): void
|
||||||
|
{
|
||||||
|
const oldEquipmentId = pmcData.Inventory.equipment;
|
||||||
|
pmcData.Inventory.equipment = this.hashUtil.generate();
|
||||||
|
|
||||||
|
for (const item of pmcData.Inventory.items)
|
||||||
|
{
|
||||||
|
if (item.parentId === oldEquipmentId)
|
||||||
|
{
|
||||||
|
item.parentId = pmcData.Inventory.equipment;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item._id === oldEquipmentId)
|
||||||
|
{
|
||||||
|
item._id = pmcData.Inventory.equipment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a profile
|
* Delete a profile
|
||||||
* @param sessionID Id of profile to delete
|
* @param sessionID Id of profile to delete
|
||||||
|
Loading…
x
Reference in New Issue
Block a user