This repository has been archived on 2024-07-18. You can view files and clone it, but cannot push or open issues or pull requests.
lwb5/scripts/game/beta5/alliance/library/getRankSize.inc

32 lines
684 B
PHP

<?php
class beta5_alliance_getRankSize {
function beta5_alliance_getRankSize($lib) {
$this->lib = $lib;
$this->db = $this->lib->game->db;
}
// Get the number of alliance members at a certain rank
function run($aid, $rId) {
$a = $this->lib->call('get', $aid);
$qs = "SELECT COUNT(*) FROM player WHERE alliance=$aid AND a_status='IN' AND ";
if ($rId == $a['default_grade']) {
$qs .= "(a_grade=$rId OR a_grade IS NULL)";
} else {
$qs .= "a_grade=$rId";
}
if (!is_null($a['leader'])) {
$qs .= " AND id<>" . $a['leader'];
}
$q = $this->db->query($qs);
if (!($q && dbCount($q))) {
return 0;
}
list($r) = dbFetchArray($q);
return $r;
}
}
?>