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/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/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"; } 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/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 08f7f2ad..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)) @@ -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); } @@ -39,28 +39,59 @@ if(isset($id)) $result = $database->query_return($q); if(count($result) >0) { + $newResult = []; 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; + } + + $newResult[] = $row; + } } $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 +100,14 @@ if(isset($id)) } }; $generator = new MyGenerator; - + if($village and $user) { include("search2.tpl"); ?> - +
@@ -237,9 +268,9 @@ if(isset($id)) 0) + if(count($newResult)) { - foreach($result as $row) + foreach($newResult as $row) { echo " @@ -247,9 +278,9 @@ if(isset($id)) - + "; - } + } } elseif($result ==0) { @@ -278,6 +309,7 @@ if(isset($id)) $level = $fdata['f'.($f)]; echo ""; } + ?>
@@ -337,6 +369,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'; } + } + ?>
= 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/GameEngine/Account.php b/GameEngine/Account.php index a1fee486..b730be41 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); } @@ -103,7 +106,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'])) { @@ -154,14 +157,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 +212,22 @@ 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); + } + } 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"); diff --git a/GameEngine/Admin/Mods/editAdminInfo.php b/GameEngine/Admin/Mods/editAdminInfo.php index 8e66d6b2..672ae9cf 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..7ad37818 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..59b1ab1f 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..f1ec6e0e 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..6f271bd4 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..dc883216 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); 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/Admin/database.php b/GameEngine/Admin/database.php index c3a08562..43478246 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); @@ -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/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/Automation.php b/GameEngine/Automation.php index b2630e1b..51af2a72 100755 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -654,11 +654,10 @@ class Automation { if ($level != 1) { $max -= ${'bid'.$indi['type']}[$level-1]['attri'] * STORAGE_MULTIPLIER; - $max += ${'bid'.$indi['type']}[$level]['attri'] * STORAGE_MULTIPLIER; - } else { - $max = ${'bid'.$indi['type']}[$level]['attri'] * STORAGE_MULTIPLIER; } + $max += ${'bid'.$indi['type']}[$level]['attri'] * STORAGE_MULTIPLIER; + $fieldsToSet[$fieldDbName] = $max; } @@ -1085,14 +1084,9 @@ 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) { - $pop=$this->recountPop($data['to'], false); if($pop==0 && $can_destroy==1){ $village_destroyed = 1; // this will ensure the right $info_cat text @@ -1101,18 +1095,34 @@ class Automation { } if ($isSecondRow) { - $info_cat .= "
"; + 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 ) . " destroyed."; + + // embassy level was changed + if ($tbgid==18){ + $info_cat .= $database->checkEmbassiesAfterBattle($data['to'], $bdo['f'.$catapultTarget], false); + } } } // building/field not damaged elseif ($battlepart[4]==0) { if ($isSecondRow) { - $info_cat .= "
"; + 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."; } @@ -1162,11 +1172,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]; @@ -1192,9 +1197,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'], $bdo['f'.$catapultTarget], 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'], $bdo['f'.$catapultTarget], false ); + } } } } @@ -1207,7 +1224,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 = " @@ -2204,7 +2221,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']; } @@ -2268,6 +2285,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']; @@ -2278,15 +2298,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++) { @@ -2299,13 +2316,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, @@ -2322,6 +2332,53 @@ 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 + */ + + // 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) + { + $j++; + $_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 @@ -2339,46 +2396,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 */ @@ -2656,7 +2688,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'])) { @@ -2716,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 .= "
"; } @@ -2803,7 +2835,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 +3036,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']; } @@ -3139,8 +3171,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']); } @@ -3212,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; @@ -3325,10 +3371,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'; @@ -3438,7 +3481,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); @@ -3992,113 +4035,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; } @@ -4501,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) { @@ -4525,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); @@ -4608,15 +4676,15 @@ 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; } $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'; @@ -4635,9 +4703,13 @@ 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'; + $columnValues[] = 0; + $modes[] = null; + $columns[] = 'intraining'; $columnValues[] = 0; $modes[] = null; @@ -5249,9 +5321,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/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\*/"; 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{ diff --git a/GameEngine/Building.php b/GameEngine/Building.php index 4b0cbdee..17e81ff6 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,30 +41,178 @@ class Building { } } } - + + public function residenceOfPalaceBuildInProgress() { + global $database, $village; + + $residenceOrPalaceInProgress = $database->getBuildingByType2($village->wid, '25, 26'); + $residenceBuildInProgress = false; + $palaceBuildInProgress = false; + + if (count($residenceOrPalaceInProgress)) { + foreach ($residenceOrPalaceInProgress as $record) { + if ($record == 25) { + $residenceBuildInProgress = true; + } else { + $palaceBuildInProgress = true; + } + } + } + + return [ + 'residence' => $residenceBuildInProgress, + 'palace' => $palaceBuildInProgress + ]; + } + + /* + * 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 = 2; + } else { + $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; + } + } + + 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 ($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; + } + } + + return $cached; + } + public function canProcess($id,$tid) { - //add fix by ronix - global $session; + //add fix by ronix + global $session, $database, $village; + if($session->access==BANNED){ header("Location: banned.php"); exit; } else { - if ($this->checkResource($id,$tid)!=4) { - if($tid >= 19) { - header("Location: dorf2.php"); + $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"); + } else { + header( "Location: dorf1.php" ); exit; - } - exit; - } - } - } + } + } + + 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 + ( + ($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 || + $levels['f'.$tid.'t'] == 0 + ) + ) { + if ( !isset($_GET['master']) && $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']); @@ -74,21 +222,25 @@ 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)) { + $this->canProcess($get['master'],$get['id']); $m=$get['master']; $master = $_GET; $session->changeChecker(); 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"); + } + + $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; } } @@ -334,7 +486,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']; @@ -369,6 +521,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); @@ -434,37 +592,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()) && + ( + !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; + } } } @@ -684,16 +857,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; @@ -830,7 +1005,7 @@ class Building { if ($session->uid == 1) { return 0; } - + $keyholder = array(); if($vid == 0) { @@ -838,7 +1013,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 +1028,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 +1045,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 +1199,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 1aa6a30f..a13da379 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 @@ -1441,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']; @@ -1456,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) { @@ -1673,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; @@ -1719,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 @@ -1765,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"; @@ -2905,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']; @@ -3287,15 +3308,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, 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 - wref = " . $vid ); + wref = " . $vid ; + + return mysqli_query( $this->dblink, $q); } function setMaxStoreForVillage($vid, $maxLevel) { @@ -3817,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) { @@ -3843,9 +3866,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); @@ -3995,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 @@ -4078,15 +4110,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]; @@ -4096,28 +4139,40 @@ References: User ID/Message ID, Mode } } } else { - $id = (int) $id; + if (!$mode_updated) { + $id = (int) $id; + } } 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"; 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).")"; 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).")"; @@ -4126,15 +4181,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); @@ -4203,7 +4259,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); } @@ -4217,7 +4273,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); @@ -4234,7 +4290,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); @@ -4248,7 +4304,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); } @@ -4443,8 +4499,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 @@ -4528,7 +4584,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 = $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 @@ -4612,273 +4668,271 @@ 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); + $minimumExistingEmbassyRecords = 1; - // 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; } - 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")); @@ -4886,7 +4940,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) { @@ -4899,65 +4953,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 @@ -4969,27 +5072,34 @@ References: User ID/Message ID, Mode return $result['Total']; } - // no need to cache this method function getBuildingByType($wid,$type) { - list($wid,$type) = $this->escape_input((int) $wid,(int) $type); + // cache data + $bdata = $this->getBData($wid); + $type = (strpos($type, ',') === false ? [(int) $type] : explode(',', str_replace(' ', '', $this->escape($type)))); - $q = "SELECT * FROM " . TB_PREFIX . "bdata where wid = $wid and type = $type and master = 0"; - $result = mysqli_query($this->dblink,$q); - return $this->mysqli_fetch_all($result); + // return all jobs which are of the requested type + $data = []; + foreach ($bdata as $row) { + if (in_array($row['field'], $type)) { + $data[] = $row; + } + } + + return $data; } function getBuildingByType2($wid,$type) { $wid = (int) $wid; if (!is_array($type)) { - $type = [(int) $type]; + $type = [$type]; } else { foreach ($type as $index => $typeValue) { $type[$index] = (int) $typeValue; } } - $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 = []; @@ -5010,22 +5120,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) { @@ -5290,7 +5412,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(); @@ -5329,7 +5451,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; @@ -5343,7 +5465,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; } } @@ -5367,6 +5489,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); @@ -5436,7 +5565,7 @@ References: User ID/Message ID, Mode $t11 = [$t11]; $type = [$type]; $ctar1 = [$ctar1]; - $ctar2 = [$ctar1]; + $ctar2 = [$ctar2]; $spy = [$spy]; $b1 = [$b1]; $b2 = [$b2]; @@ -5713,7 +5842,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]; } @@ -6094,7 +6223,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 +6340,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 +6366,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 +6377,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; @@ -6417,23 +6546,33 @@ 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)])) { $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]; } if (!isset($movingunits['hero'])) { $movingunits['hero'] = 0; } + + if (!isset($out['t11'])) { + $out['t11'] = 0; + } + $movingunits['hero'] += $out['t11']; } } $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++) { @@ -6825,20 +6964,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) { @@ -6847,15 +6988,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) { @@ -6867,15 +7025,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) { @@ -6883,15 +7055,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) { @@ -6899,15 +7085,49 @@ 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] = []; + } + + 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) { @@ -6940,7 +7160,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 ); @@ -7496,7 +7716,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; @@ -7512,7 +7732,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 ); } 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)) { 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 sledeć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 ć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 omogućene kolačić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 već na poslu."); +define("CONSTRUCTING_MASTER_BUILDER","Izgradnja sa glavnim graditeljom "); +define("COSTS","troškovi"); +define("GOLD","Zlato"); +define("WORKERS_ALREADY_WORK_WAITING","Radnici su već 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čeć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"; + + +?> diff --git a/GameEngine/Message.php b/GameEngine/Message.php index 6c34592e..e415167e 100755 --- a/GameEngine/Message.php +++ b/GameEngine/Message.php @@ -25,8 +25,9 @@ class Message { if ($req_file == 'nachrichten.php') { if ( isset( $_GET['t'] ) ) { switch ( $_GET['t'] ) { - // send messages page + // send messages page or a single sent message case 2: + case '2a': $this->getMessages( 2 ); break; @@ -402,7 +403,7 @@ class Message { private function sendAMessage($topic,$text) { global $session,$database; - + // Vulnerability closed by Shadow $q = "SELECT Count(*) as Total FROM ".TB_PREFIX."mdata WHERE owner='".$session->uid."' AND time > ".(time() - 60); @@ -412,7 +413,7 @@ class Message { return; //flood // Vulnerability closed by Shadow - + $allmembersQ = mysqli_query($GLOBALS['link'],"SELECT id FROM ".TB_PREFIX."users WHERE alliance='".$session->alliance."'"); $userally = $database->getUserField($session->uid,"alliance",0); $permission=mysqli_fetch_array(mysqli_query($GLOBALS['link'],"SELECT opt7 FROM ".TB_PREFIX."ali_permission WHERE uid='".$session->uid."'")); @@ -581,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/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]); 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/GameEngine/Session.php b/GameEngine/Session.php index 523c5929..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'); @@ -208,21 +208,29 @@ class Session { global $database,$link; $villageIDs = implode(', ', $this->villages); - $hero = mysqli_fetch_array( - mysqli_query($database->dblink, ' + if (!count($this->villages)) { + $this->Logout(); + header('login.php'); + exit; + } + + // check if hero unit for this player is present anywhere on the map + $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']; - $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); } } @@ -261,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/GameEngine/Technology.php b/GameEngine/Technology.php index ae11ccdb..223cc101 100755 --- a/GameEngine/Technology.php +++ b/GameEngine/Technology.php @@ -443,141 +443,131 @@ 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 ) + ) { + $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 ]); + } + } + } - 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'])) { + // $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) { diff --git a/GameEngine/Units.php b/GameEngine/Units.php index b64e64e7..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; } @@ -552,6 +553,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/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)); 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 99ebcf0d..7e973c17 100644 --- a/README.md +++ b/README.md @@ -1,224 +1,64 @@ -[![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) +[![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) +[![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) +[![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 b2 +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 -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) +* [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) -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 :) +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. -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 --- \ No newline at end of file +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/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 7bcd14af..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} - getEnforce($session->villages[0], 0); -if ($rat['u31']<1){?> +$rat = $database->getEnforce(0, $village->wid); +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} -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

    ".$row['name']." getMapCheck($row['wref'])."\" target=\"blank\">(".$row['x']."|".$row['y'].") ".round($row['loyalty'])."%$type".$row['type']."
    Information - \"Catapult\" ".$this->procResType($tbgid,$can_destroy,$isoasis)." destroyed.
    Information + \"Catapult\" " . $this->procResType( $tbgid, $can_destroy, $isoasis ) . " destroyed."; + } + + // embassy level was changed + if ($tbgid==18){ + $info_cat .= $database->checkEmbassiesAfterBattle($data['to'], $bdo['f'.$catapultTarget], false); + } + + $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\" ".$this->procResType($tbgid,$can_destroy,$isoasis).$info_cata."
    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 top
    edit
    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 a124293e..8f6130cc 100644 --- a/Templates/Alliance/Forum/forum_6.tpl +++ b/Templates/Alliance/Forum/forum_6.tpl @@ -61,8 +61,8 @@ $bbcode_topic = stripslashes(nl2br($bbcoded));
    created:
    CheckEditRes($aid)=="1"){ - echo '
    editdelete

    '; +if($database->CheckEditRes($aid)=="1" && ($database->isAllianceOwner($session->uid) == $session->alliance || $arr['owner'] == $session->uid)){ + 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']; @@ -154,8 +154,8 @@ echo '
    created: '.$date.'
    '; - if($database->CheckEditRes($aid)=="1"){ - echo '
    editdelete

    '; + if($database->CheckEditRes($aid)=="1" && ($database->isAllianceOwner($session->uid) == $session->alliance || $po['owner'] == $session->uid)){ + 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/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" ".$titel." ".$medal['plaats']." diff --git a/Templates/Alliance/forum.tpl b/Templates/Alliance/forum.tpl index d514058c..e9dbc28a 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)){ @@ -370,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); @@ -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 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"); ?> @@ -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 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/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/Build/37.tpl b/Templates/Build/37.tpl index c9ac1231..45654d3a 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,72 @@

    - getTimeFormat($hero_info['trainingtime'] - time()); + $include_training = true; + $include_revive = false; + 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($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()); ?>
    vname; ?>
     getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" />getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" />
    @@ -85,9 +111,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 7d16acc8..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.""; @@ -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; } diff --git a/Templates/Build/avaliable.tpl b/Templates/Build/avaliable.tpl index 2aecbb5d..7087197c 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(); +$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"); } 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"; } ?>
    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 ) { diff --git a/Templates/Manual/433.tpl b/Templates/Manual/433.tpl index 8b29bfbc..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/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){
    @@ -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";

    Messages

    - @@ -14,26 +14,26 @@ include("menu.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 " - 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) { if($message->sent1[$i-1]['target'] == 0) { @@ -67,8 +68,19 @@ else { echo ""; } - echo " - + +Sent -noticearray) == 0) { echo ""; - } + } ?> - +
    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) { - echo "«»"; + echo "«»"; } else if(count($message->archived1) > $_GET['s']+10) { - echo "«»"; + echo "«»"; } - else { - echo "«»"; + else if (count($message->archived1) > 10) { + echo "«»"; } } ?>
    Subject SenderSentSent
    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 "«»"; + else if(count($message->inbox1) > 10) { + echo "«»"; } } ?>
    ".((!$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 08dcd8e9..08f238d9 100644 --- a/Templates/Message/sent.tpl +++ b/Templates/Message/sent.tpl @@ -29,27 +29,27 @@ - sent1) < 10) { 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 "«»"; + else if (count($message->sent1) > 10) { + echo "«»"; } } ?>
    ".((!$support_messages || ($support_messages && $message->inbox1[$i-1]['target'] != 1)) ? "sent1[$i-1]['id']."\" />" : 'S')."sent1[$i-1]['id']."\">".$message->sent1[$i-1]['topic']." "; + + $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 "".$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

    diff --git a/Templates/Notice/all.tpl b/Templates/Notice/all.tpl index 57c48166..4dacb26c 100644 --- a/Templates/Notice/all.tpl +++ b/Templates/Notice/all.tpl @@ -1,4 +1,4 @@ -
    @@ -8,7 +8,7 @@ $noticeClass = array("Scout Report","Won as attacker without losses","Won as att
    Subject: -Sent
    - plus) { + plus) { if(isset($_GET['t']) && $_GET['t'] == 5) { echo ""; } else { - echo ""; + echo ""; } }?> - noticearray) < 10) { 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 "«»"; + else if (count($message->noticearray) > 10) { + 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/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/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]

    - - + +

    - + 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); ?> -

    +

    @@ -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
    - + - + - + - + -

    diff --git a/Templates/a2b/startRaid.tpl b/Templates/a2b/startRaid.tpl index c4dd1024..d79507b7 100644 --- a/Templates/a2b/startRaid.tpl +++ b/Templates/a2b/startRaid.tpl @@ -15,89 +15,141 @@ $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']; + $userID = $database->getUserField($villageOwner,'id',0); + + if ( $userAccess != '0' && !($userAccess == MULTIHUNTER && $userID == 5) && ( $userAccess != ADMIN || ( ADMIN_ALLOW_INCOMING_RAIDS && $userAccess == ADMIN ) ) ) { + 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 ++ ) { + if ($tribe == 1) { + $unitKey = $uname2 . $u; + } else { + $unitKey = $uname2 . ($u < 10 ? $u : 0); + } + + $units[] = $uname2 . $unitKey; + $amounts[] = $data[ 'u' . $unitKey ]; + $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())); - } } } } diff --git a/Templates/field.tpl b/Templates/field.tpl index 551dce63..655a970c 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"; +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++) { + echo " procResType($arrayVillage['f'.$i.'t'])." Level ".$arrayVillage['f'.$i].(isset($activeFields[$i]) ? ' (upgrade in progress)' : '')."\"/>\r\n"; } ?>
    -"; + echo "\"$text"; } } ?> diff --git a/Templates/footer.tpl b/Templates/footer.tpl index 9b048ae6..20b2d28d 100644 --- a/Templates/footer.tpl +++ b/Templates/footer.tpl @@ -22,7 +22,7 @@ diff --git a/Templates/menu.tpl b/Templates/menu.tpl index 1b2055d1..0256df28 100644 --- a/Templates/menu.tpl +++ b/Templates/menu.tpl @@ -62,11 +62,11 @@ div.c1 {text-align: center} + ?> + ?>

    isDeleting($session->uid); @@ -110,9 +110,9 @@ div.c1 {text-align: center} -
    diff --git a/Templates/res.tpl b/Templates/res.tpl index c256560b..61c0759a 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 +?>
    @@ -41,13 +43,13 @@ $totalproduction = $village->allcrop; // all crops + bakery + grain mill - + - + - - - - - + + + +
                                                                                            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); diff --git a/a2b.php b/a2b.php index 9a833b81..d25dba55 100644 --- a/a2b.php +++ b/a2b.php @@ -95,7 +95,7 @@ if(isset($_GET['o'])) { - + +?>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..0df2f515 100644 --- a/a2b2.php +++ b/a2b2.php @@ -40,10 +40,10 @@ $automation->isWinner(); - + - + gpack == null || GP_ENABLE == false) { echo " diff --git a/activate.php b/activate.php index 0e0c5954..d6bcc13b 100644 --- a/activate.php +++ b/activate.php @@ -27,9 +27,9 @@ AccessLogger::logRequest(); - + - + diff --git a/allianz.php b/allianz.php index d00ba1fa..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 - + +?>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..cf554c89 100644 --- a/anmelden.php +++ b/anmelden.php @@ -33,9 +33,9 @@ $invited=(isset($_GET['uid'])) ? filter_var($_GET['uid'], FILTER_SANITIZE_NUMBER - + - + diff --git a/banned.php b/banned.php index 7ec31782..39ad3deb 100644 --- a/banned.php +++ b/banned.php @@ -29,9 +29,9 @@ if($session->access == BANNED){ - + - + gpack == null || GP_ENABLE == false) { diff --git a/berichte.php b/berichte.php index 46fcf6a5..2fc415fa 100644 --- a/berichte.php +++ b/berichte.php @@ -47,10 +47,10 @@ if(isset($_GET['newdid'])) { - + - + gpack == null || GP_ENABLE == false) { echo " diff --git a/build.php b/build.php index 29e19289..d39887eb 100644 --- a/build.php +++ b/build.php @@ -329,10 +329,10 @@ 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/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/create_account.php b/create_account.php index 598a30e9..6010ce8f 100644 --- a/create_account.php +++ b/create_account.php @@ -59,9 +59,9 @@ AccessLogger::logRequest(); - + - + gpack == null || GP_ENABLE == false) { diff --git a/crop_finder.php b/crop_finder.php index e3a4fbc0..1bc536ae 100644 --- a/crop_finder.php +++ b/crop_finder.php @@ -47,7 +47,7 @@ $start_timer = $generator->pageLoadTimeStart(); - + +?>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..331f7906 100644 --- a/dorf1.php +++ b/dorf1.php @@ -39,9 +39,9 @@ if(isset($_GET['newdid'])) { - + - + gpack == null || GP_ENABLE == false) { diff --git a/dorf2.php b/dorf2.php index 99f9d3df..ab4f4e8e 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{ @@ -39,10 +39,10 @@ $automation->isWinner(); - + - + gpack == null || GP_ENABLE == false) { echo " diff --git a/dorf3.php b/dorf3.php index f84b3d44..96d05be2 100644 --- a/dorf3.php +++ b/dorf3.php @@ -42,10 +42,10 @@ if(isset($_GET['newdid'])) { - + - + gpack == null || GP_ENABLE == false) { echo " diff --git a/gpack/travian_default/img/g/s/lvl11_20_active.gif b/gpack/travian_default/img/g/s/lvl11_20_active.gif new file mode 100644 index 00000000..e8ef604d Binary files /dev/null and b/gpack/travian_default/img/g/s/lvl11_20_active.gif differ 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 00000000..79cab4aa Binary files /dev/null and b/gpack/travian_default/img/g/s/lvl1_10_active.gif differ 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 00000000..f9a06d9f Binary files /dev/null and b/gpack/travian_default/img/g/s/lvl21_30_active.gif differ diff --git a/gpack/travian_default/lang/en/b/zurueck.html b/gpack/travian_default/lang/en/b/zurueck.html index 1b0dc904..f50d31ae 100644 --- a/gpack/travian_default/lang/en/b/zurueck.html +++ b/gpack/travian_default/lang/en/b/zurueck.html @@ -8,12 +8,12 @@ - + - - - - + + + + @@ -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