show hints for medal targets

This commit is contained in:
Vincent Riquer 2014-06-19 16:09:07 +02:00
parent 6d8fef49e6
commit 680878e18a

66
graph
View File

@ -180,22 +180,34 @@ then
if (( last["$stat"] >= bronze["$stat"] )) if (( last["$stat"] >= bronze["$stat"] ))
then then
(( bronzecount++ )) (( bronzecount++ ))
else
(( pct = last["$stat"] * 100 / bronze["$stat"] ))
upbronze[pct]+="$stat "
fi
if (( last["$stat"] >= silver["$stat"] )) if (( last["$stat"] >= silver["$stat"] ))
then then
(( silvercount++ )) (( silvercount++ ))
else
(( pct = last["$stat"] * 100 / silver["$stat"] ))
upsilver[pct]+="$stat "
fi
if (( last["$stat"] >= gold["$stat"] )) if (( last["$stat"] >= gold["$stat"] ))
then then
(( goldcount++ )) (( goldcount++ ))
else
upgold+=( "$stat" )
fi
if (( last["$stat"] >= platinum["$stat"] )) if (( last["$stat"] >= platinum["$stat"] ))
then then
(( platinumcount++ )) (( platinumcount++ ))
else
upplatinum+=( "$stat" )
fi
if (( last["$stat"] >= black["$stat"] )) if (( last["$stat"] >= black["$stat"] ))
then then
(( blackcount++ )) (( blackcount++ ))
fi else
fi upblack+=( "$stat" )
fi
fi
fi fi
done done
cat <<-EOHTML cat <<-EOHTML
@ -227,36 +239,65 @@ then
printf "%'li" ${lvl[level]} printf "%'li" ${lvl[level]}
echo '</td>' echo '</td>'
else else
echo '<td style="background:grey">' echo '<td style="background:lightgrey">'
printf "%'li" ${lvl[level]}
echo " (<span style=\"color:#FF2020;font-weight:bold\">"
printf "%'li" $(( last["AP"] - lvl[level] )) printf "%'li" $(( last["AP"] - lvl[level] ))
echo '</td>' echo '</span>)</td>'
fi fi
if (( silvercount >= lvlsilver[level] )) if (( silvercount >= lvlsilver[level] ))
then then
echo '<td style="background:lightgreen">'${lvlsilver[level]}'</td>' echo '<td style="background:lightgreen">'${lvlsilver[level]}'</td>'
else else
echo '<td style="background:grey">'$(( silvercount - lvlsilver[level] ))'</td>' echo "<td style=\"background:lightgrey\">${lvlsilver[level]} (<span style=\"color:#FF2020;font-weight:bold\">$(( silvercount - lvlsilver[level] ))</span>)<br />"
for id in {100..0}
do
[ -z "${upsilver[id]}" ] && continue
(( colforce = id * 255 / 100 ))
echo "<div style=\"background:#FF$(printf %02x $colforce )00\"><a href=\"#${upsilver[id]}\">${upsilver[id]} ($id%)</a></div>"
done
echo '</td>'
fi fi
if (( goldcount >= lvlgold[level] )) if (( goldcount >= lvlgold[level] ))
then then
echo '<td style="background:lightgreen">'${lvlgold[level]}'</td>' echo '<td style="background:lightgreen">'${lvlgold[level]}'</td>'
else else
echo '<td style="background:grey">'$(( goldcount - lvlgold[level] ))'</td>' echo "<td style=\"background:lightgrey\">${lvlgold[level]} (<span style=\"color:#FF2020;font-weight:bold\">$(( goldcount - lvlgold[level] ))</span>)<br />"
for id in {100..0}
do
[ -z "${upgold[id]}" ] && continue
(( colforce = id * 255 / 100 ))
echo "<div style=\"background:#FF$(printf %02x $colforce )00\"><a href=\"#${upgold[id]}\">${upgold[id]} ($id%)</a></div>"
done
echo '</td>'
fi fi
if (( platinumcount >= lvlplatinum[level] )) if (( platinumcount >= lvlplatinum[level] ))
then then
echo '<td style="background:lightgreen">'${lvlplatinum[level]}'</td>' echo '<td style="background:lightgreen">'${lvlplatinum[level]}'</td>'
else else
echo '<td style="background:grey">'$(( platinumcount - lvlplatinum[level] ))'</td>' echo "<td style=\"background:lightgrey\">${lvlplatinum[level]} (<span style=\"color:#FF2020;font-weight:bold\">$(( platinumcount - lvlplatinum[level] ))</span>)<br />"
for id in {100..0}
do
[ -z "${upplatinum[id]}" ] && continue
(( colforce = id * 255 / 100 ))
echo "<div style=\"background:#FF$(printf %02x $colforce )00\"><a href=\"#${upplatinum[id]}\">${upplatinum[id]} ($id%)</a></div>"
done
echo '</td>'
fi fi
if (( blackcount >= lvlblack[level] )) if (( blackcount >= lvlblack[level] ))
then then
echo '<td style="background:lightgreen">'${lvlblack[level]}'</td>' echo '<td style="background:lightgreen">'${lvlblack[level]}'</td>'
else else
echo '<td style="background:grey">'$(( blackcount - lvlblack[level] ))'</td>' echo "<td style=\"background:lightgrey\">${lvlblack[level]} (<span style=\"color:#FF2020;font-weight:bold\">$(( blackcount - lvlblack[level] ))</span>)<br />"
for id in {100..0}
do
[ -z "${upblack[id]}" ] && continue
(( colforce = id * 255 / 100 ))
echo "<div style=\"background:#FF$(printf %02x $colforce )00\"><a href=\"#${upblack[id]}\">${upblack[id]} ($id%)</a></div>"
done
echo '</td>'
fi fi
echo '</tr>'
echo "</tr>"
done done
cat <<-EOHTML cat <<-EOHTML
</table> </table>
@ -325,6 +366,7 @@ then
<div> <div>
<img <img
src="graph?graph=$stat&amp;start=$start&amp;end=$end" src="graph?graph=$stat&amp;start=$start&amp;end=$end"
id="$stat"
alt="Ingress $stat evolution" /> alt="Ingress $stat evolution" />
</div> </div>
EOHTML EOHTML