Save additional shopoters for vehicle kill
parent
d10fc8e49a
commit
fc5eaf868a
|
@ -16,6 +16,9 @@ const LogVehicleKillSchema = new Schema({
|
|||
shooter: {
|
||||
type: String,
|
||||
},
|
||||
additionalShooter: {
|
||||
type: [String],
|
||||
},
|
||||
target: {
|
||||
type: String,
|
||||
required: true,
|
||||
|
|
|
@ -80,14 +80,21 @@ const parseWarLog = (lineArray, war) => {
|
|||
const targetString = line.substring(line.lastIndexOf(' --- Fahrzeug: ') + 15, line.lastIndexOf(' von:'));
|
||||
const target = getVehicleAndFractionFromString(targetString);
|
||||
if (target && shooter && target.fraction !== shooter.fraction) {
|
||||
stats.vehicles.push({
|
||||
const vehicleKill = {
|
||||
war: war._id,
|
||||
time: getFullTimeDate(war.date, line.split(WHITESPACE)[5]),
|
||||
shooter: shooter ? shooter.name : null,
|
||||
target: target ? target.name : null,
|
||||
fraction: shooter ? shooter.fraction : 'NONE',
|
||||
vehicleClass: target.vehicleClass,
|
||||
});
|
||||
};
|
||||
if (shooter && shooter.name instanceof Array) {
|
||||
vehicleKill.shooter = shooter.name[0];
|
||||
vehicleKill.additionalShooter = shooter.name.slice(1, shooter.name.length);
|
||||
} else {
|
||||
vehicleKill.shooter = shooter ? shooter.name : null
|
||||
}
|
||||
console.log(vehicleKill)
|
||||
stats.vehicles.push(vehicleKill);
|
||||
}
|
||||
} else {
|
||||
const targetString = line.substring(line.lastIndexOf(' --- Einheit: ') + 14, line.lastIndexOf(' von:'));
|
||||
|
|
Loading…
Reference in New Issue