Blacklist non-meaningful vehicle kills and add frontend for scoreboard

pull/29/head
HardiReady 2018-03-03 12:57:31 +01:00
parent d18986cb1f
commit 57f093f4dc
4 changed files with 19 additions and 27 deletions

View File

@ -5,6 +5,7 @@ const playerArrayContains = require('./util').playerArrayContains;
const WHITESPACE = ' '; const WHITESPACE = ' ';
const parseWarLog = (lineArray, war) => { const parseWarLog = (lineArray, war) => {
const NAME_TOO_LONG_ERROR = 'Error: ENAMETOOLONG: name too long, open \''; const NAME_TOO_LONG_ERROR = 'Error: ENAMETOOLONG: name too long, open \'';
const stats = { const stats = {
@ -21,6 +22,8 @@ const parseWarLog = (lineArray, war) => {
players: [] players: []
}; };
const vehicleBlacklist = ['Prowler (Unbewaffnet)', 'Qilin (Unbewaffnet)', 'Quad Bike', 'HuntIR'];
const addPlayerIfNotExists = (inputPlayer, steamUUID) => { const addPlayerIfNotExists = (inputPlayer, steamUUID) => {
const player = getPlayerAndFractionFromString(inputPlayer); const player = getPlayerAndFractionFromString(inputPlayer);
if (player && player.name && player.fraction && !playerArrayContains(stats.players, player)) { if (player && player.name && player.fraction && !playerArrayContains(stats.players, player)) {
@ -39,16 +42,16 @@ const parseWarLog = (lineArray, war) => {
} }
/** /**
* KILLS * KILLS & VEHICLE KILLS
*/ */
if (line.includes('(Abschuss)')) { if (line.includes('(Abschuss)')) {
stats.clean.push(line); stats.clean.push(line);
const shooterString = line.substring(line.lastIndexOf(' von: ') + 6, line.lastIndexOf('."')); const shooterString = line.substring(line.lastIndexOf(' von: ') + 6, line.lastIndexOf('."'));
const shooter = getPlayerAndFractionFromString(shooterString); const shooter = getPlayerAndFractionFromString(shooterString);
const targetString = line.substring(line.lastIndexOf(' --- ') + 5, line.lastIndexOf(' von:'));
if (line.includes('Fahrzeug')) { if (line.includes('Fahrzeug:')) {
const targetString = line.substring(line.lastIndexOf(' --- Fahrzeug: ') + 15, line.lastIndexOf(' von:'));
const target = getVehicleAndFractionFromString(targetString); const target = getVehicleAndFractionFromString(targetString);
if (target && shooter && target.fraction !== shooter.fraction) { if (target && shooter && target.fraction !== shooter.fraction) {
stats.vehicles.push({ stats.vehicles.push({
@ -60,6 +63,7 @@ const parseWarLog = (lineArray, war) => {
}) })
} }
} else { } else {
const targetString = line.substring(line.lastIndexOf(' --- ') + 5, line.lastIndexOf(' von:'));
const target = getPlayerAndFractionFromString(targetString); const target = getPlayerAndFractionFromString(targetString);
stats.kills.push({ stats.kills.push({
war: war._id, war: war._id,
@ -196,7 +200,7 @@ const parseWarLog = (lineArray, war) => {
const playerName = stats.players[i].name; const playerName = stats.players[i].name;
stats.players[i]['respawn'] = stats.respawn.filter(res => res.player === playerName).length; 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]['kill'] = stats.kills.filter(kill => kill.shooter === playerName && !kill.friendlyFire).length;
stats.players[i]['vehicle'] = stats.vehicles.filter(vehicle => vehicle.shooter === playerName).length; stats.players[i]['vehicle'] = stats.vehicles.filter(vehicle => vehicle.shooter === playerName && vehicleBlacklist.indexOf(vehicle.target) < 0).length;
stats.players[i]['friendlyFire'] = stats.kills.filter(kill => kill.shooter === playerName && kill.friendlyFire).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]['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]['revive'] = stats.revive.filter(rev => rev.medic === playerName && !rev.stabilized).length;

View File

@ -24,6 +24,7 @@ export interface Player {
name?: string; name?: string;
warId?: War; warId?: War;
kill?: number; kill?: number;
vehicle?: number;
death?: number; death?: number;
friendlyFire?: number; friendlyFire?: number;
revive?: number; revive?: number;

View File

@ -25,15 +25,16 @@
</ngx-datatable-column> </ngx-datatable-column>
<ngx-datatable-column [width]="90" name="Kills" prop="kill"></ngx-datatable-column> <ngx-datatable-column [width]="90" name="Kills" prop="kill"></ngx-datatable-column>
<ngx-datatable-column [width]="104" name="FriendlyFire" prop="friendlyFire"></ngx-datatable-column> <ngx-datatable-column [width]="104" name="FriendlyFire" prop="friendlyFire"></ngx-datatable-column>
<ngx-datatable-column [width]="90" name="Fahrzeug" prop="vehicle"></ngx-datatable-column>
<ngx-datatable-column [width]="80" name="Revive" prop="revive"></ngx-datatable-column> <ngx-datatable-column [width]="80" name="Revive" prop="revive"></ngx-datatable-column>
<ngx-datatable-column [width]="100" name="Eroberung" prop="flagTouch"></ngx-datatable-column> <ngx-datatable-column [width]="100" name="Eroberung" prop="flagTouch"></ngx-datatable-column>
<ngx-datatable-column [width]="70" name="Tod" prop="death"></ngx-datatable-column> <ngx-datatable-column [width]="70" name="Tod" prop="death"></ngx-datatable-column>
<ngx-datatable-column [width]="90" name="Respawn" prop="respawn"></ngx-datatable-column> <ngx-datatable-column [width]="90" name="Respawn" prop="respawn"></ngx-datatable-column>
<ngx-datatable-column [width]="80" name="" prop="name"> <!--<ngx-datatable-column [width]="80" name="" prop="name">-->
<ng-template ngx-datatable-cell-template let-value="value"> <!--<ng-template ngx-datatable-cell-template let-value="value">-->
<span class="btn btn-sm btn-default in-table-btn disabled">Detail</span> <!--<span class="btn btn-sm btn-default in-table-btn disabled">Detail</span>-->
</ng-template> <!--</ng-template>-->
</ngx-datatable-column> <!--</ngx-datatable-column>-->
<ngx-datatable-column [width]="80" name="" prop="name"> <ngx-datatable-column [width]="80" name="" prop="name">
<ng-template ngx-datatable-cell-template let-value="value"> <ng-template ngx-datatable-cell-template let-value="value">
<span class="btn btn-sm btn-default in-table-btn" (click)="selectPlayerDetail(1, value)">Gesamt</span> <span class="btn btn-sm btn-default in-table-btn" (click)="selectPlayerDetail(1, value)">Gesamt</span>

View File

@ -1,21 +1,3 @@
.war-header {
position: fixed;
left: 35%;
border-bottom: thin solid lightgrey;
}
@media only screen and (max-width: 1950px) {
.war-header {
left: 30%;
}
}
@media only screen and (max-width: 1500px) {
.war-header {
left: 380px;
}
}
.war-header-container { .war-header-container {
width: 920px; width: 920px;
min-height: 168px; min-height: 168px;
@ -28,6 +10,10 @@
margin-bottom: 10px; margin-bottom: 10px;
} }
.war-header {
border-bottom: thin solid lightgrey;
}
.nav-tabs > li.active > a { .nav-tabs > li.active > a {
background: #222222; background: #222222;
} }