|
|
@@ -58,64 +58,57 @@ if($vocation !== 'all') {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$skill = POT::SKILL__LEVEL;
|
|
|
|
$categories = [
|
|
|
|
if(is_numeric($list))
|
|
|
|
'experience' => 'Experience',
|
|
|
|
{
|
|
|
|
'magic' => 'Magic',
|
|
|
|
$list = (int) $list;
|
|
|
|
'shield' => 'Shielding',
|
|
|
|
if($list >= POT::SKILL_FIRST && $list <= POT::SKILL__LAST)
|
|
|
|
'distance' => 'Distance',
|
|
|
|
$skill = $list;
|
|
|
|
'club' => 'Club',
|
|
|
|
|
|
|
|
'sword' => 'Sword',
|
|
|
|
|
|
|
|
'axe' => 'Axe',
|
|
|
|
|
|
|
|
'fist' => 'Fist',
|
|
|
|
|
|
|
|
'fishing' => 'Fishing',
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(setting('core.highscores_frags')) {
|
|
|
|
|
|
|
|
$categories['frags'] = 'Frags';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
switch($list)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
case 'fist':
|
|
|
|
|
|
|
|
$skill = POT::SKILL_FIST;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'club':
|
|
|
|
if(setting('core.highscores_balance'))
|
|
|
|
$skill = POT::SKILL_CLUB;
|
|
|
|
$categories['balance'] = 'Balance';
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'sword':
|
|
|
|
$skill = POT::SKILL__LEVEL;
|
|
|
|
$skill = POT::SKILL_SWORD;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'axe':
|
|
|
|
$skillNameToId = [
|
|
|
|
$skill = POT::SKILL_AXE;
|
|
|
|
'fist' => POT::SKILL_FIST,
|
|
|
|
break;
|
|
|
|
'club' => POT::SKILL_CLUB,
|
|
|
|
|
|
|
|
'sword' => POT::SKILL_SWORD,
|
|
|
|
|
|
|
|
'axe' => POT::SKILL_AXE,
|
|
|
|
|
|
|
|
'distance' => POT::SKILL_DIST,
|
|
|
|
|
|
|
|
'shield' => POT::SKILL_SHIELD,
|
|
|
|
|
|
|
|
'fishing' => POT::SKILL_FISH,
|
|
|
|
|
|
|
|
'magic' => POT::SKILL__MAGLEVEL,
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
case 'distance':
|
|
|
|
if(setting('core.highscores_frags')) {
|
|
|
|
$skill = POT::SKILL_DIST;
|
|
|
|
$skillNameToId['frags'] = SKILL_FRAGS;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
case 'shield':
|
|
|
|
if(setting('core.highscores_balance')) {
|
|
|
|
$skill = POT::SKILL_SHIELD;
|
|
|
|
$skillNameToId['balance'] = SKILL_BALANCE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
case 'fishing':
|
|
|
|
$skill = $skillNameToId[$list];
|
|
|
|
$skill = POT::SKILL_FISH;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'level':
|
|
|
|
$args = ['list' => $list, 'skill' => $skill, 'categories' => $categories];
|
|
|
|
case 'experience':
|
|
|
|
$hooks->triggerFilter(HOOK_FILTER_HIGHSCORES_LIST, $args);
|
|
|
|
$skill = POT::SKILL_LEVEL;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'magic':
|
|
|
|
$list = $args['list'];
|
|
|
|
$skill = POT::SKILL__MAGLEVEL;
|
|
|
|
$skill = $args['skill'];
|
|
|
|
break;
|
|
|
|
$categories = $args['categories'];
|
|
|
|
|
|
|
|
|
|
|
|
case 'frags':
|
|
|
|
if (!isset($categories[$list])) {
|
|
|
|
if(setting('core.highscores_frags'))
|
|
|
|
$skill = null;
|
|
|
|
$skill = SKILL_FRAGS;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 'balance':
|
|
|
|
|
|
|
|
if(setting('core.highscores_balance'))
|
|
|
|
|
|
|
|
$skill = SKILL_BALANCE;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$promotion = '';
|
|
|
|
$promotion = '';
|
|
|
@@ -162,8 +155,18 @@ $query->join('accounts', 'accounts.id', '=', 'players.account_id')
|
|
|
|
->selectRaw('accounts.country, players.id, players.name, players.account_id, players.level, players.vocation' . $outfit . $promotion)
|
|
|
|
->selectRaw('accounts.country, players.id, players.name, players.account_id, players.level, players.vocation' . $outfit . $promotion)
|
|
|
|
->orderByDesc('value');
|
|
|
|
->orderByDesc('value');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($skill == SKILL_FRAGS) {
|
|
|
|
|
|
|
|
$skillName = 'Frags';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if($skill == SKILL_BALANCE) {
|
|
|
|
|
|
|
|
$skillName = 'Balance';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
$skillName = getSkillName($skill);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (empty($highscores)) {
|
|
|
|
if (empty($highscores)) {
|
|
|
|
if ($skill >= POT::SKILL_FIRST && $skill <= POT::SKILL_LAST) { // skills
|
|
|
|
if ($skill && $skill >= POT::SKILL_FIRST && $skill <= POT::SKILL_LAST) { // skills
|
|
|
|
if ($db->hasColumn('players', 'skill_fist')) {// tfs 1.0
|
|
|
|
if ($db->hasColumn('players', 'skill_fist')) {// tfs 1.0
|
|
|
|
$skill_ids = array(
|
|
|
|
$skill_ids = array(
|
|
|
|
POT::SKILL_FIST => 'skill_fist',
|
|
|
|
POT::SKILL_FIST => 'skill_fist',
|
|
|
@@ -193,20 +196,37 @@ if (empty($highscores)) {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$query
|
|
|
|
$query
|
|
|
|
->addSelect('players.balance as value');
|
|
|
|
->addSelect('players.balance as value');
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
if ($skill == POT::SKILL__MAGLEVEL) {
|
|
|
|
else if ($skill == POT::SKILL__MAGLEVEL) {
|
|
|
|
$query
|
|
|
|
$query
|
|
|
|
->addSelect('players.maglevel as value', 'players.maglevel')
|
|
|
|
->addSelect('players.maglevel as value', 'players.maglevel')
|
|
|
|
->orderBy('manaspent');
|
|
|
|
->orderBy('manaspent');
|
|
|
|
} else { // level
|
|
|
|
} else if ($skill == POT::SKILL__LEVEL) {
|
|
|
|
$query
|
|
|
|
$query
|
|
|
|
->addSelect('players.level as value', 'players.experience')
|
|
|
|
->addSelect('players.level as value', 'players.experience')
|
|
|
|
->orderBy('experience');
|
|
|
|
->orderBy('experience', 'desc');
|
|
|
|
$list = 'experience';
|
|
|
|
$list = 'experience';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if ($skill) {
|
|
|
|
|
|
|
|
$args = [
|
|
|
|
|
|
|
|
'list' => $list,
|
|
|
|
|
|
|
|
'skill' => $skill,
|
|
|
|
|
|
|
|
'skillName' => $skillName,
|
|
|
|
|
|
|
|
'query' => $query
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$hooks->triggerFilter(HOOK_FILTER_HIGHSCORES, $args);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$list = $args['list'];
|
|
|
|
|
|
|
|
$skill = $args['skill'];
|
|
|
|
|
|
|
|
$skillName = $args['skillName'];
|
|
|
|
|
|
|
|
$query = $args['query'];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
$query = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$highscores = $query->get()->map(function($row) {
|
|
|
|
$highscores = ($query ? $query->get()->map(function($row) {
|
|
|
|
$tmp = $row->toArray();
|
|
|
|
$tmp = $row->toArray();
|
|
|
|
$tmp['online'] = $row->online_status;
|
|
|
|
$tmp['online'] = $row->online_status;
|
|
|
|
$tmp['vocation'] = $row->vocation_name;
|
|
|
|
$tmp['vocation'] = $row->vocation_name;
|
|
|
@@ -214,7 +234,7 @@ if (empty($highscores)) {
|
|
|
|
unset($tmp['online_table']);
|
|
|
|
unset($tmp['online_table']);
|
|
|
|
|
|
|
|
|
|
|
|
return $tmp;
|
|
|
|
return $tmp;
|
|
|
|
})->toArray();
|
|
|
|
})->toArray() : []);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($highscoresTTL > 0 && $cache->enabled() && $needReCache) {
|
|
|
|
if ($highscoresTTL > 0 && $cache->enabled() && $needReCache) {
|
|
|
@@ -239,9 +259,11 @@ foreach($highscores as $id => &$player)
|
|
|
|
|
|
|
|
|
|
|
|
$player['link'] = getPlayerLink($player['name'], false);
|
|
|
|
$player['link'] = getPlayerLink($player['name'], false);
|
|
|
|
$player['flag'] = getFlagImage($player['country']);
|
|
|
|
$player['flag'] = getFlagImage($player['country']);
|
|
|
|
|
|
|
|
|
|
|
|
if($settingHighscoresOutfit) {
|
|
|
|
if($settingHighscoresOutfit) {
|
|
|
|
$player['outfit'] = '<img style="position:absolute;margin-top:' . (in_array($player['looktype'], setting('core.outfit_images_wrong_looktypes')) ? '-15px;margin-left:5px' : '-45px;margin-left:-25px') . ';" src="' . $player['outfit_url'] . '" alt="" />';
|
|
|
|
$player['outfit'] = '<img style="position:absolute;margin-top:' . (in_array($player['looktype'], setting('core.outfit_images_wrong_looktypes')) ? '-15px;margin-left:5px' : '-45px;margin-left:-25px') . ';" src="' . $player['outfit_url'] . '" alt="" />';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$player['rank'] = $offset + $i;
|
|
|
|
$player['rank'] = $offset + $i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
@@ -263,24 +285,6 @@ if($show_link_to_next_page) {
|
|
|
|
$linkNextPage = getLink('highscores') . '/' . $list . ($vocation !== 'all' ? '/' . $vocation : '') . '/' . ($page + 1);
|
|
|
|
$linkNextPage = getLink('highscores') . '/' . $list . ($vocation !== 'all' ? '/' . $vocation : '') . '/' . ($page + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$types = array(
|
|
|
|
|
|
|
|
'experience' => 'Experience',
|
|
|
|
|
|
|
|
'magic' => 'Magic',
|
|
|
|
|
|
|
|
'shield' => 'Shielding',
|
|
|
|
|
|
|
|
'distance' => 'Distance',
|
|
|
|
|
|
|
|
'club' => 'Club',
|
|
|
|
|
|
|
|
'sword' => 'Sword',
|
|
|
|
|
|
|
|
'axe' => 'Axe',
|
|
|
|
|
|
|
|
'fist' => 'Fist',
|
|
|
|
|
|
|
|
'fishing' => 'Fishing',
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(setting('core.highscores_frags')) {
|
|
|
|
|
|
|
|
$types['frags'] = 'Frags';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(setting('core.highscores_balance'))
|
|
|
|
|
|
|
|
$types['balance'] = 'Balance';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($highscoresTTL > 0 && $cache->enabled()) {
|
|
|
|
if ($highscoresTTL > 0 && $cache->enabled()) {
|
|
|
|
echo '<small>*Note: Highscores are updated every' . ($highscoresTTL > 1 ? ' ' . $highscoresTTL : '') . ' minute' . ($highscoresTTL > 1 ? 's' : '') . '.</small><br/><br/>';
|
|
|
|
echo '<small>*Note: Highscores are updated every' . ($highscoresTTL > 1 ? ' ' . $highscoresTTL : '') . ' minute' . ($highscoresTTL > 1 ? 's' : '') . '.</small><br/><br/>';
|
|
|
|
}
|
|
|
|
}
|
|
|
@@ -290,11 +294,12 @@ $twig->display('highscores.html.twig', [
|
|
|
|
'highscores' => $highscores,
|
|
|
|
'highscores' => $highscores,
|
|
|
|
'list' => $list,
|
|
|
|
'list' => $list,
|
|
|
|
'skill' => $skill,
|
|
|
|
'skill' => $skill,
|
|
|
|
'skillName' => ($skill == SKILL_FRAGS ? 'Frags' : ($skill == SKILL_BALANCE ? 'Balance' : getSkillName($skill))),
|
|
|
|
'skillName' => $skillName,
|
|
|
|
'levelName' => ($skill != SKILL_FRAGS && $skill != SKILL_BALANCE ? 'Level' : ($skill == SKILL_BALANCE ? 'Balance' : 'Frags')),
|
|
|
|
'levelName' => ($skill != SKILL_FRAGS && $skill != SKILL_BALANCE ? 'Level' : ($skill == SKILL_BALANCE ? 'Balance' : 'Frags')),
|
|
|
|
'vocation' => $vocation !== 'all' ? $vocation : null,
|
|
|
|
'vocation' => $vocation !== 'all' ? $vocation : null,
|
|
|
|
'vocationId' => $vocationId,
|
|
|
|
'vocationId' => $vocationId,
|
|
|
|
'types' => $types,
|
|
|
|
'categories' => $categories,
|
|
|
|
|
|
|
|
'types' => $categories, // leave for compatibility with outdated twigs
|
|
|
|
'linkPreviousPage' => $linkPreviousPage,
|
|
|
|
'linkPreviousPage' => $linkPreviousPage,
|
|
|
|
'linkNextPage' => $linkNextPage,
|
|
|
|
'linkNextPage' => $linkNextPage,
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|