fix: build check for village vs non-village buildings

This commit is contained in:
Martin Ambrus
2017-11-25 11:26:10 +01:00
parent 4e51c9c527
commit abfcde6e9a
2 changed files with 31 additions and 16 deletions
+29 -15
View File
@@ -67,27 +67,40 @@ class Building {
public function canProcess($id,$tid) { public function canProcess($id,$tid) {
//add fix by ronix //add fix by ronix
global $session; global $session;
if($session->access==BANNED){
header("Location: banned.php"); if($session->access==BANNED){
exit; header("Location: banned.php");
} else { exit;
if ($this->checkResource($id,$tid)!=4) { } else {
if($tid >= 19) { // first of all, let's see if we should allow building what we want where we want to
header("Location: dorf2.php"); // (prevent building resource fields in the village
exit; $page = basename($_SERVER['SCRIPT_NAME']);
} if (
else { ($page == 'dorf1.php' && $id > 1 && $id <= 4) ||
header("Location: dorf1.php"); ($page == 'dorf2.php' && $id > 4)
exit; ) {
} if ( $this->checkResource( $id, $tid ) != 4 ) {
exit; 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) { public function procBuild($get) {
global $session, $village, $database; global $session, $village, $database;
if(isset($get['a']) && $get['c'] == $session->checker && !isset($get['id'])) { if(isset($get['a']) && $get['c'] == $session->checker && !isset($get['id'])) {
if($get['a'] == 0) { if($get['a'] == 0) {
$this->removeBuilding($get['d']); $this->removeBuilding($get['d']);
@@ -97,6 +110,7 @@ class Building {
$this->upgradeBuilding($get['a']); $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)) { 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']; $m=$get['master'];
$master = $_GET; $master = $_GET;
+2 -1
View File
@@ -142,8 +142,9 @@ class Village {
$this->production['wood'] = $this->getWoodProd(); $this->production['wood'] = $this->getWoodProd();
$this->production['clay'] = $this->getClayProd(); $this->production['clay'] = $this->getClayProd();
$this->production['iron'] = $this->getIronProd(); $this->production['iron'] = $this->getIronProd();
if ($uniqueA['size']==3 && $uniqueA['owner']==$session->uid){ 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){ }else if ($normalA['type']==4 && $normalA['size']==1 && $normalA['owner']==$session->uid){
$this->production['crop'] = $this->getCropProd()-$this->pop-(($upkeep)-round($upkeep*0.25)); $this->production['crop'] = $this->getCropProd()-$this->pop-(($upkeep)-round($upkeep*0.25));