From 02dd832932c814e50cb53d5aa7391650b741826e Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Wed, 22 Nov 2017 10:03:54 +0100 Subject: [PATCH 001/126] fix: undefined index --- Templates/Profile/profile.tpl | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Templates/Profile/profile.tpl b/Templates/Profile/profile.tpl index 3e965532..b8e4f5a4 100644 --- a/Templates/Profile/profile.tpl +++ b/Templates/Profile/profile.tpl @@ -1,6 +1,6 @@

Player profile

-
- - + + - + @@ -40,7 +40,7 @@ include("menu.tpl"); ?> - userinfo['birthday'] != 0) { $bday = explode("-",$session->userinfo['birthday']); } @@ -63,10 +63,10 @@ include("menu.tpl"); ?> - + - +
Player username; ?>
Details
Location
- +

@@ -99,9 +99,9 @@ INDELING CATEGORIEEN: == 7. in top 3 - verdediging == == 8. in top 3 - klimmers == == 9. in top 3 - overval == -******************************/ - - +******************************/ + + foreach($varmedal as $medal) { $titel="Bonus"; switch ($medal['categorie']) { @@ -141,7 +141,7 @@ INDELING CATEGORIEEN: case "12": $titel="Top 10 of Rank Attackers of week ".$medal['points']." in a row"; break; - } + } echo" @@ -155,7 +155,7 @@ INDELING CATEGORIEEN: - userinfo['tribe'] == 1 && $session->userinfo['username'] == "Shadow") { echo""; @@ -171,8 +171,8 @@ INDELING CATEGORIEEN: echo""; } ?>
Medals
".$titel." ".$medal['plaats']." [#0]
Tribe Romans[#roman]
Multihunter[#TEAM]

- - + +

- + From 65a62becc24e38e9412bd07911a69de437239156 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Wed, 22 Nov 2017 11:47:17 +0100 Subject: [PATCH 002/126] fix: rat reinforcement does not arrive due to a wrong reinfs check #366 --- GameEngine/Automation.php | 2 +- GameEngine/Database.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index b2630e1b..efb09dbb 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -3438,7 +3438,7 @@ class Automation { $DefenderID = $database->getVillageField($data['to'],"owner"); if (isset($AttackerID) && $session->uid==$AttackerID || $session->uid==$DefenderID) $reload=true; $database->addEnforce($data); - $reinf = $database->getEnforce($data['to'],$data['from']); + $reinf = $database->getEnforce($data['from'],$data['to']); $database->modifyEnforce($reinf['id'],31,1,1); $data_fail = '0,0,4,1,0,0,0,0,0,0,0,0,0,0'; $database->addNotice($to['owner'],$to['wref'],(isset($targetally) ? $targetally : 0),8,'village of the elders reinforcement '.addslashes($to['name']).'',$data_fail,$AttackArrivalTime); diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 1aa6a30f..7712f1b9 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -6094,7 +6094,7 @@ References: User ID/Message ID, Mode } } - return ($array_passed ? self::$villageReinforcementsCache : self::$villageReinforcementsCache[$vid[0].$from[0]]); + return ($array_passed ? self::$villageFromReinforcementsCache : self::$villageFromReinforcementsCache[$vid[0].$from[0]]); } function getOasisEnforce($ref, $mode=0, $use_cache = true) { @@ -6211,7 +6211,7 @@ References: User ID/Message ID, Mode $modes = []; for($i = $start; $i <= $end; $i++) { - $units[] = $i; + $units[] = ($i < 0 ? 0 : $i); $amounts[] = $data['t' . $j . '']; $modes[] = 1; $j++; @@ -6237,7 +6237,7 @@ References: User ID/Message ID, Mode $start2 = ($tribe - 1) * 10 + 1; $start3 = ($tribe - 1) * 10; if($start3 == 0){ - $start3 = ""; + $start3 = ""; } $end2 = ($tribe * 10); //add unit @@ -6248,11 +6248,11 @@ References: User ID/Message ID, Mode $modes = []; for($i = $start; $i <= $end; $i++) { - $units[] = $i; + $units[] = ($i < 0 ? 0 : $i); $amounts[] = $data['t' . $j . '']; $modes[] = 1; - $units[] = $i; + $units[] = ($i < 0 ? 0 : $i); $amounts[] = ${'dead'.$j}; $modes[] = 0; From 30fc76e85bc3a3384b63b9877a76b561adcaa9e6 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Wed, 22 Nov 2017 12:20:05 +0100 Subject: [PATCH 003/126] fix: old version cannot save config data anymore --- GameEngine/Admin/Mods/editAdminInfo.php | 25 +++++++++++++++------- GameEngine/Admin/Mods/editExtraSet.php | 17 +++++++++++---- GameEngine/Admin/Mods/editLogSet.php | 27 ++++++++++++++++-------- GameEngine/Admin/Mods/editNewsboxSet.php | 27 ++++++++++++++++-------- GameEngine/Admin/Mods/editPlusSet.php | 11 +++++++++- GameEngine/Admin/Mods/editServerSet.php | 25 +++++++++++++++------- 6 files changed, 93 insertions(+), 39 deletions(-) diff --git a/GameEngine/Admin/Mods/editAdminInfo.php b/GameEngine/Admin/Mods/editAdminInfo.php index 8e66d6b2..747c02dd 100755 --- a/GameEngine/Admin/Mods/editAdminInfo.php +++ b/GameEngine/Admin/Mods/editAdminInfo.php @@ -14,9 +14,18 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN); include_once("../../Database.php"); $id = (int) $_POST['id']; +if (file_exists('constant_format.tpl')) { + die( + 'You seem to be running a new version of TravianZ which was installed using an old installer.
' . + 'Please download constant_format.tpl file and copy it into the GameEngine/Admin/Mods ' . + 'directory - otherwise saving configuration won\'t work.

' . + 'The constant_format.tpl file can be downloaded at ' . + 'https://raw.githubusercontent.com/Shadowss/TravianZ/master/install/data/constant_format.tpl'); +} + $myFile = "../../config.php"; $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\config.php"); - + $ERRORREPORT=ERROR_REPORT; $T4=(T4_COMING==false)? "false":"true"; $GP_ENABLE=(GP_ENABLE==false)? "false":"true"; @@ -39,7 +48,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $NEWSBOX2=(NEWSBOX2==false)? "false":"true"; $NEWSBOX3=(NEWSBOX3==false)? "false":"true"; $LIMIT_MAILBOX=(LIMIT_MAILBOX==false)? "false":"true"; - + $text = file_get_contents("constant_format.tpl"); $text = preg_replace("'%ERRORREPORT%'", $ERRORREPORT, $text); $text = preg_replace("'%ERROR%'", $ERRORREPORT, $text); @@ -60,7 +69,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%TRAPPERCAP%'", TRAPPER_CAPACITY, $text); $text = preg_replace("'%VILLAGE_EXPAND%'", CP, $text); $text = preg_replace("'%DEMOLISH%'", DEMOLISH_LEVEL_REQ, $text); - $text = preg_replace("'%STORAGE_MULTIPLIER%'", STORAGE_MULTIPLIER, $text); + $text = preg_replace("'%STORAGE_MULTIPLIER%'", STORAGE_MULTIPLIER, $text); $text = preg_replace("'%QUEST%'", $QUEST, $text); $text = preg_replace("'%QTYPE%'", QTYPE, $text); $text = preg_replace("'%BEGINNER%'", PROTECTION, $text); @@ -84,7 +93,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%LOGADMIN%'", $LOG_ADMIN, $text); $text = preg_replace("'%LOGWAR%'", $LOG_WAR, $text); $text = preg_replace("'%LOGMARKET%'", $LOG_MARKET, $text); - $text = preg_replace("'%LOGILLEGAL%'", $LOG_ILLEGAL, $text); + $text = preg_replace("'%LOGILLEGAL%'", $LOG_ILLEGAL, $text); $text = preg_replace("'%BOX1%'", $NEWSBOX1, $text); $text = preg_replace("'%BOX2%'", $NEWSBOX2, $text); $text = preg_replace("'%BOX3%'", $NEWSBOX3, $text); @@ -94,10 +103,10 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%SPASS%'", SQL_PASS, $text); $text = preg_replace("'%SDB%'", SQL_DB, $text); $text = preg_replace("'%PREFIX%'", TB_PREFIX, $text); - $text = preg_replace("'%CONNECTT%'", DB_TYPE, $text); + $text = preg_replace("'%CONNECTT%'", DB_TYPE, $text); $text = preg_replace("'%LIMIT_MAILBOX%'", $LIMIT_MAILBOX, $text); $text = preg_replace("'%MAX_MAILS%'", MAX_MAIL, $text); - $text = preg_replace("'%ARANK%'", $_POST['admin_rank'], $text); + $text = preg_replace("'%ARANK%'", $_POST['admin_rank'], $text); $text = preg_replace("'%AEMAIL%'", $_POST['aemail'], $text); $text = preg_replace("'%ANAME%'", $_POST['aname'], $text); $text = preg_replace("'%ASUPPMSGS%'", ($_POST['admin_support_msgs'] == 'True' ? 'true' : 'false'), $text); @@ -107,7 +116,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%DOMAIN%'", DOMAIN, $text); $text = preg_replace("'%HOMEPAGE%'", HOMEPAGE, $text); $text = preg_replace("'%SERVER%'", SERVER, $text); - + // PLUS settings need to be kept intact $text = preg_replace("'%PLUS_TIME%'", PLUS_TIME, $text); $text = preg_replace("'%PLUS_PRODUCTION%'", PLUS_PRODUCTION, $text); @@ -123,7 +132,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%PLUS_PACKAGE_D_GOLD%'", (defined('PLUS_PACKAGE_D_GOLD') ? PLUS_PACKAGE_D_GOLD : '1000'), $text); $text = preg_replace("'%PLUS_PACKAGE_E_PRICE%'", (defined('PLUS_PACKAGE_E_PRICE') ? PLUS_PACKAGE_E_PRICE : '49,99'), $text); $text = preg_replace("'%PLUS_PACKAGE_E_GOLD%'", (defined('PLUS_PACKAGE_E_GOLD') ? PLUS_PACKAGE_E_GOLD : '2000'), $text); - + fwrite($fh, $text); fclose($fh); diff --git a/GameEngine/Admin/Mods/editExtraSet.php b/GameEngine/Admin/Mods/editExtraSet.php index 7183a27a..e4b4cdc1 100755 --- a/GameEngine/Admin/Mods/editExtraSet.php +++ b/GameEngine/Admin/Mods/editExtraSet.php @@ -14,9 +14,18 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN); include_once("../../Database.php"); $id = (int) $_POST['id']; +if (file_exists('constant_format.tpl')) { + die( + 'You seem to be running a new version of TravianZ which was installed using an old installer.
' . + 'Please download constant_format.tpl file and copy it into the GameEngine/Admin/Mods ' . + 'directory - otherwise saving configuration won\'t work.

' . + 'The constant_format.tpl file can be downloaded at ' . + 'https://raw.githubusercontent.com/Shadowss/TravianZ/master/install/data/constant_format.tpl'); +} + $myFile = "../../config.php"; $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\config.php"); - + $ERRORREPORT=ERROR_REPORT; $T4=(T4_COMING==false)? "false":"true"; $GP_ENABLE=(GP_ENABLE==false)? "false":"true"; @@ -38,7 +47,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $INCLUDE_ADMIN=(INCLUDE_ADMIN==false)? "false":"true"; $SUPPORT_MSGS_IN_ADMIN = (ADMIN_RECEIVE_SUPPORT_MESSAGES == false ? 'false' : 'true'); $ADMINS_RAIDABLE = (ADMIN_ALLOW_INCOMING_RAIDS == false ? 'false' : 'true'); - + $text = file_get_contents("constant_format.tpl"); $text = preg_replace("'%ERRORREPORT%'", ERROR_REPORT, $text); $text = preg_replace("'%ERROR%'", ERROR_REPORT, $text); @@ -104,7 +113,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%DOMAIN%'", DOMAIN, $text); $text = preg_replace("'%HOMEPAGE%'", HOMEPAGE, $text); $text = preg_replace("'%SERVER%'", SERVER, $text); - + // PLUS settings need to be kept intact $text = preg_replace("'%PLUS_TIME%'", PLUS_TIME, $text); $text = preg_replace("'%PLUS_PRODUCTION%'", PLUS_PRODUCTION, $text); @@ -120,7 +129,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%PLUS_PACKAGE_D_GOLD%'", (defined('PLUS_PACKAGE_D_GOLD') ? PLUS_PACKAGE_D_GOLD : '1000'), $text); $text = preg_replace("'%PLUS_PACKAGE_E_PRICE%'", (defined('PLUS_PACKAGE_E_PRICE') ? PLUS_PACKAGE_E_PRICE : '49,99'), $text); $text = preg_replace("'%PLUS_PACKAGE_E_GOLD%'", (defined('PLUS_PACKAGE_E_GOLD') ? PLUS_PACKAGE_E_GOLD : '2000'), $text); - + fwrite($fh, $text); fclose($fh); diff --git a/GameEngine/Admin/Mods/editLogSet.php b/GameEngine/Admin/Mods/editLogSet.php index 35137df3..14b801b2 100755 --- a/GameEngine/Admin/Mods/editLogSet.php +++ b/GameEngine/Admin/Mods/editLogSet.php @@ -14,9 +14,18 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN); include_once("../../Database.php"); $id = (int) $_POST['id']; +if (file_exists('constant_format.tpl')) { + die( + 'You seem to be running a new version of TravianZ which was installed using an old installer.
' . + 'Please download constant_format.tpl file and copy it into the GameEngine/Admin/Mods ' . + 'directory - otherwise saving configuration won\'t work.

' . + 'The constant_format.tpl file can be downloaded at ' . + 'https://raw.githubusercontent.com/Shadowss/TravianZ/master/install/data/constant_format.tpl'); +} + $myFile = "../../config.php"; $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\config.php"); - + $ERRORREPORT=ERROR_REPORT; $T4=(T4_COMING==false)? "false":"true"; $GP_ENABLE=(GP_ENABLE==false)? "false":"true"; @@ -26,7 +35,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $AUTH_EMAIL=(AUTH_EMAIL==false)? "false":"true"; $GREAT_WKS=(GREAT_WKS==false)? "false":"true"; $REG_OPEN=(REG_OPEN==false)? "false":"true"; - + $NEWSBOX1=(NEWSBOX1==false)? "false":"true"; $NEWSBOX2=(NEWSBOX2==false)? "false":"true"; $NEWSBOX3=(NEWSBOX3==false)? "false":"true"; @@ -34,7 +43,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $INCLUDE_ADMIN=(INCLUDE_ADMIN==false)? "false":"true"; $SUPPORT_MSGS_IN_ADMIN = (ADMIN_RECEIVE_SUPPORT_MESSAGES == false ? 'false' : 'true'); $ADMINS_RAIDABLE = (ADMIN_ALLOW_INCOMING_RAIDS == false ? 'false' : 'true'); - + $text = file_get_contents("constant_format.tpl"); $text = preg_replace("'%ERRORREPORT%'", $ERRORREPORT, $text); $text = preg_replace("'%ERROR%'", $ERRORREPORT, $text); @@ -55,7 +64,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%TRAPPERCAP%'", TRAPPER_CAPACITY, $text); $text = preg_replace("'%VILLAGE_EXPAND%'", CP, $text); $text = preg_replace("'%DEMOLISH%'", DEMOLISH_LEVEL_REQ, $text); - $text = preg_replace("'%STORAGE_MULTIPLIER%'", STORAGE_MULTIPLIER, $text); + $text = preg_replace("'%STORAGE_MULTIPLIER%'", STORAGE_MULTIPLIER, $text); $text = preg_replace("'%QUEST%'", $QUEST, $text); $text = preg_replace("'%QTYPE%'", QTYPE, $text); $text = preg_replace("'%BEGINNER%'", PROTECTION, $text); @@ -80,7 +89,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%LOGADMIN%'", $_POST['log_admin'], $text); $text = preg_replace("'%LOGWAR%'", $_POST['log_war'], $text); $text = preg_replace("'%LOGMARKET%'", $_POST['log_market'], $text); - $text = preg_replace("'%LOGILLEGAL%'", $_POST['log_illegal'], $text); + $text = preg_replace("'%LOGILLEGAL%'", $_POST['log_illegal'], $text); //end update $text = preg_replace("'%BOX1%'", $NEWSBOX1, $text); $text = preg_replace("'%BOX2%'", $NEWSBOX2, $text); @@ -91,10 +100,10 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%SPASS%'", SQL_PASS, $text); $text = preg_replace("'%SDB%'", SQL_DB, $text); $text = preg_replace("'%PREFIX%'", TB_PREFIX, $text); - $text = preg_replace("'%CONNECTT%'", DB_TYPE, $text); + $text = preg_replace("'%CONNECTT%'", DB_TYPE, $text); $text = preg_replace("'%LIMIT_MAILBOX%'", $LIMIT_MAILBOX, $text); $text = preg_replace("'%MAX_MAILS%'", MAX_MAIL, $text); - $text = preg_replace("'%ARANK%'", $INCLUDE_ADMIN, $text); + $text = preg_replace("'%ARANK%'", $INCLUDE_ADMIN, $text); $text = preg_replace("'%AEMAIL%'", ADMIN_EMAIL, $text); $text = preg_replace("'%ANAME%'", ADMIN_NAME, $text); $text = preg_replace("'%ASUPPMSGS%'", $SUPPORT_MSGS_IN_ADMIN, $text); @@ -104,7 +113,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%DOMAIN%'", DOMAIN, $text); $text = preg_replace("'%HOMEPAGE%'", HOMEPAGE, $text); $text = preg_replace("'%SERVER%'", SERVER, $text); - + // PLUS settings need to be kept intact $text = preg_replace("'%PLUS_TIME%'", PLUS_TIME, $text); $text = preg_replace("'%PLUS_PRODUCTION%'", PLUS_PRODUCTION, $text); @@ -120,7 +129,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%PLUS_PACKAGE_D_GOLD%'", (defined('PLUS_PACKAGE_D_GOLD') ? PLUS_PACKAGE_D_GOLD : '1000'), $text); $text = preg_replace("'%PLUS_PACKAGE_E_PRICE%'", (defined('PLUS_PACKAGE_E_PRICE') ? PLUS_PACKAGE_E_PRICE : '49,99'), $text); $text = preg_replace("'%PLUS_PACKAGE_E_GOLD%'", (defined('PLUS_PACKAGE_E_GOLD') ? PLUS_PACKAGE_E_GOLD : '2000'), $text); - + fwrite($fh, $text); fclose($fh); diff --git a/GameEngine/Admin/Mods/editNewsboxSet.php b/GameEngine/Admin/Mods/editNewsboxSet.php index eba2c130..10a2fc9c 100755 --- a/GameEngine/Admin/Mods/editNewsboxSet.php +++ b/GameEngine/Admin/Mods/editNewsboxSet.php @@ -14,9 +14,18 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN); include_once("../../Database.php"); $id = (int) $_POST['id']; +if (file_exists('constant_format.tpl')) { + die( + 'You seem to be running a new version of TravianZ which was installed using an old installer.
' . + 'Please download constant_format.tpl file and copy it into the GameEngine/Admin/Mods ' . + 'directory - otherwise saving configuration won\'t work.

' . + 'The constant_format.tpl file can be downloaded at ' . + 'https://raw.githubusercontent.com/Shadowss/TravianZ/master/install/data/constant_format.tpl'); +} + $myFile = "../../config.php"; $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\config.php"); - + $ERRORREPORT=ERROR_REPORT; $T4=(T4_COMING==false)? "false":"true"; $GP_ENABLE=(GP_ENABLE==false)? "false":"true"; @@ -35,13 +44,13 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $LOG_WAR=(LOG_WAR==false)? "false":"true"; $LOG_MARKET=(LOG_MARKET==false)? "false":"true"; $LOG_ILLEGAL=(LOG_ILLEGAL==false)? "false":"true"; - + $LIMIT_MAILBOX=(LIMIT_MAILBOX==false)? "false":"true"; $INCLUDE_ADMIN=(INCLUDE_ADMIN==false)? "false":"true"; $SUPPORT_MSGS_IN_ADMIN = (ADMIN_RECEIVE_SUPPORT_MESSAGES == false ? 'false' : 'true'); $ADMINS_RAIDABLE = (ADMIN_ALLOW_INCOMING_RAIDS == false ? 'false' : 'true'); - + $text = file_get_contents("constant_format.tpl"); $text = preg_replace("'%ERRORREPORT%'", $ERRORREPORT, $text); $text = preg_replace("'%ERROR%'", $ERRORREPORT, $text); @@ -62,7 +71,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%TRAPPERCAP%'", TRAPPER_CAPACITY, $text); $text = preg_replace("'%VILLAGE_EXPAND%'", CP, $text); $text = preg_replace("'%DEMOLISH%'", DEMOLISH_LEVEL_REQ, $text); - $text = preg_replace("'%STORAGE_MULTIPLIER%'", STORAGE_MULTIPLIER, $text); + $text = preg_replace("'%STORAGE_MULTIPLIER%'", STORAGE_MULTIPLIER, $text); $text = preg_replace("'%QUEST%'", $QUEST, $text); $text = preg_replace("'%QTYPE%'", QTYPE, $text); $text = preg_replace("'%BEGINNER%'", PROTECTION, $text); @@ -86,7 +95,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%LOGADMIN%'", $LOG_ADMIN, $text); $text = preg_replace("'%LOGWAR%'", $LOG_WAR, $text); $text = preg_replace("'%LOGMARKET%'", $LOG_MARKET, $text); - $text = preg_replace("'%LOGILLEGAL%'", $LOG_ILLEGAL, $text); + $text = preg_replace("'%LOGILLEGAL%'", $LOG_ILLEGAL, $text); //update $text = preg_replace("'%BOX1%'", $_POST['box1'], $text); $text = preg_replace("'%BOX2%'", $_POST['box2'], $text); @@ -98,10 +107,10 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%SPASS%'", SQL_PASS, $text); $text = preg_replace("'%SDB%'", SQL_DB, $text); $text = preg_replace("'%PREFIX%'", TB_PREFIX, $text); - $text = preg_replace("'%CONNECTT%'", DB_TYPE, $text); + $text = preg_replace("'%CONNECTT%'", DB_TYPE, $text); $text = preg_replace("'%LIMIT_MAILBOX%'", $LIMIT_MAILBOX, $text); $text = preg_replace("'%MAX_MAILS%'", MAX_MAIL, $text); - $text = preg_replace("'%ARANK%'", $INCLUDE_ADMIN, $text); + $text = preg_replace("'%ARANK%'", $INCLUDE_ADMIN, $text); $text = preg_replace("'%AEMAIL%'", ADMIN_EMAIL, $text); $text = preg_replace("'%ANAME%'", ADMIN_NAME, $text); $text = preg_replace("'%ASUPPMSGS%'", $SUPPORT_MSGS_IN_ADMIN, $text); @@ -111,7 +120,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%DOMAIN%'", DOMAIN, $text); $text = preg_replace("'%HOMEPAGE%'", HOMEPAGE, $text); $text = preg_replace("'%SERVER%'", SERVER, $text); - + // PLUS settings need to be kept intact $text = preg_replace("'%PLUS_TIME%'", PLUS_TIME, $text); $text = preg_replace("'%PLUS_PRODUCTION%'", PLUS_PRODUCTION, $text); @@ -127,7 +136,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%PLUS_PACKAGE_D_GOLD%'", (defined('PLUS_PACKAGE_D_GOLD') ? PLUS_PACKAGE_D_GOLD : '1000'), $text); $text = preg_replace("'%PLUS_PACKAGE_E_PRICE%'", (defined('PLUS_PACKAGE_E_PRICE') ? PLUS_PACKAGE_E_PRICE : '49,99'), $text); $text = preg_replace("'%PLUS_PACKAGE_E_GOLD%'", (defined('PLUS_PACKAGE_E_GOLD') ? PLUS_PACKAGE_E_GOLD : '2000'), $text); - + fwrite($fh, $text); fclose($fh); diff --git a/GameEngine/Admin/Mods/editPlusSet.php b/GameEngine/Admin/Mods/editPlusSet.php index 798646d0..1ff28834 100644 --- a/GameEngine/Admin/Mods/editPlusSet.php +++ b/GameEngine/Admin/Mods/editPlusSet.php @@ -15,11 +15,20 @@ include_once("../../Database.php"); include_once("../../config.php"); $id = (int) $_POST['id']; +if (file_exists('constant_format.tpl')) { + die( + 'You seem to be running a new version of TravianZ which was installed using an old installer.
' . + 'Please download constant_format.tpl file and copy it into the GameEngine/Admin/Mods ' . + 'directory - otherwise saving configuration won\'t work.

' . + 'The constant_format.tpl file can be downloaded at ' . + 'https://raw.githubusercontent.com/Shadowss/TravianZ/master/install/data/constant_format.tpl'); +} + $myFile = "../../config.php"; $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\config.php"); $text = file_get_contents("constant_format.tpl"); - + $SUPPORT_MSGS_IN_ADMIN = (ADMIN_RECEIVE_SUPPORT_MESSAGES == false ? 'false' : 'true'); $ADMINS_RAIDABLE = (ADMIN_ALLOW_INCOMING_RAIDS == false ? 'false' : 'true'); diff --git a/GameEngine/Admin/Mods/editServerSet.php b/GameEngine/Admin/Mods/editServerSet.php index f20ebb1d..78838fa4 100755 --- a/GameEngine/Admin/Mods/editServerSet.php +++ b/GameEngine/Admin/Mods/editServerSet.php @@ -14,9 +14,18 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN); include_once("../../Database.php"); $id = (int) $_POST['id']; +if (file_exists('constant_format.tpl')) { + die( + 'You seem to be running a new version of TravianZ which was installed using an old installer.
' . + 'Please download constant_format.tpl file and copy it into the GameEngine/Admin/Mods ' . + 'directory - otherwise saving configuration won\'t work.

' . + 'The constant_format.tpl file can be downloaded at ' . + 'https://raw.githubusercontent.com/Shadowss/TravianZ/master/install/data/constant_format.tpl'); +} + $myFile = "../../config.php"; $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\config.php"); - + $T4=(T4_COMING==false)? "false":"true"; $LOG_BUILD=(LOG_BUILD==false)? "false":"true"; $LOG_TECH=(LOG_TECH==false)? "false":"true"; @@ -33,7 +42,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $INCLUDE_ADMIN=(INCLUDE_ADMIN==false)? "false":"true"; $SUPPORT_MSGS_IN_ADMIN = (ADMIN_RECEIVE_SUPPORT_MESSAGES == false ? 'false' : 'true'); $ADMINS_RAIDABLE = (ADMIN_ALLOW_INCOMING_RAIDS == false ? 'false' : 'true'); - + $text = file_get_contents("constant_format.tpl"); $text = preg_replace("'%ERRORREPORT%'", $_POST['error'], $text); $text = preg_replace("'%ERROR%'", $_POST['error'], $text); @@ -54,7 +63,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%TRAPPERCAP%'", $_POST['trappercap'], $text); $text = preg_replace("'%VILLAGE_EXPAND%'", $_POST['village_expand'], $text); $text = preg_replace("'%DEMOLISH%'", $_POST['demolish'], $text); - $text = preg_replace("'%STORAGE_MULTIPLIER%'", $_POST['storage_multiplier'], $text); + $text = preg_replace("'%STORAGE_MULTIPLIER%'", $_POST['storage_multiplier'], $text); $text = preg_replace("'%QUEST%'", $_POST['quest'], $text); $text = preg_replace("'%QTYPE%'", $_POST['qtype'], $text); $text = preg_replace("'%BEGINNER%'", $_POST['beginner'], $text); @@ -76,7 +85,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%LOGADMIN%'", $LOG_ADMIN, $text); $text = preg_replace("'%LOGWAR%'", $LOG_WAR, $text); $text = preg_replace("'%LOGMARKET%'", $LOG_MARKET, $text); - $text = preg_replace("'%LOGILLEGAL%'", $LOG_ILLEGAL, $text); + $text = preg_replace("'%LOGILLEGAL%'", $LOG_ILLEGAL, $text); $text = preg_replace("'%BOX1%'", $NEWSBOX1, $text); $text = preg_replace("'%BOX2%'", $NEWSBOX2, $text); $text = preg_replace("'%BOX3%'", $NEWSBOX3, $text); @@ -86,10 +95,10 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%SPASS%'", SQL_PASS, $text); $text = preg_replace("'%SDB%'", SQL_DB, $text); $text = preg_replace("'%PREFIX%'", TB_PREFIX, $text); - $text = preg_replace("'%CONNECTT%'", DB_TYPE, $text); + $text = preg_replace("'%CONNECTT%'", DB_TYPE, $text); $text = preg_replace("'%LIMIT_MAILBOX%'", $LIMIT_MAILBOX, $text); $text = preg_replace("'%MAX_MAILS%'", MAX_MAIL, $text); - $text = preg_replace("'%ARANK%'", $INCLUDE_ADMIN, $text); + $text = preg_replace("'%ARANK%'", $INCLUDE_ADMIN, $text); $text = preg_replace("'%AEMAIL%'", ADMIN_EMAIL, $text); $text = preg_replace("'%ASUPPMSGS%'", $SUPPORT_MSGS_IN_ADMIN, $text); $text = preg_replace("'%ARAIDS%'", $ADMINS_RAIDABLE, $text); @@ -99,7 +108,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%DOMAIN%'", DOMAIN, $text); $text = preg_replace("'%HOMEPAGE%'", HOMEPAGE, $text); $text = preg_replace("'%SERVER%'", SERVER, $text); - + // PLUS settings need to be kept intact $text = preg_replace("'%PLUS_TIME%'", PLUS_TIME, $text); $text = preg_replace("'%PLUS_PRODUCTION%'", PLUS_PRODUCTION, $text); @@ -115,7 +124,7 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%PLUS_PACKAGE_D_GOLD%'", (defined('PLUS_PACKAGE_D_GOLD') ? PLUS_PACKAGE_D_GOLD : '1000'), $text); $text = preg_replace("'%PLUS_PACKAGE_E_PRICE%'", (defined('PLUS_PACKAGE_E_PRICE') ? PLUS_PACKAGE_E_PRICE : '49,99'), $text); $text = preg_replace("'%PLUS_PACKAGE_E_GOLD%'", (defined('PLUS_PACKAGE_E_GOLD') ? PLUS_PACKAGE_E_GOLD : '2000'), $text); - + fwrite($fh, $text); fclose($fh); From 0134b0abe922180550d77bcbb227ce980544e55b Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Wed, 22 Nov 2017 12:21:16 +0100 Subject: [PATCH 004/126] fix: old version cannot save config data anymore --- GameEngine/Admin/Mods/editAdminInfo.php | 2 +- GameEngine/Admin/Mods/editExtraSet.php | 2 +- GameEngine/Admin/Mods/editLogSet.php | 2 +- GameEngine/Admin/Mods/editNewsboxSet.php | 2 +- GameEngine/Admin/Mods/editPlusSet.php | 2 +- GameEngine/Admin/Mods/editServerSet.php | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/GameEngine/Admin/Mods/editAdminInfo.php b/GameEngine/Admin/Mods/editAdminInfo.php index 747c02dd..672ae9cf 100755 --- a/GameEngine/Admin/Mods/editAdminInfo.php +++ b/GameEngine/Admin/Mods/editAdminInfo.php @@ -14,7 +14,7 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN); include_once("../../Database.php"); $id = (int) $_POST['id']; -if (file_exists('constant_format.tpl')) { +if (!file_exists('constant_format.tpl')) { die( 'You seem to be running a new version of TravianZ which was installed using an old installer.
' . 'Please download constant_format.tpl file and copy it into the GameEngine/Admin/Mods ' . diff --git a/GameEngine/Admin/Mods/editExtraSet.php b/GameEngine/Admin/Mods/editExtraSet.php index e4b4cdc1..7ad37818 100755 --- a/GameEngine/Admin/Mods/editExtraSet.php +++ b/GameEngine/Admin/Mods/editExtraSet.php @@ -14,7 +14,7 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN); include_once("../../Database.php"); $id = (int) $_POST['id']; -if (file_exists('constant_format.tpl')) { +if (!file_exists('constant_format.tpl')) { die( 'You seem to be running a new version of TravianZ which was installed using an old installer.
' . 'Please download constant_format.tpl file and copy it into the GameEngine/Admin/Mods ' . diff --git a/GameEngine/Admin/Mods/editLogSet.php b/GameEngine/Admin/Mods/editLogSet.php index 14b801b2..59b1ab1f 100755 --- a/GameEngine/Admin/Mods/editLogSet.php +++ b/GameEngine/Admin/Mods/editLogSet.php @@ -14,7 +14,7 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN); include_once("../../Database.php"); $id = (int) $_POST['id']; -if (file_exists('constant_format.tpl')) { +if (!file_exists('constant_format.tpl')) { die( 'You seem to be running a new version of TravianZ which was installed using an old installer.
' . 'Please download constant_format.tpl file and copy it into the GameEngine/Admin/Mods ' . diff --git a/GameEngine/Admin/Mods/editNewsboxSet.php b/GameEngine/Admin/Mods/editNewsboxSet.php index 10a2fc9c..f1ec6e0e 100755 --- a/GameEngine/Admin/Mods/editNewsboxSet.php +++ b/GameEngine/Admin/Mods/editNewsboxSet.php @@ -14,7 +14,7 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN); include_once("../../Database.php"); $id = (int) $_POST['id']; -if (file_exists('constant_format.tpl')) { +if (!file_exists('constant_format.tpl')) { die( 'You seem to be running a new version of TravianZ which was installed using an old installer.
' . 'Please download constant_format.tpl file and copy it into the GameEngine/Admin/Mods ' . diff --git a/GameEngine/Admin/Mods/editPlusSet.php b/GameEngine/Admin/Mods/editPlusSet.php index 1ff28834..6f271bd4 100644 --- a/GameEngine/Admin/Mods/editPlusSet.php +++ b/GameEngine/Admin/Mods/editPlusSet.php @@ -15,7 +15,7 @@ include_once("../../Database.php"); include_once("../../config.php"); $id = (int) $_POST['id']; -if (file_exists('constant_format.tpl')) { +if (!file_exists('constant_format.tpl')) { die( 'You seem to be running a new version of TravianZ which was installed using an old installer.
' . 'Please download constant_format.tpl file and copy it into the GameEngine/Admin/Mods ' . diff --git a/GameEngine/Admin/Mods/editServerSet.php b/GameEngine/Admin/Mods/editServerSet.php index 78838fa4..dc883216 100755 --- a/GameEngine/Admin/Mods/editServerSet.php +++ b/GameEngine/Admin/Mods/editServerSet.php @@ -14,7 +14,7 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN); include_once("../../Database.php"); $id = (int) $_POST['id']; -if (file_exists('constant_format.tpl')) { +if (!file_exists('constant_format.tpl')) { die( 'You seem to be running a new version of TravianZ which was installed using an old installer.
' . 'Please download constant_format.tpl file and copy it into the GameEngine/Admin/Mods ' . From 98ddbe235f3283a2513a493391e063eb8298f877 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Wed, 22 Nov 2017 12:34:38 +0100 Subject: [PATCH 005/126] fix: pagination returns to ALL from Attacks page in battle reports Closes #343 --- Admin/Templates/Notice/all.tpl | 25 ++++++++++++------------- Templates/Message/archive.tpl | 14 +++++++------- Templates/Message/inbox.tpl | 8 ++++---- Templates/Notice/all.tpl | 23 +++++++++++------------ 4 files changed, 34 insertions(+), 36 deletions(-) diff --git a/Admin/Templates/Notice/all.tpl b/Admin/Templates/Notice/all.tpl index 714a8561..4f3ab47c 100644 --- a/Admin/Templates/Notice/all.tpl +++ b/Admin/Templates/Notice/all.tpl @@ -1,4 +1,4 @@ -
@@ -20,32 +20,32 @@ $noticeClass = array("Scout Report","Won as attacker without losses","Won as att - plus) { + plus) { if(isset($_GET['t']) && $_GET['t'] == 5) { echo ""; } else { - echo ""; + echo ""; } }?> - 10) { - echo "«»"; + echo "«»"; } else if(isset($_GET['s']) && count($rep1) > $_GET['s']) { if(count($rep1) > ($_GET['s']+10) && $_GET['s']-10 < count($rep1) && $_GET['s'] != 0) { - echo "«»"; + echo "«»"; } else if(count($rep1) > $_GET['s']+10) { - echo "«»"; + echo "«»"; } else { - echo "«»"; + echo "«»"; } } ?> @@ -53,7 +53,7 @@ $noticeClass = array("Scout Report","Won as attacker without losses","Won as att -There are no reports available."; - } + } ?> - + - \ No newline at end of file diff --git a/Templates/Message/archive.tpl b/Templates/Message/archive.tpl index 15cbf7bd..2c28d2b6 100644 --- a/Templates/Message/archive.tpl +++ b/Templates/Message/archive.tpl @@ -1,6 +1,6 @@

Messages

- @@ -14,26 +14,26 @@ include("menu.tpl"); - - inbox1) > 10) { - echo "«»"; + echo "«»"; } else if(isset($_GET['s']) && count($message->inbox1) > $_GET['s']) { if(count($message->inbox1) > ($_GET['s']+10) && $_GET['s']-10 < count($message->inbox1) && $_GET['s'] != 0) { - echo "«»"; + echo "«»"; } else if(count($message->inbox1) > $_GET['s']+10) { - echo "«»"; + echo "«»"; } else { - echo "«»"; + echo "«»"; } } ?> diff --git a/Templates/Notice/all.tpl b/Templates/Notice/all.tpl index 57c48166..761c8054 100644 --- a/Templates/Notice/all.tpl +++ b/Templates/Notice/all.tpl @@ -1,4 +1,4 @@ - @@ -20,17 +20,17 @@ $noticeClass = array("Scout Report","Won as attacker without losses","Won as att -noticearray) == 0) { echo ""; - } + } ?> - +
archived1) < 10) { echo "«»"; } else if (!isset($_GET['s']) && count($message->archived1) > 10) { - echo "«»"; + echo "«»"; } else if(isset($_GET['s']) && count($message->archived1) > $_GET['s']) { if(count($message->archived1) > ($_GET['s']+10) && $_GET['s']-10 < count($message->archived1) && $_GET['s'] != 0) { - echo "«»"; + echo "«»"; } else if(count($message->archived1) > $_GET['s']+10) { - echo "«»"; + echo "«»"; } else { - echo "«»"; + echo "«»"; } } ?>
- plus) { + plus) { if(isset($_GET['t']) && $_GET['t'] == 5) { echo ""; } else { - echo ""; + echo ""; } }?> - noticearray) < 10) { echo "«»"; } @@ -39,13 +39,13 @@ $noticeClass = array("Scout Report","Won as attacker without losses","Won as att } else if(isset($_GET['s']) && count($message->noticearray) > $_GET['s']) { if(count($message->noticearray) > ($_GET['s']+10) && $_GET['s']-10 < count($message->noticearray) && $_GET['s'] != 0) { - echo "«»"; + echo "«»"; } else if(count($message->noticearray) > $_GET['s']+10) { - echo "«»"; + echo "«»"; } else { - echo "«»"; + echo "«»"; } } ?> @@ -53,7 +53,7 @@ $noticeClass = array("Scout Report","Won as attacker without losses","Won as att
There are no reports available.
- \ No newline at end of file From ec8752ac27359b018af4f8d0f080eaa045f0aa3b Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Wed, 22 Nov 2017 12:46:46 +0100 Subject: [PATCH 006/126] fix: fid2 missing from URL after forum post edited Closes #355 --- Templates/Alliance/Forum/forum_6.tpl | 8 ++++---- Templates/Alliance/forum.tpl | 24 +++++++++++++----------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/Templates/Alliance/Forum/forum_6.tpl b/Templates/Alliance/Forum/forum_6.tpl index a124293e..73e52195 100644 --- a/Templates/Alliance/Forum/forum_6.tpl +++ b/Templates/Alliance/Forum/forum_6.tpl @@ -62,7 +62,7 @@ $bbcode_topic = stripslashes(nl2br($bbcoded));
created:
CheckEditRes($aid)=="1"){ - echo '
editdelete

'; + echo '
editdelete

'; } ?>
@@ -135,7 +135,7 @@ foreach($posts as $po) { $trip = "Teutons"; }else if($displayarray['tribe'] == 3) { $trip = "Gauls"; - } + } $owner = $database->getUserArray($po['owner'],1); $allianceinfo = $database->getAlliance($owner['alliance']); $input = $po['post']; @@ -155,7 +155,7 @@ echo '
created: '.$date.'
'; if($database->CheckEditRes($aid)=="1"){ - echo '
editdelete

'; + echo '
editdelete

'; } echo '
'.$bbcode_post.'
'; @@ -169,7 +169,7 @@ echo '
'.$bbcode_post.'
Toggle Admin mode'; } - + echo '
'; }else{ header("Location: banned.php"); diff --git a/Templates/Alliance/forum.tpl b/Templates/Alliance/forum.tpl index d514058c..cf1791a8 100644 --- a/Templates/Alliance/forum.tpl +++ b/Templates/Alliance/forum.tpl @@ -19,7 +19,7 @@ $aid = $session->alliance; $allianceinfo = $database->getAlliance($aid); $opt = $database->getAlliPermissions($session->uid, $aid); echo "

".$allianceinfo['tag']." - ".$allianceinfo['name']."

"; -include("alli_menu.tpl"); +include("alli_menu.tpl"); $ids = $_GET['s']; if(isset($_POST['new'])){ @@ -27,14 +27,14 @@ if(isset($_POST['new'])){ $forum_des = $_POST['u2']; $forum_owner = $session->uid; $forum_area = $_POST['bid']; - + $database->CreatForum($forum_owner,$aid,$forum_name,$forum_des,$forum_area); } if(isset($_POST['edittopic'])){ $topic_name = $_POST['thema']; $topic_cat = $_POST['fid']; $topic_id = $_POST['tid']; - + $database->UpdateEditTopic($topic_id,$topic_name,$topic_cat); } if(isset($_POST['editforum'])){ @@ -43,7 +43,7 @@ if(isset($_POST['editforum'])){ $forum_des = $_POST['u2']; $forum_des = htmlspecialchars($forum_des); $forum_id = $_POST['fid']; - + $database->UpdateEditForum($forum_id,$forum_name,$forum_des); } if(isset($_POST['newtopic'])){ @@ -297,10 +297,12 @@ if(isset($_POST['editpost'])){ $text = preg_replace('/\[coor'.$i.'\]/', '[coor0]', $text); $text = preg_replace('/\[\/coor'.$i.'\]/', '[/coor0]', $text); } - for($i=0;$i<=$text['report0'];$i++){ - $text = preg_replace('/\[report'.$i.'\]/', '[report0]', $text); - $text = preg_replace('/\[\/report'.$i.'\]/', '[/report0]', $text); - } + if (isset($text['report0'])) { + for ( $i = 0; $i <= $text['report0']; $i ++ ) { + $text = preg_replace( '/\[report' . $i . '\]/', '[report0]', $text ); + $text = preg_replace( '/\[\/report' . $i . '\]/', '[/report0]', $text ); + } + } $posts_id = $_POST['pod']; if($text != ""){ if(!preg_match('/\[message\]/',$text) && !preg_match('/\[\/message\]/',$text)){ @@ -420,11 +422,11 @@ if($_GET['admin']== "newforum"){ if(isset($_GET['ac'])){ include("Forum/forum_7.tpl"); // new post }else{ - include("Forum/forum_6.tpl"); // showtopic + include("Forum/forum_6.tpl"); // showtopic } }else{ if($database->CheckForum($aid)){ - include("Forum/forum_2.tpl"); + include("Forum/forum_2.tpl"); }else if($opt['opt5'] == 1){ if($session->access==BANNED){ echo '

Forum is not created yet

@@ -435,5 +437,5 @@ if($_GET['admin']== "newforum"){ }}else{ echo '

Forum is not created yet

'; } - } + } ?> \ No newline at end of file From 6b339b95f661a05f2d8f73242bc6f5caeafafb95 Mon Sep 17 00:00:00 2001 From: Shadow <1140613+Shadowss@users.noreply.github.com> Date: Wed, 22 Nov 2017 14:43:00 +0200 Subject: [PATCH 007/126] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 99ebcf0d..63f14c1b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Code Triagers Badge](https://www.codetriage.com/shadowss/travianz/badges/users.svg)](https://www.codetriage.com/shadowss/travianz) [![Join the chat at https://gitter.im/TravianZ-V8/Lobby](https://badges.gitter.im/TravianZ-V8/Lobby.svg)](https://gitter.im/TravianZ-V8/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Code Triagers Badge](https://www.codetriage.com/shadowss/travianz/badges/users.svg)](https://www.codetriage.com/shadowss/travianz) [![Join the chat at https://gitter.im/TravianZ-V8/Lobby](https://badges.gitter.im/TravianZ-V8/Lobby.svg)](https://gitter.im/TravianZ-V8/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)[![Waffle.io - Issues in progress](https://badge.waffle.io/Shadowss/TravianZ.png?label=in%20progress&title=In%20Progress)](http://waffle.io/Shadowss/TravianZ) TravianZ Version v.8.3.3 BETA b2 @@ -221,4 +221,4 @@ TPLinux Changes: 12. Remove Rally point advantage 13. Fix fullscreen map in rtl layout 14. Fix divesion by Zero bug in general statics --- \ No newline at end of file +-- From 16c9e9b9694c4419401ddf36619a529a8dfca4e8 Mon Sep 17 00:00:00 2001 From: Shadow <1140613+Shadowss@users.noreply.github.com> Date: Wed, 22 Nov 2017 14:43:15 +0200 Subject: [PATCH 008/126] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 63f14c1b..bbdfb6da 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Code Triagers Badge](https://www.codetriage.com/shadowss/travianz/badges/users.svg)](https://www.codetriage.com/shadowss/travianz) [![Join the chat at https://gitter.im/TravianZ-V8/Lobby](https://badges.gitter.im/TravianZ-V8/Lobby.svg)](https://gitter.im/TravianZ-V8/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)[![Waffle.io - Issues in progress](https://badge.waffle.io/Shadowss/TravianZ.png?label=in%20progress&title=In%20Progress)](http://waffle.io/Shadowss/TravianZ) +[![Code Triagers Badge](https://www.codetriage.com/shadowss/travianz/badges/users.svg)](https://www.codetriage.com/shadowss/travianz) [![Join the chat at https://gitter.im/TravianZ-V8/Lobby](https://badges.gitter.im/TravianZ-V8/Lobby.svg)](https://gitter.im/TravianZ-V8/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Waffle.io - Issues in progress](https://badge.waffle.io/Shadowss/TravianZ.png?label=in%20progress&title=In%20Progress)](http://waffle.io/Shadowss/TravianZ) TravianZ Version v.8.3.3 BETA b2 From 53fa177671ce125ed7e84a41f79851fed75b24f6 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Wed, 22 Nov 2017 13:48:32 +0100 Subject: [PATCH 009/126] fix: account activation issues #344 --- GameEngine/Account.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/GameEngine/Account.php b/GameEngine/Account.php index a1fee486..bca28091 100755 --- a/GameEngine/Account.php +++ b/GameEngine/Account.php @@ -154,14 +154,14 @@ class Account { if(START_DATE < date('m/d/Y') or START_DATE == date('m/d/Y') && START_TIME <= date('H:i')) { global $database; - $q = "SELECT act, username, password, email, tribe, kid FROM ".TB_PREFIX."activate where act = '".$database->escape($_POST['id'])."'"; + $q = "SELECT act, username, password, email, tribe, location FROM ".TB_PREFIX."activate where act = '".$database->escape($_POST['id'])."'"; $result = mysqli_query($GLOBALS['link'],$q); $dbarray = mysqli_fetch_array($result); if($dbarray['act'] == $_POST['id']) { $uid = $database->register($dbarray['username'],$dbarray['password'],$dbarray['email'],$dbarray['tribe'],""); if($uid) { $database->unreg($dbarray['username']); - $this->generateBase($dbarray['kid'],$uid,$dbarray['username']); + $this->generateBase($dbarray['location'],$uid,$dbarray['username']); header("Location: activate.php?e=2"); exit; } @@ -209,15 +209,20 @@ class Account { $form->addError("pw",LOGIN_PASS_EMPTY); } else if(!$database->login($_POST['user'],$_POST['pw']) && !$database->sitterLogin($_POST['user'],$_POST['pw'])) { - $form->addError("pw",LOGIN_PW_ERROR); + // try activation data if the user was not found + if (!$userData) { + $activateData = $database->getActivateField( $_POST['user'], 'act', 1 ); + + if ( $activateData != "" ) { + $form->addError( "activate", $_POST['user'] ); + } + } else { + $form->addError("pw",LOGIN_PW_ERROR); + } } $userData = $database->getUserArray($_POST['user'], 0); - if($userData["act"] != "") { - $form->addError("activate",$_POST['user']); - } - // Vacation mode by Shadow if($userData["vac_mode"] == 1 && $userData["vac_time"] > time()) { $form->addError("vacation","Vacation mode is still enabled"); From 6ccb9683110d61d33b760db6b1a9362925fd053d Mon Sep 17 00:00:00 2001 From: Shadow <1140613+Shadowss@users.noreply.github.com> Date: Wed, 22 Nov 2017 14:52:33 +0200 Subject: [PATCH 010/126] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bbdfb6da..1bb0d3aa 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Code Triagers Badge](https://www.codetriage.com/shadowss/travianz/badges/users.svg)](https://www.codetriage.com/shadowss/travianz) [![Join the chat at https://gitter.im/TravianZ-V8/Lobby](https://badges.gitter.im/TravianZ-V8/Lobby.svg)](https://gitter.im/TravianZ-V8/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Waffle.io - Issues in progress](https://badge.waffle.io/Shadowss/TravianZ.png?label=in%20progress&title=In%20Progress)](http://waffle.io/Shadowss/TravianZ) +[![Code Triagers Badge](https://www.codetriage.com/shadowss/travianz/badges/users.svg)](https://www.codetriage.com/shadowss/travianz) [![Join the chat at https://gitter.im/TravianZ-V8/Lobby](https://badges.gitter.im/TravianZ-V8/Lobby.svg)](https://gitter.im/TravianZ-V8/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) TravianZ Version v.8.3.3 BETA b2 From ddb8614b1491e39cdfd350e9d442936a1efc344c Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Wed, 22 Nov 2017 14:35:33 +0100 Subject: [PATCH 011/126] fix: construction of a palace and a residence in one village #323 --- GameEngine/Building.php | 182 ++++++++++++++++++++++------------ GameEngine/Database.php | 6 +- Templates/Build/avaliable.tpl | 9 +- 3 files changed, 127 insertions(+), 70 deletions(-) diff --git a/GameEngine/Building.php b/GameEngine/Building.php index 4b0cbdee..9137e995 100755 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -4,15 +4,15 @@ ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## ## --------------------------------------------------------------------------- ## ## Project: TravianZ ## -## Version: 22.06.2015 ## +## Version: 22.06.2015 ## ## Filename Building.php ## -## Developed by: Mr.php , Advocaite , brainiacX , yi12345 , Shadow , ronix ## +## Developed by: Mr.php , Advocaite , brainiacX , yi12345 , Shadow , ronix ## ## Fixed by: Shadow - STARVATION , HERO FIXED COMPL., TPLinux ## ## Fixed by: InCube - double troops ## ## License: TravianZ Project ## ## Copyright: TravianZ (c) 2010-2015. All rights reserved. ## ## URLs: http://travian.shadowss.ro ## -## Source code: https://github.com/Shadowss/TravianZ ## +## Source code: https://github.com/Shadowss/TravianZ ## ## ## ################################################################################# @@ -41,27 +41,50 @@ class Building { } } } - + + public function residenceOfPalaceBuildInProgress($vid) { + global $database, $village; + + $residenceOrPalaceInProgress = $database->getBuildingByType($village->wid, '25, 26'); + $residenceBuildInProgress = false; + $palaceBuildInProgress = false; + + if (count($residenceOrPalaceInProgress)) { + foreach ($residenceOrPalaceInProgress as $record) { + if ($record['type'] == 25) { + $residenceBuildInProgress = true; + } else { + $palaceBuildInProgress = true; + } + } + } + + return [ + 'residence' => $residenceBuildInProgress, + 'palace' => $palaceBuildInProgress + ]; + } + public function canProcess($id,$tid) { - //add fix by ronix - global $session; - if($session->access==BANNED){ - header("Location: banned.php"); - exit; - } else { - if ($this->checkResource($id,$tid)!=4) { - if($tid >= 19) { - header("Location: dorf2.php"); - exit; - } - else { - header("Location: dorf1.php"); - exit; - } - exit; - } - } - } + //add fix by ronix + global $session; + if($session->access==BANNED){ + header("Location: banned.php"); + exit; + } else { + if ($this->checkResource($id,$tid)!=4) { + if($tid >= 19) { + header("Location: dorf2.php"); + exit; + } + else { + header("Location: dorf1.php"); + exit; + } + exit; + } + } + } public function procBuild($get) { global $session, $village, $database; @@ -81,14 +104,28 @@ class Building { if($session->access==BANNED){ header("Location: banned.php"); exit; - } - $level = $database->getResourceLevel($village->wid); - $database->addBuilding($village->wid, $get['id'], $get['master'], 1, $get['time'], 1, $level['f'.$get['id']] + 1 + count($database->getBuildingByField($village->wid,$get['id']))); - if($get['id'] > 18) { - header("Location: dorf2.php"); + } + + // check if we're not trying to hack-build residence and palace together + if ( + ($progresses = $this->residenceOfPalaceBuildInProgress($village->wid)) && + ( + !in_array($get['master'], [25, 26]) || + ( + ($get['master'] == 25 && $progresses['palace'] === false) || + ($get['master'] == 26 && $progresses['residence'] === false) + ) + ) + ) { + $level = $database->getResourceLevel( $village->wid ); + $database->addBuilding( $village->wid, $get['id'], $get['master'], 1, $get['time'], 1, $level[ 'f' . $get['id'] ] + 1 + count( $database->getBuildingByField( $village->wid, $get['id'] ) ) ); + } + + if ( $get['id'] > 18 ) { + header( "Location: dorf2.php" ); exit; } else { - header("Location: dorf1.php"); + header( "Location: dorf1.php" ); exit; } } @@ -434,37 +471,52 @@ class Building { global $database,$village,$session,$logging; if($this->allocated < $this->maxConcurrent) { - if($tid == 16) { - $id = 39; - } - else if($tid == 31 || $tid == 32 || $tid == 33) { - $id = 40; - } - $uprequire = $this->resourceRequired($id,$tid); - $time = time() + $uprequire['time']; - $bindicate = $this->canBuild($id,$village->resarray['f'.$id.'t']); - $loop = ($bindicate == 9 ? 1 : 0); - if($loop == 1) { - foreach($this->buildArray as $build) { - if($build['field'] >= 19 || ($session->tribe <> 1 && !ALLOW_ALL_TRIBE)) { - $time = $build['timestamp'] + ceil(60/SPEED) + $uprequire['time']; - } - } - } - if($this->meetRequirement($tid)) { - if($session->access!=BANNED){ - $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"); - exit; - } - }else{ - header("Location: banned.php"); - exit; - } - } + // check if we're not trying to hack-build residence and palace together + if ( + ($progresses = $this->residenceOfPalaceBuildInProgress($village->wid)) && + ( + !in_array($tid, [25, 26]) || + ( + ($tid == 25 && $progresses['palace'] === false) || + ($tid == 26 && $progresses['residence'] === false) + ) + ) + ) { + + if ( $tid == 16 ) { + $id = 39; + } else if ( $tid == 31 || $tid == 32 || $tid == 33 ) { + $id = 40; + } + $uprequire = $this->resourceRequired( $id, $tid ); + $time = time() + $uprequire['time']; + $bindicate = $this->canBuild( $id, $village->resarray[ 'f' . $id . 't' ] ); + $loop = ( $bindicate == 9 ? 1 : 0 ); + if ( $loop == 1 ) { + foreach ( $this->buildArray as $build ) { + if ( $build['field'] >= 19 || ( $session->tribe <> 1 && ! ALLOW_ALL_TRIBE ) ) { + $time = $build['timestamp'] + ceil( 60 / SPEED ) + $uprequire['time']; + } + } + } + if ( $this->meetRequirement( $tid ) ) { + if ( $session->access != BANNED ) { + $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" ); + exit; + } + } else { + header( "Location: banned.php" ); + exit; + } + } + } else { + header( "Location: dorf2.php" ); + exit; + } } } @@ -830,7 +882,7 @@ class Building { if ($session->uid == 1) { return 0; } - + $keyholder = array(); if($vid == 0) { @@ -838,7 +890,7 @@ class Building { } else { $resourcearray = $database->getResourceLevel($vid); } - + foreach(array_keys($resourcearray,$tid) as $key) { if(strpos($key,'t')) { $key = preg_replace("/[^0-9]/", '', $key); @@ -853,7 +905,7 @@ class Building { // resource field if($tid <= 4) { $temparray = array(); - + for($i=0;$i<=$element-1;$i++) { // collect current field level array_push($temparray,$resourcearray['f'.$keyholder[$i]]); @@ -870,7 +922,7 @@ class Building { // village building else { $target = 0; - + // find the highest level built for this building type for($i=1;$i<=$element-1;$i++) { if($resourcearray['f'.$keyholder[$i]] > $resourcearray['f'.$keyholder[$target]]) { @@ -1024,7 +1076,7 @@ class Building { $database->updateUserField($session->uid, "gold", $newgold, 1); } - $stillbuildingarray = $database->getJobs($village->wid); + $stillbuildingarray = $database->getJobs($village->wid); if (count($stillbuildingarray) == 1) { if($stillbuildingarray[0]['loopcon'] == 1) { //$q = "UPDATE ".TB_PREFIX."bdata SET loopcon=0,timestamp=".(time()+$stillbuildingarray[0]['timestamp']-$innertimestamp)." WHERE id=".$stillbuildingarray[0]['id']; diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 7712f1b9..80213c37 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -4971,9 +4971,11 @@ References: User ID/Message ID, Mode // no need to cache this method function getBuildingByType($wid,$type) { - list($wid,$type) = $this->escape_input((int) $wid,(int) $type); + $wid = (int) $wid; - $q = "SELECT * FROM " . TB_PREFIX . "bdata where wid = $wid and type = $type and master = 0"; + $type = (strpos($type, ',') === false ? (int) $type : $this->escape($type)); + + $q = "SELECT * FROM " . TB_PREFIX . "bdata where wid = $wid and type IN($type) and master = 0"; $result = mysqli_query($this->dblink,$q); return $this->mysqli_fetch_all($result); } diff --git a/Templates/Build/avaliable.tpl b/Templates/Build/avaliable.tpl index 2aecbb5d..ff1bfb5a 100644 --- a/Templates/Build/avaliable.tpl +++ b/Templates/Build/avaliable.tpl @@ -98,6 +98,10 @@ $greatwarehouse1 = getTypeCount(38); $greatgranary1 = getTypeCount(39); $greatworkshop1 = getTypeCount(42); +$residenceOrPalaceInProgress = $building->residenceOfPalaceBuildInProgress($village->wid); +$residenceBuildInProgress = $residenceOrPalaceInProgress['residence']; +$palaceBuildInProgress = $residenceOrPalaceInProgress['palace']; + ?>
= 1 && $warehouse >= 1 && $mainbuilding >= 3 && $market == 0 && $market1 == 0 && $id != 39 && $id != 40) { include("avaliable/marketplace.tpl"); } -if($mainbuilding >= 5 && $residence == 0 && $residence1 == 0 && $id != 39 && $id != 40 && $palace == 0) { +if($mainbuilding >= 5 && $residence == 0 && $residence1 == 0 && $id != 39 && $id != 40 && $palace == 0 && !$palaceBuildInProgress) { include("avaliable/residence.tpl"); } if($academy == 0 && $academy1 == 0 && $mainbuilding >= 3 && $barrack >= 3 && $id != 39 && $id != 40) { @@ -195,9 +199,8 @@ if ($test){ } - //if Castle no ready include palace.tpl -if (!$test){ +if (!$test && !$residenceBuildInProgress){ include("avaliable/palace.tpl"); } From 2f9d134ec9cf941f365ca0b011649295668caae3 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Wed, 22 Nov 2017 15:32:31 +0100 Subject: [PATCH 012/126] feat: indicator for fields under construction Also, all line separators are now Linux-style :-P Closes #321 --- Admin/Templates/Newmessage.tpl | 2 +- Admin/Templates/editVillage.tpl | 2 +- Admin/Templates/message.tpl | 2 +- Admin/Templates/msg.tpl | 2 +- Admin/Templates/report.tpl | 4 +- Admin/Templates/village.tpl | 14 ++-- Templates/Manual/433.tpl | 2 +- Templates/field.tpl | 18 ++++- a2b.php | 12 +-- a2b2.php | 2 +- activate.php | 2 +- allianz.php | 2 +- anmelden.php | 2 +- banned.php | 2 +- berichte.php | 2 +- build.php | 4 +- create_account.php | 2 +- crop_finder.php | 2 +- dorf1.php | 2 +- dorf2.php | 4 +- dorf3.php | 2 +- gpack/travian_default/img/g/s/glvlm.gif | Bin 1048 -> 1491 bytes .../img/g/s/lvl11_20_active.gif | Bin 0 -> 1498 bytes .../img/g/s/lvl1_10_active.gif | Bin 0 -> 1197 bytes .../img/g/s/lvl21_30_active.gif | Bin 0 -> 930 bytes gpack/travian_default/lang/en/b/zurueck.html | 14 ++-- gpack/travian_default/lang/en/compact.css | 33 +++++--- gpack/travian_default/lang/en/lang.css | 73 +++++++++++++++++- gpack/travian_t4/lang/en/b/zurueck.html | 14 ++-- gpack/travian_t4/lang/en/compact.css | 31 +++++--- img/admin/b/zurueck.html | 14 ++-- install/index.php | 2 +- karte.php | 2 +- karte2.php | 2 +- login.php | 2 +- logout.php | 2 +- manual.php | 2 +- massmessage.php | 6 +- nachrichten.php | 2 +- notification/index.php | 2 +- packages.php | 2 +- password.php | 2 +- plus.php | 12 +-- plus1.php | 14 ++-- rules.php | 2 +- spieler.php | 2 +- statistiken.php | 14 ++-- support.php | 2 +- sysmsg.php | 2 +- uncrypt.js | 2 +- version.php | 2 +- warsim.php | 10 +-- winner.php | 2 +- 53 files changed, 227 insertions(+), 128 deletions(-) create mode 100644 gpack/travian_default/img/g/s/lvl11_20_active.gif create mode 100644 gpack/travian_default/img/g/s/lvl1_10_active.gif create mode 100644 gpack/travian_default/img/g/s/lvl21_30_active.gif diff --git a/Admin/Templates/Newmessage.tpl b/Admin/Templates/Newmessage.tpl index 6dfc45a3..10c51082 100644 --- a/Admin/Templates/Newmessage.tpl +++ b/Admin/Templates/Newmessage.tpl @@ -18,7 +18,7 @@ if(isset($id)) $varray = $database->getProfileVillages($id); $varmedal = $database->getProfileMedal($id); ?> - + - + diff --git a/Admin/Templates/msg.tpl b/Admin/Templates/msg.tpl index 55a40342..7c01a081 100644 --- a/Admin/Templates/msg.tpl +++ b/Admin/Templates/msg.tpl @@ -13,7 +13,7 @@ $msg = $database->getMessage($_GET['nid'],3); if($msg) { ?> - + diff --git a/Admin/Templates/report.tpl b/Admin/Templates/report.tpl index e408217e..7186ee69 100644 --- a/Admin/Templates/report.tpl +++ b/Admin/Templates/report.tpl @@ -22,7 +22,7 @@ if($rep1) //$att = $database->getUserArray($rep1['uid'],1); ?> - +

Under Construction

@@ -36,7 +36,7 @@ if($rep1) if($rep) { ?> - + diff --git a/Admin/Templates/village.tpl b/Admin/Templates/village.tpl index 08f7f2ad..178c03fa 100644 --- a/Admin/Templates/village.tpl +++ b/Admin/Templates/village.tpl @@ -20,7 +20,7 @@ if(isset($id)) $type = $database->getVillageType($village['wref']); $fdata = $database->getResourceLevel($village['wref']); $units = $database->getUnit($village['wref']); - $abtech = $database->getABTech($id); // Armory/blacksmith level + $abtech = $database->getABTech($id); // Armory/blacksmith level if($type == 1){ $typ = array(3,3,3,9); } elseif($type == 2){ $typ = array(3,4,5,6); } elseif($type == 3){ $typ = array(4,4,4,6); } @@ -40,7 +40,7 @@ if(isset($id)) if(count($result) >0) { foreach($result as $row) - { + { $type = $row['type']; if($type==1) { $type = ' + 25%'; $wood+=1;} elseif($type==2) { $type = ' + 25%'; $wood+=1;} @@ -54,13 +54,13 @@ if(isset($id)) elseif($type==10){ $type = ' + 25%'; $crop+=1;} elseif($type==11){ $type = ' + 25%'; $crop+=1;} elseif($type==12){ $type = ' + 50%'; $crop+=2;} - } + } } $ocounter = array($wood,$clay,$iron,$crop); $production=$admin->calculateProduction($id,$user['id'],$user['b1'],$user['b2'],$user['b3'],$user['b4'],$fdata, $ocounter, $village['pop']); $refreshiconfrm = "../img/admin/refresh.png"; $refreshicon = ""; - + class MyGenerator { public function getMapCheck($wref) @@ -69,14 +69,14 @@ if(isset($id)) } }; $generator = new MyGenerator; - + if($village and $user) { include("search2.tpl"); ?> - +
@@ -249,7 +249,7 @@ if(isset($id)) "; - } + } } elseif($result ==0) { diff --git a/Templates/Manual/433.tpl b/Templates/Manual/433.tpl index 8b29bfbc..9143c221 100644 --- a/Templates/Manual/433.tpl +++ b/Templates/Manual/433.tpl @@ -1,6 +1,6 @@

Brewery

BreweryTasty mead is brewed in the brewery and later quaffed by the soldiers during the celebrations.

-These drinks make your soldiers braver and stronger in battles (1% per level). Unfortunately the chiefs’ power of persuasion is decreased and catapults can only do random hits. +These drinks make your soldiers braver and stronger in battles (1% per level). Unfortunately the chiefs� power of persuasion is decreased and catapults can only do random hits.

It can only be built by Teutons and only in their capital. It affects the whole empire.

Costs and construction time for level 1:
Lumber1460 | Clay930 | Iron1250 | Crop1740 | Crop consumption6 | duration2:13:20

Prerequisites
Granary Level 20, Rally Point Level 10

diff --git a/Templates/field.tpl b/Templates/field.tpl index 551dce63..45dedbde 100644 --- a/Templates/field.tpl +++ b/Templates/field.tpl @@ -1,4 +1,4 @@ -"101,33,28","165,32,28","224,46,28","46,63,28","138,74,28" $arrayVillage = $village->resarray; ?> -procResType($arrayVillage['f'.$i.'t'])." Level ".$arrayVillage['f'.$i]."\"/>\r\n"; } ?> @@ -23,7 +23,17 @@ for($i=1;$i<=18;$i++) {echo "
-getJobs($village->wid); +$activeFields = []; +if (count($jobs)) { + foreach ($jobs as $job) { + if ( $job['type'] <= 4 ) { + $activeFields[ $job['field'] ] = true; + } + } +} + for($i=1;$i<=18;$i++) { if($arrayVillage['f'.$i.'t'] != 0) { $text = ""; @@ -33,7 +43,7 @@ for($i=1;$i<=18;$i++) { case 3:$text = "Iron Mine Level";break; case 4:$text = "Cropland Level";break; } - echo "\"$text"; + echo "\"$text"; } } ?> diff --git a/a2b.php b/a2b.php index 9a833b81..a43d5638 100644 --- a/a2b.php +++ b/a2b.php @@ -106,7 +106,7 @@ if(isset($_GET['o'])) { echo GP_LOCATE; -?>lang/en/compact.css?f4b7g" rel="stylesheet" type="text/css" /> +?>lang/en/compact.css?f4b7h" rel="stylesheet" type="text/css" /> gpack == null || GP_ENABLE == false) { @@ -180,10 +180,10 @@ if(isset($_GET['o'])) { $p_ander = $database->getCoor($prisoner['from']); $p_to = array('x'=>$p_ander['x'], 'y'=>$p_ander['y']); $p_tribe = $database->getUserField($p_owner,"tribe",0); - + $p_speeds = array(); - - //find slowest unit. + + //find slowest unit. for($i=1;$i<=10;$i++){ if ($prisoner['t'.$i]){ if($prisoner['t'.$i] != '' && $prisoner['t'.$i] > 0){ @@ -193,7 +193,7 @@ if(isset($_GET['o'])) { } } } - + if ($prisoner['t11']>0){ $p_qh = "SELECT unit FROM ".TB_PREFIX."hero WHERE uid = ".(int) $p_owner." AND dead = 0"; $p_resulth = mysqli_query($GLOBALS['link'],$p_qh); @@ -201,7 +201,7 @@ if(isset($_GET['o'])) { $p_hero_unit=$p_hero_f['unit']; $p_speeds[] = $GLOBALS['u'.$p_hero_unit]['speed']; } - + $p_artefact = count($database->getOwnUniqueArtefactInfo2($p_owner,2,3,0)); $p_artefact1 = count($database->getOwnUniqueArtefactInfo2($prisoner['from'],2,1,1)); $p_artefact2 = count($database->getOwnUniqueArtefactInfo2($p_owner,2,2,0)); diff --git a/a2b2.php b/a2b2.php index 4f4da176..019be444 100644 --- a/a2b2.php +++ b/a2b2.php @@ -43,7 +43,7 @@ $automation->isWinner(); - + gpack == null || GP_ENABLE == false) { echo " diff --git a/activate.php b/activate.php index 0e0c5954..70780131 100644 --- a/activate.php +++ b/activate.php @@ -29,7 +29,7 @@ AccessLogger::logRequest(); - + diff --git a/allianz.php b/allianz.php index d00ba1fa..803ade0f 100644 --- a/allianz.php +++ b/allianz.php @@ -120,7 +120,7 @@ if(isset($_GET['aid']) or isset($_GET['fid']) or isset($_GET['fid2']) or $sessio echo GP_LOCATE; -?>lang/en/compact.css?f4b7g" rel="stylesheet" type="text/css" /> +?>lang/en/compact.css?f4b7h" rel="stylesheet" type="text/css" /> gpack == null || GP_ENABLE == false) { diff --git a/anmelden.php b/anmelden.php index 8d672ac1..1b714ff4 100644 --- a/anmelden.php +++ b/anmelden.php @@ -35,7 +35,7 @@ $invited=(isset($_GET['uid'])) ? filter_var($_GET['uid'], FILTER_SANITIZE_NUMBER - + diff --git a/banned.php b/banned.php index 7ec31782..192f3ccc 100644 --- a/banned.php +++ b/banned.php @@ -31,7 +31,7 @@ if($session->access == BANNED){ - + gpack == null || GP_ENABLE == false) { diff --git a/berichte.php b/berichte.php index 46fcf6a5..855c0b7c 100644 --- a/berichte.php +++ b/berichte.php @@ -50,7 +50,7 @@ if(isset($_GET['newdid'])) { - + gpack == null || GP_ENABLE == false) { echo " diff --git a/build.php b/build.php index 29e19289..59bc0b9a 100644 --- a/build.php +++ b/build.php @@ -332,7 +332,7 @@ if ( isset( $_GET['id'] ) ) { - + gpack == null || GP_ENABLE == false) { echo " @@ -402,7 +402,7 @@ if(isset($_GET['id']) or isset($_GET['gid']) or $route == 1 or isset($_GET['rout $building->finishAll("build.php?gid=".$_GET['id']."&ty=".$_GET['ty']); exit; } - } + } } }else{ header("Location: ".$_SERVER['PHP_SELF']."?id=39"); diff --git a/create_account.php b/create_account.php index 598a30e9..a4879b3e 100644 --- a/create_account.php +++ b/create_account.php @@ -61,7 +61,7 @@ AccessLogger::logRequest(); - + gpack == null || GP_ENABLE == false) { diff --git a/crop_finder.php b/crop_finder.php index e3a4fbc0..a755e077 100644 --- a/crop_finder.php +++ b/crop_finder.php @@ -58,7 +58,7 @@ $start_timer = $generator->pageLoadTimeStart(); echo GP_LOCATE; -?>lang/en/compact.css?f4b7g" rel="stylesheet" type="text/css" /> +?>lang/en/compact.css?f4b7h" rel="stylesheet" type="text/css" /> gpack == null || GP_ENABLE == false) { diff --git a/dorf1.php b/dorf1.php index c292b8a3..edf13c5c 100644 --- a/dorf1.php +++ b/dorf1.php @@ -41,7 +41,7 @@ if(isset($_GET['newdid'])) { - + gpack == null || GP_ENABLE == false) { diff --git a/dorf2.php b/dorf2.php index 99f9d3df..eac1fdff 100644 --- a/dorf2.php +++ b/dorf2.php @@ -18,7 +18,7 @@ AccessLogger::logRequest(); if(isset($_GET['newdid'])) { $_SESSION['wid'] = $_GET['newdid']; - $database->query("UPDATE ".TB_PREFIX."users SET village_select=".$database->escape((int) $_GET['newdid'])." WHERE id=".$session->uid); + $database->query("UPDATE ".TB_PREFIX."users SET village_select=".$database->escape((int) $_GET['newdid'])." WHERE id=".$session->uid); header("Location: ".$_SERVER['PHP_SELF']); exit; }else{ @@ -42,7 +42,7 @@ $automation->isWinner(); - + gpack == null || GP_ENABLE == false) { echo " diff --git a/dorf3.php b/dorf3.php index f84b3d44..40a7b781 100644 --- a/dorf3.php +++ b/dorf3.php @@ -45,7 +45,7 @@ if(isset($_GET['newdid'])) { - + gpack == null || GP_ENABLE == false) { echo " diff --git a/gpack/travian_default/img/g/s/glvlm.gif b/gpack/travian_default/img/g/s/glvlm.gif index 6dec584226b06bc246ed6e3738262365945541cc..e8ef604d237d913687a33731c96f81d331360840 100644 GIT binary patch literal 1491 zcmW;HYgChU9KiAao?Y1XY;)kC34+h&7!Pd4E7&y($^g_{ zg%<`vbqUhHg|~izjPGH42p0SdFOC8A8|ZI<={A^eLH-}G|@Z@Wl{sE>(;86e``r&~erhIUJ0H*q3Dgb}^Anb$5ui*D{aN`U3?HpV?2g9cz zcp5IB0`F-6K>sIs#GoPcB2xaR|DF&Fs1`%XD!wUjBXWIg+R`Hj3kR#UZOcpU52hVI zp-@h8cP$+l__4UBy6F|wgN=*Uo^3Rn#H}Oso#lBIxhu)#sfl>@T1WlbSLE6FT5`Tv zil^V$Z@ywaY{NZ|D3OGv(w$ZnR9a z*)cw(<3~I(Oq!iE9fsSMgd9TCHGHO27*^>9FVMLKD|CjCm&S}6yKv1VW(MA6$zsif zdcx1Io6mm!rN?HxU)sj~_>^QiE6F2+k{$R4^RKEXcaX0?uR z)r~SLZ2dcI*Qr`YTuY6`s0|1hj8;!(IEyaoAd7Yw!rDu}o{lxN%rl|8dP(Yv@KS@% z&yC}vZcj}`0P`DSWM>Xb^XLhB>1#h4uJ5@MotR-R@#(jH$2T46H<*x*uO}BJ1yN!p zFB%ixQu(!dyC9{|xR|KL_KK1-YC?{3FAH&5-C@DAgbL9dS+)DJltQ8=p*Z+HR=4MV zfhFV~^U?5u`@gJw-ISSOv|;=E0vP*tDSCM)4+)u)f5tap5i&nP2^50}e&!NJPuZrU z9mr>{vXSNM8zk0RE>C8lTcS^hHSCm{172*YXPZ|cpB*a3uD5utSZi-)E+>toD9)={ zkGi8$-PSp)Nq1zBKf7=J@77X=)0Sg9@5FYOnuS_EN5+1gJ6CPCGuSnah<$^7rN7xw z{`-*c1ij(=i4bKszO1?j@XyZ65*6p$j*t%#OCxd9YU`tv7g{dtSc;(;i zv4>W@-D*kXl~#x-qN+hftfrMXHLP^Ol|6f6bWW^oL9j~OelSvn@#PGnQ(P4~t!3(3 zg)^!)wyU~kB`wLz?eZiHbs>Sns$s95H&aECJ#-EW_v1w)sgBaToQ9Uc4E*ci*V^OT+bxEcCL1uTPxhL^@nr z@zy(+4IjZj*8!X3=uCYN$c}eD*!Ai{vV@M-|!!!;9b{dezwiYn}80$o7hiUDLh9(i4rI#gP z$_WDoqg;C0jW~Yk05Qc9Cfub5td?}@tQ#8hTr2TgyZKFH-(IC1hNbxqf_Ocuk=S=u z%yS)f+Yo~r8ERozQ^rt6mi=H|*KAq(Sz_9@Il$5=0JAKK$z@_dPf>0d9#>E}!cr*V zMoiOc`|c{`{Of4|)MvoVGcGgyUQQDR`&R!CtCqo0d~Xu4MutRbYMgYuqa4$;Tfh9N z3xN5xW%cNQWb{=j05h};qa7%qb(XI^3_d}-;aRMYrZDLL{%rvP!S#Tk8Yp@nyZ?zK zZztsE6PzwZoTdukiMR0N%g7-O1gSs^;*_p{t@5Mf)`ciuE(XsLwa7bm1N(NS21A mr^)28YxcBnCtE-~_`on*LugKlp|H%Ub`TzUG-Px_++^_%t)5F1}C@AXF(5V*}^fyl8z`mk|hpj_R+9M;Q zU1`VxCgqr#r1$l}007(j_rSKbqT}DN>*%)u0qkID#Q_2KjgP6QsH6V)!TtEa$i<}q z0MQ>Y@%i|~Fg@lHCiqNK(+fKI2nhK9|IGmb@sN_Jv$CQB9r^qC#Q*%n{`tcH{>T6S z%l-JlEC2ui0IC2C000L6z@Jdq01SV{+Qpj{deX8lNdVKgET0m2Hh4QB2 zVc{xOt{RQsyGEx2R?4(c4ApMOe^6OUWkXjzQ#=g;5MYXoV1y6>U_B%T3jraKh7kc$ zJq!va2tH>=J`e;Srw<<)44h;m9uGVZEFLH*9s_M;o>Bz`0Sg&FzeJt@00=kF9*oJU zls^Ch1{?%Ngq}PqmKhuvrl>3?CgeXp6($N0fImAD85;-<^Y!*vA=S`gLB*FD19mu3km4X89yY*$(ZYZP3@u<- zXaND_g98#bU}%80h1#M&c=Slop@j=3FiQAH0AYiOCUObXjRECnj|2)p@Q@O?u7w_F zd=PN^Q3wwJf?Lq=0pI`#77{oQvKGKGlmIPABpA`5f|1LaEi~Xk8$bgK767!tEYyXV ztUnSE*g(QjkJ2qHK&h!C0fr3`5IqRd!bAcI23mx0ph1EJ3otyDzz!<3 z5I_^Iq!5b_DUj6yIaq!x{yV08(6BCg{ZkG1wCi z4-)w2g#|JQ(87b3Nx%VxKA^C{NG)7Yjt~Wu2?Y%noKV64j0s* zMY>SDn}81kU|i9}DkLxgZl$F#W-1*xAV4ZDV2C7+W4d}C!m=*x<_j*^pxPINOx%Mz z02P2JDjQRP+YB4fK){&mJnO7i%z$7(%TQc^=K~<*D+JB60YHLZvl=q74<{^;fEacU zEguFGaO&xU4uPP7521Ykf(PCyPy*Zqw~%G%SrW3qKOAjtU;5P_%Y!3bzj7D5={0?Ysa2N;+G3=!ghy755(fTE5gG~j}9n2QBgkPJgy z5C9L@!2(NQgZz9Dfd$}!35fj%S zfDwp_iCEOa8V+E^c=*8w9~i+pvWN#fWYG&%9OD#yKmswrO^QE=BDw(dyC47nJL{}t AD*ylh literal 0 HcmV?d00001 diff --git a/gpack/travian_default/img/g/s/lvl1_10_active.gif b/gpack/travian_default/img/g/s/lvl1_10_active.gif new file mode 100644 index 0000000000000000000000000000000000000000..79cab4aa4f5e10c9ab4a8fde471ba13a2749a490 GIT binary patch literal 1197 zcmV;e1XBA)Nk%w1VX6QO0M!5h|FXLOue<-Kz5k@Y|DeMEl*s>)%J>72`VO1>7N!4( z(fuE@|AN*2B)b28*#9TM|9#p2Fv|aV+y8am|99R0apM0v*#B6>i=oz z|4ixsTkQW|>;F^j|5xt+{K^0P%K!Y#|NPDW`^W$M(Et3@|NPqj`o{nG#Q*oi|MbEC z^~3-5#Q*fd|MbKE@WKD=zyIgG|J=O)*SG)Fw*S$%|ID`k$hiN+w*SDk|Ns9000000 z00000A^8LW002AyEC2ui0IC2C000L6z?X0+Oo@m{qKd>+C6h~1sP%ldM5XGGRbn=^ z!d8fx0>8RmsaZ8@JI$;1Xaz2fhU~VvL}Rq5S}8LS9TYQVfie^w1uArAEhP>)E?_D; z3=Wz!k5(Z99ThYoS}Hr54h#waZ%-;P3?2|MtxqX2gpHj@B{&LnDl!v{Sydu377LDn zGZ7CR4-bb`!4VA~2_I8tCJF}%M_MEw2o2@|q@EfG9}x>Qh)E(4=H>?-BvmUe7}*OJ zE_Q8E5yOH%4k-k_7(wGfgb@Utk=t-5Ns0mw5JXs^a0m$s2WFgjkzhlzU% zsD!6wg@_0mlHyFVVnza01y;e5yAo= zyy&0{3q)|iIv5Zzq!275M#l*pSU}|q<17$D3MN>9fr;X@)1DS1c(8yR5hz&&3nNr# z0Rt8&>Q#XwL<$i}4%}&FgjHMtLIMDsAcBWOgrEQiA&e0L2WGAi!v`2xV8HZFJBZ4G6U6>jcUu z_ksxCWI%uc28341MF<33M*~O%>^Q^~BA6gT0wsdiE(A1y6~LP>q`++lGxTGus{V2hYHS+o} literal 0 HcmV?d00001 diff --git a/gpack/travian_default/img/g/s/lvl21_30_active.gif b/gpack/travian_default/img/g/s/lvl21_30_active.gif new file mode 100644 index 0000000000000000000000000000000000000000..f9a06d9f179af220d59b749cfe5f40c673d87564 GIT binary patch literal 930 zcmV;T16}+_Nk%w1VX6QO0M!5h|FgRPr@jBA!vCMb|DePFn#KQ=$p4VZ_ydsti_Q8B zn)?%^|A*218LRyuwEZNy{Uy8qfY<*g!2c}8|9jd0F2?^e&i{Aa|2ftFbKw6u+5d0j z|32UUY~}xA>i=lz|4HcoOzHnz>;GWt|4{7zSMUG)$^ZPz|NPDW`^NwL)BpU{|M|uL z`o{nG#Q*oi|MkQF^uqt~!T<8X|M9~A@4^4XJ$pw!AEnXb-pd!Qt4;I?Jpm87v z3ls+wIV&cXG2sK^haDaivkt{bVJTP^H0pAQph2Ut6)Izfn z6S>UJ7-NK_7$6!*9{x>a2g^oJXl~_d2k9G7OaN$5n#Gb6I{MyFa^lpA4GL_W9xTBE z(&HmKSZL6p%8v3<7a`a|ygnxwCqyg&pyGs^7|Ny8iV1{~;Dia%Eil3gPqdOk4-JrT zf+4;DG=J7{J33`K>aC z3pGH{009OZK)_oQ04XF5F!1<50|gXtKmj&9pn(n$f?$*c4GdrvWJnyg1eRJR02wqm zaQNbxVBj~31P-)$0e2UK5LOH<>;S<8ZIWidoq1wV16@5lAm{^q*`R|4gpwd0iP6EnL4y#Zl4@!dGyFBfsx#=7Lk`_(g+q&*)*1u= EI}$#n00000 literal 0 HcmV?d00001 diff --git a/gpack/travian_default/lang/en/b/zurueck.html b/gpack/travian_default/lang/en/b/zurueck.html index 1b0dc904..01abebcc 100644 --- a/gpack/travian_default/lang/en/b/zurueck.html +++ b/gpack/travian_default/lang/en/b/zurueck.html @@ -10,10 +10,10 @@ - - - - + + + + @@ -42,13 +42,13 @@
Nothing here!

Nothing here!

We looked 404 times already but can't find anything
- +
newsbox 1


- +
newsbox 2
Dear players, @@ -81,7 +81,7 @@ Tschena & Phanttis
- access == MULTIHUNTER || $session->access == ADMIN) && ADMIN_RECEIVE_SUPPORT_MESSAGES); - + for($i=(1+$s);$i<=(10+$s);$i++) { if(count($message->sent1) >= $i) { if($message->sent1[$i-1]['target'] == 0) { @@ -68,7 +68,7 @@ echo ""; } echo " - @@ -189,7 +189,7 @@ $actionType = "Raid"; - + @@ -208,7 +208,7 @@ $actionType = "Raid"; - + @@ -225,13 +225,13 @@ $actionType = "Raid"; - + - + getTypeLevel(16) >= 10) { ?> @@ -243,7 +243,7 @@ $actionType = "Raid"; - + @@ -262,7 +262,7 @@ $actionType = "Raid"; - + @@ -279,13 +279,13 @@ $actionType = "Raid"; - + - + getTypeLevel(16) >= 10) { ?> @@ -297,7 +297,7 @@ $actionType = "Raid"; - + @@ -308,16 +308,16 @@ $actionType = "Raid"; (will be attacked by catapult(s)) - + ?> @@ -337,7 +337,7 @@ $actionType = "Raid"; - + - + @@ -427,18 +427,18 @@ $actionType = "Raid";
".round($row['loyalty'])."% $type
sent1) < 10) { echo "«»"; } @@ -49,7 +49,7 @@ } ?>
".((!$support_messages || ($support_messages && $message->inbox1[$i-1]['target'] != 1)) ? "sent1[$i-1]['id']."\" />" : 'S')."sent1[$i-1]['id']."\">".$message->sent1[$i-1]['topic']." "; + sent1[$i-1]['id']."\">".$message->sent1[$i-1]['topic']." "; if($message->sent1[$i-1]['viewed'] == 0) { echo "(unread)"; } diff --git a/nachrichten.php b/nachrichten.php index 9ea0a66a..49c51ba2 100644 --- a/nachrichten.php +++ b/nachrichten.php @@ -120,7 +120,7 @@ if ( isset( $_GET['confirm'] ) && is_numeric( $_GET['confirm'] ) ) {
loadMessage($_GET['id']); include("Templates/Message/read.tpl"); } @@ -128,7 +128,7 @@ else if(isset($_GET['t'])) { switch($_GET['t']) { case 1: if(isset($_GET['id'])) { - $id = preg_replace("/[^a-zA-Z0-9_-]/","",$_GET['id']); + $id = preg_replace("/[^a-zA-Z0-9_-]/","",$_GET['id']); } include("Templates/Message/write.tpl"); break; From 6b7424fffb85f2d33ddda1b3946b2f083405311e Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Wed, 22 Nov 2017 16:01:12 +0100 Subject: [PATCH 015/126] fix: incoming units not shown at rally point --- GameEngine/Database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 80213c37..9f89ba27 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -5331,7 +5331,7 @@ References: User ID/Message ID, Mode $q = "SELECT * FROM " . TB_PREFIX . "movement, " . TB_PREFIX . "attacks where " . TB_PREFIX . "movement.`" . $where . "` IN(".implode(', ', $village).") and " . TB_PREFIX . "movement.ref = " . TB_PREFIX . "attacks.id and " . TB_PREFIX . "movement.proc = 0 and " . TB_PREFIX . "movement.sort_type = 3 and " . TB_PREFIX . "attacks.attack_type = 1 ORDER BY endtime ASC"; break; case 34: - $q = "SELECT * FROM " . TB_PREFIX . "movement, " . TB_PREFIX . "attacks where " . TB_PREFIX . "movement.`" . $where . "` IN(".implode(', ', $village).") and " . TB_PREFIX . "movement.ref = " . TB_PREFIX . "attacks.id and " . TB_PREFIX . "movement.proc = 0 and " . TB_PREFIX . "movement.sort_type = 3 or " . TB_PREFIX . "movement.`" . $where . "` = IN(".implode(', ', $village).") and " . TB_PREFIX . "movement.ref = " . TB_PREFIX . "attacks.id and " . TB_PREFIX . "movement.proc = 0 and " . TB_PREFIX . "movement.sort_type = 4 ORDER BY endtime ASC"; + $q = "SELECT * FROM " . TB_PREFIX . "movement, " . TB_PREFIX . "attacks where " . TB_PREFIX . "movement.`" . $where . "` IN(".implode(', ', $village).") and " . TB_PREFIX . "movement.ref = " . TB_PREFIX . "attacks.id and " . TB_PREFIX . "movement.proc = 0 and " . TB_PREFIX . "movement.sort_type = 3 or " . TB_PREFIX . "movement.`" . $where . "` IN(".implode(', ', $village).") and " . TB_PREFIX . "movement.ref = " . TB_PREFIX . "attacks.id and " . TB_PREFIX . "movement.proc = 0 and " . TB_PREFIX . "movement.sort_type = 4 ORDER BY endtime ASC"; break; default: return null; From e331ae2b1fcc759065d35613a0e429c39dd54f77 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Wed, 22 Nov 2017 16:08:23 +0100 Subject: [PATCH 016/126] fix: accidentally replaced gif & fix for one encoding difficulty --- Templates/Manual/433.tpl | 4 ++-- gpack/travian_default/img/g/s/glvlm.gif | Bin 1491 -> 1048 bytes 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Templates/Manual/433.tpl b/Templates/Manual/433.tpl index 9143c221..8542071e 100644 --- a/Templates/Manual/433.tpl +++ b/Templates/Manual/433.tpl @@ -1,6 +1,6 @@ -

Brewery

BreweryTasty mead is brewed in the brewery and later quaffed by the soldiers during the celebrations. +

Brewery

BreweryTasty mead is brewed in the brewery and later quaffed by the soldiers during the celebrations.

-These drinks make your soldiers braver and stronger in battles (1% per level). Unfortunately the chiefs� power of persuasion is decreased and catapults can only do random hits. +These drinks make your soldiers braver and stronger in battles (1% per level). Unfortunately the chiefs' power of persuasion is decreased and catapults can only do random hits.

It can only be built by Teutons and only in their capital. It affects the whole empire.

Costs and construction time for level 1:
Lumber1460 | Clay930 | Iron1250 | Crop1740 | Crop consumption6 | duration2:13:20

Prerequisites
Granary Level 20, Rally Point Level 10

diff --git a/gpack/travian_default/img/g/s/glvlm.gif b/gpack/travian_default/img/g/s/glvlm.gif index e8ef604d237d913687a33731c96f81d331360840..6dec584226b06bc246ed6e3738262365945541cc 100644 GIT binary patch literal 1048 zcmeH`YfDpc0EdrrHm^)e1k1viR*+ayg5n!fGku{@6j_#S=|Jd0zAzOW&U=bB1)CE| zC+Qr`yk@PL?wsu$FSDtYNNA+aHZO}H+vVK<<(KGHzc27SJn*}ekrtmIItT?p?ivUH z@U$+6ArQhbVc%K3b2+N1HispVSxnVbdsDA%P$?f{NcYd(QPMeS!qhAQWBP8EFtjy` zcehteQ+?9XOuMzex2s6roWK0>IjZj*8!X3=uCYN$c}eD*!Ai{vV@M-|!!!;9b{dezwiYn}80$o7hiUDLh9(i4rI#gP z$_WDoqg;C0jW~Yk05Qc9Cfub5td?}@tQ#8hTr2TgyZKFH-(IC1hNbxqf_Ocuk=S=u z%yS)f+Yo~r8ERozQ^rt6mi=H|*KAq(Sz_9@Il$5=0JAKK$z@_dPf>0d9#>E}!cr*V zMoiOc`|c{`{Of4|)MvoVGcGgyUQQDR`&R!CtCqo0d~Xu4MutRbYMgYuqa4$;Tfh9N z3xN5xW%cNQWb{=j05h};qa7%qb(XI^3_d}-;aRMYrZDLL{%rvP!S#Tk8Yp@nyZ?zK zZztsE6PzwZoTdukiMR0N%g7-O1gSs^;*_p{t@5Mf)`ciuE(XsLwa7bm1N(NS21A mr^)28E7&y($^g_{ zg%<`vbqUhHg|~izjPGH42p0SdFOC8A8|ZI<={A^eLH-}G|@Z@Wl{sE>(;86e``r&~erhIUJ0H*q3Dgb}^Anb$5ui*D{aN`U3?HpV?2g9cz zcp5IB0`F-6K>sIs#GoPcB2xaR|DF&Fs1`%XD!wUjBXWIg+R`Hj3kR#UZOcpU52hVI zp-@h8cP$+l__4UBy6F|wgN=*Uo^3Rn#H}Oso#lBIxhu)#sfl>@T1WlbSLE6FT5`Tv zil^V$Z@ywaY{NZ|D3OGv(w$ZnR9a z*)cw(<3~I(Oq!iE9fsSMgd9TCHGHO27*^>9FVMLKD|CjCm&S}6yKv1VW(MA6$zsif zdcx1Io6mm!rN?HxU)sj~_>^QiE6F2+k{$R4^RKEXcaX0?uR z)r~SLZ2dcI*Qr`YTuY6`s0|1hj8;!(IEyaoAd7Yw!rDu}o{lxN%rl|8dP(Yv@KS@% z&yC}vZcj}`0P`DSWM>Xb^XLhB>1#h4uJ5@MotR-R@#(jH$2T46H<*x*uO}BJ1yN!p zFB%ixQu(!dyC9{|xR|KL_KK1-YC?{3FAH&5-C@DAgbL9dS+)DJltQ8=p*Z+HR=4MV zfhFV~^U?5u`@gJw-ISSOv|;=E0vP*tDSCM)4+)u)f5tap5i&nP2^50}e&!NJPuZrU z9mr>{vXSNM8zk0RE>C8lTcS^hHSCm{172*YXPZ|cpB*a3uD5utSZi-)E+>toD9)={ zkGi8$-PSp)Nq1zBKf7=J@77X=)0Sg9@5FYOnuS_EN5+1gJ6CPCGuSnah<$^7rN7xw z{`-*c1ij(=i4bKszO1?j@XyZ65*6p$j*t%#OCxd9YU`tv7g{dtSc;(;i zv4>W@-D*kXl~#x-qN+hftfrMXHLP^Ol|6f6bWW^oL9j~OelSvn@#PGnQ(P4~t!3(3 zg)^!)wyU~kB`wLz?eZiHbs>Sns$s95H&aECJ#-EW_v1w)sgBaToQ9Uc4E*ci*V^OT+bxEcCL1uTPxhL^@nr z@zy(+4 Date: Wed, 22 Nov 2017 16:29:25 +0100 Subject: [PATCH 017/126] fix: resources falling to 0 will auto-fill warehouse/crop to max value --- GameEngine/Database.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 9f89ba27..86df23bc 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -3287,15 +3287,17 @@ class MYSQLi_DB implements IDbConnection { list($vid, $wood, $clay, $iron, $crop, $mode) = $this->escape_input((int) $vid, (int) $wood, (int) $clay, (int) $iron, (int) $crop, $mode); $sign = (!$mode ? '-' : '+'); - return mysqli_query( $this->dblink, " + $q = " UPDATE " . TB_PREFIX . "vdata SET - wood = IF(wood $sign $wood > 0 AND wood $sign $wood < maxstore, wood $sign $wood, ".($mode ? 'maxstore' : '0')."), - clay = IF(clay $sign $clay > 0 AND clay $sign $clay < maxstore, clay $sign $clay, ".($mode ? 'maxstore' : '0')."), - iron = IF(iron $sign $iron > 0 AND iron $sign $iron < maxstore, iron $sign $iron, ".($mode ? 'maxstore' : '0')."), - crop = IF(crop $sign $crop > 0 AND crop $sign $crop < maxcrop, crop $sign $crop, ".($mode ? 'maxcrop' : '0').") + wood = IF(wood $sign $wood < 0, 0, IF(wood $sign $wood > maxstore, maxstore, $sign $wood)), + clay = IF(clay $sign $clay < 0, 0, IF(clay $sign $clay > maxstore, maxstore, $sign $clay)), + iron = IF(iron $sign $iron < 0, 0, IF(iron $sign $iron > maxstore, maxstore, iron $sign $iron)), + crop = IF(crop $sign $crop < 0, 0, IF(crop $sign $crop > maxcrop, maxcrop, crop $sign $crop)) WHERE - wref = " . $vid ); + wref = " . $vid ; + + return mysqli_query( $this->dblink, $q); } function setMaxStoreForVillage($vid, $maxLevel) { From 5492ad29b2f73ed18d00dddc089ff593e4970017 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Wed, 22 Nov 2017 16:52:25 +0100 Subject: [PATCH 018/126] fix: incorrect resources SQL --- GameEngine/Database.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 86df23bc..798577b9 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -3290,8 +3290,8 @@ class MYSQLi_DB implements IDbConnection { $q = " UPDATE " . TB_PREFIX . "vdata SET - wood = IF(wood $sign $wood < 0, 0, IF(wood $sign $wood > maxstore, maxstore, $sign $wood)), - clay = IF(clay $sign $clay < 0, 0, IF(clay $sign $clay > maxstore, maxstore, $sign $clay)), + wood = IF(wood $sign $wood < 0, 0, IF(wood $sign $wood > maxstore, maxstore, wood $sign $wood)), + clay = IF(clay $sign $clay < 0, 0, IF(clay $sign $clay > maxstore, maxstore, clay $sign $clay)), iron = IF(iron $sign $iron < 0, 0, IF(iron $sign $iron > maxstore, maxstore, iron $sign $iron)), crop = IF(crop $sign $crop < 0, 0, IF(crop $sign $crop > maxcrop, maxcrop, crop $sign $crop)) WHERE From f390388de9b4c1ad254d8a6b918ae64a27ea3ed9 Mon Sep 17 00:00:00 2001 From: phaze1G Date: Wed, 22 Nov 2017 18:24:34 +0100 Subject: [PATCH 019/126] Serbian Language - Not completed yet (#370) * Srpski jezik * Serbian Language / Not finished yet. --- GameEngine/Lang/rs.php | 1268 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1268 insertions(+) create mode 100644 GameEngine/Lang/rs.php diff --git a/GameEngine/Lang/rs.php b/GameEngine/Lang/rs.php new file mode 100644 index 00000000..18bc7495 --- /dev/null +++ b/GameEngine/Lang/rs.php @@ -0,0 +1,1268 @@ +Plus"); +define("CONTACT","Kontaktirajte nas!"); +define("GAME_RULES","Pravila Igre"); + +//MENU +define("REG","Registruj se"); +define("FORUM","Forum"); +define("CHAT","ÄŒet"); +define("IMPRINT","Imprint"); +define("MORE_LINKS","ViÅ¡e linkova"); +define("TOUR","Game Tour"); + + +//ERRORS +define("USRNM_EMPTY","(KorisniÄko ime je prazno!)"); +define("USRNM_TAKEN","(Ime je već iskorišćeno.)"); +define("USRNM_SHORT","(min. ".USRNM_MIN_LENGTH." slova/brojki)"); +define("USRNM_CHAR","(Karakteri nisu validni)"); +define("PW_EMPTY","(Å ifra je prazna)"); +define("PW_SHORT","(min. ".PW_MIN_LENGTH." slova/brojki)"); +define("PW_INSECURE","(Å ifra je nedovoljno jaka. Molimo Vas izaberite sigurniju Å¡ifru.)"); +define("EMAIL_EMPTY","(Email je prazan)"); +define("EMAIL_INVALID","(Email nije validan)"); +define("EMAIL_TAKEN","(Email je iskorišćen)"); +define("TRIBE_EMPTY","
  • Izaberite pleme.
  • "); +define("AGREE_ERROR","
  • Morate se složiti sa pravilima igre i opÅ¡tim uslovima kako bi se registrovali.
  • "); +define("LOGIN_USR_EMPTY","Unesite ime."); +define("LOGIN_PASS_EMPTY","Unesite Å¡ifru."); +define("EMAIL_ERROR","Email adresa ne postoji"); +define("PASS_MISMATCH","Å ifra se ne slaže"); +define("ALLI_OWNER","Please appoint an alliance owner before deleting"); +define("SIT_ERROR","Sitter already set"); +define("USR_NT_FOUND","Ime ne postoji."); +define("LOGIN_PW_ERROR","Å ifra je pogreÅ¡na."); +define("WEL_TOPIC","Korisni saveti & Informacije "); +define("ATAG_EMPTY","Tag je prazan"); +define("ANAME_EMPTY","Ime je prazno"); +define("ATAG_EXIST","Tag je zauzet"); +define("ANAME_EXIST","Ime je zauzeto"); +define("NOT_OPENED_YET","Server not started yet."); +define("REGISTER_CLOSED","The register is closed. You can't register to this server."); +define("NAME_EMPTY","Molimo Vas unesite ime"); +define("NAME_NO_EXIST","Ne postoji korisnik sa tim imenom. "); +define("ID_NO_EXIST","There is no user with the id "); +define("SAME_NAME","Ne možete poslati pozivnicu sami sebi!"); +define("ALREADY_INVITED"," je već pozvan"); +define("ALREADY_IN_ALLY"," je već u alijensi"); + +//COPYRIGHT +define("TRAVIAN_COPYRIGHT","TravianZ Open Source projekat."); + +//BUILD.TPL +define("CUR_PROD","Trenutna proizvodnja"); +define("NEXT_PROD","Proizvodnja na nivou"); + +//BUILDINGS +define("B1","Woodcutter"); +define("B1_DESC","The Woodcutter cuts down trees in order to produce lumber. The further you extend the woodcutter the more lumber is produced by him."); +define("B2","Clay Pit"); +define("B2_DESC","Clay is produced here. By increasing its level you increase its clay production."); +define("B3","Iron Mine"); +define("B3_DESC","Here miners produce the precious resource iron. By increasing the mine`s level you increase its iron production."); +define("B4","Cropland"); +define("B4_DESC","Your population`s food is produced here. By increasing the farm`s level you increase its crop production."); + +//DORF1 +define("LUMBER","Drvo"); +define("CLAY","Glina"); +define("IRON","Gvožđe"); +define("CROP","Žito"); +define("LEVEL","Level"); +define("CROP_COM",CROP." potroÅ¡nja"); +define("PER_HR","po satu"); +define("PROD_HEADER","Proizvodnja"); +define("MULTI_V_HEADER","Sela"); +define("ANNOUNCEMENT","ObaveÅ¡tenje"); +define("GO2MY_VILLAGE","Idi u moje selo"); +define("VILLAGE_CENTER","Centar sela"); +define("FINISH_GOLD","ZavrÅ¡ite sve graÄ‘evinske i istraživaÄke zadatke u ovom selu odmah za 2 zlata?"); +define("WAITING_LOOP","(waiting loop)"); +define("HRS","(sati.)"); +define("DONE_AT","zavrÅ¡eno za"); +define("CANCEL","obustavi"); +define("LOYALTY","Lojalnost"); +define("CALCULATED_IN","ZavrÅ¡eno za"); +define("SEVER_TIME","Vreme servera:"); +define("HI","HI"); + +//QUEST +define("Q_CONTINUE","Nastavite sa sledecÌim zadatkom."); +define("Q_REWARD","VaÅ¡a nagrada:"); +define("Q_BUTN","zavrÅ¡i zadatak"); +define("Q0","DobrodoÅ¡li u "); +define("Q0_DESC","Kao Å¡to vidim postali ste poglavica ovog sela. Ja cÌu biti vaÅ¡ savetnik prvih nekoliko dana i nikada ne napuÅ¡tajte svoju (desnu ruku) stranu."); +define("Q0_OPT1","Na prvi zadatak."); +define("Q0_OPT2","Pogledajte sami oko Vas."); +define("Q0_OPT3","Ne igrajte nikakve zadatke."); + +define("Q1","Zadatak 1: DrvoseÄa"); +define("Q1_DESC","Oko vaÅ¡eg sela postoje Äetiri zelene Å¡ume. Izradite drvored na jednom od njih. Drvo je važan resurs za naÅ¡e novo naselje."); +define("Q1_ORDER","Zadatak:<\/p>Izgradite skloniÅ¡te."); +define("Q1_RESP","Da, na taj naÄin dobijate viÅ¡e od drveta. Pomogao sam malo i zavrÅ¡io sam odmah."); +define("Q1_REWARD","SkloniÅ¡te odmah zavrÅ¡eno."); + +define("Q2","Task 2: Crop"); +define("Q2_DESC","Now your subjects are hungry from working all day. Extend a cropland to improve your subjects' supply. Come back here once the building is complete."); +define("Q2_ORDER","Order:<\/p>Extend one cropland."); +define("Q2_RESP","Very good. Now your subjects have enough to eat again..."); +define("Q2_REWARD","Your reward:<\/p>1 day Travian"); + +define("Q3","Task 3: Your Village's Name"); +define("Q3_DESC","Creative as you are you can grant your village the ultimate name.

    Click on 'profile' in the left hand menu and then select 'change profile'..."); +define("Q3_ORDER","Order:<\/p>Change your village's name to something nice."); +define("Q3_RESP","Wow, a great name for their village. It could have been the name of my village!..."); + +define("Q4","Task 4: Other Players"); +define("Q4_DESC","In ". SERVER_NAME ." you play along with billions of other players. Click 'statistics' in the top menu to look up your rank and enter it here."); +define("Q4_ORDER","Order:<\/p>Look for your rank in the statistics and enter it here."); +define("Q4_BUTN","complete task"); +define("Q4_RESP","Exactly! That's your rank."); + +define("Q5","Task 5: Two Building Orders"); +define("Q5_DESC","Build an iron mine and a clay pit. Of iron and clay one can never have enough."); +define("Q5_ORDER","Order:<\/p>
    • Extend one iron mine.<\/li>
    • Extend one clay pit.<\/li><\/ul>"); +define("Q5_RESP","As you noticed, building orders take rather long. The world of ". SERVER_NAME ." will continue to spin even if you are offline. Even in a few months there will be many new things for you to discover.

      The best thing to do is occasionally checking your village and giving you subjects new tasks to do."); + +define("Q6","Task 6: Messages"); +define("Q6_DESC","You can talk to other players using the messaging system. I sent a message to you. Read it and come back here.

      P.S. Don't forget: on the left the reports, on the right the messages."); +define("Q6_ORDER","Order:<\/p>Read your new message."); +define("Q6_RESP","You received it? Very good.

      Here is some Gold. With Gold you can do several things, e.g. extend your in the left hand menu."); +define("Q6_RESP1","-Account or increase your resource production.To do so click "); +define("Q6_RESP2","in the left hand menu."); +define("Q6_SUBJECT","Message From The Taskmaster"); +define("Q6_MESSAGE","You are to be informed that a nice reward is waiting for you at the taskmaster.

      Hint: The message has been generated automatically. An answer is not necessary."); + +define("Q7","Task 7: One Each!"); +define("Q7_DESC","Now we should increase your resource production a bit. Build an additional woodcutter, clay pit, iron mine and cropland to level 1."); +define("Q7_ORDER","Order:<\/p>Extend one more of each resource tile to level 1."); +define("Q7_RESP","Very good, great develop of resources production."); + +define("Q8","Task 8: Huge Army!"); +define("Q8_DESC","Now I've got a very special quest for you. I am hungry. Give me 200 crop!

      In return I will try to organize a huge army to protect your village."); +define("Q8_ORDER","Order:<\/p>Send 200 crop to the taskmaster."); +define("Q8_BUTN","Send crop"); +define("Q8_NOCROP","No Enough Crop!"); + +define("Q9","Task 9: Everything to 1."); +define("Q9_DESC","In Travian there is always something to do! While you are waiting for incoming the huge army, Now we should increase your resource production a bit. Extend all your resource tiles to level 1."); +define("Q9_ORDER","Order:<\/p>Extend all resource tiles to level 1."); +define("Q9_RESP","Very good, your resource production just thrives.

      Soon we can start with constructing buildings in the village."); + +define("Q10","Task 10: Dove of Peace"); +define("Q10_DESC","The first days after signing up you are protected against attacks by your fellow players. You can see how long this protection lasts by adding the code [#0]<\/b> to your profile."); +define("Q10_ORDER","Order:<\/p>Write the code [#0]<\/b> into your profile by adding it to one of the two description fields."); +define("Q10_RESP","Well done! Now everyone can see what a great warrior the world is approached by."); +define("Q10_REWARD","Your reward:<\/p>2 day Travian"); + +define("Q11","Task 11: Neighbours!"); +define("Q11_DESC","Around you, there are many different villages. One of them is named. "); +define("Q11_DESC1"," Click on 'map' in the header menu and look for that village. The name of your neighbours' villages can be seen when hovering your mouse over any of them."); +define("Q11_ORDER","Order:

      Look for the coordinates of "); +define("Q11_ORDER1","and enter them here."); +define("Q11_RESP","Exactly, there "); +define("Q11_RESP1"," Village! As many resources as you reach this village. Well, almost as much ..."); +define("Q11_BUTN","completar misión"); + +define("Q12","Task 12: Cranny"); +define("Q12_DESC","It's getting time to erect a cranny. The world of is dangerous.

      Many players live by stealing other players' resources. Build a cranny to hide some of your resources from enemies."); +define("Q12_ORDER","Order:<\/p>Construct a Cranny."); +define("Q12_RESP","Well done, now it's way harder for your mean fellow players to plunder your village.

      If under attack, your villagers will hide the resources in the Cranny all on their own."); + +define("Q13","Task 13: To Two."); +define("Q13_DESC","In there is always something to do! Extend one woodcutter, one clay pit, one iron mine and one cropland to level 2 each."); +define("Q13_ORDER","Order:<\/p>Extend one of each resource tile to level 2."); +define("Q13_RESP","Very good, your village grows and thrives!"); + +define("Q14","Task 14: Instructions"); +define("Q14_DESC","In the ingame instructions you can find short information texts about different buildings and types of units.

      Click on 'instructions' at the left to find out how much lumber is required for the barracks."); +define("Q14_ORDER","Order:<\/p>Enter how much lumber barracks cost"); +define("Q14_BUTN","complete task"); +define("Q14_RESP","Exactly! Barracks cost 210 lumber."); + +define("Q15","Task 15: Main Building"); +define("Q15_DESC","Your master builders need a main building level 3 to erect important buildings such as the marketplace or barracks."); +define("Q15_ORDER","Order:<\/p>Extend your main building to level 3."); +define("Q15_RESP","Well done. The main building level 3 has been completed.

      With this upgrade your master builders cannot only construct more types of buildings but also do so faster."); + +define("Q16","Task 16: Advanced!"); +define("Q16_DESC","Look up your rank in the player statistics again and enjoy your progress."); +define("Q16_ORDER","Order:<\/p>Look for your rank in the statistics and enter it here."); +define("Q16_RESP","Well done! That's your current rank."); + +define("Q17","Task 17: Weapons or Dough"); +define("Q17_DESC","Now you have to make a decision: Either trade peacefully or become a dreaded warrior.

      For the marketplace you need a granary, for the barracks you need a rally point."); +define("Q17_BUTN","Economy"); +define("Q17_BUTN1","Military"); + +define("Q18","Task 18: Military"); +define("Q18_DESC","A brave decision. To be able to send troops you need a rally point.

      The rally point must be built on a specific building site. The "); +define("Q18_DESC1"," building site."); +define("Q18_DESC2"," is located on the right side of the main building, slightly below it. The building site itself is curved."); +define("Q18_ORDER","Order:<\/p>Construct a rally point."); +define("Q18_RESP","Your rally point has been erected! A good move towards world domination!"); + +define("Q19","Task 19: Barracks"); +define("Q19_DESC","Now you have a main building level 3 and a rally point. That means that all prerequisites for building barracks have been fulfilled.

      You can use the barracks to train troops for fighting."); +define("Q19_ORDER","Order:<\/p>Construct barracks."); +define("Q19_RESP","Well done... The best instructors from the whole country have gathered to train your men\u2019s fighting skills to top form."); + +define("Q20","Task 20: Train."); +define("Q20_DESC","Now that you have barracks you can start training troops. Train two "); +define("Q20_ORDER","Please train 2 "); +define("Q20_RESP","The foundation for your glorious army has been laid.

      Before sending your army off to plunder you should check with the."); +define("Q20_RESP1","Combat Simulator"); +define("Q20_RESP2","to see how many troops you need to successfully fight one rat without losses."); + +define("Q21","Task 18: Economy"); +define("Q21_DESC","Trade & Economy was your choice. Golden times await you for sure!"); +define("Q21_ORDER","Order:<\/p>Construct a Granary."); +define("Q21_RESP","Well done! With the Granary you can store more wheat."); + +define("Q22","Task 19: Warehouse"); +define("Q22_DESC","Not only Crop has to be saved. Other resources can go to waste as well if they are not stored correctly. Construct a Warehouse!"); +define("Q22_ORDER","Order:<\/p>Construct Warehouse."); +define("Q22_RESP",";Well done, your Warehouse is complete...”<\/i>
      Now you have fulfilled all prerequisites required to construct a Marketplace."); + +define("Q23","Task 20: Marketplace."); +define("Q23_DESC",";Construct a Marketplace so you can trade with your fellow players."); +define("Q23_ORDER","Order:<\/p>Please build a Marketplace."); +define("Q23_RESP",";The Marketplace has been completed. Now you can make offers of your own and accept foreign offers! When creating your own offers, you should think about offering what other players need most to get more profit."); + +define("Q24","Task 21: Everything to 2."); +define("Q24_DESC","Now we should increase your resource production a bit. Build an additional woodcutter, clay pit, iron mine and cropland to level 1."); +define("Q24_ORDER","Order:<\/p>Extend all resource tiles to level 2."); +define("Q24_RESP","Congratulations! Your village grows and thrives..."); + +define("Q28","Task 22: Alliance."); +define("Q28_DESC","Teamwork is important in Travian. Players who work together organise themselves in alliances. Get an invitation from an alliance in your region and join this alliance. Alternatively, you can found your own alliance. To do this, you need a level 3 embassy."); +define("Q28_ORDER","Order:<\/p>Join an alliance or found one on your own."); +define("Q28_RESP","Is good! Now you're in a union called"); +define("Q28_RESP1",", and you're a member of their alliance with the faster you'll progress..."); + +define("Q29","Task 23: Main Building to Level 5"); +define("Q29_DESC","To be able to build a palace or residence, you will need a main building at level 5."); +define("Q29_ORDER","Order:<\/p>Upgrade your main building to level 5."); +define("Q29_RESP","The main building is level 5 now and you can build palace or residence..."); + +define("Q30","Task 24: Granary to Level 3."); +define("Q30_DESC","That you do not lose crop, you should upgrade your granary."); +define("Q30_ORDER","Order:<\/p>Upgrade your granary to level 3."); +define("Q30_RESP","Granary is level 3 now..."); + +define("Q31","Task 25: Warehouse to Level 7"); +define("Q31_DESC"," To make sure your resources won't overflow, you should upgrade your warehouse."); +define("Q31_ORDER","Order:<\/p>Upgrade your warehouse to level 7."); +define("Q31_RESP","Warehouse has upgraded to level 7..."); + +define("Q32","Task 26: All to five!"); +define("Q32_DESC","You will always need more resources. Resource tiles are quite expensive but will always pay out in the long term."); +define("Q32_ORDER","Order:<\/p>Upgrade all resources tiles to level 5."); +define("Q32_RESP","All resources are at level 5, very good, your village grows and thrives!"); + +define("Q33","Task 27: Palace or Residence?"); +define("Q33_DESC","To found a new village, you will need settlers. Those you can train in either a palace or a residence."); +define("Q33_ORDER","Order:<\/p>Build a palace or residence to level 10."); +define("Q33_RESP","had reached to level 10, you can now train settlers and found your second village. Notice the cultural points..."); + +define("Q34","Task 28: 3 settlers."); +define("Q34_DESC","To found a new village, you will need settlers. They can be trained in either a palace or a residence."); +define("Q34_ORDER","Order:<\/p>Train 3 settlers."); +define("Q34_RESP","3 settlers were trained. To found new village you need at least"); +define("Q34_RESP1","culture points..."); + +define("Q35","Task 29: New Village."); +define("Q35_DESC","There are a lot of empty tiles on the map. Find one that suits you and found a new village"); +define("Q35_ORDER","Order:<\/p>Found a new village."); +define("Q35_RESP","I am proud of you! Now you have two villages and have all the possibilities to build a mighty empire. I wish you luck with this."); + +define("Q36"," Task 30: Build a "); +define("Q36_DESC","Now that you have trained some soldiers, you should build a "); +define("Q36_DESC1"," too. It increases the base defence and your soldiers will receive a defensive bonus."); +define("Q36_ORDER","Order:<\/p>Build a "); +define("Q36_RESP","That's what I'm talking about. A "); +define("Q36_RESP1"," Very useful. It increases the defence of the troops in the village."); + +define("Q37","Tasks"); +define("Q37_DESC","All tasks achieved!"); + +define("OPT3","Resource overview"); +define("T","Your resource deliveries"); +define("T1","Delivery"); +define("T2","Delivery time"); +define("T3","Status"); +define("T4","fetch"); +define("T5","fetched"); +define("T6","on hold"); +define("T7","1 day Travian "); +define("T8","2 days Travian "); + +//Quest 25 +define("Q25_7","Task 7: Neighbours!"); +define("Q25_7_DESC","Around you, there are many different villages. One of them is named. "); +define("Q25_7_DESC1","Click 'Map' in the head menu and look for that village. The name of your neighbours' villages can be seen once you hover your mouse over any of them."); +define("Q25_7_ORDER","<\/p>Order:
      Look for the coordinates of "); +define("Q25_7_ORDER1","and enter them here."); +define("Q25_7_RESP","Exactly, there "); +define("Q25_7_RESP1"," Village! As many resources as you reach this village. Well, almost as much ..."); + +define("Q25_8","Task 8: Huge Army!"); +define("Q25_8_DESC","Now I've got a very special Quest for you. I am hungry. Give me 200 crop!

      In return I will try to organize a huge army to protect your village."); +define("Q25_8_ORDER","Order:<\/p>Send 200 crop to the taskmaster."); +define("Q25_8_BUTN","Send crop"); +define("Q25_8_NOCROP","No Enough Crop!"); + +define("Q25_9","Task 9: One each!"); +define("Q25_9_DESC","In " . SERVER_NAME . " there is always something to do! While you are waiting for your new army,

      extend one additional woodcutter, clay pit, iron mine and cropland to level 1"); +define("Q25_9_ORDER","Order:<\/p>Extend one more of each resource tile to level 1."); +define("Q25_9_RESP","Very good, great development of resource production."); + +define("Q25_10","Task 10: Comming Soon!"); +define("Q25_10_DESC","Now there is time for a small break until the gigantic army I sent you arrives.

      Until then you can explore the map or extend a few resource tiles."); +define("Q25_10_ORDER","Order:<\/p>Wait for the taskmaster's army to arrive"); +define("Q25_10_RESP","Now a huge army from taskmaster has arrive to protect your village"); +define("Q25_10_REWARD","Your reward:<\/p>2 days more of Travian"); + +define("Q25_11","Task 11: Reports"); +define("Q25_11_DESC","Every time something important happens to your account you will receive a report.

      You can see these by clicking on the left half of the 5th button (from left to right). Read the report and come back here."); +define("Q25_11_ORDER","Order:<\/p>Read your latest report."); +define("Q25_11_RESP","You received it? Very good. Here is your reward."); + +define("Q25_12","Task 12: Everything to 1."); +define("Q25_12_DESC","Now we should increase your resource production a bit."); +define("Q25_12_ORDER","Order:<\/p>Extend all resource tiles to level 1."); +define("Q25_12_RESP","Very good, your resource production just thrives.

      Soon we can start with constructing buildings in the village."); + +define("Q25_13","Task 13: Dove of Peace"); +define("Q25_13_DESC","The first days after signing up you are protected against attacks by your fellow players. You can see how long this protection lasts by adding the code [#0]<\/b> to your profile."); +define("Q25_13_ORDER","Order:<\/p>Write the code [#0]<\/b> into your profile by adding it to one of the two description fields."); +define("Q25_13_RESP","Well done! Now everyone can see what a great warrior the world is approached by."); + +define("Q25_14","Task 14: Cranny"); +define("Q25_14_DESC","It's getting time to erect a cranny. The world of " . SERVER_NAME. " is dangerous.

      Many players live by stealing other players' resources. Build a cranny to hide some of your resources from enemies."); +define("Q25_14_ORDER","Order:<\/p>Construct a Cranny."); +define("Q25_14_RESP","Well done, now it's way harder for your mean fellow players to plunder your village.

      If under attack, your villagers will hide the resources in the Cranny all on their own."); + +define("Q25_15","Task 15: To Two."); +define("Q25_15_DESC","In " . SERVER_NAME. " there is always something to do! Extend one woodcutter, one clay pit, one iron mine and one cropland to level 2 each."); +define("Q25_15_ORDER","Order:<\/p>Extend one of each resource tile to level 2."); +define("Q25_15_RESP","Very good, your village grows and thrives!"); + +define("Q25_16","Task 16: Instructions"); +define("Q25_16_DESC","In the ingame instructions you can find short information texts about different buildings and types of units.

      Click on 'instructions' at the left to find out how much lumber is required for the barracks."); +define("Q25_16_ORDER","Order:<\/p>Enter how much lumber barracks cost"); +define("Q25_16_BUTN","complete task"); +define("Q25_16_RESP","Exactly! Barracks cost 210 lumber."); + +define("Q25_17","Task 17: Main Building"); +define("Q25_17_DESC","Your master builders need a main building level 3 to erect important buildings such as the marketplace or barracks."); +define("Q25_17_ORDER","Order:<\/p>Extend your main building to level 3."); +define("Q25_17_RESP","Well done. The main building level 3 has been completed.

      With this upgrade your master builders can construct more types of buildings and also do so faster."); + +define("Q25_18","Task 18: Advanced!"); +define("Q25_18_DESC","Look up your rank in the player statistics again and enjoy your progress."); +define("Q25_18_ORDER","Order:<\/p>Look for your rank in the statistics and enter it here."); +define("Q25_18_RESP","Well done! That's your current rank."); + +define("Q25_19","Task 19: Weapons or Dough"); +define("Q25_19_DESC","Now you have to make a decision: Either trade peacefully or become a dreaded warrior.

      For the marketplace you need a granary, for the barracks you need a rally point."); +define("Q25_19_BUTN","Economy"); +define("Q25_19_BUTN1","Military"); + +define("Q25_20","Task 19: Economy"); +define("Q25_20_DESC","Trade & Economy was your choice. Golden times await you for sure!"); +define("Q25_20_ORDER","Order:<\/p>Construct a Granary."); +define("Q25_20_RESP","Well done! With the Granary you can store more wheat."); + +define("Q25_21","Task 20: Warehouse"); +define("Q25_21_DESC","Not only Crop has to be saved. Other resources can go to waste as well if they are not stored correctly. Construct a Warehouse!"); +define("Q25_21_ORDER","Order:<\/p>Construct Warehouse."); +define("Q25_21_RESP",";Well done, your Warehouse is complete...”<\/i>
      Now you have fulfilled all prerequisites required to construct a Marketplace."); + +define("Q25_22","Task 21: Marketplace."); +define("Q25_22_DESC",";Construct a Marketplace so you can trade with your fellow players."); +define("Q25_22_ORDER","Order:<\/p>Please build a Marketplace."); +define("Q25_22_RESP","The Marketplace has been completed. Now you can make offers of your own and accept foreign offers! When creating your own offers, you should think about offering what other players need most to get more profit."); + +define("Q25_23","Task 19: Military"); +define("Q25_23_DESC","A brave decision. To be able to send troops you need a rally point.

      The rally point must be built on a specific building site. The "); +define("Q25_23_DESC1"," building site."); +define("Q25_23_DESC2"," is located on the right side of the main building, slightly below it. The building site itself is curved."); +define("Q25_23_ORDER","Order:<\/p>Construct a rally point."); +define("Q25_23_RESP","Your rally point has been erected! A good move towards world domination!"); + +define("Q25_24","Task 20: Barracks"); +define("Q25_24_DESC","Now you have a main building level 3 and a rally point. That means that all prerequisites for building barracks have been fulfilled.

      You can use the barracks to train troops for fighting."); +define("Q25_24_ORDER","Order:<\/p>Construct barracks."); +define("Q25_24_RESP","Well done... The best instructors from the whole country have gathered to train your men\u2019s fighting skills to top form."); + +define("Q25_25","Task 21: Train."); +define("Q25_25_DESC","Now that you have barracks you can start training troops. Train two "); +define("Q25_25_ORDER","Please train 2 "); +define("Q25_25_RESP","The foundation for your glorious army has been laid.

      Before sending your army off to plunder you should check with the"); +define("Q25_25_RESP1","Combat Simulator"); +define("Q25_25_RESP2","to see how many troops you need to successfully fight one rat without losses."); + +define("Q25_26","Task 22: Everything to 2."); +define("Q25_26_DESC","Now it's time again to extend the cornerstones of might and wealth! This time level 1 is not enough... it will take a while but in the end it will be worth it. Extend all your resource tiles to level 2!"); +define("Q25_26_ORDER","Order:<\/p>Extend all resource tiles to level 2."); +define("Q25_26_RESP","Congratulations! Your village grows and thrives..."); + +define("Q25_27","Task 23: Friends."); +define("Q25_27_DESC","As single player it is hard to compete with attackers. It is to your advantage if your neighbours like you.

      It is even better if you play together with friends. Did you know that you can earn Gold by inviting friends?"); +define("Q25_27_ORDER","Order:<\/p>How much Gold do you earn for inviting a friend?"); +define("Q25_27_RESP","Correct! You get 50 Gold if your invited friend have 2 village."); + +define("Q25_28","Task 24: Construct Embassy."); +define("Q25_28_DESC","The world of Travian is dangerous. You already built a cranny to protect you against attackers.

      A good alliance will give you even better protection."); +define("Q25_28_ORDER","Order:<\/p>To accept invitations from alliances, build an embassy."); +define("Q25_28_RESP","Yes! You can wait invitation from an alliance or create you own if embassy has level 3"); + +define("Q25_29","Task 25: Alliance."); +define("Q25_29_DESC","Teamwork is important in Travian. Players who work together organise themselves in alliances. Get an invitation from an alliance in your region and join this alliance. Alternatively, you can found your own alliance. To do this, you need a level 3 embassy."); +define("Q25_29_ORDER","Order:<\/p>Join an alliance or found your own alliance."); +define("Q25_29_RESP","Well done! Now you're in a union called"); +define("Q25_29_RESP1",", and you're a member of their alliance.
      Working together you will all progress faster..."); + +define("Q25_30","Tasks"); +define("Q25_30_DESC","All tasks achieved!"); + + +//======================================================// +//================ UNITS - DO NOT EDIT! ================// +//======================================================// +define("U0","Hero"); + +//ROMAN UNITS +define("U1","Legionnaire"); +define("U2","Praetorian"); +define("U3","Imperian"); +define("U4","Equites Legati"); +define("U5","Equites Imperatoris"); +define("U6","Equites Caesaris"); +define("U7","Battering Ram"); +define("U8","Fire Catapult"); +define("U9","Senator"); +define("U10","Settler"); + +//TEUTON UNITS +define("U11","Clubswinger"); +define("U12","Spearman"); +define("U13","Axeman"); +define("U14","Scout"); +define("U15","Paladin"); +define("U16","Teutonic Knight"); +define("U17","Ram"); +define("U18","Catapult"); +define("U19","Chief"); +define("U20","Settler"); + +//GAUL UNITS +define("U21","Phalanx"); +define("U22","Swordsman"); +define("U23","Pathfinder"); +define("U24","Theutates Thunder"); +define("U25","Druidrider"); +define("U26","Haeduan"); +define("U27","Ram"); +define("U28","Trebuchet"); +define("U29","Chieftain"); +define("U30","Settler"); +define("U99","Trap"); + +//NATURE UNITS +define("U31","Rat"); +define("U32","Spider"); +define("U33","Snake"); +define("U34","Bat"); +define("U35","Wild Boar"); +define("U36","Wolf"); +define("U37","Bear"); +define("U38","Crocodile"); +define("U39","Tiger"); +define("U40","Elephant"); + +//NATARS UNITS +define("U41","Pikeman"); +define("U42","Thorned Warrior"); +define("U43","Guardsman"); +define("U44","Birds Of Prey"); +define("U45","Axerider"); +define("U46","Natarian Knight"); +define("U47","War Elephant"); +define("U48","Ballista"); +define("U49","Natarian Emperor"); +define("U50","Natarian Settler"); + +//MONSTER UNITS +define("U51","Monster Peon"); +define("U52","Monster Hunter"); +define("U53","Monster Warrior"); +define("U54","Ghost"); +define("U55","Monster Steed"); +define("U56","Monster War Steed"); +define("U57","Monster Ram"); +define("U58","Monster Catapult"); +define("U59","Monster Chief"); +define("U60","Monster Settler"); + +// RESOURCES +define("R1","Drvo"); +define("R2","Glina"); +define("R3","Gvožđe"); +define("R4","Žito"); + +//INDEX.php +define("LOGIN","Prijavi se"); +define("PLAYERS","IgraÄa"); +define("MODERATOR","Moderator"); +define("ACTIVE","Aktivnih"); +define("ONLINE","Na mreži"); +define("TUTORIAL","Tutorijal"); +define("PLAYER_STATISTICS","Statistika igraÄa"); +define("TOTAL_PLAYERS","".PLAYERS." ukupno igraÄa"); +define("ACTIVE_PLAYERS","Aktivnih igraÄa"); +define("ONLINE_PLAYERS","".PLAYERS." na mreži"); +define("MP_STRATEGY_GAME","".SERVER_NAME." - the multiplayer strategy game"); +define("WHAT_IS","".SERVER_NAME." is one of the most popular browser games in the world. As a player in ".SERVER_NAME.", you will build your own empire, recruit a mighty army, and fight with your allies for game world hegemony."); +define("REGISTER_FOR_FREE","Register here for free!"); +define("LATEST_GAME_WORLD","Latest game world"); +define("LATEST_GAME_WORLD2","Register on the latest
      game world and enjoy
      the advantages of
      being one of the
      first players."); +define("PLAY_NOW","Play ".SERVER_NAME." now"); +define("LEARN_MORE","Learn more
      about ".SERVER_NAME."!"); +define("LEARN_MORE2","Now with a revolutionised
      server system, completely new
      graphics
      This clone is The Shiz!"); +define("COMUNITY","Community"); +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("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."); +define("LEARN4","Follow your improvement and success and compare yourself to other players. Look at the Top 10 rankings and fight to win a weekly medal."); +define("LEARN5","Receive detailed reports about your adventures, trades and battles. Don't forget to check the brand new reports about the happenings taking place in your surroundings."); +define("LEARN6","Exchange information and conduct diplomacy with other players. Always remember that communication is the key to winning new friends and solving old conflicts."); +define("LOGIN_TO","Prijavi se na ". SERVER_NAME); +define("REGIN_TO","Registruj se na ". SERVER_NAME); +define("P_ONLINE","IgraÄa na mreži: "); +define("P_TOTAL","Totalno igraÄa: "); +define("CHOOSE","Molimo Vas izaberite server."); +define("STARTED"," Ovaj server je poÄeo pre ". round((time()-COMMENCE)/86400) ." dana."); + +//ANMELDEN.php +define("NICKNAME","KorisniÄko ime"); +define("EMAIL","Email"); +define("PASSWORD","Å ifra"); +define("ROMANS","Rimljani"); +define("TEUTONS","Tevtonci"); +define("GAULS","Gali"); +define("NW","Severozapad"); +define("NE","Severoistok"); +define("SW","Jugozapad"); +define("SE","Jugoistok"); +define("RANDOM","NasumiÄno"); +define("ACCEPT_RULES"," Prihvatam pravila igre i opÅ¡te uslove."); +define("ONE_PER_SERVER","Svaki igraÄ može imati samo jedan nalog po serveru."); +define("BEFORE_REGISTER","Pre nego Å¡to registrujete raÄun, trebalo bi da proÄitate Uputstva Traviana 25xSPEED da biste videli specifiÄne prednosti i nedostatke tri plemena."); +define("BUILDING_UPGRADING","Gradnja:"); +define("HOURS","sati"); + + +//ATTACKS ETC. +define("TROOP_MOVEMENTS","Pokreti trupa:"); +define("ARRIVING_REINF_TROOPS","Arriving reinforcing troops"); +define("ARRIVING_ATTACKING_TROOPS","Arriving attacker troops"); +define("ARRIVING_REINF_TROOPS_SHORT","Reinf."); +define("OWN_ATTACKING_TROOPS","Own attacking troops"); +define("ATTACK","Napad"); +define("OWN_REINFORCING_TROOPS","Own reinforcing troops"); +define("TROOPS_DORF","Trupe:"); +define("NEWVILLAGE","Novo Selo"); +define("FOUNDNEWVILLAGE","Osnivanje novog sela"); +define("UNDERATTACK","Selo je pod napadom"); +define("OASISATTACK","Oaza je pod napadom"); +define("OASISATTACKS","Oasis Att."); +define("RETURNFROM","Return from"); +define("REINFORCEMENTFOR","Reinforcement to"); +define("ATTACK_ON","Attack to"); +define("RAID_ON","Raid to"); +define("SCOUTING","IzviÄ‘aÄ"); +define("PRISONERS","Zatvorenici"); +define("PRISONERSIN","Zatvorenici u"); +define("PRISONERSFROM","Zatvorenici iz"); +define("TROOPS","Trupe"); +define("TROOPSFROM","Trupe"); +define("BOUNTY","Bounty"); +define("ARRIVAL","Arrival"); +define("INCOMING_TROOPS","Incoming Troops"); +define("TROOPS_ON_THEIR_WAY","Troops on their way"); +define("OWN_TROOPS","Own troops"); +define("ON","na"); +define("AT","u"); +define("UPKEEP","Upkeep"); +define("SEND_BACK","PoÅ¡alji nazad"); +define("TROOPS_IN_THE_VILLAGE","Troops in the village"); +define("TROOPS_IN_OTHER_VILLAGE","Troops in other village"); +define("TROOPS_IN_OASIS","Troops in oasis"); +define("KILL","Ubij"); +define("FROM","Iz"); +define("SEND_TROOPS","PoÅ¡alji Trupe"); +define("TASKMASTER","Taskmaster"); +define("VILLAGE_OF_THE_ELDERS_TROOPS","village of the elders troops"); + +//SEND TROOP +define("REINFORCE","Reinforcement"); +define("NORMALATTACK","Normal Attack"); +define("RAID","Raid"); +define("OR","or"); +define("SENDTROOP","Send troops"); +define("TROOP","Troops"); +define("NOTROOP","no troops"); + +//map +define("DETAIL","Detalji"); +define("ABANDVALLEY","Abandoned valley"); +define("UNOCCUOASIS","Unoccupied oasis"); +define("OCCUOASIS","Occupied oasis"); +define("THERENOINFO","There is no
      information available."); +define("LANDDIST","Land distribution"); +define("TRIBE","Tribe"); +define("ALLIANCE","Alliance"); +define("POP","Population"); +define("REPORT","Report"); +define("OPTION","Options"); +define("CENTREMAP","Centre map"); +define("FNEWVILLAGE","Found new village"); +define("CULTUREPOINT","culture points"); +define("BUILDRALLY","build a rally point"); +define("SETTLERSAVAIL","settlers available"); +define("BEGINPRO","beginners protection"); +define("SENDMERC","Send merchant(s)"); +define("BAN","Player is banned"); +define("BUILDMARKET","Build marketplace"); +define("PERHOUR","per hour"); +define("BONUS","Bonus"); +define("MAP","Map"); +define("CROPFINDER","Crop Finder"); +define("NORTH","North"); +define("EAST","East"); +define("SOUTH","South"); +define("WEST","West"); + +//other +define("VILLAGE","Selo"); +define("OASIS","Oaza"); +define("PLAYER","IgraÄ"); + +//LOGIN.php +define("COOKIES","Morate imati omogucÌene kolaÄicÌe da biste se mogli prijaviti. Ako delite ovaj raÄunar sa drugim ljudima, morate se odjaviti nakon svake sesije za sopstvenu sigurnost."); +define("NAME","KorisniÄko ime"); +define("PW_FORGOTTEN","Zaboravili ste Å¡ifru?"); +define("PW_REQUEST","Možete zatražiti novu Å¡ifru. Vreme stizanja emaila je oko 10 MINUTA!"); +define("PW_GENERATE","GeneriÅ¡ite novu Å¡ifru."); +define("EMAIL_NOT_VERIFIED","Email nije verifikovan!"); +define("EMAIL_FOLLOW","Pratite link da biste verifikovali nalog."); +define("VERIFY_EMAIL","Verify Email."); +define("SERVER_STARTS_IN","Server will start in: "); +define("START_NOW","START NOW"); + + +//404.php +define("NOTHING_HERE","Nema niÅ¡ta ovde!"); +define("WE_LOOKED","Tražili smo 404 puta ali nismo niÅ¡ta naÅ¡li!"); + +//TIME RELATED +define("CALCULATED","IzvrÅ¡eno za:"); +define("SERVER_TIME","Vreme servera:"); + +//MASSMESSAGE.php +define("MASS","Message Content"); +define("MASS_SUBJECT","Subject:"); +define("MASS_COLOR","Message color:"); +define("MASS_REQUIRED","All fields required"); +define("MASS_UNITS","Images (units):"); +define("MASS_SHOWHIDE","Show/Hide"); +define("MASS_READ","Read this: after adding smilie, you have to add left or right after number otherwise image will won't work"); +define("MASS_CONFIRM","Confirmation"); +define("MASS_REALLY","Do you really want to send MassIGM?"); +define("MASS_ABORT","Aborting right now"); +define("MASS_SENT","Mass IGM was sent"); + +//BUILDINGS +define("WOODCUTTER","Woodcutter"); +define("CLAYPIT","Clay Pit"); +define("IRONMINE","Iron Mine"); +define("CROPLAND","Cropland"); + +define("SAWMILL","Sawmill"); +define("SAWMILL_DESC","Here wood delivered by your Woodcutters is processed. Based on its level your sawmill can increase your wood production by up to 25 percent."); +define("CURRENT_WOOD_BONUS","Current wood bonus:"); +define("WOOD_BONUS_LEVEL","Wood bonus at level"); +define("MAX_LEVEL","Building already at max level"); +define("PERCENT","Percent"); + +define("BRICKYARD","Brickyard"); +define("CURRENT_CLAY_BONUS","Current clay bonus:"); +define("CLAY_BONUS_LEVEL","Clay bonus at level"); +define("BRICKYARD_DESC","Here clay is processed into bricks. Based on its level your Brickyard can increase your clay production by up to 25 percent."); + +define("IRONFOUNDRY","Iron Foundry"); +define("CURRENT_IRON_BONUS","Current iron bonus:"); +define("IRON_BONUS_LEVEL","Iron bonus at level"); +define("IRONFOUNDRY_DESC","Iron is smelted here. Based on its level your Iron Foundry can increase your iron production by up to 25 percent."); + +define("GRAINMILL","Grain Mill"); +define("CURRENT_CROP_BONUS","Current crop bonus:"); +define("CROP_BONUS_LEVEL","Crop bonus at level"); +define("GRAINMILL_DESC","Here your grain is milled in order to produce flour. Based on its level your grain mill can increase your crop production by up to 25 percent."); + +define("BAKERY","Bakery"); +define("BAKERY_DESC","Here the flour produced in your mill is used to bake bread. In addition with the Grain Mill the increase in crop production can go up to 50 percent."); + +define("WAREHOUSE","Warehouse"); +define("CURRENT_CAPACITY","Current capacity:"); +define("CAPACITY_LEVEL","Capacity at level"); +define("RESOURCE_UNITS","Resource units"); +define("WAREHOUSE_DESC","The resources wood, clay and iron are stored in your Warehouse. By increasing its level you increase your Warehouse's capacity."); + +define("GRANARY","Granary"); +define("CROP_UNITS","Crop units"); +define("GRANARY_DESC","Crop produced by your farms is stored in the Granary. By increasing its level you increase the Granary's capacity."); + +define("BLACKSMITH","Blacksmith"); +define("ACTION","Action"); +define("UPGRADE","Upgrade"); +define("UPGRADE_IN_PROGRESS","Upgrade in
      progress"); +define("UPGRADE_BLACKSMITH","Upgrade
      blacksmith"); +define("UPGRADES_COMMENCE_BLACKSMITH","Upgrades can commence when blacksmith is completed."); +define("MAXIMUM_LEVEL","Maximum
      level"); +define("EXPAND_WAREHOUSE","Expand
      warehouse"); +define("EXPAND_GRANARY","Expand
      granary"); +define("ENOUGH_RESOURCES","Dovoljno resursa"); +define("CROP_NEGATIVE ","Crop production is negative so you will never reach the required resources"); +define("TOO_FEW_RESOURCES","Too few
      resources"); +define("UPGRADING","Upgrading"); +define("DURATION","Duration"); +define("COMPLETE","Complete"); +define("BLACKSMITH_DESC","In the blacksmith's melting furnaces your warriors' weapons are enhanced. By increasing its level you can order the fabrication of even better weapons."); + +define("ARMOURY","Armoury"); +define("UPGRADE_ARMOURY","Upgrade
      Armoury"); +define("UPGRADES_COMMENCE_ARMOURY","Upgrades can commence when armoury is completed."); +define("ARMOURY_DESC","In the armoury's melting furnaces your warriors' armour is enhanced. By increasing its level you can order the fabrication of even better armour."); + +define("TOURNAMENTSQUARE","Tournament Square"); +define("CURRENT_SPEED","Current speed bonus:"); +define("SPEED_LEVEL","Speed bonus at level"); +define("TOURNAMENTSQUARE_DESC","At the Tournament Square your troops can train their stamina. The further the building is upgraded the faster your troops are beyond a minimum distance of ".TS_THRESHOLD." squares."); + +define("MAINBUILDING","Main Building"); +define("CURRENT_CONSTRUCTION_TIME","Current construction time:"); +define("CONSTRUCTION_TIME_LEVEL","Construction time at level"); +define("DEMOLITION_BUILDING","Demolition of the building:

      If you no longer need a building, you can order the demolition of the building.

      "); +define("DEMOLISH","Demolish"); +define("DEMOLITION_OF","Demolition of "); +define("MAINBUILDING_DESC","In the main building the village's master builders live. The higher its level the faster your master builders complete the construction of new buildings."); + +define("RALLYPOINT","Rally Point"); +define("OVERVIEW","Overview"); +define("REINFORCEMENT","Reinforcement"); +define("EVASION_SETTINGS","evasion settings"); +define("SEND_TROOPS_AWAY_MAX","Send troops away a maximun 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."); + +define("MARKETPLACE","Marketplace"); +define("MERCHANT","Merchants"); +define("OR_","or"); +define("GO","go"); +define("UNITS_OF_RESOURCE","units of resource"); +define("MERCHANT_CARRY","Each merchant can carry"); +define("MERCHANT_COMING","Merchants coming"); +define("TRANSPORT_FROM","Transport from"); +define("ARRIVAL_IN","Arrival in"); +define("NO_COORDINATES_SELECTED","No Coordinates selected"); +define("CANNOT_SEND_RESOURCES","You cannot send resources to the same village"); +define("BANNED_CANNOT_SEND_RESOURCES","Player is Banned. You cannot send resources to him"); +define("RESOURCES_NO_SELECTED","Resources not selected"); +define("ENTER_COORDINATES","Enter coordinates or village name"); +define("TOO_FEW_MERCHANTS","Too few merchants"); +define("OWN_MERCHANTS_ONWAY","Own merchants on the way"); +define("MERCHANTS_RETURNING","Merchants returning"); +define("TRANSPORT_TO","Transport to"); +define("I_AN_SEARCHING","I'm searching"); +define("I_AN_OFFERING","I'm offering"); +define("OFFERS_MARKETPLACE","Offers at the marketplace"); +define("NO_AVAILABLE_OFFERS","No offers at the marketplace"); +define("OFFERED_TO_ME","Offered
      to me"); +define("WANTED_TO_ME","Wanted
      from me"); +define("NOT_ENOUGH_MERCHANTS","Not Enough Merchant"); +define("ACCEP_OFFER","Accept offer"); +define("NO_AVALIBLE_OFFERS","There are no avaliable offers on the market"); +define("SEARCHING","Searching"); +define("OFFERING","Offering"); +define("MAX_TIME_TRANSPORT","max. time of transport"); +define("OWN_ALLIANCE_ONLY","own alliance only"); +define("INVALID_OFFER","Invalid offer"); +define("OFFER","Offer"); +define("SEARCH","Search"); +define("OWN_OFFERS","Own offers"); +define("ALL","All"); +define("NPC_TRADE","NPC Trade"); +define("SUM","Sum"); +define("REST","Rest"); +define("TRADE_RESOURCES","Trade resources at (step 2 of 2"); +define("DISTRIBUTE_RESOURCES","Distribute resources at (step 1 of 2)"); +define("OF","of"); +define("NPC_COMPLETED","NPC completed"); +define("BACK_BUILDING","Back to building"); +define("YOU_CAN_NAT_NPC_WW","You can't use NPC trade in WW village."); +define("NPC_TRADING","NPC trading"); +define("SEND_RESOURCES","Send Resources"); +define("BUY","Buy"); +define("TRADE_ROUTES","trade routes"); +define("DESCRIPTION","Description"); +define("TIME_LEFT","Time left"); +define("START","Start"); +define("NO_TRADE_ROUTES","No active trade routes"); +define("TRADE_ROUTE_TO","Trade route to"); +define("CHECKED","checked"); +define("DAYS","days"); +define("EXTEND","extend"); +define("EDIT","edit"); +define("EXTEND_TRADE_ROUTES","Extend the trade route by 7 days for"); +define("CREATE_TRADE_ROUTES","Create new trade route"); +define("DELIVERIES","deliveries"); +define("START_TIME_TRADE","start time"); +define("CREATE_TRADE_ROUTE","Create trade route"); +define("TARGET_VILLAGE","target village"); +define("EDIT_TRADE_ROUTES","Edit trade route"); +define("TRADE_ROUTES_DESC","Trade route allows you to set up routes for your merchant that he will walk every day at a certain hour.

      Standard this holds on for 7 days, but you can extend it with 7 days for the cost of"); +define("NPC_TRADE_DESC","With the NPC merchant you can distribute the resources in your warehouse as you desire.

      The first line shows the current stock. In the second line you can choose another distribution. The third line shows the difference between the old and new stock."); +define("MARKETPLACE_DESC","At the Marketplace you can trade resources with other players. The higher its level, the more resources can be transported at the same time."); + +define("EMBASSY","Embassy"); +define("TAG","Tag"); +define("TO_THE_ALLIANCE","to the alliance"); +define("JOIN_ALLIANCE","join alliance"); +define("REFUSE","refuse"); +define("ACCEPT","accept"); +define("NO_INVITATIONS","There are no invitations available."); +define("NO_CREATE_ALLIANCE","Banned player can't create an alliance."); +define("FOUND_ALLIANCE","found alliance"); +define("EMBASSY_DESC","The embassy is a place for diplomats. The higher its level the more options the king gains."); + +define("BARRACKS","Barracks"); +define("QUANTITY","Quantity"); +define("MAX","Max"); +define("TRAINING","Training"); +define("FINISHED","Finished"); +define("UNIT_FINISHED","The next unit will be finished in"); +define("AVAILABLE","Available"); +define("TRAINING_COMMENCE_BARRACKS","Training can commence when barracks are completed."); +define("BARRACKS_DESC","All foot soldiers are trained in the barracks. The higher the level of the barracks, the faster the troops are trained."); + +define("STABLE","Stable"); +define("AVAILABLE_ACADEMY","No units available. Research at academy"); +define("TRAINING_COMMENCE_STABLE","Training can commence when stable are completed."); +define("STABLE_DESC","Cavalry can be trained in the stable. The higher its level the faster the troops are trained."); + +define("WORKSHOP","Workshop"); +define("TRAINING_COMMENCE_WORKSHOP","Training can commence when workshop are completed."); +define("WORKSHOP_DESC","Siege engines like catapults and rams can be built in the workshop. The higher its level the faster the units are produced."); + +define("ACADEMY","Academy"); +define("RESEARCH_AVAILABLE","There are no researches available"); +define("RESEARCH_COMMENCE_ACADEMY","Research can commence when academy is completed."); +define("RESEARCH","Research"); +define("EXPAND_WAREHOUSE1","Expand warehouse"); +define("EXPAND_GRANARY1","Expand granary"); +define("RESEARCH_IN_PROGRESS","Research in
      progress"); +define("RESEARCHING","Researching"); +define("PREREQUISITES","Prerequisites"); +define("SHOW_MORE","show more"); +define("HIDE_MORE","hide more"); +define("ACADEMY_DESC","In the academy new unit types can be researched. By increasing its level you can order the research of better units."); + +define("CRANNY","Cranny"); +define("CURRENT_HIDDEN_UNITS","Currently hidden units per resource:"); +define("HIDDEN_UNITS_LEVEL","Hidden units per resource at level"); +define("UNITS","units"); +define("CRANNY_DESC","The cranny is used to hide some of your resources when the village is attacked. These resources cannot be stolen."); + +define("TOWNHALL","Town Hall"); +define("CELEBRATIONS_COMMENCE_TOWNHALL","Celebrations can commence when the town hall is completed."); +define("GREAT_CELEBRATIONS","Great celebration"); +define("CULTURE_POINTS","Culture points"); +define("HOLD","hold"); +define("CELEBRATIONS_IN_PROGRESS","Celebration
      in progress"); +define("CELEBRATIONS","Celebrations"); +define("TOWNHALL_DESC","You can hold pompous celebrations in the Town Hall. Such a celebration increases your culture points. Building up your Town Hall to a higher level will decrease the length of the celebration."); + +define("RESIDENCE","Boravište"); +define("CAPITAL","This is your capital"); +define("RESIDENCE_TRAIN_DESC","In order to found a new village you need a level 10 or 20 residence and 3 settlers. In order to conquer a new village you need a level 10 or 20 residence and a senator, chief or chieftain."); +define("PRODUCTION_POINTS","Production of this village:"); +define("PRODUCTION_ALL_POINTS","Production of all villages:"); +define("POINTS_DAY","Culture points per day"); +define("VILLAGES_PRODUCED","Your villages have produced"); +define("POINTS_NEED","points in total. To found or conquer a new village you need"); +define("POINTS","points"); +define("INHABITANTS","Inhabitants"); +define("COORDINATES","Coordinates"); +define("EXPANSION","Expansion"); +define("TRAIN","Train"); +define("DATE","Date"); +define("CONQUERED_BY_VILLAGE","Villages founded or conquered by this village"); +define("NONE_CONQUERED_BY_VILLAGE","No other village has been founded or conquered by this village yet."); +define("RESIDENCE_CULTURE_DESC","In order to extend your empire you need culture points. These culture points increase in the course of time and do so faster as your building levels increase."); +define("RESIDENCE_LOYALTY_DESC","By attacking with senators, chiefs or chieftains a village's loyalty can be brought down. If it reaches zero, the village joins the realm of the attacker. The loyalty of this village is currently at "); +define("RESIDENCE_DESC","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."); + +define("PALACE","Palace"); +define("PALACE_CONSTRUCTION","Palace under construction"); +define("PALACE_TRAIN_DESC","In order to found a new village you need a level 10, 15 or 20 palace and 3 settlers. In order to conquer a new village you need a level 10, 15 or 20 palace and a senator, chief or chieftain."); +define("CHANGE_CAPITAL","Promeni"); +define("SECURITY_CHANGE_CAPITAL","Are you sure, that you want to change your capital?
      You can\'t undo this!
      For security you must enter your password to confirm:
      "); +define("PALACE_DESC","The king or queen of the empire lives in the palace. Only one palace can exist in your realm at a time. You need a palace in order to proclaim a village to be your capital."); + +define("TREASURY","Treasury"); +define("ARTIFACTS_AREA","Artefacts in your area"); +define("NO_ARTIFACTS_AREA","There is no artefacts in your area."); +define("OWN_ARTIFACTS","Own artefacts"); +define("CONQUERED","Conquered"); +define("DISTANCE","Distance"); +define("EFFECT","Effect"); +define("ACCOUNT","account"); +define("SMALL_ARTIFACTS","Small artefacts"); +define("LARGE_ARTIFACTS","Large artefacts"); +define("NO_ARTIFACTS","There is no artefacts."); +define("ANY_ARTIFACTS","You do not own any artefacts."); +define("OWNER","Owner"); +define("AREA_EFFECT","Area of effect"); +define("REQUIRED_LEVEL","Required level"); +define("TIME_CONQUER","Time of conquer"); +define("TIME_ACTIVATION","Time of activation"); +define("FORMER_OWNER","Former owner(s)"); +define("BUILDING_STRONGER","building stronger with"); +define("BUILDING_WEAKER","building weaker with"); +define("TROOPS_FASTER","makes troops faster with"); +define("TROOPS_SLOWEST","makes troops slowest with"); +define("SPIES_INCREASE","spies increase ability with"); +define("SPIES_DECRESE","spies decrese ability with"); +define("CONSUME_LESS","all troops consume less with"); +define("CONSUME_HIGH","all troops consume high with"); +define("TROOPS_MAKE_FASTER","troops make faster with"); +define("TROOPS_MAKE_SLOWEST","troops make slowest with"); +define("YOU_CONSTRUCT","you can construct "); +define("CRANNY_INCREASED","cranny capacity is increased by"); +define("CRANNY_DECRESE","cranny capacity is decrese by"); +define("TREASURY_DESC","The riches of your empire are kept in the treasury. The treasury has room for one treasure. After you have captured an artefact it takes 24 hours on a normal server or 12 hours on a thrice speed server to be effective."); + +define("TRADEOFFICE","Trade Office"); +define("CURRENT_MERCHANT","Current merchant load:"); +define("MERCHANT_LEVEL","Merchant load at level"); +define("TRADEOFFICE_DESC","In the trade office the merchants' carts get improved and equipped with powerful horses. The higher its level the more your merchants are able to carry."); + +define("GREATBARRACKS","Great Barracks"); +define("TRAINING_COMMENCE_GREATBARRACKS","Training can commence when great barracks are completed."); +define("GREATBARRACKS_DESC","Foot soldiers are trained in the great barracks. The higher the level of the barracks, the faster the troops are trained."); + +define("GREATSTABLE","Great Stable"); +define("TRAINING_COMMENCE_GREATSTABLE","Training can commence when great stables are completed."); +define("GREATSTABLE_DESC","Cavalry can be trained in the great stable. The higher its level the faster the troops are trained."); + +define("CITYWALL","City Wall"); +define("DEFENCE_NOW","Defence Bonus now:"); +define("DEFENCE_LEVEL","Defence Bonus at level"); +define("CITYWALL_DESC","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."); + +define("EARTHWALL","Earth Wall"); +define("EARTHWALL_DESC","By building a Earth 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."); + +define("PALISADE","Palisade"); +define("PALISADE_DESC","By building a Palisade 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."); + +define("STONEMASON","Stonemason's Lodge"); +define("CURRENT_STABILITY","Current stability bonus:"); +define("STABILITY_LEVEL","Stability bonus at level"); +define("STONEMASON_DESC","The stonemason's lodge is an expert at cutting stone. The further the building is extended the higher the stability of the village's buildings."); + +define("BREWERY","Brewery"); +define("CURRENT_BONUS","Current bonus:"); +define("BONUS_LEVEL","Bonus at level"); +define("BREWERY_DESC","Tasty mead is brewed in the Brewery and later quaffed by the soldiers during the celebrations."); + +define("TRAPPER","Trapper"); +define("CURRENT_TRAPS","Currect maximum traps to train:"); +define("TRAPS_LEVEL","Maximum traps to train at level"); +define("TRAPS","Traps"); +define("TRAP","Trap"); +define("CURRENT_HAVE","Your currently have"); +define("WHICH_OCCUPIED","of which are occupied."); +define("TRAINING_COMMENCE_TRAPPER","Training can commence when trapper are completed."); +define("TRAPPER_DESC","The trapper protects your village with well hidden traps. This means that unwary enemies can be imprisoned and won't be able to harm your village anymore."); + +define("HEROSMANSION","Hero's Mansion"); +define("HERO_READY","Hero will be ready in "); +define("NAME_CHANGED","Hero name has been changed"); +define("NOT_UNITS","Not available units"); +define("NOT","Not "); +define("TRAIN_HERO","Train New Hero"); +define("REVIVE","Revive"); +define("OASES","Oases"); +define("DELETE","delete"); +define("RESOURCES","Resources"); +define("OFFENCE","Offence"); +define("DEFENCE","Defence"); +define("OFF_BONUS","Off-Bonus"); +define("DEF_BONUS","Def-Bonus"); +define("REGENERATION","Regeneration"); +define("DAY","Day"); +define("EXPERIENCE","Experience"); +define("YOU_CAN","You can "); +define("RESET","reset"); +define("YOUR_POINT_UNTIL"," your points until you are level "); +define("OR_LOWER"," or lower!"); +define("YOUR_HERO_HAS","Your hero has "); +define("OF_HIT_POINTS","of his hit points."); +define("ERROR_NAME_SHORT","Error: name too short"); +define("HEROSMANSION_DESC","In the Hero's mansion you can train your own hero and at level 10, 15 and 20 you can conquer oases with Hero in the immediate vicinity."); + +define("GREATWAREHOUSE","Great Warehouse"); +define("GREATWAREHOUSE_DESC","Wood, clay and iron are stored in the warehouse. The great warehouse offers you more space and keeps your goods drier and safer than the normal one."); + +define("GREATGRANARY","Great Granary"); +define("GREATGRANARY_DESC","Crop produced by your farms is stored in the granary. The great granary offers you more space and keeps your crops drier and safer than the normal one."); + +define("WONDER","Wonder of the World"); +define("WORLD_WONDER","World Wonder"); +define("WONDER_DESC","The World Wonder (otherwise known as a Wonder of the World) is as wonderful as it sounds. This building is built in order to win the server. Each level of the World Wonder costs hundreds of thousands (even millions) of resources to build."); +define("WORLD_WONDER_CHANGE_NAME","You need to have World Wonder level 1 to be able to change its name"); +define("WORLD_WONDER_NAME","World Wonder name"); +define("WORLD_WONDER_NOTCHANGE_NAME","You can not change the name of the World Wonder after level 10"); +define("WORLD_WONDER_NAME_CHANGED","Name changed"); + +define("HORSEDRINKING","Horse Drinking Trough"); +define("HORSEDRINKING_DESC","The horse drinking trough of the Romans decreases the training time of cavalry and the upkeep of these troops as well."); + +define("GREATWORKSHOP","Great Workshop"); +define("TRAINING_COMMENCE_GREATWORKSHOP","Training can commence when great workshop is completed."); +define("GREATWORKSHOP_DESC","Siege engines like catapults and rams can be built in the great workshop. The higher its level the faster the units are produced."); + +define("BUILDING_MAX_LEVEL_UNDER","Izgradnja maksimalnog nivoa u izgradnji"); +define("BUILDING_BEING_DEMOLISHED","Building presently being demolished"); +define("COSTS_UPGRADING_LEVEL","Troškovi
      za nadogradnju do nivoa"); +define("WORKERS_ALREADY_WORK","Radnici su vecÌ na poslu."); +define("CONSTRUCTING_MASTER_BUILDER","Izgradnja sa glavnim graditeljom "); +define("COSTS","troÅ¡kovi"); +define("GOLD","Zlato"); +define("WORKERS_ALREADY_WORK_WAITING","Radnici su vecÌ na poslu. (loop za Äekanje)"); +define("ENOUGH_FOOD_EXPAND_CROPLAND","Nedovoljna hrana. ProÅ¡irite zemlju."); +define("UPGRADE_WAREHOUSE","Nadogradite skladiÅ¡te"); +define("UPGRADE_GRANARY","Nadogradite Žitnicu"); +define("YOUR_CROP_NEGATIVE","Your crop production is negative, you will never get the required resources."); +define("UPGRADE_LEVEL","Nadogradite na nivo "); +define("WAITING","(Äekanje loop)"); +define("NEED_WWCONSTRUCTION_PLAN","Need WW construction plan"); +define("NEED_MORE_WWCONSTRUCTION_PLAN","Need more WW construction plan"); +define("CONSTRUCT_NEW_BUILDING","Izgraditi novi objekat"); +define("SHOWSOON_AVAILABLE_BUILDINGS","show soon available buildings"); +define("HIDESOON_AVAILABLE_BUILDINGS","hide soon available buildings"); + +//artefact +define("ARCHITECTS_DESC","All buildings in the area of effect are stronger. This means that you will need more catapults to damage buildings protected by this artifacts powers."); +define("ARCHITECTS_SMALL","The architects slight secret"); +define("ARCHITECTS_SMALLVILLAGE","Diamond Chisel"); +define("ARCHITECTS_LARGE","The architects great secret"); +define("ARCHITECTS_LARGEVILLAGE","Giant Marble Hammer"); +define("ARCHITECTS_UNIQUE","The architects unique secret"); +define("ARCHITECTS_UNIQUEVILLAGE","Hemons Scrolls"); +define("HASTE_DESC","All troops in the area of effect move faster."); +define("HASTE_SMALL","The slight titan boots"); +define("HASTE_SMALLVILLAGE","Opal Horseshoe"); +define("HASTE_LARGE","The great titan boots"); +define("HASTE_LARGEVILLAGE","Golden Chariot"); +define("HASTE_UNIQUE","The unique titan boots"); +define("HASTE_UNIQUEVILLAGE","Pheidippides Sandals"); +define("EYESIGHT_DESC","All spies (Scouts, Pathfinders, and Equites Legati) increase their spying ability. In addition, with all versions of this artifact you can see the incoming TYPE of troops but not how many there are."); +define("EYESIGHT_SMALL","The eagles slight eyes"); +define("EYESIGHT_SMALLVILLAGE","Tale of a Rat"); +define("EYESIGHT_LARGE","The eagles great eyes"); +define("EYESIGHT_LARGEVILLAGE","Generals Letter"); +define("EYESIGHT_UNIQUE","The eagles unique eyes"); +define("EYESIGHT_UNIQUEVILLAGE","Diary of Sun Tzu"); +define("DIET_DESC","All troops in the artifacts range consume less wheat, making it possible to maintain a larger army."); +define("DIET_SMALL","Slight diet control"); +define("DIET_SMALLVILLAGE","Silver Platter"); +define("DIET_LARGE","Great diet control"); +define("DIET_LARGEVILLAGE","Sacred Hunting Bow"); +define("DIET_UNIQUE","Unique diet control"); +define("DIET_UNIQUEVILLAGE","King Arthurs Chalice"); +define("ACADEMIC_DESC","Troops are built a certain percentage faster within the scope of the artifact."); +define("ACADEMIC_SMALL","The trainers slight talent"); +define("ACADEMIC_SMALLVILLAGE","Scribed Soldiers Oath"); +define("ACADEMIC_LARGE","The trainers great talent"); +define("ACADEMIC_LARGEVILLAGE","Declaration of War"); +define("ACADEMIC_UNIQUE","The trainers unique talent"); +define("ACADEMIC_UNIQUEVILLAGE","Memoirs of Alexander the Great"); +define("STORAGE_DESC","With this building plan you are able to build the Great Granary or Great Warehouse in the Village with the artifact, or the whole account depending on the artifact. As long as you posses that artifact you are able to build and enlarge those buildings."); +define("STORAGE_SMALL","Slight storage masterplan"); +define("STORAGE_SMALLVILLAGE","Builders Sketch"); +define("STORAGE_LARGE","Great storage masterplan"); +define("STORAGE_LARGEVILLAGE","Babylonian Tablet"); +define("CONFUSION_DESC","Cranny capacity is increased by a certain amount for each type of artifact. Catapults can only shoot random on villages within this artifacts power. Exceptions are the WW which can always be targeted and the treasure chamber which can always be targeted, except with the unique artifact. When aiming at a resource field only random resource fields can be hit, when aiming at a building only random buildings can be hit."); +define("CONFUSION_SMALL","Rivals slight confusion"); +define("CONFUSION_SMALLVILLAGE","Map of the Hidden Caverns"); +define("CONFUSION_LARGE","Rivals great confusion"); +define("CONFUSION_LARGEVILLAGE","Bottomless Satchel"); +define("CONFUSION_UNIQUE","Rivals unique confusion"); +define("CONFUSION_UNIQUEVILLAGE","Trojan Horse"); +define("FOOL_DESC","Every 24 hours it gets a random effect, bonus, or penalty (all are possible with the exception of great warehouse, great granary and WW building plans). They change effect AND scope every 24 hours. The unique artifact will always take positive bonuses."); +define("FOOL_SMALL","Artefact of the slight fool"); +define("FOOL_SMALLVILLAGE","Pendant of Mischief"); +define("FOOL_UNIQUE","Artefact of the unique fool"); +define("FOOL_UNIQUEVILLAGE","Forbidden Manuscript"); +define("ARTEFACT","Construction plans + + + +Countless days have passed since the first battles upon the walls of the cursed villages of the Dread Natars, many armies of both the free ones and the Natarian empire struggled and died before the walls of the many strongholds from which the Natars had once ruled all creation. Now with the dust settled and a relative calm having settled in, armies began to count their losses and collect their dead, the stench of combat still lingering in the night air, a smell of a slaughter unforgettable in its extent and brutality yet soon to be dwarfed by yet others. The largest armies of the free ones and the Dread Natars were marshalling for yet another renewed assault upon the coveted former strongholds of the Natarian Empire. + +Soon scouts arrived telling of a most awesome sight and a chilling reminder, a dread army of an unfathomable size had been spotted marshalling at the end of the world, the Natarian capital, a force so great and unstoppable that the dust from their march would choke off all light, a force so brutal and ruthless that it would crush all hope. The free people knew that they had to race now, race against time and the endless hordes of the Natarian Empire to raise a Wonder of the World to restore the world to peace and vanquish the Natarian threat. + +But to raise such a great Wonder would be no easy task, one would need construction plans created in the distant past, plans of such an arcane nature that even the very wisest of sages knew not their contents or locations. + +Tens of thousands of scouts roamed across all existence searching in vain for these mystical plans, looking in all places but the dreaded Natarian Capital, yet could not find them. Today however, they return bearing good news, they return baring the locations of the plans, hidden by the armies of the Natars inside secret strongholds constructed to be hidden from the eyes of man. + +Now begins the final stretch, when the greatest armies of the Free people and the Natars will clash across the world for the fate of all that lies under heaven. This is the war that will echo across the eons, this is your war, and here you shall etch your name across history, here you shall become legend. + + +Facts: +To steal one, the following things must happen: +You must attack the village (NO Raid!) +WIN the Attack +Destroy the treasury +An empty treasury lvl 10 MUST be in the village where that attack came from +Have a hero in an attack + +If not, the next attack on that village, winning with a hero and empty treasury will take the building plan. + +To build a WW, you must own a plan yourself (you = the WW village owner) from lvl 0 to 50, from 51 to 100 you need an additional plan in your alliance! Two plans in the WW village account would not work! + +The construction plans are conquerable immediately when they appear to the server. + +There will be a countdown in game, showing the exact time of the release, 5 days prior to the launch. "); + + +//Building Plans +define("PLAN","Ancient Construction Plan"); +define("PLANVILLAGE","WW Buildingplan"); +define("PLAN_DESC","With this ancient construction plan you will able to build World Wonder to level 50. to build further, your alliance must hold at least two plans."); +define("PLAN_INFO","World Wonder Construction Plans + + +Many moons ago the tribes of Travian were surprised by the unforeseen return of the Natars. This tribe from immemorial times surpassing all in wisdom, might and glory was about to trouble the free ones again. Thus they put all their efforts in preparing a last war against the Natars and vanquishing them forever. Many thought about the so-called 'Wonders of the World', a construction of many legends, as the only solution. It was told that it would render anyone invincible once completed. Ultimately making the constructors the rulers and conquerors of all known Travian. + +However, it was also told that one would need construction plans to construct such a building. Due to this fact, the architects devised cunning plans about how to store these safely. After a while, one could see temple-like buildings in many a city and metropolis - the Treasure Chambers (Treasuries). + +Sadly, no one - not even the wise and well versed - knew where to find these construction plans. The harder people tried to locate them, the more it seemed as if they where only legends. + +Today, however, this last secret will be revealed. Deprivations and endeavors of the past will not have been in vain, as today scouts of several tribes have successfully obtained the whereabouts of the construction plans. Well guarded by the Natars, they lie hidden in several oases to be found all over Travian. Only the most valiant heroes will be able to secure such a plan and bring it home safely so that the construction can begin. + +In the end, we will see whether the free tribes of Travian can once again outwit the Natars and vanquish them once and for all. Do not be so foolish as to assume that the Natars will leave without a fight, though! + + + +To steal a set of Construction Plans from the Natars, the following things must happen: +- You must Attack the village (NOT Raid!) +- You must WIN the Attack +- You must DESTROY the Treasure Chamber (Treasury) +- Your Hero MUST be in that attack, as he is the only one who may carry the Construction Plans +- An empty level 10 Treasure Chamber (Treasury) MUST be in the village where that attack came from +NOTE: If the above criteria is not met during the attack, the next attack on that village which does meet the above criteria will take the Construction Plans. + + + +To build a Treasure Chamber (Treasury), you will need a Main Building level 10 and the village MUST NOT be contain a World Wonder. + +To build a World Wonder, you must own the Construction Plans yourself (you = the World Wonder Village Owner) from level 0 to 50, and then from level 51 to 100 you will need an additional set of Construction Plans in your Alliance! Two sets of Construction Plans in the World Wonder Village Account will not work!"); +define("WWVILLAGE","WW village"); + +/* +|-------------------------------------------------------------------------- +| Index +|-------------------------------------------------------------------------- +*/ + + $lang['index'][0][1] = "DobrodoÅ¡li na " . SERVER_NAME . ""; + $lang['index'][0][2] = "Manual"; + $lang['index'][0][3] = "Igraj sada, besplatno!"; + $lang['index'][0][4] = "Å ta je " . SERVER_NAME . ""; + $lang['index'][0][5] = "" . SERVER_NAME . " je browser igra sa angažovanim drevnim svetom sa hiljadama drugih pravih igraÄa.

      To je free to play igra i ne zahteva skidanje programa."; + $lang['index'][0][6] = "Kliknite ovde da igrate " . SERVER_NAME . ""; + $lang['index'][0][7] = "Totalno igraÄa"; + $lang['index'][0][8] = "Aktivnih igraÄa"; + $lang['index'][0][9] = "Na mreži"; + $lang['index'][0][10] = "O Igri"; + $lang['index'][0][11] = "PoÄecÌete kao Å¡ef malog sela i krenete u uzbudljivu potragu."; + $lang['index'][0][12] = "Izgradite sela, ratne ratove ili uspostavite trgovinske puteve sa svojim susedima."; + $lang['index'][0][13] = "Igrajte sa i protiv hiljada drugih pravih igraÄa i osvojite svet Traviana."; + $lang['index'][0][14] = "News"; + $lang['index'][0][15] = "FAQ"; + $lang['index'][0][16] = "Screenshots"; + $lang['forum'] = "Forum"; + $lang['register'] = "Registruj se"; + $lang['login'] = "Prijavi se"; + $lang['screenshots']['title1']="Village"; + $lang['screenshots']['desc1']="Village building"; + $lang['screenshots']['title2']="Resource"; + $lang['screenshots']['desc2']="Village resource is wood, clay, iron and crop"; + $lang['screenshots']['title3']="Map"; + $lang['screenshots']['desc3']="Location your village in map"; + $lang['screenshots']['title4']="Contruct Building"; + $lang['screenshots']['desc4']="How to contruct building or resource level"; + $lang['screenshots']['title5']="Report"; + $lang['screenshots']['desc5']="Your attack report"; + $lang['screenshots']['title6']="Statistics"; + $lang['screenshots']['desc6']="View your ranking in statistics"; + $lang['screenshots']['title7']="Weapons or dough"; + $lang['screenshots']['desc7']="You can choose to play as military or economy"; + + +?> From 9d73275522927309367c2ad990356796507fdc80 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Wed, 22 Nov 2017 18:58:16 +0100 Subject: [PATCH 020/126] fix: incorrect hero return time calculation --- GameEngine/Automation.php | 11 ++--- GameEngine/Database.php | 2 +- Templates/Build/16_walking.tpl | 18 +++---- Templates/a2b/attack.tpl | 90 ++++++++++++++++------------------ Templates/a2b/attack_5.tpl | 72 +++++++++++++-------------- 5 files changed, 93 insertions(+), 100 deletions(-) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index efb09dbb..96699dc8 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -2204,7 +2204,7 @@ class Automation { } } if ($herosend_att>0){ - $hero_unit = $database->getHeroField($from['owner'], 'unit', false); + $hero_unit = $database->getHeroField($from['owner'], 'unit'); $speeds[] = $GLOBALS['u'.$hero_unit]['speed']; } @@ -2803,7 +2803,7 @@ class Automation { } if ($prisoner['t11']>0){ - $p_hero_unit = $database->getHeroField($p_owner, 'unit', false)['unit']; + $p_hero_unit = $database->getHeroField($p_owner, 'unit'); $p_speeds[] = $GLOBALS['u'.$p_hero_unit]['speed']; } @@ -3004,7 +3004,7 @@ class Automation { } if ($herosend_att>0){ - $hero_unit = $database->getHeroField($from['owner'], 'unit', false)['unit']; + $hero_unit = $database->getHeroField($from['owner'], 'unit'); $speeds[] = $GLOBALS['u'.$hero_unit]['speed']; } @@ -3325,10 +3325,7 @@ class Automation { } if (isset($post['t11'])){ if( $post['t11'] != '' && $post['t11'] > 0){ - $qh = "SELECT unit FROM ".TB_PREFIX."hero WHERE uid = ".(int) $from['owner']." AND dead = 0"; - $resulth = mysqli_query($GLOBALS['link'],$qh); - $hero_f=mysqli_fetch_array($resulth); - $hero_unit=$hero_f['unit']; + $hero_unit = getHeroField($from['owner'], 'unit'); $speeds[] = $GLOBALS['u'.$hero_unit]['speed']; } else { $post['t11']='0'; diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 798577b9..88601b18 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -5717,7 +5717,7 @@ References: User ID/Message ID, Mode $q = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = $uid AND dead = 0"; $result = mysqli_query($this->dblink,$q); - self::$heroFieldCache[$uid.$field] = $this->mysqli_fetch_all($result); + self::$heroFieldCache[$uid.$field] = $this->mysqli_fetch_all($result)[0]; return self::$heroFieldCache[$uid.$field][$field]; } diff --git a/Templates/Build/16_walking.tpl b/Templates/Build/16_walking.tpl index d3d527f5..bc9820e8 100644 --- a/Templates/Build/16_walking.tpl +++ b/Templates/Build/16_walking.tpl @@ -19,12 +19,12 @@ if($units[$y]['attack_type'] == 4){ $attack_type = RAID_ON; } $isoasis = $database->isVillageOases($units[$y]['to']); -if ($isoasis ==0){ +if ($isoasis ==0){ $to = $database->getMInfo($units[$y]['to']); } else { $to = $database->getOMInfo($units[$y]['to']);} ?> - +
      @@ -35,10 +35,10 @@ $to = $database->getOMInfo($units[$y]['to']);} "; for($i=($session->tribe-1)*10+1;$i<=$session->tribe*10;$i++) { - echo ""; + echo ""; } if($units[$y]['t11'] != 0) { - echo ""; + echo ""; } ?> @@ -84,17 +84,17 @@ $to = $database->getOMInfo($units[$y]['to']);} - + getMovement(5,$village->wid,0); + $settlers = $database->getMovement(5,$village->wid,0); if($settlers){ $total_for = count($settlers); for($y=0;$y<$total_for;$y++){ $timer += 1; - + ?> -
      vname; ?> getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" />getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" />\"Hero\"\"Hero\"
      +
      @@ -108,7 +108,7 @@ $timer += 1; $end = ($tribe*10); echo ""; for($i=$start;$i<=($end);$i++) { - echo ""; + echo ""; } ?> diff --git a/Templates/a2b/attack.tpl b/Templates/a2b/attack.tpl index 190bba68..df279f02 100644 --- a/Templates/a2b/attack.tpl +++ b/Templates/a2b/attack.tpl @@ -38,16 +38,16 @@ $ckey= $generator->generateRandStr(6); if (!isset($process['t1']) || $process['t1'] == ''){ $t1='0'; }else{ $t1=$process['t1']; } - if (!isset($process['t2']) || $process['t2'] == ''){ $t2='0'; }else{ $t2=$process['t2']; } - if (!isset($process['t3']) || $process['t3'] == ''){ $t3='0'; }else{ $t3=$process['t3']; if ($session->tribe == 3){ $scout=1; } } - if (!isset($process['t4']) || $process['t4'] == ''){ $t4='0'; }else{ $t4=$process['t4']; if ($session->tribe == 1 || $session->tribe == 2 || $session->tribe == 4 || $session->tribe == 5){ $scout=1;} } - if (!isset($process['t5']) || $process['t5'] == ''){ $t5='0'; }else{ $t5=$process['t5']; } - if (!isset($process['t6']) || $process['t6'] == ''){ $t6='0'; }else{ $t6=$process['t6']; } - if (!isset($process['t7']) || $process['t7'] == ''){ $t7='0'; }else{ $t7=$process['t7']; } - if (!isset($process['t8']) || $process['t8'] == ''){ $t8='0'; }else{ $t8=$process['t8']; } - if (!isset($process['t9']) || $process['t9'] == ''){ $t9='0'; }else{ $t9=$process['t9']; } - if (!isset($process['t10']) || $process['t10'] == ''){ $t10='0'; }else{ $t10=$process['t10']; } - if (!isset($process['t11']) || $process['t11'] == ''){ $t11='0'; }else{ $t11=$process['t11']; $showhero=1;} + if (!isset($process['t2']) || $process['t2'] == ''){ $t2='0'; }else{ $t2=$process['t2']; } + if (!isset($process['t3']) || $process['t3'] == ''){ $t3='0'; }else{ $t3=$process['t3']; if ($session->tribe == 3){ $scout=1; } } + if (!isset($process['t4']) || $process['t4'] == ''){ $t4='0'; }else{ $t4=$process['t4']; if ($session->tribe == 1 || $session->tribe == 2 || $session->tribe == 4 || $session->tribe == 5){ $scout=1;} } + if (!isset($process['t5']) || $process['t5'] == ''){ $t5='0'; }else{ $t5=$process['t5']; } + if (!isset($process['t6']) || $process['t6'] == ''){ $t6='0'; }else{ $t6=$process['t6']; } + if (!isset($process['t7']) || $process['t7'] == ''){ $t7='0'; }else{ $t7=$process['t7']; } + if (!isset($process['t8']) || $process['t8'] == ''){ $t8='0'; }else{ $t8=$process['t8']; } + if (!isset($process['t9']) || $process['t9'] == ''){ $t9='0'; }else{ $t9=$process['t9']; } + if (!isset($process['t10']) || $process['t10'] == ''){ $t10='0'; }else{ $t10=$process['t10']; } + if (!isset($process['t11']) || $process['t11'] == ''){ $t11='0'; }else{ $t11=$process['t11']; $showhero=1;} if ($session->tribe == 3){ $totalunits = (!empty($process['t1']) ? $process['t1'] : 0) + (!empty($process['t2']) ? $process['t2'] : 0) + @@ -59,7 +59,7 @@ $ckey= $generator->generateRandStr(6); (!empty($process['t9']) ? $process['t9'] : 0) + (!empty($process['t10']) ? $process['t10'] : 0) + (!empty($process['t11']) ? $process['t11'] : 0); - + }else{ $totalunits = (!empty($process['t1']) ? $process['t1'] : 0) + (!empty($process['t2']) ? $process['t2'] : 0) + @@ -106,7 +106,7 @@ $start = ($tribe-1)*10+1; $end = ($tribe*10); ?> -

      +

      vname; ?>
       getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" />getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" />
      @@ -154,14 +154,14 @@ $end = ($tribe*10); - getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" />"; + echo ""; } if (!empty($process['t11'])){ - echo ""; - + echo ""; + }?> - + @@ -204,7 +204,7 @@ $end = ($tribe*10); - + @@ -212,7 +212,7 @@ $end = ($tribe*10); - + ?> @@ -354,7 +354,7 @@ $end = ($tribe*10); - + tribe-1)*10+$i)}['speed']; + if ($i<11) + $speeds[] = ${'u'.(($session->tribe-1)*10+$i)}['speed']; else { - //$uid - $q = "SELECT unit FROM ".TB_PREFIX."hero WHERE uid = ".(int) $uid." AND dead = 0"; - $result = mysqli_query($GLOBALS['link'],$q); - $hero_f=mysqli_fetch_array($result); - $hero_unit=$hero_f['unit']; - $speeds[] = ${'u'.$hero_unit}['speed']; + $hero_unit = $database->getHeroField($uid, 'unit'); + $speeds[] = ${'u'.$hero_unit}['speed']; } if($i != 4) @@ -393,7 +389,7 @@ $end = ($tribe*10); } - + } @@ -401,7 +397,7 @@ $end = ($tribe*10); - + if($scout) @@ -434,7 +430,7 @@ $end = ($tribe*10); ?> - +
      getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" />\"Hero\"\"Hero\"
      Destination: "> - +
      Destination: "> ONLY shoot with a normal attack (they dont shoot with raids!)"; ?> Arrived:"> @@ -450,13 +446,13 @@ $end = ($tribe*10);
      - + - + - + - + @@ -465,11 +461,11 @@ $end = ($tribe*10); if(($database->hasBeginnerProtection($village->wid)==1)&&($database->hasBeginnerProtection($process['0'])==0)){ echo"Caution: Attacking a player will lose the protection!"; } - if($database->hasBeginnerProtection($process['0'])==1) { + if($database->hasBeginnerProtection($process['0'])==1) { echo"User presently has beginners protection"; } else { ?> -

      diff --git a/Templates/a2b/attack_5.tpl b/Templates/a2b/attack_5.tpl index d092a4cf..39e59acf 100644 --- a/Templates/a2b/attack_5.tpl +++ b/Templates/a2b/attack_5.tpl @@ -40,22 +40,22 @@ $ckey= $generator->generateRandStr(6); if (!isset($process['t1']) || $process['t1'] == ''){ $t1='0'; }else{ $t1=$process['t1']; } - if (!isset($process['t2']) || $process['t2'] == ''){ $t2='0'; }else{ $t2=$process['t2']; } - if (!isset($process['t3']) || $process['t3'] == ''){ $t3='0'; }else{ $t3=$process['t3']; $scout=1; } - if (!isset($process['t4']) || $process['t4'] == ''){ $t4='0'; }else{ $t4=$process['t4']; } - if (!isset($process['t5']) || $process['t5'] == ''){ $t5='0'; }else{ $t5=$process['t5']; } - if (!isset($process['t6']) || $process['t6'] == ''){ $t6='0'; }else{ $t6=$process['t6']; } - if (!isset($process['t7']) || $process['t7'] == ''){ $t7='0'; }else{ $t7=$process['t7']; } - if (!isset($process['t8']) || $process['t8'] == ''){ $t8='0'; }else{ $t8=$process['t8']; } - if (!isset($process['t9']) || $process['t9'] == ''){ $t9='0'; }else{ $t9=$process['t9']; } - if (!isset($process['t10']) || $process['t10'] == ''){ $t10='0'; }else{ $t10=$process['t10']; } - if (!isset($process['t11']) || $process['t11'] == ''){ $t11='0'; }else{ $t11=$process['t11']; } + if (!isset($process['t2']) || $process['t2'] == ''){ $t2='0'; }else{ $t2=$process['t2']; } + if (!isset($process['t3']) || $process['t3'] == ''){ $t3='0'; }else{ $t3=$process['t3']; $scout=1; } + if (!isset($process['t4']) || $process['t4'] == ''){ $t4='0'; }else{ $t4=$process['t4']; } + if (!isset($process['t5']) || $process['t5'] == ''){ $t5='0'; }else{ $t5=$process['t5']; } + if (!isset($process['t6']) || $process['t6'] == ''){ $t6='0'; }else{ $t6=$process['t6']; } + if (!isset($process['t7']) || $process['t7'] == ''){ $t7='0'; }else{ $t7=$process['t7']; } + if (!isset($process['t8']) || $process['t8'] == ''){ $t8='0'; }else{ $t8=$process['t8']; } + if (!isset($process['t9']) || $process['t9'] == ''){ $t9='0'; }else{ $t9=$process['t9']; } + if (!isset($process['t10']) || $process['t10'] == ''){ $t10='0'; }else{ $t10=$process['t10']; } + if (!isset($process['t11']) || $process['t11'] == ''){ $t11='0'; }else{ $t11=$process['t11']; } $totalunits =$process['t1']+$process['t2']+$process['t4']+$process['t5']+$process['t6']+$process['t7']+$process['t8']+$process['t9']+$process['t10']+$process['t11']; if ($scout==1 && $totalunits==0) { $process['c'] = 1; -} +} $id = $database->addA2b($ckey,time(),$process['0'],$t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$t10,$t11,$process['c']); @@ -77,7 +77,7 @@ $actionType = "Raid"; ?> -

      +

      @@ -123,7 +123,7 @@ $actionType = "Raid"; - +
    Destination: "> ONLY shoot with a normal attack (they dont shoot with raids!)"; ?> Arrived:">
    in getTimeFormat($time); ?>
    - +
    at procMtime(date('U')+$time,9)?> hours
    - + - + - + - + -

    From 0b3f689e4c30ef9c0283c51f520ebae4cbfea803 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Wed, 22 Nov 2017 19:43:58 +0100 Subject: [PATCH 021/126] fix: beginner's protection shown wrong date and time in profile picture --- Admin/Templates/playeradditionalinfo.tpl | 2 +- Admin/admin.php | 129 ++++++++++------------- Templates/Profile/medal.php | 12 +-- src/Utils/DateTime.php | 45 ++++++++ 4 files changed, 105 insertions(+), 83 deletions(-) create mode 100644 src/Utils/DateTime.php diff --git a/Admin/Templates/playeradditionalinfo.tpl b/Admin/Templates/playeradditionalinfo.tpl index 73cb1f2a..ccb4c256 100644 --- a/Admin/Templates/playeradditionalinfo.tpl +++ b/Admin/Templates/playeradditionalinfo.tpl @@ -98,7 +98,7 @@ else { $tsdiffact = $datetime - $now; - $timetoecho = $timeformat->getTimeFormat($tsdiffact); + $timetoecho = \App\Utils\DateTime::getTimeFormat($tsdiffact); echo ''; echo " $timetoecho"; } diff --git a/Admin/admin.php b/Admin/admin.php index 1069e6d7..e7aa1351 100644 --- a/Admin/admin.php +++ b/Admin/admin.php @@ -22,30 +22,7 @@ include_once("../GameEngine/config.php"); include_once("../GameEngine/Database.php"); include_once ("../GameEngine/Lang/" . LANG . ".php"); include_once("../GameEngine/Admin/database.php"); -include_once("../GameEngine/Data/buidata.php"); - -class timeFormatGenerator -{ - public function getTimeFormat($time) - { - $min = 0; - $hr = 0; - $days = 0; - while ($time >= 60): $time -= 60; $min += 1; endwhile; - while ($min >= 60): $min -= 60; $hr += 1; endwhile; - while ($hr >= 24): $hr -= 24; $days +=1; endwhile; - if ($min < 10) - { - $min = "0".$min; - } - if($time < 10) - { - $time = "0".$time; - } - return $days ." day ".$hr."h ".$min."m ".$time."s"; - } -}; -$timeformat = new timeFormatGenerator; +include_once("../GameEngine/Data/buidata.php"); include('Templates/ver.tpl'); include('Templates/update_latest.tpl'); @@ -58,131 +35,131 @@ if (!empty($_GET['p'])) { case 'server_info': $subpage = 'Server Info'; break; - + case 'online': $subpage = 'Online Users'; break; - + case 'notregistered': $subpage = 'Players Not Activated'; break; - + case 'inactive': $subpage = 'Players Inactivate'; break; - + case 'report': $subpage = 'Players Reported'; break; - + case 'map': $subpage = 'Map'; break; - + case 'search': $subpage = 'General Search'; break; - + case 'message': $subpage = 'Search IGMs/Reports'; break; - + case 'ban': $subpage = 'Ban/Unban Players'; break; - + case 'maintenence': $subpage = 'Server Maintenence'; break; - + case 'cleanban': $subpage = 'Clean Banlist Data'; break; - + case 'gold': $subpage = 'Give All Free Gold'; break; - + case 'usergold': $subpage = 'Give Free Gold To Specific User'; break; - + case 'maintenenceResetGold': $subpage = 'Reset Gold'; break; - + case 'delmedal': $subpage = 'Delete Player Medals'; break; - + case 'delallymedal': $subpage = 'Delete Ally Medals'; break; - + case 'givePlus': $subpage = 'Give All Plus'; break; - + case 'maintenenceResetPlus': $subpage = 'Reset Plus'; break; - + case 'givePlusRes': $subpage = 'Give All Res Bonus'; break; - + case 'maintenenceResetPlusBonus': $subpage = 'Reset Res Bonus'; break; - + case 'addUsers': $subpage = 'Create Users'; break; - + case 'natarend': $subpage = 'Add WW Villages'; break; - + case 'natarbuildingplan': $subpage = 'Add WW Building Plan Villages'; break; - + case 'admin_log': $subpage = 'Admin Log'; break; - + case 'config': $subpage = 'Server Settings'; break; - + case 'editServerSet': $subpage = 'Server Configuration'; break; - + case 'editPlusSet': $subpage = 'PLUS Settings'; break; - + case 'editLogSet': $subpage = 'Log Settings'; break; - + case 'editNewsboxSet': $subpage = 'NewsBox Settings'; break; - + case 'editExtraSet': $subpage = 'Extra Settings'; break; - + case 'editAdminInfo': $subpage = 'Edit Admin Information'; break; - + case 'resetServer': $subpage = 'Server Resetting'; break; - + case 'player': if (!empty($_GET['uid'])) { $displayarray = $database->getUserArray($_GET['uid'],1); @@ -192,7 +169,7 @@ if (!empty($_GET['p'])) { $subpage = 'Player Details (no player)'; } break; - + case 'editUser': if (!empty($_GET['uid'])) { $user = $database->getUserArray($_GET['uid'],1); @@ -201,7 +178,7 @@ if (!empty($_GET['p'])) { $subpage = 'Edit Player (no player)'; } break; - + case 'deletion': if (!empty($_GET['uid'])) { $user = $database->getUserArray($_GET['uid'],1); @@ -210,7 +187,7 @@ if (!empty($_GET['p'])) { $subpage = 'Delete Player (no player)'; } break; - + case 'Newmessage': if (!empty($_GET['uid'])) { $user = $database->getUserArray($_GET['uid'],1); @@ -219,7 +196,7 @@ if (!empty($_GET['p'])) { $subpage = 'Compose Message'; } break; - + case 'editPlus': if (!empty($_GET['uid'])) { $user = $database->getUserArray($_GET['uid'],1); @@ -228,7 +205,7 @@ if (!empty($_GET['p'])) { $subpage = 'Edit Plus & Resources'; } break; - + case 'editSitter': if (!empty($_GET['uid'])) { $user = $database->getUserArray($_GET['uid'],1); @@ -237,7 +214,7 @@ if (!empty($_GET['p'])) { $subpage = 'Edit Sitters '; } break; - + case 'editOverall': if (!empty($_GET['uid'])) { $user = $database->getUserArray($_GET['uid'],1); @@ -246,7 +223,7 @@ if (!empty($_GET['p'])) { $subpage = 'Edit Off & Def'; } break; - + case 'editWeek': if (!empty($_GET['uid'])) { $user = $database->getUserArray($_GET['uid'],1); @@ -255,7 +232,7 @@ if (!empty($_GET['p'])) { $subpage = 'Edit Weekly Off & Def'; } break; - + case 'userlogin': if (!empty($_GET['uid'])) { $player = mysqli_fetch_assoc(mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".(int) $_GET['uid'])); @@ -264,7 +241,7 @@ if (!empty($_GET['p'])) { $subpage = 'User Logins (no player)'; } break; - + case 'userillegallog': if (!empty($_GET['uid'])) { $player = mysqli_fetch_assoc(mysqli_query($GLOBALS["link"], "SELECT * FROM ".TB_PREFIX."users WHERE id = ".(int) $_GET['uid'])); @@ -273,7 +250,7 @@ if (!empty($_GET['p'])) { $subpage = 'User Illegals Log (no player)'; } break; - + case 'editHero': if (!empty($_GET['uid'])) { $user = $database->getUserArray($_GET['uid'],1); @@ -282,7 +259,7 @@ if (!empty($_GET['p'])) { $subpage = 'Edit Hero'; } break; - + case 'editAdditional': if (!empty($_GET['uid'])) { $user = $database->getUserArray($_GET['uid'],1); @@ -291,7 +268,7 @@ if (!empty($_GET['p'])) { $subpage = 'Edit Additional Info'; } break; - + case 'village': if (!empty($_GET['did'])) { $village = $database->getVillage($_GET['did']); @@ -301,7 +278,7 @@ if (!empty($_GET['p'])) { $subpage = 'Edit Village (no village)'; } break; - + case 'editResources': if (!empty($_GET['did'])) { $village = $database->getVillage($_GET['did']); @@ -311,7 +288,7 @@ if (!empty($_GET['p'])) { $subpage = 'Edit Resources (no village)'; } break; - + case 'addTroops': if (!empty($_GET['did'])) { $village = $database->getVillage($_GET['did']); @@ -321,7 +298,7 @@ if (!empty($_GET['p'])) { $subpage = 'Edit Troops (no village)'; } break; - + case 'addABTroops': if (!empty($_GET['did'])) { $village = $database->getVillage($_GET['did']); @@ -331,7 +308,7 @@ if (!empty($_GET['p'])) { $subpage = 'Upgrade Troops (no village)'; } break; - + case 'editVillage': if (!empty($_GET['did'])) { $village = $database->getVillage($_GET['did']); @@ -341,7 +318,7 @@ if (!empty($_GET['p'])) { $subpage = 'Edit Village (no village)'; } break; - + case 'villagelog': if (!empty($_GET['did'])) { $village = $database->getVillage($_GET['did']); @@ -351,7 +328,7 @@ if (!empty($_GET['p'])) { $subpage = 'Build Log (no village)'; } break; - + case 'techlog': if (!empty($_GET['did'])) { $village = $database->getVillage($_GET['did']); @@ -449,8 +426,8 @@ if (!empty($_GET['p'])) { function go_url(url) { location=url; return(false); - } - + } +
    diff --git a/Templates/Profile/medal.php b/Templates/Profile/medal.php index abcfb3c7..99cb487a 100644 --- a/Templates/Profile/medal.php +++ b/Templates/Profile/medal.php @@ -1,4 +1,4 @@ -getUserField($_SESSION['username'], 'gpack', 1); @@ -24,14 +24,14 @@ $gpack= $separator.GP_LOCATE; } else { $gpack= $separator.$gpack_load; - } + } //de bird if($displayarray['protect'] > time()){ $secondsDiff = $displayarray['protect'] - time(); $remainingDay = floor($secondsDiff/(3600*24)); -$left = "$remainingDay days ".date("H:i:s", $secondsDiff); +$left = \App\Utils\DateTime::getTimeFormat($secondsDiff); $profiel = preg_replace("/\[#0]/is",'', $profiel, 1); } else { $geregistreerd=date('d-m-Y', ($displayarray['regtime'])); @@ -169,7 +169,7 @@ switch ($medal['categorie']) { break; case "10": $titel="Rank Climbers of the week."; - $woord="Ranks"; + $woord="Ranks"; break; case "11": $titel="Receiving this medal shows that you were in the top 3 of the Rank Climbers of the week ".$medal['points']." in a row."; @@ -195,7 +195,7 @@ switch ($medal['categorie']) { $titel="Receiving this medal shows that you were in the top 10 Rank Climbers of the week ".$medal['points']." in a row."; $bonus[$medal['id']]=1; break; - + } diff --git a/src/Utils/DateTime.php b/src/Utils/DateTime.php new file mode 100644 index 00000000..467da31b --- /dev/null +++ b/src/Utils/DateTime.php @@ -0,0 +1,45 @@ += 60): $time -= 60; $min += 1; endwhile; + while ($min >= 60): $min -= 60; $hr += 1; endwhile; + while ($hr >= 24): $hr -= 24; $days +=1; endwhile; + if ($min < 10) + { + $min = "0".$min; + } + if($time < 10) + { + $time = "0".$time; + } + return $days ." day ".$hr."h ".$min."m ".$time."s"; + } + +} \ No newline at end of file From 448504694a091fd210894ac8578515877023c248 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Wed, 22 Nov 2017 19:51:31 +0100 Subject: [PATCH 022/126] fix: using getTimeFormat from DateTime project class everywhere in Admin --- Admin/Templates/playerplusbonus.tpl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Admin/Templates/playerplusbonus.tpl b/Admin/Templates/playerplusbonus.tpl index 4881799f..935d4dd1 100644 --- a/Admin/Templates/playerplusbonus.tpl +++ b/Admin/Templates/playerplusbonus.tpl @@ -18,7 +18,7 @@ else { $tsdiffact = $datetime - $now; - $timetoecho = $timeformat->getTimeFormat($tsdiffact); + $timetoecho = \App\Utils\DateTime::getTimeFormat($tsdiffact); echo ''; echo " $timetoecho"; } @@ -55,7 +55,7 @@ else { $tsdiffact = $datetime - $now; - $timetoecho = $timeformat->getTimeFormat($tsdiffact); + $timetoecho = \App\Utils\DateTime::getTimeFormat($tsdiffact); echo ''; echo " $timetoecho"; } @@ -92,7 +92,7 @@ else { $tsdiffact = $datetime - $now; - $timetoecho = $timeformat->getTimeFormat($tsdiffact); + $timetoecho = \App\Utils\DateTime::getTimeFormat($tsdiffact); echo ''; echo " $timetoecho"; } @@ -130,7 +130,7 @@ else { $tsdiffact = $datetime - $now; - $timetoecho = $timeformat->getTimeFormat($tsdiffact); + $timetoecho = \App\Utils\DateTime::getTimeFormat($tsdiffact); echo ''; echo " $timetoecho"; } @@ -168,7 +168,7 @@ else { $tsdiffact = $datetime - $now; - $timetoecho = $timeformat->getTimeFormat($tsdiffact); + $timetoecho = \App\Utils\DateTime::getTimeFormat($tsdiffact); echo ''; echo " $timetoecho"; } From 96663574ad816951703c01fdfc93a0f2cd54b89f Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Wed, 22 Nov 2017 20:12:31 +0100 Subject: [PATCH 023/126] fix: compatibility issue with MySQL 5.7 --- GameEngine/Database.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 88601b18..7eddc1b7 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -3845,9 +3845,9 @@ class MYSQLi_DB implements IDbConnection { } if($field != "cp"){ - $q = "SELECT owner, lastupdate, sum(" . $field . ") as Total FROM " . TB_PREFIX . "vdata where owner IN(".implode(', ', $uid).") GROUP BY owner"; + $q = "SELECT owner, MIN(lastupdate), SUM(" . $field . ") as Total FROM " . TB_PREFIX . "vdata where owner IN(".implode(', ', $uid).") GROUP BY owner"; }else{ - $q = "SELECT owner, lastupdate, sum(" . $field . ") as Total FROM " . TB_PREFIX . "vdata where owner IN(".implode(', ', $uid).") and natar = 0 GROUP BY owner"; + $q = "SELECT owner, MIN(lastupdate), SUM(" . $field . ") as Total FROM " . TB_PREFIX . "vdata where owner IN(".implode(', ', $uid).") and natar = 0 GROUP BY owner"; } $result = mysqli_query($this->dblink,$q); From c06c62ba6aacf22938888caf504518b7517b6247 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Wed, 22 Nov 2017 21:38:57 +0100 Subject: [PATCH 024/126] fix: hero training and revive got messed up --- GameEngine/Automation.php | 4 + GameEngine/Database.php | 2 +- GameEngine/Session.php | 11 +- Templates/Build/37_train.tpl | 371 ++++------------------------------- 4 files changed, 49 insertions(+), 339 deletions(-) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 96699dc8..0d4a7ead 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -4635,6 +4635,10 @@ class Automation { if($villunits['hero'] == 0 && $hdata['trainingtime'] < time() && $hdata['intraining'] == 1){ mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET hero = 1 WHERE vref = ".(int) $hdata['wref']); + $columns[] = 'dead'; + $columnValues[] = 0; + $modes[] = null; + $columns[] = 'intraining'; $columnValues[] = 0; $modes[] = null; diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 7eddc1b7..f97e3881 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -7500,7 +7500,7 @@ References: function getHeroDeadReviveOrInTraining($id) { $id = (int) $id; - $q = "SELECT Count(*) as Total FROM " . TB_PREFIX . "hero WHERE `uid` = $id AND (dead = 0 OR inrevive = 1 OR intraining = 1)"; + $q = "SELECT Count(*) as Total FROM " . TB_PREFIX . "hero WHERE `uid` = $id AND dead = 0 AND inrevive = 0 AND intraining = 0"; $result = mysqli_fetch_array(mysqli_query($this->dblink,$q), MYSQLI_ASSOC); if ($result['Total'] > 0) { return true; diff --git a/GameEngine/Session.php b/GameEngine/Session.php index 523c5929..6fb7318d 100755 --- a/GameEngine/Session.php +++ b/GameEngine/Session.php @@ -208,7 +208,9 @@ class Session { global $database,$link; $villageIDs = implode(', ', $this->villages); - $hero = mysqli_fetch_array( + + // check if hero unit for this player is present anywhere on the map + $heroUnitRegisters = mysqli_fetch_array( mysqli_query($database->dblink, ' SELECT IFNULL((SELECT SUM(hero) from '.TB_PREFIX.'enforcement where `from` IN('.$villageIDs.')), 0) + @@ -220,9 +222,12 @@ class Session { MYSQLI_ASSOC )['herocount']; - $isHeroElsewhere = $database->getHeroDeadReviveOrInTraining($this->uid); + // check if the actual hero is alive or being trained/revived into a living state + $isHeroLivingOrRaising = $database->getHeroDeadReviveOrInTraining($this->uid); - if($isHeroElsewhere && !$hero) { + // if he doesn't register anywhere on the map but is marked as alive, + // we need to kill him + if(!$heroUnitRegisters && $isHeroLivingOrRaising) { $database->KillMyHero($this->uid); } } diff --git a/Templates/Build/37_train.tpl b/Templates/Build/37_train.tpl index 7d16acc8..4806dc77 100644 --- a/Templates/Build/37_train.tpl +++ b/Templates/Build/37_train.tpl @@ -618,343 +618,44 @@ $output.=" //HERO TRAINING - if($session->tribe == 1){ - if(isset($_GET['train']) && $_GET['train'] == 1){ - if($session->access != BANNED){ - if($count_hero < 3){ - mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '1', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u1['time'] / SPEED)*3))."', '50', '1')"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u1` = `u1` - 1 WHERE `vref` = '" . (int) $village->wid . "'"); - mysqli_query($GLOBALS['link']," - UPDATE " . TB_PREFIX . "vdata - SET - `wood` = `wood` - ".(int) $u1['wood'].", - `clay` = `clay` - ".(int) $u1['clay'].", - `iron` = `iron` - ".(int) $u1['iron'].", - `crop` = `crop` - ".(int) $u1['crop']." - WHERE - `wref` = '" . (int) $village->wid . "'"); - } - header("Location: build.php?id=".$id.""); - exit; - }else{ - header("Location: banned.php"); - exit; - } - } - if(isset($_GET['train']) && $_GET['train'] == 2){ - if($session->access != BANNED){ - if($count_hero < 3){ - mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '2', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u1['time'] / SPEED)*3))."', '50', '1')"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u2` = `u2` - 1 WHERE `vref` = '" . (int) $village->wid . "'"); - mysqli_query($GLOBALS['link']," - UPDATE " . TB_PREFIX . "vdata - SET - `wood` = `wood` - ".(int) $u2['wood'].", - `clay` = `clay` - ".(int) $u2['clay'].", - `iron` = `iron` - ".(int) $u2['iron'].", - `crop` = `crop` - ".(int) $u2['crop']." - WHERE - `wref` = '" . (int) $village->wid . "'"); - } - header("Location: build.php?id=".$id.""); - exit; - }else{ - header("Location: banned.php"); - exit; - } - } - if(isset($_GET['train']) && $_GET['train'] == 3){ - if($session->access != BANNED){ - mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '3', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u3['time'] / SPEED)*3))."', '50', '1')"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u3` = `u3` - 1 WHERE `vref` = '" . (int) $village->wid . "'"); - mysqli_query($GLOBALS['link']," - UPDATE " . TB_PREFIX . "vdata - SET - `wood` = `wood` - ".(int) $u3['wood'].", - `clay` = `clay` - ".(int) $u3['clay'].", - `iron` = `iron` - ".(int) $u3['iron'].", - `crop` = `crop` - ".(int) $u3['crop']." - WHERE - `wref` = '" . (int) $village->wid . "'"); - header("Location: build.php?id=".$id.""); - exit; - }else{ - header("Location: banned.php"); - exit; - } - } - if(isset($_GET['train']) && $_GET['train'] == 5){ - if($session->access != BANNED){ - if($count_hero < 3){ - mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '5', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u5['time'] / SPEED)*3))."', '50', '1')"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u5` = `u5` - 1 WHERE `vref` = '" . (int) $village->wid . "'"); - mysqli_query($GLOBALS['link']," - UPDATE " . TB_PREFIX . "vdata - SET - `wood` = `wood` - ".(int) $u5['wood'].", - `clay` = `clay` - ".(int) $u5['clay'].", - `iron` = `iron` - ".(int) $u5['iron'].", - `crop` = `crop` - ".(int) $u5['crop']." - WHERE - `wref` = '" . (int) $village->wid . "'"); - } - header("Location: build.php?id=".$id.""); - exit; - }else{ - header("Location: banned.php"); - exit; - } - } - if(isset($_GET['train']) && $_GET['train'] == 6){ - if($session->access != BANNED){ - if($count_hero < 3){ - mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '6', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u6['time'] / SPEED)*3))."', '50', '1')"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u6` = `u6` - 1 WHERE `vref` = '" . (int) $village->wid . "'"); - mysqli_query($GLOBALS['link']," - UPDATE " . TB_PREFIX . "vdata - SET - `wood` = `wood` - ".(int) $u6['wood'].", - `clay` = `clay` - ".(int) $u6['clay'].", - `iron` = `iron` - ".(int) $u6['iron'].", - `crop` = `crop` - ".(int) $u6['crop']." - WHERE - `wref` = '" . (int) $village->wid . "'"); - } - header("Location: build.php?id=".$id.""); - exit; - }else{ - header("Location: banned.php"); - exit; - } - } - } - if($session->tribe == 2){ - if(isset($_GET['train']) && $_GET['train'] == 11){ - if($session->access != BANNED){ - if($count_hero < 3){ - mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '11', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u11['time'] / SPEED)*3))."', '50', '1')"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u11` = `u11` - 1 WHERE `vref` = '" . (int) $village->wid . "'"); - mysqli_query($GLOBALS['link']," - UPDATE " . TB_PREFIX . "vdata - SET - `wood` = `wood` - ".(int) $u11['wood'].", - `clay` = `clay` - ".(int) $u11['clay'].", - `iron` = `iron` - ".(int) $u11['iron'].", - `crop` = `crop` - ".(int) $u11['crop']." - WHERE - `wref` = '" . (int) $village->wid . "'"); - } - header("Location: build.php?id=".$id.""); - exit; - }else{ - header("Location: banned.php"); - exit; - } - } - if(isset($_GET['train']) && $_GET['train'] == 12){ - if($session->access != BANNED){ - if($count_hero < 3){ - mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '12', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u12['time'] / SPEED)*3))."', '50', '1')"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u12` = `u12` - 1 WHERE `vref` = '" . (int) $village->wid . "'"); - mysqli_query($GLOBALS['link']," - UPDATE " . TB_PREFIX . "vdata - SET - `wood` = `wood` - ".(int) $u12['wood'].", - `clay` = `clay` - ".(int) $u12['clay'].", - `iron` = `iron` - ".(int) $u12['iron'].", - `crop` = `crop` - ".(int) $u12['crop']." - WHERE - `wref` = '" . (int) $village->wid . "'"); - } - header("Location: build.php?id=".$id.""); - exit; - }else{ - header("Location: banned.php"); - exit; - } - } - if(isset($_GET['train']) && $_GET['train'] == 13){ - if($session->access != BANNED){ - if($count_hero < 3){ - mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '13', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u13['time'] / SPEED)*3))."', '50', '1')"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u13` = `u13` - 1 WHERE `vref` = '" . (int) $village->wid . "'"); - mysqli_query($GLOBALS['link']," - UPDATE " . TB_PREFIX . "vdata - SET - `wood` = `wood` - ".(int) $u13['wood'].", - `clay` = `clay` - ".(int) $u13['clay'].", - `iron` = `iron` - ".(int) $u13['iron'].", - `crop` = `crop` - ".(int) $u13['crop']." - WHERE - `wref` = '" . (int) $village->wid . "'"); - } - header("Location: build.php?id=".$id.""); - exit; - }else{ - header("Location: banned.php"); - exit; - } - } - if(isset($_GET['train']) && $_GET['train'] == 15){ - if($session->access != BANNED){ - if($count_hero < 3){ - mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '15', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u15['time'] / SPEED)*3))."', '50', '1')"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u15` = `u15` - 1 WHERE `vref` = '" . (int) $village->wid . "'"); - mysqli_query($GLOBALS['link']," - UPDATE " . TB_PREFIX . "vdata - SET - `wood` = `wood` - ".(int) $u15['wood'].", - `clay` = `clay` - ".(int) $u15['clay'].", - `iron` = `iron` - ".(int) $u15['iron'].", - `crop` = `crop` - ".(int) $u15['crop']." - WHERE - `wref` = '" . (int) $village->wid . "'"); - } - header("Location: build.php?id=".$id.""); - exit; - }else{ - header("Location: banned.php"); - exit; - } - } - if(isset($_GET['train']) && $_GET['train'] == 16){ - if($session->access != BANNED){ - if($count_hero < 3){ - mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '16', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u16['time'] / SPEED)*3))."', '50', '1')"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u16` = `u16` - 1 WHERE `vref` = '" . (int) $village->wid . "'"); - mysqli_query($GLOBALS['link']," - UPDATE " . TB_PREFIX . "vdata - SET - `wood` = `wood` - ".(int) $u16['wood'].", - `clay` = `clay` - ".(int) $u16['clay'].", - `iron` = `iron` - ".(int) $u16['iron'].", - `crop` = `crop` - ".(int) $u16['crop']." - WHERE - `wref` = '" . (int) $village->wid . "'"); - } - header("Location: build.php?id=".$id.""); - exit; - }else{ - header("Location: banned.php"); - exit; - } - } + if (isset($_GET['train'])) { + $validationArray = []; + switch ($session->tribe) { + case 1: $validationArray = [1, 2, 3, 5, 6]; + break; + + case 2: $validationArray = [11, 12, 13, 15, 16]; + break; + + case 3: $validationArray = [21, 22, 24, 25, 26]; + break; } - if($session->tribe == 3){ - if(isset($_GET['train']) && $_GET['train'] == 21){ - if($session->access != BANNED){ - if($count_hero < 3){ - mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '21', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u21['time'] / SPEED)*3))."', '50', '1')"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u21` = `u21` - 1 WHERE `vref` = '" . (int) $village->wid . "'"); - mysqli_query($GLOBALS['link']," - UPDATE " . TB_PREFIX . "vdata - SET - `wood` = `wood` - ".(int) $u21['wood'].", - `clay` = `clay` - ".(int) $u21['clay'].", - `iron` = `iron` - ".(int) $u21['iron'].", - `crop` = `crop` - ".(int) $u21['crop']." - WHERE - `wref` = '" . (int) $village->wid . "'"); - } - header("Location: build.php?id=".$id.""); - exit; - }else{ - header("Location: banned.php"); - exit; - } - } - if(isset($_GET['train']) && $_GET['train'] == 22){ - if($session->access != BANNED){ - if($count_hero < 3){ - mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '22', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u22['time'] / SPEED)*3))."', '50', '1')"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u22` = `u22` - 1 WHERE `vref` = '" . (int) $village->wid . "'"); - mysqli_query($GLOBALS['link']," - UPDATE " . TB_PREFIX . "vdata - SET - `wood` = `wood` - ".(int) $u22['wood'].", - `clay` = `clay` - ".(int) $u22['clay'].", - `iron` = `iron` - ".(int) $u22['iron'].", - `crop` = `crop` - ".(int) $u22['crop']." - WHERE - `wref` = '" . (int) $village->wid . "'"); - } - header("Location: build.php?id=".$id.""); - exit; - }else{ - header("Location: banned.php"); - exit; - } - } - if(isset($_GET['train']) && $_GET['train'] == 24){ - if($session->access != BANNED){ - if($count_hero < 3){ - mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '24', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u24['time'] / SPEED)*3))."', '50', '1')"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u24` = `u24` - 1 WHERE `vref` = '" . (int) $village->wid . "'"); - mysqli_query($GLOBALS['link']," - UPDATE " . TB_PREFIX . "vdata - SET - `wood` = `wood` - ".(int) $u24['wood'].", - `clay` = `clay` - ".(int) $u24['clay'].", - `iron` = `iron` - ".(int) $u24['iron'].", - `crop` = `crop` - ".(int) $u24['crop']." - WHERE - `wref` = '" . (int) $village->wid . "'"); - } - header("Location: build.php?id=".$id.""); - exit; - }else{ - header("Location: banned.php"); - exit; - } - } - if(isset($_GET['train']) && $_GET['train'] == 25){ - if($session->access != BANNED){ - if($count_hero < 3){ - mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '25', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u25['time'] / SPEED)*3))."', '50', '1')"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u25` = `u25` - 1 WHERE `vref` = '" . (int) $village->wid . "'"); - mysqli_query($GLOBALS['link']," - UPDATE " . TB_PREFIX . "vdata - SET - `wood` = `wood` - ".(int) $u25['wood'].", - `clay` = `clay` - ".(int) $u25['clay'].", - `iron` = `iron` - ".(int) $u25['iron'].", - `crop` = `crop` - ".(int) $u25['crop']." - WHERE - `wref` = '" . (int) $village->wid . "'"); - } - header("Location: build.php?id=".$id.""); - exit; - }else{ - header("Location: banned.php"); - exit; - } - } - if(isset($_GET['train']) && $_GET['train'] == 26){ - if($session->access != BANNED){ - if($count_hero < 3){ - mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES ('".$database->escape($session->uid)."', '" . (int) $village->wid . "', '0', '26', '".$database->escape($session->username)."', '0', '5', '0', '0', '100', '0', '0', '0', '0', '".round((time() + ($u26['time'] / SPEED)*3))."', '50', '1')"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u26` = `u26` - 1 WHERE `vref` = '" . (int) $village->wid . "'"); - mysqli_query($GLOBALS['link']," - UPDATE " . TB_PREFIX . "vdata - SET - `wood` = `wood` - ".(int) $u26['wood'].", - `clay` = `clay` - ".(int) $u26['clay'].", - `iron` = `iron` - ".(int) $u26['iron'].", - `crop` = `crop` - ".(int) $u26['crop']." - WHERE - `wref` = '" . (int) $village->wid . "'"); - } - header("Location: build.php?id=".$id.""); - exit; - }else{ - header("Location: banned.php"); - exit; - } - } - } - - + // check for a valid unit value + if (in_array($_GET['train'], $validationArray)) { + if($session->access != BANNED){ + if($count_hero < 3){ + $unitID = $_GET['train']; + mysqli_query($GLOBALS['link'],"INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`, `experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`, `intraining`) VALUES (".$database->escape($session->uid).", " . (int) $village->wid . ", 0, ".$unitID.", '".$database->escape($session->username)."', 0, 5, 0, 0, 100, 0, 0, 0, 0, ".round((time() + (${'u'.$unitID}['time'] / SPEED)*3)).", 50, 1)"); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET `u$unitID` = `u$unitID` - 1 WHERE `vref` = " . (int) $village->wid); + mysqli_query($GLOBALS['link']," + UPDATE " . TB_PREFIX . "vdata + SET + `wood` = `wood` - ".(int) ${'u'.$unitID}['wood'].", + `clay` = `clay` - ".(int) ${'u'.$unitID}['clay'].", + `iron` = `iron` - ".(int) ${'u'.$unitID}['iron'].", + `crop` = `crop` - ".(int) ${'u'.$unitID}['crop']." + WHERE + `wref` = " . (int) $village->wid); + } + header("Location: build.php?id=".$id.""); + exit; + }else{ + header("Location: banned.php"); + exit; + } + } + } echo $output; } From 12fe632bf476395fd280bcc4210ed193a6dbe211 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Fri, 24 Nov 2017 10:17:54 +0100 Subject: [PATCH 025/126] fix: prevent reuse of old attacks by re-POSTing same values --- GameEngine/Database.php | 7 +++++++ GameEngine/Units.php | 4 ++++ Templates/a2b/startRaid.tpl | 3 +++ 3 files changed, 14 insertions(+) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index f97e3881..a9f40b31 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -5371,6 +5371,13 @@ References: User ID/Message ID, Mode return mysqli_insert_id($this->dblink); } + function remA2b($id) { + $id = (int) $id; + + $q = "DELETE FROM " . TB_PREFIX . "a2b WHERE id = $id"; + return mysqli_query($this->dblink,$q); + } + // no need to cache this method function getA2b($ckey, $check) { list($ckey, $check) = $this->escape_input($ckey, $check); diff --git a/GameEngine/Units.php b/GameEngine/Units.php index b64e64e7..a460658f 100755 --- a/GameEngine/Units.php +++ b/GameEngine/Units.php @@ -552,6 +552,10 @@ class Units { header( "Location: a2b.php" ); exit; } + + // prevent re-use of the same attack via re-POSTing the same data + $database->remA2b($data['id']); + header( "Location: build.php?id=39" ); exit; diff --git a/Templates/a2b/startRaid.tpl b/Templates/a2b/startRaid.tpl index c4dd1024..6d0c0bd8 100644 --- a/Templates/a2b/startRaid.tpl +++ b/Templates/a2b/startRaid.tpl @@ -97,6 +97,9 @@ $database->modifyUnit($getFLData['wref'], $uname2, $amounts, $modes); $database->addMovement(3,$getFLData['wref'],$data['to_vid'],$reference,time(),($time+time())); + + // prevent re-use of the same attack via re-POSTing the same data + $database->remA2b($data['id']); } } } From 0499d588629b5fb0f8efeec5043170ecfae92200 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Fri, 24 Nov 2017 10:24:41 +0100 Subject: [PATCH 026/126] fix: disable hack-registering as non-existing or NPC tribe --- GameEngine/Account.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GameEngine/Account.php b/GameEngine/Account.php index bca28091..85a09ebd 100755 --- a/GameEngine/Account.php +++ b/GameEngine/Account.php @@ -103,7 +103,7 @@ class Account { $form->addError("email",EMAIL_TAKEN); } } - if(!isset($_POST['vid'])) { + if(!isset($_POST['vid']) || !in_array($_POST['vid'], [1, 2, 3])) { $form->addError("tribe",TRIBE_EMPTY); } if(!isset($_POST['agb'])) { From 866b0886fe17404f22d3143b8401be1483027640 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Fri, 24 Nov 2017 15:59:22 +0100 Subject: [PATCH 027/126] fix: undefined index --- GameEngine/Database.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index a9f40b31..a5af9b2c 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -6434,6 +6434,11 @@ References: User ID/Message ID, Mode if (!isset($movingunits['u' . (($vtribe - 1) * 10 + $i)])) { $movingunits['u' . (($vtribe - 1) * 10 + $i)] = 0; } + + if (!isset($out['t' . $i])) { + $out['t' . $i] = 0; + } + $movingunits['u' . (($vtribe - 1) * 10 + $i)] += $out['t' . $i]; } From 2bcaeb1fef59999fc048b9e9861bad934e815629 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Fri, 24 Nov 2017 16:02:54 +0100 Subject: [PATCH 028/126] fix: undefined index --- GameEngine/Database.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index a5af9b2c..02e659f5 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -6445,6 +6445,11 @@ References: User ID/Message ID, Mode if (!isset($movingunits['hero'])) { $movingunits['hero'] = 0; } + + if (!isset($out['t11'])) { + $out['t11'] = 0; + } + $movingunits['hero'] += $out['t11']; } } From 56aa916f82c80fc6eb62967524880bdc194b1d85 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Fri, 24 Nov 2017 18:04:22 +0100 Subject: [PATCH 029/126] fix: undefined indexes --- GameEngine/Database.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 02e659f5..2aeb92de 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -6428,7 +6428,7 @@ References: User ID/Message ID, Mode $vtribe = $this->getUserField($vinfo['owner'], "tribe", 0); $movingunits = array(); $outgoingarray = $this->getMovement(3, $id, 0); - if(!empty($outgoingarray)) { + if(!empty($outgoingarray) && count($outgoingarray)) { foreach($outgoingarray as $out) { for($i = 1; $i <= 10; $i++) { if (!isset($movingunits['u' . (($vtribe - 1) * 10 + $i)])) { @@ -6454,7 +6454,7 @@ References: User ID/Message ID, Mode } } $returningarray = $this->getMovement(4, $id, 1); - if(!empty($returningarray)) { + if(!empty($returningarray) && count($returningarray)) { foreach($returningarray as $ret) { if($ret['attack_type'] != 1) { for($i = 1; $i <= 10; $i++) { From d6fc9ee371994d705dd50f7f9a98fe1e73087786 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Fri, 24 Nov 2017 19:11:02 +0100 Subject: [PATCH 030/126] fix: raid list counting down leaving units again --- Templates/a2b/startRaid.tpl | 210 +++++++++++++++++++++--------------- 1 file changed, 126 insertions(+), 84 deletions(-) diff --git a/Templates/a2b/startRaid.tpl b/Templates/a2b/startRaid.tpl index 6d0c0bd8..982f29bb 100644 --- a/Templates/a2b/startRaid.tpl +++ b/Templates/a2b/startRaid.tpl @@ -15,92 +15,134 @@ $t11 = 0; $villageOwner = $database->getVillageField($wref,'owner'); $userAccess = $database->getUserField($villageOwner,'access',0); - if($userAccess != '0' && $userAccess != '8' && ($userAccess != '9' || (ADMIN_ALLOW_INCOMING_RAIDS && $userAccess == '9'))){ - if($tribe == 1){ $uname = "u"; } elseif($tribe == 2){ $uname = "u1"; } elseif($tribe == 3){ $uname = "u2"; }elseif($tribe == 4){ $uname = "u3"; }else {$uname = "u4"; } - if($tribe == 1){ $uname1 = "u1"; } elseif($tribe == 2){ $uname1 = "u2"; } elseif($tribe == 3){ $uname1 = "u3"; }elseif($tribe == 4){ $uname1 = "u4"; }else {$uname1 = "u5"; } - if($tribe == 1){ $uname2 = ""; } elseif($tribe == 2){ $uname2 = "1"; } elseif($tribe == 3){ $uname2 = "2"; }elseif($tribe == 4){ $uname2 = "3"; }else {$uname2 = "4"; } - if($sql1[$uname.'1']>=$t1 && $sql1[$uname.'2']>=$t2 && $sql1[$uname.'3']>=$t3 && $sql1[$uname.'4']>=$t4 && $sql1[$uname.'5']>=$t5 && $sql1[$uname.'6']>=$t6 && $sql1[$uname.'7']>=$t7 && $sql1[$uname.'8']>=$t8 && $sql1[$uname.'9']>=$t9 && $sql1[$uname1.'0']>=$t10 && $sql1['hero']>=$t11){ - if($_POST['slot'.$sid]=='on'){ - $ckey = $generator->generateRandStr(6); - $id = $database->addA2b($ckey,time(),$wref,$t1,$t2,$t3,$t4,$t5,$t6,$t7,$t8,$t9,$t10,$t11,4); - - $data = $database->getA2b($ckey, time()); - - $eigen = $database->getCoor($getFLData['wref']); - $from = array('x'=>$eigen['x'], 'y'=>$eigen['y']); - $ander = $database->getCoor($data['to_vid']); - $to = array('x'=>$ander['x'], 'y'=>$ander['y']); - $start = ($tribe-1)*10+1; - $end = ($tribe*10); - - $speeds = array(); - $scout = 1; - - //find slowest unit. - for($i=1;$i<=10;$i++){ - if ($data['u'.$i]){ - if($data['u'.$i] != '' && $data['u'.$i] > 0){ - if($unitarray) { reset($unitarray); } - $unitarray = $GLOBALS["u".(($tribe-1)*10+$i)]; - $speeds[] = $unitarray['speed']; + + if ( $userAccess != '0' && $userAccess != '8' && ( $userAccess != '9' || ( ADMIN_ALLOW_INCOMING_RAIDS && $userAccess == '9' ) ) ) { + if ( $tribe == 1 ) { + $uname = "u"; + $uname1 = "u1"; + $uname2 = ""; + } elseif ( $tribe == 2 ) { + $uname = "u1"; + $uname1 = "u2"; + $uname2 = "1"; + } elseif ( $tribe == 3 ) { + $uname = "u2"; + $uname1 = "u3"; + $uname2 = "2"; + } elseif ( $tribe == 4 ) { + $uname = "u3"; + $uname1 = "u4"; + $uname2 = "3"; + } else { + $uname = "u4"; + $uname1 = "u5"; + $uname2 = "4"; + } + + if ( + $sql1[ $uname . '1' ] >= $t1 && + $sql1[ $uname . '2' ] >= $t2 && + $sql1[ $uname . '3' ] >= $t3 && + $sql1[ $uname . '4' ] >= $t4 && + $sql1[ $uname . '5' ] >= $t5 && + $sql1[ $uname . '6' ] >= $t6 && + $sql1[ $uname . '7' ] >= $t7 && + $sql1[ $uname . '8' ] >= $t8 && + $sql1[ $uname . '9' ] >= $t9 && + $sql1[ $uname1 . '0' ] >= $t10 && + $sql1['hero'] >= $t11 + ) { + + if ( $_POST[ 'slot' . $sid ] == 'on' ) { + $ckey = $generator->generateRandStr( 6 ); + $id = $database->addA2b( $ckey, time(), $wref, $t1, $t2, $t3, $t4, $t5, $t6, $t7, $t8, $t9, $t10, $t11, 4 ); + + $data = $database->getA2b( $ckey, time() ); + + $eigen = $database->getCoor( $getFLData['wref'] ); + $from = array( 'x' => $eigen['x'], 'y' => $eigen['y'] ); + + $ander = $database->getCoor( $data['to_vid'] ); + $to = array( 'x' => $ander['x'], 'y' => $ander['y'] ); + + $start = ( $tribe - 1 ) * 10 + 1; + $end = ( $tribe * 10 ); + + $speeds = array(); + $scout = 1; + + //find slowest unit. + for ( $i = 1; $i <= 10; $i ++ ) { + if ( $data[ 'u' . $i ] ) { + if ( $data[ 'u' . $i ] != '' && $data[ 'u' . $i ] > 0 ) { + if ( $unitarray ) { + reset( $unitarray ); + } + $unitarray = $GLOBALS[ "u" . ( ( $tribe - 1 ) * 10 + $i ) ]; + $speeds[] = $unitarray['speed']; + } + } } + + $artefact = count( $database->getOwnUniqueArtefactInfo2( $getFLData['owner'], 2, 3, 0 ) ); + $artefact1 = count( $database->getOwnUniqueArtefactInfo2( $getFLData['wref'], 2, 1, 1 ) ); + $artefact2 = count( $database->getOwnUniqueArtefactInfo2( $getFLData['owner'], 2, 2, 0 ) ); + + if ( $artefact > 0 ) { + $fastertroops = 3; + } else if ( $artefact1 > 0 ) { + $fastertroops = 2; + } else if ( $artefact2 > 0 ) { + $fastertroops = 1.5; + } else { + $fastertroops = 1; + } + + $time = round( $generator->procDistanceTime( $from, $to, min( $speeds ), 1 ) / $fastertroops ); + $foolartefact = $database->getFoolArtefactInfo( 2, $village->wid, $session->uid ); + + if ( count( $foolartefact ) > 0 ) { + foreach ( $foolartefact as $arte ) { + if ( $arte['bad_effect'] == 1 ) { + $time *= $arte['effect2']; + } else { + $time /= $arte['effect2']; + $time = round( $time ); + } + } + } + + if ( $data['u7'] > 0 ) { + $ctar1 = 99; + } else { + $ctar1 = 0; + } + + $ctar2 = 0; + $abdata = $database->getABTech( $getFLData['wref'] ); + $reference = $database->addAttack( ( $getFLData['wref'] ), $data['u1'], $data['u2'], $data['u3'], $data['u4'], $data['u5'], $data['u6'], $data['u7'], $data['u8'], $data['u9'], $data['u10'], $data['u11'], $data['type'], $ctar1, $ctar2, 0, $abdata['b1'], $abdata['b2'], $abdata['b3'], $abdata['b4'], $abdata['b5'], $abdata['b6'], $abdata['b7'], $abdata['b8'] ); + $totalunits = $data['u1'] + $data['u2'] + $data['u3'] + $data['u4'] + $data['u5'] + $data['u6'] + $data['u7'] + $data['u8'] + $data['u9'] + $data['u10'] + $data['u11']; + + $units = []; + $amounts = []; + $modes = []; + + for ( $u = 1; $u <= 10; $u ++ ) { + $units[] = $uname2 . ($u < 10 ? $u : 0); + $amounts[] = $data[ 'u' . ($u < 10 ? $u : 0) ]; + $modes[] = 0; + } + + $units[] = 'hero'; + $amounts[] = $data['u11']; + $modes[] = 0; + + $database->modifyUnit( $getFLData['wref'], $units, $amounts, $modes ); + $database->addMovement( 3, $getFLData['wref'], $data['to_vid'], $reference, time(), ( $time + time() ) ); + + // prevent re-use of the same attack via re-POSTing the same data + $database->remA2b( $id ); } - } - - $artefact = count($database->getOwnUniqueArtefactInfo2($getFLData['owner'],2,3,0)); - $artefact1 = count($database->getOwnUniqueArtefactInfo2($getFLData['wref'],2,1,1)); - $artefact2 = count($database->getOwnUniqueArtefactInfo2($getFLData['owner'],2,2,0)); - if($artefact > 0){ - $fastertroops = 3; - }else if($artefact1 > 0){ - $fastertroops = 2; - }else if($artefact2 > 0){ - $fastertroops = 1.5; - }else{ - $fastertroops = 1; - } - $time = round($generator->procDistanceTime($from,$to,min($speeds),1)/$fastertroops); - $foolartefact = $database->getFoolArtefactInfo(2,$village->wid,$session->uid); - if(count($foolartefact) > 0){ - foreach($foolartefact as $arte){ - if($arte['bad_effect'] == 1){ - $time *= $arte['effect2']; - }else{ - $time /= $arte['effect2']; - $time = round($time); - } - } - } - if($data['u7'] > 0){ - $ctar1 = 99; - }else{ - $ctar1 = 0; - } - $ctar2 = 0; - $abdata = $database->getABTech($getFLData['wref']); - $reference = $database->addAttack(($getFLData['wref']),$data['u1'],$data['u2'],$data['u3'],$data['u4'],$data['u5'],$data['u6'],$data['u7'],$data['u8'],$data['u9'],$data['u10'],$data['u11'],$data['type'],$ctar1,$ctar2,0,$abdata['b1'],$abdata['b2'],$abdata['b3'],$abdata['b4'],$abdata['b5'],$abdata['b6'],$abdata['b7'],$abdata['b8']); - $totalunits = $data['u1']+$data['u2']+$data['u3']+$data['u4']+$data['u5']+$data['u6']+$data['u7']+$data['u8']+$data['u9']+$data['u10']+$data['u11']; - - $units = []; - $amounts = []; - $modes = []; - - for ($u = 1; $u <= 10; $u++) { - $units[] = $uname2.$u; - $amounts[] = $data['u'.$u]; - $modes[] = 0; - } - - $units[] = 'hero'; - $amounts[] = $data['u11']; - $modes[] = 0; - - $database->modifyUnit($getFLData['wref'], $uname2, $amounts, $modes); - $database->addMovement(3,$getFLData['wref'],$data['to_vid'],$reference,time(),($time+time())); - - // prevent re-use of the same attack via re-POSTing the same data - $database->remA2b($data['id']); - } } } } From 97fe8ffb25dc249b90429dd04c175f91eca76b1e Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Fri, 24 Nov 2017 23:45:29 +0100 Subject: [PATCH 031/126] fix: incorrect return value for getMovement() caused a lot of warnings --- GameEngine/Database.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 2aeb92de..d014aaf0 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -5275,7 +5275,7 @@ References: User ID/Message ID, Mode // first of all, check if we should be using cache and whether the field // required is already cached if ($use_cache && !$array_passed && isset(self::$marketMovementCache[$type.$village[0].$mode]) && is_array(self::$marketMovementCache[$type.$village[0].$mode]) && !count(self::$marketMovementCache[$type.$village[0].$mode])) { - return self::$marketMovementCache[$type.$village[0].$mode]; + return []; } else if ($use_cache && $array_passed) { // check what we can return from cache $newIDs = []; @@ -5294,7 +5294,7 @@ References: User ID/Message ID, Mode } } else if ($use_cache && !$array_passed && ($cachedValue = self::returnCachedContent(self::$marketMovementCache, $type.$village[0].$mode)) && !is_null($cachedValue)) { // special case when we have empty arrays cached for this cache only - return $cachedValue; + return ($array_passed ? self::$marketMovementCache : [$cachedValue]); } $time = time(); @@ -5802,7 +5802,7 @@ References: User ID/Message ID, Mode // first of all, check if we should be using cache and whether the field // required is already cached if ($use_cache && !$array_passed && isset(self::$abTechCache[$vid[0]]) && is_array(self::$abTechCache[$vid[0]]) && !count(self::$abTechCache[$vid[0]])) { - return self::$abTechCache[$vid[0]]; + return []; } else if ($use_cache && $array_passed) { // check what we can return from cache $newVIDs = []; @@ -6127,7 +6127,7 @@ References: User ID/Message ID, Mode // first of all, check if we should be using cache and whether the field // required is already cached if ($use_cache && !$array_passed && isset(self::$oasisReinforcementsCache[$ref[0].$mode]) && is_array(self::$oasisReinforcementsCache[$ref[0].$mode]) && !count(self::$oasisReinforcementsCache[$ref[0].$mode])) { - return self::$oasisReinforcementsCache[$ref[0].$mode]; + return []; } else if ($use_cache && $array_passed) { // check what we can return from cache $newREFs = []; @@ -6346,7 +6346,7 @@ References: User ID/Message ID, Mode // first of all, check if we should be using cache and whether the field // required is already cached if ($use_cache && !$array_passed && isset(self::$villageReinforcementsCache[$id[0].$mode]) && is_array(self::$villageReinforcementsCache[$id[0].$mode]) && !count(self::$villageReinforcementsCache[$id[0].$mode])) { - return self::$villageReinforcementsCache[$id[0].$mode]; + return []; } else if ($use_cache && $array_passed) { // check what we can return from cache $newIDs = []; @@ -7359,7 +7359,7 @@ References: User ID/Message ID, Mode // first of all, check if we should be using cache and whether the field // required is already cached if ($use_cache && !$array_passed && isset(self::$prisonersCache[$wid[0].$mode]) && is_array(self::$prisonersCache[$wid[0].$mode]) && !count(self::$prisonersCache[$wid[0].$mode])) { - return self::$prisonersCache[$wid[0].$mode]; + return []; } else if ($use_cache && $array_passed) { // check what we can return from cache $newWIDs = []; From 87329832c548469e55a2a887beab1ac47b457368 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Fri, 24 Nov 2017 23:55:38 +0100 Subject: [PATCH 032/126] fix: somebody used a diff and left these in :-/ --- GameEngine/Generator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GameEngine/Generator.php b/GameEngine/Generator.php index 4e5eb0b9..83f45e5d 100755 --- a/GameEngine/Generator.php +++ b/GameEngine/Generator.php @@ -106,8 +106,8 @@ public function procMtime($time, $pref = 3) { break; } */ -- $time += 3600*0; //Edit this yourself -+ $time += 0; //Edit this yourself +// $time += 3600*0; //Edit this yourself + $time += 0; //Edit this yourself $today = date('d',time())-1; if (date('Ymd',time()) == date('Ymd',$time)) { From 7bc582e6747ea987fe4461de65eb3c963ab97973 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 25 Nov 2017 00:17:26 +0100 Subject: [PATCH 033/126] fix: division by zero --- GameEngine/Battle.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GameEngine/Battle.php b/GameEngine/Battle.php index 65c02b40..d46c8caf 100755 --- a/GameEngine/Battle.php +++ b/GameEngine/Battle.php @@ -508,12 +508,12 @@ class Battle { // Formula for calculating the Moral if($attpop > $defpop) { if ($rap < $rdp) { - $moralbonus = min(1.5, pow($attpop / $defpop, (0.2*($rap/$rdp)))); + $moralbonus = min(1.5, pow(($defpop > 0 ? $attpop / $defpop : 0), (0.2*($rap/$rdp)))); }else{ if($defpop==0){ $moralbonus = min(1.5, pow($attpop, 0.2)); }else{ - $moralbonus = min(1.5, pow($attpop / $defpop, 0.2)); + $moralbonus = min(1.5, pow(($defpop > 0 ? $attpop / $defpop : 0), 0.2)); } } }else{ From f599e08586aade2342c6775daf0e92f944f2cd80 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 25 Nov 2017 00:45:33 +0100 Subject: [PATCH 034/126] fix: wrong non-multi-array caching of getMovement caused a lot of error #377 --- GameEngine/Database.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index d014aaf0..5923340a 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -5275,7 +5275,7 @@ References: User ID/Message ID, Mode // first of all, check if we should be using cache and whether the field // required is already cached if ($use_cache && !$array_passed && isset(self::$marketMovementCache[$type.$village[0].$mode]) && is_array(self::$marketMovementCache[$type.$village[0].$mode]) && !count(self::$marketMovementCache[$type.$village[0].$mode])) { - return []; + return self::$marketMovementCache[$type.$village[0].$mode]; } else if ($use_cache && $array_passed) { // check what we can return from cache $newIDs = []; @@ -5294,7 +5294,7 @@ References: User ID/Message ID, Mode } } else if ($use_cache && !$array_passed && ($cachedValue = self::returnCachedContent(self::$marketMovementCache, $type.$village[0].$mode)) && !is_null($cachedValue)) { // special case when we have empty arrays cached for this cache only - return ($array_passed ? self::$marketMovementCache : [$cachedValue]); + return ($array_passed ? self::$marketMovementCache: $cachedValue); } $time = time(); @@ -5347,7 +5347,7 @@ References: User ID/Message ID, Mode } else { if ($result && count($result)) { foreach ( $result as $record ) { - self::$marketMovementCache[ $type . $record[ $where ] . $mode ] = $record; + self::$marketMovementCache[ $type . $record[ $where ] . $mode ][] = $record; } } @@ -5802,7 +5802,7 @@ References: User ID/Message ID, Mode // first of all, check if we should be using cache and whether the field // required is already cached if ($use_cache && !$array_passed && isset(self::$abTechCache[$vid[0]]) && is_array(self::$abTechCache[$vid[0]]) && !count(self::$abTechCache[$vid[0]])) { - return []; + return self::$abTechCache[$vid[0]]; } else if ($use_cache && $array_passed) { // check what we can return from cache $newVIDs = []; @@ -6127,7 +6127,7 @@ References: User ID/Message ID, Mode // first of all, check if we should be using cache and whether the field // required is already cached if ($use_cache && !$array_passed && isset(self::$oasisReinforcementsCache[$ref[0].$mode]) && is_array(self::$oasisReinforcementsCache[$ref[0].$mode]) && !count(self::$oasisReinforcementsCache[$ref[0].$mode])) { - return []; + return self::$oasisReinforcementsCache[$ref[0].$mode]; } else if ($use_cache && $array_passed) { // check what we can return from cache $newREFs = []; @@ -6346,7 +6346,7 @@ References: User ID/Message ID, Mode // first of all, check if we should be using cache and whether the field // required is already cached if ($use_cache && !$array_passed && isset(self::$villageReinforcementsCache[$id[0].$mode]) && is_array(self::$villageReinforcementsCache[$id[0].$mode]) && !count(self::$villageReinforcementsCache[$id[0].$mode])) { - return []; + return self::$villageReinforcementsCache[$id[0].$mode]; } else if ($use_cache && $array_passed) { // check what we can return from cache $newIDs = []; @@ -7359,7 +7359,7 @@ References: User ID/Message ID, Mode // first of all, check if we should be using cache and whether the field // required is already cached if ($use_cache && !$array_passed && isset(self::$prisonersCache[$wid[0].$mode]) && is_array(self::$prisonersCache[$wid[0].$mode]) && !count(self::$prisonersCache[$wid[0].$mode])) { - return []; + return self::$prisonersCache[$wid[0].$mode]; } else if ($use_cache && $array_passed) { // check what we can return from cache $newWIDs = []; From b9cdba81fb596e5f922e00a9d4bb52f366c3f6a3 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 25 Nov 2017 01:11:07 +0100 Subject: [PATCH 035/126] fix: cannot progress beyond quest 10 in classic set #366 --- Templates/Ajax/quest_core25.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Templates/Ajax/quest_core25.tpl b/Templates/Ajax/quest_core25.tpl index 7bcd14af..2b141638 100644 --- a/Templates/Ajax/quest_core25.tpl +++ b/Templates/Ajax/quest_core25.tpl @@ -537,8 +537,8 @@ if ($ironL<2 || $clayL<2 || $woodL<2 || $cropL<2){?> getEnforce($session->villages[0], 0); -if ($rat['u31']<1){?> +$rat = $database->getEnforce(0, $village->wid); +if ($rat < 1){?> {"markup":"\n\t\t

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

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

    <\/div>\n\t\t","number":-10,"reward":false,"qgsrc":"q_luserinfo['tribe'];?>","msrc":"","altstep":99} {"markup":"\n\t\t

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

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

    <\/div>\n\t\t","number":10,"reward":{"plus":2},"qgsrc":"q_luserinfo['tribe'];?>g","msrc":"","altstep":99} From 571fb9019ff7faa6017a460662c4f9f1944ed827 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 25 Nov 2017 01:21:28 +0100 Subject: [PATCH 036/126] fix: hero can be killed even if unit not present anywhere on the map #371 --- GameEngine/Admin/function.php | 8 ++++---- GameEngine/Database.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/GameEngine/Admin/function.php b/GameEngine/Admin/function.php index 94f7164b..1efe9805 100755 --- a/GameEngine/Admin/function.php +++ b/GameEngine/Admin/function.php @@ -86,10 +86,10 @@ class funct { if (!$killhero){ $killhero=$database->FindHeroInOasis($get['uid']); } - if ($killhero) { - $database->KillMyHero($get['uid']); - $error="&kc=1"; - }else $error="&e=1"; + + $database->KillMyHero($get['uid']); + $error="&kc=1"; + header("Location: admin.php?p=player&uid=".$get['uid'].$error); exit; case "reviveHero": diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 5923340a..523d7816 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -7533,7 +7533,7 @@ References: function KillMyHero($id) { list( $id ) = $this->escape_input( (int) $id ); - $q = "UPDATE " . TB_PREFIX . "hero set dead = 1 where uid = " . $id . " AND dead = 0"; + $q = "UPDATE " . TB_PREFIX . "hero set dead = 1, intraining = 0, inrevive = 0 where uid = " . $id . " AND dead = 0"; return mysqli_query( $this->dblink, $q ); } From e2ad6d3c2bd433f83135fe1b3a4a59bf9a89e938 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 25 Nov 2017 01:41:29 +0100 Subject: [PATCH 037/126] fix: due to DB inconsistencies, don't check for hero unit in village #371 --- GameEngine/Automation.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 0d4a7ead..aec80406 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -4613,7 +4613,7 @@ class Automation { } $villunits = $unitData[$hdata['wref']]; - if($villunits['hero'] == 0 && $hdata['trainingtime'] < time() && $hdata['inrevive'] == 1){ + if($hdata['trainingtime'] < time() && $hdata['inrevive'] == 1){ mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET hero = 1 WHERE vref = ".(int) $hdata['wref'].""); $columns[] = 'dead'; @@ -4632,7 +4632,7 @@ class Automation { $lastUpdateTime = (int) $hdata['trainingtime']; } - if($villunits['hero'] == 0 && $hdata['trainingtime'] < time() && $hdata['intraining'] == 1){ + if($hdata['trainingtime'] < time() && $hdata['intraining'] == 1){ mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "units SET hero = 1 WHERE vref = ".(int) $hdata['wref']); $columns[] = 'dead'; From 687dca4cecc670a9017bde664973deed8cc20f36 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 25 Nov 2017 01:46:33 +0100 Subject: [PATCH 038/126] fix: MySQL 5.7 incompatibility --- GameEngine/Database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 523d7816..c3041e3f 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -4993,7 +4993,7 @@ References: User ID/Message ID, Mode } } - $q = "SELECT CONCAT(type, \"=\", Count(type)) FROM " . TB_PREFIX . "bdata where wid = $wid and type IN(".implode(', ', $type).") and master = 0"; + $q = "SELECT CONCAT(type, \"=\", Count(type)) FROM " . TB_PREFIX . "bdata where wid = $wid and type IN(".implode(', ', $type).") and master = 0 GROUP BY type"; $result = mysqli_query($this->dblink, $q); $newresult = []; From 08abff97d16c306d10db4d4e2774db2802edb1b2 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 25 Nov 2017 09:24:56 +0100 Subject: [PATCH 039/126] fix: mysqli_fetch_all() only available with native mysqlnd driver --- GameEngine/Database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index c3041e3f..60388316 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -4530,7 +4530,7 @@ References: User ID/Message ID, Mode LEFT JOIN '.TB_PREFIX.'users u ON u.id = v.owner WHERE d.vref = '.$wid; - $res = mysqli_fetch_all(mysqli_query($this->dblink, $q), MYSQLI_ASSOC); + $res = mysqli_fetch_array(mysqli_query($this->dblink, $q), MYSQLI_ASSOC); foreach ($res as $key) { // if this building being demolished is an Embassy or was demolished completely // and the player is in an alliance, check and update their alliance status From 56f605eac146e0b662dbcc46a41512605734f859 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 25 Nov 2017 09:32:21 +0100 Subject: [PATCH 040/126] fix: logged-in users with cookies set but database cleared to log out When switching databse data (for example restoring a backup etc.) and a user is already logged-in (has a valid cookie, and thus PHP session) but that user doesn't exist in the database anymore, we need to log them out, since no data are available for them. --- GameEngine/Session.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/GameEngine/Session.php b/GameEngine/Session.php index 6fb7318d..e66ed563 100755 --- a/GameEngine/Session.php +++ b/GameEngine/Session.php @@ -208,19 +208,22 @@ class Session { global $database,$link; $villageIDs = implode(', ', $this->villages); + if (!count($this->villages)) { + $this->Logout(); + header('login.php'); + exit; + } // check if hero unit for this player is present anywhere on the map - $heroUnitRegisters = mysqli_fetch_array( - mysqli_query($database->dblink, ' + $q = ' SELECT IFNULL((SELECT SUM(hero) from '.TB_PREFIX.'enforcement where `from` IN('.$villageIDs.')), 0) + IFNULL((SELECT SUM(hero) from '.TB_PREFIX.'units where `vref` IN('.$villageIDs.')), 0) + IFNULL((SELECT SUM(t11) from '.TB_PREFIX.'prisoners where `from` IN('.$villageIDs.')), 0) + IFNULL((SELECT SUM(t11) FROM '.TB_PREFIX.'movement, '.TB_PREFIX.'attacks WHERE '.TB_PREFIX.'movement.`from` IN('.$villageIDs.') and '.TB_PREFIX.'movement.ref = '.TB_PREFIX.'attacks.id and '.TB_PREFIX.'movement.proc = 0 and '.TB_PREFIX.'movement.sort_type = 3), 0) + IFNULL((SELECT SUM(t11) FROM '.TB_PREFIX.'movement, '.TB_PREFIX.'attacks where '.TB_PREFIX.'movement.`to` IN('.$villageIDs.') and '.TB_PREFIX.'movement.ref = '.TB_PREFIX.'attacks.id and '.TB_PREFIX.'movement.proc = 0 and '.TB_PREFIX.'movement.sort_type = 4), 0) - as herocount'), - MYSQLI_ASSOC - )['herocount']; + as herocount'; + $heroUnitRegisters = mysqli_fetch_array( mysqli_query($database->dblink, $q, MYSQLI_ASSOC ))['herocount']; // check if the actual hero is alive or being trained/revived into a living state $isHeroLivingOrRaising = $database->getHeroDeadReviveOrInTraining($this->uid); From c7d737e345a3f9f32b136b6d7a281b63d0a69ace Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 25 Nov 2017 10:11:15 +0100 Subject: [PATCH 041/126] fix: actually checking for a rat now in the rat quest --- Templates/Ajax/quest_core25.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Templates/Ajax/quest_core25.tpl b/Templates/Ajax/quest_core25.tpl index 2b141638..f68fb105 100644 --- a/Templates/Ajax/quest_core25.tpl +++ b/Templates/Ajax/quest_core25.tpl @@ -538,7 +538,7 @@ if ($ironL<2 || $clayL<2 || $woodL<2 || $cropL<2){?> //comming soon //Check rat is in villa $rat = $database->getEnforce(0, $village->wid); -if ($rat < 1){?> +if ($rat['u31'] < 1){?> {"markup":"\n\t\t

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

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

    <\/div>\n\t\t","number":-10,"reward":false,"qgsrc":"q_luserinfo['tribe'];?>","msrc":"","altstep":99} {"markup":"\n\t\t

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

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

    <\/div>\n\t\t","number":10,"reward":{"plus":2},"qgsrc":"q_luserinfo['tribe'];?>g","msrc":"","altstep":99} From 4e51c9c527f7e5e1967896fb51854514d788f896 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 25 Nov 2017 11:19:14 +0100 Subject: [PATCH 042/126] fix: fetch all players, not only one for embassy check --- GameEngine/Database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 60388316..615f2829 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -4530,7 +4530,7 @@ References: User ID/Message ID, Mode LEFT JOIN '.TB_PREFIX.'users u ON u.id = v.owner WHERE d.vref = '.$wid; - $res = mysqli_fetch_array(mysqli_query($this->dblink, $q), MYSQLI_ASSOC); + $res = $this->mysqli_fetch_all(mysqli_query($this->dblink, $q), MYSQLI_ASSOC); foreach ($res as $key) { // if this building being demolished is an Embassy or was demolished completely // and the player is in an alliance, check and update their alliance status From abfcde6e9a54571a25607f021708559abbf86e96 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 25 Nov 2017 11:26:10 +0100 Subject: [PATCH 043/126] fix: build check for village vs non-village buildings --- GameEngine/Building.php | 44 +++++++++++++++++++++++++++-------------- GameEngine/Village.php | 3 ++- 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/GameEngine/Building.php b/GameEngine/Building.php index 9137e995..f9d7147b 100755 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -67,27 +67,40 @@ class Building { public function canProcess($id,$tid) { //add fix by ronix - global $session; - if($session->access==BANNED){ - header("Location: banned.php"); - exit; - } else { - if ($this->checkResource($id,$tid)!=4) { - if($tid >= 19) { - header("Location: dorf2.php"); - exit; - } - else { - header("Location: dorf1.php"); - exit; - } - exit; + global $session; + + if($session->access==BANNED){ + header("Location: banned.php"); + exit; + } else { + // first of all, let's see if we should allow building what we want where we want to + // (prevent building resource fields in the village + $page = basename($_SERVER['SCRIPT_NAME']); + if ( + ($page == 'dorf1.php' && $id > 1 && $id <= 4) || + ($page == 'dorf2.php' && $id > 4) + ) { + if ( $this->checkResource( $id, $tid ) != 4 ) { + if ( $tid >= 19 ) { + header( "Location: dorf2.php" ); + exit; + } else { + header( "Location: dorf1.php" ); + exit; + } + + exit; } + } else { + header('Location: '.$_SERVER['SCRIPT_NAME']); + exit; + } } } public function procBuild($get) { global $session, $village, $database; + if(isset($get['a']) && $get['c'] == $session->checker && !isset($get['id'])) { if($get['a'] == 0) { $this->removeBuilding($get['d']); @@ -97,6 +110,7 @@ class Building { $this->upgradeBuilding($get['a']); } } + if(isset($get['master']) && isset($get['id']) && isset($get['time']) && $session->gold >= 1 && $session->goldclub && $village->master == 0 && (isset($get['c']) && $get['c']== $session->checker)) { $m=$get['master']; $master = $_GET; diff --git a/GameEngine/Village.php b/GameEngine/Village.php index 2b24b993..c53b430b 100755 --- a/GameEngine/Village.php +++ b/GameEngine/Village.php @@ -142,8 +142,9 @@ class Village { $this->production['wood'] = $this->getWoodProd(); $this->production['clay'] = $this->getClayProd(); $this->production['iron'] = $this->getIronProd(); + if ($uniqueA['size']==3 && $uniqueA['owner']==$session->uid){ - $this->production['crop'] = $this->getCropProd()-$this->pop-(($upkeep)-round($upkeep*0.50)); + $this->production['crop'] = $this->getCropProd()- $this->pop - (($upkeep)-round($upkeep*0.50)); }else if ($normalA['type']==4 && $normalA['size']==1 && $normalA['owner']==$session->uid){ $this->production['crop'] = $this->getCropProd()-$this->pop-(($upkeep)-round($upkeep*0.25)); From 997b32e17483724b9cdbbb5decf0837f0543c207 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 25 Nov 2017 11:53:14 +0100 Subject: [PATCH 044/126] fix: great warehouse & great granary can be built with right artefact --- GameEngine/Building.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/GameEngine/Building.php b/GameEngine/Building.php index f9d7147b..ba4e11a4 100755 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -750,16 +750,18 @@ class Building { } break; + // great warehouse can only be built with artefact or only in Natar village case 38: - if ( $this->getTypeLevel( 15 ) >= 10 && $village->natar == 1 ) { + if ( $this->getTypeLevel( 15 ) >= 10 && ($village->natar == 1 || count($database->getOwnUniqueArtefactInfo2($session->uid, 6, 1, 0)) || count($database->getOwnUniqueArtefactInfo2($session->uid, 6, 2, 0)) ) ) { return true; } else { return false; } break; + // great grannary can only be built with artefact or only in Natar village case 39: - if ( $this->getTypeLevel( 15 ) >= 10 && $village->natar == 1 ) { + if ( $this->getTypeLevel( 15 ) >= 10 && ($village->natar == 1 || count($database->getOwnUniqueArtefactInfo2($session->uid, 6, 1, 0)) || count($database->getOwnUniqueArtefactInfo2($session->uid, 6, 2, 0)) ) ) { return true; } else { return false; From 3196ee9242f0b9f0a3b209e33401e275cdbc16a1 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 25 Nov 2017 12:21:07 +0100 Subject: [PATCH 045/126] fix: possible to build above max level or change standing building type --- GameEngine/Building.php | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/GameEngine/Building.php b/GameEngine/Building.php index ba4e11a4..fc90bedd 100755 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -67,18 +67,23 @@ class Building { public function canProcess($id,$tid) { //add fix by ronix - global $session; + global $session, $database, $village; if($session->access==BANNED){ header("Location: banned.php"); exit; } else { - // first of all, let's see if we should allow building what we want where we want to - // (prevent building resource fields in the village $page = basename($_SERVER['SCRIPT_NAME']); + $levels = $database->getResourceLevel($village->wid); if ( - ($page == 'dorf1.php' && $id > 1 && $id <= 4) || - ($page == 'dorf2.php' && $id > 4) + // let's see if we should allow building what we want where we want to + // (prevent building resource fields in the village + ( + ($page == 'dorf1.php' && $id > 1 && $id <= 4) || + ($page == 'dorf2.php' && $id > 4) + ) && + // check that we're not trying to change a standing building type + ($levels['f'.$tid.'t'] == $id) ) { if ( $this->checkResource( $id, $tid ) != 4 ) { if ( $tid >= 19 ) { @@ -385,7 +390,7 @@ class Building { } private function upgradeBuilding($id) { - global $database,$village,$session,$logging; + global $database,$village,$session,$logging,${'bid'.$village->resarray['f'.$id.'t']}; if($this->allocated < $this->maxConcurrent) { $uprequire = $this->resourceRequired($id,$village->resarray['f'.$id.'t']); $time = time() + $uprequire['time']; @@ -420,6 +425,12 @@ class Building { } } $level = $database->getResourceLevel($village->wid); + + // don't allow building above max levels + if ($level['f'.$id] + 1 > count(${'bid'.$village->resarray['f'.$id.'t']})) { + return; + } + if($session->access!=BANNED){ 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); From 8c9cbfee829ad8663485f91e1270317dd488645c Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 25 Nov 2017 12:24:51 +0100 Subject: [PATCH 046/126] fix: possibility to edit somebody else's profile --- GameEngine/Profile.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GameEngine/Profile.php b/GameEngine/Profile.php index 617b52f0..3568d18f 100755 --- a/GameEngine/Profile.php +++ b/GameEngine/Profile.php @@ -90,9 +90,9 @@ class Profile { } private function updateProfile($post) { - global $database; + global $database, $session; $birthday = $post['jahr'].'-'.$post['monat'].'-'.$post['tag']; - $database->submitProfile($database->RemoveXSS($post['uid']),$database->RemoveXSS($post['mw']),$database->RemoveXSS($post['ort']),$database->RemoveXSS($birthday),$database->RemoveXSS($post['be2']),$database->RemoveXSS($post['be1'])); + $database->submitProfile($session->uid,$database->RemoveXSS($post['mw']),$database->RemoveXSS($post['ort']),$database->RemoveXSS($birthday),$database->RemoveXSS($post['be2']),$database->RemoveXSS($post['be1'])); $varray = $database->getProfileVillages($post['uid']); for($i=0;$i<=count($varray)-1;$i++) { $k = trim($post['dname'.$i]); From bc450c686e9f679c0de7c045ca842d4752cc9a66 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 25 Nov 2017 13:01:09 +0100 Subject: [PATCH 047/126] fix: not able to upgrade woodcutter fields --- GameEngine/Building.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GameEngine/Building.php b/GameEngine/Building.php index fc90bedd..41b7f3b4 100755 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -79,7 +79,7 @@ class Building { // let's see if we should allow building what we want where we want to // (prevent building resource fields in the village ( - ($page == 'dorf1.php' && $id > 1 && $id <= 4) || + ($page == 'dorf1.php' && $id >= 1 && $id <= 4) || ($page == 'dorf2.php' && $id > 4) ) && // check that we're not trying to change a standing building type From 1169b4febb5bd05c63c8b28230f01ea64e8be833 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 25 Nov 2017 13:11:22 +0100 Subject: [PATCH 048/126] fix: not able to build new buildings --- GameEngine/Building.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/GameEngine/Building.php b/GameEngine/Building.php index 41b7f3b4..94c0808c 100755 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -83,7 +83,10 @@ class Building { ($page == 'dorf2.php' && $id > 4) ) && // check that we're not trying to change a standing building type - ($levels['f'.$tid.'t'] == $id) + ( + $levels['f'.$tid.'t'] == $id || + $levels['f'.$tid.'t'] == 0 + ) ) { if ( $this->checkResource( $id, $tid ) != 4 ) { if ( $tid >= 19 ) { From ec234579cc8b65c18cef77f635d26dfefe580f6a Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 25 Nov 2017 16:28:28 +0100 Subject: [PATCH 049/126] fix: give hero points to spend by the actual number of levels he got --- GameEngine/Automation.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index aec80406..289de824 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -4605,10 +4605,10 @@ class Automation { $modes[] = null; } - // add 5 points, if we're below level 100 + // add as many points as needed, if we're below level 100 if ($scorePoints) { $columns[] = 'points'; - $columnValues[] = 5; + $columnValues[] = (5 * ($newLevel - $herolevel)); $modes[] = 1; } From f656f631eaf91b43719240d6fa195b8684dce0f4 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 25 Nov 2017 18:22:13 +0100 Subject: [PATCH 050/126] refactor: s1_artefact table SELECTs optimized and cached #313 --- GameEngine/Database.php | 99 ++++++++++++++++++++++++++++++----------- 1 file changed, 73 insertions(+), 26 deletions(-) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 615f2829..0cc7aa1e 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -6846,20 +6846,22 @@ References: User ID/Message ID, Mode // no need to cache this method function getOwnArtefactInfo($vref) { - list($vref) = $this->escape_input((int) $vref); + // load the data - type is irrelevant, since the method caches all data + // then returns the one for our type + $this->getOwnArtefactInfoByType($vref, 1); - $q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE vref = $vref LIMIT 1"; - $result = mysqli_query($this->dblink,$q); - return mysqli_fetch_array($result); + // return what we've cached + return (self::$artefactInfoByTypeCache[$vref]); } // no need to cache this method function getOwnArtefactInfo3($uid) { - list($uid) = $this->escape_input((int) $uid); + // load the data - type and size are irrelevant, since the method caches all data + // then returns the one for our type and size + $this->getOwnUniqueArtefactInfo($uid, 1, 1); - $q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE owner = $uid"; - $result = mysqli_query($this->dblink,$q); - return $this->mysqli_fetch_all($result); + // return what we've cached + return (self::$artefactInfoSimpleCache[$uid]); } function getOwnArtefactInfoByType($vref, $type, $use_cache = true) { @@ -6868,15 +6870,32 @@ References: User ID/Message ID, Mode // first of all, check if we should be using cache and whether the field // required is already cached - if ($use_cache && ($cachedValue = self::returnCachedContent(self::$artefactInfoByTypeCache, $vref.$type)) && !is_null($cachedValue)) { - return $cachedValue; + if ($use_cache && isset(self::$artefactInfoByTypeCache[$vref]) && is_array(self::$artefactInfoByTypeCache[$vref]) && !count(self::$artefactInfoByTypeCache[$vref])) { + return []; + } else if ($use_cache && ($cachedValue = self::returnCachedContent(self::$artefactInfoByTypeCache, $vref)) && !is_null($cachedValue)) { + return (isset($cachedValue[$type]) ? $cachedValue[$type] : []); } - $q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE vref = $vref AND type = $type order by size LIMIT 1"; - $result = mysqli_query($this->dblink,$q); + $q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE vref = $vref ORDER BY size"; + $result = $this->mysqli_fetch_all(mysqli_query($this->dblink,$q)); - self::$artefactInfoByTypeCache[$vref.$type] = mysqli_fetch_array($result); - return self::$artefactInfoByTypeCache[$vref.$type]; + // cache all types and return the requested one + if (count($result)) { + foreach ($result as $arteInfo) { + if (!isset(self::$artefactInfoByTypeCache[$arteInfo['vref']])) { + self::$artefactInfoByTypeCache[$arteInfo['vref']] = []; + } + + // we're sorting by size, thus we only need the first one per each type + if (isset(self::$artefactInfoByTypeCache[$arteInfo['vref']]) && !isset(self::$artefactInfoByTypeCache[$arteInfo['vref']][$arteInfo['type']])) { + self::$artefactInfoByTypeCache[$arteInfo['vref']][$arteInfo['type']] = $arteInfo; + } + } + } else { + self::$artefactInfoByTypeCache[$vref] = []; + } + + return (isset(self::$artefactInfoByTypeCache[$vref][$type]) ? self::$artefactInfoByTypeCache[$vref][$type] : []); } function getOwnArtefactInfoByType2($vref, $type, $use_cache = true) { @@ -6888,15 +6907,29 @@ References: User ID/Message ID, Mode // first of all, check if we should be using cache and whether the field // required is already cached - if ($use_cache && ($cachedValue = self::returnCachedContent(self::$artefactInfoSimpleCache, $id.$type.$size)) && !is_null($cachedValue)) { - return $cachedValue; + if ($use_cache && isset(self::$artefactInfoSimpleCache[$id]) && is_array(self::$artefactInfoSimpleCache[$id]) && !count(self::$artefactInfoSimpleCache[$id])) { + return []; + } else if ($use_cache && ($cachedValue = self::returnCachedContent(self::$artefactInfoSimpleCache, $id)) && !is_null($cachedValue)) { + return (isset($cachedValue[$type.$size]) ? $cachedValue[$type.$size] : []); } - $q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE owner = $id AND type = $type AND size=$size LIMIT 1"; - $result = mysqli_query($this->dblink,$q); + $q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE owner = $id"; + $result = $this->mysqli_fetch_all(mysqli_query($this->dblink,$q)); - self::$artefactInfoSimpleCache[$id.$type.$size] = mysqli_fetch_array($result); - return self::$artefactInfoSimpleCache[$id.$type.$size]; + // cache all types and return the requested one + if (count($result)) { + foreach ($result as $arteInfo) { + if (!isset(self::$artefactInfoSimpleCache[$arteInfo['owner']])) { + self::$artefactInfoSimpleCache[$arteInfo['owner']] = []; + } + + self::$artefactInfoSimpleCache[$arteInfo['owner']][$arteInfo['type'].$arteInfo['size']] = $arteInfo; + } + } else { + self::$artefactInfoSimpleCache[$id] = []; + } + + return (isset(self::$artefactInfoSimpleCache[$id][$type.$size]) ? self::$artefactInfoSimpleCache[$id][$type.$size] : []); } function getOwnUniqueArtefactInfo2($id, $type, $size, $mode, $use_cache = true) { @@ -6904,15 +6937,29 @@ References: User ID/Message ID, Mode // first of all, check if we should be using cache and whether the field // required is already cached - if ($use_cache && ($cachedValue = self::returnCachedContent(self::$artefactDataCache, $id.$type.$size.$mode)) && !is_null($cachedValue)) { - return $cachedValue; + if ($use_cache && isset(self::$artefactDataCache[$id.$mode]) && is_array(self::$artefactDataCache[$id.$mode]) && !count(self::$artefactDataCache[$id.$mode])) { + return []; + } else if ($use_cache && ($cachedValue = self::returnCachedContent(self::$artefactDataCache, $id.$mode)) && !is_null($cachedValue)) { + return (isset($cachedValue[$size.$type]) ? $cachedValue[$size.$type] : []); } - $q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE ".(!$mode ? 'owner' : 'vref')." = $id AND active = 1 AND type = $type AND size=$size"; - $result = mysqli_query($this->dblink,$q); + $q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE ".(!$mode ? 'owner' : 'vref')." = $id AND active = 1"; + $result = $this->mysqli_fetch_all(mysqli_query($this->dblink,$q)); - self::$artefactDataCache[$id.$type.$size.$mode] = $this->mysqli_fetch_all($result); - return self::$artefactDataCache[$id.$type.$size.$mode]; + // cache all types and return the requested one + if (count($result)) { + foreach ($result as $arteInfo) { + if (!isset(self::$artefactDataCache[$arteInfo[(!$mode ? 'owner' : 'vref')] . $mode])) { + self::$artefactDataCache[$arteInfo[(!$mode ? 'owner' : 'vref')] . $mode] = []; + } + + self::$artefactDataCache[$arteInfo[(!$mode ? 'owner' : 'vref')] . $mode][$arteInfo['size'].$arteInfo['type']] = $arteInfo; + } + } else { + self::$artefactDataCache[$id.$mode] = []; + } + + return (isset(self::$artefactDataCache[$id.$mode][$size.$type]) ? self::$artefactDataCache[$id.$mode][$size.$type] : []); } function getFoolArtefactInfo($type,$vid,$uid, $use_cache = true) { From cca9feaded5e588657c0eb01adfc4bf8b1a616b0 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 25 Nov 2017 19:05:01 +0100 Subject: [PATCH 051/126] refactor: s1_bdata table SELECTs optimized and cached #313 --- GameEngine/Database.php | 181 ++++++++++++++++++++++++++++------------ 1 file changed, 126 insertions(+), 55 deletions(-) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 0cc7aa1e..99ad38f4 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -394,6 +394,11 @@ class MYSQLi_DB implements IDbConnection { */ $researchingCache = [], + /** + * @var array Cache of buildings being under construction. + */ + $buildingsUnderConstructionCache = [], + /** * @var array Cache of messages to be sent out to players, * so we can collect them and send them out together @@ -4901,65 +4906,114 @@ References: User ID/Message ID, Mode } } - // do not cache this method, as building jobs can change when using instant build (PLUS) etc. + private function getBData($wid, $use_cache = true) { + $wid = (int) $wid; + + // first of all, check if we should be using cache and whether the field + // required is already cached + if ($use_cache && isset(self::$buildingsUnderConstructionCache[$wid]) && is_array(self::$buildingsUnderConstructionCache[$wid]) && !count(self::$buildingsUnderConstructionCache[$wid])) { + return []; + } else if ($use_cache && ($cachedValue = self::returnCachedContent(self::$buildingsUnderConstructionCache, $wid)) && !is_null($cachedValue)) { + return self::$buildingsUnderConstructionCache[$wid]; + } + + $q = "SELECT * FROM " . TB_PREFIX . "bdata where wid = $wid order by master,timestamp ASC"; + $result = $this->mysqli_fetch_all(mysqli_query($this->dblink,$q)); + + self::$buildingsUnderConstructionCache[$wid] = $result; + return $result; + } + + // do not cache output, as building jobs can change when using instant build (PLUS) etc. function getJobs($wid) { - list($wid) = $this->escape_input((int) $wid); - - $q = "SELECT * FROM " . TB_PREFIX . "bdata where wid = $wid order by master,timestamp ASC"; - $result = mysqli_query($this->dblink,$q); - return $this->mysqli_fetch_all($result); + return $this->getBData($wid, false); } - // no need to cache this method function FinishWoodcutter($wid) { - list($wid) = $this->escape_input((int) $wid); - + $bdata = $this->getBData($wid); $time = time()-1; - $q = "SELECT id, timestamp FROM " . TB_PREFIX . "bdata where wid = $wid and type = 1 order by master,timestamp ASC LIMIT 1"; - $result = mysqli_query($this->dblink,$q); - $dbarray = mysqli_fetch_array($result); - $q = "UPDATE ".TB_PREFIX."bdata SET timestamp = $time WHERE id = '".$dbarray['id']."'"; + + // find our woodcutter + $dbarray = []; + foreach ($bdata as $row) { + if ($row['type'] == 1) { + $dbarray = $row; + break; + } + } + + // no woodcutters? just return + if (!count($dbarray)) { + return; + } + + // make it complete + $q = "UPDATE ".TB_PREFIX."bdata SET timestamp = $time WHERE id = ".$dbarray['id']; $this->query($q); + $tribe = $this->getUserField($this->getVillageField($wid, "owner"), "tribe", 0); - if($tribe == 1){ - $q2 = "SELECT id FROM " . TB_PREFIX . "bdata where wid = $wid and loopcon = 1 and field >= 19 order by master,timestamp ASC LIMIT 1"; - }else{ - $q2 = "SELECT id FROM " . TB_PREFIX . "bdata where wid = $wid and loopcon = 1 order by master,timestamp ASC LIMIT 1"; - } - $result2 = mysqli_query($this->dblink,$q2); - if(mysqli_num_rows($result2) > 0){ - $dbarray2 = mysqli_fetch_array($result2); - $wc_time = $dbarray['timestamp']; - $q2 = "UPDATE ".TB_PREFIX."bdata SET timestamp = timestamp - $wc_time WHERE id = '".$dbarray2['id']."'"; - $this->query($q2); + + // find first field that's the next one in the loop after our finished woodcutter + $dbarray2 = []; + foreach ($bdata as $row) { + if ($row['loopcon'] == 1 && ($tribe == 1 ? $row['field'] >= 19 : true)) { + $dbarray2 = $row; + break; + } + } + + // if found, update it's finish time by subtracting the resulting time for our woodcutter, + // which is now finished + if (count($dbarray2)){ + $wc_time = $dbarray['timestamp']; + $q2 = "UPDATE ".TB_PREFIX."bdata SET timestamp = timestamp - $wc_time WHERE id = ".$dbarray2['id']; + $this->query($q2); } } - // no need to cache this method function getMasterJobs($wid) { - list($wid) = $this->escape_input((int) $wid); + // cache data + $bdata = $this->getBData($wid); - $q = "SELECT * FROM " . TB_PREFIX . "bdata where wid = $wid and master = 1 order by master,timestamp ASC"; - $result = mysqli_query($this->dblink,$q); - return $this->mysqli_fetch_all($result); + // return all master jobs + $data = []; + foreach ($bdata as $row) { + if ($row['master'] == 1) { + $data[] = $row; + } + } + + return $data; } - // no need to cache this method function getMasterJobsByField($wid,$field) { - list($wid,$field) = $this->escape_input((int) $wid,(int) $field); + // cache data + $bdata = $this->getBData($wid); - $q = "SELECT * FROM " . TB_PREFIX . "bdata where wid = $wid and field = $field and master = 1 order by master,timestamp ASC"; - $result = mysqli_query($this->dblink,$q); - return $this->mysqli_fetch_all($result); + // return all master jobs for the requested field + $data = []; + foreach ($bdata as $row) { + if ($row['master'] == 1 && $row['field'] == $field) { + $data[] = $row; + } + } + + return $data; } - // no need to cache this method function getBuildingByField($wid,$field) { - list($wid,$field) = $this->escape_input((int) $wid,(int) $field); + // cache data + $bdata = $this->getBData($wid); - $q = "SELECT * FROM " . TB_PREFIX . "bdata where wid = $wid and field = $field and master = 0"; - $result = mysqli_query($this->dblink,$q); - return $this->mysqli_fetch_all($result); + // return all non-master jobs for the requested field + $data = []; + foreach ($bdata as $row) { + if ($row['master'] == 0 && $row['field'] == $field) { + $data[] = $row; + } + } + + return $data; } // no need to cache this method @@ -4971,15 +5025,20 @@ References: User ID/Message ID, Mode return $result['Total']; } - // no need to cache this method function getBuildingByType($wid,$type) { - $wid = (int) $wid; + // cache data + $bdata = $this->getBData($wid); + $type = (strpos($type, ',') === false ? [(int) $type] : explode(',', str_replace(' ', '', $this->escape($type)))); - $type = (strpos($type, ',') === false ? (int) $type : $this->escape($type)); + // return all jobs which are of the requested type + $data = []; + foreach ($bdata as $row) { + if (in_array($row['field'], $type)) { + $data[] = $row; + } + } - $q = "SELECT * FROM " . TB_PREFIX . "bdata where wid = $wid and type IN($type) and master = 0"; - $result = mysqli_query($this->dblink,$q); - return $this->mysqli_fetch_all($result); + return $data; } function getBuildingByType2($wid,$type) { @@ -5014,22 +5073,34 @@ References: User ID/Message ID, Mode return $result; } - // no need to cache this method function getDorf1Building($wid) { - list($wid) = $this->escape_input((int) $wid); + // cache data + $bdata = $this->getBData($wid); - $q = "SELECT * FROM " . TB_PREFIX . "bdata where wid = $wid and field < 19 and master = 0"; - $result = mysqli_query($this->dblink,$q); - return $this->mysqli_fetch_all($result); + // return all non-master jobs for field type under 19 + $data = []; + foreach ($bdata as $row) { + if ($row['master'] == 0 && $row['field'] < 19) { + $data[] = $row; + } + } + + return $data; } - // no need to cache this method function getDorf2Building($wid) { - list($wid) = $this->escape_input((int) $wid); + // cache data + $bdata = $this->getBData($wid); - $q = "SELECT * FROM " . TB_PREFIX . "bdata where wid = $wid and field > 18 and master = 0"; - $result = mysqli_query($this->dblink,$q); - return $this->mysqli_fetch_all($result); + // return all non-master jobs for field type above 18 + $data = []; + foreach ($bdata as $row) { + if ($row['master'] == 0 && $row['field'] > 18) { + $data[] = $row; + } + } + + return $data; } function updateBuildingWithMaster($id, $time,$loop) { From 446e9b5f1d5544c250016c92a04d77ef83ef717f Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 25 Nov 2017 19:26:19 +0100 Subject: [PATCH 052/126] fix: artefacts couldn't be claimed after last db caching optimizations --- GameEngine/Automation.php | 2 +- GameEngine/Database.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 289de824..0b104ec3 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -2656,7 +2656,7 @@ class Automation { } else { $xp=" gained ".$heroxp." XP from the battle"; } - $artifact = $database->getOwnArtefactInfo($data['to']); + $artifact = reset($database->getOwnArtefactInfo($data['to'])); if (!empty($artifact)) { if ($type=='3') { if ($database->canClaimArtifact($data['from'],$artifact['vref'],$artifact['size'],$artifact['type'])) { diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 99ad38f4..68f7d016 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -7079,7 +7079,7 @@ References: User ID/Message ID, Mode SUM(IF(size = '3',1,0)) `unique` FROM " . TB_PREFIX . "artefacts WHERE owner = " . (int) $uid; $result = mysqli_query( $this->dblink, $q ); - $artifact = $this->mysqli_fetch_all( $result ); + $artifact = $this->mysqli_fetch_all( $result )[0]; if ( $artifact['totals'] < 3 || $type == 11 ) { $DefenderFields = $this->getResourceLevel( $vref ); From 8d8c96014b70aa98128f12090e4d890dcd80b587 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 25 Nov 2017 20:29:12 +0100 Subject: [PATCH 053/126] refactor: multiple calls to getVSumField() replaced by a single one #313 --- Admin/Templates/alliance.tpl | 15 ++++++--- GameEngine/Automation.php | 12 ++++++- GameEngine/Database.php | 59 +++++++++++++++++++++++++++------ GameEngine/Ranking.php | 28 +++++++++++----- Templates/Alliance/allidesc.tpl | 25 +++++++++----- Templates/Alliance/overview.tpl | 53 +++++++++++++++++------------ 6 files changed, 138 insertions(+), 54 deletions(-) diff --git a/Admin/Templates/alliance.tpl b/Admin/Templates/alliance.tpl index e2959060..211049a3 100644 --- a/Admin/Templates/alliance.tpl +++ b/Admin/Templates/alliance.tpl @@ -16,10 +16,17 @@ if($_GET['aid']) $aliusers = $database->getAllMember($_GET['aid']); if($alidata and $aliusers) { - foreach($aliusers as $member) - { - $totalpop += $database->getVSumField($member['id'],"pop"); - } ?> + $memberIDs = []; + foreach($aliusers as $member) { + $memberIDs[] = $member['id']; + } + $data = $database->getVSumField($memberIDs,"pop"); + + if (count($data)) { + foreach ($data as $row) { + $totalpop += $row['Total']; + } + } ?>
    diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 0b104ec3..8dad9cf3 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -5250,9 +5250,19 @@ class Automation { $ally = $database->getAlliance($aid); $memberlist = $database->getAllMember($ally['id']); $oldrank = 0; + + $memberIDs = []; foreach($memberlist as $member) { - $oldrank += $database->getVSumField($member['id'],"pop"); + $memberIDs[] = $member['id']; } + $data = $database->getVSumField($memberIDs,"pop"); + + if (count($data)) { + foreach ($data as $row) { + $oldrank += $row['Total']; + } + } + if($ally['oldrank'] != $oldrank){ if($ally['oldrank'] < $oldrank) { $totalpoints = $oldrank - $ally['oldrank']; diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 68f7d016..f053217d 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -1770,6 +1770,11 @@ class MYSQLi_DB implements IDbConnection { $uid = $newIDs; } + // nothing left to cache, return the full cache + if (!count($uid)) { + return self::$userVillagesCache; + } + switch ($mode) { // by owner ID case 0: $q = "SELECT * FROM " . TB_PREFIX . "vdata WHERE owner IN(".implode(', ', $uid).") ORDER BY capital DESC,pop DESC"; @@ -2910,9 +2915,20 @@ class MYSQLi_DB implements IDbConnection { $ally = $this->getAlliance($aid); $memberlist = $this->getAllMember($ally['id']); $oldrank = 0; - foreach($memberlist as $member) { - $oldrank += $this->getVSumField($member['id'],"pop"); - } + $memberIDs = []; + + foreach($memberlist as $member) { + $memberIDs[] = $member['id']; + } + + $data = $this->getVSumField($memberIDs,"pop"); + + if (count($data)) { + foreach ($data as $row) { + $oldrank += $row['Total']; + } + } + if($ally['oldrank'] != $oldrank){ if($ally['oldrank'] < $oldrank) { $totalpoints = $oldrank - $ally['oldrank']; @@ -3824,7 +3840,7 @@ class MYSQLi_DB implements IDbConnection { lastupdate < (UNIX_TIMESTAMP() - 600) "; // recount every 10 minutes - mysqli_query($this->dblink, $q) OR DIE ($q); + mysqli_query($this->dblink, $q); } function getVSumField($uid, $field, $use_cache = true) { @@ -7038,15 +7054,38 @@ References: User ID/Message ID, Mode // first of all, check if we should be using cache and whether the field // required is already cached - if ($use_cache && ($cachedValue = self::returnCachedContent(self::$foolArtefactCache, $type.$vid.$uid)) && !is_null($cachedValue)) { - return $cachedValue; + if ($use_cache && isset(self::$foolArtefactCache[$vid]) && is_array(self::$foolArtefactCache[$vid]) && !count(self::$foolArtefactCache[$vid])) { + return []; + } else if ($use_cache && ($cachedValue = self::returnCachedContent(self::$foolArtefactCache, $vid)) && !is_null($cachedValue)) { + $data = []; + // prepare the data as requested + if (isset($cachedValue[$type.$uid])) { + foreach ($cachedValue[$type.$uid] as $row) { + if ($row['type'] == 8 && $row['kind'] == $type && $row['owner'] == $uid && $row['size'] > 1 && $row['active'] > 1) { + $data[] = $row; + } + } + } + return $data; } - $q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE vref = $vid AND ((type = 8 AND kind = $type) OR (owner = $uid AND size > 1 AND active = 1 AND type = 8 AND kind = $type))"; - $result = mysqli_query($this->dblink,$q); + $q = "SELECT * FROM " . TB_PREFIX . "artefacts WHERE vref = $vid"; //" AND ((type = 8 AND kind = $type) OR (owner = $uid AND size > 1 AND active = 1 AND type = 8 AND kind = $type))"; + $result = $this->mysqli_fetch_all(mysqli_query($this->dblink,$q)); - self::$foolArtefactCache[$type.$vid.$uid] = $this->mysqli_fetch_all($result); - return self::$foolArtefactCache[$type.$vid.$uid]; + // cache all types and return the requested one + if (count($result)) { + foreach ($result as $arteInfo) { + if (!isset(self::$foolArtefactCache[$vid][$arteInfo['type'].$arteInfo['owner']])) { + self::$foolArtefactCache[$vid][$arteInfo['type'].$arteInfo['owner']] = []; + } + + self::$foolArtefactCache[$vid][$arteInfo['type'].$arteInfo['owner']][] = $arteInfo; + } + } else { + self::$foolArtefactCache[$vid] = []; + } + + return (isset(self::$foolArtefactCache[$vid][$type.$uid]) ? self::$foolArtefactCache[$vid][$type.$uid] : []); } function claimArtefact($vref, $ovref, $id) { diff --git a/GameEngine/Ranking.php b/GameEngine/Ranking.php index cca81a1e..0c807229 100755 --- a/GameEngine/Ranking.php +++ b/GameEngine/Ranking.php @@ -27,7 +27,7 @@ $myrank = 0; if(count($ranking) > 0) { for($i=0;$i<($users3);$i++) { - if( isset( $ranking[$i]['userid'] ) ) { + if( isset( $ranking[$i]['userid'] ) ) { if($ranking[$i]['userid'] == $id && $ranking[$i] != "pad") { $myrank = $i; } @@ -204,8 +204,8 @@ return $key; break; } - } - } + } + } if(!next($this->rankarray)) { if($field != "userid"){ return $name; @@ -215,7 +215,7 @@ break; } } - + } } @@ -268,7 +268,7 @@ WHERE " . TB_PREFIX . "users.access < " . (INCLUDE_ADMIN ? "10" : "8") . " AND " . TB_PREFIX . "users.tribe <= 3 AND " . TB_PREFIX . "users.id > 5 - ORDER BY totalpop DESC, totalvillages DESC, userid DESC"; + ORDER BY totalpop DESC, totalvillages DESC, userid DESC"; } $result = (mysqli_query($GLOBALS['link'],$q)); @@ -474,16 +474,26 @@ } public function procARankArray() { - global $multisort; + global $multisort, $database; $array = $GLOBALS['db']->getARanking(); $holder = array(); foreach($array as $value) { $memberlist = $GLOBALS['db']->getAllMember($value['id']); $totalpop = 0; - foreach($memberlist as $member) { - $totalpop += $GLOBALS['db']->getVSumField($member['id'], "pop"); - } + + $memberIDs = []; + foreach($memberlist as $member) { + $memberIDs[] = $member['id']; + } + $data = $database->getVSumField($memberIDs,"pop"); + + if (count($data)) { + foreach ($data as $row) { + $totalpop += $row['Total']; + } + } + $value['players'] = count($memberlist); $value['totalpop'] = $totalpop; if(!isset($value['avg'])) { diff --git a/Templates/Alliance/allidesc.tpl b/Templates/Alliance/allidesc.tpl index 6cd0ca34..b5837ba6 100644 --- a/Templates/Alliance/allidesc.tpl +++ b/Templates/Alliance/allidesc.tpl @@ -1,17 +1,26 @@ -alliance; -} -$varmedal = $database->getProfileMedalAlly($aid); +} +$varmedal = $database->getProfileMedalAlly($aid); $allianceinfo = $database->getAlliance($aid); $memberlist = $database->getAllMember($aid); $totalpop = 0; +$memberIDs = []; + foreach($memberlist as $member) { - $totalpop += $database->getVSumField($member['id'],"pop"); + $memberIDs[] = $member['id']; +} +$data = $database->getVSumField($memberIDs,"pop"); + +if (count($data)) { + foreach ($data as $row) { + $totalpop += $row['Total']; + } } echo "

    ".$allianceinfo['tag']." - ".$allianceinfo['name']."

    "; @@ -80,9 +89,9 @@ INDELING CATEGORIEEN: == 7. in top 3 - verdediging == == 8. in top 3 - klimmers == == 9. in top 3 - overval == -******************************/ - - +******************************/ + + foreach($varmedal as $medal) { $titel="Bonus"; switch ($medal['categorie']) { @@ -122,7 +131,7 @@ INDELING CATEGORIEEN: case "12": $titel="Top 10 of Rank Attackers of week ".$medal['points']." in a row"; break; - } + } echo" diff --git a/Templates/Alliance/overview.tpl b/Templates/Alliance/overview.tpl index 3bedaeb8..2088e9e4 100644 --- a/Templates/Alliance/overview.tpl +++ b/Templates/Alliance/overview.tpl @@ -5,7 +5,7 @@ $aid = $_GET['aid']; else { $aid = $session->alliance; } -$varmedal = $database->getProfileMedalAlly($aid); +$varmedal = $database->getProfileMedalAlly($aid); $allianceinfo = $database->getAlliance($aid); $memberlist = $database->getAllMember($aid); @@ -14,16 +14,25 @@ if($allianceinfo['tag']==""){ header("Location: allianz.php"); exit; } +$memberIDs = []; foreach($memberlist as $member) { - $totalpop += $database->getVSumField($member['id'],"pop"); + $memberIDs[] = $member['id']; } +$data = $database->getVSumField($memberIDs,"pop"); + +if (count($data)) { + foreach ($data as $row) { + $totalpop += $row['Total']; + } +} + echo "

    ".$allianceinfo['tag']." - ".$allianceinfo['name']."

    "; $profiel="".$allianceinfo['notice']."".md5('skJkev3')."".$allianceinfo['desc'].""; require("medal.php"); $profiel=explode("".md5('skJkev3')."", $profiel); -include("alli_menu.tpl"); +include("alli_menu.tpl"); ?>
    ".$titel." ".$medal['plaats']."
    @@ -69,25 +78,25 @@ include("alli_menu.tpl"); getAlliancePermission($member['id'],"rank",0); - + //username $name = $database->getUserField($member['id'],"username",0); - + //if there is no rank defined, user will not be printed if($rank == ''){ echo ''; } - + //if there is user rank defined, user will be printed else if($rank != ''){ echo ""; echo ""; echo ""; echo ""; - } + } } if($allianceinfo['forumlink'] != '' && $allianceinfo['forumlink'] != '0'){ echo ""; @@ -115,7 +124,7 @@ include("alli_menu.tpl"); -alliance){ echo ""; } @@ -139,31 +148,31 @@ foreach($memberlist as $member) { $rank = $rank+1; $TotalUserPop = $database->getVSumField($member['id'],"pop"); - $TotalVillages = $database->getProfileVillages($member['id']); - + $TotalVillages = $database->getProfileVillages($member['id']); + echo " "; echo " "; - echo " "; - echo " "; + echo " "; + echo " "; echo " "; - - if($aid == $session->alliance){ + + if($aid == $session->alliance){ if ((time()-600) < $member['timestamp']){ // 0 Min - 10 Min echo " "; }elseif ((time()-86400) < $member['timestamp'] && (time()-600) > $member['timestamp']){ // 10 Min - 1 Days - echo " "; + echo " "; }elseif ((time()-259200) < $member['timestamp'] && (time()-86400) > $member['timestamp']){ // 1-3 Days - echo " "; + echo " "; }elseif ((time()-604800) < $member['timestamp'] && (time()-259200) > $member['timestamp']){ - echo " "; + echo " "; }else{ - echo " "; + echo " "; } } - - echo " "; + + echo " "; } -?> +?>
    ".stripslashes($rank)."".$name."
    Player Population Villages 
    ".$rank.".".$member['username']."".$TotalUserPop."".$member['username']."".$TotalUserPop."".count($TotalVillages)."Now onlineOfflineOfflineLast 3 daysLast 3 daysLast 7 daysLast 7 daysinactiveinactive
    \ No newline at end of file From 5dfbd8913015eebcad2c7a0b56a6c1bcd2d3890e Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 25 Nov 2017 20:50:12 +0100 Subject: [PATCH 054/126] fix: fool's artefact caching returns non-fool artefact data #313 --- GameEngine/Automation.php | 136 ++++++++++--------- GameEngine/Database.php | 13 +- GameEngine/Technology.php | 268 ++++++++++++++++++++------------------ 3 files changed, 233 insertions(+), 184 deletions(-) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 8dad9cf3..09ead08e 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -3989,113 +3989,133 @@ class Automation { } public function getUpkeep($array,$type,$vid=0,$prisoners=0) { - global $database,$session,$village; + global $database, $session, $village; + + if ( $vid == 0 ) { + $vid = $village->wid; + } - if($vid==0) { $vid=$village->wid; } $buildarray = array(); - if($vid!=0){ $buildarray = $database->getResourceLevel($vid); } + + if ( $vid != 0 ) { + $buildarray = $database->getResourceLevel( $vid ); + } + $upkeep = 0; - switch($type) { + + switch ( $type ) { case 0: $start = 1; - $end = 50; + $end = 50; break; case 1: $start = 1; - $end = 10; + $end = 10; break; case 2: $start = 11; - $end = 20; + $end = 20; break; case 3: $start = 21; - $end = 30; + $end = 30; break; case 4: $start = 31; - $end = 40; + $end = 40; break; case 5: $start = 41; - $end = 50; + $end = 50; break; } - for($i=$start;$i<=$end;$i++) { - $k = $i-$start+1; - $unit = "u".$i; - $unit2 = "t".$k; + + for ( $i = $start; $i <= $end; $i ++ ) { + $k = $i - $start + 1; + $unit = "u" . $i; + $unit2 = "t" . $k; + global $$unit; $dataarray = $$unit; - for($j=19;$j<=38;$j++) { - if($buildarray['f'.$j.'t'] == 41) { + + for ( $j = 19; $j <= 38; $j ++ ) { + if ( $buildarray[ 'f' . $j . 't' ] == 41 ) { $horsedrinking = $j; } } - if($prisoners == 0){ - if(isset($horsedrinking)){ - if(($i==4 && $buildarray['f'.$horsedrinking] >= 10) - || ($i==5 && $buildarray['f'.$horsedrinking] >= 15) - || ($i==6 && $buildarray['f'.$horsedrinking] == 20)) { - $upkeep += ($dataarray['pop']-1) * $array[$unit]; - } else { - $upkeep += $dataarray['pop'] * $array[$unit]; - }}else{ - $upkeep += $dataarray['pop'] * $array[$unit]; - } - }else{ - if(isset($horsedrinking)){ - if(($i==4 && $buildarray['f'.$horsedrinking] >= 10) - || ($i==5 && $buildarray['f'.$horsedrinking] >= 15) - || ($i==6 && $buildarray['f'.$horsedrinking] == 20)) { - $upkeep += ($dataarray['pop']-1) * $array[$unit2]; - } else { - $upkeep += $dataarray['pop'] * $array[$unit2]; - }}else{ - $upkeep += $dataarray['pop'] * $array[$unit2]; - } + + if ( $prisoners == 0 ) { + if ( isset( $horsedrinking ) ) { + if ( ( $i == 4 && $buildarray[ 'f' . $horsedrinking ] >= 10 ) + || ( $i == 5 && $buildarray[ 'f' . $horsedrinking ] >= 15 ) + || ( $i == 6 && $buildarray[ 'f' . $horsedrinking ] == 20 ) ) { + $upkeep += ( $dataarray['pop'] - 1 ) * $array[ $unit ]; + } else { + $upkeep += $dataarray['pop'] * $array[ $unit ]; + } + } else { + $upkeep += $dataarray['pop'] * $array[ $unit ]; + } + } else { + if ( isset( $horsedrinking ) ) { + if ( ( $i == 4 && $buildarray[ 'f' . $horsedrinking ] >= 10 ) + || ( $i == 5 && $buildarray[ 'f' . $horsedrinking ] >= 15 ) + || ( $i == 6 && $buildarray[ 'f' . $horsedrinking ] == 20 ) ) { + $upkeep += ( $dataarray['pop'] - 1 ) * $array[ $unit2 ]; + } else { + $upkeep += $dataarray['pop'] * $array[ $unit2 ]; + } + } else { + $upkeep += $dataarray['pop'] * $array[ $unit2 ]; + } } } + // $unit = "hero"; // global $$unit; // $dataarray = $$unit; - if($prisoners == 0){ - if (!isset($array['hero'])) { + if ( $prisoners == 0 ) { + if ( ! isset( $array['hero'] ) ) { $array['hero'] = 0; } $upkeep += $array['hero'] * 6; - }else{ - if (!isset($array['t11'])) { + } else { + if ( ! isset( $array['t11'] ) ) { $array['t11'] = 0; } $upkeep += $array['t11'] * 6; } - $who=$database->getVillageField($vid,"owner"); - $artefact = count($database->getOwnUniqueArtefactInfo2($who,4,3,0)); - $artefact1 = count($database->getOwnUniqueArtefactInfo2($vid,4,1,1)); - $artefact2 = count($database->getOwnUniqueArtefactInfo2($who,4,2,0)); - if($artefact > 0){ + + $who = $database->getVillageField( $vid, "owner" ); + $artefact = count( $database->getOwnUniqueArtefactInfo2( $who, 4, 3, 0 ) ); + $artefact1 = count( $database->getOwnUniqueArtefactInfo2( $vid, 4, 1, 1 ) ); + $artefact2 = count( $database->getOwnUniqueArtefactInfo2( $who, 4, 2, 0 ) ); + + if ( $artefact > 0 ) { $upkeep /= 2; - $upkeep = round($upkeep); - }else if($artefact1 > 0){ + $upkeep = round( $upkeep ); + } else if ( $artefact1 > 0 ) { $upkeep /= 2; - $upkeep = round($upkeep); - }else if($artefact2 > 0){ + $upkeep = round( $upkeep ); + } else if ( $artefact2 > 0 ) { $upkeep /= 4; - $upkeep = round($upkeep); + $upkeep = round( $upkeep ); $upkeep *= 3; } - $foolartefact = $database->getFoolArtefactInfo(4,$vid,$who); - if(count($foolartefact) > 0){ - foreach($foolartefact as $arte){ - if($arte['bad_effect'] == 1){ + + $foolartefact = $database->getFoolArtefactInfo( 4, $vid, $who ); + + if ( count( $foolartefact ) > 0 ) { + foreach ( $foolartefact as $arte ) { + if ( $arte['bad_effect'] == 1 ) { $upkeep *= $arte['effect2']; - }else{ + } else { $upkeep /= $arte['effect2']; - $upkeep = round($upkeep); + $upkeep = round( $upkeep ); } } } + return $upkeep; } diff --git a/GameEngine/Database.php b/GameEngine/Database.php index f053217d..91fdd2e6 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -7085,7 +7085,18 @@ References: User ID/Message ID, Mode self::$foolArtefactCache[$vid] = []; } - return (isset(self::$foolArtefactCache[$vid][$type.$uid]) ? self::$foolArtefactCache[$vid][$type.$uid] : []); + if ( + isset(self::$foolArtefactCache[$vid][$type.$uid]) && + self::$foolArtefactCache[$vid][$type.$uid]['type'] == 8 && + self::$foolArtefactCache[$vid][$type.$uid]['kind'] == $type && + self::$foolArtefactCache[$vid][$type.$uid]['owner'] == $uid && + self::$foolArtefactCache[$vid][$type.$uid]['size'] > 1 && + self::$foolArtefactCache[$vid][$type.$uid]['active'] > 1 + ) { + return self::$foolArtefactCache[$vid][$type.$uid]; + } else { + return []; + } } function claimArtefact($vref, $ovref, $id) { diff --git a/GameEngine/Technology.php b/GameEngine/Technology.php index ae11ccdb..0820131e 100755 --- a/GameEngine/Technology.php +++ b/GameEngine/Technology.php @@ -443,141 +443,159 @@ class Technology { } public function getUpkeep($array,$type,$vid=0,$prisoners=0) { - global $database,$session,$village; - if($vid==0) { $vid=$village->wid; } - $buildarray = array(); - $buildarray = $database->getResourceLevel($vid); - $upkeep = 0; - switch($type) { - case 0: - $start = 1; - $end = 50; - break; - case 1: - $start = 1; - $end = 10; - break; - case 2: - $start = 11; - $end = 20; - break; - case 3: - $start = 21; - $end = 30; - break; - case 4: - $start = 31; - $end = 40; - break; - case 5: - $start = 41; - $end = 50; - break; - } + global $database, $session, $village; - for($j=19;$j<=38;$j++) { - if($buildarray['f'.$j.'t'] == 41) { - $horsedrinking = $j; - break; - } - } + if ( $vid == 0 ) { + $vid = $village->wid; + } - for($i=$start;$i<=$end;$i++) { - $k = $i-$start+1; - $unit = "u".$i; - $unit2 = "t".$k; - global $$unit; - $dataarray = $$unit; - if($prisoners == 0){ - if(isset($horsedrinking)){ - if(($i==4 && $buildarray['f'.$horsedrinking] >= 10) - || ($i==5 && $buildarray['f'.$horsedrinking] >= 15) - || ($i==6 && $buildarray['f'.$horsedrinking] == 20) - ) { - $upkeepDecrement = 0; - switch ($i) { - case 4: $upkeepDecrement = 2; - break; + $buildarray = array(); + $buildarray = $database->getResourceLevel( $vid ); + $upkeep = 0; - case 5: $upkeepDecrement = 3; - break; + switch ( $type ) { + case 0: + $start = 1; + $end = 50; + break; + case 1: + $start = 1; + $end = 10; + break; + case 2: + $start = 11; + $end = 20; + break; + case 3: + $start = 21; + $end = 30; + break; + case 4: + $start = 31; + $end = 40; + break; + case 5: + $start = 41; + $end = 50; + break; + } - case 6: $upkeepDecrement = 4; - break; - } - $upkeep += ($dataarray['pop'] - $upkeepDecrement) * $array[$unit]; - } else { - $upkeep += $dataarray['pop'] * $array[$unit]; - } - } else { - $upkeep += $dataarray['pop'] * $array[$unit]; - } - } else { - if(isset($horsedrinking)){ - if(($i==4 && $buildarray['f'.$horsedrinking] >= 10) - || ($i==5 && $buildarray['f'.$horsedrinking] >= 15) - || ($i==6 && $buildarray['f'.$horsedrinking] == 20) - ) { - $upkeepDecrement = 0; - switch ($i) { - case 4: $upkeepDecrement = 2; - break; + for ( $j = 19; $j <= 38; $j ++ ) { + if ( $buildarray[ 'f' . $j . 't' ] == 41 ) { + $horsedrinking = $j; + break; + } + } - case 5: $upkeepDecrement = 3; - break; + for ( $i = $start; $i <= $end; $i ++ ) { + $k = $i - $start + 1; + $unit = "u" . $i; + $unit2 = "t" . $k; + global $$unit; + $dataarray = $$unit; + if ( $prisoners == 0 ) { + if ( isset( $horsedrinking ) ) { + if ( ( $i == 4 && $buildarray[ 'f' . $horsedrinking ] >= 10 ) + || ( $i == 5 && $buildarray[ 'f' . $horsedrinking ] >= 15 ) + || ( $i == 6 && $buildarray[ 'f' . $horsedrinking ] == 20 ) + ) { + $upkeepDecrement = 0; + switch ( $i ) { + case 4: + $upkeepDecrement = 2; + break; - case 6: $upkeepDecrement = 4; - break; - } - $upkeep += ($dataarray['pop'] - $upkeepDecrement) * $array[$unit2]; - } else { - $upkeep += $dataarray['pop'] * $array[$unit2]; - } - } else { - $upkeep += $dataarray['pop'] * $array[$unit2]; - } - } - } - // $unit = "hero"; - // global $$unit; - // $dataarray = $$unit; - if($prisoners == 0){ - if (!isset($array['hero'])) { + case 5: + $upkeepDecrement = 3; + break; + + case 6: + $upkeepDecrement = 4; + break; + } + $upkeep += ( $dataarray['pop'] - $upkeepDecrement ) * $array[ $unit ]; + } else { + $upkeep += $dataarray['pop'] * $array[ $unit ]; + } + } else { + $upkeep += $dataarray['pop'] * $array[ $unit ]; + } + } else { + if ( isset( $horsedrinking ) ) { + if ( ( $i == 4 && $buildarray[ 'f' . $horsedrinking ] >= 10 ) + || ( $i == 5 && $buildarray[ 'f' . $horsedrinking ] >= 15 ) + || ( $i == 6 && $buildarray[ 'f' . $horsedrinking ] == 20 ) + ) { + $upkeepDecrement = 0; + switch ( $i ) { + case 4: + $upkeepDecrement = 2; + break; + + case 5: + $upkeepDecrement = 3; + break; + + case 6: + $upkeepDecrement = 4; + break; + } + $upkeep += ( $dataarray['pop'] - $upkeepDecrement ) * $array[ $unit2 ]; + } else { + $upkeep += $dataarray['pop'] * $array[ $unit2 ]; + } + } else { + $upkeep += $dataarray['pop'] * $array[ $unit2 ]; + } + } + } + + // $unit = "hero"; + // global $$unit; + // $dataarray = $$unit; + if ( $prisoners == 0 ) { + if ( ! isset( $array['hero'] ) ) { $array['hero'] = 0; } - $upkeep += $array['hero'] * 6; - }else{ - if (!isset($array['t11'])) { + $upkeep += $array['hero'] * 6; + } else { + if ( ! isset( $array['t11'] ) ) { $array['t11'] = 0; } - $upkeep += $array['t11'] * 6; - } - $artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,4,3,0)); - $artefact1 = count($database->getOwnUniqueArtefactInfo2($vid,4,1,1)); - $artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,4,2,0)); - if($artefact > 0){ - $upkeep /= 2; - $upkeep = round($upkeep); - }else if($artefact1 > 0){ - $upkeep /= 2; - $upkeep = round($upkeep); - }else if($artefact2 > 0){ - $upkeep /= 4; - $upkeep = round($upkeep); - $upkeep *= 3; - } - $foolartefact = $database->getFoolArtefactInfo(4,$vid,$session->uid); - if(count($foolartefact) > 0){ - foreach($foolartefact as $arte){ - if($arte['bad_effect'] == 1){ - $upkeep *= $arte['effect2']; - }else{ - $upkeep /= $arte['effect2']; - $upkeep = round($upkeep); - } - } - } - return $upkeep; + $upkeep += $array['t11'] * 6; + } + + $artefact = count( $database->getOwnUniqueArtefactInfo2( $session->uid, 4, 3, 0 ) ); + $artefact1 = count( $database->getOwnUniqueArtefactInfo2( $vid, 4, 1, 1 ) ); + $artefact2 = count( $database->getOwnUniqueArtefactInfo2( $session->uid, 4, 2, 0 ) ); + + if ( $artefact > 0 ) { + $upkeep /= 2; + $upkeep = round( $upkeep ); + } else if ( $artefact1 > 0 ) { + $upkeep /= 2; + $upkeep = round( $upkeep ); + } else if ( $artefact2 > 0 ) { + $upkeep /= 4; + $upkeep = round( $upkeep ); + $upkeep *= 3; + } + + $foolartefact = $database->getFoolArtefactInfo( 4, $vid, $session->uid ); + + if ( count( $foolartefact ) > 0 ) { + var_dump($foolartefact); + foreach ( $foolartefact as $arte ) { + if ( $arte['bad_effect'] == 1 ) { + $upkeep *= $arte['effect2']; + } else { + $upkeep /= $arte['effect2']; + $upkeep = round( $upkeep ); + } + } + } + + return $upkeep; } private function trainUnit($unit,$amt,$great=false) { From 2d995d5cebd703bb776531f4b82f37a09d9e1a57 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 25 Nov 2017 21:21:40 +0100 Subject: [PATCH 055/126] fix: all numbers must be in same color --- .../img/g/s/lvl11_20_active.gif | Bin 1498 -> 1491 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/gpack/travian_default/img/g/s/lvl11_20_active.gif b/gpack/travian_default/img/g/s/lvl11_20_active.gif index bb4f47707ddea811879d809a25e55f23057c63a3..e8ef604d237d913687a33731c96f81d331360840 100644 GIT binary patch literal 1491 zcmW;HYgChU9KiAao?Y1XY;)kC34+h&7!Pd4E7&y($^g_{ zg%<`vbqUhHg|~izjPGH42p0SdFOC8A8|ZI<={A^eLH-}G|@Z@Wl{sE>(;86e``r&~erhIUJ0H*q3Dgb}^Anb$5ui*D{aN`U3?HpV?2g9cz zcp5IB0`F-6K>sIs#GoPcB2xaR|DF&Fs1`%XD!wUjBXWIg+R`Hj3kR#UZOcpU52hVI zp-@h8cP$+l__4UBy6F|wgN=*Uo^3Rn#H}Oso#lBIxhu)#sfl>@T1WlbSLE6FT5`Tv zil^V$Z@ywaY{NZ|D3OGv(w$ZnR9a z*)cw(<3~I(Oq!iE9fsSMgd9TCHGHO27*^>9FVMLKD|CjCm&S}6yKv1VW(MA6$zsif zdcx1Io6mm!rN?HxU)sj~_>^QiE6F2+k{$R4^RKEXcaX0?uR z)r~SLZ2dcI*Qr`YTuY6`s0|1hj8;!(IEyaoAd7Yw!rDu}o{lxN%rl|8dP(Yv@KS@% z&yC}vZcj}`0P`DSWM>Xb^XLhB>1#h4uJ5@MotR-R@#(jH$2T46H<*x*uO}BJ1yN!p zFB%ixQu(!dyC9{|xR|KL_KK1-YC?{3FAH&5-C@DAgbL9dS+)DJltQ8=p*Z+HR=4MV zfhFV~^U?5u`@gJw-ISSOv|;=E0vP*tDSCM)4+)u)f5tap5i&nP2^50}e&!NJPuZrU z9mr>{vXSNM8zk0RE>C8lTcS^hHSCm{172*YXPZ|cpB*a3uD5utSZi-)E+>toD9)={ zkGi8$-PSp)Nq1zBKf7=J@77X=)0Sg9@5FYOnuS_EN5+1gJ6CPCGuSnah<$^7rN7xw z{`-*c1ij(=i4bKszO1?j@XyZ65*6p$j*t%#OCxd9YU`tv7g{dtSc;(;i zv4>W@-D*kXl~#x-qN+hftfrMXHLP^Ol|6f6bWW^oL9j~OelSvn@#PGnQ(P4~t!3(3 zg)^!)wyU~kB`wLz?eZiHbs>Sns$s95H&aECJ#-EW_v1w)sgBaToQ9Uc4E*ci*V^OT+bxEcCL1uTPxhL^@nr z@zy(+4YxcBnCtE-~_`on*LugKlp|H%Ub`TzUG-Px_++^_%t)5F1}C@AXF(5V*}^fyl8z`mk|hpj_R+9M;Q zU1`VxCgqr#r1$l}007(j_rSKbqT}DN>*%)u0qkID#Q_2KjgP6QsH6V)!TtEa$i<}q z0MQ>Y@%i|~Fg@lHCiqNK(+fKI2nhK9|IGmb@sN_Jv$CQB9r^qC#Q*%n{`tcH{>T6S z%l-JlEC2ui0IC2C000L6z@Jdq01SV{+Qpj{deX8lNdVKgET0m2Hh4QB2 zVc{xOt{RQsyGEx2R?4(c4ApMOe^6OUWkXjzQ#=g;5MYXoV1y6>U_B%T3jraKh7kc$ zJq!va2tH>=J`e;Srw<<)44h;m9uGVZEFLH*9s_M;o>Bz`0Sg&FzeJt@00=kF9*oJU zls^Ch1{?%Ngq}PqmKhuvrl>3?CgeXp6($N0fImAD85;-<^Y!*vA=S`gLB*FD19mu3km4X89yY*$(ZYZP3@u<- zXaND_g98#bU}%80h1#M&c=Slop@j=3FiQAH0AYiOCUObXjRECnj|2)p@Q@O?u7w_F zd=PN^Q3wwJf?Lq=0pI`#77{oQvKGKGlmIPABpA`5f|1LaEi~Xk8$bgK767!tEYyXV ztUnSE*g(QjkJ2qHK&h!C0fr3`5IqRd!bAcI23mx0ph1EJ3otyDzz!<3 z5I_^Iq!5b_DUj6yIaq!x{yV08(6BCg{ZkG1wCi z4-)w2g#|JQ(87b3Nx%VxKA^C{NG)7Yjt~Wu2?Y%noKV64j0s* zMY>SDn}81kU|i9}DkLxgZl$F#W-1*xAV4ZDV2C7+W4d}C!m=*x<_j*^pxPINOx%Mz z02P2JDjQRP+YB4fK){&mJnO7i%z$7(%TQc^=K~<*D+JB60YHLZvl=q74<{^;fEacU zEguFGaO&xU4uPP7521Ykf(PCyPy*Zqw~%G%SrW3qKOAjtU;5P_%Y!3bzj7D5={0?Ysa2N;+G3=!ghy755(fTE5gG~j}9n2QBgkPJgy z5C9L@!2(NQgZz9Dfd$}!35fj%S zfDwp_iCEOa8V+E^c=*8w9~i+pvWN#fWYG&%9OD#yKmswrO^QE=BDw(dyC47nJL{}t AD*ylh From 72599065a94105c1d16be77908d188f9a88d308e Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sun, 26 Nov 2017 12:26:02 +0100 Subject: [PATCH 056/126] fix: disallow building non-existing buildings --- GameEngine/Building.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/GameEngine/Building.php b/GameEngine/Building.php index 94c0808c..33e327ab 100755 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -76,6 +76,8 @@ class Building { $page = basename($_SERVER['SCRIPT_NAME']); $levels = $database->getResourceLevel($village->wid); if ( + // check that our ID actually exists within the buildings list + isset($village->resarray['f'.$tid.'t']) && // let's see if we should allow building what we want where we want to // (prevent building resource fields in the village ( @@ -120,6 +122,14 @@ class Building { } if(isset($get['master']) && isset($get['id']) && isset($get['time']) && $session->gold >= 1 && $session->goldclub && $village->master == 0 && (isset($get['c']) && $get['c']== $session->checker)) { + // determine the timestamp of last of all the current upgrades + $t = 0; + foreach ($this->buildArray as $key) { + if ($key['timestamp'] > $t) { + $t = $key['timestamp']; + } + } + $m=$get['master']; $master = $_GET; $session->changeChecker(); From 43b7e6c9b012328d2c430c06f1bef01c4715f480 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sun, 26 Nov 2017 14:11:55 +0100 Subject: [PATCH 057/126] fix: ww can be built to 51 without construction plan in a loop #337 --- GameEngine/Building.php | 126 +++++++++++++++++++++++++++------- Templates/Build/avaliable.tpl | 2 +- Templates/Build/wwupgrade.tpl | 26 +------ 3 files changed, 103 insertions(+), 51 deletions(-) diff --git a/GameEngine/Building.php b/GameEngine/Building.php index 33e327ab..1b1ad9ab 100755 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -42,10 +42,10 @@ class Building { } } - public function residenceOfPalaceBuildInProgress($vid) { + public function residenceOfPalaceBuildInProgress() { global $database, $village; - $residenceOrPalaceInProgress = $database->getBuildingByType($village->wid, '25, 26'); + $residenceOrPalaceInProgress = $database->getBuildingByType($village->resarray, '25, 26'); $residenceBuildInProgress = false; $palaceBuildInProgress = false; @@ -65,6 +65,69 @@ class Building { ]; } + /* + * Checks whether to allow building Wonder of the World + * above current level. This includes checks for WW upgrade + * currently in progress as well as current WW level + * and the right number of building plans in the alliance. + */ + public function allowWwUpgrade() { + global $database, $village, $session; + static $cached = null; + + if ($cached === null) { + $wwHighestLevelFound = $village->resarray['f99']; + $wwBuildingProgress = $database->getBuildingByType( $village->wid, 99 ); + + if ( count( $wwBuildingProgress ) ) { + if ( $wwBuildingProgress[0]['level'] > $wwHighestLevelFound ) { + $wwHighestLevelFound = $wwBuildingProgress[0]['level']; + } + } + + // check if we should allow building the WW this high + if ( $wwHighestLevelFound >= 50 ) { + $needed_plan = 1; + } else { + $needed_plan = 0; + } + + // count building plans + if ( $needed_plan ) { + $wwbuildingplan = 0; + $villages = $database->getVillagesID( $session->uid ); + foreach ( $villages as $village1 ) { + $plan = count( $database->getOwnArtefactInfoByType2( $village1, 11 ) ); + if ( $plan > 0 ) { + $wwbuildingplan = 1; + } + } + + if ( $session->alliance != 0 ) { + $alli_users = $database->getUserByAlliance( $session->alliance ); + foreach ( $alli_users as $users ) { + $villages = $database->getVillagesID( $users['id'] ); + if ( $users['id'] != $session->uid ) { + foreach ( $villages as $village1 ) { + $plan = count( $database->getOwnArtefactInfoByType2( $village1, 11 ) ); + if ( $plan > 0 ) { + $wwbuildingplan += 1; + } + } + } + } + } + + $cached = $wwbuildingplan > $needed_plan; + } else { + // no need for building plans, we can still upgrade WW + $cached = true; + } + } + + return $cached; + } + public function canProcess($id,$tid) { //add fix by ronix global $session, $database, $village; @@ -75,6 +138,38 @@ class Building { } else { $page = basename($_SERVER['SCRIPT_NAME']); $levels = $database->getResourceLevel($village->wid); + $progresses = $this->residenceOfPalaceBuildInProgress(); + + if ( + !( + // check if we're not trying to hack-build residence and palace together + ( + !in_array($tid, [25, 26]) || + ( + ($tid == 25 && $progresses['palace'] === false) || + ($tid == 26 && $progresses['residence'] === false) + ) + ) && + + // don't allow building WW to level 51 with a waiting loop + ( + $tid != 99 || + ( + $tid == 99 && + $this->allowWwUpgrade() + ) + ) + ) + ) { + if ( $tid > 18 ) { + header( "Location: dorf2.php" ); + exit; + } else { + header( "Location: dorf1.php" ); + exit; + } + } + if ( // check that our ID actually exists within the buildings list isset($village->resarray['f'.$tid.'t']) && @@ -122,14 +217,7 @@ class Building { } if(isset($get['master']) && isset($get['id']) && isset($get['time']) && $session->gold >= 1 && $session->goldclub && $village->master == 0 && (isset($get['c']) && $get['c']== $session->checker)) { - // determine the timestamp of last of all the current upgrades - $t = 0; - foreach ($this->buildArray as $key) { - if ($key['timestamp'] > $t) { - $t = $key['timestamp']; - } - } - + $this->canProcess($get['master'],$get['id']); $m=$get['master']; $master = $_GET; $session->changeChecker(); @@ -138,20 +226,8 @@ class Building { exit; } - // check if we're not trying to hack-build residence and palace together - if ( - ($progresses = $this->residenceOfPalaceBuildInProgress($village->wid)) && - ( - !in_array($get['master'], [25, 26]) || - ( - ($get['master'] == 25 && $progresses['palace'] === false) || - ($get['master'] == 26 && $progresses['residence'] === false) - ) - ) - ) { - $level = $database->getResourceLevel( $village->wid ); - $database->addBuilding( $village->wid, $get['id'], $get['master'], 1, $get['time'], 1, $level[ 'f' . $get['id'] ] + 1 + count( $database->getBuildingByField( $village->wid, $get['id'] ) ) ); - } + $level = $database->getResourceLevel( $village->wid ); + $database->addBuilding( $village->wid, $get['id'], $get['master'], 1, $get['time'], 1, $level[ 'f' . $get['id'] ] + 1 + count( $database->getBuildingByField( $village->wid, $get['id'] ) ) ); if ( $get['id'] > 18 ) { header( "Location: dorf2.php" ); @@ -511,7 +587,7 @@ class Building { if($this->allocated < $this->maxConcurrent) { // check if we're not trying to hack-build residence and palace together if ( - ($progresses = $this->residenceOfPalaceBuildInProgress($village->wid)) && + ($progresses = $this->residenceOfPalaceBuildInProgress()) && ( !in_array($tid, [25, 26]) || ( diff --git a/Templates/Build/avaliable.tpl b/Templates/Build/avaliable.tpl index ff1bfb5a..7087197c 100644 --- a/Templates/Build/avaliable.tpl +++ b/Templates/Build/avaliable.tpl @@ -98,7 +98,7 @@ $greatwarehouse1 = getTypeCount(38); $greatgranary1 = getTypeCount(39); $greatworkshop1 = getTypeCount(42); -$residenceOrPalaceInProgress = $building->residenceOfPalaceBuildInProgress($village->wid); +$residenceOrPalaceInProgress = $building->residenceOfPalaceBuildInProgress(); $residenceBuildInProgress = $residenceOrPalaceInProgress['residence']; $palaceBuildInProgress = $residenceOrPalaceInProgress['palace']; diff --git a/Templates/Build/wwupgrade.tpl b/Templates/Build/wwupgrade.tpl index 511bf16f..fffd6aa7 100644 --- a/Templates/Build/wwupgrade.tpl +++ b/Templates/Build/wwupgrade.tpl @@ -8,31 +8,7 @@ if ( $wwlevel >= 50 ) { $needed_plan = 0; } -$wwbuildingplan = 0; -$villages = $database->getVillagesID( $session->uid ); -foreach ( $villages as $village1 ) { - $plan = count( $database->getOwnArtefactInfoByType2( $village1, 11 ) ); - if ( $plan > 0 ) { - $wwbuildingplan = 1; - } -} - -if ( $session->alliance != 0 ) { - $alli_users = $database->getUserByAlliance( $session->alliance ); - foreach ( $alli_users as $users ) { - $villages = $database->getVillagesID( $users['id'] ); - if ( $users['id'] != $session->uid ) { - foreach ( $villages as $village1 ) { - $plan = count( $database->getOwnArtefactInfoByType2( $village1, 11 ) ); - if ( $plan > 0 ) { - $wwbuildingplan += 1; - } - } - } - } -} - -if ( $wwbuildingplan > $needed_plan ) { +if ( $building->allowWwUpgrade() ) { if ( $bindicate == 1 ) { echo "

    " . MAX_LEVEL . "

    "; } else if ( $bindicate == 10 ) { From ec81cb70b85559ad1594f63fd3e7f9ca298fe630 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sun, 26 Nov 2017 14:23:01 +0100 Subject: [PATCH 058/126] fix: residence and palace being built together check did not always work --- GameEngine/Building.php | 4 ++-- GameEngine/Database.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/GameEngine/Building.php b/GameEngine/Building.php index 1b1ad9ab..9864dc8a 100755 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -45,13 +45,13 @@ class Building { public function residenceOfPalaceBuildInProgress() { global $database, $village; - $residenceOrPalaceInProgress = $database->getBuildingByType($village->resarray, '25, 26'); + $residenceOrPalaceInProgress = $database->getBuildingByType2($village->wid, '25, 26'); $residenceBuildInProgress = false; $palaceBuildInProgress = false; if (count($residenceOrPalaceInProgress)) { foreach ($residenceOrPalaceInProgress as $record) { - if ($record['type'] == 25) { + if ($record == 25) { $residenceBuildInProgress = true; } else { $palaceBuildInProgress = true; diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 91fdd2e6..c42eb5a9 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -5061,7 +5061,7 @@ References: User ID/Message ID, Mode $wid = (int) $wid; if (!is_array($type)) { - $type = [(int) $type]; + $type = [$type]; } else { foreach ($type as $index => $typeValue) { $type[$index] = (int) $typeValue; From d72290bb35b262125f9cb93a9617a47d2578c684 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sun, 26 Nov 2017 14:39:36 +0100 Subject: [PATCH 059/126] fix: changing village name to the same name in Quest 3 marks quest as OK --- Templates/Ajax/quest_core.tpl | 4 +- Templates/Ajax/quest_core25.tpl | 158 ++++++++++++++++---------------- 2 files changed, 81 insertions(+), 81 deletions(-) diff --git a/Templates/Ajax/quest_core.tpl b/Templates/Ajax/quest_core.tpl index 5704d633..4c5b22b2 100644 --- a/Templates/Ajax/quest_core.tpl +++ b/Templates/Ajax/quest_core.tpl @@ -473,7 +473,7 @@ if ($cropL<1){?> //Check the village name is changed or is default name -$vName=$village->vname; +$vName=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} @@ -944,7 +944,7 @@ if ($cropL<1){?> //Check the village name is changed or is default name -$vName=$village->vname; +$vName=str_replace(''', "'", $village->vname); if ($vName==$session->userinfo['username']."'s village"){?> {"markup":"\n\t\t

    \"\"Task 3: Your Village's Name<\/h1>
    ”Creative as you are you can grant your village the ultimate name.\r\n

    \r\nClick on 'profile' in the left hand menu and then select 'change profile'...”<\/i>

    Order:<\/p>Change your village's name to something nice.<\/div>
    <\/span><\/div>\n\t\t

    <\/div>\n\t\t","number":"-3","reward":false,"qgsrc":"q_luserinfo['tribe'];?>","msrc":"","altstep":0} diff --git a/Templates/Ajax/quest_core25.tpl b/Templates/Ajax/quest_core25.tpl index f68fb105..a6aa5e40 100644 --- a/Templates/Ajax/quest_core25.tpl +++ b/Templates/Ajax/quest_core25.tpl @@ -8,7 +8,7 @@ ## Developed by: DesPlus and Marvin ## ## Fixed by: Shadow / Skype : cata7007 and Armando ## ## Revision by: noonn ## -## Official Quest by: ronix ## +## Official Quest by: ronix ## ## License: TravianZ Project ## ## Copyright: TravianZ (c) 2010-2013. All rights reserved. ## ## URLs: http://travian.shadowss.ro ## @@ -31,16 +31,16 @@ else if(!$message->unread && $message->nunread) { $messagelol = "i3"; } else if($message->unread && $message->nunread) { $messagelol = "i1"; } else { $messagelol = "i4"; } -//set $skipp_time. Use the SPEED. standard (1x) = 10 hours. -if(SPEED == '1'){ - $skipp_time="43200"; -} else if(SPEED == '2'){ - $skipp_time="21600"; -} else if(SPEED == '3'){ - $skipp_time="11988"; +//set $skipp_time. Use the SPEED. standard (1x) = 10 hours. +if(SPEED == '1'){ + $skipp_time="43200"; +} else if(SPEED == '2'){ + $skipp_time="21600"; +} else if(SPEED == '3'){ + $skipp_time="11988"; } else if(SPEED <= '5'){ - $skipp_time="7200"; -} else if(SPEED > '5'){ + $skipp_time="7200"; +} else if(SPEED > '5'){ $skipp_time= 3600 / SPEED; } @@ -57,7 +57,7 @@ if (isset($qact)){ $database->updateUserField($_SESSION['username'],'quest','1',0); $_SESSION['qst']= 1; break; - //user does not follow the quest. + //user does not follow the quest. //Get reward: Resources: Every 24 hours (1 speed) 24/speed=hours //Gold: 25 gold case 'skip': @@ -66,10 +66,10 @@ if (isset($qact)){ break; case '2': - $database->updateUserField($_SESSION['username'],'quest','2',0); - $_SESSION['qst']= 2; + $database->updateUserField($_SESSION['username'],'quest','2',0); + $_SESSION['qst']= 2; //Give Reward - $database->FinishWoodcutter($session->villages[0]); + $database->FinishWoodcutter($session->villages[0]); break; case '3': @@ -89,18 +89,18 @@ if (isset($qact)){ $database->updateUserField($_SESSION['username'],'quest','4',0); $_SESSION['qst']= 4; //Give Reward - $database->modifyResource($session->villages[0],30,60,30,20,1); + $database->modifyResource($session->villages[0],30,60,30,20,1); break; - + case 'rank': $rSubmited=$qact2; break; - + case '5': $database->updateUserField($_SESSION['username'],'quest','5',0); $_SESSION['qst']= 5; //Give Reward - $database->modifyResource($session->villages[0],40,30,20,30,1); + $database->modifyResource($session->villages[0],40,30,20,30,1); break; case '6': @@ -111,9 +111,9 @@ if (isset($qact)){ $database->sendMessage($session->userinfo['id'],4,$Subject,$Message,0,0,0,0,0); $RB=true; //Give Reward - $database->modifyResource($session->villages[0],50,60,30,30,1); + $database->modifyResource($session->villages[0],50,60,30,30,1); break; - + case '7': $database->updateUserField($_SESSION['username'],'quest','7',0); $_SESSION['qst']= 7; @@ -127,36 +127,36 @@ if (isset($qact)){ $x=$qact2; $y=$qact3; break; - + case '8': $database->updateUserField($_SESSION['username'],'quest','8',0); $_SESSION['qst']= 8; //Give Reward $database->modifyResource($session->villages[0],60,30,40,90,1); break; - + case '9': $crop = round($village->acrop); if ($crop>=200){ $database->updateUserField($_SESSION['username'],'quest','9',0); - //Get 200 Crop - $database->modifyResource($session->villages[0],0,0,0,-200,1); + //Get 200 Crop + $database->modifyResource($session->villages[0],0,0,0,-200,1); //Give Reward $attack = $database->addAttack(0,1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0); $database->addMovement(3,0,$session->villages[0],$attack,time(),time()+43200/INCREASE_SPEED); } else{ $NoCrop=Q8_NOCROP; } - $_SESSION['qst']= 9; + $_SESSION['qst']= 9; break; - + case '10': $database->updateUserField($_SESSION['username'],'quest','10',0); $_SESSION['qst']= 10; //Give Reward $database->modifyResource($session->villages[0],100,80,40,40,1); break; - + case '11': $database->updateUserField($_SESSION['username'],'quest','11',0); $_SESSION['qst']= 11; @@ -174,16 +174,16 @@ if (isset($qact)){ $database->updateUserField($_SESSION['username'],'quest','12',0); $_SESSION['qst']= 12; //Give Reward - $database->modifyResource($session->villages[0],75,140,40,40,1); + $database->modifyResource($session->villages[0],75,140,40,40,1); break; - + case '13': $database->updateUserField($_SESSION['username'],'quest','13',0); $_SESSION['qst']= 13; //Give Reward $database->modifyResource($session->villages[0],75,80,30,50,1); break; - + case '14': $database->updateUserField($_SESSION['username'],'quest','14',0); $_SESSION['qst']= 14; @@ -197,7 +197,7 @@ if (isset($qact)){ //Give Reward $database->modifyResource($session->villages[0],150,180,30,130,1); break; - + case '16': $database->updateUserField($_SESSION['username'],'quest','16',0); $_SESSION['qst']= 16; @@ -215,21 +215,21 @@ if (isset($qact)){ //Give Reward $database->modifyResource($session->villages[0],50,30,60,20,1); break; - + case '18': $database->updateUserField($_SESSION['username'],'quest','18',0); $_SESSION['qst']= 18; //Give Reward $database->modifyResource($session->villages[0],75,75,40,40,1); break; - + case '19': $database->updateUserField($_SESSION['username'],'quest','19',0); $_SESSION['qst']= 19; //Give Reward $database->modifyResource($session->villages[0],100,90,100,60,1); break; - + case '20': $database->updateUserField($_SESSION['username'],'quest','20',0); $_SESSION['qst']= 20; @@ -242,28 +242,28 @@ if (isset($qact)){ //Give Reward granary $database->modifyResource($session->villages[0],80,90,60,40,1); break; - + case '22': $database->updateUserField($_SESSION['username'],'quest','22',0); $_SESSION['qst']= 22; //Give Reward warehouse $database->modifyResource($session->villages[0],70,120,90,50,1); break; - + case '23': $database->updateUserField($_SESSION['username'],'quest','23',0); $_SESSION['qst']= 23; //Give Reward //$database->modifyResource($session->villages[0],80,90,60,40,1); break; - + case '24': $database->updateUserField($_SESSION['username'],'quest','24',0); $_SESSION['qst']= 24; //Give Reward rally point $database->modifyResource($session->villages[0],80,90,60,40,1); break; - + case '25': //$dataarray[3] = 1; $database->updateUserField($_SESSION['username'],'quest','25',0); @@ -294,11 +294,11 @@ if (isset($qact)){ $gold+=15; $database->updateUserField($_SESSION['username'],'gold',$gold,0); break; - + case 'gold': $lSubmited=$qact2; break; - + case '28': //$dataarray[6] = 1; $database->updateUserField($_SESSION['username'],'quest','28',0); @@ -306,7 +306,7 @@ if (isset($qact)){ //Give Reward $database->modifyResource($session->villages[0],80,70,60,40,1); break; - + case '29': //$dataarray[7] = 1; $database->updateUserField($_SESSION['username'],'quest','29',0); @@ -314,7 +314,7 @@ if (isset($qact)){ //Give Reward $database->modifyResource($session->villages[0],100,60,90,40,1); break; - + case '30': //$dataarray[8] = 1; $database->updateUserField($_SESSION['username'],'quest','30',0); @@ -322,7 +322,7 @@ if (isset($qact)){ //Give Reward $database->modifyResource($session->villages[0],100,140,90,50,1); break; - + case '91': $database->updateUserField($_SESSION['username'],'quest','91',0); $database->updateUserField($_SESSION['username'],'quest_time',''.(time()+$skipp_time).'',0); @@ -340,7 +340,7 @@ if (isset($qact)){ $gold+=15; $database->updateUserField($_SESSION['username'],'gold',$gold,0); break; - + case '92': $database->updateUserField($_SESSION['username'],'quest','92',0); $database->updateUserField($_SESSION['username'],'quest_time',''.(time()+$skipp_time).'',0); @@ -348,8 +348,8 @@ if (isset($qact)){ $_SESSION['qst_time'] = time()+$skipp_time; //Give Reward $database->modifyResource($session->villages[0],217,247,177,207,1); - break; - + break; + case '93': $database->updateUserField($_SESSION['username'],'quest','93',0); $database->updateUserField($_SESSION['username'],'quest_time',''.(time()+$skipp_time).'',0); @@ -357,8 +357,8 @@ if (isset($qact)){ $_SESSION['qst_time'] = time()+$skipp_time; //Give Reward $database->modifyResource($session->villages[0],217,247,177,207,1); - break; - + break; + case '94': $database->updateUserField($_SESSION['username'],'quest','94',0); $database->updateUserField($_SESSION['username'],'quest_time',''.(time()+$skipp_time).'',0); @@ -366,8 +366,8 @@ if (isset($qact)){ $_SESSION['qst_time'] = time()+$skipp_time; //Give Reward $database->modifyResource($session->villages[0],217,247,177,207,1); - break; - + break; + case '95': $database->updateUserField($_SESSION['username'],'quest','95',0); $database->updateUserField($_SESSION['username'],'quest_time',''.(time()+$skipp_time).'',0); @@ -375,8 +375,8 @@ if (isset($qact)){ $_SESSION['qst_time'] = time()+$skipp_time; //Give Reward $database->modifyResource($session->villages[0],217,247,177,207,1); - break; - + break; + case '96': $database->updateUserField($_SESSION['username'],'quest','96',0); $database->updateUserField($_SESSION['username'],'quest_time',''.(time()+$skipp_time).'',0); @@ -384,8 +384,8 @@ if (isset($qact)){ $_SESSION['qst_time'] = time()+$skipp_time; //Give Reward $database->modifyResource($session->villages[0],217,247,177,207,1); - break; - + break; + case '97': $database->updateUserField($_SESSION['username'],'quest','97',0); $database->updateUserField($_SESSION['username'],'quest_time',''.(time()).'',0); @@ -403,7 +403,7 @@ if (isset($qact)){ $gold+=20; $database->updateUserField($_SESSION['username'],'gold',$gold,0); break; - } + } } } @@ -424,14 +424,14 @@ if($session->access!=BANNED){ getResourceLevel($session->villages[0]); $woodL=$tRes['f1']+$tRes['f3']+$tRes['f14']+$tRes['f17']; //check if you are building a woodcutter to level 1 foreach($building->buildArray as $jobs) { if($jobs['type']==1){ $woodL="99"; - } + } } if ($woodL<1){?> {"markup":"\n\t\t

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

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

    <\/div>\n\t\t","number":"-1","reward":false,"qgsrc":"q_luserinfo['tribe'];?>","msrc":"","altstep":99} @@ -439,9 +439,9 @@ if ($woodL<1){?> {"markup":"\n\t\t

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


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

    <\/div>\n\t\t","number":"-1","reward":false,"qgsrc":"q_luserinfo['tribe'];?>","msrc":"","altstep":99,"ar":1} -getResourceLevel($session->villages[0]); $cropL=$tRes['f2']+$tRes['f8']+$tRes['f9']+$tRes['f12']+$tRes['f13']+$tRes['f15']; if ($cropL<1){?> @@ -450,11 +450,11 @@ if ($cropL<1){?> {"markup":"\n\t\t

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

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

    <\/div>\n\t\t","number":2,"reward":{"plus":1},"qgsrc":"q_luserinfo['tribe'];?>g","msrc":"","altstep":99} -vname; +$vName=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} @@ -477,9 +477,9 @@ if ($rRes!=$rSubmited && $rRes !== 'Multihunter'){?> {"markup":"\n\t\t

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

    <\/p>\"Lumber\"40  \"Clay\"30  \"Iron\"20  \"Crop\"30  <\/div>
    <\/a><\/span><\/div>\n\t\t","number":4,"reward":{"wood":40,"clay":30,"iron":20,"crop":30},"qgsrc":"q_luserinfo['tribe'];?>","msrc":"","altstep":99} -getResourceLevel($session->villages[0]); $ironL=$tRes['f4']+$tRes['f7']+$tRes['f10']+$tRes['f11']; $clayL=$tRes['f5']+$tRes['f6']+$tRes['f16']+$tRes['f18']; @@ -489,7 +489,7 @@ if ($ironL<1 || $clayL<1){?> {"markup":"\n\t\t

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

    <\/p>\"Lumber\"50  \"Clay\"60  \"Iron\"30  \"Crop\"30  <\/div>
    <\/a><\/span><\/div>\n\t\t

    <\/div>\n\t\t","number":5,"reward":{"wood":50,"clay":60,"iron":30,"crop":30},"qgsrc":"q_luserinfo['tribe'];?>g","msrc":"","altstep":99} - {"markup":"\n\t\t

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

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

    <\/div>\n\t\t","number":10,"reward":{"plus":2},"qgsrc":"q_luserinfo['tribe'];?>g","msrc":"","altstep":99} -getUnViewNotice($session->uid))>0) {?> @@ -568,7 +568,7 @@ if ($ironL<4 || $clayL<4 || $woodL<4 || $cropL<6){?> {"markup":"\n\t\t

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

    <\/p>\"Lumber\"75  \"Clay\"80  \"Iron\"30  \"Crop\"50  <\/div>
    <\/a><\/span><\/div>\n\t\t

    <\/div>\n\t\t","number":12,"reward":{"wood":75,"clay":80,"iron":30,"crop":50},"qgsrc":"q_luserinfo['tribe'];?>g","msrc":"","altstep":99} - {"markup":"\n\t\t

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

    <\/p>\"Lumber\"60  \"Clay\"50  \"Iron\"40  \"Crop\"30  <\/div>
    <\/a><\/span><\/div>\n\t\t

    <\/div>\n\t\t","number":15,"reward":{"wood":60,"clay":50,"iron":40,"crop":30},"qgsrc":"q_luserinfo['tribe'];?>g","msrc":"","altstep":99} - @@ -718,7 +718,7 @@ if ($ironL<4 || $clayL<4 || $woodL<4 || $cropL<6){?> {"markup":"\n\t\t

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

    <\/p>15 \"Gold\"
    <\/div>
    <\/a><\/span><\/div>\n\t\t

    <\/div>\n\t\t","number":26,"reward":{"gold":15},"qgsrc":"q_luserinfo['tribe'];?>g","msrc":"","altstep":99} - @@ -837,7 +837,7 @@ $_SESSION['qst']= 31; ?> getResourceLevel($session->villages[0]); $woodL=$tRes['f1']+$tRes['f3']+$tRes['f14']+$tRes['f17']; if ($woodL<1){?> @@ -846,9 +846,9 @@ if ($woodL<1){?> {"markup":"\n\t\t

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


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

    <\/div>\n\t\t","number":"-1","reward":false,"qgsrc":"q_luserinfo['tribe'];?>","msrc":"","altstep":99} -getResourceLevel($session->villages[0]); $cropL=$tRes['f2']+$tRes['f8']+$tRes['f9']+$tRes['f12']+$tRes['f13']+$tRes['f15']; if ($cropL<1){?> @@ -857,10 +857,10 @@ if ($cropL<1){?> {"markup":"\n\t\t

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

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

    <\/div>\n\t\t","number":2,"reward":{"plus":1},"qgsrc":"q_luserinfo['tribe'];?>g","msrc":"","altstep":99} -vname; +$vName=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} @@ -880,9 +880,9 @@ if (!isset($rSubmited) || $rRes!=$rSubmited){ ?> {"markup":"\n\t\t

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

    <\/p>\"Lumber\"40  \"Clay\"30  \"Iron\"20  \"Crop\"30  <\/div>
    <\/a><\/span><\/div>\n\t\t","number":4,"reward":{"wood":40,"clay":30,"iron":20,"crop":30},"qgsrc":"q_luserinfo['tribe'];?>","msrc":"","altstep":99} -getResourceLevel($session->villages[0]); $ironL=$tRes['f4']+$tRes['f7']+$tRes['f10']+$tRes['f11']; $clayL=$tRes['f5']+$tRes['f6']+$tRes['f16']+$tRes['f18']; @@ -892,7 +892,7 @@ if ($ironL<1 || $clayL<1){?> {"markup":"\n\t\t

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

    <\/p>\"Lumber\"50  \"Clay\"60  \"Iron\"30  \"Crop\"30  <\/div>
    <\/a><\/span><\/div>\n\t\t

    <\/div>\n\t\t","number":5,"reward":{"wood":50,"clay":60,"iron":30,"crop":30},"qgsrc":"q_luserinfo['tribe'];?>g","msrc":"","altstep":99} -unread || $RB==true){?> @@ -918,7 +918,7 @@ if (!isset($x) || !isset($y) || $x!=$ncoor['x'] || $y!=$ncoor['y']){?> ?> {"markup":"\n\t\t

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

    <\/div>
    \"Crop\"200 \" \/>

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

    <\/div>\n\t\t","number":-8,"reward":false,"qgsrc":"q_luserinfo['tribe'];?>","msrc":"","altstep":99} -getUnViewNotice($session->uid))>0) {?> {"markup":"\n\t\t

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

    <\/p>\"Lumber\"75  \"Clay\"140  \"Iron\"40  \"Crop\"40  <\/div>
    <\/a><\/span><\/div>\n\t\t

    <\/div>\n\t\t","number":11,"reward":{"wood":75,"clay":140,"iron":40,"crop":40},"qgsrc":"q_luserinfo['tribe'];?>g","msrc":"","altstep":99} - {"markup":"\n\t\t

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

    <\/p>15 Gold
    <\/div>
    <\/a><\/span><\/div>\n\t\t

    <\/div>\n\t\t","number":26,"reward":{"gold":15},"qgsrc":"q_luserinfo['tribe'];?>g","msrc":"","altstep":99} - From 2d824220e5d13f673075b7a0bea1de5d75d8b93e Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sun, 26 Nov 2017 14:59:23 +0100 Subject: [PATCH 060/126] fix: Admin WW image incorrect #365 --- Admin/Templates/editVillage.tpl | 16 ++++++++++++++++ Admin/Templates/village.tpl | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/Admin/Templates/editVillage.tpl b/Admin/Templates/editVillage.tpl index 67adb7ee..768d3964 100644 --- a/Admin/Templates/editVillage.tpl +++ b/Admin/Templates/editVillage.tpl @@ -171,6 +171,22 @@ if(isset($id)) { echo ""; } + + $resourcearray = $database->getResourceLevel($village['wref']); + if($resourcearray['f99t'] == 40) { + if($resourcearray['f99'] >= 0 && $resourcearray['f99'] <= 19) { + echo 'Worldwonder'; } + if($resourcearray['f99'] >= 20 && $resourcearray['f99'] <= 39) { + echo 'Worldwonder'; } + if($resourcearray['f99'] >= 40 && $resourcearray['f99'] <= 59) { + echo 'Worldwonder'; } + if($resourcearray['f99'] >= 60 && $resourcearray['f99'] <= 79) { + echo 'Worldwonder'; } + if($resourcearray['f99'] >= 80 && $resourcearray['f99'] <= 99) { + echo 'Worldwonder'; } + if($resourcearray['f99'] == 100) { + echo 'Worldwonder'; } + } ?>
    "; } + ?>
    @@ -337,6 +338,23 @@ if(isset($id)) { echo ""; } + + $resourcearray = $database->getResourceLevel($village['wref']); + if($resourcearray['f99t'] == 40) { + if($resourcearray['f99'] >= 0 && $resourcearray['f99'] <= 19) { + echo 'Worldwonder'; } + if($resourcearray['f99'] >= 20 && $resourcearray['f99'] <= 39) { + echo 'Worldwonder'; } + if($resourcearray['f99'] >= 40 && $resourcearray['f99'] <= 59) { + echo 'Worldwonder'; } + if($resourcearray['f99'] >= 60 && $resourcearray['f99'] <= 79) { + echo 'Worldwonder'; } + if($resourcearray['f99'] >= 80 && $resourcearray['f99'] <= 99) { + echo 'Worldwonder'; } + if($resourcearray['f99'] == 100) { + echo 'Worldwonder'; } + } + ?>
    Date: Sun, 26 Nov 2017 15:17:21 +0100 Subject: [PATCH 061/126] fix: unable to build with master --- GameEngine/Building.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GameEngine/Building.php b/GameEngine/Building.php index 9864dc8a..8ddcdad4 100755 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -176,8 +176,8 @@ class Building { // let's see if we should allow building what we want where we want to // (prevent building resource fields in the village ( - ($page == 'dorf1.php' && $id >= 1 && $id <= 4) || - ($page == 'dorf2.php' && $id > 4) + ($page == 'dorf1.php' && $tid >= 1 && $tid <= 4) || + ($page == 'dorf2.php' && $tid > 4) ) && // check that we're not trying to change a standing building type ( @@ -185,7 +185,7 @@ class Building { $levels['f'.$tid.'t'] == 0 ) ) { - if ( $this->checkResource( $id, $tid ) != 4 ) { + if ( !isset($_GET['master']) && $this->checkResource( $tid, $id ) != 4 ) { if ( $tid >= 19 ) { header( "Location: dorf2.php" ); exit; From 3ccdbec06daa0c55e69c0eca66b9cc651bab0a18 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sun, 26 Nov 2017 15:25:36 +0100 Subject: [PATCH 062/126] fix: invalid next level info with Master builder the only item in queue #257 --- Templates/Build/upgrade.tpl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Templates/Build/upgrade.tpl b/Templates/Build/upgrade.tpl index 820ccd90..5a1e963c 100644 --- a/Templates/Build/upgrade.tpl +++ b/Templates/Build/upgrade.tpl @@ -11,11 +11,18 @@ if($bindicate == 1) { $loopsame = ($building->isCurrent($id) || $building->isLoop($id))?1:0; $doublebuild = ($building->isCurrent($id) && $building->isLoop($id))?1:0; $master = count($database->getMasterJobsByField($village->wid,$id)); + + // master and loopsame would have duplicated level display, + // so we need to decrease loopsame if master is the only job left + if ($master == 1 && $loopsame == 1) { + $loopsame = 0; + } + $uprequire = $building->resourceRequired($id,$village->resarray['f'.$id.'t'],1+$loopsame+$doublebuild+$master); $mastertime = $uprequire['time']; ?>

    resarray['f'.$id]+1+$loopsame+$doublebuild+$master; ?>:
    -Lumber | Clay | Iron | Crop | Crop consumption | durationgetTimeFormat($uprequire['time']); +Lumber | Clay | Iron | Crop | Crop consumption | durationgetTimeFormat($uprequire['time']); if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1) { echo "|
    \"NPC"; } ?>
    From ef416cd5489c473c118575145bec8f21cdba3f5d Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sun, 26 Nov 2017 16:00:55 +0100 Subject: [PATCH 063/126] fix: horse drinking trough forgives upkeep for all horse units #105 --- GameEngine/Technology.php | 40 ++++++--------------------------------- 1 file changed, 6 insertions(+), 34 deletions(-) diff --git a/GameEngine/Technology.php b/GameEngine/Technology.php index 0820131e..223cc101 100755 --- a/GameEngine/Technology.php +++ b/GameEngine/Technology.php @@ -499,26 +499,12 @@ class Technology { || ( $i == 5 && $buildarray[ 'f' . $horsedrinking ] >= 15 ) || ( $i == 6 && $buildarray[ 'f' . $horsedrinking ] == 20 ) ) { - $upkeepDecrement = 0; - switch ( $i ) { - case 4: - $upkeepDecrement = 2; - break; - - case 5: - $upkeepDecrement = 3; - break; - - case 6: - $upkeepDecrement = 4; - break; - } - $upkeep += ( $dataarray['pop'] - $upkeepDecrement ) * $array[ $unit ]; + $upkeep += (( $dataarray['pop'] - 1 ) * $array[ $unit ]); } else { - $upkeep += $dataarray['pop'] * $array[ $unit ]; + $upkeep += ($dataarray['pop'] * $array[ $unit ]); } } else { - $upkeep += $dataarray['pop'] * $array[ $unit ]; + $upkeep += ($dataarray['pop'] * $array[ $unit ]); } } else { if ( isset( $horsedrinking ) ) { @@ -526,26 +512,12 @@ class Technology { || ( $i == 5 && $buildarray[ 'f' . $horsedrinking ] >= 15 ) || ( $i == 6 && $buildarray[ 'f' . $horsedrinking ] == 20 ) ) { - $upkeepDecrement = 0; - switch ( $i ) { - case 4: - $upkeepDecrement = 2; - break; - - case 5: - $upkeepDecrement = 3; - break; - - case 6: - $upkeepDecrement = 4; - break; - } - $upkeep += ( $dataarray['pop'] - $upkeepDecrement ) * $array[ $unit2 ]; + $upkeep += (( $dataarray['pop'] - 1 ) * $array[ $unit2 ]); } else { - $upkeep += $dataarray['pop'] * $array[ $unit2 ]; + $upkeep += ($dataarray['pop'] * $array[ $unit2 ]); } } else { - $upkeep += $dataarray['pop'] * $array[ $unit2 ]; + $upkeep += ($dataarray['pop'] * $array[ $unit2 ]); } } } From d3b51a34ec725e6e450de4a11db92aeb5d10eddd Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sun, 26 Nov 2017 16:55:37 +0100 Subject: [PATCH 064/126] fix: disallow Natars user registration #382 --- GameEngine/Account.php | 3 +++ install/include/accounts.php | 6 ++++++ install/templates/accounts.tpl | 12 ++++++++---- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/GameEngine/Account.php b/GameEngine/Account.php index 85a09ebd..e498ee17 100755 --- a/GameEngine/Account.php +++ b/GameEngine/Account.php @@ -75,6 +75,9 @@ class Account { else if(USRNM_SPECIAL && preg_match("/[:,\\. \\n\\r\\t\\s\\<\\>]+/", $_POST['name'])) { $form->addError("name",USRNM_CHAR); } + else if(strtolower($_POST['name']) == 'natars') { + $form->addError("name",USRNM_TAKEN); + } else if(User::exists($database,$_POST['name'])) { $form->addError("name",USRNM_TAKEN); } diff --git a/install/include/accounts.php b/install/include/accounts.php index 4cc36e58..cba5e7fa 100644 --- a/install/include/accounts.php +++ b/install/include/accounts.php @@ -5,6 +5,12 @@ exit; } + // don't allow creating Natars user + if (!empty($_POST['aname']) && strtolower($_POST['aname']) == 'natars') { + header("Location: ../index.php?s=4&err=2"); + exit; + } + // don't let SQL time out when 30-500 seconds (depending on php.ini) is not enough @set_time_limit(0); diff --git a/install/templates/accounts.tpl b/install/templates/accounts.tpl index 1494c322..ca4e99e7 100644 --- a/install/templates/accounts.tpl +++ b/install/templates/accounts.tpl @@ -3,15 +3,15 @@ ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## ## --------------------------------------------------------------------------- ## ## Project: TravianZ ## -## Version: 22.06.2015 ## +## Version: 22.06.2015 ## ## Filename multihunter.tpl ## -## Developed by: Mr.php , Advocaite , brainiacX , yi12345 , Shadow , ronix ## +## Developed by: Mr.php , Advocaite , brainiacX , yi12345 , Shadow , ronix ## ## Fixed by: Shadow - STARVATION , HERO FIXED COMPL. ## ## Fixed by: InCube - double troops ## ## License: TravianZ Project ## ## Copyright: TravianZ (c) 2010-2015. All rights reserved. ## ## URLs: http://travian.shadowss.ro ## -## Source code: https://github.com/Shadowss/TravianZ ## +## Source code: https://github.com/Shadowss/TravianZ ## ## ## ################################################################################# @@ -19,6 +19,10 @@ if(isset($_GET['err']) && $_GET['err'] == 1) { echo "



    At least MultiHunter & Support password are required in this form.


    "; } +if(isset($_GET['err']) && $_GET['err'] == 2) { + echo "


    Natars is a reserved username for an in-game NPC tribe. Please choose a different admin username.


    "; +} + ?> @@ -60,7 +64,7 @@ if(isset($_GET['err']) && $_GET['err'] == 1) { Admin tribe: From cb148b9aec68a17da373affeffa6ec775c97828e Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sun, 26 Nov 2017 17:33:10 +0100 Subject: [PATCH 065/126] fix: sorting in messages and reports does not work #327 --- GameEngine/Database.php | 21 +++++++++++---------- Templates/Message/inbox.tpl | 10 +++++----- Templates/Message/sent.tpl | 8 ++++---- Templates/Notice/all.tpl | 8 ++++---- 4 files changed, 24 insertions(+), 23 deletions(-) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index c42eb5a9..d504c4a8 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -4125,10 +4125,10 @@ References: User ID/Message ID, Mode global $session; switch($mode) { case 1: - $q = "SELECT * FROM " . TB_PREFIX . "mdata WHERE target IN($id) and send = 0 and archived = 0 ORDER BY time DESC"; + $q = "SELECT * FROM " . TB_PREFIX . "mdata WHERE target IN($id) and send = 0 and archived = 0 ORDER BY time ".(isset($_GET['o']) && $_GET['o'] == 1 ? 'ASC' : 'DESC'); break; case 2: - $q = "SELECT * FROM " . TB_PREFIX . "mdata WHERE owner IN($id) ORDER BY time DESC"; + $q = "SELECT * FROM " . TB_PREFIX . "mdata WHERE owner IN($id) ORDER BY time ".(isset($_GET['o']) && $_GET['o'] == 1 ? 'ASC' : 'DESC'); break; case 3: $q = "SELECT * FROM " . TB_PREFIX . "mdata where id = $id"; @@ -4140,7 +4140,7 @@ References: User ID/Message ID, Mode $q = "UPDATE " . TB_PREFIX . "mdata set deltarget = 1,viewed = 1 where id IN(".implode(', ', $id).")"; break; case 6: - $q = "SELECT * FROM " . TB_PREFIX . "mdata where target IN($id) and send = 0 and archived = 1"; + $q = "SELECT * FROM " . TB_PREFIX . "mdata where target IN($id) and send = 0 and archived = 1 ORDER BY time ".(isset($_GET['o']) && $_GET['o'] == 1 ? 'ASC' : 'DESC'); break; case 7: $q = "UPDATE " . TB_PREFIX . "mdata set delowner = 1 where id IN(".implode(', ', $id).")"; @@ -4149,15 +4149,16 @@ References: User ID/Message ID, Mode $q = "UPDATE " . TB_PREFIX . "mdata set deltarget = 1,delowner = 1,viewed = 1 where IN(".implode(', ', $id).")"; break; case 9: - $q = "SELECT * FROM " . TB_PREFIX . "mdata WHERE target IN($id) and send = 0 and archived = 0 and deltarget = 0 ORDER BY time DESC"; + $q = "SELECT * FROM " . TB_PREFIX . "mdata WHERE target IN($id) and send = 0 and archived = 0 and deltarget = 0 ORDER BY time ".(isset($_GET['o']) && $_GET['o'] == 1 ? 'ASC' : 'DESC'); break; case 10: - $q = "SELECT * FROM " . TB_PREFIX . "mdata WHERE owner IN($id) and delowner = 0 ORDER BY time DESC"; + $q = "SELECT * FROM " . TB_PREFIX . "mdata WHERE owner IN($id) and delowner = 0 ORDER BY time ".(isset($_GET['o']) && $_GET['o'] == 1 ? 'ASC' : 'DESC'); break; case 11: - $q = "SELECT * FROM " . TB_PREFIX . "mdata where target IN($id) and send = 0 and archived = 1 and deltarget = 0"; + $q = "SELECT * FROM " . TB_PREFIX . "mdata where target IN($id) and send = 0 and archived = 1 and deltarget = 0 ORDER BY time ".(isset($_GET['o']) && $_GET['o'] == 1 ? 'ASC' : 'DESC'); break; } + if($mode <= 3 || $mode == 6 || $mode > 8) { $result = mysqli_query($this->dblink,$q); return $this->mysqli_fetch_all($result); @@ -4226,7 +4227,7 @@ References: User ID/Message ID, Mode function getNotice($uid) { list($uid) = $this->escape_input((int) $uid); - $q = "SELECT * FROM " . TB_PREFIX . "ndata where uid = $uid and del = 0 ORDER BY time DESC"; + $q = "SELECT * FROM " . TB_PREFIX . "ndata where uid = $uid and del = 0 ORDER BY time ".(isset($_GET['o']) && $_GET['o'] == 1 ? 'ASC' : 'DESC'); $result = mysqli_query($this->dblink,$q); return $this->mysqli_fetch_all($result); } @@ -4240,7 +4241,7 @@ References: User ID/Message ID, Mode return $cachedValue[$field]; } - $q = "SELECT * FROM " . TB_PREFIX . "ndata where `id` = $id ORDER BY time DESC LIMIT 1"; + $q = "SELECT * FROM " . TB_PREFIX . "ndata where `id` = $id ORDER BY time ".(isset($_GET['o']) && $_GET['o'] == 1 ? 'ASC' : 'DESC')." LIMIT 1"; $result = mysqli_query($this->dblink,$q); $dbarray = mysqli_fetch_array($result); @@ -4257,7 +4258,7 @@ References: User ID/Message ID, Mode return $cachedValue; } - $q = "SELECT * FROM " . TB_PREFIX . "ndata where uid = $uid ORDER BY time DESC"; + $q = "SELECT * FROM " . TB_PREFIX . "ndata where uid = $uid ORDER BY time ".(isset($_GET['o']) && $_GET['o'] == 1 ? 'ASC' : 'DESC'); $result = mysqli_query($this->dblink,$q); $noticesCacheByUId[$uid] = $this->mysqli_fetch_all($result); @@ -4271,7 +4272,7 @@ References: User ID/Message ID, Mode function getUnViewNotice($uid) { list($uid) = $this->escape_input((int) $uid); - $q = "SELECT * FROM " . TB_PREFIX . "ndata where uid = $uid AND viewed=0"; + $q = "SELECT * FROM " . TB_PREFIX . "ndata where uid = $uid AND viewed=0 ORDER BY time ".(isset($_GET['o']) && $_GET['o'] == 1 ? 'ASC' : 'DESC'); $result = mysqli_query($this->dblink,$q); return $this->mysqli_fetch_all($result); } diff --git a/Templates/Message/inbox.tpl b/Templates/Message/inbox.tpl index 69e2e0fd..48d0e44d 100644 --- a/Templates/Message/inbox.tpl +++ b/Templates/Message/inbox.tpl @@ -8,7 +8,7 @@ Subject Sender - Sent +
    Sent uid."'") or die(mysqli_error($database->dblink)); @@ -28,17 +28,17 @@ echo "«»"; } else if (!isset($_GET['s']) && count($message->inbox1) > 10) { - echo "«»"; + echo "«»"; } else if(isset($_GET['s']) && count($message->inbox1) > $_GET['s']) { if(count($message->inbox1) > ($_GET['s']+10) && $_GET['s']-10 < count($message->inbox1) && $_GET['s'] != 0) { - echo "
    «»"; + echo "«»"; } else if(count($message->inbox1) > $_GET['s']+10) { - echo "«»"; + echo "«»"; } else { - echo "«»"; + echo "
    «»"; } } ?> diff --git a/Templates/Message/sent.tpl b/Templates/Message/sent.tpl index f0b0df7e..b917305e 100644 --- a/Templates/Message/sent.tpl +++ b/Templates/Message/sent.tpl @@ -34,17 +34,17 @@ echo "«»"; } else if (!isset($_GET['s']) && count($message->sent1) > 10) { - echo "«»"; + echo "«»"; } else if(isset($_GET['s']) && count($message->sent1) > $_GET['s']) { if(count($message->sent1) > ($_GET['s']+10) && $_GET['s']-10 < count($message->sent1) && $_GET['s'] != 0) { - echo "«»"; + echo "«»"; } else if(count($message->sent1) > $_GET['s']+10) { - echo "«»"; + echo "«»"; } else { - echo "«»"; + echo "
    «»"; } } ?> diff --git a/Templates/Notice/all.tpl b/Templates/Notice/all.tpl index 761c8054..4baa7021 100644 --- a/Templates/Notice/all.tpl +++ b/Templates/Notice/all.tpl @@ -35,17 +35,17 @@ $noticeClass = array("Scout Report","Won as attacker without losses","Won as att echo "«»"; } else if (!isset($_GET['s']) && count($message->noticearray) > 10) { - echo "«»"; + echo "«»"; } else if(isset($_GET['s']) && count($message->noticearray) > $_GET['s']) { if(count($message->noticearray) > ($_GET['s']+10) && $_GET['s']-10 < count($message->noticearray) && $_GET['s'] != 0) { - echo "«»"; + echo "«»"; } else if(count($message->noticearray) > $_GET['s']+10) { - echo "«»"; + echo "«»"; } else { - echo "«»"; + echo "«»"; } } ?> From d247e5fa2798c0cb1756b6da4b2f1126218e528c Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sun, 26 Nov 2017 17:52:21 +0100 Subject: [PATCH 066/126] chore: version change and some forgotten files :P --- README.md | 2 +- Templates/Message/inbox.tpl | 10 +++++----- Templates/footer.tpl | 2 +- src/Utils/Math.php | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 1bb0d3aa..7f3355e0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Code Triagers Badge](https://www.codetriage.com/shadowss/travianz/badges/users.svg)](https://www.codetriage.com/shadowss/travianz) [![Join the chat at https://gitter.im/TravianZ-V8/Lobby](https://badges.gitter.im/TravianZ-V8/Lobby.svg)](https://gitter.im/TravianZ-V8/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -TravianZ Version v.8.3.3 BETA b2 +TravianZ Version v.8.3.3 BETA b3 Download and updates : https://github.com/Shadowss/TravianZ diff --git a/Templates/Message/inbox.tpl b/Templates/Message/inbox.tpl index 48d0e44d..9dfa2a7b 100644 --- a/Templates/Message/inbox.tpl +++ b/Templates/Message/inbox.tpl @@ -8,7 +8,7 @@ Subject Sender -
    Sent + Sent uid."'") or die(mysqli_error($database->dblink)); @@ -28,17 +28,17 @@ echo "«»"; } else if (!isset($_GET['s']) && count($message->inbox1) > 10) { - echo "«»"; + echo "«»"; } else if(isset($_GET['s']) && count($message->inbox1) > $_GET['s']) { if(count($message->inbox1) > ($_GET['s']+10) && $_GET['s']-10 < count($message->inbox1) && $_GET['s'] != 0) { - echo "«»"; + echo "«»"; } else if(count($message->inbox1) > $_GET['s']+10) { - echo "«»"; + echo "«»"; } else { - echo "«»"; + echo "«»"; } } ?> diff --git a/Templates/footer.tpl b/Templates/footer.tpl index 9b048ae6..46cf3349 100644 --- a/Templates/footer.tpl +++ b/Templates/footer.tpl @@ -22,7 +22,7 @@ diff --git a/src/Utils/Math.php b/src/Utils/Math.php index 8310fb34..33f127cf 100644 --- a/src/Utils/Math.php +++ b/src/Utils/Math.php @@ -15,18 +15,18 @@ namespace App\Utils; /** - * + * * Mathematics-related helpers. - * + * * @author martinambrus * */ class Math { - + public static function isInt($val) { return (is_numeric($val) && intval($val) === $val); } - + public static function isFloat($val) { return (is_numeric($val) && floatval($val) === $val); } From cb60226297c0e01b36afac3da85de9caca92a18a Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sun, 26 Nov 2017 19:02:43 +0100 Subject: [PATCH 067/126] fix: cannot build fields and buildings #383 --- GameEngine/Building.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GameEngine/Building.php b/GameEngine/Building.php index 8ddcdad4..da5ac596 100755 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -176,8 +176,8 @@ class Building { // let's see if we should allow building what we want where we want to // (prevent building resource fields in the village ( - ($page == 'dorf1.php' && $tid >= 1 && $tid <= 4) || - ($page == 'dorf2.php' && $tid > 4) + ($page == 'dorf1.php' && $id >= 1 && $id <= 4) || + ($page == 'dorf2.php' && $id > 4) ) && // check that we're not trying to change a standing building type ( @@ -185,7 +185,7 @@ class Building { $levels['f'.$tid.'t'] == 0 ) ) { - if ( !isset($_GET['master']) && $this->checkResource( $tid, $id ) != 4 ) { + if ( !isset($_GET['master']) && $this->checkResource( $id, $tid ) != 4 ) { if ( $tid >= 19 ) { header( "Location: dorf2.php" ); exit; From 89e14abd5e0a863d15ef3b5e6e71f359e267018b Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sun, 26 Nov 2017 21:20:46 +0100 Subject: [PATCH 068/126] fix: warnings and errors when creating Natars #384 --- GameEngine/Database.php | 4 ++-- Templates/res.tpl | 36 ++++++++++++++++++--------------- Templates/text.tpl | 44 +++++++++++++++++++++-------------------- 3 files changed, 45 insertions(+), 39 deletions(-) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index d504c4a8..00fcba54 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -1678,7 +1678,7 @@ class MYSQLi_DB implements IDbConnection { } break; - case 3: if ($value['owner'] == $vid && $value['capital'] == 1) { + case 3: if ((isset($value['owner']) && isset($value['capital'])) && $value['owner'] == $vid && $value['capital'] == 1) { return $value; } break; @@ -1724,7 +1724,7 @@ class MYSQLi_DB implements IDbConnection { // by owner ID and capital = 1 case 3: $vid = (int) $vid; - $q = "SELECT * FROM " . TB_PREFIX . "vdata WHERE owner = $vid capital = 1 LIMIT 1"; + $q = "SELECT * FROM " . TB_PREFIX . "vdata WHERE owner = $vid AND capital = 1 LIMIT 1"; break; // by owner = Taskmaster diff --git a/Templates/res.tpl b/Templates/res.tpl index c256560b..fb5d3a98 100644 --- a/Templates/res.tpl +++ b/Templates/res.tpl @@ -1,4 +1,4 @@ - getProd("wood")); -$clay = round($village->getProd("clay")); -$iron = round($village->getProd("iron")); -$crop = round($village->getProd("crop")); -$totalproduction = $village->allcrop; // all crops + bakery + grain mill -?> +// Natars cration script does not have village initialized +if (!empty($village)) { + $wood = round( $village->getProd( "wood" ) ); + $clay = round( $village->getProd( "clay" ) ); + $iron = round( $village->getProd( "iron" ) ); + $crop = round( $village->getProd( "crop" ) ); + $totalproduction = $village->allcrop; // all crops + bakery + grain mill +?>
    @@ -36,18 +38,18 @@ $totalproduction = $village->allcrop; // all crops + bakery + grain mill maxcrop; ?> <?php echo CROP_COM; ?> - pop+$technology->getUpkeep($village->unitall,0))."/".$totalproduction.""; ?> + pop+$technology->getUpkeep($village->unitall,0))."/".$totalproduction.""; ?> - + - + - - - - - + + + +
                                                                                            gold <= 1){ echo 'Remaining gold '.$session->gold.' Gold'; } @@ -56,11 +58,13 @@ $totalproduction = $village->allcrop; // all crops + bakery + grain mill } ?>
    -
    \ No newline at end of file +
    +', $txt); From 4b52df7482e30b6a5b354785b534825993860b37 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sun, 26 Nov 2017 21:30:59 +0100 Subject: [PATCH 069/126] fix: messages and reports sorting fix number 2 #327 --- Templates/Message/inbox.tpl | 2 +- Templates/Notice/all.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Templates/Message/inbox.tpl b/Templates/Message/inbox.tpl index 9dfa2a7b..3822104d 100644 --- a/Templates/Message/inbox.tpl +++ b/Templates/Message/inbox.tpl @@ -8,7 +8,7 @@ Subject Sender - Sent + Sent uid."'") or die(mysqli_error($database->dblink)); diff --git a/Templates/Notice/all.tpl b/Templates/Notice/all.tpl index 4baa7021..5cbb538d 100644 --- a/Templates/Notice/all.tpl +++ b/Templates/Notice/all.tpl @@ -8,7 +8,7 @@ $noticeClass = array("Scout Report","Won as attacker without losses","Won as att Subject: -Sent +Sent Date: Sun, 26 Nov 2017 21:41:15 +0100 Subject: [PATCH 070/126] fix: oasis can be conquered with animals in it #385 --- GameEngine/Database.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 00fcba54..eb46c265 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -1446,7 +1446,7 @@ class MYSQLi_DB implements IDbConnection { $o_unit = $this->getUnit($vref, $use_cache); for ( $i = 1; $i < 51; $i ++ ) { - $troops_o += $o_unit[ $i ]; + $troops_o += $o_unit[ 'u'.$i ]; } $troops_o += $o_unit['hero']; @@ -1461,7 +1461,7 @@ class MYSQLi_DB implements IDbConnection { } self::$oasisTroopsCountCache[$vref] = $troops_o; - return self::$oasisTroopsCountCache[$vref]; + return self::$oasisTroopsCountCache[$vref]; } public function canConquerOasis($vref, $wref, $use_cache = true) { From 70b3dc165bc36091f32a69f543ed476a11611431 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sun, 26 Nov 2017 22:08:47 +0100 Subject: [PATCH 071/126] fix: missing bracket --- Templates/res.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Templates/res.tpl b/Templates/res.tpl index fb5d3a98..61c0759a 100644 --- a/Templates/res.tpl +++ b/Templates/res.tpl @@ -38,7 +38,7 @@ if (!empty($village)) { maxcrop; ?> <?php echo CROP_COM; ?> - pop+$technology->getUpkeep($village->unitall,0))."/".$totalproduction.""; ?> + pop+$technology->getUpkeep($village->unitall,0))."/".$totalproduction.""; ?> From 3c13f3597b66ccc63db60e766c9961c9bc1c89a5 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sun, 26 Nov 2017 22:37:50 +0100 Subject: [PATCH 072/126] fix: admin oasis data not showing correct resource values --- Admin/Templates/village.tpl | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Admin/Templates/village.tpl b/Admin/Templates/village.tpl index 78a830ce..611cb944 100644 --- a/Admin/Templates/village.tpl +++ b/Admin/Templates/village.tpl @@ -39,21 +39,21 @@ if(isset($id)) $result = $database->query_return($q); if(count($result) >0) { - foreach($result as $row) + foreach($result as &$row) { $type = $row['type']; - if($type==1) { $type = ' + 25%'; $wood+=1;} - elseif($type==2) { $type = ' + 25%'; $wood+=1;} - elseif($type==3) { $type = ' + 25%
    + 25%'; $wood+=1; $crop+=1;} - elseif($type==4) { $type = ' + 25%'; $clay+=1;} - elseif($type==5) { $type = ' + 25%'; $clay+=1;} - elseif($type==6) { $type = ' + 25%
    + 25%'; $clay+=1;$crop+=1;} - elseif($type==7) { $type = ' + 25%'; $iron+=1;} - elseif($type==8) { $type = ' + 25%'; $iron+=1;} - elseif($type==9) { $type = ' + 25%
    + 25%'; $iron+=1; $crop+=1;} - elseif($type==10){ $type = ' + 25%'; $crop+=1;} - elseif($type==11){ $type = ' + 25%'; $crop+=1;} - elseif($type==12){ $type = ' + 50%'; $crop+=2;} + if($type==1) { $row['type'] = ' + 25%'; $wood+=1;} + elseif($type==2) { $row['type'] = ' + 25%'; $wood+=1;} + elseif($type==3) { $row['type'] = ' + 25%
    + 25%'; $wood+=1; $crop+=1;} + elseif($type==4) { $row['type'] = ' + 25%'; $clay+=1;} + elseif($type==5) { $row['type'] = ' + 25%'; $clay+=1;} + elseif($type==6) { $row['type'] = ' + 25%
    + 25%'; $clay+=1;$crop+=1;} + elseif($type==7) { $row['type'] = ' + 25%'; $iron+=1;} + elseif($type==8) { $row['type'] = ' + 25%'; $iron+=1;} + elseif($type==9) { $row['type'] = ' + 25%
    + 25%'; $iron+=1; $crop+=1;} + elseif($type==10){ $row['type'] = ' + 25%'; $crop+=1;} + elseif($type==11){ $row['type'] = ' + 25%'; $crop+=1;} + elseif($type==12){ $row['type'] = ' + 50%'; $crop+=2;} } } $ocounter = array($wood,$clay,$iron,$crop); @@ -247,7 +247,7 @@ if(isset($id))
    - + "; } } From 1d4f98087166f6273f06ccbcbb4b6fb396f393ab Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sun, 26 Nov 2017 22:42:44 +0100 Subject: [PATCH 073/126] fix: back arrow redirects to invalid page with < 10 records #327 --- Templates/Message/archive.tpl | 8 ++++---- Templates/Message/inbox.tpl | 4 ++-- Templates/Message/sent.tpl | 2 +- Templates/Notice/all.tpl | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Templates/Message/archive.tpl b/Templates/Message/archive.tpl index 2c28d2b6..3f9406b1 100644 --- a/Templates/Message/archive.tpl +++ b/Templates/Message/archive.tpl @@ -16,10 +16,10 @@ include("menu.tpl"); diff --git a/Templates/Message/inbox.tpl b/Templates/Message/inbox.tpl index 3822104d..f8dc6f4b 100644 --- a/Templates/Message/inbox.tpl +++ b/Templates/Message/inbox.tpl @@ -37,8 +37,8 @@ else if(count($message->inbox1) > $_GET['s']+10) { echo "«»"; } - else { - echo "«»"; + else if(count($message->inbox1) > 10) { + echo "«»"; } } ?> diff --git a/Templates/Message/sent.tpl b/Templates/Message/sent.tpl index b917305e..35869e63 100644 --- a/Templates/Message/sent.tpl +++ b/Templates/Message/sent.tpl @@ -43,7 +43,7 @@ else if(count($message->sent1) > $_GET['s']+10) { echo "«»"; } - else { + else if (count($message->sent1) > 10) { echo "«»"; } } diff --git a/Templates/Notice/all.tpl b/Templates/Notice/all.tpl index 5cbb538d..4dacb26c 100644 --- a/Templates/Notice/all.tpl +++ b/Templates/Notice/all.tpl @@ -44,7 +44,7 @@ $noticeClass = array("Scout Report","Won as attacker without losses","Won as att else if(count($message->noticearray) > $_GET['s']+10) { echo "«»"; } - else { + else if (count($message->noticearray) > 10) { echo "«»"; } } From cd00d5488a444b29fc4f1135801376e1f2d74ce5 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Mon, 27 Nov 2017 10:28:44 +0100 Subject: [PATCH 074/126] chore: new README --- README-old.md | 224 ++++++++++++++++++++++++++++++++++++++++++++ README.md | 253 ++++++++------------------------------------------ 2 files changed, 264 insertions(+), 213 deletions(-) create mode 100644 README-old.md diff --git a/README-old.md b/README-old.md new file mode 100644 index 00000000..7f3355e0 --- /dev/null +++ b/README-old.md @@ -0,0 +1,224 @@ +[![Code Triagers Badge](https://www.codetriage.com/shadowss/travianz/badges/users.svg)](https://www.codetriage.com/shadowss/travianz) [![Join the chat at https://gitter.im/TravianZ-V8/Lobby](https://badges.gitter.im/TravianZ-V8/Lobby.svg)](https://gitter.im/TravianZ-V8/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) + +TravianZ Version v.8.3.3 BETA b3 + +Download and updates : https://github.com/Shadowss/TravianZ + +Thank you to : Shadowss , advocaite , brainiacX , MisterX , yi12345 , ronix , Elio , martinambrus and many others that make that version posible. + +First i want to say THANKS for all who worked on that version , will find a list on Version file. + +TravianZ is based on TravianX v6.0.0 or TravianZ or TravianX with some grapich changes from ZravianX. + + +martinambrus changes: +1. PHP7 compatibility (mysql functions converted to mysqli) +2. a lot of database optimizations (not in code but in MySQL tables themselves, mostly adding indexes to speed things up) +3. fix for a nasty JavaScript bug which was killing the browser with any number of countdown(s) running on page (even one!) +4. large map not centered fix +5. WW Buildings have no aliance (PHP warning removed) +6. password in Admin area for deletion of user is now really a password field +7. Multihunter couldn't progress beyond Quest level 4 +8. PLUS settings (including PayPal options) can be configured in Admin +9. installation timeouting fix +10. extra settings in admin save config correctly +11. security tightened to try and prevent MySQL injections from in-game +12. assigning link to alliance forum now works +13. alliance description now really editable +14. Admin SQL injection fixes +15. fix for map not showing natar villages +16. weak MD5 password in database converted into strong bcrypt ones +17. newsbox 1 best player can also show admin if they are enabled in config +18. Natar random attacks show attacker as ?? as intended now +19. System Message can contain quotes and no longer inserts BOM characters at the beginning +20. front-end + Admin page titles now correctly reflect where we really are (so browsing history can be navigated easily instead of showing Travian on every page) +21. Return to Server link in Admin works fine if homepage in config does not end with a slash +22. Great Workshop no longer shows as "Error" in Admin when editing Village +23. Great Workshop added to manual pages +24. new Combat Simulator link when showing details of oasis for quicker determination if we can win that fight +25. Support, Taskmaster & Multihunter no longer shown in statistics as last players with 0 villages +26. invalid `
    ` tags no longer added to description textboxes when editing User in Admin +27. editing additional user data in Admin now saves them when Enter is used instead of clicking on "Save" as well +28. fixed reports pagination always staying on "All" tab +29. fix for the "fixed" :) self-kicking from an alliance +30. fixed sending messages to player via Admin +31. Support user is now a part of the installation and can be logged into Admin and in-game (albeit in game, they have no village, so can not access fields or village views) +32. messages sent to Multihunter now have the correct recepient shown next to them (was empty) +33. new links in Admin to access in-game messages + Mass Message & System Message dialogs +34. mass messages sent out under Support rather than Multihunter (we should not be scaring people :D) +35. fixed displaying of current Quest in Admin +36. fixed OK message in Admin when resetting All Players' PLUS +37. new config option to show Support messages in Admin's mailbox +38. new feature: allowing messages to be sent as Support from in-game when user is Admin + it's allowed in config +39. not allowing installation if old data are still in database to prevent multiple worlds generation and game misbehavior +40. fixed quest 1 to reload the page and allow for immediate completion of the woodcutter +41. NPC links added to units in Hero Mansion +42. fixed random attacks attacker tribe (Natars) when building Wonder of the World +43. players who post in an Alliance forum are now notified of each subsequent post in that topic via messages +44. editing troops in Admin now saves them when Enter is used instead of clicking on "Save" as well +45. added option into Admin config to allow Administrative accounts to be raided and attacked (which also permits trading with them via Market) +46. vastly improved speed of world and oasis generation steps +47. Multihunter & Support password fields are now really password fields +48. login & logout pages redirect to install if game is not installed yet +49. Multihunter can no longer build beyond level 20 +50. installation final screen shows info to remove install folder and CHMOD folders on Linux +51. fixed farms generation via Admin - these will be created all over map, not only where new players are currently being placed (players are positioned like this: middle section for first 20 days, then corners, then in between) +52. fixed logged-in check (no longer redirects to login.php from admin when not logged-in to the game itself) +53. horse drinking trough now decreases crop usage by real the amounts of how much crop Roman horse units really consume +54. fixed ability to build Great Warehouse and Great Granary in non-Natar villages +55. fixed ability to build buildings not belonging to player's tribe (trapper, brewery, horse drinking trough) +56. fixed admin help for editing village not showing IDs for all buildings +57. new feature: access log (only in config.php file to be used by advanced users to log game traffic and reveal URL hacks) +58. fixed ability to go back in quests and gain gold and resources all over again when using default quests set +59. fix for "finish immediatelly" PLUS button to decrease gold amount even when demolition alone has been insta-completed +60. fixed maximum of 3 heroes in the Hero's Mansion (+ update of the Admin interface to account for it) +61. new feature: Embassy mechanics overhaul - check out our [Wiki Page](https://github.com/Shadowss/TravianZ/wiki/New-Alliance-&-Embassy-Mechanics) or this [Google Presentation](https://docs.google.com/presentation/d/1KN1qVAlxVj7aAN6F9QkRai1oliajfxKPIaJ4MSodUac/edit?usp=sharing) to learn more about it +666. there's just a lot of stuff being worked on in this project and I'm too lazy to be writing all of it down... when the project is at lease stable, I think this will make sense... for now, it's just an "I did this" shoutout and people can see that in commits + + +Shadowss changes: +1. Modified Plus System with packages.
    +2. Modified in Plus System and added Account Statement.
    +3. Enabled Report Player in Profile. Send message to Multihunter.
    +4. Enabled Graphic Pack in Profile (NOT CODED YET).
    +5. Enabled in Profile : Auto Completation , Large Map , Report Filter and Time Preferences (NOT CODED YET).
    +6. Integrate Support Section in game.
    +7. Modified footer and menu and added version and bugs (I mean detailed version.php and bugs.php).
    +8. Modified all admin page , now all pictures appers correctly.
    +9. Added night / day pictures. (thanks to advocaite).
    +10. Activate inactive player in Admin Panel.
    +11. Added Server Maintenence in Admin Panel (Not working 100% , i mean mode ban all players).
    +12. Activate Player Report in Admin Panel (NOT CODED YET).
    +13. Many bug fixed in Admin Panel.
    +14. Negative crop fixed , now units die (starvation). WORKS LIKE REAL TRAVIAN !!!
    +15. Medal fixed.
    +16. Added new quests (alliance , main building 5 , granary level 3 , warehouse level 5 , palace or residence , 3 settlers , new village , wall).
    +17. Winner decoded end time fixed , 403 , 404 , 500 errors are now decoded.
    +18. Populate and regenerate oasis automation function added and fixed.
    +19. Fixed palace , now cannot be build more than one palace / accout.
    +20. Now you need a warehouse and granary level 20 to build great granary and great warehouse.
    +21. Cannot send attacks and send resource to banned players.
    +22. Now banned palyer cannot recive resource from marketplace.
    +23. Fix message replay , now can be viwed from who came message.
    +24. Added in instalation Nature Regeneration Time.
    +25. Fix oasis.tpl in instalation files.
    +26. Fix ranking search from everyware.
    +27. Fix "Finish all constructions for 2 gold." now you dont lose gold when you simply click.
    +28. Fix bonus on artefacts , now show what bonus gives you.(thanks to brainiacX)
    +29. Fix settler bug , now you cannot train settlers if you dont have resource. And also modifyResource function updated. (thanks to brainiacX)
    +30. Fix brewerey now can be build only on capital.
    +31. Fix treasurey and palace , now cannot be build on WW village.
    +32. Fix greatbarraks.
    +33. Fix eraseble hero , now you can delete your hero.
    +34. Fix desapear hero when you send as reinforcement.
    +35. Fix message problem with '
    +36. Fix train hero for unit pretorian
    +37. Fix merchant quantity
    +38. Fix battle system for catapults
    +39. Fix delete player in admin panel
    +40. Added automated system for give medals and also added in instalation file
    +41. Fix special characters when send troops
    +45. Fix bug 10 from NarcisRO list : If you have plus account activated you cannot see the attck/deff/scout images when you attack a village (i mean img on villages : red swords etc..)
    +43. Fix forum surveys - NOT DONE
    +44. Fix wall image when spy someone for every tribe
    +45. Fix the top romans/teutons/gauls icon must show you the first rank of each race,not the whole page
    +46. Fix destroy village bug
    +47. Fix conquer oasis.
    +48. Fix movements.tpl (now show purple sword if your oasis is attacked or if you found new village)
    +49. Fixed movements on rally point if your oasis is under attack
    +50. Fixed vulnerability attack on message.
    +51. Fixed scouting all player when create natars.
    +52. Fixed catapult if have artefact for random target. Now can target WW even have that artefact like says.
    +53. Fix special characters on message (script alert not work now).
    +54. Fix mightiest bug of travian , double troops , now you won`t have any problems with double troops. Works for own units and for enforcement units.
    +55. Fix catapult target on brewerey , now you can target brewerey.
    +56. Added loss protection if you have beginner protection and want to attack a player you loss protection.
    +57. Fix artefacts, will not win more artifacts from the same village.
    +58. Fix UTF8 in database and sql.sql file.
    +59. Fixed Username HACK on register.
    +60. Fixed Village hack in profile .
    +61. Fixed a Bug where Founder or a user in alliance can kick himself.
    +62. Fixed new village must build a rally point.
    +63. Fix sorting distance artefact village .
    +64. Fix to conquer oasis: can conquer 1 attack if nature troop die.
    +65. Fix report scout by Natars. Now report player can see..
    +66. Fix area and location like real travian.
    +67. Fix field natar village set to type=3.
    +68. Fix natar village area 400/400 or WORLD_MAX not the random area.
    +69. Fix create_account : cannot create natar if already exist.
    +70. Fix counter timer if timer < 0 = display 0:00:00 and not display like your time pc.
    +71. Fix quest_core , now is like real travian.
    +72. Fix update oasis unit.
    +73. Fixed Registration hack.
    +74. Fixed Village hack hidden village and !
    +75. Fixed hidden Alliance name and fixed the bug of kicking your self if you are founder or anything else.
    +76. Fix conquer artefact.
    +77. Fix ranking and Quest 4.
    +78. Fix finishAll building/demolition/tecknology.
    +79. Fix conquer Occupied Oasis.
    +80. Fix NPC trade on settler in village or palace.
    +81. Fix bug when paste address to update building or resource , now not possible to upgrade.
    +82. Fix spy : When defender has no spy's in his village, an incomming spy attack should be unnoticed, and the defender shouldn't get a report and also there shouldn't appear red swords in dorf.1 when there are no own spy's in village.
    +83. Fix village to destroy and less query.
    +84. Fix settler to raid (1 unit of settler can carry 3000 resource...wow!!)
    +85. Fix dorf3 , now timer works corectly.
    +86. Added timezone in instalation file , and can be edited after installation on config.
    +87. The damage must be calculate for all troops as a defender.
    +88. Battle system is fixed and it`s work like real travian.
    +89. War Simulator system is fixed and it`s work like real travian.
    +90. Fix calculation culturepoint according to the speed server.
    +91. Fix to delete hero table when delete user from admin.
    +92. Fix link to coor village from admin.
    +93. Fix return troops if village destroy.
    +94. Fix link list multivillage.
    +95. Fix rally point to list troops own/other village/oasis.
    +96. Fix recive report when other player send me reinforcement to my oasis
    +97. Fix calculate defender hero
    +98. Fix enforcement oasis
    +99. Fix hero XP calculation by crop consumed and share point hero xp
    +100. Fix chiefting village only normal attack can reduce loyalty
    +101. Fix conquered oasis. Hero must use normal attack if oasis is conquered by other player
    +102. Fix destroy village.
    +103. Fix returntroop in oasis when destroy village
    +104. Fix total point hero and statistics calculation by crop consumption
    +105. Fix hero reinfocement sometimes mising in action
    +106. Fix total of trapper bug is full trapp if 1 troop only you send.
    +107. Fix invalid argument supplied if using masterbuilder
    +108. Change entire database to InnoDB. + +TienTN changes: +1. Change install/templates/config.tpl to deal with deprecated warning from new PHP version. +2. Fix install/data/sql.sql, to be executable in current MySQL version. +3. Fix db_MYSQL.php + with safe_mysql_fetch_all, and safe_mysqli_fetch_array wrappers, to avoid + Warning: mysql_fetch_all/array() expects parameter 1 to be resource, boolean given +4. Fix the db_MYSQLi.php in class object declaration(if anybody want to use db_MYSQLi.php again) +5. Fix the unx.js file for error: + VM5051:1 Uncaught SyntaxError: Unexpected token ) + jd.onreadystatechange @ unx.js?0ac36:170 + This error arises when moving to the border of the map. +6. Fix the map loop moving bug: + Symptom: For map not set to size 400x400, on the map page, + when moving on and on in one direction, cross the map border(loop) two times, + the moving function will be crashed(freeze, you can't move any more). + I found out that unx.js handle a static map size(400x400). + So I fixed this with a m_c.world_max variable from mapview.tpl and changed the unx.js accordingly. +7. Fix the constructor global variable missing in Session.php + + +TPLinux Changes: +1. Fix FinishAll with two gold issue/bug +2. Fix Reload crush issue after building construction finished +3. Fix in_array bug in show more buldings in WWV +4. Fix winner redirection +5. Fix winner WW image path +6. Convert ' 5 +10. Fixing Quest not appears if press (play no tasks) +11. Fix the redirection from rally point when attack is finished +12. Remove Rally point advantage +13. Fix fullscreen map in rtl layout +14. Fix divesion by Zero bug in general statics +-- diff --git a/README.md b/README.md index 7f3355e0..0c06b5a5 100644 --- a/README.md +++ b/README.md @@ -1,224 +1,51 @@ -[![Code Triagers Badge](https://www.codetriage.com/shadowss/travianz/badges/users.svg)](https://www.codetriage.com/shadowss/travianz) [![Join the chat at https://gitter.im/TravianZ-V8/Lobby](https://badges.gitter.im/TravianZ-V8/Lobby.svg)](https://gitter.im/TravianZ-V8/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Code Triagers Badge](https://www.codetriage.com/shadowss/travianz/badges/users.svg)](https://www.codetriage.com/shadowss/travianz) +[![Join the chat at https://gitter.im/TravianZ-V8/Lobby](https://badges.gitter.im/TravianZ-V8/Lobby.svg)](https://gitter.im/TravianZ-V8/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Gratipay User](https://img.shields.io/gratipay/user/martinambrus.svg?style=plastic)](https://gratipay.com/~martinambrus/) +[![Maintenance](https://img.shields.io/maintenance/yes/2017.svg)]() -TravianZ Version v.8.3.3 BETA b3 +TravianZ Version **v.8.3.3 BETA b3** +====== +**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 -Download and updates : https://github.com/Shadowss/TravianZ +**Quick links:** +* [Download and Updates](https://github.com/Shadowss/TravianZ) »» https://github.com/Shadowss/TravianZ +* [Wiki](https://github.com/Shadowss/TravianZ/wiki) +* [Game Mechanics](http://travian.wikia.com/wiki/Travian_Wiki) -Thank you to : Shadowss , advocaite , brainiacX , MisterX , yi12345 , ronix , Elio , martinambrus and many others that make that version posible. +**Minimum requirements:** +* [PHP](http://php.net/) 5.6.32+ +* [MySQL Community Server](https://dev.mysql.com/downloads/mysql/) 5.5+ + * or alternatively, [MariaDB](https://downloads.mariadb.org/) 5.5+ + * please see also the compatibility notes on [this Wiki page](https://github.com/Shadowss/TravianZ/wiki/Known-Bugs) -First i want to say THANKS for all who worked on that version , will find a list on Version file. +**Dedicated or shared hosting?** -TravianZ is based on TravianX v6.0.0 or TravianZ or TravianX with some grapich changes from ZravianX. +We *strongly* recommend using a ***dedicated hosting*** for this game. Big Travian servers used to host +thousands of players and the original servers still had about 300ms page display time. The legacy code +in this clone (which was created in 2013) is right now doing about **400 MySQL queries** (questions +to the database) per single page refresh - which is usually well beyond what most shared hostings can support +with a big enough player base. +**Support & Bug reports** -martinambrus changes: -1. PHP7 compatibility (mysql functions converted to mysqli) -2. a lot of database optimizations (not in code but in MySQL tables themselves, mostly adding indexes to speed things up) -3. fix for a nasty JavaScript bug which was killing the browser with any number of countdown(s) running on page (even one!) -4. large map not centered fix -5. WW Buildings have no aliance (PHP warning removed) -6. password in Admin area for deletion of user is now really a password field -7. Multihunter couldn't progress beyond Quest level 4 -8. PLUS settings (including PayPal options) can be configured in Admin -9. installation timeouting fix -10. extra settings in admin save config correctly -11. security tightened to try and prevent MySQL injections from in-game -12. assigning link to alliance forum now works -13. alliance description now really editable -14. Admin SQL injection fixes -15. fix for map not showing natar villages -16. weak MD5 password in database converted into strong bcrypt ones -17. newsbox 1 best player can also show admin if they are enabled in config -18. Natar random attacks show attacker as ?? as intended now -19. System Message can contain quotes and no longer inserts BOM characters at the beginning -20. front-end + Admin page titles now correctly reflect where we really are (so browsing history can be navigated easily instead of showing Travian on every page) -21. Return to Server link in Admin works fine if homepage in config does not end with a slash -22. Great Workshop no longer shows as "Error" in Admin when editing Village -23. Great Workshop added to manual pages -24. new Combat Simulator link when showing details of oasis for quicker determination if we can win that fight -25. Support, Taskmaster & Multihunter no longer shown in statistics as last players with 0 villages -26. invalid `
    ` tags no longer added to description textboxes when editing User in Admin -27. editing additional user data in Admin now saves them when Enter is used instead of clicking on "Save" as well -28. fixed reports pagination always staying on "All" tab -29. fix for the "fixed" :) self-kicking from an alliance -30. fixed sending messages to player via Admin -31. Support user is now a part of the installation and can be logged into Admin and in-game (albeit in game, they have no village, so can not access fields or village views) -32. messages sent to Multihunter now have the correct recepient shown next to them (was empty) -33. new links in Admin to access in-game messages + Mass Message & System Message dialogs -34. mass messages sent out under Support rather than Multihunter (we should not be scaring people :D) -35. fixed displaying of current Quest in Admin -36. fixed OK message in Admin when resetting All Players' PLUS -37. new config option to show Support messages in Admin's mailbox -38. new feature: allowing messages to be sent as Support from in-game when user is Admin + it's allowed in config -39. not allowing installation if old data are still in database to prevent multiple worlds generation and game misbehavior -40. fixed quest 1 to reload the page and allow for immediate completion of the woodcutter -41. NPC links added to units in Hero Mansion -42. fixed random attacks attacker tribe (Natars) when building Wonder of the World -43. players who post in an Alliance forum are now notified of each subsequent post in that topic via messages -44. editing troops in Admin now saves them when Enter is used instead of clicking on "Save" as well -45. added option into Admin config to allow Administrative accounts to be raided and attacked (which also permits trading with them via Market) -46. vastly improved speed of world and oasis generation steps -47. Multihunter & Support password fields are now really password fields -48. login & logout pages redirect to install if game is not installed yet -49. Multihunter can no longer build beyond level 20 -50. installation final screen shows info to remove install folder and CHMOD folders on Linux -51. fixed farms generation via Admin - these will be created all over map, not only where new players are currently being placed (players are positioned like this: middle section for first 20 days, then corners, then in between) -52. fixed logged-in check (no longer redirects to login.php from admin when not logged-in to the game itself) -53. horse drinking trough now decreases crop usage by real the amounts of how much crop Roman horse units really consume -54. fixed ability to build Great Warehouse and Great Granary in non-Natar villages -55. fixed ability to build buildings not belonging to player's tribe (trapper, brewery, horse drinking trough) -56. fixed admin help for editing village not showing IDs for all buildings -57. new feature: access log (only in config.php file to be used by advanced users to log game traffic and reveal URL hacks) -58. fixed ability to go back in quests and gain gold and resources all over again when using default quests set -59. fix for "finish immediatelly" PLUS button to decrease gold amount even when demolition alone has been insta-completed -60. fixed maximum of 3 heroes in the Hero's Mansion (+ update of the Admin interface to account for it) -61. new feature: Embassy mechanics overhaul - check out our [Wiki Page](https://github.com/Shadowss/TravianZ/wiki/New-Alliance-&-Embassy-Mechanics) or this [Google Presentation](https://docs.google.com/presentation/d/1KN1qVAlxVj7aAN6F9QkRai1oliajfxKPIaJ4MSodUac/edit?usp=sharing) to learn more about it -666. there's just a lot of stuff being worked on in this project and I'm too lazy to be writing all of it down... when the project is at lease stable, I think this will make sense... for now, it's just an "I did this" shoutout and people can see that in commits +We are usually available to chat at our [Gitter channel](https://gitter.im/TravianZ-V8/Lobby), if you like to ask +any questions or just talk to the developers about how great their day is today :) As for bug reports, please use +the [Issues tab](https://github.com/Shadowss/TravianZ/issues) and create new issue, whether it's an error in game +or you have a feature request to be included in the play. +**The team** +* [Shadowss](https://github.com/Shadowss) - project owner and an occasional developer / tester +* [martinambrus](https://github.com/martinambrus) - lead developer +* [Vladyslav](https://github.com/velhbxtyrj) - rigorous game tester -Shadowss changes: -1. Modified Plus System with packages.
    -2. Modified in Plus System and added Account Statement.
    -3. Enabled Report Player in Profile. Send message to Multihunter.
    -4. Enabled Graphic Pack in Profile (NOT CODED YET).
    -5. Enabled in Profile : Auto Completation , Large Map , Report Filter and Time Preferences (NOT CODED YET).
    -6. Integrate Support Section in game.
    -7. Modified footer and menu and added version and bugs (I mean detailed version.php and bugs.php).
    -8. Modified all admin page , now all pictures appers correctly.
    -9. Added night / day pictures. (thanks to advocaite).
    -10. Activate inactive player in Admin Panel.
    -11. Added Server Maintenence in Admin Panel (Not working 100% , i mean mode ban all players).
    -12. Activate Player Report in Admin Panel (NOT CODED YET).
    -13. Many bug fixed in Admin Panel.
    -14. Negative crop fixed , now units die (starvation). WORKS LIKE REAL TRAVIAN !!!
    -15. Medal fixed.
    -16. Added new quests (alliance , main building 5 , granary level 3 , warehouse level 5 , palace or residence , 3 settlers , new village , wall).
    -17. Winner decoded end time fixed , 403 , 404 , 500 errors are now decoded.
    -18. Populate and regenerate oasis automation function added and fixed.
    -19. Fixed palace , now cannot be build more than one palace / accout.
    -20. Now you need a warehouse and granary level 20 to build great granary and great warehouse.
    -21. Cannot send attacks and send resource to banned players.
    -22. Now banned palyer cannot recive resource from marketplace.
    -23. Fix message replay , now can be viwed from who came message.
    -24. Added in instalation Nature Regeneration Time.
    -25. Fix oasis.tpl in instalation files.
    -26. Fix ranking search from everyware.
    -27. Fix "Finish all constructions for 2 gold." now you dont lose gold when you simply click.
    -28. Fix bonus on artefacts , now show what bonus gives you.(thanks to brainiacX)
    -29. Fix settler bug , now you cannot train settlers if you dont have resource. And also modifyResource function updated. (thanks to brainiacX)
    -30. Fix brewerey now can be build only on capital.
    -31. Fix treasurey and palace , now cannot be build on WW village.
    -32. Fix greatbarraks.
    -33. Fix eraseble hero , now you can delete your hero.
    -34. Fix desapear hero when you send as reinforcement.
    -35. Fix message problem with '
    -36. Fix train hero for unit pretorian
    -37. Fix merchant quantity
    -38. Fix battle system for catapults
    -39. Fix delete player in admin panel
    -40. Added automated system for give medals and also added in instalation file
    -41. Fix special characters when send troops
    -45. Fix bug 10 from NarcisRO list : If you have plus account activated you cannot see the attck/deff/scout images when you attack a village (i mean img on villages : red swords etc..)
    -43. Fix forum surveys - NOT DONE
    -44. Fix wall image when spy someone for every tribe
    -45. Fix the top romans/teutons/gauls icon must show you the first rank of each race,not the whole page
    -46. Fix destroy village bug
    -47. Fix conquer oasis.
    -48. Fix movements.tpl (now show purple sword if your oasis is attacked or if you found new village)
    -49. Fixed movements on rally point if your oasis is under attack
    -50. Fixed vulnerability attack on message.
    -51. Fixed scouting all player when create natars.
    -52. Fixed catapult if have artefact for random target. Now can target WW even have that artefact like says.
    -53. Fix special characters on message (script alert not work now).
    -54. Fix mightiest bug of travian , double troops , now you won`t have any problems with double troops. Works for own units and for enforcement units.
    -55. Fix catapult target on brewerey , now you can target brewerey.
    -56. Added loss protection if you have beginner protection and want to attack a player you loss protection.
    -57. Fix artefacts, will not win more artifacts from the same village.
    -58. Fix UTF8 in database and sql.sql file.
    -59. Fixed Username HACK on register.
    -60. Fixed Village hack in profile .
    -61. Fixed a Bug where Founder or a user in alliance can kick himself.
    -62. Fixed new village must build a rally point.
    -63. Fix sorting distance artefact village .
    -64. Fix to conquer oasis: can conquer 1 attack if nature troop die.
    -65. Fix report scout by Natars. Now report player can see..
    -66. Fix area and location like real travian.
    -67. Fix field natar village set to type=3.
    -68. Fix natar village area 400/400 or WORLD_MAX not the random area.
    -69. Fix create_account : cannot create natar if already exist.
    -70. Fix counter timer if timer < 0 = display 0:00:00 and not display like your time pc.
    -71. Fix quest_core , now is like real travian.
    -72. Fix update oasis unit.
    -73. Fixed Registration hack.
    -74. Fixed Village hack hidden village and !
    -75. Fixed hidden Alliance name and fixed the bug of kicking your self if you are founder or anything else.
    -76. Fix conquer artefact.
    -77. Fix ranking and Quest 4.
    -78. Fix finishAll building/demolition/tecknology.
    -79. Fix conquer Occupied Oasis.
    -80. Fix NPC trade on settler in village or palace.
    -81. Fix bug when paste address to update building or resource , now not possible to upgrade.
    -82. Fix spy : When defender has no spy's in his village, an incomming spy attack should be unnoticed, and the defender shouldn't get a report and also there shouldn't appear red swords in dorf.1 when there are no own spy's in village.
    -83. Fix village to destroy and less query.
    -84. Fix settler to raid (1 unit of settler can carry 3000 resource...wow!!)
    -85. Fix dorf3 , now timer works corectly.
    -86. Added timezone in instalation file , and can be edited after installation on config.
    -87. The damage must be calculate for all troops as a defender.
    -88. Battle system is fixed and it`s work like real travian.
    -89. War Simulator system is fixed and it`s work like real travian.
    -90. Fix calculation culturepoint according to the speed server.
    -91. Fix to delete hero table when delete user from admin.
    -92. Fix link to coor village from admin.
    -93. Fix return troops if village destroy.
    -94. Fix link list multivillage.
    -95. Fix rally point to list troops own/other village/oasis.
    -96. Fix recive report when other player send me reinforcement to my oasis
    -97. Fix calculate defender hero
    -98. Fix enforcement oasis
    -99. Fix hero XP calculation by crop consumed and share point hero xp
    -100. Fix chiefting village only normal attack can reduce loyalty
    -101. Fix conquered oasis. Hero must use normal attack if oasis is conquered by other player
    -102. Fix destroy village.
    -103. Fix returntroop in oasis when destroy village
    -104. Fix total point hero and statistics calculation by crop consumption
    -105. Fix hero reinfocement sometimes mising in action
    -106. Fix total of trapper bug is full trapp if 1 troop only you send.
    -107. Fix invalid argument supplied if using masterbuilder
    -108. Change entire database to InnoDB. +**Thanks** -TienTN changes: -1. Change install/templates/config.tpl to deal with deprecated warning from new PHP version. -2. Fix install/data/sql.sql, to be executable in current MySQL version. -3. Fix db_MYSQL.php - with safe_mysql_fetch_all, and safe_mysqli_fetch_array wrappers, to avoid - Warning: mysql_fetch_all/array() expects parameter 1 to be resource, boolean given -4. Fix the db_MYSQLi.php in class object declaration(if anybody want to use db_MYSQLi.php again) -5. Fix the unx.js file for error: - VM5051:1 Uncaught SyntaxError: Unexpected token ) - jd.onreadystatechange @ unx.js?0ac36:170 - This error arises when moving to the border of the map. -6. Fix the map loop moving bug: - Symptom: For map not set to size 400x400, on the map page, - when moving on and on in one direction, cross the map border(loop) two times, - the moving function will be crashed(freeze, you can't move any more). - I found out that unx.js handle a static map size(400x400). - So I fixed this with a m_c.world_max variable from mapview.tpl and changed the unx.js accordingly. -7. Fix the constructor global variable missing in Session.php +Many thanks to all those who recently played around with the project and tested it both, locally and on their +own servers. This includes [ZZJHONS](https://github.com/ZZJHONS), [DracoMilesX](https://github.com/DracoMilesX), +[phaze1G](https://github.com/phaze1G) and many others who were too shy to let us know that they use and enjoy +runnign this game :) - -TPLinux Changes: -1. Fix FinishAll with two gold issue/bug -2. Fix Reload crush issue after building construction finished -3. Fix in_array bug in show more buldings in WWV -4. Fix winner redirection -5. Fix winner WW image path -6. Convert ' 5 -10. Fixing Quest not appears if press (play no tasks) -11. Fix the redirection from rally point when attack is finished -12. Remove Rally point advantage -13. Fix fullscreen map in rtl layout -14. Fix divesion by Zero bug in general statics --- +Also, our thanks go to all both, the original and occasional developers, especially [yi12345](https://github.com/yi12345/), +[advocaite](https://github.com/advocaite/), [brainiacX](https://github.com/brainiacX/), [ronix](https://github.com/ronix/), +[MisterX](https://github.com/MisterX/), [Elio](https://github.com/Elio/) and many others who were part of this +project's history. \ No newline at end of file From f2261a7c8f5fcc4d26fa99bd24069112f76d4a81 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Mon, 27 Nov 2017 10:48:20 +0100 Subject: [PATCH 075/126] fix: oasis displayed incorrectly in Admin #386 PHP error caused array pointers to miss-align and the last one to point to the previous record. --- Admin/Templates/village.tpl | 61 ++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 15 deletions(-) diff --git a/Admin/Templates/village.tpl b/Admin/Templates/village.tpl index 611cb944..b3946cc3 100644 --- a/Admin/Templates/village.tpl +++ b/Admin/Templates/village.tpl @@ -39,21 +39,52 @@ if(isset($id)) $result = $database->query_return($q); if(count($result) >0) { - foreach($result as &$row) + $newResult = []; + foreach($result as $row) { $type = $row['type']; - if($type==1) { $row['type'] = ' + 25%'; $wood+=1;} - elseif($type==2) { $row['type'] = ' + 25%'; $wood+=1;} - elseif($type==3) { $row['type'] = ' + 25%
    + 25%'; $wood+=1; $crop+=1;} - elseif($type==4) { $row['type'] = ' + 25%'; $clay+=1;} - elseif($type==5) { $row['type'] = ' + 25%'; $clay+=1;} - elseif($type==6) { $row['type'] = ' + 25%
    + 25%'; $clay+=1;$crop+=1;} - elseif($type==7) { $row['type'] = ' + 25%'; $iron+=1;} - elseif($type==8) { $row['type'] = ' + 25%'; $iron+=1;} - elseif($type==9) { $row['type'] = ' + 25%
    + 25%'; $iron+=1; $crop+=1;} - elseif($type==10){ $row['type'] = ' + 25%'; $crop+=1;} - elseif($type==11){ $row['type'] = ' + 25%'; $crop+=1;} - elseif($type==12){ $row['type'] = ' + 50%'; $crop+=2;} + if ( $type == 1 ) { + $row['type'] = ' + 25%'; + $wood += 1; + } elseif ( $type == 2 ) { + $row['type'] = ' + 25%'; + $wood += 1; + } elseif ( $type == 3 ) { + $row['type'] = ' + 25%
    + 25%'; + $wood += 1; + $crop += 1; + } elseif ( $type == 4 ) { + $row['type'] = ' + 25%'; + $clay += 1; + } elseif ( $type == 5 ) { + $row['type'] = ' + 25%'; + $clay += 1; + } elseif ( $type == 6 ) { + $row['type'] = ' + 25%
    + 25%'; + $clay += 1; + $crop += 1; + } elseif ( $type == 7 ) { + $row['type'] = ' + 25%'; + $iron += 1; + } elseif ( $type == 8 ) { + $row['type'] = ' + 25%'; + $iron += 1; + } elseif ( $type == 9 ) { + $row['type'] = ' + 25%
    + 25%'; + $iron += 1; + $crop += 1; + } elseif ( $type == 10 ) { + $row['type'] = ' + 25%'; + $crop += 1; + } elseif ( $type == 11 ) { + $row['type'] = ' + 25%'; + $crop += 1; + } elseif ( $type == 12 ) { + $row['type'] = ' + 50%'; + $crop += 2; + } + + $newResult[] = $row; } } $ocounter = array($wood,$clay,$iron,$crop); @@ -237,9 +268,9 @@ if(isset($id))
    0) + if(count($newResult)) { - foreach($result as $row) + foreach($newResult as $row) { echo " From 5ce949a135b31336f0792d03eafa724c0382a5c7 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Mon, 27 Nov 2017 11:18:55 +0100 Subject: [PATCH 076/126] feat: voting for travian.martinambrus.com --- Templates/menu.tpl | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/Templates/menu.tpl b/Templates/menu.tpl index 1b2055d1..dfea5108 100644 --- a/Templates/menu.tpl +++ b/Templates/menu.tpl @@ -62,12 +62,26 @@ div.c1 {text-align: center} + ?> + ?>

    + + VOTE FOR US +

    + + + travian private servers

    + Travian Private Servers

    + Travian Private Server

    +

    +
    Top Travian Private Servers
    + + +
    +
    isDeleting($session->uid); if($timestamp) { @@ -110,9 +124,9 @@ div.c1 {text-align: center} -
    From 9f414943e036dc3a1a5dfc82b801b03b25a912e1 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Mon, 27 Nov 2017 11:27:22 +0100 Subject: [PATCH 077/126] feat: ads on side --- Templates/News/newsbox2.tpl | 63 ++++++------------------------------- 1 file changed, 10 insertions(+), 53 deletions(-) diff --git a/Templates/News/newsbox2.tpl b/Templates/News/newsbox2.tpl index 2787ee98..8b9f3419 100644 --- a/Templates/News/newsbox2.tpl +++ b/Templates/News/newsbox2.tpl @@ -1,55 +1,12 @@ -
    newsbox 2
    - ".(time() - (60*10))." AND tribe!=0 AND tribe!=4 AND tribe!=5"); - -?> -
    -
    ".$row['name']." getMapCheck($row['wref'])."\" target=\"blank\">(".$row['x']."|".$row['y'].") ".round($row['loyalty'])."%$type".$row['type']."
    archived1) < 10) { - echo "«»"; + echo "«»"; } else if (!isset($_GET['s']) && count($message->archived1) > 10) { - echo "«»"; + echo "«»"; } else if(isset($_GET['s']) && count($message->archived1) > $_GET['s']) { if(count($message->archived1) > ($_GET['s']+10) && $_GET['s']-10 < count($message->archived1) && $_GET['s'] != 0) { @@ -28,8 +28,8 @@ include("menu.tpl"); else if(count($message->archived1) > $_GET['s']+10) { echo "«»"; } - else { - echo "«»"; + else if (count($message->archived1) > 10) { + echo "«»"; } } ?>
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Online Users: users
    Server Speed:
    Troop Speed: x
    Evasion Speed:
    Map Size: x
    Village Exp.:
    Beginners Prot.: hrs
    Medal Interval: = 86400){ echo ''.(MEDALINTERVAL/86400).' Days'; } else if(MEDALINTERVAL < 86400){ echo ''.(MEDALINTERVAL/3600).' Hours'; } ?>
    Server Start:
    + + + +
    From 646d1dedda61d1b464c916ec4cb3743e624c77ac Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Mon, 27 Nov 2017 11:31:26 +0100 Subject: [PATCH 078/126] feat: ads on side changed for text and graphics --- Templates/News/newsbox2.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Templates/News/newsbox2.tpl b/Templates/News/newsbox2.tpl index 8b9f3419..52dfc9ed 100644 --- a/Templates/News/newsbox2.tpl +++ b/Templates/News/newsbox2.tpl @@ -1,10 +1,10 @@
    - + Date: Thu, 30 Nov 2017 18:16:00 +0100 Subject: [PATCH 088/126] fix: Multihunter should have access to villages info --- Admin/Templates/troopUpgrades.tpl | 2 +- Admin/Templates/troops.tpl | 2 +- Admin/Templates/village.tpl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Admin/Templates/troopUpgrades.tpl b/Admin/Templates/troopUpgrades.tpl index c6b61c99..41152c70 100644 --- a/Admin/Templates/troopUpgrades.tpl +++ b/Admin/Templates/troopUpgrades.tpl @@ -1,5 +1,5 @@ diff --git a/Admin/Templates/troops.tpl b/Admin/Templates/troops.tpl index 8533977d..2836de67 100644 --- a/Admin/Templates/troops.tpl +++ b/Admin/Templates/troops.tpl @@ -108,7 +108,7 @@ else if($units['u49'] > 0){$u49 = ''.$units['u49'].'';} if($units['u50'] == 0){$u50 = ''.$units['u50'].'';} else if($units['u50'] > 0){$u50 = ''.$units['u50'].'';} - if($_SESSION['access'] == ADMIN) + if($_SESSION['access'] >= MULTIHUNTER) { if($user['tribe'] == 1) { diff --git a/Admin/Templates/village.tpl b/Admin/Templates/village.tpl index b3946cc3..f2f19e8b 100644 --- a/Admin/Templates/village.tpl +++ b/Admin/Templates/village.tpl @@ -10,7 +10,7 @@ ## Copyright: TravianZ (c) 2010-2014. All rights reserved. ## ## Improved: aggenkeech ## ################################################################################# -if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!"); +if($_SESSION['access'] < 8) die("Access Denied: You are not Admin!"); error_reporting(0); $id = $_GET['did']; if(isset($id)) From 68c6cc69ccded4023dbbfaf224452838561f98c5 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Thu, 30 Nov 2017 20:09:49 +0100 Subject: [PATCH 089/126] fix: troops duplicate for certain tribes via raid lists --- Templates/a2b/startRaid.tpl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Templates/a2b/startRaid.tpl b/Templates/a2b/startRaid.tpl index 982f29bb..c274fbe6 100644 --- a/Templates/a2b/startRaid.tpl +++ b/Templates/a2b/startRaid.tpl @@ -128,8 +128,14 @@ $modes = []; for ( $u = 1; $u <= 10; $u ++ ) { - $units[] = $uname2 . ($u < 10 ? $u : 0); - $amounts[] = $data[ 'u' . ($u < 10 ? $u : 0) ]; + if ($tribe == 1) { + $unitKey = $uname2 . $u; + } else { + $unitKey = $uname2 . ($u < 10 ? $u : 0); + } + + $units[] = $uname2 . $unitKey; + $amounts[] = $data[ 'u' . $unitKey ]; $modes[] = 0; } From 6fb38ebca16b55accfe9a500237d929704e7efbb Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Thu, 30 Nov 2017 20:12:59 +0100 Subject: [PATCH 090/126] catching up (#2) * fix: all languages added to installer * fix: all languages added to installer and Admin * fix: max crop/resources reset to level 1 value temporarily This happened when level 1 granary / warehouse was built because of a missing + sign in a formula. #374 * chore: some more badges and thanks to JetBrains :) * chore: one more badge :P * chore: cleanup * fix: Multihunter should have access to villages info * fix: troops duplicate for certain tribes via raid lists --- Admin/Templates/troopUpgrades.tpl | 2 +- Admin/Templates/troops.tpl | 2 +- Admin/Templates/village.tpl | 2 +- README.md | 16 +++- Templates/a2b/startRaid.tpl | 10 ++- cache/.htaccess | 4 - payment/.htaccess | 11 --- payment/c2p.php | 117 ------------------------------ 8 files changed, 24 insertions(+), 140 deletions(-) delete mode 100644 cache/.htaccess delete mode 100644 payment/.htaccess delete mode 100644 payment/c2p.php diff --git a/Admin/Templates/troopUpgrades.tpl b/Admin/Templates/troopUpgrades.tpl index c6b61c99..41152c70 100644 --- a/Admin/Templates/troopUpgrades.tpl +++ b/Admin/Templates/troopUpgrades.tpl @@ -1,5 +1,5 @@
    diff --git a/Admin/Templates/troops.tpl b/Admin/Templates/troops.tpl index 8533977d..2836de67 100644 --- a/Admin/Templates/troops.tpl +++ b/Admin/Templates/troops.tpl @@ -108,7 +108,7 @@ else if($units['u49'] > 0){$u49 = ''.$units['u49'].'';} if($units['u50'] == 0){$u50 = ''.$units['u50'].'';} else if($units['u50'] > 0){$u50 = ''.$units['u50'].'';} - if($_SESSION['access'] == ADMIN) + if($_SESSION['access'] >= MULTIHUNTER) { if($user['tribe'] == 1) { diff --git a/Admin/Templates/village.tpl b/Admin/Templates/village.tpl index b3946cc3..f2f19e8b 100644 --- a/Admin/Templates/village.tpl +++ b/Admin/Templates/village.tpl @@ -10,7 +10,7 @@ ## Copyright: TravianZ (c) 2010-2014. All rights reserved. ## ## Improved: aggenkeech ## ################################################################################# -if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!"); +if($_SESSION['access'] < 8) die("Access Denied: You are not Admin!"); error_reporting(0); $id = $_GET['did']; if(isset($id)) diff --git a/README.md b/README.md index 0c06b5a5..a08d9043 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,13 @@ [![Code Triagers Badge](https://www.codetriage.com/shadowss/travianz/badges/users.svg)](https://www.codetriage.com/shadowss/travianz) -[![Join the chat at https://gitter.im/TravianZ-V8/Lobby](https://badges.gitter.im/TravianZ-V8/Lobby.svg)](https://gitter.im/TravianZ-V8/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![Gratipay User](https://img.shields.io/gratipay/user/martinambrus.svg?style=plastic)](https://gratipay.com/~martinambrus/) [![Maintenance](https://img.shields.io/maintenance/yes/2017.svg)]() +[![GitHub Release](https://img.shields.io/github/release/Shadowss/TravianZ/all.svg)]() +[![Github All Downloads](https://img.shields.io/github/downloads/Shadowss/TravianZ/total.svg)]() +[![GitHub contributors](https://img.shields.io/github/contributors/Shadowss/TravianZ.svg)]() +[![license](https://img.shields.io/github/license/Shadowss/TravianZ.svg)]() +[![GitHub last commit](https://img.shields.io/github/last-commit/Shadowss/TravianZ.svg)]() +[![Proudly Coded in PHPStorm](https://img.shields.io/badge/coded%20in-PHPStorm-BD5CF3.svg)](https://www.jetbrains.com/buy/opensource/?product=phpstorm) +[![Join the chat at https://gitter.im/TravianZ-V8/Lobby](https://badges.gitter.im/TravianZ-V8/Lobby.svg)](https://gitter.im/TravianZ-V8/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Donate to this project on LiberaPay](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/martinambrus/donate) TravianZ Version **v.8.3.3 BETA b3** ====== @@ -48,4 +54,8 @@ runnign this game :) Also, our thanks go to all both, the original and occasional developers, especially [yi12345](https://github.com/yi12345/), [advocaite](https://github.com/advocaite/), [brainiacX](https://github.com/brainiacX/), [ronix](https://github.com/ronix/), [MisterX](https://github.com/MisterX/), [Elio](https://github.com/Elio/) and many others who were part of this -project's history. \ No newline at end of file +project's history. + +Last but not least, our thanks go to [JetBrains](https://www.jetbrains.com/) for lending us a one-year full-featured +[open-source PHPStorm](https://www.jetbrains.com/buy/opensource/?product=phpstorm) (and other products) license! +Thanks guys, you're awesome :) \ No newline at end of file diff --git a/Templates/a2b/startRaid.tpl b/Templates/a2b/startRaid.tpl index 982f29bb..c274fbe6 100644 --- a/Templates/a2b/startRaid.tpl +++ b/Templates/a2b/startRaid.tpl @@ -128,8 +128,14 @@ $modes = []; for ( $u = 1; $u <= 10; $u ++ ) { - $units[] = $uname2 . ($u < 10 ? $u : 0); - $amounts[] = $data[ 'u' . ($u < 10 ? $u : 0) ]; + if ($tribe == 1) { + $unitKey = $uname2 . $u; + } else { + $unitKey = $uname2 . ($u < 10 ? $u : 0); + } + + $units[] = $uname2 . $unitKey; + $amounts[] = $data[ 'u' . $unitKey ]; $modes[] = 0; } diff --git a/cache/.htaccess b/cache/.htaccess deleted file mode 100644 index d87fe95b..00000000 --- a/cache/.htaccess +++ /dev/null @@ -1,4 +0,0 @@ - -Order allow,deny -Deny from all - \ No newline at end of file diff --git a/payment/.htaccess b/payment/.htaccess deleted file mode 100644 index 5a2d943e..00000000 --- a/payment/.htaccess +++ /dev/null @@ -1,11 +0,0 @@ - -Order deny,allow -Deny from all -Allow from service.micropayment.de -Allow from proxy.micropayment.de -Allow from access.micropayment.de -ErrorDocument 403 http://travian.shadowss.ro/403.php -ErrorDocument 404 http://travian.shadowss.ro/404.php -ErrorDocument 500 http://travian.shadowss.ro/500.php -Options -Indexes - \ No newline at end of file diff --git a/payment/c2p.php b/payment/c2p.php deleted file mode 100644 index 94221ff1..00000000 --- a/payment/c2p.php +++ /dev/null @@ -1,117 +0,0 @@ -Somethings wrong"; -} -if ($id1 == 199) { -$_SESSION['amount'] = $amount; -$trenner = "\n"; -$status = 'ok'; -$url = "http://" . $_SERVER['HOMEPAGE'] . "/a2b2.php"; // change to your own -$target = '_blank'; -$forward = 0; - -$response = 'status=' . $status; -$response.= $trenner; -$response.= 'url=' . $url; -$response.= $trenner; -$response.= 'target=' . $target; -$response.= $trenner; -$response.= 'forward=' . $forward; - - -echo $response; -} - -if ($id1 == 499) { -$_SESSION['amount'] = $amount; -$trenner = "\n"; -$status = 'ok'; -$url = "http://" . $_SERVER['HOMEPAGE'] . "/a2b2.php"; // change to your own -$target = '_blank'; -$forward = 1; - -$response = 'status=' . $status; -$response.= $trenner; -$response.= 'url=' . $url; -$response.= $trenner; -$response.= 'target=' . $target; -$response.= $trenner; -$response.= 'forward=' . $forward; - - -echo $response; -} -if ($id1 == 999) { -$_SESSION['amount'] = $amount; -$trenner = "\n"; -$status = 'ok'; -$url = "http://" . $_SERVER['HOMEPAGE'] . "/a2b2.php"; // change to your own -$target = '_blank'; -$forward = 1; - -$response = 'status=' . $status; -$response.= $trenner; -$response.= 'url=' . $url; -$response.= $trenner; -$response.= 'target=' . $target; -$response.= $trenner; -$response.= 'forward=' . $forward; - - -echo $response; -} -if ($id1 == 1999) { -$_SESSION['amount'] = $amount; -$trenner = "\n"; -$status = 'ok'; -$url = "http://" . $_SERVER['HOMEPAGE'] . "/a2b2.php"; // change to your own -$target = '_blank'; -$forward = 1; - -$response = 'status=' . $status; -$response.= $trenner; -$response.= 'url=' . $url; -$response.= $trenner; -$response.= 'target=' . $target; -$response.= $trenner; -$response.= 'forward=' . $forward; - - -echo $response; -} -if ($id1 == 4999) { -$_SESSION['amount'] = $amount; -$trenner = "\n"; -$status = 'ok'; -$url = "http://" . $_SERVER['HOMEPAGE'] . "/a2b2.php"; // change to your own -$target = '_blank'; -$forward = 1; - -$response = 'status=' . $status; -$response.= $trenner; -$response.= 'url=' . $url; -$response.= $trenner; -$response.= 'target=' . $target; -$response.= $trenner; -$response.= 'forward=' . $forward; - - -echo $response; -} -?> - From 7c6ab4c1f5924084c80541b5b29dea1e8cb49850 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Thu, 30 Nov 2017 20:37:31 +0100 Subject: [PATCH 091/126] fix: no need for WW Building Plan to start building a WW #337 --- GameEngine/Building.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GameEngine/Building.php b/GameEngine/Building.php index da5ac596..19239a2b 100755 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -87,9 +87,9 @@ class Building { // check if we should allow building the WW this high if ( $wwHighestLevelFound >= 50 ) { - $needed_plan = 1; + $needed_plan = 2; } else { - $needed_plan = 0; + $needed_plan = 1; } // count building plans @@ -118,7 +118,7 @@ class Building { } } - $cached = $wwbuildingplan > $needed_plan; + $cached = $wwbuildingplan >= $needed_plan; } else { // no need for building plans, we can still upgrade WW $cached = true; From 5354e185fa734ca2473dfb5d7eee12a6a47a8867 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Fri, 1 Dec 2017 10:42:38 +0100 Subject: [PATCH 092/126] fix: natar WW villages created without units #392 --- GameEngine/Admin/Mods/natarend.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GameEngine/Admin/Mods/natarend.php b/GameEngine/Admin/Mods/natarend.php index 68497aa4..bbb3be0a 100755 --- a/GameEngine/Admin/Mods/natarend.php +++ b/GameEngine/Admin/Mods/natarend.php @@ -50,7 +50,7 @@ for($i=1;$i<=$amt;$i++) { $speed = NATARS_UNITS; //new with random amount of troops - $q = "UPDATE " . TB_PREFIX . "units SET u41 = " . (rand(50, 1200) * $speed) . ", u42 = " . (rand(100, 1400) * $speed) . ", u43 = " . (rand(200, 1600) * $speed) . ", u44 = " . (rand(10, 50) * $speed) . ", u45 = " . (rand(48, 1700) * $speed) . ", u46 = " . (rand(60, 1800) * $speed) . ", u47 = " . (rand(200, 1600) * $speed) . ", u48 = " . (rand(40, 200) * $speed) . " , u49 = " . (rand(4, 20) * $speed) . ", u50 = " . (rand(5, 25) * $speed) . " WHERE vref = '".$wid."'"; + $q = "INSERT IGNORE INTO " . TB_PREFIX . "units SET u41 = " . (rand(50, 1200) * $speed) . ", u42 = " . (rand(100, 1400) * $speed) . ", u43 = " . (rand(200, 1600) * $speed) . ", u44 = " . (rand(10, 50) * $speed) . ", u45 = " . (rand(48, 1700) * $speed) . ", u46 = " . (rand(60, 1800) * $speed) . ", u47 = " . (rand(200, 1600) * $speed) . ", u48 = " . (rand(40, 200) * $speed) . " , u49 = " . (rand(4, 20) * $speed) . ", u50 = " . (rand(5, 25) * $speed) . " WHERE vref = ".$wid; mysqli_query($GLOBALS["link"], $q); } From 4db6ca52f933ed564ceea45e8eea981d15e215ba Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Fri, 1 Dec 2017 10:43:30 +0100 Subject: [PATCH 093/126] fix: sendunits.txt file could not be opened from Admin --- GameEngine/Automation.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 97f9086a..fcc2878e 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -1206,7 +1206,7 @@ class Automation { } $reload=false; - $ourFileHandle = fopen("GameEngine/Prevention/sendunits.txt", 'w'); + $ourFileHandle = fopen($autoprefix."GameEngine/Prevention/sendunits.txt", 'w'); fclose($ourFileHandle); $time = time(); $q = " @@ -3138,8 +3138,8 @@ class Automation { } } - if(file_exists("GameEngine/Prevention/sendunits.txt")) { - unlink("GameEngine/Prevention/sendunits.txt"); + if(file_exists($autoprefix."GameEngine/Prevention/sendunits.txt")) { + unlink($autoprefix."GameEngine/Prevention/sendunits.txt"); } if ($reload) header("Location: ".$_SERVER['PHP_SELF']); } From c0c11050d96d0eaf9e69dec8ba3d2e71cda56f64 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Fri, 1 Dec 2017 10:50:35 +0100 Subject: [PATCH 094/126] fix: WW villages created via Admin do not have any units #392 --- GameEngine/Admin/Mods/natarbuildingplan.php | 5 +---- GameEngine/Admin/Mods/natarend.php | 6 ++---- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/GameEngine/Admin/Mods/natarbuildingplan.php b/GameEngine/Admin/Mods/natarbuildingplan.php index 1928f904..f37b0726 100755 --- a/GameEngine/Admin/Mods/natarbuildingplan.php +++ b/GameEngine/Admin/Mods/natarbuildingplan.php @@ -27,7 +27,6 @@ include_once($autoprefix."GameEngine/Database.php"); $id = (int) $_POST['id']; $amt = (int) $_POST['vill_amount']; -$addUnitsWrefs = []; for($i=1;$i<=$amt;$i++) { @@ -41,7 +40,7 @@ $addUnitsWrefs = []; mysqli_query($GLOBALS["link"], $q); $pop = $automation->recountPop($wid); $cp = $automation->recountPop($wid); - $addUnitsWrefs[] = $wid; + $database->addUnits($wid); $database->addTech($wid); $database->addABTech($wid); $speed = NATARS_UNITS; @@ -51,8 +50,6 @@ $addUnitsWrefs = []; $database->addArtefact($wid, 3, 11, 1, PLAN, $desc, '', 'type1.gif'); } - $database->addUnits($addUnitsWrefs); - $myFile = "../../../Templates/text.tpl"; $fh = fopen($myFile, 'w') or die("


    Can't open file: templates/text.tpl"); $text = file_get_contents("../../../Templates/text_format.tpl"); diff --git a/GameEngine/Admin/Mods/natarend.php b/GameEngine/Admin/Mods/natarend.php index bbb3be0a..a3fd058f 100755 --- a/GameEngine/Admin/Mods/natarend.php +++ b/GameEngine/Admin/Mods/natarend.php @@ -27,7 +27,6 @@ include_once($autoprefix."GameEngine/Database.php"); $id = (int) $_POST['id']; $amt = (int) $_POST['vill_amount']; -$addUnitsWrefs = []; $addTechWrefs = []; $addABTechWrefs = []; @@ -44,17 +43,16 @@ for($i=1;$i<=$amt;$i++) { mysqli_query($GLOBALS["link"], $q); $pop = $automation->recountPop($wid); $cp = $automation->recountPop($wid); - $addUnitsWrefs[] = $wid; $addTechWrefs[] = $wid; $addABTechWrefs[] = $wid; $speed = NATARS_UNITS; //new with random amount of troops - $q = "INSERT IGNORE INTO " . TB_PREFIX . "units SET u41 = " . (rand(50, 1200) * $speed) . ", u42 = " . (rand(100, 1400) * $speed) . ", u43 = " . (rand(200, 1600) * $speed) . ", u44 = " . (rand(10, 50) * $speed) . ", u45 = " . (rand(48, 1700) * $speed) . ", u46 = " . (rand(60, 1800) * $speed) . ", u47 = " . (rand(200, 1600) * $speed) . ", u48 = " . (rand(40, 200) * $speed) . " , u49 = " . (rand(4, 20) * $speed) . ", u50 = " . (rand(5, 25) * $speed) . " WHERE vref = ".$wid; + $database->addUnits($wid); + $q = "UPDATE " . TB_PREFIX . "units SET u41 = " . (rand(50, 1200) * $speed) . ", u42 = " . (rand(100, 1400) * $speed) . ", u43 = " . (rand(200, 1600) * $speed) . ", u44 = " . (rand(10, 50) * $speed) . ", u45 = " . (rand(48, 1700) * $speed) . ", u46 = " . (rand(60, 1800) * $speed) . ", u47 = " . (rand(200, 1600) * $speed) . ", u48 = " . (rand(40, 200) * $speed) . " , u49 = " . (rand(4, 20) * $speed) . ", u50 = " . (rand(5, 25) * $speed) . " WHERE vref = '".$wid."'"; mysqli_query($GLOBALS["link"], $q); } -$database->addUnits($addUnitsWrefs); $database->addTech($addTechWrefs); $database->addABTech($addABTechWrefs); From 65f6eb2da1e0977aa80c2ed9fbc91ea1303d4d65 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Fri, 1 Dec 2017 11:08:41 +0100 Subject: [PATCH 095/126] fix: WW building plans must be in player's village to start building WW #337 --- GameEngine/Building.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/GameEngine/Building.php b/GameEngine/Building.php index 19239a2b..17e81ff6 100755 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -95,11 +95,14 @@ class Building { // count building plans if ( $needed_plan ) { $wwbuildingplan = 0; + $planFoundInOwnersVillage = false; $villages = $database->getVillagesID( $session->uid ); + foreach ( $villages as $village1 ) { $plan = count( $database->getOwnArtefactInfoByType2( $village1, 11 ) ); if ( $plan > 0 ) { $wwbuildingplan = 1; + $planFoundInOwnersVillage = true; } } @@ -118,7 +121,11 @@ class Building { } } - $cached = $wwbuildingplan >= $needed_plan; + if ($needed_plan == 1) { + $cached = ($wwbuildingplan >= $needed_plan && $planFoundInOwnersVillage); + } else { + $cached = $wwbuildingplan >= $needed_plan; + } } else { // no need for building plans, we can still upgrade WW $cached = true; From 23c0f4f8f758d77583508fbb97038b4836e5ed91 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Fri, 1 Dec 2017 11:10:00 +0100 Subject: [PATCH 096/126] catching up (#3) * fix: all languages added to installer * fix: all languages added to installer and Admin * fix: max crop/resources reset to level 1 value temporarily This happened when level 1 granary / warehouse was built because of a missing + sign in a formula. #374 * chore: some more badges and thanks to JetBrains :) * chore: one more badge :P * chore: cleanup * fix: Multihunter should have access to villages info * fix: troops duplicate for certain tribes via raid lists * fix: no need for WW Building Plan to start building a WW #337 * fix: natar WW villages created without units #392 * fix: sendunits.txt file could not be opened from Admin * fix: WW villages created via Admin do not have any units #392 * fix: WW building plans must be in player's village to start building WW #337 --- GameEngine/Admin/Mods/natarbuildingplan.php | 5 +---- GameEngine/Admin/Mods/natarend.php | 4 +--- GameEngine/Automation.php | 6 +++--- GameEngine/Building.php | 13 ++++++++++--- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/GameEngine/Admin/Mods/natarbuildingplan.php b/GameEngine/Admin/Mods/natarbuildingplan.php index 1928f904..f37b0726 100755 --- a/GameEngine/Admin/Mods/natarbuildingplan.php +++ b/GameEngine/Admin/Mods/natarbuildingplan.php @@ -27,7 +27,6 @@ include_once($autoprefix."GameEngine/Database.php"); $id = (int) $_POST['id']; $amt = (int) $_POST['vill_amount']; -$addUnitsWrefs = []; for($i=1;$i<=$amt;$i++) { @@ -41,7 +40,7 @@ $addUnitsWrefs = []; mysqli_query($GLOBALS["link"], $q); $pop = $automation->recountPop($wid); $cp = $automation->recountPop($wid); - $addUnitsWrefs[] = $wid; + $database->addUnits($wid); $database->addTech($wid); $database->addABTech($wid); $speed = NATARS_UNITS; @@ -51,8 +50,6 @@ $addUnitsWrefs = []; $database->addArtefact($wid, 3, 11, 1, PLAN, $desc, '', 'type1.gif'); } - $database->addUnits($addUnitsWrefs); - $myFile = "../../../Templates/text.tpl"; $fh = fopen($myFile, 'w') or die("


    Can't open file: templates/text.tpl"); $text = file_get_contents("../../../Templates/text_format.tpl"); diff --git a/GameEngine/Admin/Mods/natarend.php b/GameEngine/Admin/Mods/natarend.php index 68497aa4..a3fd058f 100755 --- a/GameEngine/Admin/Mods/natarend.php +++ b/GameEngine/Admin/Mods/natarend.php @@ -27,7 +27,6 @@ include_once($autoprefix."GameEngine/Database.php"); $id = (int) $_POST['id']; $amt = (int) $_POST['vill_amount']; -$addUnitsWrefs = []; $addTechWrefs = []; $addABTechWrefs = []; @@ -44,17 +43,16 @@ for($i=1;$i<=$amt;$i++) { mysqli_query($GLOBALS["link"], $q); $pop = $automation->recountPop($wid); $cp = $automation->recountPop($wid); - $addUnitsWrefs[] = $wid; $addTechWrefs[] = $wid; $addABTechWrefs[] = $wid; $speed = NATARS_UNITS; //new with random amount of troops + $database->addUnits($wid); $q = "UPDATE " . TB_PREFIX . "units SET u41 = " . (rand(50, 1200) * $speed) . ", u42 = " . (rand(100, 1400) * $speed) . ", u43 = " . (rand(200, 1600) * $speed) . ", u44 = " . (rand(10, 50) * $speed) . ", u45 = " . (rand(48, 1700) * $speed) . ", u46 = " . (rand(60, 1800) * $speed) . ", u47 = " . (rand(200, 1600) * $speed) . ", u48 = " . (rand(40, 200) * $speed) . " , u49 = " . (rand(4, 20) * $speed) . ", u50 = " . (rand(5, 25) * $speed) . " WHERE vref = '".$wid."'"; mysqli_query($GLOBALS["link"], $q); } -$database->addUnits($addUnitsWrefs); $database->addTech($addTechWrefs); $database->addABTech($addABTechWrefs); diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 97f9086a..fcc2878e 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -1206,7 +1206,7 @@ class Automation { } $reload=false; - $ourFileHandle = fopen("GameEngine/Prevention/sendunits.txt", 'w'); + $ourFileHandle = fopen($autoprefix."GameEngine/Prevention/sendunits.txt", 'w'); fclose($ourFileHandle); $time = time(); $q = " @@ -3138,8 +3138,8 @@ class Automation { } } - if(file_exists("GameEngine/Prevention/sendunits.txt")) { - unlink("GameEngine/Prevention/sendunits.txt"); + if(file_exists($autoprefix."GameEngine/Prevention/sendunits.txt")) { + unlink($autoprefix."GameEngine/Prevention/sendunits.txt"); } if ($reload) header("Location: ".$_SERVER['PHP_SELF']); } diff --git a/GameEngine/Building.php b/GameEngine/Building.php index da5ac596..17e81ff6 100755 --- a/GameEngine/Building.php +++ b/GameEngine/Building.php @@ -87,19 +87,22 @@ class Building { // check if we should allow building the WW this high if ( $wwHighestLevelFound >= 50 ) { - $needed_plan = 1; + $needed_plan = 2; } else { - $needed_plan = 0; + $needed_plan = 1; } // count building plans if ( $needed_plan ) { $wwbuildingplan = 0; + $planFoundInOwnersVillage = false; $villages = $database->getVillagesID( $session->uid ); + foreach ( $villages as $village1 ) { $plan = count( $database->getOwnArtefactInfoByType2( $village1, 11 ) ); if ( $plan > 0 ) { $wwbuildingplan = 1; + $planFoundInOwnersVillage = true; } } @@ -118,7 +121,11 @@ class Building { } } - $cached = $wwbuildingplan > $needed_plan; + if ($needed_plan == 1) { + $cached = ($wwbuildingplan >= $needed_plan && $planFoundInOwnersVillage); + } else { + $cached = $wwbuildingplan >= $needed_plan; + } } else { // no need for building plans, we can still upgrade WW $cached = true; From bc4687bf76a31c19e54f3ebe7d87963c9a596624 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Fri, 1 Dec 2017 12:29:32 +0100 Subject: [PATCH 097/126] fix: hero training and revival misbehaving --- Templates/Build/37.tpl | 104 ++++++++++++++++++++-------------- Templates/Build/37_hero.tpl | 3 +- Templates/Build/37_revive.tpl | 1 - Templates/Build/37_train.tpl | 34 +++++------ 4 files changed, 81 insertions(+), 61 deletions(-) diff --git a/Templates/Build/37.tpl b/Templates/Build/37.tpl index c9ac1231..c7abd466 100644 --- a/Templates/Build/37.tpl +++ b/Templates/Build/37.tpl @@ -8,7 +8,8 @@ | Copyright: TravianX Project All rights reserved | \*-------------------------------------------------------*/ - $hero_info = $units->Hero($session->uid, 0, true); + $hero_info = $units->Hero($session->uid); + $heroes = $units->Hero($session->uid, 1); $define['reset_level'] = 3; // Until which level you are able to reset your points ?> @@ -22,47 +23,70 @@

    - getTimeFormat($hero_info['trainingtime'] - time()); + $include_training = true; + $include_revive = false; + foreach ($heroes as $hdata) { + if ($hdata['dead'] == 1) { + $include_revive = true; + } + + if ($hdata['inrevive'] == 1) { + $name1 = $hdata['name']; + $include_training = false; + } + } + + if($hero_info === false && $include_revive){ + include_once("37_revive.tpl"); + } + + if ($hero_info === false && $include_training) { + include_once("37_train.tpl"); + } else if($hero_info['intraining'] == 1) { + + $timeleft = $generator->getTimeFormat($hero_info['trainingtime'] - time()); ?>
    @@ -85,9 +109,7 @@
    escape($_POST['name']))."' where `uid`='".$database->escape($session->uid)."' AND dead = 0") or die("ERROR:".mysqli_error($database->dblink)); echo "".NAME_CHANGED.""; -} - $hero_info = $units->Hero($session->uid); +} ?> diff --git a/Templates/Build/37_revive.tpl b/Templates/Build/37_revive.tpl index d8378058..fd9c8d1c 100644 --- a/Templates/Build/37_revive.tpl +++ b/Templates/Build/37_revive.tpl @@ -29,7 +29,6 @@ | Dzoki < dzoki.travian@gmail.com > | | Copyright: TravianX Project All rights reserved | \*-------------------------------------------------------*/ - $heroes = $units->Hero($session->uid, 1); // check if there is a hero in revive already $reviving = false; diff --git a/Templates/Build/37_train.tpl b/Templates/Build/37_train.tpl index 4806dc77..7c2c34bb 100644 --- a/Templates/Build/37_train.tpl +++ b/Templates/Build/37_train.tpl @@ -34,8 +34,8 @@ //check if there is unit needed in the village -$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."units WHERE `vref` = ".(int) $village->wid.""); -$units = mysqli_fetch_array($result); +$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."units WHERE `vref` = ".(int) $village->wid.""); +$units_array = mysqli_fetch_array($result); $count_hero = mysqli_fetch_array(mysqli_query($GLOBALS['link'],"SELECT Count(*) as Total FROM " . TB_PREFIX . "hero WHERE `uid` = " . $database->escape($session->uid) . ""), MYSQLI_ASSOC); $count_hero = $count_hero['Total']; @@ -75,7 +75,7 @@ if($session->tribe == 1) { if($village->awood < $u1['wood'] || $village->aclay < $u1['clay'] || $village->airon < $u1['iron'] || $village->acrop < $u1['crop']) $output.="".NOT."".ENOUGH_RESOURCES.""; - elseif($units['u1'] == 0) + elseif( $units_array['u1'] == 0) $output.="".NOT_UNITS.""; else $output.="".TRAIN.""; @@ -112,7 +112,7 @@ if($session->tribe == 1) { if($village->awood < $u2['wood'] OR $village->aclay < $u2['clay'] OR $village->airon < $u2['iron'] OR $village->acrop < $u2['crop']) $output.="".NOT."".ENOUGH_RESOURCES.""; - elseif($units['u2'] == 0) + elseif( $units_array['u2'] == 0) $output.="".NOT_UNITS.""; else $output.="".TRAIN.""; @@ -150,7 +150,7 @@ if($session->tribe == 1) { if($village->awood < $u3['wood'] OR $village->aclay < $u3['clay'] OR $village->airon < $u3['iron'] OR $village->acrop < $u3['crop']) { $output.="".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u3'] == 0){ + }else if( $units_array['u3'] == 0){ $output.="".NOT_UNITS.""; }else { $output.="".TRAIN.""; @@ -187,7 +187,7 @@ if($session->tribe == 1) { if($village->awood < $u5['wood'] OR $village->aclay < $u5['clay'] OR $village->airon < $u5['iron'] OR $village->acrop < $u5['crop']) { $output.= "".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u5'] == 0){ + }else if( $units_array['u5'] == 0){ $output.= "".NOT_UNITS.""; }else { $output.= "".TRAIN.""; @@ -224,7 +224,7 @@ if($session->tribe == 1) { if($village->awood < $u6['wood'] OR $village->aclay < $u6['clay'] OR $village->airon < $u6['iron'] OR $village->acrop < $u6['crop']) { $output.= "".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u6'] == 0){ + }else if( $units_array['u6'] == 0){ $output.= "".NOT_UNITS.""; }else { $output.= "".TRAIN.""; @@ -264,7 +264,7 @@ $output.=" if($village->awood < $u11['wood'] OR $village->aclay < $u11['clay'] OR $village->airon < $u11['iron'] OR $village->acrop < $u11['crop']) { $output.= "".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u11'] == 0){ + }else if( $units_array['u11'] == 0){ $output.= "".NOT_UNITS.""; }else { $output.= "".TRAIN.""; @@ -301,7 +301,7 @@ $output.=" if($village->awood < $u12['wood'] OR $village->aclay < $u12['clay'] OR $village->airon < $u12['iron'] OR $village->acrop < $u12['crop']) { $output.= "".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u12'] == 0){ + }else if( $units_array['u12'] == 0){ $output.= "".NOT_UNITS.""; }else { $output.= "".TRAIN.""; @@ -340,7 +340,7 @@ $output.=" if($village->awood < $u13['wood'] OR $village->aclay < $u13['clay'] OR $village->airon < $u13['iron'] OR $village->acrop < $u13['crop']) { $output.= "".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u13'] == 0){ + }else if( $units_array['u13'] == 0){ $output.= "".NOT_UNITS.""; }else { $output.= "".TRAIN.""; @@ -377,7 +377,7 @@ $output.=" if($village->awood < $u15['wood'] OR $village->aclay < $u15['clay'] OR $village->airon < $u15['iron'] OR $village->acrop < $u15['crop']) { $output.= "".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u15'] == 0){ + }else if( $units_array['u15'] == 0){ $output.= "".NOT_UNITS.""; }else { $output.= "".TRAIN.""; @@ -415,7 +415,7 @@ $output.=" if($village->awood < $u16['wood'] OR $village->aclay < $u16['clay'] OR $village->airon < $u16['iron'] OR $village->acrop < $u16['crop']) { $output.= "".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u16'] == 0){ + }else if( $units_array['u16'] == 0){ $output.= "".NOT_UNITS.""; }else { $output.= "".TRAIN.""; @@ -455,7 +455,7 @@ $output.=" if($village->awood < $u21['wood'] OR $village->aclay < $u21['clay'] OR $village->airon < $u21['iron'] OR $village->acrop < $u21['crop']) { $output.= "".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u21'] == 0){ + }else if( $units_array['u21'] == 0){ $output.= "".NOT_UNITS.""; }else { $output.= "".TRAIN.""; @@ -492,7 +492,7 @@ $output.=" if($village->awood < $u22['wood'] OR $village->aclay < $u22['clay'] OR $village->airon < $u22['iron'] OR $village->acrop < $u22['crop']) { $output.= "".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u22'] == 0){ + }else if( $units_array['u22'] == 0){ $output.= "".NOT_UNITS.""; }else { $output.= "".TRAIN.""; @@ -530,7 +530,7 @@ $output.=" if($village->awood < $u24['wood'] OR $village->aclay < $u24['clay'] OR $village->airon < $u24['iron'] OR $village->acrop < $u24['crop']) { $output.= "".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u24'] == 0){ + }else if( $units_array['u24'] == 0){ $output.= "".NOT_UNITS.""; }else { $output.= "".TRAIN.""; @@ -567,7 +567,7 @@ $output.=" if($village->awood < $u25['wood'] OR $village->aclay < $u25['clay'] OR $village->airon < $u25['iron'] OR $village->acrop < $u25['crop']) { $output.= "".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u25'] == 0){ + }else if( $units_array['u25'] == 0){ $output.= "".NOT_UNITS.""; }else { $output.= "".TRAIN.""; @@ -605,7 +605,7 @@ $output.=" if($village->awood < $u26['wood'] OR $village->aclay < $u26['clay'] OR $village->airon < $u26['iron'] OR $village->acrop < $u26['crop']) { $output.= "".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u26'] == 0){ + }else if( $units_array['u26'] == 0){ $output.= "".NOT_UNITS.""; }else { $output.= "".TRAIN.""; From 0d0dc548c157e3e3377652a1cad8e42e016c6f75 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Fri, 1 Dec 2017 12:53:05 +0100 Subject: [PATCH 098/126] fix: spending hero points subtracts these from all player's heroes #341 --- Templates/Build/37_hero.tpl | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Templates/Build/37_hero.tpl b/Templates/Build/37_hero.tpl index 665a4a1b..f8c2da2e 100644 --- a/Templates/Build/37_hero.tpl +++ b/Templates/Build/37_hero.tpl @@ -171,12 +171,12 @@ if (isset($_POST['name'])) { if($_GET['add'] == "reset") { if($hero_info['level'] <= 3){ if($hero_info['attack'] != 0 OR $hero_info['defence'] != 0 OR $hero_info['attackbonus'] != 0 OR $hero_info['defencebonus'] != 0 OR $hero_info['regeneration'] != 0){ - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `points` = '".(($hero_info['level']*5)+5)."' WHERE `uid` = '" . $database->escape($session->uid) . "'"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `attack` = '0' WHERE `uid` = '" . $database->escape($session->uid) . "'"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `defence` = '0' WHERE `uid` = '" . $database->escape($session->uid) . "'"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `attackbonus` = '0' WHERE `uid` = '" . $database->escape($session->uid) . "'"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `defencebonus` = '0' WHERE `uid` = '" . $database->escape($session->uid) . "'"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `regeneration` = '0' WHERE `uid` = '" . $database->escape($session->uid) . "'"); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `points` = '".(($hero_info['level']*5)+5)."' WHERE `heroid` = " . $hero_info['heroid']); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `attack` = '0' WHERE `heroid` = " . $hero_info['heroid']); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `defence` = '0' WHERE `heroid` = " . $hero_info['heroid']); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `attackbonus` = '0' WHERE `heroid` = " . $hero_info['heroid']); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `defencebonus` = '0' WHERE `heroid` = " . $hero_info['heroid']); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `regeneration` = '0' WHERE `heroid` = " . $hero_info['heroid']); header("Location: build.php?id=".$id.""); exit; } @@ -184,40 +184,40 @@ if (isset($_POST['name'])) { } if($_GET['add'] == "off" && $hero_info['attack'] < 100) { if($hero_info['points'] > 0) { - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `attack` = `attack` + 1 WHERE `uid` = '" . $database->escape($session->uid) . "'"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `points` = `points` - 1 WHERE `uid` = '" . $database->escape($session->uid) . "'"); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `attack` = `attack` + 1 WHERE `heroid` = " . $hero_info['heroid']); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `points` = `points` - 1 WHERE `heroid` = " . $hero_info['heroid']); header("Location: build.php?id=".$id.""); exit; } } if($_GET['add'] == "deff" && $hero_info['defence'] < 100) { if($hero_info['points'] > 0) { - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `defence` = `defence` + 1 WHERE `uid` = '" . $database->escape($session->uid) . "'"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `points` = `points` - 1 WHERE `uid` = '" . $database->escape($session->uid) . "'"); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `defence` = `defence` + 1 WHERE `heroid` = " . $hero_info['heroid']); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `points` = `points` - 1 WHERE `heroid` = " . $hero_info['heroid']); header("Location: build.php?id=".$id.""); exit; } } if($_GET['add'] == "obonus" && $hero_info['attackbonus'] < 100) { if($hero_info['points'] > 0) { - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `attackbonus` = `attackbonus` + 1 WHERE `uid` = '" . $database->escape($session->uid) . "'"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `points` = `points` - 1 WHERE `uid` = '" . $database->escape($session->uid) . "'"); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `attackbonus` = `attackbonus` + 1 WHERE `heroid` = " . $hero_info['heroid']); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `points` = `points` - 1 WHERE `heroid` = " . $hero_info['heroid']); header("Location: build.php?id=".$id.""); exit; } } if($_GET['add'] == "dbonus" && $hero_info['defencebonus'] < 100) { if($hero_info['points'] > 0) { - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `defencebonus` = `defencebonus` + 1 WHERE `uid` = '" . $database->escape($session->uid) . "'"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `points` = `points` - 1 WHERE `uid` = '" . $database->escape($session->uid) . "'"); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `defencebonus` = `defencebonus` + 1 WHERE `heroid` = " . $hero_info['heroid']); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `points` = `points` - 1 WHERE `heroid` = " . $hero_info['heroid']); header("Location: build.php?id=".$id.""); exit; } } if($_GET['add'] == "reg" && $hero_info['regeneration'] < 100) { if($hero_info['points'] > 0) { - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `regeneration` = `regeneration` + 1 WHERE `uid` = '" . $database->escape($session->uid) . "'"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `points` = `points` - 1 WHERE `uid` = '" . $database->escape($session->uid) . "'"); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `regeneration` = `regeneration` + 1 WHERE `heroid` = " . $hero_info['heroid']); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `points` = `points` - 1 WHERE `heroid` = " . $hero_info['heroid']); header("Location: build.php?id=".$id.""); exit; } From 7e2960afe6c354eca741f3e61130d29dc954f61f Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Fri, 1 Dec 2017 13:55:46 +0100 Subject: [PATCH 099/126] fix: 2nd row of catapults firing when not allowed #393 --- GameEngine/Database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index eb46c265..f6ced345 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -5535,7 +5535,7 @@ References: User ID/Message ID, Mode $t11 = [$t11]; $type = [$type]; $ctar1 = [$ctar1]; - $ctar2 = [$ctar1]; + $ctar2 = [$ctar2]; $spy = [$spy]; $b1 = [$b1]; $b2 = [$b2]; From 680386044e359698de181b7f0a6e57d8b5763821 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Fri, 1 Dec 2017 14:47:43 +0100 Subject: [PATCH 100/126] fix: 2nd wave of catapults destroys targets and villages incorrectly #393 --- GameEngine/Automation.php | 96 +++++++++++++++++++++++---------------- 1 file changed, 56 insertions(+), 40 deletions(-) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index fcc2878e..95b437f9 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -1090,8 +1090,8 @@ class Automation { } // oasis cannot be destroyed + $pop=$this->recountPop($data['to'], false); if ($isoasis == 0) { - $pop=$this->recountPop($data['to'], false); if($pop==0 && $can_destroy==1){ $village_destroyed = 1; // this will ensure the right $info_cat text @@ -2267,6 +2267,9 @@ class Automation { else { // village stands, let's do the damage + /** + * FIRST CATAPULTS ROW + */ $basearray = $data['to']; $bdo = $database->getResourceLevel($basearray, false); $catapultTarget = $data['ctar1']; @@ -2277,15 +2280,12 @@ class Automation { $catapults2TargetRandom = ($catapults2WillNotShoot || $catapultTarget2 == 99); // we're manually targetting 1st and/or 2nd row of catapults - if (!$catapults1TargetRandom || !$catapults2TargetRandom) + if (!$catapults1TargetRandom) { $_catapultsTarget1Levels=array(); $__catapultsTarget1AltTargets=array(); - $_catapultsTarget2Levels=array(); - $__catapultsTarget2AltTargets=array(); - - // calculate targets for 1st and 2nd rows of catapults + // calculate targets for 1st rows of catapults $j=0; for ($i=1;$i<=41;$i++) { @@ -2298,13 +2298,6 @@ class Automation { $_catapultsTarget1Levels[$j]=$bdo['f'.$i]; $__catapultsTarget1AltTargets[$j]=$i; } - - // 2nd row of catapults pre-selected target calculations, if needed - if (!$catapults2TargetRandom && !$catapults2WillNotShoot && $bdo['f'.$i.'t'] == $catapultTarget2 && $bdo['f'.$i] > 0 && $catapultTarget2 != 31 && $catapultTarget2 != 32 && $catapultTarget2 != 33) - { - $_catapultsTarget2Levels[$j]=$bdo['f'.$i]; - $__catapultsTarget2AltTargets[$j]=$i; - } } // if we couldn't find a suitable target for 1st row of catapults, @@ -2321,6 +2314,54 @@ class Automation { $catapults1TargetRandom = true; } } + } + + // 1st row of catapults set to target randomly + if ($catapults1TargetRandom) + { + $list=array(); + for ($i=1;$i<=41;$i++) + { + if ($i==41) $i=99; + if ($bdo['f'.$i] > 0 && $catapultTarget != 31 && $catapultTarget != 32 && $catapultTarget != 33) + { + $list[]=$i; + } + } + $catapultTarget = $list[ rand(0, count($list) - 1) ]; + } + + /** + * resolve 1st row of catapults + */ + $village_destroyed = 0; + $this->resolveCatapultsDestruction($bdo, $battlepart, $info_cat, $data, $catapultTarget, !$catapults2WillNotShoot, false, $catp_pic, $can_destroy, $isoasis, $village_destroyed); + + /** + * SECOND CATAPULTS ROW + */ + // reload resource levels, since they've changed now + $bdo = $database->getResourceLevel($basearray, false); + + // we're manually targetting 2nd row of catapults + if (!$catapults2TargetRandom) + { + $_catapultsTarget2Levels=array(); + $__catapultsTarget2AltTargets=array(); + + // calculate targets for 2nd rows of catapults + $j=0; + for ($i=1;$i<=41;$i++) + { + if ($i==41) $i=99; + + // 2nd row of catapults pre-selected target calculations, if needed + if (!$catapults2TargetRandom && !$catapults2WillNotShoot && $bdo['f'.$i.'t'] == $catapultTarget2 && $bdo['f'.$i] > 0 && $catapultTarget2 != 31 && $catapultTarget2 != 32 && $catapultTarget2 != 33) + { + $_catapultsTarget2Levels[$j]=$bdo['f'.$i]; + $__catapultsTarget2AltTargets[$j]=$i; + } + } // if we couldn't find a suitable target for 2nd row of catapults, // select a random target instead @@ -2338,46 +2379,21 @@ class Automation { } } - // 1st row of catapults set to target randomly - if ($catapults1TargetRandom) - { - $list=array(); - $j = 1; - for ($i=1;$i<=41;$i++) - { - if ($i==41) $i=99; - if ($bdo['f'.$i] > 0 && $catapultTarget != 31 && $catapultTarget != 32 && $catapultTarget != 33) - { - $list[$j]=$i; - $j++; - } - } - $catapultTarget = $list[ rand(1, $j - 1) ]; - } - // 2nd row of catapults set to target randomly if ($catapults2TargetRandom && !$catapults2WillNotShoot) { $list=array(); - $j=1; for ($i=1;$i<=41;$i++) { if ($i==41) $i=99; if ($bdo['f'.$i] > 0) { - $j++; - $list[$j]=$i; + $list[]=$i; } } - $catapultTarget2 = $list[ rand(1, $j - 1) ]; + $catapultTarget2 = $list[ rand(0, count($list) - 1) ]; } - /** - * resolve 1st row of catapults - */ - $village_destroyed = 0; - $this->resolveCatapultsDestruction($bdo, $battlepart, $info_cat, $data, $catapultTarget, !$catapults2WillNotShoot, false, $catp_pic, $can_destroy, $isoasis, $village_destroyed); - /** * resolve 2nd row of catapults */ From 0d65029db4b711dc198c5458187874319c1781b4 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Fri, 1 Dec 2017 19:26:30 +0100 Subject: [PATCH 101/126] fix: adding new village via Admin generates incorrect fields --- GameEngine/Admin/database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GameEngine/Admin/database.php b/GameEngine/Admin/database.php index c3a08562..f47c4bdc 100755 --- a/GameEngine/Admin/database.php +++ b/GameEngine/Admin/database.php @@ -181,7 +181,7 @@ class adm_DB { $username = $database->getUserArray($uid,1); $username = $username['username']; $database->addVillage($wid,$uid,$username,'0'); - $database->addResourceFields($wid,$database->getVillageType($wid)); + $database->addResourceFields($wid,$database->getVillageType($wid, false)); $database->addUnits($wid); $database->addTech($wid); $database->addABTech($wid); From 55a5238a6d8a6a57f7260f68a25f07c7e161697e Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Fri, 1 Dec 2017 19:32:03 +0100 Subject: [PATCH 102/126] chore: create default users with bcrypt enabled by default --- var/db/struct.sql | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/var/db/struct.sql b/var/db/struct.sql index bb472ef5..bcfb1f4b 100644 --- a/var/db/struct.sql +++ b/var/db/struct.sql @@ -1605,11 +1605,11 @@ CREATE TABLE IF NOT EXISTS `%PREFIX%users` ( -- Dumping data for table `%prefix%users` -- -INSERT INTO `%PREFIX%users` (`id`, `username`, `password`, `email`, `tribe`, `access`, `gold`, `gender`, `birthday`, `location`, `desc1`, `desc2`, `plus`, `b1`, `b2`, `b3`, `b4`, `sit1`, `sit2`, `alliance`, `sessid`, `act`, `timestamp`, `ap`, `apall`, `dp`, `dpall`, `protect`, `quest`, `gpack`, `cp`, `lastupdate`, `RR`, `Rc`, `ok`) VALUES -(5, 'Multihunter', '', 'multihunter@travianz.game', 0, 9, 0, 0, '1970-01-01', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'gpack/travian_default/', 1, 0, 0, 0, 0), -(1, 'Support', '', 'support@travianz.game', 0, 8, 0, 0, '1970-01-01', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'gpack/travian_default/', 1, 0, 0, 0, 0), -(2, 'Nature', '', 'nature@travianz.game', 4, 2, 0, 0, '1970-01-01', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'gpack/travian_default/', 1, 0, 0, 0, 0), -(4, 'Taskmaster', '', 'taskmaster@travianz.game', 0, 8, 0, 0, '1970-01-01', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'gpack/travian_default/', 1, 0, 0, 0, 0); +INSERT INTO `%PREFIX%users` (`id`, `username`, `password`, `email`, `tribe`, `access`, `gold`, `gender`, `birthday`, `location`, `desc1`, `desc2`, `plus`, `b1`, `b2`, `b3`, `b4`, `sit1`, `sit2`, `alliance`, `sessid`, `act`, `timestamp`, `ap`, `apall`, `dp`, `dpall`, `protect`, `quest`, `gpack`, `cp`, `lastupdate`, `RR`, `Rc`, `ok`, `is_bcrypt`) VALUES +(5, 'Multihunter', '', 'multihunter@travianz.game', 0, 9, 0, 0, '1970-01-01', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'gpack/travian_default/', 1, 0, 0, 0, 0, 1), +(1, 'Support', '', 'support@travianz.game', 0, 8, 0, 0, '1970-01-01', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'gpack/travian_default/', 1, 0, 0, 0, 0, 1), +(2, 'Nature', '', 'nature@travianz.game', 4, 2, 0, 0, '1970-01-01', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'gpack/travian_default/', 1, 0, 0, 0, 0, 1), +(4, 'Taskmaster', '', 'taskmaster@travianz.game', 0, 8, 0, 0, '1970-01-01', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'gpack/travian_default/', 1, 0, 0, 0, 0, 1); -- -------------------------------------------------------- From f32101b685a954cb818ee188031ba6b1d1af939d Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Fri, 1 Dec 2017 19:51:05 +0100 Subject: [PATCH 103/126] fix: in-game Support login fails --- GameEngine/Session.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/GameEngine/Session.php b/GameEngine/Session.php index e66ed563..abff455c 100755 --- a/GameEngine/Session.php +++ b/GameEngine/Session.php @@ -180,7 +180,7 @@ class Session { if($user && ($admin || isset($_SESSION['sessid']))) { // check if this is not a support user, for who only messages and statistics are available - if ($user == 1) { + if ($user == 'Support') { $req_file = basename($_SERVER['PHP_SELF']); if (!in_array($req_file, ['nachrichten.php', 'logout.php', 'statistiken.php', 'rules.php', 'karte.php', 'karte2.php', 'spieler.php'])) { header('Location:nachrichten.php'); @@ -269,7 +269,9 @@ class Session { if($this->userarray['b4'] > $this->time) { $this->bonus4 = 1; } - $this->CheckHeroReal(); + if (!in_array($this->username, ['Support', 'Multihunter'])) { + $this->CheckHeroReal(); + } } private function SurfControl(){ From 50709a34f01788ed4d07b8d87e194b6f5cb23a75 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Fri, 1 Dec 2017 19:55:24 +0100 Subject: [PATCH 104/126] fix: wrong password verify check allows for any login --- GameEngine/Account.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/GameEngine/Account.php b/GameEngine/Account.php index e498ee17..b730be41 100755 --- a/GameEngine/Account.php +++ b/GameEngine/Account.php @@ -218,6 +218,8 @@ class Account { if ( $activateData != "" ) { $form->addError( "activate", $_POST['user'] ); + } else { + $form->addError("pw",LOGIN_PW_ERROR); } } else { $form->addError("pw",LOGIN_PW_ERROR); From a321906d41e07028a5e50e53d9f3378e971e6ad5 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Fri, 1 Dec 2017 19:57:57 +0100 Subject: [PATCH 105/126] catching up (#4) * fix: all languages added to installer * fix: all languages added to installer and Admin * fix: max crop/resources reset to level 1 value temporarily This happened when level 1 granary / warehouse was built because of a missing + sign in a formula. #374 * chore: some more badges and thanks to JetBrains :) * chore: one more badge :P * chore: cleanup * fix: Multihunter should have access to villages info * fix: troops duplicate for certain tribes via raid lists * fix: no need for WW Building Plan to start building a WW #337 * fix: natar WW villages created without units #392 * fix: sendunits.txt file could not be opened from Admin * fix: WW villages created via Admin do not have any units #392 * fix: WW building plans must be in player's village to start building WW #337 * fix: hero training and revival misbehaving * fix: spending hero points subtracts these from all player's heroes #341 * fix: 2nd row of catapults firing when not allowed #393 * fix: 2nd wave of catapults destroys targets and villages incorrectly #393 * fix: adding new village via Admin generates incorrect fields * chore: create default users with bcrypt enabled by default * fix: in-game Support login fails * fix: wrong password verify check allows for any login --- GameEngine/Account.php | 2 + GameEngine/Admin/database.php | 2 +- GameEngine/Automation.php | 96 ++++++++++++++++++------------- GameEngine/Database.php | 2 +- GameEngine/Session.php | 6 +- Templates/Build/37.tpl | 104 ++++++++++++++++++++-------------- Templates/Build/37_hero.tpl | 35 ++++++------ Templates/Build/37_revive.tpl | 1 - Templates/Build/37_train.tpl | 34 +++++------ var/db/struct.sql | 10 ++-- 10 files changed, 166 insertions(+), 126 deletions(-) diff --git a/GameEngine/Account.php b/GameEngine/Account.php index e498ee17..b730be41 100755 --- a/GameEngine/Account.php +++ b/GameEngine/Account.php @@ -218,6 +218,8 @@ class Account { if ( $activateData != "" ) { $form->addError( "activate", $_POST['user'] ); + } else { + $form->addError("pw",LOGIN_PW_ERROR); } } else { $form->addError("pw",LOGIN_PW_ERROR); diff --git a/GameEngine/Admin/database.php b/GameEngine/Admin/database.php index c3a08562..f47c4bdc 100755 --- a/GameEngine/Admin/database.php +++ b/GameEngine/Admin/database.php @@ -181,7 +181,7 @@ class adm_DB { $username = $database->getUserArray($uid,1); $username = $username['username']; $database->addVillage($wid,$uid,$username,'0'); - $database->addResourceFields($wid,$database->getVillageType($wid)); + $database->addResourceFields($wid,$database->getVillageType($wid, false)); $database->addUnits($wid); $database->addTech($wid); $database->addABTech($wid); diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index fcc2878e..95b437f9 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -1090,8 +1090,8 @@ class Automation { } // oasis cannot be destroyed + $pop=$this->recountPop($data['to'], false); if ($isoasis == 0) { - $pop=$this->recountPop($data['to'], false); if($pop==0 && $can_destroy==1){ $village_destroyed = 1; // this will ensure the right $info_cat text @@ -2267,6 +2267,9 @@ class Automation { else { // village stands, let's do the damage + /** + * FIRST CATAPULTS ROW + */ $basearray = $data['to']; $bdo = $database->getResourceLevel($basearray, false); $catapultTarget = $data['ctar1']; @@ -2277,15 +2280,12 @@ class Automation { $catapults2TargetRandom = ($catapults2WillNotShoot || $catapultTarget2 == 99); // we're manually targetting 1st and/or 2nd row of catapults - if (!$catapults1TargetRandom || !$catapults2TargetRandom) + if (!$catapults1TargetRandom) { $_catapultsTarget1Levels=array(); $__catapultsTarget1AltTargets=array(); - $_catapultsTarget2Levels=array(); - $__catapultsTarget2AltTargets=array(); - - // calculate targets for 1st and 2nd rows of catapults + // calculate targets for 1st rows of catapults $j=0; for ($i=1;$i<=41;$i++) { @@ -2298,13 +2298,6 @@ class Automation { $_catapultsTarget1Levels[$j]=$bdo['f'.$i]; $__catapultsTarget1AltTargets[$j]=$i; } - - // 2nd row of catapults pre-selected target calculations, if needed - if (!$catapults2TargetRandom && !$catapults2WillNotShoot && $bdo['f'.$i.'t'] == $catapultTarget2 && $bdo['f'.$i] > 0 && $catapultTarget2 != 31 && $catapultTarget2 != 32 && $catapultTarget2 != 33) - { - $_catapultsTarget2Levels[$j]=$bdo['f'.$i]; - $__catapultsTarget2AltTargets[$j]=$i; - } } // if we couldn't find a suitable target for 1st row of catapults, @@ -2321,6 +2314,54 @@ class Automation { $catapults1TargetRandom = true; } } + } + + // 1st row of catapults set to target randomly + if ($catapults1TargetRandom) + { + $list=array(); + for ($i=1;$i<=41;$i++) + { + if ($i==41) $i=99; + if ($bdo['f'.$i] > 0 && $catapultTarget != 31 && $catapultTarget != 32 && $catapultTarget != 33) + { + $list[]=$i; + } + } + $catapultTarget = $list[ rand(0, count($list) - 1) ]; + } + + /** + * resolve 1st row of catapults + */ + $village_destroyed = 0; + $this->resolveCatapultsDestruction($bdo, $battlepart, $info_cat, $data, $catapultTarget, !$catapults2WillNotShoot, false, $catp_pic, $can_destroy, $isoasis, $village_destroyed); + + /** + * SECOND CATAPULTS ROW + */ + // reload resource levels, since they've changed now + $bdo = $database->getResourceLevel($basearray, false); + + // we're manually targetting 2nd row of catapults + if (!$catapults2TargetRandom) + { + $_catapultsTarget2Levels=array(); + $__catapultsTarget2AltTargets=array(); + + // calculate targets for 2nd rows of catapults + $j=0; + for ($i=1;$i<=41;$i++) + { + if ($i==41) $i=99; + + // 2nd row of catapults pre-selected target calculations, if needed + if (!$catapults2TargetRandom && !$catapults2WillNotShoot && $bdo['f'.$i.'t'] == $catapultTarget2 && $bdo['f'.$i] > 0 && $catapultTarget2 != 31 && $catapultTarget2 != 32 && $catapultTarget2 != 33) + { + $_catapultsTarget2Levels[$j]=$bdo['f'.$i]; + $__catapultsTarget2AltTargets[$j]=$i; + } + } // if we couldn't find a suitable target for 2nd row of catapults, // select a random target instead @@ -2338,46 +2379,21 @@ class Automation { } } - // 1st row of catapults set to target randomly - if ($catapults1TargetRandom) - { - $list=array(); - $j = 1; - for ($i=1;$i<=41;$i++) - { - if ($i==41) $i=99; - if ($bdo['f'.$i] > 0 && $catapultTarget != 31 && $catapultTarget != 32 && $catapultTarget != 33) - { - $list[$j]=$i; - $j++; - } - } - $catapultTarget = $list[ rand(1, $j - 1) ]; - } - // 2nd row of catapults set to target randomly if ($catapults2TargetRandom && !$catapults2WillNotShoot) { $list=array(); - $j=1; for ($i=1;$i<=41;$i++) { if ($i==41) $i=99; if ($bdo['f'.$i] > 0) { - $j++; - $list[$j]=$i; + $list[]=$i; } } - $catapultTarget2 = $list[ rand(1, $j - 1) ]; + $catapultTarget2 = $list[ rand(0, count($list) - 1) ]; } - /** - * resolve 1st row of catapults - */ - $village_destroyed = 0; - $this->resolveCatapultsDestruction($bdo, $battlepart, $info_cat, $data, $catapultTarget, !$catapults2WillNotShoot, false, $catp_pic, $can_destroy, $isoasis, $village_destroyed); - /** * resolve 2nd row of catapults */ diff --git a/GameEngine/Database.php b/GameEngine/Database.php index eb46c265..f6ced345 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -5535,7 +5535,7 @@ References: User ID/Message ID, Mode $t11 = [$t11]; $type = [$type]; $ctar1 = [$ctar1]; - $ctar2 = [$ctar1]; + $ctar2 = [$ctar2]; $spy = [$spy]; $b1 = [$b1]; $b2 = [$b2]; diff --git a/GameEngine/Session.php b/GameEngine/Session.php index e66ed563..abff455c 100755 --- a/GameEngine/Session.php +++ b/GameEngine/Session.php @@ -180,7 +180,7 @@ class Session { if($user && ($admin || isset($_SESSION['sessid']))) { // check if this is not a support user, for who only messages and statistics are available - if ($user == 1) { + if ($user == 'Support') { $req_file = basename($_SERVER['PHP_SELF']); if (!in_array($req_file, ['nachrichten.php', 'logout.php', 'statistiken.php', 'rules.php', 'karte.php', 'karte2.php', 'spieler.php'])) { header('Location:nachrichten.php'); @@ -269,7 +269,9 @@ class Session { if($this->userarray['b4'] > $this->time) { $this->bonus4 = 1; } - $this->CheckHeroReal(); + if (!in_array($this->username, ['Support', 'Multihunter'])) { + $this->CheckHeroReal(); + } } private function SurfControl(){ diff --git a/Templates/Build/37.tpl b/Templates/Build/37.tpl index c9ac1231..c7abd466 100644 --- a/Templates/Build/37.tpl +++ b/Templates/Build/37.tpl @@ -8,7 +8,8 @@ | Copyright: TravianX Project All rights reserved | \*-------------------------------------------------------*/ - $hero_info = $units->Hero($session->uid, 0, true); + $hero_info = $units->Hero($session->uid); + $heroes = $units->Hero($session->uid, 1); $define['reset_level'] = 3; // Until which level you are able to reset your points ?> @@ -22,47 +23,70 @@

    - getTimeFormat($hero_info['trainingtime'] - time()); + $include_training = true; + $include_revive = false; + foreach ($heroes as $hdata) { + if ($hdata['dead'] == 1) { + $include_revive = true; + } + + if ($hdata['inrevive'] == 1) { + $name1 = $hdata['name']; + $include_training = false; + } + } + + if($hero_info === false && $include_revive){ + include_once("37_revive.tpl"); + } + + if ($hero_info === false && $include_training) { + include_once("37_train.tpl"); + } else if($hero_info['intraining'] == 1) { + + $timeleft = $generator->getTimeFormat($hero_info['trainingtime'] - time()); ?>
    @@ -85,9 +109,7 @@
    escape($_POST['name']))."' where `uid`='".$database->escape($session->uid)."' AND dead = 0") or die("ERROR:".mysqli_error($database->dblink)); echo "".NAME_CHANGED.""; -} - $hero_info = $units->Hero($session->uid); +} ?> @@ -172,12 +171,12 @@ if (isset($_POST['name'])) { if($_GET['add'] == "reset") { if($hero_info['level'] <= 3){ if($hero_info['attack'] != 0 OR $hero_info['defence'] != 0 OR $hero_info['attackbonus'] != 0 OR $hero_info['defencebonus'] != 0 OR $hero_info['regeneration'] != 0){ - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `points` = '".(($hero_info['level']*5)+5)."' WHERE `uid` = '" . $database->escape($session->uid) . "'"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `attack` = '0' WHERE `uid` = '" . $database->escape($session->uid) . "'"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `defence` = '0' WHERE `uid` = '" . $database->escape($session->uid) . "'"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `attackbonus` = '0' WHERE `uid` = '" . $database->escape($session->uid) . "'"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `defencebonus` = '0' WHERE `uid` = '" . $database->escape($session->uid) . "'"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `regeneration` = '0' WHERE `uid` = '" . $database->escape($session->uid) . "'"); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `points` = '".(($hero_info['level']*5)+5)."' WHERE `heroid` = " . $hero_info['heroid']); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `attack` = '0' WHERE `heroid` = " . $hero_info['heroid']); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `defence` = '0' WHERE `heroid` = " . $hero_info['heroid']); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `attackbonus` = '0' WHERE `heroid` = " . $hero_info['heroid']); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `defencebonus` = '0' WHERE `heroid` = " . $hero_info['heroid']); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `regeneration` = '0' WHERE `heroid` = " . $hero_info['heroid']); header("Location: build.php?id=".$id.""); exit; } @@ -185,40 +184,40 @@ if (isset($_POST['name'])) { } if($_GET['add'] == "off" && $hero_info['attack'] < 100) { if($hero_info['points'] > 0) { - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `attack` = `attack` + 1 WHERE `uid` = '" . $database->escape($session->uid) . "'"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `points` = `points` - 1 WHERE `uid` = '" . $database->escape($session->uid) . "'"); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `attack` = `attack` + 1 WHERE `heroid` = " . $hero_info['heroid']); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `points` = `points` - 1 WHERE `heroid` = " . $hero_info['heroid']); header("Location: build.php?id=".$id.""); exit; } } if($_GET['add'] == "deff" && $hero_info['defence'] < 100) { if($hero_info['points'] > 0) { - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `defence` = `defence` + 1 WHERE `uid` = '" . $database->escape($session->uid) . "'"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `points` = `points` - 1 WHERE `uid` = '" . $database->escape($session->uid) . "'"); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `defence` = `defence` + 1 WHERE `heroid` = " . $hero_info['heroid']); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `points` = `points` - 1 WHERE `heroid` = " . $hero_info['heroid']); header("Location: build.php?id=".$id.""); exit; } } if($_GET['add'] == "obonus" && $hero_info['attackbonus'] < 100) { if($hero_info['points'] > 0) { - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `attackbonus` = `attackbonus` + 1 WHERE `uid` = '" . $database->escape($session->uid) . "'"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `points` = `points` - 1 WHERE `uid` = '" . $database->escape($session->uid) . "'"); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `attackbonus` = `attackbonus` + 1 WHERE `heroid` = " . $hero_info['heroid']); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `points` = `points` - 1 WHERE `heroid` = " . $hero_info['heroid']); header("Location: build.php?id=".$id.""); exit; } } if($_GET['add'] == "dbonus" && $hero_info['defencebonus'] < 100) { if($hero_info['points'] > 0) { - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `defencebonus` = `defencebonus` + 1 WHERE `uid` = '" . $database->escape($session->uid) . "'"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `points` = `points` - 1 WHERE `uid` = '" . $database->escape($session->uid) . "'"); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `defencebonus` = `defencebonus` + 1 WHERE `heroid` = " . $hero_info['heroid']); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `points` = `points` - 1 WHERE `heroid` = " . $hero_info['heroid']); header("Location: build.php?id=".$id.""); exit; } } if($_GET['add'] == "reg" && $hero_info['regeneration'] < 100) { if($hero_info['points'] > 0) { - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `regeneration` = `regeneration` + 1 WHERE `uid` = '" . $database->escape($session->uid) . "'"); - mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `points` = `points` - 1 WHERE `uid` = '" . $database->escape($session->uid) . "'"); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `regeneration` = `regeneration` + 1 WHERE `heroid` = " . $hero_info['heroid']); + mysqli_query($GLOBALS['link'],"UPDATE " . TB_PREFIX . "hero SET `points` = `points` - 1 WHERE `heroid` = " . $hero_info['heroid']); header("Location: build.php?id=".$id.""); exit; } diff --git a/Templates/Build/37_revive.tpl b/Templates/Build/37_revive.tpl index d8378058..fd9c8d1c 100644 --- a/Templates/Build/37_revive.tpl +++ b/Templates/Build/37_revive.tpl @@ -29,7 +29,6 @@ | Dzoki < dzoki.travian@gmail.com > | | Copyright: TravianX Project All rights reserved | \*-------------------------------------------------------*/ - $heroes = $units->Hero($session->uid, 1); // check if there is a hero in revive already $reviving = false; diff --git a/Templates/Build/37_train.tpl b/Templates/Build/37_train.tpl index 4806dc77..7c2c34bb 100644 --- a/Templates/Build/37_train.tpl +++ b/Templates/Build/37_train.tpl @@ -34,8 +34,8 @@ //check if there is unit needed in the village -$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."units WHERE `vref` = ".(int) $village->wid.""); -$units = mysqli_fetch_array($result); +$result = mysqli_query($GLOBALS['link'],"SELECT * FROM ".TB_PREFIX."units WHERE `vref` = ".(int) $village->wid.""); +$units_array = mysqli_fetch_array($result); $count_hero = mysqli_fetch_array(mysqli_query($GLOBALS['link'],"SELECT Count(*) as Total FROM " . TB_PREFIX . "hero WHERE `uid` = " . $database->escape($session->uid) . ""), MYSQLI_ASSOC); $count_hero = $count_hero['Total']; @@ -75,7 +75,7 @@ if($session->tribe == 1) { if($village->awood < $u1['wood'] || $village->aclay < $u1['clay'] || $village->airon < $u1['iron'] || $village->acrop < $u1['crop']) $output.="".NOT."".ENOUGH_RESOURCES.""; - elseif($units['u1'] == 0) + elseif( $units_array['u1'] == 0) $output.="".NOT_UNITS.""; else $output.="".TRAIN.""; @@ -112,7 +112,7 @@ if($session->tribe == 1) { if($village->awood < $u2['wood'] OR $village->aclay < $u2['clay'] OR $village->airon < $u2['iron'] OR $village->acrop < $u2['crop']) $output.="".NOT."".ENOUGH_RESOURCES.""; - elseif($units['u2'] == 0) + elseif( $units_array['u2'] == 0) $output.="".NOT_UNITS.""; else $output.="".TRAIN.""; @@ -150,7 +150,7 @@ if($session->tribe == 1) { if($village->awood < $u3['wood'] OR $village->aclay < $u3['clay'] OR $village->airon < $u3['iron'] OR $village->acrop < $u3['crop']) { $output.="".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u3'] == 0){ + }else if( $units_array['u3'] == 0){ $output.="".NOT_UNITS.""; }else { $output.="".TRAIN.""; @@ -187,7 +187,7 @@ if($session->tribe == 1) { if($village->awood < $u5['wood'] OR $village->aclay < $u5['clay'] OR $village->airon < $u5['iron'] OR $village->acrop < $u5['crop']) { $output.= "".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u5'] == 0){ + }else if( $units_array['u5'] == 0){ $output.= "".NOT_UNITS.""; }else { $output.= "".TRAIN.""; @@ -224,7 +224,7 @@ if($session->tribe == 1) { if($village->awood < $u6['wood'] OR $village->aclay < $u6['clay'] OR $village->airon < $u6['iron'] OR $village->acrop < $u6['crop']) { $output.= "".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u6'] == 0){ + }else if( $units_array['u6'] == 0){ $output.= "".NOT_UNITS.""; }else { $output.= "".TRAIN.""; @@ -264,7 +264,7 @@ $output.=" if($village->awood < $u11['wood'] OR $village->aclay < $u11['clay'] OR $village->airon < $u11['iron'] OR $village->acrop < $u11['crop']) { $output.= "".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u11'] == 0){ + }else if( $units_array['u11'] == 0){ $output.= "".NOT_UNITS.""; }else { $output.= "".TRAIN.""; @@ -301,7 +301,7 @@ $output.=" if($village->awood < $u12['wood'] OR $village->aclay < $u12['clay'] OR $village->airon < $u12['iron'] OR $village->acrop < $u12['crop']) { $output.= "".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u12'] == 0){ + }else if( $units_array['u12'] == 0){ $output.= "".NOT_UNITS.""; }else { $output.= "".TRAIN.""; @@ -340,7 +340,7 @@ $output.=" if($village->awood < $u13['wood'] OR $village->aclay < $u13['clay'] OR $village->airon < $u13['iron'] OR $village->acrop < $u13['crop']) { $output.= "".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u13'] == 0){ + }else if( $units_array['u13'] == 0){ $output.= "".NOT_UNITS.""; }else { $output.= "".TRAIN.""; @@ -377,7 +377,7 @@ $output.=" if($village->awood < $u15['wood'] OR $village->aclay < $u15['clay'] OR $village->airon < $u15['iron'] OR $village->acrop < $u15['crop']) { $output.= "".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u15'] == 0){ + }else if( $units_array['u15'] == 0){ $output.= "".NOT_UNITS.""; }else { $output.= "".TRAIN.""; @@ -415,7 +415,7 @@ $output.=" if($village->awood < $u16['wood'] OR $village->aclay < $u16['clay'] OR $village->airon < $u16['iron'] OR $village->acrop < $u16['crop']) { $output.= "".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u16'] == 0){ + }else if( $units_array['u16'] == 0){ $output.= "".NOT_UNITS.""; }else { $output.= "".TRAIN.""; @@ -455,7 +455,7 @@ $output.=" if($village->awood < $u21['wood'] OR $village->aclay < $u21['clay'] OR $village->airon < $u21['iron'] OR $village->acrop < $u21['crop']) { $output.= "".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u21'] == 0){ + }else if( $units_array['u21'] == 0){ $output.= "".NOT_UNITS.""; }else { $output.= "".TRAIN.""; @@ -492,7 +492,7 @@ $output.=" if($village->awood < $u22['wood'] OR $village->aclay < $u22['clay'] OR $village->airon < $u22['iron'] OR $village->acrop < $u22['crop']) { $output.= "".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u22'] == 0){ + }else if( $units_array['u22'] == 0){ $output.= "".NOT_UNITS.""; }else { $output.= "".TRAIN.""; @@ -530,7 +530,7 @@ $output.=" if($village->awood < $u24['wood'] OR $village->aclay < $u24['clay'] OR $village->airon < $u24['iron'] OR $village->acrop < $u24['crop']) { $output.= "".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u24'] == 0){ + }else if( $units_array['u24'] == 0){ $output.= "".NOT_UNITS.""; }else { $output.= "".TRAIN.""; @@ -567,7 +567,7 @@ $output.=" if($village->awood < $u25['wood'] OR $village->aclay < $u25['clay'] OR $village->airon < $u25['iron'] OR $village->acrop < $u25['crop']) { $output.= "".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u25'] == 0){ + }else if( $units_array['u25'] == 0){ $output.= "".NOT_UNITS.""; }else { $output.= "".TRAIN.""; @@ -605,7 +605,7 @@ $output.=" if($village->awood < $u26['wood'] OR $village->aclay < $u26['clay'] OR $village->airon < $u26['iron'] OR $village->acrop < $u26['crop']) { $output.= "".NOT."".ENOUGH_RESOURCES.""; - }else if($units['u26'] == 0){ + }else if( $units_array['u26'] == 0){ $output.= "".NOT_UNITS.""; }else { $output.= "".TRAIN.""; diff --git a/var/db/struct.sql b/var/db/struct.sql index bb472ef5..bcfb1f4b 100644 --- a/var/db/struct.sql +++ b/var/db/struct.sql @@ -1605,11 +1605,11 @@ CREATE TABLE IF NOT EXISTS `%PREFIX%users` ( -- Dumping data for table `%prefix%users` -- -INSERT INTO `%PREFIX%users` (`id`, `username`, `password`, `email`, `tribe`, `access`, `gold`, `gender`, `birthday`, `location`, `desc1`, `desc2`, `plus`, `b1`, `b2`, `b3`, `b4`, `sit1`, `sit2`, `alliance`, `sessid`, `act`, `timestamp`, `ap`, `apall`, `dp`, `dpall`, `protect`, `quest`, `gpack`, `cp`, `lastupdate`, `RR`, `Rc`, `ok`) VALUES -(5, 'Multihunter', '', 'multihunter@travianz.game', 0, 9, 0, 0, '1970-01-01', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'gpack/travian_default/', 1, 0, 0, 0, 0), -(1, 'Support', '', 'support@travianz.game', 0, 8, 0, 0, '1970-01-01', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'gpack/travian_default/', 1, 0, 0, 0, 0), -(2, 'Nature', '', 'nature@travianz.game', 4, 2, 0, 0, '1970-01-01', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'gpack/travian_default/', 1, 0, 0, 0, 0), -(4, 'Taskmaster', '', 'taskmaster@travianz.game', 0, 8, 0, 0, '1970-01-01', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'gpack/travian_default/', 1, 0, 0, 0, 0); +INSERT INTO `%PREFIX%users` (`id`, `username`, `password`, `email`, `tribe`, `access`, `gold`, `gender`, `birthday`, `location`, `desc1`, `desc2`, `plus`, `b1`, `b2`, `b3`, `b4`, `sit1`, `sit2`, `alliance`, `sessid`, `act`, `timestamp`, `ap`, `apall`, `dp`, `dpall`, `protect`, `quest`, `gpack`, `cp`, `lastupdate`, `RR`, `Rc`, `ok`, `is_bcrypt`) VALUES +(5, 'Multihunter', '', 'multihunter@travianz.game', 0, 9, 0, 0, '1970-01-01', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'gpack/travian_default/', 1, 0, 0, 0, 0, 1), +(1, 'Support', '', 'support@travianz.game', 0, 8, 0, 0, '1970-01-01', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'gpack/travian_default/', 1, 0, 0, 0, 0, 1), +(2, 'Nature', '', 'nature@travianz.game', 4, 2, 0, 0, '1970-01-01', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'gpack/travian_default/', 1, 0, 0, 0, 0, 1), +(4, 'Taskmaster', '', 'taskmaster@travianz.game', 0, 8, 0, 0, '1970-01-01', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '', '', 0, 0, 0, 0, 0, 0, 0, 'gpack/travian_default/', 1, 0, 0, 0, 0, 1); -- -------------------------------------------------------- From cbc404e74035bc778c0ae81a8bcb31274b2827f7 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Fri, 1 Dec 2017 21:29:26 +0100 Subject: [PATCH 106/126] fix: warning with 0 heroes #341 --- Templates/Build/37.tpl | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Templates/Build/37.tpl b/Templates/Build/37.tpl index c7abd466..45654d3a 100644 --- a/Templates/Build/37.tpl +++ b/Templates/Build/37.tpl @@ -67,14 +67,16 @@ } else { $include_training = true; $include_revive = false; - foreach ($heroes as $hdata) { - if ($hdata['dead'] == 1) { - $include_revive = true; - } + if (isset($heroes) && is_array($heroes) && count($heroes)) { + foreach ( $heroes as $hdata ) { + if ( $hdata['dead'] == 1 ) { + $include_revive = true; + } - if ($hdata['inrevive'] == 1) { - $name1 = $hdata['name']; - $include_training = false; + if ( $hdata['inrevive'] == 1 ) { + $name1 = $hdata['name']; + $include_training = false; + } } } From a948537056f97ee093ca5714807d3f2b2d650437 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 2 Dec 2017 10:45:20 +0100 Subject: [PATCH 107/126] fix: embassy checks performed on non-alliance players #399 --- GameEngine/Database.php | 488 ++++++++++++++++++++-------------------- 1 file changed, 245 insertions(+), 243 deletions(-) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index f6ced345..d72f48c1 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -4467,8 +4467,8 @@ References: User ID/Message ID, Mode global $building, $village, $session; - // check if we're not demolishing an Embassy - if ($this->getFieldType($wid,$field) == 18) { + // check if we're not demolishing an Embassy if the player is in an alliance + if ($this->getFieldType($wid,$field) == 18 && $session->alliance) { // get field level, alliance members count and the minimum // level of Embassy to be able to hold this number of people @@ -4636,267 +4636,269 @@ References: User ID/Message ID, Mode // TODO: refactor this and break it into more smaler methods global $session; - // check whether this player is an alliance owner - $isOwner = ($userData['alliance'] && $this->isAllianceOwner($userData['id'], $use_cache) == $userData['alliance']); + if ($userData['alliance']) { + // check whether this player is an alliance owner + $isOwner = ($userData['alliance'] && $this->isAllianceOwner($userData['id'], $use_cache) == $userData['alliance']); - // for demolition, the Embassy was already destroyed, so we need at least 1 - // Embassy still standing... for battle, the Embassy is still standing - // and will only be deleted upon finalizing battle calculations, so we need - // to check for at least 2 Embassies - $minimumExistingEmbassyRecords = ($demolition ? 1 : 2); + // for demolition, the Embassy was already destroyed, so we need at least 1 + // Embassy still standing... for battle, the Embassy is still standing + // and will only be deleted upon finalizing battle calculations, so we need + // to check for at least 2 Embassies + $minimumExistingEmbassyRecords = ($demolition ? 1 : 2); - // if they are not an alliance owner, simply check whether we have any Embassies - // at lvl 1+ standing somewhere - if (!$isOwner) { - // TODO: replace magic numbers by constants (18 = Embassy) - if ($this->getSingleFieldTypeCount($userData['id'], 18, '>=', 1, $use_cache) < $minimumExistingEmbassyRecords) { + // if they are not an alliance owner, simply check whether we have any Embassies + // at lvl 1+ standing somewhere + if (!$isOwner) { + // TODO: replace magic numbers by constants (18 = Embassy) + if ($this->getSingleFieldTypeCount($userData['id'], 18, '>=', 1, $use_cache) < $minimumExistingEmbassyRecords) { - // the player has no more Embassies, evict them from the alliance - mysqli_query($this->dblink, 'UPDATE '.TB_PREFIX.'users SET alliance = 0 WHERE id = '.$userData['id']); + // the player has no more Embassies, evict them from the alliance + mysqli_query($this->dblink, 'UPDATE '.TB_PREFIX.'users SET alliance = 0 WHERE id = '.$userData['id']); - // unset the alliance in session, if we're evicting - // currently logged-in player - if ($session->uid == $userData['id']) { - $_SESSION['alliance_user'] = 0; - } + // unset the alliance in session, if we're evicting + // currently logged-in player + if ($session->uid == $userData['id']) { + $_SESSION['alliance_user'] = 0; + } - // notify them via in-game messaging, if we come from a demolition, - // otherwise return a result which can be used in battle reports - if ($demolition) { - $this->sendMessage( - $userData['id'], - 4, - 'You left the alliance', - $this->escape("Hi, ".$userData['username']."!\n\nThis is to inform you that due to a finished demolition of your last Embassy, you have now successfully left your alliance.\n\nYours sincerely,\nServer Robot :)"), - 0, - 0, - 0, - 0, - 0, - true); - } else { - // player has been removed from the alliance - $this->sendMessage( - $userData['id'], - 4, - 'An attack has forced you to leave the alliance', - $this->escape("Hi, ".$userData['username']."!\n\nThis is to inform you that due to a successful attack and destruction of your last Embassy, you have been forced to leave your alliance.\n\nTo re-establish your position in this alliance, you will need to build a new Embassy and ask the leader to send you an invite again.\n\nYours sincerely,\nServer Robot :)"), - 0, - 0, - 0, - 0, - 0, - true); + // notify them via in-game messaging, if we come from a demolition, + // otherwise return a result which can be used in battle reports + if ($demolition) { + $this->sendMessage( + $userData['id'], + 4, + 'You left the alliance', + $this->escape("Hi, ".$userData['username']."!\n\nThis is to inform you that due to a finished demolition of your last Embassy, you have now successfully left your alliance.\n\nYours sincerely,\nServer Robot :)"), + 0, + 0, + 0, + 0, + 0, + true); + } else { + // player has been removed from the alliance + $this->sendMessage( + $userData['id'], + 4, + 'An attack has forced you to leave the alliance', + $this->escape("Hi, ".$userData['username']."!\n\nThis is to inform you that due to a successful attack and destruction of your last Embassy, you have been forced to leave your alliance.\n\nTo re-establish your position in this alliance, you will need to build a new Embassy and ask the leader to send you an invite again.\n\nYours sincerely,\nServer Robot :)"), + 0, + 0, + 0, + 0, + 0, + true); - return 0; - } + return 0; + } - } - } else { - // the player IS an alliance owner, check if we need to take any action - $membersCount = $this->countAllianceMembers($userData['alliance'], $use_cache); - $minAllianceEmbassyLevel = $this->getMinEmbassyLevel($membersCount); + } + } else { + // the player IS an alliance owner, check if we need to take any action + $membersCount = $this->countAllianceMembers($userData['alliance'], $use_cache); + $minAllianceEmbassyLevel = $this->getMinEmbassyLevel($membersCount); - // in this case, the minimum Embassy level cannot go below 3, - // since this player is a leader and as such, he needs at least - // a level 3 Embassy - if ($minAllianceEmbassyLevel < 3) { - $minAllianceEmbassyLevel = 3; - } + // in this case, the minimum Embassy level cannot go below 3, + // since this player is a leader and as such, he needs at least + // a level 3 Embassy + if ($minAllianceEmbassyLevel < 3) { + $minAllianceEmbassyLevel = 3; + } - $takeAction = ( - // was the Embassy taken below a threshold level? - ($userData['lvl'] <= $minAllianceEmbassyLevel) - && - // check for standing Embassies with sufficient level - // TODO: replace magic numbers by constants (18 = Embassy) - ($this->getSingleFieldTypeCount($userData['id'], 18, '>=', $minAllianceEmbassyLevel, false, $use_cache) < $minimumExistingEmbassyRecords) - ); + $takeAction = ( + // was the Embassy taken below a threshold level? + ($userData['lvl'] <= $minAllianceEmbassyLevel) + && + // check for standing Embassies with sufficient level + // TODO: replace magic numbers by constants (18 = Embassy) + ($this->getSingleFieldTypeCount($userData['id'], 18, '>=', $minAllianceEmbassyLevel, false, $use_cache) < $minimumExistingEmbassyRecords) + ); - // the Embassy got damaged below a sufficient level and there are no more Embassies - // at that level standing on this player's account, additional actions are needed - if ($takeAction) { + // the Embassy got damaged below a sufficient level and there are no more Embassies + // at that level standing on this player's account, additional actions are needed + if ($takeAction) { - // load all alliance members - $members = $this->getAllMember($userData['alliance'], 0, $use_cache); + // load all alliance members + $members = $this->getAllMember($userData['alliance'], 0, $use_cache); - // if we come from demolition, we need to evict all new members - // that accepted an invitation while level 3 of the last - // Embassy was already under demolition. The demolition dialog itself - // already checks if there are no more people other than the owner - // present before the demolition is allowed. - if ($demolition) { - $evicts = []; - foreach ($members as $member) { - // evict the player from the alliance - $evicts[] = $member['id']; + // if we come from demolition, we need to evict all new members + // that accepted an invitation while level 3 of the last + // Embassy was already under demolition. The demolition dialog itself + // already checks if there are no more people other than the owner + // present before the demolition is allowed. + if ($demolition) { + $evicts = []; + foreach ($members as $member) { + // evict the player from the alliance + $evicts[] = $member['id']; - // notify them via in-game messaging - $this->sendMessage( - $member['id'], - 4, - 'Your alliance was disbanded', - ( - ($member['id'] == $userData['id']) - ? - $this->escape("Hi, ".$userData['username']."!\n\nThis is to inform you that due to a finished demolition of your last Embassy at level 3, and the fact that you were the leader of your alliance, this alliance has been disbanded.\n\nIn order to found a new alliance, please build a level 3 Embassy again in one of your villages.\n\nYours sincerely,\nServer Robot :)") - : - $this->escape("Hi, ".$member['username']."!\n\nThis is to inform you that due to a demolition of your alliance founder's last Embassy below level 3, this alliance has been disbanded.\n\n\You can now accept invitations from other alliances or found a new alliance yourself.\n\nYours sincerely,\nServer Robot :)") - ), - 0, - 0, - 0, - 0, - 0, - true); - } - - mysqli_query($this->dblink, 'UPDATE '.TB_PREFIX.'users SET alliance = 0 WHERE id IN('.implode(',', $evicts).")"); - } else { - // we come from a battle result, therefore we need to check - // for the first player in the alliance who has a sufficient - // level Embassy and to which we can auto-reassign the leadership - $newLeaderFound = false; - - // in case we'll need these later to disband the alliance, - // we'll collect them inside this foeach loop - $memberIDs = []; - - // no need for this whole foreach loop if this player is the lone - // founder and member of their alliance - if ($membersCount > 1) { - foreach ($members as $member) { - if (!$newLeaderFound && $this->getSingleFieldTypeCount($member['id'], 18, '>=', $minAllianceEmbassyLevel) >= 1) { - // found a new leader for the alliance - $newLeaderFound = true; - $newleader = $member['id']; - $q = "UPDATE " . TB_PREFIX . "alidata set leader = ".(int) $newleader." where id = ".(int) $userData['alliance']; - $this->query($q); - $this->updateAlliPermissions($newleader, $userData['alliance'], "Leader", 1, 1, 1, 1, 1, 1, 1); - Automation::updateMax($newleader); - - // update permissions for the old leader - $this->updateAlliPermissions($userData['id'], $userData['alliance'], "Former Leader", 0, 0, 0, 0, 0, 0, 0); - - // notify new leader via in-game messaging - $this->sendMessage( - $newleader, - 4, - 'You are now the alliance leader', - $this->escape("Hi, ".$member['username']."!\n\nThis is to inform you that there was a successful attack on player ".$userData['username']." which has damaged their Embassy badly enough that they are no longer able to sustain the leadership of your alliance.\n\nSince your Embassy level is of a sufficient level, you have been auto-elected to the position of a new leader of your alliance with all duties and responsibilities thereof.\n\nYours sincerely,\nServer Robot :)"), - 0, - 0, - 0, - 0, - 0, - true); - } - - $memberIDs[] = $member['id']; - } - } else { - // if there is only 1 member and it's the actual founder - $memberIDs[] = $userData['id']; - } - - // if there wasn't anyone with a sufficient level of Embassy - // among the existing members, disperse this alliance - if (!$newLeaderFound) { - - // evict all members from the alliance - mysqli_query($this->dblink, 'UPDATE '.TB_PREFIX.'users SET alliance = 0 WHERE id IN('.implode(',', $memberIDs).")"); - - // notify all of them via in-game messaging - foreach ($members as $member) { - $this->sendMessage( - $member['id'], - 4, - 'Your alliance was dispersed', - ( - ($member['id'] == $userData['id']) - ? - $this->escape("Hi, ".$userData['username']."!\n\nThis is to inform you that due to a successful attack that has degraded your last Embassy to a level ".($membersCount > 1 ? "which is unable to hold all ".$membersCount." alliance members, and because there was no other alliance member with an Embassy on a high enough level to overtake the leadership," : "lower then 3 - which is required to found and hold your own alliance - ")." your alliance has been dispersed.\n\nYours sincerely,\nServer Robot :)") - : - $this->escape("Hi, ".$member['username']."!\n\nThis is to inform you that due to a successful attack on your alliance leader's Embassy by another player that degraded it below threshold allowed to hold all ".$membersCount." alliance members, and because there was no other alliance member with an Embassy on a high enough level to overtake the leadership, your alliance has been dispersed.\n\nYours sincerely,\nServer Robot :)") - ), - 0, - 0, - 0, - 0, - 0, - true); - } - } else { - // let's determine whether to keep currently attacked player - // in the alliance or not - if ($userData['lvl'] > 0 || $this->getSingleFieldTypeCount($member['id'], 18, '>=', 1, $use_cache) >= $minimumExistingEmbassyRecords) { - $keepCurrentPlayer = true; - } else { - $keepCurrentPlayer = false; + // notify them via in-game messaging + $this->sendMessage( + $member['id'], + 4, + 'Your alliance was disbanded', + ( + ($member['id'] == $userData['id']) + ? + $this->escape("Hi, ".$userData['username']."!\n\nThis is to inform you that due to a finished demolition of your last Embassy at level 3, and the fact that you were the leader of your alliance, this alliance has been disbanded.\n\nIn order to found a new alliance, please build a level 3 Embassy again in one of your villages.\n\nYours sincerely,\nServer Robot :)") + : + $this->escape("Hi, ".$member['username']."!\n\nThis is to inform you that due to a demolition of your alliance founder's last Embassy below level 3, this alliance has been disbanded.\n\n\You can now accept invitations from other alliances or found a new alliance yourself.\n\nYours sincerely,\nServer Robot :)") + ), + 0, + 0, + 0, + 0, + 0, + true); } - // if a new leader was found, notify all alliance member of this change - // notify all of them via in-game messaging - foreach ($members as $member) { - // don't send duplicate messages to the new leader - if ($member['id'] != $newleader) { - // also, don't send to the attacked player if we're - // not keeping them in alliance - if ($keepCurrentPlayer || (!$keepCurrentPlayer && $member['id'] != $userData['id'])) - $this->sendMessage( - $member['id'], - 4, - 'Your alliance has a new leader', - ( - ($member['id'] == $userData['id']) - ? - $this->escape("Hi, ".$userData['username']."!\n\nThis is to inform you that due to a successful attack that has degraded your last Embassy to a level which is unable to hold all ".$membersCount." alliance members, another alliance member who meets these criteria has been auto-elected as a new alliance leader.\n\nAdditionally - due to the Embassy destruction - you have been forcefuly evicted from your alliance.\n\nPlease re-establish the connection with your alliance by building a new Embassy and contacting the new leader for an invitation.\n\nYours sincerely,\nServer Robot :)") - : - $this->escape("Hi, ".$member['username']."!\n\nThis is to inform you that due to a successful attack on your alliance leader's Embassy by another player, another alliance member with enough Embassy capacity has been auto-elected as the new alliance leader.\n\nYours sincerely,\nServer Robot :)") - ), - 0, - 0, - 0, - 0, - 0, - true); - } - } + mysqli_query($this->dblink, 'UPDATE '.TB_PREFIX.'users SET alliance = 0 WHERE id IN('.implode(',', $evicts).")"); + } else { + // we come from a battle result, therefore we need to check + // for the first player in the alliance who has a sufficient + // level Embassy and to which we can auto-reassign the leadership + $newLeaderFound = false; - // evict current player from the alliance - // if this was their last Embassy and was completely destroyed - if (!$keepCurrentPlayer) { - mysqli_query($this->dblink, 'UPDATE '.TB_PREFIX.'users SET alliance = 0 WHERE id = '.$userData['id']); + // in case we'll need these later to disband the alliance, + // we'll collect them inside this foeach loop + $memberIDs = []; - // unset the alliance in session, if we're evicting - // currently logged-in player - if ($session->uid == $userData['id']) { - $_SESSION['alliance_user'] = 0; - } + // no need for this whole foreach loop if this player is the lone + // founder and member of their alliance + if ($membersCount > 1) { + foreach ($members as $member) { + if (!$newLeaderFound && $this->getSingleFieldTypeCount($member['id'], 18, '>=', $minAllianceEmbassyLevel) >= 1) { + // found a new leader for the alliance + $newLeaderFound = true; + $newleader = $member['id']; + $q = "UPDATE " . TB_PREFIX . "alidata set leader = ".(int) $newleader." where id = ".(int) $userData['alliance']; + $this->query($q); + $this->updateAlliPermissions($newleader, $userData['alliance'], "Leader", 1, 1, 1, 1, 1, 1, 1); + Automation::updateMax($newleader); - // notify the evicted player - $this->sendMessage( - $userData['id'], - 4, - 'An attack has forced you to leave the alliance', - $this->escape("Hi, ".$userData['username']."!\n\nThis is to inform you that due to a successful attack and destruction of your last Embassy, you have been forced to leave your alliance.\n\nTo re-establish your position in this alliance, you will need to build a new Embassy and ask the newly auto-elected leader to send you an invite again.\n\nYours sincerely,\nServer Robot :)"), - 0, - 0, - 0, - 0, - 0, - true); - } - } - } + // update permissions for the old leader + $this->updateAlliPermissions($userData['id'], $userData['alliance'], "Former Leader", 0, 0, 0, 0, 0, 0, 0); - // execute a method that will delete an alliance - // if no members are left in it - $this->deleteAlliance($userData['alliance']); + // notify new leader via in-game messaging + $this->sendMessage( + $newleader, + 4, + 'You are now the alliance leader', + $this->escape("Hi, ".$member['username']."!\n\nThis is to inform you that there was a successful attack on player ".$userData['username']." which has damaged their Embassy badly enough that they are no longer able to sustain the leadership of your alliance.\n\nSince your Embassy level is of a sufficient level, you have been auto-elected to the position of a new leader of your alliance with all duties and responsibilities thereof.\n\nYours sincerely,\nServer Robot :)"), + 0, + 0, + 0, + 0, + 0, + true); + } - return ((isset($newLeaderFound) && $newLeaderFound === true) ? true : false); - } - } + $memberIDs[] = $member['id']; + } + } else { + // if there is only 1 member and it's the actual founder + $memberIDs[] = $userData['id']; + } + + // if there wasn't anyone with a sufficient level of Embassy + // among the existing members, disperse this alliance + if (!$newLeaderFound) { + + // evict all members from the alliance + mysqli_query($this->dblink, 'UPDATE '.TB_PREFIX.'users SET alliance = 0 WHERE id IN('.implode(',', $memberIDs).")"); + + // notify all of them via in-game messaging + foreach ($members as $member) { + $this->sendMessage( + $member['id'], + 4, + 'Your alliance was dispersed', + ( + ($member['id'] == $userData['id']) + ? + $this->escape("Hi, ".$userData['username']."!\n\nThis is to inform you that due to a successful attack that has degraded your last Embassy to a level ".($membersCount > 1 ? "which is unable to hold all ".$membersCount." alliance members, and because there was no other alliance member with an Embassy on a high enough level to overtake the leadership," : "lower then 3 - which is required to found and hold your own alliance - ")." your alliance has been dispersed.\n\nYours sincerely,\nServer Robot :)") + : + $this->escape("Hi, ".$member['username']."!\n\nThis is to inform you that due to a successful attack on your alliance leader's Embassy by another player that degraded it below threshold allowed to hold all ".$membersCount." alliance members, and because there was no other alliance member with an Embassy on a high enough level to overtake the leadership, your alliance has been dispersed.\n\nYours sincerely,\nServer Robot :)") + ), + 0, + 0, + 0, + 0, + 0, + true); + } + } else { + // let's determine whether to keep currently attacked player + // in the alliance or not + if ($userData['lvl'] > 0 || $this->getSingleFieldTypeCount($member['id'], 18, '>=', 1, $use_cache) >= $minimumExistingEmbassyRecords) { + $keepCurrentPlayer = true; + } else { + $keepCurrentPlayer = false; + } + + // if a new leader was found, notify all alliance member of this change + // notify all of them via in-game messaging + foreach ($members as $member) { + // don't send duplicate messages to the new leader + if ($member['id'] != $newleader) { + // also, don't send to the attacked player if we're + // not keeping them in alliance + if ($keepCurrentPlayer || (!$keepCurrentPlayer && $member['id'] != $userData['id'])) + $this->sendMessage( + $member['id'], + 4, + 'Your alliance has a new leader', + ( + ($member['id'] == $userData['id']) + ? + $this->escape("Hi, ".$userData['username']."!\n\nThis is to inform you that due to a successful attack that has degraded your last Embassy to a level which is unable to hold all ".$membersCount." alliance members, another alliance member who meets these criteria has been auto-elected as a new alliance leader.\n\nAdditionally - due to the Embassy destruction - you have been forcefuly evicted from your alliance.\n\nPlease re-establish the connection with your alliance by building a new Embassy and contacting the new leader for an invitation.\n\nYours sincerely,\nServer Robot :)") + : + $this->escape("Hi, ".$member['username']."!\n\nThis is to inform you that due to a successful attack on your alliance leader's Embassy by another player, another alliance member with enough Embassy capacity has been auto-elected as the new alliance leader.\n\nYours sincerely,\nServer Robot :)") + ), + 0, + 0, + 0, + 0, + 0, + true); + } + } + + // evict current player from the alliance + // if this was their last Embassy and was completely destroyed + if (!$keepCurrentPlayer) { + mysqli_query($this->dblink, 'UPDATE '.TB_PREFIX.'users SET alliance = 0 WHERE id = '.$userData['id']); + + // unset the alliance in session, if we're evicting + // currently logged-in player + if ($session->uid == $userData['id']) { + $_SESSION['alliance_user'] = 0; + } + + // notify the evicted player + $this->sendMessage( + $userData['id'], + 4, + 'An attack has forced you to leave the alliance', + $this->escape("Hi, ".$userData['username']."!\n\nThis is to inform you that due to a successful attack and destruction of your last Embassy, you have been forced to leave your alliance.\n\nTo re-establish your position in this alliance, you will need to build a new Embassy and ask the newly auto-elected leader to send you an invite again.\n\nYours sincerely,\nServer Robot :)"), + 0, + 0, + 0, + 0, + 0, + true); + } + } + } + + // execute a method that will delete an alliance + // if no members are left in it + $this->deleteAlliance($userData['alliance']); + + return ((isset($newLeaderFound) && $newLeaderFound === true) ? true : false); + } + } + } // no changes in player-to-alliance relationship return true; From 9474a60313e37a5b78ac384f0dbabf51d176e50c Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 2 Dec 2017 10:55:24 +0100 Subject: [PATCH 108/126] fix: embassy destruction status text on an incorrect line in a report #393 --- GameEngine/Automation.php | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 95b437f9..54462742 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -1084,11 +1084,6 @@ class Automation { $database->setMaxCropForVillage($data['to'], $buildarray[$tblevel]['attri']); } - // embassy level was changed - if ($tbgid==18){ - $info_cat .= $database->checkEmbassiesAfterBattle($data['to'], false); - } - // oasis cannot be destroyed $pop=$this->recountPop($data['to'], false); if ($isoasis == 0) { @@ -1101,9 +1096,21 @@ class Automation { if ($isSecondRow) { $info_cat .= "
    "; + \"Catapult\" ".$this->procResType($tbgid,$can_destroy,$isoasis)." destroyed."; + + // embassy level was changed + if ($tbgid==18){ + $info_cat .= $database->checkEmbassiesAfterBattle($data['to'], false); + } + + $info_cat .= ""; } else { $info_cat = "" . $catp_pic . ", " . $this->procResType( $tbgid, $can_destroy, $isoasis ) . " destroyed."; + + // embassy level was changed + if ($tbgid==18){ + $info_cat .= $database->checkEmbassiesAfterBattle($data['to'], false); + } } } // building/field not damaged @@ -1161,11 +1168,6 @@ class Automation { if ( $tbgid == 11 || $tbgid == 39 ) { $database->setMaxCropForVillage( $data['to'], $buildarray[ $tblevel ]['attri'] ); } - - // embassy level was changed - if ( $tbgid == 18 ) { - $info_cat .= $database->checkEmbassiesAfterBattle( $data['to'], false ); - } } $fieldsToSet = ["f" . $tbid]; @@ -1191,9 +1193,21 @@ class Automation { if ($isSecondRow) { $info_cat .= "
    "; + \"Catapult\" ".$this->procResType($tbgid,$can_destroy,$isoasis).$info_cata; + + // embassy level was changed + if ( $tbgid == 18 ) { + $info_cat .= $database->checkEmbassiesAfterBattle( $data['to'], false ); + } + + $info_cat .= ""; } else { $info_cat = "" . $catp_pic . "," . $this->procResType( $tbgid, $can_destroy, $isoasis ) . $info_cata; + + // embassy level was changed + if ( $tbgid == 18 ) { + $info_cat .= $database->checkEmbassiesAfterBattle( $data['to'], false ); + } } } } From 537a14e4e35e35c706a02ac8c6db1ad3d1eda356 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 2 Dec 2017 11:09:14 +0100 Subject: [PATCH 109/126] fix: second row of catapults destroys incorrect target #393 --- GameEngine/Automation.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 54462742..701816d7 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -2354,8 +2354,6 @@ class Automation { /** * SECOND CATAPULTS ROW */ - // reload resource levels, since they've changed now - $bdo = $database->getResourceLevel($basearray, false); // we're manually targetting 2nd row of catapults if (!$catapults2TargetRandom) @@ -2372,6 +2370,7 @@ class Automation { // 2nd row of catapults pre-selected target calculations, if needed if (!$catapults2TargetRandom && !$catapults2WillNotShoot && $bdo['f'.$i.'t'] == $catapultTarget2 && $bdo['f'.$i] > 0 && $catapultTarget2 != 31 && $catapultTarget2 != 32 && $catapultTarget2 != 33) { + $j++; $_catapultsTarget2Levels[$j]=$bdo['f'.$i]; $__catapultsTarget2AltTargets[$j]=$i; } From 76fdbc6c3ecafc14f274ec7f1ea8d9b4b44a77e7 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 2 Dec 2017 11:57:59 +0100 Subject: [PATCH 110/126] feat: ability for players with Multihunter rank to see&write MH messages #398 --- GameEngine/Database.php | 29 ++++++++++++++++++++++++++--- GameEngine/Message.php | 18 +++++++++++++++--- Templates/Message/inbox.tpl | 16 ++++++++++++++-- Templates/Message/sent.tpl | 16 ++++++++++++++-- Templates/Message/write.tpl | 10 +++++++--- 5 files changed, 76 insertions(+), 13 deletions(-) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index d72f48c1..b522f4fd 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -4101,15 +4101,26 @@ References: User ID/Message ID, Mode global $session; $mode = (int) $mode; + $mode_updated = false; // update $id if we should show Support messages for Admins and we are an admin if ( - ($session->access == MULTIHUNTER || $session->access == ADMIN) + $session->access == ADMIN && ADMIN_RECEIVE_SUPPORT_MESSAGES && in_array($mode, [1,2,6,9,10,11]) ) { $id = $id . ', 1'; + $mode_updated = true; } + // update $id if we should show Multihunter messages for the current player + if ( + $session->access == MULTIHUNTER + && in_array($mode, [1,2,6,9,10,11]) + ) { + $id = $id . ', 5'; + $mode_updated = true; + } + if (in_array($mode, [5,7,8])) { if (!is_array($id)) { $id = [$id]; @@ -4119,7 +4130,9 @@ References: User ID/Message ID, Mode } } } else { - $id = (int) $id; + if (!$mode_updated) { + $id = (int) $id; + } } global $session; @@ -4134,7 +4147,17 @@ References: User ID/Message ID, Mode $q = "SELECT * FROM " . TB_PREFIX . "mdata where id = $id"; break; case 4: - $q = "UPDATE " . TB_PREFIX . "mdata set viewed = 1 where id = $id AND target IN(".((($session->access == MULTIHUNTER || $session->access == ADMIN) && ADMIN_RECEIVE_SUPPORT_MESSAGES) ? $session->uid.',1' : $session->uid).")"; + $show_target = $session->uid; + + if ($session->access == ADMIN && ADMIN_RECEIVE_SUPPORT_MESSAGES) { + $show_target .= ',1'; + } + + if ($session->access == MULTIHUNTER) { + $show_target .= ',5'; + } + + $q = "UPDATE " . TB_PREFIX . "mdata set viewed = 1 where id = $id AND target IN(".$show_target.")"; break; case 5: $q = "UPDATE " . TB_PREFIX . "mdata set deltarget = 1,viewed = 1 where id IN(".implode(', ', $id).")"; diff --git a/GameEngine/Message.php b/GameEngine/Message.php index 6b9e20f5..e415167e 100755 --- a/GameEngine/Message.php +++ b/GameEngine/Message.php @@ -582,9 +582,21 @@ class Message { } } - // check if we're not sending this as support - $support_from_admin_allowed = ( ( $session->access == MULTIHUNTER || $session->access == ADMIN ) && ADMIN_RECEIVE_SUPPORT_MESSAGES ); - $database->sendMessage( $user, ( ( ! empty( $_POST['as_support'] ) && $support_from_admin_allowed ) ? 1 : $session->uid ), htmlspecialchars( addslashes( $topic ) ), htmlspecialchars( addslashes( $text ) ), 0, $alliance, $player, $coor, $report ); + // check if we're not sending this as Support or Multihunter + $support_from_admin_allowed = ( $session->access == ADMIN && ADMIN_RECEIVE_SUPPORT_MESSAGES ); + $send_as = $session->uid; + + // send as Support? + if (( ! empty( $_POST['as_support'] ) && $support_from_admin_allowed )) { + $send_as = 1; + } + + // send as Multihunter + if (( ! empty( $_POST['as_multihunter'] ) && $session->access == MULTIHUNTER )) { + $send_as = 5; + } + + $database->sendMessage( $user, $send_as, htmlspecialchars( addslashes( $topic ) ), htmlspecialchars( addslashes( $text ) ), 0, $alliance, $player, $coor, $report ); } } diff --git a/Templates/Message/inbox.tpl b/Templates/Message/inbox.tpl index f8dc6f4b..926994b3 100644 --- a/Templates/Message/inbox.tpl +++ b/Templates/Message/inbox.tpl @@ -55,7 +55,8 @@ $s = 0; } $name = 1; - $support_messages = (($session->access == MULTIHUNTER || $session->access == ADMIN) && ADMIN_RECEIVE_SUPPORT_MESSAGES); + $support_messages = ($session->access == ADMIN && ADMIN_RECEIVE_SUPPORT_MESSAGES); + $multihunter_messages = ($session->access == MULTIHUNTER); for($i=(1+$s);$i<=(10+$s);$i++) { if(count($message->inbox1) >= $i) { @@ -67,7 +68,18 @@ else { echo ""; } - echo " + + $message_for_text = ''; + + if (!$support_messages || ($support_messages && $message->inbox1[$i-1]['target'] != 1) || ($multihunter_messages && $message->inbox1[$i-1]['target'] != 5)) { + $message_for_text = "inbox1[$i-1]['id']."\" />"; + } else if ($support_messages) { + $message_for_text = 'S'; + } else if ($multihunter_messages) { + $message_for_text = 'M'; + } + + echo ""; } - echo " + + $sent_as_text = ''; + + if (!$support_messages || ($support_messages && $message->inbox1[$i-1]['target'] != 1) || ($multihunter_messages && $message->inbox1[$i-1]['target'] != 5)) { + $sent_as_text = "sent1[$i-1]['id']."\" />"; + } else if ($support_messages) { + $sent_as_text = 'S'; + } else if ($multihunter_messages) { + $sent_as_text = 'M'; + } + + echo ""; + if ($tbid > 0 || ($tbid == 0 && strpos($info_cat, 'The village has') === false)) { + $info_cat .= "
    "; + } } else { $info_cat = "" . $catp_pic . "," . $this->procResType( $tbgid, $can_destroy, $isoasis ) . " was not damaged."; } @@ -2744,7 +2748,7 @@ class Automation { else{ if(isset($village_destroyed) && $village_destroyed == 1 && $can_destroy==1){ //check if village pop=0 and no info destroy - if (strpos($info_cat,"The village has")==0) { + if (strpos($info_cat,"The village has") === false) { $info_cat .= "
    "; } From aec7a57ca4aacba7bfba96a59381c11ebfad8c76 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 2 Dec 2017 16:00:24 +0100 Subject: [PATCH 114/126] fix: destroyed Embassy evicts player even with another Embassy standing #399 --- GameEngine/Automation.php | 8 ++++---- GameEngine/Database.php | 10 +++------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index a743c8c7..0954d8fe 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -1102,7 +1102,7 @@ class Automation { // embassy level was changed if ($tbgid==18){ - $info_cat .= $database->checkEmbassiesAfterBattle($data['to'], false); + $info_cat .= $database->checkEmbassiesAfterBattle($data['to'], $bdo['f'.$catapultTarget], false); } $info_cat .= ""; @@ -1111,7 +1111,7 @@ class Automation { // embassy level was changed if ($tbgid==18){ - $info_cat .= $database->checkEmbassiesAfterBattle($data['to'], false); + $info_cat .= $database->checkEmbassiesAfterBattle($data['to'], $bdo['f'.$catapultTarget], false); } } } @@ -1201,7 +1201,7 @@ class Automation { // embassy level was changed if ( $tbgid == 18 ) { - $info_cat .= $database->checkEmbassiesAfterBattle( $data['to'], false ); + $info_cat .= $database->checkEmbassiesAfterBattle( $data['to'], $bdo['f'.$catapultTarget], false ); } $info_cat .= ""; @@ -1210,7 +1210,7 @@ class Automation { // embassy level was changed if ( $tbgid == 18 ) { - $info_cat .= $database->checkEmbassiesAfterBattle( $data['to'], false ); + $info_cat .= $database->checkEmbassiesAfterBattle( $data['to'], $bdo['f'.$catapultTarget], false ); } } } diff --git a/GameEngine/Database.php b/GameEngine/Database.php index b522f4fd..9aaa2f9e 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -4663,11 +4663,7 @@ References: User ID/Message ID, Mode // check whether this player is an alliance owner $isOwner = ($userData['alliance'] && $this->isAllianceOwner($userData['id'], $use_cache) == $userData['alliance']); - // for demolition, the Embassy was already destroyed, so we need at least 1 - // Embassy still standing... for battle, the Embassy is still standing - // and will only be deleted upon finalizing battle calculations, so we need - // to check for at least 2 Embassies - $minimumExistingEmbassyRecords = ($demolition ? 1 : 2); + $minimumExistingEmbassyRecords = 1; // if they are not an alliance owner, simply check whether we have any Embassies // at lvl 1+ standing somewhere @@ -4927,7 +4923,7 @@ References: User ID/Message ID, Mode return true; } - function checkEmbassiesAfterBattle($vid, $use_cache = true) { + function checkEmbassiesAfterBattle($vid, $current_level, $use_cache = true) { $userData = $this->getUserArray($this->getVillageField($vid,"owner"), 1); Automation::updateMax($this->getVillageField($vid,"owner")); @@ -4935,7 +4931,7 @@ References: User ID/Message ID, Mode 'id' => $userData['id'], 'alliance' => $userData["alliance"], 'username' => $userData["username"], - 'lvl' => $totallvl + 'lvl' => $current_level ], false, $use_cache); if ($allianceStatus === false) { From b261212d12494611c95d35f11a1a8cf1dd65eb89 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 2 Dec 2017 16:17:47 +0100 Subject: [PATCH 115/126] fix: expansion slots not being cleared up upon village destruction #400 --- GameEngine/Admin/database.php | 15 +++++++++++++++ GameEngine/Automation.php | 14 ++++++++++++++ sql_updates.txt | 5 +++++ var/db/struct.sql | 5 ++++- 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/GameEngine/Admin/database.php b/GameEngine/Admin/database.php index f47c4bdc..43478246 100755 --- a/GameEngine/Admin/database.php +++ b/GameEngine/Admin/database.php @@ -364,6 +364,21 @@ class adm_DB { $q = "UPDATE ".TB_PREFIX."wdata SET occupied = 0 where id = $wref"; mysqli_query($this->connection, $q); + // clear expansion slots, if this village is an expansion of any other village + $q = " + UPDATE + ".TB_PREFIX."vdata + SET + exp1 = IF(exp1 = $wref, 0, exp1), + exp2 = IF(exp2 = $wref, 0, exp2), + exp3 = IF(exp3 = $wref, 0, exp3) + WHERE + exp1 = $wref OR + exp2 = $wref OR + exp3 = $wref"; + + mysqli_query($this->connection, $q); + $getmovement = $database->getMovement(3,$wref,1); foreach($getmovement as $movedata) { $time = microtime(true); diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 0954d8fe..79c2a36e 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -3244,6 +3244,20 @@ class Automation { $q = "UPDATE ".TB_PREFIX."wdata set occupied = 0 where id = $wref"; $database->query($q); + // clear expansion slots, if this village is an expansion of any other village + $q = " + UPDATE + ".TB_PREFIX."vdata + SET + exp1 = IF(exp1 = $wref, 0, exp1), + exp2 = IF(exp2 = $wref, 0, exp2), + exp3 = IF(exp3 = $wref, 0, exp3) + WHERE + exp1 = $wref OR + exp2 = $wref OR + exp3 = $wref"; + $database->query($q); + $getprisoners = $database->getPrisoners($wref); foreach($getprisoners as $pris) { $troops = 0; diff --git a/sql_updates.txt b/sql_updates.txt index 0dc9dcfc..f8a2611d 100644 --- a/sql_updates.txt +++ b/sql_updates.txt @@ -1,3 +1,8 @@ +-- 2.12.2017 -> new indexes +ALTER TABLE `s1_vdata` ADD INDEX(`exp1`); +ALTER TABLE `s1_vdata` ADD INDEX(`exp2`); +ALTER TABLE `s1_vdata` ADD INDEX(`exp3`); + -- 17.11.2017 -> query optimizations ALTER TABLE `s1_prisoners` DROP INDEX `from`, ADD INDEX `from-t11` (`from`, `t11`); ALTER TABLE `s1_enforcement` DROP INDEX `from`, ADD INDEX `from` (`from`, `hero`) USING BTREE; diff --git a/var/db/struct.sql b/var/db/struct.sql index bcfb1f4b..bbea2d0e 100644 --- a/var/db/struct.sql +++ b/var/db/struct.sql @@ -1653,7 +1653,10 @@ KEY `clay` (`clay`), KEY `iron` (`iron`), KEY `crop` (`crop`), KEY `starv` (`starv`), -KEY `loyalty` (`loyalty`) +KEY `loyalty` (`loyalty`), +KEY `exp1` (`exp1`), +KEY `exp2` (`exp2`), +KEY `exp3` (`exp3`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; -- From 9d3e074d09bf2deff03afb22dc245c78789269df Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 2 Dec 2017 17:03:25 +0100 Subject: [PATCH 116/126] fix: Multihunter and Support unread messages counter incorrect #398 --- GameEngine/Database.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/GameEngine/Database.php b/GameEngine/Database.php index 9aaa2f9e..a13da379 100755 --- a/GameEngine/Database.php +++ b/GameEngine/Database.php @@ -4018,9 +4018,18 @@ class MYSQLi_DB implements IDbConnection { function getUnreadMessagesCount($uid) { $uid = (int) $uid; - return mysqli_fetch_array(mysqli_query($this->dblink, ' - SELECT Count(*) as numUnread FROM '.TB_PREFIX.'mdata WHERE target = '.$uid.' AND viewed = 0' - ), MYSQLI_ASSOC)['numUnread']; + $ids = [$uid]; + + if (($this->getUserField($uid, 'access', 0) == ADMIN) && ADMIN_RECEIVE_SUPPORT_MESSAGES) { + $ids[] = 1; + } + + if ($this->getUserField($uid, 'access', 0) == MULTIHUNTER) { + $ids[] = 5; + } + + $q = 'SELECT Count(*) as numUnread FROM '.TB_PREFIX.'mdata WHERE target IN('.implode(', ', $ids).') AND viewed = 0'; + return mysqli_fetch_array(mysqli_query($this->dblink, $q), MYSQLI_ASSOC)['numUnread']; } // no need to cache this method From 4ebb2709b0c1cb61d71408add2ad53b0d0123d95 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 2 Dec 2017 18:22:54 +0100 Subject: [PATCH 117/126] chore: version update --- README.md | 2 +- Templates/footer.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a08d9043..553a51ad 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ [![Join the chat at https://gitter.im/TravianZ-V8/Lobby](https://badges.gitter.im/TravianZ-V8/Lobby.svg)](https://gitter.im/TravianZ-V8/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Donate to this project on LiberaPay](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/martinambrus/donate) -TravianZ Version **v.8.3.3 BETA b3** +TravianZ Version **v.8.3.3 BETA b4** ====== **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/footer.tpl b/Templates/footer.tpl index 46cf3349..20b2d28d 100644 --- a/Templates/footer.tpl +++ b/Templates/footer.tpl @@ -22,7 +22,7 @@ From d6952219a8d7f6035d0e89ac2f320c1eeaa77cb6 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sun, 3 Dec 2017 02:16:21 +0100 Subject: [PATCH 118/126] chore: readme update --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 553a51ad..7e973c17 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,9 @@ [![license](https://img.shields.io/github/license/Shadowss/TravianZ.svg)]() [![GitHub last commit](https://img.shields.io/github/last-commit/Shadowss/TravianZ.svg)]() [![Proudly Coded in PHPStorm](https://img.shields.io/badge/coded%20in-PHPStorm-BD5CF3.svg)](https://www.jetbrains.com/buy/opensource/?product=phpstorm) +[![Donate to this project on LiberaPay](https://img.shields.io/badge/LiberaPay-donate-F6C915.svg)](https://liberapay.com/martinambrus/donate) [![Join the chat at https://gitter.im/TravianZ-V8/Lobby](https://badges.gitter.im/TravianZ-V8/Lobby.svg)](https://gitter.im/TravianZ-V8/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![Donate to this project on LiberaPay](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/martinambrus/donate) +[![Watch how this was made on YouTube](https://img.shields.io/badge/The%20making%20of...-YouTube-FF0000.svg)](https://www.youtube.com/watch?v=1XiHhpGUmQg&list=PLzV5avt1FFHorlIeoL9YX0pdb9bj-FO84) TravianZ Version **v.8.3.3 BETA b4** ====== @@ -17,6 +18,8 @@ TravianZ Version **v.8.3.3 BETA b4** * [Download and Updates](https://github.com/Shadowss/TravianZ) »» https://github.com/Shadowss/TravianZ * [Wiki](https://github.com/Shadowss/TravianZ/wiki) * [Game Mechanics](http://travian.wikia.com/wiki/Travian_Wiki) +* [The Making Of](https://www.youtube.com/watch?v=1XiHhpGUmQg&list=PLzV5avt1FFHorlIeoL9YX0pdb9bj-FO84) - YouTube Videos about this project +* [Donate to TravianZ](https://liberapay.com/martinambrus/donate) **Minimum requirements:** * [PHP](http://php.net/) 5.6.32+ From fa8a6640e210828db37eddd3112aaaca23f5ae1d Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Mon, 4 Dec 2017 11:10:00 +0100 Subject: [PATCH 119/126] fix: demolition could bring building level to negative numbers Closes #412 --- GameEngine/Automation.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 79c2a36e..51af2a72 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -4564,6 +4564,11 @@ class Automation { if ($vil['timetofinish'] <= time()) { $type = $database->getFieldType($vil['vref'],$vil['buildnumber']); $level = $database->getFieldLevel($vil['vref'],$vil['buildnumber']); + + if ($level < 0) { + $level = 0; + } + $buildarray = $GLOBALS["bid".$type]; if ($type==10 || $type==38) { @@ -4588,7 +4593,7 @@ class Automation { if ($village->natar==1 && $type==40) $clear=""; //fix by ronix - $q = "UPDATE ".TB_PREFIX."fdata SET f".$vil['buildnumber']."=".($level-1).$clear." WHERE vref=".(int) $vil['vref']; + $q = "UPDATE ".TB_PREFIX."fdata SET f".$vil['buildnumber']."=".(($level-1 >= 0) ? $level-1 : 0).$clear." WHERE vref=".(int) $vil['vref']; $database->query($q); $pop = $this->getPop($type,$level-1); From 32bb5fe7261fae27d2fcfac2214402fbc240b26c Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Mon, 4 Dec 2017 11:19:21 +0100 Subject: [PATCH 120/126] fix: raid lists do not work Closes #411 --- Templates/a2b/startRaid.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Templates/a2b/startRaid.tpl b/Templates/a2b/startRaid.tpl index f9b57180..d79507b7 100644 --- a/Templates/a2b/startRaid.tpl +++ b/Templates/a2b/startRaid.tpl @@ -17,7 +17,7 @@ $userAccess = $database->getUserField($villageOwner,'access',0); $userID = $database->getUserField($villageOwner,'id',0); - if ( $userAccess != '0' && ($userAccess == MULTIHUNTER && $userID == 5) && ( $userAccess != ADMIN || ( ADMIN_ALLOW_INCOMING_RAIDS && $userAccess == ADMIN ) ) ) { + if ( $userAccess != '0' && !($userAccess == MULTIHUNTER && $userID == 5) && ( $userAccess != ADMIN || ( ADMIN_ALLOW_INCOMING_RAIDS && $userAccess == ADMIN ) ) ) { if ( $tribe == 1 ) { $uname = "u"; $uname1 = "u1"; From 818701c63ab13e3fa76c713894d0cc8f189ad275 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Mon, 4 Dec 2017 11:25:33 +0100 Subject: [PATCH 121/126] fix: Internet Explorer redirects to homepage instead of page reload #403 --- a2b.php | 2 +- a2b2.php | 2 +- activate.php | 2 +- allianz.php | 2 +- anmelden.php | 2 +- banned.php | 2 +- berichte.php | 2 +- build.php | 2 +- create_account.php | 2 +- crop_finder.php | 2 +- dorf1.php | 2 +- dorf2.php | 2 +- dorf3.php | 2 +- gpack/travian_default/lang/en/b/zurueck.html | 2 +- gpack/travian_t4/lang/en/b/zurueck.html | 2 +- img/admin/b/zurueck.html | 2 +- install/index.php | 2 +- karte.php | 2 +- karte2.php | 2 +- login.php | 2 +- logout.php | 2 +- manual.php | 2 +- massmessage.php | 2 +- packages.php | 2 +- password.php | 2 +- plus.php | 2 +- plus1.php | 2 +- rules.php | 2 +- spieler.php | 2 +- statistiken.php | 2 +- support.php | 2 +- sysmsg.php | 2 +- unx.js | 2 +- version.php | 2 +- warsim.php | 2 +- winner.php | 2 +- 36 files changed, 36 insertions(+), 36 deletions(-) diff --git a/a2b.php b/a2b.php index a43d5638..d25dba55 100644 --- a/a2b.php +++ b/a2b.php @@ -95,7 +95,7 @@ if(isset($_GET['o'])) { - + - + diff --git a/activate.php b/activate.php index 70780131..d6bcc13b 100644 --- a/activate.php +++ b/activate.php @@ -27,7 +27,7 @@ AccessLogger::logRequest(); - + diff --git a/allianz.php b/allianz.php index 803ade0f..f2d8c02d 100644 --- a/allianz.php +++ b/allianz.php @@ -109,7 +109,7 @@ if(isset($_GET['aid']) or isset($_GET['fid']) or isset($_GET['fid2']) or $sessio - + - + diff --git a/banned.php b/banned.php index 192f3ccc..39ad3deb 100644 --- a/banned.php +++ b/banned.php @@ -29,7 +29,7 @@ if($session->access == BANNED){ - + diff --git a/berichte.php b/berichte.php index 855c0b7c..2fc415fa 100644 --- a/berichte.php +++ b/berichte.php @@ -47,7 +47,7 @@ if(isset($_GET['newdid'])) { - + diff --git a/build.php b/build.php index 59bc0b9a..d39887eb 100644 --- a/build.php +++ b/build.php @@ -329,7 +329,7 @@ if ( isset( $_GET['id'] ) ) { - + diff --git a/create_account.php b/create_account.php index a4879b3e..6010ce8f 100644 --- a/create_account.php +++ b/create_account.php @@ -59,7 +59,7 @@ AccessLogger::logRequest(); - + diff --git a/crop_finder.php b/crop_finder.php index a755e077..1bc536ae 100644 --- a/crop_finder.php +++ b/crop_finder.php @@ -47,7 +47,7 @@ $start_timer = $generator->pageLoadTimeStart(); - + - + diff --git a/dorf2.php b/dorf2.php index eac1fdff..ab4f4e8e 100644 --- a/dorf2.php +++ b/dorf2.php @@ -39,7 +39,7 @@ $automation->isWinner(); - + diff --git a/dorf3.php b/dorf3.php index 40a7b781..96d05be2 100644 --- a/dorf3.php +++ b/dorf3.php @@ -42,7 +42,7 @@ if(isset($_GET['newdid'])) { - + diff --git a/gpack/travian_default/lang/en/b/zurueck.html b/gpack/travian_default/lang/en/b/zurueck.html index 01abebcc..f50d31ae 100644 --- a/gpack/travian_default/lang/en/b/zurueck.html +++ b/gpack/travian_default/lang/en/b/zurueck.html @@ -8,7 +8,7 @@ - + diff --git a/gpack/travian_t4/lang/en/b/zurueck.html b/gpack/travian_t4/lang/en/b/zurueck.html index 9adadacc..9f1a59e9 100644 --- a/gpack/travian_t4/lang/en/b/zurueck.html +++ b/gpack/travian_t4/lang/en/b/zurueck.html @@ -8,7 +8,7 @@ - + diff --git a/img/admin/b/zurueck.html b/img/admin/b/zurueck.html index 9adadacc..9f1a59e9 100644 --- a/img/admin/b/zurueck.html +++ b/img/admin/b/zurueck.html @@ -8,7 +8,7 @@ - + diff --git a/install/index.php b/install/index.php index 5d82e2b3..04cf7cc5 100644 --- a/install/index.php +++ b/install/index.php @@ -37,7 +37,7 @@ date_default_timezone_set($t_zone); - + diff --git a/karte.php b/karte.php index 771997c4..29f59d3a 100644 --- a/karte.php +++ b/karte.php @@ -48,7 +48,7 @@ else{ - + diff --git a/karte2.php b/karte2.php index 6ac04d4b..20da2191 100644 --- a/karte2.php +++ b/karte2.php @@ -27,7 +27,7 @@ if($session->plus){ - + diff --git a/login.php b/login.php index 8f66e322..d2176e35 100644 --- a/login.php +++ b/login.php @@ -48,7 +48,7 @@ $_SESSION[ 'csrf' ] = $key; - + diff --git a/logout.php b/logout.php index 6e28f0c2..c70a7f0a 100644 --- a/logout.php +++ b/logout.php @@ -30,7 +30,7 @@ AccessLogger::logRequest(); - + diff --git a/manual.php b/manual.php index 77412d84..00f3b93e 100644 --- a/manual.php +++ b/manual.php @@ -24,7 +24,7 @@ include_once("GameEngine/config.php"); - + diff --git a/massmessage.php b/massmessage.php index 20d5ab97..be8b1552 100644 --- a/massmessage.php +++ b/massmessage.php @@ -99,7 +99,7 @@ if (isset($_GET['send']) && isset($_GET['from'])) - + diff --git a/packages.php b/packages.php index 27426f2c..55bbfe83 100644 --- a/packages.php +++ b/packages.php @@ -30,7 +30,7 @@ if($session->access != BANNED){ - + diff --git a/password.php b/password.php index 4444168d..c7446ad7 100644 --- a/password.php +++ b/password.php @@ -38,7 +38,7 @@ if(!isset($_REQUEST['npw'])){ - + diff --git a/plus.php b/plus.php index a7558d8f..29237779 100644 --- a/plus.php +++ b/plus.php @@ -63,7 +63,7 @@ $automation->isWinner(); - + diff --git a/plus1.php b/plus1.php index ff2d4777..ebf8a2a9 100644 --- a/plus1.php +++ b/plus1.php @@ -28,7 +28,7 @@ else { - + diff --git a/rules.php b/rules.php index 87e5cf0e..53e127d7 100644 --- a/rules.php +++ b/rules.php @@ -36,7 +36,7 @@ if(isset($_GET['newdid'])) { - + diff --git a/spieler.php b/spieler.php index f38caa21..ad37578e 100644 --- a/spieler.php +++ b/spieler.php @@ -51,7 +51,7 @@ $automation->isWinner(); - + diff --git a/statistiken.php b/statistiken.php index 40a02ff5..fc5e4ffd 100644 --- a/statistiken.php +++ b/statistiken.php @@ -69,7 +69,7 @@ if(isset($_GET['newdid'])) { - + diff --git a/support.php b/support.php index 5eb5564f..36076404 100644 --- a/support.php +++ b/support.php @@ -38,7 +38,7 @@ $automation->isWinner(); - + diff --git a/sysmsg.php b/sysmsg.php index 5ff6a6da..1a5cd144 100644 --- a/sysmsg.php +++ b/sysmsg.php @@ -63,7 +63,7 @@ if (@isset($_POST['confirm'])) - + diff --git a/unx.js b/unx.js index 58f45dd0..4ffb031c 100644 --- a/unx.js +++ b/unx.js @@ -87,7 +87,7 @@ function executeCounter(){ bb[i] = null; eb = 1; if (!window.reloading) { - setTimeout(function(){window.location.href = ''},1000); + setTimeout(function(){window.location.href = window.location.href;},1000); window.reloading = true; } } diff --git a/version.php b/version.php index 6a300360..bd1f07ab 100644 --- a/version.php +++ b/version.php @@ -39,7 +39,7 @@ $automation->isWinner(); - + diff --git a/warsim.php b/warsim.php index bec09577..94668ef7 100644 --- a/warsim.php +++ b/warsim.php @@ -30,7 +30,7 @@ $battle->procSim($_POST); - + diff --git a/winner.php b/winner.php index e9368be6..d89c03d7 100644 --- a/winner.php +++ b/winner.php @@ -167,7 +167,7 @@ else { - + From ce6f4ed3a9cf00501a918ddb781bc484bd881054 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Mon, 4 Dec 2017 20:53:03 +0100 Subject: [PATCH 122/126] fix: all players can see forum edit links #410 --- Templates/Alliance/Forum/forum_10.tpl | 459 +++++++++++++++++++++----- Templates/Alliance/Forum/forum_2.tpl | 8 +- Templates/Alliance/Forum/forum_4.tpl | 4 +- Templates/Alliance/Forum/forum_6.tpl | 4 +- Templates/Alliance/forum.tpl | 2 +- 5 files changed, 385 insertions(+), 92 deletions(-) diff --git a/Templates/Alliance/Forum/forum_10.tpl b/Templates/Alliance/Forum/forum_10.tpl index f361ad85..612c7f56 100644 --- a/Templates/Alliance/Forum/forum_10.tpl +++ b/Templates/Alliance/Forum/forum_10.tpl @@ -5,89 +5,382 @@ ## FIX BY RONIX ## ## TRAVIANZ ## ############################################################ -if($session->access!=BANNED){ -$topic_id = $_GET['pod']; -$post_id = $_GET['pod']; -$topics = $database->ShowTopic($topic_id); -$posts = $database->ShowPostEdit($post_id); -foreach($topics as $top) { - $title = stripslashes($top['title']); +if($session->access!=BANNED) { + $topic_id = $_GET['pod']; + $post_id = $_GET['pod']; + $topics = $database->ShowTopic( $topic_id ); + $posts = $database->ShowPostEdit( $post_id ); + foreach ( $topics as $top ) { + $title = stripslashes( $top['title'] ); + } + foreach ( $posts as $pos ) { + $poss = stripslashes( $pos['post'] ); + $poss = preg_replace( '/\[message\]/', '', $poss ); + $poss = preg_replace( '/\[\/message\]/', '', $poss ); + $alliance0 = $pos['alliance0']; + $player0 = $pos['player0']; + $owner = $pos['owner']; + $coor0 = $pos['coor0']; + $report0 = $pos['report0']; + } + + if ( $owner == $session->uid ) { + ?> + + + + + + + + +
    Information - \"Catapult\" ".$this->procResType($tbgid,$can_destroy,$isoasis)." destroyed.
    Information - \"Catapult\" ".$this->procResType($tbgid,$can_destroy,$isoasis).$info_cata."
    ".((!$support_messages || ($support_messages && $message->inbox1[$i-1]['target'] != 1)) ? "inbox1[$i-1]['id']."\" />" : 'S')."".$message_for_text." inbox1[$i-1]['id']."\">".$message->inbox1[$i-1]['topic']." "; if($message->inbox1[$i-1]['viewed'] == 0) { echo "(new)"; diff --git a/Templates/Message/sent.tpl b/Templates/Message/sent.tpl index 35869e63..08f238d9 100644 --- a/Templates/Message/sent.tpl +++ b/Templates/Message/sent.tpl @@ -57,7 +57,8 @@ $s = 0; } $name = 1; - $support_messages = (($session->access == MULTIHUNTER || $session->access == ADMIN) && ADMIN_RECEIVE_SUPPORT_MESSAGES); + $support_messages = ($session->access == ADMIN && ADMIN_RECEIVE_SUPPORT_MESSAGES); + $multihunter_messages = ($session->access == MULTIHUNTER); for($i=(1+$s);$i<=(10+$s);$i++) { if(count($message->sent1) >= $i) { @@ -67,7 +68,18 @@ else { echo "
    ".((!$support_messages || ($support_messages && $message->inbox1[$i-1]['target'] != 1)) ? "sent1[$i-1]['id']."\" />" : 'S')."".$sent_as_text." sent1[$i-1]['id']."\">".$message->sent1[$i-1]['topic']." "; if($message->sent1[$i-1]['viewed'] == 0) { echo "(unread)"; diff --git a/Templates/Message/write.tpl b/Templates/Message/write.tpl index 6bf8604e..36ce0272 100644 --- a/Templates/Message/write.tpl +++ b/Templates/Message/write.tpl @@ -98,12 +98,16 @@ Reply: ".$database->getUserField($id,'username',0)." access == MULTIHUNTER || $session->access == ADMIN) && ADMIN_RECEIVE_SUPPORT_MESSAGES && !empty($_GET['mid'])) { + if ($session->access == ADMIN && ADMIN_RECEIVE_SUPPORT_MESSAGES && !empty($_GET['mid'])) { ?>
    /> Send as Support + } else if ($session->access == MULTIHUNTER) { + ?>
    + /> Send as Multihunter +

    Addressbook

    From 43dfea920b4044ff8fd3ff68d38a6aec71ae540b Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 2 Dec 2017 14:18:28 +0100 Subject: [PATCH 111/126] fix: unable to attack players with Multihunter access rights --- GameEngine/Units.php | 3 ++- Templates/Build/17.tpl | 5 +++-- Templates/Map/vilview.tpl | 4 ++-- Templates/a2b/startRaid.tpl | 3 ++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/GameEngine/Units.php b/GameEngine/Units.php index a460658f..25e01b1c 100755 --- a/GameEngine/Units.php +++ b/GameEngine/Units.php @@ -186,7 +186,8 @@ class Units { //check if banned/admin: $villageOwner = $database->getVillageField($id,'owner'); $userAccess = $database->getUserField($villageOwner,'access',0); - if($userAccess == '0' or $userAccess == '8' or (!ADMIN_ALLOW_INCOMING_RAIDS && $userAccess == '9')){ + $userID = $database->getUserField($villageOwner,'id',0); + if($userAccess == '0' or ($userAccess == MULTIHUNTER && $userID == 5) or (!ADMIN_ALLOW_INCOMING_RAIDS && $userAccess == ADMIN)){ $form->addError("error","Player is Banned. You can't attack him"); //break; } diff --git a/Templates/Build/17.tpl b/Templates/Build/17.tpl index 189ae021..b1e58865 100644 --- a/Templates/Build/17.tpl +++ b/Templates/Build/17.tpl @@ -31,10 +31,11 @@ else if(!empty($_POST['dname'])){ if(isset($checkexist) && $checkexist){ $villageOwner = $database->getVillageField($getwref,'owner'); $userAccess = $database->getUserField($villageOwner,'access',0); +$userID = $database->getUserField($villageOwner,'id',0); } $maxcarry = $market->maxcarry; $maxcarry *= $market->merchantAvail(); -if(isset($_POST['ft'])=='check' && $allres!=0 && $allres <= $maxcarry && ($_POST['x']!="" && $_POST['y']!="" or $_POST['dname']!="") && $checkexist && ($userAccess == 2 || (ADMIN_ALLOW_INCOMING_RAIDS && $userAccess == 9))){ +if(isset($_POST['ft'])=='check' && $allres!=0 && $allres <= $maxcarry && ($_POST['x']!="" && $_POST['y']!="" or $_POST['dname']!="") && $checkexist && ($userAccess == 2 || $userAccess == MULTIHUNTER || (ADMIN_ALLOW_INCOMING_RAIDS && $userAccess == ADMIN))){ ?>
    @@ -218,7 +219,7 @@ if(isset($_POST['ft'])=='check'){ $error = ''.NO_COORDINATES_SELECTED.''; }elseif($getwref == $village->wid){ $error = ''.CANNOT_SEND_RESOURCES.''; - }elseif($userAccess == '0' or $userAccess == '8' or (!ADMIN_ALLOW_INCOMING_RAIDS && $userAccess == '9')){ + }elseif($userAccess == '0' or ($userAccess == MULTIHUNTER && $userID == 5) or (!ADMIN_ALLOW_INCOMING_RAIDS && $userAccess == ADMIN)){ $error = ''.BANNED_CANNOT_SEND_RESOURCES.'.'; }elseif($_POST['r1']==0 && $_POST['r2']==0 && $_POST['r3']==0 && $_POST['r4']==0){ $error = ''.RESOURCES_NO_SELECTED.'.'; diff --git a/Templates/Map/vilview.tpl b/Templates/Map/vilview.tpl index 2bd77278..deb45e6e 100644 --- a/Templates/Map/vilview.tpl +++ b/Templates/Map/vilview.tpl @@ -515,7 +515,7 @@ if($type==18 or $type==19 or $type==20 or $type==21){ $data1 = mysqli_fetch_assoc($query1); $query2 = mysqli_query($GLOBALS['link'],'SELECT * FROM `' . TB_PREFIX . 'users` WHERE `id` = ' . $data1['owner']); $data2 = mysqli_fetch_assoc($query2); - if($data2['access']=='0' or $data2['access']=='8' or (!ADMIN_ALLOW_INCOMING_RAIDS && $data2['access']=='9')) { + if($data2['access']=='0' or ($data2['access']== MULTIHUNTER && $data2['id'] == 5) or (!ADMIN_ALLOW_INCOMING_RAIDS && $data2['access']=='9')) { echo "» ".SENDTROOP." (".BAN.")"; } else if($data2['vac_mode']=='1') { echo "» Send troops. (Vacation mode on)"; @@ -530,7 +530,7 @@ if($type==18 or $type==19 or $type==20 or $type==21){
    getVillageField($wref,'owner'); $userAccess = $database->getUserField($villageOwner,'access',0); + $userID = $database->getUserField($villageOwner,'id',0); - if ( $userAccess != '0' && $userAccess != '8' && ( $userAccess != '9' || ( ADMIN_ALLOW_INCOMING_RAIDS && $userAccess == '9' ) ) ) { + if ( $userAccess != '0' && ($userAccess == MULTIHUNTER && $userID == 5) && ( $userAccess != ADMIN || ( ADMIN_ALLOW_INCOMING_RAIDS && $userAccess == ADMIN ) ) ) { if ( $tribe == 1 ) { $uname = "u"; $uname1 = "u1"; From 073beed5c6576bf199cd57e8e287870ec0f36296 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 2 Dec 2017 14:24:58 +0100 Subject: [PATCH 112/126] fix: reverting testing server changes --- Templates/News/newsbox2.tpl | 65 ++++++++++++++++++++++++++++++------- Templates/menu.tpl | 14 -------- 2 files changed, 54 insertions(+), 25 deletions(-) diff --git a/Templates/News/newsbox2.tpl b/Templates/News/newsbox2.tpl index ec69b690..2787ee98 100644 --- a/Templates/News/newsbox2.tpl +++ b/Templates/News/newsbox2.tpl @@ -1,12 +1,55 @@ -
    - - - - +
    newsbox 2
    + ".(time() - (60*10))." AND tribe!=0 AND tribe!=4 AND tribe!=5"); + +?> + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Online Users: users
    Server Speed:
    Troop Speed: x
    Evasion Speed:
    Map Size: x
    Village Exp.:
    Beginners Prot.: hrs
    Medal Interval: = 86400){ echo ''.(MEDALINTERVAL/86400).' Days'; } else if(MEDALINTERVAL < 86400){ echo ''.(MEDALINTERVAL/3600).' Hours'; } ?>
    Server Start:
    diff --git a/Templates/menu.tpl b/Templates/menu.tpl index 340f9317..0256df28 100644 --- a/Templates/menu.tpl +++ b/Templates/menu.tpl @@ -68,20 +68,6 @@ div.c1 {text-align: center} } ?>

    - - VOTE FOR US -

    - - - travian private servers

    - Travian Private Servers

    - Travian Private Server

    -

    -
    Top Travian Private Servers
    - - -
    -
    isDeleting($session->uid); if($timestamp) { From 4b842ae0fa240d45bbb5b555312108ff182ae826 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 2 Dec 2017 15:04:15 +0100 Subject: [PATCH 113/126] fix: village destroyed text displayed twice for 2-row catapults attack #393 --- GameEngine/Automation.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 701816d7..a743c8c7 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -1095,8 +1095,10 @@ class Automation { } if ($isSecondRow) { - $info_cat .= "
    Information - \"Catapult\" ".$this->procResType($tbgid,$can_destroy,$isoasis)." destroyed."; + if ($tbid > 0 || ($tbid == 0 && strpos($info_cat, 'The village has') === false)) { + $info_cat .= "
    Information + \"Catapult\" " . $this->procResType( $tbgid, $can_destroy, $isoasis ) . " destroyed."; + } // embassy level was changed if ($tbgid==18){ @@ -1117,8 +1119,10 @@ class Automation { elseif ($battlepart[4]==0) { if ($isSecondRow) { - $info_cat .= "
    Information - \"Catapult\" ".$this->procResType($tbgid,$can_destroy,$isoasis)." was not damaged.
    Information + \"Catapult\" " . $this->procResType( $tbgid, $can_destroy, $isoasis ) . " was not damaged.
    Information \"Catapult\" The village has been destroyed.
    + + + + + + + + + + + + + + + + + +
    Edit answer
    Thread
    + + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    + Wood + Clay + Iron + Crop +
    +
    *aha**angry**cool**cry**cute**depressed**eek**ehem**emotional*:D:)*hit**hmm**hmpf**hrhr**huh**lazy**love**nocomment**noemotion**notamused**pout**redface**rolleyes*:(*shy**smile**tongue**veryangry**veryhappy*;)
    +
    LegionnairePraetorianImperianEquites LegatiEquites ImperatorisEquites CaesarisRamFire CatapultSenatorSettlerMacemanSpearmanAxemanScoutPaladinTeutonic KnightRamCatapultChieftainSettlerPhalanxSwordsmanPathfinderTheutates ThunderDruidriderHaeduanBattering RamTrebuchetChiefSettlerRatSpiderSnakeBatWild BoarWolfBearCrocodileTigerElephantPikemanThorned WarriorGuardsmanBirds of PreyAxeriderNatarian KnightWar ElephantBallistaNatarian EmperorSettlerHero +
    +
    +
    +
    + + +
    +
    + + + +
    + +

    + Warning: you can't use the values [message] or [/message] in your post because it can cause problem with bbcode system. + -
    - - - - - - - - - - - - - - - - - - - - -
    Edit answer
    Thread
    - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    - Wood - Clay - Iron - Crop
    -
    *aha**angry**cool**cry**cute**depressed**eek**ehem**emotional*:D:)*hit**hmm**hmpf**hrhr**huh**lazy**love**nocomment**noemotion**notamused**pout**redface**rolleyes*:(*shy**smile**tongue**veryangry**veryhappy*;)
    -
    LegionnairePraetorianImperianEquites LegatiEquites ImperatorisEquites CaesarisRamFire CatapultSenatorSettlerMacemanSpearmanAxemanScoutPaladinTeutonic KnightRamCatapultChieftainSettlerPhalanxSwordsmanPathfinderTheutates ThunderDruidriderHaeduanBattering RamTrebuchetChiefSettlerRatSpiderSnakeBatWild BoarWolfBearCrocodileTigerElephantPikemanThorned WarriorGuardsmanBirds of PreyAxeriderNatarian KnightWar ElephantBallistaNatarian EmperorSettlerHero
    -
    -
    -
    - - -
    -
    - - - -
    - -

    -Warning: you can't use the values [message] or [/message] in your post because it can cause problem with bbcode system. - \ No newline at end of file diff --git a/Templates/Alliance/Forum/forum_2.tpl b/Templates/Alliance/Forum/forum_2.tpl index 5b45d575..693da4c4 100644 --- a/Templates/Alliance/Forum/forum_2.tpl +++ b/Templates/Alliance/Forum/forum_2.tpl @@ -52,7 +52,7 @@ foreach($forumcat as $arr) { } } echo ''; - if($database->CheckEditRes($aid)=="1"){ + if($database->CheckEditRes($aid)=="1" && ($database->isAllianceOwner($session->uid) == $session->alliance || $arr['owner'] == $session->uid)){ echo ' To top edit
    @@ -113,7 +113,7 @@ foreach($forumcat as $arr) { } } echo ''; - if($database->CheckEditRes($aid)=="1"){ + if($database->CheckEditRes($aid)=="1" && ($database->isAllianceOwner($session->uid) == $session->alliance || $arr['owner'] == $session->uid)){ echo 'To topedit
    To bottomdelete'; }else{ echo 'Thread without new posts'; @@ -168,7 +168,7 @@ foreach($forumcat as $arr) { } } echo ''; - if($database->CheckEditRes($aid)=="1"){ + if($database->CheckEditRes($aid)=="1" && ($database->isAllianceOwner($session->uid) == $session->alliance || $arr['owner'] == $session->uid)){ echo 'To topedit
    To bottomdelete'; }else{ echo 'Thread without new posts'; @@ -223,7 +223,7 @@ if($closed1 != 0){ } } echo ''; - if($database->CheckEditRes($aid)=="1"){ + if($database->CheckEditRes($aid)=="1" && ($database->isAllianceOwner($session->uid) == $session->alliance || $arr['owner'] == $session->uid)){ echo 'To topedit
    To bottomdelete'; }else{ echo 'Thread without new posts'; diff --git a/Templates/Alliance/Forum/forum_4.tpl b/Templates/Alliance/Forum/forum_4.tpl index d31f2f26..0c9db803 100644 --- a/Templates/Alliance/Forum/forum_4.tpl +++ b/Templates/Alliance/Forum/forum_4.tpl @@ -38,7 +38,7 @@ if($ChckTopic){ } echo ''; - if($database->CheckEditRes($aid)=="1"){ + if($database->CheckEditRes($aid)=="1" && ($database->isAllianceOwner($session->uid) == $session->alliance || $arrs['owner'] == $session->uid)){ if($database->CheckCloseTopic($arrs['id']) == 1){ $locks = 'open topic'; }else{ @@ -72,7 +72,7 @@ if($ChckTopic){ } echo ''; - if($database->CheckEditRes($aid)=="1"){ + if($database->CheckEditRes($aid)=="1" && ($database->isAllianceOwner($session->uid) == $session->alliance || $arr['owner'] == $session->uid)){ if($database->CheckCloseTopic($arr['id']) == 1){ $lock = 'open topic'; }else{ diff --git a/Templates/Alliance/Forum/forum_6.tpl b/Templates/Alliance/Forum/forum_6.tpl index 73e52195..8f6130cc 100644 --- a/Templates/Alliance/Forum/forum_6.tpl +++ b/Templates/Alliance/Forum/forum_6.tpl @@ -61,7 +61,7 @@ $bbcode_topic = stripslashes(nl2br($bbcoded));
    created:
    CheckEditRes($aid)=="1"){ +if($database->CheckEditRes($aid)=="1" && ($database->isAllianceOwner($session->uid) == $session->alliance || $arr['owner'] == $session->uid)){ echo '
    editdelete

    '; } ?> @@ -154,7 +154,7 @@ echo '
    created: '.$date.'
    '; - if($database->CheckEditRes($aid)=="1"){ + if($database->CheckEditRes($aid)=="1" && ($database->isAllianceOwner($session->uid) == $session->alliance || $po['owner'] == $session->uid)){ echo '
    editdelete

    '; } echo '
    '.$bbcode_post.'
    diff --git a/Templates/Alliance/forum.tpl b/Templates/Alliance/forum.tpl index cf1791a8..e9dbc28a 100644 --- a/Templates/Alliance/forum.tpl +++ b/Templates/Alliance/forum.tpl @@ -372,7 +372,7 @@ if($opt['opt5'] == 1){ if($database->CheckResultEdit($aid) != 1){ $database->CreatResultEdit($aid,1); }else{ - if($database->CheckEditRes($aid) == 1){ + if($database->CheckEditRes($aid) == 1 && $database->isAllianceOwner($session->uid) == $session->alliance){ $database->UpdateResultEdit($aid,''); }else{ $database->UpdateResultEdit($aid,1); From 5264cbff6270342be4dabfbff9548268612a92d8 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Mon, 4 Dec 2017 20:59:02 +0100 Subject: [PATCH 123/126] fix: lumber, crop, iron, clay BBCode icons not replaced in forum posts #409 --- GameEngine/BBCode.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/GameEngine/BBCode.php b/GameEngine/BBCode.php index d57b3b7b..e0583121 100755 --- a/GameEngine/BBCode.php +++ b/GameEngine/BBCode.php @@ -58,10 +58,10 @@ $pattern[50] = "/\[tid48\]/"; $pattern[51] = "/\[tid49\]/"; $pattern[52] = "/\[tid50\]/"; $pattern[53] = "/\[hero\]/"; -$pattern[54] = "/\[l\]/"; -$pattern[55] = "/\[cl\]/"; -$pattern[56] = "/\[i\]/"; -$pattern[57] = "/\[c\]/"; +$pattern[54] = "/\[lumber\]/"; +$pattern[55] = "/\[clay\]/"; +$pattern[56] = "/\[iron\]/"; +$pattern[57] = "/\[crop\]/"; $pattern[58] = "/\*aha\*/"; $pattern[59] = "/\*angry\*/"; $pattern[60] = "/\*cool\*/"; From 0c040477331a9ae245dbc8973985019f19bb8ceb Mon Sep 17 00:00:00 2001 From: DracoMilesX Date: Mon, 4 Dec 2017 22:19:03 +0100 Subject: [PATCH 124/126] Update compact.css --- gpack/travian_t4/lang/en/compact.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gpack/travian_t4/lang/en/compact.css b/gpack/travian_t4/lang/en/compact.css index 13ccf1f0..2c9e343b 100644 --- a/gpack/travian_t4/lang/en/compact.css +++ b/gpack/travian_t4/lang/en/compact.css @@ -8905,7 +8905,7 @@ div.plus table#plus_features td.preview img.att_mark { width: 200px; } div.logout img.roman, div.signup img.roman { - background-image: url("http://img.travian.org/img/de/temp/roemer.gif"); + background-image: url("../../img/un/h/roemer.jpg"); height: 156px; width: 129px; } @@ -9040,4 +9040,4 @@ input.accept{width:12px;height:12px;background-image:url(../../img/a/acc.gif);} #Frame { top: 0; z-index: 1000; -} \ No newline at end of file +} From b142548c4e0687d7a63f22e76a9efcf13676241d Mon Sep 17 00:00:00 2001 From: DracoMilesX Date: Mon, 4 Dec 2017 22:19:47 +0100 Subject: [PATCH 125/126] Update compact.css --- gpack/travian_default/lang/en/compact.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gpack/travian_default/lang/en/compact.css b/gpack/travian_default/lang/en/compact.css index a8b34d21..652bada2 100644 --- a/gpack/travian_default/lang/en/compact.css +++ b/gpack/travian_default/lang/en/compact.css @@ -8949,7 +8949,7 @@ div.plus table#plus_features td.preview img.att_mark { width: 200px; } div.logout img.roman, div.signup img.roman { - background-image: url("http://img.travian.org/img/de/temp/roemer.gif"); + background-image: url("../../img/un/h/roemer.jpg"); height: 156px; width: 129px; } @@ -9084,4 +9084,4 @@ input.accept{width:12px;height:12px;background-image:url(../../img/a/acc.gif);} #Frame { top: 0; z-index: 1000; -} \ No newline at end of file +} From 7a33e15775bb89590cd9d3df124b5cf816fe0a79 Mon Sep 17 00:00:00 2001 From: DracoMilesX Date: Mon, 4 Dec 2017 22:20:50 +0100 Subject: [PATCH 126/126] Update index.php --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index 4611f747..3e8f5dbc 100644 --- a/index.php +++ b/index.php @@ -204,7 +204,7 @@ AccessLogger::logRequest();