Fix player parsing for vehicle classes
parent
9d6c6e01b3
commit
9767e1bf25
|
@ -199,14 +199,31 @@ const parseWarLog = (lineArray, war) => {
|
|||
for (let i = 0; i < stats.players.length; i++) {
|
||||
const playerName = stats.players[i].name;
|
||||
stats.players[i]['respawn'] = stats.respawn.filter((res) => res.player === playerName).length;
|
||||
|
||||
stats.players[i]['kill'] = stats.kills.filter((kill) => kill.shooter === playerName && !kill.friendlyFire).length;
|
||||
stats.players[i]['vehicle'] = stats.vehicles.filter(
|
||||
(vehicle) => vehicle.shooter === playerName && VEHICLE_BLACKLIST.indexOf(vehicle.target) < 0).length;
|
||||
|
||||
//TODO: use vehicle class description from enum
|
||||
stats.players[i]['vehicleLight'] = stats.vehicles.filter(
|
||||
(vehicle) => vehicle.shooter === playerName && 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_BLACKLIST.indexOf(vehicle.target) < 0).length;
|
||||
|
||||
stats.players[i]['vehicleAir'] = stats.vehicles.filter(
|
||||
(vehicle) => vehicle.shooter === playerName && vehicle.vehicleClass === 'AIR' &&
|
||||
VEHICLE_BLACKLIST.indexOf(vehicle.target) < 0).length;
|
||||
|
||||
stats.players[i]['friendlyFire'] = stats.kills.filter(
|
||||
(kill) => kill.shooter === playerName && kill.friendlyFire).length;
|
||||
|
||||
stats.players[i]['death'] = stats.kills.filter((kill) => kill.target === playerName).length;
|
||||
|
||||
stats.players[i]['revive'] = stats.revive.filter((rev) => rev.medic === playerName && !rev.stabilized).length;
|
||||
|
||||
stats.players[i]['flagTouch'] = stats.flag.filter((flag) => flag.player === playerName).length;
|
||||
|
||||
stats.players[i]['sort'] = stats.players[i]['kill'] + stats.players[i]['revive'] + stats.players[i]['flagTouch']
|
||||
- stats.players[i]['friendlyFire'] - stats.players[i]['death'] - stats.players[i]['respawn'];
|
||||
}
|
||||
|
@ -263,12 +280,12 @@ const getVehicleAndFractionFromString = (nameClassFractionString) => {
|
|||
|
||||
const vehicleFraction = nameArray[nameArray.length - 1];
|
||||
nameArray.pop();
|
||||
const veheicleClassString = nameArray[nameArray.length - 1].replace('(', '').replace(')', '');
|
||||
const vehicleClassString = nameArray[nameArray.length - 1].replace('(', '').replace(')', '');
|
||||
nameArray.pop();
|
||||
const vehicleName = nameArray.join(WHITESPACE);
|
||||
|
||||
// skip logging here - this is some basic equipment identifier (i.e. parachute)
|
||||
if (vehicleFraction === 'OPF_F' || vehicleFraction === 'BLU_F' || veheicleClassString === VehicleClasses.UNKNOWN) {
|
||||
if (vehicleFraction === 'OPF_F' || vehicleFraction === 'BLU_F' || vehicleClassString === VehicleClasses.UNKNOWN) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -276,7 +293,7 @@ const getVehicleAndFractionFromString = (nameClassFractionString) => {
|
|||
|
||||
let vehicleClass;
|
||||
for (const key in VehicleClasses) {
|
||||
if (VehicleClasses.hasOwnProperty(key) && VehicleClasses[key] === veheicleClassString) {
|
||||
if (VehicleClasses.hasOwnProperty(key) && VehicleClasses[key] === vehicleClassString) {
|
||||
vehicleClass = key;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,9 @@ export interface Player {
|
|||
name?: string;
|
||||
warId?: War;
|
||||
kill?: number;
|
||||
vehicle?: number;
|
||||
vehicleLight?: number;
|
||||
vehicleHeavy?: number;
|
||||
vehicleAir?: number;
|
||||
death?: number;
|
||||
friendlyFire?: number;
|
||||
revive?: number;
|
||||
|
|
|
@ -87,7 +87,7 @@ export class StatisticHighScoreComponent implements OnInit {
|
|||
this.players = {
|
||||
kill: this.filterPlayerAttribute('kill'),
|
||||
friendlyFire: this.filterPlayerAttribute('friendlyFire'),
|
||||
vehicle: this.filterPlayerAttribute('vehicle'),
|
||||
vehicleLight: this.filterPlayerAttribute('vehicleLight'),
|
||||
death: this.filterPlayerAttribute('death'),
|
||||
respawn: this.filterPlayerAttribute('respawn'),
|
||||
revive: this.filterPlayerAttribute('revive'),
|
||||
|
|
|
@ -25,11 +25,13 @@
|
|||
</ngx-datatable-column>
|
||||
<ngx-datatable-column [width]="90" name="{{tableHead[2]}}" prop="kill"></ngx-datatable-column>
|
||||
<ngx-datatable-column [width]="104" name="{{tableHead[3]}}" prop="friendlyFire"></ngx-datatable-column>
|
||||
<ngx-datatable-column [width]="90" name="{{tableHead[4]}}" prop="vehicle"></ngx-datatable-column>
|
||||
<ngx-datatable-column [width]="80" name="{{tableHead[5]}}" prop="revive"></ngx-datatable-column>
|
||||
<ngx-datatable-column [width]="100" name="{{tableHead[6]}}" prop="flagTouch"></ngx-datatable-column>
|
||||
<ngx-datatable-column [width]="70" name="{{tableHead[7]}}" prop="death"></ngx-datatable-column>
|
||||
<ngx-datatable-column [width]="90" name="{{tableHead[8]}}" prop="respawn"></ngx-datatable-column>
|
||||
<ngx-datatable-column [width]="90" name="{{tableHead[4]}}" prop="vehicleLight"></ngx-datatable-column>
|
||||
<ngx-datatable-column [width]="90" name="{{tableHead[5]}}" prop="vehicleHeavy"></ngx-datatable-column>
|
||||
<ngx-datatable-column [width]="90" name="{{tableHead[6]}}" prop="vehicleAir"></ngx-datatable-column>
|
||||
<ngx-datatable-column [width]="80" name="{{tableHead[7]}}" prop="revive"></ngx-datatable-column>
|
||||
<ngx-datatable-column [width]="100" name="{{tableHead[8]}}" prop="flagTouch"></ngx-datatable-column>
|
||||
<ngx-datatable-column [width]="70" name="{{tableHead[9]}}" prop="death"></ngx-datatable-column>
|
||||
<ngx-datatable-column [width]="90" name="{{tableHead[10]}}" prop="respawn"></ngx-datatable-column>
|
||||
<!--<ngx-datatable-column [width]="80" name="" prop="name">-->
|
||||
<!--<ng-template ngx-datatable-cell-template let-value="value">-->
|
||||
<!--<span class="btn btn-sm btn-default in-table-btn disabled">Detail</span>-->
|
||||
|
|
|
@ -19,7 +19,8 @@ export class ScoreboardComponent implements OnChanges {
|
|||
|
||||
@Output() playerTabSwitch = new EventEmitter();
|
||||
|
||||
tableHead = ['Spieler', 'Fraktion', 'Kills', 'FriendlyFire', 'Fahrzeug', 'Revive', 'Eroberung', 'Tod', 'Respawn'];
|
||||
tableHead = ['Spieler', 'Fraktion', 'Kills', 'FriendlyFire', 'Fzg(L)', 'Fzg(S)', 'Fzg(A)',
|
||||
'Revive', 'Eroberung', 'Tod', 'Respawn'];
|
||||
|
||||
isSteamUUID = PlayerUtils.isSteamUUID;
|
||||
|
||||
|
@ -82,7 +83,9 @@ export class ScoreboardComponent implements OnChanges {
|
|||
csvOut += player.fraction + ',';
|
||||
csvOut += player.kill + ',';
|
||||
csvOut += player.friendlyFire + ',';
|
||||
csvOut += player.vehicle + ',';
|
||||
csvOut += player.vehicleLight + ',';
|
||||
csvOut += player.vehicleHeavy + ',';
|
||||
csvOut += player.vehicleAir + ',';
|
||||
csvOut += player.revive + ',';
|
||||
csvOut += player.flagTouch + ',';
|
||||
csvOut += player.death + ',';
|
||||
|
|
Loading…
Reference in New Issue