From 92f7a1795929af79e826fd7c916d93a757512452 Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Fri, 26 Dec 2014 15:11:22 +0100 Subject: [PATCH] Add new stats and medals --- add | 3 ++- add.html | 1 + import | 16 +++++++++------- ingrrd.css | 6 +++--- settings | 30 ++++++++++++++++++++++++++---- 5 files changed, 41 insertions(+), 15 deletions(-) diff --git a/add b/add index 5761467..b6c6c07 100755 --- a/add +++ b/add @@ -77,11 +77,12 @@ data=N for dsname in "${dsnames[@]}" do data+=:${POST["$dsname"]:=U} + template+="${template:+:}$dsname" echo "$dsname....${POST["$dsname"]}" done echo ${POST["innovator"]} > .innovator -rrdtool update ingress.rrd "$data" +rrdtool update ingress.rrd -t $template "$data" if [ -n "$CACHE_DIR" ] then diff --git a/add.html b/add.html index c19ab32..857d377 100755 --- a/add.html +++ b/add.html @@ -68,6 +68,7 @@ then DS:Field_Held: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:Engineer:GAUGE:$((48*60*60)):0:NaN \ RRA:HWPREDICT:8760:8e-1:8e-1:$((24)) \ RRA:AVERAGE:99e-2:1:$((24*15)) \ RRA:MAX:99e-2:1:$((24*15)) \ diff --git a/import b/import index 27e5fe6..0119d53 100755 --- a/import +++ b/import @@ -24,12 +24,17 @@ do done 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 ]] then cat <<-EOHead Content-type: text/plain 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') + + EOHead + cat <<-EOHead >/dev/null refresh: 0,url=/cgi/$webuser/?start=${POST["start"]}&end=${POST["end"]} EOHead @@ -75,7 +80,7 @@ then while read date hour data do 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"]}" if [ -n "$CACHE_DIR" ] @@ -128,6 +133,7 @@ else DS:Field_Held: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:Engineer:GAUGE:$((48*60*60)):0:NaN \ RRA:HWPREDICT:8760:8e-1:8e-1:$((24)) \ RRA:AVERAGE:99e-2:1:$((24*15)) \ RRA:MAX:99e-2:1:$((24*15)) \ @@ -152,12 +158,8 @@ else cat <<-EOHTML

Import data from e.g. https://www.agent-stats.com/
- Expected format: YYYY-MM-DD hh:mm:ss AP Explorer Seer XM Hacker - Builder Connector Mind_Controller MU Longest_Link Largest_Field - Recharger Liberator Pioneer Purifier Neutralized Links_Destroyed - Fields_Destroyed Walked Guardian Link_Maintained - Link_Length_x_Days Field_Held Field_x_Days - Mercenary

+ Expected format: YYYY-MM-DD hh:mm:ss + ${template[@]//:/ }

diff --git a/ingrrd.css b/ingrrd.css index f0b34dd..c22b952 100644 --- a/ingrrd.css +++ b/ingrrd.css @@ -32,7 +32,7 @@ div.menu { div.anchor { position: relative; - top: -9.5em; + top: -10.9em; } table.menu { @@ -62,12 +62,12 @@ td.submenu-inv { div.main { position: absolute; - top: 7.5em; + top: 8.9em; } div.maingraph { position: absolute; - top: 9.3em; + top: 10.5em; } table.curlevel { diff --git a/settings b/settings index 0e3309b..9415c25 100644 --- a/settings +++ b/settings @@ -40,7 +40,7 @@ uinames=( "Unique Portals Visited" "Portals Discovered" "XM Collected" - Hacks + "Distance Walked" "Resonators Deployed" "Links Created" "Control Fields Created" @@ -50,24 +50,25 @@ uinames=( "XM Recharged" "Portals Captured" "Unique Portals Captured" + "Mods Deployed" "Resonators Destroyed" "Portals Neutralized" "Enemy Links Destroyed" "Enemy Control Fields Destroyed" - "Distance Walked" "Max Time Portal Held" "Max Time Link Maintained" "Max Link Length x Days" "Max Time Field Held" "Largest Field MUs x Days" "Unique missions completed" + Hacks ) dsnames=( AP Explorer Seer XM - Hacker + Walked Builder Connector Mind_Controller @@ -77,17 +78,18 @@ dsnames=( Recharger Liberator Pioneer + Engineer Purifier Neutralized Links_Destroyed Fields_Destroyed - Walked Guardian Link_Maintained Link_Length_x_Days Field_Held Field_x_Days Mercenary + Hacker ) medals=( Explorer @@ -101,6 +103,9 @@ medals=( Pioneer Purifier Guardian + Mercenary + Engineer + Walked ) ## (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 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