Update : now cannot be build more than one palace per account

This commit is contained in:
Shadowss
2013-07-24 12:00:09 +03:00
parent 82c2f4bb9c
commit 1dabdf1939
+52 -86
View File
@@ -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);
}
?>
<div id="build" class="gid0"><h1>Construct new building</h1>
<?php
@@ -116,14 +122,14 @@ if($wall == 0 && $wall1 == 0) {
if((($warehouse == 0 && $warehouse1 == 0) || $warehouse == 20) && $mainbuilding >= 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) {
<div id="build_list_soon" class="hide">
<?php
if($rallypoint == 0 && $session->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");
}
}
?>
</div><script language="JavaScript" type="text/javascript">
function show_build_list(list) {
@@ -477,4 +440,7 @@ function show_build_list(list) {
}
}
</script>
</div>
<?php
}
?>
</div>