Add war participation count for highscore page (CC-85); Add player transport stats for highscore page (CC-84)

pull/52/head
HardiReady 2019-02-11 22:57:31 +01:00
parent e2764c938d
commit 939613d55c
7 changed files with 49 additions and 17 deletions

View File

@ -54,26 +54,43 @@ campaignPlayer.route('/ranking/:campaignId')
revive: 0, revive: 0,
respawn: 0, respawn: 0,
flagTouch: 0, flagTouch: 0,
travelDistance: 0,
driverDistance: 0,
}; };
for (let i = 0; i < playerInstances.length; i++) { for (let i = 0; i < playerInstances.length; i++) {
resItem.kill += playerInstances[i].kill; const player = playerInstances[i];
resItem.death += playerInstances[i].death; resItem.kill += player.kill;
resItem.friendlyFire += playerInstances[i].friendlyFire; resItem.death += player.death;
resItem.vehicleLight += playerInstances[i].vehicleLight; resItem.friendlyFire += player.friendlyFire;
resItem.vehicleHeavy += playerInstances[i].vehicleHeavy; resItem.vehicleLight += player.vehicleLight;
resItem.vehicleAir += playerInstances[i].vehicleAir; resItem.vehicleHeavy += player.vehicleHeavy;
resItem.revive += playerInstances[i].revive; resItem.vehicleAir += player.vehicleAir;
resItem.respawn += playerInstances[i].respawn; resItem.revive += player.revive;
resItem.flagTouch += playerInstances[i].flagTouch; resItem.respawn += player.respawn;
resItem.flagTouch += player.flagTouch;
if (player.travelDistance) {
resItem.travelDistance += Math.round(player.travelDistance / 1000);
}
if (player.driverDistance) {
resItem.driverDistance += Math.round(player.driverDistance / 1000);
}
} }
resItem.warCount = playerInstances.length;
resItem.fraction = playerInstances[playerInstances.length - 1].fraction; resItem.fraction = playerInstances[playerInstances.length - 1].fraction;
rankingItems.push(resItem); rankingItems.push(resItem);
}); });
const getSortedField = (fieldName) => { const getSortedField = (fieldName) => {
let num = 1; let num = 1;
rankingItems.sort((a, b) => b[fieldName] - a[fieldName]); const filteredSortResult = rankingItems.map(item => {
const res = JSON.parse(JSON.stringify(rankingItems)); return {
name: item.name,
fraction: item.fraction,
[fieldName]: item[fieldName]
}
})
.sort((a, b) => b[fieldName] - a[fieldName]);
const res = JSON.parse(JSON.stringify(filteredSortResult));
for (const entity of res) { for (const entity of res) {
entity.num = num++; entity.num = num++;
} }
@ -90,6 +107,9 @@ campaignPlayer.route('/ranking/:campaignId')
revive: getSortedField('revive'), revive: getSortedField('revive'),
respawn: getSortedField('respawn'), respawn: getSortedField('respawn'),
flagTouch: getSortedField('flagTouch'), flagTouch: getSortedField('flagTouch'),
travelDistance: getSortedField('travelDistance'),
driverDistance: getSortedField('driverDistance'),
warCount: getSortedField('warCount'),
}; };
next(); next();
}); });

View File

