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

View File

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

View File

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

View File

@ -7,6 +7,7 @@ createScoreboard() {
KILL=0 KILL=0
FF=0 FF=0
REVIVE=0
DEATH=0 DEATH=0
RESPAWN=0 RESPAWN=0
FLAG=0 FLAG=0
@ -23,6 +24,9 @@ createScoreboard() {
*\(EAST\)[" "]von:[" "]${ESC_NAME}[" "]\(EAST\)* | *\(WEST\)[" "]von:[" "]${ESC_NAME}[" "]\(WEST\)*) *\(EAST\)[" "]von:[" "]${ESC_NAME}[" "]\(EAST\)* | *\(WEST\)[" "]von:[" "]${ESC_NAME}[" "]\(WEST\)*)
((FF++)) ((FF++))
;; ;;
*\(EAST\)[" "]wurde[" "]von[" "]${ESC_NAME}[" "]\(EAST\)[" "]wiederbelebt* | *\(WEST\)[" "]wurde[" "]von[" "]${ESC_NAME}[" "]\(WEST\)[" "]wiederbelebt*)
((REVIVE++))
;;
*${ESC_NAME}[" "]*von:*) *${ESC_NAME}[" "]*von:*)
((DEATH++)) ((DEATH++))
;; ;;
@ -42,7 +46,7 @@ createScoreboard() {
fi fi
done < <(grep -- "${ESC_NAME}" ${FILE}) 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 if [[ -z ${4} ]]; then
printf ",\n" printf ",\n"
else else

View File

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

View File

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

View File

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

View File

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

View File

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