Fix some things

Fix some things
This commit is contained in:
novgorodschi catalin
2026-06-22 15:19:05 +03:00
parent 228397d011
commit 4b208dbfd8
5 changed files with 17 additions and 4 deletions
+16 -3
View File
@@ -13,6 +13,19 @@
*/
include('menu.tpl');
function short($n) {
$n = (int)$n;
if ($n >= 1000000) {
return round($n/1000000,1).'M';
}
if ($n >= 100000) {
return floor($n/1000).'k';
}
// sub 100k lași normal, cu punct ca la Travian RO
return $n;
}
?>
<table id="troops" cellpadding="1" cellspacing="1">
@@ -139,7 +152,7 @@ foreach ($varray as $vil) {
$cl = ($val != 0) ? '' : 'none';
echo '<td class="'.$cl.'">'.$val.'</td>';
echo '<td class="'.$cl.'" title="'.$val.'">'.short($val).'</td>';
}
// hero
@@ -167,13 +180,13 @@ for ($i = $unit_start; $i <= $unit_end; $i++) {
$cl = ($val != 0) ? '' : 'none';
echo '<td class="'.$cl.'">'.$val.'</td>';
echo '<td class="'.$cl.'" title="'.$val.'">'.short($val).'</td>';
}
$heroTotal = $unit_total['hero'];
$cl = ($heroTotal != 0) ? '' : 'none';
echo '<td class="'.$cl.'">'.$heroTotal.'</td>';
echo '<td class="'.$cl.'" title="'.$heroVal.'">'.short($heroVal).'</td>';
?>
</tr>