The first release of the refactored version

It's still a work in progress, there are a lot of things that will
change in the final release
This commit is contained in:
iopietro
2018-09-16 17:22:39 +02:00
parent f032523e1c
commit 62d6e19ee9
3503 changed files with 90956 additions and 35819 deletions
-280
View File
@@ -1,280 +0,0 @@
<?php
use App\Entity\User;
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Project: TravianZ ##
## Version: 22.06.2015 ##
## Filename Account.php ##
## Developed by: Mr.php , Advocaite , brainiacX , yi12345 , Shadow , ronix ##
## Fixed by: Shadow - STARVATION , HERO FIXED COMPL. ##
## Fixed by: InCube - double troops ##
## License: TravianZ Project ##
## Copyright: TravianZ (c) 2010-2015. All rights reserved. ##
## URLs: http://travian.shadowss.ro ##
## Source code: https://github.com/Shadowss/TravianZ ##
## ##
#################################################################################
global $autoprefix;
// go max 5 levels up - we don't have folders that go deeper than that
$autoprefix = '';
for ($i = 0; $i < 5; $i++) {
$autoprefix = str_repeat('../', $i);
if (file_exists($autoprefix.'autoloader.php')) {
// we have our path, let's leave
break;
}
}
include_once($autoprefix."GameEngine/Session.php");
class Account {
function __construct() {
global $session;
if(isset($_POST['ft'])) {
switch($_POST['ft']) {
case "a1":
$this->Signup();
break;
case "a2":
$this->Activate();
break;
case "a3":
$this->Unreg();
break;
case "a4":
$this->Login();
break;
}
} if(isset($_GET['code'])) {
$_POST['id'] = $_GET['code']; $this->Activate();
}
else {
if($session->logged_in && in_array("logout.php",explode("/",$_SERVER['PHP_SELF']))) {
$this->Logout();
}
}
}
private function Signup() {
global $database,$form,$mailer,$generator,$session;
if(!isset($_POST['name']) || trim($_POST['name']) == "") {
$form->addError("name",USRNM_EMPTY);
}
else {
if(strlen($_POST['name']) < USRNM_MIN_LENGTH) {
$form->addError("name",USRNM_SHORT);
}
else if(!USRNM_SPECIAL && preg_match('/[^0-9A-Za-z]/',$_POST['name'])) {
$form->addError("name",USRNM_CHAR);
}
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);
}
}
if(!isset($_POST['pw']) || trim($_POST['pw']) == "") {
$form->addError("pw",PW_EMPTY);
}
else {
if(strlen($_POST['pw']) < PW_MIN_LENGTH) {
$form->addError("pw",PW_SHORT);
}
else if($_POST['pw'] == $_POST['name']) {
$form->addError("pw",PW_INSECURE);
}
}
if(!isset($_POST['email'])) {
$form->addError("email",EMAIL_EMPTY);
}
else {
if(!$this->validEmail($_POST['email'])) {
$form->addError("email",EMAIL_INVALID);
}
else if(User::exists($database,$_POST['email'])) {
$form->addError("email",EMAIL_TAKEN);
}
}
if(!isset($_POST['vid']) || !in_array($_POST['vid'], [1, 2, 3])) {
$form->addError("tribe",TRIBE_EMPTY);
}
if(!isset($_POST['agb'])) {
$form->addError("agree",AGREE_ERROR);
}
if($form->returnErrors() > 0) {
$form->addError("invt",$_POST['invited']);
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $_POST;
header("Location: anmelden.php");
exit;
}
else {
if(AUTH_EMAIL){
$act = $generator->generateRandStr(10);
$act2 = $generator->generateRandStr(5);
$uid = $database->activate($_POST['name'],password_hash($_POST['pw'], PASSWORD_BCRYPT,['cost' => 12]),$_POST['email'],$_POST['vid'],$_POST['kid'],$act,$act2);
if($uid) {
$mailer->sendActivate($_POST['email'],$_POST['name'],$_POST['pw'],$act);
header("Location: activate.php?id=$uid&q=$act2");
exit;
}
}
else {
$uid = $database->register($_POST['name'], password_hash($_POST['pw'], PASSWORD_BCRYPT, ['cost' => 12]), $_POST['email'], $_POST['vid'], $act);
if($uid) {
setcookie("COOKUSR" , $_POST['name'], time() + COOKIE_EXPIRE,COOKIE_PATH);
setcookie("COOKEMAIL" , $_POST['email'], time() + COOKIE_EXPIRE,COOKIE_PATH);
$database->updateUserField(
$uid,
["act", "invited"],
["", $_POST['invited']],
1
);
$this->generateBase($_POST['kid'], $uid, $_POST['name']);
header("Location: login.php");
exit;
}
}
}
}
private function Activate() {
global $database;
if(START_DATE < date('d.m.Y') or START_DATE == date('d.m.Y') && START_TIME <= date('H:i'))
{
$q = "SELECT act, username, password, email, tribe, location FROM ".TB_PREFIX."activate where act = '".$database->escape($_POST['id'])."'";
$result = mysqli_query($database->dblink,$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['location'],$uid,$dbarray['username']);
header("Location: activate.php?e=2");
exit;
}
}
else
{
header("Location: activate.php?e=3");
exit;
}
}
else
{
header("Location: activate.php");
exit;
}
}
private function Unreg() {
global $database;
$q = "SELECT password, username FROM ".TB_PREFIX."activate where id = ".(int) $_POST['id'];
$result = mysqli_query($database->dblink,$q);
$dbarray = mysqli_fetch_array($result);
if(password_verify($_POST['pw'], $dbarray['password'])) {
$database->unreg($dbarray['username']);
header("Location: anmelden.php");
exit;
}
else {
header("Location: activate.php?e=3");
exit;
}
}
private function Login() {
global $database, $session, $form;
$user = $_POST['user'];
if(!isset($_POST['user']) || empty($_POST['user'])){
$form->addError("user", $user);
}else if(!User::exists($database, $_POST['user'])){
$form->addError("user", USR_NT_FOUND);
}
if(!isset($_POST['pw']) || empty($_POST['pw'])){
$form->addError("pw", LOGIN_PASS_EMPTY);
}else if(!$database->login($_POST['user'], $_POST['pw']) && !$database->sitterLogin($_POST['user'], $_POST['pw'])){
// try activation data if the user was not found
if(!$userData){
$activateData = $database->getActivateField($_POST['user'], 'act', 1);
if(!empty($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);
// Vacation mode by Shadow
if($userData["vac_mode"] == 1 && $userData["vac_time"] > time()){
$form->addError("vacation", "Vacation mode is still enabled");
}
// Vacation mode by Shadow
if($form->returnErrors() > 0){
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $_POST;
header("Location: login.php");
exit();
}else{
// Vacation mode by Shadow
$database->removevacationmode($userData['id']);
// Vacation mode by Shadow
if($database->login($_POST['user'], $_POST['pw'])){
$database->UpdateOnline("login", $_POST['user'], time(), $userData['id']);
}else if($database->sitterLogin($_POST['user'], $_POST['pw'])){
$database->UpdateOnline("sitter", $_POST['user'], time(), $userData['id']);
}
setcookie("COOKUSR", $_POST['user'], time() + COOKIE_EXPIRE, COOKIE_PATH);
$session->login($_POST['user']);
}
}
private function Logout() {
global $session, $database;
unset($_SESSION['wid']);
$database->activeModify(addslashes($session->username),1);
$database->UpdateOnline("logout") or die(mysqli_error($database->dblink));
$session->Logout();
}
private function validEmail($email) {
$regexp="/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}$/i";
return preg_match($regexp, $email);
}
function generateBase($kid, $uid, $username) {
global $database;
$message = new Message();
if($kid == 0) $kid = rand(1,4);
else $kid = $_POST['kid'];
$database->generateVillages([['wid' => 0, 'mode' => 0, 'type' => 3, 'kid' => $kid, 'capital' => 1, 'pop' => 2, 'name' => null, 'natar' => 0]], $uid, $username);
$message->sendWelcome($uid, $username);
}
};
$account = new Account;
?>
+1 -4
View File
@@ -629,9 +629,6 @@ class adm_DB {
if($unitarray) { reset($unitarray); }
$unitarray = $GLOBALS["u".$i];
$speeds[] = $unitarray['speed'];
//echo print_r(array_keys($speeds))."unitspd\n".$i."trib\n";
} else {
$enforce['u'.$i]='0';
}
@@ -662,7 +659,7 @@ class adm_DB {
global $technology, $database;
$isNatar = $database->getVillageField($wid, "natar");
$upkeep = $technology->getUpkeep($this->getAllUnits($wid), 0, $wid);
$upkeep = $database->getUpkeep($this->getAllUnits($wid), 0, $wid);
$production = [];
$production['wood'] = $this->getWoodProd($fdata, $ocounter,$b1);
$production['clay'] = $this->getClayProd($fdata, $ocounter,$b2);
+3 -1
View File
@@ -17,6 +17,8 @@
// # Source code: https://github.com/Shadowss/TravianZ ##
// # ##
// ################################################################################
use TravianZ\Village\Units;
include_once("../GameEngine/Artifacts.php");
include_once("../GameEngine/Units.php");
include_once("../GameEngine/Generator.php");
@@ -74,7 +76,7 @@ class funct
// add ban
break;
case "delOas":
$units->returnTroops($get['did'], 1);
Units::returnTroops($get['did'], 1);
$database->removeOases($get['oid']);
break;
case "logout":
-622
View File
@@ -1,622 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Project: TravianZ ##
## Version: 22.06.2015 ##
## Filename Alliance.php ##
## Developed by: Mr.php , Advocaite , brainiacX , yi12345 , Shadow , ronix ##
## Fixed by: Shadow - STARVATION , HERO FIXED COMPL. ##
## Fixed by: InCube - double troops ##
## License: TravianZ Project ##
## Copyright: TravianZ (c) 2010-2015. All rights reserved. ##
## URLs: http://travian.shadowss.ro ##
## Source code: https://github.com/Shadowss/TravianZ ##
## ##
#################################################################################
use App\Entity\User;
global $autoprefix;
// even with autoloader created, we can't use it here yet, as it's not been created
// ... so, let's see where it is and include it
$autoloader_found = false;
// go max 5 levels up - we don't have folders that go deeper than that
$autoprefix = '';
for ($i = 0; $i < 5; $i++) {
$autoprefix = str_repeat('../', $i);
if (file_exists($autoprefix.'autoloader.php')) {
$autoloader_found = true;
include_once $autoprefix.'autoloader.php';
break;
}
}
if (!$autoloader_found) {
die('Could not find autoloading class.');
}
class Alliance {
public $gotInvite = false;
public $inviteArray = [];
public $allianceArray = [];
public $userPermArray = [];
public function procAlliance($get) {
global $session, $database;
if($session->alliance > 0) {
$this->allianceArray = $database->getAlliance($session->alliance);
// Permissions Array
// [id] => id [uid] => uid [alliance] => alliance [opt1] => X [opt2] => X [opt3] => X [opt4] => X [opt5] => X [opt6] => X [opt7] => X [opt8] => X
$this->userPermArray = $database->getAlliPermissions($session->uid, $session->alliance);
} else {
$this->inviteArray = $database->getInvitation($session->uid);
$this->gotInvite = count($this->inviteArray) > 0;
}
if(isset($get['a'])) {
switch($get['a']) {
case 2:
$this->rejectInvite($get);
break;
case 3:
$this->acceptInvite($get);
break;
}
}
if(isset($get['o'])) {
switch($get['o']) {
case 4:
$this->delInvite($get);
break;
}
}
}
/**
* Determines if a forum is accessible or not
*
* @param int $forumID The forum ID
* @return bool Returns if the forum is accessible or not
*/
public function isForumAccessible($forumID){
global $session;
//Loop through the shared forums and try to find the passed one
foreach($session->sharedForums as $forums){
foreach($forums as $forum){
if($forum['id'] == $forumID) return true;
}
}
return false;
}
/**
* Determines if a player can act with the forum (edit/delete/create things, etc.)
*
* @param array $datas The array which contains: [aid, alliance, forum_perm, admin, owner, forum_owner]
* @return bool Returns true if you are able to act, false otherwise
*/
public static function canAct($datas, $mode = 0){
global $database, $session;
$hasSwitchedToAdmin = isset($datas['admin']) && !empty($datas['admin']) && $datas['admin'] == "switch_admin";
return (/*$database->CheckEditRes($datas['aid']) == 1 && */($datas['alliance'] > 0 && (($database->isAllianceOwner($session->uid) == $datas['alliance'] ||
($datas['forum_perm'] == 1 && $session->alliance == $datas['alliance']))) ||
($datas['owner'] == $session->uid && $session->access != ADMIN)) ||
($session->access == ADMIN)) &&
($mode || $hasSwitchedToAdmin);
}
/**
* Create two string, representing alliances ID and users ID which can see a specific forum
*
* @param int $alliancesID A list of alliances ID
* @param int $alliancesName A list of alliances Name
* @param int $usersID A list of users ID
* @param int $usersName A list of users name
* @return array Returns the two string, composed by alliances ID and users ID
*/
public function createForumVisiblity($alliancesID, $alliancesName, $usersID, $usersName){
global $database, $session;
$alliances = $users = [];
//TODO: Reduce the code of this part and cache existing diplomacy relationship
//Deduplicate alliances
if(!empty($alliancesID)){
foreach($alliancesID as $alliance){
if(!empty($alliance) && is_numeric($alliance) && $database->aExist($alliance, 'id') && $alliance != $session->alliance && empty($database->diplomacyExistingRelationships($alliance))){
$alliances[$alliance] = true;
}
}
}
if(!empty($alliancesName)){
foreach($alliancesName as $alliance){
if(!empty($alliance) && !empty($allianceID = $database->getAllianceID($alliance)) && $allianceID != $session->alliance && empty($database->diplomacyExistingRelationships($allianceID))){
$alliances[$allianceID] = true;
}
}
}
//Deduplicate users
if(!empty($usersID)){
foreach($usersID as $user) {
if(!empty($user) && is_numeric($user) && ($userAlly = $database->getUserAllianceID($user)) > 0 && $userAlly != $session->alliance && $database->getUserField($user, 'username', 0) != "[?]" && $user != $session->uid && empty($database->diplomacyExistingRelationships($userAlly))) {
$users[$user] = true;
}
}
}
if(!empty($usersName)){
foreach($usersName as $user){
if(!empty($user) && !empty($userID = $database->getUserField($user, 'id', 1)) && $userID != $session->uid && ($userAlly = $database->getUserAllianceID($userID)) > 0 && $userAlly != $session->alliance && empty($database->diplomacyExistingRelationships($userAlly))) {
$users[$userID] = true;
}
}
}
return ['alliances' => implode(',', array_keys($alliances)), 'users' => implode(',', array_keys($users))];
}
/**
* Redirects to the forum selection
*
* @param array $get Contains the values of a GET request
*/
public function redirect($get = null)
{
header("Location: allianz.php?s=2".(isset($get['fid']) && !empty($get['fid']) && $get['admin'] != 'pos' ? "&fid=".$get['fid']."" : "").
(isset($get['admin']) && !empty($get['admin']) ? "&admin=switch_admin" : ""));
exit;
}
public function procAlliForm($post) {
if(isset($post['ft'])) {
switch($post['ft']) {
case "ali1":
$this->createAlliance($post);
break;
}
}
if(isset($post['dipl']) && isset($post['a_name'])) $this->changediplomacy($post);
if(isset($post['s'])) {
if(isset($post['o'])) {
switch($post['o']) {
case 1:
if(isset($_POST['a'])) $this->changeUserPermissions($post);
break;
case 2:
if(isset($_POST['a_user'])) $this->kickAlliUser($post);
break;
case 4:
if(isset($_POST['a']) && $_POST['a'] == 4) $this->sendInvite($post);
break;
case 3:
$this->updateAlliProfile($post);
break;
case 11:
$this->quitally($post);
break;
case 100:
$this->changeAliName($post);
break;
}
}
}
}
/*****************************************
Function to process of sending invitations
*****************************************/
public function sendInvite($post) {
global $form, $database, $session;
$UserData = $database->getUserArray(stripslashes($post['a_name']), 0);
if($this->userPermArray['opt4'] == 0) {
$form->addError("name", NO_PERMISSION);
}elseif(!isset($post['a_name']) || $post['a_name'] == "") {
$form->addError("name", NAME_EMPTY);
}elseif(!User::exists($database, $post['a_name'])) {
$form->addError("name", NAME_NO_EXIST."".stripslashes(stripslashes($post['a_name'])));
}elseif($UserData['id'] == $session->uid) {
$form->addError("name", SAME_NAME);
}elseif($database->getInvitation2($UserData['id'],$session->alliance)) {
$form->addError("name", $post['a_name'].ALREADY_INVITED);
}elseif($UserData['alliance'] == $session->alliance) {
$form->addError("name", $post['a_name'].ALREADY_IN_ALLY);
}elseif($UserData['alliance'] > 0) {
$form->addError("name", $post['a_name'].ALREADY_IN_AN_ALLY);
}else{
// Obtenemos la informacion necesaria
$aid = $session->alliance;
// Insertamos invitacion
$database->sendInvitation($UserData['id'], $aid, $session->uid);
// Log the notice
$database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid=' . $session->uid . '">' . addslashes($session->username) . '</a> has invited <a href="spieler.php?uid=' . $UserData['id'] . '">' . addslashes($UserData['username']) . '</a> into the alliance.');
// send invitation via in-game messages
if(NEW_FUNCTIONS_ALLIANCE_INVITATION){
$database->sendMessage(
$UserData['id'],
4,
'Invitation to Alliance',
$database->escape("Hi, ".$UserData['username']."!\n\nThis is to inform you that you have been invited to join an alliance. To accept this invitation, please visit your Embassy.\n\nYours sincerely,\n<i>Server Robot :)</i>"),
0,
0,
0,
0,
0,
true);
}
}
}
/*****************************************
Function to reject an invitation
*****************************************/
private function rejectInvite($get) {
global $database, $session;
foreach($this->inviteArray as $invite) {
if($invite['id'] == $get['d'] && $invite['uid'] == $session->uid) {
$database->removeInvitation($get['d']);
$database->insertAlliNotice($invite['alliance'], '<a href="spieler.php?uid='.$session->uid.'">'.addslashes($session->username).'</a> has rejected the invitation.');
}
}
header("Location: build.php?gid=18");
exit;
}
/*****************************************
Function to del an invitation
*****************************************/
private function delInvite($get) {
global $database, $session;
$inviteArray = $database->getAliInvitations($session->alliance);
foreach($inviteArray as $invite) {
if($invite['id'] == $get['d'] && $invite['alliance'] == $session->alliance && $this->userPermArray['opt4'] == 1) {
$invitename = $database->getUserArray($invite['uid'], 1);
$database->removeInvitation($get['d']);
$database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid='.$session->uid.'">'.addslashes($session->username).'</a> has deleted the invitation for <a href="spieler.php?uid='.$invitename['id'].'">'.addslashes($invitename['username']).'</a>.');
}
}
header("Location: allianz.php?delinvite");
exit;
}
/*****************************************
Function to accept an invitation
*****************************************/
private function acceptInvite($get) {
global $form, $database, $session;
foreach ($this->inviteArray as $invite) {
if ($session->alliance == 0) {
if ($invite['id'] == $get['d'] && $invite['uid'] == $session->uid) {
$memberlist = $database->getAllMember($invite['alliance']);
$alliance_info = $database->getAlliance($invite['alliance']);
if (count($memberlist) < $alliance_info['max']) {
$database->removeInvitation($get['d']);
$database->updateUserField($invite['uid'], "alliance", $invite['alliance'], 1);
$database->createAlliPermissions($invite['uid'], $invite['alliance'], '', 0, 0, 0, 0, 0, 0, 0, 0);
// Log the notice
$database->insertAlliNotice($invite['alliance'], '<a href="spieler.php?uid='.$session->uid.'">'.addslashes($session->username).'</a> has joined the alliance.');
} else {
$accept_error = 1;
$max = $alliance_info['max'];
}
}
}
}
if($accept_error == 1) $form->addError("ally_accept", "The alliance can contain only ".$max." members at this moment.");
else
{
header("Location: build.php?gid=18");
exit;
}
}
/*****************************************
Function to create an alliance
*****************************************/
private function createAlliance($post) {
global $form, $database, $session, $bid18, $building;
if(!isset($post['ally1']) || $post['ally1'] == "") {
$form->addError("ally1", ATAG_EMPTY);
}
if(!isset($post['ally2']) || $post['ally2'] == "") {
$form->addError("ally2", ANAME_EMPTY);
}
if($database->aExist($post['ally1'], "tag")) {
$form->addError("ally1", ATAG_EXIST);
}
if($database->aExist($post['ally2'], "name")) {
$form->addError("ally2", ANAME_EXIST);
}
if($session->alliance != 0){
$form->addError("ally3", ALREADY_ALLY_MEMBER);
}
if($building->getTypeLevel(18) < 3){
$form->addError("ally4", ALLY_TOO_LOW);
}
if($form->returnErrors() != 0) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $post;
if($building->getTypeLevel(18) > 0) header("Location: build.php?gid=18");
else header("Location: dorf2.php");
exit;
} else {
$max = $bid18[$building->getTypeLevel(18)]['attri'];
$aid = $database->createAlliance($post['ally1'], $post['ally2'], $session->uid, $max);
$database->updateUserField($session->uid, "alliance", $aid, 1);
$database->procAllyPop($aid);
// Asign Permissions
$database->createAlliPermissions($session->uid, $aid, 'Alliance founder', '1', '1', '1', '1', '1', '1', '1', '1');
// log the notice
$database->insertAlliNotice($aid, 'The alliance has been founded by <a href="spieler.php?uid='.$session->uid.'">'.addslashes($session->username).'</a>.');
header("Location: build.php?gid=18");
exit;
}
}
/*****************************************
Function to change the alliance name
*****************************************/
private function changeAliName($get) {
global $form, $database, $session;
$userAlly = $database->getAlliance($session->alliance);
if(!isset($get['ally1']) || $get['ally1'] == "") $form->addError("ally1", ATAG_EMPTY);
if(!isset($get['ally2']) || $get['ally2'] == "") $form->addError("ally2", ANAME_EMPTY);
if($get['ally1'] != $userAlly['tag'] && $database->aExist($get['ally1'], "tag")) $form->addError("ally1", ATAG_EXIST);
if($get['ally2'] != $userAlly['name'] && $database->aExist($get['ally2'], "name")) $form->addError("ally2", ANAME_EXIST);
if($this->userPermArray['opt3'] == 0) $form->addError("perm", NO_PERMISSION);
if($form->returnErrors() == 0) {
$database->setAlliName($session->alliance, $get['ally2'], $get['ally1']);
// log the notice
$database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid='.$session->uid.'">'.addslashes($session->username).'</a> has changed the alliance name.');
$form->addError("perm", NAME_OR_TAG_CHANGED);
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $get;
header("Location: allianz.php?s=5");
exit;
}
}
/*****************************************
Function to create/change the alliance description
*****************************************/
private function updateAlliProfile($post) {
global $database, $session, $form;
if($this->userPermArray['opt3'] == 0) {
$form->addError("perm", NO_PERMISSION);
}
if($form->returnErrors() > 0) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $post;
} else {
$database->submitAlliProfile($session->alliance, $post['be2'], $post['be1']);
// log the notice
$database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid='.$session->uid.'">'.addslashes($session->username).'</a> has changed the alliance description.');
}
}
/*****************************************
Function to change the user permissions
*****************************************/
private function changeUserPermissions($post)
{
global $database, $session, $form;
if($this->userPermArray['opt1'] == 0) $form->addError("perm", NO_PERMISSION);
elseif($database->getUserField($post['a_user'], "alliance", 0) != $session->alliance) $form->addError("perm", USER_NOT_IN_YOUR_ALLY);
elseif($post['a_user'] == $session->uid) $form->addError("perm", CANT_EDIT_YOUR_PERMISSIONS);
elseif($database->isAllianceOwner($_POST['a_user'])) $form->addError("perm", CANT_EDIT_LEADER_PERMISSIONS);
else
{
$database->updateAlliPermissions($post['a_user'], $session->alliance, $post['a_titel'], $post['e1'], $post['e2'], $post['e3'], $post['e4'], $post['e5'], $post['e6'], $post['e7']);
// log the notice
$database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid='.$session->uid.'">'.addslashes($session->username).'</a> has changed permissions of <a href="spieler.php?uid='.$post['a_user'].'">'.addslashes($database->getUserField($post['a_user'], "username", 0)).'</a>.');
$form->addError("perm", ALLY_PERMISSIONS_UPDATED);
}
if($form->returnErrors() > 0)
{
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $post;
header("Location: allianz.php?s=5");
exit;
}
}
/*****************************************
Function to kick a user from alliance
*****************************************/
private function kickAlliUser($post) {
global $database, $session, $form;
$UserData = $database->getUserArray($post['a_user'], 1);
if($this->userPermArray['opt2'] == 0) {
$form->addError("perm", NO_PERMISSION);
} else if($database->getUserField($post['a_user'], "alliance", 0) != $session->alliance){
$form->addError("perm", USER_NOT_IN_YOUR_ALLY);
} else if($UserData['id'] != $session->uid){
$database->updateUserField($post['a_user'], 'alliance', 0, 1);
$database->deleteAlliPermissions($post['a_user']);
$database->deleteAlliance($session->alliance);
// log the notice
$database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid='.$UserData['id'].'">'.($kickedUsername = addslashes($database->getUserField($post['a_user'], "username", 0))).'</a> has been expelled from the alliance by <a href="spieler.php?uid='.$session->uid.'">'.addslashes($session->username).'</a>.');
if($session->alliance && $database->isAllianceOwner($UserData['id']) == $session->alliance){
$newowner = $database->getAllMember2($session->alliance);
$newleader = $newowner['id'];
$q = "UPDATE " . TB_PREFIX . "alidata set leader = ".(int) $newleader." where id = ".(int) $session->alliance."";
$database->query($q);
$database->updateAlliPermissions($newleader, 1, 1, 1, 1, 1, 1, 1, 1, 1);
Automation::updateMax($newleader);
}
$form->addError("perm", $kickedUsername.ALLY_USER_KICKED);
}
}
/*****************************************
Function to set forum link
*****************************************/
public function setForumLink($post) {
global $database, $session, $form;
if($this->userPermArray['opt5'] == 0) $form->addError("perm", NO_PERMISSION);
else
{
$database->setAlliForumdblink($session->alliance, $post['f_link']);
$form->addError("perm", ALLY_FORUM_LINK_UPDATED);
}
}
/*****************************************
Function to vote on forum survey
*****************************************/
public function Vote($post) {
global $database, $session;
if($database->checkSurvey($post['tid']) && !$database->checkVote($post['tid'], $session->uid)){
$survey = $database->getSurvey($post['tid']);
$text = ''.$survey['voted'].','.$session->uid.',';
$database->Vote($post['tid'], $post['vote'], $text);
}
header("Location: allianz.php?s=2&fid2=".$post['fid2']."&tid=".$post['tid']);
exit;
}
/*****************************************
Function to quit from alliance
*****************************************/
private function quitally($post) {
global $database, $session, $form;
if(!isset($post['pw']) || $post['pw'] == "") {
$form->addError("pw", PW_EMPTY);
} elseif(!password_verify($post['pw'], $session->userinfo['password'])) {
$form->addError("pw", LOGIN_PW_ERROR);
} else {
// check whether this is not the founder leaving and if he is, see whether
// his replacement has been selected
if (
$session->alliance &&
$database->isAllianceOwner($session->uid) == $session->alliance &&
$database->countAllianceMembers($session->alliance) > 1
) {
// check that we have a valid new founder
if (!isset($post['new_founder'])) {
$form->addError("founder", 'Founder was not selected.');
return;
} else {
$post['new_founder'] = (int) $post['new_founder'];
}
$members = $database->getAllMember($session->alliance);
$validMemberFound = false;
foreach ($members as $member) {
if ($member['id'] == $post['new_founder']) {
$validMemberFound = true;
break;
}
}
if (!$validMemberFound || $post['new_founder'] == $session->uid) {
$form->addError("founder", 'Invalid founder.');
return;
}
$newleader = (int) $post['new_founder'];
$q = "UPDATE " . TB_PREFIX . "alidata set leader = ".$newleader." where id = ".(int) $session->alliance;
$_SESSION['alliance_user'] = 0;
$database->query($q);
$database->createAlliPermissions($newleader, $session->alliance, 'Alliance Leader', 1, 1, 1, 1, 1, 1, 1, 1);
Automation::updateMax($newleader);
// send the new founder an in-game message, notifying them of their election
$database->sendMessage(
$newleader,
4,
'You are now leader of your alliance',
"Hi!\n\nThis is to inform you that the former leader of your alliance - <a href=\"".rtrim(SERVER, '/')."/spieler.php?uid=".(int) $session->uid."\">".$database->escape($session->username)."</a>, has decided to quit and elected you as his replacement. You now gain full access, administration and responsibilities to your alliance.\n\nGood luck!\n\nYours sincerely,\n<i>Server Robot :)</i>",
0,
0,
0,
0,
0,
true);
}
$database->updateUserField($session->uid, 'alliance', 0, 1);
$database->deleteAlliPermissions($session->uid);
// log the notice
$database->deleteAlliance($session->alliance);
$database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid=' . $session->uid . '">' . addslashes($session->username) . '</a> has quit the alliance.');
header("Location: spieler.php?uid=".$session->uid);
exit;
}
}
private function changediplomacy($post) {
global $database, $session, $form;
if($this->userPermArray['opt6'] == 1){
if(!empty($post['a_name']) || !empty($post['dipl'])){
$aName = $post['a_name'];
$aType = (int)intval($post['dipl']);
if($database->aExist($aName, "tag")) {
$allianceID = $database->getAllianceID($aName);
if($allianceID != $session->alliance) {
if($aType >= 1 and $aType <= 3) {
if(!$database->diplomacyInviteCheck2($session->alliance, $allianceID)) {
if($database->diplomacyCheckLimits($session->alliance, $aType)){
$database->diplomacyInviteAdd($session->alliance, $allianceID, $aType);
if($aType == 1){
$notice = OFFERED_CONFED_TO;
}else if($aType == 2){
$notice = OFFERED_NON_AGGRESION_PACT_TO;
}else if($aType == 3){
$notice = DECLARED_WAR_ON;
}
$database->insertAlliNotice($session->alliance, '<a href="allianz.php?aid='.$session->alliance.'">'.$database->getAllianceName($session->alliance).'</a> '.$notice.' <a href="allianz.php?aid='.$allianceID.'">'.$aName.'</a>.');
$database->insertAlliNotice($allianceID, '<a href="allianz.php?aid='.$session->alliance.'">'.$database->getAllianceName($session->alliance).'</a> '.$notice.' <a href="allianz.php?aid='.$allianceID.'">'.$aName.'</a>.');
$form->addError("name", INVITE_SENT);
}
else $form->addError("name", ALLY_TOO_MUCH_PACTS);
}
else $form->addError("name", INVITE_ALREADY_SENT);
}
else $form->addError("name", WRONG_DIPLOMACY);
}
else $form->addError("name", CANNOT_INVITE_SAME_ALLY);
}
else $form->addError("name", ALLY_DOESNT_EXISTS);
}
else $form->addError("name", NAME_OR_DIPL_EMPTY);
}
else $form->addError("name", NO_PERMISSION);
}
}
$alliance = new Alliance;
?>
-519
View File
@@ -1,519 +0,0 @@
<?php
class Artifacts
{
const
/**
* @var int Default Natars' uid
*/
NATARS_UID = 3,
/**
* @var int Default Natars' tribe
*/
NATARS_TRIBE = 5,
/**
* @var string Default Natars' email
*/
NATARS_EMAIL = TRIBE5."@noreply.com",
/**
* @var string Default Natars' description
*/
NATARS_DESC = "**************************
[#natars]
**************************",
/**
* @var array Possible Natars' capital locations
*/
NATARS_CAPITAL_COORDINATES = [[WORLD_MAX, WORLD_MAX],
[WORLD_MAX, 0],
[WORLD_MAX, -WORLD_MAX],
[0, -WORLD_MAX],
[-WORLD_MAX, -WORLD_MAX],
[-WORLD_MAX, 0],
[-WORLD_MAX, WORLD_MAX],
[0, WORLD_MAX],
[WORLD_MAX / 10, WORLD_MAX / 20],
[WORLD_MAX / 10, -WORLD_MAX / 10],
[-WORLD_MAX / 20, -WORLD_MAX / 10],
[-WORLD_MAX / 10, 0],
[-WORLD_MAX / 20, WORLD_MAX / 10]],
/**
* @var array Normal Natars' artifacts
*/
NATARS_ARTIFACTS = [ARCHITECTS_DESC => [["type" => 1, "size" => 1, "name" => ARCHITECTS_SMALL, "vname" => ARCHITECTS_SMALLVILLAGE, "effect" => "(4x)", "quantity" => 6, "img" => 2],
["type" => 1, "size" => 2, "name" => ARCHITECTS_LARGE, "vname" => ARCHITECTS_LARGEVILLAGE, "effect" => "(3x)", "quantity" => 4, "img" => 2],
["type" => 1, "size" => 3, "name" => ARCHITECTS_UNIQUE,"vname" => ARCHITECTS_UNIQUEVILLAGE, "effect" => "(5x)", "quantity" => 1, "img" => 2]],
HASTE_DESC => [["type" => 2, "size" => 1, "name" => HASTE_SMALL, "vname" => HASTE_SMALLVILLAGE, "effect" => "(2x)", "quantity" => 6, "img" => 4],
["type" => 2, "size" => 2, "name" => HASTE_LARGE, "vname" => HASTE_LARGEVILLAGE, "effect" => "(1.5x)", "quantity" => 4, "img" => 4],
["type" => 2, "size" => 3, "name" => HASTE_UNIQUE, "vname" => HASTE_UNIQUEVILLAGE, "effect" => "(3x)", "quantity" => 1, "img" => 4]],
EYESIGHT_DESC => [["type" => 3, "size" => 1, "name" => EYESIGHT_SMALL, "vname" => EYESIGHT_SMALLVILLAGE, "effect" => "(5x)", "quantity" => 6, "img" => 5],
["type" => 3, "size" => 2, "name" => EYESIGHT_LARGE, "vname" => EYESIGHT_LARGEVILLAGE, "effect" => "(3x)", "quantity" => 4, "img" => 5],
["type" => 3, "size" => 3, "name" => EYESIGHT_UNIQUE, "vname" => EYESIGHT_UNIQUEVILLAGE, "effect" => "(10x)", "quantity" => 1, "img" => 5]],
DIET_DESC => [["type" => 4, "size" => 1, "name" => DIET_SMALL, "vname" => DIET_SMALLVILLAGE, "effect" => "(50%)", "quantity" => 6, "img" => 6],
["type" => 4, "size" => 2, "name" => DIET_LARGE, "vname" => DIET_LARGEVILLAGE, "effect" => "(25%)", "quantity" => 4, "img" => 6],
["type" => 4, "size" => 3, "name" => DIET_UNIQUE, "vname" => DIET_UNIQUEVILLAGE, "effect" => "(50%)", "quantity" => 1, "img" => 6]],
ACADEMIC_DESC => [["type" => 5, "size" => 1, "name" => ACADEMIC_SMALL, "vname" => ACADEMIC_SMALLVILLAGE, "effect" => "(50%)", "quantity" => 6, "img" => 8],
["type" => 5, "size" => 2, "name" => ACADEMIC_LARGE, "vname" => ACADEMIC_LARGEVILLAGE, "effect" => "(25%)", "quantity" => 4, "img" => 8],
["type" => 5, "size" => 3, "name" => ACADEMIC_UNIQUE, "vname" => ACADEMIC_UNIQUEVILLAGE, "effect" => "(50%)", "quantity" => 1, "img" => 8]],
STORAGE_DESC => [["type" => 6, "size" => 1, "name" => STORAGE_SMALL, "vname" => STORAGE_SMALLVILLAGE, "effect" => "(50%)", "quantity" => 6, "img" => 9],
["type" => 6, "size" => 2, "name" => STORAGE_LARGE, "vname" => STORAGE_LARGEVILLAGE, "effect" => "(25%)", "quantity" => 4, "img" => 9]],
CONFUSION_DESC => [["type" => 7, "size" => 1, "name" => CONFUSION_SMALL, "vname" => CONFUSION_SMALLVILLAGE, "effect" => "(200)", "quantity" => 6, "img" => 10],
["type" => 7, "size" => 2, "name" => CONFUSION_LARGE, "vname" => CONFUSION_LARGEVILLAGE, "effect" => "(100)", "quantity" => 4, "img" => 10],
["type" => 7, "size" => 3, "name" => CONFUSION_UNIQUE, "vname" => CONFUSION_UNIQUEVILLAGE, "effect" => "(500)", "quantity" => 1, "img" => 10]],
FOOL_DESC => [["type" => 8, "size" => 1, "name" => FOOL_SMALL, "vname" => FOOL_SMALLVILLAGE, "effect" => "", "quantity" => 10, "img" => "fool"],
2 => ["type" => 8, "size" => 3, "name" => FOOL_UNIQUE, "vname" => FOOL_UNIQUEVILLAGE, "effect" => "", "quantity" => 1, "img" => "fool"]]],
/**
* @var array WW building plans Natars' artifacts
*/
NATARS_WW_BUILDING_PLANS = [PLAN_DESC => [["type" => 11, "size" => 1, "name" => PLAN, "vname" => PLANVILLAGE, "effect" => "", "quantity" => 13, "img" => 1]]],
/**
* @var array Natars' normal artifacts buildings
*/
NATARS_ARTIFACTS_BUILDINGS = [
//Treasury of the 20th level, Residence of the 10th level, Rally Point of the 1th level
"f22t" => 27, "f22" => 20, "f28t" => 25, "f28" => 10, "f39t" => 16, "f39" => 1,
//18 Cranny of the 10th level
"f19t" => 23, "f19" => 10, "f20t" => 23, "f20" => 10, "f21t" => 23, "f21" => 10,
"f23t" => 23, "f23" => 10, "f24t" => 23, "f24" => 10, "f25t" => 23, "f25" => 10,
"f26t" => 23, "f26" => 10, "f27t" => 23, "f27" => 10, "f29t" => 23, "f29" => 10,
"f30t" => 23, "f30" => 10, "f31t" => 23, "f31" => 10, "f32t" => 23, "f32" => 10,
"f33t" => 23, "f33" => 10, "f34t" => 23, "f34" => 10, "f35t" => 23, "f35" => 10,
"f36t" => 23, "f36" => 10, "f37t" => 23, "f37" => 10, "f38t" => 23, "f38" => 10],
/**
* @var array Natars' WW villages buildings
*/
NATARS_WW_VILLAGES_BUILDINGS = [
//WW of the 0th level, Main Building of the 10th level, Marketplace of the 1th level
"f99t" => 40, "f99" => 0, "f22t" => 15, "f22" => 10, "f34t" => 17, "f34" => 1,
//Warehouse of the 20th & 10th level, Granary of the 20th & 10th level
"f20t" => 10, "f20" => 20, "f19t" => 10, "f19" => 10, "f23t" => 11, "f23" => 20, "f27t" => 11, "f27" => 10,
//All Woodcutter of the 5th level
"f1" => 5, "f3" => 5, "f14" => 5, "f17" => 5,
//All Clay Pit of the 5th level
"f5" => 5, "f6" => 5, "f16" => 5, "f18" => 5,
//All Iron Mine of the 5th level
"f4" => 5, "f7" => 5, "f10" => 5, "f11" => 5,
//All Cropland of the 6th level
"f2" => 6, "f8" => 6, "f9" => 6, "f12" => 6, "f13" => 6, "f15" => 6],
/**
* @var int The base amount of Natars' spying units, used when Natars account is created
*/
NATARS_BASE_SPY = 1500,
/**
* @var int the base amount of Natars' WW villages
*/
NATARS_BASE_WW_VILLAGES = 13;
public
/**
* @var funct Natars' troops for normal artifact
*/
$natarsArtifactsUnits,
/**
* @var funct WW villages Natars' troops
*/
$natarsWWVillagesUnits;
public function __construct(){
$this->natarsArtifactsUnits = function($multiplier){
return [41 => rand(1000 * $multiplier, 2000 * $multiplier) * NATARS_UNITS,
42 => rand(1500 * $multiplier, 2000 * $multiplier) * NATARS_UNITS,
43 => rand(2300 * $multiplier, 2800 * $multiplier) * NATARS_UNITS,
44 => rand(25 * $multiplier, 75 * $multiplier) * NATARS_UNITS,
45 => rand(1200 * $multiplier, 1900 * $multiplier) * NATARS_UNITS,
46 => rand(1500 * $multiplier, 2000 * $multiplier) * NATARS_UNITS,
47 => rand(500 * $multiplier, 900 * $multiplier) * NATARS_UNITS,
48 => rand(100 * $multiplier, 300 * $multiplier) * NATARS_UNITS,
49 => rand(1 * $multiplier, 5 * $multiplier) * NATARS_UNITS,
50 => rand(1 * $multiplier, 5 * $multiplier) * NATARS_UNITS];
};
$this->natarsWWVillagesUnits = function(){
return [41 => rand(500, 12000) * NATARS_UNITS,
42 => rand(1000 , 14000) * NATARS_UNITS,
43 => rand(2000, 16000) * NATARS_UNITS,
44 => rand(100, 500) * NATARS_UNITS,
45 => rand(480, 17000) * NATARS_UNITS,
46 => rand(600, 18000) * NATARS_UNITS,
47 => rand(2000, 16000) * NATARS_UNITS,
48 => rand(400, 2000) * NATARS_UNITS,
49 => rand(40, 200) * NATARS_UNITS,
50 => rand(50, 250) * NATARS_UNITS];
};
}
/**
* Called when Natars account needs to be created, creates his account and capital village
*
*/
public function createNatars(){
global $database;
//Register the Natars account, the Natars' password is the same as the MH's one
$password = $database->getUserField(5, 'password', 0);
$database->register(TRIBE5, $password, self::NATARS_EMAIL, self::NATARS_TRIBE, null, self::NATARS_UID, self::NATARS_DESC);
//Convert from coordinates to village IDs
$possibleWids = $database->getVilWrefs(self::NATARS_CAPITAL_COORDINATES);
//Check if the villages aren't already taken
$wid = $database->getFreeVillage($possibleWids);
//Generate the Natars' capital
$wid = $database->generateVillages([['wid' => $wid, 'mode' => 2, 'type' => 3, 'kid' => 0, 'capital' => 1, 'pop' => 834, 'name' => null, 'natar' => 0]], self::NATARS_UID, TRIBE5);
//Scouts all players
$this->scoutAllPlayers($wid);
//Add artifacts
$this->addArtifactVillages(self::NATARS_ARTIFACTS);
}
/**
* Called when Natars account has been created
*
* @param int $wid The village ID of the Natars' capital
*/
public function scoutAllPlayers($wid){
global $database;
$array = $database->getProfileVillages(0, 1);
$refs = [];
$vils = [];
foreach($array as $vill){
$refs[] = $database->addAttack($wid, 0, 0, 0, self::NATARS_BASE_SPY * NATARS_UNITS, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 20, 0, 0, 0, 0);
$vils[] = $vill['wref'];
}
$type = [];
$from = [];
$to = [];
$ref = [];
$time = [];
$timeValue = time();
$endtime = [];
$endtimeValue = $timeValue + round(10000 / SPEED);
$counter = 0;
foreach ($refs as $index => $refID) {
$type[] = 3;
$from[] = $wid;
$to[] = $vils[$index];
$ref[] = $refID;
$time[] = $timeValue;
$endtime[] = $endtimeValue;
// limit the insert, so it can push through any reasonable network limits imposed
if (++$counter > 25) {
$database->addMovement($type, $from, $to, $ref, $time, $endtime);
$type = [];
$from = [];
$to = [];
$ref = [];
$time = [];
$endtime = [];
$counter = 0;
}
}
if ($counter > 0) $database->addMovement($type, $from, $to, $ref, $time, $endtime);
}
/**
* Creates villages and puts the desired artifacts in it
*
* @param array $artifactArrays The array containing the artifacts to insert
* @param int $uid The owner's user ID (Natars)
* @param bool $addTroops Add troops to the village if true, and vice versa if false
*/
public function addArtifactVillages($artifactArrays, $uid = self::NATARS_UID, $addTroops = true) {
global $database;
//Variables initialization
$artifactNumber = 0;
$artifactVillages = $artifactTroops = $artifactBuildings = $artifactsToAdd = $wids = [];
//Create the artifact villages array
foreach($artifactArrays as $desc => $artifactType){
foreach($artifactType as $artifact){
for($i = 0; $i < $artifact['quantity']; $i++){
//Generate the villages array
$artifactVillages[] = ['wid' => 0, 'mode' => $artifact['size'] + 1, 'type' => 3, 'kid' => rand(1, 4), 'capital' => 0, 'pop' => 163, 'name' => $artifact['vname'], 'natar' => 0];
//Set the unit arrays (1, 2 or 4)
$multiplier = $artifact['size'] == 3 ? 4 : $artifact['size'];
$unitArrays = ($this->natarsArtifactsUnits)($multiplier);
//Generate the unit arrays
if($addTroops) $artifactTroops[1][] = array_values($unitArrays);
$artifactBuildings[1][] = array_values(self::NATARS_ARTIFACTS_BUILDINGS);
//Generate the artifacts array
$artifactsToAdd[] = ['owner' => $uid, 'type' => $artifact['type'], 'size' => $artifact['size'],
'name' => $artifact['name'], 'desc' => $desc, 'effect' => $artifact['effect'],
'img' => "type".$artifact['img'].".gif"];
}
}
}
//Set the unit types by using the last $unitArrays
if($addTroops) $artifactTroops[0] = array_keys($unitArrays);
$artifactBuildings[0] = array_keys(self::NATARS_ARTIFACTS_BUILDINGS);
//Generate the wids
$wids = array_merge($wids, (array)$database->generateVillages($artifactVillages, $uid, TRIBE5, $addTroops ? $artifactTroops : null, $artifactBuildings));
//Create the artifacts for the generated wids
$database->addArtefacts($wids, $artifactsToAdd);
}
/**
* Called when WW villages need to be created
*
* @param int $numberOfVillages The number of villages that have to be added
* @param int $uid The player ID
* @param bool $addTroops Add troops to the village if true, and vice versa if false
*/
public function createWWVillages($numberOfVillages = self::NATARS_BASE_WW_VILLAGES, $uid = self::NATARS_UID, $addTroops = true){
global $database;
$villageArrays = $troopArrays = $buildingArrays = $wids = [];
for($i = 1; $i <= $numberOfVillages; $i++){
$villageArrays[] = ['wid' => 0, 'mode' => 5, 'type' => 3, 'kid' => ($i == $numberOfVillages ? rand(1, 4) : ($i % 4) + 1), 'capital' => 0, 'pop' => 233, 'name' => WWVILLAGE, 'natar' => 1];
if($addTroops) $troopArrays[1][] = array_values(($this->natarsWWVillagesUnits)());
$buildingArrays[1][] = array_values(self::NATARS_WW_VILLAGES_BUILDINGS);
}
if($addTroops) $troopArrays[0] = array_keys(($this->natarsWWVillagesUnits)());
$buildingArrays[0] = array_keys(self::NATARS_WW_VILLAGES_BUILDINGS);
$wids = $database->generateVillages($villageArrays, $uid, null, $addTroops ? $troopArrays : null, $buildingArrays);
}
/**
* Called when WW building plans need to be created
*
*/
public function createWWBuildingPlans(){
//Add the artifacts and villages
$this->addArtifactVillages(self::NATARS_WW_BUILDING_PLANS);
}
/**
* Automatically activate all artifacts that need to be activated
*
*/
public function activateArtifacts(){
global $database;
//Get all inactive artifacts that have to be activated --> (24 hours / Speed of the server)
$time = time();
$artifacts = $database->getInactiveArtifacts(round($time - (86400 / (SPEED == 2 ? 1.5 : (SPEED == 3 ? 2 : SPEED)))));
if(!empty($artifacts)){
//Cache inactive artifacts by owner
$inactiveArtifactsCache = [];
foreach($artifacts as $artifact) $inactiveArtifactsCache[$artifact['owner']][] = $artifact;
foreach($inactiveArtifactsCache as $owner => $inactiveArtifacts){
//Initialize the array
$activeArtifacts = [];
//Get cached active artifacts
$ownArtifacts = $database->getOwnArtifactsSum($owner, true);
//Activate activable artifacts
foreach($inactiveArtifacts as $artifact){
if($ownArtifacts['totals'] < 3){
if($artifact['size'] == 1){ //Village effect
$database->activateArtifact($artifact['id']);
$ownArtifacts['totals']++;
$ownArtifacts['small']++;
}elseif($artifact['size'] == 2 && !$ownArtifacts['unique'] && !$ownArtifacts['great']){ //Account effect
$database->activateArtifact($artifact['id']);
$ownArtifacts['totals']++;
$ownArtifacts['great']++;
}elseif($artifact['size'] == 3 && !$ownArtifacts['unique'] && !$ownArtifacts['great']){ //Unique effect
$database->activateArtifact($artifact['id']);
$ownArtifacts['totals']++;
$ownArtifacts['unique']++;
}
}elseif($ownArtifacts['small'] == 3 && $artifact['size'] > 1){
//If we've 3 village effect artifacts activated and at least one account/unique effect not activated
//then we need to deactivate the most recent village effect artifact and activate the oldest account
//or unique effect artifact
//Deactivate the most recent village effect artifact
$database->activateArtifact($database->getNewestArtifactBySize($owner, 1)['id'], 0);
//Activate the great/unique artifact
$database->activateArtifact($artifact['id']);
$ownArtifacts['small']--;
$ownArtifacts['totals']++;
if($artifact['size'] == 2) $ownArtifacts['great']++;
else $ownArtifacts['unique']++;
}
}
}
}
}
/**
* Return the selected artifact, to the Natars account, by creating a new village and
* by moving the artifact into it
*
* @param array $artifact The artifact array
*/
public function returnArtifactToNatars($artifactArray){
global $database;
//Set the village arrays
$artifactArrays = array_merge(self::NATARS_ARTIFACTS, self::NATARS_WW_BUILDING_PLANS);
$villageArrays = [['wid' => 0, 'mode' => $artifactArray['size'] + 1, 'type' => 3,
'kid' => rand(1, 4), 'capital' => 0, 'pop' => 163,
'name' => $artifactArrays[$artifactArray['desc']][$artifactArray['size'] - 1]['vname'],
'natar' => 0]];
//Set the unit arrays
$multiplier = $artifactArray['size'] == 3 ? 4 : $artifactArray['size'];
$unitsArray = ($this->natarsArtifactsUnits)($multiplier);
//Set the unit types
$artifactTroops[1][] = array_values($unitsArray);
$artifactTroops[0] = array_keys($unitsArray);
//Set the buildings array
$artifactBuildings[1][] = array_values(self::NATARS_ARTIFACTS_BUILDINGS);
$artifactBuildings[0] = array_keys(self::NATARS_ARTIFACTS_BUILDINGS);
//Generate the village
$wid = $database->generateVillages($villageArrays, self::NATARS_UID, TRIBE5, $artifactTroops, $artifactBuildings);
//Update the artifact with the new village id and owner
$database->updateArtifactDetails($artifactArray['id'], ['vref' => $wid, 'owner' => self::NATARS_UID, 'active' => 0, 'del' => 0]);
}
/**
* Gets the artifact informations in plain text
*
* @param int $artifact The artifact
* @return array Returns the information of the artifacts
*/
public static function getArtifactInfo($artifact){
$activationTime = 86400 / (SPEED == 2 ? 1.5 : (SPEED == 3 ? 2 : SPEED));
$time = time();
$nextEffect = "-";
if($artifact['size'] == 1 && $artifact['type'] != 11){
$requiredLevel = 10;
$effectInfluence = VILLAGE;
}else{
$requiredLevel = $artifact['type'] != 11 ? 20 : 10;
$effectInfluence = ACCOUNT;
}
if($artifact['owner'] == 3) $active = "-";
elseif(!$artifact['active'] && $artifact['conquered'] < $time - $activationTime) $active = "<b>Can't be activated</b>";
elseif (!$artifact['active']) $active = date("d.m.Y H:i:s", $artifact['conquered'] + $activationTime);
else
{
$active = "<b>".ACTIVE."</b>";
$nextEffect = date("d.m.Y H:i:s", $artifact['lastupdate'] + (86400 / (SPEED == 2 ? 1.5 : (SPEED == 3 ? 2 : SPEED))));
}
//// Added by brainiac - thank you
if ($artifact['type'] == 8)
{
$kind = $artifact['kind'];
$effect = $artifact['effect2'];
}else{
$kind = $artifact['type'];
$effect = $artifact['effect'];
}
$artifactBadEffect = $artifact['type'] == 8 && $artifact['bad_effect'] == 1;
switch($kind){
case 1:
$betterorbadder = $artifactBadEffect ? BUILDING_WEAKER : BUILDING_STRONGER;
break;
case 2:
$betterorbadder = $artifactBadEffect ? TROOPS_SLOWEST : TROOPS_FASTER;
break;
case 3:
$betterorbadder = $artifactBadEffect ? SPIES_DECRESE : SPIES_INCREASE;
break;
case 4:
$betterorbadder = $artifactBadEffect ? CONSUME_HIGH : CONSUME_LESS;
break;
case 5:
$betterorbadder = $artifactBadEffect ? TROOPS_MAKE_SLOWEST : TROOPS_MAKE_FASTER;
break;
case 6:
$betterorbadder = $artifactBadEffect ? YOU_CONSTRUCT : YOU_CONSTRUCT;
break;
case 7:
$betterorbadder = $artifactBadEffect ? CRANNY_DECRESE : CRANNY_INCREASED;
break;
case 8:
$betterorbadder = $artifactBadEffect ? SPIES_INCREASE : SPIES_DECRESE;
break;
}
$bonus = isset($betterorbadder) ? $betterorbadder." (<b>".str_replace(["(", ")"], "" , $effect)."</b>)" : (($kind == 11 && $artifact['active']) ? "<b>".WW_BUILDING_PLAN."</b>" : "<b>Not yet active</b>");
return ["requiredLevel" => $requiredLevel, "active" => $active,
"bonus" => $bonus, "effectInfluence" => $effectInfluence,
"nextEffect" => $nextEffect];
}
}
?>
File diff suppressed because it is too large Load Diff
-255
View File
@@ -1,255 +0,0 @@
<?php
include_once ("config.php");
include_once ("Lang/".LANG.".php");
$pattern = [];
$pattern[0] = "/\[b\](.*?)\[\/b\]/is";
$pattern[1] = "/\[i\](.*?)\[\/i\]/is";
$pattern[2] = "/\[u\](.*?)\[\/u\]/is";
$pattern[3] = "/\[tid1\]/";
$pattern[4] = "/\[tid2\]/";
$pattern[5] = "/\[tid3\]/";
$pattern[6] = "/\[tid4\]/";
$pattern[7] = "/\[tid5\]/";
$pattern[8] = "/\[tid6\]/";
$pattern[9] = "/\[tid7\]/";
$pattern[10] = "/\[tid8\]/";
$pattern[11] = "/\[tid9\]/";
$pattern[12] = "/\[tid10\]/";
$pattern[13] = "/\[tid11\]/";
$pattern[14] = "/\[tid12\]/";
$pattern[15] = "/\[tid13\]/";
$pattern[16] = "/\[tid14\]/";
$pattern[17] = "/\[tid15\]/";
$pattern[18] = "/\[tid16\]/";
$pattern[19] = "/\[tid17\]/";
$pattern[20] = "/\[tid18\]/";
$pattern[21] = "/\[tid19\]/";
$pattern[22] = "/\[tid20\]/";
$pattern[23] = "/\[tid21\]/";
$pattern[24] = "/\[tid22\]/";
$pattern[25] = "/\[tid23\]/";
$pattern[26] = "/\[tid24\]/";
$pattern[27] = "/\[tid25\]/";
$pattern[28] = "/\[tid26\]/";
$pattern[29] = "/\[tid27\]/";
$pattern[30] = "/\[tid28\]/";
$pattern[31] = "/\[tid29\]/";
$pattern[32] = "/\[tid30\]/";
$pattern[33] = "/\[tid31\]/";
$pattern[34] = "/\[tid32\]/";
$pattern[35] = "/\[tid33\]/";
$pattern[36] = "/\[tid34\]/";
$pattern[37] = "/\[tid35\]/";
$pattern[38] = "/\[tid36\]/";
$pattern[39] = "/\[tid37\]/";
$pattern[40] = "/\[tid38\]/";
$pattern[41] = "/\[tid39\]/";
$pattern[42] = "/\[tid40\]/";
$pattern[43] = "/\[tid41\]/";
$pattern[44] = "/\[tid42\]/";
$pattern[45] = "/\[tid43\]/";
$pattern[46] = "/\[tid44\]/";
$pattern[47] = "/\[tid45\]/";
$pattern[48] = "/\[tid46\]/";
$pattern[49] = "/\[tid47\]/";
$pattern[50] = "/\[tid48\]/";
$pattern[51] = "/\[tid49\]/";
$pattern[52] = "/\[tid50\]/";
$pattern[53] = "/\[hero\]/";
$pattern[54] = "/\[lumber\]/";
$pattern[55] = "/\[clay\]/";
$pattern[56] = "/\[iron\]/";
$pattern[57] = "/\[crop\]/";
$pattern[58] = "/\*aha\*/";
$pattern[59] = "/\*angry\*/";
$pattern[60] = "/\*cool\*/";
$pattern[61] = "/\*cry\*/";
$pattern[62] = "/\*cute\*/";
$pattern[63] = "/\*depressed\*/";
$pattern[64] = "/\*eek\*/";
$pattern[65] = "/\*ehem\*/";
$pattern[66] = "/\*emotional\*/";
$pattern[67] = "/\:D/";
$pattern[68] = "/\:\)/";
$pattern[69] = "/\*hit\*/";
$pattern[70] = "/\*hmm\*/";
$pattern[71] = "/\*hmpf\*/";
$pattern[72] = "/\*hrhr\*/";
$pattern[73] = "/\*huh\*/";
$pattern[74] = "/\*lazy\*/";
$pattern[75] = "/\*love\*/";
$pattern[76] = "/\*nocomment\*/";
$pattern[77] = "/\*noemotion\*/";
$pattern[78] = "/\*notamused\*/";
$pattern[79] = "/\*pout\*/";
$pattern[80] = "/\*redface\*/";
$pattern[81] = "/\*rolleyes\*/";
$pattern[82] = "/\:\(/";
$pattern[83] = "/\*shy\*/";
$pattern[84] = "/\*smile\*/";
$pattern[85] = "/\*tongue\*/";
$pattern[86] = "/\*veryangry\*/";
$pattern[87] = "/\*veryhappy\*/";
$pattern[88] = "/\;\)/";
$replace = [];
$replace[0] = "<b>$1</b>";
$replace[1] = "<i>$1</i>";
$replace[2] = "<u>$1</u>";
$replace[3] = "<img class='unit u1' src='img/x.gif' title='".U1."' alt='".U1."'>";
$replace[4] = "<img class='unit u2' src='img/x.gif' title='".U2."' alt='".U2."'>";
$replace[5] = "<img class='unit u3' src='img/x.gif' title='".U3."' alt='".U3."'>";
$replace[6] = "<img class='unit u4' src='img/x.gif' title='".U4."' alt='".U4."'>";
$replace[7] = "<img class='unit u5' src='img/x.gif' title='".U5."' alt='".U5."'>";
$replace[8] = "<img class='unit u6' src='img/x.gif' title='".U6."' alt='".U6."'>";
$replace[9] = "<img class='unit u7' src='img/x.gif' title='".U7."' alt='".U7."'>";
$replace[10] = "<img class='unit u8' src='img/x.gif' title='".U8."' alt='".U8."'>";
$replace[11] = "<img class='unit u9' src='img/x.gif' title='".U9."' alt='".U9."'>";
$replace[12] = "<img class='unit u10' src='img/x.gif' title='".U10."' alt='".U10."'>";
$replace[13] = "<img class='unit u11' src='img/x.gif' title='".U11."' alt='".U11."'>";
$replace[14] = "<img class='unit u12' src='img/x.gif' title='".U12."' alt='".U12."'>";
$replace[15] = "<img class='unit u13' src='img/x.gif' title='".U13."' alt='".U13."'>";
$replace[16] = "<img class='unit u14' src='img/x.gif' title='".U14."' alt='".U14."'>";
$replace[17] = "<img class='unit u15' src='img/x.gif' title='".U15."' alt='".U15."'>";
$replace[18] = "<img class='unit u16' src='img/x.gif' title='".U16."' alt='".U16."'>";
$replace[19] = "<img class='unit u17' src='img/x.gif' title='".U17."' alt='".U17."'>";
$replace[20] = "<img class='unit u18' src='img/x.gif' title='".U18."' alt='".U18."'>";
$replace[21] = "<img class='unit u19' src='img/x.gif' title='".U19."' alt='".U19."'>";
$replace[22] = "<img class='unit u20' src='img/x.gif' title='".U20."' alt='".U20."'>";
$replace[23] = "<img class='unit u21' src='img/x.gif' title='".U21."' alt='".U21."'>";
$replace[24] = "<img class='unit u22' src='img/x.gif' title='".U22."' alt='".U22."'>";
$replace[25] = "<img class='unit u23' src='img/x.gif' title='".U23."' alt='".U23."'>";
$replace[26] = "<img class='unit u24' src='img/x.gif' title='".U24."' alt='".U24."'>";
$replace[27] = "<img class='unit u25' src='img/x.gif' title='".U25."' alt='".U25."'>";
$replace[28] = "<img class='unit u26' src='img/x.gif' title='".U26."' alt='".U26."'>";
$replace[29] = "<img class='unit u27' src='img/x.gif' title='".U27."' alt='".U27."'>";
$replace[30] = "<img class='unit u28' src='img/x.gif' title='".U28."' alt='".U28."'>";
$replace[31] = "<img class='unit u29' src='img/x.gif' title='".U29."' alt='".U29."'>";
$replace[32] = "<img class='unit u30' src='img/x.gif' title='".U30."' alt='".U30."'>";
$replace[33] = "<img class='unit u31' src='img/x.gif' title='".U31."' alt='".U31."'>";
$replace[34] = "<img class='unit u32' src='img/x.gif' title='".U32."' alt='".U32."'>";
$replace[35] = "<img class='unit u33' src='img/x.gif' title='".U33."' alt='".U33."'>";
$replace[36] = "<img class='unit u34' src='img/x.gif' title='".U34."' alt='".U34."'>";
$replace[37] = "<img class='unit u35' src='img/x.gif' title='".U35."' alt='".U35."'>";
$replace[38] = "<img class='unit u36' src='img/x.gif' title='".U36."' alt='".U36."'>";
$replace[39] = "<img class='unit u37' src='img/x.gif' title='".U37."' alt='".U37."'>";
$replace[40] = "<img class='unit u38' src='img/x.gif' title='".U38."' alt='".U38."'>";
$replace[41] = "<img class='unit u39' src='img/x.gif' title='".U39."' alt='".U39."'>";
$replace[42] = "<img class='unit u40' src='img/x.gif' title='".U40."' alt='".U40."'>";
$replace[43] = "<img class='unit u41' src='img/x.gif' title='".U41."' alt='".U41."'>";
$replace[44] = "<img class='unit u42' src='img/x.gif' title='".U42."' alt='".U42."'>";
$replace[45] = "<img class='unit u43' src='img/x.gif' title='".U43."' alt='".U43."'>";
$replace[46] = "<img class='unit u44' src='img/x.gif' title='".U44."' alt='".U44."'>";
$replace[47] = "<img class='unit u45' src='img/x.gif' title='".U45."' alt='".U45."'>";
$replace[48] = "<img class='unit u46' src='img/x.gif' title='".U46."' alt='".U46."'>";
$replace[49] = "<img class='unit u47' src='img/x.gif' title='".U47."' alt='".U47."'>";
$replace[50] = "<img class='unit u48' src='img/x.gif' title='".U48."' alt='".U48."'>";
$replace[51] = "<img class='unit u49' src='img/x.gif' title='".U49."' alt='".U49."'>";
$replace[52] = "<img class='unit u50' src='img/x.gif' title='".U50."' alt='".U50."'>";
$replace[53] = "<img class='unit uhero' src='img/x.gif' title='".U0."' alt='".U0."'>";
$replace[54] = "<img src='img/x.gif' class='r1' title='".R1."' alt='".R1."'>";
$replace[55] = "<img src='img/x.gif' class='r2' title='".R2."' alt='".R2."'>";
$replace[56] = "<img src='img/x.gif' class='r3' title='".R3."' alt='".R3."'>";
$replace[57] = "<img src='img/x.gif' class='r4' title='".R4."' alt='".R4."'>";
$replace[54] = "<img src='img/x.gif' class='r1' title='Lumber' alt='Lumber'>";
$replace[55] = "<img src='img/x.gif' class='r2' title='Clay' alt='Clay'>";
$replace[56] = "<img src='img/x.gif' class='r3' title='Iron' alt='Iron'>";
$replace[57] = "<img src='img/x.gif' class='r4' title='Crop' alt='Crop'>";
$replace[58] = "<img class='smiley aha' src='img/x.gif' alt='*aha*' title='*aha*'>";
$replace[59] = "<img class='smiley angry' src='img/x.gif' alt='*angry*' title='*angry*'>";
$replace[60] = "<img class='smiley cool' src='img/x.gif' alt='*cool*' title='*cool*'>";
$replace[61] = "<img class='smiley cry' src='img/x.gif' alt='*cry*' title='*cry*'>";
$replace[62] = "<img class='smiley cute' src='img/x.gif' alt='*cute*' title='*cute*'>";
$replace[63] = "<img class='smiley depressed' src='img/x.gif' alt='*depressed*' title='*depressed*'>";
$replace[64] = "<img class='smiley eek' src='img/x.gif' alt='*eek*' title='*eek*'>";
$replace[65] = "<img class='smiley ehem' src='img/x.gif' alt='*ehem*' title='*ehem*'>";
$replace[66] = "<img class='smiley emotional' src='img/x.gif' alt='*emotional*' title='*emotional*'>";
$replace[67] = "<img class='smiley grin' src='img/x.gif' alt=':D' title=':D'>";
$replace[68] = "<img class='smiley happy' src='img/x.gif' alt=':)' title=':)'>";
$replace[69] = "<img class='smiley hit' src='img/x.gif' alt='*hit*' title='*hit*'>";
$replace[70] = "<img class='smiley hmm' src='img/x.gif' alt='*hmm*' title='*hmm*'>";
$replace[71] = "<img class='smiley hmpf' src='img/x.gif' alt='*hmpf*' title='*hmpf*'>";
$replace[72] = "<img class='smiley hrhr' src='img/x.gif' alt='*hrhr*' title='*hrhr*'>";
$replace[73] = "<img class='smiley huh' src='img/x.gif' alt='*huh*' title='*huh*'>";
$replace[74] = "<img class='smiley lazy' src='img/x.gif' alt='*lazy*' title='*lazy*'>";
$replace[75] = "<img class='smiley love' src='img/x.gif' alt='*love*' title='*love*'>";
$replace[76] = "<img class='smiley nocomment' src='img/x.gif' alt='*nocomment*' title='*nocomment*'>";
$replace[77] = "<img class='smiley noemotion' src='img/x.gif' alt='*noemotion*' title='*noemotion*'>";
$replace[78] = "<img class='smiley notamused' src='img/x.gif' alt='*notamused*' title='*notamused*'>";
$replace[79] = "<img class='smiley pout' src='img/x.gif' alt='*pout*' title='*pout*'>";
$replace[80] = "<img class='smiley redface' src='img/x.gif' alt='*redface*' title='*redface*'>";
$replace[81] = "<img class='smiley rolleyes' src='img/x.gif' alt='*rolleyes*' title='*rolleyes*'>";
$replace[82] = "<img class='smiley sad' src='img/x.gif' alt=':(' title=':('>";
$replace[83] = "<img class='smiley shy' src='img/x.gif' alt='*shy*' title='*shy*'>";
$replace[84] = "<img class='smiley smile' src='img/x.gif' alt='*smile*' title='*smile*'>";
$replace[85] = "<img class='smiley tongue' src='img/x.gif' alt='*tongue*' title='*tongue*'>";
$replace[86] = "<img class='smiley veryangry' src='img/x.gif' alt='*veryangry*' title='*veryangry*'>";
$replace[87] = "<img class='smiley veryhappy' src='img/x.gif' alt='*veryhappy*' title='*veryhappy*'>";
$replace[88] = "<img class='smiley wink' src='img/x.gif' alt=';)' title=';)'>";
// replace alliance placeholders
$input = preg_replace_callback(
"/\[alliance(\d{0,20})\]([^\]]*)\[\/alliance\d{0,20}\]/is",
function($matches) {
global $database;
$aname = $database->getAllianceName($matches[2]);
if (!empty($aname)) return "<a href=allianz.php?aid=$matches[2]>".$aname."</a>";
else return "Alliance not found!";
},
$input);
// replace player placeholders
$input = preg_replace_callback(
"/\[player(\d{0,20})\]([^\]]*)\[\/player\d{0,20}\]/is",
function($matches) {
global $database;
$uname = $database->getUserField((int) $matches[2], "username", 0);
if (!empty($uname) && $uname != "[?]") return "<a href=spieler.php?uid=$matches[2]>".$uname."</a>";
else return "Player not found!";
},
$input);
// replace report placeholders
$input = preg_replace_callback(
"/\[report(\d{0,20})\]([^\]]*)\[\/report\d{0,20}\]/is",
function($matches) {
global $database;
$reportID = $matches[1] > 0 ? $matches[1] : $matches[2];
$report = $database->getNotice2((int) $reportID, null, false);
if (!empty($report)) return "<a href=berichte.php?id=".$reportID.">".$report['topic']."</a>";
else return "Report not found!";
},
$input);
// replace coordinate placeholders
$input = preg_replace_callback(
"/\[coor(\d{0,20})\]([^\]]*)\[\/coor\d{0,20}\]/is",
function($matches) {
global $generator, $database;
$name = "";
$coordinates = explode("|", $matches[2]);
$wRef = $database->getVilWref($coordinates[0], $coordinates[1]);
$cwref = $generator->getMapCheck($wRef);
$state = $database->getVillageType($wRef);
if($state > 0){
if($database->getVillageState($wRef)) $name = $database->getVillageField($wRef, 'name');
else $name = ABANDVALLEY;
}
else $name = $database->getOasisInfo($wRef)['name'];
if(!empty($name)) return "<a href=karte.php?d=".$wRef."&amp;c=".$cwref.">".$name." (".$coordinates[0]."|".$coordinates[1].")"."</a>";
return "Village not found!";
},
$input);
$input = preg_replace('/\[message\]/', '', $input);
$input = preg_replace('/\[\/message\]/', '', $input);
$bbcoded = preg_replace($pattern, $replace, $input);
?>
-789
View File
@@ -1,789 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Project: TravianZ ##
## Version: 22.06.2015 ##
## Filename Battle.php ##
## Developed by: Dzoki & Dixie ##
## Fixed by: Shadow ##
## Thanks to: Akakori, Elmar & Kirilloid ##
## Reworked and Fix by: ronix ##
## 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 ##
## ##
#################################################################################
class Battle {
/**
*
* @author Kirilloid --> https://github.com/kirilloid/travian/blob/master/src/model/base/combat.ts
* @var double The number of attacking catapults: 1 = 100%, 0 = 0%
*
*/
private $sigma;
public function __construct(){
$this->sigma = function($x) { return ($x > 1 ? 2 - $x ** -1.5 : $x ** 1.5) / 2; };
}
public function procSim($post) {
global $form;
// receive form and process
if(isset($post['a1_v']) && (isset($post['a2_v1']) || isset($post['a2_v2']) || isset($post['a2_v3']) || isset($post['a2_v4']))){
$_POST['mytribe'] = $post['a1_v'];
$target = [];
if(isset($post['a2_v1'])) array_push($target, 1);
if(isset($post['a2_v2'])) array_push($target, 2);
if(isset($post['a2_v3'])) array_push($target, 3);
if(isset($post['a2_v4'])) array_push($target, 4);
if(isset($post['a2_v5'])) array_push($target, 5);
$_POST['target'] = $target;
if(isset($post['h_off_bonus'])){
if(intval($post['h_off_bonus']) > 20) $post['h_off_bonus'] = 20;
}
else $post['h_off_bonus'] = 0;
if(isset($post['h_def_bonus'])){
if(intval($post['h_def_bonus']) > 20) $post['h_def_bonus'] = 20;
}
else $post['h_def_bonus'] = 0;
$sum = 0;
for($i = 1; $i <= 10; $i++) $sum += (!empty($post['a1_'.$i]) ? $post['a1_'.$i] : 0);
if($sum > 0){
$post['palast'] = intval($post['palast']);
if($post['palast'] > 20) $post['palast'] = 20;
for($i = 1; $i <= 5; $i++){
if(isset($post['wall'.$i])){
$post['wall'.$i] = intval($post['wall'.$i]);
if($post['wall'.$i] > 20) $post['wall'.$i] = 20;
elseif($post['wall'.$i] < 0) $post['wall'.$i] = 0;
$post['walllevel'] = $post['wall'.$i];
}
}
$post['tribe'] = $target[0];
$_POST['result'] = $this->simulate($post);
$newWallLevel = $_POST['result'][7];
$oldWallLevel = $_POST['result'][8];
//If the wall level is reduce, we have to re-do the whole battle
if($newWallLevel != $oldWallLevel){
$post['walllevel'] = $newWallLevel;
$_POST['result'] = $this->simulate($post);
//Reset the datas
$_POST['result'][7] = $newWallLevel;
$_POST['result'][8] = $post['walllevel'] = $oldWallLevel;
}
$form->valuearray = $post;
}
}
}
private function getBattleHero($uid) {
global $database;
$heroarray = $database->getHero($uid);
if (!count($heroarray)) return ['heroid' => 0, 'unit' =>'','atk' => 0,'di' => 0,'dc' => 0,'ob' => 0,'db' => 0,'health' => 0];
$herodata = $GLOBALS["h".$heroarray[0]['unit']];
if(!isset($heroarray['health'])) $heroarray['health'] = 0;
$h_atk = $herodata['atk'] + ($heroarray[0]['attack'] * $herodata['atkp']);
$h_di = $herodata['di'] + 5 * floor($heroarray[0]['defence'] * $herodata['dip'] / 5);
$h_dc = $herodata['dc'] + 5 * floor($heroarray[0]['defence'] * $herodata['dcp'] / 5);
$h_ob = 1 + 0.010 * ($heroarray[0]['attackbonus'] / 5);
$h_db = 1 + 0.010 * ($heroarray[0]['defencebonus'] / 5);
return ['heroid' => (int) $heroarray[0]['heroid'], 'unit' => $heroarray[0]['unit'], 'atk' => $h_atk, 'di' => $h_di, 'dc' => $h_dc, 'ob' => $h_ob, 'db' => $h_db, 'health' => $heroarray['health']];
}
private function getBattleHeroSim($attbonus) {
$h_atk = 0;
$h_ob = 1 + 0.010 * $attbonus;
return ['unit' => 16,'atk' => $h_atk,'ob' => $h_ob];
}
private function simulate($post) {
//set the arrays with attacking and defending units
$attacker = ['u1' => 0, 'u2' => 0, 'u3' => 0, 'u4' => 0, 'u5' => 0, 'u6' => 0, 'u7' => 0, 'u8' => 0, 'u9' => 0, 'u10' => 0, 'u11' => 0, 'u12' => 0, 'u13' => 0, 'u14' => 0, 'u15' => 0, 'u16' => 0, 'u17' => 0, 'u18' => 0, 'u19' => 0, 'u20' => 0, 'u21' => 0, 'u22' => 0, 'u23' => 0, 'u24' => 0,
'u25' => 0, 'u26' => 0, 'u27' => 0, 'u28' => 0, 'u29' => 0, 'u30' => 0, 'u31' => 0, 'u32' => 0, 'u33' => 0, 'u34' => 0, 'u35' => 0, 'u36' => 0, 'u37' => 0, 'u38' => 0, 'u39' => 0, 'u40' => 0, 'u41' => 0, 'u42' => 0, 'u43' => 0, 'u44' => 0, 'u45' => 0, 'u46' => 0, 'u47' => 0, 'u48' => 0,
'u49' => 0, 'u50' => 0];
$start = ($post['a1_v'] - 1) * 10 + 1;
$offhero = intval($post['h_off_bonus']);
$hero_strenght = intval($post['h_off']);
$deffhero = intval($post['h_def_bonus']);
for($i = $start, $index = 1; $i <= $start + 9; $i++, $index++) {
if(isset($post['a1_'.$index]) && !empty($post['a1_'.$index])) {
$attacker['u'.$i] = $post['a1_'.$index];
}
else $attacker['u'.$i] = 0;
if($index <=8 && isset($post['f1_'.$index]) && !empty($post['f1_'.$index])) {
${'att_ab'.$index} = $post['f1_'.$index];
}
else ${'att_ab'.$index} = 0;
}
$defender = [];
$defscout = 0;
//fix by ronix
for($i = 1;$i <= 50; $i++) {
if(isset($post['a2_'.$i]) && !empty($post['a2_'.$i])) {
$defender['u'.$i] = $post['a2_'.$i];
$def_ab[$i] = $post['f2_'.$i];
if($i == 4 || $i == 14 || $i == 23 || $i == 44){
$defscout += $defender['u'.$i];
}
}
else {
$defender['u'.$i] = 0;
$def_ab[$i] = 0;
}
}
$deftribe = $post['tribe'];
$wall = 0;
if(empty($post['kata'])) $post['kata'] = 0;
// check scout
$scout = 1;
for($i = $start; $i <= $start + 9 ; $i++) {
if($i == 4 || $i == 14 || $i == 23 || $i == 44){
}else{
if($attacker['u'.$i] > 0) {
$scout = 0;
break;
}
}
}
$walllevel = $post['walllevel'];
$wall = $walllevel;
$palast = $post['palast'];
if($scout == 1 && $defscout == 0) $walllevel = $wall = $palast = 0;
if($scout == 1) $palast = 0; //no def point palace and residence when scout
if(!$scout) return $this->calculateBattle($attacker,$defender,$wall,$post['a1_v'],$deftribe,$palast,$post['ew1'],$post['ew2'],$post['ktyp']+3,$def_ab,$att_ab1,$att_ab2,$att_ab3,$att_ab4,$att_ab5,$att_ab6,$att_ab7,$att_ab8,$post['kata'],$post['stonemason'],$walllevel,$offhero,$post['h_off'],$deffhero,0,0,0,0,0);
else return $this->calculateBattle($attacker,$defender,$wall,$post['a1_v'],$deftribe,$palast,$post['ew1'],$post['ew2'],1,$def_ab,$att_ab1,$att_ab2,$att_ab3,$att_ab4,$att_ab5,$att_ab6,$att_ab7,$att_ab8,$post['kata'],$post['stonemason'],$walllevel,0,0,0,0,0,0,0,0);
}
public function getTypeLevel($tid,$vid) {
global $village,$database;
$keyholder = [];
$resourcearray = $database->getResourceLevel($vid);
foreach(array_keys($resourcearray, $tid) as $key) {
if(strpos($key,'t')) {
$key = preg_replace("/[^0-9]/", '', $key);
array_push($keyholder, $key);
}
}
$element = count($keyholder);
if($element >= 2) {
if($tid <= 4) {
$temparray = [];
for($i = 0; $i <= $element - 1; $i++){
array_push($temparray, $resourcearray['f'.$keyholder[$i]]);
}
foreach ($temparray as $key => $val) {
if ($val == max($temparray))
$target = $key;
}
}
else {
$target = 0;
for($i=1;$i<=$element-1;$i++) {
if($resourcearray['f'.$keyholder[$i]] > $resourcearray['f'.$keyholder[$target]]) {
$target = $i;
}
}
}
}
else if($element == 1) $target = 0;
else return 0;
if(!empty($keyholder[$target])) return $resourcearray['f'.$keyholder[$target]];
else return 0;
}
//1 raid 0 normal
function calculateBattle($Attacker, $Defender, $def_wall, $att_tribe, $def_tribe, $residence, $attpop, $defpop, $type, $def_ab, $att_ab1, $att_ab2, $att_ab3, $att_ab4, $att_ab5, $att_ab6, $att_ab7, $att_ab8, $tblevel, $stonemason, $walllevel, $offhero, $hero_strenght, $deffhero, $AttackerID, $DefenderID, $AttackerWref, $DefenderWref, $conqureby, $defReinforcements = null) {
global $bid34, $bid35, $database;
// Define the array, with the units
$calvary = [4, 5, 6, 15, 16, 23, 24, 25, 26, 45, 46];
$catapult = [8, 18, 28, 48];
$rams = [7, 17, 27, 47];
$catp = $ram = 0;
// Array to return the result of the calculation back
$result = [];
$involve = 0;
$winner = false;
// at 0 all partial results
//cap = Cavalry attack points
//ap = Infantry attack points
//cdp = Cavalry attack points
//dp = Infantry defense points
//rap = Result attack points
//rdp = Result defense points
//detected = Detected or not by defender spies
$cap = $ap = $dp = $cdp = $rap = $rdp = 0;
$detected = false;
//Get involved artifacts
$attacker_artefact = $database->getArtifactsValueInfluence($AttackerID, $AttackerWref, 3, 1, false);
$defender_artefact = $database->getArtifactsValueInfluence($DefenderID, $DefenderWref, 3, 1, false);
$strongerbuildings = $database->getArtifactsValueInfluence($DefenderID, $DefenderWref, 1, 1, false);
$isWWVillage = $database->getVillageField($DefenderWref, 'natar');
if(isset($Attacker['uhero']) && $Attacker['uhero'] > 0){
$atkhero = $this->getBattleHero($AttackerID);
}
if(isset($Defender['hero']) && $Defender['hero'] > 0){
$defenderhero = $this->getBattleHero($DefenderID);
}
//own defender units
if ($type == 1) {
$datadefScout = $this->getDataDefScout($Defender, $def_ab, $defender_artefact);
$dp += $datadefScout['dp'];
$cdp += $datadefScout['cdp'];
$involve = $datadefScout['involve'];
if(!$detected && $datadefScout['detect']) $detected = $datadefScout['detect'];
}else{
$datadef = $this->getDataDef($Defender, $def_ab);
$dp += $datadef['dp'];
$cdp += $datadef['cdp'];
$involve = $datadef['involve'];
if(isset($Defender['hero']) && $Defender['hero'] != 0){
$units['Def_unit']['hero'] = $Defender['hero'];
$cdp += $defenderhero['dc'];
$dp += $defenderhero['di'];
$dp *= $defenderhero['db'];
$cdp *= $defenderhero['db'];
}
}
$DefendersAll = (!is_null($defReinforcements) ? $database->getEnforceVillage($DefenderWref, 0) : $defReinforcements);
if(!empty($DefendersAll) && $DefenderWref > 0){
// preload village IDs
$vilIDs = [];
foreach($DefendersAll as $defenders) {
$vilIDs[$defenders['from']] = true;
$vilIDs[$defenders['to']] = true;
}
$vilIDs = array_keys($vilIDs);
$database->getABTech($vilIDs);
foreach($DefendersAll as $defenders) {
for ($i = 1; $i <= 50; $i++) $def_ab[$i] = 0;
$fromvillage = $defenders['from'];
$userdataCache[$fromvillage] = $database->getUserArray($database->getVillageField($fromvillage, "owner"), 1);
$enforcetribe = $userdataCache[$fromvillage]["tribe"];
$ud=($enforcetribe - 1) * 10;
if($defenders['from'] > 0) { //don't check nature tribe
$armory = $database->getABTech($defenders['from']); // Armory level every village enforcement
$def_ab[$ud + 1] = $armory['a1'];
$def_ab[$ud + 2] = $armory['a2'];
$def_ab[$ud + 3] = $armory['a3'];
$def_ab[$ud + 4] = $armory['a4'];
$def_ab[$ud + 5] = $armory['a5'];
$def_ab[$ud + 6] = $armory['a6'];
$def_ab[$ud + 7] = $armory['a7'];
$def_ab[$ud + 8] = $armory['a8'];
}
if ($type == 1) {
$datadefScout = $this->getDataDefScout($defenders, $def_ab, $defender_artefact);
$dp += $datadefScout['dp'];
$cdp += $datadefScout['cdp'];
$involve = $datadefScout['involve'];
if(!$detected && $datadefScout['detect']) $detected = $datadefScout['detect'];
}else{
$datadef = $this->getDataDef($defenders, $def_ab);
$dp += $datadef['dp'];
$cdp += $datadef['cdp'];
$involve = $datadef['involve'];
}
$reinfowner = $database->getVillageField($fromvillage, "owner");
$defhero = $this->getBattleHero($reinfowner);
//calculate def hero from enforcement
if($defenders['hero'] != 0){
$cdp += $defhero['dc'];
$dp += $defhero['di'];
$dp *= $defhero['db'];
$cdp *= $defhero['db'];
}
}
}
// Calculate the total number of points Attacker
$start = ($att_tribe - 1) * 10 + 1;
$end = $att_tribe * 10;
if($att_tribe == 3) $abcount = 3;
else $abcount = 4;
if($type == 1) {//scout
for($i = $start;$i <= $end; $i++) {
global ${'u'.$i};
$j = $i - $start + 1;
if($Attacker['u'.$i] > 0 && ($i == 4 || $i == 14 || $i == 23 || $i == 44)){
if(${'att_ab'.$abcount} > 0) {
$ap += round(35 + (35 + 300 * ${'u'.$i}['pop'] / 7) * (pow(1.007, ${'att_ab'.$abcount}) - 1), 4) * $Attacker['u'.$i];
}
else $ap += $Attacker['u'.$i] * 35;
}
$involve += $Attacker['u'.$i];
$units['Att_unit'][$i] = $Attacker['u'.$i];
}
$ap *= $attacker_artefact;
}else{ //type=3 normal 4=raid
$abcount = 1;
for($i = $start; $i <= $end; $i++) {
global ${'u'.$i};
$j = $i - $start + 1;
if($abcount <= 8 && ${'att_ab'.$abcount} > 0) {
if(in_array($i,$calvary)) {
$cap += round(${'u'.$i}['atk'] + (${'u'.$i}['atk'] + 300 * ${'u'.$i}['pop'] / 7) * (pow(1.007, ${'att_ab'.$abcount}) - 1), 4) * (int) $Attacker['u'.$i];
}else{
$ap += round(${'u'.$i}['atk'] + (${'u'.$i}['atk'] + 300 * ${'u'.$i}['pop'] / 7) * (pow(1.007, ${'att_ab'.$abcount}) - 1), 4) * (int) $Attacker['u'.$i];
}
}else{
if(in_array($i,$calvary)) $cap += (int) $Attacker['u'.$i]*${'u'.$i}['atk'];
else $ap += (int) $Attacker['u'.$i]*${'u'.$i}['atk'];
}
$abcount += 1;
// Points catapult the attacker
if(in_array($i, $catapult)) $catp += (int) $Attacker['u'.$i];
// Points of the Rams attacker
if(in_array($i, $rams)) $ram += (int) $Attacker['u'.$i];
$involve += (int) $Attacker['u'.$i];
$units['Att_unit'][$i] = (int) $Attacker['u'.$i];
}
if (isset($Attacker['uhero']) && $Attacker['uhero'] != 0){
$units['Att_unit']['hero'] = $Attacker['uhero'];
$ap *= $atkhero['ob'];
$cap *= $atkhero['ob'];
$ap += $atkhero['atk'];
}
if ($offhero > 0 || $hero_strenght > 0) {
$atkhero= $this->getBattleHeroSim($offhero);
$ap *= $atkhero['ob'];
$cap *= $atkhero['ob'];
$ap += $hero_strenght;
}
if ($deffhero > 0) {
$dfdhero = $this->getBattleHeroSim($deffhero);
$dp *= $dfdhero['ob'];
$cdp *= $dfdhero['ob'];
}
}
// Formula for calculating the bonus defensive wall and Residence
if($def_wall > 0) {
// Set the factor calculation for the "wall" as the type of the civilization
// Factor = 1030 Wall Roman
// Factor = 1020 Wall Teuton
// Factor = 1025 Wall Goul
$factor = ($def_tribe == 1)? 1.030 : (($def_tribe == 2)? 1.020 : 1.025);
$wallMultiplier = round(pow($factor, $def_wall), 3);
// Defense infantry = Infantry * Wall (%)
// Defense calvary calvary = * Wall (%)
if ($dp > 0 || $cdp > 0){
if($type == 1) {
$dp *= $wallMultiplier;
$dp += 10;
}else{
$dp *= $wallMultiplier;
$cdp *= $wallMultiplier;
// Calculation of the Basic defense bonus "Residence"
$dp += (2 * (pow($residence, 2)) + 10) * $wallMultiplier;
$cdp += (2 * (pow($residence, 2)) + 10) * $wallMultiplier;
}
}else{
$dp = 10 * $wallMultiplier * $def_wall;
// Defense calvary calvary = * Wall (%)
$cdp = 10 * $wallMultiplier * $def_wall;
if($type != 1){
// Calculation of the Basic defense bonus "Residence"
$dp += (2 * (pow($residence, 2)) + 10) * $wallMultiplier;
$cdp += (2 * (pow($residence, 2)) + 10) * $wallMultiplier;
}else{
$dp += 10;
$cdp = 0;
}
}
}elseif($type != 1) {
// Calculation of the Basic defense bonus "Residence"
$dp += (2 * (pow($residence, 2)) + 10);
$cdp += (2 * (pow($residence, 2)) + 10);
}
// Formula for calculating Attacking Points (Infantry & Cavalry)
if($AttackerWref != 0){
$rap = round(($ap + $cap) + (($ap + $cap) / 100 * (isset($bid35[$this->getTypeLevel(35, $AttackerWref)]) ? $bid35[$this->getTypeLevel(35, $AttackerWref)]['attri'] : 0)));
}
else $rap = round($ap + $cap);
// Formula for calculating Defensive Points
if ($rap == 0) $rdp = round(($dp) + ($cdp));
else $rdp = round(round($cap / $rap, 4) * ($cdp) + round($ap / $rap, 4) * ($dp));
// The Winner is....:
$result['Attack_points'] = $rap;
$result['Defend_points'] = $rdp;
$winner = ($rap > $rdp);
// Formula for calculating the Morale bonus
// WW villages aren't affected by this bonus
if($attpop > $defpop && !$isWWVillage) {
$moralbonus = 1 / round(max(0.667, pow($defpop / $attpop, 0.2 * min(1, $rap / ($rdp > 0 ? $rdp : 1)))), 3);
}
else $moralbonus = 1.0;
if($involve >= 1000 && $type != 1) $Mfactor = 2 * round((1.8592 - pow($involve, 0.015)), 4);
else $Mfactor = 1.5;
if ($Mfactor < 1.2578) $Mfactor = 1.2578;
elseif ($Mfactor > 1.5) $Mfactor = 1.5;
// Formula for calculating losses
// $type = 1 Scout, 2 Enforcement
// $type = 3 Normal, 4 Raid
if($type == 1){
$holder = pow((($rdp * $moralbonus) / $rap), $Mfactor);
if($holder > 1) $holder = 1;
if ($rdp > $rap) $holder = 1;
//Birds of Prey cannot die when scouting
//Spies cannot die if the attacked village has no defending spies
//Attacker result
$result[1] = ($att_tribe == 5 || !$detected) ? 0 : $holder;
//Defender result
$result[2] = 0;
}else if($type == 4) {
$holder = ($winner) ? pow((($rdp * $moralbonus) / $rap), $Mfactor) : pow(($rap / ($rdp * $moralbonus)), $Mfactor);
$holder = $holder / (1 + $holder);
//Attacker result
$result[1] = $winner ? $holder : 1 - $holder;
//Defender result
$result[2] = $winner ? 1 - $holder : $holder;
$ram -= round($ram * $result[1] / 100);
$catp -= round($catp * $result[1] / 100);
}else if($type == 3){
// Attacker
$result[1] = ($winner) ? pow((($rdp * $moralbonus) / $rap), $Mfactor) : 1;
if ($result[1] > 1){
$result[1] = 1;
$winner = false;
$result['Winner'] = "defender";
}
// Defender
$result[2] = (!$winner) ? pow(($rap / ($rdp * $moralbonus)), $Mfactor) : 1;
if ($result[1] == 1) $result[2] = pow(($rap / ($rdp * $moralbonus)), $Mfactor);
if ($result[2] > 1) {
$result[2] = 1;
$result['Winner'] = "attacker";
$winner = true;
}
// If attacked with "Hero"
$ku = ($att_tribe - 1) * 10 + 9;
$kings = (int) $Attacker['u'.$ku];
$aviables = $kings - round($kings * (int) $result[1]);
if ($aviables > 0){
switch($aviables){
case 1: $fealthy = rand(20, 30); break;
case 2: $fealthy = rand(40, 60); break;
case 3: $fealthy = rand(60, 80); break;
case 4: $fealthy = rand(80, 100); break;
default: $fealthy = 100; break;
}
$result['hero_fealthy'] = $fealthy;
}
$ram -= ($winner) ? round($ram * $result[1] / 100) : round($ram * $result[2] / 100);
$catp -= ($winner) ? round($catp * $result[1] / 100) : round($catp * $result[2] / 100);
}
if($catp > 0 && $tblevel != 0) {
//Catapults blacksmith upgrades
$upgrades = round(200 * pow(1.0205, $att_ab8)) / 200;
//Buildings durability
$durability = ($stonemason > 0 ? $bid34[$stonemason]['attri'] / 100 : 1);
//Calculates the catapults morale bonus
$catpMoraleBonus = min(max(($attpop / ($defpop > 0 ? $defpop : 1)) ** 0.3, 1), 3);
//New level of the building (only for warsim.php)
$catapultsDamage = $this->calculateCatapultsDamage($catp, $upgrades, $durability, $rap / $rdp, $strongerbuildings, $catpMoraleBonus);
$result[3] = $this->calculateNewBuildingLevel($tblevel, $catapultsDamage);
$result[4] = $tblevel;
//Results for Automation.php
$result['catapults']['upgrades'] = $upgrades;
$result['catapults']['durability'] = $durability;
$result['catapults']['attackDefenseRatio'] = $rap / $rdp;
$result['catapults']['strongerBuildings'] = $strongerbuildings;
$result['catapults']['moraleBonus'] = $catpMoraleBonus;
}
if($ram > 0 && $walllevel != 0) {
//Rams blacksmith upgrades
$upgrades = round(200 * pow(1.0205, $att_ab7)) / 200;
//Building durability
$durability = ($stonemason > 0 ? $bid34[$stonemason]['attri'] / 100 : 1);
// New level of the building (only for warsim.php)
$ramsDamage = $this->calculateCatapultsDamage($ram, $upgrades, $durability, $rap / $rdp, $strongerbuildings, 1);
$result[7] = $this->calculateNewBuildingLevel($walllevel, $ramsDamage);
$result[8] = $walllevel;
// Results for Automation.php
$result['rams']['upgrades'] = $upgrades;
$result['rams']['durability'] = $durability;
$result['rams']['attackDefenseRatio'] = $rap / $rdp;
$result['rams']['strongerBuildings'] = $strongerbuildings;
$result['rams']['moraleBonus'] = 1;
}
$result[6] = pow($rap / ($rdp * $moralbonus > 0 ? $rdp * $moralbonus : 1), $Mfactor);
$result['moralBonus'] = $moralbonus;
$total_att_units = count($units['Att_unit']);
$start = intval(($att_tribe - 1) * 10 + 1);
$end = intval($att_tribe * 10);
for($i = $start; $i <= $end; $i++){
$y = $i - (($att_tribe - 1) * 10);
$result['casualties_attacker'][$y] = round($result[1] * $units['Att_unit'][$i]);
}
if (isset($units['Att_unit']['hero']) && $units['Att_unit']['hero'] >0){
$_result = mysqli_query($database->dblink,"select heroid, health from " . TB_PREFIX . "hero where `dead`='0' and `heroid`=".(int) $atkhero['heroid']);
$fdb = mysqli_fetch_array($_result);
$hero_id = (int) $fdb['heroid'];
$hero_health = $fdb['health'];
$damage_health = round(100 * $result[1]);
if ($hero_health <= $damage_health || $damage_health > 90){
//hero die
$result['casualties_attacker'][11] = 1;
mysqli_query($database->dblink,"update " . TB_PREFIX . "hero set `dead` = 1, `health` = 0 where `heroid`=".(int) $hero_id);
}else{
mysqli_query($database->dblink,"update " . TB_PREFIX . "hero set `health`=`health`-".(int) $damage_health." where `heroid`=".(int) $hero_id);
}
}
unset($_result, $fdb, $hero_id, $hero_health, $damage_health);
if (isset($units['Def_unit']['hero']) && $units['Def_unit']['hero'] >0){
$_result = mysqli_query($database->dblink,"select heroid, health from " . TB_PREFIX . "hero where `dead`='0' and `heroid`=".(int) $defenderhero['heroid']);
$fdb = mysqli_fetch_array($_result);
$hero_id = (int) $fdb['heroid'];
$hero_health = $fdb['health'];
$damage_health = round(100 * $result[2]);
if ($hero_health <= $damage_health || $damage_health > 90){
//hero die
$result['deadherodef'] = 1;
mysqli_query($database->dblink,"update " . TB_PREFIX . "hero set `dead` = 1, `health` = 0 where `heroid`=".(int) $hero_id);
}else{
$result['deadherodef'] = 0;
mysqli_query($database->dblink,"update " . TB_PREFIX . "hero set `health`=`health`-".(int) $damage_health." where `heroid`=".(int) $hero_id);
}
}
unset($_result, $fdb, $hero_id, $hero_health, $damage_health);
if(!empty($DefendersAll)){
$battleHeroesCache = [];
foreach($DefendersAll as $defenders) {
if($defenders['hero'] > 0) {
$battleHeroesCache[$defenders['from']] = $this->getBattleHero($database->getVillageField($defenders['from'],"owner"));
$heroarraydefender = $battleHeroesCache[$defenders['from']];
$_result = mysqli_query($database->dblink,"select heroid, health from " . TB_PREFIX . "hero where `dead`='0' and `heroid`=".(int) $heroarraydefender['heroid']);
$fdb = mysqli_fetch_array($_result);
$hero_id = (int) $fdb['heroid'];
$hero_health = $fdb['health'];
$damage_health = round(100 * $result[2]);
if ($hero_health <= $damage_health || $damage_health > 90){
//hero die
$result['deadheroref'][$defenders['id']] = 1;
mysqli_query($database->dblink,"update " . TB_PREFIX . "hero set `dead` = 1, `health` = 0 where `heroid`=".(int) $hero_id);
}else{
$result['deadheroref'][$defenders['id']] = 0;
mysqli_query($database->dblink,"update " . TB_PREFIX . "hero set `health`=`health`-".(int) $damage_health." where `heroid`=".(int) $hero_id);
}
}
}
}
unset($_result, $fdb, $hero_id, $hero_health, $damage_health);
// Work out bounty
$start = ($att_tribe - 1) * 10 + 1;
$end = ($att_tribe * 10);
$max_bounty = 0;
for($i = $start; $i <= $end; $i++) {
$j = $i - $start + 1;
$y = $i -(($att_tribe - 1) * 10);
$max_bounty += ((int) $Attacker['u'.$i] - (int) $result['casualties_attacker'][$y]) * (int) ${'u'.$i}['cap'];
}
$result['bounty'] = $max_bounty;
return $result;
}
public function getDataDefScout($defenders, $def_ab, $defender_artefact) {
$abcount = 1;
$invol = $dp = $cdp = 0;
$detected = false;
for($y = 4; $y <= 50; $y++) {
if($y == 4 || $y == 14 || $y == 23 || $y == 44){
global ${'u'.$y};
if($defenders['u'.$y] > 0 && $def_ab[$y] > 0){
$dp += round(20 + (20 + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, $def_ab[$y]) - 1), 4) * $defenders['u'.$y] * $defender_artefact;
$detected = true;
}else{
if($defenders['u'.$y] > 0){
$dp += $defenders['u'.$y] * 20 * $defender_artefact;
$detected = true;
}
}
$invol += $defenders['u'.$y]; //total troops
$units['Def_unit'][$y] = $defenders['u'.$y];
}
}
$datadef['dp'] = $dp;
$datadef['cdp'] = $cdp;
$datadef['detect'] = $detected;
$datadef['involve'] = $invol;
return $datadef;
}
public function getDataDef($defenders,$def_ab) {
$dp = $cdp = $invol = 0;
for($y = 1;$y <= 50; $y++) {
global ${'u'.$y};
if ($defenders['u'.$y] > 0) {
if (!isset($def_ab[$y])) {
$def_ab[$y] = 0;
}
if ($def_ab[$y] > 0) {
$dp += round(${'u'.$y}['di'] + (${'u'.$y}['di'] + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, $def_ab[$y]) - 1), 4) * $defenders['u'.$y];
$cdp += round(${'u'.$y}['dc'] + (${'u'.$y}['dc'] + 300 * ${'u'.$y}['pop'] / 7) * (pow(1.007, $def_ab[$y]) - 1), 4) * $defenders['u'.$y];
}else{
$dp += $defenders['u'.$y] * ${'u'.$y}['di'];
$cdp += $defenders['u'.$y] * ${'u'.$y}['dc'];
}
}
$invol += $defenders['u'.$y]; //total troops
$units['Def_unit'][$y] = $defenders['u'.$y];
}
$datadef['dp'] = $dp;
$datadef['cdp'] = $cdp;
$datadef['involve'] = $invol;
return $datadef;
}
/**
* @author Kirilloid --> https://github.com/kirilloid/travian/blob/master/src/model/base/combat.ts
*
* Calculates the new building level, after damaging it
*
* @param int $oldLevel The old building level
* @param float $damage The damage done by catapults
* @return int Returns the new building level
*/
public function calculateNewBuildingLevel($oldLevel, $damage){
$damage -= 0.5;
if ($damage < 0) return $oldLevel;
while ($damage >= $oldLevel && $oldLevel) $damage -= $oldLevel--;
return $oldLevel;
}
/**
* @author Kirilloid --> https://github.com/kirilloid/travian/blob/master/src/model/base/combat.ts
*
* Calculates the damage done by catapults
*
* @param int $catapultsQuantity The quantity of catapults which take part in the attack
* @param double $catapultsUpgrade The catapults upgrade multiplier, affected by the cataputls level in the blacksmith
* @param double $durability The building durability, affected by the stonemason's lodge
* @param double $ADRatio The attack points / defensive points ratio
* @param double $strongerBuildings The artifacts multiplier, which strengthens the building, affected by durability artifacts
* @param double $moraleBonus The defender morale bonus
* @return double Returns the damage done by catapults
*/
public function calculateCatapultsDamage($catapultsQuantity, $catapultsUpgrade, $durability, $ADRatio, $strongerBuildings, $moraleBonus){
$catapultsEfficiency = floor($catapultsQuantity / ($durability * $strongerBuildings));
return 4 * ($this->sigma)($ADRatio) * $catapultsEfficiency * $catapultsUpgrade / $moraleBonus;
}
};
$battle = new Battle;
?>
-845
View File
@@ -1,845 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Project: TravianZ ##
## Version: 22.06.2015 ##
## Filename Building.php ##
## 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 ##
## ##
#################################################################################
class Building {
public $NewBuilding = false;
private $maxConcurrent;
private $allocated;
private $basic, $inner, $plus = 0;
public $buildArray = [];
public function __construct() {
global $session;
$this->maxConcurrent = BASIC_MAX;
if(ALLOW_ALL_TRIBE || $session->tribe == 1) $this->maxConcurrent += INNER_MAX;
if($session->plus) $this->maxConcurrent += PLUS_MAX;
$this->LoadBuilding();
foreach($this->buildArray as $build) {
if($build['master'] == 1) $this->maxConcurrent++;
}
}
/*
* 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'];
}
}
//Get our WW construction plans
$userHasWWConstructionPlans = $database->getWWConstructionPlans($session->uid);
//Get ally WW construction plans
$allyHasWWConstructionPlans = $session->alliance > 0 ? $database->getWWConstructionPlans($session->uid, $session->alliance) : false;
//Check if we should allow building the WW this high
if($wwHighestLevelFound < 50) $cached = $userHasWWConstructionPlans;
else $cached = $userHasWWConstructionPlans && $allyHasWWConstructionPlans;
}
return $cached;
}
public function canProcess($id, $tid) {
//add fix by ronix
global $session, $database, $village;
$levels = $database->getResourceLevel($village->wid);
//Don't allow building WW to level 51 with a waiting loop
if (!(($tid != 99 || ($tid == 99 && $this->allowWwUpgrade())))) $this->redirect($tid);
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
(
($tid >= 1 && $tid <= 18 && $id >= 1 && $id <= 4) ||
($tid >= 19 && $id > 4)
) &&
//Check that we're not trying to change a standing building type
(
$levels['f'.$tid.'t'] == $id ||
$levels['f'.$tid.'t'] == 0
) &&
//Check that we're not trying to build in the walls id
(
($tid == 40 && in_array($id, [31, 32, 33])) ||
$tid != 40
)
) {
if (!isset($_GET['master']) && $this->checkResource($id, $tid) != 4){
$this->redirect($tid);
}
//Check if the building will be built with the master builder
if(isset($_GET['master'])){
//If so, we have to check if it'll be built or upgraded
if($levels['f'.$tid.'t'] == 0)
{
//The building will be built, we have to check if we can build it
if(!$this->meetRequirement($id)) $this->redirect($tid);
}else{
//The building will be upgraded, we have to check if we can upgrade it
if($this->isMax($id, $tid, $this->isLoop($tid) + $this->isCurrent($tid))){
$this->redirect($tid);
}
}
}
}else{
header('Location: '.$_SERVER['SCRIPT_NAME']);
exit;
}
}
/**
* Redirects to dorf1.php if we're building/upgrading resource fields otherwise in dorf2.php
*
* @param int $tid the id where the building is built/upgraded
*/
private function redirect($tid){
if ($tid >= 19) header("Location: dorf2.php");
else header("Location: dorf1.php");
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']);
else
{
$session->changeChecker();
$this->canProcess($village->resarray['f'.$get['a'].'t'],$get['a']);
$this->upgradeBuilding($get['a']);
}
}elseif(isset($get['master']) && isset($get['id']) && $session->gold >= 1 && $session->goldclub && $village->master == 0 && (isset($get['c']) && $get['c']== $session->checker)) {
$this->canProcess($get['master'], $get['id']);
$session->changeChecker();
$level = $database->getResourceLevel($village->wid);
$time = $this->resourceRequired($get['id'], $get['master'])['time'];
$database->addBuilding($village->wid, $get['id'], $get['master'], 1, $time, 1, $level['f'.$get['id']] + 1 + count($database->getBuildingByField($village->wid, $get['id'])));
$this->redirect($get['id']);
}elseif(isset($get['a']) && $get['c'] == $session->checker && isset($get['id'])) {
if($get['id'] > 18 && ($get['id'] < 41 || $get['id'] == 99)){
$session->changeChecker();
$this->canProcess($get['a'], $get['id']);
$this->constructBuilding($get['id'], $get['a']);
}
}
elseif(isset($get['buildingFinish']) && $session->gold >= 2 && $session->sit == 0) $this->finishAll();
}
public function canBuild($id, $tid) {
global $village, $session, $database;
$demolition = $database->getDemolition($village->wid);
if((isset($demolition[0])) && $demolition[0]['buildnumber'] == $id) return 11;
if($this->isMax($tid, $id)) return 1;
else if($this->isMax($tid, $id, 1) && ($this->isLoop($id) || $this->isCurrent($id))) return 10;
else if($this->isMax($tid, $id, 2) && $this->isLoop($id) && $this->isCurrent($id)) return 10;
else if($this->isMax($tid, $id, 3) && $this->isLoop($id) && $this->isCurrent($id) && count($database->getMasterJobs($village->wid)) > 0) {
return 10;
}
else {
if($this->allocated <= $this->maxConcurrent) {
$resRequired = $this->resourceRequired($id, $village->resarray['f'.$id.'t']);
$resRequiredPop = $resRequired['pop'];
if (empty($resRequiredPop)) {
$buildarray = $GLOBALS["bid".$tid];
$resRequiredPop = $buildarray[1]['pop'];
}
$jobs = $database->getJobs($village->wid);
if ($jobs > 0) {
$soonPop = 0;
foreach ($jobs as $j) {
$buildarray = $GLOBALS["bid".$j['type']];
$soonPop += $buildarray[$database->getFieldLevel($village->wid, $j['field']) + 1]['pop'];
}
}
if(($village->allcrop - $village->pop - $soonPop - $resRequiredPop) <= 1 && $village->resarray['f'.$id.'t'] <> 4) {
return 4;
}
else {
switch($this->checkResource($tid, $id)) {
case 1: return 5;
case 2: return 6;
case 3: return 7;
case 4:
if($id >= 19) {
if($session->tribe == 1 || ALLOW_ALL_TRIBE) {
if($this->inner == 0) return 8;
else
{
if($session->plus || $tid == 40) {
if($this->plus == 0) return 9;
else return 3;
}
else return 2;
}
}
else {
if($this->basic == 0) return 8;
else
{
if($session->plus || $tid == 40) {
if($this->plus == 0) return 9;
else return 3;
}
else return 2;
}
}
}
else {
if($this->basic == 1) {
if(($session->plus || $tid == 40) && $this->plus == 0) return 9;
else return 3;
}
else return 8;
}
}
}
}
else return 2;
}
}
public function walling() {
global $session;
$wall = array(31,32,33);
foreach($this->buildArray as $job) {
if(in_array($job['type'],$wall)) return "3".$session->tribe;
}
return false;
}
public function rallying() {
foreach($this->buildArray as $job) {
if($job['type'] == 16) return true;
}
return false;
}
public static function procResType($ref) {
switch($ref) {
case 1: return "Woodcutter";
case 2: return "Clay Pit";
case 3: return "Iron Mine";
case 4: return "Cropland";
case 5: return "Sawmill";
case 6: return "Brickyard";
case 7: return "Iron Foundry";
case 8: return "Grain Mill";
case 9: return "Bakery";
case 10: return "Warehouse";
case 11: return "Granary";
case 12: return "Blacksmith";
case 13: return "Armoury";
case 14: return "Tournament Square";
case 15: return "Main Building";
case 16: return "Rally Point";
case 17: return "Marketplace";
case 18: return "Embassy";
case 19: return "Barracks";
case 20: return "Stable";
case 21: return "Workshop";
case 22: return "Academy";
case 23: return "Cranny";
case 24: return "Town Hall";
case 25: return "Residence";
case 26: return "Palace";
case 27: return "Treasury";
case 28: return "Trade Office";
case 29: return "Great Barracks";
case 30: return "Great Stable";
case 31: return "City Wall";
case 32: return "Earth Wall";
case 33: return "Palisade";
case 34: return "Stonemason's Lodge";
case 35: return "Brewery";
case 36: return "Trapper";
case 37: return "Hero's Mansion";
case 38: return "Great Warehouse";
case 39: return "Great Granary";
case 40: return "Wonder of the World";
case 41: return "Horse Drinking Trough";
case 42: return "Great Workshop";
default: return "Error";
}
}
public function loadBuilding() {
global $database,$village,$session;
$this->buildArray = $database->getJobs($village->wid);
$this->allocated = count($this->buildArray);
if($this->allocated > 0) {
foreach($this->buildArray as $build) {
if($build['loopcon'] == 1) $this->plus = 1;
else
{
if($build['field'] <= 18) $this->basic++;
else
{
if($session->tribe == 1 || ALLOW_ALL_TRIBE) $this->inner++;
else $this->basic++;
}
}
}
$this->NewBuilding = true;
}
else $this->NewBuilding = false;
}
private function removeBuilding($d) {
global $database, $village;
foreach($this->buildArray as $jobs) {
if($jobs['id'] == $d) {
$uprequire = $this->resourceRequired($jobs['field'], $jobs['type']);
if($database->removeBuilding($d, $session->tribe, $village->wid, $village->resarray)) {
if($jobs['master'] == 0) $database->modifyResource($village->wid, $uprequire['wood'], $uprequire['clay'], $uprequire['iron'], $uprequire['crop'], 1);
$this->redirect($jobs['field']);
}
}
}
}
private function upgradeBuilding($id) {
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'];
$bindicate = $this->canBuild($id,$village->resarray['f'.$id.'t']);
// don't allow building above max levels and don't allow building if it's in demolition
if (in_array($bindicate, [1, 2, 3, 10, 11])) {
header("Location: dorf2.php");
exit;
}
$loop = ($bindicate == 9 ? 1 : 0);
$loopsame = 0;
if($loop == 1) {
foreach($this->buildArray as $build) {
if($build['field'] == $id) {
$loopsame++;
$uprequire = $this->resourceRequired($id, $village->resarray['f'.$id.'t'], ($loopsame > 0 ? 2 : 1));
}
}
if($session->tribe == 1 || ALLOW_ALL_TRIBE) {
if($id >= 19) {
foreach($this->buildArray as $build) {
if($build['field'] >= 19) {
$time = $build['timestamp'] + $uprequire['time'];
}
}
}
else {
foreach($this->buildArray as $build) {
if($build['field'] <= 18) {
$time = $build['timestamp'] + $uprequire['time'];
}
}
}
}
else {
$time = $this->buildArray[0]['timestamp'] + $uprequire['time'];
}
}
$level = $database->getResourceLevel($village->wid);
if($database->addBuilding($village->wid, $id, $village->resarray['f'.$id.'t'], $loop, $time + ($loop == 1 ? ceil(60 / SPEED) : 0), 0, $level['f'.$id] + 1 + count($database->getBuildingByField($village->wid, $id)))) {
$database->modifyResource($village->wid, $uprequire['wood'], $uprequire['clay'], $uprequire['iron'], $uprequire['crop'], 0);
$logging->addBuildLog($village->wid, self::procResType($village->resarray['f'.$id.'t']), ($village->resarray['f'.$id] + ($loopsame > 0 ? 2 : 1)), 0);
$this->redirect($id);
}
}
}
private function downgradeBuilding($id) {
global $database, $village, $session, $logging;
if($this->allocated < $this->maxConcurrent) {
$name = "bid".$village->resarray['f'.$id.'t'];
global $$name;
$dataarray = $$name;
$time = time() + round($dataarray[$village->resarray['f'.$id]-1]['time'] / 4);
$loop = 0;
if($this->inner == 1 || $this->basic == 1) {
if(($session->plus || $village->resarray['f'.$id.'t']==40)&& $this->plus == 0) {
$loop = 1;
}
}
if($loop == 1) {
if($session->tribe == 1 || ALLOW_ALL_TRIBE) {
if($id >= 19) {
foreach($this->buildArray as $build) {
if($build['field'] >= 19) {
$time = $build['timestamp'] + round($dataarray[$village->resarray['f'.$id]-1]['time'] / 4);
}
}
}
}
else {
$time = $this->buildArray[0]['timestamp'] + round($dataarray[$village->resarray['f'.$id]-1]['time'] / 4);
}
}
$level = $database->getResourceLevel($village->wid);
if($database->addBuilding($village->wid, $id, $village->resarray['f'.$id.'t'], $loop, $time, 0, 0, $level['f'.$id] + 1 + count($database->getBuildingByField($village->wid, $id)))){
$logging->addBuildLog($village->wid, self::procResType($village->resarray['f'.$id.'t']), ($village->resarray['f'.$id] - 1), 2);
header("Location: dorf2.php");
exit();
}
}
}
private function constructBuilding($id, $tid) {
global $database, $village, $session, $logging;
if($this->allocated < $this->maxConcurrent) {
if($tid == 16) $id = 39;
elseif($tid == 31 || $tid == 32 || $tid == 33) $id = 40;
$uprequire = $this->resourceRequired($id, $tid);
$time = time() + $uprequire['time'];
$bindicate = $this->canBuild($id, $tid);
$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)) {
$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, self::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: dorf2.php");
exit;
}
}else{
header("Location: dorf2.php");
exit;
}
}
/**
* Search through all user's villages if the castle is built or not
*
* @return boolean Returns true if the castle is already built in the whole account, otherwise returns false
*/
public function isCastleBuilt(){
global $database, $session;
$villages = $database->getProfileVillages($session->uid);
foreach ($villages as $vil){
if(in_array(26, $database->getResourceLevel($vil['wref']))) return true;
}
return false;
}
private function meetRequirement($id) {
global $village,$session,$database;
$isBuilt = $this->getTypeField($id);
switch ($id) {
case 1:
case 2:
case 3:
case 4: return true;
case 5: return $this->getTypeLevel(1) >= 10 && $this->getTypeLevel(15) >= 5 && !$isBuilt;
case 6: return $this->getTypeLevel(2) >= 10 && $this->getTypeLevel(15) >= 5 && !$isBuilt;
case 7: return $this->getTypeLevel(3) >= 10 && $this->getTypeLevel(15) >= 5 && !$isBuilt;
case 8: return $this->getTypeLevel(4) >= 5 && !$isBuilt;
case 9: return $this->getTypeLevel(15) >= 5 && $this->getTypeLevel(4) >= 10 && $this->getTypeLevel(8) >= 5 && !$isBuilt;
case 10:
case 11: return $this->getTypeLevel(15) >= 1 && (!$isBuilt || $this->getTypeLevel($id) == 20);
case 12: return $this->getTypeLevel(22) >= 3 && $this->getTypeLevel(15) >= 3 && !$isBuilt;
case 13: return $this->getTypeLevel(15) >= 3 && $this->getTypeLevel(22) >= 1 && !$isBuilt;
case 14: return $this->getTypeLevel(16) >= 15 && !$isBuilt;
case 15:
case 16: return !$isBuilt;
case 17: return $this->getTypeLevel(15) >= 3 && $this->getTypeLevel(10) >= 1 && $this->getTypeLevel(11) >= 1 && !$isBuilt;
case 18: return $this->getTypeLevel(15) >= 1 && !$isBuilt;
case 19: return $this->getTypeLevel(15) >= 3 && $this->getTypeLevel(16) >= 1 && !$isBuilt;
case 20: return $this->getTypeLevel(12) >= 3 && $this->getTypeLevel(22) >= 5 && !$isBuilt;
case 21: return $this->getTypeLevel(22) >= 10 && $this->getTypeLevel(15) >= 5 && !$isBuilt;
case 22: return $this->getTypeLevel(15) >= 3 && $this->getTypeLevel(19) >= 3 && !$isBuilt;
case 23: return !$isBuilt || $this->getTypeLevel($id) == 10;
case 24: return $this->getTypeLevel(22) >= 10 && $this->getTypeLevel(15) >= 10 && !$isBuilt;
case 25: return $this->getTypeLevel(15) >= 5 && !$isBuilt && !$this->getTypeField(26);
case 26: return $this->getTypeLevel(18) >= 1 && $this->getTypeLevel(15) >= 5 && !$isBuilt && !$this->isCastleBuilt() && !$this->getTypeField(25);
case 27: return $this->getTypeLevel(15) >= 10 && !$isBuilt;
case 28: return $this->getTypeLevel(17) == 20 && $this->getTypeLevel(20) >= 10 && !$isBuilt;
case 29: return $this->getTypeLevel(19) == 20 && $village->capital == 0 && !$isBuilt;
case 30: return $this->getTypeLevel(20) == 20 && $village->capital == 0 && !$isBuilt;
case 31: return $session->tribe == 1;
case 32: return $session->tribe == 2;
case 33: return $session->tribe == 3;
case 34: return $this->getTypeLevel(26) >= 3 && $this->getTypeLevel(15) >= 5 && $this->getTypeLevel(25) == 0 && $village->capital != 0 && !$isBuilt;
case 35: return $this->getTypeLevel(16) >= 10 && $this->getTypeLevel(11) == 20 && $session->tribe == 2 && $village->capital != 0 && !$isBuilt;
case 36: return $this->getTypeLevel(16) >= 1 && $session->tribe == 3 && (!$isBuilt || $this->getTypeLevel($id) == 20);
case 37: return $this->getTypeLevel(15) >= 3 && $this->getTypeLevel(16) >= 1 && !$isBuilt;
// great warehouse can only be built with artefact or in Natar villages
case 38: return $this->getTypeLevel(15) >= 10 && (!$isBuilt || $this->getTypeLevel($id) == 20) && ($village->natar == 1 || count($database->getOwnUniqueArtefactInfo2($village->wid, 6, 1, 0)) || count($database->getOwnUniqueArtefactInfo2($session->uid, 6, 2, 0)));
// great granary can only be built with artefact or in Natar villages
case 39: return $this->getTypeLevel(15) >= 10 && (!$isBuilt || $this->getTypeLevel($id) == 20) && ($village->natar == 1 || count($database->getOwnUniqueArtefactInfo2($village->wid, 6, 1, 0)) || count($database->getOwnUniqueArtefactInfo2($session->uid, 6, 2, 0)));
case 40: return $this->allowWwUpgrade();
case 41: return $this->getTypeLevel(16) >= 10 && $this->getTypeLevel(20) == 20 && $session->tribe == 1 && !$isBuilt;
case 42: return GREAT_WKS && $this->getTypeLevel(21) == 20 && $village->capital == 0 && !$isBuilt;
default: return false;
}
}
private function checkResource($tid, $id) {
$name = "bid".$tid;
global $village,$$name,$database;
$plus = 1;
foreach($this->buildArray as $job) {
if($job['type'] == $tid && $job['field'] == $id) {
$plus = 2;
break;
}
}
$dataarray = $$name;
$wood = $dataarray[$village->resarray['f'.$id] + $plus]['wood'];
$clay = $dataarray[$village->resarray['f'.$id] + $plus]['clay'];
$iron = $dataarray[$village->resarray['f'.$id] + $plus]['iron'];
$crop = $dataarray[$village->resarray['f'.$id] + $plus]['crop'];
if($wood > $village->maxstore || $clay > $village->maxstore || $iron > $village->maxstore) return 1;
else
{
if($crop > $village->maxcrop) return 2;
else
{
if($wood > $village->awood || $clay > $village->aclay || $iron > $village->airon || $crop > $village->acrop) {
return 3;
}
else {
if($village->awood >= $wood && $village->aclay >= $clay && $village->airon >= $iron && $village->acrop >= $crop){
return 4;
}
else return 3;
}
}
}
}
public function isMax($id, $field, $loop = 0) {
$name = "bid".$id;
global $$name,$village,$session;
$dataarray = $$name;
// special case for Multihunter login which mathematically (because of the resarray length)
// allows for building resource fields above level 20
if ($session->tribe == 0) return $village->resarray['f'.$field] == 20;
if($id <= 4) {
if($village->capital == 1) return ($village->resarray['f'.$field] == (count($dataarray) - 1 - $loop));
else return ($village->resarray['f'.$field] == (count($dataarray) - 11 - $loop));
}
else return ($village->resarray['f'.$field] == count($dataarray) - $loop);
}
public function getTypeLevel($tid, $vid = 0) {
global $village, $database, $session;
// Support would not have a village, so this is irrelevant
if ($session->uid == 1) return 0;
$keyholder = [];
if($vid == 0) $resourcearray = $village->resarray;
else $resourcearray = $database->getResourceLevel($vid);
foreach(array_keys($resourcearray, $tid) as $key) {
if(strpos($key,'t')) {
$key = preg_replace("/[^0-9]/", '', $key);
array_push($keyholder, $key);
}
}
$element = count($keyholder);
// if we count more than 1 instance of the building (mostly resource fields)
if($element >= 2){
// resource field
if($tid <= 4){
$temparray = [];
for($i = 0; $i <= $element - 1; $i++){
// collect current field level
array_push($temparray, $resourcearray['f'.$keyholder[$i]]);
}
// find out the maximum field level for this village
$maValue = max($temparray);
foreach($temparray as $key => $val){
if($val == $maValue){
$target = $key;
}
}
}else{ // village building
$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]]){
$target = $i;
}
}
}
}
// if we count only a single building
else if($element == 1) $target = 0;
else return 0; // no building matching search criteria
if(!empty($keyholder[$target])) return $resourcearray['f'.$keyholder[$target]];
else return 0;
}
public function isCurrent($id) {
foreach($this->buildArray as $build) {
if($build['field'] == $id && $build['loopcon'] <> 1) {
return true;
}
}
}
public function isLoop($id=0) {
foreach($this->buildArray as $build) {
if(($build['field'] == $id && $build['loopcon']) || ($build['loopcon'] == 1 && $id == 0)) {
return true;
}
}
return false;
}
public function finishAll($redirect_url = '') {
global $database, $session, $logging, $village, $bid18, $bid10, $bid11, $technology, $_SESSION;
// will be true if we should decrease player's gold by 2
// for the immediate completion action
$countPlus2Gold = false;
// will be true if we should decrease player's gold by 1
// for master builder queue
$countMasterGold = false;
// number of jobs to finish
$buildcount = ($this->buildArray ? count($this->buildArray) : 0);
// will be true if the job was successfully finished
$jobFinishSuccess = false;
// IDs of successful jobs to delete
$deletIDs = [];
foreach ($this->buildArray as $jobs) {
if ($jobs['wid'] == $village->wid) {
$wwvillage = $database->getResourceLevel($jobs['wid']);
if ($wwvillage['f99t'] != 40) {
$level = $jobs['level'];
if ($jobs['type'] != 25 && $jobs['type'] != 26 && $jobs['type'] != 40) {
$resource = $this->resourceRequired($jobs['field'],$jobs['type']);
// master builder involved
if ($jobs['master'] != 0) {
if ($this->meetRequirement($jobs['field'])) {
// don't allow master builder to build anything
// if we only have 2 gold, since that would take us to -1 gold
if ( $session->gold > 2 ) {
$villwood = $database->getVillageField( $jobs['wid'], 'wood' );
$villclay = $database->getVillageField( $jobs['wid'], 'clay' );
$villiron = $database->getVillageField( $jobs['wid'], 'iron' );
$villcrop = $database->getVillageField( $jobs['wid'], 'crop' );
$type = $jobs['type'];
$buildarray = $GLOBALS[ "bid" . $type ];
$buildwood = $buildarray[ $level ]['wood'];
$buildclay = $buildarray[ $level ]['clay'];
$buildiron = $buildarray[ $level ]['iron'];
$buildcrop = $buildarray[ $level ]['crop'];
if ( $buildwood < $villwood && $buildclay < $villclay && $buildiron < $villiron && $buildcrop < $villcrop ) {
$jobFinishSuccess = true;
$countMasterGold = true;
$enought_res = 1;
// we need to subtract resources for this, if another 2 jobs are active,
// as we'd never subtract those otherwise
if ( $buildcount > 2 ) {
$database->setVillageField( $jobs['wid'],
['wood', 'clay', 'iron', 'crop'],
[( $villwood - $buildwood ), ( $villclay - $buildclay ), ( $villiron - $buildiron ), ( $villcrop - $buildcrop )]);
}
}
} else {
// if we only have 2 gold, we need to cancel this job, as there will never
// be enough gold now in our account to finish this up
$exclude_master = true;
$deletIDs[] = (int) $jobs['id'];
}
}
} else {
// non-master builder build, we should count +2 gold for it
$countPlus2Gold = true;
$jobFinishSuccess = true;
}
// update build level in the database
if ($jobFinishSuccess) {
$q = "UPDATE ".TB_PREFIX."fdata set f".$jobs['field']." = ".$jobs['level'].", f".$jobs['field']."t = ".$jobs['type']." where vref = ".$jobs['wid'];
}
if (!isset($exclude_master) && $database->query($q) && ($enought_res == 1 || $jobs['master'] == 0)) {
$database->modifyPop($jobs['wid'],$resource['pop'],0);
$database->addCP($jobs['wid'],$resource['cp']);
$deletIDs[] = (int) $jobs['id'];
if($jobs['type'] == 18) {
$owner = $database->getVillageField($jobs['wid'],"owner");
$max = $bid18[$level]['attri'];
$q = "UPDATE ".TB_PREFIX."alidata set max = $max where leader = $owner";
$database->query($q);
}
}
if (($jobs['field'] >= 19 && ($session->tribe == 1 || ALLOW_ALL_TRIBE)) || (!ALLOW_ALL_TRIBE && $session->tribe != 1)) {
$innertimestamp = $jobs['timestamp'];
}
}
}
}
// reset the flag for the next job
$jobFinishSuccess = false;
}
if (count($deletIDs)) {
$database->query("DELETE FROM " . TB_PREFIX . "bdata WHERE id IN(" . implode(', ', $deletIDs) . ")");
}
$demolition = $database->finishDemolition($village->wid);
$tech = $technology->finishTech();
if ($demolition > 0 || $tech > 0) {
$countPlus2Gold = true;
$logging->goldFinLog($village->wid);
}
// deduct the right amount of gold
if ($countMasterGold || $countPlus2Gold) {
$newgold = $session->gold - (($countMasterGold && $countPlus2Gold) ? 3 : 2);
$database->updateUserField($session->uid, "gold", $newgold, 1);
}
$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'];
$q = "UPDATE ".TB_PREFIX."bdata SET loopcon=0 WHERE id=".(int) $stillbuildingarray[0]['id'];
$database->query($q);
}
}
header("Location: ".($redirect_url ? $redirect_url : $session->referrer));
exit;
}
public function resourceRequired($id, $tid, $plus = 1) {
$name = "bid".$tid;
global $$name, $village, $bid15, $database;
$dataarray = $$name;
$wood = $dataarray[$village->resarray['f'.$id] + $plus]['wood'];
$clay = $dataarray[$village->resarray['f'.$id] + $plus]['clay'];
$iron = $dataarray[$village->resarray['f'.$id] + $plus]['iron'];
$crop = $dataarray[$village->resarray['f'.$id] + $plus]['crop'];
$pop = $dataarray[$village->resarray['f'.$id] + $plus]['pop'];
$time = $database->getBuildingTime($id, $tid, $plus, $village->wid, $village->resarray);
$cp = $dataarray[$village->resarray['f'.$id] + $plus]['cp'];
return ["wood" => $wood, "clay" => $clay, "iron" => $iron, "crop" => $crop, "pop" => $pop, "time" => $time, "cp" => $cp];
}
public function getTypeField($type) {
global $village;
for($i = 19; $i <= 40; $i++) {
if($village->resarray['f'.$i.'t'] == $type) return $i;
}
}
public function calculateAvaliable($id, $tid, $plus = 1) {
global $village, $generator;
$uprequire = $this->resourceRequired($id, $tid, $plus);
$rwood = $uprequire['wood'] - $village->awood;
$rclay = $uprequire['clay'] - $village->aclay;
$rcrop = $uprequire['crop'] - $village->acrop;
$riron = $uprequire['iron'] - $village->airon;
$rwtime = $rwood / $village->getProd("wood") * 3600;
$rcltime = $rclay / $village->getProd("clay") * 3600;
$rctime = $rcrop / $village->getProd("crop") * 3600;
$ritime = $riron / $village->getProd("iron") * 3600;
$reqtime = max($rwtime, $rctime, $rcltime, $ritime);
$reqtime += time();
return $generator->procMtime($reqtime);
}
};
?>
-387
View File
@@ -1,387 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename Chat.php ##
## Developed by: TTMMTT ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ##
#################################################################################
if (!isset($SAJAX_INCLUDED)) {
$GLOBALS['sajax_version'] = '0.12';
$GLOBALS['sajax_debug_mode'] = 0;
$GLOBALS['sajax_export_list'] = array();
$GLOBALS['sajax_request_type'] = 'GET';
$GLOBALS['sajax_remote_uri'] = '';
$GLOBALS['sajax_failure_redirect'] = '';
function sajax_init() {
}
function sajax_get_my_uri() {
return $_SERVER["REQUEST_URI"];
}
$sajax_remote_uri = sajax_get_my_uri();
function sajax_get_js_repr($value) {
$type = gettype($value);
if ($type == "boolean") {
return ($value) ? "Boolean(true)" : "Boolean(false)";
}
elseif ($type == "integer") {
return "parseInt($value)";
}
elseif ($type == "double") {
return "parseFloat($value)";
}
elseif ($type == "array" || $type == "object" ) {
$s = "{ ";
if ($type == "object") {
$value = get_object_vars($value);
}
foreach ($value as $k=>$v) {
$esc_key = sajax_esc($k);
if (is_numeric($k))
$s .= "$k: " . sajax_get_js_repr($v) . ", ";
else
$s .= "\"$esc_key\": " . sajax_get_js_repr($v) . ", ";
}
if (count($value))
$s = substr($s, 0, -2);
return $s . " }";
}
else {
$esc_val = sajax_esc($value);
$s = "'$esc_val'";
return $s;
}
}
function sajax_handle_client_request() {
global $sajax_export_list;
$mode = "";
if (! empty($_GET["rs"]))
$mode = "get";
if (!empty($_POST["rs"]))
$mode = "post";
if (empty($mode))
return;
$target = "";
if ($mode == "get") {
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");
$func_name = $_GET["rs"];
if (! empty($_GET["rsargs"]))
$args = $_GET["rsargs"];
else
$args = array();
}
else {
$func_name = $_POST["rs"];
if (! empty($_POST["rsargs"]))
$args = $_POST["rsargs"];
else
$args = array();
}
if (! in_array($func_name, $sajax_export_list))
echo "-:$func_name not callable";
else {
echo "+:";
$result = call_user_func_array($func_name, $args);
echo "var res = " . trim(sajax_get_js_repr($result)) . "; res;";
}
exit;
}
function sajax_get_common_js() {
global $sajax_debug_mode;
global $sajax_request_type;
global $sajax_remote_uri;
global $sajax_failure_redirect;
$t = strtoupper($sajax_request_type);
if ($t != "" && $t != "GET" && $t != "POST")
return "// Invalid type: $t.. \n\n";
ob_start();
?>
// remote scripting library
// (c) copyright 2005 modernmethod, inc
// edited by ttmtt
var sajax_debug_mode = <?php echo $sajax_debug_mode ? "true" : "false"; ?>;
var sajax_request_type = "<?php echo $t; ?>";
var sajax_target_id = "";
var sajax_failure_redirect = "<?php echo $sajax_failure_redirect; ?>";
function sajax_debug(text) {
if (sajax_debug_mode)
alert(text);
}
function sajax_init_object() {
sajax_debug("sajax_init_object() called..")
var A;
var msxmlhttp = new Array(
'Msxml2.XMLHTTP.5.0',
'Msxml2.XMLHTTP.4.0',
'Msxml2.XMLHTTP.3.0',
'Msxml2.XMLHTTP',
'Microsoft.XMLHTTP');
for (var i = 0; i < msxmlhttp.length; i++) {
try {
A = new ActiveXObject(msxmlhttp[i]);
} catch (e) {
A = null;
}
}
if(!A && typeof XMLHttpRequest != "undefined")
A = new XMLHttpRequest();
if (!A)
sajax_debug("Could not create connection object.");
return A;
}
var sajax_requests = new Array();
function sajax_cancel() {
for (var i = 0; i < sajax_requests.length; i++)
sajax_requests[i].abort();
}
function sajax_do_call(func_name, args) {
var i, x, n;
var uri;
var post_data;
var target_id;
sajax_debug("in sajax_do_call().." + sajax_request_type + "/" + sajax_target_id);
target_id = sajax_target_id;
if (typeof(sajax_request_type) == "undefined" || sajax_request_type == "")
sajax_request_type = "GET";
uri = "<?php echo $sajax_remote_uri; ?>";
if (sajax_request_type == "GET") {
// alert(args);
if (uri.indexOf("?") == -1)
uri += "?rs=" + escape(func_name);
else
uri += "&rs=" + escape(func_name);
uri += "&rst=" + escape(sajax_target_id);
uri += "&rsrnd=" + new Date().getTime();
for (i = 0; i < args.length-1; i++) {
uri += "&rsargs[]=" + args[i];
}
post_data = null;
}
else if (sajax_request_type == "POST") {
post_data = "rs=" + escape(func_name);
post_data += "&rst=" + escape(sajax_target_id);
post_data += "&rsrnd=" + new Date().getTime();
for (i = 0; i < args.length-1; i++)
post_data = post_data + "&rsargs[]=" + escape(args[i]);
}
else {
alert("Illegal request type: " + sajax_request_type);
}
x = sajax_init_object();
if (x == null) {
if (sajax_failure_redirect != "") {
location.href = sajax_failure_redirect;
return false;
} else {
sajax_debug("NULL sajax object for user agent:\n" + navigator.userAgent);
return false;
}
} else {
x.open(sajax_request_type, uri, true);
// window.open(uri);
sajax_requests[sajax_requests.length] = x;
if (sajax_request_type == "POST") {
x.setRequestHeader("Method", "POST " + uri + " HTTP/1.1");
x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
}
x.onreadystatechange = function() {
if (x.readyState != 4)
return;
sajax_debug("received " + x.responseText);
var status;
var data;
var txt = x.responseText.replace(/^\s*|\s*$/g,"");
status = txt.charAt(0);
data = txt.substring(2);
if (status == "") {
// let's just assume this is a pre-response bailout and let it slide for now
} else if (status == "-")
alert("Error: " + data);
else {
if (target_id != "")
document.getElementById(target_id).innerHTML = eval(data);
else {
try {
var callback;
var extra_data = false;
if (typeof args[args.length-1] == "object") {
callback = args[args.length-1].callback;
extra_data = args[args.length-1].extra_data;
} else {
callback = args[args.length-1];
}
callback(eval(data), extra_data);
} catch (e) {
sajax_debug("Caught error " + e + ": Could not eval " + data );
}
}
}
}
}
sajax_debug(func_name + " uri = " + uri + "/post = " + post_data);
x.send(post_data);
sajax_debug(func_name + " waiting..");
delete x;
return true;
}
<?php
$html = ob_get_contents();
ob_end_clean();
return $html;
}
function sajax_show_common_js() {
echo sajax_get_common_js();
}
// javascript escape a value
function sajax_esc($val)
{
$val = str_replace("\\", "\\\\", $val);
$val = str_replace("\r", "\\r", $val);
$val = str_replace("\n", "\\n", $val);
$val = str_replace("'", "\\'", $val);
return str_replace('"', '\\"', $val);
}
function sajax_get_one_stub($func_name) {
ob_start();
?>
// wrapper for <?php echo $func_name; ?>
function x_<?php echo $func_name; ?>() {
sajax_do_call("<?php echo $func_name; ?>",
x_<?php echo $func_name; ?>.arguments);
}
<?php
$html = ob_get_contents();
ob_end_clean();
return $html;
}
function sajax_show_one_stub($func_name) {
echo sajax_get_one_stub($func_name);
}
function sajax_export() {
global $sajax_export_list;
$n = func_num_args();
for ($i = 0; $i < $n; $i++) {
$sajax_export_list[] = func_get_arg($i);
}
}
$sajax_js_has_been_shown = 0;
function sajax_get_javascript()
{
global $sajax_js_has_been_shown;
global $sajax_export_list;
$html = "";
if (! $sajax_js_has_been_shown) {
$html .= sajax_get_common_js();
$sajax_js_has_been_shown = 1;
}
foreach ($sajax_export_list as $func) {
$html .= sajax_get_one_stub($func);
}
return $html;
}
function sajax_show_javascript()
{
echo sajax_get_javascript();
}
$SAJAX_INCLUDED = 1;
}
function add_data($data) {
global $session,$database;
//$data = explode("|",$data);
if (is_array($data)){$msg = htmlspecialchars($data[1]);}else{$msg = htmlspecialchars($data);};
$msg = $database->escape($msg);
// $msg=htmlspecialchars($msg);
$name = addslashes($session->username);
if ($msg != ""){
$id_user = (int) $session->uid;
$alliance = $database->escape($session->alliance);
$now = time();
echo $q = "INSERT into ".TB_PREFIX."chat (id_user,name,alli,date,msg) values ($id_user,'$name','$alliance','$now','$msg')";
mysqli_query($database->dblink,$q);
}
}
function get_data() {
global $session,$database;
$alliance = $database->escape($session->alliance);
$query = mysqli_query($database->dblink,"select id_user, name, date, msg from ".TB_PREFIX."chat where alli='$alliance' order by id desc limit 0,13");
while ($r = mysqli_fetch_array($query)) {
$dates = date("g:i",$r['date']);
$data .= "[{$dates}] <a href='spieler.php?uid={$r['id_user']}'>{$r['name']}</a>: {$r['msg']} <br>";
}
return $data;
}
$sajax_request_type = "GET";
sajax_init();
sajax_export("add_data","get_data");
sajax_handle_client_request();
?>
File diff suppressed because one or more lines are too long
-49
View File
@@ -1,49 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename cel.php ##
## Developed by: G3n3s!s & JimJam & LoppyLukas ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ##
#################################################################################
$cel=array(1=>array('name'=>'Small Celebration','wood'=>6400,'clay'=>6650,'iron'=>5940,'crop'=>1340,'attri'=>500,'time'=>86400),array('name'=>'Great Celebration','wood'=>29700,'clay'=>33250,'iron'=>32000,'crop'=>6700,'attri'=>2000,'time'=>216000));
$sc = array(
1 => 86400,
2 => 83290,
3 => 80291,
4 => 77401,
5 => 74614,
6 => 71928,
7 => 69338,
8 => 66843,
9 => 64436,
10 => 62117,
11 => 59880,
12 => 57725,
13 => 55647,
14 => 53643,
15 => 51712,
16 => 49850,
17 => 48056,
18 => 46326,
19 => 44658,
20 => 43050);
$gc= array(
10 => 155291,
11 => 149701,
12 => 144312,
13 => 139116,
14 => 134108,
15 => 129280,
16 => 124626,
17 => 120140,
18 => 115815,
19 => 111645,
20 => 107626);
?>
-267
View File
@@ -1,267 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename cp.php ##
## Developed by: G3n3s!s & JimJam & LoppyLukas ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ##
#################################################################################
$cp0 = array(
1 => 0,
2 => 500,
3 => 2600,
4 => 6700,
5 => 12900,
6 => 21600,
7 => 32900,
8 => 46000,
9 => 63000,
10 => 83500,
11 => 106400,
12 => 132500,
13 => 161900,
14 => 194600,
15 => 230700,
16 => 270400,
17 => 313700,
18 => 360600,
19 => 411300,
20 => 465700,
21 => 524000,
22 => 586300,
23 => 652500,
24 => 722700,
25 => 797000,
26 => 875500,
27 => 958200,
28 => 1045000,
29 => 1136200,
30 => 1231700,
31 => 1316000,
32 => 1435900,
33 => 1435900,
34 => 1658000,
35 => 1775800,
36 => 1898300,
37 => 2025300,
38 => 2157100,
39 => 2293500,
40 => 2434700,
41 => 2580700,
42 => 2731500,
43 => 2887200,
44 => 3047700,
45 => 3213200,
46 => 3383700,
47 => 3559100,
48 => 3739600,
49 => 3925100,
50 => 4115800,
51 => 4311500,
52 => 4512400,
53 => 4718500,
54 => 4929800,
55 => 5146400,
56 => 5368300,
57 => 5595400,
58 => 5827900,
59 => 6065700,
60 => 6309000,
61 => 6557600,
62 => 6811700,
63 => 7071300,
64 => 7336400,
65 => 7607000,
66 => 7883100,
67 => 8164900,
68 => 8452200,
69 => 8745200,
70 => 9043800,
71 => 9348100,
72 => 9659100,
73 => 9973900,
74 => 10295400,
75 => 10622600,
76 => 10955700,
77 => 11294600,
78 => 11639300,
79 => 11989900,
80 => 12346400,
81 => 12708800,
82 => 13077200,
83 => 13451500,
84 => 13831800,
85 => 14218100,
86 => 14610400,
87 => 15008800,
88 => 15413200,
89 => 15823700,
90 => 16240400,
91 => 16663100,
92 => 17092000,
93 => 17527100,
94 => 17968400,
95 => 18415900,
96 => 18869600,
97 => 19329600,
98 => 19795800,
99 => 20268400,
100 => 20747200,
101 => 21232400,
102 => 21723900,
103 => 22221800,
104 => 22726100,
105 => 23236800,
106 => 23753900,
107 => 24277400,
108 => 24807400,
109 => 25343900,
110 => 25886900,
111 => 26436400,
112 => 26992400,
113 => 27555000,
114 => 28124100,
115 => 28699900,
116 => 29282200,
117 => 29871200,
118 => 30466800,
119 => 31069000,
120 => 31677900,
121 => 32293500,
122 => 32915900,
123 => 33544900,
124 => 34180700,
125 => 34823200);
$cp1= array(
1 => 0,
2 => 2000,
3 => 8000,
4 => 20000,
5 => 39000,
6 => 65000,
7 => 99000,
8 => 141000,
9 => 191000,
10 => 251000,
11 => 319000,
12 => 397000,
13 => 486000,
14 => 584000,
15 => 692000,
16 => 811000,
17 => 941000,
18 => 1082000,
19 => 1234000,
20 => 1397000,
21 => 1572000,
22 => 1759000,
23 => 1957000,
24 => 2168000,
25 => 2391000,
26 => 2627000,
27 => 2874000,
28 => 3135000,
29 => 3409000,
30 => 3695000,
31 => 3995000,
32 => 4308000,
33 => 4634000,
34 => 4974000,
35 => 5327000,
36 => 5695000,
37 => 6076000,
38 => 6471000,
39 => 6881000,
40 => 7304000,
41 => 7742000,
42 => 8195000,
43 => 8662000,
44 => 9143000,
45 => 9640000,
46 => 10151000,
47 => 10677000,
48 => 11219000,
49 => 11775000,
50 => 12347000,
51 => 12935000,
52 => 13537000,
53 => 14156000,
54 => 14790000,
55 => 15439000,
56 => 16105000,
57 => 16786000,
58 => 17484000,
59 => 18197000,
60 => 18927000,
61 => 19673000,
62 => 20435000,
63 => 21214000,
64 => 22009000,
65 => 22821000,
66 => 23649000,
67 => 24495000,
68 => 25357000,
69 => 26236000,
70 => 27131000,
71 => 28044000,
72 => 28974000,
73 => 29922000,
74 => 30886000,
75 => 31868000,
76 => 32867000,
77 => 33884000,
78 => 34918000,
79 => 35970000,
80 => 37039000,
81 => 38127000,
82 => 39232000,
83 => 40354000,
84 => 41495000,
85 => 42654000,
86 => 43831000,
87 => 45026000,
88 => 46240000,
89 => 47471000,
90 => 48721000,
91 => 49989000,
92 => 51276000,
93 => 52581000,
94 => 53905000,
95 => 55248000,
96 => 56609000,
97 => 57989000,
98 => 59387000,
99 => 60805000,
100 => 62242000,
101 => 63697000,
102 => 65172000,
103 => 66665000,
104 => 68178000,
105 => 69710000,
106 => 71262000,
107 => 72832000,
108 => 74422000,
109 => 76032000,
110 => 77661000,
111 => 79309000,
112 => 80977000,
113 => 82665000,
114 => 84372000,
115 => 86000000,
116 => 87847000,
117 => 89613000,
118 => 91400000,
119 => 93207000,
120 => 95034000,
121 => 96881000,
122 => 98748000,
123 => 100635000,
124 => 102542000,
125 => 104470000);
?>
-181
View File
@@ -1,181 +0,0 @@
<?php
$hero_levels = array(0 => 0, 100, 300, 600, 1000, 1500, 2100, 2800, 3600, 4500, 5500, 6600, 7800, 9100, 10500, 12000, 13600, 15300, 17100, 19000, 21000, 23100, 25300, 27600, 30000, 32500, 35100, 37800, 40600, 43500, 46500, 49600, 52800, 56100, 59500, 63000, 66600, 70300, 74100, 78000, 82000, 86100, 90300, 94600, 99000, 103500, 108100, 112800, 117600, 122500, 127500, 132600, 137800, 143100, 148500, 154000, 159600, 165300, 171100, 177000, 183000, 189100, 195300, 201600, 208000, 214500, 221100, 227800,
234600, 241500, 248500, 255600, 262800, 270100, 277500, 285000, 292600, 300300, 308100, 316000, 324000, 332100, 340300, 348600, 357000, 365500, 374100, 382800, 391600, 400500, 409500, 418600, 427800, 437100, 446500, 456000, 465600, 475300, 485100, 495000);
//ROMAN UNITS
$h1_full = array(array('wood' => 240, 'clay' => 200, 'iron' => 300, 'crop' => 60, 'time' => 3200), array('wood' => 640, 'clay' => 550, 'iron' => 780, 'crop' => 210, 'time' => 6400), array('wood' => 1100, 'clay' => 910, 'iron' => 1300, 'crop' => 360, 'time' => 9600), array('wood' => 1500, 'clay' => 1300, 'iron' => 1900, 'crop' => 510, 'time' => 12800), array('wood' => 2000, 'clay' => 1700, 'iron' => 2500, 'crop' => 670, 'time' => 16000), array('wood' => 2500, 'clay' => 2200, 'iron' => 3100, 'crop' => 850, 'time' =>
19200), array('wood' => 3100, 'clay' => 2600, 'iron' => 3800, 'crop' => 1000, 'time' => 22400), array('wood' => 3600, 'clay' => 3100, 'iron' => 4400, 'crop' => 1200, 'time' => 25580), array('wood' => 4200, 'clay' => 3600, 'iron' => 5100, 'crop' => 1400, 'time' => 28800), array('wood' => 4800, 'clay' => 4100, 'iron' => 5900, 'crop' => 1600, 'time' => 32000), array('wood' => 5400, 'clay' => 4600, 'iron' => 6600, 'crop' => 1800, 'time' => 35200), array('wood' => 6000, 'clay' => 5100, 'iron' => 7400, 'crop' => 2000,
'time' => 38400), array('wood' => 6700, 'clay' => 5700, 'iron' => 8100, 'crop' => 2200, 'time' => 41600), array('wood' => 7300, 'clay' => 6200, 'iron' => 8900, 'crop' => 2400, 'time' => 44800), array('wood' => 8000, 'clay' => 6800, 'iron' => 9700, 'crop' => 2700, 'time' => 48000), array('wood' => 8600, 'clay' => 7400, 'iron' => 10500, 'crop' => 2900, 'time' => 51200), array('wood' => 9300, 'clay' => 7900, 'iron' => 11500, 'crop' => 3100, 'time' => 54400), array('wood' => 10000, 'clay' => 8500, 'iron' => 12000,
'crop' => 3300, 'time' => 57600), array('wood' => 10500, 'clay' => 9100, 'iron' => 13000, 'crop' => 3600, 'time' => 60800), array('wood' => 11500, 'clay' => 9700, 'iron' => 14000, 'crop' => 3800, 'time' => 64000), array('wood' => 12000, 'clay' => 10500, 'iron' => 15000, 'crop' => 4000, 'time' => 67200), array('wood' => 13000, 'clay' => 11000, 'iron' => 15500, 'crop' => 4300, 'time' => 70400), array('wood' => 13500, 'clay' => 11500, 'iron' => 16500, 'crop' => 4500, 'time' => 73600), array('wood' => 14500, 'clay' =>
12000, 'iron' => 17500, 'crop' => 4800, 'time' => 76800), array('wood' => 15000, 'clay' => 13000, 'iron' => 18500, 'crop' => 5000, 'time' => 80000), array('wood' => 16000, 'clay' => 13500, 'iron' => 19500, 'crop' => 5300, 'time' => 83200), array('wood' => 16500, 'clay' => 14000, 'iron' => 20500, 'crop' => 5500, 'time' => 86400), array('wood' => 17500, 'clay' => 15000, 'iron' => 21500, 'crop' => 5800, 'time' => 89600), array('wood' => 18000, 'clay' => 15500, 'iron' => 22000, 'crop' => 6100, 'time' => 92800),
array('wood' => 19000, 'clay' => 16000, 'iron' => 23000, 'crop' => 6300, 'time' => 96000), array('wood' => 19500, 'clay' => 17000, 'iron' => 24000, 'crop' => 6600, 'time' => 99200), array('wood' => 20500, 'clay' => 17500, 'iron' => 25000, 'crop' => 6800, 'time' => 102400), array('wood' => 21500, 'clay' => 18000, 'iron' => 26000, 'crop' => 7100, 'time' => 105600), array('wood' => 22000, 'clay' => 19000, 'iron' => 27000, 'crop' => 7400, 'time' => 108800), array('wood' => 23000, 'clay' => 19500, 'iron' => 28000, 'crop' =>
7700, 'time' => 112000), array('wood' => 24000, 'clay' => 20500, 'iron' => 29000, 'crop' => 7900, 'time' => 115200), array('wood' => 24500, 'clay' => 21000, 'iron' => 30000, 'crop' => 8200, 'time' => 118400), array('wood' => 25500, 'clay' => 21500, 'iron' => 31000, 'crop' => 8500, 'time' => 121600), array('wood' => 26500, 'clay' => 22500, 'iron' => 32000, 'crop' => 8800, 'time' => 124800), array('wood' => 27000, 'clay' => 23000, 'iron' => 33000, 'crop' => 9100, 'time' => 128000), array('wood' => 28000, 'clay' => 24000,
'iron' => 34000, 'crop' => 9300, 'time' => 131200), array('wood' => 29000, 'clay' => 24500, 'iron' => 35500, 'crop' => 9600, 'time' => 134400), array('wood' => 29500, 'clay' => 25500, 'iron' => 36500, 'crop' => 9900, 'time' => 137600), array('wood' => 30500, 'clay' => 26000, 'iron' => 37500, 'crop' => 10000, 'time' => 140800), array('wood' => 31500, 'clay' => 27000, 'iron' => 38500, 'crop' => 10500, 'time' => 144000), array('wood' => 32500, 'clay' => 27500, 'iron' => 39500, 'crop' => 11000, 'time' => 147200),
array('wood' => 34000, 'clay' => 28500, 'iron' => 40500, 'crop' => 11000, 'time' => 150400), array('wood' => 34000, 'clay' => 29000, 'iron' => 41500, 'crop' => 11500, 'time' => 153600), array('wood' => 35000, 'clay' => 30000, 'iron' => 43000, 'crop' => 11500, 'time' => 156800), array('wood' => 36000, 'clay' => 30500, 'iron' => 44000, 'crop' => 12000, 'time' => 160000), array('wood' => 37000, 'clay' => 31500, 'iron' => 45000, 'crop' => 12500, 'time' => 163200), array('wood' => 37500, 'clay' => 32000, 'iron' => 46000,
'crop' => 12500, 'time' => 166400), array('wood' => 38500, 'clay' => 33000, 'iron' => 47000, 'crop' => 13000, 'time' => 169600), array('wood' => 39500, 'clay' => 33500, 'iron' => 48500, 'crop' => 13000, 'time' => 172800), array('wood' => 40500, 'clay' => 34500, 'iron' => 49500, 'crop' => 13500, 'time' => 176000), array('wood' => 41500, 'clay' => 35000, 'iron' => 50500, 'crop' => 14000, 'time' => 179200), array('wood' => 42500, 'clay' => 36000, 'iron' => 51500, 'crop' => 14000, 'time' => 182400), array('wood' => 43000,
'clay' => 37000, 'iron' => 53000, 'crop' => 14500, 'time' => 185600), array('wood' => 44000, 'clay' => 37500, 'iron' => 54000, 'crop' => 14500, 'time' => 188800), array('wood' => 45000, 'clay' => 38500, 'iron' => 55000, 'crop' => 15000, 'time' => 192000), array('wood' => 46000, 'clay' => 39000, 'iron' => 56500, 'crop' => 15500, 'time' => 195200));
$h2_full = array(array('wood' => 200, 'clay' => 260, 'iron' => 320, 'crop' => 140, 'time' => 3520), array('wood' => 550, 'clay' => 690, 'iron' => 830, 'crop' => 400, 'time' => 7040), array('wood' => 910, 'clay' => 1100, 'iron' => 1400, 'crop' => 670, 'time' => 10560), array('wood' => 1300, 'clay' => 1600, 'iron' => 2000, 'crop' => 960, 'time' => 14080), array('wood' => 1700, 'clay' => 2200, 'iron' => 2600, 'crop' => 1300, 'time' => 17600), array('wood' => 2200, 'clay' => 2700, 'iron' => 3300, 'crop' => 1600, 'time' =>
21120), array('wood' => 2600, 'clay' => 3300, 'iron' => 4000, 'crop' => 1900, 'time' => 24640), array('wood' => 3100, 'clay' => 3900, 'iron' => 4700, 'crop' => 2300, 'time' => 28160), array('wood' => 3600, 'clay' => 4500, 'iron' => 5500, 'crop' => 2700, 'time' => 31680), array('wood' => 4100, 'clay' => 5200, 'iron' => 6200, 'crop' => 3000, 'time' => 35200), array('wood' => 4600, 'clay' => 5800, 'iron' => 7000, 'crop' => 3400, 'time' => 38720), array('wood' => 5100, 'clay' => 6500, 'iron' => 7800, 'crop' => 3800, 'time' =>
42240), array('wood' => 5700, 'clay' => 7200, 'iron' => 8600, 'crop' => 4200, 'time' => 45760), array('wood' => 6200, 'clay' => 7900, 'iron' => 9500, 'crop' => 4600, 'time' => 49280), array('wood' => 6800, 'clay' => 8600, 'iron' => 10500, 'crop' => 5000, 'time' => 52800), array('wood' => 7400, 'clay' => 9300, 'iron' => 11000, 'crop' => 5400, 'time' => 56320), array('wood' => 7900, 'clay' => 10000, 'iron' => 12000, 'crop' => 5900, 'time' => 59840), array('wood' => 8500, 'clay' => 11000, 'iron' => 13000, 'crop' => 6300,
'time' => 63360), array('wood' => 9100, 'clay' => 11500, 'iron' => 14000, 'crop' => 6700, 'time' => 66880), array('wood' => 9700, 'clay' => 12500, 'iron' => 15000, 'crop' => 7200, 'time' => 70400), array('wood' => 10500, 'clay' => 13000, 'iron' => 15500, 'crop' => 7600, 'time' => 73920), array('wood' => 11000, 'clay' => 14000, 'iron' => 16500, 'crop' => 8100, 'time' => 77440), array('wood' => 11500, 'clay' => 14500, 'iron' => 17500, 'crop' => 8600, 'time' => 80960), array('wood' => 12000, 'clay' => 15500, 'iron' => 18500,
'crop' => 9000, 'time' => 84480), array('wood' => 13000, 'clay' => 16000, 'iron' => 19500, 'crop' => 9500, 'time' => 88000), array('wood' => 13500, 'clay' => 17000, 'iron' => 20500, 'crop' => 10000, 'time' => 91520), array('wood' => 14000, 'clay' => 18000, 'iron' => 21500, 'crop' => 10500, 'time' => 95040), array('wood' => 15000, 'clay' => 18500, 'iron' => 22500, 'crop' => 11000, 'time' => 98560), array('wood' => 15500, 'clay' => 19500, 'iron' => 23500, 'crop' => 11500, 'time' => 102080), array('wood' => 16000, 'clay' =>
20500, 'iron' => 24500, 'crop' => 12000, 'time' => 105600), array('wood' => 17000, 'clay' => 21000, 'iron' => 25500, 'crop' => 12500, 'time' => 109120), array('wood' => 17500, 'clay' => 22000, 'iron' => 26500, 'crop' => 13000, 'time' => 112640), array('wood' => 18000, 'clay' => 23000, 'iron' => 27500, 'crop' => 13500, 'time' => 116160), array('wood' => 19000, 'clay' => 24000, 'iron' => 28500, 'crop' => 14000, 'time' => 119680), array('wood' => 19500, 'clay' => 24500, 'iron' => 30000, 'crop' => 14500, 'time' => 123200),
array('wood' => 20500, 'clay' => 25500, 'iron' => 31000, 'crop' => 15000, 'time' => 126270), array('wood' => 21000, 'clay' => 26500, 'iron' => 32000, 'crop' => 15500, 'time' => 130240), array('wood' => 21500, 'clay' => 27500, 'iron' => 33000, 'crop' => 16000, 'time' => 133760), array('wood' => 22500, 'clay' => 28500, 'iron' => 34000, 'crop' => 16500, 'time' => 137280), array('wood' => 23000, 'clay' => 29000, 'iron' => 35000, 'crop' => 17000, 'time' => 140800), array('wood' => 24000, 'clay' => 30000, 'iron' => 36500, 'crop' =>
17500, 'time' => 144320), array('wood' => 24500, 'clay' => 31000, 'iron' => 37500, 'crop' => 18000, 'time' => 147840), array('wood' => 25500, 'clay' => 32000, 'iron' => 38500, 'crop' => 18500, 'time' => 151360), array('wood' => 26000, 'clay' => 33000, 'iron' => 39500, 'crop' => 19500, 'time' => 154880), array('wood' => 27000, 'clay' => 34000, 'iron' => 41000, 'crop' => 20000, 'time' => 158400), array('wood' => 27500, 'clay' => 34500, 'iron' => 42000, 'crop' => 20500, 'time' => 161920), array('wood' => 28500, 'clay' => 35500,
'iron' => 43000, 'crop' => 21000, 'time' => 165440), array('wood' => 29000, 'clay' => 36500, 'iron' => 44000, 'crop' => 21500, 'time' => 168960), array('wood' => 30000, 'clay' => 37500, 'iron' => 45500, 'crop' => 22000, 'time' => 172480), array('wood' => 30500, 'clay' => 38500, 'iron' => 46500, 'crop' => 22500, 'time' => 176000), array('wood' => 31500, 'clay' => 39500, 'iron' => 47500, 'crop' => 23000, 'time' => 179520), array('wood' => 32000, 'clay' => 40500, 'iron' => 49000, 'crop' => 23500, 'time' => 183040), array('wood' =>
33000, 'clay' => 41500, 'iron' => 50000, 'crop' => 24500, 'time' => 186560), array('wood' => 33500, 'clay' => 42500, 'iron' => 51000, 'crop' => 25000, 'time' => 190080), array('wood' => 34500, 'clay' => 43500, 'iron' => 52500, 'crop' => 25500, 'time' => 193600), array('wood' => 35000, 'clay' => 44500, 'iron' => 53500, 'crop' => 26000, 'time' => 197120), array('wood' => 36000, 'clay' => 45500, 'iron' => 55000, 'crop' => 26500, 'time' => 200640), array('wood' => 37000, 'clay' => 46500, 'iron' => 56000, 'crop' => 27000, 'time' =>
204160), array('wood' => 37500, 'clay' => 47500, 'iron' => 57000, 'crop' => 28000, 'time' => 207680), array('wood' => 38500, 'clay' => 48500, 'iron' => 58500, 'crop' => 28500, 'time' => 211200), array('wood' => 39000, 'clay' => 49500, 'iron' => 59500, 'crop' => 29000, 'time' => 214720));
$h3_full = array(array('wood' => 300, 'clay' => 320, 'iron' => 420, 'crop' => 160, 'time' => 3840), array('wood' => 780, 'clay' => 830, 'iron' => 1100, 'crop' => 450, 'time' => 7680), array('wood' => 1300, 'clay' => 1400, 'iron' => 1800, 'crop' => 750, 'time' => 11520), array('wood' => 1900, 'clay' => 2000, 'iron' => 2500, 'crop' => 1100, 'time' => 15360), array('wood' => 2500, 'clay' => 2600, 'iron' => 3400, 'crop' => 1400, 'time' => 19200), array('wood' => 3100, 'clay' => 3300, 'iron' => 4200, 'crop' => 1800, 'time' => 23040),
array('wood' => 3800, 'clay' => 4000, 'iron' => 5100, 'crop' => 2200, 'time' => 26880), array('wood' => 4400, 'clay' => 4700, 'iron' => 6100, 'crop' => 2600, 'time' => 30720), array('wood' => 5100, 'clay' => 5500, 'iron' => 7000, 'crop' => 3000, 'time' => 34560), array('wood' => 5900, 'clay' => 6200, 'iron' => 8000, 'crop' => 3400, 'time' => 38400), array('wood' => 6600, 'clay' => 7000, 'iron' => 9000, 'crop' => 3800, 'time' => 42240), array('wood' => 7400, 'clay' => 7800, 'iron' => 10000, 'crop' => 4200, 'time' => 46080),
array('wood' => 8100, 'clay' => 8600, 'iron' => 11000, 'crop' => 4700, 'time' => 49920), array('wood' => 8900, 'clay' => 9500, 'iron' => 12000, 'crop' => 5100, 'time' => 53760), array('wood' => 9700, 'clay' => 10500, 'iron' => 13500, 'crop' => 5600, 'time' => 57600), array('wood' => 10500, 'clay' => 11000, 'iron' => 14500, 'crop' => 6100, 'time' => 61440), array('wood' => 11500, 'clay' => 12000, 'iron' => 15500, 'crop' => 6600, 'time' => 65280), array('wood' => 12000, 'clay' => 13000, 'iron' => 16500, 'crop' => 7000, 'time' =>
69120), array('wood' => 13000, 'clay' => 14000, 'iron' => 18000, 'crop' => 7500, 'time' => 72960), array('wood' => 14000, 'clay' => 15000, 'iron' => 19000, 'crop' => 8000, 'time' => 76800), array('wood' => 15000, 'clay' => 15500, 'iron' => 20000, 'crop' => 8500, 'time' => 80640), array('wood' => 15500, 'clay' => 16500, 'iron' => 21500, 'crop' => 9100, 'time' => 84480), array('wood' => 16500, 'clay' => 17500, 'iron' => 22500, 'crop' => 9600, 'time' => 88320), array('wood' => 17500, 'clay' => 18500, 'iron' => 24000, 'crop' => 10000,
'time' => 92160), array('wood' => 18500, 'clay' => 19500, 'iron' => 25000, 'crop' => 10500, 'time' => 96000), array('wood' => 19500, 'clay' => 20500, 'iron' => 26500, 'crop' => 11000, 'time' => 99840), array('wood' => 20500, 'clay' => 21500, 'iron' => 27500, 'crop' => 11500, 'time' => 103680), array('wood' => 21500, 'clay' => 22500, 'iron' => 29000, 'crop' => 12000, 'time' => 107520), array('wood' => 22000, 'clay' => 23500, 'iron' => 30500, 'crop' => 13000, 'time' => 111360), array('wood' => 23000, 'clay' => 24500, 'iron' => 31500,
'crop' => 13500, 'time' => 115200), array('wood' => 24000, 'clay' => 25500, 'iron' => 33000, 'crop' => 14000, 'time' => 119040), array('wood' => 25000, 'clay' => 26500, 'iron' => 34000, 'crop' => 14500, 'time' => 122880), array('wood' => 26000, 'clay' => 27500, 'iron' => 35500, 'crop' => 15000, 'time' => 126720), array('wood' => 27000, 'clay' => 28500, 'iron' => 37000, 'crop' => 15500, 'time' => 130560), array('wood' => 28000, 'clay' => 30000, 'iron' => 38500, 'crop' => 16000, 'time' => 134400), array('wood' => 29000, 'clay' => 31000,
'iron' => 39500, 'crop' => 17000, 'time' => 138240), array('wood' => 30000, 'clay' => 32000, 'iron' => 41000, 'crop' => 17500, 'time' => 142080), array('wood' => 31000, 'clay' => 33000, 'iron' => 42500, 'crop' => 18000, 'time' => 145920), array('wood' => 32000, 'clay' => 34000, 'iron' => 44000, 'crop' => 18500, 'time' => 149760), array('wood' => 33000, 'clay' => 35000, 'iron' => 45500, 'crop' => 19000, 'time' => 153600), array('wood' => 34000, 'clay' => 36500, 'iron' => 46500, 'crop' => 19500, 'time' => 157440), array('wood' => 35500,
'clay' => 37500, 'iron' => 48000, 'crop' => 20500, 'time' => 161280), array('wood' => 36500, 'clay' => 38500, 'iron' => 49500, 'crop' => 21000, 'time' => 165120), array('wood' => 37500, 'clay' => 39500, 'iron' => 51000, 'crop' => 21500, 'time' => 168960), array('wood' => 38500, 'clay' => 41000, 'iron' => 52500, 'crop' => 22000, 'time' => 172800), array('wood' => 39500, 'clay' => 42000, 'iron' => 54000, 'crop' => 23000, 'time' => 176640), array('wood' => 40500, 'clay' => 43000, 'iron' => 55000, 'crop' => 23500, 'time' => 180480),
array('wood' => 41500, 'clay' => 44000, 'iron' => 57000, 'crop' => 24000, 'time' => 184320), array('wood' => 43000, 'clay' => 45500, 'iron' => 58500, 'crop' => 24500, 'time' => 188160), array('wood' => 44000, 'clay' => 46500, 'iron' => 60000, 'crop' => 25500, 'time' => 192000), array('wood' => 45000, 'clay' => 47500, 'iron' => 61500, 'crop' => 26000, 'time' => 195840), array('wood' => 46000, 'clay' => 49000, 'iron' => 63000, 'crop' => 26500, 'time' => 199680), array('wood' => 47000, 'clay' => 50000, 'iron' => 64500, 'crop' => 27000,
'time' => 203520), array('wood' => 48500, 'clay' => 51000, 'iron' => 66000, 'crop' => 28000, 'time' => 207360), array('wood' => 49500, 'clay' => 52500, 'iron' => 67500, 'crop' => 28500, 'time' => 211200), array('wood' => 50500, 'clay' => 53500, 'iron' => 69000, 'crop' => 29000, 'time' => 215040), array('wood' => 51500, 'clay' => 55000, 'iron' => 70500, 'crop' => 30000, 'time' => 218880), array('wood' => 53000, 'clay' => 56000, 'iron' => 72000, 'crop' => 30500, 'time' => 222720), array('wood' => 54000, 'clay' => 57000, 'iron' => 73500,
'crop' => 31000, 'time' => 226560), array('wood' => 55000, 'clay' => 58500, 'iron' => 75000, 'crop' => 31500, 'time' => 230400), array('wood' => 56500, 'clay' => 59500, 'iron' => 76500, 'crop' => 32500, 'time' => 234240));
$h5_full = array(array('wood' => 1100, 'clay' => 880, 'iron' => 640, 'crop' => 200, 'time' => 5280), array('wood' => 2700, 'clay' => 2200, 'iron' => 1600, 'crop' => 550, 'time' => 10560), array('wood' => 4500, 'clay' => 3600, 'iron' => 2600, 'crop' => 910, 'time' => 15840), array('wood' => 6400, 'clay' => 5100, 'iron' => 3800, 'crop' => 1300, 'time' => 21120), array('wood' => 8400, 'clay' => 6800, 'iron' => 5000, 'crop' => 1700, 'time' => 26400), array('wood' => 10500, 'clay' => 8500, 'iron' => 6300, 'crop' => 2200, 'time' => 31680),
array('wood' => 13000, 'clay' => 10500, 'iron' => 7600, 'crop' => 2600, 'time' => 36960), array('wood' => 15000, 'clay' => 12000, 'iron' => 9000, 'crop' => 3100, 'time' => 42240), array('wood' => 17500, 'clay' => 14000, 'iron' => 10500, 'crop' => 3600, 'time' => 47520), array('wood' => 20000, 'clay' => 16000, 'iron' => 12000, 'crop' => 4100, 'time' => 52800), array('wood' => 22500, 'clay' => 18000, 'iron' => 13500, 'crop' => 4600, 'time' => 58080), array('wood' => 25000, 'clay' => 20500, 'iron' => 15000, 'crop' => 5100, 'time' =>
63360), array('wood' => 28000, 'clay' => 22500, 'iron' => 16500, 'crop' => 5700, 'time' => 68640), array('wood' => 30500, 'clay' => 24500, 'iron' => 18000, 'crop' => 6200, 'time' => 73920), array('wood' => 33500, 'clay' => 27000, 'iron' => 20000, 'crop' => 6800, 'time' => 79200), array('wood' => 36000, 'clay' => 29000, 'iron' => 21500, 'crop' => 7400, 'time' => 84480), array('wood' => 39000, 'clay' => 31500, 'iron' => 23000, 'crop' => 7900, 'time' => 89760), array('wood' => 42000, 'clay' => 33500, 'iron' => 25000, 'crop' => 8500,
'time' => 95040), array('wood' => 45000, 'clay' => 36000, 'iron' => 26500, 'crop' => 9100, 'time' => 100320), array('wood' => 48000, 'clay' => 38500, 'iron' => 28500, 'crop' => 9700, 'time' => 105600), array('wood' => 51000, 'clay' => 41000, 'iron' => 30000, 'crop' => 10500, 'time' => 110880), array('wood' => 54000, 'clay' => 43500, 'iron' => 32000, 'crop' => 11000, 'time' => 116160), array('wood' => 57000, 'clay' => 46000, 'iron' => 33500, 'crop' => 11500, 'time' => 121440), array('wood' => 60000, 'clay' => 48500, 'iron' => 35500,
'crop' => 12000, 'time' => 126720), array('wood' => 63000, 'clay' => 51000, 'iron' => 37500, 'crop' => 13000, 'time' => 132000), array('wood' => 66500, 'clay' => 53500, 'iron' => 39500, 'crop' => 13500, 'time' => 137280), array('wood' => 69500, 'clay' => 56000, 'iron' => 41000, 'crop' => 14000, 'time' => 142560), array('wood' => 73000, 'clay' => 58500, 'iron' => 43000, 'crop' => 15000, 'time' => 147840), array('wood' => 76000, 'clay' => 61000, 'iron' => 45000, 'crop' => 15500, 'time' => 153120), array('wood' => 79500, 'clay' => 64000,
'iron' => 47000, 'crop' => 16000, 'time' => 158400), array('wood' => 82500, 'clay' => 66500, 'iron' => 49000, 'crop' => 17000, 'time' => 163680), array('wood' => 86000, 'clay' => 69500, 'iron' => 51000, 'crop' => 17500, 'time' => 168960), array('wood' => 89500, 'clay' => 72000, 'iron' => 53000, 'crop' => 18000, 'time' => 174240), array('wood' => 93000, 'clay' => 74500, 'iron' => 55000, 'crop' => 19000, 'time' => 179520), array('wood' => 96000, 'clay' => 77500, 'iron' => 57000, 'crop' => 19500, 'time' => 184800), array('wood' => 99500,
'clay' => 80000, 'iron' => 59000, 'crop' => 20500, 'time' => 190080), array('wood' => 103000, 'clay' => 83000, 'iron' => 61000, 'crop' => 21000, 'time' => 195360), array('wood' => 106500, 'clay' => 86000, 'iron' => 63000, 'crop' => 21500, 'time' => 200640), array('wood' => 110000, 'clay' => 88500, 'iron' => 65500, 'crop' => 22500, 'time' => 205920), array('wood' => 113500, 'clay' => 91500, 'iron' => 67500, 'crop' => 23000, 'time' => 211200), array('wood' => 117000, 'clay' => 94500, 'iron' => 69500, 'crop' => 24000, 'time' => 216480),
array('wood' => 121000, 'clay' => 97500, 'iron' => 75500, 'crop' => 24500, 'time' => 221760), array('wood' => 124500, 'clay' => 100000, 'iron' => 74000, 'crop' => 25500, 'time' => 227040), array('wood' => 128000, 'clay' => 103000, 'iron' => 76000, 'crop' => 26000, 'time' => 232320), array('wood' => 131500, 'clay' => 106000, 'iron' => 78000, 'crop' => 27000, 'time' => 237600), array('wood' => 135500, 'clay' => 109000, 'iron' => 80500, 'crop' => 27500, 'time' => 242800), array('wood' => 139000, 'clay' => 112000, 'iron' => 82500, 'crop' =>
28500, 'time' => 248160), array('wood' => 143000, 'clay' => 115000, 'iron' => 84500, 'crop' => 29000, 'time' => 253440), array('wood' => 146500, 'clay' => 118000, 'iron' => 87000, 'crop' => 30000, 'time' => 258720), array('wood' => 150000, 'clay' => 121000, 'iron' => 89000, 'crop' => 30500, 'time' => 264000), array('wood' => 154000, 'clay' => 124000, 'iron' => 91500, 'crop' => 31500, 'time' => 269280), array('wood' => 158000, 'clay' => 127000, 'iron' => 93500, 'crop' => 32000, 'time' => 274560), array('wood' => 161500, 'clay' => 130000,
'iron' => 96000, 'crop' => 33000, 'time' => 279840), array('wood' => 165500, 'clay' => 133000, 'iron' => 98000, 'crop' => 33500, 'time' => 285120), array('wood' => 169500, 'clay' => 136500, 'iron' => 100500, 'crop' => 34500, 'time' => 290400), array('wood' => 173000, 'clay' => 139500, 'iron' => 102500, 'crop' => 35000, 'time' => 295680), array('wood' => 177000, 'clay' => 142500, 'iron' => 105000, 'crop' => 36000, 'time' => 300960), array('wood' => 181000, 'clay' => 145500, 'iron' => 107000, 'crop' => 37000, 'time' => 306240), array('wood' =>
185000, 'clay' => 149000, 'iron' => 109500, 'crop' => 37500, 'time' => 311520), array('wood' => 188500, 'clay' => 152000, 'iron' => 112000, 'crop' => 38500, 'time' => 316800), array('wood' => 192500, 'clay' => 155000, 'iron' => 114000, 'crop' => 39000, 'time' => 322080));
$h6_full = array(array('wood' => 1100, 'clay' => 1300, 'iron' => 1600, 'crop' => 360, 'time' => 7040), array('wood' => 2700, 'clay' => 3100, 'iron' => 3900, 'crop' => 930, 'time' => 14080), array('wood' => 4500, 'clay' => 5200, 'iron' => 6400, 'crop' => 1500, 'time' => 21120), array('wood' => 6400, 'clay' => 7400, 'iron' => 9200, 'crop' => 2200, 'time' => 28160), array('wood' => 8400, 'clay' => 9800, 'iron' => 12000, 'crop' => 2900, 'time' => 35200), array('wood' => 10500, 'clay' => 12500, 'iron' => 15500, 'crop' => 3700, 'time' => 42240),
array('wood' => 13000, 'clay' => 15000, 'iron' => 18500, 'crop' => 4400, 'time' => 49280), array('wood' => 15000, 'clay' => 17500, 'iron' => 22000, 'crop' => 5200, 'time' => 56320), array('wood' => 17500, 'clay' => 20500, 'iron' => 25500, 'crop' => 6100, 'time' => 63360), array('wood' => 20000, 'clay' => 23500, 'iron' => 29000, 'crop' => 6900, 'time' => 70400), array('wood' => 22500, 'clay' => 26000, 'iron' => 32500, 'crop' => 7800, 'time' => 77440), array('wood' => 25000, 'clay' => 29500, 'iron' => 36500, 'crop' => 8700, 'time' => 84480),
array('wood' => 28000, 'clay' => 32500, 'iron' => 40000, 'crop' => 9600, 'time' => 91520), array('wood' => 30500, 'clay' => 35500, 'iron' => 44000, 'crop' => 10500, 'time' => 98560), array('wood' => 33500, 'clay' => 38500, 'iron' => 48000, 'crop' => 11500, 'time' => 105600), array('wood' => 36000, 'clay' => 42000, 'iron' => 52000, 'crop' => 12500, 'time' => 112640), array('wood' => 39000, 'clay' => 45000, 'iron' => 56500, 'crop' => 13500, 'time' => 119680), array('wood' => 42000, 'clay' => 48500, 'iron' => 60500, 'crop' => 14500, 'time' =>
126720), array('wood' => 45000, 'clay' => 52000, 'iron' => 64500, 'crop' => 15500, 'time' => 133760), array('wood' => 48000, 'clay' => 55500, 'iron' => 69000, 'crop' => 16500, 'time' => 140800), array('wood' => 51000, 'clay' => 59000, 'iron' => 73500, 'crop' => 17500, 'time' => 147840), array('wood' => 54000, 'clay' => 62500, 'iron' => 77500, 'crop' => 18500, 'time' => 154880), array('wood' => 57000, 'clay' => 66000, 'iron' => 82000, 'crop' => 19500, 'time' => 161920), array('wood' => 60000, 'clay' => 69500, 'iron' => 86500, 'crop' => 20500,
'time' => 168960), array('wood' => 63000, 'clay' => 73000, 'iron' => 91000, 'crop' => 22000, 'time' => 176000), array('wood' => 66500, 'clay' => 77000, 'iron' => 95500, 'crop' => 23000, 'time' => 183040), array('wood' => 69500, 'clay' => 80500, 'iron' => 100500, 'crop' => 24000, 'time' => 190080), array('wood' => 73000, 'clay' => 84500, 'iron' => 105000, 'crop' => 25000, 'time' => 197120), array('wood' => 76000, 'clay' => 88000, 'iron' => 109500, 'crop' => 26000, 'time' => 204160), array('wood' => 79500, 'clay' => 92000, 'iron' => 114500,
'crop' => 27500, 'time' => 211200), array('wood' => 82500, 'clay' => 96000, 'iron' => 119000, 'crop' => 28500, 'time' => 218240), array('wood' => 86000, 'clay' => 99500, 'iron' => 124000, 'crop' => 29500, 'time' => 255280), array('wood' => 89500, 'clay' => 103500, 'iron' => 129000, 'crop' => 31000, 'time' => 232320), array('wood' => 93000, 'clay' => 107500, 'iron' => 134000, 'crop' => 32000, 'time' => 239360), array('wood' => 96000, 'clay' => 111500, 'iron' => 139000, 'crop' => 33000, 'time' => 246400), array('wood' => 99500, 'clay' => 115500,
'iron' => 143500, 'crop' => 34500, 'time' => 253440), array('wood' => 103000, 'clay' => 119500, 'iron' => 148500, 'crop' => 35500, 'time' => 260480), array('wood' => 106500, 'clay' => 123500, 'iron' => 154000, 'crop' => 37000, 'time' => 267520), array('wood' => 110000, 'clay' => 127500, 'iron' => 159000, 'crop' => 38000, 'time' => 274560), array('wood' => 113500, 'clay' => 132000, 'iron' => 164000, 'crop' => 39000, 'time' => 281600), array('wood' => 117000, 'clay' => 136000, 'iron' => 169000, 'crop' => 40500, 'time' => 288640), array('wood' =>
121000, 'clay' => 140000, 'iron' => 174500, 'crop' => 41500, 'time' => 295680), array('wood' => 124500, 'clay' => 144000, 'iron' => 179500, 'crop' => 43000, 'time' => 302720), array('wood' => 128000, 'clay' => 148500, 'iron' => 184500, 'crop' => 44000, 'time' => 309760), array('wood' => 131500, 'clay' => 152500, 'iron' => 190000, 'crop' => 45500, 'time' => 316800), array('wood' => 135500, 'clay' => 157000, 'iron' => 195500, 'crop' => 46500, 'time' => 323840), array('wood' => 139000, 'clay' => 161000, 'iron' => 200500, 'crop' => 48000, 'time' =>
330880), array('wood' => 143000, 'clay' => 165500, 'iron' => 206000, 'crop' => 49500, 'time' => 337920), array('wood' => 146500, 'clay' => 170000, 'iron' => 211500, 'crop' => 50500, 'time' => 344960), array('wood' => 150000, 'clay' => 174000, 'iron' => 216500, 'crop' => 52000, 'time' => 352000), array('wood' => 154000, 'clay' => 178500, 'iron' => 222000, 'crop' => 53000, 'time' => 359040), array('wood' => 46000, 'clay' => 183000, 'iron' => 227500, 'crop' => 54500, 'time' => 366080), array('wood' => 46000, 'clay' => 187500, 'iron' => 233000, 'crop'
=> 56000, 'time' => 373120), array('wood' => 166500, 'clay' => 192000, 'iron' => 238500, 'crop' => 57000, 'time' => 380160), array('wood' => 169500, 'clay' => 196000, 'iron' => 240000, 'crop' => 58500, 'time' => 387200), array('wood' => 173000, 'clay' => 200500, 'iron' => 240000, 'crop' => 59500, 'time' => 394240), array('wood' => 177000, 'clay' => 205000, 'iron' => 240000, 'crop' => 61000, 'time' => 401280), array('wood' => 181000, 'clay' => 209500, 'iron' => 240000, 'crop' => 62500, 'time' => 406970), array('wood' => 185000, 'clay' => 214000,
'iron' => 240000, 'crop' => 64000, 'time' => 415360), array('wood' => 188500, 'clay' => 219000, 'iron' => 240000, 'crop' => 65000, 'time' => 422400), array('wood' => 192500, 'clay' => 223500, 'iron' => 240000, 'crop' => 66500, 'time' => 429440));
//TEUTON UNITS
$h11_full = array(array('wood' => 190, 'clay' => 150, 'iron' => 80, 'crop' => 80, 'time' => 1440), array('wood' => 520, 'clay' => 430, 'iron' => 260, 'crop' => 260, 'time' => 2880), array('wood' => 870, 'clay' => 710, 'iron' => 430, 'crop' => 430, 'time' => 4320), array('wood' => 1200, 'clay' => 1000, 'iron' => 620, 'crop' => 620, 'time' => 5760), array('wood' => 1600, 'clay' => 1300, 'iron' => 820, 'crop' => 820, 'time' => 7200), array('wood' => 2100, 'clay' => 1700, 'iron' => 1000, 'crop' => 1000, 'time' => 8640), array('wood' => 2500, 'clay' =>
2000, 'iron' => 1300, 'crop' => 1300, 'time' => 10080), array('wood' => 3000, 'clay' => 2400, 'iron' => 1500, 'crop' => 1500, 'time' => 11520), array('wood' => 3400, 'clay' => 2800, 'iron' => 1700, 'crop' => 1700, 'time' => 12960), array('wood' => 3900, 'clay' => 3200, 'iron' => 2000, 'crop' => 2000, 'time' => 14400), array('wood' => 4400, 'clay' => 3600, 'iron' => 2200, 'crop' => 2200, 'time' => 15840), array('wood' => 4900, 'clay' => 4000, 'iron' => 2500, 'crop' => 2500, 'time' => 17280), array('wood' => 5400, 'clay' => 4400, 'iron' => 2700,
'crop' => 2700, 'time' => 18720), array('wood' => 6000, 'clay' => 4900, 'iron' => 3000, 'crop' => 3000, 'time' => 20160), array('wood' => 6500, 'clay' => 5300, 'iron' => 3200, 'crop' => 3200, 'time' => 21600), array('wood' => 7000, 'clay' => 5800, 'iron' => 3500, 'crop' => 3500, 'time' => 23040), array('wood' => 7600, 'clay' => 6200, 'iron' => 3800, 'crop' => 3800, 'time' => 24480), array('wood' => 8200, 'clay' => 6700, 'iron' => 4100, 'crop' => 4100, 'time' => 25920), array('wood' => 8700, 'clay' => 7100, 'iron' => 4400, 'crop' => 4400,
'time' => 27360), array('wood' => 9300, 'clay' => 7600, 'iron' => 4700, 'crop' => 4700, 'time' => 28800), array('wood' => 9900, 'clay' => 8100, 'iron' => 4900, 'crop' => 4900, 'time' => 30240), array('wood' => 10500, 'clay' => 8600, 'iron' => 5200, 'crop' => 5200, 'time' => 31680), array('wood' => 11000, 'clay' => 9100, 'iron' => 5500, 'crop' => 5500, 'time' => 33120), array('wood' => 11500, 'clay' => 9600, 'iron' => 5800, 'crop' => 5800, 'time' => 34560), array('wood' => 12500, 'clay' => 10000, 'iron' => 6100, 'crop' => 6100, 'time' => 36000),
array('wood' => 13000, 'clay' => 10500, 'iron' => 6500, 'crop' => 6500, 'time' => 37440), array('wood' => 13500, 'clay' => 11000, 'iron' => 6800, 'crop' => 6800, 'time' => 38880), array('wood' => 14000, 'clay' => 11500, 'iron' => 7100, 'crop' => 7100, 'time' => 40320), array('wood' => 15000, 'clay' => 12000, 'iron' => 7400, 'crop' => 7400, 'time' => 41760), array('wood' => 15500, 'clay' => 12500, 'iron' => 7700, 'crop' => 7700, 'time' => 43200), array('wood' => 16000, 'clay' => 13000, 'iron' => 8000, 'crop' => 8000, 'time' => 44640), array('wood'
=> 16500, 'clay' => 13500, 'iron' => 8400, 'crop' => 8400, 'time' => 46080), array('wood' => 17500, 'clay' => 14000, 'iron' => 8700, 'crop' => 8700, 'time' => 47520), array('wood' => 18000, 'clay' => 15000, 'iron' => 9000, 'crop' => 9000, 'time' => 48960), array('wood' => 18500, 'clay' => 15500, 'iron' => 9400, 'crop' => 9400, 'time' => 50400), array('wood' => 19500, 'clay' => 16000, 'iron' => 9700, 'crop' => 9700, 'time' => 51840), array('wood' => 20000, 'clay' => 16500, 'iron' => 10000, 'crop' => 10000, 'time' => 53280), array('wood' =>
21000, 'clay' => 17000, 'iron' => 10500, 'crop' => 10500, 'time' => 54720), array('wood' => 21500, 'clay' => 17500, 'iron' => 10500, 'crop' => 10500, 'time' => 56160), array('wood' => 22000, 'clay' => 18000, 'iron' => 11000, 'crop' => 11000, 'time' => 57600), array('wood' => 23000, 'clay' => 18500, 'iron' => 11500, 'crop' => 11500, 'time' => 59040), array('wood' => 23500, 'clay' => 19000, 'iron' => 12000, 'crop' => 12000, 'time' => 60480), array('wood' => 24000, 'clay' => 20000, 'iron' => 12000, 'crop' => 12000, 'time' => 61920), array('wood' =>
25000, 'clay' => 20500, 'iron' => 12500, 'crop' => 12500, 'time' => 63360), array('wood' => 25500, 'clay' => 21000, 'iron' => 13000, 'crop' => 13000, 'time' => 64800), array('wood' => 26500, 'clay' => 21500, 'iron' => 13000, 'crop' => 13000, 'time' => 66240), array('wood' => 27000, 'clay' => 22000, 'iron' => 13500, 'crop' => 13500, 'time' => 67680), array('wood' => 28000, 'clay' => 22500, 'iron' => 14000, 'crop' => 14000, 'time' => 69120), array('wood' => 28500, 'clay' => 23500, 'iron' => 14500, 'crop' => 14500, 'time' => 70560), array('wood' =>
29500, 'clay' => 24000, 'iron' => 14500, 'crop' => 14500, 'time' => 72000), array('wood' => 30000, 'clay' => 24500, 'iron' => 15000, 'crop' => 15000, 'time' => 73440), array('wood' => 30500, 'clay' => 25000, 'iron' => 15500, 'crop' => 15500, 'time' => 74880), array('wood' => 31500, 'clay' => 25500, 'iron' => 15500, 'crop' => 15500, 'time' => 76320), array('wood' => 32000, 'clay' => 26500, 'iron' => 16000, 'crop' => 16000, 'time' => 77760), array('wood' => 33000, 'clay' => 27000, 'iron' => 16500, 'crop' => 16500, 'time' => 79200), array('wood' =>
33500, 'clay' => 27500, 'iron' => 17000, 'crop' => 17000, 'time' => 80640), array('wood' => 34500, 'clay' => 28000, 'iron' => 17000, 'crop' => 17000, 'time' => 82080), array('wood' => 35000, 'clay' => 29000, 'iron' => 17500, 'crop' => 17500, 'time' => 83520), array('wood' => 36000, 'clay' => 29500, 'iron' => 18000, 'crop' => 18000, 'time' => 84960), array('wood' => 36500, 'clay' => 30000, 'iron' => 18500, 'crop' => 18500, 'time' => 86400), array('wood' => 37500, 'clay' => 30500, 'iron' => 19000, 'crop' => 19000, 'time' => 87840));
$h12_full = array(array('wood' => 290, 'clay' => 140, 'iron' => 170, 'crop' => 80, 'time' => 2240), array('wood' => 760, 'clay' => 400, 'iron' => 480, 'crop' => 260, 'time' => 4480), array('wood' => 1300, 'clay' => 670, 'iron' => 790, 'crop' => 430, 'time' => 6720), array('wood' => 1800, 'clay' => 960, 'iron' => 1100, 'crop' => 620, 'time' => 8960), array('wood' => 2400, 'clay' => 1300, 'iron' => 1500, 'crop' => 820, 'time' => 11200), array('wood' => 3000, 'clay' => 1600, 'iron' => 1900, 'crop' => 1000, 'time' => 13440), array('wood' => 3600,
'clay' => 1900, 'iron' => 2300, 'crop' => 1300, 'time' => 15680), array('wood' => 4300, 'clay' => 2300, 'iron' => 2700, 'crop' => 1500, 'time' => 17920), array('wood' => 5000, 'clay' => 2700, 'iron' => 3100, 'crop' => 1700, 'time' => 20160), array('wood' => 5700, 'clay' => 3000, 'iron' => 3600, 'crop' => 2000, 'time' => 22400), array('wood' => 6400, 'clay' => 3400, 'iron' => 4000, 'crop' => 2200, 'time' => 24640), array('wood' => 7100, 'clay' => 3800, 'iron' => 4500, 'crop' => 2500, 'time' => 26880), array('wood' => 7900, 'clay' => 4200,
'iron' => 4900, 'crop' => 2700, 'time' => 29120), array('wood' => 8700, 'clay' => 4600, 'iron' => 5400, 'crop' => 3000, 'time' => 31360), array('wood' => 9400, 'clay' => 5000, 'iron' => 5900, 'crop' => 3200, 'time' => 33600), array('wood' => 10000, 'clay' => 5400, 'iron' => 6400, 'crop' => 3500, 'time' => 35840), array('wood' => 11000, 'clay' => 5900, 'iron' => 6900, 'crop' => 3800, 'time' => 38080), array('wood' => 12000, 'clay' => 6300, 'iron' => 7400, 'crop' => 4100, 'time' => 40320), array('wood' => 12500, 'clay' => 6700, 'iron' => 7900,
'crop' => 4400, 'time' => 42560), array('wood' => 13500, 'clay' => 7200, 'iron' => 8500, 'crop' => 4700, 'time' => 44800), array('wood' => 14500, 'clay' => 7600, 'iron' => 9000, 'crop' => 4900, 'time' => 47040), array('wood' => 15000, 'clay' => 8100, 'iron' => 9500, 'crop' => 5200, 'time' => 49280), array('wood' => 16000, 'clay' => 8600, 'iron' => 10000, 'crop' => 5500, 'time' => 51520), array('wood' => 17000, 'clay' => 9000, 'iron' => 10500, 'crop' => 5800, 'time' => 53760), array('wood' => 18000, 'clay' => 9500, 'iron' => 11000, 'crop' => 6100,
'time' => 56000), array('wood' => 19000, 'clay' => 10000, 'iron' => 11500, 'crop' => 6500, 'time' => 58240), array('wood' => 19500, 'clay' => 10500, 'iron' => 12500, 'crop' => 6800, 'time' => 60480), array('wood' => 20500, 'clay' => 11000, 'iron' => 13000, 'crop' => 7100, 'time' => 62720), array('wood' => 21500, 'clay' => 11500, 'iron' => 13500, 'crop' => 7400, 'time' => 64960), array('wood' => 22500, 'clay' => 12000, 'iron' => 14000, 'crop' => 7700, 'time' => 67200), array('wood' => 23500, 'clay' => 12500, 'iron' => 14500, 'crop' => 8000,
'time' => 69440), array('wood' => 24500, 'clay' => 13000, 'iron' => 15000, 'crop' => 8400, 'time' => 71680), array('wood' => 25500, 'clay' => 13500, 'iron' => 16000, 'crop' => 8700, 'time' => 73920), array('wood' => 26500, 'clay' => 14000, 'iron' => 16500, 'crop' => 9000, 'time' => 76160), array('wood' => 27000, 'clay' => 14500, 'iron' => 17000, 'crop' => 9400, 'time' => 78400), array('wood' => 28000, 'clay' => 15000, 'iron' => 17500, 'crop' => 9700, 'time' => 80640), array('wood' => 29000, 'clay' => 15500, 'iron' => 18000, 'crop' => 10000,
'time' => 82880), array('wood' => 30000, 'clay' => 16000, 'iron' => 18500, 'crop' => 10500, 'time' => 85120), array('wood' => 31000, 'clay' => 16500, 'iron' => 19500, 'crop' => 10500, 'time' => 87360), array('wood' => 32000, 'clay' => 17000, 'iron' => 20000, 'crop' => 11000, 'time' => 89600), array('wood' => 33000, 'clay' => 17500, 'iron' => 20500, 'crop' => 11500, 'time' => 91840), array('wood' => 34000, 'clay' => 18000, 'iron' => 21500, 'crop' => 12000, 'time' => 94080), array('wood' => 35000, 'clay' => 18500, 'iron' => 22000, 'crop' => 12000,
'time' => 96320), array('wood' => 36500, 'clay' => 19500, 'iron' => 22500, 'crop' => 12500, 'time' => 98560), array('wood' => 37500, 'clay' => 20000, 'iron' => 23500, 'crop' => 13000, 'time' => 100800), array('wood' => 38500, 'clay' => 20500, 'iron' => 24000, 'crop' => 13000, 'time' => 103040), array('wood' => 39500, 'clay' => 21000, 'iron' => 24500, 'crop' => 13500, 'time' => 105280), array('wood' => 40500, 'clay' => 21500, 'iron' => 25500, 'crop' => 14000, 'time' => 107520), array('wood' => 41500, 'clay' => 22000, 'iron' => 26000, 'crop' =>
14500, 'time' => 109760), array('wood' => 42500, 'clay' => 22500, 'iron' => 26500, 'crop' => 14500, 'time' => 112000), array('wood' => 43500, 'clay' => 23000, 'iron' => 27500, 'crop' => 15000, 'time' => 114240), array('wood' => 44500, 'clay' => 23500, 'iron' => 28000, 'crop' => 15500, 'time' => 116480), array('wood' => 46000, 'clay' => 24500, 'iron' => 28500, 'crop' => 15500, 'time' => 118720), array('wood' => 47000, 'clay' => 25000, 'iron' => 29500, 'crop' => 16000, 'time' => 120960), array('wood' => 48000, 'clay' => 25500, 'iron' => 30000,
'crop' => 16500, 'time' => 123200), array('wood' => 49000, 'clay' => 26000, 'iron' => 30500, 'crop' => 17000, 'time' => 125440), array('wood' => 50000, 'clay' => 26500, 'iron' => 31500, 'crop' => 17000, 'time' => 127680), array('wood' => 51000, 'clay' => 27000, 'iron' => 32000, 'crop' => 17500, 'time' => 129920), array('wood' => 52500, 'clay' => 28000, 'iron' => 32500, 'crop' => 18000, 'time' => 132160), array('wood' => 53500, 'clay' => 28500, 'iron' => 33500, 'crop' => 18500, 'time' => 134400), array('wood' => 54500, 'clay' => 29000, 'iron' =>
34000, 'crop' => 19000, 'time' => 136640));
$h13_full = array(array('wood' => 260, 'clay' => 240, 'iron' => 340, 'crop' => 140, 'time' => 2400), array('wood' => 690, 'clay' => 640, 'iron' => 880, 'crop' => 400, 'time' => 4800), array('wood' => 1100, 'clay' => 1100, 'iron' => 1500, 'crop' => 670, 'time' => 7200), array('wood' => 1600, 'clay' => 1500, 'iron' => 2100, 'crop' => 960, 'time' => 9600), array('wood' => 2200, 'clay' => 2000, 'iron' => 2800, 'crop' => 1300, 'time' => 12000), array('wood' => 2700, 'clay' => 2500, 'iron' => 3500, 'crop' => 1600, 'time' => 14400), array('wood' => 3300,
'clay' => 3100, 'iron' => 4200, 'crop' => 1900, 'time' => 16800), array('wood' => 3900, 'clay' => 3600, 'iron' => 5000, 'crop' => 2300, 'time' => 19200), array('wood' => 4500, 'clay' => 4200, 'iron' => 5800, 'crop' => 2700, 'time' => 21600), array('wood' => 5200, 'clay' => 4800, 'iron' => 6600, 'crop' => 3000, 'time' => 24000), array('wood' => 5800, 'clay' => 5400, 'iron' => 7400, 'crop' => 3400, 'time' => 26400), array('wood' => 6500, 'clay' => 6000, 'iron' => 8300, 'crop' => 3800, 'time' => 28800), array('wood' => 7200, 'clay' => 6700, 'iron'
=> 9100, 'crop' => 4200, 'time' => 31200), array('wood' => 7900, 'clay' => 7300, 'iron' => 10000, 'crop' => 4600, 'time' => 33600), array('wood' => 8600, 'clay' => 8000, 'iron' => 11000, 'crop' => 5000, 'time' => 36000), array('wood' => 9300, 'clay' => 8600, 'iron' => 12000, 'crop' => 5400, 'time' => 38400), array('wood' => 10000, 'clay' => 9300, 'iron' => 13000, 'crop' => 5900, 'time' => 40800), array('wood' => 11000, 'clay' => 10000, 'iron' => 13500, 'crop' => 6300, 'time' => 43200), array('wood' => 11500, 'clay' => 10500, 'iron' => 14500,
'crop' => 6700, 'time' => 45600), array('wood' => 12500, 'clay' => 11500, 'iron' => 15500, 'crop' => 7200, 'time' => 48000), array('wood' => 13000, 'clay' => 12000, 'iron' => 16500, 'crop' => 7600, 'time' => 50400), array('wood' => 14000, 'clay' => 13000, 'iron' => 17500, 'crop' => 8100, 'time' => 52800), array('wood' => 14500, 'clay' => 13500, 'iron' => 18500, 'crop' => 8600, 'time' => 55200), array('wood' => 15500, 'clay' => 14500, 'iron' => 19500, 'crop' => 9000, 'time' => 57600), array('wood' => 16000, 'clay' => 15000, 'iron' => 20500,
'crop' => 9500, 'time' => 60000), array('wood' => 17000, 'clay' => 16000, 'iron' => 21500, 'crop' => 10000, 'time' => 62400), array('wood' => 18000, 'clay' => 16500, 'iron' => 23000, 'crop' => 10500, 'time' => 64800), array('wood' => 18500, 'clay' => 17500, 'iron' => 24000, 'crop' => 11000, 'time' => 67200), array('wood' => 19500, 'clay' => 18000, 'iron' => 25000, 'crop' => 11500, 'time' => 69600), array('wood' => 20500, 'clay' => 19000, 'iron' => 26000, 'crop' => 12000, 'time' => 72000), array('wood' => 21000, 'clay' => 19500, 'iron' => 27000,
'crop' => 12500, 'time' => 74400), array('wood' => 22000, 'clay' => 20500, 'iron' => 28000, 'crop' => 13000, 'time' => 76800), array('wood' => 23000, 'clay' => 21500, 'iron' => 29500, 'crop' => 13500, 'time' => 79200), array('wood' => 24000, 'clay' => 22000, 'iron' => 30500, 'crop' => 14000, 'time' => 81600), array('wood' => 24500, 'clay' => 23000, 'iron' => 31500, 'crop' => 14500, 'time' => 84000), array('wood' => 25500, 'clay' => 24000, 'iron' => 32500, 'crop' => 15000, 'time' => 86400), array('wood' => 26500, 'clay' => 24500, 'iron' => 34000,
'crop' => 15500, 'time' => 88800), array('wood' => 27500, 'clay' => 25500, 'iron' => 35000, 'crop' => 16000, 'time' => 91200), array('wood' => 28500, 'clay' => 26500, 'iron' => 36000, 'crop' => 16500, 'time' => 93600), array('wood' => 29000, 'clay' => 27000, 'iron' => 37000, 'crop' => 17000, 'time' => 96000), array('wood' => 30000, 'clay' => 28000, 'iron' => 38500, 'crop' => 17500, 'time' => 98400), array('wood' => 31000, 'clay' => 29000, 'iron' => 39500, 'crop' => 18000, 'time' => 100800), array('wood' => 32000, 'clay' => 29500, 'iron' =>
40500, 'crop' => 18500, 'time' => 103200), array('wood' => 33000, 'clay' => 30500, 'iron' => 42000, 'crop' => 19500, 'time' => 105600), array('wood' => 34000, 'clay' => 31500, 'iron' => 43000, 'crop' => 20000, 'time' => 108000), array('wood' => 34500, 'clay' => 32500, 'iron' => 44500, 'crop' => 20500, 'time' => 110400), array('wood' => 35500, 'clay' => 33000, 'iron' => 45500, 'crop' => 21000, 'time' => 112800), array('wood' => 36500, 'clay' => 34000, 'iron' => 46500, 'crop' => 21500, 'time' => 115200), array('wood' => 37500, 'clay' => 35000,
'iron' => 48000, 'crop' => 22000, 'time' => 117600), array('wood' => 38500, 'clay' => 36000, 'iron' => 49000, 'crop' => 22500, 'time' => 120000), array('wood' => 39500, 'clay' => 37000, 'iron' => 50500, 'crop' => 23000, 'time' => 122400), array('wood' => 40500, 'clay' => 37500, 'iron' => 51500, 'crop' => 23500, 'time' => 124800), array('wood' => 41500, 'clay' => 38500, 'iron' => 53000, 'crop' => 24500, 'time' => 127200), array('wood' => 42500, 'clay' => 39500, 'iron' => 54000, 'crop' => 25000, 'time' => 129600), array('wood' => 43500, 'clay' =>
40500, 'iron' => 55500, 'crop' => 25500, 'time' => 132000), array('wood' => 44500, 'clay' => 41500, 'iron' => 56500, 'crop' => 26000, 'time' => 134400), array('wood' => 45500, 'clay' => 42500, 'iron' => 58000, 'crop' => 26500, 'time' => 136800), array('wood' => 46500, 'clay' => 43000, 'iron' => 59000, 'crop' => 27000, 'time' => 139200), array('wood' => 47500, 'clay' => 44000, 'iron' => 60500, 'crop' => 28000, 'time' => 141600), array('wood' => 48500, 'clay' => 45000, 'iron' => 62000, 'crop' => 28500, 'time' => 144000), array('wood' => 49500,
'clay' => 46000, 'iron' => 63000, 'crop' => 29000, 'time' => 146400));
$h15_full = array(array('wood' => 740, 'clay' => 540, 'iron' => 580, 'crop' => 150, 'time' => 4800), array('wood' => 1800, 'clay' => 1400, 'iron' => 1500, 'crop' => 430, 'time' => 9600), array('wood' => 3000, 'clay' => 2300, 'iron' => 2400, 'crop' => 710, 'time' => 14400), array('wood' => 4400, 'clay' => 3200, 'iron' => 3500, 'crop' => 1000, 'time' => 19200), array('wood' => 5800, 'clay' => 4300, 'iron' => 4600, 'crop' => 1300, 'time' => 24000), array('wood' => 7200, 'clay' => 5400, 'iron' => 5700, 'crop' => 1700, 'time' => 28800), array('wood' =>
8800, 'clay' => 6500, 'iron' => 6900, 'crop' => 2000, 'time' => 33600), array('wood' => 10500, 'clay' => 7700, 'iron' => 8200, 'crop' => 2400, 'time' => 38400), array('wood' => 12000, 'clay' => 8900, 'iron' => 9500, 'crop' => 2800, 'time' => 43200), array('wood' => 13500, 'clay' => 10000, 'iron' => 11000, 'crop' => 3200, 'time' => 48000), array('wood' => 15500, 'clay' => 11500, 'iron' => 12000, 'crop' => 3600, 'time' => 52800), array('wood' => 17000, 'clay' => 12500, 'iron' => 13500, 'crop' => 4000, 'time' => 57600), array('wood' => 19000,
'clay' => 14000, 'iron' => 15000, 'crop' => 4400, 'time' => 62400), array('wood' => 21000, 'clay' => 15500, 'iron' => 16500, 'crop' => 4900, 'time' => 67200), array('wood' => 22500, 'clay' => 17000, 'iron' => 18000, 'crop' => 5300, 'time' => 72000), array('wood' => 24500, 'clay' => 18000, 'iron' => 19500, 'crop' => 5800, 'time' => 76800), array('wood' => 26500, 'clay' => 19500, 'iron' => 21000, 'crop' => 6200, 'time' => 81600), array('wood' => 28500, 'clay' => 21000, 'iron' => 22500, 'crop' => 6700, 'time' => 86400), array('wood' => 30500,
'clay' => 22500, 'iron' => 24000, 'crop' => 7100, 'time' => 91200), array('wood' => 32500, 'clay' => 24000, 'iron' => 26000, 'crop' => 7600, 'time' => 96000), array('wood' => 34500, 'clay' => 25500, 'iron' => 27500, 'crop' => 8100, 'time' => 100800), array('wood' => 36500, 'clay' => 27000, 'iron' => 29000, 'crop' => 8600, 'time' => 105600), array('wood' => 39000, 'clay' => 28500, 'iron' => 30500, 'crop' => 9100, 'time' => 110400), array('wood' => 41000, 'clay' => 30500, 'iron' => 32500, 'crop' => 9600, 'time' => 115200), array('wood' => 43000,
'clay' => 32000, 'iron' => 34000, 'crop' => 10000, 'time' => 120000), array('wood' => 45000, 'clay' => 33500, 'iron' => 36000, 'crop' => 10500, 'time' => 124800), array('wood' => 47500, 'clay' => 35000, 'iron' => 37500, 'crop' => 11000, 'time' => 129600), array('wood' => 49500, 'clay' => 36500, 'iron' => 39500, 'crop' => 11500, 'time' => 134400), array('wood' => 52000, 'clay' => 38500, 'iron' => 41000, 'crop' => 12000, 'time' => 139200), array('wood' => 54000, 'clay' => 40000, 'iron' => 43000, 'crop' => 12500, 'time' => 144000), array('wood' =>
56500, 'clay' => 41500, 'iron' => 44500, 'crop' => 13000, 'time' => 148800), array('wood' => 58500, 'clay' => 43500, 'iron' => 46500, 'crop' => 13500, 'time' => 153600), array('wood' => 61000, 'clay' => 45000, 'iron' => 48000, 'crop' => 14000, 'time' => 158400), array('wood' => 63000, 'clay' => 47000, 'iron' => 50000, 'crop' => 15000, 'time' => 163200), array('wood' => 65500, 'clay' => 48500, 'iron' => 52000, 'crop' => 15500, 'time' => 168000), array('wood' => 68000, 'clay' => 50500, 'iron' => 54000, 'crop' => 16000, 'time' => 172800),
array('wood' => 70500, 'clay' => 52000, 'iron' => 55500, 'crop' => 16500, 'time' => 177600), array('wood' => 72500, 'clay' => 54000, 'iron' => 57500, 'crop' => 17000, 'time' => 182400), array('wood' => 75000, 'clay' => 55500, 'iron' => 59500, 'crop' => 17500, 'time' => 187200), array('wood' => 77500, 'clay' => 57500, 'iron' => 61500, 'crop' => 18000, 'time' => 192000), array('wood' => 80000, 'clay' => 59000, 'iron' => 63500, 'crop' => 18500, 'time' => 196800), array('wood' => 82500, 'clay' => 61000, 'iron' => 65000, 'crop' => 19000, 'time' =>
201600), array('wood' => 85000, 'clay' => 63000, 'iron' => 67000, 'crop' => 20000, 'time' => 206400), array('wood' => 87500, 'clay' => 64500, 'iron' => 69000, 'crop' => 20500, 'time' => 211200), array('wood' => 89500, 'clay' => 66500, 'iron' => 71000, 'crop' => 21000, 'time' => 216000), array('wood' => 92000, 'clay' => 68500, 'iron' => 73000, 'crop' => 21500, 'time' => 220800), array('wood' => 95000, 'clay' => 70000, 'iron' => 75000, 'crop' => 22000, 'time' => 225600), array('wood' => 97500, 'clay' => 72000, 'iron' => 77000, 'crop' => 22500,
'time' => 230400), array('wood' => 100000, 'clay' => 74000, 'iron' => 79000, 'crop' => 23500, 'time' => 235200), array('wood' => 102500, 'clay' => 76000, 'iron' => 81000, 'crop' => 24000, 'time' => 240000), array('wood' => 105000, 'clay' => 77500, 'iron' => 83000, 'crop' => 24500, 'time' => 244800), array('wood' => 107500, 'clay' => 79500, 'iron' => 85000, 'crop' => 25000, 'time' => 249600), array('wood' => 110000, 'clay' => 81500, 'iron' => 87000, 'crop' => 25500, 'time' => 254400), array('wood' => 112500, 'clay' => 83500, 'iron' => 89500,
'crop' => 26500, 'time' => 259200), array('wood' => 115500, 'clay' => 85500, 'iron' => 91500, 'crop' => 27000, 'time' => 264000), array('wood' => 118000, 'clay' => 87500, 'iron' => 93500, 'crop' => 27500, 'time' => 268800), array('wood' => 120500, 'clay' => 89500, 'iron' => 95500, 'crop' => 28000, 'time' => 273600), array('wood' => 123000, 'clay' => 91000, 'iron' => 97500, 'crop' => 29000, 'time' => 278400), array('wood' => 126000, 'clay' => 93000, 'iron' => 99500, 'crop' => 29500, 'time' => 283200), array('wood' => 128500, 'clay' => 95000,
'iron' => 102000, 'crop' => 30000, 'time' => 288000), array('wood' => 131500, 'clay' => 97000, 'iron' => 104000, 'crop' => 30500, 'time' => 292800));
$h16_full = array(array('wood' => 900, 'clay' => 1000, 'iron' => 960, 'crop' => 160, 'time' => 5920), array('wood' => 2200, 'clay' => 2500, 'iron' => 2400, 'crop' => 450, 'time' => 11840), array('wood' => 3700, 'clay' => 4200, 'iron' => 3900, 'crop' => 750, 'time' => 17760), array('wood' => 5300, 'clay' => 6000, 'iron' => 5600, 'crop' => 1100, 'time' => 23680), array('wood' => 7000, 'clay' => 7900, 'iron' => 7400, 'crop' => 1400, 'time' => 29600), array('wood' => 8700, 'clay' => 10000, 'iron' => 9300, 'crop' => 1800, 'time' => 35520), array('wood' =>
10500, 'clay' => 12000, 'iron' => 11500, 'crop' => 2200, 'time' => 41440), array('wood' => 12500, 'clay' => 14500, 'iron' => 13500, 'crop' => 2600, 'time' => 47360), array('wood' => 14500, 'clay' => 16500, 'iron' => 15500, 'crop' => 3000, 'time' => 53280), array('wood' => 16500, 'clay' => 19000, 'iron' => 17500, 'crop' => 3400, 'time' => 59200), array('wood' => 18500, 'clay' => 21000, 'iron' => 20000, 'crop' => 3800, 'time' => 65120), array('wood' => 21000, 'clay' => 23500, 'iron' => 22000, 'crop' => 4200, 'time' => 71040), array('wood' => 23000,
'clay' => 26000, 'iron' => 24500, 'crop' => 4700, 'time' => 76960), array('wood' => 25000, 'clay' => 28500, 'iron' => 27000, 'crop' => 5100, 'time' => 82880), array('wood' => 27500, 'clay' => 31500, 'iron' => 29000, 'crop' => 5600, 'time' => 88800), array('wood' => 30000, 'clay' => 34000, 'iron' => 31500, 'crop' => 6100, 'time' => 94720), array('wood' => 32000, 'clay' => 36500, 'iron' => 34000, 'crop' => 6600, 'time' => 100640), array('wood' => 34500, 'clay' => 39500, 'iron' => 36500, 'crop' => 7000, 'time' => 106560), array('wood' => 37000,
'clay' => 42000, 'iron' => 39500, 'crop' => 7500, 'time' => 112480), array('wood' => 39500, 'clay' => 45000, 'iron' => 42000, 'crop' => 8000, 'time' => 118400), array('wood' => 42000, 'clay' => 47500, 'iron' => 44500, 'crop' => 8500, 'time' => 124320), array('wood' => 44500, 'clay' => 50500, 'iron' => 47000, 'crop' => 9100, 'time' => 130240), array('wood' => 47000, 'clay' => 53500, 'iron' => 50000, 'crop' => 9600, 'time' => 136160), array('wood' => 49500, 'clay' => 56500, 'iron' => 52500, 'crop' => 10000, 'time' => 142080), array('wood' => 52000,
'clay' => 59500, 'iron' => 55500, 'crop' => 10500, 'time' => 148000), array('wood' => 54500, 'clay' => 62000, 'iron' => 58000, 'crop' => 11000, 'time' => 153920), array('wood' => 57000, 'clay' => 65000, 'iron' => 61000, 'crop' => 11500, 'time' => 159840), array('wood' => 60000, 'clay' => 68500, 'iron' => 64000, 'crop' => 12000, 'time' => 165760), array('wood' => 62500, 'clay' => 71500, 'iron' => 66500, 'crop' => 13000, 'time' => 171680), array('wood' => 65500, 'clay' => 74500, 'iron' => 69500, 'crop' => 13500, 'time' => 177600), array('wood' =>
68000, 'clay' => 77500, 'iron' => 72500, 'crop' => 14000, 'time' => 183520), array('wood' => 71000, 'clay' => 80500, 'iron' => 75500, 'crop' => 14500, 'time' => 189440), array('wood' => 73500, 'clay' => 84000, 'iron' => 78500, 'crop' => 15000, 'time' => 195360), array('wood' => 76500, 'clay' => 87000, 'iron' => 81500, 'crop' => 15500, 'time' => 201280), array('wood' => 79000, 'clay' => 90000, 'iron' => 84500, 'crop' => 16000, 'time' => 207200), array('wood' => 82000, 'clay' => 93500, 'iron' => 87500, 'crop' => 17000, 'time' => 213120),
array('wood' => 85000, 'clay' => 96500, 'iron' => 90500, 'crop' => 17500, 'time' => 219040), array('wood' => 87500, 'clay' => 100000, 'iron' => 93500, 'crop' => 18000, 'time' => 224960), array('wood' => 90500, 'clay' => 103500, 'iron' => 96500, 'crop' => 18500, 'time' => 230880), array('wood' => 93500, 'clay' => 106500, 'iron' => 99500, 'crop' => 19000, 'time' => 236800), array('wood' => 96500, 'clay' => 110000, 'iron' => 102500, 'crop' => 19500, 'time' => 242720), array('wood' => 99500, 'clay' => 113500, 'iron' => 106000, 'crop' => 20500,
'time' => 248640), array('wood' => 102500, 'clay' => 116500, 'iron' => 109000, 'crop' => 21000, 'time' => 244560), array('wood' => 105500, 'clay' => 120000, 'iron' => 112000, 'crop' => 21500, 'time' => 260480), array('wood' => 108500, 'clay' => 123500, 'iron' => 115500, 'crop' => 22000, 'time' => 266400), array('wood' => 111500, 'clay' => 127000, 'iron' => 118500, 'crop' => 23000, 'time' => 272320), array('wood' => 114500, 'clay' => 130500, 'iron' => 122000, 'crop' => 23500, 'time' => 278240), array('wood' => 117500, 'clay' => 134000, 'iron' =>
125000, 'crop' => 24000, 'time' => 284160), array('wood' => 120500, 'clay' => 137500, 'iron' => 128500, 'crop' => 24500, 'time' => 290080), array('wood' => 123500, 'clay' => 141000, 'iron' => 131500, 'crop' => 25500, 'time' => 296000), array('wood' => 126500, 'clay' => 144500, 'iron' => 135000, 'crop' => 26000, 'time' => 301920), array('wood' => 130000, 'clay' => 148000, 'iron' => 138000, 'crop' => 26500, 'time' => 307840), array('wood' => 133000, 'clay' => 151500, 'iron' => 141500, 'crop' => 27000, 'time' => 313760), array('wood' => 136000,
'clay' => 155000, 'iron' => 145000, 'crop' => 28000, 'time' => 319680), array('wood' => 139500, 'clay' => 159000, 'iron' => 148500, 'crop' => 28500, 'time' => 325600), array('wood' => 142500, 'clay' => 162500, 'iron' => 151500, 'crop' => 29000, 'time' => 331520), array('wood' => 145500, 'clay' => 166000, 'iron' => 155000, 'crop' => 30000, 'time' => 337440), array('wood' => 149000, 'clay' => 169500, 'iron' => 158500, 'crop' => 30500, 'time' => 343360), array('wood' => 152000, 'clay' => 173500, 'iron' => 162000, 'crop' => 31000, 'time' => 349280),
array('wood' => 155500, 'clay' => 177000, 'iron' => 165500, 'crop' => 31500, 'time' => 355200), array('wood' => 158500, 'clay' => 180500, 'iron' => 169000, 'crop' => 32500, 'time' => 361120));
//GAUL UNITS
$h21_full = array(array('wood' => 200, 'clay' => 260, 'iron' => 110, 'crop' => 60, 'time' => 2080), array('wood' => 550, 'clay' => 690, 'iron' => 330, 'crop' => 210, 'time' => 4160), array('wood' => 910, 'clay' => 1100, 'iron' => 550, 'crop' => 360, 'time' => 6240), array('wood' => 1300, 'clay' => 1600, 'iron' => 790, 'crop' => 510, 'time' => 8320), array('wood' => 1700, 'clay' => 2200, 'iron' => 1000, 'crop' => 670, 'time' => 10400), array('wood' => 2200, 'clay' => 2700, 'iron' => 1300, 'crop' =>
850, 'time' => 12480), array('wood' => 2600, 'clay' => 3300, 'iron' => 1600, 'crop' => 1000, 'time' => 14560), array('wood' => 3100, 'clay' => 3900, 'iron' => 1900, 'crop' => 1200, 'time' => 16640), array('wood' => 3600, 'clay' => 4500, 'iron' => 2200, 'crop' => 1400, 'time' => 18720), array('wood' => 4100, 'clay' => 5200, 'iron' => 2500, 'crop' => 1600, 'time' => 20800), array('wood' => 4600, 'clay' => 5800, 'iron' => 2800, 'crop' => 1800, 'time' => 22880), array('wood' => 5100, 'clay' => 6500,
'iron' => 3100, 'crop' => 2000, 'time' => 24960), array('wood' => 5700, 'clay' => 7200, 'iron' => 3500, 'crop' => 2200, 'time' => 27040), array('wood' => 6200, 'clay' => 7900, 'iron' => 3800, 'crop' => 2400, 'time' => 29120), array('wood' => 6800, 'clay' => 8600, 'iron' => 4100, 'crop' => 2700, 'time' => 31200), array('wood' => 7400, 'clay' => 9300, 'iron' => 4500, 'crop' => 2900, 'time' => 33280), array('wood' => 7900, 'clay' => 10000, 'iron' => 4800, 'crop' => 3100, 'time' => 35360), array('wood' =>
8500, 'clay' => 11000, 'iron' => 5200, 'crop' => 3300, 'time' => 37440), array('wood' => 9100, 'clay' => 11500, 'iron' => 5600, 'crop' => 3600, 'time' => 39520), array('wood' => 9700, 'clay' => 12500, 'iron' => 5900, 'crop' => 3800, 'time' => 41600), array('wood' => 10500, 'clay' => 13000, 'iron' => 6300, 'crop' => 4000, 'time' => 43680), array('wood' => 11000, 'clay' => 14000, 'iron' => 6700, 'crop' => 4300, 'time' => 45760), array('wood' => 11500, 'clay' => 14500, 'iron' => 7100, 'crop' =>
4500, 'time' => 47840), array('wood' => 12000, 'clay' => 15500, 'iron' => 7400, 'crop' => 4800, 'time' => 49920), array('wood' => 13000, 'clay' => 16000, 'iron' => 7800, 'crop' => 5000, 'time' => 52000), array('wood' => 13500, 'clay' => 17000, 'iron' => 8200, 'crop' => 5300, 'time' => 54080), array('wood' => 14000, 'clay' => 18000, 'iron' => 8600, 'crop' => 5500, 'time' => 56160), array('wood' => 15000, 'clay' => 18500, 'iron' => 9000, 'crop' => 5800, 'time' => 58240), array('wood' => 15500,
'clay' => 19500, 'iron' => 9400, 'clay' => 6100, 'time' => 60320), array('wood' => 16000, 'crop' => 20500, 'iron' => 9800, 'clay' => 6300, 'time' => 62400), array('wood' => 17000, 'crop' => 21000, 'iron' => 10000, 'clay' => 6600, 'time' => 64480), array('wood' => 17500, 'crop' => 22000, 'iron' => 10500, 'clay' => 6800, 'time' => 66560), array('wood' => 18000, 'crop' => 23000, 'iron' => 11000, 'clay' => 7100, 'time' => 68640), array('wood' => 19000, 'crop' => 24000, 'iron' => 11500, 'clay' =>
7400, 'time' => 70720), array('wood' => 19500, 'crop' => 24500, 'iron' => 12000, 'clay' => 7700, 'time' => 72800), array('wood' => 20500, 'crop' => 25500, 'iron' => 12500, 'clay' => 7900, 'time' => 74880), array('wood' => 21000, 'crop' => 26500, 'iron' => 13000, 'clay' => 8200, 'time' => 76960), array('wood' => 21500, 'crop' => 27500, 'iron' => 13000, 'clay' => 8500, 'time' => 79040), array('wood' => 22500, 'crop' => 28500, 'iron' => 13500, 'clay' => 8800, 'time' => 81120), array('wood' => 23000,
'clay' => 29000, 'iron' => 14000, 'crop' => 9100, 'time' => 83200), array('wood' => 24000, 'clay' => 30000, 'iron' => 14500, 'crop' => 9300, 'time' => 85280), array('wood' => 24500, 'clay' => 31000, 'iron' => 15000, 'crop' => 9600, 'time' => 87360), array('wood' => 25500, 'clay' => 32000, 'iron' => 15500, 'crop' => 9900, 'time' => 89440), array('wood' => 26000, 'clay' => 33000, 'iron' => 16000, 'crop' => 10000, 'time' => 91520), array('wood' => 27000, 'clay' => 34000, 'iron' => 16500, 'crop' =>
10500, 'time' => 93600), array('wood' => 27500, 'clay' => 34500, 'iron' => 17000, 'crop' => 11000, 'time' => 95680), array('wood' => 28500, 'clay' => 35500, 'iron' => 17000, 'crop' => 11000, 'time' => 97760), array('wood' => 29000, 'clay' => 36500, 'iron' => 17500, 'crop' => 11500, 'time' => 99840), array('wood' => 30000, 'clay' => 37500, 'iron' => 18000, 'crop' => 11500, 'time' => 101920), array('wood' => 30500, 'clay' => 38500, 'iron' => 18500, 'crop' => 12000, 'time' => 104000), array('wood' =>
31500, 'clay' => 39500, 'iron' => 19000, 'crop' => 12500, 'time' => 106080), array('wood' => 32000, 'clay' => 40500, 'iron' => 19500, 'crop' => 12500, 'time' => 108160), array('wood' => 33000, 'clay' => 41500, 'iron' => 20000, 'crop' => 13000, 'time' => 110240), array('wood' => 33500, 'clay' => 42500, 'iron' => 20500, 'crop' => 13000, 'time' => 112320), array('wood' => 34500, 'clay' => 43500, 'iron' => 21000, 'crop' => 13500, 'time' => 114400), array('wood' => 35000, 'clay' => 44500, 'iron' =>
21500, 'crop' => 14000, 'time' => 116480), array('wood' => 36000, 'clay' => 45500, 'iron' => 22000, 'crop' => 14000, 'time' => 118560), array('wood' => 37000, 'clay' => 46500, 'iron' => 22500, 'crop' => 14500, 'time' => 120640), array('wood' => 37500, 'clay' => 47500, 'iron' => 23000, 'crop' => 14500, 'time' => 122720), array('wood' => 38500, 'clay' => 48500, 'iron' => 23500, 'crop' => 15000, 'time' => 124800), array('wood' => 39000, 'clay' => 49500, 'iron' => 24000, 'crop' => 15500, 'time' => 126880));
$h22_full = array(array('wood' => 280, 'clay' => 300, 'iron' => 370, 'crop' => 120, 'time' => 2880), array('wood' => 740, 'clay' => 780, 'iron' => 950, 'crop' => 360, 'time' => 5760), array('wood' => 1200, 'clay' => 1300, 'iron' => 1600, 'crop' => 590, 'time' => 8640), array('wood' => 1800, 'clay' => 1900, 'iron' => 2300, 'crop' => 850, 'time' => 11520), array('wood' => 2300, 'clay' => 2500, 'iron' => 3000, 'crop' => 1100, 'time' => 14400), array('wood' => 2900, 'clay' => 3100, 'iron' => 3800,
'crop' => 1400, 'time' => 17280), array('wood' => 3500, 'clay' => 3800, 'iron' => 4600, 'crop' => 1700, 'time' => 20160), array('wood' => 4200, 'clay' => 4400, 'iron' => 5400, 'crop' => 2000, 'time' => 23040), array('wood' => 4800, 'clay' => 5100, 'iron' => 6200, 'crop' => 2300, 'time' => 25920), array('wood' => 5500, 'clay' => 5900, 'iron' => 7100, 'crop' => 2700, 'time' => 28800), array('wood' => 6200, 'clay' => 6600, 'iron' => 8000, 'crop' => 3000, 'time' => 31680), array('wood' => 6900,
'clay' => 7400, 'iron' => 8900, 'crop' => 3400, 'time' => 34560), array('wood' => 7700, 'clay' => 8100, 'iron' => 9900, 'crop' => 3700, 'time' => 37440), array('wood' => 8400, 'clay' => 8900, 'iron' => 11000, 'crop' => 4100, 'time' => 40320), array('wood' => 9200, 'clay' => 9700, 'iron' => 12000, 'crop' => 4400, 'time' => 43200), array('wood' => 9900, 'clay' => 10500, 'iron' => 13000, 'crop' => 4800, 'time' => 46080), array('wood' => 10500, 'clay' => 11500, 'iron' => 14000, 'crop' => 5200,
'time' => 48960), array('wood' => 11500, 'clay' => 12000, 'iron' => 15000, 'crop' => 5600, 'time' => 51840), array('wood' => 12500, 'clay' => 13000, 'iron' => 16000, 'crop' => 6000, 'time' => 54720), array('wood' => 13000, 'clay' => 14000, 'iron' => 17000, 'crop' => 6300, 'time' => 57600), array('wood' => 14000, 'clay' => 15000, 'iron' => 18000, 'crop' => 6700, 'time' => 60480), array('wood' => 15000, 'clay' => 15500, 'iron' => 19000, 'crop' => 7100, 'time' => 63360), array('wood' => 15500,
'clay' => 16500, 'iron' => 20000, 'crop' => 7600, 'time' => 66240), array('wood' => 16500, 'clay' => 17500, 'iron' => 21000, 'crop' => 8000, 'time' => 69120), array('wood' => 17500, 'clay' => 18500, 'iron' => 22500, 'crop' => 8400, 'time' => 72000), array('wood' => 18000, 'clay' => 19500, 'iron' => 23500, 'crop' => 8800, 'time' => 74880), array('wood' => 19000, 'clay' => 20500, 'iron' => 24500, 'crop' => 9200, 'time' => 77760), array('wood' => 20000, 'clay' => 21500, 'iron' => 26000, 'crop' =>
9700, 'time' => 80640), array('wood' => 21000, 'clay' => 22000, 'iron' => 27000, 'crop' => 10000, 'time' => 83520), array('wood' => 22000, 'clay' => 23000, 'iron' => 28000, 'crop' => 10500, 'time' => 86400), array('wood' => 22500, 'clay' => 24000, 'iron' => 29500, 'crop' => 11000, 'time' => 89280), array('wood' => 23500, 'clay' => 25000, 'iron' => 30500, 'crop' => 11500, 'time' => 92160), array('wood' => 24500, 'clay' => 26000, 'iron' => 31500, 'crop' => 12000, 'time' => 95040), array('wood' =>
25500, 'clay' => 27000, 'iron' => 33000, 'crop' => 12500, 'time' => 97920), array('wood' => 26500, 'clay' => 28000, 'iron' => 34000, 'crop' => 13000, 'time' => 100800), array('wood' => 27500, 'clay' => 29000, 'iron' => 35500, 'crop' => 13000, 'time' => 103680), array('wood' => 28500, 'clay' => 30000, 'iron' => 36500, 'crop' => 13500, 'time' => 106560), array('wood' => 29000, 'clay' => 31000, 'iron' => 37500, 'crop' => 14000, 'time' => 109440), array('wood' => 30000, 'clay' => 32000, 'iron' =>
39000, 'crop' => 14500, 'time' => 112320), array('wood' => 31000, 'clay' => 33000, 'iron' => 40000, 'crop' => 15000, 'time' => 115200), array('wood' => 32000, 'clay' => 34000, 'iron' => 41500, 'crop' => 15500, 'time' => 118080), array('wood' => 33000, 'clay' => 35500, 'iron' => 43000, 'crop' => 16000, 'time' => 120960), array('wood' => 34000, 'clay' => 36500, 'iron' => 44000, 'crop' => 16500, 'time' => 123840), array('wood' => 35000, 'clay' => 37500, 'iron' => 45500, 'crop' => 17000, 'time' =>
126720), array('wood' => 36000, 'clay' => 38500, 'iron' => 46500, 'crop' => 17500, 'time' => 129600), array('wood' => 37000, 'clay' => 39500, 'iron' => 48000, 'crop' => 18000, 'time' => 132480), array('wood' => 38000, 'clay' => 40500, 'iron' => 49000, 'crop' => 18500, 'time' => 135360), array('wood' => 39000, 'clay' => 41500, 'iron' => 50500, 'crop' => 19000, 'time' => 138240), array('wood' => 40000, 'clay' => 43000, 'iron' => 52000, 'crop' => 19500, 'time' => 141120), array('wood' => 41000,
'clay' => 44000, 'iron' => 53000, 'crop' => 20000, 'time' => 144000), array('wood' => 42000, 'clay' => 45000, 'iron' => 54500, 'crop' => 20500, 'time' => 146880), array('wood' => 43500, 'clay' => 46000, 'iron' => 56000, 'crop' => 21000, 'time' => 149760), array('wood' => 44500, 'clay' => 47000, 'iron' => 57000, 'crop' => 21500, 'time' => 152640), array('wood' => 45500, 'clay' => 48500, 'iron' => 58500, 'crop' => 22000, 'time' => 155520), array('wood' => 46500, 'clay' => 49500, 'iron' => 60000,
'crop' => 22500, 'time' => 158400), array('wood' => 47500, 'clay' => 50500, 'iron' => 61500, 'crop' => 23000, 'time' => 161280), array('wood' => 48500, 'clay' => 51500, 'iron' => 62500, 'crop' => 23500, 'time' => 164160), array('wood' => 49500, 'clay' => 53000, 'iron' => 64000, 'crop' => 24000, 'time' => 167040), array('wood' => 50500, 'clay' => 54000, 'iron' => 65500, 'crop' => 24500, 'time' => 169920), array('wood' => 52000, 'clay' => 55000, 'iron' => 67000, 'crop' => 25000, 'time' => 172800),
array('wood' => 53000, 'clay' => 56500, 'iron' => 68000, 'crop' => 25500, 'time' => 175680));
$h24_full = array(array('wood' => 700, 'clay' => 900, 'iron' => 460, 'crop' => 120, 'time' => 4960), array('wood' => 1700, 'clay' => 2200, 'iron' => 1200, 'crop' => 360, 'time' => 9920), array('wood' => 2900, 'clay' => 3700, 'iron' => 1900, 'crop' => 590, 'time' => 14880), array('wood' => 4100, 'clay' => 5300, 'iron' => 2800, 'crop' => 850, 'time' => 19840), array('wood' => 5500, 'clay' => 7000, 'iron' => 3700, 'crop' => 1100, 'time' => 24800), array('wood' => 6900, 'clay' => 8700, 'iron' =>
4600, 'crop' => 1400, 'time' => 29760), array('wood' => 8300, 'clay' => 10500, 'iron' => 5600, 'crop' => 1700, 'time' => 34720), array('wood' => 9800, 'clay' => 12500, 'iron' => 6600, 'crop' => 2000, 'time' => 39680), array('wood' => 11500, 'clay' => 14500, 'iron' => 7600, 'crop' => 2300, 'time' => 44640), array('wood' => 13000, 'clay' => 16500, 'iron' => 8700, 'crop' => 2700, 'time' => 49600), array('wood' => 14500, 'clay' => 18500, 'iron' => 9800, 'crop' => 3000, 'time' => 54560), array('wood' =>
16500, 'clay' => 21000, 'iron' => 11000, 'crop' => 3400, 'time' => 59520), array('wood' => 18000, 'clay' => 23000, 'iron' => 12000, 'crop' => 3700, 'time' => 64480), array('wood' => 20000, 'clay' => 25000, 'iron' => 13500, 'crop' => 4100, 'time' => 69440), array('wood' => 21500, 'clay' => 27500, 'iron' => 14500, 'crop' => 4400, 'time' => 74400), array('wood' => 23500, 'clay' => 30000, 'iron' => 15500, 'crop' => 4800, 'time' => 79360), array('wood' => 25000, 'clay' => 32000, 'iron' => 17000,
'crop' => 5200, 'time' => 84320), array('wood' => 27000, 'clay' => 34500, 'iron' => 18000, 'crop' => 5600, 'time' => 89280), array('wood' => 29000, 'clay' => 37000, 'iron' => 19500, 'crop' => 6000, 'time' => 94240), array('wood' => 31000, 'clay' => 39500, 'iron' => 20500, 'crop' => 6300, 'time' => 99200), array('wood' => 33000, 'clay' => 42000, 'iron' => 22000, 'crop' => 6700, 'time' => 104160), array('wood' => 35000, 'clay' => 44500, 'iron' => 23500, 'crop' => 7100, 'time' => 109120), array('wood' =>
37000, 'clay' => 47000, 'iron' => 24500, 'crop' => 7600, 'time' => 114080), array('wood' => 39000, 'clay' => 49500, 'iron' => 26000, 'crop' => 8000, 'time' => 119040), array('wood' => 41000, 'clay' => 52000, 'iron' => 27500, 'crop' => 8400, 'time' => 124000), array('wood' => 43000, 'clay' => 54500, 'iron' => 29000, 'crop' => 8800, 'time' => 128960), array('wood' => 45000, 'clay' => 57000, 'iron' => 30000, 'crop' => 9200, 'time' => 133920), array('wood' => 47000, 'clay' => 60000, 'iron' => 31500,
'crop' => 9700, 'time' => 138880), array('wood' => 49000, 'clay' => 62500, 'iron' => 33000, 'crop' => 10000, 'time' => 143840), array('wood' => 51500, 'clay' => 65500, 'iron' => 34500, 'crop' => 10500, 'time' => 148800), array('wood' => 53500, 'clay' => 68000, 'iron' => 36000, 'crop' => 11000, 'time' => 153760), array('wood' => 55500, 'clay' => 71000, 'iron' => 37500, 'crop' => 11500, 'time' => 158720), array('wood' => 57500, 'clay' => 73500, 'iron' => 39000, 'crop' => 12000, 'time' => 163680),
array('wood' => 60000, 'clay' => 76500, 'iron' => 40000, 'crop' => 12500, 'time' => 168640), array('wood' => 62000, 'clay' => 79000, 'iron' => 41500, 'crop' => 13000, 'time' => 173600), array('wood' => 64500, 'clay' => 82000, 'iron' => 43000, 'crop' => 13000, 'time' => 178560), array('wood' => 66500, 'clay' => 85000, 'iron' => 44500, 'crop' => 13500, 'time' => 183520), array('wood' => 69000, 'clay' => 87500, 'iron' => 46000, 'crop' => 14000, 'time' => 188480), array('wood' => 71000, 'clay' =>
90500, 'iron' => 48000, 'crop' => 14500, 'time' => 193440), array('wood' => 73500, 'clay' => 93500, 'iron' => 49500, 'crop' => 15000, 'time' => 198400), array('wood' => 75500, 'clay' => 96500, 'iron' => 51000, 'crop' => 15500, 'time' => 203360), array('wood' => 78000, 'clay' => 99500, 'iron' => 52500, 'crop' => 16000, 'time' => 208320), array('wood' => 80500, 'clay' => 102500, 'iron' => 54000, 'crop' => 16500, 'time' => 213280), array('wood' => 82500, 'clay' => 105500, 'iron' => 55500, 'crop' =>
17000, 'time' => 218240), array('wood' => 85000, 'clay' => 108500, 'iron' => 57000, 'crop' => 17500, 'time' => 223200), array('wood' => 87500, 'clay' => 111500, 'iron' => 58500, 'crop' => 18000, 'time' => 228160), array('wood' => 90000, 'clay' => 114500, 'iron' => 60500, 'crop' => 18500, 'time' => 233120), array('wood' => 92000, 'clay' => 117500, 'iron' => 62000, 'crop' => 19000, 'time' => 238080), array('wood' => 94500, 'clay' => 120500, 'iron' => 63500, 'crop' => 19500, 'time' => 243040),
array('wood' => 97000, 'clay' => 123500, 'iron' => 65000, 'crop' => 20000, 'time' => 248000), array('wood' => 99500, 'clay' => 126500, 'iron' => 67000, 'crop' => 20500, 'time' => 252960), array('wood' => 102000, 'clay' => 130000, 'iron' => 68500, 'crop' => 21000, 'time' => 257920), array('wood' => 104500, 'clay' => 133000, 'iron' => 70000, 'crop' => 21500, 'time' => 262880), array('wood' => 107000, 'clay' => 136000, 'iron' => 71500, 'crop' => 22000, 'time' => 267840), array('wood' => 109500,
'clay' => 139500, 'iron' => 73500, 'crop' => 22500, 'time' => 272800), array('wood' => 112000, 'clay' => 142500, 'iron' => 75000, 'crop' => 23000, 'time' => 277760), array('wood' => 114500, 'clay' => 145500, 'iron' => 76500, 'crop' => 23500, 'time' => 282720), array('wood' => 117000, 'clay' => 149000, 'iron' => 78500, 'crop' => 24000, 'time' => 287680), array('wood' => 119500, 'clay' => 152000, 'iron' => 80000, 'crop' => 24500, 'time' => 292640), array('wood' => 122000, 'clay' => 155500, 'iron' =>
82000, 'crop' => 25000, 'time' => 297600), array('wood' => 124500, 'clay' => 158500, 'iron' => 83500, 'crop' => 25500, 'time' => 302560));
$h25_full = array(array('wood' => 720, 'clay' => 660, 'iron' => 560, 'crop' => 240, 'time' => 5120), array('wood' => 1800, 'clay' => 1600, 'iron' => 1400, 'crop' => 640, 'time' => 10240), array('wood' => 3000, 'clay' => 2700, 'iron' => 2300, 'crop' => 1100, 'time' => 15360), array('wood' => 4200, 'clay' => 3900, 'iron' => 3300, 'crop' => 1500, 'time' => 20480), array('wood' => 5600, 'clay' => 5200, 'iron' => 4400, 'crop' => 2000, 'time' => 25600), array('wood' => 7000, 'clay' => 6500, 'iron' =>
5500, 'crop' => 2500, 'time' => 30720), array('wood' => 8500, 'clay' => 7900, 'iron' => 6700, 'crop' => 3100, 'time' => 35840), array('wood' => 10000, 'clay' => 9300, 'iron' => 7900, 'crop' => 3600, 'time' => 40960), array('wood' => 11500, 'clay' => 11000, 'iron' => 9200, 'crop' => 4200, 'time' => 46080), array('wood' => 13500, 'clay' => 12500, 'iron' => 10500, 'crop' => 4800, 'time' => 51200), array('wood' => 15000, 'clay' => 14000, 'iron' => 12000, 'crop' => 5400, 'time' => 56320), array('wood' =>
17000, 'clay' => 15500, 'iron' => 13000, 'crop' => 6000, 'time' => 61440), array('wood' => 18500, 'clay' => 17000, 'iron' => 14500, 'crop' => 6700, 'time' => 66560), array('wood' => 20500, 'clay' => 18500, 'iron' => 16000, 'crop' => 7300, 'time' => 71680), array('wood' => 22000, 'clay' => 20500, 'iron' => 17500, 'crop' => 8000, 'time' => 76800), array('wood' => 24000, 'clay' => 22000, 'iron' => 19000, 'crop' => 8600, 'time' => 81920), array('wood' => 26000, 'clay' => 24000, 'iron' => 20500,
'crop' => 9300, 'time' => 87040), array('wood' => 28000, 'clay' => 25500, 'iron' => 22000, 'crop' => 10000, 'time' => 92160), array('wood' => 30000, 'clay' => 27500, 'iron' => 23500, 'crop' => 10500, 'time' => 97280), array('wood' => 31500, 'clay' => 29000, 'iron' => 25000, 'crop' => 11500, 'time' => 102400), array('wood' => 33500, 'clay' => 31000, 'iron' => 26500, 'crop' => 12000, 'time' => 107520), array('wood' => 35500, 'clay' => 33000, 'iron' => 28000, 'crop' => 13000, 'time' => 112640),
array('wood' => 38000, 'clay' => 35000, 'iron' => 29500, 'crop' => 13500, 'time' => 117760), array('wood' => 40000, 'clay' => 36500, 'iron' => 31500, 'crop' => 14500, 'time' => 122880), array('wood' => 42000, 'clay' => 38500, 'iron' => 33000, 'crop' => 15000, 'time' => 128000), array('wood' => 44000, 'clay' => 40500, 'iron' => 34500, 'crop' => 16000, 'time' => 133120), array('wood' => 46000, 'clay' => 42500, 'iron' => 36500, 'crop' => 16500, 'time' => 138240), array('wood' => 48500, 'clay' =>
44500, 'iron' => 38000, 'crop' => 17500, 'time' => 143360), array('wood' => 50500, 'clay' => 46500, 'iron' => 39500, 'crop' => 18000, 'time' => 148480), array('wood' => 52500, 'clay' => 48500, 'iron' => 41500, 'crop' => 19000, 'time' => 153600), array('wood' => 55000, 'clay' => 50500, 'iron' => 43000, 'crop' => 19500, 'time' => 158720), array('wood' => 57000, 'clay' => 52500, 'iron' => 45000, 'crop' => 20500, 'time' => 163840), array('wood' => 59500, 'clay' => 54500, 'iron' => 46500, 'crop' =>
21500, 'time' => 168960), array('wood' => 61500, 'clay' => 56500, 'iron' => 48500, 'crop' => 22000, 'time' => 174080), array('wood' => 64000, 'clay' => 58500, 'iron' => 50000, 'crop' => 23000, 'time' => 179200), array('wood' => 66000, 'clay' => 61000, 'iron' => 52000, 'crop' => 24000, 'time' => 184320), array('wood' => 68500, 'clay' => 63000, 'iron' => 54000, 'crop' => 24500, 'time' => 189440), array('wood' => 71000, 'clay' => 65000, 'iron' => 55500, 'crop' => 25500, 'time' => 194560), array('wood' =>
73000, 'clay' => 67000, 'iron' => 57500, 'crop' => 26500, 'time' => 199680), array('wood' => 75500, 'clay' => 69500, 'iron' => 59500, 'crop' => 27000, 'time' => 204800), array('wood' => 78000, 'clay' => 71500, 'iron' => 61000, 'crop' => 28000, 'time' => 209920), array('wood' => 80000, 'clay' => 74000, 'iron' => 63000, 'crop' => 29000, 'time' => 215040), array('wood' => 82500, 'clay' => 76000, 'iron' => 65000, 'crop' => 29500, 'time' => 220160), array('wood' => 85000, 'clay' => 78000, 'iron' =>
67000, 'crop' => 30500, 'time' => 225280), array('wood' => 87500, 'clay' => 80500, 'iron' => 69000, 'crop' => 31500, 'time' => 230400), array('wood' => 90000, 'clay' => 82500, 'iron' => 70500, 'crop' => 32500, 'time' => 235520), array('wood' => 92500, 'clay' => 85000, 'iron' => 72500, 'crop' => 33000, 'time' => 240640), array('wood' => 95000, 'clay' => 87000, 'iron' => 74500, 'crop' => 34000, 'time' => 245760), array('wood' => 97000, 'clay' => 89500, 'iron' => 76500, 'crop' => 35000, 'time' =>
250880), array('wood' => 99500, 'clay' => 91500, 'iron' => 78500, 'crop' => 36000, 'time' => 256000), array('wood' => 102000, 'clay' => 94000, 'iron' => 80500, 'crop' => 37000, 'time' => 261120), array('wood' => 104500, 'clay' => 96500, 'iron' => 82500, 'crop' => 37500, 'time' => 266240), array('wood' => 107500, 'clay' => 98500, 'iron' => 84500, 'crop' => 38500, 'time' => 271360), array('wood' => 110000, 'clay' => 101000, 'iron' => 86500, 'crop' => 39500, 'time' => 276480), array('wood' =>
112500, 'clay' => 103500, 'iron' => 88500, 'crop' => 40500, 'time' => 281600), array('wood' => 115000, 'clay' => 105500, 'iron' => 90500, 'crop' => 41500, 'time' => 286720), array('wood' => 117500, 'clay' => 108000, 'iron' => 92500, 'crop' => 42500, 'time' => 291840), array('wood' => 120000, 'clay' => 110500, 'iron' => 94500, 'crop' => 43000, 'time' => 296960), array('wood' => 122500, 'clay' => 113000, 'iron' => 96500, 'crop' => 44000, 'time' => 302080), array('wood' => 125000, 'clay' => 115000,
'iron' => 98500, 'crop' => 45000, 'time' => 307200), array('wood' => 128000, 'clay' => 117500, 'iron' => 100500, 'crop' => 46000, 'time' => 312320));
$h26_full = array(array('wood' => 1000, 'clay' => 1200, 'iron' => 1400, 'crop' => 340, 'time' => 6240), array('wood' => 2400, 'clay' => 3000, 'iron' => 3300, 'crop' => 880, 'time' => 12480), array('wood' => 4100, 'clay' => 5000, 'iron' => 5400, 'crop' => 1500, 'time' => 18720), array('wood' => 5800, 'clay' => 7200, 'iron' => 7800, 'crop' => 2100, 'time' => 24960), array('wood' => 7700, 'clay' => 9500, 'iron' => 10500, 'crop' => 2800, 'time' => 31200), array('wood' => 9700, 'clay' => 12000,
'iron' => 13000, 'crop' => 3500, 'time' => 37440), array('wood' => 11500, 'clay' => 14500, 'iron' => 15500, 'crop' => 4200, 'time' => 43680), array('wood' => 14000, 'clay' => 17000, 'iron' => 18500, 'crop' => 5000, 'time' => 49920), array('wood' => 16000, 'clay' => 20000, 'iron' => 21500, 'crop' => 5800, 'time' => 56160), array('wood' => 18500, 'clay' => 22500, 'iron' => 24500, 'crop' => 6600, 'time' => 62400), array('wood' => 20500, 'clay' => 25500, 'iron' => 27500, 'crop' => 7400, 'time' =>
68640), array('wood' => 23000, 'clay' => 28500, 'iron' => 31000, 'crop' => 8300, 'time' => 74880), array('wood' => 25500, 'clay' => 31500, 'iron' => 34000, 'crop' => 9100, 'time' => 81120), array('wood' => 28000, 'clay' => 34500, 'iron' => 37500, 'crop' => 10000, 'time' => 87360), array('wood' => 30500, 'clay' => 37500, 'iron' => 40500, 'crop' => 11000, 'time' => 93600), array('wood' => 33000, 'clay' => 40500, 'iron' => 44000, 'crop' => 12000, 'time' => 99840), array('wood' => 35500, 'clay' =>
44000, 'iron' => 47500, 'crop' => 13000, 'time' => 106080), array('wood' => 38000, 'clay' => 47000, 'iron' => 51000, 'crop' => 13500, 'time' => 112320), array('wood' => 41000, 'clay' => 50500, 'iron' => 54500, 'crop' => 14500, 'time' => 118560), array('wood' => 43500, 'clay' => 53500, 'iron' => 58500, 'crop' => 15500, 'time' => 124800), array('wood' => 46500, 'clay' => 57000, 'iron' => 62000, 'crop' => 16500, 'time' => 131040), array('wood' => 49000, 'clay' => 60500, 'iron' => 66000, 'crop' =>
17500, 'time' => 137280), array('wood' => 52000, 'clay' => 64000, 'iron' => 69500, 'crop' => 18500, 'time' => 143520), array('wood' => 54500, 'clay' => 67500, 'iron' => 73500, 'crop' => 19500, 'time' => 149760), array('wood' => 57500, 'clay' => 71000, 'iron' => 77000, 'crop' => 20500, 'time' => 156000), array('wood' => 60500, 'clay' => 74500, 'iron' => 81000, 'crop' => 21500, 'time' => 162240), array('wood' => 63500, 'clay' => 78000, 'iron' => 85000, 'crop' => 23000, 'time' => 168480), array('wood' =>
66500, 'clay' => 82000, 'iron' => 89000, 'crop' => 24000, 'time' => 174720), array('wood' => 69500, 'clay' => 85500, 'iron' => 93000, 'crop' => 25000, 'time' => 180960), array('wood' => 72500, 'clay' => 89000, 'iron' => 97000, 'crop' => 26000, 'time' => 187200), array('wood' => 75500, 'clay' => 93000, 'iron' => 101000, 'crop' => 27000, 'time' => 193440), array('wood' => 78500, 'clay' => 96500, 'iron' => 105000, 'crop' => 28000, 'time' => 199680), array('wood' => 81500, 'clay' => 100500, 'iron' =>
109000, 'crop' => 29500, 'time' => 205920), array('wood' => 84500, 'clay' => 104500, 'iron' => 113500, 'crop' => 30500, 'time' => 212160), array('wood' => 87500, 'clay' => 108000, 'iron' => 117500, 'crop' => 31500, 'time' => 218400), array('wood' => 91000, 'clay' => 112000, 'iron' => 121500, 'crop' => 32500, 'time' => 224640), array('wood' => 94000, 'clay' => 116000, 'iron' => 126000, 'crop' => 34000, 'time' => 230880), array('wood' => 97000, 'clay' => 120000, 'iron' => 130000, 'crop' => 35000,
'time' => 237120), array('wood' => 100500, 'clay' => 124000, 'iron' => 134500, 'crop' => 36000, 'time' => 243360), array('wood' => 103500, 'clay' => 128000, 'iron' => 139000, 'crop' => 37000, 'time' => 249600), array('wood' => 107000, 'clay' => 132000, 'iron' => 143000, 'crop' => 38500, 'time' => 255840), array('wood' => 110000, 'clay' => 136000, 'iron' => 147500, 'crop' => 39500, 'time' => 262080), array('wood' => 113500, 'clay' => 140000, 'iron' => 152000, 'crop' => 40500, 'time' => 268320),
array('wood' => 116500, 'clay' => 144000, 'iron' => 156500, 'crop' => 42000, 'time' => 274560), array('wood' => 120000, 'clay' => 148000, 'iron' => 161000, 'crop' => 43000, 'time' => 280800), array('wood' => 123500, 'clay' => 152000, 'iron' => 165500, 'crop' => 44500, 'time' => 287040), array('wood' => 127000, 'clay' => 156500, 'iron' => 170000, 'crop' => 45500, 'time' => 293280), array('wood' => 130000, 'clay' => 160500, 'iron' => 174500, 'crop' => 46500, 'time' => 299520), array('wood' =>
133500, 'clay' => 164500, 'iron' => 179000, 'crop' => 48000, 'time' => 305760), array('wood' => 137000, 'clay' => 169000, 'iron' => 183500, 'crop' => 49000, 'time' => 312000), array('wood' => 140500, 'clay' => 173000, 'iron' => 188000, 'crop' => 50500, 'time' => 318240), array('wood' => 144000, 'clay' => 177500, 'iron' => 192500, 'crop' => 51500, 'time' => 324480), array('wood' => 147500, 'clay' => 181500, 'iron' => 197500, 'crop' => 53000, 'time' => 330720), array('wood' => 151000, 'clay' =>
186000, 'iron' => 202000, 'crop' => 54000, 'time' => 336960), array('wood' => 154500, 'clay' => 190000, 'iron' => 206500, 'crop' => 55500, 'time' => 343200), array('wood' => 158000, 'clay' => 194500, 'iron' => 211500, 'crop' => 56500, 'time' => 349440), array('wood' => 161500, 'clay' => 199000, 'iron' => 216000, 'crop' => 58000, 'time' => 355680), array('wood' => 165000, 'clay' => 203500, 'iron' => 221000, 'crop' => 59000, 'time' => 361920), array('wood' => 168500, 'clay' => 207500, 'iron' =>
225500, 'crop' => 60500, 'time' => 368160), array('wood' => 172000, 'clay' => 212000, 'iron' => 230500, 'crop' => 62000, 'time' => 374400), array('wood' => 175500, 'clay' => 216500, 'iron' => 235500, 'crop' => 63000, 'time' => 380640));
?>
-19
View File
@@ -1,19 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename 404.tpl ##
## Developed by: aggenkeech ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2012. All rights reserved. ##
## ##
#################################################################################
?>
<div style="margin-top: 50px;">
<div style="text-align: center">
<h1>404 - File not found</h1>
<img src="../../gpack/travian_default/img/misc/404.gif" title="Not Found" alt="Not Found"><br />
<p>We looked 404 times already but can't find anything, Not even an X marking the spot.</p>
<p>This system is not complete yet. So the page probably does not exist.</p><br>
</div>
</div>
-97
View File
@@ -1,97 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename resdata.php ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ##
#################################################################################
//Academy
$r2=array('wood'=>700,'clay'=>620,'iron'=>1480,'crop'=>580,'time'=>7080);
$r3=array('wood'=>1000,'clay'=>740,'iron'=>1880,'crop'=>640,'time'=>7560);
$r4=array('wood'=>940,'clay'=>740,'iron'=>360,'crop'=>400,'time'=>5880);
$r5=array('wood'=>3400,'clay'=>1860,'iron'=>2760,'crop'=>760,'time'=>9720);
$r6=array('wood'=>3400,'clay'=>2660,'iron'=>6600,'crop'=>1240,'time'=>12360);
$r7=array('wood'=>5500,'clay'=>1540,'iron'=>4200,'crop'=>580,'time'=>15600);
$r8=array('wood'=>5800,'clay'=>5500,'iron'=>5000,'crop'=>700,'time'=>28800);
$r9=array('wood'=>15880,'clay'=>13800,'iron'=>36400,'crop'=>22660,'time'=>24475);
$r12=array('wood'=>970,'clay'=>380,'iron'=>880,'crop'=>400,'time'=>5160);
$r13=array('wood'=>880,'clay'=>580,'iron'=>1560,'crop'=>580,'time'=>5400);
$r14=array('wood'=>1060,'clay'=>500,'iron'=>600,'crop'=>460,'time'=>5160);
$r15=array('wood'=>2320,'clay'=>1180,'iron'=>2520,'crop'=>610,'time'=>9000);
$r16=array('wood'=>2800,'clay'=>2160,'iron'=>4040,'crop'=>640,'time'=>10680);
$r17=array('wood'=>6100,'clay'=>1300,'iron'=>3000,'crop'=>580,'time'=>14400);
$r18=array('wood'=>5500,'clay'=>4900,'iron'=>5000,'crop'=>520,'time'=>28800);
$r19=array('wood'=>18250,'clay'=>13500,'iron'=>20400,'crop'=>16480,'time'=>19425);
$r22=array('wood'=>940,'clay'=>700,'iron'=>1680,'crop'=>520,'time'=>6120);
$r23=array('wood'=>1120,'clay'=>700,'iron'=>360,'crop'=>400,'time'=>5880);
$r24=array('wood'=>2200,'clay'=>1900,'iron'=>2040,'crop'=>520,'time'=>9240);
$r25=array('wood'=>2260,'clay'=>1420,'iron'=>2440,'crop'=>880,'time'=>9480);
$r26=array('wood'=>3100,'clay'=>2580,'iron'=>5600,'crop'=>1180,'time'=>11160);
$r27=array('wood'=>5800,'clay'=>2320,'iron'=>2840,'crop'=>610,'time'=>16800);
$r28=array('wood'=>5860,'clay'=>5900,'iron'=>5240,'crop'=>700,'time'=>28800);
$r29=array('wood'=>15880,'clay'=>22900,'iron'=>25200,'crop'=>22660,'time'=>24475);
$r32=array('wood'=>970,'clay'=>380,'iron'=>880,'crop'=>400,'time'=>5160);
$r33=array('wood'=>880,'clay'=>580,'iron'=>1560,'crop'=>580,'time'=>5400);
$r34=array('wood'=>1060,'clay'=>500,'iron'=>600,'crop'=>460,'time'=>5160);
$r35=array('wood'=>2320,'clay'=>1180,'iron'=>2520,'crop'=>610,'time'=>9000);
$r36=array('wood'=>2800,'clay'=>2160,'iron'=>4040,'crop'=>640,'time'=>10680);
$r37=array('wood'=>6100,'clay'=>1300,'iron'=>3000,'crop'=>580,'time'=>14400);
$r38=array('wood'=>5500,'clay'=>4900,'iron'=>5000,'crop'=>520,'time'=>28800);
$r39=array('wood'=>18250,'clay'=>13500,'iron'=>20400,'crop'=>16480,'time'=>19425);
$r42=array('wood'=>970,'clay'=>380,'iron'=>880,'crop'=>400,'time'=>5160);
$r43=array('wood'=>880,'clay'=>580,'iron'=>1560,'crop'=>580,'time'=>5400);
$r44=array('wood'=>1060,'clay'=>500,'iron'=>600,'crop'=>460,'time'=>5160);
$r45=array('wood'=>2320,'clay'=>1180,'iron'=>2520,'crop'=>610,'time'=>9000);
$r46=array('wood'=>2800,'clay'=>2160,'iron'=>4040,'crop'=>640,'time'=>10680);
$r47=array('wood'=>6100,'clay'=>1300,'iron'=>3000,'crop'=>580,'time'=>14400);
$r48=array('wood'=>5500,'clay'=>4900,'iron'=>5000,'crop'=>520,'time'=>28800);
$r49=array('wood'=>18250,'clay'=>13500,'iron'=>20400,'crop'=>16480,'time'=>19425);
//Armoury
//Blacksmith
$ab1=array(1=>array('wood'=>940,'clay'=>800,'iron'=>1250,'crop'=>370,'time'=>6600),array('wood'=>1635,'clay'=>1395,'iron'=>2175,'crop'=>645,'time'=>11491),array('wood'=>2265,'clay'=>1925,'iron'=>3010,'crop'=>890,'time'=>15894),array('wood'=>2850,'clay'=>2425,'iron'=>3790,'crop'=>1120,'time'=>20007),array('wood'=>3405,'clay'=>2900,'iron'=>4530,'crop'=>1340,'time'=>23918),array('wood'=>3940,'clay'=>3355,'iron'=>5240,'crop'=>1550,'time'=>27674),array('wood'=>4460,'clay'=>3795,'iron'=>5930,'crop'=>1755,'time'=>31306),array('wood'=>4960,'clay'=>4220,'iron'=>6600,'crop'=>1955,'time'=>34835),array('wood'=>5450,'clay'=>4640,'iron'=>7250,'crop'=>2145,'time'=>38277),array('wood'=>5930,'clay'=>5050,'iron'=>7885,'crop'=>2335,'time'=>41643),array('wood'=>6400,'clay'=>5450,'iron'=>8510,'crop'=>2520,'time'=>44943),array('wood'=>6860,'clay'=>5840,'iron'=>9125,'crop'=>2700,'time'=>48182),array('wood'=>7315,'clay'=>6225,'iron'=>9730,'crop'=>2880,'time'=>51369),array('wood'=>7765,'clay'=>6605,'iron'=>10325,'crop'=>3055,'time'=>54506),array('wood'=>8205,'clay'=>6980,'iron'=>10910,'crop'=>3230,'time'=>57599),array('wood'=>8640,'clay'=>7350,'iron'=>11485,'crop'=>3400,'time'=>60651),array('wood'=>9065,'clay'=>7715,'iron'=>12060,'crop'=>3570,'time'=>63665),array('wood'=>9490,'clay'=>8080,'iron'=>12620,'crop'=>3735,'time'=>66644),array('wood'=>9910,'clay'=>8435,'iron'=>13180,'crop'=>3900,'time'=>69590),array('wood'=>10325,'clay'=>8790,'iron'=>13730,'crop'=>4065,'time'=>72505));
$ab2=array(1=>array('wood'=>800,'clay'=>1010,'iron'=>1320,'crop'=>650,'time'=>7080),array('wood'=>1395,'clay'=>1760,'iron'=>2300,'crop'=>1130,'time'=>12327),array('wood'=>1925,'clay'=>2430,'iron'=>3180,'crop'=>1565,'time'=>17050),array('wood'=>2425,'clay'=>3060,'iron'=>4000,'crop'=>1970,'time'=>21463),array('wood'=>2900,'clay'=>3660,'iron'=>4785,'crop'=>2355,'time'=>25657),array('wood'=>3355,'clay'=>4235,'iron'=>5535,'crop'=>2725,'time'=>29686),array('wood'=>3795,'clay'=>4790,'iron'=>6260,'crop'=>3085,'time'=>33582),array('wood'=>4220,'clay'=>5330,'iron'=>6965,'crop'=>3430,'time'=>37368),array('wood'=>4640,'clay'=>5860,'iron'=>7655,'crop'=>3770,'time'=>41061),array('wood'=>5050,'clay'=>6375,'iron'=>8330,'crop'=>4100,'time'=>44672),array('wood'=>5450,'clay'=>6880,'iron'=>8990,'crop'=>4425,'time'=>48211),array('wood'=>5840,'clay'=>7375,'iron'=>9635,'crop'=>4745,'time'=>51687),array('wood'=>6225,'clay'=>7860,'iron'=>10275,'crop'=>5060,'time'=>55105),array('wood'=>6605,'clay'=>8340,'iron'=>10900,'crop'=>5370,'time'=>58470),array('wood'=>6980,'clay'=>8815,'iron'=>11520,'crop'=>5675,'time'=>61788),array('wood'=>7350,'clay'=>9280,'iron'=>12130,'crop'=>5975,'time'=>65062),array('wood'=>7715,'clay'=>9745,'iron'=>12735,'crop'=>6270,'time'=>68296),array('wood'=>8080,'clay'=>10200,'iron'=>13330,'crop'=>6565,'time'=>71491),array('wood'=>8435,'clay'=>10650,'iron'=>13920,'crop'=>6855,'time'=>74651),array('wood'=>8790,'clay'=>11095,'iron'=>14500,'crop'=>7140,'time'=>77778));
$ab3=array(1=>array('wood'=>1150,'clay'=>1220,'iron'=>1670,'crop'=>720,'time'=>7560),array('wood'=>2000,'clay'=>2125,'iron'=>2910,'crop'=>1255,'time'=>13163),array('wood'=>2770,'clay'=>2940,'iron'=>4020,'crop'=>1735,'time'=>18206),array('wood'=>3485,'clay'=>3700,'iron'=>5060,'crop'=>2185,'time'=>22918),array('wood'=>4165,'clay'=>4420,'iron'=>6050,'crop'=>2610,'time'=>27397),array('wood'=>4820,'clay'=>5115,'iron'=>7000,'crop'=>3020,'time'=>31699),array('wood'=>5455,'clay'=>5785,'iron'=>7920,'crop'=>3415,'time'=>35859),array('wood'=>6070,'clay'=>6440,'iron'=>8815,'crop'=>3800,'time'=>39902),array('wood'=>6670,'clay'=>7075,'iron'=>9685,'crop'=>4175,'time'=>43845),array('wood'=>7255,'clay'=>7700,'iron'=>10535,'crop'=>4545,'time'=>47700),array('wood'=>7830,'clay'=>8310,'iron'=>11370,'crop'=>4905,'time'=>51480),array('wood'=>8395,'clay'=>8905,'iron'=>12190,'crop'=>5255,'time'=>55191),array('wood'=>8950,'clay'=>9495,'iron'=>13000,'crop'=>5605,'time'=>58841),array('wood'=>9495,'clay'=>10075,'iron'=>13790,'crop'=>5945,'time'=>62434),array('wood'=>10035,'clay'=>10645,'iron'=>14575,'crop'=>6285,'time'=>65977),array('wood'=>10570,'clay'=>11210,'iron'=>15345,'crop'=>6615,'time'=>69473),array('wood'=>11095,'clay'=>11770,'iron'=>16110,'crop'=>6945,'time'=>72926),array('wood'=>11610,'clay'=>12320,'iron'=>16865,'crop'=>7270,'time'=>76338),array('wood'=>12125,'clay'=>12865,'iron'=>17610,'crop'=>7590,'time'=>79712),array('wood'=>12635,'clay'=>13400,'iron'=>18345,'crop'=>7910,'time'=>83051));
$ab4=array(1=>array('wood'=>540,'clay'=>610,'iron'=>170,'crop'=>220,'time'=>5880),array('wood'=>940,'clay'=>1060,'iron'=>295,'crop'=>385,'time'=>10238),array('wood'=>1300,'clay'=>1470,'iron'=>410,'crop'=>530,'time'=>14160),array('wood'=>1635,'clay'=>1850,'iron'=>515,'crop'=>665,'time'=>17825),array('wood'=>1955,'clay'=>2210,'iron'=>615,'crop'=>795,'time'=>21309),array('wood'=>2265,'clay'=>2560,'iron'=>715,'crop'=>920,'time'=>24655),array('wood'=>2560,'clay'=>2895,'iron'=>805,'crop'=>1045,'time'=>27890),array('wood'=>2850,'clay'=>3220,'iron'=>895,'crop'=>1160,'time'=>31035),array('wood'=>3130,'clay'=>3540,'iron'=>985,'crop'=>1275,'time'=>34101),array('wood'=>3405,'clay'=>3850,'iron'=>1075,'crop'=>1390,'time'=>37100),array('wood'=>3675,'clay'=>4155,'iron'=>1160,'crop'=>1500,'time'=>40040),array('wood'=>3940,'clay'=>4455,'iron'=>1240,'crop'=>1605,'time'=>42926),array('wood'=>4205,'clay'=>4750,'iron'=>1325,'crop'=>1710,'time'=>45765),array('wood'=>4460,'clay'=>5040,'iron'=>1405,'crop'=>1815,'time'=>48560),array('wood'=>4715,'clay'=>5325,'iron'=>1485,'crop'=>1920,'time'=>51316),array('wood'=>4960,'clay'=>5605,'iron'=>1560,'crop'=>2020,'time'=>54035),array('wood'=>5210,'clay'=>5885,'iron'=>1640,'crop'=>2120,'time'=>56720),array('wood'=>5455,'clay'=>6160,'iron'=>1715,'crop'=>2220,'time'=>59374),array('wood'=>5695,'clay'=>6430,'iron'=>1790,'crop'=>2320,'time'=>61998),array('wood'=>5930,'clay'=>6700,'iron'=>1870,'crop'=>2415,'time'=>64595));
$ab5=array(1=>array('wood'=>1315,'clay'=>1060,'iron'=>815,'crop'=>285,'time'=>9720),array('wood'=>2290,'clay'=>1845,'iron'=>1415,'crop'=>500,'time'=>16924),array('wood'=>3170,'clay'=>2555,'iron'=>1960,'crop'=>690,'time'=>23408),array('wood'=>3990,'clay'=>3215,'iron'=>2465,'crop'=>870,'time'=>29466),array('wood'=>4770,'clay'=>3840,'iron'=>2945,'crop'=>1040,'time'=>35224),array('wood'=>5520,'clay'=>4445,'iron'=>3410,'crop'=>1200,'time'=>40756),array('wood'=>6245,'clay'=>5030,'iron'=>3860,'crop'=>1360,'time'=>46105),array('wood'=>6950,'clay'=>5595,'iron'=>4295,'crop'=>1515,'time'=>51302),array('wood'=>7635,'clay'=>6150,'iron'=>4715,'crop'=>1665,'time'=>56372),array('wood'=>8310,'clay'=>6690,'iron'=>5130,'crop'=>1810,'time'=>61329),array('wood'=>8965,'clay'=>7220,'iron'=>5540,'crop'=>1950,'time'=>66188),array('wood'=>9610,'clay'=>7740,'iron'=>5940,'crop'=>2095,'time'=>70960),array('wood'=>10250,'clay'=>8250,'iron'=>6330,'crop'=>2230,'time'=>75652),array('wood'=>10875,'clay'=>8755,'iron'=>6715,'crop'=>2365,'time'=>80273),array('wood'=>11490,'clay'=>9250,'iron'=>7100,'crop'=>2500,'time'=>84828),array('wood'=>12100,'clay'=>9740,'iron'=>7475,'crop'=>2635,'time'=>89323),array('wood'=>12700,'clay'=>10225,'iron'=>7845,'crop'=>2765,'time'=>93762),array('wood'=>13295,'clay'=>10705,'iron'=>8215,'crop'=>2895,'time'=>98149),array('wood'=>13885,'clay'=>11175,'iron'=>8575,'crop'=>3025,'time'=>102487),array('wood'=>14465,'clay'=>11645,'iron'=>8935,'crop'=>3150,'time'=>106780));
$ab6=array(1=>array('wood'=>990,'clay'=>1145,'iron'=>1450,'crop'=>355,'time'=>12360),array('wood'=>1720,'clay'=>1995,'iron'=>2525,'crop'=>620,'time'=>21520),array('wood'=>2380,'clay'=>2755,'iron'=>3490,'crop'=>855,'time'=>29766),array('wood'=>2995,'clay'=>3470,'iron'=>4395,'crop'=>1075,'time'=>37469),array('wood'=>3580,'clay'=>4150,'iron'=>5255,'crop'=>1285,'time'=>44791),array('wood'=>4140,'clay'=>4800,'iron'=>6080,'crop'=>1490,'time'=>51825),array('wood'=>4685,'clay'=>5430,'iron'=>6880,'crop'=>1685,'time'=>58627),array('wood'=>5210,'clay'=>6045,'iron'=>7655,'crop'=>1875,'time'=>65236),array('wood'=>5725,'clay'=>6640,'iron'=>8410,'crop'=>2060,'time'=>71682),array('wood'=>6230,'clay'=>7225,'iron'=>9150,'crop'=>2240,'time'=>77986),array('wood'=>6725,'clay'=>7795,'iron'=>9875,'crop'=>2415,'time'=>84165),array('wood'=>7210,'clay'=>8360,'iron'=>10585,'crop'=>2590,'time'=>90233),array('wood'=>7685,'clay'=>8910,'iron'=>11285,'crop'=>2765,'time'=>96200),array('wood'=>8155,'clay'=>9455,'iron'=>11975,'crop'=>2930,'time'=>102075),array('wood'=>8620,'clay'=>9995,'iron'=>12655,'crop'=>3100,'time'=>107868),array('wood'=>9075,'clay'=>10520,'iron'=>13325,'crop'=>3260,'time'=>113583),array('wood'=>9525,'clay'=>11045,'iron'=>13985,'crop'=>3425,'time'=>119228),array('wood'=>9970,'clay'=>11560,'iron'=>14640,'crop'=>3585,'time'=>124806),array('wood'=>10410,'clay'=>12075,'iron'=>15290,'crop'=>3745,'time'=>130323),array('wood'=>10850,'clay'=>12580,'iron'=>15930,'crop'=>3900,'time'=>135782));
$ab7=array(1=>array('wood'=>2135,'clay'=>875,'iron'=>1235,'crop'=>215,'time'=>15600),array('wood'=>3715,'clay'=>1520,'iron'=>2145,'crop'=>375,'time'=>27161),array('wood'=>5140,'clay'=>2105,'iron'=>2970,'crop'=>520,'time'=>37568),array('wood'=>6465,'clay'=>2645,'iron'=>3740,'crop'=>655,'time'=>47290),array('wood'=>7730,'clay'=>3165,'iron'=>4470,'crop'=>785,'time'=>56533),array('wood'=>8945,'clay'=>3660,'iron'=>5170,'crop'=>910,'time'=>65410),array('wood'=>10120,'clay'=>4140,'iron'=>5850,'crop'=>1030,'time'=>73995),array('wood'=>11260,'clay'=>4610,'iron'=>6510,'crop'=>1145,'time'=>82337),array('wood'=>12370,'clay'=>5065,'iron'=>7155,'crop'=>1255,'time'=>90473),array('wood'=>13460,'clay'=>5510,'iron'=>7780,'crop'=>1365,'time'=>98429),array('wood'=>14525,'clay'=>5945,'iron'=>8400,'crop'=>1475,'time'=>106228),array('wood'=>15575,'clay'=>6375,'iron'=>9005,'crop'=>1580,'time'=>113886),array('wood'=>16605,'clay'=>6795,'iron'=>9600,'crop'=>1685,'time'=>121417),array('wood'=>17620,'clay'=>7210,'iron'=>10185,'crop'=>1790,'time'=>128833),array('wood'=>18620,'clay'=>7620,'iron'=>10765,'crop'=>1890,'time'=>136144),array('wood'=>19605,'clay'=>8025,'iron'=>11335,'crop'=>1990,'time'=>143358),array('wood'=>20580,'clay'=>8425,'iron'=>11895,'crop'=>2090,'time'=>150482),array('wood'=>21540,'clay'=>8820,'iron'=>12455,'crop'=>2190,'time'=>157523),array('wood'=>22495,'clay'=>9210,'iron'=>13005,'crop'=>2285,'time'=>164485),array('wood'=>23435,'clay'=>9595,'iron'=>13550,'crop'=>2380,'time'=>171375));
$ab8=array(1=>array('wood'=>1125,'clay'=>1590,'iron'=>735,'crop'=>130,'time'=>28800),array('wood'=>1960,'clay'=>2770,'iron'=>1275,'crop'=>230,'time'=>50144),array('wood'=>2710,'clay'=>3835,'iron'=>1765,'crop'=>315,'time'=>69357),array('wood'=>3410,'clay'=>4825,'iron'=>2225,'crop'=>400,'time'=>87305),array('wood'=>4075,'clay'=>5770,'iron'=>2660,'crop'=>475,'time'=>104368),array('wood'=>4715,'clay'=>6675,'iron'=>3075,'crop'=>550,'time'=>120757),array('wood'=>5335,'clay'=>7550,'iron'=>3480,'crop'=>625,'time'=>136606),array('wood'=>5940,'clay'=>8400,'iron'=>3870,'crop'=>695,'time'=>152007),array('wood'=>6525,'clay'=>9230,'iron'=>4255,'crop'=>765,'time'=>167027),array('wood'=>7100,'clay'=>10045,'iron'=>4625,'crop'=>830,'time'=>181716),array('wood'=>7660,'clay'=>10840,'iron'=>4995,'crop'=>895,'time'=>196113),array('wood'=>8215,'clay'=>11620,'iron'=>5355,'crop'=>960,'time'=>210251),array('wood'=>8755,'clay'=>12390,'iron'=>5710,'crop'=>1025,'time'=>224154),array('wood'=>9290,'clay'=>13145,'iron'=>6055,'crop'=>1085,'time'=>237845),array('wood'=>9820,'clay'=>13890,'iron'=>6400,'crop'=>1150,'time'=>251342),array('wood'=>10340,'clay'=>14625,'iron'=>6740,'crop'=>1210,'time'=>264660),array('wood'=>10850,'clay'=>15355,'iron'=>7075,'crop'=>1270,'time'=>277812),array('wood'=>11360,'clay'=>16070,'iron'=>7405,'crop'=>1330,'time'=>290811),array('wood'=>11860,'clay'=>16780,'iron'=>7730,'crop'=>1390,'time'=>303665),array('wood'=>12360,'clay'=>17485,'iron'=>8055,'crop'=>1445,'time'=>316385));
$ab11=array(1=>array('wood'=>765,'clay'=>625,'iron'=>480,'crop'=>440,'time'=>3960),array('wood'=>1330,'clay'=>1090,'iron'=>835,'crop'=>765,'time'=>6895),array('wood'=>1840,'clay'=>1505,'iron'=>1155,'crop'=>1060,'time'=>9537),array('wood'=>2320,'clay'=>1895,'iron'=>1455,'crop'=>1335,'time'=>12004),array('wood'=>2770,'clay'=>2265,'iron'=>1740,'crop'=>1595,'time'=>14351),array('wood'=>3210,'clay'=>2620,'iron'=>2015,'crop'=>1845,'time'=>16604),array('wood'=>3630,'clay'=>2965,'iron'=>2275,'crop'=>2085,'time'=>18783),array('wood'=>4040,'clay'=>3300,'iron'=>2535,'crop'=>2320,'time'=>20901),array('wood'=>4435,'clay'=>3625,'iron'=>2785,'crop'=>2550,'time'=>22966),array('wood'=>4825,'clay'=>3945,'iron'=>3030,'crop'=>2775,'time'=>24986),array('wood'=>5210,'clay'=>4255,'iron'=>3270,'crop'=>2995,'time'=>26966),array('wood'=>5585,'clay'=>4565,'iron'=>3505,'crop'=>3210,'time'=>28909),array('wood'=>5955,'clay'=>4865,'iron'=>3735,'crop'=>3425,'time'=>30821),array('wood'=>6320,'clay'=>5160,'iron'=>3965,'crop'=>3635,'time'=>32704),array('wood'=>6675,'clay'=>5455,'iron'=>4190,'crop'=>3840,'time'=>34560),array('wood'=>7030,'clay'=>5745,'iron'=>4410,'crop'=>4045,'time'=>36391),array('wood'=>7380,'clay'=>6030,'iron'=>4630,'crop'=>4245,'time'=>38199),array('wood'=>7725,'clay'=>6310,'iron'=>4845,'crop'=>4445,'time'=>39986),array('wood'=>8065,'clay'=>6590,'iron'=>5060,'crop'=>4640,'time'=>41754),array('wood'=>8405,'clay'=>6865,'iron'=>5275,'crop'=>4835,'time'=>43503));
$ab12=array(1=>array('wood'=>1115,'clay'=>590,'iron'=>795,'crop'=>440,'time'=>5160),array('wood'=>1940,'clay'=>1025,'iron'=>1385,'crop'=>765,'time'=>8984),array('wood'=>2685,'clay'=>1420,'iron'=>1915,'crop'=>1060,'time'=>12426),array('wood'=>3380,'clay'=>1790,'iron'=>2410,'crop'=>1335,'time'=>15642),array('wood'=>4040,'clay'=>2140,'iron'=>2880,'crop'=>1595,'time'=>18699),array('wood'=>4675,'clay'=>2475,'iron'=>3335,'crop'=>1845,'time'=>21636),array('wood'=>5290,'clay'=>2800,'iron'=>3770,'crop'=>2085,'time'=>24475),array('wood'=>5885,'clay'=>3115,'iron'=>4195,'crop'=>2320,'time'=>27235),array('wood'=>6465,'clay'=>3420,'iron'=>4610,'crop'=>2550,'time'=>29926),array('wood'=>7035,'clay'=>3725,'iron'=>5015,'crop'=>2775,'time'=>32557),array('wood'=>7595,'clay'=>4020,'iron'=>5415,'crop'=>2995,'time'=>35137),array('wood'=>8140,'clay'=>4305,'iron'=>5805,'crop'=>3210,'time'=>37670),array('wood'=>8680,'clay'=>4590,'iron'=>6190,'crop'=>3425,'time'=>40161),array('wood'=>9210,'clay'=>4875,'iron'=>6565,'crop'=>3635,'time'=>42614),array('wood'=>9730,'clay'=>5150,'iron'=>6940,'crop'=>3840,'time'=>45032),array('wood'=>10245,'clay'=>5420,'iron'=>7305,'crop'=>4045,'time'=>47418),array('wood'=>10755,'clay'=>5690,'iron'=>7670,'crop'=>4245,'time'=>49775),array('wood'=>11260,'clay'=>5960,'iron'=>8030,'crop'=>4445,'time'=>52104),array('wood'=>11755,'clay'=>6220,'iron'=>8380,'crop'=>4640,'time'=>54407),array('wood'=>12250,'clay'=>6480,'iron'=>8735,'crop'=>4835,'time'=>56686));
$ab13=array(1=>array('wood'=>1010,'clay'=>940,'iron'=>1390,'crop'=>650,'time'=>5400),array('wood'=>1760,'clay'=>1635,'iron'=>2420,'crop'=>1130,'time'=>9402),array('wood'=>2430,'clay'=>2265,'iron'=>3345,'crop'=>1565,'time'=>13004),array('wood'=>3060,'clay'=>2850,'iron'=>4215,'crop'=>1970,'time'=>16370),array('wood'=>3660,'clay'=>3405,'iron'=>5035,'crop'=>2355,'time'=>19569),array('wood'=>4235,'clay'=>3940,'iron'=>5830,'crop'=>2725,'time'=>22642),array('wood'=>4790,'clay'=>4460,'iron'=>6595,'crop'=>3085,'time'=>25614),array('wood'=>5330,'clay'=>4960,'iron'=>7335,'crop'=>3430,'time'=>28501),array('wood'=>5860,'clay'=>5450,'iron'=>8060,'crop'=>3770,'time'=>31318),array('wood'=>6375,'clay'=>5930,'iron'=>8770,'crop'=>4100,'time'=>34072),array('wood'=>6880,'clay'=>6400,'iron'=>9465,'crop'=>4425,'time'=>36771),array('wood'=>7375,'clay'=>6860,'iron'=>10150,'crop'=>4745,'time'=>39422),array('wood'=>7860,'clay'=>7315,'iron'=>10820,'crop'=>5060,'time'=>42029),array('wood'=>8340,'clay'=>7765,'iron'=>11480,'crop'=>5370,'time'=>44596),array('wood'=>8815,'clay'=>8205,'iron'=>12130,'crop'=>5675,'time'=>47127),array('wood'=>9280,'clay'=>8640,'iron'=>12775,'crop'=>5975,'time'=>49624),array('wood'=>9745,'clay'=>9065,'iron'=>13410,'crop'=>6270,'time'=>52090),array('wood'=>10200,'clay'=>9490,'iron'=>14035,'crop'=>6565,'time'=>54527),array('wood'=>10650,'clay'=>9910,'iron'=>14655,'crop'=>6855,'time'=>56937),array('wood'=>11095,'clay'=>10325,'iron'=>15270,'crop'=>7140,'time'=>59322));
$ab14=array(1=>array('wood'=>1220,'clay'=>800,'iron'=>550,'crop'=>510,'time'=>5160),array('wood'=>2125,'clay'=>1395,'iron'=>960,'crop'=>890,'time'=>8984),array('wood'=>2940,'clay'=>1925,'iron'=>1325,'crop'=>1230,'time'=>12426),array('wood'=>3700,'clay'=>2425,'iron'=>1665,'crop'=>1545,'time'=>15642),array('wood'=>4420,'clay'=>2900,'iron'=>1995,'crop'=>1850,'time'=>18699),array('wood'=>5115,'clay'=>3355,'iron'=>2305,'crop'=>2140,'time'=>21636),array('wood'=>5785,'clay'=>3795,'iron'=>2610,'crop'=>2420,'time'=>24475),array('wood'=>6440,'clay'=>4220,'iron'=>2905,'crop'=>2690,'time'=>27235),array('wood'=>7075,'clay'=>4640,'iron'=>3190,'crop'=>2960,'time'=>29926),array('wood'=>7700,'clay'=>5050,'iron'=>3470,'crop'=>3220,'time'=>32557),array('wood'=>8310,'clay'=>5450,'iron'=>3745,'crop'=>3475,'time'=>35137),array('wood'=>8905,'clay'=>5840,'iron'=>4015,'crop'=>3725,'time'=>37670),array('wood'=>9495,'clay'=>6225,'iron'=>4280,'crop'=>3970,'time'=>40161),array('wood'=>10075,'clay'=>6605,'iron'=>4540,'crop'=>4210,'time'=>42614),array('wood'=>10645,'clay'=>6980,'iron'=>4800,'crop'=>4450,'time'=>45032),array('wood'=>11210,'clay'=>7350,'iron'=>5055,'crop'=>4685,'time'=>47418),array('wood'=>11770,'clay'=>7715,'iron'=>5305,'crop'=>4920,'time'=>49775),array('wood'=>12320,'clay'=>8080,'iron'=>5555,'crop'=>5150,'time'=>52104),array('wood'=>12865,'clay'=>8435,'iron'=>5800,'crop'=>5375,'time'=>54407),array('wood'=>13400,'clay'=>8790,'iron'=>6040,'crop'=>5605,'time'=>56686));
$ab15=array(1=>array('wood'=>1345,'clay'=>995,'iron'=>1115,'crop'=>345,'time'=>9000),array('wood'=>2340,'clay'=>1730,'iron'=>1940,'crop'=>595,'time'=>15670),array('wood'=>3240,'clay'=>2395,'iron'=>2685,'crop'=>825,'time'=>21674),array('wood'=>4075,'clay'=>3015,'iron'=>3380,'crop'=>1040,'time'=>27283),array('wood'=>4875,'clay'=>3605,'iron'=>4040,'crop'=>1240,'time'=>32615),array('wood'=>5640,'clay'=>4170,'iron'=>4675,'crop'=>1435,'time'=>37737),array('wood'=>6380,'clay'=>4720,'iron'=>5290,'crop'=>1625,'time'=>42689),array('wood'=>7100,'clay'=>5250,'iron'=>5885,'crop'=>1810,'time'=>47502),array('wood'=>7800,'clay'=>5770,'iron'=>6465,'crop'=>1985,'time'=>52196),array('wood'=>8485,'clay'=>6280,'iron'=>7035,'crop'=>2160,'time'=>56786),array('wood'=>9160,'clay'=>6775,'iron'=>7595,'crop'=>2330,'time'=>61285),array('wood'=>9820,'clay'=>7265,'iron'=>8140,'crop'=>2500,'time'=>65703),array('wood'=>10470,'clay'=>7745,'iron'=>8680,'crop'=>2665,'time'=>70048),array('wood'=>11110,'clay'=>8215,'iron'=>9210,'crop'=>2830,'time'=>74327),array('wood'=>11740,'clay'=>8685,'iron'=>9730,'crop'=>2990,'time'=>78544),array('wood'=>12360,'clay'=>9145,'iron'=>10245,'crop'=>3145,'time'=>82706),array('wood'=>12975,'clay'=>9600,'iron'=>10755,'crop'=>3305,'time'=>86816),array('wood'=>13580,'clay'=>10045,'iron'=>11260,'crop'=>3460,'time'=>90878),array('wood'=>14180,'clay'=>10490,'iron'=>11755,'crop'=>3610,'time'=>94895),array('wood'=>14775,'clay'=>10930,'iron'=>12250,'crop'=>3765,'time'=>98870));
$ab16=array(1=>array('wood'=>1085,'clay'=>1235,'iron'=>1185,'crop'=>240,'time'=>10680),array('wood'=>1885,'clay'=>2150,'iron'=>2065,'crop'=>420,'time'=>18595),array('wood'=>2610,'clay'=>2975,'iron'=>2860,'crop'=>580,'time'=>25720),array('wood'=>3285,'clay'=>3745,'iron'=>3595,'crop'=>730,'time'=>32376),array('wood'=>3925,'clay'=>4475,'iron'=>4300,'crop'=>870,'time'=>38703),array('wood'=>4540,'clay'=>5180,'iron'=>4975,'crop'=>1005,'time'=>44781),array('wood'=>5140,'clay'=>5860,'iron'=>5630,'crop'=>1140,'time'=>50658),array('wood'=>5720,'clay'=>6520,'iron'=>6265,'crop'=>1265,'time'=>56369),array('wood'=>6285,'clay'=>7160,'iron'=>6880,'crop'=>1390,'time'=>61939),array('wood'=>6835,'clay'=>7790,'iron'=>7485,'crop'=>1515,'time'=>67386),array('wood'=>7375,'clay'=>8410,'iron'=>8080,'crop'=>1635,'time'=>72725),array('wood'=>7910,'clay'=>9015,'iron'=>8665,'crop'=>1750,'time'=>77968),array('wood'=>8430,'clay'=>9610,'iron'=>9235,'crop'=>1870,'time'=>83124),array('wood'=>8945,'clay'=>10200,'iron'=>9800,'crop'=>1980,'time'=>88201),array('wood'=>9455,'clay'=>10780,'iron'=>10355,'crop'=>2095,'time'=>93206),array('wood'=>9955,'clay'=>11350,'iron'=>10905,'crop'=>2205,'time'=>98145),array('wood'=>10450,'clay'=>11915,'iron'=>11445,'crop'=>2315,'time'=>103022),array('wood'=>10940,'clay'=>12470,'iron'=>11980,'crop'=>2425,'time'=>107842),array('wood'=>11425,'clay'=>13020,'iron'=>12510,'crop'=>2530,'time'=>112609),array('wood'=>11900,'clay'=>13565,'iron'=>13035,'crop'=>2635,'time'=>117326));
$ab17=array(1=>array('wood'=>2365,'clay'=>735,'iron'=>885,'crop'=>215,'time'=>14400),array('wood'=>4120,'clay'=>1275,'iron'=>1540,'crop'=>375,'time'=>25072),array('wood'=>5700,'clay'=>1765,'iron'=>2125,'crop'=>520,'time'=>34678),array('wood'=>7175,'clay'=>2225,'iron'=>2680,'crop'=>655,'time'=>43653),array('wood'=>8575,'clay'=>2660,'iron'=>3200,'crop'=>785,'time'=>52184),array('wood'=>9925,'clay'=>3075,'iron'=>3705,'crop'=>910,'time'=>60379),array('wood'=>11225,'clay'=>3480,'iron'=>4190,'crop'=>1030,'time'=>68303),array('wood'=>12490,'clay'=>3870,'iron'=>4660,'crop'=>1145,'time'=>76004),array('wood'=>13725,'clay'=>4255,'iron'=>5125,'crop'=>1255,'time'=>83513),array('wood'=>14935,'clay'=>4625,'iron'=>5575,'crop'=>1365,'time'=>90858),array('wood'=>16115,'clay'=>4995,'iron'=>6015,'crop'=>1475,'time'=>98057),array('wood'=>17280,'clay'=>5355,'iron'=>6450,'crop'=>1580,'time'=>105125),array('wood'=>18420,'clay'=>5710,'iron'=>6875,'crop'=>1685,'time'=>112077),array('wood'=>19545,'clay'=>6055,'iron'=>7295,'crop'=>1790,'time'=>118923),array('wood'=>20655,'clay'=>6400,'iron'=>7710,'crop'=>1890,'time'=>125671),array('wood'=>21750,'clay'=>6740,'iron'=>8115,'crop'=>1990,'time'=>132330),array('wood'=>22830,'clay'=>7075,'iron'=>8520,'crop'=>2090,'time'=>138906),array('wood'=>23900,'clay'=>7405,'iron'=>8920,'crop'=>2190,'time'=>145405),array('wood'=>24955,'clay'=>7730,'iron'=>9315,'crop'=>2285,'time'=>151833),array('wood'=>26000,'clay'=>8055,'iron'=>9705,'crop'=>2380,'time'=>158193));
$ab18=array(1=>array('wood'=>1065,'clay'=>1415,'iron'=>735,'crop'=>95,'time'=>28800),array('wood'=>1855,'clay'=>2465,'iron'=>1275,'crop'=>170,'time'=>50144),array('wood'=>2570,'clay'=>3410,'iron'=>1765,'crop'=>235,'time'=>69357),array('wood'=>3235,'clay'=>4295,'iron'=>2225,'crop'=>295,'time'=>87305),array('wood'=>3865,'clay'=>5135,'iron'=>2660,'crop'=>350,'time'=>104368),array('wood'=>4470,'clay'=>5940,'iron'=>3075,'crop'=>405,'time'=>120757),array('wood'=>5060,'clay'=>6720,'iron'=>3480,'crop'=>460,'time'=>136606),array('wood'=>5630,'clay'=>7475,'iron'=>3870,'crop'=>510,'time'=>152007),array('wood'=>6185,'clay'=>8215,'iron'=>4255,'crop'=>560,'time'=>167027),array('wood'=>6730,'clay'=>8940,'iron'=>4625,'crop'=>610,'time'=>181716),array('wood'=>7265,'clay'=>9645,'iron'=>4995,'crop'=>660,'time'=>196113),array('wood'=>7785,'clay'=>10340,'iron'=>5355,'crop'=>705,'time'=>210251),array('wood'=>8300,'clay'=>11025,'iron'=>5710,'crop'=>750,'time'=>224154),array('wood'=>8810,'clay'=>11700,'iron'=>6055,'crop'=>800,'time'=>237845),array('wood'=>9310,'clay'=>12365,'iron'=>6400,'crop'=>845,'time'=>251342),array('wood'=>9800,'clay'=>13020,'iron'=>6740,'crop'=>890,'time'=>264660),array('wood'=>10290,'clay'=>13665,'iron'=>7075,'crop'=>930,'time'=>277812),array('wood'=>10770,'clay'=>14305,'iron'=>7405,'crop'=>975,'time'=>290811),array('wood'=>11245,'clay'=>14935,'iron'=>7730,'crop'=>1020,'time'=>303665),array('wood'=>11720,'clay'=>15565,'iron'=>8055,'crop'=>1060,'time'=>316385));
$ab21=array(1=>array('wood'=>800,'clay'=>1010,'iron'=>585,'crop'=>370,'time'=>4920),array('wood'=>1395,'clay'=>1760,'iron'=>1020,'crop'=>645,'time'=>8566),array('wood'=>1925,'clay'=>2430,'iron'=>1410,'crop'=>890,'time'=>11848),array('wood'=>2425,'clay'=>3060,'iron'=>1775,'crop'=>1120,'time'=>14915),array('wood'=>2900,'clay'=>3660,'iron'=>2120,'crop'=>1340,'time'=>17830),array('wood'=>3355,'clay'=>4235,'iron'=>2455,'crop'=>1550,'time'=>20629),array('wood'=>3795,'clay'=>4790,'iron'=>2775,'crop'=>1755,'time'=>23337),array('wood'=>4220,'clay'=>5330,'iron'=>3090,'crop'=>1955,'time'=>25968),array('wood'=>4640,'clay'=>5860,'iron'=>3395,'crop'=>2145,'time'=>28534),array('wood'=>5050,'clay'=>6375,'iron'=>3690,'crop'=>2335,'time'=>31043),array('wood'=>5450,'clay'=>6880,'iron'=>3985,'crop'=>2520,'time'=>33503),array('wood'=>5840,'clay'=>7375,'iron'=>4270,'crop'=>2700,'time'=>35918),array('wood'=>6225,'clay'=>7860,'iron'=>4555,'crop'=>2880,'time'=>38293),array('wood'=>6605,'clay'=>8340,'iron'=>4830,'crop'=>3055,'time'=>40632),array('wood'=>6980,'clay'=>8815,'iron'=>5105,'crop'=>3230,'time'=>42938),array('wood'=>7350,'clay'=>9280,'iron'=>5375,'crop'=>3400,'time'=>45213),array('wood'=>7715,'clay'=>9745,'iron'=>5645,'crop'=>3570,'time'=>47460),array('wood'=>8080,'clay'=>10200,'iron'=>5905,'crop'=>3735,'time'=>49680),array('wood'=>8435,'clay'=>10650,'iron'=>6170,'crop'=>3900,'time'=>51876),array('wood'=>8790,'clay'=>11095,'iron'=>6425,'crop'=>4065,'time'=>54049));
$ab22=array(1=>array('wood'=>1080,'clay'=>1150,'iron'=>1495,'crop'=>580,'time'=>6120),array('wood'=>1880,'clay'=>2000,'iron'=>2605,'crop'=>1010,'time'=>10656),array('wood'=>2600,'clay'=>2770,'iron'=>3600,'crop'=>1395,'time'=>14738),array('wood'=>3275,'clay'=>3485,'iron'=>4530,'crop'=>1760,'time'=>18552),array('wood'=>3915,'clay'=>4165,'iron'=>5420,'crop'=>2100,'time'=>22178),array('wood'=>4530,'clay'=>4820,'iron'=>6270,'crop'=>2430,'time'=>25661),array('wood'=>5125,'clay'=>5455,'iron'=>7090,'crop'=>2750,'time'=>29029),array('wood'=>5700,'clay'=>6070,'iron'=>7890,'crop'=>3060,'time'=>32302),array('wood'=>6265,'clay'=>6670,'iron'=>8670,'crop'=>3365,'time'=>35493),array('wood'=>6815,'clay'=>7255,'iron'=>9435,'crop'=>3660,'time'=>38615),array('wood'=>7355,'clay'=>7830,'iron'=>10180,'crop'=>3950,'time'=>41674),array('wood'=>7885,'clay'=>8395,'iron'=>10915,'crop'=>4235,'time'=>44678),array('wood'=>8405,'clay'=>8950,'iron'=>11635,'crop'=>4515,'time'=>47633),array('wood'=>8920,'clay'=>9495,'iron'=>12345,'crop'=>4790,'time'=>50542),array('wood'=>9425,'clay'=>10035,'iron'=>13045,'crop'=>5060,'time'=>53410),array('wood'=>9925,'clay'=>10570,'iron'=>13740,'crop'=>5330,'time'=>56240),array('wood'=>10420,'clay'=>11095,'iron'=>14420,'crop'=>5595,'time'=>59035),array('wood'=>10905,'clay'=>11610,'iron'=>15095,'crop'=>5855,'time'=>61797),array('wood'=>11385,'clay'=>12125,'iron'=>15765,'crop'=>6115,'time'=>64529),array('wood'=>11865,'clay'=>12635,'iron'=>16425,'crop'=>6370,'time'=>67232));
$ab23=array(1=>array('wood'=>645,'clay'=>575,'iron'=>170,'crop'=>220,'time'=>5880),array('wood'=>1125,'clay'=>1000,'iron'=>295,'crop'=>385,'time'=>10238),array('wood'=>1555,'clay'=>1385,'iron'=>410,'crop'=>530,'time'=>14160),array('wood'=>1955,'clay'=>1745,'iron'=>515,'crop'=>665,'time'=>17825),array('wood'=>2335,'clay'=>2085,'iron'=>615,'crop'=>795,'time'=>21309),array('wood'=>2705,'clay'=>2410,'iron'=>715,'crop'=>920,'time'=>24655),array('wood'=>3060,'clay'=>2725,'iron'=>805,'crop'=>1045,'time'=>27890),array('wood'=>3405,'clay'=>3035,'iron'=>895,'crop'=>1160,'time'=>31035),array('wood'=>3740,'clay'=>3335,'iron'=>985,'crop'=>1275,'time'=>34101),array('wood'=>4070,'clay'=>3630,'iron'=>1075,'crop'=>1390,'time'=>37100),array('wood'=>4390,'clay'=>3915,'iron'=>1160,'crop'=>1500,'time'=>40040),array('wood'=>4710,'clay'=>4200,'iron'=>1240,'crop'=>1605,'time'=>42926),array('wood'=>5020,'clay'=>4475,'iron'=>1325,'crop'=>1710,'time'=>45765),array('wood'=>5325,'clay'=>4750,'iron'=>1405,'crop'=>1815,'time'=>48560),array('wood'=>5630,'clay'=>5020,'iron'=>1485,'crop'=>1920,'time'=>51316),array('wood'=>5925,'clay'=>5285,'iron'=>1560,'crop'=>2020,'time'=>54035),array('wood'=>6220,'clay'=>5545,'iron'=>1640,'crop'=>2120,'time'=>56720),array('wood'=>6515,'clay'=>5805,'iron'=>1715,'crop'=>2220,'time'=>59374),array('wood'=>6800,'clay'=>6065,'iron'=>1790,'crop'=>2320,'time'=>61998),array('wood'=>7085,'clay'=>6315,'iron'=>1870,'crop'=>2415,'time'=>64595));
$ab24=array(1=>array('wood'=>1275,'clay'=>1625,'iron'=>905,'crop'=>290,'time'=>9240),array('wood'=>2220,'clay'=>2830,'iron'=>1575,'crop'=>505,'time'=>16088),array('wood'=>3070,'clay'=>3915,'iron'=>2180,'crop'=>700,'time'=>22252),array('wood'=>3865,'clay'=>4925,'iron'=>2745,'crop'=>880,'time'=>28010),array('wood'=>4620,'clay'=>5890,'iron'=>3280,'crop'=>1050,'time'=>33485),array('wood'=>5345,'clay'=>6815,'iron'=>3795,'crop'=>1215,'time'=>38743),array('wood'=>6050,'clay'=>7710,'iron'=>4295,'crop'=>1375,'time'=>43828),array('wood'=>6730,'clay'=>8575,'iron'=>4775,'crop'=>1530,'time'=>48769),array('wood'=>7395,'clay'=>9425,'iron'=>5250,'crop'=>1680,'time'=>53588),array('wood'=>8045,'clay'=>10255,'iron'=>5710,'crop'=>1830,'time'=>58300),array('wood'=>8680,'clay'=>11065,'iron'=>6165,'crop'=>1975,'time'=>62920),array('wood'=>9310,'clay'=>11865,'iron'=>6605,'crop'=>2115,'time'=>67455),array('wood'=>9925,'clay'=>12650,'iron'=>7045,'crop'=>2255,'time'=>71916),array('wood'=>10530,'clay'=>13420,'iron'=>7475,'crop'=>2395,'time'=>76309),array('wood'=>11125,'clay'=>14180,'iron'=>7900,'crop'=>2530,'time'=>80639),array('wood'=>11715,'clay'=>14935,'iron'=>8315,'crop'=>2665,'time'=>84912),array('wood'=>12300,'clay'=>15675,'iron'=>8730,'crop'=>2795,'time'=>89131),array('wood'=>12875,'clay'=>16410,'iron'=>9140,'crop'=>2930,'time'=>93302),array('wood'=>13445,'clay'=>17135,'iron'=>9540,'crop'=>3060,'time'=>97426),array('wood'=>14005,'clay'=>17850,'iron'=>9940,'crop'=>3185,'time'=>101507));
$ab25=array(1=>array('wood'=>1310,'clay'=>1205,'iron'=>1080,'crop'=>500,'time'=>9480),array('wood'=>2280,'clay'=>2100,'iron'=>1880,'crop'=>870,'time'=>16506),array('wood'=>3155,'clay'=>2900,'iron'=>2600,'crop'=>1205,'time'=>22830),array('wood'=>3970,'clay'=>3655,'iron'=>3275,'crop'=>1515,'time'=>28738),array('wood'=>4745,'clay'=>4365,'iron'=>3915,'crop'=>1810,'time'=>34355),array('wood'=>5495,'clay'=>5055,'iron'=>4530,'crop'=>2095,'time'=>39749),array('wood'=>6215,'clay'=>5715,'iron'=>5125,'crop'=>2370,'time'=>44966),array('wood'=>6915,'clay'=>6360,'iron'=>5700,'crop'=>2640,'time'=>50036),array('wood'=>7595,'clay'=>6990,'iron'=>6265,'crop'=>2900,'time'=>54980),array('wood'=>8265,'clay'=>7605,'iron'=>6815,'crop'=>3155,'time'=>59815),array('wood'=>8920,'clay'=>8205,'iron'=>7355,'crop'=>3405,'time'=>64554),array('wood'=>9565,'clay'=>8795,'iron'=>7885,'crop'=>3650,'time'=>69208),array('wood'=>10195,'clay'=>9380,'iron'=>8405,'crop'=>3890,'time'=>73784),array('wood'=>10820,'clay'=>9950,'iron'=>8920,'crop'=>4130,'time'=>78291),array('wood'=>11435,'clay'=>10515,'iron'=>9425,'crop'=>4365,'time'=>82733),array('wood'=>12040,'clay'=>11075,'iron'=>9925,'crop'=>4595,'time'=>87117),array('wood'=>12635,'clay'=>11625,'iron'=>10420,'crop'=>4825,'time'=>91447),array('wood'=>13230,'clay'=>12170,'iron'=>10905,'crop'=>5050,'time'=>95725),array('wood'=>13815,'clay'=>12705,'iron'=>11385,'crop'=>5270,'time'=>99957),array('wood'=>14390,'clay'=>13240,'iron'=>11865,'crop'=>5495,'time'=>104144));
$ab26=array(1=>array('wood'=>1200,'clay'=>1480,'iron'=>1640,'crop'=>450,'time'=>11160),array('wood'=>2090,'clay'=>2575,'iron'=>2860,'crop'=>785,'time'=>19431),array('wood'=>2890,'clay'=>3565,'iron'=>3955,'crop'=>1085,'time'=>26876),array('wood'=>3640,'clay'=>4485,'iron'=>4975,'crop'=>1365,'time'=>33831),array('wood'=>4350,'clay'=>5365,'iron'=>5950,'crop'=>1630,'time'=>40443),array('wood'=>5030,'clay'=>6205,'iron'=>6885,'crop'=>1885,'time'=>46793),array('wood'=>5690,'clay'=>7020,'iron'=>7785,'crop'=>2135,'time'=>52935),array('wood'=>6335,'clay'=>7810,'iron'=>8665,'crop'=>2375,'time'=>58903),array('wood'=>6960,'clay'=>8585,'iron'=>9520,'crop'=>2610,'time'=>64723),array('wood'=>7570,'clay'=>9340,'iron'=>10360,'crop'=>2840,'time'=>70415),array('wood'=>8170,'clay'=>10080,'iron'=>11180,'crop'=>3065,'time'=>75994),array('wood'=>8760,'clay'=>10805,'iron'=>11985,'crop'=>3285,'time'=>81472),array('wood'=>9340,'clay'=>11520,'iron'=>12775,'crop'=>3500,'time'=>86860),array('wood'=>9910,'clay'=>12225,'iron'=>13560,'crop'=>3715,'time'=>92165),array('wood'=>10475,'clay'=>12915,'iron'=>14325,'crop'=>3925,'time'=>97395),array('wood'=>11030,'clay'=>13600,'iron'=>15085,'crop'=>4135,'time'=>102556),array('wood'=>11575,'clay'=>14275,'iron'=>15835,'crop'=>4340,'time'=>107652),array('wood'=>12115,'clay'=>14945,'iron'=>16575,'crop'=>4545,'time'=>112689),array('wood'=>12655,'clay'=>15605,'iron'=>17310,'crop'=>4745,'time'=>117670),array('wood'=>13185,'clay'=>16260,'iron'=>18035,'crop'=>4945,'time'=>122599));
$ab27=array(1=>array('wood'=>2250,'clay'=>1330,'iron'=>835,'crop'=>230,'time'=>16800),array('wood'=>3915,'clay'=>2315,'iron'=>1455,'crop'=>400,'time'=>29250),array('wood'=>5420,'clay'=>3200,'iron'=>2015,'crop'=>550,'time'=>40458),array('wood'=>6820,'clay'=>4025,'iron'=>2535,'crop'=>690,'time'=>50928),array('wood'=>8155,'clay'=>4815,'iron'=>3030,'crop'=>825,'time'=>60881),array('wood'=>9435,'clay'=>5570,'iron'=>3510,'crop'=>955,'time'=>70442),array('wood'=>10670,'clay'=>6300,'iron'=>3970,'crop'=>1085,'time'=>79687),array('wood'=>11875,'clay'=>7010,'iron'=>4415,'crop'=>1205,'time'=>88671),array('wood'=>13050,'clay'=>7705,'iron'=>4850,'crop'=>1325,'time'=>97432),array('wood'=>14195,'clay'=>8380,'iron'=>5280,'crop'=>1440,'time'=>106001),array('wood'=>15320,'clay'=>9045,'iron'=>5695,'crop'=>1555,'time'=>114399),array('wood'=>16425,'clay'=>9695,'iron'=>6110,'crop'=>1665,'time'=>122646),array('wood'=>17510,'clay'=>10340,'iron'=>6510,'crop'=>1775,'time'=>130757),array('wood'=>18580,'clay'=>10970,'iron'=>6910,'crop'=>1885,'time'=>138743),array('wood'=>19635,'clay'=>11595,'iron'=>7300,'crop'=>1995,'time'=>146616),array('wood'=>20675,'clay'=>12205,'iron'=>7690,'crop'=>2100,'time'=>154385),array('wood'=>21705,'clay'=>12815,'iron'=>8070,'crop'=>2205,'time'=>162057),array('wood'=>22720,'clay'=>13415,'iron'=>8450,'crop'=>2305,'time'=>169640),array('wood'=>23725,'clay'=>14005,'iron'=>8820,'crop'=>2410,'time'=>177138),array('wood'=>24720,'clay'=>14595,'iron'=>9190,'crop'=>2510,'time'=>184558));
$ab28=array(1=>array('wood'=>1135,'clay'=>1710,'iron'=>770,'crop'=>130,'time'=>28800),array('wood'=>1980,'clay'=>2975,'iron'=>1340,'crop'=>230,'time'=>50144),array('wood'=>2735,'clay'=>4115,'iron'=>1850,'crop'=>315,'time'=>69357),array('wood'=>3445,'clay'=>5180,'iron'=>2330,'crop'=>400,'time'=>87305),array('wood'=>4120,'clay'=>6190,'iron'=>2785,'crop'=>475,'time'=>104368),array('wood'=>4765,'clay'=>7165,'iron'=>3220,'crop'=>550,'time'=>120757),array('wood'=>5390,'clay'=>8105,'iron'=>3645,'crop'=>625,'time'=>136606),array('wood'=>6000,'clay'=>9015,'iron'=>4055,'crop'=>695,'time'=>152007),array('wood'=>6590,'clay'=>9910,'iron'=>4455,'crop'=>765,'time'=>167027),array('wood'=>7170,'clay'=>10780,'iron'=>4850,'crop'=>830,'time'=>181716),array('wood'=>7740,'clay'=>11635,'iron'=>5230,'crop'=>895,'time'=>196113),array('wood'=>8300,'clay'=>12470,'iron'=>5610,'crop'=>960,'time'=>210251),array('wood'=>8845,'clay'=>13295,'iron'=>5980,'crop'=>1025,'time'=>224154),array('wood'=>9385,'clay'=>14110,'iron'=>6345,'crop'=>1085,'time'=>237845),array('wood'=>9920,'clay'=>14910,'iron'=>6705,'crop'=>1150,'time'=>251342),array('wood'=>10445,'clay'=>15700,'iron'=>7060,'crop'=>1210,'time'=>264660),array('wood'=>10965,'clay'=>16480,'iron'=>7410,'crop'=>1270,'time'=>277812),array('wood'=>11480,'clay'=>17250,'iron'=>7760,'crop'=>1330,'time'=>290811),array('wood'=>11985,'clay'=>18015,'iron'=>8100,'crop'=>1390,'time'=>303665),array('wood'=>12485,'clay'=>18765,'iron'=>8440,'crop'=>1445,'time'=>316385));
$ab31=array(1=>array('wood'=>765,'clay'=>625,'iron'=>480,'crop'=>440,'time'=>3960),array('wood'=>1330,'clay'=>1090,'iron'=>835,'crop'=>765,'time'=>6895),array('wood'=>1840,'clay'=>1505,'iron'=>1155,'crop'=>1060,'time'=>9537),array('wood'=>2320,'clay'=>1895,'iron'=>1455,'crop'=>1335,'time'=>12004),array('wood'=>2770,'clay'=>2265,'iron'=>1740,'crop'=>1595,'time'=>14351),array('wood'=>3210,'clay'=>2620,'iron'=>2015,'crop'=>1845,'time'=>16604),array('wood'=>3630,'clay'=>2965,'iron'=>2275,'crop'=>2085,'time'=>18783),array('wood'=>4040,'clay'=>3300,'iron'=>2535,'crop'=>2320,'time'=>20901),array('wood'=>4435,'clay'=>3625,'iron'=>2785,'crop'=>2550,'time'=>22966),array('wood'=>4825,'clay'=>3945,'iron'=>3030,'crop'=>2775,'time'=>24986),array('wood'=>5210,'clay'=>4255,'iron'=>3270,'crop'=>2995,'time'=>26966),array('wood'=>5585,'clay'=>4565,'iron'=>3505,'crop'=>3210,'time'=>28909),array('wood'=>5955,'clay'=>4865,'iron'=>3735,'crop'=>3425,'time'=>30821),array('wood'=>6320,'clay'=>5160,'iron'=>3965,'crop'=>3635,'time'=>32704),array('wood'=>6675,'clay'=>5455,'iron'=>4190,'crop'=>3840,'time'=>34560),array('wood'=>7030,'clay'=>5745,'iron'=>4410,'crop'=>4045,'time'=>36391),array('wood'=>7380,'clay'=>6030,'iron'=>4630,'crop'=>4245,'time'=>38199),array('wood'=>7725,'clay'=>6310,'iron'=>4845,'crop'=>4445,'time'=>39986),array('wood'=>8065,'clay'=>6590,'iron'=>5060,'crop'=>4640,'time'=>41754),array('wood'=>8405,'clay'=>6865,'iron'=>5275,'crop'=>4835,'time'=>43503));
$ab32=array(1=>array('wood'=>1115,'clay'=>590,'iron'=>795,'crop'=>440,'time'=>5160),array('wood'=>1940,'clay'=>1025,'iron'=>1385,'crop'=>765,'time'=>8984),array('wood'=>2685,'clay'=>1420,'iron'=>1915,'crop'=>1060,'time'=>12426),array('wood'=>3380,'clay'=>1790,'iron'=>2410,'crop'=>1335,'time'=>15642),array('wood'=>4040,'clay'=>2140,'iron'=>2880,'crop'=>1595,'time'=>18699),array('wood'=>4675,'clay'=>2475,'iron'=>3335,'crop'=>1845,'time'=>21636),array('wood'=>5290,'clay'=>2800,'iron'=>3770,'crop'=>2085,'time'=>24475),array('wood'=>5885,'clay'=>3115,'iron'=>4195,'crop'=>2320,'time'=>27235),array('wood'=>6465,'clay'=>3420,'iron'=>4610,'crop'=>2550,'time'=>29926),array('wood'=>7035,'clay'=>3725,'iron'=>5015,'crop'=>2775,'time'=>32557),array('wood'=>7595,'clay'=>4020,'iron'=>5415,'crop'=>2995,'time'=>35137),array('wood'=>8140,'clay'=>4305,'iron'=>5805,'crop'=>3210,'time'=>37670),array('wood'=>8680,'clay'=>4590,'iron'=>6190,'crop'=>3425,'time'=>40161),array('wood'=>9210,'clay'=>4875,'iron'=>6565,'crop'=>3635,'time'=>42614),array('wood'=>9730,'clay'=>5150,'iron'=>6940,'crop'=>3840,'time'=>45032),array('wood'=>10245,'clay'=>5420,'iron'=>7305,'crop'=>4045,'time'=>47418),array('wood'=>10755,'clay'=>5690,'iron'=>7670,'crop'=>4245,'time'=>49775),array('wood'=>11260,'clay'=>5960,'iron'=>8030,'crop'=>4445,'time'=>52104),array('wood'=>11755,'clay'=>6220,'iron'=>8380,'crop'=>4640,'time'=>54407),array('wood'=>12250,'clay'=>6480,'iron'=>8735,'crop'=>4835,'time'=>56686));
$ab33=array(1=>array('wood'=>1010,'clay'=>940,'iron'=>1390,'crop'=>650,'time'=>5400),array('wood'=>1760,'clay'=>1635,'iron'=>2420,'crop'=>1130,'time'=>9402),array('wood'=>2430,'clay'=>2265,'iron'=>3345,'crop'=>1565,'time'=>13004),array('wood'=>3060,'clay'=>2850,'iron'=>4215,'crop'=>1970,'time'=>16370),array('wood'=>3660,'clay'=>3405,'iron'=>5035,'crop'=>2355,'time'=>19569),array('wood'=>4235,'clay'=>3940,'iron'=>5830,'crop'=>2725,'time'=>22642),array('wood'=>4790,'clay'=>4460,'iron'=>6595,'crop'=>3085,'time'=>25614),array('wood'=>5330,'clay'=>4960,'iron'=>7335,'crop'=>3430,'time'=>28501),array('wood'=>5860,'clay'=>5450,'iron'=>8060,'crop'=>3770,'time'=>31318),array('wood'=>6375,'clay'=>5930,'iron'=>8770,'crop'=>4100,'time'=>34072),array('wood'=>6880,'clay'=>6400,'iron'=>9465,'crop'=>4425,'time'=>36771),array('wood'=>7375,'clay'=>6860,'iron'=>10150,'crop'=>4745,'time'=>39422),array('wood'=>7860,'clay'=>7315,'iron'=>10820,'crop'=>5060,'time'=>42029),array('wood'=>8340,'clay'=>7765,'iron'=>11480,'crop'=>5370,'time'=>44596),array('wood'=>8815,'clay'=>8205,'iron'=>12130,'crop'=>5675,'time'=>47127),array('wood'=>9280,'clay'=>8640,'iron'=>12775,'crop'=>5975,'time'=>49624),array('wood'=>9745,'clay'=>9065,'iron'=>13410,'crop'=>6270,'time'=>52090),array('wood'=>10200,'clay'=>9490,'iron'=>14035,'crop'=>6565,'time'=>54527),array('wood'=>10650,'clay'=>9910,'iron'=>14655,'crop'=>6855,'time'=>56937),array('wood'=>11095,'clay'=>10325,'iron'=>15270,'crop'=>7140,'time'=>59322));
$ab34=array(1=>array('wood'=>1220,'clay'=>800,'iron'=>550,'crop'=>510,'time'=>5160),array('wood'=>2125,'clay'=>1395,'iron'=>960,'crop'=>890,'time'=>8984),array('wood'=>2940,'clay'=>1925,'iron'=>1325,'crop'=>1230,'time'=>12426),array('wood'=>3700,'clay'=>2425,'iron'=>1665,'crop'=>1545,'time'=>15642),array('wood'=>4420,'clay'=>2900,'iron'=>1995,'crop'=>1850,'time'=>18699),array('wood'=>5115,'clay'=>3355,'iron'=>2305,'crop'=>2140,'time'=>21636),array('wood'=>5785,'clay'=>3795,'iron'=>2610,'crop'=>2420,'time'=>24475),array('wood'=>6440,'clay'=>4220,'iron'=>2905,'crop'=>2690,'time'=>27235),array('wood'=>7075,'clay'=>4640,'iron'=>3190,'crop'=>2960,'time'=>29926),array('wood'=>7700,'clay'=>5050,'iron'=>3470,'crop'=>3220,'time'=>32557),array('wood'=>8310,'clay'=>5450,'iron'=>3745,'crop'=>3475,'time'=>35137),array('wood'=>8905,'clay'=>5840,'iron'=>4015,'crop'=>3725,'time'=>37670),array('wood'=>9495,'clay'=>6225,'iron'=>4280,'crop'=>3970,'time'=>40161),array('wood'=>10075,'clay'=>6605,'iron'=>4540,'crop'=>4210,'time'=>42614),array('wood'=>10645,'clay'=>6980,'iron'=>4800,'crop'=>4450,'time'=>45032),array('wood'=>11210,'clay'=>7350,'iron'=>5055,'crop'=>4685,'time'=>47418),array('wood'=>11770,'clay'=>7715,'iron'=>5305,'crop'=>4920,'time'=>49775),array('wood'=>12320,'clay'=>8080,'iron'=>5555,'crop'=>5150,'time'=>52104),array('wood'=>12865,'clay'=>8435,'iron'=>5800,'crop'=>5375,'time'=>54407),array('wood'=>13400,'clay'=>8790,'iron'=>6040,'crop'=>5605,'time'=>56686));
$ab35=array(1=>array('wood'=>1345,'clay'=>995,'iron'=>1115,'crop'=>345,'time'=>9000),array('wood'=>2340,'clay'=>1730,'iron'=>1940,'crop'=>595,'time'=>15670),array('wood'=>3240,'clay'=>2395,'iron'=>2685,'crop'=>825,'time'=>21674),array('wood'=>4075,'clay'=>3015,'iron'=>3380,'crop'=>1040,'time'=>27283),array('wood'=>4875,'clay'=>3605,'iron'=>4040,'crop'=>1240,'time'=>32615),array('wood'=>5640,'clay'=>4170,'iron'=>4675,'crop'=>1435,'time'=>37737),array('wood'=>6380,'clay'=>4720,'iron'=>5290,'crop'=>1625,'time'=>42689),array('wood'=>7100,'clay'=>5250,'iron'=>5885,'crop'=>1810,'time'=>47502),array('wood'=>7800,'clay'=>5770,'iron'=>6465,'crop'=>1985,'time'=>52196),array('wood'=>8485,'clay'=>6280,'iron'=>7035,'crop'=>2160,'time'=>56786),array('wood'=>9160,'clay'=>6775,'iron'=>7595,'crop'=>2330,'time'=>61285),array('wood'=>9820,'clay'=>7265,'iron'=>8140,'crop'=>2500,'time'=>65703),array('wood'=>10470,'clay'=>7745,'iron'=>8680,'crop'=>2665,'time'=>70048),array('wood'=>11110,'clay'=>8215,'iron'=>9210,'crop'=>2830,'time'=>74327),array('wood'=>11740,'clay'=>8685,'iron'=>9730,'crop'=>2990,'time'=>78544),array('wood'=>12360,'clay'=>9145,'iron'=>10245,'crop'=>3145,'time'=>82706),array('wood'=>12975,'clay'=>9600,'iron'=>10755,'crop'=>3305,'time'=>86816),array('wood'=>13580,'clay'=>10045,'iron'=>11260,'crop'=>3460,'time'=>90878),array('wood'=>14180,'clay'=>10490,'iron'=>11755,'crop'=>3610,'time'=>94895),array('wood'=>14775,'clay'=>10930,'iron'=>12250,'crop'=>3765,'time'=>98870));
$ab36=array(1=>array('wood'=>1085,'clay'=>1235,'iron'=>1185,'crop'=>240,'time'=>10680),array('wood'=>1885,'clay'=>2150,'iron'=>2065,'crop'=>420,'time'=>18595),array('wood'=>2610,'clay'=>2975,'iron'=>2860,'crop'=>580,'time'=>25720),array('wood'=>3285,'clay'=>3745,'iron'=>3595,'crop'=>730,'time'=>32376),array('wood'=>3925,'clay'=>4475,'iron'=>4300,'crop'=>870,'time'=>38703),array('wood'=>4540,'clay'=>5180,'iron'=>4975,'crop'=>1005,'time'=>44781),array('wood'=>5140,'clay'=>5860,'iron'=>5630,'crop'=>1140,'time'=>50658),array('wood'=>5720,'clay'=>6520,'iron'=>6265,'crop'=>1265,'time'=>56369),array('wood'=>6285,'clay'=>7160,'iron'=>6880,'crop'=>1390,'time'=>61939),array('wood'=>6835,'clay'=>7790,'iron'=>7485,'crop'=>1515,'time'=>67386),array('wood'=>7375,'clay'=>8410,'iron'=>8080,'crop'=>1635,'time'=>72725),array('wood'=>7910,'clay'=>9015,'iron'=>8665,'crop'=>1750,'time'=>77968),array('wood'=>8430,'clay'=>9610,'iron'=>9235,'crop'=>1870,'time'=>83124),array('wood'=>8945,'clay'=>10200,'iron'=>9800,'crop'=>1980,'time'=>88201),array('wood'=>9455,'clay'=>10780,'iron'=>10355,'crop'=>2095,'time'=>93206),array('wood'=>9955,'clay'=>11350,'iron'=>10905,'crop'=>2205,'time'=>98145),array('wood'=>10450,'clay'=>11915,'iron'=>11445,'crop'=>2315,'time'=>103022),array('wood'=>10940,'clay'=>12470,'iron'=>11980,'crop'=>2425,'time'=>107842),array('wood'=>11425,'clay'=>13020,'iron'=>12510,'crop'=>2530,'time'=>112609),array('wood'=>11900,'clay'=>13565,'iron'=>13035,'crop'=>2635,'time'=>117326));
$ab37=array(1=>array('wood'=>2365,'clay'=>735,'iron'=>885,'crop'=>215,'time'=>14400),array('wood'=>4120,'clay'=>1275,'iron'=>1540,'crop'=>375,'time'=>25072),array('wood'=>5700,'clay'=>1765,'iron'=>2125,'crop'=>520,'time'=>34678),array('wood'=>7175,'clay'=>2225,'iron'=>2680,'crop'=>655,'time'=>43653),array('wood'=>8575,'clay'=>2660,'iron'=>3200,'crop'=>785,'time'=>52184),array('wood'=>9925,'clay'=>3075,'iron'=>3705,'crop'=>910,'time'=>60379),array('wood'=>11225,'clay'=>3480,'iron'=>4190,'crop'=>1030,'time'=>68303),array('wood'=>12490,'clay'=>3870,'iron'=>4660,'crop'=>1145,'time'=>76004),array('wood'=>13725,'clay'=>4255,'iron'=>5125,'crop'=>1255,'time'=>83513),array('wood'=>14935,'clay'=>4625,'iron'=>5575,'crop'=>1365,'time'=>90858),array('wood'=>16115,'clay'=>4995,'iron'=>6015,'crop'=>1475,'time'=>98057),array('wood'=>17280,'clay'=>5355,'iron'=>6450,'crop'=>1580,'time'=>105125),array('wood'=>18420,'clay'=>5710,'iron'=>6875,'crop'=>1685,'time'=>112077),array('wood'=>19545,'clay'=>6055,'iron'=>7295,'crop'=>1790,'time'=>118923),array('wood'=>20655,'clay'=>6400,'iron'=>7710,'crop'=>1890,'time'=>125671),array('wood'=>21750,'clay'=>6740,'iron'=>8115,'crop'=>1990,'time'=>132330),array('wood'=>22830,'clay'=>7075,'iron'=>8520,'crop'=>2090,'time'=>138906),array('wood'=>23900,'clay'=>7405,'iron'=>8920,'crop'=>2190,'time'=>145405),array('wood'=>24955,'clay'=>7730,'iron'=>9315,'crop'=>2285,'time'=>151833),array('wood'=>26000,'clay'=>8055,'iron'=>9705,'crop'=>2380,'time'=>158193));
$ab38=array(1=>array('wood'=>1065,'clay'=>1415,'iron'=>735,'crop'=>95,'time'=>28800),array('wood'=>1855,'clay'=>2465,'iron'=>1275,'crop'=>170,'time'=>50144),array('wood'=>2570,'clay'=>3410,'iron'=>1765,'crop'=>235,'time'=>69357),array('wood'=>3235,'clay'=>4295,'iron'=>2225,'crop'=>295,'time'=>87305),array('wood'=>3865,'clay'=>5135,'iron'=>2660,'crop'=>350,'time'=>104368),array('wood'=>4470,'clay'=>5940,'iron'=>3075,'crop'=>405,'time'=>120757),array('wood'=>5060,'clay'=>6720,'iron'=>3480,'crop'=>460,'time'=>136606),array('wood'=>5630,'clay'=>7475,'iron'=>3870,'crop'=>510,'time'=>152007),array('wood'=>6185,'clay'=>8215,'iron'=>4255,'crop'=>560,'time'=>167027),array('wood'=>6730,'clay'=>8940,'iron'=>4625,'crop'=>610,'time'=>181716),array('wood'=>7265,'clay'=>9645,'iron'=>4995,'crop'=>660,'time'=>196113),array('wood'=>7785,'clay'=>10340,'iron'=>5355,'crop'=>705,'time'=>210251),array('wood'=>8300,'clay'=>11025,'iron'=>5710,'crop'=>750,'time'=>224154),array('wood'=>8810,'clay'=>11700,'iron'=>6055,'crop'=>800,'time'=>237845),array('wood'=>9310,'clay'=>12365,'iron'=>6400,'crop'=>845,'time'=>251342),array('wood'=>9800,'clay'=>13020,'iron'=>6740,'crop'=>890,'time'=>264660),array('wood'=>10290,'clay'=>13665,'iron'=>7075,'crop'=>930,'time'=>277812),array('wood'=>10770,'clay'=>14305,'iron'=>7405,'crop'=>975,'time'=>290811),array('wood'=>11245,'clay'=>14935,'iron'=>7730,'crop'=>1020,'time'=>303665),array('wood'=>11720,'clay'=>15565,'iron'=>8055,'crop'=>1060,'time'=>316385));
$ab41=array(1=>array('wood'=>765,'clay'=>625,'iron'=>480,'crop'=>440,'time'=>3960),array('wood'=>1330,'clay'=>1090,'iron'=>835,'crop'=>765,'time'=>6895),array('wood'=>1840,'clay'=>1505,'iron'=>1155,'crop'=>1060,'time'=>9537),array('wood'=>2320,'clay'=>1895,'iron'=>1455,'crop'=>1335,'time'=>12004),array('wood'=>2770,'clay'=>2265,'iron'=>1740,'crop'=>1595,'time'=>14351),array('wood'=>3210,'clay'=>2620,'iron'=>2015,'crop'=>1845,'time'=>16604),array('wood'=>3630,'clay'=>2965,'iron'=>2275,'crop'=>2085,'time'=>18783),array('wood'=>4040,'clay'=>3300,'iron'=>2535,'crop'=>2320,'time'=>20901),array('wood'=>4435,'clay'=>3625,'iron'=>2785,'crop'=>2550,'time'=>22966),array('wood'=>4825,'clay'=>3945,'iron'=>3030,'crop'=>2775,'time'=>24986),array('wood'=>5210,'clay'=>4255,'iron'=>3270,'crop'=>2995,'time'=>26966),array('wood'=>5585,'clay'=>4565,'iron'=>3505,'crop'=>3210,'time'=>28909),array('wood'=>5955,'clay'=>4865,'iron'=>3735,'crop'=>3425,'time'=>30821),array('wood'=>6320,'clay'=>5160,'iron'=>3965,'crop'=>3635,'time'=>32704),array('wood'=>6675,'clay'=>5455,'iron'=>4190,'crop'=>3840,'time'=>34560),array('wood'=>7030,'clay'=>5745,'iron'=>4410,'crop'=>4045,'time'=>36391),array('wood'=>7380,'clay'=>6030,'iron'=>4630,'crop'=>4245,'time'=>38199),array('wood'=>7725,'clay'=>6310,'iron'=>4845,'crop'=>4445,'time'=>39986),array('wood'=>8065,'clay'=>6590,'iron'=>5060,'crop'=>4640,'time'=>41754),array('wood'=>8405,'clay'=>6865,'iron'=>5275,'crop'=>4835,'time'=>43503));
$ab42=array(1=>array('wood'=>1115,'clay'=>590,'iron'=>795,'crop'=>440,'time'=>5160),array('wood'=>1940,'clay'=>1025,'iron'=>1385,'crop'=>765,'time'=>8984),array('wood'=>2685,'clay'=>1420,'iron'=>1915,'crop'=>1060,'time'=>12426),array('wood'=>3380,'clay'=>1790,'iron'=>2410,'crop'=>1335,'time'=>15642),array('wood'=>4040,'clay'=>2140,'iron'=>2880,'crop'=>1595,'time'=>18699),array('wood'=>4675,'clay'=>2475,'iron'=>3335,'crop'=>1845,'time'=>21636),array('wood'=>5290,'clay'=>2800,'iron'=>3770,'crop'=>2085,'time'=>24475),array('wood'=>5885,'clay'=>3115,'iron'=>4195,'crop'=>2320,'time'=>27235),array('wood'=>6465,'clay'=>3420,'iron'=>4610,'crop'=>2550,'time'=>29926),array('wood'=>7035,'clay'=>3725,'iron'=>5015,'crop'=>2775,'time'=>32557),array('wood'=>7595,'clay'=>4020,'iron'=>5415,'crop'=>2995,'time'=>35137),array('wood'=>8140,'clay'=>4305,'iron'=>5805,'crop'=>3210,'time'=>37670),array('wood'=>8680,'clay'=>4590,'iron'=>6190,'crop'=>3425,'time'=>40161),array('wood'=>9210,'clay'=>4875,'iron'=>6565,'crop'=>3635,'time'=>42614),array('wood'=>9730,'clay'=>5150,'iron'=>6940,'crop'=>3840,'time'=>45032),array('wood'=>10245,'clay'=>5420,'iron'=>7305,'crop'=>4045,'time'=>47418),array('wood'=>10755,'clay'=>5690,'iron'=>7670,'crop'=>4245,'time'=>49775),array('wood'=>11260,'clay'=>5960,'iron'=>8030,'crop'=>4445,'time'=>52104),array('wood'=>11755,'clay'=>6220,'iron'=>8380,'crop'=>4640,'time'=>54407),array('wood'=>12250,'clay'=>6480,'iron'=>8735,'crop'=>4835,'time'=>56686));
$ab43=array(1=>array('wood'=>1010,'clay'=>940,'iron'=>1390,'crop'=>650,'time'=>5400),array('wood'=>1760,'clay'=>1635,'iron'=>2420,'crop'=>1130,'time'=>9402),array('wood'=>2430,'clay'=>2265,'iron'=>3345,'crop'=>1565,'time'=>13004),array('wood'=>3060,'clay'=>2850,'iron'=>4215,'crop'=>1970,'time'=>16370),array('wood'=>3660,'clay'=>3405,'iron'=>5035,'crop'=>2355,'time'=>19569),array('wood'=>4235,'clay'=>3940,'iron'=>5830,'crop'=>2725,'time'=>22642),array('wood'=>4790,'clay'=>4460,'iron'=>6595,'crop'=>3085,'time'=>25614),array('wood'=>5330,'clay'=>4960,'iron'=>7335,'crop'=>3430,'time'=>28501),array('wood'=>5860,'clay'=>5450,'iron'=>8060,'crop'=>3770,'time'=>31318),array('wood'=>6375,'clay'=>5930,'iron'=>8770,'crop'=>4100,'time'=>34072),array('wood'=>6880,'clay'=>6400,'iron'=>9465,'crop'=>4425,'time'=>36771),array('wood'=>7375,'clay'=>6860,'iron'=>10150,'crop'=>4745,'time'=>39422),array('wood'=>7860,'clay'=>7315,'iron'=>10820,'crop'=>5060,'time'=>42029),array('wood'=>8340,'clay'=>7765,'iron'=>11480,'crop'=>5370,'time'=>44596),array('wood'=>8815,'clay'=>8205,'iron'=>12130,'crop'=>5675,'time'=>47127),array('wood'=>9280,'clay'=>8640,'iron'=>12775,'crop'=>5975,'time'=>49624),array('wood'=>9745,'clay'=>9065,'iron'=>13410,'crop'=>6270,'time'=>52090),array('wood'=>10200,'clay'=>9490,'iron'=>14035,'crop'=>6565,'time'=>54527),array('wood'=>10650,'clay'=>9910,'iron'=>14655,'crop'=>6855,'time'=>56937),array('wood'=>11095,'clay'=>10325,'iron'=>15270,'crop'=>7140,'time'=>59322));
$ab44=array(1=>array('wood'=>1220,'clay'=>800,'iron'=>550,'crop'=>510,'time'=>5160),array('wood'=>2125,'clay'=>1395,'iron'=>960,'crop'=>890,'time'=>8984),array('wood'=>2940,'clay'=>1925,'iron'=>1325,'crop'=>1230,'time'=>12426),array('wood'=>3700,'clay'=>2425,'iron'=>1665,'crop'=>1545,'time'=>15642),array('wood'=>4420,'clay'=>2900,'iron'=>1995,'crop'=>1850,'time'=>18699),array('wood'=>5115,'clay'=>3355,'iron'=>2305,'crop'=>2140,'time'=>21636),array('wood'=>5785,'clay'=>3795,'iron'=>2610,'crop'=>2420,'time'=>24475),array('wood'=>6440,'clay'=>4220,'iron'=>2905,'crop'=>2690,'time'=>27235),array('wood'=>7075,'clay'=>4640,'iron'=>3190,'crop'=>2960,'time'=>29926),array('wood'=>7700,'clay'=>5050,'iron'=>3470,'crop'=>3220,'time'=>32557),array('wood'=>8310,'clay'=>5450,'iron'=>3745,'crop'=>3475,'time'=>35137),array('wood'=>8905,'clay'=>5840,'iron'=>4015,'crop'=>3725,'time'=>37670),array('wood'=>9495,'clay'=>6225,'iron'=>4280,'crop'=>3970,'time'=>40161),array('wood'=>10075,'clay'=>6605,'iron'=>4540,'crop'=>4210,'time'=>42614),array('wood'=>10645,'clay'=>6980,'iron'=>4800,'crop'=>4450,'time'=>45032),array('wood'=>11210,'clay'=>7350,'iron'=>5055,'crop'=>4685,'time'=>47418),array('wood'=>11770,'clay'=>7715,'iron'=>5305,'crop'=>4920,'time'=>49775),array('wood'=>12320,'clay'=>8080,'iron'=>5555,'crop'=>5150,'time'=>52104),array('wood'=>12865,'clay'=>8435,'iron'=>5800,'crop'=>5375,'time'=>54407),array('wood'=>13400,'clay'=>8790,'iron'=>6040,'crop'=>5605,'time'=>56686));
$ab45=array(1=>array('wood'=>1345,'clay'=>995,'iron'=>1115,'crop'=>345,'time'=>9000),array('wood'=>2340,'clay'=>1730,'iron'=>1940,'crop'=>595,'time'=>15670),array('wood'=>3240,'clay'=>2395,'iron'=>2685,'crop'=>825,'time'=>21674),array('wood'=>4075,'clay'=>3015,'iron'=>3380,'crop'=>1040,'time'=>27283),array('wood'=>4875,'clay'=>3605,'iron'=>4040,'crop'=>1240,'time'=>32615),array('wood'=>5640,'clay'=>4170,'iron'=>4675,'crop'=>1435,'time'=>37737),array('wood'=>6380,'clay'=>4720,'iron'=>5290,'crop'=>1625,'time'=>42689),array('wood'=>7100,'clay'=>5250,'iron'=>5885,'crop'=>1810,'time'=>47502),array('wood'=>7800,'clay'=>5770,'iron'=>6465,'crop'=>1985,'time'=>52196),array('wood'=>8485,'clay'=>6280,'iron'=>7035,'crop'=>2160,'time'=>56786),array('wood'=>9160,'clay'=>6775,'iron'=>7595,'crop'=>2330,'time'=>61285),array('wood'=>9820,'clay'=>7265,'iron'=>8140,'crop'=>2500,'time'=>65703),array('wood'=>10470,'clay'=>7745,'iron'=>8680,'crop'=>2665,'time'=>70048),array('wood'=>11110,'clay'=>8215,'iron'=>9210,'crop'=>2830,'time'=>74327),array('wood'=>11740,'clay'=>8685,'iron'=>9730,'crop'=>2990,'time'=>78544),array('wood'=>12360,'clay'=>9145,'iron'=>10245,'crop'=>3145,'time'=>82706),array('wood'=>12975,'clay'=>9600,'iron'=>10755,'crop'=>3305,'time'=>86816),array('wood'=>13580,'clay'=>10045,'iron'=>11260,'crop'=>3460,'time'=>90878),array('wood'=>14180,'clay'=>10490,'iron'=>11755,'crop'=>3610,'time'=>94895),array('wood'=>14775,'clay'=>10930,'iron'=>12250,'crop'=>3765,'time'=>98870));
$ab46=array(1=>array('wood'=>1085,'clay'=>1235,'iron'=>1185,'crop'=>240,'time'=>10680),array('wood'=>1885,'clay'=>2150,'iron'=>2065,'crop'=>420,'time'=>18595),array('wood'=>2610,'clay'=>2975,'iron'=>2860,'crop'=>580,'time'=>25720),array('wood'=>3285,'clay'=>3745,'iron'=>3595,'crop'=>730,'time'=>32376),array('wood'=>3925,'clay'=>4475,'iron'=>4300,'crop'=>870,'time'=>38703),array('wood'=>4540,'clay'=>5180,'iron'=>4975,'crop'=>1005,'time'=>44781),array('wood'=>5140,'clay'=>5860,'iron'=>5630,'crop'=>1140,'time'=>50658),array('wood'=>5720,'clay'=>6520,'iron'=>6265,'crop'=>1265,'time'=>56369),array('wood'=>6285,'clay'=>7160,'iron'=>6880,'crop'=>1390,'time'=>61939),array('wood'=>6835,'clay'=>7790,'iron'=>7485,'crop'=>1515,'time'=>67386),array('wood'=>7375,'clay'=>8410,'iron'=>8080,'crop'=>1635,'time'=>72725),array('wood'=>7910,'clay'=>9015,'iron'=>8665,'crop'=>1750,'time'=>77968),array('wood'=>8430,'clay'=>9610,'iron'=>9235,'crop'=>1870,'time'=>83124),array('wood'=>8945,'clay'=>10200,'iron'=>9800,'crop'=>1980,'time'=>88201),array('wood'=>9455,'clay'=>10780,'iron'=>10355,'crop'=>2095,'time'=>93206),array('wood'=>9955,'clay'=>11350,'iron'=>10905,'crop'=>2205,'time'=>98145),array('wood'=>10450,'clay'=>11915,'iron'=>11445,'crop'=>2315,'time'=>103022),array('wood'=>10940,'clay'=>12470,'iron'=>11980,'crop'=>2425,'time'=>107842),array('wood'=>11425,'clay'=>13020,'iron'=>12510,'crop'=>2530,'time'=>112609),array('wood'=>11900,'clay'=>13565,'iron'=>13035,'crop'=>2635,'time'=>117326));
$ab47=array(1=>array('wood'=>2365,'clay'=>735,'iron'=>885,'crop'=>215,'time'=>14400),array('wood'=>4120,'clay'=>1275,'iron'=>1540,'crop'=>375,'time'=>25072),array('wood'=>5700,'clay'=>1765,'iron'=>2125,'crop'=>520,'time'=>34678),array('wood'=>7175,'clay'=>2225,'iron'=>2680,'crop'=>655,'time'=>43653),array('wood'=>8575,'clay'=>2660,'iron'=>3200,'crop'=>785,'time'=>52184),array('wood'=>9925,'clay'=>3075,'iron'=>3705,'crop'=>910,'time'=>60379),array('wood'=>11225,'clay'=>3480,'iron'=>4190,'crop'=>1030,'time'=>68303),array('wood'=>12490,'clay'=>3870,'iron'=>4660,'crop'=>1145,'time'=>76004),array('wood'=>13725,'clay'=>4255,'iron'=>5125,'crop'=>1255,'time'=>83513),array('wood'=>14935,'clay'=>4625,'iron'=>5575,'crop'=>1365,'time'=>90858),array('wood'=>16115,'clay'=>4995,'iron'=>6015,'crop'=>1475,'time'=>98057),array('wood'=>17280,'clay'=>5355,'iron'=>6450,'crop'=>1580,'time'=>105125),array('wood'=>18420,'clay'=>5710,'iron'=>6875,'crop'=>1685,'time'=>112077),array('wood'=>19545,'clay'=>6055,'iron'=>7295,'crop'=>1790,'time'=>118923),array('wood'=>20655,'clay'=>6400,'iron'=>7710,'crop'=>1890,'time'=>125671),array('wood'=>21750,'clay'=>6740,'iron'=>8115,'crop'=>1990,'time'=>132330),array('wood'=>22830,'clay'=>7075,'iron'=>8520,'crop'=>2090,'time'=>138906),array('wood'=>23900,'clay'=>7405,'iron'=>8920,'crop'=>2190,'time'=>145405),array('wood'=>24955,'clay'=>7730,'iron'=>9315,'crop'=>2285,'time'=>151833),array('wood'=>26000,'clay'=>8055,'iron'=>9705,'crop'=>2380,'time'=>158193));
$ab48=array(1=>array('wood'=>1065,'clay'=>1415,'iron'=>735,'crop'=>95,'time'=>28800),array('wood'=>1855,'clay'=>2465,'iron'=>1275,'crop'=>170,'time'=>50144),array('wood'=>2570,'clay'=>3410,'iron'=>1765,'crop'=>235,'time'=>69357),array('wood'=>3235,'clay'=>4295,'iron'=>2225,'crop'=>295,'time'=>87305),array('wood'=>3865,'clay'=>5135,'iron'=>2660,'crop'=>350,'time'=>104368),array('wood'=>4470,'clay'=>5940,'iron'=>3075,'crop'=>405,'time'=>120757),array('wood'=>5060,'clay'=>6720,'iron'=>3480,'crop'=>460,'time'=>136606),array('wood'=>5630,'clay'=>7475,'iron'=>3870,'crop'=>510,'time'=>152007),array('wood'=>6185,'clay'=>8215,'iron'=>4255,'crop'=>560,'time'=>167027),array('wood'=>6730,'clay'=>8940,'iron'=>4625,'crop'=>610,'time'=>181716),array('wood'=>7265,'clay'=>9645,'iron'=>4995,'crop'=>660,'time'=>196113),array('wood'=>7785,'clay'=>10340,'iron'=>5355,'crop'=>705,'time'=>210251),array('wood'=>8300,'clay'=>11025,'iron'=>5710,'crop'=>750,'time'=>224154),array('wood'=>8810,'clay'=>11700,'iron'=>6055,'crop'=>800,'time'=>237845),array('wood'=>9310,'clay'=>12365,'iron'=>6400,'crop'=>845,'time'=>251342),array('wood'=>9800,'clay'=>13020,'iron'=>6740,'crop'=>890,'time'=>264660),array('wood'=>10290,'clay'=>13665,'iron'=>7075,'crop'=>930,'time'=>277812),array('wood'=>10770,'clay'=>14305,'iron'=>7405,'crop'=>975,'time'=>290811),array('wood'=>11245,'clay'=>14935,'iron'=>7730,'crop'=>1020,'time'=>303665),array('wood'=>11720,'clay'=>15565,'iron'=>8055,'crop'=>1060,'time'=>316385));
?>
-91
View File
@@ -1,91 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename unitdata.php ##
## Developed by: Akakori ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ##
#################################################################################
$unitsbytype=array('infantry'=>array(1,2,3,11,12,13,14,21,22,31,32,33,34,41,42,43,44),'cavalry'=>array(4,5,6,15,16,23,24,25,26,35,36,45,46),'siege'=>array(7,8,17,18,27,28,37,38,47,48),'ram'=>array(7,17,27,47),'catapult'=>array(8,18,28,48),'expansion'=>array(9,10,19,20,29,30,39,40,49,50),'scout'=>array(4,14,23,44),'chief'=>array(9,19,29,49));
$u1=array('atk'=>40,'di'=>35,'dc'=>50,'wood'=>120,'clay'=>100,'iron'=>150,'crop'=>30,'pop'=>1,'speed'=>6,'time'=>1600,'cap'=>50);
$u2=array('atk'=>30,'di'=>65,'dc'=>35,'wood'=>100,'clay'=>130,'iron'=>160,'crop'=>70,'pop'=>1,'speed'=>5,'time'=>1760,'cap'=>20);
$u3=array('atk'=>70,'di'=>40,'dc'=>25,'wood'=>150,'clay'=>160,'iron'=>210,'crop'=>80,'pop'=>1,'speed'=>7,'time'=>1920,'cap'=>50);
$u4=array('atk'=>0,'di'=>20,'dc'=>10,'wood'=>140,'clay'=>160,'iron'=>20,'crop'=>40,'pop'=>2,'speed'=>16,'time'=>1360,'cap'=>0,'drinking'=>10);
$u5=array('atk'=>120,'di'=>65,'dc'=>50,'wood'=>550,'clay'=>440,'iron'=>320,'crop'=>100,'pop'=>3,'speed'=>14,'time'=>2640,'cap'=>100,'drinking'=>15);
$u6=array('atk'=>180,'di'=>80,'dc'=>105,'wood'=>550,'clay'=>640,'iron'=>800,'crop'=>180,'pop'=>4,'speed'=>10,'time'=>3520,'cap'=>70,'drinking'=>20);
$u7=array('atk'=>60,'di'=>30,'dc'=>75,'wood'=>900,'clay'=>360,'iron'=>500,'crop'=>70,'pop'=>3,'speed'=>4,'time'=>4600,'cap'=>0);
$u8=array('atk'=>75,'di'=>60,'dc'=>10,'wood'=>950,'clay'=>1350,'iron'=>600,'crop'=>90,'pop'=>6,'speed'=>3,'time'=>9000,'cap'=>0);
$u9=array('atk'=>50,'di'=>40,'dc'=>30,'wood'=>30750,'clay'=>27200,'iron'=>45000,'crop'=>37500,'pop'=>5,'speed'=>5,'time'=>90700,'cap'=>0);
$u10=array('atk'=>0,'di'=>80,'dc'=>80,'wood'=>5800,'clay'=>5300,'iron'=>7200,'crop'=>5500,'pop'=>1,'speed'=>5,'time'=>26900,'cap'=>3000);
$u11=array('atk'=>40,'di'=>20,'dc'=>5,'wood'=>95,'clay'=>75,'iron'=>40,'crop'=>40,'pop'=>1,'speed'=>7,'time'=>720,'cap'=>60);
$u12=array('atk'=>10,'di'=>35,'dc'=>60,'wood'=>145,'clay'=>70,'iron'=>85,'crop'=>40,'pop'=>1,'speed'=>7,'time'=>1120,'cap'=>40);
$u13=array('atk'=>60,'di'=>30,'dc'=>30,'wood'=>130,'clay'=>120,'iron'=>170,'crop'=>70,'pop'=>1,'speed'=>6,'time'=>1200,'cap'=>50);
$u14=array('atk'=>0,'di'=>10,'dc'=>5,'wood'=>160,'clay'=>100,'iron'=>50,'crop'=>50,'pop'=>1,'speed'=>9,'time'=>1120,'cap'=>0);
$u15=array('atk'=>55,'di'=>100,'dc'=>40,'wood'=>370,'clay'=>270,'iron'=>290,'crop'=>75,'pop'=>2,'speed'=>10,'time'=>2400,'cap'=>110);
$u16=array('atk'=>150,'di'=>50,'dc'=>75,'wood'=>450,'clay'=>515,'iron'=>480,'crop'=>80,'pop'=>3,'speed'=>9,'time'=>2960,'cap'=>80);
$u17=array('atk'=>65,'di'=>30,'dc'=>80,'wood'=>1000,'clay'=>300,'iron'=>350,'crop'=>70,'pop'=>3,'speed'=>4,'time'=>4200,'cap'=>0);
$u18=array('atk'=>50,'di'=>60,'dc'=>10,'wood'=>900,'clay'=>1200,'iron'=>600,'crop'=>60,'pop'=>6,'speed'=>3,'time'=>9000,'cap'=>0);
$u19=array('atk'=>40,'di'=>60,'dc'=>40,'wood'=>35500,'clay'=>26600,'iron'=>25000,'crop'=>27200,'pop'=>4,'speed'=>5,'time'=>70500,'cap'=>0);
$u20=array('atk'=>10,'di'=>80,'dc'=>80,'wood'=>7200,'clay'=>5500,'iron'=>5800,'crop'=>6500,'pop'=>1,'speed'=>5,'time'=>31000,'cap'=>3000);
$u21=array('atk'=>15,'di'=>40,'dc'=>50,'wood'=>100,'clay'=>130,'iron'=>55,'crop'=>30,'pop'=>1,'speed'=>7,'time'=>1040,'cap'=>35);
$u22=array('atk'=>65,'di'=>35,'dc'=>20,'wood'=>140,'clay'=>150,'iron'=>185,'crop'=>60,'pop'=>1,'speed'=>6,'time'=>1440,'cap'=>45);
$u23=array('atk'=>0,'di'=>20,'dc'=>10,'wood'=>170,'clay'=>150,'iron'=>20,'crop'=>40,'pop'=>2,'speed'=>17,'time'=>1360,'cap'=>0);
$u24=array('atk'=>90,'di'=>25,'dc'=>40,'wood'=>350,'clay'=>450,'iron'=>230,'crop'=>60,'pop'=>2,'speed'=>19,'time'=>2480,'cap'=>75);
$u25=array('atk'=>45,'di'=>115,'dc'=>55,'wood'=>360,'clay'=>330,'iron'=>280,'crop'=>120,'pop'=>2,'speed'=>16,'time'=>2560,'cap'=>35);
$u26=array('atk'=>140,'di'=>50,'dc'=>165,'wood'=>500,'clay'=>620,'iron'=>675,'crop'=>170,'pop'=>3,'speed'=>13,'time'=>3120,'cap'=>65);
$u27=array('atk'=>50,'di'=>30,'dc'=>105,'wood'=>950,'clay'=>555,'iron'=>330,'crop'=>75,'pop'=>3,'speed'=>4,'time'=>5000,'cap'=>0);
$u28=array('atk'=>70,'di'=>45,'dc'=>10,'wood'=>960,'clay'=>1450,'iron'=>630,'crop'=>90,'pop'=>6,'speed'=>3,'time'=>9000,'cap'=>0);
$u29=array('atk'=>40,'di'=>50,'dc'=>50,'wood'=>30750,'clay'=>45400,'iron'=>31000,'crop'=>37500,'pop'=>4,'speed'=>4,'time'=>90700,'cap'=>0);
$u30=array('atk'=>0,'di'=>80,'dc'=>80,'wood'=>5500,'clay'=>7000,'iron'=>5300,'crop'=>4900,'pop'=>1,'speed'=>5,'time'=>22700,'cap'=>3000);
$u31=array('atk'=>10,'di'=>25,'dc'=>20,'wood'=>85,'clay'=>75,'iron'=>120,'crop'=>25,'speed'=>7,'pop'=>1,'time'=>1600,'cap'=>45);
$u32=array('atk'=>20,'di'=>35,'dc'=>40,'wood'=>125,'clay'=>130,'iron'=>60,'crop'=>40,'speed'=>7,'pop'=>1,'time'=>1800,'cap'=>65);
$u33=array('atk'=>60,'di'=>40,'dc'=>60,'wood'=>140,'clay'=>150,'iron'=>40,'crop'=>60,'speed'=>6,'pop'=>1,'time'=>1900,'cap'=>80);
$u34=array('atk'=>10,'di'=>66,'dc'=>50,'wood'=>95,'clay'=>120,'iron'=>65,'crop'=>25,'speed'=>9,'pop'=>1,'time'=>2000,'cap'=>0);
$u35=array('atk'=>50,'di'=>70,'dc'=>33,'wood'=>250,'clay'=>200,'iron'=>125,'crop'=>45,'speed'=>10,'pop'=>2,'time'=>2000,'cap'=>120);
$u36=array('atk'=>100,'di'=>80,'dc'=>70,'wood'=>250,'clay'=>125,'iron'=>250,'crop'=>150,'speed'=>9,'pop'=>2,'time'=>2000,'cap'=>150);
$u37=array('atk'=>250,'di'=>140,'dc'=>200,'wood'=>250,'clay'=>220,'iron'=>135,'crop'=>50,'speed'=>4,'pop'=>3,'time'=>2000,'cap'=>125);
$u38=array('atk'=>450,'di'=>380,'dc'=>240,'wood'=>125,'clay'=>250,'iron'=>300,'crop'=>65,'speed'=>3,'pop'=>3,'time'=>2000,'cap'=>0);
$u39=array('atk'=>200,'di'=>170,'dc'=>250,'wood'=>350,'clay'=>350,'iron'=>125,'crop'=>80,'speed'=>5,'pop'=>3,'time'=>70500,'cap'=>0);
$u40=array('atk'=>600,'di'=>440,'dc'=>520,'wood'=>350,'clay'=>250,'iron'=>135,'crop'=>100,'speed'=>5,'pop'=>5,'time'=>31000,'cap'=>3000);
$u41=array('atk'=>20,'di'=>35,'dc'=>50,'wood'=>0,'clay'=>0,'iron'=>0,'crop'=>0,'pop'=>1,'speed'=>6,'time'=>0,'cap'=>0);
$u42=array('atk'=>65,'di'=>30,'dc'=>10,'wood'=>0,'clay'=>0,'iron'=>0,'crop'=>0,'pop'=>1,'speed'=>7,'time'=>0,'cap'=>0);
$u43=array('atk'=>100,'di'=>90,'dc'=>75,'wood'=>0,'clay'=>0,'iron'=>0,'crop'=>0,'pop'=>1,'speed'=>6,'time'=>0,'cap'=>0);
$u44=array('atk'=>0,'di'=>50,'dc'=>25,'wood'=>0,'clay'=>0,'iron'=>0,'crop'=>0,'pop'=>2,'speed'=>25,'time'=>0,'cap'=>0);
$u45=array('atk'=>155,'di'=>80,'dc'=>50,'wood'=>0,'clay'=>0,'iron'=>0,'crop'=>0,'pop'=>2,'speed'=>14,'time'=>0,'cap'=>0);
$u46=array('atk'=>170,'di'=>140,'dc'=>80,'wood'=>0,'clay'=>0,'iron'=>0,'crop'=>0,'pop'=>3,'speed'=>12,'time'=>0,'cap'=>0);
$u47=array('atk'=>250,'di'=>120,'dc'=>150,'wood'=>0,'clay'=>0,'iron'=>0,'crop'=>0,'pop'=>4,'speed'=>5,'time'=>0,'cap'=>0);
$u48=array('atk'=>60,'di'=>45,'dc'=>10,'wood'=>0,'clay'=>0,'iron'=>0,'crop'=>0,'pop'=>5,'speed'=>3,'time'=>0,'cap'=>0);
$u49=array('atk'=>80,'di'=>50,'dc'=>50,'wood'=>0,'clay'=>0,'iron'=>0,'crop'=>0,'pop'=>1,'speed'=>5,'time'=>0,'cap'=>0);
$u50=array('atk'=>30,'di'=>40,'dc'=>40,'wood'=>0,'clay'=>0,'iron'=>0,'crop'=>0,'pop'=>1,'speed'=>5,'time'=>0,'cap'=>0);
$u51=array('atk'=>10,'di'=>25,'dc'=>20,'wood'=>85,'clay'=>75,'iron'=>120,'crop'=>25,'speed'=>7,'pop'=>1,'time'=>1600,'cap'=>45);
$u52=array('atk'=>20,'di'=>35,'dc'=>40,'wood'=>125,'clay'=>130,'iron'=>60,'crop'=>40,'speed'=>7,'pop'=>1,'time'=>1800,'cap'=>65);
$u53=array('atk'=>60,'di'=>40,'dc'=>60,'wood'=>140,'clay'=>150,'iron'=>40,'crop'=>60,'speed'=>6,'pop'=>1,'time'=>1900,'cap'=>80);
$u54=array('atk'=>10,'di'=>66,'dc'=>50,'wood'=>95,'clay'=>120,'iron'=>65,'crop'=>25,'speed'=>9,'pop'=>1,'time'=>2000,'cap'=>0);
$u55=array('atk'=>50,'di'=>70,'dc'=>33,'wood'=>250,'clay'=>200,'iron'=>125,'crop'=>45,'speed'=>10,'pop'=>2,'time'=>2000,'cap'=>120);
$u56=array('atk'=>100,'di'=>80,'dc'=>70,'wood'=>250,'clay'=>125,'iron'=>250,'crop'=>150,'speed'=>9,'pop'=>2,'time'=>2000,'cap'=>150);
$u57=array('atk'=>250,'di'=>140,'dc'=>200,'wood'=>250,'clay'=>220,'iron'=>135,'crop'=>50,'speed'=>4,'pop'=>3,'time'=>2000,'cap'=>125);
$u58=array('atk'=>450,'di'=>380,'dc'=>240,'wood'=>125,'clay'=>250,'iron'=>300,'crop'=>65,'speed'=>3,'pop'=>3,'time'=>2000,'cap'=>0);
$u59=array('atk'=>200,'di'=>170,'dc'=>250,'wood'=>350,'clay'=>350,'iron'=>125,'crop'=>80,'speed'=>5,'pop'=>3,'time'=>70500,'cap'=>0);
$u60=array('atk'=>600,'di'=>440,'dc'=>520,'wood'=>350,'clay'=>250,'iron'=>135,'crop'=>100,'speed'=>5,'pop'=>5,'time'=>31000,'cap'=>3000);
$u99=array('atk'=>0,'di'=>0,'dc'=>0,'wood'=>20,'clay'=>30,'iron'=>10,'crop'=>20,'speed'=>0,'pop'=>0,'time'=>600,'cap'=>0);
// Hero data base values and increase per point
$h1=array('atk'=>50,'atkp'=>54,'di'=>60,'dip'=>49,'dc'=>85,'dcp'=>62.5);
$h2=array('atk'=>40,'atkp'=>46.5,'di'=>100,'dip'=>75.5,'dc'=>60,'dcp'=>47.5);
$h3=array('atk'=>90,'atkp'=>74,'di'=>65,'dip'=>57,'dc'=>40,'dcp'=>42);
$h5=array('atk'=>150,'atkp'=>107.5,'di'=>100,'dip'=>73,'dc'=>85,'dcp'=>59);
$h6=array('atk'=>225,'atkp'=>147.5,'di'=>135,'dip'=>79,'dc'=>175,'dcp'=>99);
$h11=array('atk'=>50,'atkp'=>54,'di'=>35,'dip'=>49.5,'dc'=>10,'dcp'=>24);
$h12=array('atk'=>15,'atkp'=>34,'di'=>60,'dip'=>48,'dc'=>100,'dcp'=>70.5);
$h13=array('atk'=>75,'atkp'=>67.5,'di'=>50,'dip'=>47.5,'dc'=>50,'dcp'=>47.5);
$h15=array('atk'=>70,'atkp'=>64,'di'=>165,'dip'=>100,'dc'=>65,'dcp'=>39.5);
$h16=array('atk'=>190,'atkp'=>127.5,'di'=>85,'dip'=>58.5,'dc'=>125,'dcp'=>80);
$h21=array('atk'=>20,'atkp'=>37.5,'di'=>65,'dip'=>53,'dc'=>85,'dcp'=>62);
$h22=array('atk'=>80,'atkp'=>71,'di'=>60,'dip'=>54,'dc'=>35,'dcp'=>38);
$h24=array('atk'=>115,'atkp'=>87.5,'di'=>40,'dip'=>42,'dc'=>65,'dcp'=>57);
$h25=array('atk'=>55,'atkp'=>57.5,'di'=>190,'dip'=>108.5,'dc'=>90,'dcp'=>60.5);
$h26=array('atk'=>175,'atkp'=>121,'di'=>85,'dip'=>55,'dc'=>275,'dcp'=>145);
?>
File diff suppressed because it is too large Load Diff
-75
View File
@@ -1,75 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename Form.php ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ##
#################################################################################
class Form {
private $errorarray = array();
public $valuearray = array();
private $errorcount;
public function __construct() {
if(isset($_SESSION['errorarray']) && isset($_SESSION['valuearray'])) {
$this->errorarray = $_SESSION['errorarray'];
$this->valuearray = $_SESSION['valuearray'];
$this->errorcount = count($this->errorarray);
unset($_SESSION['errorarray']);
unset($_SESSION['valuearray']);
}
else $this->errorcount = 0;
}
public function addError($field,$error) {
$this->errorarray[$field] = $error;
$this->errorcount = count($this->errorarray);
}
public function getError($field) {
if(array_key_exists($field,$this->errorarray)) {
return $this->errorarray[$field];
}
else return "";
}
public function getValue($field) {
if(array_key_exists($field,$this->valuearray)) {
return $this->valuearray[$field];
}
else return "";
}
public function setValue($field, $value) {
$this->valuearray[$field] = $value;
}
public function getDiff($field,$cookie) {
if(array_key_exists($field,$this->valuearray) && $this->valuearray[$field] != $cookie) {
return $this->valuearray[$field];
}
else return $cookie;
}
public function getRadio($field,$value) {
if(array_key_exists($field,$this->valuearray) && $this->valuearray[$field] == $value) {
return "checked";
}
else return "";
}
public function returnErrors() {
return $this->errorcount;
}
public function getErrors() {
return $this->errorarray;
}
};
?>
-21
View File
@@ -1,21 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename WorldWonderName.php ##
## Developed by: Dzoki ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ##
#################################################################################
include("../Village.php");
if(isset($_POST['wwname']) && !empty($_POST['wwname']) && $village->natar){
$database->submitWWname($village->wid,$_POST['wwname']);
header("Location: ../../build.php?id=99&n");
}else{
header("Location: ../../dorf2.php");
}
?>
-19
View File
@@ -1,19 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename 404.tpl ##
## Developed by: aggenkeech ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2012. All rights reserved. ##
## ##
#################################################################################
?>
<div style="margin-top: 50px;">
<div style="text-align: center">
<h1>404 - File not found</h1>
<img src="../../gpack/travian_default/img/misc/404.gif" title="Not Found" alt="Not Found"><br />
<p>We looked 404 times already but can't find anything, Not even an X marking the spot.</p>
<p>This system is not complete yet. So the page probably does not exist.</p><br>
</div>
</div>
-144
View File
@@ -1,144 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename Generator.php ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ##
#################################################################################
class MyGenerator {
public function generateRandID(){
return md5($this->generateRandStr(16));
}
public function generateRandStr($length){
$randstr = "";
for($i = 0; $i < $length; $i++){
$randnum = mt_rand(0, 61);
if($randnum < 10) $randstr .= chr($randnum + 48);
else if($randnum < 36) $randstr .= chr($randnum + 55);
else $randstr .= chr($randnum + 61);
}
return $randstr;
}
public function encodeStr($str, $length) {
$encode = md5($str);
return substr($encode, 0 ,$length);
}
public function procDistanceTime($coor, $thiscoor, $ref, $mode, $vid = 0) {
global $database, $bid28, $bid14, $village;
if($vid == 0) $vid = $village->wid;
$xdistance = ABS($thiscoor['x'] - $coor['x']);
if($xdistance > WORLD_MAX) $xdistance = (2 * WORLD_MAX + 1) - $xdistance;
$ydistance = ABS($thiscoor['y'] - $coor['y']);
if($ydistance > WORLD_MAX) $ydistance = (2 * WORLD_MAX + 1) - $ydistance;
$distance = SQRT(POW($xdistance,2) + POW($ydistance,2));
if(!$mode){
if($ref == 1) $speed = 16;
else if($ref == 2) $speed = 12;
else if($ref == 3) $speed = 24;
else if($ref == 300) $speed = 5;
else $speed = 1;
}else{
$speed = $ref;
if(($tSquareLevel = $database->getFieldLevelInVillage($vid, 14)) > 0 && $distance >= TS_THRESHOLD) {
$speed *= ($bid14[$tSquareLevel]['attri'] / 100) ;
}
}
if($speed > 0) return round(($distance / $speed) * 3600 / INCREASE_SPEED);
else return round($distance * 3600 / INCREASE_SPEED);
}
public function getTimeFormat($time) {
$min = $hr = $days = 0;
while($time >= 60){
$time -= 60;
$min += 1;
}
while($min >= 60){
$min -= 60;
$hr += 1;
}
if($min < 10) $min = "0" . $min;
if($time < 10) $time = "0" . $time;
return $hr . ":" . $min . ":" . $time;
}
public function procMtime($time, $pref = 3){
/*
* $timezone = 7;
* switch($timezone) {
* case 7:
* $time -= 3600;
* break;
* }
*/
// $time += 3600*0; //Edit this yourself
$time += 0; // Edit this yourself
$today = date('d', time()) - 1;
if(date('Ymd', time()) == date('Ymd', $time)) $day = "today";
elseif($today == date('d', $time)) $day = "yesterday";
else
{
switch($pref){
case 1 :
$day = date("m/j/y", $time);
break;
case 2 :
$day = date("j/m/y", $time);
break;
case 3 :
$day = date("j.m.y", $time);
break;
default :
$day = date("y/m/j", $time);
break;
}
}
$new = date("H:i:s", $time);
if($pref == "9" || $pref == 9) return $new;
else return array($day, $new);
}
public function getBaseID($x, $y){
return ((WORLD_MAX - $y) * (WORLD_MAX * 2 + 1)) + (WORLD_MAX + $x + 1);
}
public function getMapCheck($wref){
return substr(md5($wref), 5, 2);
}
public function pageLoadTimeStart(){
if(isset($_SERVER["REQUEST_TIME_FLOAT"])) return $_SERVER["REQUEST_TIME_FLOAT"];
$starttime = microtime(true);
$startarray = explode(" ", $starttime);
//$starttime = $startarray[1] + $startarray[0];
return $startarray[0];
}
public function pageLoadTimeEnd(){
$endtime = microtime(true);
$endarray = explode(" ", $endtime);
//$endtime = $endarray[1] + $endarray[0];
return $endarray[0];
}
};
$generator = new MyGenerator;
File diff suppressed because it is too large Load Diff
-19
View File
@@ -1,19 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename 404.tpl ##
## Developed by: aggenkeech ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2012. All rights reserved. ##
## ##
#################################################################################
?>
<div style="margin-top: 50px;">
<div style="text-align: center">
<h1>404 - File not found</h1>
<img src="../../gpack/travian_default/img/misc/404.gif" title="Not Found" alt="Not Found"><br />
<p>We looked 404 times already but can't find anything, Not even an X marking the spot.</p>
<p>This system is not complete yet. So the page probably does not exist.</p><br>
</div>
</div>
-110
View File
@@ -1,110 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename Logging.php ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ##
#################################################################################
class Logging {
public function addIllegal($uid,$ref,$type) {
global $database;
list($uid,$ref,$type) = $database->escape_input((int) $uid,$ref,$type);
if(LOG_ILLEGAL) {
$log = "Attempted to ";
switch($type) {
case 1:
$log .= "access village $ref";
break;
}
$q = "Insert into ".TB_PREFIX."illegal_log SET user = $uid, log = '$log'";
$database->query($q);
}
}
public function addLoginLog($id,$ip) {
global $database;
list($id,$ip) = $database->escape_input((int) $id,$ip);
if(LOG_LOGIN) {
$q = "Insert into ".TB_PREFIX."login_log SET uid = $id, ip = '".$_SERVER['REMOTE_ADDR']."'";
$database->query($q);
}
}
public function addBuildLog($wid,$building,$level,$type) {
global $database;
list($wid,$building,$level,$type) = $database->escape_input((int) $wid,$building,$level,$type);
if(LOG_BUILD) {
if($type) {
$log = "Start Construction of ";
}
else {
$log = "Start Upgrade of ";
}
$log .= $building." to level ".$level;
$q = "Insert into ".TB_PREFIX."build_log SET wid = $wid, log = '$log'";
$database->query($q);
}
}
public function addTechLog($wid,$tech,$level) {
global $database;
list($wid,$tech,$level) = $database->escape_input((int) $wid,$tech,$level);
if(LOG_TECH) {
$log = "Upgrading of tech ".$tech." to level ".$level;
$q = "Insert into ".TB_PREFIX."tech_log SET wid = $wid, log = '$log'";
$database->query($q);
}
}
public function goldFinLog($wid) {
global $database;
list($wid) = $database->escape_input((int) $wid);
if(LOG_GOLD_FIN) {
$log = "Finish construction and research with gold";
$q = "Insert into ".TB_PREFIX."gold_fin_log values (0,$wid,'$log')";
$database->query($q);
}
}
public function addAdminLog() {
global $database;
}
public function addMarketLog($wid,$type,$data) {
global $database;
list($wid,$type,$data) = $database->escape_input((int) $wid,$type,$data);
if(LOG_MARKET) {
if($type == 1) {
$log = "Sent ".$data[0].",".$data[1].",".$data[2].",".$data[3]." to village ".$data[4];
}
else if($type == 2) {
$log = "Traded resource between ".$wid." and ".$data[0]." market ref is ".$data[1];
}
$q = "Insert into ".TB_PREFIX."market_log SET wid = $wid, log = '$log'";
$database->query($q);
}
}
public function addWarLog() {
global $database;
}
public function clearLogs() {
global $database;
}
public static function debug($debug_info, $time = 0) {
global $database, $generator;
list($debug_info) = $database->escape_input($debug_info);
echo '<script>console.log('.json_encode(($time > 0 ? "[".$generator->procMtime($time)[1]."] " : "").$debug_info).')</script>';
}
};
$logging = new Logging;
?>
-95
View File
@@ -1,95 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename Mailer.php ##
## Developed by: Dixie ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ##
#################################################################################
class Mailer {
function sendActivate($email,$username,$pass,$act) {
$subject = "Welcome to ".SERVER_NAME;
$message = "Hello ".$username."
Thank you for your registration.
----------------------------
Name: ".$username."
Password: ".$pass."
Activation code: ".$act."
----------------------------
Click the following link in order to activate your account:
".SERVER."activate.php?code=".$act."
Greetings,
Travian adminision";
$headers = "From: ".ADMIN_EMAIL."\n";
mail($email, $subject, $message, $headers);
}
function sendInvite($email,$uid,$text) {
$subject = "".SERVER_NAME." registeration";
$message = "Hello ".$username."
Try the new ".SERVER_NAME."!
Link: ".SERVER."anmelden.php?id=ref".$uid."
".$text."
Greetings,
Travian";
$headers = "From: ".ADMIN_EMAIL."\n";
mail($email, $subject, $message, $headers);
}
function sendPassword($email,$uid,$username,$npw,$cpw) {
$subject = "Password forgotten";
$message = "Hello ".$username."
You have requested a new password for Travian.
----------------------------
Name: ".$username."
Password: ".$npw."
----------------------------
Please click this link to activate your new password. The old password then
becomes invalid:
http://${_SERVER['HTTP_HOST']}/password.php?cpw=$cpw&npw=$uid
If you want to change your new password, you can enter a new one in your profile
on tab \"account\".
In case you did not request a new password you may ignore this email.
Travian
";
$headers = "From: ".ADMIN_EMAIL."\n";
mail($email, $subject, $message, $headers);
}
};
$mailer = new Mailer;
?>
-374
View File
@@ -1,374 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename Market.php ##
## Developed by: Dzoki ##
## Some fixes: aggenkeech ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ##
#################################################################################
class Market
{
public $onsale, $onmarket, $sending, $recieving, $return = [];
public $maxcarry, $merchant, $used;
public function procMarket($post)
{
$this->loadMarket();
if(isset($_SESSION['loadMarket']))
{
$this->loadOnsale();
unset($_SESSION['loadMarket']);
}
if(isset($post['ft']))
{
switch($post['ft'])
{
case "mk1": $this->sendResource($post); break;
case "mk2": $this->addOffer($post); break;
case "mk3": $this->tradeResource($post); break;
}
}
}
public function procRemove($get)
{
global $database, $village, $session;
if(isset($get['t']) && $get['t'] == 1)
{
$this->filterNeed($get);
}
else if(isset($get['t']) && $get['t'] == 2 && isset($get['a']) && $get['a'] == 5 && isset($get['del']))
{
//GET ALL FIELDS FROM MARKET
$type = $database->getMarketField($village->wid, $get['del'], "gtype");
$amt = $database->getMarketField($village->wid, $get['del'], "gamt");
$database->getResourcesBack($village->wid, $type, $amt);
$database->addMarket($village->wid, $get['del'], 0, 0, 0, 0, 0, 0, 1);
header("Location: build.php?id=".$get['id']."&t=2");
exit;
}
if(isset($get['t']) && $get['t'] == 1 && isset($get['a']) && $get['a'] == $session->mchecker && !isset($get['del']))
{
$session->changeChecker();
$this->acceptOffer($get);
}
}
public function merchantAvail()
{
return $this->merchant - $this->used;
}
private function loadMarket()
{
global $session,$building,$bid28,$bid17,$database,$village;
$this->recieving = $database->getMovement(0,$village->wid,1);
$this->sending = $database->getMovement(0,$village->wid,0);
$this->return = $database->getMovement(2,$village->wid,1);
$this->merchant = ($building->getTypeLevel(17) > 0)? $bid17[$building->getTypeLevel(17)]['attri'] : 0;
$this->used = $database->totalMerchantUsed($village->wid);
$this->onmarket = $database->getMarket($village->wid,0);
$this->maxcarry = ($session->tribe == 1)? 500 : (($session->tribe == 2)? 1000 : 750);
$this->maxcarry *= TRADER_CAPACITY;
if($building->getTypeLevel(28) != 0)
{
$this->maxcarry *= $bid28[$building->getTypeLevel(28)]['attri'] / 100;
}
}
private function sendResource($post)
{
global $database, $village, $session, $generator, $logging, $form;
$wtrans = (isset($post['r1']) && !empty($post['r1']))? $post['r1'] : 0;
$ctrans = (isset($post['r2']) && !empty($post['r2']))? $post['r2'] : 0;
$itrans = (isset($post['r3']) && !empty($post['r3']))? $post['r3'] : 0;
$crtrans = (isset($post['r4']) && !empty($post['r4']))? $post['r4'] : 0;
$wtrans = str_replace("-", "", $wtrans);
$ctrans = str_replace("-", "", $ctrans);
$itrans = str_replace("-", "", $itrans);
$crtrans = str_replace("-", "", $crtrans);
// preload all village data, since we're retrieving some of those separately below
$database->getVillage($village->wid);
$availableWood = $database->getWoodAvailable($village->wid);
$availableClay = $database->getClayAvailable($village->wid);
$availableIron = $database->getIronAvailable($village->wid);
$availableCrop = $database->getCropAvailable($village->wid);
//check if on vacation:
if($database->getvacmodexy($id)) $form->addError("error", USER_ON_VACATION);
if(!$database->checkVilExist($post['getwref'])) $form->addError("error", NO_COORDINATES_SELECTED);
elseif($post['getwref'] == $village->wid) $form->addError("error", CANNOT_SEND_RESOURCES);
elseif($post['send3'] < 1 || $post['send3'] > 3 || ($post['send3'] > 1 && !$session->goldclub)) $form->addError("error", INVALID_MERCHANTS_REPETITION);
elseif($availableWood >= $post['r1'] && $availableClay >= $post['r2'] && $availableIron >= $post['r3'] && $availableCrop >= $post['r4'])
{
$resource = [$wtrans, $ctrans, $itrans, $crtrans];
$reqMerc = ceil((array_sum($resource) - 0.1) / $this->maxcarry);
if($this->merchantAvail() > 0 && $reqMerc <= $this->merchantAvail())
{
$id = $post['getwref'];
$coor = $database->getCoor($id);
if($database->getVillageState($id))
{
$timetaken = $generator->procDistanceTime($coor, $village->coor, $session->tribe, 0);
$res = $resource[0] + $resource[1] + $resource[2] + $resource[3];
if($res != 0){
$reference = $database->sendResource($resource[0], $resource[1], $resource[2], $resource[3], $reqMerc, 0);
$database->modifyResource($village->wid, $resource[0], $resource[1], $resource[2], $resource[3], 0);
$database->addMovement(0, $village->wid, $id, $reference, time(), time() + $timetaken, $post['send3']);
$logging->addMarketLog($village->wid, 1, [$resource[0], $resource[1], $resource[2], $resource[3], $id]);
}
}
header("Location: build.php?id=".$post['id']);
exit;
}
else $form->addError("error", TOO_FEW_MERCHANTS);
}
else $form->addError("error", TOO_FEW_RESOURCES);
}
private function addOffer($post)
{
global $database,$village,$session;
if($post['rid1'] == $post['rid2'])
{
// Trading res for res of same type (invalid)
header("Location: build.php?id=".$post['id']."&t=2&e2");
exit;
}
elseif(!isset($post['m1']) || !isset($post['m2']) || $post['m1'] <= 0 || $post['m2'] <= 0)
{
// No resources selected (invalid)
header("Location: build.php?id=".$post['id']."&t=2&e2");
exit;
}
elseif($post['m1'] > (2 * $post['m2']))
{
// Trade is for more than 2x (invalid)
header("Location: build.php?id=".$post['id']."&t=2&e2");
exit;
}
elseif($post['m2'] > (2 * $post['m1']))
{
// Trade is for less than 0.5x (invalid)
header("Location: build.php?id=".$post['id']."&t=2&e2");
exit;
}
elseif($post['rid1'] < 1 || $post['rid1'] > 4 || $post['rid2'] < 1 || $post['rid2'] > 4)
{
// Inexistent resources type (invalid)
header("Location: build.php?id=".$post['id']."&t=2&e2");
exit;
}
else
{
$wood = ($post['rid1'] == 1)? $post['m1'] : 0;
$clay = ($post['rid1'] == 2)? $post['m1'] : 0;
$iron = ($post['rid1'] == 3)? $post['m1'] : 0;
$crop = ($post['rid1'] == 4)? $post['m1'] : 0;
// preload all village data, since we're retrieving some of those separately below
$database->getVillage($village->wid);
$availableWood = $database->getWoodAvailable($village->wid);
$availableClay = $database->getClayAvailable($village->wid);
$availableIron = $database->getIronAvailable($village->wid);
$availableCrop = $database->getCropAvailable($village->wid);
if($availableWood >= $wood && $availableClay >= $clay && $availableIron >= $iron && $availableCrop >= $crop)
{
$reqMerc = 1;
if(($wood+$clay+$iron+$crop) > $this->maxcarry)
{
$reqMerc = round(($wood+$clay+$iron+$crop)/$this->maxcarry);
if(($wood+$clay+$iron+$crop) > $this->maxcarry*$reqMerc) $reqMerc += 1;
}
if($this->merchantAvail() > 0 && $reqMerc <= $this->merchantAvail())
{
if($database->modifyResource($village->wid,$wood,$clay,$iron,$crop,0))
{
$time = 0;
if(isset($_POST['d1'])) $time = $_POST['d2'] * 3600;
$alliance = (isset($post['ally']) && $post['ally'] == 1)? $session->userinfo['alliance'] : 0;
$database->addMarket($village->wid,$post['rid1'],$post['m1'],$post['rid2'],$post['m2'],$time,$alliance,$reqMerc,0);
}
// Enough merchants
header("Location: build.php?id=".$post['id']."&t=2");
exit;
}
else
{
// Not enough merchants
header("Location: build.php?id=".$post['id']."&t=2&e3");
exit;
}
}
else
{
// not enough resources
header("Location: build.php?id=".$post['id']."&t=2&e1");
exit;
}
}
}
private function acceptOffer($get)
{
global $database,$village,$session,$logging,$generator;
$infoarray = $database->getMarketInfo($get['g']);
$reqMerc = 1;
if($infoarray['wamt'] > $this->maxcarry)
{
$reqMerc = round($infoarray['wamt']/$this->maxcarry);
if($infoarray['wamt'] > $this->maxcarry*$reqMerc)
{
$reqMerc += 1;
}
}
// We don't have enough resources
if($infoarray['wamt'] > ([$village->awood, $village->aclay, $village->airon, $village->acrop])[$infoarray['wtype']])
{
header("Location: build.php?id=".$get['id']."&t=1&e1");
exit;
} // We're accepting the offering from the same village/of another alliance/with a too high maxtime
elseif
(($infoarray['vref'] == $village->wid) ||
($infoarray['alliance'] > 0 && $infoarray['alliance'] != $session->alliance) ||
($infoarray['maxtime'] > 0 && ($infoarray['maxtime'] * 3600) < $generator->procDistanceTime($database->getCoor($infoarray['vref']), $village->coor, $session->tribe, 0)))
{
header("Location: build.php?id=".$get['id']."&t=1&e2");
exit;
} // We don't have enough merchants
elseif($reqMerc > $this->merchantAvail()){
header("Location: build.php?id=".$get['id']."&t=1&e3");
exit;
}
$myresource = $hisresource = [ 1=> 0, 0, 0, 0];
$myresource[$infoarray['wtype']] = $infoarray['wamt'];
$mysendid = $database->sendResource($myresource[1],$myresource[2],$myresource[3],$myresource[4],$reqMerc,0);
$hisresource[$infoarray['gtype']] = $infoarray['gamt'];
$hissendid = $database->sendResource($hisresource[1],$hisresource[2],$hisresource[3],$hisresource[4],$infoarray['merchant'],0);
$hiscoor = $database->getCoor($infoarray['vref']);
$mytime = $generator->procDistanceTime($hiscoor,$village->coor,$session->tribe,0);
$targettribe = $database->getUserField($database->getVillageField($infoarray['vref'],"owner"),"tribe",0);
$histime = $generator->procDistanceTime($village->coor,$hiscoor,$targettribe,0);
$timestamp = time();
$database->addMovement(
[0, 0],
[$village->wid, $infoarray['vref']],
[$infoarray['vref'], $village->wid],
[$mysendid, $hissendid],
[$timestamp, $timestamp],
[$mytime + $timestamp, $histime + $timestamp]
);
$resource = [1 => 0, 0, 0, 0];
$resource[$infoarray['wtype']] = $infoarray['wamt'];
$database->modifyResource($village->wid, $resource[1], $resource[2], $resource[3], $resource[4], 0);
$database->setMarketAcc($get['g']);
$database->removeAcceptedOffer($get['g']);
$logging->addMarketLog($village->wid, 2, [$infoarray['vref'], $get['g']]);
header("Location: build.php?id=" . $get['id']);
exit;
}
private function loadOnsale()
{
global $database,$village,$session,$multisort,$generator;
$displayarray = $database->getMarket($village->wid,1);
$holderarray = [];
foreach($displayarray as $value)
{
$targetcoor = $database->getCoor($value['vref']);
$duration = $generator->procDistanceTime($targetcoor, $village->coor, $session->tribe, 0);
if($duration <= ($value['maxtime'] * 3600) || $value['maxtime'] == 0)
{
$value['duration'] = $duration;
array_push($holderarray,$value);
}
}
$this->onsale = $multisort->sorte($holderarray, "duration", true, 2);
}
private function filterNeed($get)
{
if(isset($get['v']) || isset($get['s']) || isset($get['b'])){
$holder = $holder2 = [];
if(isset($get['v']) && $get['v'] == "1:1"){
foreach($this->onsale as $equal){
if($equal['wamt'] <= $equal['gamt']){
array_push($holder, $equal);
}
}
}
else $holder = $this->onsale;
foreach($holder as $sale){
if(isset($get['s']) && isset($get['b'])){
if($sale['gtype'] == $get['s'] && $sale['wtype'] == $get['b']){
array_push($holder2, $sale);
}
}else if(isset($get['s']) && !isset($get['b'])){
if($sale['gtype'] == $get['s']){
array_push($holder2, $sale);
}
}else if(isset($get['b']) && !isset($get['s'])){
if($sale['wtype'] == $get['b']){
array_push($holder2, $sale);
}
}
else $holder2 = $holder;
}
$this->onsale = $holder2;
}
else $this->loadOnsale();
}
private function tradeResource($post)
{
global $session,$database,$village;
$wwvillage = $database->getResourceLevel($village->wid);
if($wwvillage['f99t'] != 40){
if($session->userinfo['gold'] >= 3){
//Check if there are too many resources
if(($post['m2'][0]+$post['m2'][1]+$post['m2'][2]+$post['m2'][3])<=(round($village->awood)+round($village->aclay)+round($village->airon)+round($village->acrop))){
$database->setVillageField(
$village->wid,
["wood", "clay", "iron", "crop"],
[$post['m2'][0], $post['m2'][1], $post['m2'][2], $post['m2'][3]]
);
$database->modifyGold($session->uid, 3, 0);
header("Location: build.php?id=".$post['id']."&t=3&c");;
exit;
}else{
header("Location: build.php?id=".$post['id']."&t=3");
exit;
}
}else{
header("Location: build.php?id=".$post['id']."&t=3");
exit;
}
}
}
};
$market = new Market;
?>
-686
View File
@@ -1,686 +0,0 @@
<?php
/** --------------------------------------------------- **\
| ********* DO NOT REMOVE THIS COPYRIGHT NOTICE ********* |
+---------------------------------------------------------+
| Credits: All the developers including the leaders: |
| Advocaite & Dzoki & Donnchadh |
| |
| Copyright: TravianX Project All rights reserved |
\** --------------------------------------------------- **/
class Message {
public $unread, $nunread = false;
public $note;
public $inbox, $inbox1, $sent, $sent1, $reading, $reply, $archived, $archived1, $noticearray, $readingNotice = [];
private $totalMessage;
function __construct() {
$req_file = basename($_SERVER['PHP_SELF']);
$this->unread = $this->checkUnread();
$this->nunread = $this->checkNUnread();
if($req_file == 'nachrichten.php'){
if(isset($_GET['t'])){
switch($_GET['t']){
// send messages page or a single sent message
case 2 :
case '2a' :
$this->getMessages(2);
break;
// archived messages page
case 3 :
$this->getMessages(3);
break;
}
}
else $this->getMessages(1); // inbox - received messages page
}
if ($req_file == 'berichte.php') $this->getNotice();
if(isset($_SESSION['reply'])) {
$this->reply = $_SESSION['reply'];
unset($_SESSION['reply']);
}
}
public function procMessage($post) {
if(isset($post['ft'])) {
switch($post['ft']) {
case "m1":
$this->quoteMessage($post['id']);
break;
case "m2":
if ($post['an'] == "[ally]") $this->sendAMessage($post['be'],addslashes($post['message']));
else $this->sendMessage($post['an'],$post['be'],addslashes($post['message']));
header("Location: nachrichten.php?t=2");
exit;
case "m3":
case "m4":
case "m5":
if(isset($post['delmsg']))$this->removeMessage($post);
if(isset($post['archive'])) $this->archiveMessage($post);
if(isset($post['start'])) $this->unarchiveMessage($post);
break;
case "m6":
$this->createNote($post);
break;
case "m7":
$this->addFriends($post);
break;
}
}
}
public function noticeType($get) {
global $session, $database;
if(isset($get['t'])) {
if($get['t'] == 1) $type = [8, 15, 16, 17];
if($get['t'] == 2) $type = [10, 11, 12, 13];
if($get['t'] == 3) $type = [1, 2, 3, 4, 5, 6, 7];
if($get['t'] == 4) $type = [0, 18, 19, 20, 21];
if($get['t'] == 5) {
if(!$session->plus){
header("Location: berichte.php");
exit;
}
else $type = 9;
}
if (!is_array($type)) $type = [$type];
$this->noticearray = $this->filter_by_value($database->getNotice($session->uid), "ntype", $type);
}
if(isset($get['id'])) $this->readingNotice = $this->getReadNotice($get['id']);
}
public function procNotice($post) {
if(isset($post["del_x"])) $this->removeNotice($post);
if(isset($post['archive_x'])) $this->archiveNotice($post);
if(isset($post['start_x'])) $this->unarchiveNotice($post);
}
public function quoteMessage($id) {
foreach($this->inbox as $message) {
if($message['id'] == $id) {
$message = preg_replace('/\[message\]/', '', $message);
$message = preg_replace('/\[\/message\]/', '', $message);
for($i = 1; $i <= $message['alliance']; $i++){
$message = preg_replace('/\[alliance'.$i.'\]/', '[alliance0]', $message);
$message = preg_replace('/\[\/alliance'.$i.'\]/', '[/alliance0]', $message);
}
for($i = 0; $i <= $message['player']; $i++){
$message = preg_replace('/\[player'.$i.'\]/', '[player0]', $message);
$message = preg_replace('/\[\/player'.$i.'\]/', '[/player0]', $message);
}
for($i = 0; $i <= $message['coor']; $i++){
$message = preg_replace('/\[coor'.$i.'\]/', '[coor0]', $message);
$message = preg_replace('/\[\/coor'.$i.'\]/', '[/coor0]', $message);
}
for($i = 0; $i <= $message['report']; $i++){
$message = preg_replace('/\[report'.$i.'\]/', '[report0]', $message);
$message = preg_replace('/\[\/report'.$i.'\]/', '[/report0]', $message);
}
$this->reply = $_SESSION['reply'] = $message;
header("Location: nachrichten.php?t=1&id=" . $message['owner'] . "&mid=" . $message['id'] . "&tid=" . $message['target']);
exit;
}
}
}
public function loadMessage($id) {
global $database, $session;
if($this->findInbox($id)) {
foreach($this->inbox as $message) {
if($message['id'] == $id) {
$this->reading = $message;
break;
}
}
}
if($this->findSent($id)) {
foreach($this->sent as $message) {
if($message['id'] == $id) {
$this->reading = $message;
break;
}
}
}
if($session->plus && $this->findArchive($id)) {
foreach($this->archived as $message) {
if($message['id'] == $id) {
$this->reading = $message;
break;
}
}
}
if($this->reading['viewed'] == 0) $database->getMessage($id, 4);
}
private function filter_by_value_except($array, $index, $value) {
$newarray = [];
if(is_array($array) && count($array) > 0) {
foreach(array_keys($array) as $key) {
$temp[$key] = $array[$key][$index];
if($temp[$key] != $value) {
array_push($newarray, $array[$key]);
//$newarray[$key] = $array[$key];
}
}
}
return $newarray;
}
private function filter_by_value($array, $index, $value) {
$newarray = [];
if(is_array($array) && count($array) > 0) {
foreach(array_keys($array) as $key) {
$temp[$key] = $array[$key][$index];
if(in_array($temp[$key], $value)) {
array_push($newarray, $array[$key]);
//$newarray[$key] = $array[$key];
}
}
}
return $newarray;
}
private function getNotice() {
global $database, $session;
$this->noticearray = $this->filter_by_value_except($database->getNotice($session->uid), "ntype", 9);
}
private function removeMessage($post) {
global $database, $session;
$post = $database->escape($post);
$mode5updates = $mode7updates = $mode8updates = [];
for($i = 1; $i <= 10; $i++){
if(isset($post['n' . $i])){
$message1 = mysqli_query($database->dblink, "SELECT target, owner FROM " . TB_PREFIX . "mdata where id = " . (int)$post['n' . $i] . "");
$message = mysqli_fetch_array($message1);
if($message['target'] == $session->uid && $message['owner'] == $session->uid) $mode8updates[] = $post['n' . $i];
else if($message['target'] == $session->uid) $mode5updates[] = $post['n' . $i];
else if($message['owner'] == $session->uid) $mode7updates[] = $post['n' . $i];
}
}
if(count($mode5updates)) $database->getMessage($mode5updates, 5);
if(count($mode7updates)) $database->getMessage($mode7updates, 7);
if(count($mode8updates)) $database->getMessage($mode8updates, 8);
header("Location: nachrichten.php");
exit;
}
private function archiveMessage($post) {
global $database;
$archIDs = [];
for($i = 1; $i <= 10; $i++) {
if(isset($post['n'.$i])) $archIDs[] = $post['n'.$i];
}
$database->setArchived($archIDs);
header("Location: nachrichten.php");
exit;
}
private function unarchiveMessage($post) {
global $database;
$normIDs = [];
for($i = 1; $i <= 10; $i++) {
if(isset($post['n'.$i])) $normIDs[] = $post['n'.$i];
}
$database->setNorm($normIDs);
header("Location: nachrichten.php");
exit;
}
private function removeNotice($post) {
global $database;
$removeIDs = [];
for($i = 1; $i <= 10; $i++) {
if(isset($post['n' . $i])) {
$removeIDs[] = $post['n' . $i];
}
}
$database->removeNotice($removeIDs);
header("Location: berichte.php");
exit;
}
private function archiveNotice($post) {
global $database;
$archiveIDs = [];
for($i = 1; $i <= 10; $i++) {
if(isset($post['n' . $i])) {
$archiveIDs[] = $post['n' . $i];
}
}
$database->archiveNotice($archiveIDs);
header("Location: berichte.php");
exit;
}
private function unarchiveNotice($post) {
global $database;
$unarchIDs = [];
for($i = 1; $i <= 10; $i++) {
if(isset($post['n' . $i])) {
$unarchIDs[] = $post['n' . $i];
}
}
$database->unarchiveNotice($unarchIDs);
header("Location: berichte.php");
exit;
}
private function getReadNotice($id) {
global $database, $session;
$notice = $database->getNotice2($id);
if($notice['uid'] == $session->uid || $notice['ally'] == $session->alliance){
if($notice['uid'] == $session->uid) $database->noticeViewed($notice['id']);
return $notice;
}
else return null;
}
/**
* Not all notices have a corresponding .tpl file but with this method it's like they have it
*
* @param int $type The type of the report (notice)
* @return int Returns the new report type
*/
public function getReportType($type)
{
switch($type)
{
case 2:
case 4:
case 5:
case 6:
case 7:
case 18:
case 20:
case 21: return 1; //General attacking reports
case 11:
case 12:
case 13:
case 14: return 10; //Merchants reports
case 16:
case 17: return 15; //Reinforcements attacked
case 19: return 3; //No troops have returned
case 23: return 22; //Festive reports
}
return $type;
}
public function loadNotes() {
global $session;
if(file_exists("GameEngine/Notes/".md5($session->username).".txt")) {
$this->note = file_get_contents("GameEngine/Notes/".md5($session->username).".txt");
}
else $this->note = "";
}
private function createNote($post) {
global $session;
if($session->plus) {
$ourFileHandle = fopen("GameEngine/Notes/".md5($session->username).".txt", 'w');
fwrite($ourFileHandle, $post['notizen']);
fclose($ourFileHandle);
}
}
private function getMessages($which) {
global $database, $session;
switch($which){
case 1 :
$this->inbox = $database->getMessage($session->uid, 1);
$this->inbox1 = $database->getMessage($session->uid, 9);
break;
case 2 :
$this->sent = $database->getMessage($session->uid, 2);
$this->sent1 = $database->getMessage($session->uid, 10);
break;
case 3 :
if($session->plus){
$this->archived = $database->getMessage($session->uid, 6);
$this->archived1 = $database->getMessage($session->uid, 11);
}
break;
}
}
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);
$res = mysqli_fetch_array(mysqli_query($database->dblink,$q), MYSQLI_ASSOC);
if($res['Total'] > 5) return; //flooding prevention
// Vulnerability closed by Shadow
$allmembersQ = mysqli_query($database->dblink,"SELECT id FROM ".TB_PREFIX."users WHERE alliance='".$session->alliance."'");
$userally = $database->getUserField($session->uid,"alliance",0);
$permission=mysqli_fetch_array(mysqli_query($database->dblink,"SELECT opt7 FROM ".TB_PREFIX."ali_permission WHERE uid='".$session->uid."'"));
if(WORD_CENSOR) {
$topic = $this->wordCensor($topic);
$text = $this->wordCensor($text);
}
if($topic == "") $topic = "No subject";
if(!preg_match('/\[message\]/',$text) && !preg_match('/\[\/message\]/',$text)){
$text = "[message]".$text."[/message]";
$alliance = $player = $coor = $report = 0;
for ( $i = 0; $i <= $alliance; $i ++ ) {
if ( preg_match( '/\[alliance' . $i . '\]/', $text ) && preg_match( '/\[\/alliance' . $i . '\]/', $text ) ) {
$alliance1 = preg_replace( '/\[message\](.*?)\[\/alliance' . $i . '\]/is', '', $text );
if ( preg_match( '/\[alliance' . $i . '\]/', $alliance1 ) && preg_match( '/\[\/alliance' . $i . '\]/', $alliance1 ) ) {
$j = $i + 1;
$alliance2 = preg_replace( '/\[\/alliance' . $i . '\](.*?)\[\/message\]/is', '', $text );
$alliance1 = preg_replace( '/\[alliance' . $i . '\]/', '[alliance' . $j . ']', $alliance1 );
$alliance1 = preg_replace( '/\[\/alliance' . $i . '\]/', '[/alliance' . $j . ']', $alliance1 );
$text = $alliance2 . "[/alliance" . $i . "]" . $alliance1;
$alliance += 1;
}
}
}
for ( $i = 0; $i <= $player; $i ++ ) {
if ( preg_match( '/\[player' . $i . '\]/', $text ) && preg_match( '/\[\/player' . $i . '\]/', $text ) ) {
$player1 = preg_replace( '/\[message\](.*?)\[\/player' . $i . '\]/is', '', $text );
if ( preg_match( '/\[player' . $i . '\]/', $player1 ) && preg_match( '/\[\/player' . $i . '\]/', $player1 ) ) {
$j = $i + 1;
$player2 = preg_replace( '/\[\/player' . $i . '\](.*?)\[\/message\]/is', '', $text );
$player1 = preg_replace( '/\[player' . $i . '\]/', '[player' . $j . ']', $player1 );
$player1 = preg_replace( '/\[\/player' . $i . '\]/', '[/player' . $j . ']', $player1 );
$text = $player2 . "[/player" . $i . "]" . $player1;
$player += 1;
}
}
}
for ( $i = 0; $i <= $coor; $i ++ ) {
if ( preg_match( '/\[coor' . $i . '\]/', $text ) && preg_match( '/\[\/coor' . $i . '\]/', $text ) ) {
$coor1 = preg_replace( '/\[message\](.*?)\[\/coor' . $i . '\]/is', '', $text );
if ( preg_match( '/\[coor' . $i . '\]/', $coor1 ) && preg_match( '/\[\/coor' . $i . '\]/', $coor1 ) ) {
$j = $i + 1;
$coor2 = preg_replace( '/\[\/coor' . $i . '\](.*?)\[\/message\]/is', '', $text );
$coor1 = preg_replace( '/\[coor' . $i . '\]/', '[coor' . $j . ']', $coor1 );
$coor1 = preg_replace( '/\[\/coor' . $i . '\]/', '[/coor' . $j . ']', $coor1 );
$text = $coor2 . "[/coor" . $i . "]" . $coor1;
$coor += 1;
}
}
}
for ( $i = 0; $i <= $report; $i ++ ) {
if ( preg_match( '/\[report' . $i . '\]/', $text ) && preg_match( '/\[\/report' . $i . '\]/', $text ) ) {
$report1 = preg_replace( '/\[message\](.*?)\[\/report' . $i . '\]/is', '', $text );
if ( preg_match( '/\[report' . $i . '\]/', $report1 ) && preg_match( '/\[\/report' . $i . '\]/', $report1 ) ) {
$j = $i + 1;
$report2 = preg_replace( '/\[\/report' . $i . '\](.*?)\[\/message\]/is', '', $text );
$report1 = preg_replace( '/\[report' . $i . '\]/', '[report' . $j . ']', $report1 );
$report1 = preg_replace( '/\[\/report' . $i . '\]/', '[/report' . $j . ']', $report1 );
$text = $report2 . "[/report" . $i . "]" . $report1;
$report += 1;
}
}
}
if($permission['opt7'] == 1){
if ($userally > 0) {
while ($allmembers = mysqli_fetch_array($allmembersQ)) {
$database->sendMessage($allmembers[id],$session->uid,htmlspecialchars(addslashes($topic)),htmlspecialchars(addslashes($text)),0,$alliance,$player,$coor,$report);
}
}
}
}
}
private function sendMessage($recieve, $topic, $text, $security_check = true) {
global $session, $database;
$user = $database->getUserField($recieve, "id", 1);
// Vulnerability closed by Shadow
if ($security_check) {
$q = "SELECT Count(*) as Total FROM ".TB_PREFIX."mdata WHERE owner='".$session->uid."' AND time > ".(time() - 60);
$res = mysqli_fetch_array(mysqli_query($database->dblink,$q), MYSQLI_ASSOC);
if($res['Total'] > 5) return; //flooding prevention
}
// Vulnerability closed by Shadow
if(WORD_CENSOR) {
$topic = $this->wordCensor($topic);
$text = $this->wordCensor($text);
}
if(empty($topic)) $topic = "No subject";
if ( ! preg_match( '/\[message\]/', $text ) && ! preg_match( '/\[\/message\]/', $text ) ) {
$text = "[message]" . $text . "[/message]";
$alliance = $player = $coor = $report = 0;
for ( $i = 0; $i <= $alliance; $i ++ ) {
if ( preg_match( '/\[alliance' . $i . '\]/', $text ) && preg_match( '/\[\/alliance' . $i . '\]/', $text ) ) {
$alliance1 = preg_replace( '/\[message\](.*?)\[\/alliance' . $i . '\]/is', '', $text );
if ( preg_match( '/\[alliance' . $i . '\]/', $alliance1 ) && preg_match( '/\[\/alliance' . $i . '\]/', $alliance1 ) ) {
$j = $i + 1;
$alliance2 = preg_replace( '/\[\/alliance' . $i . '\](.*?)\[\/message\]/is', '', $text );
$alliance1 = preg_replace( '/\[alliance' . $i . '\]/', '[alliance' . $j . ']', $alliance1 );
$alliance1 = preg_replace( '/\[\/alliance' . $i . '\]/', '[/alliance' . $j . ']', $alliance1 );
$text = $alliance2 . "[/alliance" . $i . "]" . $alliance1;
$alliance += 1;
}
}
}
for ( $i = 0; $i <= $player; $i ++ ) {
if ( preg_match( '/\[player' . $i . '\]/', $text ) && preg_match( '/\[\/player' . $i . '\]/', $text ) ) {
$player1 = preg_replace( '/\[message\](.*?)\[\/player' . $i . '\]/is', '', $text );
if ( preg_match( '/\[player' . $i . '\]/', $player1 ) && preg_match( '/\[\/player' . $i . '\]/', $player1 ) ) {
$j = $i + 1;
$player2 = preg_replace( '/\[\/player' . $i . '\](.*?)\[\/message\]/is', '', $text );
$player1 = preg_replace( '/\[player' . $i . '\]/', '[player' . $j . ']', $player1 );
$player1 = preg_replace( '/\[\/player' . $i . '\]/', '[/player' . $j . ']', $player1 );
$text = $player2 . "[/player" . $i . "]" . $player1;
$player += 1;
}
}
}
for ( $i = 0; $i <= $coor; $i ++ ) {
if ( preg_match( '/\[coor' . $i . '\]/', $text ) && preg_match( '/\[\/coor' . $i . '\]/', $text ) ) {
$coor1 = preg_replace( '/\[message\](.*?)\[\/coor' . $i . '\]/is', '', $text );
if ( preg_match( '/\[coor' . $i . '\]/', $coor1 ) && preg_match( '/\[\/coor' . $i . '\]/', $coor1 ) ) {
$j = $i + 1;
$coor2 = preg_replace( '/\[\/coor' . $i . '\](.*?)\[\/message\]/is', '', $text );
$coor1 = preg_replace( '/\[coor' . $i . '\]/', '[coor' . $j . ']', $coor1 );
$coor1 = preg_replace( '/\[\/coor' . $i . '\]/', '[/coor' . $j . ']', $coor1 );
$text = $coor2 . "[/coor" . $i . "]" . $coor1;
$coor += 1;
}
}
}
for ( $i = 0; $i <= $report; $i ++ ) {
if ( preg_match( '/\[report' . $i . '\]/', $text ) && preg_match( '/\[\/report' . $i . '\]/', $text ) ) {
$report1 = preg_replace( '/\[message\](.*?)\[\/report' . $i . '\]/is', '', $text );
if ( preg_match( '/\[report' . $i . '\]/', $report1 ) && preg_match( '/\[\/report' . $i . '\]/', $report1 ) ) {
$j = $i + 1;
$report2 = preg_replace( '/\[\/report' . $i . '\](.*?)\[\/message\]/is', '', $text );
$report1 = preg_replace( '/\[report' . $i . '\]/', '[report' . $j . ']', $report1 );
$report1 = preg_replace( '/\[\/report' . $i . '\]/', '[/report' . $j . ']', $report1 );
$text = $report2 . "[/report" . $i . "]" . $report1;
$report += 1;
}
}
}
// 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);
}
}
public function sendWelcome($uid, $username) {
global $database;
$welcomemsg = file_get_contents("GameEngine/Admin/welcome.tpl");
$welcomemsg = "[message]".preg_replace(
["'%USER%'", "'%START%'", "'%TIME%'", "'%PLAYERS%'", "'%ALLI%'", "'%SERVER_NAME%'", "'%PROTECTION%'"],
[$username, date("y.m.d", COMMENCE), date("H:i", COMMENCE), $database->countUser(), $database->countAlli(), SERVER_NAME, round((PROTECTION/3600))],
$welcomemsg
)."[/message]";
return $database->sendMessage($uid, 1, WEL_TOPIC, addslashes($welcomemsg), 0, 0, 0, 0, 0);
}
private function wordCensor($text) {
$censorarray = explode(",", CENSORED);
foreach($censorarray as $key => $value) {
$censorarray[$key] = "/" . $value . "/i";
}
return preg_replace($censorarray, "****", $text);
}
private function checkUnread() {
global $database, $session;
return $database->getUnreadMessagesCount($session->uid);
}
private function checkNUnread() {
global $database, $session;
return $database->getUnreadNoticesCount($session->uid);
}
private function findInbox($id) {
if(!empty($this->inbox)){
foreach($this->inbox as $message){
if($message['id'] == $id) return true;
}
}
return false;
}
private function findSent($id){
if(!empty($this->sent)){
foreach($this->sent as $message){
if($message['id'] == $id) return true;
}
}
return false;
}
private function findArchive($id){
if(!empty($this->archived)){
foreach($this->archived as $message){
if($message['id'] == $id) return true;
}
}
return false;
}
public function addFriends($post){
global $database;
for($i = 0; $i <= 19; $i++){
if($post['addfriends'.$i] != ""){
$uid = $database->getUserField($post['addfriends'.$i], "id", 1);
$added = 0;
for($j = 0; $j <= $i; $j++){
if($added == 0){
$user = $database->getUserField($post['myid'], "friend".$j, 0);
$userwait = $database->getUserField($post['myid'], "friend".$j."wait", 0);
$exist = 0;
for($k = 0; $k <= 19; $k++){
$user1 = $database->getUserField($post['myid'], "friend".$k, 0);
if($user1 == $uid or $uid == $post['myid']){
$exist = 1;
}
}
if($user == 0 && $userwait == 0 && $exist == 0){
$added1 = 0;
for($l = 0; $l <= 19; $l++){
$user2 = $database->getUserField($uid, "friend".$l, 0);
$userwait2 = $database->getUserField($uid, "friend".$l."wait", 0);
if($user2 == 0 && $userwait2 == 0 && $added1 == 0){
$database->addFriend($uid, "friend".$l."wait", $post['myid']);
$added1 = 1;
}
}
$database->addFriend($post['myid'], "friend".$j, $uid);
$database->addFriend($post['myid'], "friend".$j."wait", $uid);
$added = 1;
}
}
}
}
}
header("Location: nachrichten.php?t=1");
exit();
}
};
-58
View File
@@ -1,58 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename Multisort.php ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ##
#################################################################################
class multiSort {
function sorte($array)
{
for($i = 1; $i < func_num_args(); $i += 3)
{
$key = func_get_arg($i);
$order = true;
if($i + 1 < func_num_args())
$order = func_get_arg($i + 1);
$type = 0;
if($i + 2 < func_num_args())
$type = func_get_arg($i + 2);
$t = function($a, $b) use ($key, $type, $order)
{
switch($type)
{
case 1: // Case insensitive natural.
$result = strcasenatcmp($a[$key], $b[$key]);
break;
case 2: // Numeric.
$result = $a[$key] - $b[$key];
break;
case 3: // Case sensitive string.
$result = strcmp($a[$key], $b[$key]);
break;
case 4: // Case insensitive string.
$result = strcasecmp($a[$key], $b[$key]);
break;
default: // Case sensitive natural.
$result = strnatcmp($a[$key], $b[ $key]);
break;
}
return $result*($order ? 1 : -1);
};
usort($array, $t);
}
return $array;
}
};
$multisort = new multiSort;
?>
-19
View File
@@ -1,19 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename 404.tpl ##
## Developed by: aggenkeech ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2012. All rights reserved. ##
## ##
#################################################################################
?>
<div style="margin-top: 50px;">
<div style="text-align: center">
<h1>404 - File not found</h1>
<img src="../../gpack/travian_default/img/misc/404.gif" title="Not Found" alt="Not Found"><br />
<p>We looked 404 times already but can't find anything, Not even an X marking the spot.</p>
<p>This system is not complete yet. So the page probably does not exist.</p><br>
</div>
</div>
View File
-19
View File
@@ -1,19 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename 404.tpl ##
## Developed by: aggenkeech ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2012. All rights reserved. ##
## ##
#################################################################################
?>
<div style="margin-top: 50px;">
<div style="text-align: center">
<h1>404 - File not found</h1>
<img src="../../gpack/travian_default/img/misc/404.gif" title="Not Found" alt="Not Found"><br />
<p>We looked 404 times already but can't find anything, Not even an X marking the spot.</p>
<p>This system is not complete yet. So the page probably does not exist.</p><br>
</div>
</div>
View File
-191
View File
@@ -1,191 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename Profile.php ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ##
#################################################################################
class Profile {
public function procProfile($post) {
global $session;
if(isset($post['ft'])) {
switch($post['ft']) {
case "p1" :
$this->updateProfile($post);
break;
case "p3" :
$this->updateAccount($post);
break;
case "p4" :
$this->setvactionmode($post);
break;
}
}
if(isset($post['s']) && $post['s'] == 4) $this->gpack($post);
}
public function procSpecial($get) {
global $session;
if(isset($get['e'])) {
switch($get['e']) {
case 2 :
$this->removeMeSit($get);
break;
case 3 :
$this->removeSitter($get);
break;
case 4 :
$this->cancelDeleting($get);
break;
}
}
}
private function updateProfile($post) {
global $database, $session;
$birthday = $post['jahr'].'-'.$post['monat'].'-'.$post['tag'];
$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($session->uid);
for($i = 0; $i < count($varray); $i++){
$database->setVillageName($varray[$i]['wref'], $database->RemoveXSS(trim($post['dname'.$i])));
}
header("Location: spieler.php?uid=".$session->uid);
exit;
}
private function gpack($post) {
global $database, $session;
$database->gpack($database->RemoveXSS($session->uid),$database->RemoveXSS($post['custom_url']));
header("Location: spieler.php?uid=".$session->uid);
exit;
}
/**
* Function to vacation mode - by advocaite and Shadow
*
* @param array $post The $_POST array
*/
private function setvactionmode($post){
global $database, $session, $form;
if(isset($post['vac']) && $post['vac'] && isset($post['vac_days']) && $post['vac_days'] >= 2 && $post['vac_days'] <= 14){
unset($_SESSION['wid']);
$database->setvacmode($session->uid, $post['vac_days']);
$database->activeModify(addslashes($session->username), 1);
$database->UpdateOnline("logout");
$session->Logout();
header("Location: login.php");
exit;
}else{
$form->add("vac", VAC_MODE_WRONG_DAYS);
header("Location: spieler.php?s=".$session->uid);
exit;
}
}
/**
* Function to vacation mode - by advocaite and Shadow
*
* @param array $post The $_POST array
*/
private function updateAccount($post) {
global $database, $session, $form;
if(!empty($post['pw1']) && !empty($post['pw2']) && !empty($post['pw3'])){
if($post['pw2'] == $post['pw3']){
if($database->login($session->username, $post['pw1'])){
$database->updateUserField($session->uid, "password", password_hash($post['pw2'], PASSWORD_BCRYPT, ['cost' => 12]), 1);
}
else $form->addError("pw", LOGIN_PW_ERROR);
}
else $form->addError("pw", PASS_MISMATCH);
}
if(!empty($post['email_alt']) && !empty($post['email_neu'])){
if($post['email_alt'] == $session->userinfo['email']){
$database->updateUserField($session->uid, "email", $post['email_neu'], 1);
}
else $form->addError("email", EMAIL_ERROR);
}
if(!empty($post['del_pw']) && $post['del']){
if(password_verify($post['del_pw'], $session->userinfo['password'])){
$database->setDeleting($session->uid, 0);
}
else $form->addError("del", PASS_MISMATCH);
}
if(!empty($post['v1'])){
$sitid = $database->getUserField($post['v1'], "id", 1);
if($sitid == $session->userinfo['sit1'] || $sitid == $session->userinfo['sit2']){
$form->addError("sit", SIT_ERROR);
}else if($sitid != $session->uid){
if($session->userinfo['sit1'] == 0){
$database->updateUserField($session->uid, "sit1", $sitid, 1);
}else if($session->userinfo['sit2'] == 0){
$database->updateUserField($session->uid, "sit2", $sitid, 1);
}
}
}
if($form->returnErrors() > 0){
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $_POST;
}
header("Location: spieler.php?s=3");
exit;
}
private function removeSitter($get) {
global $database,$session;
if($get['a'] == $session->checker) {
if($session->userinfo['sit'.$get['type']] == $get['id']) {
$database->updateUserField($session->uid,"sit".$get['type'],0,1);
}
$session->changeChecker();
}
header("Location: spieler.php?s=".$get['s']);
exit;
}
private function cancelDeleting($get) {
global $database, $session;
$database->setDeleting($session->uid,1);
header("Location: spieler.php?s=".$get['s']);
exit;
}
private function removeMeSit($get) {
global $database, $session;
if($get['a'] == $session->checker) {
$database->removeMeSit($get['id'],$session->uid);
$session->changeChecker();
}
header("Location: spieler.php?s=".$get['s']);
exit;
}
};
$profile = new Profile;
?>
-26
View File
@@ -1,26 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename Protection.php ##
## Developed by: SlimShady ##
## Edited by: Dzoki & Dixie ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ##
#################################################################################
//heef npc uitzondering omdat die met speciaal $_post werken
if(isset($_POST)){
if(!isset($_POST['ft'])){
//$_POST = @array_map('mysqli_real_escape_string', $_POST);
$_POST = array_map('htmlspecialchars', $_POST);
}
}
$rsargs=$_GET['rsargs'];
//$_GET = array_map('mysqli_real_escape_string', $_GET);
$_GET = array_map('htmlspecialchars', $_GET);
$_GET['rsargs']=$rsargs;
//$_COOKIE = array_map('mysqli_real_escape_string', $_COOKIE);
$_COOKIE = array_map('htmlspecialchars', $_COOKIE);
?>
-592
View File
@@ -1,592 +0,0 @@
<?php
/** --------------------------------------------------- **\
| ********* DO NOT REMOVE THIS COPYRIGHT NOTICE ********* |
+---------------------------------------------------------+
| Credits: All the developers including the leaders: |
| Advocaite & Dzoki & Donnchadh |
| |
| Copyright: TravianX Project All rights reserved |
\** --------------------------------------------------- **/
class Ranking {
public $rankarray = [];
private $rlastupdate;
public function getRank() {
return $this->rankarray;
}
public function getUserRank($id) {
global $database;
$ranking = $this->getRank();
$users = "SELECT Count(*) as Total FROM " . TB_PREFIX . "users WHERE access < " . (INCLUDE_ADMIN ? "10" : "8");
$users2 = mysqli_fetch_array(mysqli_query($database->dblink,$users), MYSQLI_ASSOC);
$users2 = $users2['Total'];
$users3 = $users2 + 1;
$myrank = 0;
if(count($ranking) > 0) {
for($i = 0;$i < $users3; $i++) {
if( isset( $ranking[$i]['userid'] ) ) {
if($ranking[$i]['userid'] == $id && $ranking[$i] != "pad") {
$myrank = $i;
}
}
}
}
return $myrank;
}
public function procRankReq($get) {
global $village, $session;
if(isset($get['id'])) {
switch($get['id']) {
case 1:
$this->procRankArray();
break;
case 8:
$this->procHeroRankArray();
if($get['hero'] == 0) {
$this->getStart(1);
} else {
$this->getStart($this->searchRank($session->uid, "uid"));
}
break;
case 11:
$this->procRankRaceArray(1);
if($this->searchRank($session->uid, "userid") != 0){
$this->getStart($this->searchRank($session->uid, "userid"));
}else{
$this->getStart(1);
}
break;
case 12:
$this->procRankRaceArray(2);
if($this->searchRank($session->uid, "userid") != 0){
$this->getStart($this->searchRank($session->uid, "userid"));
}else{
$this->getStart(1);
}
break;
case 13:
$this->procRankRaceArray(3);
if($this->searchRank($session->uid, "userid") != 0){
$this->getStart($this->searchRank($session->uid, "userid"));
}else{
$this->getStart(1);
}
break;
case 31:
$this->procAttRankArray();
$this->getStart($this->searchRank($session->uid, "userid"));
break;
case 32:
$this->procDefRankArray();
$this->getStart($this->searchRank($session->uid, "userid"));
break;
case 2:
$this->procVRankArray();
$this->getStart($this->searchRank($village->wid, "wref"));
break;
case 4:
$this->procARankArray();
if($get['aid'] == 0) {
$this->getStart(1);
} else {
$this->getStart($this->searchRank($get['aid'], "id"));
}
break;
case 41:
$this->procAAttRankArray();
if($get['aid'] == 0) {
$this->getStart(1);
} else {
$this->getStart($this->searchRank($get['aid'], "id"));
}
break;
case 42:
$this->procADefRankArray();
if($get['aid'] == 0) {
$this->getStart(1);
} else {
$this->getStart($this->searchRank($get['aid'], "id"));
}
break;
}
} else {
$this->procRankArray();
$this->getStart($this->searchRank($session->uid, "userid"));
}
}
public function procRank($post) {
if(isset($post['ft'])) {
switch($post['ft']) {
case "r1":
case "r11":
case "r12":
case "r13":
case "r31":
case "r32":
if(isset($post['rank']) && $post['rank'] != "") {
$this->getStart($post['rank']);
}
if(isset($post['name']) && $post['name'] != "") {
$this->getStart($this->searchRank(stripslashes($post['name']), "username"));
}
break;
case "r4":
case "r42":
case "r41":
if(isset($post['rank']) && $post['rank'] != "") {
$this->getStart($post['rank']);
}
if(isset($post['name']) && $post['name'] != "") {
$this->getStart($this->searchRank(stripslashes($post['name']), "tag"));
}
break;
case "r2":
case "r8":
if(isset($post['rank']) && $post['rank'] != "") {
$this->getStart($post['rank']);
}
if(isset($post['name']) && $post['name'] != "") {
$this->getStart($this->searchRank(stripslashes($post['name']), "name"));
}
break;
}
}
}
private function getStart($search) {
$multiplier = 1;
if(!is_numeric($search)) {
$_SESSION['search'] = $search;
} else {
if($search > count($this->rankarray)) {
$search = count($this->rankarray) - 1;
}
while($search > (20 * $multiplier)) {
$multiplier += 1;
}
$start = 20 * $multiplier - 19 - 1;
$_SESSION['search'] = $search;
$_SESSION['start'] = $start;
}
}
public function getAllianceRank($id) {
$this->procARankArray();
while(1) {
if(count($this->rankarray) > 1) {
$key = key($this->rankarray);
if(isset ($this->rankarray[$key]["id"]) && $this->rankarray[$key]["id"] === $id) {
return $key;
break;
} else {
if(!next($this->rankarray)) {
return false;
break;
}
}
} else {
return 1;
}
}
}
public function searchRank($name, $field) {
while(1) {
//$key = key($this->rankarray);
for($key = 0; $key < count($this->rankarray); $key++){
if($this->rankarray[$key]!="pad") {
if($this->rankarray[$key][$field] == $name) return $key;
}
}
if(!next($this->rankarray)) {
if($field != "userid") return $name;
else return 0;
}
}
}
public function procRankArray() {
global $multisort, $database;
if($GLOBALS['db']->countUser() > 0){
$holder = array();
if(SHOW_NATARS == True){
$q = "SELECT " . TB_PREFIX . "users.id userid, " . TB_PREFIX . "users.username username, " . TB_PREFIX . "users.oldrank oldrank, " . TB_PREFIX . "users.alliance alliance, (
SELECT SUM( " . TB_PREFIX . "vdata.pop )
FROM " . TB_PREFIX . "vdata
WHERE " . TB_PREFIX . "vdata.owner = userid
)totalpop, (
SELECT COUNT( " . TB_PREFIX . "vdata.wref )
FROM " . TB_PREFIX . "vdata
WHERE " . TB_PREFIX . "vdata.owner = userid AND type != 99
)totalvillages, (
SELECT " . TB_PREFIX . "alidata.tag
FROM " . TB_PREFIX . "alidata, " . TB_PREFIX . "users
WHERE " . TB_PREFIX . "alidata.id = " . TB_PREFIX . "users.alliance
AND " . TB_PREFIX . "users.id = userid
)allitag
FROM " . TB_PREFIX . "users
WHERE " . TB_PREFIX . "users.access < " . (INCLUDE_ADMIN ? "10" : "8") . "
AND (" . TB_PREFIX . "users.tribe <= 5 OR " . TB_PREFIX . "users.tribe = 5)
AND (" . TB_PREFIX . "users.id > 5 OR " . TB_PREFIX . "users.id = 3)
ORDER BY totalpop DESC, totalvillages DESC, userid DESC";
} else {
$q = "SELECT " . TB_PREFIX . "users.id userid, " . TB_PREFIX . "users.username username, " . TB_PREFIX . "users.oldrank oldrank, " . TB_PREFIX . "users.alliance alliance, (
SELECT SUM( " . TB_PREFIX . "vdata.pop )
FROM " . TB_PREFIX . "vdata
WHERE " . TB_PREFIX . "vdata.owner = userid
)totalpop, (
SELECT COUNT( " . TB_PREFIX . "vdata.wref )
FROM " . TB_PREFIX . "vdata
WHERE " . TB_PREFIX . "vdata.owner = userid AND type != 99
)totalvillages, (
SELECT " . TB_PREFIX . "alidata.tag
FROM " . TB_PREFIX . "alidata, " . TB_PREFIX . "users
WHERE " . TB_PREFIX . "alidata.id = " . TB_PREFIX . "users.alliance
AND " . TB_PREFIX . "users.id = userid
)allitag
FROM " . TB_PREFIX . "users
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";
}
$datas = [];
$result = (mysqli_query($database->dblink,$q));
while($row = mysqli_fetch_assoc($result)) $datas[] = $row;
if (count($datas)) {
foreach($datas as $result) {
$value['userid'] = $result['userid'];
$value['username'] = $result['username'];
$value['oldrank'] = $result['oldrank'];
$value['alliance'] = $result['alliance'];
$value['aname'] = $result['allitag'];
$value['totalpop'] = $result['totalpop'];
$value['totalvillage'] = $result['totalvillages'];
array_push($holder, $value);
}
}
$newholder = ["pad"];
foreach($holder as $key) array_push($newholder, $key);
$this->rankarray = $newholder;
}
}
public function procRankRaceArray($race) {
global $multisort, $database;
$race = $database->escape((int) $race);
//$array = $GLOBALS['db']->getRanking();
$holder = array();
//$value['totalvillage'] = count($GLOBALS['db']->getVillagesID($value['id']));
//$value['totalvillage'] = count($GLOBALS['db']->getVillagesID($value['id']));
//$value['totalpop'] = $GLOBALS['db']->getVSumField($value['id'],"pop");
//$value['aname'] = $GLOBALS['db']->getAllianceName($value['alliance']);
$q = "SELECT " . TB_PREFIX . "users.id userid, " . TB_PREFIX . "users.tribe tribe, " . TB_PREFIX . "users.username username," . TB_PREFIX . "users.alliance alliance, (
SELECT SUM( " . TB_PREFIX . "vdata.pop )
FROM " . TB_PREFIX . "vdata
WHERE " . TB_PREFIX . "vdata.owner = userid
)totalpop, (
SELECT COUNT( " . TB_PREFIX . "vdata.wref )
FROM " . TB_PREFIX . "vdata
WHERE " . TB_PREFIX . "vdata.owner = userid AND type != 99
)totalvillages, (
SELECT " . TB_PREFIX . "alidata.tag
FROM " . TB_PREFIX . "alidata, " . TB_PREFIX . "users
WHERE " . TB_PREFIX . "alidata.id = " . TB_PREFIX . "users.alliance
AND " . TB_PREFIX . "users.id = userid
)allitag
FROM " . TB_PREFIX . "users
WHERE " . TB_PREFIX . "users.tribe = $race AND " . TB_PREFIX . "users.access < " . (INCLUDE_ADMIN ? "10" : "8") . "
AND " . TB_PREFIX . "users.id > 5
ORDER BY totalpop DESC, totalvillages DESC, userid DESC";
$result = (mysqli_query($database->dblink,$q));
while($row = mysqli_fetch_assoc($result)) {
$datas[] = $row;
}
if(mysqli_num_rows($result)) {
foreach($datas as $result) {
$value['userid'] = $result['userid'];
$value['username'] = $result['username'];
$value['alliance'] = $result['alliance'];
$value['aname'] = $result['allitag'];
$value['totalpop'] = $result['totalpop'];
$value['totalvillage'] = $result['totalvillages'];
//SELECT (SELECT SUM(".TB_PREFIX."vdata.pop) FROM ".TB_PREFIX."vdata WHERE ".TB_PREFIX."vdata.owner = 2) totalpop, (SELECT COUNT(".TB_PREFIX."vdata.wref) FROM ".TB_PREFIX."vdata WHERE ".TB_PREFIX."vdata.owner = 2) totalvillages, (SELECT ".TB_PREFIX."alidata.tag FROM ".TB_PREFIX."alidata WHERE ".TB_PREFIX."alidata.id = ".TB_PREFIX."users.alliance AND ".TB_PREFIX."users.id = 2);
array_push($holder, $value);
}
} else {
$value['userid'] = 0;
$value['username'] = "No User";
$value['alliance'] = "";
$value['aname'] = "";
$value['totalpop'] = "";
$value['totalvillage'] = "";
array_push($holder, $value);
}
//$holder = $multisort->sorte($holder, "'totalvillage'", false, 2, "'totalpop'", false, 2);
$newholder = array("pad");
foreach($holder as $key) {
array_push($newholder, $key);
}
$this->rankarray = $newholder;
}
public function procAttRankArray() {
global $multisort, $database;
//$array = $GLOBALS['db']->getRanking();
$holder = array();
//$value['totalvillage'] = count($GLOBALS['db']->getVillagesID($value['id']));
//$value['totalpop'] = $GLOBALS['db']->getVSumField($value['id'],"pop");
$q = "SELECT " . TB_PREFIX . "users.id userid, " . TB_PREFIX . "users.username username, " . TB_PREFIX . "users.apall, (
SELECT COUNT( " . TB_PREFIX . "vdata.wref )
FROM " . TB_PREFIX . "vdata
WHERE " . TB_PREFIX . "vdata.owner = userid AND type != 99
)totalvillages, (
SELECT SUM( " . TB_PREFIX . "vdata.pop )
FROM " . TB_PREFIX . "vdata
WHERE " . TB_PREFIX . "vdata.owner = userid
)pop
FROM " . TB_PREFIX . "users
WHERE " . TB_PREFIX . "users.apall >=0 AND " . TB_PREFIX . "users.access < " . (INCLUDE_ADMIN ? "10" : "8") . " AND " . TB_PREFIX . "users.tribe <= 3
AND " . TB_PREFIX . "users.id > 5
ORDER BY " . TB_PREFIX . "users.apall DESC, pop DESC, userid DESC";
$result = mysqli_query($database->dblink,$q) or die(mysqli_error($database->dblink));
while($row = mysqli_Fetch_assoc($result)) {
$datas[] = $row;
}
foreach($datas as $key => $row) {
$value['userid'] = $row['userid'];
$value['username'] = $row['username'];
$value['totalvillages'] = $row['totalvillages'];
$value['id'] = $row['userid'];
$value['totalpop'] = $row['pop'];
$value['apall'] = $row['apall'];
array_push($holder, $value);
printf("\n<!-- %s %s %s %s -->\n", $value['username'], $value['totalvillages'], $value['totalpop'], $value['apall']);
}
//$holder = $multisort->sorte($holder, "'ap'", false, 2, "'totalvillages'", false, 2, "'ap'", false, 2);
$newholder = array("pad");
foreach($holder as $key) {
array_push($newholder, $key);
}
$this->rankarray = $newholder;
}
public function procDefRankArray() {
global $database;
//global $GLOBALS['db'], $multisort;
//$array = $GLOBALS['db']->getRanking();
$holder = array();
$q = "SELECT " . TB_PREFIX . "users.id userid, " . TB_PREFIX . "users.username username, " . TB_PREFIX . "users.dpall, (
SELECT COUNT( " . TB_PREFIX . "vdata.wref )
FROM " . TB_PREFIX . "vdata
WHERE " . TB_PREFIX . "vdata.owner = userid AND type != 99
)totalvillages, (
SELECT SUM( " . TB_PREFIX . "vdata.pop )
FROM " . TB_PREFIX . "vdata
WHERE " . TB_PREFIX . "vdata.owner = userid
)pop
FROM " . TB_PREFIX . "users
WHERE " . TB_PREFIX . "users.dpall >=0 AND " . TB_PREFIX . "users.access < " . (INCLUDE_ADMIN ? "10" : "8") . " AND " . TB_PREFIX . "users.tribe <= 3
AND " . TB_PREFIX . "users.id > 5
ORDER BY " . TB_PREFIX . "users.dpall DESC, pop DESC, userid DESC";
$result = mysqli_query($database->dblink,$q) or die(mysqli_error($database->dblink));
while($row = mysqli_Fetch_assoc($result)) {
$datas[] = $row;
}
foreach($datas as $key => $row) {
$value['userid'] = $row['userid'];
$value['username'] = $row['username'];
$value['totalvillages'] = $row['totalvillages'];
$value['id'] = $row['userid'];
$value['totalpop'] = $row['pop'];
$value['dpall'] = $row['dpall'];
array_push($holder, $value);
}
//$holder = $multisort->sorte($holder, "'dpall'", false, 2, "'totalvillage'", false, 2, "'dpall'", false, 2);
$newholder = array("pad");
foreach($holder as $key) {
array_push($newholder, $key);
}
$this->rankarray = $newholder;
}
public function procVRankArray() {
global $multisort;
$array = $GLOBALS['db']->getVRanking();
$holder = array();
foreach($array as $value) {
$coor = $GLOBALS['db']->getCoor($value['wref']);
$value['x'] = $coor['x'];
$value['y'] = $coor['y'];
$value['user'] = $GLOBALS['db']->getUserField($value['owner'], "username", 0);
array_push($holder, $value);
}
$holder = $multisort->sorte($holder, "x", true, 2, "y", true, 2, "pop", false, 2);
$newholder = array("pad");
foreach($holder as $key) {
array_push($newholder, $key);
}
$this->rankarray = $newholder;
}
public function procARankArray() {
global $multisort, $database;
$array = $GLOBALS['db']->getARanking();
$holder = array();
foreach($array as $value) {
$memberlist = $GLOBALS['db']->getAllMember($value['id']);
$totalpop = 0;
$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'])) {
$value['avg'] = @round($totalpop / count($memberlist));
} else {
$value['avg'] = 0;
}
array_push($holder, $value);
}
$holder = $multisort->sorte($holder, "totalpop", false, 2);
$newholder = array("pad");
foreach($holder as $key) {
array_push($newholder, $key);
}
$this->rankarray = $newholder;
}
public function procHeroRankArray() {
global $multisort;
$array = $GLOBALS['db']->getHeroRanking();
$holder = array();
foreach($array as $value) {
$value['owner'] = $GLOBALS['db']->getUserField($value['uid'], "username", 0);
$value['level'];
$value['name'];
$value['uid'];
array_push($holder, $value);
}
$holder = $multisort->sorte($holder, "experience", false, 2);
$newholder = array("pad");
foreach($holder as $key) {
array_push($newholder, $key);
}
$this->rankarray = $newholder;
}
public function procAAttRankArray() {
global $multisort;
$array = $GLOBALS['db']->getARanking();
$holder = array();
foreach($array as $value) {
$memberlist = $GLOBALS['db']->getAllMember($value['id']);
$totalap = 0;
foreach($memberlist as $member) {
$totalap += $member['ap'];
}
$value['players'] = count($memberlist);
$value['totalap'] = $totalap;
if($value['avg'] > 0) {
$value['avg'] = round($totalap / count($memberlist));
} else {
$value['avg'] = 0;
}
array_push($holder, $value);
}
$holder = $multisort->sorte($holder, "Aap", false, 2);
$newholder = array("pad");
foreach($holder as $key) {
array_push($newholder, $key);
}
$this->rankarray = $newholder;
}
public function procADefRankArray() {
global $multisort;
$array = $GLOBALS['db']->getARanking();
$holder = array();
foreach($array as $value) {
$memberlist = $GLOBALS['db']->getAllMember($value['id']);
$totaldp = 0;
foreach($memberlist as $member) {
$totaldp += $member['dp'];
}
$value['players'] = count($memberlist);
$value['totaldp'] = $totaldp;
if($value['avg'] > 0) {
$value['avg'] = round($totalap / count($memberlist));
} else {
$value['avg'] = 0;
}
array_push($holder, $value);
}
$holder = $multisort->sorte($holder, "Adp", false, 2);
$newholder = array("pad");
foreach($holder as $key) {
array_push($newholder, $key);
}
$this->rankarray = $newholder;
}
}
;
$ranking = new Ranking;
?>
-381
View File
@@ -1,381 +0,0 @@
<?php
use App\Entity\User;
ob_start(); // Enesure, that no more header already been sent error not showing up again
mb_internal_encoding("UTF-8"); // Add for utf8 varriables.
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Project: TravianZ ##
## Version: 22.06.2015 ##
## Filename Session.php ##
## Developed by: Mr.php , Advocaite , brainiacX , yi12345 , Shadow , ronix ##
## Fixed by: Shadow - STARVATION , HERO FIXED COMPL. ##
## Fixed by: InCube - double troops ##
## License: TravianZ Project ##
## Copyright: TravianZ (c) 2010-2015. All rights reserved. ##
## URLs: http://travian.shadowss.ro ##
## Source code: https://github.com/Shadowss/TravianZ ##
## ##
#################################################################################
global $autoprefix;
// go max 5 levels up - we don't have folders that go deeper than that
$autoprefix = '';
for ($i = 0; $i < 5; $i++) {
$autoprefix = str_repeat('../', $i);
if (file_exists($autoprefix.'autoloader.php')) {
// we have our path, let's leave
break;
}
}
if(!file_exists($autoprefix.'GameEngine/config.php')) {
header("Location: install/");
exit;
}
$script_name = ($_SERVER['REQUEST_URI'] == 'karte.php') ? 'karte' : $_SERVER['REQUEST_URI'];
include_once ("Battle.php");
include_once ("Data/buidata.php");
include_once ("Data/cp.php");
include_once ("Data/cel.php");
include_once ("Data/resdata.php");
include_once ("Data/unitdata.php");
include_once ("Data/hero_full.php");
include_once ("config.php");
include_once ("Database.php");
include_once ("Mailer.php");
include_once ("Form.php");
include_once ("Generator.php");
include_once ("Multisort.php");
include_once ("Ranking.php");
include_once ("Lang/" . LANG . ".php");
include_once ("Logging.php");
include_once ("Message.php");
include_once ("Alliance.php");
include_once ("Profile.php");
class Session {
private $time;
var $logged_in = false;
var $referrer, $url;
var $username, $uid, $access, $plus, $tribe, $isAdmin, $alliance, $gold, $oldrank, $gpack, $goldclub;
var $bonus = 0;
var $bonus1 = 0;
var $bonus2 = 0;
var $bonus3 = 0;
var $bonus4 = 0;
var $timer = 0;
var $sharedForums = [];
var $checker, $mchecker;
public $userinfo = [];
private $userarray = [];
var $villages = [];
function __construct() {
global $database; //TienTN fix
$this->time = time();
if (!isset($_SESSION)) session_start();
$this->logged_in = $this->checkLogin();
if($this->logged_in && TRACK_USR) $database->updateActiveUser($this->username, $this->time);
if(isset($_SESSION['url'])) $this->referrer = $_SESSION['url'];
else $this->referrer = "/";
$this->url = $_SESSION['url'] = $_SERVER['PHP_SELF'];
$this->SurfControl();
}
public function Login($user) {
global $database, $generator, $logging;
$this->logged_in = true;
$_SESSION['sessid'] = $generator->generateRandID();
$_SESSION['username'] = $user;
$user_sanitized = $database->escape($user);
$_SESSION['checker'] = $generator->generateRandStr(3);
$_SESSION['mchecker'] = $generator->generateRandStr(5);
$userFields = $database->getUserFields($user_sanitized, "quest, id", 1, true);
$_SESSION['qst'] = $userFields["quest"];
$dbarray = $database->getUserFields($user_sanitized, 'id, village_select', 1);
$selected_village=(int) $dbarray['village_select'];
if ($dbarray['id'] > 1) {
if(!isset($_SESSION['wid'])) {
if(!empty($selected_village)) $data = $database->getVillage($selected_village);
else $data = $database->getVillage($userFields["id"]);
$_SESSION['wid'] = $data['wref'];
} else
if(empty($_SESSION['wid'])) {
if(!empty($selected_village)) $data = $database->getVillage($selected_village);
else $data = $database->getVillage($userFields["id"]);
$_SESSION['wid'] = $data['wref'];
}
$this->PopulateVar();
$database->updateActiveUser($user_sanitized, $this->time);
$database->updateUserField($user_sanitized, "sessid", $_SESSION['sessid'], 0);
}
$logging->addLoginLog($dbarray['id'], $_SERVER['REMOTE_ADDR']);
if ($dbarray['id'] == 1) {
header("Location: nachrichten.php");
exit;
} else {
header("Location: dorf1.php");
exit;
}
}
public function Logout() {
global $database;
$this->logged_in = false;
$database->updateUserField($_SESSION['username'], "sessid", "", 0);
if(ini_get("session.use_cookies")) {
$params = session_get_cookie_params();
setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"]);
}
session_destroy();
session_start();
}
public function changeChecker() {
global $generator;
$this->checker = $_SESSION['checker'] = $generator->generateRandStr(3);
$this->mchecker = $_SESSION['mchecker'] = $generator->generateRandStr(5);
}
private function checkLogin(){
global $database;
$user = $id = '';
$admin = false;
$inAdmin = (strpos($_SERVER['REQUEST_URI'], '/Admin') !== false);
if (!$inAdmin && isset($_SESSION['username'])) {
$user = $_SESSION['username'];
$id = (int) $_SESSION['id_user'];
} else if ($inAdmin && isset($_SESSION['admin_username'])) {
$user = $_SESSION['admin_username'];
$id = (int) $_SESSION['id'];
$admin = true;
}
if($user && ($admin || isset($_SESSION['sessid']))) {
$this->maintenance();
$this->isWinner();
// check if this is not a support user, for who only messages and statistics are available
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');
exit;
}
}
//Get and Populate Data
$this->PopulateVar();
//Check if the player is banned
$this->isBanned();
//update database
$database->updateActiveUser($user, $this->time);
return true;
}
else return false;
}
/**
* Called if the player is banned
*
*/
function isBanned(){
if($this->access == BANNED && !in_array(basename($_SERVER['PHP_SELF']), ['banned.php', 'nachrichten.php', 'rules.php'])){
header('Location: banned.php');
exit;
}
}
/**
* Called when the server is under maintenance
*
*/
function maintenance(){
if($_SESSION['ok'] == 2 && basename($_SERVER['PHP_SELF']) != 'maintenance.php'){
header('Location: maintenance.php');
exit;
}
}
/**
* Called when there's a player who built a WW to level 100
*
*/
function isWinner(){
global $database;
$requiredPage = basename($_SERVER['PHP_SELF']);
if($database->isThereAWinner() && (in_array($requiredPage, ['build.php', 'plus1.php']) ||
(in_array($requiredPage, ['plus.php']) && isset($_GET['id']) && !empty($_GET['id'] && $_GET['id'] >= 7))))
{
header('Location: winner.php');
exit;
}
}
/**
* Function to check Real Hero
* Made by: Shadow and brainiacX
*
*/
function CheckHeroReal () {
global $database,$link;
$villageIDs = implode(', ', $this->villages);
if (!count($this->villages)) {
$this->Logout();
header('login.php');
exit;
}
// check if hero unit for this player is present anywhere on the map
$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';
$heroUnitRegisters = mysqli_fetch_array( mysqli_query($database->dblink, $q, MYSQLI_ASSOC ))['herocount'];
// check if the actual hero is alive or being trained/revived into a living state
$isHeroLivingOrRaising = $database->getHeroDeadReviveOrInTraining($this->uid);
// 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);
}
}
private function PopulateVar() {
global $database;
$this->userarray = $this->userinfo = $database->getUserArray($_SESSION['username'], 0);
$this->username = $this->userarray['username'];
$this->uid = $_SESSION['id_user'] = $this->userarray['id'];
$this->gpack = $this->userarray['gpack'];
$this->access = $this->userarray['access'];
$this->plus = ($this->userarray['plus'] > $this->time);
$this->goldclub = $this->userarray['goldclub'];
$this->villages = $database->getVillagesID($this->uid);
$this->tribe = $this->userarray['tribe'];
$this->isAdmin = $this->access >= MODERATOR;
$this->alliance = $_SESSION['alliance_user'] = $this->userarray['alliance'];
$this->checker = $_SESSION['checker'];
$this->mchecker = $_SESSION['mchecker'];
$this->sit = $database->GetOnline($this->uid);
$this->sit1 = $this->userarray['sit1'];
$this->sit2 = $this->userarray['sit2'];
$this->cp = floor($this->userarray['cp']);
$this->gold = $this->userarray['gold'];
$this->oldrank = $this->userarray['oldrank'];
$this->sharedForums = $database->getSharedForums($this->uid, $this->alliance);
$_SESSION['ok'] = $this->userarray['ok'];
if($this->userarray['b1'] > $this->time) $this->bonus1 = 1;
if($this->userarray['b2'] > $this->time) $this->bonus2 = 1;
if($this->userarray['b3'] > $this->time) $this->bonus3 = 1;
if($this->userarray['b4'] > $this->time) $this->bonus4 = 1;
if (!in_array($this->username, ['Support', 'Multihunter'])) $this->CheckHeroReal();
}
/**
* Creates an array with the vrefs of attacked/scouted/reinforced villages and oasis
*
*/
public function populateAttacks(){
global $database, $village;
$troopsMovement = $database->getMovement(3, $village->wid, 0);
if(count($troopsMovement) > 0){
foreach($troopsMovement as $movement)
{
switch($movement['attack_type']){
case 1:
$_SESSION['troops_movement']['scouts'][] = $movement['to'];
break;
case 2:
$_SESSION['troops_movement']['enforcements'][] = $movement['to'];
break;
case 3:
case 4:
$_SESSION['troops_movement']['attacks'][] = $movement['to'];
break;
}
}
}
}
private function SurfControl(){
if(SERVER_WEB_ROOT) {
$page = $_SERVER['SCRIPT_NAME'];
} else {
$explode = explode("/", $_SERVER['SCRIPT_NAME']);
$i = count($explode) - 1;
$page = $explode[$i];
}
$pagearray = array("index.php", "anleitung.php", "tutorial.php", "login.php", "activate.php", "anmelden.php", "xaccount.php");
if(!$this->logged_in) {
if(!in_array($page, $pagearray) || $page == "logout.php") {
header("Location: login.php");
exit;
}
} else {
if(in_array($page, $pagearray)) {
if ($this->uid == 1) {
header("Location: nachrichten.php");
exit;
} else {
header("Location: dorf1.php");
exit;
}
}
}
}
};
$session = new Session;
$form = new Form;
// if there is no user, we'd try to load messages for user with ID 0, which is wrong
if (!empty($_SESSION['id_user'])) {
$message = new Message;
// create a global user variable which will later be removed from here
// and created + retrieved either via Service Locator or other DI concept
$user = new User((int) $_SESSION['id_user'], $database);
}
?>
-729
View File
@@ -1,729 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename Technology.php ##
## Developed by: Dzoki ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ##
#################################################################################
global $autoprefix;
// even with autoloader created, we can't use it here yet, as it's not been created
// ... so, let's see where it is and include it
$autoloader_found = false;
// go max 5 levels up - we don't have folders that go deeper than that
for ($i = 0; $i < 5; $i++) {
$autoprefix = str_repeat('../', $i);
if (file_exists($autoprefix.'autoloader.php')) {
$autoloader_found = true;
include_once $autoprefix.'autoloader.php';
break;
}
}
if (!$autoloader_found) {
die('Could not find autoloading class.');
}
// this is needed for installation, since the lang file would not be included yet
include_once($autoprefix."GameEngine/Lang/en.php");
class Technology {
public $unarray = [1 => U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20, U21, U22, U23, U24, U25, U26, U27, U28, U29, U30, U31, U32, U33, U34, U35, U36, U37, U38, U39, U40, U41, U42, U43, U44, U45, U46, U47, U48, U49, U50 , U99, U0];
public function grabAcademyRes() {
global $village;
$holder = [];
foreach($village->researching as $research) {
if(substr($research['tech'], 0, 1) == "t") array_push($holder, $research);
}
return $holder;
}
public function getABUpgrades($type='a') {
global $village;
$holder = [];
foreach($village->researching as $research) {
if(substr($research['tech'], 0, 1) == $type) array_push($holder, $research);
}
return $holder;
}
public function isResearch($tech, $type) {
global $village;
if(count($village->researching) == 0) return false;
else
{
switch($type) {
case 1: $string = "t"; break;
case 2: $string = "a"; break;
case 3: $string = "b"; break;
}
foreach($village->researching as $research) {
if($research['tech'] == $string.$tech) return true;
}
return false;
}
}
public function procTech($post) {
if(isset($post['ft'])) {
switch($post['ft']) {
case "t1":
$this->procTrain($post);
break;
case "t3":
$this->procTrain($post,true);
break;
}
}
}
public function procTechno($get) {
global $village;
if(isset($get['a'])) {
switch($village->resarray['f'.$get['id'].'t']) {
case 22:
$this->researchTech($get);
break;
case 13:
$this->upgradeArmour($get);
break;
case 12:
$this->upgradeSword($get);
break;
}
}
}
public function getTrainingList($type) {
global $database,$village;
$trainingarray = $database->getTraining($village->wid);
$listarray = [];
$barracks = [1, 2, 3, 11, 12, 13, 14, 21, 22, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44];
// fix by brainiac - THANK YOU
$greatbarracks = [61, 62, 63, 71, 72, 73, 74, 81, 82, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104];
$stables = [4, 5, 6, 15, 16, 23, 24, 25, 26, 45, 46];
$greatstables = [64, 65, 66, 75, 76, 83, 84, 85, 86, 105, 106];
$workshop = [7, 8, 17, 18, 27, 28, 47, 48];
$greatworkshop = [67, 68, 77, 78, 87, 88, 107, 108];
$residence = [9, 10, 19, 20, 29, 30, 49, 50];
$trapper = [99];
if(count($trainingarray) > 0) {
foreach($trainingarray as $train) {
if($type == 1 && in_array($train['unit'],$barracks)) {
$train['name'] = $this->unarray[$train['unit']];
array_push($listarray,$train);
}
if($type == 2 && in_array($train['unit'],$stables)) {
$train['name'] = $this->unarray[$train['unit']];
array_push($listarray,$train);
}
if($type == 3 && in_array($train['unit'],$workshop)) {
$train['name'] = $this->unarray[$train['unit']];
array_push($listarray,$train);
}
if($type == 4 && in_array($train['unit'],$residence)) {
$train['name'] = $this->unarray[$train['unit']];
array_push($listarray,$train);
}
if($type == 5 && in_array($train['unit'],$greatbarracks)) {
$train['name'] = $this->unarray[$train['unit']-60];
$train['unit'] -= 60;
array_push($listarray,$train);
}
if($type == 6 && in_array($train['unit'],$greatstables)) {
$train['name'] = $this->unarray[$train['unit']-60];
$train['unit'] -= 60;
array_push($listarray,$train);
}
if($type == 7 && in_array($train['unit'],$greatworkshop)) {
$train['name'] = $this->unarray[$train['unit']-60];
$train['unit'] -= 60;
array_push($listarray,$train);
}
if($type == 8 && in_array($train['unit'],$trapper)) {
$train['name'] = $this->unarray[$train['unit']];
array_push($listarray,$train);
}
}
}
return $listarray;
}
public function getUnitList() {
global $database, $village;
$unitarray = func_num_args() == 1 ? $database->getUnit(func_get_arg(0)) : $village->unitall;
$listArray = [];
for($i = 1; $i < count($this->unarray); $i++) {
$holder = [];
if(!empty($unitarray['u'.$i]) && $unitarray['u'.$i] > 0 && !empty($unitarray['u'.$i])) {
$holder['id'] = $i;
$holder['name'] = $this->unarray[$i];
$holder['amt'] = $unitarray['u'.$i];
array_push($listArray, $holder);
}
}
if($unitarray['hero'] > 0 && !empty($unitarray['hero'])) {
$holder['id'] = "hero";
$holder['name'] = $this->unarray[$i];
$holder['amt'] = $unitarray['hero'];
array_push($listArray, $holder);
}
return $listArray;
}
public function maxUnit($unit,$great=false) {
$unit = "u" . $unit;
global $village, $$unit, $database;
$unitarray = $$unit;
$res = $database->getVillage($village->wid, 0, false);
if($res['wood'] > $res['maxstore']) $res['wood'] = $res['maxstore'];
if($res['clay'] > $res['maxstore']) $res['clay'] = $res['maxstore'];
if($res['iron'] > $res['maxstore']) $res['iron'] = $res['maxstore'];
if($res['crop'] > $res['maxcrop']) $res['crop'] = $res['maxcrop'];
$woodcalc = floor($res['wood'] / ($unitarray['wood'] * ($great ? 3 : 1)));
$claycalc = floor($res['clay'] / ($unitarray['clay'] * ($great ? 3 : 1)));
$ironcalc = floor($res['iron'] / ($unitarray['iron'] * ($great ? 3 : 1)));
if($res['crop'] > 0) $cropcalc = floor($res['crop'] / ($unitarray['crop'] * ($great ? 3 : 1)));
else $cropcalc = 0;
if($unit != "u99") $popcalc = floor($village->getProd("crop") / $unitarray['pop']);
else $popcalc = $village->getProd("crop");
return min($woodcalc, $claycalc, $ironcalc, $cropcalc);
}
public function maxUnitPlus($unit,$great=false) {
$unit = "u" . $unit;
global $village, $$unit, $database;
$unitarray = $$unit;
$res = $database->getVillage($village->wid);
$totalres = $res['wood'] + $res['clay'] + $res['iron'] + $res['crop'];
$totalresunit = ($unitarray['wood'] * ($great ? 3 : 1)) + ($unitarray['clay'] * ($great ? 3 : 1)) + ($unitarray['iron'] * ($great ? 3 : 1)) + ($unitarray['crop'] * ($great ? 3 : 1));
$max = round($totalres / $totalresunit);
return $max;
}
public function getUnits() {
global $database, $village;
if(func_num_args() == 1) $base = func_get_arg(0);
$ownunit = func_num_args() == 2 ? func_get_arg(0) : $database->getUnit($base);
$enforcementarray = func_num_args() == 2 ? func_get_arg(1) : $database->getEnforceVillage($base, 0);
if(count($enforcementarray) > 0){
foreach($enforcementarray as $enforce){
for($i = 1; $i <= 50; $i++) $ownunit['u'.$i] += $enforce['u'.$i];
}
}
return $ownunit;
}
function getAllUnits($base, $InVillageOnly = false, $mode = 0, $useCache = true) {
global $database;
$ownunit = $database->getUnit($base, $useCache);
$ownunit['u99'] -= $ownunit['u99'];
$ownunit['u99o'] -= $ownunit['u99o'];
$enforcementarray = $database->getEnforceVillage($base, 0, $useCache);
if(count($enforcementarray) > 0){
foreach($enforcementarray as $enforce){
for($i = 1; $i <= 50; $i++){
$ownunit['u' . $i] += $enforce['u' . $i];
}
$ownunit['hero'] += $enforce['hero'];
}
}
if($mode == 0){
$enforceoasis = $database->getOasisEnforce($base, 0, $useCache);
if(count($enforceoasis) > 0){
foreach($enforceoasis as $enforce){
for($i = 1; $i <= 50; $i++){
$ownunit['u' . $i] += $enforce['u' . $i];
}
$ownunit['hero'] += $enforce['hero'];
}
}
$enforceoasis1 = $database->getOasisEnforce($base, 1, $useCache);
if(count($enforceoasis1) > 0){
foreach($enforceoasis1 as $enforce){
for($i = 1; $i <= 50; $i++){
$ownunit['u' . $i] += $enforce['u' . $i];
}
$ownunit['hero'] += $enforce['hero'];
}
}
$prisoners = $database->getPrisoners($base, 1, $useCache);
if(!empty($prisoners)){
foreach($prisoners as $prisoner){
$owner = $database->getVillageField($base, "owner");
$ownertribe = $database->getUserField($owner, "tribe", 0);
$start = ($ownertribe - 1) * 10 + 1;
$end = ($ownertribe * 10);
for($i = $start; $i <= $end; $i++){
$j = $i - $start + 1;
$ownunit['u' . $i] += $prisoner['t' . $j];
}
$ownunit['hero'] += $prisoner['t11'];
}
}
}
if(!$InVillageOnly){
$movement = $database->getVillageMovement($base);
if(!empty($movement)){
for($i = 1; $i <= 50; $i++){
if(!isset($ownunit['u'.$i])) $ownunit['u'.$i] = 0;
$ownunit['u'.$i] += (isset($movement['u'.$i]) ? $movement['u'.$i] : 0);
}
if(!isset($ownunit['hero'])) $ownunit['hero'] = 0;
$ownunit['hero'] += (isset($movement['hero']) ? $movement['hero'] : 0);
}
}
return $ownunit;
}
public function meetTRequirement($unit) {
global $session;
switch($unit) {
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8: return $this->getTech($unit) && $session->tribe == 1;
case 1:
case 10: return $session->tribe == 1;
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18: return $session->tribe == 2 && $this->getTech($unit);
case 11:
case 20: return $session->tribe == 2;
case 22:
case 23:
case 24:
case 25:
case 26:
case 27:
case 28: return $session->tribe == 3 && $this->getTech($unit);
case 21:
case 30: return $session->tribe == 3;
case 32:
case 33:
case 34:
case 35:
case 36:
case 37:
case 38: return $session->tribe == 4 && $this->getTech($unit);
case 31:
case 40: return $session->tribe == 4;
case 42:
case 43:
case 44:
case 45:
case 46:
case 47:
case 48: return $session->tribe == 5 && $this->getTech($unit);
case 41:
case 50: return $session->tribe == 5;
}
}
public function getTech($tech) {
global $village;
return (isset($village->techarray['t'.$tech]) && $village->techarray['t'.$tech] == 1);
}
private function procTrain($post, $great = false) {
global $session;
// first of all, check if we're not trying to train chieftain
// and settlers together - which we cannot, since that can result
// in 1 chieftain and 3 settlers, then conquering a village, then
// founding a new one, all with only 1 available slot
if (
!(
(!empty($post['t9']) && !empty($post['t10'])) ||
(!empty($post['t19']) && !empty($post['t20'])) ||
(!empty($post['t29']) && !empty($post['t30'])) ||
(!empty($post['t39']) && !empty($post['t40'])) ||
(!empty($post['t49']) && !empty($post['t50']))
)
) {
$start = ($session->tribe - 1) * 10 + 1;
$end = ($session->tribe * 10);
for ($i = $start; $i <= $end; $i ++ ) {
if (isset($post['t'.$i]) && $post['t'.$i] != 0) {
$amt = intval($post['t'.$i]);
if ($amt < 0) $amt = 1;
$this->trainUnit($i, $amt, $great);
}
}
if($session->tribe == 3)
{
if (isset($post['t99']) && $post['t99'] != 0) {
$amt = intval($post['t99']);
if ($amt < 0) $amt = 1;
$this->trainUnit(99, $amt, $great);
}
}
header( "Location: build.php?id=" . $post['id'] );
exit;
}
}
public function getUpkeep($array, $type, $vid = 0, $prisoners = 0) {
global $database, $village;
if ($vid == 0) $vid = $village->wid;
$upkeep = 0;
$horsedrinking = $database->getFieldLevelInVillage($vid, 41);
if(!$type){
$start = 1;
$end = 50;
}else{
$start = ($type - 1) * 10 + 1;
$end = $type * 10;
}
for ($i = $start; $i <= $end; $i ++) {
$k = $i - $start + 1;
$unit = "u".$i;
$index = $prisoners == 0 ? $unit : "t".$k;
global $$unit;
$dataarray = $$unit;
if($horsedrinking > 0) {
if (($i == 4 && $horsedrinking >= 10) || ($i == 5 && $horsedrinking >= 15) || ( $i == 6 && $horsedrinking == 20)) {
$upkeep += ($dataarray['pop'] - 1) * $array[$index];
}
else $upkeep += ($dataarray['pop'] * $array[$index]);
}
else $upkeep += ($dataarray['pop'] * $array[$index]);
}
$index = $prisoners > 0 ? 't11' : 'hero';
if(!isset($array[$index])) $array[$index] = 0;
$upkeep += $array[$index] * 6;
$who = $database->getVillageField($vid, "owner");
//If it's a WW village, halve the crop consumption
if($database->getVillageField($vid, "natar") == 1) $upkeep /= 2;
return ceil($database->getArtifactsValueInfluence($who, $vid, 4, $upkeep, false));
}
private function trainUnit($unit, $amt, $great = false) {
global $session, $database, ${'u'.$unit}, $building, $village, $bid19, $bid20, $bid21, $bid25, $bid26, $bid29, $bid30, $bid36, $bid41, $bid42;
if($this->getTech($unit) || $unit % 10 <= 1 || $unit == 99) {
$footies = [1, 2, 3, 11, 12, 13, 14, 21, 22, 31, 32, 33, 34, 41, 42, 43, 44];
$calvary = [4, 5, 6, 15, 16, 23, 24, 25, 26, 35, 36, 45, 46];
$workshop = [7, 8, 17, 18, 27, 28, 37, 38, 47, 48];
$special = [9, 10, 19, 20, 29, 30, 39, 40, 49, 50];
$trapper = [99];
//Check if the player is trying to train troops without the needed buildings
if((in_array($unit, $footies) && ($building->getTypeLevel(19) == 0 && $building->getTypeLevel(29) == 0)) ||
(in_array($unit, $calvary) && ($building->getTypeLevel(20) == 0 && $building->getTypeLevel(30) == 0)) ||
(in_array($unit, $workshop) && ($building->getTypeLevel(21) == 0 && $building->getTypeLevel(42) == 0)) ||
(in_array($unit, $special) && ($building->getTypeLevel(25) < 10 && $building->getTypeLevel(26) < 10)) ||
(in_array($unit, $trapper) && $building->getTypeLevel(36) == 0)) return;
if(in_array($unit, $footies)) {
if($great) {
$each = round(($bid29[$building->getTypeLevel(29)]['attri'] / 100) * ${'u'.$unit}['time'] / SPEED);
} else {
$each = round(($bid19[$building->getTypeLevel(19)]['attri'] / 100) * ${'u'.$unit}['time'] / SPEED);
}
}
if(in_array($unit, $calvary)) {
if($great) {
$each = round(($bid30[$building->getTypeLevel(30)]['attri'] * ($building->getTypeLevel(41)>=1?(1/$bid41[$building->getTypeLevel(41)]['attri']):1) / 100) * ${'u'.$unit}['time'] / SPEED);
} else {
$each = round(($bid20[$building->getTypeLevel(20)]['attri'] * ($building->getTypeLevel(41)>=1?(1/$bid41[$building->getTypeLevel(41)]['attri']):1) / 100) * ${'u'.$unit}['time'] / SPEED);
}
}
if(in_array($unit, $workshop)) {
if($great) {
$each = round(($bid42[$building->getTypeLevel(42)]['attri'] / 100) * ${'u'.$unit}['time'] / SPEED);
} else {
$each = round(($bid21[$building->getTypeLevel(21)]['attri'] / 100) * ${'u'.$unit}['time'] / SPEED);
}
}
if(in_array($unit, $special)) {
if($building->getTypeLevel(25) > 0){
$each = round(($bid25[$building->getTypeLevel(25)]['attri'] / 100) * ${'u'.$unit}['time'] / SPEED);
} else {
$each = round(($bid26[$building->getTypeLevel(26)]['attri'] / 100) * ${'u'.$unit}['time'] / SPEED);
}
}
if(in_array($unit, $trapper)) {
$each = round(($bid19[$building->getTypeLevel(36)]['attri'] / 100) * ${'u'.$unit}['time'] / SPEED);
}
if($unit % 10 == 0 || $unit % 10 == 9 && $unit != 99) {
$slots = $database->getAvailableExpansionTraining();
if($unit % 10 == 0 && $slots['settlers'] <= $amt) $amt = $slots['settlers'];
if($unit % 10 == 9 && $slots['chiefs'] <= $amt) $amt = $slots['chiefs'];
} else {
if($unit != 99){
if($this->maxUnit($unit, $great) < $amt) $amt = 0;
}else{
$trainlist = $this->getTrainingList(8);
foreach($trainlist as $train) $train_amt += $train['amt'];
$max = 0;
for($i = 19; $i < 41; $i++){
if($village->resarray['f'.$i.'t'] == 36){
$max += $bid36[$village->resarray['f'.$i]]['attri']*TRAPPER_CAPACITY;
}
}
$max1 = $max - ($village->unitarray['u99'] + $train_amt);
if($max1 < $amt) $amt = 0;
}
}
$wood = ${'u'.$unit}['wood'] * $amt * ($great ? 3 : 1);
$clay = ${'u'.$unit}['clay'] * $amt * ($great ? 3 : 1);
$iron = ${'u'.$unit}['iron'] * $amt * ($great ? 3 : 1);
$crop = ${'u'.$unit}['crop'] * $amt * ($great ? 3 : 1);
if($database->modifyResource($village->wid, $wood , $clay, $iron, $crop, 0) && $amt > 0) {
$database->trainUnit($village->wid, $unit + ($great ? 60 : 0), $amt, ${'u'.$unit}['pop'], $each, 0);
}
}
}
public function meetRRequirement($tech) {
global $session, $building;
switch($tech) {
case 2: return $building->getTypeLevel(22) >= 1 && $building->getTypeLevel(13) >= 1;
case 3: return $building->getTypeLevel(22) >= 5 && $building->getTypeLevel(12) >= 1;
case 4:
case 23: return$building->getTypeLevel(22) >= 5 && $building->getTypeLevel(20) >= 1;
case 5:
case 25: return $building->getTypeLevel(22) >= 5 && $building->getTypeLevel(20) >= 5;
case 6: return $building->getTypeLevel(22) >= 15 && $building->getTypeLevel(20) >= 10;
case 9:
case 29: return $building->getTypeLevel(22) >= 20 && $building->getTypeLevel(16) >= 10;
case 12:
case 32:
case 42: return $building->getTypeLevel(22) >= 1 && $building->getTypeLevel(19) >= 3;
case 13:
case 33:
case 43: return $building->getTypeLevel(22) >= 3 && $building->getTypeLevel(12) >= 1;
case 14:
case 34:
case 44: return $building->getTypeLevel(22) >= 1 && $building->getTypeLevel(15) >= 5;
case 15:
case 35:
case 45: return $building->getTypeLevel(22) >= 1 && $building->getTypeLevel(20) >= 3;
case 16:
case 26:
case 36:
case 46: return $building->getTypeLevel(22) >= 15 && $building->getTypeLevel(20) >= 10;
case 7:
case 17:
case 27:
case 37:
case 47: return $building->getTypeLevel(22) >= 10 && $building->getTypeLevel(21) >= 1;
case 8:
case 18:
case 28:
case 38:
case 48: return $building->getTypeLevel(22) >= 15 && $building->getTypeLevel(21) >= 10;
case 19:
case 39:
case 49: return $building->getTypeLevel(22) >= 20 && $building->getTypeLevel(16) >= 5;
case 22: return $building->getTypeLevel(22) >= 3 && $building->getTypeLevel(12) >= 1;
case 24: return $building->getTypeLevel(22) >= 5 && $building->getTypeLevel(20) >= 3;
}
}
private function researchTech($get) {
global $database,$session,${'r'.$get['a']},$bid22,$building,$village,$logging;
if($this->meetRRequirement($get['a']) && $get['c'] == $session->mchecker) {
$data = ${'r'.$get['a']};
$time = time() + round(($data['time'] * ($bid22[$building->getTypeLevel(22)]['attri'] / 100))/SPEED);
$database->modifyResource($village->wid,$data['wood'],$data['clay'],$data['iron'],$data['crop'],0);
$database->addResearch($village->wid,"t".$get['a'],$time);
$logging->addTechLog($village->wid,"t".$get['a'],1);
}
$session->changeChecker();
header("Location: build.php?id=".$get['id']);
exit;
}
//TODO: Merge these two functions in one function, they're very similar to each other
private function upgradeSword($get) {
global $database,$session,$bid12,$building,$village,$logging;
$ABTech = $database->getABTech($village->wid);
$ABUpgrades = $this->getABUpgrades('b');
$ABUpgradesCount = count($ABUpgrades);
$ups = 0;
if($ABUpgradesCount > 0){
foreach($ABUpgrades as $upgrade){
if(in_array(("b".$get['a']), $upgrade)) $ups++;
}
}
$CurrentTech = $ABTech["b".$get['a']]+$ups;
$unit = ($session->tribe-1)*10+intval($get['a']);
if(($ABUpgradesCount < 2 && $session->plus || $ABUpgradesCount == 0) && ($this->getTech($unit) || ($unit % 10) == 1) && ($CurrentTech < $building->getTypeLevel(12)) && $get['c'] == $session->mchecker) {
global ${'ab'.strval($unit)};
$data = ${'ab'.strval($unit)};
$time = time() + round(($data[$CurrentTech+1]['time'] * ($bid12[$building->getTypeLevel(12)]['attri'] / 100))/SPEED) + ($ABUpgradesCount > 0 ? ($ABUpgrades[$ABUpgradesCount-1]['timestamp'] - time()) + ceil(60/SPEED) : 0);
if ($database->modifyResource($village->wid,$data[$CurrentTech+1]['wood'],$data[$CurrentTech+1]['clay'],$data[$CurrentTech+1]['iron'],$data[$CurrentTech+1]['crop'],0)) {
$database->addResearch($village->wid,"b".$get['a'],$time);
$logging->addTechLog($village->wid,"b".$get['a'],$CurrentTech+1);
}
}
$session->changeChecker();
header("Location: build.php?id=".$get['id']);
exit;
}
private function upgradeArmour($get) {
global $database,$session,$bid13,$building,$village,$logging;
$ABTech = $database->getABTech($village->wid);
$ABUpgrades = $this->getABUpgrades('a');
$ABUpgradesCount = count($ABUpgrades);
$ups = 0;
if($ABUpgradesCount > 0){
foreach($ABUpgrades as $upgrade){
if(in_array(("a".$get['a']), $upgrade)) $ups++;
}
}
$CurrentTech = $ABTech["a".$get['a']]+$ups;
$unit = ($session->tribe-1)*10+intval($get['a']);
if(($ABUpgradesCount < 2 && $session->plus || $ABUpgradesCount == 0) && ($this->getTech($unit) || ($unit % 10) == 1) && ($CurrentTech < $building->getTypeLevel(13)) && $get['c'] == $session->mchecker) {
global ${'ab'.strval($unit)};
$data = ${'ab'.strval($unit)};
$time = time() + round(($data[$CurrentTech+1]['time'] * ($bid13[$building->getTypeLevel(13)]['attri'] / 100))/SPEED) + ($ABUpgradesCount > 0 ? ($ABUpgrades[$ABUpgradesCount-1]['timestamp'] - time()) + ceil(60/SPEED) : 0);
if ($database->modifyResource($village->wid,$data[$CurrentTech+1]['wood'],$data[$CurrentTech+1]['clay'],$data[$CurrentTech+1]['iron'],$data[$CurrentTech+1]['crop'],0)) {
$database->addResearch($village->wid,"a".$get['a'],$time);
$logging->addTechLog($village->wid,"a".$get['a'],$CurrentTech+1);
}
}
$session->changeChecker();
header("Location: build.php?id=".$get['id']);
exit;
}
public function getUnitName($i) {
return $this->unarray[$i];
}
public function finishTech() {
global $database,$village;
$q = "UPDATE ".TB_PREFIX."research SET timestamp=".(time()-1)." WHERE vref = ".(int) $village->wid;
$result = $database->query($q);
return mysqli_affected_rows($database->dblink);
}
public function calculateAvaliable($id, $resarray = []) {
global $village,$generator,${'r'.$id};
if(count($resarray)==0) {
$resarray['wood'] = ${'r'.$id}['wood'];
$resarray['clay'] = ${'r'.$id}['clay'];
$resarray['iron'] = ${'r'.$id}['iron'];
$resarray['crop'] = ${'r'.$id}['crop'];
}
$rwtime = ($resarray['wood']-$village->awood) / $village->getProd("wood") * 3600;
$rcltime = ($resarray['clay']-$village->aclay) / $village->getProd("clay") * 3600;
$ritime = ($resarray['iron']-$village->airon) / $village->getProd("iron") * 3600;
$rctime = ($resarray['crop']-$village->acrop) / $village->getProd("crop") * 3600;
if($village->getProd("crop") >= 0) {
$reqtime = max($rwtime,$rcltime,$ritime,$rctime) + time();
} else {
$reqtime = max($rwtime,$rcltime,$ritime);
if($reqtime > $rctime) {
$reqtime = 0;
} else {
$reqtime += time();
}
}
return $generator->procMtime($reqtime);
}
public function checkReinf($id, $use_cache = true) {
global $database;
$enforce=$database->getEnforceArray($id, 0, $use_cache);
$fail=0;
for ($i=1; $i<50; $i++) {
if($enforce['u'.$i.'']>0){
$fail=1;
}
}
if ($enforce['hero']>0) $fail=1;
if($fail==0){
$database->deleteReinf($id);
}
}
}
$technology = new Technology;
?>
-818
View File
@@ -1,818 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Project: TravianZ ##
## Version: 22.06.2015 ##
## Filename Units.php ##
## Developed by: Mr.php , Advocaite , brainiacX , yi12345 , Shadow , ronix ##
## Fixed by: Shadow - STARVATION , HERO FIXED COMPL. ##
## Fixed by: InCube - double troops ##
## License: TravianZ Project ##
## Copyright: TravianZ (c) 2010-2015. All rights reserved. ##
## URLs: http://travian.shadowss.ro ##
## Source code: https://github.com/Shadowss/TravianZ ##
## ##
#################################################################################
class Units {
public $sending, $recieving, $return = [];
public function procUnits($post) {
if(isset($post['c'])) {
if (!isset($post['disabled'])) $post['disabled'] = '';
switch($post['c']) {
case 1:
if (isset($post['a']) && $post['a'] == 533374) $this->sendTroops($post);
else
{
$post = $this->loadUnits($post);
return $post;
}
break;
case 2:
if (isset($post['a']) && $post['a'] == 533374 && empty($post['disabled'])) $this->sendTroops($post);
else
{
$post = $this->loadUnits($post);
return $post;
}
break;
case 3:
if (isset($post['a']) && $post['a'] == 533374 && empty($post['disabled'])) $this->sendTroops($post);
else
{
$post = $this->loadUnits($post);
return $post;
}
break;
case 4:
if (isset($post['a']) && $post['a'] == 533374) $this->sendTroops($post);
else
{
$post = $this->loadUnits($post);
return $post;
}
break;
case 5:
if (isset($post['a']) && $post['a'] == "new") $this->Settlers($post);
else
{
$post = $this->loadUnits($post);
return $post;
}
break;
case 8:
$this->sendTroopsBack($post);
break;
}
}
}
private function loadUnits($post) {
global $form;
if(!empty($error = $this->checkErrors($post))) {
$form->addError("error", $error);
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $_POST;
header("Location: a2b.php");
exit;
}
else return $post;
}
/**
* Gets an error if the user did a mistake
*
* @param array $post The array containing all of the needed informations
* @return string Returns the errors, or empty if no errors was found
*/
public function checkErrors(&$post){
global $database, $village, $session, $generator;
// Search by town name
// Coordinates and look confirm name people
if(isset($post['x']) && isset($post['y']) && $post['x'] != "" && $post['y'] != "") {
$vid = $database->getVilWref($post['x'], $post['y']);
unset($post['dname'], $post['dname']);
}
else if(isset($post['dname']) && !empty($post['dname'])) $vid = $database->getVillageByName(stripslashes($post['dname']));
if (!empty($vid)) {
if($isOasis = $database->isVillageOases($vid)){
$too = $database->getOasisField($vid, "conqured");
if($too == 0) $disabled = $disabledr ="disabled=disabled";
else
{
$disabledr = "";
if($session->sit == 0) $disabled = "";
else $disabled ="disabled=disabled";
}
}else{
$too = $database->getVillage($vid);
if($too['owner'] == 3){
$disabledr = "disabled=disabled";
$disabled = "";
}else{
$disabledr = "";
if($session->sit == 0) $disabled = "";
else $disabled ="disabled=disabled";
}
}
}else{
$disabledr = "";
if($session->sit == 0) $disabled = "";
else $disabled ="disabled=disabled";
}
if(!empty($disabledr) && $post['c'] == 2) return "You can't reinforce this village/oasis";
if(!empty($disabled) && $post['c'] == 3) return "You can't attack this village/oasis with normal attack";
if($post['c'] < 2 || $post['c'] > 4) return "Invalid attack type.";
//check if at least one troops has been selected
for($i = 1; $i <= 11; $i++) $selectedTroops += empty($post['t'.$i]) ? 0 : $post['t'.$i];
if($selectedTroops == 0) return "You need to select min. one troop";
if(!empty($post['dname']) && $post['x'] != "" && $post['y'] != "") return "Insert name or coordinates";
if(isset($post['dname']) && !empty($post['dname'])) {
$id = $database->getVillageByName(stripslashes($post['dname']));
if (!isset($id)) return "Village doesn't exist";
else $coor = $database->getCoor($id);
}
// People search by coordinates
// We confirm and seek coordinate coordinates Village
if(isset($post['x']) && isset($post['y']) && $post['x'] != "" && $post['y'] != "") {
$coor = ['x' => $post['x'], 'y' => $post['y']];
$id = $generator->getBaseID($coor['x'], $coor['y']);
if (!$database->getVillageState($id)) return "Coordinates do not exist";
}
if (!empty($coor)) {
$Gtribe = $session->tribe == 1 ? "" : $session->tribe - 1;
for($i = 1; $i < 12; $i++){
if(isset($post['t'.$i])){
if($i < 10) $troophave = $village->unitarray['u'.$Gtribe.$i];
if($i == 10) $troophave = $village->unitarray['u'.floor(intval($Gtribe) + 1) * $i];
if($i == 11) $troophave = $village->unitarray['hero'];
if(intval($post['t'.$i]) > $troophave) return "You can't send more units than you have";
if(intval($post['t'.$i]) < 0) return "You can't send negative units.";
if(preg_match('/[^0-9]/',$post['t'.$i])) return "Special characters can't entered";
}
}
}
if(isset($id)) {
//check if the attacked village/oasis' owner is under beginners protection
if($database->hasBeginnerProtection($id) == 1) return "Player is under beginners protection. You can't attack him";
//check if it's an oasis or not
$villageInfo = (!$isOasis) ? $database->getVillage($id) : $database->getOasisV($id);
//check if banned/admin:
$villageOwner = $villageInfo['owner'];
$userAccess = $database->getUserField($villageOwner, 'access', 0);
$userID = $database->getUserField($villageOwner, 'id', 0);
//check if he's an Admin and if he's attackable
if($userAccess == 0 || ($userAccess == MULTIHUNTER && $userID == 5) || (!ADMIN_ALLOW_INCOMING_RAIDS && $userAccess == ADMIN)){
return "Player is Banned. You can't attack him";
}
//check if the user' is on the vacation mode:
if($database->getvacmodexy($id)) return "User is on vacation mode";
//check if attacking same village that units are in
if($id == $village->wid) return "You cant attack same village you are sending from.";
}
//no errors, we can add the additional information to the post array
array_push($post, $id, $villageInfo['name'], $villageInfo['owner'], 0);
return "";
}
public function returnTroops($wref, $mode = 0) {
global $database;
if(!$mode){
$getenforce = $database->getEnforceVillage($wref, 0);
foreach($getenforce as $enforce) $this->processReturnTroops($enforce);
}
// check oasis
$getenforce1 = $database->getOasisEnforce($wref, 1);
foreach($getenforce1 as $enforce) $this->processReturnTroops($enforce);
// set oasis to default
if(count($getenforce1) > 0) $database->regenerateOasisUnits($getenforce1[0]['vref']);
}
private function processReturnTroops($enforce) {
global $database;
$to = $database->getVillage($enforce['from']);
$tribe = $database->getUserField($to['owner'], 'tribe', 0);
$start = ($tribe - 1) * 10 + 1;
$troopsTime = $this->getWalkingTroopsTime($enforce['from'], $enforce['vref'], $to['owner'], $tribe, $enforce, 1);
$time = $database->getArtifactsValueInfluence($from['owner'], $enforce['from'], 2, $troopsTime);
$reference = $database->addAttack($enforce['from'], $enforce['u'.$start], $enforce['u'.($start + 1)], $enforce['u'.($start + 2)], $enforce['u'.($start + 3)], $enforce['u'.($start + 4)], $enforce['u'.($start + 5)], $enforce['u'.($start + 6)], $enforce['u'.($start + 7)], $enforce['u'.($start + 8)], $enforce['u'.($start + 9)], $enforce['hero'], 2, 0, 0, 0, 0);
$database->addMovement(4, $enforce['vref'], $enforce['from'], $reference, time(), ($time + time()));
$database->deleteReinf($enforce['id']);
}
private function sendTroops($post) {
global $form, $database, $village, $session;
$data = $database->getA2b($post['timestamp_checksum']);
$Gtribe = ($session->tribe == 1) ? "" : $session->tribe - 1;
for ($i = 1; $i < 10; $i++) {
if (isset($data['u'.$i])) {
if ($data['u'.$i] > $village->unitarray['u'.$Gtribe.$i]) {
$form->addError("error", "You can't send more units than you have");
break;
}
if ($data['u'.$i] < 0) {
$form->addError("error", "You can't send negative units.");
break;
}
}
}
if($data['u11'] > $village->unitarray['hero']) $form->addError("error", "You can't send more units than you have");
if($data['u11'] < 0) $form->addError("error", "You can't send negative units.");
if($data['type'] != 1 && $post['spy'] != 0) $post['spy'] = 0;
if($form->returnErrors() > 0){
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $_POST;
header( "Location: a2b.php" );
exit;
}else{
$u = ($session->tribe == 1) ? "" : $session->tribe - 1;
$database->modifyUnit(
$village->wid,
[
$u . "1",
$u . "2",
$u . "3",
$u . "4",
$u . "5",
$u . "6",
$u . "7",
$u . "8",
$u . "9",
$u . $session->tribe . "0",
"hero"
],
[
$data['u1'],
$data['u2'],
$data['u3'],
$data['u4'],
$data['u5'],
$data['u6'],
$data['u7'],
$data['u8'],
$data['u9'],
$data['u10'],
$data['u11']
],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
);
$troopsTime = $this->getWalkingTroopsTime($village->wid, $data['to_vid'], $session->uid, $session->tribe, $data, 1, 'u');
$time = $database->getArtifactsValueInfluence($session->uid, $village->wid, 2, $troopsTime);
// Check if have WW owner have artefact Rivals great confusion or Artefact of the unique fool with that effect
// If is a WW village you can target on WW , if is not a WW village catapults will target randomly.
// Like it says : Exceptions are the WW which can always be targeted and the treasure chamber which can always be targeted, except with the unique artifact.
// Fixed by Advocaite and Shadow - Optimized by iopietro
$to_owner = $database->getVillageField($data['to_vid'], "owner");
$rivalsGreatConfusion = $database->getArtifactsSumByKind($to_owner, $data['to_vid'], 7);
$rallyPointLevel = ($village->resarray)['f39'];
$invalidBuildings = [];
// fill the array with the invalid buildings
if($rallyPointLevel >= 3 && $rallyPointLevel < 5){
for($i = 1; $i <= 37; $i++){
if(!in_array($i, [10, 11])) $invalidBuildings[] = $i;
}
}
else if($rallyPointLevel >= 5 && $rallyPointLevel < 10){
for($i = 12; $i <= 37; $i++) $invalidBuildings[] = $i;
}
else if($rallyPointLevel >= 10){
$invalidBuildings = [23, 31, 32, 33, 34, 36];
}
if(isset($post['ctar1']) && $post['ctar1'] != 0){
// check if the player has selected a valid building
if($rallyPointLevel < 3 || $data['u8'] == 0 || in_array($post['ctar1'], $invalidBuildings) || $post['ctar1'] < 0 || $post['ctar1'] > 40){
$post['ctar1'] = 0;
}
}
if(isset($post['ctar2']) && $post['ctar2'] != 0){
// check if there are atleast 20 catapults
if($data['u8'] < 20 || $rallyPointLevel != 20){
$post['ctar2'] = 0;
}else{
// check if the player has selected a valid building
if(in_array($post['ctar2'], $invalidBuildings) || ($post['ctar2'] < 0 || $post['ctar2'] > 40 && $post['ctar2'] != 99)){
$post['ctar2'] = 99;
}
}
}
if(isset($post['ctar1'])) {
//Is the Brewery built?
if($session->tribe != 2 || $database->getFieldLevelInVillage($village->wid, 35) == 0){
if($rivalsGreatConfusion['totals'] > 0) {
if($post['ctar1'] != 40 && ($post['ctar1'] != 27 || ($post['ctar1'] == 27 && $rivalsGreatConfusion['unique'] > 0))) {
$post['ctar1'] = 0;
}
}
}
else $post['ctar1'] = 0;
}
else $post['ctar1'] = 0;
if(isset($post['ctar2']) && $post['ctar2'] > 0) {
//Is the Brewery built?
if($session->tribe != 2 || $database->getFieldLevelInVillage($village->wid, 35) == 0){
if($rivalsGreatConfusion['totals'] > 0) {
if ($post['ctar2'] != 40 && ($post['ctar2'] != 27 || ($post['ctar2'] == 27 && $rivalsGreatConfusion['unique'] > 0))) {
$post['ctar2'] = 99;
}
}
}
else $post['ctar2'] = 99;
}
else $post['ctar2'] = 0;
if(!isset($post['spy'])) $post['spy'] = 0;
$abdata = $database->getABTech($village->wid);
$reference = $database->addAttack(($village->wid), $data['u1'], $data['u2'], $data['u3'], $data['u4'], $data['u5'], $data['u6'], $data['u7'], $data['u8'], $data['u9'], $data['u10'], $data['u11'], $data['type'], $post['ctar1'], $post['ctar2'], $post['spy'], $abdata['b1'], $abdata['b2'], $abdata['b3'], $abdata['b4'], $abdata['b5'], $abdata['b6'], $abdata['b7'], $abdata['b8']);
$checkexist = $database->checkVilExist($data['to_vid']);
$checkoexist = $database->checkOasisExist($data['to_vid']);
if($checkexist || $checkoexist) {
$database->addMovement(3, $village->wid, $data['to_vid'], $reference, time(), ($time + time()));
if ($database->hasBeginnerProtection($village->wid) == 1 && $checkexist) {
mysqli_query($database->dblink, "UPDATE " . TB_PREFIX . "users SET protect = 0 WHERE id = ".(int) $session->uid);
}
}
if($form->returnErrors() > 0) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $_POST;
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;
}
}
private function sendTroopsBack($post) {
global $form, $database, $village, $session, $technology;
$enforce = $database->getEnforceArray( $post['ckey'], 0 );
$enforceoasis = $database->getOasisEnforceArray( $post['ckey'], 0 );
if ( ( $enforce['from'] == $village->wid ) || ( $enforce['vref'] == $village->wid ) || ( $enforceoasis['conqured'] == $village->wid ) ) {
$to = $database->getVillage( $enforce['from'] );
$Gtribe = ($ownerTribe = $database->getUserField( $to['owner'], 'tribe', 0)) == 1 ? "" : $ownerTribe - 1;
for ( $i = 1; $i < 10; $i ++ ) {
if ( isset( $post[ 't' . $i ] ) ) {
if ( $i != 10 ) {
if ( $post[ 't' . $i ] > $enforce[ 'u' . $Gtribe . $i ] ) {
$form->addError( "error", "You can't send back more units than you have" );
break;
}
if ( $post[ 't' . $i ] < 0 ) {
$form->addError( "error", "You can't send back negative units." );
break;
}
}
} else {
$post[ 't' . $i . '' ] = '0';
}
}
if ( isset( $post['t11'] ) ) {
if ( $post['t11'] > $enforce['hero'] ) {
$form->addError( "error", "You can't send back more units than you have" );
}
if ( $post['t11'] < 0 ) {
$form->addError( "error", "You can't send back negative units." );
}
} else {
$post['t11'] = '0';
}
if ( $form->returnErrors() > 0 ) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $_POST;
header( "Location: a2b.php" );
exit;
} else {
//change units
$tribe = $database->getUserField($to['owner'], 'tribe', 0);
$start = ($tribe - 1 ) * 10 + 1;
$end = $tribe * 10 ;
$units = [];
$amounts = [];
$modes = [];
$j = 1;
for ( $i = $start; $i <= $end; $i ++ ) {
$units[] = $i;
$amounts[] = $post[ 't' . $j . '' ];
$modes[] = 0;
$j ++;
}
$units[] = 'hero';
$amounts[] = $post['t11'];
$modes[] = 0;
$database->modifyEnforce($post['ckey'], $units, $amounts, $modes);
$j++;
$troopsTime = $this->getWalkingTroopsTime($enforce['from'], $enforce['vref'], $to['owner'], $tribe, $post, 1, 't');
$time = $database->getArtifactsValueInfluence($session->uid, $village->wid, 2, $troopsTime);
$reference = $database->addAttack($enforce['from'], $post['t1'], $post['t2'], $post['t3'], $post['t4'], $post['t5'], $post['t6'], $post['t7'], $post['t8'], $post['t9'], $post['t10'], $post['t11'], 2, 0, 0, 0, 0);
$database->addMovement(4, $village->wid, $enforce['from'], $reference, time(), ($time + time()));
$technology->checkReinf($post['ckey'], false);
header("Location: build.php?id=39&refresh=1");
exit();
}
}else{
$form->addError("error", "You cant change someones troops.");
if($form->returnErrors() > 0){
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $_POST;
header("Location: a2b.php");
exit();
}
}
}
public function Settlers($post) {
global $form, $database, $village, $session;
$mode = CP;
$total = count($database->getProfileVillages($session->uid));
$need_cps = ${'cp'.$mode}[$total + 1];
$cps = $session->cp;
$rallypoint = $database->getResourceLevel($village->wid);
//-- Prevent user from founding a new village if there are not enough settlers or the player put an invalid village ID or an already occupied one
//-- fix by AL-Kateb - Semplified and additions by iopietro
if ($rallypoint['f39'] > 0 && $village->unitarray['u'.$session->tribe.'0'] >= 3 && isset($post['s']) && ($newvillage = $database->getMInfo($post['s']))['id'] > 0 && $newvillage['occupied'] == 0 && $newvillage['oasistype'] == 0) {
if ($cps >= $need_cps) {
$troopsTime = $this->getWalkingTroopsTime($village->wid, $newvillage['id'], 0, 0, [300], 0);
$time = $database->getArtifactsValueInfluence($session->uid, $village->wid, 2, $troopsTime);
$unit = ($session->tribe * 10);
$database->modifyResource($village->wid, 750, 750, 750, 750, 0);
$database->modifyUnit($village->wid, [$unit], [3], [0]);
$database->addMovement(5, $village->wid, $post['s'], 0, time(), time() + $time);
}
header("Location: build.php?id=39");
exit;
} else {
header("Location: dorf1.php");
exit;
}
}
public function Hero($uid, $all = 0, $include_dead = false) {
global $database;
$heroarray = $database->getHero($uid, $all, $include_dead);
$herodata = false;
$singleHeroArrayID = 0;
// no hero data found
if (!count($heroarray)) {
return false;
}
// check all heroes and load hero data for the one,
// whose data were updated more recently - if we're not getting all of them
if (!$all) {
foreach ($heroarray as $id => $hero) {
// try to load a hero who's alive first
if (!$herodata && $hero['dead'] != 1) {
// this global value comes from GameEngine/Data/unitdata.php
$herodata = $GLOBALS["h".$hero['unit']];
$singleHeroArrayID = $id;
break;
}
}
// if we couldn't get a living hero,
// resort to loading the first one from the list,
// as that would be the one most recently updated/used
if (!$herodata) {
// this global value comes from GameEngine/Data/unitdata.php
$herodata = $GLOBALS["h".$heroarray[0]['unit']];
}
$h_atk = $herodata['atk'] + 5 * floor($heroarray[$singleHeroArrayID]['attack'] * $herodata['atkp'] / 5);
$h_di = $herodata['di'] + 5 * floor($heroarray[$singleHeroArrayID]['defence'] * $herodata['dip'] / 5);
$h_dc = $herodata['dc'] + 5 * floor($heroarray[$singleHeroArrayID]['defence'] * $herodata['dcp'] / 5);
$h_ob = 1 + 0.002 * $heroarray[$singleHeroArrayID]['attackbonus'];
$h_db = 1 + 0.002 * $heroarray[$singleHeroArrayID]['defencebonus'];
return [
'heroid' => $heroarray[$singleHeroArrayID]['heroid'],
'unit' => $heroarray[$singleHeroArrayID]['unit'],
'name' => $heroarray[$singleHeroArrayID]['name'],
'inrevive' => $heroarray[$singleHeroArrayID]['inrevive'],
'intraining' => $heroarray[$singleHeroArrayID]['intraining'],
'trainingtime' => $heroarray[$singleHeroArrayID]['trainingtime'],
'level' => $heroarray[$singleHeroArrayID]['level'],
'attack' => $heroarray[$singleHeroArrayID]['attack'],
'atk' => $h_atk,
'defence' => $heroarray[$singleHeroArrayID]['defence'],
'di' => $h_di,
'dc' => $h_dc,
'attackbonus' => $heroarray[$singleHeroArrayID]['attackbonus'],
'ob' => $h_ob,
'defencebonus' => $heroarray[$singleHeroArrayID]['defencebonus'],
'db' => $h_db,
'regeneration' => $heroarray[$singleHeroArrayID]['regeneration'],
'health' => $heroarray[$singleHeroArrayID]['health'],
'dead' => $heroarray[$singleHeroArrayID]['dead'],
'points' => $heroarray[$singleHeroArrayID]['points'],
'experience' => $heroarray[$singleHeroArrayID]['experience']
];
} else {
// build up a full array of heroes and their stats
$heroes = [];
foreach ($heroarray as $id => $hero) {
$herodata = $GLOBALS["h".$heroarray[$id]['unit']];
$h_atk = $herodata['atk'] + 5 * floor($heroarray[$id]['attack'] * $herodata['atkp'] / 5);
$h_di = $herodata['di'] + 5 * floor($heroarray[$id]['defence'] * $herodata['dip'] / 5);
$h_dc = $herodata['dc'] + 5 * floor($heroarray[$id]['defence'] * $herodata['dcp'] / 5);
$h_ob = 1 + 0.002 * $heroarray[$id]['attackbonus'];
$h_db = 1 + 0.002 * $heroarray[$id]['defencebonus'];
$heroes[] = [
'heroid' => $heroarray[$id]['heroid'],
'unit' => $heroarray[$id]['unit'],
'name' => $heroarray[$id]['name'],
'inrevive' => $heroarray[$id]['inrevive'],
'intraining' => $heroarray[$id]['intraining'],
'trainingtime' => $heroarray[$id]['trainingtime'],
'level' => $heroarray[$id]['level'],
'attack' => $heroarray[$id]['attack'],
'atk' => $h_atk,
'defence' => $heroarray[$id]['defence'],
'di' => $h_di,
'dc' => $h_dc,
'attackbonus' => $heroarray[$id]['attackbonus'],
'ob' => $h_ob,
'defencebonus' => $heroarray[$id]['defencebonus'],
'db' => $h_db,
'regeneration' => $heroarray[$id]['regeneration'],
'health' => $heroarray[$id]['health'],
'dead' => $heroarray[$id]['dead'],
'points' => $heroarray[$id]['points'],
'experience' => $heroarray[$id]['experience']
];
}
return $heroes;
}
}
/**
* Function to kill/release prisoners
*
* @param int the ID of the prisoners you want to release
*/
public function deletePrisoners($id){
global $village, $database, $session, $building, $bid19, $u99;
$prisoner = $database->getPrisonersByID($id);
$troops = 0;
if($prisoner['wref'] == $village->wid){
$p_owner = $database->getVillageField($prisoner['from'], "owner");
$p_tribe = $database->getUserField($p_owner, "tribe", 0);
$troopsTime = $this->getWalkingTroopsTime($prisoner['from'], $prisoner['wref'], $p_owner, $p_tribe, $prisoner, 1, 't');
$p_time = $database->getArtifactsValueInfluence($p_owner, $prisoner['from'], 2, $troopsTime);
$p_reference = $database->addAttack($prisoner['from'], $prisoner['t1'],$prisoner['t2'], $prisoner['t3'], $prisoner['t4'], $prisoner['t5'], $prisoner['t6'], $prisoner['t7'], $prisoner['t8'], $prisoner['t9'], $prisoner['t10'], $prisoner['t11'], 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
$database->addMovement(4, $prisoner['wref'], $prisoner['from'], $p_reference, time(), ($p_time + time()));
for($i = 1; $i <= 11; $i++) $troops += $prisoner['t'.$i];
//Reset traps
$database->modifyUnit($village->wid, ["99", "99o"], [$troops, $troops], [0, 0]);
$repairDuration = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round(($bid19[max($building->getTypeLevel(36, $village->wid), 1)]['attri'] / 100) * $u99['time'] / SPEED));
$database->trainUnit($village->wid, 99, $troops, $u99['pop'], $repairDuration, 0);
$database->deletePrisoners($prisoner['id']);
}else if($prisoner['from'] == $village->wid){
$prisonersToOwner = $database->getVillageField($prisoner['wref'], "owner");
for($i = 1; $i <= 11; $i++) $troops += $prisoner['t'.$i];
if($prisoner['t11'] > 0){
$p_owner = $database->getVillageField($prisoner['from'], "owner");
mysqli_query($database->dblink, "UPDATE ".TB_PREFIX."hero SET `dead` = '1', `health` = '0' WHERE `uid` = '".$p_owner."' AND dead = 0");
}
//Reset traps
$database->modifyUnit($prisoner['wref'], ["99", "99o"], [$troops, $troops], [0, 0]);
if(($troops = round($troops / 3)) > 0){
$repairDuration = $database->getArtifactsValueInfluence($prisonersToOwner, $prisoner['wref'], 5, round(($bid19[max($building->getTypeLevel(36, $prisoner['wref']), 1)]['attri'] / 100) * $u99['time'] / SPEED));
$database->trainUnit($prisoner['wref'], 99, $troops, $u99['pop'], $repairDuration, 0);
}
$database->deletePrisoners($prisoner['id']);
}
header("Location: build.php?id=39");
exit;
}
/**
* Get how much time troops spend to walk from a village to another
*
* @param int $from The start village ID
* @param int $to The target village ID
* @param int $owner The owner of the troops
* @param int $tribe The tribe of the owner's troops
* @param array $unitArray The array containing troops count if mode is 0, otherwise it'll contains the troop speed
* @param int $mode How the time should be calculated
* @return int Returns the time troops take to walk from a village to another
*/
public function getWalkingTroopsTime($from, $to, $owner, $tribe, $unitArray, $mode, $unit = ""){
global $generator, $database;
$fromCoor = $database->getCoor($from);
$toCoor = $database->getCoor($to);
$fromCor = ['x' => $fromCoor['x'], 'y' => $fromCoor['y']];
$toCor = ['x' => $toCoor['x'], 'y' => $toCoor['y']];
if(!$mode) return $generator->procDistanceTime($fromCor, $toCor, $unitArray[0], $mode, $from);
$start = ($tribe - 1) * 10 + 1;
$end = $tribe * 10;
$speeds = [];
//Find slowest unit
if(!empty($unit)){
for($i = 1; $i <= 11; $i++){
if(isset($unitArray[$unit.$i]) && $unitArray[$unit.$i] > 0) $unitArray[$i - 1] = $unitArray[$unit.$i];
else $unitArray[$i - 1] = 0;
}
}else{
for($i = $start; $i <= $end; $i++){
if(isset($unitArray['u'.$i]) && $unitArray['u'.$i] > 0) $unitArray[$i - $start] = $unitArray['u'.$i];
else $unitArray[$i - $start] = 0;
}
if(isset($unitArray['hero']) && $unitArray['hero'] > 0){
$unitArray[10] = $unitArray['hero'];
}
else $unitArray[10] = 0;
}
for($i = 0; $i <= 9; $i++){
if(isset($unitArray[$i]) && $unitArray[$i] > 0){
$speeds[] = $GLOBALS['u'.($i + $start)]['speed'];
}
}
if(isset($unitArray[10]) && $unitArray[10] > 0){
$heroUnit = $database->getHeroField($owner, 'unit');
$speeds[] = $GLOBALS['u'.$heroUnit]['speed'];
}
return $generator->procDistanceTime($fromCor, $toCor, min($speeds), $mode, $from);
}
public function startRaidList($post){
global $database, $generator, $session;
$slots = $post['slot'];
if(empty($slots)){
header("Location: build.php?id=39&t=99");
exit();
}
$tribe = $session->tribe;
foreach($slots as $slot){
$raidList = $database->getRaidList($slot);
$getFLData = $database->getFLData($raidList['lid']);
//Check if we're trying to start our raidlists or other players raidlist
if($getFLData['owner'] != $session->uid) continue;
//Get the units in the village
$villageUnits = $database->getUnit($getFLData['wref'], false);
$sid = $raidList['id'];
$wref = $raidList['towref'];
for($i = 1; $i <= 6; $i++) ${'t'.$i} = $raidList['t'.$i];
if(!$database->isVillageOases($wref)) $villageOwner = $database->getVillageField($wref, 'owner');
else $villageOwner = $database->getOasisField($wref, 'owner');
$userAccess = $database->getUserField($villageOwner, 'access', 0);
$userID = $database->getUserField($villageOwner, 'id', 0);
if($userAccess != 0 && !($userAccess == MULTIHUNTER && $userID == 5) && ($userAccess != ADMIN || (ADMIN_ALLOW_INCOMING_RAIDS && $userAccess == ADMIN))){
//Start = the first troop of the player's tribe
//End = the last selectable troop of the player's tribe
$start = ($session->tribe - 1) * 10 + 1;
$end = $start + 5;
//Check if we've enough troops
$canSend = true;
for($i = $start; $i <= $end; $i++){
if($villageUnits['u'.$i] < ${'t'.($i - $start + 1)}){
$canSend = false;
break;
}
}
//Send the attack
if($canSend){
$ckey = $generator->generateRandStr(6);
$id = $database->addA2b($ckey, 0, $wref, $t1, $t2, $t3, $t4, $t5, $t6, 0, 0, 0, 0, 0, 4);
$data = $database->getA2b($ckey);
$troopsTime = $this->getWalkingTroopsTime($getFLData['wref'], $data['to_vid'], $session->uid, $session->tribe, $data, 1, 'u');
$time = $database->getArtifactsValueInfluence($getFLData['owner'], $getFLData['wref'], 2, $troopsTime);
$abdata = $database->getABTech($getFLData['wref']);
$reference = $database->addAttack(($getFLData['wref']), $data['u1'], $data['u2'], $data['u3'], $data['u4'], $data['u5'], $data['u6'], 0, 0, 0, 0, 0, $data['type'], 0, 0, 0, $abdata['b1'], $abdata['b2'], $abdata['b3'], $abdata['b4'], $abdata['b5'], $abdata['b6'], $abdata['b7'], $abdata['b8']);
$troops = [];
$amounts = [];
$modes = [];
for($u = $start; $u <= $end; $u++){
$troops[] = $u;
$amounts[] = $data['u'.($u - $start + 1)];
$modes[] = 0;
}
$database->modifyUnit($getFLData['wref'], $troops, $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);
}
}
}
header("Location: build.php?id=39&t=99");
exit();
}
};
$units = new Units;
?>
-321
View File
@@ -1,321 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename Village.php ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ##
#################################################################################
include_once("Session.php");
include_once("Building.php");
include_once("Market.php");
include_once("GameEngine/Units.php");
include_once("Technology.php");
class Village {
public $type;
public $coor = [];
public $awood, $aclay, $airon, $acrop, $pop, $maxstore, $maxcrop, $atotal;
public $wid, $vname, $capital, $natar, $master;
public $resarray = [];
public $unitarray, $techarray, $unitall, $researching, $abarray = [];
private $infoarray = [];
private $production = [];
private $oasisowned, $ocounter = [];
function __construct() {
global $session, $database;
if(isset($_SESSION['wid'])) $this->wid = $_SESSION['wid'];
else $this->wid = $session->villages[0];
$this->preloadVillagesData();
//add new line code
//check exist village if from village destroy to avoid error msg.
if(!$database->checkVilExist($this->wid)){
$this->wid=$database->getVillageID($session->uid);
$_SESSION['wid'] = $this->wid;
}
$this->LoadTown();
$database->cacheResourceLevels($this->wid);
$this->calculateProduction();
$this->processProduction();
$this->ActionControl();
}
private function preloadVillagesData() {
global $database, $session;
// preload villages for this user account
$database->getProfileVillages($session->uid, 5);
// preload villages world data records
$database->cacheVillageByWorldIDs($session->uid);
}
public function getProd($type) {
return $this->production[$type];
}
public function getAllUnits($vid) {
global $database, $technology;
return $technology->getUnits($database->getUnit($vid),$database->getEnforceVillage($vid,0));
}
private function LoadTown($second_run = false) {
global $database, $session, $logging, $technology;
$this->infoarray = $database->getVillage($this->wid);
if($this->infoarray['owner'] != $session->uid && !$session->isAdmin) {
unset($_SESSION['wid']);
$logging->addIllegal($session->uid,$this->wid,1);
$this->wid = $session->villages[0];
$this->infoarray = $database->getVillage($this->wid);
}
$this->resarray = $database->getResourceLevel($this->wid);
$this->coor = $database->getCoor($this->wid);
$this->type = $database->getVillageType($this->wid);
$this->oasisowned = $database->getOasis($this->wid);
$this->ocounter = $this->sortOasis();
$this->unitarray = $database->getUnit($this->wid);
$this->enforcetome = $database->getEnforceVillage($this->wid,0);
$this->enforcetoyou = $database->getEnforceVillage($this->wid,1);
$this->enforceoasis = $database->getOasisEnforce($this->wid,0);
$this->unitall = $technology->getAllUnits($this->wid);
$this->techarray = $database->getTech($this->wid);
$this->abarray = $database->getABTech($this->wid);
$this->researching = $database->getResearching($this->wid, !$second_run);
$this->capital = $this->infoarray['capital'];
$this->natar = $this->infoarray['natar'];
$this->currentcel = $this->infoarray['celebration'];
$this->wid = $this->infoarray['wref'];
$this->vname = $this->infoarray['name'];
$this->awood = $this->infoarray['wood'];
$this->aclay = $this->infoarray['clay'];
$this->airon = $this->infoarray['iron'];
$this->acrop = $this->infoarray['crop'];
$this->atotal = (int)($this->awood + $this->aclay + $this->airon + $this->acrop);
$this->pop = $this->infoarray['pop'];
$this->maxstore = $this->infoarray['maxstore'];
$this->maxcrop = $this->infoarray['maxcrop'];
$this->allcrop = $this->getCropProd();
$this->loyalty = $this->infoarray['loyalty'];
$this->master = count($database->getMasterJobs($this->wid));
//If resources overflow the warehouse/granary limit, set them at the maximum value
$resourceUpdates = [];
if($this->awood > $this->maxstore)
{
$this->awood = $this->maxstore;
$resourceUpdates['wood'] = $this->maxstore;
}
if($this->aclay > $this->maxstore)
{
$this->aclay = $this->maxstore;
$resourceUpdates['clay'] = $this->maxstore;
}
if($this->airon > $this->maxstore)
{
$this->airon = $this->maxstore;
$resourceUpdates['iron'] = $this->maxstore;
}
if($this->acrop > $this->maxcrop)
{
$this->acrop = $this->maxcrop;
$resourceUpdates['crop'] = $this->maxcrop;
}
if (count($resourceUpdates)) {
$database->updateResource($this->wid, array_keys($resourceUpdates), array_values($resourceUpdates));
// reload cache if we've updated resources and the like
if ($second_run) {
// update DB cache
call_user_func(get_class($database).'::clearVillageCache');
$this->preloadVillagesData();
}
}
else if ($second_run) $this->preloadVillagesData();
}
private function calculateProduction() {
global $technology, $database, $session;
// clear cache, since we're updating village data
call_user_func(get_class($database).'::clearVillageCache');
$upkeep = $technology->getUpkeep($this->unitall, 0, $this->wid);
$this->production['wood'] = $this->getWoodProd();
$this->production['clay'] = $this->getClayProd();
$this->production['iron'] = $this->getIronProd();
$this->production['crop'] = $this->getCropProd() - (!$this->natar ? $this->pop : round($this->pop / 2)) - $upkeep;
}
private function processProduction() {
global $database;
$timepast = time() - $this->infoarray['lastupdate'];
$nwood = min(($this->production['wood'] / 3600) * $timepast, $this->maxstore);
$nclay = min(($this->production['clay'] / 3600) * $timepast, $this->maxstore);
$niron = min(($this->production['iron'] / 3600) * $timepast, $this->maxstore);
$ncrop = min(($this->production['crop'] / 3600) * $timepast, $this->maxcrop);
$database->modifyResource($this->wid, $nwood, $nclay, $niron, $ncrop, 1);
$database->updateVillage($this->wid);
$this->LoadTown(true);
}
private function getWoodProd() {
global $bid1, $bid5, $session;
$wood = $sawmill = 0;
$woodholder = [];
for($i = 1; $i <= 38; $i++) {
if($this->resarray['f'.$i.'t'] == 1) array_push($woodholder,'f'.$i);
if($this->resarray['f'.$i.'t'] == 5) $sawmill = $this->resarray['f'.$i];
}
for($i = 0; $i <= count($woodholder) - 1; $i++) $wood += $bid1[$this->resarray[$woodholder[$i]]]['prod'];
$wood = $wood + $wood * 0.25 * $this->ocounter[0];
if($sawmill >= 1) $wood += $wood / 100 * $bid5[$sawmill]['attri'];
if($session->bonus1 == 1) $wood *= 1.25;
return round($wood * SPEED);
}
private function getClayProd() {
global $bid2, $bid6, $session;
$clay = $brick = 0;
$clayholder = [];
for($i = 1; $i <= 38; $i++) {
if($this->resarray['f'.$i.'t'] == 2) array_push($clayholder,'f'.$i);
if($this->resarray['f'.$i.'t'] == 6) $brick = $this->resarray['f'.$i];
}
for($i = 0; $i <= count($clayholder) - 1; $i++) $clay+= $bid2[$this->resarray[$clayholder[$i]]]['prod'];
$clay = $clay + $clay * 0.25 * $this->ocounter[1];
if($brick >= 1) $clay += $clay / 100 * $bid6[$brick]['attri'];
if($session->bonus2 == 1) $clay *= 1.25;
return round($clay * SPEED);
}
private function getIronProd() {
global $bid3, $bid7, $session;
$iron = $foundry = 0;
$ironholder = [];
for($i = 1; $i <= 38; $i++) {
if($this->resarray['f'.$i.'t'] == 3) array_push($ironholder,'f'.$i);
if($this->resarray['f'.$i.'t'] == 7) $foundry = $this->resarray['f'.$i];
}
for($i = 0;$i <= count($ironholder) - 1; $i++) $iron+= $bid3[$this->resarray[$ironholder[$i]]]['prod'];
$iron = $iron + $iron * 0.25 * $this->ocounter[2];
if($foundry >= 1) $iron += $iron / 100 * $bid7[$foundry]['attri'];
if($session->bonus3 == 1) $iron *= 1.25;
return round($iron * SPEED);
}
private function getCropProd() {
global $bid4, $bid8, $bid9, $session;
$crop = $grainmill = $bakery = 0;
$cropholder = [];
for($i = 1; $i <= 38; $i++) {
if($this->resarray['f'.$i.'t'] == 4) array_push($cropholder,'f'.$i);
if($this->resarray['f'.$i.'t'] == 8) $grainmill = $this->resarray['f'.$i];
if($this->resarray['f'.$i.'t'] == 9) $bakery = $this->resarray['f'.$i];
}
for ($i = 0; $i <= count($cropholder) - 1; $i++) $crop += $bid4[$this->resarray[$cropholder[$i]]]['prod'];
$bonus = 0.25 * $this->ocounter[3];
$crop = $crop + $crop * 0.25 * $this->ocounter[3];
if($grainmill >= 1 || $bakery >= 1) {
$crop += $crop / 100 * ((isset($bid8[$grainmill]['attri']) ? $bid8[$grainmill]['attri'] : 0) + (isset($bid9[$bakery]['attri']) ? $bid9[$bakery]['attri'] : 0));
}
if($session->bonus4 == 1) $crop *= 1.25;
return round($crop * SPEED);
}
private function sortOasis() {
$crop = $clay = $wood = $iron = 0;
if(!empty($this->oasisowned)){
foreach($this->oasisowned as $oasis){
switch($oasis['type']){
case 1:
case 2:
$wood++;
break;
case 3:
$wood++;
$crop++;
break;
case 4:
case 5:
$clay++;
break;
case 6:
$clay++;
$crop++;
break;
case 7:
case 8:
$iron++;
break;
case 9:
$iron++;
$crop++;
break;
case 10:
case 11:
$crop++;
break;
case 12:
$crop += 2;
break;
}
}
}
return [$wood, $clay, $iron, $crop];
}
private function ActionControl() {
global $session;
if(SERVER_WEB_ROOT) $page = $_SERVER['SCRIPT_NAME'];
else
{
$explode = explode("/",$_SERVER['SCRIPT_NAME']);
$i = count($explode)-1;
$page = $explode[$i];
}
if($page == "build.php" && $session->uid != $this->infoarray['owner']) {
unset($_SESSION['wid']);
header("Location: dorf1.php");
exit;
}
}
};
$village = new Village;
$building = new Building;
//include_once("Automation.php");
?>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

-37
View File
@@ -1,37 +0,0 @@
<?php
############################################################
## ##
## Test functions so far mini template parser ##
## Author : Advocaite ##
## Project : TravianX ##
## ##
############################################################
function addSub($subName, $sub)
{
$GLOBALS['subs']["{".$subName."}"] = $sub;
}
function template($filepath, $subs)
{
global $s;
if(file_exists($filepath))
{
$text = file_get_contents($filepath);
} else {
print "File '$filepath' not found";
return false;
}
foreach($subs as $sub => $repl)
{
$text = str_replace($sub, $repl, $text);
}
ob_start();
eval("?>".$text);
$text = ob_get_contents();
ob_end_clean();
return $text;
}
?>
-19
View File
@@ -1,19 +0,0 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename 404.tpl ##
## Developed by: aggenkeech ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2012. All rights reserved. ##
## ##
#################################################################################
?>
<div style="margin-top: 50px;">
<div style="text-align: center">
<h1>404 - File not found</h1>
<img src="../../gpack/travian_default/img/misc/404.gif" title="Not Found" alt="Not Found"><br />
<p>We looked 404 times already but can't find anything, Not even an X marking the spot.</p>
<p>This system is not complete yet. So the page probably does not exist.</p><br>
</div>
</div>