diff --git a/Templates/Build/avaliable.tpl b/Templates/Build/avaliable.tpl index d7f6a63d..3d7ff282 100644 --- a/Templates/Build/avaliable.tpl +++ b/Templates/Build/avaliable.tpl @@ -84,6 +84,12 @@ $greatwarehouse1 = $database->getBuildingByType2($village->wid,38); $greatgranary1 = $database->getBuildingByType2($village->wid,39); $greatworkshop1 = $database->getBuildingByType2($village->wid,42); +foreach ($database->getJobs($_SESSION['wid']) as $bdata) { + $UnderConstruction = strtolower(str_replace(array(" ","'"),"",$building->procResType($bdata['type']))); + $$UnderConstruction = ($$UnderConstruction == 0 ? -1 : $$UnderConstruction); +} + + ?>

Construct new building

= 1 && $id != 39 && $id != 40) { include("avaliable/warehouse.tpl"); } -if($mainbuilding >= 10 && $village->capital == 0 && $largeA['owner'] == $session->uid || $normalA['vref'] == $village->wid ) { +if($mainbuilding >= 10 && $warehouse == 20 && $village->capital == 0 && $largeA['owner'] == $session->uid || $normalA['vref'] == $village->wid ) { include("avaliable/greatwarehouse.tpl"); } -if($mainbuilding >= 10 && $village->capital == 0 && $largeA['owner'] == $session->uid || $normalA['vref'] == $village->wid ) { +if($mainbuilding >= 10 && $granary == 20 && $village->capital == 0 && $largeA['owner'] == $session->uid || $normalA['vref'] == $village->wid ) { include("avaliable/greatgranary.tpl"); -} +} 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) { include("avaliable/rallypoint.tpl"); @@ -132,11 +138,11 @@ if($embassy == 0 && $embassy1 == 0 && $id != 39 && $id != 40) { include("avaliable/embassy.tpl"); } //fix hero -if($hero == 0 && $hero1 == 0 && $mainbuilding >= 3 && $rallypoint >= 1 && $id != 39 && $id != 40) { +if($hero == 0 && $hero1 == 0 && $mainbuilding >= 3 && $rallypoint >= 1 && $$UnderConstruction <> -1 && $id != 39 && $id != 40) { include("avaliable/hero.tpl"); } //fix barracks -if($rallypoint >= 1 && $mainbuilding >= 3 && $barrack == 0 && $barrack1 == 0 && $id != 39 && $id != 40) { +if($rallypoint >= 1 && $mainbuilding >= 3 && $barrack == 0 && $barrack1 == 0 && $$UnderConstruction <> -1 && $id != 39 && $id != 40) { include("avaliable/barracks.tpl"); } if($mainbuilding >= 3 && $academy >= 1 && $armoury == 0 && $armoury1 == 0 && $id != 39 && $id != 40) { @@ -146,25 +152,42 @@ if($cropland >= 5 && $grainmill == 0 && $grainmill1 == 0 && $id != 39 && $id != include("avaliable/grainmill.tpl"); } //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 && $$UnderConstruction <> -1 && $id != 39 && $id != 40) { include("avaliable/marketplace.tpl"); } -//fix residence -if($mainbuilding >= 5 && $residence == 0 && $residence1 == 0 && $id != 39 && $id != 40 && $palace == 0 && $palace1 == 0) { +if($mainbuilding >= 5 && $residence == 0 && $residence1 == 0 && $id != 39 && $id != 40 && $palace == 0) { include("avaliable/residence.tpl"); } if($academy == 0 && $academy1 == 0 && $mainbuilding >= 3 && $barrack >= 3 && $id != 39 && $id != 40) { include("avaliable/academy.tpl"); } -//fix palace + if($palace == 0 && $palace1 == 0 && $embassy >= 1 && $mainbuilding >= 5 && $id != 39 && $id != 40 && $residence == 0 && $residence1 == 0) { //Fix Castle //id user $user = $session->uid; +//connect to DB +mysql_connect(SQL_SERVER, SQL_USER, SQL_PASS); +mysql_select_db(SQL_DB); + +//loop search village user +$query = mysql_query("SELECT * FROM ".TB_PREFIX."vdata WHERE owner = ".$user.""); +while($villaggi_array = mysql_fetch_array($query)){ + + //loop structure village + $query1 = mysql_query("SELECT * FROM ".TB_PREFIX."fdata WHERE vref = ".$villaggi_array['wref'].""); + $strutture= mysql_fetch_array($query1); + //search Castle in array structure village -$test = in_array(26, $database->caststruc($user)); +$test = in_array(26,$strutture); +if ($test){ + break; + } + +} + //if Castle no ready include palace.tpl if (!$test){ @@ -173,10 +196,12 @@ if (!$test){ //end Fix } + + if($blacksmith == 0 && $blacksmith1 == 0 && $academy >= 3 && $mainbuilding >= 3 && $id != 39 && $id != 40) { include("avaliable/blacksmith.tpl"); } -if($stonemasonslodge == 0 && $stonemasonslodge1 == 0 && $palace >= 3 && $mainbuilding >= 5 && $id != 39 && $id != 40 && $village->capital == 1) { +if($stonemasonslodge == 0 && $stonemasonslodge1 == 0 && $palace >= 3 && $mainbuilding >= 5 && $id != 39 && $id != 40) { include("avaliable/stonemason.tpl"); } if($stable == 0 && $stable1 == 0 && $blacksmith >= 3 && $academy >= 5 && $id != 39 && $id != 40) { @@ -230,19 +255,19 @@ if($id != 39 && $id != 40) {
tribe == 3 && $trapper == 0) { -include("soon/trapper.tpl"); +if($rallypoint == 0 && $session->tribe == 3 && $trapper == 0 ) { +//include("soon/trapper.tpl"); } -if($mainbuilding < 10 && $village->capital == 0 && $largeA['owner'] == $session->uid || $normalA['vref'] == $village->wid) { +if($mainbuilding < 10 && $warehouse < 10 && $village->capital == 0 && $largeA['owner'] == $session->uid || $normalA['vref'] == $village->wid ) { include("soon/greatwarehouse.tpl"); } -if($mainbuilding < 10 && $village->capital == 0 && $largeA['owner'] == $session->uid || $normalA['vref'] == $village->wid) { +if($mainbuilding < 10 && $granary < 10 && $village->capital == 0 && $largeA['owner'] == $session->uid || $normalA['vref'] == $village->wid ) { include("soon/greatgranary.tpl"); } if($hero == 0 && ($mainbuilding <= 2 || $rallypoint == 0)){ include("soon/hero.tpl"); } -if($barrack == 0 && ($rallypoint == 0 || $mainbuilding <= 2)) { +if($barrack == 0 && ($rallypoint == 0 || $mainbuilding <= 2) ) { include("soon/barracks.tpl"); } if($armoury == 0 && ($mainbuilding <= 2 || $academy == 0)) { @@ -254,50 +279,19 @@ if($cropland <= 4) { if($marketplace == 0 && ($mainbuilding <= 2 || $granary <= 0 || $warehouse <= 0)) { include("soon/marketplace.tpl"); } -if($residence == 0 && $palace == 0 && $mainbuilding <= 4) { +if($residence == 0 && $mainbuilding <= 4) { include("soon/residence.tpl"); } if($academy == 0 && ($mainbuilding <= 2 || $barrack <= 2)) { include("soon/academy.tpl"); } -if($embassy == 0 || $mainbuilding >= 2 && $mainbuilding <= 4 && $palace == 0 && $residence == 0) { - -//Fix Castle -//id user -$user = $session->uid; - -//connect to DB -mysql_connect(SQL_SERVER, SQL_USER, SQL_PASS); -mysql_select_db(SQL_DB); - -//loop search village user -$query = mysql_query("SELECT * FROM ".TB_PREFIX."vdata WHERE owner = ".$user.""); -while($villaggi_array = mysql_fetch_array($query)){ - - //loop structure village - $query1 = mysql_query("SELECT * FROM ".TB_PREFIX."fdata WHERE vref = ".$villaggi_array['wref'].""); - $strutture= mysql_fetch_array($query1); - -//search Castle in array structure village -$test = in_array(26,$strutture); -if ($test){ - break; - } - -} - - -//if Castle no ready include palace.tpl -if (!$test){ - include("soon/palace.tpl"); -} - - //end Fix +if($embassy == 0 || $mainbuilding >= 2 && $mainbuilding <= 4) { + include("soon/palace.tpl"); } if($blacksmith == 0 && ($academy <= 2 || $mainbuilding <= 2)) { include("soon/blacksmith.tpl"); } -if($stonemasonslodge == 0 && $palace <= 2 && $palace != 0 && $mainbuilding >= 2 && $mainbuilding <= 4 && $residence == 0) { +if($stonemasonslodge == 0 && $palace <= 2 && $palace != 0 && $mainbuilding >= 2 && $mainbuilding <= 4 && $residence == 0 && $village->capital == 1) { include("soon/stonemason.tpl"); } if($stable == 0 && (($blacksmith <= 2 && $blacksmith != 0) || ($academy >= 2 && $academy <= 4))) { @@ -355,42 +349,12 @@ if($greatworkshop == 0 && $workshop >= 18 && $village->capital == 0 && GREAT_WKS include("soon/academy.tpl"); } if($palace == 0 && ($embassy == 0 || $mainbuilding <= 2)) { - //Fix Castle - //id user - $user = $session->uid; - - //connect to DB - mysql_connect(SQL_SERVER, SQL_USER, SQL_PASS); - mysql_select_db(SQL_DB); - - //loop search village user - $query = mysql_query("SELECT * FROM ".TB_PREFIX."vdata WHERE owner = ".$user.""); - while($villaggi_array = mysql_fetch_array($query)){ - - //loop structure village - $query1 = mysql_query("SELECT * FROM ".TB_PREFIX."fdata WHERE vref = ".$villaggi_array['wref'].""); - $strutture= mysql_fetch_array($query1); - - //search Castle in array structure village - $test = in_array(26,$strutture); - if ($test){ - break; - } - - } - - - //if Castle no ready include palace.tpl - if (!$test){ - include("soon/palace.tpl"); - } - - //end Fix + include("soon/palace.tpl"); } if($blacksmith == 0 && ($academy == 0 || $mainbuilding == 1)) { include("soon/blacksmith.tpl"); } - if($stonemason == 0 && ($palace == 0 || $mainbuilding <= 2) && $residence == 0 && $village->capital == 1) { + if($stonemason == 0 && ($palace == 0 || $mainbuilding <= 2) && $residence == 0) { include("soon/stonemason.tpl"); } if($stable == 0 && ($blacksmith == 0 || $academy <= 2)) { @@ -438,7 +402,6 @@ if($greatworkshop == 0 && $workshop >= 18 && $village->capital == 0 && GREAT_WKS if($greatworkshop == 0 && $workshop >= 15 && $village->capital == 0 && GREAT_WKS) { include("soon/greatworkshop.tpl"); } - } ?>
-
\ No newline at end of file + +