Add revive field for player

pull/5/head
Florian Hartwich 2017-08-05 23:19:23 +02:00
parent 33c465aeb6
commit e2923c85a6
9 changed files with 28 additions and 17 deletions

View File

@ -36,6 +36,12 @@ const PlayerSchema = new Schema({
set: v => Math.round(v),
required: true
},
revive: {
type: Number,
get: v => Math.round(v),
set: v => Math.round(v),
required: true
},
respawn: {
type: Number,
get: v => Math.round(v),
@ -46,7 +52,7 @@ const PlayerSchema = new Schema({
type: Number,
get: v => Math.round(v),
set: v => Math.round(v),
default: 0
required: true
}
}, {
collection: 'player',

View File

@ -35,11 +35,6 @@ const WarSchema = new Schema({
get: v => Math.round(v),
set: v => Math.round(v),
default: 0
},
bestPlayerId: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Player',
default: null
}
}, {
collection: 'war',

View File

@ -4,7 +4,7 @@ FILE="$1/war.log"
while IFS='' read -r line || [[ -n "$line" ]]; do
case "$line" in
*"Budget"* | *"Mission"* | *"Abschuss"* | *"Respawn"* | *"Punkte"* | *"Flagge"*)
*"Budget"* | *"Mission"* | *"Abschuss"* | *"Respawn"* | *"Punkte"* | *"Flagge"* | *"Revive"*)
echo $line;
echo ""
;;

View File

@ -7,6 +7,7 @@ createScoreboard() {
KILL=0
FF=0
REVIVE=0
DEATH=0
RESPAWN=0
FLAG=0
@ -23,6 +24,9 @@ createScoreboard() {
*\(EAST\)[" "]von:[" "]${ESC_NAME}[" "]\(EAST\)* | *\(WEST\)[" "]von:[" "]${ESC_NAME}[" "]\(WEST\)*)
((FF++))
;;
*\(EAST\)[" "]wurde[" "]von[" "]${ESC_NAME}[" "]\(EAST\)[" "]wiederbelebt* | *\(WEST\)[" "]wurde[" "]von[" "]${ESC_NAME}[" "]\(WEST\)[" "]wiederbelebt*)
((REVIVE++))
;;
*${ESC_NAME}[" "]*von:*)
((DEATH++))
;;
@ -42,7 +46,7 @@ createScoreboard() {
fi
done < <(grep -- "${ESC_NAME}" ${FILE})
printf "\t{\"name\":\"$NAME\", \"fraction\":\"$FRACTION\", \"kill\":${KILL}, \"friendlyFire\":${FF}, \"death\":${DEATH}, \"respawn\":${RESPAWN}, \"flagTouch\":${FLAG}, \"warId\":\"${WAR_ID}\"} "
printf "\t{\"name\":\"$NAME\", \"fraction\":\"$FRACTION\", \"kill\":${KILL}, \"friendlyFire\":${FF}, \"revive\":${REVIVE}, \"death\":${DEATH}, \"respawn\":${RESPAWN}, \"flagTouch\":${FLAG}, \"warId\":\"${WAR_ID}\"} "
if [[ -z ${4} ]]; then
printf ",\n"
else

View File

@ -1,5 +1,8 @@
#!/usr/bin/env bash
# execute script in its location folder
cd $(dirname $0)
# array of files to minify
FILES=(inline main polyfills scripts styles vendor)
OPTIONS="-c toplevel,dead_code=true,unused=true"

View File

@ -7,8 +7,7 @@
"start": "npm run deploy-static-prod && npm start --prefix ./api",
"dev": "npm run deploy-static && npm run dev --prefix ./api",
"deploy-static": "cd ./static && $(npm bin)/ng build && ln -s ../api/resource/ ../public/resource",
"deploy-static-prod": "cd ./static && $(npm bin)/ng build --env=prod && ln -s ../api/resource/ ../public/resource && cd .. && npm run deploy-minify",
"deploy-minify": "./minify.sh",
"deploy-static-prod": "cd ./static && $(npm bin)/ng build --env=prod && ln -s ../api/resource/ ../public/resource && .././minify.sh",
"postinstall": "npm install --prefix ./static && npm install --prefix ./api",
"mongodb": "mkdir -p mongodb-data && mongod --dbpath ./mongodb-data",
"test": "npm test --prefix ./api",

View File

@ -24,6 +24,7 @@ export interface Player {
kill?: number;
death?: number;
friendlyFire?: number;
revive?: number;
respawn?: number;
flagTouch?: number;
}
@ -35,7 +36,6 @@ export interface War {
ptOpfor?: number;
playersBlufor?: number;
playersOpfor?: number;
bestPlayerId?: Player;
players: Player[];
}

View File

@ -22,11 +22,9 @@
.scoreboard-table-container {
min-width: 920px;
max-width: 920px;
margin-left: 5%
}
.table-container {
margin-top: 10px;
overflow-x: auto;
}

View File

@ -1,7 +1,7 @@
<div class="overview" xmlns="http://www.w3.org/1999/html">
<div style="margin-left: 5%; min-height: 263px;">
<h2>{{war.title}} - Schlacht vom {{war.date | date: 'dd.MM.yyyy'}}</h2>
<h2>{{war.title}} - vom {{war.date | date: 'dd.MM.yyyy'}}</h2>
<h3 class="pull-left">
<h4>Endpunktestand:</h4>
<span class="text-blufor" style="font-weight: bold; margin-right: 10px">NATO {{war.ptBlufor}}</span>
@ -53,7 +53,7 @@
</div>
</div>
<div class="pull-left">
<div class="pull-left" style="margin-left: 5%">
<div class="table-container scoreboard-table-container">
<table class="table table-hover" [mfData]="players" #mf="mfDataTable" [(mfSortBy)]="sortBy"
[(mfSortOrder)]="sortOrder">
@ -72,10 +72,13 @@
<mfDefaultSorter by="friendlyFire">FriendlyFire</mfDefaultSorter>
</th>
<th class="col-sm-1">
<mfDefaultSorter by="flagTouch">Eroberungen</mfDefaultSorter>
<mfDefaultSorter by="revive">Revive</mfDefaultSorter>
</th>
<th class="col-sm-1">
<mfDefaultSorter by="death">Tode</mfDefaultSorter>
<mfDefaultSorter by="flagTouch">Eroberung</mfDefaultSorter>
</th>
<th class="col-sm-1">
<mfDefaultSorter by="death">Tod</mfDefaultSorter>
</th>
<th class="col-sm-1" style="border-radius: 0 10px 0 0;">
<mfDefaultSorter by="respawn">Respawn</mfDefaultSorter>
@ -96,6 +99,9 @@
<td>
{{player.friendlyFire}}
</td>
<td>
{{player.revive}}
</td>
<td>
{{player.flagTouch}}
</td>