fix(stats): captures not being tracked for a new enemy #1728
@ -147,8 +147,11 @@ export const updateStats = async (accountOwnerId: string, payload: IStatsUpdate)
 | 
			
		||||
                            )[category];
 | 
			
		||||
 | 
			
		||||
                            for (const [type, count] of Object.entries(data as IUploadEntry)) {
 | 
			
		||||
                                const enemy = playerStats.Enemies.find(element => element.type === type);
 | 
			
		||||
                                if (enemy) {
 | 
			
		||||
                                let enemy = playerStats.Enemies.find(element => element.type === type);
 | 
			
		||||
                                if (!enemy) {
 | 
			
		||||
                                    enemy = { type: type };
 | 
			
		||||
                                    playerStats.Enemies.push(enemy);
 | 
			
		||||
                                }
 | 
			
		||||
                                if (category === "KILL_ENEMY") {
 | 
			
		||||
                                    enemy.kills ??= 0;
 | 
			
		||||
                                    const captureCount = (actionData as IStatsAdd)["CAPTURE_ENEMY"]?.[type];
 | 
			
		||||
@ -163,11 +166,6 @@ export const updateStats = async (accountOwnerId: string, payload: IStatsUpdate)
 | 
			
		||||
                                    enemy[enemyStatKey] ??= 0;
 | 
			
		||||
                                    enemy[enemyStatKey] += count;
 | 
			
		||||
                                }
 | 
			
		||||
                                } else {
 | 
			
		||||
                                    const newEnemy: IEnemy = { type: type };
 | 
			
		||||
                                    newEnemy[enemyStatKey] = count;
 | 
			
		||||
                                    playerStats.Enemies.push(newEnemy);
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user