mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-10 06:36:07 +00:00
now you cannot build WW without building plan (did not tested, but should to work)
This commit is contained in:
@@ -33,6 +33,13 @@ for($i=1;$i<=$amt;$i++) {
|
||||
$database->addABTech($wid);
|
||||
$q = "UPDATE ".TB_PREFIX."units SET u41 = u41 + '150000', u42 = u42 + '150000', u43 = u43 + '150000', u44 = u44 + '150000', u45 = u45 + '150000', u46 = u46 + '150000', u47 = u47 + '150000', u48 = u48 + '150000' , u49 = u49 + '150000', u50 = u50 + '150000' WHERE vref = '".$wid."'";
|
||||
mysql_query($q);
|
||||
$desc = 'With this ancient construction plan you will able to build World Wonder to level 50. to build further, your alliance must hold at least two plans.';
|
||||
|
||||
unset($i);
|
||||
unset($vname);
|
||||
unset($effect);
|
||||
$vname = 'Ancient Construction Plan';
|
||||
$database->addArtefact($wid, 3, 11, 3, 'Ancient Construction Plan', $desc, 0, 'typeww.gif');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ for($i=1;$i<=$amt;$i++) {
|
||||
$time = time();
|
||||
$q = "insert into `s1_vdata`(`wref`,`owner`,`name`,`capital`,`pop`,`cp`,`celebration`,`type`,`wood`,`clay`,`iron`,`maxstore`,`crop`,`maxcrop`,`lastupdate`,`loyalty`,`exp1`,`exp2`,`exp3`,`created`,`natar`) values ('$wid','3','WW village',0,233,232,0,0,80000.00,80000.00,80000.00,80000,80000.00,80000,1314974534,100,0,0,0,$time,1)";
|
||||
mysql_query($q) or die(mysql_error());
|
||||
$q = "insert into ".TB_PREFIX."fdata (`vref`,`f1`,`f1t`,`f2`,`f2t`,`f3`,`f3t`,`f4`,`f4t`,`f5`,`f5t`,`f6`,`f6t`,`f7`,`f7t`,`f8`,`f8t`,`f9`,`f9t`,`f10`,`f10t`,`f11`,`f11t`,`f12`,`f12t`,`f13`,`f13t`,`f14`,`f14t`,`f15`,`f15t`,`f16`,`f16t`,`f17`,`f17t`,`f18`,`f18t`,`f19`,`f19t`,`f20`,`f20t`,`f21`,`f21t`,`f22`,`f22t`,`f23`,`f23t`,`f24`,`f24t`,`f25`,`f25t`,`f26`,`f26t`,`f27`,`f27t`,`f28`,`f28t`,`f29`,`f29t`,`f30`,`f30t`,`f31`,`f31t`,`f32`,`f32t`,`f33`,`f33t`,`f34`,`f34t`,`f35`,`f35t`,`f36`,`f36t`,`f37`,`f37t`,`f38`,`f38t`,`f39`,`f39t`,`f40`,`f40t`,`f99`,`f99t`,`wwname`) values ($wid,0,1,0,4,0,1,0,3,0,2,0,2,0,3,0,4,0,4,0,3,0,3,0,4,0,4,0,1,0,4,0,2,0,1,0,2,20,17,20,11,20,15,20,10,10,22,10,25,0,0,0,0,10,19,0,0,0,0,0,0,10,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,16,0,0,1,40,'World Wonder')";
|
||||
$q = "insert into ".TB_PREFIX."fdata (`vref`,`f1`,`f1t`,`f2`,`f2t`,`f3`,`f3t`,`f4`,`f4t`,`f5`,`f5t`,`f6`,`f6t`,`f7`,`f7t`,`f8`,`f8t`,`f9`,`f9t`,`f10`,`f10t`,`f11`,`f11t`,`f12`,`f12t`,`f13`,`f13t`,`f14`,`f14t`,`f15`,`f15t`,`f16`,`f16t`,`f17`,`f17t`,`f18`,`f18t`,`f19`,`f19t`,`f20`,`f20t`,`f21`,`f21t`,`f22`,`f22t`,`f23`,`f23t`,`f24`,`f24t`,`f25`,`f25t`,`f26`,`f26t`,`f27`,`f27t`,`f28`,`f28t`,`f29`,`f29t`,`f30`,`f30t`,`f31`,`f31t`,`f32`,`f32t`,`f33`,`f33t`,`f34`,`f34t`,`f35`,`f35t`,`f36`,`f36t`,`f37`,`f37t`,`f38`,`f38t`,`f39`,`f39t`,`f40`,`f40t`,`f99`,`f99t`,`wwname`) values ($wid,0,1,0,4,0,1,0,3,0,2,0,2,0,3,0,4,0,4,0,3,0,3,0,4,0,4,0,1,0,4,0,2,0,1,0,2,20,17,20,11,20,15,20,10,10,22,10,25,0,0,0,0,10,19,0,0,0,0,0,0,10,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,16,0,0,0,0,'World Wonder')";
|
||||
mysql_query($q);
|
||||
$database->addUnits($wid);
|
||||
$database->addTech($wid);
|
||||
|
||||
@@ -118,7 +118,6 @@ class Automation {
|
||||
$this->oasisResoucesProduce();
|
||||
$this->pruneResource();
|
||||
$this->pruneOResource();
|
||||
$this->MasterBuilder();
|
||||
if(!file_exists("GameEngine/Prevention/culturepoints.txt") or time()-filemtime("GameEngine/Prevention/culturepoints.txt")>10) {
|
||||
$this->culturePoints();
|
||||
}
|
||||
@@ -165,6 +164,7 @@ class Automation {
|
||||
$this->demolitionComplete();
|
||||
}
|
||||
$this->updateStore();
|
||||
$this->MasterBuilder();
|
||||
}
|
||||
|
||||
function activeCropDead(){
|
||||
@@ -2928,7 +2928,8 @@ private function demolitionComplete() {
|
||||
}else{
|
||||
$inbuild = 1;
|
||||
}
|
||||
if($bdata < $inbuild && $buildwood < $villwood && $buildclay < $villclay && $buildiron < $villiron && $buildcrop < $villcrop){
|
||||
$usergold = $database->getUserField($owner,'gold',0);
|
||||
if($bdata < $inbuild && $buildwood < $villwood && $buildclay < $villclay && $buildiron < $villiron && $buildcrop < $villcrop && $usergold > 0){
|
||||
$time = $master['timestamp']+time();
|
||||
if(!empty($bdata1)){
|
||||
foreach($bdata1 as $master1) {
|
||||
@@ -2940,7 +2941,6 @@ private function demolitionComplete() {
|
||||
}else{
|
||||
$database->updateBuildingWithMaster($master['id'],$time,1);
|
||||
}
|
||||
$usergold = $database->getUserField($owner,'gold',0);
|
||||
$gold = $usergold-1;
|
||||
$database->updateUserField($owner,'gold',$gold,1);
|
||||
$database->modifyResource($master['wid'],$buildwood,$buildclay,$buildiron,$buildcrop,0);
|
||||
|
||||
@@ -64,7 +64,9 @@ class Building {
|
||||
return 10;
|
||||
} else if($this->isMax($tid,$id,2) && $this->isLoop($id) && $this->isCurrent($id)) {
|
||||
return 10;
|
||||
}
|
||||
} else if($this->isMax($tid,$id,3) && $this->isLoop($id) && $this->isCurrent($id) && count($database->getMasterJobs($village->wid)) > 0) {
|
||||
return 10;
|
||||
}
|
||||
else {
|
||||
if($this->allocated <= $this->maxConcurrent) {
|
||||
$resRequired = $this->resourceRequired($id,$village->resarray['f'.$id.'t']);
|
||||
@@ -392,7 +394,7 @@ class Building {
|
||||
}
|
||||
|
||||
private function meetRequirement($id) {
|
||||
global $village;
|
||||
global $village,$database;
|
||||
switch($id) {
|
||||
case 1:
|
||||
case 2:
|
||||
@@ -491,8 +493,8 @@ class Building {
|
||||
if($this->getTypeLevel(15) >= 10 && $village->capital == 0) { return true; } else { return false; }
|
||||
break;
|
||||
case 40:
|
||||
//need to check if have ww buildplan too
|
||||
if($village->natar == 1) { return true; } else { return false; }
|
||||
$wwbuildingplan = count($database->getOwnArtefactInfoByType2($village->wid,11));
|
||||
if($village->natar == 1 && $wwbuildingplan > 0) { return true; } else { return false; }
|
||||
break;
|
||||
case 41:
|
||||
if($this->getTypeLevel(16) >= 10 && $this->getTypeLevel(20) == 20) { return true; } else { return false; }
|
||||
|
||||
@@ -1997,6 +1997,12 @@
|
||||
function getUserByTribe($tribe){
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "users where tribe = $tribe";
|
||||
$result = mysql_query($q, $this->connection);
|
||||
return $this->mysql_fetch_all($result);
|
||||
}
|
||||
|
||||
function getUserByAlliance($aid){
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "users where alliance = $aid";
|
||||
$result = mysql_query($q, $this->connection);
|
||||
return $this->mysql_fetch_all($result);
|
||||
}
|
||||
|
||||
@@ -2612,11 +2618,19 @@
|
||||
$result = mysql_query($q, $this->connection);
|
||||
return mysql_fetch_array($result);
|
||||
}
|
||||
|
||||
function getOwnArtefactInfoByType($vref, $type) {
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE vref = $vref AND type = $type";
|
||||
$result = mysql_query($q, $this->connection);
|
||||
return mysql_fetch_array($result);
|
||||
}
|
||||
|
||||
function getOwnArtefactInfoByType2($vref, $type) {
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE vref = $vref AND type = $type";
|
||||
$result = mysql_query($q, $this->connection);
|
||||
return $this->mysql_fetch_all($result);
|
||||
}
|
||||
|
||||
function getOwnUniqueArtefactInfo($id, $type, $size) {
|
||||
$q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE owner = $id AND type = $type AND size=$size";
|
||||
$result = mysql_query($q, $this->connection);
|
||||
|
||||
@@ -44,6 +44,7 @@ $greatgranary = $building->getTypeLevel(39);
|
||||
$greatworkshop = $building->getTypeLevel(42);
|
||||
$ww = $building->getTypeLevel(40);
|
||||
$wwinbuild = count($database->getBuildingByType($village->wid,40));
|
||||
$wwbuildingplan = count($database->getOwnArtefactInfoByType2($village->wid,11));
|
||||
|
||||
foreach ($database->getJobs($_SESSION['wid']) as $bdata) {
|
||||
$UnderConstruction = strtolower(str_replace(array(" ","'"),"",$building->procResType($bdata['type'])));
|
||||
@@ -54,7 +55,7 @@ foreach ($database->getJobs($_SESSION['wid']) as $bdata) {
|
||||
?>
|
||||
<div id="build" class="gid0"><h1>Construct new building</h1>
|
||||
<?php
|
||||
if($ww == 0 && $wwinbuild == 0 && $village->natar == 1){ //need to check if have ww buildplan too
|
||||
if($ww == 0 && $wwinbuild == 0 && $village->natar == 1 && $wwbuildingplan > 0){
|
||||
include("avaliable/ww.tpl");
|
||||
}
|
||||
if($mainbuilding == 0 && $id != 39 && $id != 40) {
|
||||
|
||||
@@ -42,6 +42,6 @@ echo 'You can not change the name of the World Wonder after level 10.
|
||||
?>
|
||||
|
||||
<?php
|
||||
include("upgrade.tpl");
|
||||
include("wwupgrade.tpl");
|
||||
?>
|
||||
</p></div>
|
||||
@@ -0,0 +1,156 @@
|
||||
<?php
|
||||
$bid = $village->resarray['f'.$id.'t'];
|
||||
$bindicate = $building->canBuild($id,$bid);
|
||||
$wwlevel = $village->resarray['f'.$id];
|
||||
if($wwlevel > 49){
|
||||
$needed_plan = 1;
|
||||
}else{
|
||||
$needed_plan = 0;
|
||||
}
|
||||
$alli_users = $database->getUserByAlliance($session->alliance);
|
||||
$wwbuildingplan = 0;
|
||||
if(!empty(($alli_users))){
|
||||
foreach($alli_users as $users){
|
||||
$villages = $database->getVillageID($users['id']);
|
||||
foreach($villages as $village){
|
||||
$plan = count($database->getOwnArtefactInfoByType2($village,11));
|
||||
if($plan > 0){
|
||||
$wwbuildingplan += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if($wwbuildingplan == $needed_plan){
|
||||
if($bindicate == 1) {
|
||||
echo "<p><span class=\"none\">Building already at max level</span></p>";
|
||||
} else if($bindicate == 10) {
|
||||
echo "<p><span class=\"none\">Building max level under construction</span></p>";
|
||||
} else if($bindicate == 11) {
|
||||
echo "<p><span class=\"none\">Building presently being demolished</span></p>";
|
||||
} 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'];
|
||||
?>
|
||||
<p id="contract"><b>Costs</b> for upgrading to level <?php echo $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master; ?>:<br />
|
||||
<img class="r1" src="img/x.gif" alt="Lumber" title="Lumber" /><span class="little_res"><?php echo $uprequire['wood']; ?></span> | <img class="r2" src="img/x.gif" alt="Clay" title="Clay" /><span class="little_res"><?php echo $uprequire['clay']; ?></span> | <img class="r3" src="img/x.gif" alt="Iron" title="Iron" /><span class="little_res"><?php echo $uprequire['iron']; ?></span> | <img class="r4" src="img/x.gif" alt="Crop" title="Crop" /><span class="little_res"><?php echo $uprequire['crop']; ?></span> | <img class="r5" src="img/x.gif" alt="Crop consumption" title="Crop consumption" /><?php echo $uprequire['pop']; ?> | <img class="clock" src="img/x.gif" alt="duration" title="duration" /><?php echo $generator->getTimeFormat($uprequire['time']);
|
||||
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1) {
|
||||
echo "|<a href=\"build.php?gid=17&t=3&r1=".$uprequire['wood']."&r2=".$uprequire['clay']."&r3=".$uprequire['iron']."&r4=".$uprequire['crop']."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>";
|
||||
} ?><br />
|
||||
<?php
|
||||
if($bindicate == 2) {
|
||||
echo "<span class=\"none\">The workers are already at work.</span>";
|
||||
if($session->goldclub){
|
||||
?> </br>
|
||||
<?php
|
||||
if($id <= 18) {
|
||||
if($session->gold >= 1 && $village->master == 0){
|
||||
echo "<a class=\"build\" href=\"dorf1.php?master=$bid&id=$id&time=$mastertime\">Constructing with master builder </a>";
|
||||
echo '<font color="#B3B3B3">(costs: <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="Gold"/>1)</font>';
|
||||
}else{
|
||||
echo "<span class=\"none\">Constructing with master builder</span>";
|
||||
echo '<font color="#B3B3B3">(costs: <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="Gold"/>1)</font>';
|
||||
}
|
||||
}else{
|
||||
if($session->gold >= 1 && $village->master == 0){
|
||||
echo "<a class=\"build\" href=\"dorf2.php?master=$bid&id=$id&time=$mastertime\">Constructing with master builder </a>";
|
||||
echo '<font color="#B3B3B3">(costs: <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="Gold"/>1)</font>';
|
||||
}else{
|
||||
echo "<span class=\"none\">Constructing with master builder</span>";
|
||||
echo '<font color="#B3B3B3">(costs: <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="Gold"/>1)</font>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if($bindicate == 3) {
|
||||
echo "<span class=\"none\">The workers are already at work. (waiting loop)</span>";
|
||||
if($session->goldclub){
|
||||
?> </br>
|
||||
<?php
|
||||
if($id <= 18) {
|
||||
if($session->gold >= 1 && $village->master == 0){
|
||||
echo "<a class=\"build\" href=\"dorf1.php?master=$bid&id=$id&time=$mastertime\">Constructing with master builder </a>";
|
||||
echo '<font color="#B3B3B3">(costs: <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="Gold"/>1)</font>';
|
||||
}else{
|
||||
echo "<span class=\"none\">Constructing with master builder</span>";
|
||||
echo '<font color="#B3B3B3">(costs: <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="Gold"/>1)</font>';
|
||||
}
|
||||
}else{
|
||||
if($session->gold >= 1 && $village->master == 0){
|
||||
echo "<a class=\"build\" href=\"dorf2.php?master=$bid&id=$id&time=$mastertime\">Constructing with master builder </a>";
|
||||
echo '<font color="#B3B3B3">(costs: <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="Gold"/>1)</font>';
|
||||
}else{
|
||||
echo "<span class=\"none\">Constructing with master builder</span>";
|
||||
echo '<font color="#B3B3B3">(costs: <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="Gold"/>1)</font>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if($bindicate == 4) {
|
||||
echo "<span class=\"none\">Not enough food. Expand cropland.</span>";
|
||||
}
|
||||
else if($bindicate == 5) {
|
||||
echo "<span class=\"none\">Upgrade Warehouse.</span>";
|
||||
}
|
||||
else if($bindicate == 6) {
|
||||
echo "<span class=\"none\">Upgrade Granary.</span>";
|
||||
}
|
||||
else if($bindicate == 7) {
|
||||
$neededtime = $building->calculateAvaliable($id,$village->resarray['f'.$id.'t'],1+$loopsame+$doublebuild+$master);
|
||||
echo "<span class=\"none\">Enough resources ".$neededtime[0]." at ".$neededtime[1]."</span>";
|
||||
if($session->goldclub){
|
||||
?> </br>
|
||||
<?php
|
||||
if($id <= 18) {
|
||||
if($session->gold >= 1 && $village->master == 0){
|
||||
echo "<a class=\"build\" href=\"dorf1.php?master=$bid&id=$id&time=$mastertime\">Constructing with master builder </a>";
|
||||
echo '<font color="#B3B3B3">(costs: <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="Gold"/>1)</font>';
|
||||
}else{
|
||||
echo "<span class=\"none\">Constructing with master builder</span>";
|
||||
echo '<font color="#B3B3B3">(costs: <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="Gold"/>1)</font>';
|
||||
}
|
||||
}else{
|
||||
if($session->gold >= 1 && $village->master == 0){
|
||||
echo "<a class=\"build\" href=\"dorf2.php?master=$bid&id=$id&time=$mastertime\">Constructing with master builder </a>";
|
||||
echo '<font color="#B3B3B3">(costs: <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="Gold"/>1)</font>';
|
||||
}else{
|
||||
echo "<span class=\"none\">Constructing with master builder</span>";
|
||||
echo '<font color="#B3B3B3">(costs: <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="Gold"/>1)</font>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if($bindicate == 8) {
|
||||
if($session->access==BANNED){
|
||||
echo "<a class=\"build\" href=\"banned.php\">Upgrade to level ";
|
||||
}
|
||||
else if($id <= 18) {
|
||||
echo "<a class=\"build\" href=\"dorf1.php?a=$id&c=$session->checker\">Upgrade to level ";
|
||||
}
|
||||
else {
|
||||
echo "<a class=\"build\" href=\"dorf2.php?a=$id&c=$session->checker\">Upgrade to level ";
|
||||
}
|
||||
echo $village->resarray['f'.$id]+1;
|
||||
echo ".</a>";
|
||||
}
|
||||
else if($bindicate == 9) {
|
||||
if($session->access==BANNED){
|
||||
echo "<a class=\"build\" href=\"banned.php\">Upgrade to level ";
|
||||
}
|
||||
else if($id <= 18) {
|
||||
echo "<a class=\"build\" href=\"dorf1.php?a=$id&c=$session->checker\">Upgrade to level ";
|
||||
}
|
||||
else {
|
||||
echo "<a class=\"build\" href=\"dorf2.php?a=$id&c=$session->checker\">Upgrade to level ";
|
||||
}
|
||||
echo $village->resarray['f'.$id]+($loopsame > 0 ? 2:1);
|
||||
echo ".</a> <span class=\"none\">(waiting loop)</span> ";
|
||||
}
|
||||
}
|
||||
}else{
|
||||
echo "<span class=\"none\">Need more WW construction plan.</span>";
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user