diff --git a/powergamers.php b/powergamers.php index 3d83882..dcd843f 100644 --- a/powergamers.php +++ b/powergamers.php @@ -1,70 +1,92 @@ - - 3) - { - $value .= '.'.substr($value2, -3, 3); - $value2 = substr($value2, 0, strlen($value2)-3); +
+ + 0) + $today = false; + } else { + $znotePlayers = mysql_select_multi('SELECT `a`.`id`, `b`.`player_id`, `a`.`name`, `a`.`vocation`, `a`.`level`, `a`.`group_id`, `a`.`experience`, `b`.`exphist_lastexp`, `b`.`exphist1`, `b`.`exphist2`, `b`.`exphist3`, `b`.`exphist4`, `b`.`exphist5`, `b`.`exphist6`, `b`.`exphist7`, (`a`.`experience` - `b`.`exphist_lastexp`) AS `expdiff` FROM `players` `a` JOIN `znote_players` `b` ON `a`.`id` = `b`.`player_id` WHERE `a`.`group_id` < 2 ORDER BY `expdiff` DESC LIMIT '.$limit); } - @$value = $value2.$value; - if($valuein > 0) - return '+'.$value.''; - elseif($valuein < 0) - return ''.$value.''; - else - return $value; -} + $limit = $config['powergamers']['limit']; -if(empty($type)) - $znotePlayers = mysql_select_multi('SELECT `a`.`id`, `b`.`player_id`, `a`.`name`, `a`.`vocation`, `a`.`level`, `a`.`group_id`, `a`.`experience`, `b`.`exphist_lastexp`, `b`.`exphist1`, `b`.`exphist2`, `b`.`exphist3`, `b`.`exphist4`, `b`.`exphist5`, `b`.`exphist6`, `b`.`exphist7`, (`a`.`experience` - `b`.`exphist_lastexp`) AS `expdiff` FROM `players` `a` JOIN `znote_players` `b` ON `a`.`id` = `b`.`player_id` WHERE `a`.`group_id` < 2 ORDER BY `expdiff` DESC LIMIT '.$limit); -elseif($type >= 1 && $type <= 3) - $znotePlayers = mysql_select_multi('SELECT `a`.`id`, `b`.`player_id`, `a`.`name`, `a`.`vocation`, `a`.`level`, `a`.`group_id`, `a`.`experience`, `b`.`exphist_lastexp`, `b`.`exphist1`, `b`.`exphist2`, `b`.`exphist3`, `b`.`exphist4`, `b`.`exphist5`, `b`.`exphist6`, `b`.`exphist7`, (`a`.`experience` - `b`.`exphist_lastexp`) AS `expdiff` FROM `players` `a` JOIN `znote_players` `b` ON `a`.`id` = `b`.`player_id` WHERE `a`.`group_id` < 2 ORDER BY `exphist' . (int) $type . '` DESC LIMIT '.$limit); -echo '

Ranking of powergamers

