diff --git a/GameEngine/Admin/database.php b/GameEngine/Admin/database.php index 2c1919be..8c123eeb 100755 --- a/GameEngine/Admin/database.php +++ b/GameEngine/Admin/database.php @@ -296,6 +296,12 @@ class adm_DB { } $dbarray = mysqli_fetch_array($result); + + if ( !$dbarray ) { + mysqli_query($this->connection,"Insert into ".TB_PREFIX."admin_log values (0,'X','IP: ".$_SERVER['REMOTE_ADDR']." tried to log in with username $username but access was denied!',".time().")"); + return false; + } + // even if we didn't do a DB conversion for bcrypt passwords, // we still need to check if this password wasn't encrypted via password_hash, diff --git a/GameEngine/Admin/function.php b/GameEngine/Admin/function.php index 385629d1..d67461df 100755 --- a/GameEngine/Admin/function.php +++ b/GameEngine/Admin/function.php @@ -17,9 +17,9 @@ // # Source code: https://github.com/Shadowss/TravianZ ## // # ## // ################################################################################ -include_once("../GameEngine/Artifacts.php"); -include_once("../GameEngine/Units.php"); -include_once("../GameEngine/Generator.php"); +include_once(__DIR__ . "/../Artifacts.php"); +include_once(__DIR__ . "/../Units.php"); +include_once(__DIR__ . "/../Generator.php"); class funct { diff --git a/GameEngine/Artifacts.php b/GameEngine/Artifacts.php index 035119ab..c005d218 100644 --- a/GameEngine/Artifacts.php +++ b/GameEngine/Artifacts.php @@ -453,62 +453,70 @@ class Artifacts $activationTime = 86400 / (SPEED == 2 ? 1.5 : (SPEED == 3 ? 2 : SPEED)); $time = time(); $nextEffect = "-"; - - if($artifact['size'] == 1 && $artifact['type'] != 11){ + + if ( is_array($artifact) ) { + if($artifact['size'] == 1 && $artifact['type'] != 11){ $requiredLevel = 10; $effectInfluence = VILLAGE; - }else{ + }else{ $requiredLevel = $artifact['type'] != 11 ? 20 : 10; $effectInfluence = ACCOUNT; - } - - if($artifact['owner'] == 3) $active = "-"; - elseif(!$artifact['active'] && $artifact['conquered'] < $time - $activationTime) $active = "Can't be activated"; - elseif (!$artifact['active']) $active = date("d.m.Y H:i:s", $artifact['conquered'] + $activationTime); - else - { + } + + if($artifact['owner'] == 3) $active = "-"; + elseif(!$artifact['active'] && $artifact['conquered'] < $time - $activationTime) $active = "Can't be activated"; + elseif (!$artifact['active']) $active = date("d.m.Y H:i:s", $artifact['conquered'] + $activationTime); + else + { $active = "".ACTIVE.""; $nextEffect = date("d.m.Y H:i:s", $artifact['lastupdate'] + (86400 / (SPEED == 2 ? 1.5 : (SPEED == 3 ? 2 : SPEED)))); - } - - //// Added by brainiac - thank you - if ($artifact['type'] == 8) - { + } + + //// Added by brainiac - thank you + if ($artifact['type'] == 8) + { $kind = $artifact['kind']; $effect = $artifact['effect2']; - }else{ + }else{ $kind = $artifact['type']; $effect = $artifact['effect']; - } - - $artifactBadEffect = $artifact['type'] == 8 && $artifact['bad_effect'] == 1; - switch($kind){ + } + + $artifactBadEffect = $artifact['type'] == 8 && $artifact['bad_effect'] == 1; + switch($kind){ case 1: - $betterorbadder = $artifactBadEffect ? BUILDING_WEAKER : BUILDING_STRONGER; - break; + $betterorbadder = $artifactBadEffect ? BUILDING_WEAKER : BUILDING_STRONGER; + break; case 2: - $betterorbadder = $artifactBadEffect ? TROOPS_SLOWEST : TROOPS_FASTER; - break; + $betterorbadder = $artifactBadEffect ? TROOPS_SLOWEST : TROOPS_FASTER; + break; case 3: - $betterorbadder = $artifactBadEffect ? SPIES_DECRESE : SPIES_INCREASE; - break; + $betterorbadder = $artifactBadEffect ? SPIES_DECRESE : SPIES_INCREASE; + break; case 4: - $betterorbadder = $artifactBadEffect ? CONSUME_HIGH : CONSUME_LESS; - break; + $betterorbadder = $artifactBadEffect ? CONSUME_HIGH : CONSUME_LESS; + break; case 5: - $betterorbadder = $artifactBadEffect ? TROOPS_MAKE_SLOWEST : TROOPS_MAKE_FASTER; - break; + $betterorbadder = $artifactBadEffect ? TROOPS_MAKE_SLOWEST : TROOPS_MAKE_FASTER; + break; case 6: - $betterorbadder = $artifactBadEffect ? YOU_CONSTRUCT : YOU_CONSTRUCT; - break; + $betterorbadder = $artifactBadEffect ? YOU_CONSTRUCT : YOU_CONSTRUCT; + break; case 7: - $betterorbadder = $artifactBadEffect ? CRANNY_DECRESE : CRANNY_INCREASED; - break; + $betterorbadder = $artifactBadEffect ? CRANNY_DECRESE : CRANNY_INCREASED; + break; case 8: - $betterorbadder = $artifactBadEffect ? SPIES_INCREASE : SPIES_DECRESE; - break; + $betterorbadder = $artifactBadEffect ? SPIES_INCREASE : SPIES_DECRESE; + break; + } + $bonus = isset($betterorbadder) ? $betterorbadder." (".str_replace(["(", ")"], "" , $effect).")" : (($kind == 11 && $artifact['active']) ? "".WW_BUILDING_PLAN."" : "Not yet active"); + } else { + $requiredLevel = 0; + $active = 0; + $bonus = 0; + $effectInfluence = 0; + $nextEffect = 0; } - $bonus = isset($betterorbadder) ? $betterorbadder." (".str_replace(["(", ")"], "" , $effect).")" : (($kind == 11 && $artifact['active']) ? "".WW_BUILDING_PLAN."" : "Not yet active"); return ["requiredLevel" => $requiredLevel, "active" => $active, "bonus" => $bonus, "effectInfluence" => $effectInfluence, diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 9f591bd7..53c07126 100644 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -16,6 +16,27 @@ ## ## ################################################################################# +// make sure we only run the automation script once and wait until it's done, +// so concurrent AJAX calls from many different users won't overload the server +if ( !defined('AUTOMATION_MANUAL_RUN') ) { + if ( file_exists( AUTOMATION_LOCK_FILE_NAME ) ) { + // check that the file is not too old, in which case our PHP script hung + // and we need to remove the lock and run automation again + $fileTime = filemtime( AUTOMATION_LOCK_FILE_NAME ); + + // allow for 60 seconds of old automation script processing time, which is still way too plenty + if ( ! $fileTime || time() - $fileTime > 60 ) { + @unlink( AUTOMATION_LOCK_FILE_NAME ); + } else { + // automation file exists and is valid, don't run another automation + exit; + } + } else { + // create automation lock file + file_put_contents( AUTOMATION_LOCK_FILE_NAME, '' ); + } +} + include_once("Database.php"); include_once("Data/buidata.php"); include_once("Data/unitdata.php"); @@ -721,15 +742,17 @@ class Automation { $database->setVillageLevel($data['to'], $fieldsToSet, $fieldValuesToSet); $buildarray = $GLOBALS["bid".$tbgid]; - - // (great) warehouse level was changed - if ($tbgid == 10 || $tbgid == 38) { - $database->setMaxStoreForVillage($data['to'], $buildarray[$newLevel]['attri']); - } - - // (great) granary level was changed - if ($tbgid == 11 || $tbgid == 39) { - $database->setMaxCropForVillage($data['to'], $buildarray[$newLevel]['attri']); + + if ( isset( $buildarray[$newLevel] ) ) { + // (great) warehouse level was changed + if ($tbgid == 10 || $tbgid == 38) { + $database->setMaxStoreForVillage($data['to'], $buildarray[$newLevel]['attri']); + } + + // (great) granary level was changed + if ($tbgid == 11 || $tbgid == 39) { + $database->setMaxCropForVillage($data['to'], $buildarray[$newLevel]['attri']); + } } // oasis cannot be destroyed @@ -1191,6 +1214,9 @@ class Automation { if(empty($scout) || $NatarCapital){ for ($i = 1; $i <= 11; $i++){ if (!isset(${'traped'.$i})) ${'traped'.$i} = 0; + if ( !isset($totaltraped_att) ) { + $totaltraped_att = 0; + } $totaltraped_att += ${'traped'.$i}; } @@ -1733,6 +1759,9 @@ class Automation { for($i = 1; $i <= 10; $i++){ $unitarray = $GLOBALS["u".(($att_tribe - 1) * 10 + $i)]; + if ( !isset($totalpoint_def) ) { + $totalpoint_def = 0; + } $totalpoint_def += (${'dead'.$i}*$unitarray['pop']); } @@ -3765,6 +3794,9 @@ class Automation { if($maxtype > 0){ $starvingTroops[$utype.$maxtype]--; + if ( !isset($killedUnits[$maxtype]) ) { + $killedUnits[$maxtype] = 0; + } $killedUnits[$maxtype]++; $difcrop -= $GLOBALS['u'.(($special) ? $maxtype + ($tribe - 1) * 10 : $maxtype)]['crop']; } @@ -4612,4 +4644,7 @@ class Automation { } } $automation = new Automation; + +// remove automation lock file +@unlink( AUTOMATION_LOCK_FILE_NAME ); ?> diff --git a/GameEngine/Building.php b/GameEngine/Building.php index ad386b21..f745d153 100755 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -258,50 +258,51 @@ class Building { return false; } - public static function procResType($ref) { + public static function procResType($ref) { switch($ref) { - case 1: return "Woodcutter"; - case 2: return "Clay Pit"; - case 3: return "Iron Mine"; - case 4: return "Cropland"; - case 5: return "Sawmill"; - case 6: return "Brickyard"; - case 7: return "Iron Foundry"; - case 8: return "Grain Mill"; - case 9: return "Bakery"; - case 10: return "Warehouse"; - case 11: return "Granary"; - case 12: return "Blacksmith"; - case 13: return "Armoury"; - case 14: return "Tournament Square"; - case 15: return "Main Building"; - case 16: return "Rally Point"; - case 17: return "Marketplace"; - case 18: return "Embassy"; - case 19: return "Barracks"; - case 20: return "Stable"; - case 21: return "Workshop"; - case 22: return "Academy"; - case 23: return "Cranny"; - case 24: return "Town Hall"; - case 25: return "Residence"; - case 26: return "Palace"; - case 27: return "Treasury"; - case 28: return "Trade Office"; - case 29: return "Great Barracks"; - case 30: return "Great Stable"; - case 31: return "City Wall"; - case 32: return "Earth Wall"; - case 33: return "Palisade"; - case 34: return "Stonemason's Lodge"; - case 35: return "Brewery"; - case 36: return "Trapper"; - case 37: return "Hero's Mansion"; - case 38: return "Great Warehouse"; - case 39: return "Great Granary"; - case 40: return "Wonder of the World"; - case 41: return "Horse Drinking Trough"; - case 42: return "Great Workshop"; + + case 1: return WOODCUTTER; + case 2: return CLAYPIT; + case 3: return IRONMINE; + case 4: return CROPLAND; + case 5: return SAWMILL; + case 6: return BRICKYARD; + case 7: return IRONFOUNDRY; + case 8: return GRAINMILL; + case 9: return BAKERY; + case 10: return WAREHOUSE; + case 11: return GRANARY; + case 12: return BLACKSMITH; + case 13: return ARMOURY; + case 14: return TOURNAMENTSQUARE; + case 15: return MAINBUILDING; + case 16: return RALLYPOINT; + case 17: return MARKETPLACE; + case 18: return EMBASSY; + case 19: return BARRACKS; + case 20: return STABLE; + case 21: return WORKSHOP; + case 22: return ACADEMY; + case 23: return CRANNY; + case 24: return TOWNHALL; + case 25: return RESIDENCE; + case 26: return PALACE; + case 27: return TREASURY; + case 28: return TRADEOFFICE; + case 29: return GREATBARRACKS; + case 30: return GREATSTABLE; + case 31: return CITYWALL; + case 32: return EARTHWALL; + case 33: return PALISADE; + case 34: return STONEMASON; + case 35: return BREWERY; + case 36: return TRAPPER; + case 37: return HEROSMANSION; + case 38: return GREATWAREHOUSE; + case 39: return GREATGRANARY; + case 40: return WONDER; + case 41: return HORSEDRINKING; + case 42: return GREATWORKSHOP; default: return "Error"; } } @@ -832,6 +833,11 @@ class Building { global $$name, $village, $bid15, $database; $dataarray = $$name; + + if ( !$$name ) { + return ["wood" => 0, "clay" => 0, "iron" => 0, "crop" => 0, "pop" => 0, "time" => 0, "cp" => 0]; + } + $wood = $dataarray[$village->resarray['f'.$id] + $plus]['wood']; $clay = $dataarray[$village->resarray['f'.$id] + $plus]['clay']; $iron = $dataarray[$village->resarray['f'.$id] + $plus]['iron']; diff --git a/GameEngine/Database.php b/GameEngine/Database.php index e244372e..a71ef4bb 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -1135,7 +1135,7 @@ class MYSQLi_DB implements IDbConnection { $q = "SELECT timestamp from " . TB_PREFIX . "deleting where uid = $uid LIMIT 1"; $result = mysqli_query($this->dblink,$q); $dbarray = mysqli_fetch_array($result); - return $dbarray['timestamp']; + return ( $dbarray ? $dbarray['timestamp'] : false ); } function modifyGold($userid, $amt, $mode) { @@ -3853,7 +3853,7 @@ class MYSQLi_DB implements IDbConnection { "); $row = mysqli_fetch_array($result, MYSQLI_ASSOC); - self::$fieldLevelsInVillageSearchCache[$vid.$fieldType] = $row['level']; + self::$fieldLevelsInVillageSearchCache[$vid.$fieldType] = ( $row ? $row['level'] : 0 ); return self::$fieldLevelsInVillageSearchCache[$vid.$fieldType]; } @@ -5257,12 +5257,13 @@ References: User ID/Message ID, Mode function modifyBData($wid, $field, $levels, $tribe){ list($wid, $field, $levels, $tribe) = $this->escape_input((int) $wid, (int) $field, (int) $levels, (int) $tribe); - if($levels[0] == 0){ + if ( is_array( $levels ) && $levels[0] == 0){ $q = "SELECT id FROM " .TB_PREFIX. "bdata WHERE wid = $wid AND field = $field"; $orders = $this->mysqli_fetch_all(mysqli_query($this->dblink, $q)); foreach($orders as $order) $this->removeBuilding($order['id'], $tribe, $wid); + } else { + mysqli_query( $this->dblink, $q = "UPDATE " . TB_PREFIX . "bdata SET level = level - $levels[1] + $levels[0] WHERE wid = $wid AND field = $field" ); } - else mysqli_query($this->dblink, $q = "UPDATE " .TB_PREFIX. "bdata SET level = level - $levels[1] + $levels[0] WHERE wid = $wid AND field = $field"); } private function getBData($wid, $use_cache = true, $orderByID = false) { @@ -6010,7 +6011,7 @@ References: User ID/Message ID, Mode */ function addUnits($vid, $troopsArray = null) { - list($vid, $type, $values) = $this->escape_input($vid, $type, $values); + list($vid) = $this->escape_input($vid); if (!is_array($vid)) $vid = [$vid]; $types = $values = ""; @@ -6118,12 +6119,22 @@ References: User ID/Message ID, Mode $end = ( $ownertribe * 10 ); for ( $i = $start; $i <= $end; $i ++ ) { + if ( $movingunits ) { $totalunits += $movingunits[ 'u' . $i ]; + } + + if ( $reinforcingunits ) { $totalunits += $reinforcingunits[ 'u' . $i ]; + } } - $totalunits += $movingunits['hero']; - $totalunits += $reinforcingunits['hero']; + if ( $movingunits ) { + $totalunits += $movingunits['hero']; + } + + if ( $reinforcingunits ) { + $totalunits += $reinforcingunits['hero']; + } return $totalunits; } @@ -6428,7 +6439,7 @@ References: User ID/Message ID, Mode //Fixed part of negative troops (double troops) - by InCube $array_amt[$i] = (int) $array_amt[$i] < 0 ? 0 : $array_amt[$i]; //Fixed part of negative troops (double troops) - by InCube - $units .= $unit.' = '.$unit.' '.(($array_mode[$i] == 1)? '+':'-').' '.($array_amt[$i] ? $array_amt[$i] : 0).(($number > $i+1) ? ', ' : ''); + $units .= $unit.' = '.$unit.' '.((isset($array_mode) && $array_mode[$i] == 1)? '+':'-').' '.( isset($array_amt[$i]) ? $array_amt[$i] : 0).(($number > $i+1) ? ', ' : ''); } $q = "UPDATE ".TB_PREFIX."units set $units WHERE vref = $vref"; return mysqli_query($this->dblink, $q); @@ -7164,22 +7175,16 @@ References: User ID/Message ID, Mode } } - $q = "SELECT (u10+u20+u30) FROM " . TB_PREFIX . "enforcement WHERE `from` = ".(int) $village->wid; + $q = "SELECT (u10+u20+u30) as sumsettlers FROM " . TB_PREFIX . "enforcement WHERE `from` = ".(int) $village->wid; $result = mysqli_query($this->dblink,$q); - $row = mysqli_fetch_row($result); - if(!empty($row)) { - foreach($row as $reinf) { - $settlers += $reinf[0]; - } + while($settlersrow = mysqli_fetch_array($result)) { + $settlers += $settlersrow["sumsettlers"]; } - $q = "SELECT (u9+u19+u29) FROM " . TB_PREFIX . "enforcement WHERE `from` = ".(int) $village->wid; + $q = "SELECT (u9+u19+u29) as sumchiefs FROM " . TB_PREFIX . "enforcement WHERE `from` = ".(int) $village->wid; $result = mysqli_query($this->dblink,$q); - $row = mysqli_fetch_row($result); - if(!empty($row)) { - foreach($row as $reinf) { - $chiefs += $reinf[0]; - } + while($chiefsrow = mysqli_fetch_array($result)) { + $chiefs += $chiefsrow["sumchiefs"]; } $trainlist = $technology->getTrainingList(4); @@ -7734,7 +7739,7 @@ References: User ID/Message ID, Mode $q = 'SELECT * FROM ' . TB_PREFIX . 'farmlist WHERE owner = '.$uid.' ORDER BY wref ASC LIMIT 1'; $result = mysqli_query($this->dblink,$q); $dbarray = mysqli_fetch_array($result); - return $dbarray['id'] > 0; + return ( $dbarray && $dbarray['id'] > 0 ); } // no need to cache this method @@ -7909,7 +7914,7 @@ References: User ID/Message ID, Mode $getVillage = $this->getVillage($wref); //Exlude Support, Nature, Natars, TaskMaster and Multihunter - if ($getVillage['owner'] > 5){ + if ($getVillage && $getVillage['owner'] > 5){ $crop = $this->getCropProdstarv($wref, false); $unitArrays = $technology->getAllUnits($wref, false, 0, false); $villageUpkeep = $getVillage['pop'] + $technology->getUpkeep($unitArrays, 0, $wref); diff --git a/GameEngine/Lang/en.php b/GameEngine/Lang/en.php index b162a603..33c94a4e 100755 --- a/GameEngine/Lang/en.php +++ b/GameEngine/Lang/en.php @@ -109,6 +109,7 @@ define("TRAVIAN_COPYRIGHT","TravianZ 100% Open Source Travian Clone."); //BUILD.TPL define("CUR_PROD","Current production"); define("NEXT_PROD","Production at level "); +define("CONSTRUCT_BUILD","Construct Building"); //BUILDINGS define("B1","Woodcutter"); @@ -143,6 +144,7 @@ define("LOYALTY","Loyalty"); define("CALCULATED_IN","Calculated in"); define("SEVER_TIME","Server time:"); define("HI","HI"); +define("P_IN","in"); //QUEST define("Q_CONTINUE","Continue with the next task."); @@ -594,6 +596,9 @@ define("BECOME_COMUNITY","Become part of our community now!"); define("BECOME_COMUNITY2","Become a part of one of
the biggest gaming
communities in the
world."); define("NEWS","News"); define("SCREENSHOTS","Screenshots"); +define("FAQ","FAQ"); +define("SPIELREGELN","Rules"); +define("AGB","Terms and Conditions"); define("LEARN1","Upgrade your fields and mines to increase your resource production. You will need resources to construct buildings and train soldiers."); define("LEARN2","Construct and expand the buildings in your village. Buildings improve your overall infrastructure, increase your resource production and allow you to research, train and upgrade your troops."); define("LEARN3","View and interact with your surroundings. You can make new friends or new enemies, make use of the nearby oases and observe as your empire grows and becomes stronger."); @@ -832,7 +837,7 @@ define("RALLYPOINT_COMMENCE","Troops movement will be displayed when the ".RALLY define("OVERVIEW","Overview"); define("REINFORCEMENT","Reinforcement"); define("EVASION_SETTINGS","evasion settings"); -define("SEND_TROOPS_AWAY_MAX","Send troops away a maximun of"); +define("SEND_TROOPS_AWAY_MAX","Send troops away a maximum of"); define("TIMES","times"); define("PER_EVASION","per evasion"); define("RALLYPOINT_DESC","Your village's troops meet here. From here you can send them out to conquer, raid or reinforce other villages."); diff --git a/GameEngine/Market.php b/GameEngine/Market.php index db084410..d53a4ca0 100755 --- a/GameEngine/Market.php +++ b/GameEngine/Market.php @@ -348,17 +348,31 @@ class Market $wwvillage = $database->getResourceLevel($village->wid); if($wwvillage['f99t'] != 40){ if($session->userinfo['gold'] >= 3){ + // check that we're not trying to sell more resources that we actually have + if ( + (int) $post['m2'][0] < 0 && round($village->awood) + (int) $post['m2'][0] < 0 + || + (int) $post['m2'][1] < 0 && round($village->aclay) + (int) $post['m2'][1] < 0 + || + (int) $post['m2'][2] < 0 && round($village->airon) + (int) $post['m2'][2] < 0 + || + (int) $post['m2'][3] < 0 && round($village->acrop) + (int) $post['m2'][3] < 0 + ) { + header("Location: build.php?id=".$post['id']."&t=3"); + exit; + } + //Check if there are too many resources - if(($post['m2'][0]+$post['m2'][1]+$post['m2'][2]+$post['m2'][3])<=(round($village->awood)+round($village->aclay)+round($village->airon)+round($village->acrop))){ + if ( ((int) $post['m2'][0] + (int) $post['m2'][1] + (int) $post['m2'][2] + (int) $post['m2'][3] ) <= ( round($village->awood) + round($village->aclay) + round($village->airon) + round($village->acrop) ) ) { $database->setVillageField( $village->wid, ["wood", "clay", "iron", "crop"], [$post['m2'][0], $post['m2'][1], $post['m2'][2], $post['m2'][3]] ); $database->modifyGold($session->uid, 3, 0); - header("Location: build.php?id=".$post['id']."&t=3&c");; + header("Location: build.php?id=".$post['id']."&t=3&c"); exit; - }else{ + } else { header("Location: build.php?id=".$post['id']."&t=3"); exit; } diff --git a/GameEngine/Village.php b/GameEngine/Village.php index e450f848..3b2634d9 100755 --- a/GameEngine/Village.php +++ b/GameEngine/Village.php @@ -152,7 +152,7 @@ class Village { global $technology, $database, $session; // clear cache, since we're updating village data - call_user_func(get_class($database).'::clearVillageCache'); + call_user_func(get_class($database).'::clearVillageCache'); $upkeep = $technology->getUpkeep($this->unitall, 0, $this->wid); $this->production['wood'] = $this->getWoodProd(); $this->production['clay'] = $this->getClayProd(); @@ -169,9 +169,6 @@ class Village { $niron = min(($this->production['iron'] / 3600) * $timepast, $this->maxstore); $ncrop = min(($this->production['crop'] / 3600) * $timepast, $this->maxcrop); - // clear cache, since we're updating village data - call_user_func(get_class($database).'::clearVillageCache'); - $database->modifyResource($this->wid, $nwood, $nclay, $niron, $ncrop, 1); $database->updateVillage($this->wid); $this->LoadTown(true); @@ -320,5 +317,18 @@ class Village { }; $village = new Village; $building = new Building; -//include_once("Automation.php"); + +// if automation is not currently running, run it for this user, +// so if they are waiting for some automation to take place +// (units, resources, buildings...), the script will calculate that +// before showing the page +// ... this is a quick fix for automation being called async by AJAX +// and users seeing old values on their page even though new values +// already exist after the initial AJAX call +if ( !file_exists( AUTOMATION_LOCK_FILE_NAME ) ) { + define( 'AUTOMATION_MANUAL_RUN', true ); + // this file is auto-removed by the Automation.php script + file_put_contents( AUTOMATION_LOCK_FILE_NAME, '' ); + include_once("Automation.php"); +} ?> diff --git a/README.md b/README.md index c888889c..8a9aedd3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![Code Triagers Badge](https://www.codetriage.com/shadowss/travianz/badges/users.svg)](https://www.codetriage.com/shadowss/travianz) -[![Maintenance](https://img.shields.io/maintenance/yes/2018.svg)](https://github.com/Shadowss/TravianZ) +[![Maintenance](https://img.shields.io/maintenance/yes/2022.svg)](https://github.com/Shadowss/TravianZ) [![GitHub Release](https://img.shields.io/github/release/Shadowss/TravianZ/all.svg)](https://github.com/Shadowss/TravianZ) [![Github All Releases](https://img.shields.io/github/downloads/Shadowss/TravianZ/total.svg)](https://github.com/Shadowss/TravianZ) [![GitHub contributors](https://img.shields.io/github/contributors/Shadowss/TravianZ.svg)](https://github.com/Shadowss/TravianZ) @@ -17,7 +17,7 @@ [![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/cata7007) ====== -TravianZ Version **v.8.3.4** +TravianZ Version **v.8.3.5** ====== **Note:** this game is still in a pre-release state, although at this point it is very playable, tested and found to be fairly stable diff --git a/Templates/Ajax/quest_core.tpl b/Templates/Ajax/quest_core.tpl index a55ef586..2763a543 100644 --- a/Templates/Ajax/quest_core.tpl +++ b/Templates/Ajax/quest_core.tpl @@ -1225,10 +1225,11 @@ if ($residence<10 && $palace<10){?> unitall; $unarray2=array("","u10", "u20","u30"); -if ($units[$unarray2[$session->userinfo['tribe']]]<3){ $cp = CP;?> +$vil = $database->getProfileVillages($session->uid); +if ( $units[$unarray2[$session->userinfo['tribe']]] < 3 && count( $vil ) == 1 ){ $cp = CP;?> {"markup":"\n\t\t

