From 86f243f15bc116cd827978b9bc8cb3d384240808 Mon Sep 17 00:00:00 2001 From: Vincent Riquer Date: Mon, 7 Jul 2014 16:17:45 +0200 Subject: [PATCH] * medals: 0% is 100% for the lower medal * show currectly unreachable medals as transparent --- ingrrd.css | 12 +++++++++ lib/globals | 8 ++++-- lib/medals | 20 +++++++++++--- lib/show_current_level | 60 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 94 insertions(+), 6 deletions(-) diff --git a/ingrrd.css b/ingrrd.css index b8fa4cc..f0b34dd 100644 --- a/ingrrd.css +++ b/ingrrd.css @@ -126,11 +126,23 @@ img.badge { height: 30px; } +img.nobadge { + width: 30px; + height: 30px; + opacity: 0.8; +} + img.minibadge { width: 20px; height: 20px; } +img.nominibadge { + width: 20px; + height: 20px; + opacity: 0.5; +} + span.missing { color: red; font-weight: bold; diff --git a/lib/globals b/lib/globals index cb43991..c45e2a4 100644 --- a/lib/globals +++ b/lib/globals @@ -1,7 +1,11 @@ #!/bin/bash -declare -A \ - last \ +declare -A \ + last \ + nosilver \ + nogold \ + noplatinum \ + noblack \ declare -a \ bronzes \ diff --git a/lib/medals b/lib/medals index 2bf68b7..d96a712 100644 --- a/lib/medals +++ b/lib/medals @@ -17,29 +17,41 @@ medals() { then (( silvercount++ )) silvers+=( "$stat" ) + elif (( last["$stat"] >= bronze["$stat"] )) + then + upsilver[( last["$stat"] - bronze["$stat"] ) * 100 / ( silver["$stat"] - bronze["$stat"] )]+="$stat " else - upsilver[last["$stat"] * 100 / silver["$stat"]]+="$stat " + nosilver["$stat"]=1 fi if (( last["$stat"] >= gold["$stat"] )) then (( goldcount++ )) golds+=( "$stat" ) + elif (( last["$stat"] >= silver["$stat"] )) + then + upgold[( last["$stat"] - silver["$stat"] ) * 100 / ( gold["$stat"] - silver["$stat"] )]+="$stat " else - upgold[last["$stat"] * 100 / gold["$stat"]]+="$stat " + nogold["$stat"]=1 fi if (( last["$stat"] >= platinum["$stat"] )) then (( platinumcount++ )) platinums+=( "$stat" ) + elif (( last["$stat"] >= gold["$stat"] )) + then + upplatinum[( last["$stat"] - gold["$stat"] ) * 100 / ( platinum["$stat"] - gold["$stat"] )]+="$stat " else - upplatinum[last["$stat"] * 100 / platinum["$stat"]]+="$stat " + noplatinum["$stat"]=1 fi if (( last["$stat"] >= black["$stat"] )) then (( blackcount++ )) blacks+=( "$stat" ) + elif (( last["$stat"] >= platinum["$stat"] )) + then + upblack[( last["$stat"] - platinum["$stat"] ) * 100 / ( black["$stat"] - platinum["$stat"] )]+="$stat " else - upblack[last["$stat"] * 100 / black["$stat"]]+="$stat " + noblack["$stat"]=1 fi done } diff --git a/lib/show_current_level b/lib/show_current_level index 5412104..8b4ee3a 100644 --- a/lib/show_current_level +++ b/lib/show_current_level @@ -84,6 +84,21 @@ show_current_level() { EOHTML done done + for stat in ${!nosilver[@]} + do + img=${stat,,} + cat <<-EOHTML + + $stat silver + + EOHTML + done cat <<-EOHTML @@ -124,6 +139,21 @@ show_current_level() { EOHTML done done + for stat in ${!nogold[@]} + do + img=${stat,,} + cat <<-EOHTML + + $stat gold + + EOHTML + done cat <<-EOHTML @@ -164,6 +194,21 @@ show_current_level() { EOHTML done done + for stat in ${!noplatinum[@]} + do + img=${stat,,} + cat <<-EOHTML + + $stat platinum + + EOHTML + done cat <<-EOHTML @@ -204,6 +249,21 @@ show_current_level() { EOHTML done done + for stat in ${!noblack[@]} + do + img=${stat,,} + cat <<-EOHTML + + $stat black + + EOHTML + done cat <<-EOHTML