From 1215e1c42fe3d9ea466c1ba12f0542a6d70e6f08 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 15 May 2012 23:23:19 +0300 Subject: [PATCH] more big update --- GameEngine/Admin/Mods/natarbuildingplan.php | 2 +- GameEngine/Admin/Mods/natarend.php | 4 +- GameEngine/Automation.php | 96 +++++++----- GameEngine/Building.php | 18 ++- GameEngine/Database/db_MYSQL.php | 83 +++++++++-- GameEngine/Market.php | 2 +- GameEngine/Message.php | 34 ----- GameEngine/Village.php | 4 +- Templates/Build/1.tpl | 5 +- Templates/Build/10.tpl | 5 +- Templates/Build/11.tpl | 5 +- Templates/Build/14.tpl | 5 +- Templates/Build/15.tpl | 5 +- Templates/Build/15_1.tpl | 8 + Templates/Build/17_3.tpl | 4 +- Templates/Build/2.tpl | 5 +- Templates/Build/22_1.tpl_bk | 145 ------------------- Templates/Build/23.tpl | 9 +- Templates/Build/28.tpl | 5 +- Templates/Build/3.tpl | 5 +- Templates/Build/31.tpl | 5 +- Templates/Build/32.tpl | 5 +- Templates/Build/33.tpl | 5 +- Templates/Build/34.tpl | 5 +- Templates/Build/35.tpl | 5 +- Templates/Build/36.tpl | 5 +- Templates/Build/38.tpl | 5 +- Templates/Build/39.tpl | 5 +- Templates/Build/4.tpl | 5 +- Templates/Build/40.tpl | 106 -------------- Templates/Build/5.tpl | 5 +- Templates/Build/6.tpl | 5 +- Templates/Build/7.tpl | 5 +- Templates/Build/8.tpl | 5 +- Templates/Build/9.tpl | 5 +- Templates/Build/avaliable.tpl | 9 +- Templates/Build/avaliable/availupgrade.tpl | 36 +++++ Templates/Build/avaliable/ww.tpl | 16 ++ Templates/Build/avaliable/wwavailupgrade.tpl | 84 +++++++++++ Templates/Build/next.tpl | 5 + Templates/Build/upgrade.tpl | 76 +++++++++- Templates/Build/ww.tpl | 71 +-------- Templates/Building.tpl | 8 +- Templates/Ranking/ww.tpl | 6 +- Templates/dorf2.tpl | 6 +- Templates/multivillage.tpl | 8 + dorf1.php | 9 ++ dorf2.php | 9 ++ install/data/sql.sql | 4 +- winner.php | 4 +- 50 files changed, 478 insertions(+), 498 deletions(-) delete mode 100644 Templates/Build/22_1.tpl_bk delete mode 100644 Templates/Build/40.tpl create mode 100644 Templates/Build/avaliable/ww.tpl create mode 100644 Templates/Build/avaliable/wwavailupgrade.tpl create mode 100644 Templates/Build/next.tpl diff --git a/GameEngine/Admin/Mods/natarbuildingplan.php b/GameEngine/Admin/Mods/natarbuildingplan.php index 74e972c2..056be321 100644 --- a/GameEngine/Admin/Mods/natarbuildingplan.php +++ b/GameEngine/Admin/Mods/natarbuildingplan.php @@ -39,5 +39,5 @@ for($i=1;$i<=$amt;$i++) { mysql_query("Insert into ".TB_PREFIX."admin_log values (0,$id,'Added $amt WW Buildingplan Villages',".time().")"); -header("Location: ../../../admin.php?p=natarbuildingplan&g"); +header("Location: ../../../Admin/admin.php?p=natarbuildingplan&g"); ?> \ No newline at end of file diff --git a/GameEngine/Admin/Mods/natarend.php b/GameEngine/Admin/Mods/natarend.php index 6b00e942..fed5ce6c 100644 --- a/GameEngine/Admin/Mods/natarend.php +++ b/GameEngine/Admin/Mods/natarend.php @@ -24,7 +24,7 @@ for($i=1;$i<=$amt;$i++) { $wid = $database->generateBase($kid); $database->setFieldTaken($wid); $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`) 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,1314968914)"; + $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')"; mysql_query($q); @@ -39,5 +39,5 @@ for($i=1;$i<=$amt;$i++) { mysql_query("Insert into ".TB_PREFIX."admin_log values (0,$id,'Added $amt WW Villages',".time().")"); -header("Location: ../../../admin.php?p=natarend&g"); +header("Location: ../../../Admin/admin.php?p=natarend&g"); ?> \ No newline at end of file diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index ddbfa2f1..7375d6e2 100644 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -19,42 +19,13 @@ class Automation { private $bountyOpop = 1; public function isWinner() { - for ($i = 1; $i <= 40; $i++) { - $q = mysql_query("SELECT vref FROM ".TB_PREFIX."fdata WHERE f99 = '100' and f99t = '40' or f".$i." = '100' and f".$i."t = '40'"); + $q = mysql_query("SELECT vref FROM ".TB_PREFIX."fdata WHERE f99 = '100' and f99t = '40'"); $isThere = mysql_num_rows($q); if($isThere > 0) { header('Location: /winner.php'); }else{ ## there is no winner - } - } - } - - 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]); - } - } - } - - private function checkWWLevel() { - global $database; - $q = mysql_query("SELECT * FROM ".TB_PREFIX."fdata WHERE wwlevel != 0"); - $ww = mysql_fetch_array($q); - for ($i = 1; $i <= 40; $i++) { - if(mysql_num_rows($q) > 0){ - if($ww['f99t'] != 40 && $ww['f'.$i.'t'] != 40){ - $database->setVillageLevel($ww['vref'], "wwlevel", 0); - } - } } } @@ -147,6 +118,7 @@ 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(); } @@ -193,8 +165,6 @@ class Automation { $this->demolitionComplete(); } $this->updateStore(); - $this->getWWRankInfo(); - $this->checkWWLevel(); } function activeCropDead(){ @@ -548,10 +518,10 @@ private function loyaltyRegeneration() { global $database,$bid18,$bid10,$bid11,$bid38,$bid39; $time = time(); $array = array(); - $q = "SELECT * FROM ".TB_PREFIX."bdata where timestamp < $time"; + $q = "SELECT * FROM ".TB_PREFIX."bdata where timestamp < $time and master = 0"; $array = $database->query_return($q); foreach($array as $indi) { - $q = "UPDATE ".TB_PREFIX."fdata set f".$indi['field']." = f".$indi['field']." + 1, f".$indi['field']."t = ".$indi['type']." where vref = ".$indi['wid']; + $q = "UPDATE ".TB_PREFIX."fdata set f".$indi['field']." = ".$indi['level'].", f".$indi['field']."t = ".$indi['type']." where vref = ".$indi['wid']; if($database->query($q)) { $level = $database->getFieldLevel($indi['wid'],$indi['field']); $pop = $this->getPop($indi['type'],($level-1)); @@ -1894,8 +1864,6 @@ ${dead.$i}=$data['t'.$i]; $database->setVillageLevel($data['to'],"f40",0); $database->setVillageLevel($data['to'],"f40t",0); $database->clearExpansionSlot($data['to']); - //kill a chief - $database->modifyAttack($data['ref'],9,1); $exp1 = $database->getVillageField($data['from'],'exp1'); @@ -2923,6 +2891,62 @@ private function demolitionComplete() { $database->updateOasis($getoasis['wref']); } } + + private function MasterBuilder() { + global $database; + $q = "SELECT * FROM ".TB_PREFIX."bdata WHERE master = 1"; + $array = $database->query_return($q); + foreach($array as $master) { + $villwood = $database->getVillageField($master['wid'],'wood'); + $villclay = $database->getVillageField($master['wid'],'clay'); + $villiron = $database->getVillageField($master['wid'],'iron'); + $villcrop = $database->getVillageField($master['wid'],'crop'); + $type = $master['type']; + $level = $master['level']; + $buildarray = $GLOBALS["bid".$type]; + $buildwood = $buildarray[$level]['wood']; + $buildclay = $buildarray[$level]['clay']; + $buildiron = $buildarray[$level]['iron']; + $buildcrop = $buildarray[$level]['crop']; + $ww = count($database->getBuildingByType($master['wid'],40)); + if($master['field'] < 19){ + $bdata = count($database->getDorf1Building($master['wid'])); + $bbdata = count($database->getDorf2Building($master['wid'])); + $bdata1 = $database->getDorf1Building($master['wid']); + }else{ + $bdata = count($database->getDorf2Building($master['wid'])); + $bbdata = count($database->getDorf1Building($master['wid'])); + $bdata1 = $database->getDorf2Building($master['wid']); + } + $owner = $database->getVillageField($master['wid'],'owner'); + if($database->getUserField($owner,'plus',0) > time() or $ww > 0){ + if($bbdata < 2){ + $inbuild = 2; + }else{ + $inbuild = 1; + } + }else{ + $inbuild = 1; + } + if($bdata < $inbuild && $buildwood < $villwood && $buildclay < $villclay && $buildiron < $villiron && $buildcrop < $villcrop){ + $time = $master['timestamp']+time(); + if(!empty($bdata1)){ + foreach($bdata1 as $master1) { + $time += ($master1['timestamp']-time()); + } + } + if($bdata == 0){ + $database->updateBuildingWithMaster($master['id'],$time,0); + }else{ + $database->updateBuildingWithMaster($master['id'],$time,1); + } + $usergold = $database->getUserField($owner,'gold',0); + $gold = $usergold; + $database->updateUserField($owner,'gold',$gold,1); + $database->modifyResource($master['wid'],$buildwood,$buildclay,$buildiron,$buildcrop,0); + } + } + } } $automation = new Automation; diff --git a/GameEngine/Building.php b/GameEngine/Building.php index 84110735..99c7e92e 100644 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -260,7 +260,9 @@ class Building { if($jobs['id'] == $d) { $uprequire = $this->resourceRequired($jobs['field'],$jobs['type']); if($database->removeBuilding($d)) { + if($jobs['master'] == 0){ $database->modifyResource($village->wid,$uprequire['wood'],$uprequire['clay'],$uprequire['iron'],$uprequire['crop'],1); + } if($jobs['field'] >= 19) { header("Location: dorf2.php"); } @@ -307,7 +309,8 @@ class Building { $time = $this->buildArray[0]['timestamp'] + $uprequire['time']; } } - if($database->addBuilding($village->wid,$id,$village->resarray['f'.$id.'t'],$loop,$time+($loop==1?ceil(60/SPEED):0))) { + $level = $database->getResourceLevel($village->wid); + if($database->addBuilding($village->wid,$id,$village->resarray['f'.$id.'t'],$loop,$time+($loop==1?ceil(60/SPEED):0),0,$level['f'.$id] + 1 + count($database->getBuildingByField($village->wid,$id)))) { $database->modifyResource($village->wid,$uprequire['wood'],$uprequire['clay'],$uprequire['iron'],$uprequire['crop'],0); $logging->addBuildLog($village->wid,$this->procResType($village->resarray['f'.$id.'t']),($village->resarray['f'.$id]+($loopsame>0?2:1)),0); if($id >= 19) { @@ -347,7 +350,8 @@ class Building { $time = $this->buildArray[0]['timestamp'] + round($dataarray[$village->resarray['f'.$id]-1]['time'] / 4); } } - if($database->addBuilding($village->wid,$id,$village->resarray['f'.$id.'t'],$loop,$time,0)) { + $level = $database->getResourceLevel($village->wid); + if($database->addBuilding($village->wid,$id,$village->resarray['f'.$id.'t'],$loop,$time,0,0,$level['f'.$id] + 1 + count($database->getBuildingByField($village->wid,$id)))) { $logging->addBuildLog($village->wid,$this->procResType($village->resarray['f'.$id.'t']),($village->resarray['f'.$id]-1),2); header("Location: dorf2.php"); } @@ -377,7 +381,8 @@ class Building { } } if($this->meetRequirement($tid)) { - if($database->addBuilding($village->wid,$id,$tid,$loop,$time)) { + $level = $database->getResourceLevel($village->wid); + if($database->addBuilding($village->wid,$id,$tid,$loop,$time,0,$level['f'.$id] + 1 + count($database->getBuildingByField($village->wid,$id)))) { $logging->addBuildLog($village->wid,$this->procResType($tid),($village->resarray['f'.$id]+1),1); $database->modifyResource($village->wid,$uprequire['wood'],$uprequire['clay'],$uprequire['iron'],$uprequire['crop'],0); header("Location: dorf2.php"); @@ -486,7 +491,8 @@ class Building { if($this->getTypeLevel(15) >= 10 && $village->capital == 0) { return true; } else { return false; } break; case 40: - return false; //not implemented + //need to check if have ww buildplan too + if($village->natar == 1) { return true; } else { return false; } break; case 41: if($this->getTypeLevel(16) >= 10 && $this->getTypeLevel(20) == 20) { return true; } else { return false; } @@ -625,8 +631,8 @@ class Building { foreach($this->buildArray as $jobs) { if($jobs['wid']==$village->wid){ $wwvillage = $database->getResourceLevel($jobs['wid']); - 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']); + if($wwvillage['f99t']!=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) { $gold=$database->getUserField($_SESSION['username'],'gold','username'); diff --git a/GameEngine/Database/db_MYSQL.php b/GameEngine/Database/db_MYSQL.php index c5a62857..4ebccae5 100644 --- a/GameEngine/Database/db_MYSQL.php +++ b/GameEngine/Database/db_MYSQL.php @@ -1498,7 +1498,8 @@ function getDelArchive($uid) { $q = "SELECT * FROM " . TB_PREFIX . "mdata WHERE target = $uid and archived = 1 and deltarget = 1 OR owner = $uid and archived = 1 and delowner = 1 ORDER BY time DESC"; - return mysql_query($q, $this->connection); + $result = mysql_query($q, $this->connection); + return $this->mysql_fetch_all($result); } function unarchiveNotice($id) { @@ -1548,10 +1549,10 @@ return $dbarray[$field]; } - function addBuilding($wid, $field, $type, $loop, $time) { + function addBuilding($wid, $field, $type, $loop, $time, $master, $level) { $x = "UPDATE " . TB_PREFIX . "fdata SET f" . $field . "t=" . $type . " WHERE vref=" . $wid; mysql_query($x, $this->connection) or die(mysql_error()); - $q = "INSERT into " . TB_PREFIX . "bdata values (0,$wid,$field,$type,$loop,$time)"; + $q = "INSERT into " . TB_PREFIX . "bdata values (0,$wid,$field,$type,$loop,$time,$master,$level)"; return mysql_query($q, $this->connection); } @@ -1567,6 +1568,9 @@ if($jobs[$i]['loopcon'] == 1) { $jobLoopconID = $i; } + if($jobs[$i]['master'] == 1) { + $jobMaster = $i; + } } if(count($jobs) > 1 && ($jobs[0]['field'] == $jobs[1]['field'])) { $SameBuildCount = 1; @@ -1577,10 +1581,26 @@ if(count($jobs) > 2 && ($jobs[1]['field'] == $jobs[2]['field'])) { $SameBuildCount = 3; } + if(count($jobs) > 2 && ($jobs[0]['field'] == ($jobs[1]['field'] == $jobs[2]['field']))) { + $SameBuildCount = 4; + } if($SameBuildCount > 0) { - if($d == $jobs[floor($SameBuildCount / 3)]['id'] || $d == $jobs[floor($SameBuildCount / 2) + 1]['id']) { - $q = "UPDATE " . TB_PREFIX . "bdata SET loopcon=0,timestamp=" . $jobs[floor($SameBuildCount / 3)]['timestamp'] . " WHERE ID=" . $jobs[floor($SameBuildCount / 3)]['id'] . " OR ID=" . $jobs[floor($SameBuildCount / 2) + 1]['id']; + if($SameBuildCount == 4){ + if($jobDeleted == 0){ + $uprequire = $building->resourceRequired($jobs[1]['field'],$jobs[1]['type'],1); + $time = $uprequire['time']; + $timestamp = $time+time(); + $q = "UPDATE " . TB_PREFIX . "bdata SET loopcon=0,level=level-1,timestamp=".$timestamp." WHERE id=".$jobs[1]['id'].""; + mysql_query($q, $this->connection); + } + $uprequire1 = $building->resourceRequired($jobs[$jobMaster]['field'],$jobs[$jobMaster]['type'],2); + $time1 = $uprequire1['time']; + $timestamp1 = $time1; + $q1 = "UPDATE " . TB_PREFIX . "bdata SET level=level-1,timestamp=".$timestamp1." WHERE id=".$jobs[$jobMaster]['id'].""; + mysql_query($q1, $this->connection); + }else if($d == $jobs[floor($SameBuildCount / 3)]['id'] || $d == $jobs[floor($SameBuildCount / 2) + 1]['id']) { + $q = "UPDATE " . TB_PREFIX . "bdata SET loopcon=0,level=level-1,timestamp=" . $jobs[floor($SameBuildCount / 3)]['timestamp'] . " WHERE master = 0 AND id > ".$d." and (ID=" . $jobs[floor($SameBuildCount / 3)]['id'] . " OR ID=" . $jobs[floor($SameBuildCount / 2) + 1]['id'] . ")"; mysql_query($q, $this->connection); } } else { @@ -1596,7 +1616,7 @@ if(($jobLoopconID >= 0) && ($jobs[$jobDeleted]['loopcon'] != 1)) { if(($jobs[$jobLoopconID]['field'] <= 18 && $jobs[$jobDeleted]['field'] <= 18) || ($jobs[$jobLoopconID]['field'] >= 19 && $jobs[$jobDeleted]['field'] >= 19)) { $uprequire = $building->resourceRequired($jobs[$jobLoopconID]['field'], $jobs[$jobLoopconID]['type']); - $x = "UPDATE " . TB_PREFIX . "bdata SET loopcon=0,timestamp=" . (time() + $uprequire['time']) . " WHERE wid=" . $jobs[$jobDeleted]['wid'] . " AND loopcon=1"; + $x = "UPDATE " . TB_PREFIX . "bdata SET loopcon=0,timestamp=" . (time() + $uprequire['time']) . " WHERE wid=" . $jobs[$jobDeleted]['wid'] . " AND loopcon=1 AND master=0"; mysql_query($x, $this->connection) or die(mysql_error()); } } @@ -1640,10 +1660,51 @@ } function getJobs($wid) { - $q = "SELECT * FROM " . TB_PREFIX . "bdata where wid = $wid order by timestamp ASC"; + $q = "SELECT * FROM " . TB_PREFIX . "bdata where wid = $wid order by master,timestamp ASC"; $result = mysql_query($q, $this->connection); return $this->mysql_fetch_all($result); } + + function getMasterJobs($wid) { + $q = "SELECT * FROM " . TB_PREFIX . "bdata where wid = $wid and master = 1 order by master,timestamp ASC"; + $result = mysql_query($q, $this->connection); + return $this->mysql_fetch_all($result); + } + + function getMasterJobsByField($wid,$field) { + $q = "SELECT * FROM " . TB_PREFIX . "bdata where wid = $wid and field = $field and master = 1 order by master,timestamp ASC"; + $result = mysql_query($q, $this->connection); + return $this->mysql_fetch_all($result); + } + + function getBuildingByField($wid,$field) { + $q = "SELECT * FROM " . TB_PREFIX . "bdata where wid = $wid and field = $field and master = 0"; + $result = mysql_query($q, $this->connection); + return $this->mysql_fetch_all($result); + } + + function getBuildingByType($wid,$type) { + $q = "SELECT * FROM " . TB_PREFIX . "bdata where wid = $wid and type = $type and master = 0"; + $result = mysql_query($q, $this->connection); + return $this->mysql_fetch_all($result); + } + + function getDorf1Building($wid) { + $q = "SELECT * FROM " . TB_PREFIX . "bdata where wid = $wid and field < 19 and master = 0"; + $result = mysql_query($q, $this->connection); + return $this->mysql_fetch_all($result); + } + + function getDorf2Building($wid) { + $q = "SELECT * FROM " . TB_PREFIX . "bdata where wid = $wid and field > 18 and master = 0"; + $result = mysql_query($q, $this->connection); + return $this->mysql_fetch_all($result); + } + + function updateBuildingWithMaster($id, $time,$loop) { + $q = "UPDATE " . TB_PREFIX . "bdata SET master = 0, timestamp = ".$time.",loopcon = ".$loop." WHERE id = ".$id.""; + return mysql_query($q, $this->connection); + } function getVillageByName($name) { $q = "SELECT wref FROM " . TB_PREFIX . "vdata where name = '$name' limit 1"; @@ -2175,15 +2236,13 @@ ***************************/ function getWW() { - for($i=1; $i<=40; $i++) { - $q = "SELECT * FROM " . TB_PREFIX . "fdata WHERE f99t = 40 or f".$i."t = 40"; + $q = "SELECT * FROM " . TB_PREFIX . "fdata WHERE f99t = 40"; $result = mysql_query($q, $this->connection); if(mysql_num_rows($result)) { return true; } else { return false; } - } } /*************************** @@ -2192,10 +2251,10 @@ ***************************/ function getWWLevel($vref) { - $q = "SELECT wwlevel FROM " . TB_PREFIX . "fdata WHERE vref = $vref"; + $q = "SELECT f99 FROM " . TB_PREFIX . "fdata WHERE vref = $vref"; $result = mysql_query($q, $this->connection) or die(mysql_error()); $dbarray = mysql_fetch_array($result); - return $dbarray['wwlevel']; + return $dbarray['f99']; } /*************************** diff --git a/GameEngine/Market.php b/GameEngine/Market.php index c4a9beb7..826ee7ab 100644 --- a/GameEngine/Market.php +++ b/GameEngine/Market.php @@ -243,7 +243,7 @@ class Market { private function tradeResource($post) { global $session,$database,$village; $wwvillage = $database->getResourceLevel($village->wid); - 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){ + if($wwvillage['f99t']!=40){ if($session->userinfo['gold'] >= 3) { //kijken of ze niet meer gs invoeren dan ze hebben if($session->access == BANNED){ diff --git a/GameEngine/Message.php b/GameEngine/Message.php index f2a97a30..e3010a25 100644 --- a/GameEngine/Message.php +++ b/GameEngine/Message.php @@ -33,52 +33,31 @@ } public function procMessage($post) { - global $session; if(isset($post['ft'])) { switch($post['ft']) { case "m1": - if($session->access!=BANNED){ $this->quoteMessage($post['id']); - }else{ - header("Location: banned.php"); - } break; case "m2": - if($session->access!=BANNED or $post['an']==strtolower("multihunter")){ if ($post['an'] == "[ally]"){ $this->sendAMessage($post['an'],$post['be'],$post['message']); }else{ $this->sendMessage($post['an'],$post['be'],$post['message']); } header("Location: nachrichten.php?t=2"); - }else{ - header("Location: banned.php"); - } break; case "m3": case "m4": case "m5": if(isset($post['delmsg_x'])) { - if($session->access!=BANNED){ $this->removeMessage($post); $this->header($get); - }else{ - header("Location: banned.php"); - } } if(isset($post['archive_x'])) { - if($session->access!=BANNED){ $this->archiveMessage($post); - }else{ - header("Location: banned.php"); - } } if(isset($post['start_x'])) { - if($session->access!=BANNED){ $this->unarchiveMessage($post); - }else{ - header("Location: banned.php"); - } } break; case "m6": @@ -120,27 +99,14 @@ } public function procNotice($post) { - global $session; if(isset($post["del_x"])) { - if($session->access != BANNED){ $this->removeNotice($post); - }else{ - header("Location: banned.php"); - } } if(isset($post['archive_x'])) { - if($session->access != BANNED){ $this->archiveNotice($post); - }else{ - header("Location: banned.php"); - } } if(isset($post['start_x'])) { - if($session->access != BANNED){ $this->unarchiveNotice($post); - }else{ - header("Location: banned.php"); - } } } diff --git a/GameEngine/Village.php b/GameEngine/Village.php index 5674548c..5cbd1b1b 100644 --- a/GameEngine/Village.php +++ b/GameEngine/Village.php @@ -19,7 +19,7 @@ class Village { public $type; public $coor = array(); public $awood,$aclay,$airon,$acrop,$pop,$maxstore,$maxcrop; - public $wid,$vname,$capital; + public $wid,$vname,$capital,$natar,$master; public $resarray = array(); public $unitarray,$techarray,$unitall,$researching,$abarray = array(); private $infoarray = array(); @@ -72,6 +72,7 @@ class Village { $this->researching = $database->getResearching($this->wid); $this->capital = $this->infoarray['capital']; + $this->natar = $this->infoarray['natar']; $this->currentcel = $this->infoarray['celebration']; $this->wid = $this->infoarray['wref']; $this->vname = $this->infoarray['name']; @@ -84,6 +85,7 @@ class Village { $this->maxcrop = $this->infoarray['maxcrop']; $this->allcrop = $this->getCropProd(); $this->loyalty = $this->infoarray['loyalty']; + $this->master = count($database->getMasterJobs($this->wid)); //de gs in town, zetten op max pakhuisinhoud if($this->awood>$this->maxstore){ $this->awood=$this->maxstore; $database->updateResource($this->wid,'wood',$this->maxstore); } if($this->aclay>$this->maxstore){ $this->aclay=$this->maxstore; $database->updateResource($this->wid,'clay',$this->maxstore); } diff --git a/Templates/Build/1.tpl b/Templates/Build/1.tpl index bea337f0..535619a7 100644 --- a/Templates/Build/1.tpl +++ b/Templates/Build/1.tpl @@ -1,6 +1,5 @@ isCurrent($id) || $building->isLoop($id))?1:0; - $doublebuild = ($building->isCurrent($id) && $building->isLoop($id))?1:0; +include("next.tpl"); ?>
AcademyAction
-
- \"".$technology-getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" /> - ".$technology->getUnitName($i)." -
-
\"Lumber\"".${'r'.$i}['wood']."|\"Clay\"".${'r'.$i}['clay']."|\"Iron\"".${'r'.$i}['iron']."|\"Crop\"".${'r'.$i}['crop']."|\"duration\""; - echo $generator->getTimeFormat(round(${'r'.$i}['time'] * ($bid22[$village->resarray['f'.$id]]['attri'] / 100)/SPEED)); - if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) > 1) { - echo "|\"NPC"; - } - if(${'r'.$i}['wood'] > $village->maxstore || ${'r'.$i}['clay'] > $village->maxstore || ${'r'.$i}['iron'] > $village->maxstore) { - echo "
Expand warehouse
-
Expand
warehouse
-
-
Expand
granary
-
-
Too few
resources
-
- mchecker."\">Research
- Research
There are no researches avaliable

show more

- - "; - if(!$technology->meetRRequirement(2) && !$technology->getTech(2)) { - echo""; - } - if(!$technology->meetRRequirement(3) && !$technology->getTech(3)) { - echo""; - } - if(!$technology->meetRRequirement(4) && !$technology->getTech(4)) { - echo ""; - } - if(!$technology->meetRRequirement(5) && !$technology->getTech(5)) { - echo ""; - } - if(!$technology->meetRRequirement(6) && !$technology->getTech(6)) { - echo ""; - } - if(!$technology->meetRRequirement(7) && !$technology->getTech(7)) { - echo " - "; - } - if(!$technology->meetRRequirement(8) && !$technology->getTech(8)) { - echo " - "; - } - if(!$technology->meetRRequirement(9) && !$technology->getTech(9)) { - echo " "; - } - echo ""; - echo "
Prerequisites
Academy - Level 1
Armoury Level 1
Academy - Level 5
Blacksmith Level 1
- AcademyLevel 5
StableLevel 1
- AcademyLevel 5
StableLevel 5
- AcademyLevel 15
- StableLevel 10
Academy - Level 10
WorkshopLevel 1
Workshop - Level 10
AcademyLevel 15
- Rally PointLevel 10
- AcademyLevel 20
"; -} -$acares = $technology->grabAcademyRes(); -if(count($acares) > 0) { - echo " - "; - $timer = 1; - foreach($acares as $aca) { - $unit = substr($aca['tech'],1,2); - echo ""; - echo ""; - $date = $generator->procMtime($aca['timestamp']); - echo ""; - echo ""; - $timer +=1; - } - echo "
ResearchingDurationComplete
\"".$technology-getUnitName($unit)."\" title=\"".$technology->getUnitName($unit)."\" />".$technology->getUnitName($unit)."".$generator->getTimeFormat($aca['timestamp']-time())."".$date[1]." hrs
"; -} -?> diff --git a/Templates/Build/23.tpl b/Templates/Build/23.tpl index 002767f7..e4fd43da 100644 --- a/Templates/Build/23.tpl +++ b/Templates/Build/23.tpl @@ -1,6 +1,5 @@ isCurrent($id) || $building->isLoop($id))?1:0; - $doublebuild = ($building->isCurrent($id) && $building->isLoop($id))?1:0; +include("next.tpl"); ?>
-

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/Build/5.tpl b/Templates/Build/5.tpl index 471cf7e1..05882142 100644 --- a/Templates/Build/5.tpl +++ b/Templates/Build/5.tpl @@ -1,6 +1,5 @@ isCurrent($id) || $building->isLoop($id))?1:0; - $doublebuild = ($building->isCurrent($id) && $building->isLoop($id))?1:0; +include("next.tpl"); ?>
Constructing with master builder "; + echo '(costs: Gold1)'; + }else{ + echo "Constructing with master builder"; + echo '(costs: Gold1)'; + } + } } else if($bindicator == 3) { echo "The workers are already at work. (waiting loop)"; + if($session->goldclub){ +?>
+gold >= 1 && $village->master == 0){ + echo "Constructing with master builder "; + echo '(costs: Gold1)'; + }else{ + echo "Constructing with master builder"; + echo '(costs: Gold1)'; + } + } } else if($bindicator == 4) { echo "Not enough food. Expand cropland."; @@ -32,6 +57,17 @@ $uprequire = $building->resourceRequired($id,$bid); else if($bindicator == 7) { $neededtime = $building->calculateAvaliable($id,$bid); echo "Enough resources ".$neededtime[0]." at ".$neededtime[1].""; + if($session->goldclub){ +?>
+gold >= 1 && $village->master == 0){ + echo "Constructing with master builder "; + echo '(costs: Gold1)'; + }else{ + echo "Constructing with master builder"; + echo '(costs: Gold1)'; + } + } } else if($bindicator == 8) { if($session->access!=BANNED){ diff --git a/Templates/Build/avaliable/ww.tpl b/Templates/Build/avaliable/ww.tpl new file mode 100644 index 00000000..3b7002ff --- /dev/null +++ b/Templates/Build/avaliable/ww.tpl @@ -0,0 +1,16 @@ +

Wonder Of The World

+ + + + + + + + +
The wonder of the world represents the pride of creation. Only the mightiest and richest are able to build such a masterwork and defend it against envious enemies. + + Wonder Of The World +
\ No newline at end of file diff --git a/Templates/Build/avaliable/wwavailupgrade.tpl b/Templates/Build/avaliable/wwavailupgrade.tpl new file mode 100644 index 00000000..ff325574 --- /dev/null +++ b/Templates/Build/avaliable/wwavailupgrade.tpl @@ -0,0 +1,84 @@ +canBuild(99,$bid); +$uprequire = $building->resourceRequired(99,$bid); +?> + + 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."; + if($session->goldclub){ +?>
+gold >= 1){ + echo "Constructing with master builder "; + echo '(costs: Gold1)'; + }else{ + echo "Constructing with master builder"; + echo '(costs: Gold1)'; + } + } + } + else if($bindicator == 3) { + echo "The workers are already at work. (waiting loop)"; + if($session->goldclub){ +?>
+gold >= 1){ + echo "Constructing with master builder "; + echo '(costs: Gold1)'; + }else{ + echo "Constructing with master builder"; + echo '(costs: Gold1)'; + } + } + } + else if($bindicator == 4) { + echo "Not enough food. Expand cropland."; + } + else if($bindicator == 5) { + echo "Upgrade Warehouse."; + } + else if($bindicator == 6) { + echo "Upgrade Granary."; + } + else if($bindicator == 7) { + $neededtime = $building->calculateAvaliable(99,$bid); + echo "Enough resources ".$neededtime[0]." at ".$neededtime[1].""; + if($session->goldclub){ +?>
+gold >= 1){ + echo "Constructing with master builder "; + echo '(costs: Gold1)'; + }else{ + echo "Constructing with master builder"; + echo '(costs: Gold1)'; + } + } + } + else if($bindicator == 8) { + if($session->access!=BANNED){ + echo "checker."\">Construct building."; + }else{ + echo "Construct building."; + } + } + else if($bindicator == 9) { + if($session->access!=BANNED){ + echo "checker."\">Construct building. (waiting loop)"; + }else{ + echo "checker."\">Construct building. (waiting loop)"; + } + } + ?> + \ No newline at end of file diff --git a/Templates/Build/next.tpl b/Templates/Build/next.tpl new file mode 100644 index 00000000..487ffea5 --- /dev/null +++ b/Templates/Build/next.tpl @@ -0,0 +1,5 @@ +isCurrent($id) || $building->isLoop($id))?1:0; + $doublebuild = ($building->isCurrent($id) && $building->isLoop($id))?1:0; + $master = count($database->getMasterJobsByField($village->wid,$id)); +?> \ No newline at end of file diff --git a/Templates/Build/upgrade.tpl b/Templates/Build/upgrade.tpl index 7ae6489d..6911756f 100644 --- a/Templates/Build/upgrade.tpl +++ b/Templates/Build/upgrade.tpl @@ -1,5 +1,6 @@ canBuild($id,$village->resarray['f'.$id.'t']); +$bid = $village->resarray['f'.$id.'t']; +$bindicate = $building->canBuild($id,$bid); if($bindicate == 1) { echo "

Building already at max level

"; } else if($bindicate == 10) { @@ -9,9 +10,11 @@ if($bindicate == 1) { } else { $loopsame = ($building->isCurrent($id) || $building->isLoop($id))?1:0; $doublebuild = ($building->isCurrent($id) && $building->isLoop($id))?1:0; - $uprequire = $building->resourceRequired($id,$village->resarray['f'.$id.'t'],($loopsame > 0 ? 2:1)+$doublebuild); + $master = count($database->getMasterJobsByField($village->wid,$id)); + $uprequire = $building->resourceRequired($id,$village->resarray['f'.$id.'t'],1+$loopsame+$doublebuild+$master); + $mastertime = $uprequire['time']; ?> -

Costs for upgrading to level resarray['f'.$id]+($loopsame > 0 ? 2:1)+$doublebuild; ?>:
+

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"; @@ -19,9 +22,51 @@ if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1) { The workers are already at work."; + if($session->goldclub){ +?>
+gold >= 1 && $village->master == 0){ + echo "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 "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){ +?>
+gold >= 1 && $village->master == 0){ + echo "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 "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."; @@ -33,8 +78,29 @@ if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1) { echo "Upgrade Granary."; } else if($bindicate == 7) { - $neededtime = $building->calculateAvaliable($id,$village->resarray['f'.$id.'t'],($loopsame > 0 ? 2:1)); + $neededtime = $building->calculateAvaliable($id,$village->resarray['f'.$id.'t'],1+$loopsame+$doublebuild+$master); echo "Enough resources ".$neededtime[0]." at ".$neededtime[1].""; + if($session->goldclub){ +?>
+gold >= 1 && $village->master == 0){ + echo "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 "Constructing with master builder "; + echo '(costs: Gold1)'; + }else{ + echo "Constructing with master builder"; + echo '(costs: Gold1)'; + } + } + } } else if($bindicate == 8) { if($session->access==BANNED){ @@ -48,7 +114,7 @@ if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1) { } echo $village->resarray['f'.$id]+1; echo "."; - } + } else if($bindicate == 9) { if($session->access==BANNED){ echo "Upgrade to level "; diff --git a/Templates/Build/ww.tpl b/Templates/Build/ww.tpl index 3bd4bda4..0f088f3f 100644 --- a/Templates/Build/ww.tpl +++ b/Templates/Build/ww.tpl @@ -15,9 +15,9 @@ ?>

-

Wonder of the World
Level resarray['f99'];?>

+

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.

@@ -25,12 +25,12 @@ $vref = $_SESSION['wid']; $wwname = $database->getWWName($vref); -if($village->resarray['f99'] < 0){ +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['f99'] > 0 and $village->resarray['f99'] < 11) { +} else if($village->resarray['f'.$id] > 0 and $village->resarray['f'.$id] < 11) { echo '

World Wonder name:

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

World Wonder name:

'; }?> @@ -42,65 +42,6 @@ echo 'You can not change the name of the World Wonder after level 10. ?> canBuild($id,$village->resarray['f99t']); -if($village->resarray['f99'] == 100) { - echo "

Building already at max level

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

Costs for upgrading to level resarray['f99']+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['f99']); - 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['f99']+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['f99']+1+$loopsame+$doublebuild; - echo ". (waiting loop) "; - } -} - +include("upgrade.tpl"); ?>

\ No newline at end of file diff --git a/Templates/Building.tpl b/Templates/Building.tpl index 6e6a322e..08ceded9 100644 --- a/Templates/Building.tpl +++ b/Templates/Building.tpl @@ -34,9 +34,10 @@ } $BuildingList = array(); foreach($building->buildArray as $jobs) { + if($jobs['master'] == 0){ echo "checker\">"; echo "\"cancel\""; - echo $building->procResType($jobs['type'])." (Level ".($village->resarray['f'.$jobs['field']]+(in_array($jobs['field'],$BuildingList)?2:1 )).")"; + echo $building->procResType($jobs['type'])." (Level ".$jobs['level'].")"; if($jobs['loopcon'] == 0) { $BuildingList[] = $jobs['field']; } if($jobs['loopcon'] == 1) { echo " (waiting loop)"; @@ -46,6 +47,11 @@ echo " hrs."; echo "done at ".date('H:i', $jobs['timestamp']).""; $timer +=1; + }else{ + echo "checker\">"; + echo "\"cancel\""; + echo $building->procResType($jobs['type'])." (Level ".$jobs['level'].")"; + } } ?> diff --git a/Templates/Ranking/ww.tpl b/Templates/Ranking/ww.tpl index 59613631..22d1c429 100644 --- a/Templates/Ranking/ww.tpl +++ b/Templates/Ranking/ww.tpl @@ -1,10 +1,10 @@ 0 ORDER BY ".TB_PREFIX."fdata.wwlevel Desc "); + WHERE ".TB_PREFIX."fdata.f99 > 0 ORDER BY ".TB_PREFIX."fdata.f99 Desc "); ?> @@ -43,7 +43,7 @@ - + diff --git a/Templates/dorf2.tpl b/Templates/dorf2.tpl index a465d9a9..c9c17ed9 100644 --- a/Templates/dorf2.tpl +++ b/Templates/dorf2.tpl @@ -25,7 +25,10 @@ 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<=40;$t++) { +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 { if($village->resarray['f'.$t.'t'] != 0) { $title = $building->procResType($village->resarray['f'.$t.'t']). " Level ".$village->resarray['f'.$t]; } @@ -37,6 +40,7 @@ else { } echo ""; } +} ?> diff --git a/Templates/multivillage.tpl b/Templates/multivillage.tpl index f63cae61..fcf64e92 100644 --- a/Templates/multivillage.tpl +++ b/Templates/multivillage.tpl @@ -100,6 +100,14 @@ else if(isset($_GET['vill']) && isset($_GET['id'])) { '; + } +} +else if(isset($_GET['t']) && isset($_GET['id'])) { + for($i=1;$i<=count($session->villages);++$i){echo' + + + + '; }}else{ for($i=1;$i<=count($session->villages);++$i){echo' diff --git a/dorf1.php b/dorf1.php index 1bdead59..d41d759b 100644 --- a/dorf1.php +++ b/dorf1.php @@ -20,6 +20,15 @@ if(isset($_GET['newdid'])) { }else{ $building->procBuild($_GET); } +if(isset($_GET['master']) && isset($_GET['id']) && isset($_GET['time']) && $session->gold >= 1 && $session->goldclub) { +if($session->access!=BANNED){ +$level = $database->getResourceLevel($village->wid); +$database->addBuilding($village->wid, $_GET['id'], $_GET['master'], 1, $_GET['time'], 1, $level['f'.$_GET['id']] + 1 + count($database->getBuildingByField($village->wid,$_GET['id']))); +header("Location: ".$_SERVER['PHP_SELF']); +}else{ +header("Location: banned.php"); +} +} ?> diff --git a/dorf2.php b/dorf2.php index 6da4bdbd..5db5894c 100644 --- a/dorf2.php +++ b/dorf2.php @@ -17,6 +17,15 @@ if(isset($_GET['newdid'])) { }else{ $building->procBuild($_GET); } +if(isset($_GET['master']) && isset($_GET['id']) && isset($_GET['time']) && $session->gold >= 1 && $session->goldclub) { +if($session->access!=BANNED){ +$level = $database->getResourceLevel($village->wid); +$database->addBuilding($village->wid, $_GET['id'], $_GET['master'], 1, $_GET['time'], 1, $level['f'.$_GET['id']] + 1 + count($database->getBuildingByField($village->wid,$_GET['id']))); +header("Location: ".$_SERVER['PHP_SELF']); +}else{ +header("Location: banned.php"); +} +} ?> diff --git a/install/data/sql.sql b/install/data/sql.sql index 011a2e78..52a5523c 100644 --- a/install/data/sql.sql +++ b/install/data/sql.sql @@ -370,6 +370,8 @@ CREATE TABLE IF NOT EXISTS `%PREFIX%bdata` ( `type` tinyint(2) unsigned NOT NULL, `loopcon` tinyint(1) unsigned NOT NULL, `timestamp` int(10) unsigned NOT NULL, + `master` tinyint(1) unsigned NOT NULL, + `level` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; @@ -650,7 +652,6 @@ 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; @@ -1338,6 +1339,7 @@ CREATE TABLE IF NOT EXISTS `%PREFIX%vdata` ( `exp2` int(10) NOT NULL, `exp3` int(10) NOT NULL, `created` int(11) NOT NULL, +`natar` tinyint(1) unsigned NOT NULL, PRIMARY KEY (`wref`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; diff --git a/winner.php b/winner.php index 366fcbbc..1c154d74 100644 --- a/winner.php +++ b/winner.php @@ -109,7 +109,7 @@ $q = " } ## Get WW Winner Details - $sql = mysql_query("SELECT vref FROM ".TB_PREFIX."fdata WHERE f99 = '100' and f99t = '40' OR f1 = '100' and f1t = '40' OR f2 = '100' and f2t = '40' OR f3 = '100' and f3t = '40' OR f4 = '100' and f4t = '40' OR f5 = '100' and f5t = '40' OR f6 = '100' and f6t = '40' OR f7 = '100' and f7t = '40' OR f8 = '100' and f8t = '40' OR f9 = '100' and f9t = '40' OR f10 = '100' and f10t = '40' OR f11 = '100' and f11t = '40' OR f12 = '100' and f12t = '40' OR f13 = '100' and f13t = '40' OR f14 = '100' and f14t = '40' OR f15 = '100' and f15t = '40' OR f16 = '100' and f16t = '40' OR f17 = '100' and f17t = '40' OR f18 = '100' and f18t = '40' OR f19 = '100' and f19t = '40' OR f20 = '100' and f20t = '40' OR f21 = '100' and f21t = '40' OR f22 = '100' and f22t = '40' OR f23 = '100' and f23t = '40' OR f24 = '100' and f24t = '40' OR f25 = '100' and f25t = '40' OR f26 = '100' and f26t = '40' OR f27 = '100' and f27t = '40' OR f28 = '100' and f28t = '40' OR f29 = '100' and f29t = '40' OR f30 = '100' and f30t = '40' OR f31 = '100' and f31t = '40' OR f32 = '100' and f32t = '40' OR f33 = '100' and f33t = '40' OR f34 = '100' and f34t = '40' OR f35 = '100' and f35t = '40' OR f36 = '100' and f36t = '40' OR f37 = '100' and f37t = '40' OR f38 = '100' and f38t = '40' OR f39 = '100' and f39t = '40' OR f40 = '100' and f40t = '40'")or die(mysql_error()); + $sql = mysql_query("SELECT vref FROM ".TB_PREFIX."fdata WHERE f99 = '100' and f99t = '40'"); $vref = mysql_result($sql, 0); $sql = mysql_query("SELECT name FROM ".TB_PREFIX."vdata WHERE wref = '$vref'")or die(mysql_error()); @@ -130,7 +130,7 @@ $q = " $sql = mysql_query("SELECT tag FROM ".TB_PREFIX."alidata WHERE id = '$allianceid'")or die(mysql_error()); $winningalliancetag = mysql_result($sql, 0); - $sql = mysql_query("SELECT vref FROM ".TB_PREFIX."fdata WHERE f99 = '100' and f99t = '40' OR f1 = '100' and f1t = '40' OR f2 = '100' and f2t = '40' OR f3 = '100' and f3t = '40' OR f4 = '100' and f4t = '40' OR f5 = '100' and f5t = '40' OR f6 = '100' and f6t = '40' OR f7 = '100' and f7t = '40' OR f8 = '100' and f8t = '40' OR f9 = '100' and f9t = '40' OR f10 = '100' and f10t = '40' OR f11 = '100' and f11t = '40' OR f12 = '100' and f12t = '40' OR f13 = '100' and f13t = '40' OR f14 = '100' and f14t = '40' OR f15 = '100' and f15t = '40' OR f16 = '100' and f16t = '40' OR f17 = '100' and f17t = '40' OR f18 = '100' and f18t = '40' OR f19 = '100' and f19t = '40' OR f20 = '100' and f20t = '40' OR f21 = '100' and f21t = '40' OR f22 = '100' and f22t = '40' OR f23 = '100' and f23t = '40' OR f24 = '100' and f24t = '40' OR f25 = '100' and f25t = '40' OR f26 = '100' and f26t = '40' OR f27 = '100' and f27t = '40' OR f28 = '100' and f28t = '40' OR f29 = '100' and f29t = '40' OR f30 = '100' and f30t = '40' OR f31 = '100' and f31t = '40' OR f32 = '100' and f32t = '40' OR f33 = '100' and f33t = '40' OR f34 = '100' and f34t = '40' OR f35 = '100' and f35t = '40' OR f36 = '100' and f36t = '40' OR f37 = '100' and f37t = '40' OR f38 = '100' and f38t = '40' OR f39 = '100' and f39t = '40' OR f40 = '100' and f40t = '40'")or die(mysql_error()); + $sql = mysql_query("SELECT vref FROM ".TB_PREFIX."fdata WHERE f99 = '100' and f99t = '40'"); $winner = mysql_num_rows($sql); if($winner!=0){
('.$returnVillageArray[$i-1]['x'].'
|
'.$returnVillageArray[$i-1]['y'].')
('.$returnVillageArray[$i-1]['x'].'
|
'.$returnVillageArray[$i-1]['y'].')