From ba723dce9d0676be8bd0bb61f11bdb1b54f7a1b5 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 May 2012 20:44:10 +0300 Subject: [PATCH] fixed bugs from the list of NarcisRO and more --- Admin/Templates/ban_msg.tpl | 2 +- GameEngine/Admin/Mods/natarbuildingplan.php | 2 +- GameEngine/Automation.php | 29 +++++++++-- GameEngine/Building.php | 54 ++++++++------------- GameEngine/Technology.php | 2 +- Templates/Build/15_1.tpl | 3 ++ Templates/Build/36.tpl | 2 +- Templates/Build/37_train.tpl | 15 +++--- Templates/Build/avaliable.tpl | 8 ++- Templates/Build/wwupgrade.tpl | 18 ++++--- Templates/Ranking/alliance.tpl | 4 +- Templates/Ranking/alliance_attack.tpl | 4 +- Templates/Ranking/alliance_defend.tpl | 4 +- Templates/Ranking/heroes.tpl | 11 +++-- Templates/Ranking/overview.tpl | 4 +- Templates/Ranking/player_1.tpl | 4 +- Templates/Ranking/player_2.tpl | 4 +- Templates/Ranking/player_3.tpl | 4 +- Templates/Ranking/player_attack.tpl | 7 ++- Templates/Ranking/player_defend.tpl | 4 +- Templates/Ranking/villages.tpl | 4 +- Templates/Ranking/ww.tpl | 2 +- build.php | 6 +++ 23 files changed, 122 insertions(+), 75 deletions(-) diff --git a/Admin/Templates/ban_msg.tpl b/Admin/Templates/ban_msg.tpl index b1d44113..ea8e991e 100644 --- a/Admin/Templates/ban_msg.tpl +++ b/Admin/Templates/ban_msg.tpl @@ -8,7 +8,7 @@ ## ## ################################################################################# $time = time(); -$ban = mysql_query("SELECT * FROM ".TB_PREFIX."banlist WHERE `uid` = '".$session->uid."' and `end` < '".$time."'"); +$ban = mysql_query("SELECT * FROM ".TB_PREFIX."banlist WHERE `uid` = '".$session->uid."' and `end` < '".$time."' and active = 1"); $ban1 = mysql_fetch_array($ban); ?> diff --git a/GameEngine/Admin/Mods/natarbuildingplan.php b/GameEngine/Admin/Mods/natarbuildingplan.php index e4f1d876..219fbf7b 100644 --- a/GameEngine/Admin/Mods/natarbuildingplan.php +++ b/GameEngine/Admin/Mods/natarbuildingplan.php @@ -37,7 +37,7 @@ for($i=1;$i<=$amt;$i++) { $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.'; - $database->addArtefact($wid, 3, 11, 3, 'Ancient Construction Plan', $desc, 0, 'typeww.gif'); + $database->addArtefact($wid, 3, 11, 1, 'Ancient Construction Plan', $desc, '', 'typeww.gif'); } diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 5b632149..64d0ffef 100644 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -1075,6 +1075,22 @@ class Automation { $heroxp = $totaldead_def; $database->modifyHeroXp("experience",$heroxp,$from['owner']); } + $Defender1 = $database->getUnit($data['to']); + if($Defender1['hero'] > 0){ + $defheroowner = $database->getVillageField($Defender1['vref'],"owner"); + $defheroxp = $totaldead_att; + $database->modifyHeroXp("experience",$defheroxp,$defheroowner); + } + $enforcementarray1 = $database->getEnforceVillage($data['to'],0); + if(count($enforcementarray1) > 0) { + foreach($enforcementarray1 as $enforce1) { + if($enforce1['hero'] > 0){ + $enforceowner = $database->getVillageField($enforce1['from'],"owner"); + $reinfheroxp = $totaldead_att; + $database->modifyHeroXp("experience",$reinfheroxp,$enforceowner); + } + } + } $database->modifyPoints($toF['owner'],'dpall',$totaldead_att ); $database->modifyPoints($from['owner'],'apall',$totaldead_def); $database->modifyPoints($toF['owner'],'dp',$totaldead_att ); @@ -1913,8 +1929,8 @@ if($data['t11'] > 0){ $walllevel =0; $rplevel =0; } -$palaceimg = "img/g/g26.gif\" height=\"30\" width=\"24\" alt=\"Palace\" title=\"Palace\" />"; -$crannyimg = "img/g/g23.gif\" height=\"30\" width=\"24\" alt=\"Cranny\" title=\"Cranny\" />"; +$palaceimg = "\"Palace\""; +$crannyimg = "\"Cranny\""; $info_spy = "".$spy_pic.",".$palaceimg." Residance/Palace Level : ".$rplevel."
".$crannyimg." Cranny level: ".$crannylevel."

