diff --git a/GameEngine/Building.php b/GameEngine/Building.php index 9137e995..f9d7147b 100755 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -67,27 +67,40 @@ class Building { public function canProcess($id,$tid) { //add fix by ronix - global $session; - if($session->access==BANNED){ - header("Location: banned.php"); - exit; - } else { - if ($this->checkResource($id,$tid)!=4) { - if($tid >= 19) { - header("Location: dorf2.php"); - exit; - } - else { - header("Location: dorf1.php"); - exit; - } - exit; + global $session; + + if($session->access==BANNED){ + header("Location: banned.php"); + exit; + } else { + // first of all, let's see if we should allow building what we want where we want to + // (prevent building resource fields in the village + $page = basename($_SERVER['SCRIPT_NAME']); + if ( + ($page == 'dorf1.php' && $id > 1 && $id <= 4) || + ($page == 'dorf2.php' && $id > 4) + ) { + if ( $this->checkResource( $id, $tid ) != 4 ) { + if ( $tid >= 19 ) { + header( "Location: dorf2.php" ); + exit; + } else { + header( "Location: dorf1.php" ); + exit; + } + + exit; } + } else { + header('Location: '.$_SERVER['SCRIPT_NAME']); + exit; + } } } public function procBuild($get) { global $session, $village, $database; + if(isset($get['a']) && $get['c'] == $session->checker && !isset($get['id'])) { if($get['a'] == 0) { $this->removeBuilding($get['d']); @@ -97,6 +110,7 @@ class Building { $this->upgradeBuilding($get['a']); } } + if(isset($get['master']) && isset($get['id']) && isset($get['time']) && $session->gold >= 1 && $session->goldclub && $village->master == 0 && (isset($get['c']) && $get['c']== $session->checker)) { $m=$get['master']; $master = $_GET; diff --git a/GameEngine/Village.php b/GameEngine/Village.php index 2b24b993..c53b430b 100755 --- a/GameEngine/Village.php +++ b/GameEngine/Village.php @@ -142,8 +142,9 @@ class Village { $this->production['wood'] = $this->getWoodProd(); $this->production['clay'] = $this->getClayProd(); $this->production['iron'] = $this->getIronProd(); + if ($uniqueA['size']==3 && $uniqueA['owner']==$session->uid){ - $this->production['crop'] = $this->getCropProd()-$this->pop-(($upkeep)-round($upkeep*0.50)); + $this->production['crop'] = $this->getCropProd()- $this->pop - (($upkeep)-round($upkeep*0.50)); }else if ($normalA['type']==4 && $normalA['size']==1 && $normalA['owner']==$session->uid){ $this->production['crop'] = $this->getCropProd()-$this->pop-(($upkeep)-round($upkeep*0.25));