Compare commits

...

1 Commits

Author SHA1 Message Date
hardi c0a714d2b0 Release v1.9.8 (#63) 2020-04-23 10:41:03 +02:00
7 changed files with 41 additions and 16 deletions

View File

@ -85,6 +85,7 @@
+ `LIGHT`
+ `HEAVY`
+ `AIR`
+ `BOAT`
+ `UNKNOWN`
+ shooterVehicle: `FV-720 Mora` (string, optional) - vehicle in whiock the shooting player sat
+ magazine: `30 mm APFSDS` (string, optional) - magazine name used to execute the kill

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 65 KiB

View File

@ -30,7 +30,7 @@ const LogVehicleKillSchema = new Schema({
},
vehicleClass: {
type: String,
enum: ['LIGHT', 'HEAVY', 'AIR', 'UNKNOWN'],
enum: ['LIGHT', 'HEAVY', 'AIR', 'BOAT', 'UNKNOWN'],
required: true,
},
magazine: {

View File

@ -42,6 +42,12 @@ const PlayerSchema = new Schema({
set: (v) => Math.round(v),
required: true,
},
vehicleBoat: {
type: Number,
get: (v) => Math.round(v),
set: (v) => Math.round(v),
required: true,
},
death: {
type: Number,
get: (v) => Math.round(v),

View File

@ -172,6 +172,11 @@ wars.route('/:id')
return next(err);
}
// TODO: temp solution for CC-93 - add boat kills to light vehicle kills until FE available
items.forEach((player) => {
player.vehicleLight = player.vehicleLight + player.vehicleBoat;
});
const responseObj = item.toObject();
responseObj.players = items;
res.locals.items = responseObj;

View File

@ -8,6 +8,7 @@ const VehicleClasses = Object.freeze({
LIGHT: 'Leicht',
HEAVY: 'Schwer',
AIR: 'Flug',
BOAT: 'Boot',
UNKNOWN: 'Unbekannt',
});
@ -73,6 +74,8 @@ const parseWarLog = (lineArray, war) => {
'Tempest-Transporter', 'Tempest-Transporter (abgedeckt)', 'Tempest Sanitätsfahrzeug',
'Remote Designator [CSAT]', 'UBF Saif',
'Quad Bike', 'HuntIR', 'Offroad',
// boats
'RHIB', 'Kampfboot', 'SDV',
];
const addPlayerIfNotExists = (inputPlayer, steamUUID) => {
@ -80,6 +83,10 @@ const parseWarLog = (lineArray, war) => {
if (player && player.name && player.fraction && !playerArrayContains(stats.players, player)) {
player['warId'] = war._id;
player['steamUUID'] = steamUUID;
player['vehicleLight'] = 0;
player['vehicleHeavy'] = 0;
player['vehicleAir'] = 0;
player['vehicleBoat'] = 0;
stats.players.push(player);
}
};
@ -335,21 +342,27 @@ const parseWarLog = (lineArray, war) => {
stats.players[i]['kill'] = stats.kills.filter(
(kill) => kill.shooter === playerName && !kill.friendlyFire).length;
// TODO: use vehicle class description from enum
stats.players[i]['vehicleLight'] = stats.vehicles.filter(
(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 && 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 && vehicle.additionalShooter.indexOf(playerName)) > -1) && vehicle.vehicleClass ===
'AIR' && VEHICLE_BLACKLIST.indexOf(vehicle.target) < 0).length;
stats.vehicles
.filter((vehicle) => VEHICLE_BLACKLIST.indexOf(vehicle.target) < 0)
.forEach((vehicle) => {
if (vehicle.shooter === playerName ||
(vehicle.additionalShooter && vehicle.additionalShooter.indexOf(playerName)) > -1) {
switch (vehicle.vehicleClass) {
case 'LIGHT':
stats.players[i].vehicleLight++;
break;
case 'HEAVY':
stats.players[i].vehicleHeavy++;
break;
case 'AIR':
stats.players[i].vehicleAir++;
break;
case 'BOAT':
stats.players[i].vehicleBoat++;
break;
}
}
});
stats.players[i]['friendlyFire'] = stats.kills.filter(
(kill) => kill.shooter === playerName && kill.friendlyFire).length;