Add new stats and medals

This commit is contained in:
Vincent Riquer 2014-12-26 15:11:22 +01:00
parent 6b0a4b570d
commit 92f7a17959
5 changed files with 41 additions and 15 deletions

3
add
View File

@ -77,11 +77,12 @@ data=N
for dsname in "${dsnames[@]}" for dsname in "${dsnames[@]}"
do do
data+=:${POST["$dsname"]:=U} data+=:${POST["$dsname"]:=U}
template+="${template:+:}$dsname"
echo "$dsname....${POST["$dsname"]}" echo "$dsname....${POST["$dsname"]}"
done done
echo ${POST["innovator"]} > .innovator echo ${POST["innovator"]} > .innovator
rrdtool update ingress.rrd "$data" rrdtool update ingress.rrd -t $template "$data"
if [ -n "$CACHE_DIR" ] if [ -n "$CACHE_DIR" ]
then then

View File

@ -68,6 +68,7 @@ then
DS:Field_Held:GAUGE:$((48*60*60)):0:NaN \ DS:Field_Held:GAUGE:$((48*60*60)):0:NaN \
DS:Field_x_Days:GAUGE:$((48*60*60)):0:NaN \ DS:Field_x_Days:GAUGE:$((48*60*60)):0:NaN \
DS:Mercenary:GAUGE:$((48*60*60)):0:NaN \ DS:Mercenary:GAUGE:$((48*60*60)):0:NaN \
DS:Engineer:GAUGE:$((48*60*60)):0:NaN \
RRA:HWPREDICT:8760:8e-1:8e-1:$((24)) \ RRA:HWPREDICT:8760:8e-1:8e-1:$((24)) \
RRA:AVERAGE:99e-2:1:$((24*15)) \ RRA:AVERAGE:99e-2:1:$((24*15)) \
RRA:MAX:99e-2:1:$((24*15)) \ RRA:MAX:99e-2:1:$((24*15)) \

16
import
View File