-
- - - '; -echo ''; + if(!empty($days) && !empty($vocation)) + $znotePlayers = mysql_select_multi('SELECT `a`.`id`, `b`.`player_id`, `a`.`name`, `a`.`vocation`, `a`.`level`, `a`.`group_id`, `a`.`experience`, `b`.`exphist_lastexp`, `b`.`exphist1`, `b`.`exphist2`, `b`.`exphist3`, `b`.`exphist4`, `b`.`exphist5`, `b`.`exphist6`, `b`.`exphist7`, (`a`.`experience` - `b`.`exphist_lastexp`) AS `expdiff` FROM `players` `a` JOIN `znote_players` `b` ON `a`.`id` = `b`.`player_id` WHERE `a`.`group_id` < 2 AND `a`.`vocation`='. (int)$vocation .' ORDER BY `exphist' . (int)$days . '` DESC LIMIT '.$limit); + elseif(empty($days) && !empty($vocation)) { + $znotePlayers = mysql_select_multi('SELECT `a`.`id`, `b`.`player_id`, `a`.`name`, `a`.`vocation`, `a`.`level`, `a`.`group_id`, `a`.`experience`, `b`.`exphist_lastexp`, `b`.`exphist1`, `b`.`exphist2`, `b`.`exphist3`, `b`.`exphist4`, `b`.`exphist5`, `b`.`exphist6`, `b`.`exphist7`, (`a`.`experience` - `b`.`exphist_lastexp`) AS `expdiff` FROM `players` `a` JOIN `znote_players` `b` ON `a`.`id` = `b`.`player_id` WHERE `a`.`group_id` < 2 AND `a`.`vocation`='. (int)$vocation .' ORDER BY `expdiff` DESC LIMIT '.$limit); + }elseif(!empty($days) && empty($vocation)) + $znotePlayers = mysql_select_multi('SELECT `a`.`id`, `b`.`player_id`, `a`.`name`, `a`.`vocation`, `a`.`level`, `a`.`group_id`, `a`.`experience`, `b`.`exphist_lastexp`, `b`.`exphist1`, `b`.`exphist2`, `b`.`exphist3`, `b`.`exphist4`, `b`.`exphist5`, `b`.`exphist6`, `b`.`exphist7`, (`a`.`experience` - `b`.`exphist_lastexp`) AS `expdiff` FROM `players` `a` JOIN `znote_players` `b` ON `a`.`id` = `b`.`player_id` WHERE `a`.`group_id` < 2 ORDER BY `exphist' . (int)$days . '` DESC LIMIT '.$limit); + else + $znotePlayers = mysql_select_multi('SELECT `a`.`id`, `b`.`player_id`, `a`.`name`, `a`.`vocation`, `a`.`level`, `a`.`group_id`, `a`.`experience`, `b`.`exphist_lastexp`, `b`.`exphist1`, `b`.`exphist2`, `b`.`exphist3`, `b`.`exphist4`, `b`.`exphist5`, `b`.`exphist6`, `b`.`exphist7`, (`a`.`experience` - `b`.`exphist_lastexp`) AS `expdiff` FROM `players` `a` JOIN `znote_players` `b` ON `a`.`id` = `b`.`player_id` WHERE `a`.`group_id` < 2 ORDER BY `expdiff` DESC LIMIT '.$limit); -for($i = 3; $i >= 2; $i--) - echo ($type == $i) ? '' : ''; - echo ($type == 1) ? '' : ''; - echo (empty($type)) ? '' : ''; - echo ''; + $showVoc = (!empty($vocation)) ? $vocation : 0; + ?> + +
+
+ + +
+ 0) ? 'Showing only '. strtolower(vocation_id_to_name($vocation)).'s and' : 'Showing all vocations and'; ?> + 0) ? 'sorted by '. $days .' days': 'sorted by today'; ?>. +
+
+ +
#
Name
Total
'.$i.' Days Ago
'.$i.' Days Ago
1 Day Ago1 Day AgoTodayToday
+ + + = 2; $i--) + echo ($days == $i) ? '' : ''; + echo ($days == 1) ? '' : ''; + echo ($today) ? '' : ''; + echo ($days == 4) ? '' : ''; + echo ''; -$number_of_rows = 1; -if($znotePlayers) - foreach($znotePlayers as $player) - { - echo ''; - echo ''; - echo ''; $number_of_rows++; + $number_of_rows = 0; + if($znotePlayers) { + foreach($znotePlayers as $player) + { + $number_of_rows++; + echo ''; + echo '' : ''; + echo ($days == 2) ? '' : ''; + echo ($days == 1) ? '' : ''; + echo ($today == true) ? '' : ''; + echo ''; + } } -echo '
#
Name'.$i.' Days AgoYesterdayTodayTotal
'. $number_of_rows . '.
' .$player['name']. ''; - echo '
' .$player['level']. ' '.htmlspecialchars(vocation_id_to_name($player['vocation'])).' '; - - echo '
'.coloured_value($player['exphist1'] + $player['exphist2'] + $player['exphist3'] + $player['experience'] - $player['exphist_lastexp']).'
'.coloured_value($player['exphist3']).'
'.coloured_value($player['exphist2']).'
'.coloured_value($player['exphist1']).'
'.coloured_value($player['experience']-$player['exphist_lastexp']).'
'. $number_of_rows . '.
' .$player['name']. ''; + echo '
'. ($player['level']. ' '.htmlspecialchars(vocation_id_to_name($player['vocation'])) ).' '; + echo ($days == 3) ? '
'. number_format($player['exphist3']) .'
'. $player['exphist2'] .'
'. $player['exphist1'] .'
'. ($player['experience']-$player['exphist_lastexp']) .'

'; -?> + ?> + +
+