diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 1e80ecff..9a8caa2f 100644 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -31,6 +31,20 @@ class Automation { } } + private function getWWRankInfo() { + global $database; + for ($i = 1; $i <= 40; $i++) { + $q = mysql_query("SELECT * FROM ".TB_PREFIX."fdata WHERE f99t = '40' or f".$i."t = '40'"); + $ww = mysql_fetch_array($q); + if($ww['f99'] > 0){ + $i = 99; + } + if(mysql_num_rows($q) > 0){ + $database->setVillageLevel($ww['vref'], "wwlevel", $ww['f'.$i]); + } + } + } + public function procResType($ref) { global $session; switch($ref) { @@ -166,6 +180,7 @@ class Automation { $this->demolitionComplete(); } $this->updateStore(); + $this->getWWRankInfo(); } function activeCropDead(){ diff --git a/GameEngine/Building.php b/GameEngine/Building.php index 3bb69039..84110735 100644 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -624,9 +624,8 @@ class Building { if($session->gold >= 2){ foreach($this->buildArray as $jobs) { if($jobs['wid']==$village->wid){ - for ($i = 1; $i <= 40; $i++) { $wwvillage = $database->getResourceLevel($jobs['wid']); - if($wwvillage['f99t']!=40 and $wwvillage['f'.$i.'t']!=40){ + if($wwvillage['f99t']!=40 && $wwvillage['f1t']!=40 && $wwvillage['f2t']!=40 && $wwvillage['f3t']!=40 && $wwvillage['f4t']!=40 && $wwvillage['f5t']!=40 && $wwvillage['f6t']!=40 && $wwvillage['f7t']!=40 && $wwvillage['f8t']!=40 && $wwvillage['f9t']!=40 && $wwvillage['f10t']!=40 && $wwvillage['f11t']!=40 && $wwvillage['f12t']!=40 && $wwvillage['f13t']!=40 && $wwvillage['f14t']!=40 && $wwvillage['f15t']!=40 && $wwvillage['f16t']!=40 && $wwvillage['f17t']!=40 && $wwvillage['f18t']!=40 && $wwvillage['f19t']!=40 && $wwvillage['f20t']!=40 && $wwvillage['f21t']!=40 && $wwvillage['f22t']!=40 && $wwvillage['f23t']!=40 && $wwvillage['f24t']!=40 && $wwvillage['f25t']!=40 && $wwvillage['f26t']!=40 && $wwvillage['f27t']!=40 && $wwvillage['f28t']!=40 && $wwvillage['f29t']!=40 && $wwvillage['f30t']!=40 && $wwvillage['f31t']!=40 && $wwvillage['f32t']!=40 && $wwvillage['f33t']!=40 && $wwvillage['f34t']!=40 && $wwvillage['f35t']!=40 && $wwvillage['f36t']!=40 && $wwvillage['f37t']!=40 && $wwvillage['f38t']!=40 && $wwvillage['f39t']!=40 && $wwvillage['f40t']!=40){ $level = $database->getFieldLevel($jobs['wid'],$jobs['field']); $level = ($level == -1) ? 0 : $level; if($jobs['type'] != 25 AND $jobs['type'] != 26 AND $jobs['type'] != 40) { @@ -681,7 +680,6 @@ class Building { } } } - } $technology->finishTech(); $logging->goldFinLog($village->wid); $database->modifyGold($session->uid,0,0); diff --git a/GameEngine/Database/db_MYSQL.php b/GameEngine/Database/db_MYSQL.php index b4c797d9..8b9bfcda 100644 --- a/GameEngine/Database/db_MYSQL.php +++ b/GameEngine/Database/db_MYSQL.php @@ -2150,13 +2150,15 @@ ***************************/ function getWW() { - $q = "SELECT * FROM " . TB_PREFIX . "fdata WHERE f99t = 40"; + for($i=1; $i<=40; $i++) { + $q = "SELECT * FROM " . TB_PREFIX . "fdata WHERE f99t = 40 or f".$i."t = 40"; $result = mysql_query($q, $this->connection); if(mysql_num_rows($result)) { return true; } else { return false; } + } } /*************************** @@ -2165,10 +2167,10 @@ ***************************/ function getWWLevel($vref) { - $q = "SELECT f99 FROM " . TB_PREFIX . "fdata WHERE vref = $vref"; + $q = "SELECT wwlevel FROM " . TB_PREFIX . "fdata WHERE vref = $vref"; $result = mysql_query($q, $this->connection) or die(mysql_error()); $dbarray = mysql_fetch_array($result); - return $dbarray['f99']; + return $dbarray['wwlevel']; } /*************************** diff --git a/Templates/Build/40.tpl b/Templates/Build/40.tpl new file mode 100644 index 00000000..db677e88 --- /dev/null +++ b/Templates/Build/40.tpl @@ -0,0 +1,106 @@ +isCurrent($id) || $building->isLoop($id))?1:0; + $doublebuild = ($building->isCurrent($id) && $building->isLoop($id))?1:0; +?> + +
+

Wonder of the World
Level resarray['f'.$id];?>

+

The World Wonder (otherwise known as a Wonder of the World) is as wonderful as it sounds. "This building" is built in order to win the server. Each level of the World Wonder costs hundreds of thousands (even millions) of resources to build.

+
+ +getWWName($vref); + +if($village->resarray['f'.$id] < 0){ +echo 'You need to have World Wonder level 1 to be able to change its name. +

World Wonder name:

'; +} else if($village->resarray['f'.$id] > 0 and $village->resarray['f'.$id] < 11) { +echo '

World Wonder name:

'; +} else if ($village->resarray['f'.$id] > 10){ +echo 'You can not change the name of the World Wonder after level 10. +

World Wonder name:

'; +}?> +
+      Name changed.'; + } + ?> + +canBuild($id,$village->resarray['f'.$id.'t']); +if($village->resarray['f'.$id] == 100) { + echo "

Building already at max level

"; +} +else { +$uprequire = $building->resourceRequired($id,$village->resarray['f'.$id.'t'],($loopsame > 0 ? 2:1)+$doublebuild); +?> +

Costs for upgrading to level resarray['f'.$id]+1+$loopsame+$doublebuild; ?>:
+Lumber | Clay | Iron | Crop | Crop consumption | durationgetTimeFormat($uprequire['time']); +if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1) { + echo "|\"NPC"; + } ?>
+The workers are already at work."; + } + else if($bindicate == 3) { + echo "The workers are already at work. (waiting loop)"; + } + 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) { + $neededtime = $building->calculateAvaliable($id,$village->resarray['f'.$id]); + echo "Enough resources ".$neededtime[0]." at ".$neededtime[1].""; + } + else if($bindicate == 8) { + 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]+1+$loopsame+$doublebuild; + 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]+1+$loopsame+$doublebuild; + echo ". (waiting loop) "; + } +} + +?> +

\ No newline at end of file diff --git a/Templates/Ranking/ww.tpl b/Templates/Ranking/ww.tpl index f3834b90..59613631 100644 --- a/Templates/Ranking/ww.tpl +++ b/Templates/Ranking/ww.tpl @@ -1,10 +1,10 @@ 0 ORDER BY ".TB_PREFIX."fdata.wwlevel Desc "); ?> @@ -43,7 +43,7 @@ - + diff --git a/Templates/dorf2.tpl b/Templates/dorf2.tpl index 47749711..a465d9a9 100644 --- a/Templates/dorf2.tpl +++ b/Templates/dorf2.tpl @@ -25,10 +25,7 @@ else { "53,91,91,71,127,91,91,112","136,66,174,46,210,66,174,87","196,56,234,36,270,56,234,77","270,69,308,49,344,69,308,90","327,117,365,97,401,117,365,138","14,129,52,109,88,129,52,150","97,137,135,117,171,137,135,158","182,119,182,65,257,65,257,119,220,140","337,156,375,136,411,156,375,177","2,199,40,179,76,199,40,220","129,164,167,144,203,164,167,185","92,189,130,169,166,189,130,210","342,216,380,196,416,216,380,237","22,238,60,218,96,238,60,259","167,232,205,212,241,232,205,253","290,251,328,231,364,251,328,272","95,273,133,253,169,273,133,294","222,284,260,264,296,284,260,305","80,306,118,286,154,306,118,327","199,316,237,296,273,316,237,337","270,158,303,135,316,155,318,178,304,211,288,227,263,238,250,215"); -for($t=19;$t<=39;$t++) { - if(($village->resarray['f99t'] == 40 AND ($t)=='25') or ($village->resarray['f99t'] == 40 AND ($t)=='26') or ($village->resarray['f99t'] == 40 AND ($t)=='29') or ($village->resarray['f99t'] == 40 AND ($t)=='30') or ($village->resarray['f99t'] == 40 AND ($t)=='33')) { - echo "resarray['f99']."\" coords=\"$coords[$t]\" shape=\"poly\"/>"; - } else { +for($t=19;$t<=40;$t++) { if($village->resarray['f'.$t.'t'] != 0) { $title = $building->procResType($village->resarray['f'.$t.'t']). " Level ".$village->resarray['f'.$t]; } @@ -40,7 +37,6 @@ else { } echo ""; } -} ?> diff --git a/install/data/sql.sql b/install/data/sql.sql index 90c2b462..98fcb686 100644 --- a/install/data/sql.sql +++ b/install/data/sql.sql @@ -650,6 +650,7 @@ CREATE TABLE IF NOT EXISTS `%PREFIX%fdata` ( `f99` tinyint(2) unsigned NOT NULL DEFAULT '0', `f99t` tinyint(2) unsigned NOT NULL DEFAULT '0', `wwname` varchar(25) NOT NULL DEFAULT 'World Wonder', + `wwlevel` tinyint(2) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`vref`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED;