} $col = "ch.char_id, ch.name AS char_name, ch.class AS char_class, ch.base_level, ch.job_level, "; $col .= "ch.guild_id, guild.name AS guild_name, guild.emblem_len AS guild_emblem_len, "; $col .= "CAST(IFNULL(reg.value, '0') AS UNSIGNED) AS death_count"; $sql = "SELECT {$col} FROM {$server->charMapDatabase}.`char` AS ch "; $sql .= "LEFT JOIN {$server->charMapDatabase}.guild ON guild.guild_id = ch.guild_id "; $sql .= "LEFT JOIN {$server->loginDatabase}.login ON login.account_id = ch.account_id "; $sql .= "LEFT JOIN {$server->charMapDatabase}.`global_reg_value` AS reg ON reg.char_id = ch.char_id AND reg.str = 'PC_DIE_COUNTER' "; $sql .= "WHERE 1=1 "; if (Flux::config('HidePermBannedDeathRank')) { $sql .= "AND login.state != 5 "; } if (Flux::config('HideTempBannedDeathRank')) { $sql .= "AND (login.unban_time IS NULL OR login.unban_time = 0) "; } $groups = AccountLevel::getGroupID((int) Flux::config('RankingHideGroupLevel'), '<'); if (!empty($groups)) { $ids = implode(', ', array_fill(0, count($groups), '?')); $sql .= "AND login.group_id IN ({$ids}) "; $bind = array_merge($bind, $groups); } if ($days = Flux::config('DeathRankingThreshold')) { $sql .= 'AND TIMESTAMPDIFF(DAY, login.lastlogin, NOW()) <= ? '; $bind[] = $days * 24 * 60 * 60; } if (!is_null($jobClass)) { $sql .= "AND ch.class = ? "; $bind[] = $jobClass; } $sql .= "ORDER BY death_count DESC, ch.char_id DESC "; $sql .= "LIMIT " . (int) Flux::config('DeathRankingLimit');
$sql .= "AND login.state != 5 "; } if (Flux::config('HideTempBannedZenyRank')) { $sql .= "AND (login.unban_time IS NULL OR login.unban_time = 0) "; } $groupsLT = AccountLevel::getGroupID((int) Flux::config('RankingHideGroupLevel'), '<'); if (!empty($groupsLT)) { $idsLT = implode(', ', array_fill(0, count($groupsLT), '?')); $sql .= "AND login.group_id IN ({$idsLT})"; $bind = array_merge($bind, $groupsLT); } if ($days = Flux::config('ZenyRankingThreshold')) { $sql .= 'AND TIMESTAMPDIFF(DAY, login.lastlogin, NOW()) <= ? '; $bind[] = $days * 24 * 60 * 60; } $groupsGEQ = AccountLevel::getGroupID((int) $auth->getGroupLevelToHideFromZenyRank, '>='); if (!empty($groupsGEQ)) { $ids = implode(', ', array_fill(0, count($groupsGEQ), '?')); $check1 = "AND login.group_id IN ({$ids})"; $bind = array_merge($bind, $groupsGEQ); } if (!empty($groupsLT)) { $check2 = "OR login.group_id IN ({$idsLT})"; $bind = array_merge($bind, $groupsLT); } // Whether or not the character is allowed to hide themselves from the Zeny Ranking. if (isset($check1) && isset($check2)) { $sql .= "AND (((hide_from_zr.value IS NULL OR hide_from_zr.value = 0) {$check1}) {$check2}) "; } if (!is_null($jobClass)) { $sql .= "AND ch.class = ? ";
<?php if (!defined('FLUX_ROOT')) { exit; } $bind = array(); $sqlpartial = ''; $chars = array(); $hideGroupLevel = Flux::config('HideFromWhosOnline'); $groups = AccountLevel::getGroupID($hideGroupLevel, '<'); if (!empty($groups)) { $ids = implode(', ', array_fill(0, count($groups), '?')); $sqlpartial .= " where login.group_id IN ({$ids}) "; $bind = array_merge($bind, $groups); } $sqlpartial .= " group by m.kill_char_id"; $sql = "SELECT count(*) AS total FROM {$server->charMapDatabase}.`mvplog` as m inner join `char` as ch ON ch.char_id = `m`.kill_char_id left join login ON `login`.account_id =ch.account_id {$sqlpartial}"; $sth = $server->connection->getStatement($sql); $sth->execute($bind); $sortable = array('name', 'char_id', 'class', 'amount' => 'desc', 'base_level', 'job_level'); $paginator = $this->getPaginator($sth->fetch()->total); $paginator->setSortableColumns($sortable); $col = "ch.name, ch.char_id, class, ch.guild_id, count(3) as amount, base_level, job_level, guild.name as g_name"; $sql = $paginator->getSQL("SELECT {$col} FROM {$server->charMapDatabase}.`mvplog` as m inner join `char` as ch ON ch.char_id = `m`.kill_char_id left join login ON `login`.account_id =ch.account_id left join guild on guild.guild_id=ch.guild_id {$sqlpartial}"); $sth = $server->connection->getStatement($sql); $sth->execute($bind); $chars = $sth->fetchAll();