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