Merge pull request #509 from iopietro/master

Fixed a building bug and some cleanup
Fixed the issue #506.
This commit is contained in:
Vladyslav
2018-04-04 21:13:27 +03:00
committed by GitHub
3 changed files with 152 additions and 243 deletions
+2 -1
View File
@@ -3219,7 +3219,8 @@ class Automation {
,$troopsdead9 ,$troopsdead9
,$troopsdead10 ,$troopsdead10
,$troopsdead11 ,$troopsdead11
,$DefenderUnit); ,$DefenderUnit
,$info_trap);
################################################# #################################################
+61 -84
View File
@@ -42,29 +42,6 @@ class Building {
} }
} }
public function residenceOfPalaceBuildInProgress() {
global $database, $village;
$residenceOrPalaceInProgress = $database->getBuildingByType2($village->wid, '25, 26');
$residenceBuildInProgress = false;
$palaceBuildInProgress = false;
if (count($residenceOrPalaceInProgress)) {
foreach ($residenceOrPalaceInProgress as $record) {
if ($record == 25) {
$residenceBuildInProgress = true;
} else {
$palaceBuildInProgress = true;
}
}
}
return [
'residence' => $residenceBuildInProgress,
'palace' => $palaceBuildInProgress
];
}
/* /*
* Checks whether to allow building Wonder of the World * Checks whether to allow building Wonder of the World
* above current level. This includes checks for WW upgrade * above current level. This includes checks for WW upgrade
@@ -144,19 +121,9 @@ class Building {
exit; exit;
} else { } else {
$levels = $database->getResourceLevel($village->wid); $levels = $database->getResourceLevel($village->wid);
$progresses = $this->residenceOfPalaceBuildInProgress();
if ( if (
!( !(
// check if we're not trying to hack-build residence and palace together
(
!in_array($tid, [25, 26]) ||
(
($tid == 25 && $progresses['palace'] === false) ||
($tid == 26 && $progresses['residence'] === false)
)
) &&
// don't allow building WW to level 51 with a waiting loop // don't allow building WW to level 51 with a waiting loop
( (
$tid != 99 || $tid != 99 ||
@@ -183,6 +150,11 @@ class Building {
( (
$levels['f'.$tid.'t'] == $id || $levels['f'.$tid.'t'] == $id ||
$levels['f'.$tid.'t'] == 0 $levels['f'.$tid.'t'] == 0
) &&
// check that we're not trying to build in the walls id
(
($tid == 40 && in_array($id, [31, 32, 33])) ||
$tid != 40
) )
) { ) {
if ( !isset($_GET['master']) && $this->checkResource( $id, $tid ) != 4 ) { if ( !isset($_GET['master']) && $this->checkResource( $id, $tid ) != 4 ) {
@@ -590,58 +562,63 @@ class Building {
global $database,$village,$session,$logging; global $database,$village,$session,$logging;
if($this->allocated < $this->maxConcurrent) { if($this->allocated < $this->maxConcurrent) {
// check if we're not trying to hack-build residence and palace together if ( $tid == 16 ) {
if ( $id = 39;
($progresses = $this->residenceOfPalaceBuildInProgress()) && } else if ( $tid == 31 || $tid == 32 || $tid == 33 ) {
( $id = 40;
!in_array($tid, [25, 26]) || }
( $uprequire = $this->resourceRequired( $id, $tid );
($tid == 25 && $progresses['palace'] === false) || $time = time() + $uprequire['time'];
($tid == 26 && $progresses['residence'] === false) $bindicate = $this->canBuild( $id, $tid );
) $loop = ( $bindicate == 9 ? 1 : 0 );
) if ( $loop == 1 ) {
) { foreach ( $this->buildArray as $build ) {
if ( $build['field'] >= 19 || ( $session->tribe <> 1 && ! ALLOW_ALL_TRIBE ) ) {
if ( $tid == 16 ) { $time = $build['timestamp'] + ceil( 60 / SPEED ) + $uprequire['time'];
$id = 39; }
} else if ( $tid == 31 || $tid == 32 || $tid == 33 ) { }
$id = 40; }
} if ( $this->meetRequirement( $tid ) ) {
$uprequire = $this->resourceRequired( $id, $tid ); if ( $session->access != BANNED ) {
$time = time() + $uprequire['time']; $level = $database->getResourceLevel( $village->wid );
$bindicate = $this->canBuild( $id, $tid ); if ( $database->addBuilding( $village->wid, $id, $tid, $loop, $time, 0, $level[ 'f' . $id ] + 1 + count( $database->getBuildingByField( $village->wid, $id ) ) ) ) {
$loop = ( $bindicate == 9 ? 1 : 0 ); $logging->addBuildLog( $village->wid, $this->procResType( $tid ), ( $village->resarray[ 'f' . $id ] + 1 ), 1 );
if ( $loop == 1 ) { $database->modifyResource( $village->wid, $uprequire['wood'], $uprequire['clay'], $uprequire['iron'], $uprequire['crop'], 0 );
foreach ( $this->buildArray as $build ) { header( "Location: dorf2.php" );
if ( $build['field'] >= 19 || ( $session->tribe <> 1 && ! ALLOW_ALL_TRIBE ) ) { exit;
$time = $build['timestamp'] + ceil( 60 / SPEED ) + $uprequire['time']; }
} } else {
} header( "Location: banned.php" );
} exit;
if ( $this->meetRequirement( $tid ) ) { }
if ( $session->access != BANNED ) { } else {
$level = $database->getResourceLevel( $village->wid ); header("location: dorf2.php");
if ( $database->addBuilding( $village->wid, $id, $tid, $loop, $time, 0, $level[ 'f' . $id ] + 1 + count( $database->getBuildingByField( $village->wid, $id ) ) ) ) { exit;
$logging->addBuildLog( $village->wid, $this->procResType( $tid ), ( $village->resarray[ 'f' . $id ] + 1 ), 1 ); }
$database->modifyResource( $village->wid, $uprequire['wood'], $uprequire['clay'], $uprequire['iron'], $uprequire['crop'], 0 ); } else {
header( "Location: dorf2.php" ); header( "Location: dorf2.php" );
exit; exit;
}
} else {
header( "Location: banned.php" );
exit;
}
} else {
header("location: dorf2.php");
exit;
}
} else {
header( "Location: dorf2.php" );
exit;
}
} }
} }
/**
* Search through all user's villages if the castle is built or not
*
* @return boolean Returns true if the castle is already built in the whole account, otherwise returns false
*/
public function isCastleBuilt(){
global $database, $session;
$villages = $database->getProfileVillages($session->uid);
foreach ($villages as $vil){
if(in_array(26, $database->getResourceLevel($vil['wref']))){
return true;
}
}
return false;
}
private function meetRequirement($id) { private function meetRequirement($id) {
global $village,$session,$database; global $village,$session,$database;
@@ -677,8 +654,8 @@ class Building {
case 22: return $this->getTypeLevel(15) >= 3 && $this->getTypeLevel(19) >= 3 && !$isBuilt; case 22: return $this->getTypeLevel(15) >= 3 && $this->getTypeLevel(19) >= 3 && !$isBuilt;
case 23: return !$isBuilt || $this->getTypeLevel($id) == 10; case 23: return !$isBuilt || $this->getTypeLevel($id) == 10;
case 24: return $this->getTypeLevel(22) >= 10 && $this->getTypeLevel(15) >= 10 && !$isBuilt; 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 25: return $this->getTypeLevel(15) >= 5 && !$isBuilt && !$this->getTypeField(26);
case 26: return $this->getTypeLevel(18) >= 1 && $this->getTypeLevel(15) >= 5 && $this->getTypeLevel(25) == 0 && !$isBuilt; case 26: return $this->getTypeLevel(18) >= 1 && $this->getTypeLevel(15) >= 5 && !$isBuilt && !$this->isCastleBuilt() && !$this->getTypeField(25);
case 27: return $this->getTypeLevel(15) >= 10 && !$isBuilt; case 27: return $this->getTypeLevel(15) >= 10 && !$isBuilt;
case 28: return $this->getTypeLevel(17) == 20 && $this->getTypeLevel(20) >= 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 29: return $this->getTypeLevel(19) == 20 && $village->capital == 0 && !$isBuilt;
+88 -157
View File
@@ -98,12 +98,8 @@ $greatwarehouse1 = getTypeCount(38);
$greatgranary1 = getTypeCount(39); $greatgranary1 = getTypeCount(39);
$greatworkshop1 = getTypeCount(42); $greatworkshop1 = getTypeCount(42);
$residenceOrPalaceInProgress = $building->residenceOfPalaceBuildInProgress();
$residenceBuildInProgress = $residenceOrPalaceInProgress['residence'];
$palaceBuildInProgress = $residenceOrPalaceInProgress['palace'];
?> ?>
<div id="build" class="gid0"><h1<?php echo CONSTRUCT_NEW_BUILDING;?></h1> <div id="build" class="gid0"><h1><?php echo CONSTRUCT_NEW_BUILDING;?></h1>
<?php <?php
if($mainbuilding == 0 && $mainbuilding1 == 0 && $id != 39 && $id != 40) { if($mainbuilding == 0 && $mainbuilding1 == 0 && $id != 39 && $id != 40) {
include("avaliable/mainbuilding.tpl"); include("avaliable/mainbuilding.tpl");
@@ -116,23 +112,23 @@ if((($granary == 0 && $granary1 == 0) || $granary == 20) && $mainbuilding >= 1 &
} }
if($wall == 0 && $wall1 == 0) { if($wall == 0 && $wall1 == 0) {
if($session->tribe == 1 && $id != 39) { if($session->tribe == 1 && $id != 39) {
include("avaliable/citywall.tpl"); include("avaliable/citywall.tpl");
} }
if($session->tribe == 2 && $id != 39) { if($session->tribe == 2 && $id != 39) {
include("avaliable/earthwall.tpl"); include("avaliable/earthwall.tpl");
} }
if($session->tribe == 3 && $id != 39) { if($session->tribe == 3 && $id != 39) {
include("avaliable/palisade.tpl"); include("avaliable/palisade.tpl");
} }
if($session->tribe == 4 && $id != 39) { if($session->tribe == 4 && $id != 39) {
include("avaliable/earthwall.tpl"); include("avaliable/earthwall.tpl");
} }
if($session->tribe == 5 && $id != 39) { if($session->tribe == 5 && $id != 39) {
include("avaliable/citywall.tpl"); include("avaliable/citywall.tpl");
} }
} }
if((($warehouse == 0 && $warehouse1 == 0) || $warehouse == 20) && $mainbuilding >= 1 && $id != 39 && $id != 40) { if((($warehouse == 0 && $warehouse1 == 0) || $warehouse == 20) && $mainbuilding >= 1 && $id != 39 && $id != 40) {
include("avaliable/warehouse.tpl"); include("avaliable/warehouse.tpl");
} }
if((($greatwarehouse == 0 && $greatwarehouse1 == 0) || $greatwarehouse == 20) && $mainbuilding >= 10 && ($largeA['owner'] == $session->uid || $normalA['vref'] == $village->wid || $village->natar==1) && ($id != 39 && $id != 40)) { if((($greatwarehouse == 0 && $greatwarehouse1 == 0) || $greatwarehouse == 20) && $mainbuilding >= 10 && ($largeA['owner'] == $session->uid || $normalA['vref'] == $village->wid || $village->natar==1) && ($id != 39 && $id != 40)) {
include("avaliable/greatwarehouse.tpl"); include("avaliable/greatwarehouse.tpl");
@@ -141,96 +137,64 @@ if((($greatgranary == 0 && $greatgranary1 == 0) || $greatgranary == 20) && $main
include("avaliable/greatgranary.tpl"); include("avaliable/greatgranary.tpl");
} }
if((($trapper == 0 && $trapper1 == 0) || $trapper == 20) && $rallypoint >= 1 && $session->tribe == 3 && $id != 39 && $id != 40) { if((($trapper == 0 && $trapper1 == 0) || $trapper == 20) && $rallypoint >= 1 && $session->tribe == 3 && $id != 39 && $id != 40) {
include("avaliable/trapper.tpl"); include("avaliable/trapper.tpl");
} }
if($rallypoint == 0 && $rallypoint1 == 0 && $id != 40) { if($rallypoint == 0 && $rallypoint1 == 0 && $id != 40) {
include("avaliable/rallypoint.tpl"); include("avaliable/rallypoint.tpl");
} }
if($embassy == 0 && $embassy1 == 0 && $id != 39 && $id != 40 && $mainbuilding >= 1) { if($embassy == 0 && $embassy1 == 0 && $id != 39 && $id != 40 && $mainbuilding >= 1) {
include("avaliable/embassy.tpl"); include("avaliable/embassy.tpl");
} }
//fix hero //fix hero
if($hero == 0 && $hero1 == 0 && $mainbuilding >= 3 && $rallypoint >= 1 && $id != 39 && $id != 40) { if($hero == 0 && $hero1 == 0 && $mainbuilding >= 3 && $rallypoint >= 1 && $id != 39 && $id != 40) {
include("avaliable/hero.tpl"); include("avaliable/hero.tpl");
} }
//fix barracks //fix barracks
if($rallypoint >= 1 && $mainbuilding >= 3 && $barrack == 0 && $barrack1 == 0 && $id != 39 && $id != 40) { if($rallypoint >= 1 && $mainbuilding >= 3 && $barrack == 0 && $barrack1 == 0 && $id != 39 && $id != 40) {
include("avaliable/barracks.tpl"); include("avaliable/barracks.tpl");
} }
if($mainbuilding >= 3 && $academy >= 1 && $armoury == 0 && $armoury1 == 0 && $id != 39 && $id != 40) { if($mainbuilding >= 3 && $academy >= 1 && $armoury == 0 && $armoury1 == 0 && $id != 39 && $id != 40) {
include("avaliable/armoury.tpl"); include("avaliable/armoury.tpl");
} }
if($cropland >= 5 && $grainmill == 0 && $grainmill1 == 0 && $id != 39 && $id != 40) { if($cropland >= 5 && $grainmill == 0 && $grainmill1 == 0 && $id != 39 && $id != 40) {
include("avaliable/grainmill.tpl"); include("avaliable/grainmill.tpl");
} }
//fix marketplace //fix marketplace
if($granary >= 1 && $warehouse >= 1 && $mainbuilding >= 3 && $market == 0 && $market1 == 0 && $id != 39 && $id != 40) { if($granary >= 1 && $warehouse >= 1 && $mainbuilding >= 3 && $market == 0 && $market1 == 0 && $id != 39 && $id != 40) {
include("avaliable/marketplace.tpl"); include("avaliable/marketplace.tpl");
} }
if($mainbuilding >= 5 && $residence == 0 && $residence1 == 0 && $id != 39 && $id != 40 && $palace == 0 && !$palaceBuildInProgress) { if($mainbuilding >= 5 && $residence == 0 && $residence1 == 0 && $id != 39 && $id != 40 && $palace == 0 && $palace1 == 0) {
include("avaliable/residence.tpl"); include("avaliable/residence.tpl");
} }
if($academy == 0 && $academy1 == 0 && $mainbuilding >= 3 && $barrack >= 3 && $id != 39 && $id != 40) { if($academy == 0 && $academy1 == 0 && $mainbuilding >= 3 && $barrack >= 3 && $id != 39 && $id != 40) {
include("avaliable/academy.tpl"); include("avaliable/academy.tpl");
} }
if($palace == 0 && $palace1 == 0 && !$building->isCastleBuilt() && $village->natar == 0 && $embassy >= 1 && $mainbuilding >= 5 && $id != 39 && $id != 40 && $residence == 0 && $residence1 == 0) {
if($palace == 0 && $palace1 == 0 && $village->natar == 0 && $embassy >= 1 && $mainbuilding >= 5 && $id != 39 && $id != 40 && $residence == 0 && $residence1 == 0) { include("avaliable/palace.tpl");
//Fix Castle
//id user
$user = $session->uid;
//loop search village user
$villages = $database->getProfileVillages($user);
foreach ($villages as $villaggi_array){
//loop structure village
$query1 = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."fdata WHERE vref = ".(int) $villaggi_array['wref']."");
$strutture= mysqli_fetch_array($query1);
if($strutture == false)
$strutture = [];
//search Castle in array structure village
$test = in_array(26,$strutture);
if ($test){
break;
} }
}
//if Castle no ready include palace.tpl
if (!$test && !$residenceBuildInProgress){
include("avaliable/palace.tpl");
}
//end Fix
}
if($blacksmith == 0 && $blacksmith1 == 0 && $academy >= 3 && $mainbuilding >= 3 && $id != 39 && $id != 40) { if($blacksmith == 0 && $blacksmith1 == 0 && $academy >= 3 && $mainbuilding >= 3 && $id != 39 && $id != 40) {
include("avaliable/blacksmith.tpl"); include("avaliable/blacksmith.tpl");
} }
if($stonemasonslodge == 0 && $stonemasonslodge1 == 0 && $palace >= 3 && $mainbuilding >= 5 && $id != 39 && $id != 40) { if($stonemasonslodge == 0 && $stonemasonslodge1 == 0 && $palace >= 3 && $mainbuilding >= 5 && $id != 39 && $id != 40) {
include("avaliable/stonemason.tpl"); include("avaliable/stonemason.tpl");
} }
if($stable == 0 && $stable1 == 0 && $blacksmith >= 3 && $academy >= 5 && $id != 39 && $id != 40) { if($stable == 0 && $stable1 == 0 && $blacksmith >= 3 && $academy >= 5 && $id != 39 && $id != 40) {
include("avaliable/stable.tpl"); include("avaliable/stable.tpl");
} }
if($treasury == 0 && $treasury1 == 0 && $village->natar == 0 && $mainbuilding >= 10 && $id != 39 && $id != 40) { if($treasury == 0 && $treasury1 == 0 && $village->natar == 0 && $mainbuilding >= 10 && $id != 39 && $id != 40) {
include("avaliable/treasury.tpl"); include("avaliable/treasury.tpl");
} }
if($brickyard == 0 && $brickyard1 == 0 && $claypit >= 10 && $mainbuilding >= 5 && $id != 39 && $id != 40 ) { if($brickyard == 0 && $brickyard1 == 0 && $claypit >= 10 && $mainbuilding >= 5 && $id != 39 && $id != 40 ) {
include("avaliable/brickyard.tpl"); include("avaliable/brickyard.tpl");
} }
if($sawmill == 0 && $sawmill1 == 0 && $woodcutter >= 10 && $mainbuilding >= 5 && $id != 39 && $id != 40) { if($sawmill == 0 && $sawmill1 == 0 && $woodcutter >= 10 && $mainbuilding >= 5 && $id != 39 && $id != 40) {
include("avaliable/sawmill.tpl"); include("avaliable/sawmill.tpl");
} }
if($ironfoundry == 0 && $ironfoundry1 == 0 && $ironmine >= 10 && $mainbuilding >= 5 && $id != 39 && $id != 40) { if($ironfoundry == 0 && $ironfoundry1 == 0 && $ironmine >= 10 && $mainbuilding >= 5 && $id != 39 && $id != 40) {
include("avaliable/ironfoundry.tpl"); include("avaliable/ironfoundry.tpl");
} }
if($workshop == 0 && $workshop1 == 0 && $academy >= 10 && $mainbuilding >= 5 && $id != 39 && $id != 40) { if($workshop == 0 && $workshop1 == 0 && $academy >= 10 && $mainbuilding >= 5 && $id != 39 && $id != 40) {
include("avaliable/workshop.tpl"); include("avaliable/workshop.tpl");
} }
if($tournamentsquare == 0 && $tournamentsquare1 == 0 && $rallypoint >= 15 && $id != 39 && $id != 40) { if($tournamentsquare == 0 && $tournamentsquare1 == 0 && $rallypoint >= 15 && $id != 39 && $id != 40) {
include("avaliable/tsquare.tpl"); include("avaliable/tsquare.tpl");
@@ -284,76 +248,43 @@ if($armoury == 0 && ($mainbuilding <= 2 || $academy == 0)) {
include("soon/armoury.tpl"); include("soon/armoury.tpl");
} }
if($cropland <= 4) { if($cropland <= 4) {
include("soon/grainmill.tpl"); include("soon/grainmill.tpl");
} }
if(isset($marketplace) && $marketplace == 0 && ($mainbuilding <= 2 || $granary <= 0 || $warehouse <= 0)) { if($marketplace == 0 && ($mainbuilding <= 2 || $granary <= 0 || $warehouse <= 0)) {
include("soon/marketplace.tpl"); include("soon/marketplace.tpl");
} }
if($residence == 0 && $mainbuilding <= 4) { if($residence == 0 && $mainbuilding <= 4) {
include("soon/residence.tpl"); include("soon/residence.tpl");
} }
if($academy == 0 && ($mainbuilding <= 2 || $barrack <= 2)) { if($academy == 0 && ($mainbuilding <= 2 || $barrack <= 2)) {
include("soon/academy.tpl"); include("soon/academy.tpl");
} }
if($embassy == 0 || $mainbuilding >= 2 && $mainbuilding <= 4 && $village->natar == 0) { if($embassy == 0 || $mainbuilding >= 2 && $mainbuilding <= 4 && !$building->isCastleBuilt() && $village->natar == 0) {
//Fix Castle include("soon/palace.tpl");
//id user
$user = $session->uid;
//connect to DB
//mysqli_connect(SQL_SERVER, SQL_USER, SQL_PASS);
//mysqli_select_db(SQL_DB);
//loop search village user
$villages = $database->getProfileVillages($user);
foreach ($villages as $villaggi_array){
//loop structure village
$query1 = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."fdata WHERE vref = ".(int) $villaggi_array['wref']."");
$strutture= mysqli_fetch_array($query1);
//search Castle in array structure village
if($strutture !== false)
$test = in_array(26,$strutture);
else
$test = in_array(26,[]);
if ($test){
break;
}
}
//if Castle no ready include palace.tpl
if (!$test){
include("soon/palace.tpl");
}
//end Fix
} }
if($blacksmith == 0 && ($academy <= 2 || $mainbuilding <= 2)) { if($blacksmith == 0 && ($academy <= 2 || $mainbuilding <= 2)) {
include("soon/blacksmith.tpl"); include("soon/blacksmith.tpl");
} }
if($stonemasonslodge == 0 && $palace <= 2 && $palace != 0 && $mainbuilding >= 2 && $mainbuilding <= 4 && $residence == 0 && $village->capital == 1) { if($stonemasonslodge == 0 && $palace <= 2 && $palace != 0 && $mainbuilding >= 2 && $mainbuilding <= 4 && $residence == 0 && $village->capital == 1) {
include("soon/stonemason.tpl"); include("soon/stonemason.tpl");
} }
if($stable == 0 && (($blacksmith <= 2 && $blacksmith != 0) || ($academy >= 2 && $academy <= 4))) { if($stable == 0 && (($blacksmith <= 2 && $blacksmith != 0) || ($academy >= 2 && $academy <= 4))) {
include("soon/stable.tpl"); include("soon/stable.tpl");
} }
if($treasury == 0 && $mainbuilding <= 9 && $mainbuilding >= 5 && $village->natar == 0) { if($treasury == 0 && $mainbuilding <= 9 && $mainbuilding >= 5 && $village->natar == 0) {
include("soon/treasury.tpl"); include("soon/treasury.tpl");
} }
if($brickyard == 0 && $claypit <= 9 && $claypit >= 5 && $mainbuilding >= 2 && $mainbuilding <= 4) { if($brickyard == 0 && $claypit <= 9 && $claypit >= 5 && $mainbuilding >= 2 && $mainbuilding <= 4) {
include("soon/brickyard.tpl"); include("soon/brickyard.tpl");
} }
if($sawmill == 0 && $woodcutter <= 9 && $woodcutter >= 5 && $mainbuilding >= 2 && $mainbuilding <= 4) { if($sawmill == 0 && $woodcutter <= 9 && $woodcutter >= 5 && $mainbuilding >= 2 && $mainbuilding <= 4) {
include("soon/sawmill.tpl"); include("soon/sawmill.tpl");
} }
if($ironfoundry == 0 && $ironmine <= 9 && $ironmine >= 5 && $mainbuilding >= 2 && $mainbuilding <= 4) { if($ironfoundry == 0 && $ironmine <= 9 && $ironmine >= 5 && $mainbuilding >= 2 && $mainbuilding <= 4) {
include("soon/ironfoundry.tpl"); include("soon/ironfoundry.tpl");
} }
if($workshop == 0 && $academy <= 9 && $academy >= 5 && $mainbuilding >= 2 && $mainbuilding <= 4) { if($workshop == 0 && $academy <= 9 && $academy >= 5 && $mainbuilding >= 2 && $mainbuilding <= 4) {
include("soon/workshop.tpl"); include("soon/workshop.tpl");
} }
if($tournamentsquare == 0 && $rallypoint <= 14 && $rallypoint >= 7) { if($tournamentsquare == 0 && $rallypoint <= 14 && $rallypoint >= 7) {
include("soon/tsquare.tpl"); include("soon/tsquare.tpl");
@@ -369,7 +300,7 @@ if($tradeoffice == 0 && $market <= 19 && $market >= 10 || $stable >= 5 && $stabl
} }
if($session->tribe == 1 && $horsedrinkingtrough == 0 && $rallypoint <= 9 && $rallypoint >= 5 || $stable <= 19 && $stable >= 10 && $session->tribe == 1) { if($session->tribe == 1 && $horsedrinkingtrough == 0 && $rallypoint <= 9 && $rallypoint >= 5 || $stable <= 19 && $stable >= 10 && $session->tribe == 1) {
include("soon/horsedrinking.tpl"); include("soon/horsedrinking.tpl");
} }
if($brewery == 0 && $village->capital == 1 && $rallypoint <= 9 && $rallypoint >= 5 || $granary <= 19 && $granary >= 10 && $session->tribe == 2) { if($brewery == 0 && $village->capital == 1 && $rallypoint <= 9 && $rallypoint >= 5 || $granary <= 19 && $granary >= 10 && $session->tribe == 2) {
include("soon/brewery.tpl"); include("soon/brewery.tpl");
} }
@@ -388,64 +319,64 @@ href="javascript:show_build_list('all');"><?php echo SHOW_MORE;?></a></p>
<div id="build_list_all" class="hide"> <div id="build_list_all" class="hide">
<?php <?php
if($academy == 0 && ($mainbuilding == 1 || $barrack == 0)) { if($academy == 0 && ($mainbuilding == 1 || $barrack == 0)) {
include("soon/academy.tpl"); include_once("soon/academy.tpl");
} }
if($palace == 0 && ($embassy == 0 || $mainbuilding <= 2) && $village->natar == 0) { if($palace == 0 && ($embassy == 0 || $mainbuilding <= 2) && $village->natar == 0) {
include("soon/palace.tpl"); include_once("soon/palace.tpl");
} }
if($blacksmith == 0 && ($academy == 0 || $mainbuilding == 1)) { if($blacksmith == 0 && ($academy == 0 || $mainbuilding == 1)) {
include("soon/blacksmith.tpl"); include_once("soon/blacksmith.tpl");
} }
if($stonemason == 0 && ($palace == 0 || $mainbuilding <= 2) && $residence == 0) { if($stonemason == 0 && ($palace == 0 || $mainbuilding <= 2) && $residence == 0) {
include("soon/stonemason.tpl"); include_once("soon/stonemason.tpl");
} }
if($stable == 0 && ($blacksmith == 0 || $academy <= 2)) { if($stable == 0 && ($blacksmith == 0 || $academy <= 2)) {
include("soon/stable.tpl"); include_once("soon/stable.tpl");
} }
if($treasury == 0 && $mainbuilding <= 5) { if($treasury == 0 && $mainbuilding <= 5) {
include("soon/treasury.tpl"); include_once("soon/treasury.tpl");
} }
if($brickyard == 0 && ($claypit <= 5 || $mainbuilding <= 2)) { if($brickyard == 0 && ($claypit <= 5 || $mainbuilding <= 2)) {
include("soon/brickyard.tpl"); include_once("soon/brickyard.tpl");
} }
if($sawmill == 0 && ($woodcutter <= 5 || $mainbuilding <= 2)) { if($sawmill == 0 && ($woodcutter <= 5 || $mainbuilding <= 2)) {
include("soon/sawmill.tpl"); include_once("soon/sawmill.tpl");
} }
if($ironfoundry == 0 && ($ironmine <= 5 || $mainbuilding <= 2)) { if($ironfoundry == 0 && ($ironmine <= 5 || $mainbuilding <= 2)) {
include("soon/ironfoundry.tpl"); include_once("soon/ironfoundry.tpl");
} }
if($workshop == 0 && ($academy <= 5 || $mainbuilding <= 2)) { if($workshop == 0 && ($academy <= 5 || $mainbuilding <= 2)) {
include("soon/workshop.tpl"); include_once("soon/workshop.tpl");
} }
if($tournamentsquare == 0 && $rallypoint <= 7) { if($tournamentsquare == 0 && $rallypoint <= 7) {
include("soon/tsquare.tpl"); include_once("soon/tsquare.tpl");
} }
if($bakery == 0 && ($grainmill == 0 || $cropland <= 5 || $mainbuilding <= 2)) { if($bakery == 0 && ($grainmill == 0 || $cropland <= 5 || $mainbuilding <= 2)) {
include("soon/bakery.tpl"); include_once("soon/bakery.tpl");
} }
if($townhall == 0 && ($mainbuilding <= 5 || $academy <= 5)) { if($townhall == 0 && ($mainbuilding <= 5 || $academy <= 5)) {
include("soon/townhall.tpl"); include_once("soon/townhall.tpl");
} }
if($tradeoffice == 0 && ($market <= 10 || $stable <= 5)) { if($tradeoffice == 0 && ($market <= 10 || $stable <= 5)) {
include("soon/tradeoffice.tpl"); include_once("soon/tradeoffice.tpl");
} }
if($session->tribe == 1 && $horsedrinkingtrough == 0 && ($rallypoint <= 5 || $stable <= 10)) { if($session->tribe == 1 && $horsedrinkingtrough == 0 && ($rallypoint <= 5 || $stable <= 10)) {
include("soon/horsedrinking.tpl"); include_once("soon/horsedrinking.tpl");
} }
if($brewery == 0 && ($rallypoint <= 5 || $granary <= 10) && $session->tribe == 2 && $village->capital == 1) { if($brewery == 0 && ($rallypoint <= 5 || $granary <= 10) && $session->tribe == 2 && $village->capital == 1) {
include("soon/brewery.tpl"); include_once("soon/brewery.tpl");
} }
if($greatbarracks == 0 && $barrack >= 15 && $village->capital == 0) { if($greatbarracks == 0 && $barrack >= 15 && $village->capital == 0) {
include("soon/greatbarracks.tpl"); include_once("soon/greatbarracks.tpl");
} }
if($greatstable == 0 && $stable >= 15 && $village->capital == 0) { if($greatstable == 0 && $stable >= 15 && $village->capital == 0) {
include("soon/greatstable.tpl"); include_once("soon/greatstable.tpl");
} }
if($greatworkshop == 0 && $workshop >= 15 && $village->capital == 0 && GREAT_WKS) { if($greatworkshop == 0 && $workshop >= 15 && $village->capital == 0 && GREAT_WKS) {
include("soon/greatworkshop.tpl"); include_once("soon/greatworkshop.tpl");
} }
?> ?>
</div><script language="JavaScript" type="text/javascript"> </div><script type="text/javascript">
function show_build_list(list) { function show_build_list(list) {
// aktuelle liste, aktueller link // aktuelle liste, aktueller link
var build_list = document.getElementById('build_list_'+list); var build_list = document.getElementById('build_list_'+list);