<?PHP
$list = $_REQUEST['list'];
$page = $_REQUEST['page'];
switch($list)
{
case "fist":
$id = 0;
$list_name = 'Fist Fighting';
break;
case "club":
$id = 1;
$list_name = 'Club Fighting';
break;
case "sword":
$id = 2;
$list_name = 'Sword Fighting';
break;
case "axe":
$id = 3;
$list_name = 'Axe Fighting';
break;
case "distance":
$id = 4;
$list_name = 'Distance Fighting';
break;
case "shield":
$id = 5;
$list_name = 'Shielding';
break;
case "fishing":
$id = 6;
$list_name = 'Fishing';
break;
}
if(!isset($id))
{
if($list == "magic")
$list_name = "Magic Level";
else
{
$list_name = 'Experience';
$list = 'experience';
}
}
$world_id = 0;
$world_name = $config['server']['serverName'];
$offset = $page * 100;
if(isset($id))
$skills = $SQL->query('SELECT name,online,value,level,vocation,promotion FROM players,player_skills WHERE players.world_id = '.$world_id.' AND players.deleted = 0 AND players.group_id < '.$config['site']['players_group_id_block'].' AND players.id = player_skills.player_id AND player_skills.skillid = '.$id.' ORDER BY value DESC, count DESC LIMIT 101 OFFSET '.$offset);
elseif($list == "magic")
$skills = $SQL->query('SELECT name,online,maglevel,level,vocation,promotion FROM players WHERE players.world_id = '.$world_id.' AND players.deleted = 0 AND players.group_id < '.$config['site']['players_group_id_block'].' AND name != "Account Manager" ORDER BY maglevel DESC, manaspent DESC LIMIT 101 OFFSET '.$offset);
elseif($list == "experience")
$skills = $SQL->query('SELECT name,online,level,experience,vocation,promotion FROM players WHERE players.world_id = '.$world_id.' AND players.deleted = 0 AND players.group_id < '.$config['site']['players_group_id_block'].' AND name != "Account Manager" ORDER BY level DESC, experience DESC LIMIT 101 OFFSET '.$offset);
$main_content .= '<center><h2> Highscores of '.$list_name.' on '.$world_name.'</h2></center><br />';
$main_content .= '
<div align="center">
<a href=?subtopic=highscores>Experience</a> | <a href=?subtopic=highscores&list=magic>Magic</a> | <a href=?subtopic=highscores&list=fist>Fist</a> | <a href=?subtopic=highscores&list=club>Club</a> | <a href=?subtopic=highscores&list=sword>Sword</a> | <a href=?subtopic=highscores&list=axe>Axe</a> | <a href=?subtopic=highscores&list=distance>Distance</a> | <a href=?subtopic=highscores&list=shield>Shielding</a> | <a href=?subtopic=highscores&list=fishing>Fishing</a><br /><br />
<table border="0" cellspacing="1" cellpadding="3" width="85%">
<tr bgcolor="'.$config['site']['vdarkborder'].'">
<td width="10%" class="white"> <b><center>#</center></b> </td>
<td width="50%" class="white"> <b><center>Player Name</center></b> </td>
<td width="20%" class="white"> <b><center>Level</center></b> </td>';
if($list == "experience")
$main_content .= '
<td width="20%" class="white"> <b><center>Experience</center></b> </td>';
$main_content .= '
</tr>';
foreach($skills as $skill) {
$player = $ots->createObject('Player');
$player->find($skill['name']);
$account = $player->getAccount();
$ban = '';
if($account->isBanned())
$ban = '<font color="darkred"> [Banished]</font>';
if($number_of_rows < 100) {
if($list == "magic")
$skill['value'] = $skill['maglevel'];
if($list == "experience")
$skill['value'] = $skill['level'];
if(!is_int($number_of_rows / 2)) {
$bgcolor = $config['site']['darkborder'];
}
else {
$bgcolor = $config['site']['lightborder'];
}
$number_of_rows++;
$main_content .= '
<tr bgcolor="'.$bgcolor.'">
<td><center>'.($offset + $number_of_rows).'. </center></td>
<td><center> <a href="?subtopic=characters&name='.urlencode($skill['name']).'">'.($skill['online']>0 ? "<font color=\"green\">".$skill['name']."</font>" : "<font color=\"red\">".$skill['name']."</font>").'</a> '.$ban.'<br /><small>'.$skill['level'].' '.$vocation_name[$world_id][$skill['promotion']][$skill['vocation']].'</small> </center></td>
<td><center> '.$skill['value'].' </center></td>';
if($list == "experience")
$main_content .= '
<td> <center>'.$skill['experience'].'</center> </td>';
$main_content .= '
</tr>';
}
else
$show_link_to_next_page = TRUE;
}
$main_content .= '
</table></div>';
$main_content .= '
<table border="0" cellspacing="1" width="90%">';
if($page > 0)
$main_content .= '
<tr>
<td width="90%" align="left" valign="bottom"><a href="?subtopic=highscores&list='.$list.'&page='.($page - 1).'">Previous Page</a> </td>
</tr>';
if($show_link_to_next_page)
$main_content .= '
<tr>
<td width="90%" align="right" valign="bottom"><a href="?subtopic=highscores&list='.$list.'&page='.($page + 1).'">Next Page</a> </td>
</tr>';
$main_content .= '</table>';
?>