lwb5-in-2025/scripts/game/beta5/tech/library/getPoints.inc

26 lines
533 B
PHP
Raw Normal View History

2016-01-10 11:01:49 +01:00
<?php
class beta5_tech_getPoints {
2024-12-31 00:50:29 +01:00
public function __construct($lib) {
2016-01-10 11:01:49 +01:00
$this->lib = $lib;
$this->db = $this->lib->game->db;
$this->rules = $this->lib->game->getLib('beta5/rules');
}
// Returns the amount of research points a player gains daily
function run($pid) {
$q = $this->db->query("SELECT SUM(pop) FROM planet WHERE owner = $pid");
if (!($q && dbCount($q))) {
return 0;
}
list($p) = dbFetchArray($q);
$r = $this->rules->call('get', $pid);
return floor($r['research_percent'] * $p / 100);
}
}
?>