Wall Level : ".$walllevel.""; @@ -2035,7 +2051,7 @@ $crannyimg = "img/g/g23.gif\" height=\"30\" w } unset($Attacker); unset($Defender); - unset($Enforce); + unset($enforce); unset($unitssend_att); unset($unitssend_def); unset($battlepart); @@ -2056,7 +2072,6 @@ $crannyimg = "img/g/g23.gif\" height=\"30\" w unset($herosend_def); unset($deadhero); unset($heroxp); - unset($dead11); unset($AttackerID); unset($DefenderID); unset($totalsend_alldef); @@ -2064,6 +2079,12 @@ $crannyimg = "img/g/g23.gif\" height=\"30\" w unset($totaldead_def); unset($unitsdead_att_check); unset($totalattackdead); + unset($Defender1); + unset($enforce1); + unset($defheroowner); + unset($enforceowner); + unset($defheroxp); + unset($reinfheroxp); } if(file_exists("GameEngine/Prevention/sendunits.txt")) { @unlink("GameEngine/Prevention/sendunits.txt"); diff --git a/GameEngine/Building.php b/GameEngine/Building.php index 9ab462b8..cb3ef8d7 100644 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -394,7 +394,7 @@ class Building { } private function meetRequirement($id) { - global $village,$database; + global $village,$session,$database; switch($id) { case 1: case 2: @@ -493,8 +493,20 @@ class Building { if($this->getTypeLevel(15) >= 10 && $village->capital == 0) { return true; } else { return false; } break; case 40: - $wwbuildingplan = count($database->getOwnArtefactInfoByType2($village->wid,11)); - if($village->natar == 1 && $wwbuildingplan > 0) { return true; } else { return false; } + $wwlevel = $village->resarray['f'.$id]; + if($wwlevel > 50){ + $needed_plan = 1; + }else{ + $needed_plan = 0; + } + $wwvillages = $database->getVillagesID($session->uid); + foreach($wwvillages as $wwvillage){ + $plan = count($database->getOwnArtefactInfoByType2($wwvillage,11)); + if($plan > 0){ + $wwbuildingplan += 1; + } + } + if($village->natar == 1 && $wwbuildingplan > $needed_plan) { return true; } else { return false; } break; case 41: if($this->getTypeLevel(16) >= 10 && $this->getTypeLevel(20) == 20) { return true; } else { return false; } @@ -626,7 +638,7 @@ class Building { return false; } - private function finishAll() { + public function finishAll() { global $database,$session,$logging,$village,$bid18,$bid10,$bid11,$technology,$_SESSION; if($session->access!=BANNED){ foreach($this->buildArray as $jobs) { @@ -638,11 +650,10 @@ class Building { if($jobs['type'] != 25 AND $jobs['type'] != 26 AND $jobs['type'] != 40) { $finish = 1; $resource = $this->resourceRequired($jobs['field'],$jobs['type']); - $q = "UPDATE ".TB_PREFIX."fdata set f".$jobs['field']." = f".$jobs['field']." + 1, f".$jobs['field']."t = ".$jobs['type']." where vref = ".$jobs['wid']; + $q = "UPDATE ".TB_PREFIX."fdata set f".$jobs['field']." = ".$jobs['level'].", f".$jobs['field']."t = ".$jobs['type']." where vref = ".$jobs['wid']; if($database->query($q)) { $database->modifyPop($jobs['wid'],$resource['pop'],0); $database->addCP($jobs['wid'],$resource['cp']); - $database->finishDemolition($village->wid); $q = "DELETE FROM ".TB_PREFIX."bdata where id = ".$jobs['id']; $database->query($q); if($jobs['type'] == 18) { @@ -650,41 +661,14 @@ class Building { $max = $bid18[$level]['attri']; $q = "UPDATE ".TB_PREFIX."alidata set max = $max where leader = $owner"; $database->query($q); - } - if($jobs['type'] == 10) { - $max=$database->getVillageField($jobs['wid'],"maxstore"); - if($level=='0' && $this->getTypeLevel(10) != 20){ $max-=STORAGE_BASE; } - $max-=$bid10[$level]['attri']*STORAGE_MULTIPLIER; - $max+=$bid10[$level+1]['attri']*STORAGE_MULTIPLIER; - $database->setVillageField($jobs['wid'],"maxstore",$max); - } - if($jobs['type'] == 11) { - $max=$database->getVillageField($jobs['wid'],"maxcrop"); - if($level=='0' && $this->getTypeLevel(11) != 20){ $max-=STORAGE_BASE; } - $max-=$bid11[$level]['attri']*STORAGE_MULTIPLIER; - $max+=$bid11[$level+1]['attri']*STORAGE_MULTIPLIER; - $database->setVillageField($jobs['wid'],"maxcrop",$max); - } - if($jobs['type'] == 38) { - $max=$database->getVillageField($jobs['wid'],"maxstore"); - if($level=='0' && $this->getTypeLevel(38) != 20){ $max-=STORAGE_BASE; } - $max-=$bid38[$level]['attri']*STORAGE_MULTIPLIER; - $max+=$bid38[$level+1]['attri']*STORAGE_MULTIPLIER; - $database->setVillageField($jobs['wid'],"maxstore",$max); - } - if($jobs['type'] == 39) { - $max=$database->getVillageField($jobs['wid'],"maxcrop"); - if($level=='0' && $this->getTypeLevel(39) != 20){ $max-=STORAGE_BASE; } - $max-=$bid39[$level]['attri']*STORAGE_MULTIPLIER; - $max+=$bid39[$level+1]['attri']*STORAGE_MULTIPLIER; - $database->setVillageField($jobs['wid'],"maxcrop",$max); - } + } } if(($jobs['field'] >= 19 && ($session->tribe == 1 || ALLOW_ALL_TRIBE)) || (!ALLOW_ALL_TRIBE && $session->tribe != 1)) { $innertimestamp = $jobs['timestamp']; } } } } } + $database->finishDemolition($village->wid); $technology->finishTech(); $logging->goldFinLog($village->wid); $database->modifyGold($session->uid,2,0); diff --git a/GameEngine/Technology.php b/GameEngine/Technology.php index 81c7c4d9..a5b657c3 100644 --- a/GameEngine/Technology.php +++ b/GameEngine/Technology.php @@ -459,7 +459,7 @@ private function trainUnit($unit,$amt,$great=false) { foreach($trainlist as $train) { $train_amt += $train['amt']; } - $max = $bid36[$village->resarray['f'.$id]]['attri'] - ($village->unitarray['u99'] + $train_amt); + $max = $bid36[$building->getTypeLevel(36)]['attri'] - ($village->unitarray['u99'] + $train_amt); if($max < $amt) { $amt = 0; } diff --git a/Templates/Build/15_1.tpl b/Templates/Build/15_1.tpl index cdf83882..0ff19492 100644 --- a/Templates/Build/15_1.tpl +++ b/Templates/Build/15_1.tpl @@ -31,6 +31,9 @@ if($village->resarray['f'.$id] >= DEMOLISH_LEVEL_REQ) { echo ""; echo "cancel "; echo "Demolition of ".$building->procResType($VillageResourceLevels['f'.$Demolition['buildnumber'].'t']).": ".$generator->getTimeFormat($Demolition['timetofinish']-time()).""; + ?> + Finish all construction and research orders in this village immediately for 2 Gold? + "; } else { echo " diff --git a/Templates/Build/36.tpl b/Templates/Build/36.tpl index 0978b73d..ffe9e82e 100644 --- a/Templates/Build/36.tpl +++ b/Templates/Build/36.tpl @@ -86,7 +86,7 @@ include("next.tpl"); -

+

Training can commence when trapper are completed.

\n"; diff --git a/Templates/Build/37_train.tpl b/Templates/Build/37_train.tpl index ad917768..2051188e 100644 --- a/Templates/Build/37_train.tpl +++ b/Templates/Build/37_train.tpl @@ -573,12 +573,10 @@ $output.=" mysql_query("UPDATE " . TB_PREFIX . "vdata SET `clay` = `clay` - ".$u6['clay']." WHERE `wref` = '" . $village->wid . "'"); mysql_query("UPDATE " . TB_PREFIX . "vdata SET `iron` = `wood` - ".$u6['iron']." WHERE `wref` = '" . $village->wid . "'"); mysql_query("UPDATE " . TB_PREFIX . "vdata SET `crop` = `wood` - ".$u6['crop']." WHERE `wref` = '" . $village->wid . "'"); - header("Location: build.php?id=".$id.""); - }else{ - header("Location: banned.php"); + } - } - } + } + } if($session->tribe == 2){ if($_GET['train'] == 11){ if($session->access != BANNED){ @@ -590,7 +588,10 @@ $output.=" mysql_query("UPDATE " . TB_PREFIX . "vdata SET `clay` = `clay` - ".$u11['clay']." WHERE `wref` = '" . $village->wid . "'"); mysql_query("UPDATE " . TB_PREFIX . "vdata SET `iron` = `wood` - ".$u11['iron']." WHERE `wref` = '" . $village->wid . "'"); mysql_query("UPDATE " . TB_PREFIX . "vdata SET `crop` = `wood` - ".$u11['crop']." WHERE `wref` = '" . $village->wid . "'"); - header("Location: build.php?id=".$id.""); + header("Location: build.php?id=".$id.""); + }else{ + header("Location: banned.php"); + } } if($_GET['train'] == 12){ if($session->access != BANNED){ @@ -730,7 +731,7 @@ $output.=" } } } - } + diff --git a/Templates/Build/avaliable.tpl b/Templates/Build/avaliable.tpl index c356ec06..876a79cd 100644 --- a/Templates/Build/avaliable.tpl +++ b/Templates/Build/avaliable.tpl @@ -44,7 +44,13 @@ $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)); +$wwvillages = $database->getVillagesID($session->uid); +foreach($wwvillages as $wwvillage){ +$plan = count($database->getOwnArtefactInfoByType2($wwvillage,11)); +if($plan > 0){ +$wwbuildingplan += 1; +} +} foreach ($database->getJobs($_SESSION['wid']) as $bdata) { $UnderConstruction = strtolower(str_replace(array(" ","'"),"",$building->procResType($bdata['type']))); diff --git a/Templates/Build/wwupgrade.tpl b/Templates/Build/wwupgrade.tpl index 8a2a3269..6db23940 100644 --- a/Templates/Build/wwupgrade.tpl +++ b/Templates/Build/wwupgrade.tpl @@ -2,25 +2,25 @@ $bid = $village->resarray['f'.$id.'t']; $bindicate = $building->canBuild($id,$bid); $wwlevel = $village->resarray['f'.$id]; -if($wwlevel > 49){ +if($wwlevel > 50){ $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)); +$villages = $database->getVillagesID($users['id']); +foreach($villages as $village1){ +$plan = count($database->getOwnArtefactInfoByType2($village1,11)); if($plan > 0){ $wwbuildingplan += 1; } } } -} -if($wwbuildingplan == $needed_plan){ + +if($wwbuildingplan > $needed_plan){ if($bindicate == 1) { echo "

Building already at max level

"; } else if($bindicate == 10) { @@ -149,8 +149,12 @@ if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1) { echo ". (waiting loop) "; } } + }else{ + if($needed_plan == 0){ + echo "Need WW construction plan."; }else{ echo "Need more WW construction plan."; } + } ?> diff --git a/Templates/Ranking/alliance.tpl b/Templates/Ranking/alliance.tpl index 7b0500b1..f48e3bcd 100644 --- a/Templates/Ranking/alliance.tpl +++ b/Templates/Ranking/alliance.tpl @@ -1,6 +1,8 @@ The alliance ".$_SESSION['search']." does not exist.

"; +?> +

The alliance "" does not exist.

+The alliance ".$_SESSION['search']." does not exist.

"; +?> +

The alliance "" does not exist.

+The alliance ".$_SESSION['search']." does not exist.

"; +?> +

The alliance "" does not exist.

+ | | Copyright: TravianX Project All rights reserved | \** --------------------------------------------------- **/ - - if(!is_numeric($_SESSION['search'])) { - echo "

The user " . $_SESSION['search'] . " does not exist or has no hero.

"; - $search = 0; - } else { + if(!is_numeric($_SESSION['search'])) { + ?> +

The user "" does not exist or has no hero.

+ The user ".$_SESSION['search']." does not exist.

"; +?> +

The user "" does not exist.

+The user ".$_SESSION['search']." does not exist.

"; +?> +

The user "" does not exist.

+The user ".$_SESSION['search']." does not exist.

"; +?> +

The user "" does not exist.

+The user ".$_SESSION['search']." does not exist.

"; +?> +

The user "" does not exist.

+The user ".$_SESSION['search']." does not exist.

"; + +

The user "" does not exist.

+The user ".$_SESSION['search']." does not exist.

"; +?> +

The user "" does not exist.

+The village ".$_SESSION['search']." does not exist.

"; +?> +

The village "" does not exist.

+ 0 ORDER BY ".TB_PREFIX."fdata.f99 Desc "); + WHERE ".TB_PREFIX."fdata.f99t = 40 ORDER BY ".TB_PREFIX."fdata.f99 Desc "); ?> diff --git a/build.php b/build.php index 88d36e94..1056b76b 100644 --- a/build.php +++ b/build.php @@ -17,6 +17,12 @@ if(isset($_GET['newdid'])) { $_SESSION['wid'] = $_GET['newdid']; header("Location: ".$_SERVER['PHP_SELF'].(isset($_GET['id'])?'?id='.$_GET['id']:(isset($_GET['gid'])?'?gid='.$_GET['gid']:''))); } +if(isset($_GET['buildingFinish'])) { + if($session->gold >= 2) { + $building->finishAll(); + header("Location: build.php?gid=15"); + } +} $start = $generator->pageLoadTimeStart(); $alliance->procAlliForm($_POST); $technology->procTech($_POST);