mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-16 01:26:07 +00:00
Update to version 8.3.5
Many Fixes
This commit is contained in:
@@ -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','<font color=\'red\'><b>IP: ".$_SERVER['REMOTE_ADDR']." tried to log in with username <u> $username</u> but access was denied!</font></b>',".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,
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
+45
-37
@@ -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 = "<b>Can't be activated</b>";
|
||||
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 = "<b>Can't be activated</b>";
|
||||
elseif (!$artifact['active']) $active = date("d.m.Y H:i:s", $artifact['conquered'] + $activationTime);
|
||||
else
|
||||
{
|
||||
$active = "<b>".ACTIVE."</b>";
|
||||
$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." (<b>".str_replace(["(", ")"], "" , $effect)."</b>)" : (($kind == 11 && $artifact['active']) ? "<b>".WW_BUILDING_PLAN."</b>" : "<b>Not yet active</b>");
|
||||
} else {
|
||||
$requiredLevel = 0;
|
||||
$active = 0;
|
||||
$bonus = 0;
|
||||
$effectInfluence = 0;
|
||||
$nextEffect = 0;
|
||||
}
|
||||
$bonus = isset($betterorbadder) ? $betterorbadder." (<b>".str_replace(["(", ")"], "" , $effect)."</b>)" : (($kind == 11 && $artifact['active']) ? "<b>".WW_BUILDING_PLAN."</b>" : "<b>Not yet active</b>");
|
||||
|
||||
return ["requiredLevel" => $requiredLevel, "active" => $active,
|
||||
"bonus" => $bonus, "effectInfluence" => $effectInfluence,
|
||||
|
||||
@@ -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 );
|
||||
?>
|
||||
|
||||
+49
-43
@@ -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'];
|
||||
|
||||
+27
-22
@@ -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);
|
||||
|
||||
@@ -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<br>the biggest gaming<br>communities in the<br>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.");
|
||||
|
||||
+17
-3
@@ -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;
|
||||
}
|
||||
|
||||
+15
-5
@@ -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");
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user