Add vehicle kills to fraction stats
parent
57f093f4dc
commit
840695bf0e
|
@ -13,6 +13,7 @@ const LogBudgetModel = require('../models/logs/budget');
|
||||||
const LogRespawnModel = require('../models/logs/respawn');
|
const LogRespawnModel = require('../models/logs/respawn');
|
||||||
const LogReviveModel = require('../models/logs/revive');
|
const LogReviveModel = require('../models/logs/revive');
|
||||||
const LogKillModel = require('../models/logs/kill');
|
const LogKillModel = require('../models/logs/kill');
|
||||||
|
const LogVehicleModel = require('../models/logs/vehicle');
|
||||||
const LogTransportModel = require('../models/logs/transport');
|
const LogTransportModel = require('../models/logs/transport');
|
||||||
const LogFlagModel = require('../models/logs/flag');
|
const LogFlagModel = require('../models/logs/flag');
|
||||||
const LogPointsModel = require('../models/logs/points');
|
const LogPointsModel = require('../models/logs/points');
|
||||||
|
@ -43,6 +44,7 @@ logsRouter.route('/:warId')
|
||||||
const respawnObjects = LogRespawnModel.find(filter, {}, sort);
|
const respawnObjects = LogRespawnModel.find(filter, {}, sort);
|
||||||
const reviveObjects = LogReviveModel.find(filter, {}, sort);
|
const reviveObjects = LogReviveModel.find(filter, {}, sort);
|
||||||
const killObjects = LogKillModel.find(filter, {}, sort);
|
const killObjects = LogKillModel.find(filter, {}, sort);
|
||||||
|
const vehicleObjects = LogVehicleModel.find(filter, {}, sort);
|
||||||
const transportObjects = LogTransportModel.find(filter, {}, sort);
|
const transportObjects = LogTransportModel.find(filter, {}, sort);
|
||||||
const flagObjects = LogFlagModel.find(filter, {}, sort);
|
const flagObjects = LogFlagModel.find(filter, {}, sort);
|
||||||
const resources = {
|
const resources = {
|
||||||
|
@ -51,6 +53,7 @@ logsRouter.route('/:warId')
|
||||||
respawn: respawnObjects.exec.bind(respawnObjects),
|
respawn: respawnObjects.exec.bind(respawnObjects),
|
||||||
revive: reviveObjects.exec.bind(reviveObjects),
|
revive: reviveObjects.exec.bind(reviveObjects),
|
||||||
kill: killObjects.exec.bind(killObjects),
|
kill: killObjects.exec.bind(killObjects),
|
||||||
|
vehicle: killObjects.exec.bind(vehicleObjects),
|
||||||
transport: transportObjects.exec.bind(transportObjects),
|
transport: transportObjects.exec.bind(transportObjects),
|
||||||
flag: flagObjects.exec.bind(flagObjects)
|
flag: flagObjects.exec.bind(flagObjects)
|
||||||
};
|
};
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
btnRadio="{{labelKill}}">{{labelKill}}</label>
|
btnRadio="{{labelKill}}">{{labelKill}}</label>
|
||||||
<label class="btn btn-default btn-dark" [(ngModel)]="chartSelectModel"
|
<label class="btn btn-default btn-dark" [(ngModel)]="chartSelectModel"
|
||||||
btnRadio="{{labelFriendlyFire}}">{{labelFriendlyFire}}</label>
|
btnRadio="{{labelFriendlyFire}}">{{labelFriendlyFire}}</label>
|
||||||
|
<label class="btn btn-default btn-dark" [(ngModel)]="chartSelectModel"
|
||||||
|
btnRadio="{{labelVehicle}}">{{labelVehicle}}</label>
|
||||||
<label class="btn btn-default btn-dark" [(ngModel)]="chartSelectModel"
|
<label class="btn btn-default btn-dark" [(ngModel)]="chartSelectModel"
|
||||||
btnRadio="{{labelRevive}}">{{labelRevive}}</label>
|
btnRadio="{{labelRevive}}">{{labelRevive}}</label>
|
||||||
<label class="btn btn-default btn-dark" [(ngModel)]="chartSelectModel"
|
<label class="btn btn-default btn-dark" [(ngModel)]="chartSelectModel"
|
||||||
|
|
|
@ -34,6 +34,7 @@ export class FractionStatsComponent {
|
||||||
tmpBudgetData;
|
tmpBudgetData;
|
||||||
tmpKillData;
|
tmpKillData;
|
||||||
tmpFrienlyFireData;
|
tmpFrienlyFireData;
|
||||||
|
tmpVehicleData;
|
||||||
tmpTransportData;
|
tmpTransportData;
|
||||||
tmpReviveData;
|
tmpReviveData;
|
||||||
tmpStabilizeData;
|
tmpStabilizeData;
|
||||||
|
@ -47,6 +48,7 @@ export class FractionStatsComponent {
|
||||||
labelBudget = 'Budget';
|
labelBudget = 'Budget';
|
||||||
labelKill = 'Kills';
|
labelKill = 'Kills';
|
||||||
labelFriendlyFire = 'FriendlyFire';
|
labelFriendlyFire = 'FriendlyFire';
|
||||||
|
labelVehicle = 'Fahrzeug-Kills';
|
||||||
labelTransport = 'Lufttransport';
|
labelTransport = 'Lufttransport';
|
||||||
labelRevive = 'Revive';
|
labelRevive = 'Revive';
|
||||||
labelStabilize = 'Stabilisiert';
|
labelStabilize = 'Stabilisiert';
|
||||||
|
@ -111,6 +113,10 @@ export class FractionStatsComponent {
|
||||||
this.initKillData();
|
this.initKillData();
|
||||||
this.lineChartData = this.tmpFrienlyFireData;
|
this.lineChartData = this.tmpFrienlyFireData;
|
||||||
break;
|
break;
|
||||||
|
case this.labelVehicle:
|
||||||
|
this.initVehicleData();
|
||||||
|
this.lineChartData = this.tmpVehicleData;
|
||||||
|
break;
|
||||||
case this.labelRevive:
|
case this.labelRevive:
|
||||||
this.initRevive();
|
this.initRevive();
|
||||||
this.lineChartData = this.tmpReviveData;
|
this.lineChartData = this.tmpReviveData;
|
||||||
|
@ -250,6 +256,30 @@ export class FractionStatsComponent {
|
||||||
this.initialized.revive = true;
|
this.initialized.revive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initVehicleData() {
|
||||||
|
if (this.initialized.vehicle) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let vehicleKillCountBlufor = 0, vehicleKillCountOpfor = 0;
|
||||||
|
for (const {transportEntry: vehicleEntry, index} of this.logData.vehicle.map((transportEntry, index) => ({
|
||||||
|
transportEntry,
|
||||||
|
index
|
||||||
|
}))) {
|
||||||
|
const vehicleEntryDate = new Date(vehicleEntry.time);
|
||||||
|
if (vehicleEntry.fraction === 'BLUFOR') {
|
||||||
|
vehicleKillCountBlufor++;
|
||||||
|
} else {
|
||||||
|
vehicleKillCountOpfor++;
|
||||||
|
}
|
||||||
|
if (this.isTwoMinutesAhead(vehicleEntryDate, this.tmpVehicleData) || index === this.logData.vehicle.length - 1) {
|
||||||
|
this.tmpVehicleData[0].series.push(ChartUtils.getSeriesEntry(vehicleEntryDate, vehicleKillCountBlufor));
|
||||||
|
this.tmpVehicleData[1].series.push(ChartUtils.getSeriesEntry(vehicleEntryDate, vehicleKillCountOpfor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.addFinalTimeData(this.tmpVehicleData);
|
||||||
|
this.initialized.vehicle = true;
|
||||||
|
}
|
||||||
|
|
||||||
initTransportData() {
|
initTransportData() {
|
||||||
if (this.initialized.transport) {
|
if (this.initialized.transport) {
|
||||||
return;
|
return;
|
||||||
|
@ -272,7 +302,6 @@ export class FractionStatsComponent {
|
||||||
}
|
}
|
||||||
this.addFinalTimeData(this.tmpTransportData);
|
this.addFinalTimeData(this.tmpTransportData);
|
||||||
this.initialized.transport = true;
|
this.initialized.transport = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
initFlagHoldData() {
|
initFlagHoldData() {
|
||||||
|
@ -308,12 +337,13 @@ export class FractionStatsComponent {
|
||||||
this.tmpBudgetData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
|
this.tmpBudgetData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
|
||||||
this.tmpKillData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
|
this.tmpKillData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
|
||||||
this.tmpFrienlyFireData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
|
this.tmpFrienlyFireData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
|
||||||
|
this.tmpVehicleData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
|
||||||
this.tmpTransportData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
|
this.tmpTransportData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
|
||||||
this.tmpReviveData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
|
this.tmpReviveData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
|
||||||
this.tmpStabilizeData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
|
this.tmpStabilizeData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
|
||||||
this.tmpFlagCaptureData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
|
this.tmpFlagCaptureData = ChartUtils.getMultiDataArray(Fraction.BLUFOR, Fraction.OPFOR);
|
||||||
|
|
||||||
[this.tmpKillData, this.tmpFrienlyFireData, this.tmpReviveData, this.tmpStabilizeData, this.tmpTransportData].forEach(tmp => {
|
[this.tmpKillData, this.tmpFrienlyFireData, this.tmpVehicleData, this.tmpReviveData, this.tmpStabilizeData, this.tmpTransportData].forEach(tmp => {
|
||||||
[0, 1].forEach(index => {
|
[0, 1].forEach(index => {
|
||||||
tmp[index].series.push(ChartUtils.getSeriesEntry(this.startDateObj, 0));
|
tmp[index].series.push(ChartUtils.getSeriesEntry(this.startDateObj, 0));
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue