<?
$scale =6;
?>
<style>
.progress {
position: relative;
border: 1px solid black;
height: 9px;
width: <?=($scale * 100)?>px;
border-radius: 5px
}
.progress .text {
position: absolute;
float: left;
left: <?=($scale * 50) ?>px;
top: -3px;
color: white;
font-weight: bold;
}
.progress .done {
float: left;
height: 9px;
background: <?=$vdark?>;
border-top-left-radius: 5px;
border-bottom-left-radius: 5px
}
.progress .remaining {
float: left;
height: 9px;
background: grey;
border-top-right-radius: 5px;
border-bottom-right-radius: 5px
}
</style>
<h2 align="center">Top Questmakers</h2>
<table border="0" cellspacing="1" cellpadding="4" width="100%" class="hover">
<tr bgcolor="<?=$vdark?>" height="35" style="text-align: center; font-weight: bold;">
<td class="white" width="20">#</td>
<td class="white" width="150">Name</td>
<td class="white" width="50">Level</td>
<td class="white">Progress (Total: <b>62</b>)</td>
</tr>
<?
$f = 'cache/questmakers.tmp';
if(($m=@filemtime($f)) && $m >= time() - 180)
readfile($f);
else {
$total = 62;
ob_start();
$i = 0;
foreach(query('SELECT players.name, COUNT( player_storage.value ) c, players.level, players.online
FROM player_storage
LEFT JOIN players ON players.id = player_storage.player_id
WHERE `key`
IN ( 5050, 35041, 30015, 3699, 57642, 51051, 48050, 48547, 7742, 5461, 11937, 13371, 13374, 13375, 14375, 13377, 13378, 17741, 16188, 17012, 23575, 24565, 34027, 35335, 36543, 37550, 37551, 37552, 37553, 37554, 37555, 37557, 57060, 46175, 47060, 48811, 49121, 49615, 51428, 52033, 52326, 55000, 56116, 56669, 56715, 57002, 57006, 57009, 57011, 57013, 57014, 57016, 57018, 57022, 57025, 57030, 57045, 57050, 57398, 7740, 9399, 9786 )
GROUP BY player_id
ORDER BY c DESC
LIMIT 50 ')->fetchAll() as $v) {
++$i;
$percent = round((int)$v[1] / $total * 100, 2); ?>
<tr class="<?=($i & 1 ? 'Odd' : 'Even')?>">
<td style="text-align: center; text-align: right;"><?=$i?>.</td>
<td><a href="/characters/<?=$v[0]?>"<? if($v[3] === '1') echo ' class="green"'; ?>><?=$v[0]?></a></td>
<td align="center"><?=$v[2]?></td>
<td style="text-align: center;">
<div class="progress">
<span class="text"><?=round($percent)?>%</span>
<div style="width: <?=($percent * $scale)?>px;" class="done"></div>
<div style="width: <?=((100 - $percent - .001) * $scale)?>px;" class="remaining"></div>
</div>
</td>
</tr>
<? }
$str = ob_get_clean();
file_put_contents($f, $str);
echo $str;
} ?>
</table>