diff --git a/api/tools/log-parse-tool.js b/api/tools/log-parse-tool.js index 661746b..3d9f73b 100644 --- a/api/tools/log-parse-tool.js +++ b/api/tools/log-parse-tool.js @@ -223,19 +223,19 @@ const parseWarLog = (lineArray, war) => { // TODO: use vehicle class description from enum stats.players[i]['vehicleLight'] = stats.vehicles.filter( - (vehicle) => (vehicle.shooter === playerName || vehicle.additionalShooter.indexOf(playerName) > -1) && - vehicle.vehicleClass === 'LIGHT' && - VEHICLE_BLACKLIST.indexOf(vehicle.target) < 0).length; + (vehicle) => (vehicle.shooter === playerName || + (vehicle.additionalShooter && vehicle.additionalShooter.indexOf(playerName)) > -1) && vehicle.vehicleClass === + 'LIGHT' && VEHICLE_BLACKLIST.indexOf(vehicle.target) < 0).length; stats.players[i]['vehicleHeavy'] = stats.vehicles.filter( - (vehicle) => (vehicle.shooter === playerName || vehicle.additionalShooter.indexOf(playerName) > -1) && - vehicle.vehicleClass === 'HEAVY' && - VEHICLE_BLACKLIST.indexOf(vehicle.target) < 0).length; + (vehicle) => (vehicle.shooter === playerName || + (vehicle.additionalShooter && vehicle.additionalShooter.indexOf(playerName)) > -1) && vehicle.vehicleClass === + 'HEAVY' && VEHICLE_BLACKLIST.indexOf(vehicle.target) < 0).length; stats.players[i]['vehicleAir'] = stats.vehicles.filter( - (vehicle) => (vehicle.shooter === playerName || vehicle.additionalShooter.indexOf(playerName) > -1) && - vehicle.vehicleClass === 'AIR' && - VEHICLE_BLACKLIST.indexOf(vehicle.target) < 0).length; + (vehicle) => (vehicle.shooter === playerName || + (vehicle.additionalShooter && vehicle.additionalShooter.indexOf(playerName)) > -1) && vehicle.vehicleClass === + 'AIR' && VEHICLE_BLACKLIST.indexOf(vehicle.target) < 0).length; stats.players[i]['friendlyFire'] = stats.kills.filter( (kill) => kill.shooter === playerName && kill.friendlyFire).length;