@ -24,12 +24,17 @@ do
done done
read_query_string read_query_string
template=AP:Explorer:Seer:XM:Walked:Builder:Connector:Mind_Controller:MU:Longest_Link:Largest_Field:Recharger:Liberator:Pioneer:Engineer:Purifier:Neutralized:Links_Destroyed:Fields_Destroyed:Guardian:Link_Maintained:Link_Length_x_Days:Field_Held:Field_x_Days:Mercenary:Hacker
if [[ $REQUEST_METHOD == POST ]] if [[ $REQUEST_METHOD == POST ]]
then then
cat <<-EOHead cat <<-EOHead
Content-type: text/plain Content-type: text/plain
Last-Modified: $(LC_ALL=C TZ=GMT date +'%a, %d %b %Y %X %Z') Last-Modified: $(LC_ALL=C TZ=GMT date +'%a, %d %b %Y %X %Z')
Expires: $(LC_ALL=C TZ=GMT date +'%a, %d %b %Y %X %Z') Expires: $(LC_ALL=C TZ=GMT date +'%a, %d %b %Y %X %Z')
EOHead
cat <<-EOHead >/dev/null
refresh: 0,url=/cgi/$webuser/?start=${POST["start"]}&end=${POST["end"]} refresh: 0,url=/cgi/$webuser/?start=${POST["start"]}&end=${POST["end"]}
EOHead EOHead
@ -75,7 +80,7 @@ then
while read date hour data while read date hour data
do do
data=$(date -d "$date $hour" +%s):${data// /:} data=$(date -d "$date $hour" +%s):${data// /:}
rrdtool update ingress.rrd "$data" 2>&1 rrdtool update ingress.rrd -t $template "$data" 2>&1
done <<<"${POST["data"]}" done <<<"${POST["data"]}"
if [ -n "$CACHE_DIR" ] if [ -n "$CACHE_DIR" ]
@ -128,6 +133,7 @@ else
DS:Field_Held:GAUGE:$((48*60*60)):0:NaN \ DS:Field_Held:GAUGE:$((48*60*60)):0:NaN \
DS:Field_x_Days:GAUGE:$((48*60*60)):0:NaN \ DS:Field_x_Days:GAUGE:$((48*60*60)):0:NaN \
DS:Mercenary:GAUGE:$((48*60*60)):0:NaN \ DS:Mercenary:GAUGE:$((48*60*60)):0:NaN \
DS:Engineer:GAUGE:$((48*60*60)):0:NaN \
RRA:HWPREDICT:8760:8e-1:8e-1:$((24)) \ RRA:HWPREDICT:8760:8e-1:8e-1:$((24)) \
RRA:AVERAGE:99e-2:1:$((24*15)) \ RRA:AVERAGE:99e-2:1:$((24*15)) \
RRA:MAX:99e-2:1:$((24*15)) \ RRA:MAX:99e-2:1:$((24*15)) \
@ -152,12 +158,8 @@ else
cat <<-EOHTML cat <<-EOHTML
<div class="main"> <div class="main">
<p>Import data from e.g. https://www.agent-stats.com/ <br/> <p>Import data from e.g. https://www.agent-stats.com/ <br/>
<small>Expected format: <tt>YYYY-MM-DD hh:mm:ss AP Explorer Seer XM Hacker <small>Expected format: <tt>YYYY-MM-DD hh:mm:ss
Builder Connector Mind_Controller MU Longest_Link Largest_Field ${template[@]//:/ }</tt></small></p>
Recharger Liberator Pioneer Purifier Neutralized Links_Destroyed
Fields_Destroyed Walked Guardian Link_Maintained
Link_Length_x_Days Field_Held Field_x_Days
Mercenary</tt></small></p>
<form method="post" action="import"> <form method="post" action="import">
<input type="hidden" name="start" value="$start" /> <input type="hidden" name="start" value="$start" />
<input type="hidden" name="end" value="$end" /> <input type="hidden" name="end" value="$end" />

View File

@ -32,7 +32,7 @@ div.menu {
div.anchor { div.anchor {
position: relative; position: relative;
top: -9.5em; top: -10.9em;
} }
table.menu { table.menu {
@ -62,12 +62,12 @@ td.submenu-inv {
div.main { div.main {
position: absolute; position: absolute;
top: 7.5em; top: 8.9em;
} }
div.maingraph { div.maingraph {
position: absolute; position: absolute;
top: 9.3em; top: 10.5em;
} }
table.curlevel { table.curlevel {

View File

@ -40,7 +40,7 @@ uinames=(
"Unique Portals Visited" "Unique Portals Visited"
"Portals Discovered" "Portals Discovered"
"XM Collected" "XM Collected"
Hacks "Distance Walked"
"Resonators Deployed" "Resonators Deployed"
"Links Created" "Links Created"
"Control Fields Created" "Control Fields Created"
@ -50,24 +50,25 @@ uinames=(
"XM Recharged" "XM Recharged"
"Portals Captured" "Portals Captured"
"Unique Portals Captured" "Unique Portals Captured"
"Mods Deployed"
"Resonators Destroyed" "Resonators Destroyed"
"Portals Neutralized" "Portals Neutralized"
"Enemy Links Destroyed" "Enemy Links Destroyed"
"Enemy Control Fields Destroyed" "Enemy Control Fields Destroyed"
"Distance Walked"
"Max Time Portal Held" "Max Time Portal Held"
"Max Time Link Maintained" "Max Time Link Maintained"
"Max Link Length x Days" "Max Link Length x Days"
"Max Time Field Held" "Max Time Field Held"
"Largest Field MUs x Days" "Largest Field MUs x Days"
"Unique missions completed" "Unique missions completed"
Hacks
) )
dsnames=( dsnames=(
AP AP
Explorer Explorer
Seer Seer
XM XM
Hacker Walked
Builder Builder
Connector Connector
Mind_Controller Mind_Controller
@ -77,17 +78,18 @@ dsnames=(
Recharger Recharger
Liberator Liberator
Pioneer Pioneer
Engineer
Purifier Purifier
Neutralized Neutralized
Links_Destroyed Links_Destroyed
Fields_Destroyed Fields_Destroyed
Walked
Guardian Guardian
Link_Maintained Link_Maintained
Link_Length_x_Days Link_Length_x_Days
Field_Held Field_Held
Field_x_Days Field_x_Days
Mercenary Mercenary
Hacker
) )
medals=( medals=(
Explorer Explorer
@ -101,6 +103,9 @@ medals=(
Pioneer Pioneer
Purifier Purifier
Guardian Guardian
Mercenary
Engineer
Walked
) )
## (0) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ## (0) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
@ -177,3 +182,20 @@ gold["Guardian"]=20
platinum["Guardian"]=90 platinum["Guardian"]=90
black["Guardian"]=150 black["Guardian"]=150
bronze["Engineer"]=150
silver["Engineer"]=1500
gold["Engineer"]=5000
platinum["Engineer"]=20000
black["Engineer"]=50000
bronze["Walked"]=10
silver["Walked"]=100
gold["Walked"]=300
platinum["Walked"]=1000
black["Walked"]=2500
bronze["Mercenary"]=5
silver["Mercenary"]=25
gold["Mercenary"]=100
platinum["Mercenary"]=200
black["Mercenary"]=500