From 4a658a2c13d0c74c703ea2bd3d2c681e70da33e6 Mon Sep 17 00:00:00 2001 From: Shadow Date: Sun, 2 Mar 2014 13:25:49 +0200 Subject: [PATCH] Update wwupgrade.tpl --- Templates/Build/wwupgrade.tpl | 308 +++++++++++++++++----------------- 1 file changed, 152 insertions(+), 156 deletions(-) diff --git a/Templates/Build/wwupgrade.tpl b/Templates/Build/wwupgrade.tpl index 4b1ab268..a12f32f1 100644 --- a/Templates/Build/wwupgrade.tpl +++ b/Templates/Build/wwupgrade.tpl @@ -1,176 +1,172 @@ -resarray['f'.$id.'t']; $bindicate = $building->canBuild($id,$bid); -$wwlevel = $village->resarray['f99']; -if($wwlevel > 50){ -$needed_plan = 1; -}else{ -$needed_plan = 0; -} $wwbuildingplan = 0; $villages = $database->getVillagesID($session->uid); foreach($villages as $village1){ -$plan = count($database->getOwnArtefactInfoByType2($village1,11)); -if($plan > 0){ -$wwbuildingplan = 1; -} + $plan = count($database->getOwnArtefactInfoByType2($village1,11)); + if($plan > 0){ + $wwbuildingplan = 1; + } } if($session->alliance != 0){ -$alli_users = $database->getUserByAlliance($session->alliance); -foreach($alli_users as $users){ -$villages = $database->getVillagesID($users['id']); -if($users['id'] != $session->uid){ -foreach($villages as $village1){ -$plan = count($database->getOwnArtefactInfoByType2($village1,11)); -if($plan > 0){ -$wwbuildingplan += 1; -} -} -} -} + $alli_users = $database->getUserByAlliance($session->alliance); + foreach($alli_users as $users){ + $villages = $database->getVillagesID($users['id']); + if($users['id'] != $session->uid){ + foreach($villages as $village1){ + $plan = count($database->getOwnArtefactInfoByType2($village1,11)); + if($plan > 0){ + $wwbuildingplan += 1; + } + } + } + } } -if($wwbuildingplan > $needed_plan){ if($bindicate == 1) { - echo "

Building already at max level

"; -} else if($bindicate == 10) { - echo "

Building max level under construction

"; -} else if($bindicate == 11) { - echo "

Building presently being demolished

"; -} else { - $loopsame = ($building->isCurrent($id) || $building->isLoop($id))?1:0; - $doublebuild = ($building->isCurrent($id) && $building->isLoop($id))?1:0; - $master = count($database->getMasterJobsByField($village->wid,$id)); - $uprequire = $building->resourceRequired($id,$village->resarray['f'.$id.'t'],1+$loopsame+$doublebuild+$master); - $mastertime = $uprequire['time']; - $_SESSION['mas'][$bid]=$bid.",".$id.",".$mastertime; + echo "

Building already at max level

"; +}elseif($bindicate == 10) { + echo "

Building max level under construction

"; +}elseif($bindicate == 11) { + echo "

Building presently being demolished

"; +}else{ + $loopsame = ($building->isCurrent($id) || $building->isLoop($id))?1:0; + $doublebuild = ($building->isCurrent($id) && $building->isLoop($id))?1:0; + $master = count($database->getMasterJobsByField($village->wid,$id)); + $uprequire = $building->resourceRequired($id,$village->resarray['f'.$id.'t'],1+$loopsame+$doublebuild+$master); + $mastertime = $uprequire['time']; + $_SESSION['mas'][$bid]=$bid.",".$id.",".$mastertime; + $currentLevel=$village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master; + + $wwlevel = $currentLevel; + if($wwlevel > 50){ + $needed_plan = 1; + }else{ + $needed_plan = 0; + } + if($wwbuildingplan > $needed_plan){ ?> -

Costs for upgrading to level resarray['f'.$id]+1+$loopsame+$doublebuild+$master; ?>:
-Lumber | Clay | Iron | Crop | Crop consumption | durationgetTimeFormat($uprequire['time']); -if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1) { - echo "|\"NPC"; - } ?>
+

Costs for upgrading to level resarray['f'.$id]+1+$loopsame+$doublebuild+$master; ?>:
+ Lumber + | Clay + | Iron + | Crop + | Crop consumption | duration + getTimeFormat($uprequire['time']); + if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1) { + echo "|\"NPC"; + } ?>
The workers are already at work."; - if($session->goldclub == 1){ -?>
+ if($bindicate == 2) { + echo "The workers are already at work."; + if($session->goldclub == 1){ +?>
gold >= 1 && $village->master == 0){ - echo "checker\">Constructing with master builder "; - echo '(costs: Gold1)'; - }else{ - echo "Constructing with master builder"; - echo '(costs: Gold1)'; - } - }else{ - if($session->gold >= 1 && $village->master == 0){ - echo "checker\">Constructing with master builder "; - echo '(costs: Gold1)'; - }else{ - echo "Constructing with master builder"; - echo '(costs: Gold1)'; - } - } - } - } - else if($bindicate == 3) { - echo "The workers are already at work. (waiting loop)"; - if($session->goldclub == 1){ -?>
+ if($id <= 18) { + if($session->gold >= 1 && $village->master == 0){ + echo "checker\">Constructing with master builder "; + echo '(costs: Gold1)'; + }else{ + echo "Constructing with master builder"; + echo '(costs: Gold1)'; + } + }else{ + if($session->gold >= 1 && $village->master == 0){ + echo "checker\">Constructing with master builder "; + echo '(costs: Gold1)'; + }else{ + echo "Constructing with master builder"; + echo '(costs: Gold1)'; + } + } + } + }elseif($bindicate == 3) { + echo "The workers are already at work. (waiting loop)"; + if($session->goldclub == 1){ +?>
gold >= 1 && $village->master == 0){ - echo "checker\">Constructing with master builder "; - echo '(costs: Gold1)'; - }else{ - echo "Constructing with master builder"; - echo '(costs: Gold1)'; - } - }else{ - if($session->gold >= 1 && $village->master == 0){ - echo "checker\">Constructing with master builder "; - echo '(costs: Gold1)'; - }else{ - echo "Constructing with master builder"; - echo '(costs: Gold1)'; - } - } - } - } - else if($bindicate == 4) { - echo "Not enough food. Expand cropland."; - } - else if($bindicate == 5) { - echo "Upgrade Warehouse."; - } - else if($bindicate == 6) { - echo "Upgrade Granary."; - } - else if($bindicate == 7) { - if($village->allcrop > 0){ - $neededtime = $building->calculateAvaliable($id,$village->resarray['f'.$id.'t'],1+$loopsame+$doublebuild+$master); - echo "Enough resources ".$neededtime[0]." at ".$neededtime[1].""; - }else{ - echo "Your crop production is negative, you will never get the required resources."; - } - if($session->goldclub == 1){ -?>
+ if($id <= 18) { + if($session->gold >= 1 && $village->master == 0){ + echo "checker\">Constructing with master builder "; + echo '(costs: Gold1)'; + }else{ + echo "Constructing with master builder"; + echo '(costs: Gold1)'; + } + }else{ + if($session->gold >= 1 && $village->master == 0){ + echo "checker\">Constructing with master builder "; + echo '(costs: Gold1)'; + }else{ + echo "Constructing with master builder"; + echo '(costs: Gold1)'; + } + } + } + }elseif($bindicate == 4) { + echo "Not enough food. Expand cropland."; + }elseif($bindicate == 5) { + echo "Upgrade Warehouse."; + }else if($bindicate == 6) { + echo "Upgrade Granary."; + }else if($bindicate == 7) { + if($village->allcrop > 0){ + $neededtime = $building->calculateAvaliable($id,$village->resarray['f'.$id.'t'],1+$loopsame+$doublebuild+$master); + echo "Enough resources ".$neededtime[0]." at ".$neededtime[1].""; + }else{ + echo "Your crop production is negative, you will never get the required resources."; + } + if($session->goldclub == 1){ +?>
gold >= 1 && $village->master == 0){ - echo "checker\">Constructing with master builder "; - echo '(costs: Gold1)'; - }else{ - echo "Constructing with master builder"; - echo '(costs: Gold1)'; - } - }else{ - if($session->gold >= 1 && $village->master == 0){ - echo "checker\">Constructing with master builder "; - echo '(costs: Gold1)'; - }else{ - echo "Constructing with master builder"; - echo '(costs: Gold1)'; - } - } - } - } - else if($bindicate == 8) { - if($session->access==BANNED){ - echo "Upgrade to level "; - } - else if($id <= 18) { - echo "checker\">Upgrade to level "; + if($id <= 18) { + if($session->gold >= 1 && $village->master == 0){ + echo "checker\">Constructing with master builder "; + echo '(costs: Gold1)'; + }else{ + echo "Constructing with master builder"; + echo '(costs: Gold1)'; + } + }else{ + if($session->gold >= 1 && $village->master == 0){ + echo "checker\">Constructing with master builder "; + echo '(costs: Gold1)'; + }else{ + echo "Constructing with master builder"; + echo '(costs: Gold1)'; + } + } + } + }elseif($bindicate == 8) { + if($session->access==BANNED){ + echo "Upgrade to level "; + }elseif($id <= 18) { + echo "checker\">Upgrade to level "; + }else{ + echo "checker\">Upgrade to level "; + } + echo $village->resarray['f'.$id]+1; + echo "."; + }elseif($bindicate == 9) { + if($session->access==BANNED){ + echo "Upgrade to level "; + }else if($id <= 18) { + echo "checker\">Upgrade to level "; + }else{ + echo "checker\">Upgrade to level "; + } + echo $village->resarray['f'.$id]+($loopsame > 0 ? 2:1); + echo ". (waiting loop) "; } - else { - echo "checker\">Upgrade to level "; + }else{ + if($needed_plan == 0){ + echo "Need WW construction plan."; + }else{ + echo "Need more WW construction plan."; } - echo $village->resarray['f'.$id]+1; - echo "."; - } - else if($bindicate == 9) { - if($session->access==BANNED){ - echo "Upgrade to level "; - } - else if($id <= 18) { - echo "checker\">Upgrade to level "; - } - else { - echo "checker\">Upgrade to level "; - } - echo $village->resarray['f'.$id]+($loopsame > 0 ? 2:1); - echo ". (waiting loop) "; } } - }else{ - if($needed_plan == 0){ - echo "Need WW construction plan."; - }else{ - echo "Need more WW construction plan."; - } - } - -?> +?>