@ -67,6 +67,7 @@ export class AppComponent implements OnInit {
'vehicleLight': 'stats/scoreboard/vehicle-light', 'vehicleLight': 'stats/scoreboard/vehicle-light',
'travelDistance': 'stats/scoreboard/travel-distance', 'travelDistance': 'stats/scoreboard/travel-distance',
'driverDistance': 'stats/scoreboard/driver-distance', 'driverDistance': 'stats/scoreboard/driver-distance',
'warCount': 'stats/scoreboard/war-count',
// --------LOCALE--------- // --------LOCALE---------
'flag-de': 'locale/de', 'flag-de': 'locale/de',
'flag-en': 'locale/en', 'flag-en': 'locale/en',

View File

@ -8,13 +8,13 @@ h2 {
.search-field { .search-field {
width: 40%; width: 40%;
margin: 32px 0 0 8%; margin: 50px 0 50px 8%;
} }
.highscore-table-container { .highscore-table-container {
width: 320px; width: 320px;
max-height: 394px; max-height: 394px;
margin: 100px 0 0 8%; margin: 50px 0 50px 8%;
float: left; float: left;
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
@ -36,7 +36,8 @@ h2 {
} }
.mat-column-kill, .mat-column-friendlyFire, .mat-column-revive, .mat-column-flagTouch, .mat-column-kill, .mat-column-friendlyFire, .mat-column-revive, .mat-column-flagTouch,
.mat-column-vehicleLight, .mat-column-vehicleHeavy, .mat-column-vehicleAir, .mat-column-death, .mat-column-respawn { .mat-column-vehicleLight, .mat-column-vehicleHeavy, .mat-column-vehicleAir, .mat-column-death, .mat-column-respawn,
.mat-column-driverDistance, .mat-column-travelDistance, .mat-column-warCount {
width: 67px; width: 67px;
text-indent: 14px; text-indent: 14px;
} }

View File

@ -1,7 +1,6 @@
import {Component, Input, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router'; import {ActivatedRoute} from '@angular/router';
import {PlayerService} from '../../../services/logs/player.service'; import {PlayerService} from '../../../services/logs/player.service';
import {CampaignService} from '../../../services/logs/campaign.service';
import {Fraction} from '../../../utils/fraction.enum'; import {Fraction} from '../../../utils/fraction.enum';
import {FormControl} from '@angular/forms'; import {FormControl} from '@angular/forms';
import {Observable} from 'rxjs/Observable'; import {Observable} from 'rxjs/Observable';
@ -24,7 +23,7 @@ export class StatisticHighScoreComponent implements OnInit {
playersStored = {}; playersStored = {};
playerAttributeDisplayNames = PlayerUtils.tmpAttributeDisplayNames.slice(2, PlayerUtils.tmpAttributeDisplayNames.length); playerAttributeDisplayNames = PlayerUtils.attributeDisplayNames.slice(2, PlayerUtils.attributeDisplayNames.length);
readonly fraction = Fraction; readonly fraction = Fraction;
@ -33,6 +32,8 @@ export class StatisticHighScoreComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.playerAttributeDisplayNames.push({prop: 'warCount', head: 'stats.scoreboard.header.war.count'});
this.route.params this.route.params
.map(params => params['id']) .map(params => params['id'])
.subscribe((id) => { .subscribe((id) => {

View File

@ -67,6 +67,7 @@
"stats.scoreboard.header.respawn": "Respawn", "stats.scoreboard.header.respawn": "Respawn",
"stats.scoreboard.header.travel.distance": "Passagier Flugdistanz (km)", "stats.scoreboard.header.travel.distance": "Passagier Flugdistanz (km)",
"stats.scoreboard.header.driver.distance": "Pilot Flugdistanz (km)", "stats.scoreboard.header.driver.distance": "Pilot Flugdistanz (km)",
"stats.scoreboard.header.war.count": "Schlachtteilnahmen",
"stats.scoreboard.button.detail": "Kampagnenstatistik für {{name}}", "stats.scoreboard.button.detail": "Kampagnenstatistik für {{name}}",
"stats.highscore.filter.placholder": "Spielername (mehrere mit '&' trennen)", "stats.highscore.filter.placholder": "Spielername (mehrere mit '&' trennen)",

View File

@ -74,6 +74,7 @@
"stats.scoreboard.header.respawn": "Respawn", "stats.scoreboard.header.respawn": "Respawn",
"stats.scoreboard.header.travel.distance": "Passenger Travel Distance (km)", "stats.scoreboard.header.travel.distance": "Passenger Travel Distance (km)",
"stats.scoreboard.header.driver.distance": "Pilot Travel Distance (km)", "stats.scoreboard.header.driver.distance": "Pilot Travel Distance (km)",
"stats.scoreboard.header.war.count": "Battle Participation",
"stats.scoreboard.button.detail": "Campaign statistics for {{name}}", "stats.scoreboard.button.detail": "Campaign statistics for {{name}}",
"stats.highscore.filter.placholder": "Player Name (separate multiple using '&')", "stats.highscore.filter.placholder": "Player Name (separate multiple using '&')",

View File

@ -0,0 +1,7 @@
<svg enable-background="new 0 0 50 50" version="1.1" viewBox="0 0 50 50" xml:space="preserve" xmlns="http://www.w3.org/2000/svg">
<g transform="matrix(.64 0 0 .64 -.092 .055)" stroke-width="1.6">
<path d="m32 20c6.6-5.6 12-12 17-20 0.1-0.2 0.1-0.4-0.1-0.5-0.1-0.1-0.3-0.1-0.5 0-1.6 1.2-4 3-6.5 4.2-3.2 1.6-6.6 2.3-8.3 2.5-0.7 0.1-1.4 0.5-1.8 1.2-0.9 1.3-2.5 3.9-4.6 6.7 1 1.3 2 2.6 3.2 3.8 0.6 0.7 1.2 1.3 1.8 2z"/>
<path d="m19 24c-2.8 3.1-4.8 5.2-6 6.4l-0.5-0.5c-0.6-0.7-1.7-0.7-2.3 0s-0.6 1.7 0 2.4l0.2 0.2c-0.6-0.1-1.2 0.1-1.6 0.6-0.5 0.5-0.7 1.3-0.5 2-0.7-0.2-1.4 0-1.9 0.5s-0.7 1.3-0.5 2c-0.7-0.2-1.4 0-1.9 0.5s-0.7 1.2-0.6 1.8l-0.3-0.3c-0.6-0.7-1.7-0.7-2.3 0s-0.6 1.7 0 2.4l6.7 7.1c0.3 0.3 0.6 0.4 1 0.5l3.8 0.4h0.2c0.8 0 1.5-0.6 1.6-1.5s-0.5-1.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 2 0.4 0.4 0.9 0.6 1.4 0.6h0.4l-2.3 2.4-3.2 0.4c-0.9 0.1-1.5 0.9-1.4 1.9 0.1 0.9 0.8 1.5 1.6 1.5h0.2l3.8-0.4c0.4 0 0.7-0.2 1-0.5l6.9-7.1c0.8-0.7 0.8-1.8 0.1-2.4z"/>
</g>
<g transform="matrix(.043 0 -.015 .04 32 13)" stroke-width="24"><path d="m240 313 21 1c2 0.67 5 1.7 9 3 9.3 4.7 16 12 21 22 3.3 6.7 5 21 5 42v92h93v-58c-3.9e-4 -42 1-66 3-72 2-5.3 5.7-11 11-16 5.3-6 11-10 17-12 8.7-2.7 17-3.3 25-2 4 0.67 8.3 2 13 4 9.3 4.7 16 12 21 22 3.3 6.7 5 21 5 42v92h26c17 5.8e-4 26 0.33 29 1 21 4 33 16 38 36 0.67 3.3 1 7 1 11-5.8e-4 21-9.3 35-28 44-3.3 1.3-7 2.3-11 3-2.7 0.67-12 1-29 1h-26v105h26c17 3.8e-4 26 0.33 29 1 21 4 33 16 38 36 0.67 3.3 1 7 1 11-5.8e-4 21-9.3 35-28 44-3.3 1.3-7 2.3-11 3-2.7 0.67-12 1-29 1h-26v59c-4.8e-4 39-0.33 60-1 63-3.3 20-15 33-35 38-4 0.67-8 1-12 1-20 1.2e-4 -34-9.3-43-28-1.3-3.3-2.7-7-4-11-3.9e-4 -3.3-3.9e-4 -24 0-63v-59h-93v59c-3e-4 39-3e-4 60 0 63-4 20-16 33-36 38-4 0.67-8 1-12 1-21 1.2e-4 -35-9.7-44-29-1.3-3.3-2.3-6.7-3-10-2e-4 -3.3-2e-4 -24 0-63v-59h-28c-18 2.8e-4 -28-0.67-31-2-22-6.7-34-22-35-46-1.1e-4 -22 12-37 35-46 2.7-0.67 13-1.3 31-2h28v-105h-28c-18 4.9e-4 -28-0.67-31-2-22-9.3-34-25-35-46-1.1e-4 -23 12-38 35-46 2.7-1.3 13-2 31-2h28v-58c-2e-4 -42 1-66 3-72 2-5.3 5.7-11 11-16 7.3-7.3 16-12 25-14m149 309v-53h-93v105h93v-52"/></g></svg>

After

Width:  |  Height:  |  Size: 3.0 KiB