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/player/library/getRealPlanetCount.inc

21 lines
542 B
PHP

<?php
class beta5_player_getRealPlanetCount {
function beta5_player_getRealPlanetCount($lib) {
$this->lib = $lib;
$this->db = $this->lib->game->db;
}
function run($id) {
$c = $this->lib->call('getPlanetCount', $id);
$q = $this->db->query("SELECT COUNT(*) FROM sale WHERE player=$id AND planet IS NOT NULL");
list($scount) = dbFetchArray($q);
$q = $this->db->query("SELECT COUNT(*) FROM planet WHERE owner=$id AND (abandon<>0 OR bh_prep<>0)");
list($acount) = dbFetchArray($q);
return $c - ($scount + $acount);
}
}
?>