Fixed two population bugs

Automation.php:
Fixed the attacker population and defender population before a battle, now the account population will be considered instead of the single village population.
Fixed the attacker population and defender population while chiefing a village, now the account population will be considered instead of the single village population.

Database:
Added a function to get the total population of the account.
This commit is contained in:
Pietro
2018-04-05 21:09:16 +02:00
committed by GitHub
parent c3e2bae50b
commit 9869abe5ba
2 changed files with 33 additions and 5 deletions
+16
View File
@@ -1870,6 +1870,22 @@ class MYSQLi_DB implements IDbConnection {
}
}
/**
* Used to get the population of the whole account
*
* @param int $uid the user id
* @return int Returns the total population of the account
*/
function getTotalPopulation($uid){
list($uid) = $this->escape_input((int) $uid);
$q = "SELECT Sum(pop) FROM " . TB_PREFIX . "vdata WHERE owner = ".$uid."";
$result = mysqli_query($this->dblink, $q);
$row = mysqli_fetch_row($result);
return $row[0];
}
function getVillageByWorldID($vid, $use_cache = true) {
$array_passed = is_array($vid);