mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-08 05:36:10 +00:00
fix ww upgrade and ranking + fix bug with complete build with gold
This commit is contained in:
@@ -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(){
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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'];
|
||||
}
|
||||
|
||||
/***************************
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
#################################################################################
|
||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||
## --------------------------------------------------------------------------- ##
|
||||
## Filename ww.tpl ##
|
||||
## Developed by: Dixie ##
|
||||
## Edited by: Dzoki ##
|
||||
## License: TravianX Project ##
|
||||
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
|
||||
## ##
|
||||
#################################################################################
|
||||
$loopsame = ($building->isCurrent($id) || $building->isLoop($id))?1:0;
|
||||
$doublebuild = ($building->isCurrent($id) && $building->isLoop($id))?1:0;
|
||||
?>
|
||||
|
||||
<div id="build" class="gid40"><a href="#" onClick="return Popup(5,4);" class="build_logo">
|
||||
<img class="building g40" src="img/x.gif" alt="Sawmill" title="Sawmill" />
|
||||
</a>
|
||||
<h1>Wonder of the World <br /><span class="level">Level <?php echo $village->resarray['f'.$id];?></span></h1>
|
||||
<p class="build_desc">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.</p>
|
||||
<form action="GameEngine/Game/WorldWonderName.php" method="POST">
|
||||
<input type="hidden" name="vref" value="<?php echo $_SESSION['wid']; ?>" />
|
||||
<?php
|
||||
$vref = $_SESSION['wid'];
|
||||
$wwname = $database->getWWName($vref);
|
||||
|
||||
if($village->resarray['f'.$id] < 0){
|
||||
echo 'You need to have World Wonder level 1 to be able to change its name.
|
||||
<center><br />World Wonder name: <input class="text" name="wwname" id="wwname" disabled="disabled" value="'.$wwname.'" maxlength="20"></center><p class="btn"><input type="image" value="" tabindex="9" name="s1" disabled="disabled" id="btn_ok" class="dynamic_img" src="img/x.gif" alt="OK" /></p>';
|
||||
} else if($village->resarray['f'.$id] > 0 and $village->resarray['f'.$id] < 11) {
|
||||
echo '<center><br />World Wonder name: <input class="text" name="wwname" id="wwname" value="'.$wwname.'" maxlength="20"></center><p class="btn"><input type="image" value="" tabindex="9" name="s1" id="btn_ok" class="dynamic_img" src="img/x.gif" alt="OK" /></p>';
|
||||
} else if ($village->resarray['f'.$id] > 10){
|
||||
echo 'You can not change the name of the World Wonder after level 10.
|
||||
<center><br />World Wonder name: <input class="text" name="wwname" id="wwname" disabled="disabled" value="'.$wwname.'" maxlength="20"></center><p class="btn"><input type="image" value="" tabindex="9" name="s1" disabled="disabled" id="btn_ok" class="dynamic_img" src="img/x.gif" alt="OK" /></p>';
|
||||
}?>
|
||||
</form>
|
||||
<?php
|
||||
if(isset($_GET['n'])) {
|
||||
echo '<br /> <font color="Red"><b>Name changed.</b></font>';
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
$bindicate = $building->canBuild($id,$village->resarray['f'.$id.'t']);
|
||||
if($village->resarray['f'.$id] == 100) {
|
||||
echo "<p><span class=\"none\">Building already at max level</span></p>";
|
||||
}
|
||||
else {
|
||||
$uprequire = $building->resourceRequired($id,$village->resarray['f'.$id.'t'],($loopsame > 0 ? 2:1)+$doublebuild);
|
||||
?>
|
||||
<p id="contract"><b>Costs</b> for upgrading to level <?php echo $village->resarray['f'.$id]+1+$loopsame+$doublebuild; ?>:<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>";
|
||||
}
|
||||
else if($bindicate == 3) {
|
||||
echo "<span class=\"none\">The workers are already at work. (waiting loop)</span>";
|
||||
}
|
||||
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]);
|
||||
echo "<span class=\"none\">Enough resources ".$neededtime[0]." at ".$neededtime[1]."</span>";
|
||||
}
|
||||
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+$loopsame+$doublebuild;
|
||||
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]+1+$loopsame+$doublebuild;
|
||||
echo ".</a> <span class=\"none\">(waiting loop)</span> ";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</p></div>
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
if(WW==True){
|
||||
$result = mysql_query("select ".TB_PREFIX."users.id, ".TB_PREFIX."users.username,".TB_PREFIX."users.alliance, ".TB_PREFIX."fdata.wwname, ".TB_PREFIX."fdata.f99, ".TB_PREFIX."vdata.name, ".TB_PREFIX."fdata.vref
|
||||
$result = mysql_query("select ".TB_PREFIX."users.id, ".TB_PREFIX."users.username,".TB_PREFIX."users.alliance, ".TB_PREFIX."fdata.wwname, ".TB_PREFIX."fdata.wwlevel, ".TB_PREFIX."vdata.name, ".TB_PREFIX."fdata.vref
|
||||
FROM ".TB_PREFIX."users
|
||||
INNER JOIN ".TB_PREFIX."vdata ON ".TB_PREFIX."users.id = ".TB_PREFIX."vdata.owner
|
||||
INNER JOIN ".TB_PREFIX."fdata ON ".TB_PREFIX."fdata.vref = ".TB_PREFIX."vdata.wref
|
||||
WHERE ".TB_PREFIX."fdata.f99t = 40 ORDER BY ".TB_PREFIX."fdata.f99 Desc ");
|
||||
WHERE ".TB_PREFIX."fdata.wwlevel > 0 ORDER BY ".TB_PREFIX."fdata.wwlevel Desc ");
|
||||
|
||||
?>
|
||||
<table cellpadding="1" cellspacing="1" id="villages" class="row_table_data">
|
||||
@@ -43,7 +43,7 @@
|
||||
</td>
|
||||
<td><?php echo $row['wwname'];?></td>
|
||||
<td><a href="allianz.php?aid=<?php echo $ally['id'];?>"><?php echo $ally['tag'];?></a></td>
|
||||
<td><?php echo $row['f99'];?></td>
|
||||
<td><?php echo $row['wwlevel'];?></td>
|
||||
|
||||
|
||||
</tr>
|
||||
|
||||
+1
-5
@@ -25,10 +25,7 @@ else {
|
||||
<map name="map2" id="map2">
|
||||
<?php
|
||||
$coords = array(19=>"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 "<area href=\"build.php?id=99\" title=\"WorldWonder Level ".$village->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 "<area href=\"build.php?id=$t\" title=\"$title\" coords=\"$coords[$t]\" shape=\"poly\"/>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<area href="build.php?id=40" title="<?php echo $wtitle; ?>" coords="312,338,347,338,377,320,406,288,421,262,421,222,396,275,360,311" shape="poly" alt="" />
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user