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"); ?>
@@ -14,7 +13,7 @@
isMax($village->resarray['f'.$id.'t'],$id)) {
- $next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild;
+ $next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master;
if($village->capital == 1) {
if($next<=20){
?>
diff --git a/Templates/Build/10.tpl b/Templates/Build/10.tpl
index ad028bc5..0fbe756f 100644
--- a/Templates/Build/10.tpl
+++ b/Templates/Build/10.tpl
@@ -1,6 +1,5 @@
isCurrent($id) || $building->isLoop($id))?1:0;
- $doublebuild = ($building->isCurrent($id) && $building->isLoop($id))?1:0;
+include("next.tpl");
?>
@@ -17,7 +16,7 @@
@@ -18,7 +17,7 @@
@@ -17,7 +16,7 @@
@@ -17,7 +16,7 @@