avoid duplicate entries in inventory.EvolutionProgress

This commit is contained in:
Sainan 2024-06-20 12:55:22 +02:00
parent 3c27f01ad2
commit dcdf03c9ce

View File

@ -21,11 +21,13 @@ export const evolveWeaponController: RequestHandler = async (req, res) => {
item.SkillTree = "0"; item.SkillTree = "0";
inventory.EvolutionProgress ??= []; inventory.EvolutionProgress ??= [];
if (!inventory.EvolutionProgress.find(entry => entry.ItemType == payload.EvoType)) {
inventory.EvolutionProgress.push({ inventory.EvolutionProgress.push({
Progress: 0, Progress: 0,
Rank: 1, Rank: 1,
ItemType: payload.EvoType ItemType: payload.EvoType
}); });
}
await inventory.save(); await inventory.save();
res.end(); res.end();