From 1657928d88897cdbc615c9393e4333dadce2b5bf Mon Sep 17 00:00:00 2001 From: Pietro Date: Sat, 31 Mar 2018 16:07:32 +0200 Subject: [PATCH 01/11] Fixed a bug while sorting --- GameEngine/Market.php | 2 +- GameEngine/Multisort.php | 44 +++++++++++++++++++++------------------- GameEngine/Ranking.php | 10 ++++----- 3 files changed, 29 insertions(+), 27 deletions(-) diff --git a/GameEngine/Market.php b/GameEngine/Market.php index a1946dcf..23ef305f 100755 --- a/GameEngine/Market.php +++ b/GameEngine/Market.php @@ -290,7 +290,7 @@ class Market array_push($holderarray,$value); } } - $this->onsale = $multisort->sorte($holderarray, "'duration'", true, 2); + $this->onsale = $multisort->sorte($holderarray, "duration", true, 2); } private function filterNeed($get) diff --git a/GameEngine/Multisort.php b/GameEngine/Multisort.php index 8935c470..b762fee0 100755 --- a/GameEngine/Multisort.php +++ b/GameEngine/Multisort.php @@ -25,28 +25,30 @@ class multiSort { if($i + 2 < func_num_args()) $type = func_get_arg($i + 2); - switch($type) - { - case 1: // Case insensitive natural. - $t = 'strcasenatcmp($a[' . $key . '], $b[' . $key . '])'; - break; - case 2: // Numeric. - $t = '$a[' . $key . '] - $b[' . $key . ']'; - break; - case 3: // Case sensitive string. - $t = 'strcmp($a[' . $key . '], $b[' . $key . '])'; - break; - case 4: // Case insensitive string. - $t = 'strcasecmp($a[' . $key . '], $b[' . $key . '])'; - break; - default: // Case sensitive natural. - $t = 'strnatcmp($a[' . $key . '], $b[' . $key . '])'; - break; - } + $t = function($a, $b) use ($key) + { + switch($type) + { + case 1: // Case insensitive natural. + $result = strcasenatcmp($a[$key], $b[$key]); + break; + case 2: // Numeric. + $result = $a[$key] - $b[$key]; + break; + case 3: // Case sensitive string. + $result = strcmp($a[$key], $b[$key]); + break; + case 4: // Case insensitive string. + $result = strcasecmp($a[$key], $b[$key]); + break; + default: // Case sensitive natural. + $result = strnatcmp($a[$key], $b[ $key]); + break; + } + return $result*($order ? 1 : -1); + }; - usort($array, function($a, $b) use ($order, $t) { - return ($order ? '' : '-') . ($t); - }); + usort($array, $t); } return $array; } diff --git a/GameEngine/Ranking.php b/GameEngine/Ranking.php index b77b11cf..1ebe6dda 100755 --- a/GameEngine/Ranking.php +++ b/GameEngine/Ranking.php @@ -467,7 +467,7 @@ array_push($holder, $value); } - $holder = $multisort->sorte($holder, "'x'", true, 2, "'y'", true, 2, "'pop'", false, 2); + $holder = $multisort->sorte($holder, "x", true, 2, "y", true, 2, "pop", false, 2); $newholder = array("pad"); foreach($holder as $key) { array_push($newholder, $key); @@ -506,7 +506,7 @@ array_push($holder, $value); } - $holder = $multisort->sorte($holder, "'totalpop'", false, 2); + $holder = $multisort->sorte($holder, "totalpop", false, 2); $newholder = array("pad"); foreach($holder as $key) { array_push($newholder, $key); @@ -526,7 +526,7 @@ array_push($holder, $value); } - $holder = $multisort->sorte($holder, "'experience'", false, 2); + $holder = $multisort->sorte($holder, "experience", false, 2); $newholder = array("pad"); foreach($holder as $key) { array_push($newholder, $key); @@ -554,7 +554,7 @@ array_push($holder, $value); } - $holder = $multisort->sorte($holder, "'Aap'", false, 2); + $holder = $multisort->sorte($holder, "Aap", false, 2); $newholder = array("pad"); foreach($holder as $key) { array_push($newholder, $key); @@ -582,7 +582,7 @@ array_push($holder, $value); } - $holder = $multisort->sorte($holder, "'Adp'", false, 2); + $holder = $multisort->sorte($holder, "Adp", false, 2); $newholder = array("pad"); foreach($holder as $key) { array_push($newholder, $key); From d2226ba8be3c8fce4d5c2b1fd302a57975896f0c Mon Sep 17 00:00:00 2001 From: Pietro Date: Sat, 31 Mar 2018 17:26:49 +0200 Subject: [PATCH 02/11] A little forgetfulness --- Multisort.php | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Multisort.php diff --git a/Multisort.php b/Multisort.php new file mode 100644 index 00000000..b54c0c80 --- /dev/null +++ b/Multisort.php @@ -0,0 +1,58 @@ + \ No newline at end of file From ea42e8bf632fd37c15dfbef1760964cbe873c67d Mon Sep 17 00:00:00 2001 From: Pietro Date: Sat, 31 Mar 2018 17:32:17 +0200 Subject: [PATCH 03/11] A little forgetfulness --- GameEngine/Multisort.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GameEngine/Multisort.php b/GameEngine/Multisort.php index b762fee0..31eb9e43 100755 --- a/GameEngine/Multisort.php +++ b/GameEngine/Multisort.php @@ -25,7 +25,7 @@ class multiSort { if($i + 2 < func_num_args()) $type = func_get_arg($i + 2); - $t = function($a, $b) use ($key) + $t = function($a, $b) use ($key, $type) { switch($type) { @@ -55,4 +55,4 @@ class multiSort { }; $multisort = new multiSort; -?> \ No newline at end of file +?> From 7b2e810f751b137475f73c53ea48dd6aea4d8285 Mon Sep 17 00:00:00 2001 From: Pietro Date: Sat, 31 Mar 2018 17:37:35 +0200 Subject: [PATCH 04/11] Oops Wrong folder... --- Multisort.php | 58 --------------------------------------------------- 1 file changed, 58 deletions(-) delete mode 100644 Multisort.php diff --git a/Multisort.php b/Multisort.php deleted file mode 100644 index b54c0c80..00000000 --- a/Multisort.php +++ /dev/null @@ -1,58 +0,0 @@ - \ No newline at end of file From f3564a3390ae6255aa22646bb7b153d1d9bf7ade Mon Sep 17 00:00:00 2001 From: Pietro Date: Sat, 31 Mar 2018 17:58:37 +0200 Subject: [PATCH 05/11] Update Multisort.php --- GameEngine/Multisort.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GameEngine/Multisort.php b/GameEngine/Multisort.php index 31eb9e43..c7e8a7a4 100755 --- a/GameEngine/Multisort.php +++ b/GameEngine/Multisort.php @@ -25,7 +25,7 @@ class multiSort { if($i + 2 < func_num_args()) $type = func_get_arg($i + 2); - $t = function($a, $b) use ($key, $type) + $t = function($a, $b) use ($key, $type, $order) { switch($type) { From 057c622c26c56dae2dd94b6cd1c8500571d5fad6 Mon Sep 17 00:00:00 2001 From: Pietro Date: Sun, 1 Apr 2018 01:05:02 +0200 Subject: [PATCH 06/11] Fixed an oasis exploit With this bug you could have an infinite amount of resources --- GameEngine/Automation.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index e0f59d8f..7bded50d 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -2124,19 +2124,22 @@ class Automation { $totwood = $villageData['wood']; $totcrop = $villageData['crop']; }else{ - $cranny_eff = 0; - - // work out available resources. - $this->updateORes($data['to']); - $this->pruneOResource(); + $cranny_eff = 0; if ($conqureby >0) { //10% from owner proc village owner - fix by ronix + $this->updateRes($conqureby,$to['owner']); + $this->pruneResource(); + $villageData = $database->getVillageFields($conqureby,'clay, iron, wood, crop'); $totclay = intval($villageData['clay']/10); $totiron = intval($villageData['iron']/10); $totwood = intval($villageData['wood']/10); $totcrop = intval($villageData['crop']/10); }else{ + // work out available resources. + $this->updateORes($data['to']); + $this->pruneOResource(); + $oasisData = $database->getOasisFields($data['to'],'clay, iron, wood, crop'); $totclay = $oasisData['clay']; $totiron = $oasisData['iron']; @@ -3014,7 +3017,12 @@ class Automation { if ($isoasis == 0){ $database->modifyResource($DefenderWref,$steal[0],$steal[1],$steal[2],$steal[3],0); }else{ - $database->modifyOasisResource($DefenderWref,$steal[0],$steal[1],$steal[2],$steal[3],0); + if($conqureby > 0) //if it's an oasis but it's conquered by someone, resources must be modified in the owner village + { + $database->modifyResource($conqureby,$steal[0],$steal[1],$steal[2],$steal[3],0); + }else{ + $database->modifyOasisResource($DefenderWref,$steal[0],$steal[1],$steal[2],$steal[3],0); + } } $database->addMovement(6,$DefenderWref,$AttackerWref,$reference,$AttackArrivalTime,$endtime,1,0,0,0,0,$data['ref']); $totalstolengain=$steal[0]+$steal[1]+$steal[2]+$steal[3]; From ea653194775bb29f7b2b44ae0ad219e3345714ec Mon Sep 17 00:00:00 2001 From: Pietro Date: Sun, 1 Apr 2018 02:30:46 +0200 Subject: [PATCH 07/11] Fixed trapped chiefs' behaviour Trapped chiefs can no longer reduce the village loyalty. Removed some unused code. --- GameEngine/Automation.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 7bded50d..58fa51ab 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -2253,14 +2253,9 @@ class Automation { //catapults look :D $info_cat = $info_chief = $info_ram = $info_hero = ","; //check to see if can destroy village - $hasArtefact = false; if (count($varray) != 1 && $to['capital'] != 1 && !$database->villageHasArtefact($DefenderWref)) { $can_destroy=1; } else { - if ($database->villageHasArtefact($DefenderWref)) { - $hasArtefact = true; - } - $can_destroy=0; } if ($isoasis == 1) $can_destroy=0; @@ -2531,7 +2526,7 @@ class Automation { //$info_chief = "".$chief_pic.",You don't have enought CP to chief a village."; // note: at this point, we can use cache, since we've cleared it above if($this->getTypeLevel(35,$data['from']) == 0){ - for ($i=0; $i<($data['t9']-$dead9); $i++){ + for ($i=0; $i<($data['t9']-$dead9-$traped9); $i++){ if (!isset($rand)) { $rand = 0; } @@ -2543,7 +2538,7 @@ class Automation { } } }else{ - for ($i=0; $i<($data['t9']-$dead9); $i++){ + for ($i=0; $i<($data['t9']-$dead9-$traped9); $i++){ $rand+=rand(5,15); } } From 23a6957a7f38ab274fa3d58eff8f55f021d2489a Mon Sep 17 00:00:00 2001 From: Pietro Date: Sun, 1 Apr 2018 18:11:02 +0200 Subject: [PATCH 08/11] Fixed a little error Generated when "fid2" was empty. --- Templates/Alliance/Forum/forum_6.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Templates/Alliance/Forum/forum_6.tpl b/Templates/Alliance/Forum/forum_6.tpl index f03d7841..6f1a3ff9 100644 --- a/Templates/Alliance/Forum/forum_6.tpl +++ b/Templates/Alliance/Forum/forum_6.tpl @@ -167,7 +167,7 @@ echo '
'.$bbcode_post.'
Replies'; } if($opt['opt5'] == 1){ - echo 'Toggle Admin mode'; + echo 'Toggle Admin mode'; } echo ''; From cfc64aacc829274829d81c19ad3d7d95770600ae Mon Sep 17 00:00:00 2001 From: Pietro Date: Sun, 1 Apr 2018 18:37:10 +0200 Subject: [PATCH 09/11] Fixed an exploit in the Hero's mansion With this exploit you can release any conquered oasis --- Templates/Build/37_land.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Templates/Build/37_land.tpl b/Templates/Build/37_land.tpl index 30a5ba13..c7bb8299 100644 --- a/Templates/Build/37_land.tpl +++ b/Templates/Build/37_land.tpl @@ -3,7 +3,7 @@ Copyright: Travianx Project */ $oasisarray = $database->getOasis($village->wid); -if(isset($_GET['gid']) && $_GET['gid']==37 && isset($_GET['del'])){ +if(isset($_GET['gid']) && $_GET['gid']==37 && isset($_GET['del']) && $database->getOasisField($_GET['del'], 'owner') == $session->uid){ if($session->access != BANNED){ $database->removeOases($_GET['del']); header("Location: build.php?id=".$id."&land"); From 27bef26315a6b1406e8dabb2b8bf9d11be635bf2 Mon Sep 17 00:00:00 2001 From: Pietro Date: Mon, 2 Apr 2018 17:22:09 +0200 Subject: [PATCH 10/11] Fixed an exploit in Building.php With this exploit you can build "infinite" building of the same type. Reduced the file size from 1274 lines to 1072 lines. Removed some unused variables. Corrected some building requirements (Embassy, Academy, Stable, Walls). --- GameEngine/Building.php | 303 +++++++--------------------------------- 1 file changed, 50 insertions(+), 253 deletions(-) diff --git a/GameEngine/Building.php b/GameEngine/Building.php index 17e81ff6..5f65eeb0 100755 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -225,8 +225,6 @@ class Building { 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)) { $this->canProcess($get['master'],$get['id']); - $m=$get['master']; - $master = $_GET; $session->changeChecker(); if($session->access==BANNED){ header("Location: banned.php"); @@ -643,238 +641,58 @@ class Building { private function meetRequirement($id) { global $village,$session,$database; - - switch ( $id ) { + + $isBuilt = $this->getTypeField($id); + + switch ($id) { case 1: case 2: case 3: - case 4: - case 11: - case 15: - case 16: - case 18: - case 23: - case 31: - case 32: - case 33: - return true; - break; - + case 4: return true; + + case 5: return $this->getTypeLevel(1) >= 10 && $this->getTypeLevel(15) >= 5 && !$isBuilt; + case 6: return $this->getTypeLevel(2) >= 10 && $this->getTypeLevel(15) >= 5 && !$isBuilt; + case 7: return $this->getTypeLevel(3) >= 10 && $this->getTypeLevel(15) >= 5 && !$isBuilt; + case 8: return $this->getTypeLevel(4) >= 5 && !$isBuilt; + case 9: return $this->getTypeLevel(15) >= 5 && $this->getTypeLevel(4) >= 10 && $this->getTypeLevel(8) >= 5 && !$isBuilt; + case 10: - case 20: - return ( $this->getTypeLevel( 15 ) >= 1 ) ? true : false; - break; - - case 5: - if ( $this->getTypeLevel( 1 ) >= 10 && $this->getTypeLevel( 15 ) >= 5 ) { - return true; - } else { - return false; - } - break; - - case 6: - if ( $this->getTypeLevel( 2 ) >= 10 && $this->getTypeLevel( 15 ) >= 5 ) { - return true; - } else { - return false; - } - break; - - case 7: - if ( $this->getTypeLevel( 3 ) >= 10 && $this->getTypeLevel( 15 ) >= 5 ) { - return true; - } else { - return false; - } - break; - - case 8: - if ( $this->getTypeLevel( 4 ) >= 5 ) { - return true; - } else { - return false; - } - break; - - case 9: - if ( $this->getTypeLevel( 15 ) >= 5 && $this->getTypeLevel( 4 ) >= 10 && $this->getTypeLevel( 8 ) >= 5 ) { - return true; - } else { - return false; - } - break; - - case 12: - if ( $this->getTypeLevel( 22 ) >= 3 && $this->getTypeLevel( 15 ) >= 3 ) { - return true; - } else { - return false; - } - break; - - case 13: - if ( $this->getTypeLevel( 15 ) >= 3 && $this->getTypeLevel( 22 ) >= 1 ) { - return true; - } else { - return false; - } - break; - - case 14: - if ( $this->getTypeLevel( 16 ) >= 15 ) { - return true; - } else { - return false; - } - break; - - case 17: - if ( $this->getTypeLevel( 15 ) >= 3 && $this->getTypeLevel( 10 ) >= 1 && $this->getTypeLevel( 11 ) >= 1 ) { - return true; - } else { - return false; - } - break; - - case 19: - if ( $this->getTypeLevel( 15 ) >= 3 && $this->getTypeLevel( 16 ) >= 1 ) { - return true; - } else { - return false; - } - break; - - case 20: - if ( $this->getTypeLevel( 12 ) >= 3 && $this->getTypeLevel( 22 ) >= 5 ) { - return true; - } else { - return false; - } - break; - - case 21: - if ( $this->getTypeLevel( 22 ) >= 10 && $this->getTypeLevel( 15 ) >= 5 ) { - return true; - } else { - return false; - } - break; - - case 22: - if ( $this->getTypeLevel( 15 ) >= 3 && $this->getTypeLevel( 16 ) >= 1 ) { - return true; - } else { - return false; - } - break; - - case 24: - if ( $this->getTypeLevel( 22 ) >= 10 && $this->getTypeLevel( 15 ) >= 10 ) { - return true; - } else { - return false; - } - break; - - case 25: - if ( $this->getTypeLevel( 15 ) >= 5 && $this->getTypeLevel( 26 ) == 0 ) { - return true; - } else { - return false; - } - break; - - case 26: - if ( $this->getTypeLevel( 18 ) >= 1 && $this->getTypeLevel( 15 ) >= 5 && $this->getTypeLevel( 25 ) == 0 ) { - return true; - } else { - return false; - } - break; - - case 27: - if ( $this->getTypeLevel( 15 ) >= 10 ) { - return true; - } else { - return false; - } - break; - - case 28: - if ( $this->getTypeLevel( 17 ) == 20 && $this->getTypeLevel( 20 ) >= 10 ) { - return true; - } else { - return false; - } - break; - - case 29: - if ( $this->getTypeLevel( 19 ) == 20 && $village->capital == 0 ) { - return true; - } else { - return false; - } - break; - - case 30: - if ( $this->getTypeLevel( 20 ) == 20 && $village->capital == 0 ) { - return true; - } else { - return false; - } - break; - - case 34: - if ( $this->getTypeLevel( 26 ) >= 3 && $this->getTypeLevel( 15 ) >= 5 && $this->getTypeLevel( 25 ) == 0 && $village->capital != 0 ) { - return true; - } else { - return false; - } - break; - - case 35: - if ( $this->getTypeLevel( 16 ) >= 10 && $this->getTypeLevel( 11 ) == 20 && $session->tribe == 2 && $village->capital != 0 ) { - return true; - } else { - return false; - } - break; - - case 36: - if ( $this->getTypeLevel( 16 ) >= 1 && $session->tribe == 3 ) { - return true; - } else { - return false; - } - break; - - case 37: - if ( $this->getTypeLevel( 15 ) >= 3 && $this->getTypeLevel( 16 ) >= 1 ) { - return true; - } else { - return false; - } - break; + case 11: return $this->getTypeLevel(15) >= 1 && (!$isBuilt || $this->getTypeLevel($id) == 20); + + case 12: return $this->getTypeLevel(22) >= 3 && $this->getTypeLevel(15) >= 3 && !$isBuilt; + case 13: return $this->getTypeLevel(15) >= 3 && $this->getTypeLevel(22) >= 1 && !$isBuilt; + case 14: return $this->getTypeLevel(16) >= 15 && !$isBuilt; + + case 15: + case 16: return !$isBuilt; + + case 17: return $this->getTypeLevel(15) >= 3 && $this->getTypeLevel(10) >= 1 && $this->getTypeLevel(11) >= 1 && !$isBuilt; + case 18: return $this->getTypeLevel(15) >= 1 && !$isBuilt; + case 19: return $this->getTypeLevel(15) >= 3 && $this->getTypeLevel(16) >= 1 && !$isBuilt; + case 20: return $this->getTypeLevel(12) >= 3 && $this->getTypeLevel(22) >= 5 && !$isBuilt; + case 21: return $this->getTypeLevel(22) >= 10 && $this->getTypeLevel(15) >= 5 && !$isBuilt; + case 22: return $this->getTypeLevel(15) >= 3 && $this->getTypeLevel(19) >= 3 && !$isBuilt; + case 23: return !$isBuilt || $this->getTypeLevel($id) == 10; + case 24: return $this->getTypeLevel(22) >= 10 && $this->getTypeLevel(15) >= 10 && !$isBuilt; + case 25: return $this->getTypeLevel(15) >= 5 && $this->getTypeLevel(26) == 0 && !$isBuilt; + case 26: return $this->getTypeLevel(18) >= 1 && $this->getTypeLevel(15) >= 5 && $this->getTypeLevel(25) == 0 && !$isBuilt; + case 27: return $this->getTypeLevel(15) >= 10 && !$isBuilt; + case 28: return $this->getTypeLevel(17) == 20 && $this->getTypeLevel(20) >= 10 && !$isBuilt; + case 29: return $this->getTypeLevel(19) == 20 && $village->capital == 0 && !$isBuilt; + case 30: return $this->getTypeLevel(20) == 20 && $village->capital == 0 && !$isBuilt; + case 31: return $session->tribe == 1; + case 32: return $session->tribe == 2; + case 33: return $session->tribe == 3; + case 34: return $this->getTypeLevel(26) >= 3 && $this->getTypeLevel(15) >= 5 && $this->getTypeLevel(25) == 0 && $village->capital != 0 && !$isBuilt; + case 35: return $this->getTypeLevel(16) >= 10 && $this->getTypeLevel(11) == 20 && $session->tribe == 2 && $village->capital != 0 && !$isBuilt; + case 36: return $this->getTypeLevel(16) >= 1 && $session->tribe == 3 && (!$isBuilt || $this->getTypeLevel($id) == 20); + case 37: return $this->getTypeLevel(15) >= 3 && $this->getTypeLevel(16) >= 1 && !$isBuilt; // great warehouse can only be built with artefact or only in Natar village - case 38: - if ( $this->getTypeLevel( 15 ) >= 10 && ($village->natar == 1 || count($database->getOwnUniqueArtefactInfo2($session->uid, 6, 1, 0)) || count($database->getOwnUniqueArtefactInfo2($session->uid, 6, 2, 0)) ) ) { - return true; - } else { - return false; - } - break; + case 38: return $this->getTypeLevel(15) >= 10 && (!$isBuilt || $this->getTypeLevel($id) == 20) && ($village->natar == 1 || count($database->getOwnUniqueArtefactInfo2($session->uid, 6, 1, 0)) || count($database->getOwnUniqueArtefactInfo2($session->uid, 6, 2, 0))); // great grannary can only be built with artefact or only in Natar village - case 39: - if ( $this->getTypeLevel( 15 ) >= 10 && ($village->natar == 1 || count($database->getOwnUniqueArtefactInfo2($session->uid, 6, 1, 0)) || count($database->getOwnUniqueArtefactInfo2($session->uid, 6, 2, 0)) ) ) { - return true; - } else { - return false; - } - break; - + case 39: return $this->getTypeLevel(15) >= 10 && (!$isBuilt || $this->getTypeLevel($id) == 20) && ($village->natar == 1 || count($database->getOwnUniqueArtefactInfo2($session->uid, 6, 1, 0)) || count($database->getOwnUniqueArtefactInfo2($session->uid, 6, 2, 0))); case 40: $wwlevel = $village->resarray['f99']; @@ -907,29 +725,12 @@ class Building { } } } + + return $village->natar == 1 && $wwbuildingplan > $needed_plan; - if ( $village->natar == 1 && $wwbuildingplan > $needed_plan ) { - return true; - } else { - return false; - } - break; - - case 41: - if ( $this->getTypeLevel( 16 ) >= 10 && $this->getTypeLevel( 20 ) == 20 && $session->tribe == 1 ) { - return true; - } else { - return false; - } - break; - - case 42: - if ( GREAT_WKS && $this->getTypeLevel( 21 ) == 20 && $village->capital == 0 ) { - return true; - } else { - return false; - } - break; + case 41: return $this->getTypeLevel(16) >= 10 && $this->getTypeLevel(20) == 20 && $session->tribe == 1 && !$isBuilt; + case 42: return GREAT_WKS && $this->getTypeLevel(21) == 20 && $village->capital == 0 && !$isBuilt; + default: return false; } } @@ -978,11 +779,7 @@ class Building { // special case for Multihunter login which mathematically (because of the resarray length) // allows for building resource fields above level 20 if ($session->tribe == 0) { - if ($village->resarray['f'.$field] == 20) { - return true; - } else { - return false; - } + return $village->resarray['f'.$field] == 20; } if($id <= 4) { From a8e39468b4292f28808dc9c2cf6956a1f1d450f9 Mon Sep 17 00:00:00 2001 From: Pietro Date: Mon, 2 Apr 2018 17:23:55 +0200 Subject: [PATCH 11/11] Fixed a little thing Corrected the embassy requirements --- Templates/Build/avaliable.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Templates/Build/avaliable.tpl b/Templates/Build/avaliable.tpl index 7087197c..36b99618 100644 --- a/Templates/Build/avaliable.tpl +++ b/Templates/Build/avaliable.tpl @@ -146,7 +146,7 @@ include("avaliable/trapper.tpl"); if($rallypoint == 0 && $rallypoint1 == 0 && $id != 40) { include("avaliable/rallypoint.tpl"); } -if($embassy == 0 && $embassy1 == 0 && $id != 39 && $id != 40) { +if($embassy == 0 && $embassy1 == 0 && $id != 39 && $id != 40 && $mainbuilding >= 1) { include("avaliable/embassy.tpl"); } //fix hero