chore: use mongoose's 'id' function in addGearExpByCategory #892
@ -823,12 +823,10 @@ export const addGearExpByCategory = (
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const itemIndex = ItemId ? category.findIndex(item => item._id?.equals(ItemId.$oid)) : -1;
|
const item = category.id(ItemId.$oid);
|
||||||
if (itemIndex !== -1) {
|
if (item) {
|
||||||
const item = category[itemIndex];
|
|
||||||
item.XP ??= 0;
|
item.XP ??= 0;
|
||||||
item.XP += XP;
|
item.XP += XP;
|
||||||
inventory.markModified(`${categoryName}.${itemIndex}.XP`);
|
|
||||||
|
|
||||||
const xpinfoIndex = inventory.XPInfo.findIndex(x => x.ItemType == item.ItemType);
|
const xpinfoIndex = inventory.XPInfo.findIndex(x => x.ItemType == item.ItemType);
|
||||||
if (xpinfoIndex !== -1) {
|
if (xpinfoIndex !== -1) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user