\"\" Task 26: 3 settlers.<\/h1>
”To found a new village, you will need settlers. You can train them in the palace or residence.”<\/i>

Order:<\/p>Train 3 settlers.<\/div>
<\/span><\/div>\n\t\t

<\/div>\n\t\t","number":"-34","reward":false,"qgsrc":"q_luserinfo['tribe'];?>","msrc":"","altstep":99} diff --git a/Templates/Ajax/quest_core25.tpl b/Templates/Ajax/quest_core25.tpl index 1d9bd56b..cd8e7d60 100644 --- a/Templates/Ajax/quest_core25.tpl +++ b/Templates/Ajax/quest_core25.tpl @@ -860,7 +860,7 @@ if ($cropL<1){?> vname); +$vName=rtrim(str_replace(''', "'", $village->vname)); if ($vName==$session->userinfo['username']."'s village"){?> {"markup":"\n\t\t

\"\"<\/h1>
”<\/i>

<\/div>
<\/span><\/div>\n\t\t

<\/div>\n\t\t","number":"-3","reward":false,"qgsrc":"q_luserinfo['tribe'];?>","msrc":"","altstep":99} diff --git a/Templates/Alliance/Forum/forum_9.tpl b/Templates/Alliance/Forum/forum_9.tpl index 232e4cbc..0b3fde8f 100644 --- a/Templates/Alliance/Forum/forum_9.tpl +++ b/Templates/Alliance/Forum/forum_9.tpl @@ -19,7 +19,7 @@ foreach($topics as $top) { $ans = preg_replace('/\[\/message\]/', '', $ans); } ?> -
+ diff --git a/Templates/Alliance/forum.tpl b/Templates/Alliance/forum.tpl index 9a8be711..d063f6bd 100644 --- a/Templates/Alliance/forum.tpl +++ b/Templates/Alliance/forum.tpl @@ -138,7 +138,7 @@ if(isset($_POST['newpost']) && isset($_POST['text']) && !empty($_POST['text']) & if(isset($_POST['editans']) && isset($_POST['text']) && !empty($_POST['text']) && isset($_POST['tid']) && !empty($_POST['tid']) && Alliance::canAct(['aid' => $aid, 'alliance' => ($topic = reset($database->ShowTopic($_POST['tid'])))['alliance'], - 'forum_perm' => $opt['opt5'], 'admin' => $_GET['admin'], 'owner' => $topic['owner'], + 'forum_perm' => $opt['opt5'], 'admin' => ( !empty( $_GET['admin'] ) ? $_GET['admin'] : '' ), 'owner' => $topic['owner'], 'forum_owner' => reset($database->ForumCatEdit($topic['cat']))['owner']], 1)) { $text = $_POST['text']; diff --git a/Templates/Build/16_99.tpl b/Templates/Build/16_99.tpl index 8e161902..e367dcd6 100644 --- a/Templates/Build/16_99.tpl +++ b/Templates/Build/16_99.tpl @@ -14,7 +14,7 @@ else

- + diff --git a/Templates/Build/17.tpl b/Templates/Build/17.tpl index 0ff76ad7..745dfaf5 100644 --- a/Templates/Build/17.tpl +++ b/Templates/Build/17.tpl @@ -20,7 +20,7 @@ for ($a = 1; $a <= 4; $a++) { } } $allres = (int) $_POST['r1'] + (int) $_POST['r2'] + (int) $_POST['r3'] + (int) $_POST['r4']; -if($_POST['x'] != "" && $_POST['y'] != "" && is_numeric($_POST['x']) && is_numeric($_POST['y'])){ +if(isset( $_POST['x'] ) && isset( $_POST['y'] ) && $_POST['x'] != "" && $_POST['y'] != "" && is_numeric($_POST['x']) && is_numeric($_POST['y'])){ $getwref = $database->getVilWref($_POST['x'],$_POST['y']); $checkexist = $database->checkVilExist($getwref); } diff --git a/Templates/Build/17_2.tpl b/Templates/Build/17_2.tpl index ab1df9ba..636e40db 100644 --- a/Templates/Build/17_2.tpl +++ b/Templates/Build/17_2.tpl @@ -59,7 +59,7 @@ echo "

".NOT_ENOUGH_MERCHANTS."

"; } - echo "

Merchants: ".$market->merchantAvail()."/".$market->merchant."

"; + echo "

".MERCHANT.": " .$market->merchantAvail()."/".$market->merchant."

"; ?> merchantAvail()) { echo "DISABLED"; }?>/>

diff --git a/Templates/Build/17_4.tpl b/Templates/Build/17_4.tpl index 1f335e37..d8c6d1e2 100644 --- a/Templates/Build/17_4.tpl +++ b/Templates/Build/17_4.tpl @@ -13,7 +13,7 @@ $routeaccess = 1; if(isset($_GET['create']) && $session->gold > 1){ $routeaccess = 1; include("17_create.tpl"); -}else if($_POST['action'] == 'editRoute' && isset($_POST['routeid']) && !empty($_POST['routeid']) && $database->getTradeRouteUid($_POST['routeid']) == $session->uid){ +}else if(isset($_POST['action']) && $_POST['action'] == 'editRoute' && isset($_POST['routeid']) && !empty($_POST['routeid']) && $database->getTradeRouteUid($_POST['routeid']) == $session->uid){ include("17_edit.tpl"); }else{ ?> @@ -52,7 +52,13 @@ echo "".TRADE_ROUTE_TO." g
- + | | diff --git a/Templates/Build/22_3.tpl b/Templates/Build/22_3.tpl index 8fb6ffa0..3fa63035 100644 --- a/Templates/Build/22_3.tpl +++ b/Templates/Build/22_3.tpl @@ -72,49 +72,49 @@ echo "
".RESEARCH_AVAILABL echo "

".SHOW_MORE."

"; - if(!$technology->meetRRequirement(22) && !$technology->getTech(22)) { - echo""; } if(!$technology->meetRRequirement(23) && !$technology->getTech(23)) { echo""; } if(!$technology->meetRRequirement(24) && !$technology->getTech(24)) { echo ""; } if(!$technology->meetRRequirement(25) && !$technology->getTech(25)) { echo ""; } if(!$technology->meetRRequirement(26) && !$technology->getTech(26)) { echo ""; } if(!$technology->meetRRequirement(27) && !$technology->getTech(27)) { echo " "; } if(!$technology->meetRRequirement(28) && !$technology->getTech(28)) { echo ""; } if(!$technology->meetRRequirement(29) && !$technology->getTech(29)) { echo " "; } diff --git a/Templates/Build/avaliable.tpl b/Templates/Build/avaliable.tpl index 8e37bb1f..dcfdea97 100644 --- a/Templates/Build/avaliable.tpl +++ b/Templates/Build/avaliable.tpl @@ -1,6 +1,6 @@ getArtifactsSumByKind($session->uid, $village->wid, 6); -$GreatGranaryWarehouseBuildable = $artifactsSum['small'] > 0 || $artifactsSum['large'] > 0; +$GreatGranaryWarehouseBuildable = $artifactsSum['small'] > 0 || $artifactsSum['great'] > 0; $mainbuilding = $building->getTypeLevel(15); $cranny = $building->getTypeLevel(23); @@ -274,16 +274,16 @@ if($stable == 0 && (($blacksmith <= 2 && $blacksmith != 0) || ($academy >= 2 && if($treasury == 0 && $mainbuilding <= 9 && $mainbuilding >= 5 && $village->natar == 0) { include("soon/treasury.tpl"); } -if($brickyard == 0 && $claypit <= 9 && $claypit >= 5 && $mainbuilding >= 2 && $mainbuilding <= 4) { +if($brickyard == 0 && ( ($claypit <= 9 && $claypit >= 5) || $claypit == 10 ) && $mainbuilding >= 2) { include("soon/brickyard.tpl"); } -if($sawmill == 0 && $woodcutter <= 9 && $woodcutter >= 5 && $mainbuilding >= 2 && $mainbuilding <= 4) { +if($sawmill == 0 && ( ( $woodcutter <= 9 && $woodcutter >= 5 ) || $woodcutter == 10 ) && $mainbuilding >= 2) { include("soon/sawmill.tpl"); } -if($ironfoundry == 0 && $ironmine <= 9 && $ironmine >= 5 && $mainbuilding >= 2 && $mainbuilding <= 4) { +if($ironfoundry == 0 && ( ( $ironmine <= 9 && $ironmine >= 5 ) || $ironmine == 10 ) && $mainbuilding >= 2) { include("soon/ironfoundry.tpl"); } -if($workshop == 0 && $academy <= 9 && $academy >= 5 && $mainbuilding >= 2 && $mainbuilding <= 4) { +if($workshop == 0 && $academy <= 9 && $academy >= 5 && $mainbuilding >= 2) { include("soon/workshop.tpl"); } if($tournamentsquare == 0 && $rallypoint <= 14 && $rallypoint >= 7) { @@ -327,7 +327,7 @@ if($palace == 0 && ($embassy == 0 || $mainbuilding <= 2) && $village->natar == 0 if($blacksmith == 0 && ($academy == 0 || $mainbuilding == 1)) { include_once("soon/blacksmith.tpl"); } -if($stonemason == 0 && ($palace == 0 || $mainbuilding <= 2) && $residence == 0) { +if($stonemasonslodge == 0 && ($palace == 0 || $mainbuilding <= 2) && $residence == 0) { include_once("soon/stonemason.tpl"); } if($stable == 0 && ($blacksmith == 0 || $academy <= 2)) { diff --git a/Templates/Build/avaliable/academy.tpl b/Templates/Build/avaliable/academy.tpl index ee4dd545..c2a7c157 100644 --- a/Templates/Build/avaliable/academy.tpl +++ b/Templates/Build/avaliable/academy.tpl @@ -1,10 +1,10 @@ -

Academy

+

".PREREQUISITES."
".ACADEMY." + if(!$technology->meetRRequirement(22) && !$technology->getTech(22)) { + echo"
".ACADEMY."  ".LEVEL." 3
".BLACKSMITH."  ".LEVEL." 1
".ACADEMY." + ".U23."".ACADEMY."  ".LEVEL." 5
".STABLE."  ".LEVEL." 1
+ ".U24." ".ACADEMY." ".LEVEL." 5
".STABLE."  ".LEVEL." 3
+ ".U25." ".ACADEMY." ".LEVEL." 5
".STABLE."  ".LEVEL." 5
+ ".U26." ".ACADEMY." ".LEVEL." 15
".STABLE." ".LEVEL." 10
\"Ram\" - Ram
".ACADEMY." + ".U27."".ACADEMY."  ".LEVEL." 10
".WORKSHOP." ".LEVEL." 1
".WORKSHOP." + ".U28."".WORKSHOP."  ".LEVEL." 10
".ACADEMY." ".LEVEL." 15
+ ".U29." ".RALLYPOINT." ".LEVEL." 10
".ACADEMY." ".LEVEL." 20
- + @@ -13,4 +13,4 @@ include("availupgrade.tpl"); ?> -
In the academy new unit types can be researched. By increasing its level you can order the research of better units. - Academy + <?php echo ACADEMY ?>
\ No newline at end of file +
diff --git a/Templates/Build/avaliable/armoury.tpl b/Templates/Build/avaliable/armoury.tpl index 723bf4d6..bd084cb4 100644 --- a/Templates/Build/avaliable/armoury.tpl +++ b/Templates/Build/avaliable/armoury.tpl @@ -1,10 +1,10 @@ -

Armoury

+

- + @@ -13,4 +13,4 @@ include("availupgrade.tpl"); ?> -
In the armoury's melting furnaces your warriors' armour is enhanced. By increasing its level you can order the fabrication of even better armour. - Armoury + <?php echo ARMOURY ?>
\ No newline at end of file + diff --git a/Templates/Build/avaliable/availupgrade.tpl b/Templates/Build/avaliable/availupgrade.tpl index 9e06bfdc..b299dee1 100644 --- a/Templates/Build/avaliable/availupgrade.tpl +++ b/Templates/Build/avaliable/availupgrade.tpl @@ -20,15 +20,15 @@ $uprequire = $building->resourceRequired($id, $bid); The workers are already at work."; + echo "" . WORKERS_ALREADY_WORK_WAITING . ""; if($session->goldclub == 1){ ?>
gold >= 1 && $village->master == 0){ - echo "
checker\">Constructing with master builder "; + echo "checker\">" . CONSTRUCTING_MASTER_BUILDER . ""; echo '(costs: Gold1)'; }else{ - echo "Constructing with master builder"; + echo "" . CONSTRUCTING_MASTER_BUILDER . ""; echo '(costs: Gold1)'; } } @@ -39,10 +39,10 @@ $uprequire = $building->resourceRequired($id, $bid); ?>
gold >= 1 && $village->master == 0){ - echo "checker\">Constructing with master builder "; + echo "checker\">" . CONSTRUCTING_MASTER_BUILDER . ""; echo '(costs: Gold1)'; }else{ - echo "Constructing with master builder"; + echo "" . CONSTRUCTING_MASTER_BUILDER . ""; echo '(costs: Gold1)'; } } @@ -58,24 +58,24 @@ $uprequire = $building->resourceRequired($id, $bid); } else if($bindicator == 7) { $neededtime = $building->calculateAvaliable($id,$bid); - echo "Enough resources ".$neededtime[0]." at ".$neededtime[1].""; + echo "" .ENOUGH_RESOURCES . " " .$neededtime[0]." at ".$neededtime[1].""; if($session->goldclub == 1){ ?>
gold >= 1 && $village->master == 0){ - echo "checker\">Constructing with master builder "; + echo "checker\">" . CONSTRUCTING_MASTER_BUILDER . ""; echo '(costs: Gold1)'; }else{ - echo "Constructing with master builder"; + echo "" . CONSTRUCTING_MASTER_BUILDER . ""; echo '(costs: Gold1)'; } } } else if($bindicator == 8) { if($session->access!=BANNED){ - echo "checker."\">Construct building."; + echo "checker."\">". CONSTRUCT_BUILD.""; }else{ - echo "Construct building."; + echo "". CONSTRUCT_BUILD.""; } } else if($bindicator == 9) { diff --git a/Templates/Build/avaliable/barracks.tpl b/Templates/Build/avaliable/barracks.tpl index 9faaff83..7b01f6b6 100644 --- a/Templates/Build/avaliable/barracks.tpl +++ b/Templates/Build/avaliable/barracks.tpl @@ -1,11 +1,11 @@ -

Barracks

+

- + @@ -14,4 +14,4 @@ include("availupgrade.tpl"); ?> -
In the barracks infantry can be trained. The higher its level the faster the troops are trained. - Barracks + <?php echo BARRACKS ?>
\ No newline at end of file + diff --git a/Templates/Build/avaliable/blacksmith.tpl b/Templates/Build/avaliable/blacksmith.tpl index 41e47b4a..0ed0eaf0 100644 --- a/Templates/Build/avaliable/blacksmith.tpl +++ b/Templates/Build/avaliable/blacksmith.tpl @@ -1,12 +1,10 @@ -

Blacksmith

+

- + @@ -15,4 +13,4 @@ include("availupgrade.tpl"); ?> -
In the blacksmith's melting furnaces your warriors' weapons are enhanced. By increasing its level you can order the fabrication of even better weapons. - - - Blacksmith + <?php echo BLACKSMITH ?>
\ No newline at end of file + diff --git a/Templates/Build/avaliable/citywall.tpl b/Templates/Build/avaliable/citywall.tpl index 116e8c43..3447ec23 100644 --- a/Templates/Build/avaliable/citywall.tpl +++ b/Templates/Build/avaliable/citywall.tpl @@ -1,8 +1,8 @@ -

City Wall

+

- + @@ -12,4 +12,4 @@ include("availupgrade.tpl"); ?> -
By building a City Wall you can protect your village against the barbarian hordes of your enemies. The higher the wall's level, the higher the bonus given to your forces' defence.
\ No newline at end of file + diff --git a/Templates/Build/avaliable/cranny.tpl b/Templates/Build/avaliable/cranny.tpl index c6ca57ea..f3cc5dd3 100644 --- a/Templates/Build/avaliable/cranny.tpl +++ b/Templates/Build/avaliable/cranny.tpl @@ -1,11 +1,11 @@ -

Cranny

+

- + @@ -14,4 +14,4 @@ include("availupgrade.tpl"); ?> -
The cranny is used to hide some of your resources when the village is attacked. These resources cannot be stolen. - Cranny + <?php echo CRANNY ?>
\ No newline at end of file + diff --git a/Templates/Build/avaliable/embassy.tpl b/Templates/Build/avaliable/embassy.tpl index 79c36ba7..c72b0d40 100644 --- a/Templates/Build/avaliable/embassy.tpl +++ b/Templates/Build/avaliable/embassy.tpl @@ -1,11 +1,11 @@ -

Embassy

+

- + @@ -14,4 +14,4 @@ include("availupgrade.tpl"); ?> -
The embassy is a place for diplomats. The higher its level the more options the king gains. - Embassy + <?php echo EMBASSY ?>
\ No newline at end of file + diff --git a/Templates/Build/avaliable/granary.tpl b/Templates/Build/avaliable/granary.tpl index 0906adca..0b7810a5 100644 --- a/Templates/Build/avaliable/granary.tpl +++ b/Templates/Build/avaliable/granary.tpl @@ -1,12 +1,12 @@ -

Granary

+

- + @@ -15,4 +15,4 @@ include("availupgrade.tpl"); ?> -
In the granary the crop produced in your farms is stored. By increasing its level you increase the granary’s capacity. - Granary + <?php echo GRANARY ?>
\ No newline at end of file + diff --git a/Templates/Build/avaliable/hero.tpl b/Templates/Build/avaliable/hero.tpl index 44f31d5a..ca26c2d6 100644 --- a/Templates/Build/avaliable/hero.tpl +++ b/Templates/Build/avaliable/hero.tpl @@ -1,11 +1,11 @@ -

Hero's Mansion

+

- + @@ -14,4 +14,4 @@ include("availupgrade.tpl"); ?> -
In the Hero's Mansion you can train a hero and starting with building level 10 occupy oases in your surrounding area. - Hero's Mansion + <?php echo HEROSMANSION ?>
\ No newline at end of file + diff --git a/Templates/Build/avaliable/marketplace.tpl b/Templates/Build/avaliable/marketplace.tpl index 20511baf..f228937b 100644 --- a/Templates/Build/avaliable/marketplace.tpl +++ b/Templates/Build/avaliable/marketplace.tpl @@ -1,10 +1,10 @@ -

Marketplace

+

- + @@ -13,4 +13,4 @@ include("availupgrade.tpl"); ?> -
At the marketplace you can trade resources with other players. The higher its level, the more resources can be transported at the same time. - Marketplace + <?php echo MARKETPLACE ?>
\ No newline at end of file + diff --git a/Templates/Build/avaliable/palisade.tpl b/Templates/Build/avaliable/palisade.tpl index f5fd601b..8eb4d826 100644 --- a/Templates/Build/avaliable/palisade.tpl +++ b/Templates/Build/avaliable/palisade.tpl @@ -1,8 +1,8 @@ -

Palisade

+

- + @@ -12,4 +12,4 @@ include("availupgrade.tpl"); ?> -
By building a Palisade you can protect your village against the barbarian hordes of your enemies. A higher level Palisade will give your troops a higher defence bonus.
\ No newline at end of file + diff --git a/Templates/Build/avaliable/rallypoint.tpl b/Templates/Build/avaliable/rallypoint.tpl index 358d77c0..e497be5e 100644 --- a/Templates/Build/avaliable/rallypoint.tpl +++ b/Templates/Build/avaliable/rallypoint.tpl @@ -1,11 +1,11 @@ -

Rally point

+

- + @@ -14,4 +14,4 @@ include("availupgrade.tpl"); ?> -
Your village's troops meet here. From here you can send them out to conquer, raid or reinforce other villages. - Rally point + <?php echo RALLYPOINT ?>
\ No newline at end of file + diff --git a/Templates/Build/avaliable/residence.tpl b/Templates/Build/avaliable/residence.tpl index 83a6291b..d267d6d0 100644 --- a/Templates/Build/avaliable/residence.tpl +++ b/Templates/Build/avaliable/residence.tpl @@ -1,10 +1,10 @@ -

Residence

+

- + @@ -13,4 +13,4 @@ include("availupgrade.tpl"); ?> -
The residence is a small palace, where the king or queen lives when (s)he visits the village. The residence protects the village against enemies who want to conquer it. - Residence + <?php echo RESIDENCE ?>
\ No newline at end of file + diff --git a/Templates/Build/avaliable/stable.tpl b/Templates/Build/avaliable/stable.tpl index ce09e40d..f8dcbc12 100644 --- a/Templates/Build/avaliable/stable.tpl +++ b/Templates/Build/avaliable/stable.tpl @@ -1,10 +1,10 @@ -

Stable

+

- + @@ -13,4 +13,4 @@ include("availupgrade.tpl"); ?> -
In the stable cavalry is trained. The higher its level the faster the troops are trained. - Stable + <?php echo STABLE ?>
\ No newline at end of file + diff --git a/Templates/Build/avaliable/trapper.tpl b/Templates/Build/avaliable/trapper.tpl index 2d701668..0bc5c1a6 100644 --- a/Templates/Build/avaliable/trapper.tpl +++ b/Templates/Build/avaliable/trapper.tpl @@ -1,10 +1,10 @@ -

Trapper

+

- + @@ -13,4 +13,4 @@ include("availupgrade.tpl"); ?> -
The Trapper protects your village with well hidden traps. Enemies can be imprisoned and won't be able to harm your village anymore. - Trapper + <?php echo TRAPPER ?>
\ No newline at end of file + diff --git a/Templates/Build/avaliable/warehouse.tpl b/Templates/Build/avaliable/warehouse.tpl index 3b5e4170..2d27be95 100644 --- a/Templates/Build/avaliable/warehouse.tpl +++ b/Templates/Build/avaliable/warehouse.tpl @@ -1,11 +1,11 @@ -

Warehouse

+

- + @@ -14,4 +14,4 @@ include("availupgrade.tpl"); ?> -
In your warehouse the resources lumber, clay and iron are stored. By increasing its level you increase your warehouse's capacity. - Warehouse + <?php echo WAREHOUSE ?>
\ No newline at end of file + diff --git a/Templates/Build/soon/academy.tpl b/Templates/Build/soon/academy.tpl index 88f30aa0..d2efaa89 100644 --- a/Templates/Build/soon/academy.tpl +++ b/Templates/Build/soon/academy.tpl @@ -1,18 +1,18 @@ -

Academy

+

- + - + -
In the academy new unit types can be researched. By increasing its level you can order the research of better units. - Academy + <?php echo ACADEMY ?>
Prerequisites
- Barracks Level 3, Main Building Level 3 + 3, 3
\ No newline at end of file + diff --git a/Templates/Build/soon/armoury.tpl b/Templates/Build/soon/armoury.tpl index 7e5fc90e..f7d2ed54 100644 --- a/Templates/Build/soon/armoury.tpl +++ b/Templates/Build/soon/armoury.tpl @@ -1,18 +1,18 @@ -

Armoury

+

- + - + -
In the armoury's melting furnaces your warriors' armour is enhanced. By increasing its level you can order the fabrication of even better armour. - Armoury + <?php echo ARMOURY ?>
Prerequisites
- Main Building Level 3, Academy Level 1 + 3, 1
\ No newline at end of file + diff --git a/Templates/Build/soon/barracks.tpl b/Templates/Build/soon/barracks.tpl index 41073de1..9772a8e6 100644 --- a/Templates/Build/soon/barracks.tpl +++ b/Templates/Build/soon/barracks.tpl @@ -1,18 +1,18 @@ -

Barracks

+

- + - + -
In the barracks infantry can be trained. The higher its level the faster the troops are trained. - Barracks + <?php echo BARRACKS ?>
Prerequisites
- Rally Point Level 1, Main Building Level 3 + 1, 3
\ No newline at end of file + diff --git a/Templates/Build/soon/blacksmith.tpl b/Templates/Build/soon/blacksmith.tpl index 990cbc92..c664e28f 100644 --- a/Templates/Build/soon/blacksmith.tpl +++ b/Templates/Build/soon/blacksmith.tpl @@ -1,20 +1,18 @@ -

Blacksmith

+

- + - + -
In the blacksmith's melting furnaces your warriors' weapons are enhanced. By increasing its level you can order the fabrication of even better weapons. - - - Blacksmith + <?php echo BLACKSMITH ?>
Prerequisites
- Main Building Level 3, Academy Level 3 + 3, 3
\ No newline at end of file + diff --git a/Templates/Build/soon/hero.tpl b/Templates/Build/soon/hero.tpl index 5d9adc16..1a3231ec 100644 --- a/Templates/Build/soon/hero.tpl +++ b/Templates/Build/soon/hero.tpl @@ -1,18 +1,23 @@ -

Hero's Mansion

+

- + - + -
In the Hero's Mansion you can train a hero and starting with building level 10 occupy oases in your surrounding area. - Hero's Mansion + <?php echo HEROSMANSION; ?>
Prerequisites
- Main Building Level 3, Rally Point Level 1 + + + 3 + , + + 1
\ No newline at end of file + diff --git a/Templates/Build/soon/residence.tpl b/Templates/Build/soon/residence.tpl index 4cfc16d3..9b50d9d2 100644 --- a/Templates/Build/soon/residence.tpl +++ b/Templates/Build/soon/residence.tpl @@ -1,18 +1,18 @@ -

Residence

+

- + - + -
The residence is a small palace, where the king or queen lives when (s)he visits the village. The residence protects the village against enemies who want to conquer it. - Residence + <?php echo RESIDENCE ?>
Prerequisites
- Main Building Level 5, Palace + 5,
\ No newline at end of file + diff --git a/Templates/Build/soon/stable.tpl b/Templates/Build/soon/stable.tpl index 14d9c50c..45f8d892 100644 --- a/Templates/Build/soon/stable.tpl +++ b/Templates/Build/soon/stable.tpl @@ -1,18 +1,18 @@ -

Stable

+

- + - + -
In the stable cavalry is trained. The higher its level the faster the troops are trained. - Stable + <?php echo STABLE ?>
Prerequisites
- Blacksmith Level 3, Academy Level 5 + 3, 5
\ No newline at end of file + diff --git a/Templates/Build/soon/trapper.tpl b/Templates/Build/soon/trapper.tpl index 8ea565df..729b2720 100644 --- a/Templates/Build/soon/trapper.tpl +++ b/Templates/Build/soon/trapper.tpl @@ -1,18 +1,18 @@ -

Trapper

+

- + - + -
The Trapper protects your village with well hidden traps. Enemies can be imprisoned and won't be able to harm your village anymore. - Trapper + <?php echo TRAPPER ?>
Prerequisites
- Rally Point Level 1 + 1
\ No newline at end of file + diff --git a/Templates/Map/mapview.tpl b/Templates/Map/mapview.tpl index 702c3c9b..2696849e 100644 --- a/Templates/Map/mapview.tpl +++ b/Templates/Map/mapview.tpl @@ -19,7 +19,7 @@ if(isset($_GET['z'])) { - $currentcoor = $database->getCoor($_GET['z']);++$requse2; + $currentcoor = $database->getCoor($_GET['z']); $y = $currentcoor['y']; $x = $currentcoor['x']; $bigmid = $_GET['z']; diff --git a/Templates/Map/vilview.tpl b/Templates/Map/vilview.tpl index f6be7b24..bc158089 100644 --- a/Templates/Map/vilview.tpl +++ b/Templates/Map/vilview.tpl @@ -14,7 +14,7 @@ echo !$oasis['conqured']? UNOCCUOASIS : OCCUOASIS; echo " (".$basearray['x']."|" $otext = !$oasis['conqured']? UNOCCUOASIS : OCCUOASIS; } ?>

(capital)
"; } -if($uinfo['owner'] == 3 && $uinfo['name'] == PLANVILLAGE){ +if($uinfo && $uinfo['owner'] == 3 && $uinfo['name'] == PLANVILLAGE){ ?> <?php echo PLANVILLAGE;?> @@ -154,7 +154,8 @@ if($oasis['owner'] == 2){ uid == $database->getVillage($_GET['d'])['owner']){ +$vilData = $database->getVillage($_GET['d']); +if( $vilData && $session->uid == $vilData['owner'] ){ $limit = "ntype > 3 AND ntype < 8"; } else $limit = "ntype < 8 OR ntype > 17"; diff --git a/Templates/News/newsbox3.tpl b/Templates/News/newsbox3.tpl index 99d46815..5a31b57e 100644 --- a/Templates/News/newsbox3.tpl +++ b/Templates/News/newsbox3.tpl @@ -1,11 +1,11 @@
newsbox 2
-
TravianZ by Shadow

- Version: v8.3.4
+
TravianZ

+ Version: v8.3.5
Major Changes: Over 120 bugs fixed, artifacts fully fixed, catapults and rams fully fixed, automated Natars/Artifacts/WW villages/WW building plans, new battle formula (more precise than the old one), automatic artifacts activation, rewritten a lot of code. See more in readme file!
Minor Changes: New forum system, Travian-like trapper formula, fixed master builder, double research queue in blacksmith and armoury with plus
Script Price: FREE!

-
Released by: Shadow

+
Released by: TravianZ Team


Download from Github

diff --git a/Templates/Plus/110.tpl b/Templates/Plus/110.tpl index b6c23809..0b0474af 100644 --- a/Templates/Plus/110.tpl +++ b/Templates/Plus/110.tpl @@ -120,7 +120,7 @@ $name = $session->uid; - + "> diff --git a/Templates/Plus/112.tpl b/Templates/Plus/112.tpl index fedd5ea2..b4f7c1da 100644 --- a/Templates/Plus/112.tpl +++ b/Templates/Plus/112.tpl @@ -118,7 +118,7 @@ $free = $session->uid; - + "> diff --git a/Templates/Plus/113.tpl b/Templates/Plus/113.tpl index 1e2364e5..cd71db7f 100644 --- a/Templates/Plus/113.tpl +++ b/Templates/Plus/113.tpl @@ -92,7 +92,7 @@ $free = $session->uid; - + "> diff --git a/Templates/Plus/3110.tpl b/Templates/Plus/3110.tpl index ccc39351..0e96c9d8 100644 --- a/Templates/Plus/3110.tpl +++ b/Templates/Plus/3110.tpl @@ -63,7 +63,7 @@ $free = $session->uid; - + "> diff --git a/Templates/a2b/search.tpl b/Templates/a2b/search.tpl index 7e438406..faffccb6 100644 --- a/Templates/a2b/search.tpl +++ b/Templates/a2b/search.tpl @@ -1,11 +1,21 @@ - +valuearray ) { + if ( !empty( $form->valuearray['disabled'] ) ) { + $disabled = $form->valuearray['disabled']; + } + + if ( !empty( $form->valuearray['disabledr'] ) ) { + $disabledr = $form->valuearray['disabledr']; + } + } +?>
@@ -29,7 +39,12 @@ diff --git a/Templates/dorf3/2.tpl b/Templates/dorf3/2.tpl index a00c5a44..60a5cf6c 100644 --- a/Templates/dorf3/2.tpl +++ b/Templates/dorf3/2.tpl @@ -2,9 +2,9 @@ include('menu.tpl'); ?>
- + - +getProfileVillages($session->uid); diff --git a/Templates/footer.tpl b/Templates/footer.tpl index a90f393f..db54b8e7 100644 --- a/Templates/footer.tpl +++ b/Templates/footer.tpl @@ -22,7 +22,7 @@ diff --git a/Templates/goldClub/farmlist.tpl b/Templates/goldClub/farmlist.tpl index 0139b494..4549aee6 100644 --- a/Templates/goldClub/farmlist.tpl +++ b/Templates/goldClub/farmlist.tpl @@ -166,7 +166,6 @@ while($row2 = mysqli_fetch_array($getnotice)){
-
Create a new list @@ -174,6 +173,10 @@ while($row2 = mysqli_fetch_array($getnotice)){ + +pageLoadTimeStart(); exit; } - if($_POST['type'] == 15) { - header("Location: ".$_SERVER['PHP_SELF']."?s=1&x=" . preg_replace("/[^a-zA-Z0-9_-]/","",$_POST['x']) . '&y=' . preg_replace("/[^a-zA-Z0-9_-]/","",$_POST['y'])); - exit; - } elseif($_POST['type'] == 9) { - header("Location: ".$_SERVER['PHP_SELF']."?s=2&x=" . preg_replace("/[^a-zA-Z0-9_-]/","",$_POST['x']) . '&y=' . preg_replace("/[^a-zA-Z0-9_-]/","",$_POST['y'])); - exit; - } elseif($_POST['type'] == 'both') { - header("Location: ".$_SERVER['PHP_SELF']."?s=3&x=" . preg_replace("/[^a-zA-Z0-9_-]/","",$_POST['x']) . '&y=' . preg_replace("/[^a-zA-Z0-9_-]/","",$_POST['y'])); - exit; + if ( !empty( $_POST['type'] ) ) { + if ( $_POST['type'] == 15 ) { + header( "Location: " . $_SERVER['PHP_SELF'] . "?s=1&x=" . preg_replace( "/[^a-zA-Z0-9_-]/", "", $_POST['x'] ) . '&y=' . preg_replace( "/[^a-zA-Z0-9_-]/", "", $_POST['y'] ) ); + exit; + } elseif ( $_POST['type'] == 9 ) { + header( "Location: " . $_SERVER['PHP_SELF'] . "?s=2&x=" . preg_replace( "/[^a-zA-Z0-9_-]/", "", $_POST['x'] ) . '&y=' . preg_replace( "/[^a-zA-Z0-9_-]/", "", $_POST['y'] ) ); + exit; + } elseif ( $_POST['type'] == 'both' ) { + header( "Location: " . $_SERVER['PHP_SELF'] . "?s=3&x=" . preg_replace( "/[^a-zA-Z0-9_-]/", "", $_POST['x'] ) . '&y=' . preg_replace( "/[^a-zA-Z0-9_-]/", "", $_POST['y'] ) ); + exit; + } } ?> @@ -93,7 +95,7 @@ $start_timer = $generator->pageLoadTimeStart();
@@ -145,10 +147,10 @@ if(is_numeric($_GET['x']) && is_numeric($_GET['y'])) { dblink,"SELECT id, x, y, occupied, fieldtype FROM ".TB_PREFIX."wdata WHERE $fieldType"); -if(is_numeric($_GET['x']) && is_numeric($_GET['y'])) { +if ( !empty( $_GET['x'] ) && is_numeric($_GET['x']) && !empty( $_GET['y'] ) && is_numeric($_GET['y'])) { $coor['x'] = $_GET['x']; $coor['y'] = $_GET['y']; } else { @@ -156,7 +158,7 @@ if(is_numeric($_GET['x']) && is_numeric($_GET['y'])) { $coor = $database->getCoor($wref); } -if($_GET['s'] >= 1 && $_GET['s'] <= 3) { +if ( !empty( $_GET['s'] ) && $_GET['s'] >= 1 && $_GET['s'] <= 3 ) { ?>
Resources
VillageMerchantsVillage
Cropper Type: - /> 15 crop - /> 9 crop - /> both
+ /> 15 crop + /> 9 crop + /> both
diff --git a/install/data/constant_format.tpl b/install/data/constant_format.tpl index 0f4236f4..1ce9340f 100644 --- a/install/data/constant_format.tpl +++ b/install/data/constant_format.tpl @@ -18,6 +18,7 @@ // (0) = disabled define("ERROR_REPORT","%ERRORREPORT%"); %ERROR% +define('AUTOMATION_LOCK_FILE_NAME', 'automation.lck'); ////////////////////////////////// // ***** SERVER SETTINGS *****// @@ -117,9 +118,9 @@ define("SHOW_NATARS",%SHOW_NATARS%); define("NATARS_UNITS",%NATARS_UNITS%); // ***** Natars Spawn Time -define("NATARS_SPAWN_TIME",%NATARS_SPAWN_TIME%); -define("NATARS_WW_SPAWN_TIME",%NATARS_WW_SPAWN_TIME%); -define("NATARS_WW_BUILDING_PLAN_SPAWN_TIME",%NATARS_WW_BUILDING_PLAN_SPAWN_TIME%); +define("NATARS_SPAWN_TIME", round( %NATARS_SPAWN_TIME% / SPEED )); +define("NATARS_WW_SPAWN_TIME", round( %NATARS_WW_SPAWN_TIME% / SPEED )); +define("NATARS_WW_BUILDING_PLAN_SPAWN_TIME", round( %NATARS_WW_BUILDING_PLAN_SPAWN_TIME% / SPEED )); // ***** Nature troops regeneration time define("NATURE_REGTIME",%NATURE_REGTIME%); diff --git a/install/templates/config.tpl b/install/templates/config.tpl index 6b5d367e..db221626 100644 --- a/install/templates/config.tpl +++ b/install/templates/config.tpl @@ -48,8 +48,9 @@ echo "
Error creating constant.php - - + + + diff --git a/login.php b/login.php index fbb02e71..a461bd57 100644 --- a/login.php +++ b/login.php @@ -81,12 +81,14 @@ else
login

time()){ +$stime = strtotime( date( 'm/d/Y H:i', strtotime(START_DATE . ' ' . START_TIME ) ) ); + +// check whether the server has started or is yet to start +if ( $stime > $time ){ ?>
Server will start in: