diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 8061f379..dc116c9b 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -3974,7 +3974,6 @@ class Automation { $unitArrays = $this->getAllUnits($wref, false); $villageUpkeep = $getVillage['pop'] + $technology->getUpkeep($unitArrays, 0, $wref); $starv = $getVillage['starv']; - if ($crop < $villageUpkeep){ //Add starvation data $database->setVillageFields($wref, ['starv', 'starvupdate'], [$villageUpkeep, time()]); @@ -4156,7 +4155,7 @@ class Automation { break; } - $database->modifyResource($starv['wref'], 0, 0, 0, max(intval($newCrop), 0), 1); + $database->modifyResource($starv['wref'], 0, 0, 0, max($newCrop, 0), 1); $database->setVillageField($starv['wref'], ['starv', 'starvupdate'], [$upkeep, $time]); } } diff --git a/GameEngine/Database.php b/GameEngine/Database.php index adb70757..8af1f5fe 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -3274,7 +3274,7 @@ class MYSQLi_DB implements IDbConnection { /////////////ADDED BY BRAINIAC - THANK YOU function modifyResource($vid, $wood, $clay, $iron, $crop, $mode) { - list($vid, $wood, $clay, $iron, $crop, $mode) = $this->escape_input((int) $vid, (int) $wood, (int) $clay, (int) $iron, (int) $crop, $mode); + list($vid, $wood, $clay, $iron, $crop, $mode) = $this->escape_input((int) $vid, $wood, $clay, $iron, $crop, $mode); $sign = (!$mode ? '-' : '+'); $q = " @@ -7407,17 +7407,16 @@ References: User ID/Message ID, Mode return $cachedValue; } - $wood = $cropo = $clay = $iron = 0; - $basecrop = $grainmill = $bakery = 0; + $basecrop = $grainmill = $bakery = $cropo = 0; $owner = $this->getVrefField($wref, 'owner', $use_cache); $bonus = $this->getUserField($owner, 'b4', 0); $buildarray = $this->getResourceLevel($wref); $cropholder = []; for($i = 1; $i <= 38; $i++){ - if($buildarray['f'.$i.'t'] == 4) array_push($cropholder, 'f' . $i); - if($buildarray['f'.$i.'t'] == 8) $grainmill = $buildarray['f' . $i]; - if($buildarray['f'.$i.'t'] == 9) $bakery = $buildarray['f' . $i]; + if($buildarray['f'.$i.'t'] == 4) array_push($cropholder, 'f'.$i); + if($buildarray['f'.$i.'t'] == 8) $grainmill = $buildarray['f'.$i]; + if($buildarray['f'.$i.'t'] == 9) $bakery = $buildarray['f'.$i]; } $q = "SELECT type FROM `" . TB_PREFIX . "odata` WHERE conqured = ".(int) $wref; @@ -7440,14 +7439,14 @@ References: User ID/Message ID, Mode for($i = 0; $i <= count($cropholder) - 1; $i++){ $basecrop += $bid4[$buildarray[$cropholder[$i]]]['prod']; } + $crop = $basecrop + $basecrop * 0.25 * $cropo; if($grainmill >= 1 || $bakery >= 1){ $crop += $basecrop / 100 * ((isset($bid8[$grainmill]['attri']) ? $bid8[$grainmill]['attri'] : 0) + (isset($bid9[$bakery]['attri']) ? $bid9[$bakery]['attri'] : 0)); } - if($bonus > time()){ - $crop *= 1.25; - } + if($bonus > time()) $crop *= 1.25; + $crop *= SPEED; self::$cropProductionStarvationValueCache[$wref] = $crop; diff --git a/GameEngine/Village.php b/GameEngine/Village.php index 4658c9fb..2e687fca 100755 --- a/GameEngine/Village.php +++ b/GameEngine/Village.php @@ -37,9 +37,9 @@ class Village { //add new line code //check exist village if from village destroy to avoid error msg. - if ( !$database->checkVilExist($this->wid) ) { + if(!$database->checkVilExist($this->wid)){ $this->wid=$database->getVillageID($session->uid); - $_SESSION['wid']=$this->wid; + $_SESSION['wid'] = $this->wid; } $this->LoadTown();