mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-09-02 16:37:15 +00:00
Some additional fixes
Some additional fixes
This commit is contained in:
@@ -143,17 +143,29 @@ trait DatabaseBuildingQueries {
|
||||
global ${'bid'.$tid}, $bid15;
|
||||
|
||||
$dataArray = ${'bid'.$tid};
|
||||
|
||||
$level = $buildingArray['f'.$id] + $plus;
|
||||
|
||||
// FIX (PHP log): daca $level depaseste nivelul maxim definit in
|
||||
// $dataArray (cladire deja la nivel maxim - acelasi guard pus si in
|
||||
// Building::checkResource()/resourceRequired()), $dataArray[$level]
|
||||
// nu exista -> "Undefined array key 21" + acces pe null pe ['time'].
|
||||
// Timp 0 e fallback sigur (apelantii trateaza deja "cost zero" ca
|
||||
// raspuns pentru cazul de nivel maxim, vezi resourceRequired()).
|
||||
if (!isset($dataArray[$level])) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
//Check if we've the main building or not
|
||||
$mainBuilding = $this->getFieldLevelInVillage($wref, 15);
|
||||
if($tid == 15){
|
||||
if($mainBuilding == 0) return round($dataArray[$buildingArray['f'.$id] + $plus]['time'] / SPEED * 5);
|
||||
else return round($dataArray[$buildingArray['f'.$id] + $plus]['time'] / SPEED);
|
||||
if($mainBuilding == 0) return round($dataArray[$level]['time'] / SPEED * 5);
|
||||
else return round($dataArray[$level]['time'] / SPEED);
|
||||
}else{
|
||||
if($mainBuilding > 0) {
|
||||
return round($dataArray[$buildingArray['f'.$id] + $plus]['time'] * ($bid15[$mainBuilding]['attri'] / 100) / SPEED);
|
||||
return round($dataArray[$level]['time'] * ($bid15[$mainBuilding]['attri'] / 100) / SPEED);
|
||||
}
|
||||
else return round($dataArray[$buildingArray['f'.$id] + $plus]['time'] * 5 / SPEED);
|
||||
else return round($dataArray[$level]['time'] * 5 / SPEED);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -405,7 +405,11 @@ References: User ID/Message ID, Mode
|
||||
// first of all, check if we should be using cache and whether the field
|
||||
// required is already cached
|
||||
if ($use_cache && ($cachedValue = self::returnCachedContent(self::$noticesCacheById, $id)) && !is_null($cachedValue)) {
|
||||
return $cachedValue[$field];
|
||||
// FIX (PHP log): cand $field e null (apelantul vrea randul intreg,
|
||||
// nu un camp anume), vechiul cod facea $cachedValue[$field] cu
|
||||
// $field=null -> PHP converteste cheia null in "" -> "Undefined
|
||||
// array key \"\"". Acelasi tratament ca pe ramura fara cache mai jos.
|
||||
return is_null($field) ? $cachedValue : $cachedValue[$field];
|
||||
}
|
||||
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "ndata where `id` = $id ORDER BY time ".(isset($_GET['o']) && $_GET['o'] == 1 ? 'ASC' : 'DESC')." LIMIT 1";
|
||||
@@ -413,6 +417,18 @@ References: User ID/Message ID, Mode
|
||||
$dbarray = mysqli_fetch_array($result);
|
||||
|
||||
self::$noticesCacheById[$id] = $dbarray;
|
||||
|
||||
// FIX (PHP log): id inexistent in ndata (notice sters / link stale)
|
||||
// -> mysqli_fetch_array() intoarce null -> $dbarray e null. Vechiul
|
||||
// cod incerca oricum self::$noticesCacheById[$id][$field] pe el,
|
||||
// dand "Trying to access array offset on null". Notice-ul chiar nu
|
||||
// exista, deci intoarcem null direct (comportament identic la
|
||||
// consumatori: Message::getReadNotice() trateaza deja null ca
|
||||
// "nu am gasit/nu am voie", vezi fix-ul din Message.php).
|
||||
if (is_null($dbarray)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return is_null($field) ? self::$noticesCacheById[$id] : self::$noticesCacheById[$id][$field];
|
||||
}
|
||||
|
||||
|
||||
@@ -92,8 +92,12 @@ trait DatabaseStatisticsQueries {
|
||||
* jucatorii acelor triburi nu-si vedeau niciodata satele acolo.
|
||||
*
|
||||
* Aceeasi lista completa e folosita deja in winner.php.
|
||||
*
|
||||
* BUG REPARAT #2: u.access<8/10 excludea Multihunter(8)/Admin(9) dar nu si
|
||||
* conturile banate (access=0, 0 < 8 e adevarat); u.access>0 adaugat, deci
|
||||
* satele unui cont banat nu mai sunt colorate dupa rang pe harta lumii.
|
||||
*/
|
||||
$q = "SELECT v.wref,v.name,v.owner,v.pop FROM " . TB_PREFIX . "vdata AS v," . TB_PREFIX . "users AS u WHERE v.owner=u.id AND u.tribe IN(1,2,3,6,7,8,9".(SHOW_NATARS ? ',5' : '').") AND v.wref != '' AND u.access<" . (INCLUDE_ADMIN ? "10" : "8");
|
||||
$q = "SELECT v.wref,v.name,v.owner,v.pop FROM " . TB_PREFIX . "vdata AS v," . TB_PREFIX . "users AS u WHERE v.owner=u.id AND u.tribe IN(1,2,3,6,7,8,9".(SHOW_NATARS ? ',5' : '').") AND v.wref != '' AND u.access>0 AND u.access<" . (INCLUDE_ADMIN ? "10" : "8");
|
||||
$result = mysqli_query($this->dblink,$q);
|
||||
return $this->mysqli_fetch_all($result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user