CC-93: parse boat kills from logs, MVP
parent
91d5095890
commit
d9b0b2153e
|
@ -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
|
||||
|
|
|
@ -10,6 +10,7 @@ Basic player statistic information object
|
|||
+ vehicleLight: 1 (number, required) - sum of light vehicle kills
|
||||
+ vehicleHeavy: 1 (number, required) - sum of heavy vehicle kills
|
||||
+ vehicleAir: 0 (number, required) - sum of air vehicle kills
|
||||
+ vehicleBoat: 0 (number, required) - sum of boat vehicle kills
|
||||
+ death: 3 (number, required) - sum of deaths
|
||||
+ respawn: 2 (number, required) - sum of respawns
|
||||
+ flagTouch: 1 (number, required) - sum of flag captures
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue