Apply vehicle kill to all multi shooters

pull/36/head
HardiReady 2018-06-09 22:06:18 +02:00
parent 236e445ca0
commit 13a6e0f157
2 changed files with 9 additions and 6 deletions

View File

@ -64,6 +64,7 @@ campaigns.route('/:id')
}
WarModel.find({campaign: req.params.id}).remove().exec();
// TODO: remove all the war logs from fs here!!!
// TODO: remove all LOG entries from DB!!!
res.locals.processed = true;
next();
});

View File

@ -91,9 +91,8 @@ const parseWarLog = (lineArray, war) => {
vehicleKill.shooter = shooter.name[0];
vehicleKill.additionalShooter = shooter.name.slice(1, shooter.name.length);
} else {
vehicleKill.shooter = shooter ? shooter.name : null
vehicleKill.shooter = shooter ? shooter.name : null;
}
console.log(vehicleKill)
stats.vehicles.push(vehicleKill);
}
} else {
@ -224,15 +223,18 @@ const parseWarLog = (lineArray, war) => {
// TODO: use vehicle class description from enum
stats.players[i]['vehicleLight'] = stats.vehicles.filter(
(vehicle) => vehicle.shooter === playerName && vehicle.vehicleClass === 'LIGHT' &&
(vehicle) => (vehicle.shooter === playerName || 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.vehicleClass === 'HEAVY' &&
(vehicle) => (vehicle.shooter === playerName || 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.vehicleClass === 'AIR' &&
(vehicle) => (vehicle.shooter === playerName || vehicle.additionalShooter.indexOf(playerName) > -1) &&
vehicle.vehicleClass === 'AIR' &&
VEHICLE_BLACKLIST.indexOf(vehicle.target) < 0).length;
stats.players[i]['friendlyFire'] = stats.kills.filter(
@ -298,7 +300,7 @@ const getPlayerAndFractionFromString = (inputString) => {
while ((additionalPlayerMatch = playerNameRegex.exec(inputString)) !== null) {
const addPlayer = additionalPlayerMatch[0].replace(/^,\s/, '').replace(/\s\($/, '').trim();
if (name instanceof Array) {
name.push(addPlayer)
name.push(addPlayer);
} else {
name = [name, addPlayer];
}