Big Cleanup

1) Removed unnecessary files
2) Trailling spaces (no all though)
3)  Some space to tab conversion
This commit is contained in:
Neranjen
2012-06-18 05:06:05 +05:30
parent e081116620
commit 786cbf1f8e
195 changed files with 23522 additions and 23537 deletions
+230 -230
View File
@@ -1,241 +1,241 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename Account.php ##
## Developed by: Songer & Dzoki ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ##
#################################################################################
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename Account.php ##
## Developed by: Songer & Dzoki ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ##
#################################################################################
include("Session.php");
include("Session.php");
class Account {
function Account() {
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($database->checkExist($_POST['name'],0)) {
$form->addError("name",USRNM_TAKEN);
}
else if($database->checkExist_activate($_POST['name'],0)) {
$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);
class Account {
}
}
if(!isset($_POST['email'])) {
$form->addError("email",EMAIL_EMPTY);
}
else {
if(!$this->validEmail($_POST['email'])) {
$form->addError("email",EMAIL_INVALID);
}
else if($database->checkExist($_POST['email'],1)) {
$form->addError("email",EMAIL_TAKEN);
}
else if($database->checkExist_activate($_POST['email'],1)) {
$form->addError("email",EMAIL_TAKEN);
}
}
if(!isset($_POST['vid'])) {
$form->addError("tribe",TRIBE_EMPTY);
}
if(!isset($_POST['agb'])) {
$form->addError("agree",AGREE_ERROR);
}
if($form->returnErrors() > 0) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $_POST;
header("Location: anmelden.php");
}
else {
if(AUTH_EMAIL){
$act = $generator->generateRandStr(10);
$act2 = $generator->generateRandStr(5);
$uid = $database->activate($_POST['name'],md5($_POST['pw']),$_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");
}
}
else {
$uid = $database->register($_POST['name'],md5($_POST['pw']),$_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","",1);
$database->updateUserField($uid,"invited",$_POST['invited'],1);
$this->generateBase($_POST['kid'],$uid,$_POST['name']);
header("Location: login.php");
}
}
}
}
private function Activate() {
function Account() {
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($database->checkExist($_POST['name'],0)) {
$form->addError("name",USRNM_TAKEN);
}
else if($database->checkExist_activate($_POST['name'],0)) {
$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($database->checkExist($_POST['email'],1)) {
$form->addError("email",EMAIL_TAKEN);
}
else if($database->checkExist_activate($_POST['email'],1)) {
$form->addError("email",EMAIL_TAKEN);
}
}
if(!isset($_POST['vid'])) {
$form->addError("tribe",TRIBE_EMPTY);
}
if(!isset($_POST['agb'])) {
$form->addError("agree",AGREE_ERROR);
}
if($form->returnErrors() > 0) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $_POST;
header("Location: anmelden.php");
}
else {
if(AUTH_EMAIL){
$act = $generator->generateRandStr(10);
$act2 = $generator->generateRandStr(5);
$uid = $database->activate($_POST['name'],md5($_POST['pw']),$_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");
}
}
else {
$uid = $database->register($_POST['name'],md5($_POST['pw']),$_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","",1);
$database->updateUserField($uid,"invited",$_POST['invited'],1);
$this->generateBase($_POST['kid'],$uid,$_POST['name']);
header("Location: login.php");
}
}
}
}
private function Activate() {
if(START_DATE < date('m/d/Y') or START_DATE == date('m/d/Y') && START_TIME <= date('H:i'))
{
global $database;
$q = "SELECT * FROM ".TB_PREFIX."activate where act = '".$_POST['id']."'";
$result = mysql_query($q, $database->connection);
$dbarray = mysql_fetch_array($result);
if($dbarray['act'] == $_POST['id']) {
$uid = $database->register($dbarray['username'],$dbarray['password'],$dbarray['email'],$dbarray['tribe'],"");
if($uid) {
$database->unreg($dbarray['username']);
$this->generateBase($dbarray['kid'],$uid,$dbarray['username']);
header("Location: activate.php?e=2");
}
}
else
{
header("Location: activate.php?e=3");
}
}
else
{
header("Location: activate.php");
}
}
private function Unreg() {
global $database;
$q = "SELECT * FROM ".TB_PREFIX."activate where id = '".$_POST['id']."'";
$result = mysql_query($q, $database->connection);
$dbarray = mysql_fetch_array($result);
if(md5($_POST['pw']) == $dbarray['password']) {
$database->unreg($dbarray['username']);
header("Location: anmelden.php");
}
else {
header("Location: activate.php?e=3");
}
}
private function Login() {
global $database,$session,$form;
if(!isset($_POST['user']) || $_POST['user'] == "") {
$form->addError("user",LOGIN_USR_EMPTY);
}
else if(!$database->checkExist($_POST['user'],0)) {
$form->addError("user",USR_NT_FOUND);
}
if(!isset($_POST['pw']) || $_POST['pw'] == "") {
$form->addError("pw",LOGIN_PASS_EMPTY);
}
else if(!$database->login($_POST['user'],$_POST['pw']) && !$database->sitterLogin($_POST['user'],$_POST['pw'])) {
$form->addError("pw",LOGIN_PW_ERROR);
}
if($database->getUserField($_POST['user'],"act",1) != "") {
$form->addError("activate",$_POST['user']);
}
if($form->returnErrors() > 0) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $_POST;
header("Location: login.php");
}
else {
{
global $database;
$q = "SELECT * FROM ".TB_PREFIX."activate where act = '".$_POST['id']."'";
$result = mysql_query($q, $database->connection);
$dbarray = mysql_fetch_array($result);
if($dbarray['act'] == $_POST['id']) {
$uid = $database->register($dbarray['username'],$dbarray['password'],$dbarray['email'],$dbarray['tribe'],"");
if($uid) {
$database->unreg($dbarray['username']);
$this->generateBase($dbarray['kid'],$uid,$dbarray['username']);
header("Location: activate.php?e=2");
}
}
else
{
header("Location: activate.php?e=3");
}
}
else
{
header("Location: activate.php");
}
}
private function Unreg() {
global $database;
$q = "SELECT * FROM ".TB_PREFIX."activate where id = '".$_POST['id']."'";
$result = mysql_query($q, $database->connection);
$dbarray = mysql_fetch_array($result);
if(md5($_POST['pw']) == $dbarray['password']) {
$database->unreg($dbarray['username']);
header("Location: anmelden.php");
}
else {
header("Location: activate.php?e=3");
}
}
private function Login() {
global $database,$session,$form;
if(!isset($_POST['user']) || $_POST['user'] == "") {
$form->addError("user",LOGIN_USR_EMPTY);
}
else if(!$database->checkExist($_POST['user'],0)) {
$form->addError("user",USR_NT_FOUND);
}
if(!isset($_POST['pw']) || $_POST['pw'] == "") {
$form->addError("pw",LOGIN_PASS_EMPTY);
}
else if(!$database->login($_POST['user'],$_POST['pw']) && !$database->sitterLogin($_POST['user'],$_POST['pw'])) {
$form->addError("pw",LOGIN_PW_ERROR);
}
if($database->getUserField($_POST['user'],"act",1) != "") {
$form->addError("activate",$_POST['user']);
}
if($form->returnErrors() > 0) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $_POST;
header("Location: login.php");
}
else {
$userid = $database->getUserArray($_POST['user'], 0);
if($database->login($_POST['user'],$_POST['pw'])){
$database->UpdateOnline("login" ,$_POST['user'],time(),$userid['id']);
}else if($database->sitterLogin($_POST['user'],$_POST['pw'])){
$database->UpdateOnline("sitter" ,$_POST['user'],time(),$userid['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($session->username,1);
$database->UpdateOnline("logout") or die(mysql_error());
$session->Logout();
}
private function validEmail($email) {
$regexp="/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}$/i";
if ( !preg_match($regexp, $email) ) {
return false;
}
return true;
}
function generateBase($kid,$uid,$username) {
global $database,$message;
if($kid == 0) {
$kid = rand(1,4);
}
else{
$kid = $_POST['kid'];
}
$wid = $database->generateBase($kid);
$database->setFieldTaken($wid);
$database->addVillage($wid,$uid,$username,1);
$database->addResourceFields($wid,$database->getVillageType($wid));
$database->addUnits($wid);
$database->addTech($wid);
$database->addABTech($wid);
$database->updateUserField($uid,"access",USER,1);
$message->sendWelcome($uid,$username);
}
};
$account = new Account;
setcookie("COOKUSR",$_POST['user'],time()+COOKIE_EXPIRE,COOKIE_PATH);
$session->login($_POST['user']);
}
}
private function Logout() {
global $session,$database;
unset($_SESSION['wid']);
$database->activeModify($session->username,1);
$database->UpdateOnline("logout") or die(mysql_error());
$session->Logout();
}
private function validEmail($email) {
$regexp="/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}$/i";
if ( !preg_match($regexp, $email) ) {
return false;
}
return true;
}
function generateBase($kid,$uid,$username) {
global $database,$message;
if($kid == 0) {
$kid = rand(1,4);
}
else{
$kid = $_POST['kid'];
}
$wid = $database->generateBase($kid);
$database->setFieldTaken($wid);
$database->addVillage($wid,$uid,$username,1);
$database->addResourceFields($wid,$database->getVillageType($wid));
$database->addUnits($wid);
$database->addTech($wid);
$database->addABTech($wid);
$database->updateUserField($uid,"access",USER,1);
$message->sendWelcome($uid,$username);
}
};
$account = new Account;
?>
+1 -1
View File
@@ -101,4 +101,4 @@ mysql_query("Insert into ".TB_PREFIX."admin_log values (0,".$_SESSION['id'].",'C
header("Location: ../../../Admin/admin.php?p=addTroops&did=".$id."&d");
?>
?>
+18 -18
View File
@@ -16,30 +16,30 @@ mysql_select_db(SQL_DB);
$id = $_POST['id'];
$amt = $_POST['vill_amount'];
for($i=1;$i<=$amt;$i++) {
$kid = rand(1,4);
$wid = $database->generateBase($kid);
$database->setFieldTaken($wid);
$time = time();
$q = "insert into ".TB_PREFIX."vdata (`wref`,`owner`,`name`,`capital`,`pop`,`cp`,`celebration`,`type`,`wood`,`clay`,`iron`,`maxstore`,`crop`,`maxcrop`,`lastupdate`,`loyalty`,`exp1`,`exp2`,`exp3`,`created`) values ('$wid','3','WW Buildingplan',0,0,0,0,0,80000.00,80000.00,80000.00,80000,80000.00,80000,1314974534,100,0,0,0,1314968914)";
mysql_query($q) or die(mysql_error());
$q = "insert into ".TB_PREFIX."fdata (`vref`,`f1`,`f1t`,`f2`,`f2t`,`f3`,`f3t`,`f4`,`f4t`,`f5`,`f5t`,`f6`,`f6t`,`f7`,`f7t`,`f8`,`f8t`,`f9`,`f9t`,`f10`,`f10t`,`f11`,`f11t`,`f12`,`f12t`,`f13`,`f13t`,`f14`,`f14t`,`f15`,`f15t`,`f16`,`f16t`,`f17`,`f17t`,`f18`,`f18t`,`f19`,`f19t`,`f20`,`f20t`,`f21`,`f21t`,`f22`,`f22t`,`f23`,`f23t`,`f24`,`f24t`,`f25`,`f25t`,`f26`,`f26t`,`f27`,`f27t`,`f28`,`f28t`,`f29`,`f29t`,`f30`,`f30t`,`f31`,`f31t`,`f32`,`f32t`,`f33`,`f33t`,`f34`,`f34t`,`f35`,`f35t`,`f36`,`f36t`,`f37`,`f37t`,`f38`,`f38t`,`f39`,`f39t`,`f40`,`f40t`,`f99`,`f99t`,`wwname`) values ($wid,0,1,0,4,0,1,0,3,0,2,0,2,0,3,0,4,0,4,0,3,0,3,0,4,0,4,0,1,0,4,0,2,0,1,0,2,20,17,20,11,10,27,20,10,10,22,10,25,0,0,20,15,10,19,0,0,0,0,0,0,10,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,16,0,0,0,0,'World Wonder')";
mysql_query($q);
$kid = rand(1,4);
$wid = $database->generateBase($kid);
$database->setFieldTaken($wid);
$time = time();
$q = "insert into ".TB_PREFIX."vdata (`wref`,`owner`,`name`,`capital`,`pop`,`cp`,`celebration`,`type`,`wood`,`clay`,`iron`,`maxstore`,`crop`,`maxcrop`,`lastupdate`,`loyalty`,`exp1`,`exp2`,`exp3`,`created`) values ('$wid','3','WW Buildingplan',0,0,0,0,0,80000.00,80000.00,80000.00,80000,80000.00,80000,1314974534,100,0,0,0,1314968914)";
mysql_query($q) or die(mysql_error());
$q = "insert into ".TB_PREFIX."fdata (`vref`,`f1`,`f1t`,`f2`,`f2t`,`f3`,`f3t`,`f4`,`f4t`,`f5`,`f5t`,`f6`,`f6t`,`f7`,`f7t`,`f8`,`f8t`,`f9`,`f9t`,`f10`,`f10t`,`f11`,`f11t`,`f12`,`f12t`,`f13`,`f13t`,`f14`,`f14t`,`f15`,`f15t`,`f16`,`f16t`,`f17`,`f17t`,`f18`,`f18t`,`f19`,`f19t`,`f20`,`f20t`,`f21`,`f21t`,`f22`,`f22t`,`f23`,`f23t`,`f24`,`f24t`,`f25`,`f25t`,`f26`,`f26t`,`f27`,`f27t`,`f28`,`f28t`,`f29`,`f29t`,`f30`,`f30t`,`f31`,`f31t`,`f32`,`f32t`,`f33`,`f33t`,`f34`,`f34t`,`f35`,`f35t`,`f36`,`f36t`,`f37`,`f37t`,`f38`,`f38t`,`f39`,`f39t`,`f40`,`f40t`,`f99`,`f99t`,`wwname`) values ($wid,0,1,0,4,0,1,0,3,0,2,0,2,0,3,0,4,0,4,0,3,0,3,0,4,0,4,0,1,0,4,0,2,0,1,0,2,20,17,20,11,10,27,20,10,10,22,10,25,0,0,20,15,10,19,0,0,0,0,0,0,10,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,16,0,0,0,0,'World Wonder')";
mysql_query($q);
$pop = $automation->recountPop($wid);
$cp = $automation->recountPop($wid);
$database->addUnits($wid);
$database->addTech($wid);
$database->addABTech($wid);
$q = "UPDATE ".TB_PREFIX."units SET u41 = u41 + '150000', u42 = u42 + '150000', u43 = u43 + '150000', u44 = u44 + '150000', u45 = u45 + '150000', u46 = u46 + '150000', u47 = u47 + '150000', u48 = u48 + '150000' , u49 = u49 + '150000', u50 = u50 + '150000' WHERE vref = '".$wid."'";
mysql_query($q);
$desc = 'With this ancient construction plan you will able to build World Wonder to level 50. to build further, your alliance must hold at least two plans.';
$database->addUnits($wid);
$database->addTech($wid);
$database->addABTech($wid);
$q = "UPDATE ".TB_PREFIX."units SET u41 = u41 + '150000', u42 = u42 + '150000', u43 = u43 + '150000', u44 = u44 + '150000', u45 = u45 + '150000', u46 = u46 + '150000', u47 = u47 + '150000', u48 = u48 + '150000' , u49 = u49 + '150000', u50 = u50 + '150000' WHERE vref = '".$wid."'";
mysql_query($q);
$desc = 'With this ancient construction plan you will able to build World Wonder to level 50. to build further, your alliance must hold at least two plans.';
$database->addArtefact($wid, 3, 11, 1, 'Ancient Construction Plan', $desc, '', 'typeww.gif');
}
mysql_query("Insert into ".TB_PREFIX."admin_log values (0,$id,'Added <b>$amt</b> WW Buildingplan Villages',".time().")");
mysql_query("Insert into ".TB_PREFIX."admin_log values (0,$id,'Added <b>$amt</b> WW Buildingplan Villages',".time().")");
header("Location: ../../../Admin/admin.php?p=natarbuildingplan&g");
+18 -18
View File
@@ -16,29 +16,29 @@ mysql_select_db(SQL_DB);
$id = $_POST['id'];
$amt = $_POST['vill_amount'];
for($i=1;$i<=$amt;$i++) {
$kid = rand(1,4);
$wid = $database->generateBase($kid);
$database->setFieldTaken($wid);
$time = time();
$q = "insert into ".TB_PREFIX."vdata (`wref`,`owner`,`name`,`capital`,`pop`,`cp`,`celebration`,`type`,`wood`,`clay`,`iron`,`maxstore`,`crop`,`maxcrop`,`lastupdate`,`loyalty`,`exp1`,`exp2`,`exp3`,`created`,`natar`) values ('$wid','3','WW village',0,0,0,0,0,80000.00,80000.00,80000.00,80000,80000.00,80000,1314974534,100,0,0,0,$time,1)";
mysql_query($q) or die(mysql_error());
$q = "insert into ".TB_PREFIX."fdata (`vref`,`f1`,`f1t`,`f2`,`f2t`,`f3`,`f3t`,`f4`,`f4t`,`f5`,`f5t`,`f6`,`f6t`,`f7`,`f7t`,`f8`,`f8t`,`f9`,`f9t`,`f10`,`f10t`,`f11`,`f11t`,`f12`,`f12t`,`f13`,`f13t`,`f14`,`f14t`,`f15`,`f15t`,`f16`,`f16t`,`f17`,`f17t`,`f18`,`f18t`,`f19`,`f19t`,`f20`,`f20t`,`f21`,`f21t`,`f22`,`f22t`,`f23`,`f23t`,`f24`,`f24t`,`f25`,`f25t`,`f26`,`f26t`,`f27`,`f27t`,`f28`,`f28t`,`f29`,`f29t`,`f30`,`f30t`,`f31`,`f31t`,`f32`,`f32t`,`f33`,`f33t`,`f34`,`f34t`,`f35`,`f35t`,`f36`,`f36t`,`f37`,`f37t`,`f38`,`f38t`,`f39`,`f39t`,`f40`,`f40t`,`f99`,`f99t`,`wwname`) values ($wid,0,1,0,4,0,1,0,3,0,2,0,2,0,3,0,4,0,4,0,3,0,3,0,4,0,4,0,1,0,4,0,2,0,1,0,2,20,17,20,11,20,15,20,10,10,22,10,25,0,0,0,0,10,19,0,0,0,0,0,0,10,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,16,0,0,0,40,'World Wonder')";
mysql_query($q);
$kid = rand(1,4);
$wid = $database->generateBase($kid);
$database->setFieldTaken($wid);
$time = time();
$q = "insert into ".TB_PREFIX."vdata (`wref`,`owner`,`name`,`capital`,`pop`,`cp`,`celebration`,`type`,`wood`,`clay`,`iron`,`maxstore`,`crop`,`maxcrop`,`lastupdate`,`loyalty`,`exp1`,`exp2`,`exp3`,`created`,`natar`) values ('$wid','3','WW village',0,0,0,0,0,80000.00,80000.00,80000.00,80000,80000.00,80000,1314974534,100,0,0,0,$time,1)";
mysql_query($q) or die(mysql_error());
$q = "insert into ".TB_PREFIX."fdata (`vref`,`f1`,`f1t`,`f2`,`f2t`,`f3`,`f3t`,`f4`,`f4t`,`f5`,`f5t`,`f6`,`f6t`,`f7`,`f7t`,`f8`,`f8t`,`f9`,`f9t`,`f10`,`f10t`,`f11`,`f11t`,`f12`,`f12t`,`f13`,`f13t`,`f14`,`f14t`,`f15`,`f15t`,`f16`,`f16t`,`f17`,`f17t`,`f18`,`f18t`,`f19`,`f19t`,`f20`,`f20t`,`f21`,`f21t`,`f22`,`f22t`,`f23`,`f23t`,`f24`,`f24t`,`f25`,`f25t`,`f26`,`f26t`,`f27`,`f27t`,`f28`,`f28t`,`f29`,`f29t`,`f30`,`f30t`,`f31`,`f31t`,`f32`,`f32t`,`f33`,`f33t`,`f34`,`f34t`,`f35`,`f35t`,`f36`,`f36t`,`f37`,`f37t`,`f38`,`f38t`,`f39`,`f39t`,`f40`,`f40t`,`f99`,`f99t`,`wwname`) values ($wid,0,1,0,4,0,1,0,3,0,2,0,2,0,3,0,4,0,4,0,3,0,3,0,4,0,4,0,1,0,4,0,2,0,1,0,2,20,17,20,11,20,15,20,10,10,22,10,25,0,0,0,0,10,19,0,0,0,0,0,0,10,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,16,0,0,0,40,'World Wonder')";
mysql_query($q);
$pop = $automation->recountPop($wid);
$cp = $automation->recountPop($wid);
$database->addUnits($wid);
$database->addTech($wid);
$database->addABTech($wid);
$q = "UPDATE ".TB_PREFIX."units SET u41 = u41 + '150000', u42 = u42 + '150000', u43 = u43 + '150000', u44 = u44 + '150000', u45 = u45 + '150000', u46 = u46 + '150000', u47 = u47 + '150000', u48 = u48 + '150000' , u49 = u49 + '150000', u50 = u50 + '150000' WHERE vref = '".$wid."'";
mysql_query($q);
$database->addUnits($wid);
$database->addTech($wid);
$database->addABTech($wid);
$q = "UPDATE ".TB_PREFIX."units SET u41 = u41 + '150000', u42 = u42 + '150000', u43 = u43 + '150000', u44 = u44 + '150000', u45 = u45 + '150000', u46 = u46 + '150000', u47 = u47 + '150000', u48 = u48 + '150000' , u49 = u49 + '150000', u50 = u50 + '150000' WHERE vref = '".$wid."'";
mysql_query($q);
}
mysql_query("Insert into ".TB_PREFIX."admin_log values (0,$id,'Added <b>$amt</b> WW Villages',".time().")");
mysql_query("Insert into ".TB_PREFIX."admin_log values (0,$id,'Added <b>$amt</b> WW Villages',".time().")");
header("Location: ../../../Admin/admin.php?p=natarend&g");
+2 -2
View File
@@ -9,8 +9,8 @@
## ##
#################################################################################
include ("../../Database.php");
include ("../../Admin/database.php");
include ("../../Database.php");
include ("../../Admin/database.php");
include ("../../config.php");
$database->populateOasisUnitsLow();
+81 -81
View File
@@ -23,87 +23,87 @@ $sessionaccess = $access['access'];
if($sessionaccess != 9) die("<h1><font color=\"red\">Access Denied: You are not Admin!</font></h1>");
mysql_query("UPDATE ".TB_PREFIX."fdata SET
f1 = '".$_POST['id1level']."',
f1t = '".$_POST['id1gid']."',
f2 = '".$_POST['id2level']."',
f2t = '".$_POST['id2gid']."',
f3 = '".$_POST['id3level']."',
f3t = '".$_POST['id3gid']."',
f4 = '".$_POST['id4level']."',
f4t = '".$_POST['id4gid']."',
f5 = '".$_POST['id5level']."',
f5t = '".$_POST['id5gid']."',
f6 = '".$_POST['id6level']."',
f6t = '".$_POST['id6gid']."',
f7 = '".$_POST['id7level']."',
f7t = '".$_POST['id7gid']."',
f8 = '".$_POST['id8level']."',
f8t = '".$_POST['id8gid']."',
f9 = '".$_POST['id9level']."',
f9t = '".$_POST['id9gid']."',
f10 = '".$_POST['id10level']."',
f10t = '".$_POST['id10gid']."',
f11 = '".$_POST['id11level']."',
f11t = '".$_POST['id11gid']."',
f12 = '".$_POST['id12level']."',
f12t = '".$_POST['id12gid']."',
f13 = '".$_POST['id13level']."',
f13t = '".$_POST['id13gid']."',
f14 = '".$_POST['id14level']."',
f14t = '".$_POST['id14gid']."',
f15 = '".$_POST['id15level']."',
f15t = '".$_POST['id15gid']."',
f16 = '".$_POST['id16level']."',
f16t = '".$_POST['id16gid']."',
f17 = '".$_POST['id17level']."',
f17t = '".$_POST['id17gid']."',
f18 = '".$_POST['id18level']."',
f18t = '".$_POST['id18gid']."',
f19 = '".$_POST['id19level']."',
f19t = '".$_POST['id19gid']."',
f20 = '".$_POST['id20level']."',
f20t = '".$_POST['id20gid']."',
f21 = '".$_POST['id21level']."',
f21t = '".$_POST['id21gid']."',
f22 = '".$_POST['id22level']."',
f22t = '".$_POST['id22gid']."',
f23 = '".$_POST['id23level']."',
f23t = '".$_POST['id23gid']."',
f24 = '".$_POST['id24level']."',
f24t = '".$_POST['id24gid']."',
f25 = '".$_POST['id25level']."',
f25t = '".$_POST['id25gid']."',
f26 = '".$_POST['id26level']."',
f26t = '".$_POST['id26gid']."',
f27 = '".$_POST['id27level']."',
f27t = '".$_POST['id27gid']."',
f28 = '".$_POST['id28level']."',
f28t = '".$_POST['id28gid']."',
f29 = '".$_POST['id29level']."',
f29t = '".$_POST['id29gid']."',
f30 = '".$_POST['id30level']."',
f30t = '".$_POST['id30gid']."',
f31 = '".$_POST['id31level']."',
f31t = '".$_POST['id31gid']."',
f32 = '".$_POST['id32level']."',
f32t = '".$_POST['id32gid']."',
f33 = '".$_POST['id33level']."',
f33t = '".$_POST['id33gid']."',
f34 = '".$_POST['id34level']."',
f34t = '".$_POST['id34gid']."',
f35 = '".$_POST['id35level']."',
f35t = '".$_POST['id35gid']."',
f36 = '".$_POST['id36level']."',
f36t = '".$_POST['id36gid']."',
f37 = '".$_POST['id37level']."',
f37t = '".$_POST['id37gid']."',
f38 = '".$_POST['id38level']."',
f38t = '".$_POST['id38gid']."',
f39 = '".$_POST['id39level']."',
f39t = '".$_POST['id39gid']."',
f40 = '".$_POST['id40level']."',
f40t = '".$_POST['id40gid']."'
mysql_query("UPDATE ".TB_PREFIX."fdata SET
f1 = '".$_POST['id1level']."',
f1t = '".$_POST['id1gid']."',
f2 = '".$_POST['id2level']."',
f2t = '".$_POST['id2gid']."',
f3 = '".$_POST['id3level']."',
f3t = '".$_POST['id3gid']."',
f4 = '".$_POST['id4level']."',
f4t = '".$_POST['id4gid']."',
f5 = '".$_POST['id5level']."',
f5t = '".$_POST['id5gid']."',
f6 = '".$_POST['id6level']."',
f6t = '".$_POST['id6gid']."',
f7 = '".$_POST['id7level']."',
f7t = '".$_POST['id7gid']."',
f8 = '".$_POST['id8level']."',
f8t = '".$_POST['id8gid']."',
f9 = '".$_POST['id9level']."',
f9t = '".$_POST['id9gid']."',
f10 = '".$_POST['id10level']."',
f10t = '".$_POST['id10gid']."',
f11 = '".$_POST['id11level']."',
f11t = '".$_POST['id11gid']."',
f12 = '".$_POST['id12level']."',
f12t = '".$_POST['id12gid']."',
f13 = '".$_POST['id13level']."',
f13t = '".$_POST['id13gid']."',
f14 = '".$_POST['id14level']."',
f14t = '".$_POST['id14gid']."',
f15 = '".$_POST['id15level']."',
f15t = '".$_POST['id15gid']."',
f16 = '".$_POST['id16level']."',
f16t = '".$_POST['id16gid']."',
f17 = '".$_POST['id17level']."',
f17t = '".$_POST['id17gid']."',
f18 = '".$_POST['id18level']."',
f18t = '".$_POST['id18gid']."',
f19 = '".$_POST['id19level']."',
f19t = '".$_POST['id19gid']."',
f20 = '".$_POST['id20level']."',
f20t = '".$_POST['id20gid']."',
f21 = '".$_POST['id21level']."',
f21t = '".$_POST['id21gid']."',
f22 = '".$_POST['id22level']."',
f22t = '".$_POST['id22gid']."',
f23 = '".$_POST['id23level']."',
f23t = '".$_POST['id23gid']."',
f24 = '".$_POST['id24level']."',
f24t = '".$_POST['id24gid']."',
f25 = '".$_POST['id25level']."',
f25t = '".$_POST['id25gid']."',
f26 = '".$_POST['id26level']."',
f26t = '".$_POST['id26gid']."',
f27 = '".$_POST['id27level']."',
f27t = '".$_POST['id27gid']."',
f28 = '".$_POST['id28level']."',
f28t = '".$_POST['id28gid']."',
f29 = '".$_POST['id29level']."',
f29t = '".$_POST['id29gid']."',
f30 = '".$_POST['id30level']."',
f30t = '".$_POST['id30gid']."',
f31 = '".$_POST['id31level']."',
f31t = '".$_POST['id31gid']."',
f32 = '".$_POST['id32level']."',
f32t = '".$_POST['id32gid']."',
f33 = '".$_POST['id33level']."',
f33t = '".$_POST['id33gid']."',
f34 = '".$_POST['id34level']."',
f34t = '".$_POST['id34gid']."',
f35 = '".$_POST['id35level']."',
f35t = '".$_POST['id35gid']."',
f36 = '".$_POST['id36level']."',
f36t = '".$_POST['id36gid']."',
f37 = '".$_POST['id37level']."',
f37t = '".$_POST['id37gid']."',
f38 = '".$_POST['id38level']."',
f38t = '".$_POST['id38gid']."',
f39 = '".$_POST['id39level']."',
f39t = '".$_POST['id39gid']."',
f40 = '".$_POST['id40level']."',
f40t = '".$_POST['id40gid']."'
WHERE vref = $id") or die(mysql_error());
header("Location: ../../../Admin/admin.php?action=recountPop&did=".$id."");
-4
View File
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<dwsync>
<file name="userCount.php" server="D:/wamp/www/New/" local="129157402737451172" remote="129157402730000000" />
</dwsync>
+45 -45
View File
@@ -1,13 +1,13 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename admin.php ##
## --------------------------------------------------------------------------- ##
## Filename admin.php ##
## Developed by: Dzoki ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ##
#################################################################################
#################################################################################
session_start();
include("../GameEngine/Database.php");
include("../GameEngine/Admin/database.php");
@@ -24,9 +24,9 @@ function aktiv() {this.srcElement.className='fl1'; }
<script src="ajax.js" type="text/javascript"></script>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="imagetoolbar" content="no">
</head>
<body>
<meta http-equiv="imagetoolbar" content="no">
</head>
<body>
<script language="javascript">
function aktiv() {this.srcElement.className='fl1'; }
@@ -46,16 +46,16 @@ if(conf){return true;}else{return false;}
<img src="../img/x.gif" width="1" height="1">
</div>
<img class="fl2" src="../img/admin/x1.gif" width="70" height="100" border="0" onmouseover="this.className='fl1'" onmouseout="this.className='fl2'"><img class="fl2" src="../img/admin/x2.gif" width="70" height="100" border="0" onmouseover="this.className='fl1'" onmouseout="this.className='fl2'"><img class="fl2" src="../img/admin/x3.gif" width="70" height="100" border="0" onmouseover="this.className='fl1'" onmouseout="this.className='fl2'"><img class="fl2" src="../img/admin/x4.gif" width="70" height="100" border="0" onmouseover="this.className='fl1'" onmouseout="this.className='fl2'"><img class="fl2" src="../img/admin/x5.gif" width="70" height="100" border="0" onmouseover="this.className='fl1'" onmouseout="this.className='fl2'"></div>
<div id="lmidall">
<div id="lmidlc">
<div id="lleft">
<a href="index.php"><img src="../img/en/a/travian0.gif" class="logo_plus" width="116" height="60" border="0"></a>
<table id="navi_table" cellspacing="0" cellpadding="0">
<tr>
<td class="menu">
<?php
<div id="lmidlc">
<div id="lleft">
<a href="index.php"><img src="../img/en/a/travian0.gif" class="logo_plus" width="116" height="60" border="0"></a>
<table id="navi_table" cellspacing="0" cellpadding="0">
<tr>
<td class="menu">
<?php
if($funct->CheckLogin()){?>
<a href="admin.php">ACP Home</a>
@@ -63,43 +63,43 @@ if(conf){return true;}else{return false;}
<a href="#"></a><a href="#"></a>
<a href="?p=server_info">Server Info</a>
<a href="?p=server_info">Server Info</a>
<a href="?p=online">Online users</a>
<a href="?p=search">Search</a>
<a href="?p=message">Msg/Rep</a>
<a href="?p=ban">Ban</a>
<a href="?p=config">Config</a>
<a href="?p=config_editor">Config Editor</a>
<a href="#"></a><a href="#"></a><a href="#"></a>
<a href="?action=logout">Logout</a>
<?php }?>
</td>
</tr>
</table></div>
<div id="lmid1">
<div id="lmid3">
<?php
if($funct->CheckLogin()){
if($_POST or $_GET){
if($_GET['p'] and $_GET['p']!="search"){
$filename = '../Templates/Admin/'.$_GET['p'].'.tpl';
if(file_exists($filename)){
include($filename);
}else{
include('../Templates/Admin/404.tpl');
}
<a href="?p=search">Search</a>
<a href="?p=message">Msg/Rep</a>
<a href="?p=ban">Ban</a>
<a href="?p=config">Config</a>
<a href="?p=config_editor">Config Editor</a>
<a href="#"></a><a href="#"></a><a href="#"></a>
<a href="?action=logout">Logout</a>
<?php }?>
</td>
</tr>
</table></div>
<div id="lmid1">
<div id="lmid3">
<?php
if($funct->CheckLogin()){
if($_POST or $_GET){
if($_GET['p'] and $_GET['p']!="search"){
$filename = '../Templates/Admin/'.$_GET['p'].'.tpl';
if(file_exists($filename)){
include($filename);
}else{
include('../Templates/Admin/404.tpl');
}
}else{
include('../Templates/Admin/search.tpl');
}
}
if($_POST['p'] and $_POST['s']){
$filename = '../Templates/Admin/results_'.$_POST['p'].'.tpl';
if(file_exists($filename)){
if(file_exists($filename)){
include($filename);
}else{
include('../Templates/Admin/404.tpl');
include('../Templates/Admin/404.tpl');
}
}
}else{
+163 -163
View File
@@ -27,9 +27,9 @@ class adm_DB {
var $connection;
function adm_DB(){
global $database;
global $database;
$this->connection = mysql_connect(SQL_SERVER, SQL_USER, SQL_PASS) or die(mysql_error());
mysql_select_db(SQL_DB, $this->connection) or die(mysql_error());
mysql_select_db(SQL_DB, $this->connection) or die(mysql_error());
}
function Login($username,$password){
@@ -49,40 +49,40 @@ class adm_DB {
function recountPopUser($uid){
global $database;
$villages = $database->getProfileVillages($uid);
for ($i = 0; $i <= count($villages)-1; $i++) {
$vid = $villages[$i]['wref'];
$this->recountPop($vid);
}
for ($i = 0; $i <= count($villages)-1; $i++) {
$vid = $villages[$i]['wref'];
$this->recountPop($vid);
}
}
function recountPop($vid){
global $database;
$fdata = $database->getResourceLevel($vid);
$popTot = 0;
for ($i = 1; $i <= 40; $i++) {
$lvl = $fdata["f".$i];
$building = $fdata["f".$i."t"];
if($building){
$popTot += $this->buildingPOP($building,$lvl);
}
}
$q = "UPDATE ".TB_PREFIX."vdata set pop = $popTot where wref = $vid";
mysql_query($q, $this->connection);
global $database;
$fdata = $database->getResourceLevel($vid);
$popTot = 0;
for ($i = 1; $i <= 40; $i++) {
$lvl = $fdata["f".$i];
$building = $fdata["f".$i."t"];
if($building){
$popTot += $this->buildingPOP($building,$lvl);
}
}
$q = "UPDATE ".TB_PREFIX."vdata set pop = $popTot where wref = $vid";
mysql_query($q, $this->connection);
}
function buildingPOP($f,$lvl){
$name = "bid".$f;
global $$name;
$name = "bid".$f;
global $$name;
$popT = 0;
$dataarray = $$name;
for ($i = 0; $i <= $lvl; $i++) {
$popT += $dataarray[$i]['pop'];
}
return $popT;
$dataarray = $$name;
for ($i = 0; $i <= $lvl; $i++) {
$popT += $dataarray[$i]['pop'];
}
return $popT;
}
function getWref($x,$y) {
$q = "SELECT id FROM ".TB_PREFIX."wdata where x = $x and y = $y";
$q = "SELECT id FROM ".TB_PREFIX."wdata where x = $x and y = $y";
$result = mysql_query($q, $this->connection);
$r = mysql_fetch_array($result);
return $r['id'];
@@ -92,199 +92,199 @@ class adm_DB {
global $database;
$wid = $this->getWref($post['x'],$post['y']);
$uid = $post['uid'];
$status = $database->getVillageState($wid);
$status = 0;
if($status == 0){
$status = $database->getVillageState($wid);
$status = 0;
if($status == 0){
mysql_query("Insert into ".TB_PREFIX."admin_log values (0,".$_SESSION['id'].",'Added new village <b><a href=\'admin.php?p=village&did=$wid\'>$wid</a></b> to user <b><a href=\'admin.php?p=player&uid=$uid\'>$uid</a></b>',".time().")");
$database->setFieldTaken($wid);
$database->setFieldTaken($wid);
$database->addVillage($wid,$uid,'new village','0');
$database->addResourceFields($wid,$database->getVillageType($wid));
$database->addUnits($wid);
$database->addTech($wid);
$database->addABTech($wid);
}
$database->addABTech($wid);
}
}
function Punish($post){
global $database;
global $database;
$villages = $database->getProfileVillages($post['uid']);
$admid = $post['admid'];
$user = $database->getUserArray($post['uid'],1);
for ($i = 0; $i <= count($villages)-1; $i++) {
$vid = $villages[$i]['wref'];
if($post['punish']){
$popOld = $villages[$i]['pop'];
$proc = 100-$post['punish'];
$pop = floor(($popOld/100)*($proc));
if($pop <= 1 ){$pop = 2;}
$this->PunishBuilding($vid,$proc,$pop);
$user = $database->getUserArray($post['uid'],1);
for ($i = 0; $i <= count($villages)-1; $i++) {
$vid = $villages[$i]['wref'];
if($post['punish']){
$popOld = $villages[$i]['pop'];
$proc = 100-$post['punish'];
$pop = floor(($popOld/100)*($proc));
if($pop <= 1 ){$pop = 2;}
$this->PunishBuilding($vid,$proc,$pop);
}
if($post['del_troop']){
if($user['tribe'] == 1) {
$unit = 1;
}else if($user['tribe'] == 2) {
$unit = 11;
}else if($user['tribe'] == 3) {
$unit = 21;
}
$this->DelUnits($villages[$i]['wref'],$unit);
}
if($post['clean_ware']){
$time = time();
$q = "UPDATE ".TB_PREFIX."vdata SET `wood` = '0', `clay` = '0', `iron` = '0', `crop` = '0', `lastupdate` = '$time' WHERE wref = $vid;";
mysql_query($q, $this->connection);
}
}
}
if($post['del_troop']){
if($user['tribe'] == 1) {
$unit = 1;
}else if($user['tribe'] == 2) {
$unit = 11;
}else if($user['tribe'] == 3) {
$unit = 21;
}
$this->DelUnits($villages[$i]['wref'],$unit);
}
if($post['clean_ware']){
$time = time();
$q = "UPDATE ".TB_PREFIX."vdata SET `wood` = '0', `clay` = '0', `iron` = '0', `crop` = '0', `lastupdate` = '$time' WHERE wref = $vid;";
mysql_query($q, $this->connection);
}
}
mysql_query("Insert into ".TB_PREFIX."admin_log values (0,".$_SESSION['id'].",'Punished user: <a href=\'admin.php?p=player&uid=".$post['uid']."\'>".$post['uid']."</a> with <b>-".$post['punish']."%</b> population',".time().")");
}
function PunishBuilding($vid,$proc,$pop){
global $database;
$q = "UPDATE ".TB_PREFIX."vdata set pop = $pop where wref = $vid;";
mysql_query($q, $this->connection);
$fdata = $database->getResourceLevel($vid);
for ($i = 1; $i <= 40; $i++) {
if($fdata['f'.$i]>1){
$zm = ($fdata['f'.$i]/100)*$proc;
if($zm < 1){$zm = 1;}else{$zm = floor($zm);}
$q = "UPDATE ".TB_PREFIX."fdata SET `f$i` = '$zm' WHERE `vref` = $vid;";
mysql_query($q, $this->connection);
}
}
global $database;
$q = "UPDATE ".TB_PREFIX."vdata set pop = $pop where wref = $vid;";
mysql_query($q, $this->connection);
$fdata = $database->getResourceLevel($vid);
for ($i = 1; $i <= 40; $i++) {
if($fdata['f'.$i]>1){
$zm = ($fdata['f'.$i]/100)*$proc;
if($zm < 1){$zm = 1;}else{$zm = floor($zm);}
$q = "UPDATE ".TB_PREFIX."fdata SET `f$i` = '$zm' WHERE `vref` = $vid;";
mysql_query($q, $this->connection);
}
}
}
function DelUnits($vid,$unit){
for ($i = $unit; $i <= 9+$unit; $i++) {
$this->DelUnits2($vid,$unit);
}
for ($i = $unit; $i <= 9+$unit; $i++) {
$this->DelUnits2($vid,$unit);
}
}
function DelUnits2($vid,$unit){
$q = "UPDATE ".TB_PREFIX."units SET `u$unit` = '0' WHERE `vref` = $vid;";
mysql_query($q, $this->connection);
$q = "UPDATE ".TB_PREFIX."units SET `u$unit` = '0' WHERE `vref` = $vid;";
mysql_query($q, $this->connection);
}
function DelPlayer($uid,$pass){
global $database;
$ID = $_SESSION['id'];//$database->getUserField($_SESSION['username'],'id',1);
global $database;
$ID = $_SESSION['id'];//$database->getUserField($_SESSION['username'],'id',1);
if($this->CheckPass($pass,$ID)){
$villages = $database->getProfileVillages($uid);
for ($i = 0; $i <= count($villages)-1; $i++) {
$this->DelVillage($villages[$i]['wref']);
}
$villages = $database->getProfileVillages($uid);
for ($i = 0; $i <= count($villages)-1; $i++) {
$this->DelVillage($villages[$i]['wref']);
}
$name = $database->getUserField($uid,"username",0);
mysql_query("Insert into ".TB_PREFIX."admin_log values (0,$ID,'Deleted user <a>$name</a>',".time().")");
$q = "DELETE FROM ".TB_PREFIX."users WHERE `id` = $uid;";
mysql_query($q, $this->connection);
}
}
function getUserActive() {
$time = time() - (60*5);
$q = "SELECT * FROM ".TB_PREFIX."users where timestamp > $time and username != 'support'";
$result = mysql_query($q, $this->connection);
return $this->mysql_fetch_all($result);
$q = "DELETE FROM ".TB_PREFIX."users WHERE `id` = $uid;";
mysql_query($q, $this->connection);
}
function CheckPass($password,$uid){
$q = "SELECT password FROM ".TB_PREFIX."users where id = '$uid' and access = ".ADMIN;
}
function getUserActive() {
$time = time() - (60*5);
$q = "SELECT * FROM ".TB_PREFIX."users where timestamp > $time and username != 'support'";
$result = mysql_query($q, $this->connection);
return $this->mysql_fetch_all($result);
}
function CheckPass($password,$uid){
$q = "SELECT password FROM ".TB_PREFIX."users where id = '$uid' and access = ".ADMIN;
$result = mysql_query($q, $this->connection);
$dbarray = mysql_fetch_array($result);
if($dbarray['password'] == md5($password)) {
if($dbarray['password'] == md5($password)) {
return true;
}else{
return false;
}
}else{
return false;
}
}
function DelVillage($wref){
$q = "SELECT * FROM ".TB_PREFIX."vdata WHERE `wref` = $wref and capital = 0";
$result = mysql_query($q, $this->connection);
if(mysql_num_rows($result) > 0){
$result = mysql_query($q, $this->connection);
if(mysql_num_rows($result) > 0){
mysql_query("Insert into ".TB_PREFIX."admin_log values (0,".$_SESSION['id'].",'Deleted village <b>$wref</b>',".time().")");
$q = "DELETE FROM ".TB_PREFIX."vdata WHERE `wref` = $wref";
$q = "DELETE FROM ".TB_PREFIX."vdata WHERE `wref` = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."units WHERE `vref` = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."bdata WHERE `wid` = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."abdata WHERE `wid` = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."fdata WHERE `vref` = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."training WHERE `vref` = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."movement WHERE `from` = $wref";
mysql_query($q, $this->connection);
$q = "UPDATE ".TB_PREFIX."wdata SET `occupied` = '0' WHERE `id` = $wref";
mysql_query($q, $this->connection);
}
$q = "DELETE FROM ".TB_PREFIX."units WHERE `vref` = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."bdata WHERE `wid` = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."abdata WHERE `wid` = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."fdata WHERE `vref` = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."training WHERE `vref` = $wref";
mysql_query($q, $this->connection);
$q = "DELETE FROM ".TB_PREFIX."movement WHERE `from` = $wref";
mysql_query($q, $this->connection);
$q = "UPDATE ".TB_PREFIX."wdata SET `occupied` = '0' WHERE `id` = $wref";
mysql_query($q, $this->connection);
}
}
function DelBan($uid,$id){
global $database;
$name = $database->getUserField($uid,"username",0);
mysql_query("Insert into ".TB_PREFIX."admin_log values (0,".$_SESSION['id'].",'Unbanned user <a href=\'admin.php?p=player&uid=$uid\'>$name</a>',".time().")");
$q = "UPDATE ".TB_PREFIX."users SET `access` = '".USER."' WHERE `id` = $uid;";
mysql_query($q, $this->connection);
$q = "UPDATE ".TB_PREFIX."banlist SET `active` = '0' WHERE `id` = $id;";
mysql_query($q, $this->connection);
$q = "UPDATE ".TB_PREFIX."users SET `access` = '".USER."' WHERE `id` = $uid;";
mysql_query($q, $this->connection);
$q = "UPDATE ".TB_PREFIX."banlist SET `active` = '0' WHERE `id` = $id;";
mysql_query($q, $this->connection);
}
function AddBan($uid,$end,$reason){
global $database;
global $database;
$name = $database->getUserField($uid,"username",0);
mysql_query("Insert into ".TB_PREFIX."admin_log values (0,".$_SESSION['id'].",'Banned user <a href=\'admin.php?p=player&uid=$uid\'>$name</a>',".time().")");
$q = "UPDATE ".TB_PREFIX."users SET `access` = '0' WHERE `id` = $uid;";
mysql_query($q, $this->connection);
$time = time();
$admin = $_SESSION['id']; //$database->getUserField($_SESSION['username'],'id',1);
$name = $database->getUserField($uid,'username',0);
$q = "INSERT INTO ".TB_PREFIX."banlist (`uid`, `name`, `reason`, `time`, `end`, `admin`, `active`) VALUES ($uid, '$name' , '$reason', '$time', '$end', '$admin', '1');";
mysql_query($q, $this->connection);
$q = "UPDATE ".TB_PREFIX."users SET `access` = '0' WHERE `id` = $uid;";
mysql_query($q, $this->connection);
$time = time();
$admin = $_SESSION['id']; //$database->getUserField($_SESSION['username'],'id',1);
$name = $database->getUserField($uid,'username',0);
$q = "INSERT INTO ".TB_PREFIX."banlist (`uid`, `name`, `reason`, `time`, `end`, `admin`, `active`) VALUES ($uid, '$name' , '$reason', '$time', '$end', '$admin', '1');";
mysql_query($q, $this->connection);
}
function search_player($player){
$q = "SELECT id,username FROM ".TB_PREFIX."users WHERE `username` LIKE '%$player%' and username != 'support'";
$result = mysql_query($q, $this->connection);
return $this->mysql_fetch_all($result);
}
$q = "SELECT id,username FROM ".TB_PREFIX."users WHERE `username` LIKE '%$player%' and username != 'support'";
$result = mysql_query($q, $this->connection);
return $this->mysql_fetch_all($result);
}
function search_email($email){
$q = "SELECT id,email FROM ".TB_PREFIX."users WHERE `email` LIKE '%$email%' and username != 'support'";
$result = mysql_query($q, $this->connection);
return $this->mysql_fetch_all($result);
$q = "SELECT id,email FROM ".TB_PREFIX."users WHERE `email` LIKE '%$email%' and username != 'support'";
$result = mysql_query($q, $this->connection);
return $this->mysql_fetch_all($result);
}
function search_village($village){
$q = "SELECT * FROM ".TB_PREFIX."vdata WHERE `name` LIKE '%$village%' or `wref` LIKE '%$village%'";
$result = mysql_query($q, $this->connection);
return $this->mysql_fetch_all($result);
$q = "SELECT * FROM ".TB_PREFIX."vdata WHERE `name` LIKE '%$village%' or `wref` LIKE '%$village%'";
$result = mysql_query($q, $this->connection);
return $this->mysql_fetch_all($result);
}
function search_alliance($alliance){
$q = "SELECT * FROM ".TB_PREFIX."alidata WHERE `name` LIKE '%$alliance%' or `tag` LIKE '%$alliance%' or `id` LIKE '%$alliance%'";
$result = mysql_query($q, $this->connection);
return $this->mysql_fetch_all($result);
$q = "SELECT * FROM ".TB_PREFIX."alidata WHERE `name` LIKE '%$alliance%' or `tag` LIKE '%$alliance%' or `id` LIKE '%$alliance%'";
$result = mysql_query($q, $this->connection);
return $this->mysql_fetch_all($result);
}
function search_ip($ip){
$q = "SELECT * FROM ".TB_PREFIX."login_log WHERE `ip` LIKE '%$ip%'";
$result = mysql_query($q, $this->connection);
return $this->mysql_fetch_all($result);
$q = "SELECT * FROM ".TB_PREFIX."login_log WHERE `ip` LIKE '%$ip%'";
$result = mysql_query($q, $this->connection);
return $this->mysql_fetch_all($result);
}
function search_banned(){
$q = "SELECT * FROM ".TB_PREFIX."banlist where active = '1'";
$result = mysql_query($q, $this->connection);
return $this->mysql_fetch_all($result);
$q = "SELECT * FROM ".TB_PREFIX."banlist where active = '1'";
$result = mysql_query($q, $this->connection);
return $this->mysql_fetch_all($result);
}
function Del_banned(){
//$q = "SELECT * FROM ".TB_PREFIX."banlist";
$result = mysql_query($q, $this->connection);
return $this->mysql_fetch_all($result);
//$q = "SELECT * FROM ".TB_PREFIX."banlist";
$result = mysql_query($q, $this->connection);
return $this->mysql_fetch_all($result);
}
/***************************
@@ -316,5 +316,5 @@ class adm_DB {
};
$admin = new adm_DB;
include("function.php");
include("function.php");
?>
+88 -88
View File
@@ -9,97 +9,97 @@
## ##
#################################################################################
class funct {
function CheckLogin(){
if($_SESSION['access'] >= MULTIHUNTER and $_SESSION['id']){
return true;
}else{
return false;
}
}
function Act($get){
global $admin,$database;
class funct {
switch($get['action']){
case recountPop:
$admin->recountPop($get['did']);
break;
case recountPopUsr:
$admin->recountPopUser($get['uid']);
break;
case StopDel:
//stop deleting
break;
case delVil:
$admin->DelVillage($get['did']);
break;
case delBan:
$admin->DelBan($get['uid'],$get['id']);
//remove ban
break;
case addBan:
if($get['time']){$end = time()+$get['time']; }else{$end = '';}
if(preg_match("/^[0-9]+$/",$get['uid'])){
//if(eregi("^[0-9]*+$",$get['uid'])){
$get['uid'] = $get['uid'];
}else{
$get['uid'] = $database->getUserField($get['uid'],'id',1);
}
$admin->AddBan($get['uid'],$end,$get['reason']);
//add ban
break;
case delOas:
//oaza
break;
case logout:
$this->LogOut();
break;
}
if($get['action'] == 'logout'){
header("Location: admin.php");
}else{
header("Location: ".$_SERVER['HTTP_REFERER']);
}
function CheckLogin(){
if($_SESSION['access'] >= MULTIHUNTER and $_SESSION['id']){
return true;
}else{
return false;
}
}
function Act($get){
global $admin,$database;
switch($get['action']){
case recountPop:
$admin->recountPop($get['did']);
break;
case recountPopUsr:
$admin->recountPopUser($get['uid']);
break;
case StopDel:
//stop deleting
break;
case delVil:
$admin->DelVillage($get['did']);
break;
case delBan:
$admin->DelBan($get['uid'],$get['id']);
//remove ban
break;
case addBan:
if($get['time']){$end = time()+$get['time']; }else{$end = '';}
if(preg_match("/^[0-9]+$/",$get['uid'])){
//if(eregi("^[0-9]*+$",$get['uid'])){
$get['uid'] = $get['uid'];
}else{
$get['uid'] = $database->getUserField($get['uid'],'id',1);
}
$admin->AddBan($get['uid'],$end,$get['reason']);
//add ban
break;
case delOas:
//oaza
break;
case logout:
$this->LogOut();
break;
}
if($get['action'] == 'logout'){
header("Location: admin.php");
}else{
header("Location: ".$_SERVER['HTTP_REFERER']);
}
}
function Act2($post){
global $admin,$database;
switch($post['action']){
case DelPlayer:
$admin->DelPlayer($post['uid'],$post['pass']);
header("Location: ?p=search&msg=ursdel");
break;
case punish:
$admin->Punish($post);
header("Location: ".$_SERVER['HTTP_REFERER']);
break;
case addVillage:
$admin->AddVillage($post);
header("Location: ".$_SERVER['HTTP_REFERER']);
break;
}
global $admin,$database;
switch($post['action']){
case DelPlayer:
$admin->DelPlayer($post['uid'],$post['pass']);
header("Location: ?p=search&msg=ursdel");
break;
case punish:
$admin->Punish($post);
header("Location: ".$_SERVER['HTTP_REFERER']);
break;
case addVillage:
$admin->AddVillage($post);
header("Location: ".$_SERVER['HTTP_REFERER']);
break;
}
}
function LogIN($username,$password){
global $admin,$database;
if($admin->Login($username,$password)){
//$_SESSION['username'] = $username;
$_SESSION['access'] = $database->getUserField($username,'access',1);
$_SESSION['id'] = $database->getUserField($username,'id',1);
header("Location: ".$_SERVER['HTTP_REFERER']);
//header("Location: admin.php");
}else{
echo "Error";
}
global $admin,$database;
if($admin->Login($username,$password)){
//$_SESSION['username'] = $username;
$_SESSION['access'] = $database->getUserField($username,'access',1);
$_SESSION['id'] = $database->getUserField($username,'id',1);
header("Location: ".$_SERVER['HTTP_REFERER']);
//header("Location: admin.php");
}else{
echo "Error";
}
}
function LogOut(){
$_SESSION['access'] = '';
$_SESSION['id'] = '';
function LogOut(){
$_SESSION['access'] = '';
$_SESSION['id'] = '';
}
public function procResType($ref) {
@@ -150,16 +150,16 @@ class funct {
}
return $build;
}
};
$funct = new funct;
if($funct->CheckLogin()){
if($_GET['action']){
$funct->Act($_GET);
$funct->Act($_GET);
}
if($_POST['action']){
$funct->Act2($_POST);
$funct->Act2($_POST);
}
}
if($_POST['action']=='login'){
+1 -1
View File
@@ -1,6 +1,6 @@
Hello %USER%,
Thank you for registering on our server.
Since the %START% at %TIME% Romans, Gauls and Teutons attack each other on this game world. Right now, %PLAYERS% players in %ALLI% Alliances are fighting for supremacy.
Since the %START% at %TIME% Romans, Gauls and Teutons attack each other on this game world. Right now, %PLAYERS% players in %ALLI% Alliances are fighting for supremacy.
Regards, %SERVER_NAME%
+350 -350
View File
@@ -3,361 +3,361 @@
/*
|--------------------------------------------------------------------------
| PLEASE DO NOT REMOVE THIS COPYRIGHT NOTICE!
|--------------------------------------------------------------------------
|--------------------------------------------------------------------------
|
| Project owner: Dzoki < dzoki.travian@gmail.com >
|
|
| This script is property of TravianX Project. You are allowed to change
| its source and release it under own name, not under name `TravianX`.
| its source and release it under own name, not under name `TravianX`.
| You have no rights to remove copyright notices.
|
| TravianX All rights reserved
|
*/
class Alliance {
class Alliance {
public $gotInvite = false;
public $inviteArray = array();
public $allianceArray = array();
public $userPermArray = array();
public $gotInvite = false;
public $inviteArray = array();
public $allianceArray = array();
public $userPermArray = array();
public function procAlliance($get) {
global $session, $database;
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 ? false : true;
}
if(isset($get['a'])) {
switch($get['a']) {
case 2:
$this->rejectInvite($get);
break;
case 3:
$this->acceptInvite($get);
break;
default:
break;
}
}
if(isset($get['o'])) {
switch($get['o']) {
case 4:
$this->delInvite($get);
break;
default:
break;
}
}
}
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 ? false : true;
}
if(isset($get['a'])) {
switch($get['a']) {
case 2:
$this->rejectInvite($get);
break;
case 3:
$this->acceptInvite($get);
break;
default:
break;
}
}
if(isset($get['o'])) {
switch($get['o']) {
case 4:
$this->delInvite($get);
break;
default:
break;
}
}
}
public function procAlliForm($post) {
if(isset($post['ft'])) {
switch($post['ft']) {
case "ali1":
$this->createAlliance($post);
break;
}
public function procAlliForm($post) {
if(isset($post['ft'])) {
switch($post['ft']) {
case "ali1":
$this->createAlliance($post);
break;
}
}
if(isset($_POST['dipl']) and isset($_POST['a_name'])) {
$this->changediplomacy($post);
}
}
if(isset($_POST['dipl']) and 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;
}
}
}
}
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;
// ¿El campo posee informacion?
if(!isset($post['a_name']) || $post['a_name'] == "") {
$form->addError("name1", NAME_EMPTY);
}
// ¿Existe el usuario?
if(!$database->checkExist($post['a_name'], 0)) {
$form->addError("name2", NAME_NO_EXIST);
}
// ¿La invitacion es a si mismo?
if($post['a_name'] == ($session->username)) {
$form->addError("name3", SAME_NAME);
}
// ¿Esta ya invitado a la alianza?
$UserData = $database->getUserArray($post['a_name'], 0);
if($database->getInvitation($UserData['id'])) {
$form->addError("name4", OLRADY_INVITED);
}
// ¿Esta ya en la alianza?
$UserData = $database->getUserArray($post['a_name'], 0);
if($UserData['alliance'] == $session->alliance) {
$form->addError("name5", OLRADY_IN_ALLY);
}
// ¿La invitación la envia un autorizado?
if($this->userPermArray['opt4'] == 0) {
$form->addError("perm", NO_PERMISSION);
}
if($form->returnErrors() != 0) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $post;
print_r($form->getErrors());
} 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 . '">' . $session->username . '</a> has invited <a href="spieler.php?uid=' . $UserData['id'] . '">' . $UserData['username'] . '</a> into the alliance.');
}
}
/*****************************************
Function to reject an invitation
*****************************************/
private function rejectInvite($get) {
global $database, $session;
foreach($this->inviteArray as $invite) {
if($invite['id'] == $get['d']) {
$database->removeInvitation($get['d']);
$database->insertAlliNotice($invite['alliance'], '<a href="spieler.php?uid=' . $session->uid . '">' . $session->username . '</a> has rejected the invitation.');
}
}
header("Location: build.php?id=".$get['id']);
}
/*****************************************
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']) {
$invitename = $database->getUserArray($invite['uid'], 1);
$database->removeInvitation($get['d']);
$database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid=' . $session->uid . '">' . $session->username . '</a> has deleted the invitation for <a href="spieler.php?uid=' . $invitename['id'] . '">' . $invitename['username'] . '</a>.');
}
}
}
/*****************************************
Function to accept an invitation
*****************************************/
private function acceptInvite($get) {
global $database, $session;
foreach($this->inviteArray as $invite) {
if($invite['id'] == $get['d']) {
$database->removeInvitation($database->RemoveXSS($get['d']));
$database->updateUserField($database->RemoveXSS($invite['uid']), "alliance", $database->RemoveXSS($invite['alliance']), 1);
$database->createAlliPermissions($database->RemoveXSS($invite['uid']), $database->RemoveXSS($invite['alliance']), '', '0', '0', '0', '0', '0', '0', '0', '0');
// Log the notice
$database->insertAlliNotice($invite['alliance'], '<a href="spieler.php?uid=' . $session->uid . '">' . $session->username . '</a> has joined the alliance.');
}
}
header("Location: build.php?id=" . $get['id']);
}
/*****************************************
Function to create an alliance
*****************************************/
private function createAlliance($post) {
global $form, $database, $session, $bid18, $village;
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($form->returnErrors() != 0) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $post;
header("Location: build.php?id=" . $post['id']);
} else {
$max = $bid18[$village->resarray['f' . $post['id']]]['attri'];
$aid = $database->createAlliance($database->RemoveXSS($post['ally1']), $database->RemoveXSS($post['ally2']), $session->uid, $max);
$database->updateUserField($database->RemoveXSS($session->uid), "alliance", $database->RemoveXSS($aid), 1);
// Asign Permissions
$database->createAlliPermissions($database->RemoveXSS($session->uid), $database->RemoveXSS($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 . '">' . $session->username . '</a>.');
header("Location: build.php?id=" . $post['id']);
}
}
/*****************************************
Function to change the alliance name
*****************************************/
private function changeAliName($get) {
global $form, $database, $session;
if(!isset($get['ally1']) || $get['ally1'] == "") {
$form->addError("ally1", ATAG_EMPTY);
}
if(!isset($get['ally2']) || $get['ally2'] == "") {
$form->addError("ally2", ANAME_EMPTY);
}
if($database->aExist($get['ally1'], "tag")) {
$form->addError("tag", ATAG_EXIST);
}
if($database->aExist($get['ally2'], "name")) {
$form->addError("name", ANAME_EXIST);
}
if($this->userPermArray['opt3'] == 0) {
$form->addError("perm", NO_PERMISSION);
}
if($form->returnErrors() != 0) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $post;
//header("Location: build.php?id=".$post['id']);
} else {
$database->setAlliName($database->RemoveXSS($session->alliance), $database->RemoveXSS($get['ally2']), $database->RemoveXSS($get['ally1']));
// log the notice
$database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid=' . $session->uid . '">' . $session->username . '</a> has changed the alliance name.');
}
}
/*****************************************
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;
//header("Location: build.php?id=".$post['id']);
} else {
$database->submitAlliProfile($database->RemoveXSS($session->alliance), $database->RemoveXSS($post['be2']), $database->RemoveXSS($post['be1']));
// log the notice
$database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid=' . $session->uid . '">' . $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);
}
if($form->returnErrors() != 0) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $post;
//header("Location: build.php?id=".$post['id']);
} 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 . '">' . $session->username . '</a> has changed permissions.');
}
}
/*****************************************
Function to kick a user from alliance
*****************************************/
private function kickAlliUser($post) {
global $database, $session, $form;
if($this->userPermArray['opt2'] == 0) {
$form->addError("perm", NO_PERMISSION);
}
if($form->returnErrors() != 0) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $post;
//header("Location: build.php?id=".$post['id']);
} else {
$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=' . $session->uid . '">' . $session->username . '</a> kicked <a href="spieler.php?uid=' . $post['a_user'] . '">' . $UserData['username'] . '</a>.');
//header("Location: build.php?id=".$post['id']);
}
}
/*****************************************
Function to set forum link
*****************************************/
public function setForumLink($post) {
global $database, $session;
if(isset($post['f_link'])){
$database->setAlliForumLink($session->alliance, $post['f_link']);
Function to process of sending invitations
*****************************************/
public function sendInvite($post) {
global $form, $database, $session;
// ¿El campo posee informacion?
if(!isset($post['a_name']) || $post['a_name'] == "") {
$form->addError("name1", NAME_EMPTY);
}
// ¿Existe el usuario?
if(!$database->checkExist($post['a_name'], 0)) {
$form->addError("name2", NAME_NO_EXIST);
}
// ¿La invitacion es a si mismo?
if($post['a_name'] == ($session->username)) {
$form->addError("name3", SAME_NAME);
}
// ¿Esta ya invitado a la alianza?
$UserData = $database->getUserArray($post['a_name'], 0);
if($database->getInvitation($UserData['id'])) {
$form->addError("name4", OLRADY_INVITED);
}
// ¿Esta ya en la alianza?
$UserData = $database->getUserArray($post['a_name'], 0);
if($UserData['alliance'] == $session->alliance) {
$form->addError("name5", OLRADY_IN_ALLY);
}
// ¿La invitación la envia un autorizado?
if($this->userPermArray['opt4'] == 0) {
$form->addError("perm", NO_PERMISSION);
}
if($form->returnErrors() != 0) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $post;
print_r($form->getErrors());
} 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 . '">' . $session->username . '</a> has invited <a href="spieler.php?uid=' . $UserData['id'] . '">' . $UserData['username'] . '</a> into the alliance.');
}
}
/*****************************************
Function to reject an invitation
*****************************************/
private function rejectInvite($get) {
global $database, $session;
foreach($this->inviteArray as $invite) {
if($invite['id'] == $get['d']) {
$database->removeInvitation($get['d']);
$database->insertAlliNotice($invite['alliance'], '<a href="spieler.php?uid=' . $session->uid . '">' . $session->username . '</a> has rejected the invitation.');
}
}
header("Location: build.php?id=".$get['id']);
}
/*****************************************
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']) {
$invitename = $database->getUserArray($invite['uid'], 1);
$database->removeInvitation($get['d']);
$database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid=' . $session->uid . '">' . $session->username . '</a> has deleted the invitation for <a href="spieler.php?uid=' . $invitename['id'] . '">' . $invitename['username'] . '</a>.');
}
}
}
/*****************************************
Function to accept an invitation
*****************************************/
private function acceptInvite($get) {
global $database, $session;
foreach($this->inviteArray as $invite) {
if($invite['id'] == $get['d']) {
$database->removeInvitation($database->RemoveXSS($get['d']));
$database->updateUserField($database->RemoveXSS($invite['uid']), "alliance", $database->RemoveXSS($invite['alliance']), 1);
$database->createAlliPermissions($database->RemoveXSS($invite['uid']), $database->RemoveXSS($invite['alliance']), '', '0', '0', '0', '0', '0', '0', '0', '0');
// Log the notice
$database->insertAlliNotice($invite['alliance'], '<a href="spieler.php?uid=' . $session->uid . '">' . $session->username . '</a> has joined the alliance.');
}
}
header("Location: build.php?id=" . $get['id']);
}
/*****************************************
Function to create an alliance
*****************************************/
private function createAlliance($post) {
global $form, $database, $session, $bid18, $village;
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($form->returnErrors() != 0) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $post;
header("Location: build.php?id=" . $post['id']);
} else {
$max = $bid18[$village->resarray['f' . $post['id']]]['attri'];
$aid = $database->createAlliance($database->RemoveXSS($post['ally1']), $database->RemoveXSS($post['ally2']), $session->uid, $max);
$database->updateUserField($database->RemoveXSS($session->uid), "alliance", $database->RemoveXSS($aid), 1);
// Asign Permissions
$database->createAlliPermissions($database->RemoveXSS($session->uid), $database->RemoveXSS($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 . '">' . $session->username . '</a>.');
header("Location: build.php?id=" . $post['id']);
}
}
/*****************************************
Function to change the alliance name
*****************************************/
private function changeAliName($get) {
global $form, $database, $session;
if(!isset($get['ally1']) || $get['ally1'] == "") {
$form->addError("ally1", ATAG_EMPTY);
}
if(!isset($get['ally2']) || $get['ally2'] == "") {
$form->addError("ally2", ANAME_EMPTY);
}
if($database->aExist($get['ally1'], "tag")) {
$form->addError("tag", ATAG_EXIST);
}
if($database->aExist($get['ally2'], "name")) {
$form->addError("name", ANAME_EXIST);
}
if($this->userPermArray['opt3'] == 0) {
$form->addError("perm", NO_PERMISSION);
}
if($form->returnErrors() != 0) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $post;
//header("Location: build.php?id=".$post['id']);
} else {
$database->setAlliName($database->RemoveXSS($session->alliance), $database->RemoveXSS($get['ally2']), $database->RemoveXSS($get['ally1']));
// log the notice
$database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid=' . $session->uid . '">' . $session->username . '</a> has changed the alliance name.');
}
}
/*****************************************
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;
//header("Location: build.php?id=".$post['id']);
} else {
$database->submitAlliProfile($database->RemoveXSS($session->alliance), $database->RemoveXSS($post['be2']), $database->RemoveXSS($post['be1']));
// log the notice
$database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid=' . $session->uid . '">' . $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);
}
if($form->returnErrors() != 0) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $post;
//header("Location: build.php?id=".$post['id']);
} 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 . '">' . $session->username . '</a> has changed permissions.');
}
}
/*****************************************
Function to kick a user from alliance
*****************************************/
private function kickAlliUser($post) {
global $database, $session, $form;
if($this->userPermArray['opt2'] == 0) {
$form->addError("perm", NO_PERMISSION);
}
if($form->returnErrors() != 0) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $post;
//header("Location: build.php?id=".$post['id']);
} else {
$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=' . $session->uid . '">' . $session->username . '</a> kicked <a href="spieler.php?uid=' . $post['a_user'] . '">' . $UserData['username'] . '</a>.');
//header("Location: build.php?id=".$post['id']);
}
}
/*****************************************
Function to set forum link
*****************************************/
public function setForumLink($post) {
global $database, $session;
if(isset($post['f_link'])){
$database->setAlliForumLink($session->alliance, $post['f_link']);
header("Location: allianz.php?s=5");
}
}
/*****************************************
Function to quit from alliance
*****************************************/
private function quitally($post) {
global $database, $session, $form;
if(!isset($post['pw']) || $post['pw'] == "") {
$form->addError("pw1", PW_EMPTY);
} elseif(md5($post['pw']) !== $session->userinfo['password']) {
$form->addError("pw2", PW_ERR);
} else {
$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 . '">' . $session->username . '</a> has quit the alliance.');
header("Location: spieler.php?uid=".$session->uid);
}
}
}
/*****************************************
Function to quit from alliance
*****************************************/
private function quitally($post) {
global $database, $session, $form;
if(!isset($post['pw']) || $post['pw'] == "") {
$form->addError("pw1", PW_EMPTY);
} elseif(md5($post['pw']) !== $session->userinfo['password']) {
$form->addError("pw2", PW_ERR);
} else {
$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 . '">' . $session->username . '</a> has quit the alliance.');
header("Location: spieler.php?uid=".$session->uid);
}
}
private function changediplomacy($post) {
global $database, $session, $form;
private function changediplomacy($post) {
global $database, $session, $form;
$aName = $database->RemoveXSS($_POST['a_name']);
$aType = (int)intval($_POST['dipl']);
if($database->aExist($aName, "tag")) {
if($database->getAllianceID($aName) != $session->alliance) {
if($aType >= 1 and $aType <= 3) {
if(!$database->diplomacyInviteCheck($database->getAllianceID($aName), $session->alliance)) {
$database->diplomacyInviteAdd($session->alliance, $database->getAllianceID($aName), $aType);
$aName = $database->RemoveXSS($_POST['a_name']);
$aType = (int)intval($_POST['dipl']);
if($database->aExist($aName, "tag")) {
if($database->getAllianceID($aName) != $session->alliance) {
if($aType >= 1 and $aType <= 3) {
if(!$database->diplomacyInviteCheck($database->getAllianceID($aName), $session->alliance)) {
$database->diplomacyInviteAdd($session->alliance, $database->getAllianceID($aName), $aType);
if($aType == 1){
$notice = "offer a confederation to";
}else if($aType == 2){
@@ -366,23 +366,23 @@
$notice = "declare war on";
}
$database->insertAlliNotice($session->alliance, '<a href="allianz.php?aid=' . $session->alliance . '">' . $database->getAllianceName($session->alliance) . '</a> '. $notice .' <a href="allianz.php?aid=' . $database->getAllianceID($aName) . '">' . $aName . '</a>.');
$form->addError("name", "Invite sended");
} else {
$form->addError("name", "You have already sended them a invite");
}
$form->addError("name", "Invite sended");
} else {
$form->addError("name", "You have already sended them a invite");
}
} else {
$form->addError("name", "wrong choice made");
}
} else {
$form->addError("name", "You can not invite your own alliance");
}
} else {
$form->addError("name", "Alliance does not exist");
}
}
}
} else {
$form->addError("name", "wrong choice made");
}
} else {
$form->addError("name", "You can not invite your own alliance");
}
} else {
$form->addError("name", "Alliance does not exist");
}
}
}
$alliance = new Alliance;
$alliance = new Alliance;
?>
+2892 -2892
View File
File diff suppressed because it is too large Load Diff
+857 -857
View File
File diff suppressed because it is too large Load Diff
+42 -42
View File
@@ -11,7 +11,7 @@
#################################################################################
class Building {
class Building {
public $NewBuilding = false;
private $maxConcurrent;
@@ -29,10 +29,10 @@ class Building {
$this->maxConcurrent += PLUS_MAX;
}
$this->LoadBuilding();
}
public function procBuild($get) {
public function procBuild($get) {
global $session;
if(isset($get['a']) && $get['c'] == $session->checker && !isset($get['id'])) {
if($get['a'] == 0) {
@@ -53,7 +53,7 @@ class Building {
}
}
}
public function canBuild($id,$tid) {
global $village,$session,$database;
$demolition = $database->getDemolition($village->wid);
@@ -112,7 +112,7 @@ class Building {
return 3;
}
}
else {
else {
return 2;
}
}
@@ -169,7 +169,7 @@ class Building {
}
return false;
}
public function rallying() {
foreach($this->buildArray as $job) {
if($job['type'] == 16) {
@@ -178,7 +178,7 @@ class Building {
}
return false;
}
public function procResType($ref) {
global $session;
switch($ref) {
@@ -228,7 +228,7 @@ class Building {
}
return $build;
}
private function loadBuilding() {
global $database,$village,$session;
$this->buildArray = $database->getJobs($village->wid);
@@ -255,7 +255,7 @@ class Building {
$this->NewBuilding = true;
}
}
private function removeBuilding($d) {
global $database,$village;
foreach($this->buildArray as $jobs) {
@@ -275,7 +275,7 @@ class Building {
}
}
}
private function upgradeBuilding($id) {
global $database,$village,$session,$logging;
if($this->allocated < $this->maxConcurrent) {
@@ -324,7 +324,7 @@ class Building {
}
}
}
private function downgradeBuilding($id) {
global $database,$village,$session,$logging;
if($this->allocated < $this->maxConcurrent) {
@@ -346,7 +346,7 @@ class Building {
$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);
@@ -357,11 +357,11 @@ class Building {
$logging->addBuildLog($village->wid,$this->procResType($village->resarray['f'.$id.'t']),($village->resarray['f'.$id]-1),2);
header("Location: dorf2.php");
}
}
}
}
private function constructBuilding($id,$tid) {
global $database,$village,$session,$logging;
if($this->allocated < $this->maxConcurrent) {
@@ -392,7 +392,7 @@ class Building {
}
}
}
private function meetRequirement($id) {
global $village,$session,$database;
switch($id) {
@@ -486,12 +486,12 @@ class Building {
case 37:
if($this->getTypeLevel(15) >= 3 && $this->getTypeLevel(16) >= 1) { return true; } else { return false; }
break;
case 38:
if($this->getTypeLevel(15) >= 10 && $village->capital == 0) { return true; } else { return false; }
break;
case 39:
if($this->getTypeLevel(15) >= 10 && $village->capital == 0) { return true; } else { return false; }
break;
case 38:
if($this->getTypeLevel(15) >= 10 && $village->capital == 0) { return true; } else { return false; }
break;
case 39:
if($this->getTypeLevel(15) >= 10 && $village->capital == 0) { return true; } else { return false; }
break;
case 40:
$wwlevel = $village->resarray['f'.$id];
if($wwlevel > 50){
@@ -506,7 +506,7 @@ class Building {
$wwbuildingplan += 1;
}
}
if($village->natar == 1 && $wwbuildingplan > $needed_plan) { return true; } else { return false; }
if($village->natar == 1 && $wwbuildingplan > $needed_plan) { return true; } else { return false; }
break;
case 41:
if($this->getTypeLevel(16) >= 10 && $this->getTypeLevel(20) == 20) { return true; } else { return false; }
@@ -516,7 +516,7 @@ class Building {
break;
}
}
private function checkResource($tid,$id) {
$name = "bid".$tid;
global $village,$$name,$database;
@@ -553,7 +553,7 @@ class Building {
}
}
}
public function isMax($id,$field,$loop=0) {
$name = "bid".$id;
global $$name,$village;
@@ -570,7 +570,7 @@ class Building {
return ($village->resarray['f'.$field] == count($dataarray) - $loop);
}
}
public function getTypeLevel($tid,$vid=0) {
global $village,$database;
$keyholder = array();
@@ -583,7 +583,7 @@ class Building {
if(strpos($key,'t')) {
$key = preg_replace("/[^0-9]/", '', $key);
array_push($keyholder, $key);
}
}
}
$element = count($keyholder);
if($element >= 2) {
@@ -593,8 +593,8 @@ class Building {
array_push($temparray,$resourcearray['f'.$keyholder[$i]]);
}
foreach ($temparray as $key => $val) {
if ($val == max($temparray))
$target = $key;
if ($val == max($temparray))
$target = $key;
}
}
else {
@@ -619,8 +619,8 @@ class Building {
return 0;
}
}
public function isCurrent($id) {
foreach($this->buildArray as $build) {
if($build['field'] == $id && $build['loopcon'] <> 1) {
@@ -628,7 +628,7 @@ class Building {
}
}
}
public function isLoop($id=0) {
foreach($this->buildArray as $build) {
if(($build['field'] == $id && $build['loopcon']) || ($build['loopcon'] == 1 && $id == 0)) {
@@ -637,10 +637,10 @@ class Building {
}
return false;
}
public function finishAll() {
global $database,$session,$logging,$village,$bid18,$bid10,$bid11,$technology,$_SESSION;
if($session->access!=BANNED){
if($session->access!=BANNED){
foreach($this->buildArray as $jobs) {
if($jobs['wid']==$village->wid){
$wwvillage = $database->getResourceLevel($jobs['wid']);
@@ -651,7 +651,7 @@ class Building {
$resource = $this->resourceRequired($jobs['field'],$jobs['type']);
if($jobs['master'] == 0){
$q = "UPDATE ".TB_PREFIX."fdata set f".$jobs['field']." = ".$jobs['level'].", f".$jobs['field']."t = ".$jobs['type']." where vref = ".$jobs['wid'];
}else{
}else{
$villwood = $database->getVillageField($jobs['wid'],'wood');
$villclay = $database->getVillageField($jobs['wid'],'clay');
$villiron = $database->getVillageField($jobs['wid'],'iron');
@@ -676,7 +676,7 @@ class Building {
$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']; }
}
@@ -699,7 +699,7 @@ class Building {
header("Location: banned.php");
}
}
public function resourceRequired($id,$tid,$plus=1) {
$name = "bid".$tid;
global $$name,$village,$bid15;
@@ -728,7 +728,7 @@ class Building {
$cp = $dataarray[$village->resarray['f'.$id]+$plus]['cp'];
return array("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++) {
@@ -737,7 +737,7 @@ class Building {
}
}
}
public function calculateAvaliable($id,$tid,$plus=1) {
global $village,$generator;
$uprequire = $this->resourceRequired($id,$tid,$plus);
@@ -755,4 +755,4 @@ class Building {
}
};
?>
?>
+71 -71
View File
@@ -1,4 +1,4 @@
<?php
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
@@ -11,13 +11,13 @@
if (!isset($SAJAX_INCLUDED)) {
$GLOBALS['sajax_version'] = '0.12';
$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() {
}
@@ -26,29 +26,29 @@ if (!isset($SAJAX_INCLUDED)) {
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))
if (is_numeric($k))
$s .= "$k: " . sajax_get_js_repr($v) . ", ";
else
$s .= "\"$esc_key\": " . sajax_get_js_repr($v) . ", ";
@@ -56,7 +56,7 @@ if (!isset($SAJAX_INCLUDED)) {
if (count($value))
$s = substr($s, 0, -2);
return $s . " }";
}
}
else {
$esc_val = sajax_esc($value);
$s = "'$esc_val'";
@@ -66,36 +66,36 @@ if (!isset($SAJAX_INCLUDED)) {
function sajax_handle_client_request() {
global $sajax_export_list;
$mode = "";
if (! empty($_GET["rs"]))
if (! empty($_GET["rs"]))
$mode = "get";
if (!empty($_POST["rs"]))
$mode = "post";
if (empty($mode))
if (empty($mode))
return;
$target = "";
if ($mode == "get") {
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
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");
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");
$func_name = $_GET["rs"];
if (! empty($_GET["rsargs"]))
if (! empty($_GET["rsargs"]))
$args = $_GET["rsargs"];
else
$args = array();
}
else {
$func_name = $_POST["rs"];
if (! empty($_POST["rsargs"]))
if (! empty($_POST["rsargs"]))
$args = $_POST["rsargs"];
else
$args = array();
@@ -110,20 +110,20 @@ if (!isset($SAJAX_INCLUDED)) {
}
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")
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
@@ -131,18 +131,18 @@ if (!isset($SAJAX_INCLUDED)) {
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(
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',
@@ -155,21 +155,21 @@ if (!isset($SAJAX_INCLUDED)) {
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++)
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;
@@ -178,36 +178,36 @@ if (!isset($SAJAX_INCLUDED)) {
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 == "")
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)
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++)
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 != "") {
@@ -220,20 +220,20 @@ if (!isset($SAJAX_INCLUDED)) {
} 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)
if (x.readyState != 4)
return;
sajax_debug("received " + x.responseText);
var status;
var data;
var txt = x.responseText.replace(/^\s*|\s*$/g,"");
@@ -242,10 +242,10 @@ if (!isset($SAJAX_INCLUDED)) {
if (status == "") {
// let's just assume this is a pre-response bailout and let it slide for now
} else if (status == "-")
} else if (status == "-")
alert("Error: " + data);
else {
if (target_id != "")
if (target_id != "")
document.getElementById(target_id).innerHTML = eval(data);
else {
try {
@@ -265,24 +265,24 @@ if (!isset($SAJAX_INCLUDED)) {
}
}
}
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)
{
@@ -294,41 +294,41 @@ if (!isset($SAJAX_INCLUDED)) {
}
function sajax_get_one_stub($func_name) {
ob_start();
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();
@@ -339,13 +339,13 @@ if (!isset($SAJAX_INCLUDED)) {
}
return $html;
}
function sajax_show_javascript()
{
echo sajax_get_javascript();
}
$SAJAX_INCLUDED = 1;
}
@@ -356,7 +356,7 @@ if (!isset($SAJAX_INCLUDED)) {
if (is_array($data)){$msg = htmlspecialchars($data[1]);}else{$msg = htmlspecialchars($data);};
// $msg=htmlspecialchars($msg);
$name = $session->username;
$id_user = $session->uid;
$alliance = $session->alliance;
$now = time();
File diff suppressed because one or more lines are too long
+66 -66
View File
@@ -1,74 +1,74 @@
<?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);
$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
//STOPPED ON LEVEL 20! -> http://travian.kirilloid.ru/hero.php#unit=1
$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' => 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));
//STOPPED ON LEVEL 20! -> http://travian.kirilloid.ru/hero.php#unit=1
$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' => 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));
//GAUL UNITS
$h21_full = array(array('wood' => 200, 'clay' => 260, 'iron' => 110, 'clay' => 60, 'time' => 2080), array('wood' => 550, 'clay' => 690, 'iron' => 330, 'clay' => 210, 'time' => 4160), array('wood' => 910, 'clay' => 1100, 'iron' => 550, 'clay' => 360, 'time' => 6240), array('wood' => 1300, 'clay' => 1600, 'iron' => 790, 'clay' => 510, 'time' => 8320), array('wood' => 1700, 'clay' => 2200, 'iron' => 1000, 'clay' => 670, 'time' => 10400), array('wood' => 2200, 'clay' => 2700, 'iron' => 1300, 'clay' =>
850, 'time' => 12480), array('wood' => 2600, 'clay' => 3300, 'iron' => 1600, 'clay' => 1000, 'time' => 14560), array('wood' => 3100, 'clay' => 3900, 'iron' => 1900, 'clay' => 1200, 'time' => 16640), array('wood' => 3600, 'clay' => 4500, 'iron' => 2200, 'clay' => 1400, 'time' => 18720), array('wood' => 4100, 'clay' => 5200, 'iron' => 2500, 'clay' => 1600, 'time' => 20800), array('wood' => 4600, 'clay' => 5800, 'iron' => 2800, 'clay' => 1800, 'time' => 22880), array('wood' => 5100, 'clay' => 6500,
'iron' => 3100, 'clay' => 2000, 'time' => 24960), array('wood' => 5700, 'clay' => 7200, 'iron' => 3500, 'clay' => 2200, 'time' => 27040), array('wood' => 6200, 'clay' => 7900, 'iron' => 3800, 'clay' => 2400, 'time' => 29120), array('wood' => 6800, 'clay' => 8600, 'iron' => 4100, 'clay' => 2700, 'time' => 31200), array('wood' => 7400, 'clay' => 9300, 'iron' => 4500, 'clay' => 2900, 'time' => 33280), array('wood' => 7900, 'clay' => 10000, 'iron' => 4800, 'clay' => 3100, 'time' => 35360), array('wood' =>
8500, 'clay' => 11000, 'iron' => 5200, 'clay' => 3300, 'time' => 37440), array('wood' => 9100, 'clay' => 11500, 'iron' => 5600, 'clay' => 3600, 'time' => 39520), array('wood' => 9700, 'clay' => 12500, 'iron' => 5900, 'clay' => 3800, 'time' => 41600), array('wood' => 10500, 'clay' => 13000, 'iron' => 6300, 'clay' => 4000, 'time' => 43680), array('wood' => 11000, 'clay' => 14000, 'iron' => 6700, 'clay' => 4300, 'time' => 45760), array('wood' => 11500, 'clay' => 14500, 'iron' => 7100, 'clay' =>
4500, 'time' => 47840), array('wood' => 12000, 'clay' => 15500, 'iron' => 7400, 'clay' => 4800, 'time' => 49920), array('wood' => 13000, 'clay' => 16000, 'iron' => 7800, 'clay' => 5000, 'time' => 52000), array('wood' => 13500, 'clay' => 17000, 'iron' => 8200, 'clay' => 5300, 'time' => 54080), array('wood' => 14000, 'clay' => 18000, 'iron' => 8600, 'clay' => 5500, 'time' => 56160), array('wood' => 15000, 'clay' => 18500, 'iron' => 9000, 'clay' => 5800, 'time' => 58240), array('wood' => 15500,
'clay' => 19500, 'iron' => 9400, 'clay' => 6100, 'time' => 60320), array('wood' => 16000, 'clay' => 20500, 'iron' => 9800, 'clay' => 6300, 'time' => 62400), array('wood' => 17000, 'clay' => 21000, 'iron' => 10000, 'clay' => 6600, 'time' => 64480), array('wood' => 17500, 'clay' => 22000, 'iron' => 10500, 'clay' => 6800, 'time' => 66560), array('wood' => 18000, 'clay' => 23000, 'iron' => 11000, 'clay' => 7100, 'time' => 68640), array('wood' => 19000, 'clay' => 24000, 'iron' => 11500, 'clay' =>
7400, 'time' => 70720), array('wood' => 19500, 'clay' => 24500, 'iron' => 12000, 'clay' => 7700, 'time' => 72800), array('wood' => 20500, 'clay' => 25500, 'iron' => 12500, 'clay' => 7900, 'time' => 74880), array('wood' => 21000, 'clay' => 26500, 'iron' => 13000, 'clay' => 8200, 'time' => 76960), array('wood' => 21500, 'clay' => 27500, 'iron' => 13000, 'clay' => 8500, 'time' => 79040), array('wood' => 22500, 'clay' => 28500, 'iron' => 13500, 'clay' => 8800, 'time' => 81120), array('wood' => 23000,
'clay' => 29000, 'iron' => 14000, 'clay' => 9100, 'time' => 83200), array('wood' => 24000, 'clay' => 30000, 'iron' => 14500, 'clay' => 9300, 'time' => 85280), array('wood' => 24500, 'clay' => 31000, 'iron' => 15000, 'clay' => 9600, 'time' => 87360), array('wood' => 25500, 'clay' => 32000, 'iron' => 15500, 'clay' => 9900, 'time' => 89440), array('wood' => 26000, 'clay' => 33000, 'iron' => 16000, 'clay' => 10000, 'time' => 91520), array('wood' => 27000, 'clay' => 34000, 'iron' => 16500, 'clay' =>
10500, 'time' => 93600), array('wood' => 27500, 'clay' => 34500, 'iron' => 17000, 'clay' => 11000, 'time' => 95680), array('wood' => 28500, 'clay' => 35500, 'iron' => 17000, 'clay' => 11000, 'time' => 97760), array('wood' => 29000, 'clay' => 36500, 'iron' => 17500, 'clay' => 11500, 'time' => 99840), array('wood' => 30000, 'clay' => 37500, 'iron' => 18000, 'clay' => 11500, 'time' => 101920), array('wood' => 30500, 'clay' => 38500, 'iron' => 18500, 'clay' => 12000, 'time' => 104000), array('wood' =>
31500, 'clay' => 39500, 'iron' => 19000, 'clay' => 12500, 'time' => 106080), array('wood' => 32000, 'clay' => 40500, 'iron' => 19500, 'clay' => 12500, 'time' => 108160), array('wood' => 33000, 'clay' => 41500, 'iron' => 20000, 'clay' => 13000, 'time' => 110240), array('wood' => 33500, 'clay' => 42500, 'iron' => 20500, 'clay' => 13000, 'time' => 112320), array('wood' => 34500, 'clay' => 43500, 'iron' => 21000, 'clay' => 13500, 'time' => 114400), array('wood' => 35000, 'clay' => 44500, 'iron' =>
21500, 'clay' => 14000, 'time' => 116480), array('wood' => 36000, 'clay' => 45500, 'iron' => 22000, 'clay' => 14000, 'time' => 118560), array('wood' => 37000, 'clay' => 46500, 'iron' => 22500, 'clay' => 14500, 'time' => 120640), array('wood' => 37500, 'clay' => 47500, 'iron' => 23000, 'clay' => 14500, 'time' => 122720), array('wood' => 38500, 'clay' => 48500, 'iron' => 23500, 'clay' => 15000, 'time' => 124800), array('wood' => 39000, 'clay' => 49500, 'iron' => 24000, 'clay' => 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));
$h21_full = array(array('wood' => 200, 'clay' => 260, 'iron' => 110, 'clay' => 60, 'time' => 2080), array('wood' => 550, 'clay' => 690, 'iron' => 330, 'clay' => 210, 'time' => 4160), array('wood' => 910, 'clay' => 1100, 'iron' => 550, 'clay' => 360, 'time' => 6240), array('wood' => 1300, 'clay' => 1600, 'iron' => 790, 'clay' => 510, 'time' => 8320), array('wood' => 1700, 'clay' => 2200, 'iron' => 1000, 'clay' => 670, 'time' => 10400), array('wood' => 2200, 'clay' => 2700, 'iron' => 1300, 'clay' =>
850, 'time' => 12480), array('wood' => 2600, 'clay' => 3300, 'iron' => 1600, 'clay' => 1000, 'time' => 14560), array('wood' => 3100, 'clay' => 3900, 'iron' => 1900, 'clay' => 1200, 'time' => 16640), array('wood' => 3600, 'clay' => 4500, 'iron' => 2200, 'clay' => 1400, 'time' => 18720), array('wood' => 4100, 'clay' => 5200, 'iron' => 2500, 'clay' => 1600, 'time' => 20800), array('wood' => 4600, 'clay' => 5800, 'iron' => 2800, 'clay' => 1800, 'time' => 22880), array('wood' => 5100, 'clay' => 6500,
'iron' => 3100, 'clay' => 2000, 'time' => 24960), array('wood' => 5700, 'clay' => 7200, 'iron' => 3500, 'clay' => 2200, 'time' => 27040), array('wood' => 6200, 'clay' => 7900, 'iron' => 3800, 'clay' => 2400, 'time' => 29120), array('wood' => 6800, 'clay' => 8600, 'iron' => 4100, 'clay' => 2700, 'time' => 31200), array('wood' => 7400, 'clay' => 9300, 'iron' => 4500, 'clay' => 2900, 'time' => 33280), array('wood' => 7900, 'clay' => 10000, 'iron' => 4800, 'clay' => 3100, 'time' => 35360), array('wood' =>
8500, 'clay' => 11000, 'iron' => 5200, 'clay' => 3300, 'time' => 37440), array('wood' => 9100, 'clay' => 11500, 'iron' => 5600, 'clay' => 3600, 'time' => 39520), array('wood' => 9700, 'clay' => 12500, 'iron' => 5900, 'clay' => 3800, 'time' => 41600), array('wood' => 10500, 'clay' => 13000, 'iron' => 6300, 'clay' => 4000, 'time' => 43680), array('wood' => 11000, 'clay' => 14000, 'iron' => 6700, 'clay' => 4300, 'time' => 45760), array('wood' => 11500, 'clay' => 14500, 'iron' => 7100, 'clay' =>
4500, 'time' => 47840), array('wood' => 12000, 'clay' => 15500, 'iron' => 7400, 'clay' => 4800, 'time' => 49920), array('wood' => 13000, 'clay' => 16000, 'iron' => 7800, 'clay' => 5000, 'time' => 52000), array('wood' => 13500, 'clay' => 17000, 'iron' => 8200, 'clay' => 5300, 'time' => 54080), array('wood' => 14000, 'clay' => 18000, 'iron' => 8600, 'clay' => 5500, 'time' => 56160), array('wood' => 15000, 'clay' => 18500, 'iron' => 9000, 'clay' => 5800, 'time' => 58240), array('wood' => 15500,
'clay' => 19500, 'iron' => 9400, 'clay' => 6100, 'time' => 60320), array('wood' => 16000, 'clay' => 20500, 'iron' => 9800, 'clay' => 6300, 'time' => 62400), array('wood' => 17000, 'clay' => 21000, 'iron' => 10000, 'clay' => 6600, 'time' => 64480), array('wood' => 17500, 'clay' => 22000, 'iron' => 10500, 'clay' => 6800, 'time' => 66560), array('wood' => 18000, 'clay' => 23000, 'iron' => 11000, 'clay' => 7100, 'time' => 68640), array('wood' => 19000, 'clay' => 24000, 'iron' => 11500, 'clay' =>
7400, 'time' => 70720), array('wood' => 19500, 'clay' => 24500, 'iron' => 12000, 'clay' => 7700, 'time' => 72800), array('wood' => 20500, 'clay' => 25500, 'iron' => 12500, 'clay' => 7900, 'time' => 74880), array('wood' => 21000, 'clay' => 26500, 'iron' => 13000, 'clay' => 8200, 'time' => 76960), array('wood' => 21500, 'clay' => 27500, 'iron' => 13000, 'clay' => 8500, 'time' => 79040), array('wood' => 22500, 'clay' => 28500, 'iron' => 13500, 'clay' => 8800, 'time' => 81120), array('wood' => 23000,
'clay' => 29000, 'iron' => 14000, 'clay' => 9100, 'time' => 83200), array('wood' => 24000, 'clay' => 30000, 'iron' => 14500, 'clay' => 9300, 'time' => 85280), array('wood' => 24500, 'clay' => 31000, 'iron' => 15000, 'clay' => 9600, 'time' => 87360), array('wood' => 25500, 'clay' => 32000, 'iron' => 15500, 'clay' => 9900, 'time' => 89440), array('wood' => 26000, 'clay' => 33000, 'iron' => 16000, 'clay' => 10000, 'time' => 91520), array('wood' => 27000, 'clay' => 34000, 'iron' => 16500, 'clay' =>
10500, 'time' => 93600), array('wood' => 27500, 'clay' => 34500, 'iron' => 17000, 'clay' => 11000, 'time' => 95680), array('wood' => 28500, 'clay' => 35500, 'iron' => 17000, 'clay' => 11000, 'time' => 97760), array('wood' => 29000, 'clay' => 36500, 'iron' => 17500, 'clay' => 11500, 'time' => 99840), array('wood' => 30000, 'clay' => 37500, 'iron' => 18000, 'clay' => 11500, 'time' => 101920), array('wood' => 30500, 'clay' => 38500, 'iron' => 18500, 'clay' => 12000, 'time' => 104000), array('wood' =>
31500, 'clay' => 39500, 'iron' => 19000, 'clay' => 12500, 'time' => 106080), array('wood' => 32000, 'clay' => 40500, 'iron' => 19500, 'clay' => 12500, 'time' => 108160), array('wood' => 33000, 'clay' => 41500, 'iron' => 20000, 'clay' => 13000, 'time' => 110240), array('wood' => 33500, 'clay' => 42500, 'iron' => 20500, 'clay' => 13000, 'time' => 112320), array('wood' => 34500, 'clay' => 43500, 'iron' => 21000, 'clay' => 13500, 'time' => 114400), array('wood' => 35000, 'clay' => 44500, 'iron' =>
21500, 'clay' => 14000, 'time' => 116480), array('wood' => 36000, 'clay' => 45500, 'iron' => 22000, 'clay' => 14000, 'time' => 118560), array('wood' => 37000, 'clay' => 46500, 'iron' => 22500, 'clay' => 14500, 'time' => 120640), array('wood' => 37500, 'clay' => 47500, 'iron' => 23000, 'clay' => 14500, 'time' => 122720), array('wood' => 38500, 'clay' => 48500, 'iron' => 23500, 'clay' => 15000, 'time' => 124800), array('wood' => 39000, 'clay' => 49500, 'iron' => 24000, 'clay' => 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));
?>
?>
+4 -4
View File
@@ -1,4 +1,4 @@
<?php
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
@@ -9,8 +9,8 @@
## ##
#################################################################################
$getheroinfo = mysql_query("SELECT * FROM ".TB_PREFIX."hero WHERE `uid`='".$session->uid."'") or die(mysql_error());
$heroinfo = mysql_fetch_array($getheroinfo);
echo $heroinfo['attackpower'];
$heroinfo = mysql_fetch_array($getheroinfo);
echo $heroinfo['attackpower'];
$hero=array('atk'=>40*$heroinfo['attackpower'],'di'=>35,'dc'=>50,'wood'=>120,'clay'=>100,'iron'=>150,'crop'=>30,'pop'=>6,'speed'=>6,'time'=>1600,'cap'=>0);
?>
?>
+4 -4
View File
@@ -25,7 +25,7 @@ $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);
$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);
@@ -41,7 +41,7 @@ $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);
$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);
@@ -49,7 +49,7 @@ $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);
$r49=array('wood'=>18250,'clay'=>13500,'iron'=>20400,'crop'=>16480,'time'=>19425);
//Armoury
//Blacksmith
@@ -94,4 +94,4 @@ $ab46=array(1=>array('wood'=>1085,'clay'=>1235,'iron'=>1185,'crop'=>240,'time'=>
$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));
?>
?>
+2 -2
View File
@@ -1,4 +1,4 @@
<?php
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
@@ -88,4 +88,4 @@ $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
+10 -10
View File
@@ -10,17 +10,17 @@
#################################################################################
class Form {
private $errorarray = array();
public $valuearray = array();
private $errorcount;
public function Form() {
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']);
}
@@ -28,12 +28,12 @@ class Form {
$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];
@@ -42,7 +42,7 @@ class Form {
return "";
}
}
public function getValue($field) {
if(array_key_exists($field,$this->valuearray)) {
return $this->valuearray[$field];
@@ -51,7 +51,7 @@ class Form {
return "";
}
}
public function getDiff($field,$cookie) {
if(array_key_exists($field,$this->valuearray) && $this->valuearray[$field] != $cookie) {
return $this->valuearray[$field];
@@ -60,7 +60,7 @@ class Form {
return $cookie;
}
}
public function getRadio($field,$value) {
if(array_key_exists($field,$this->valuearray) && $this->valuearray[$field] == $value) {
return "checked";
@@ -69,11 +69,11 @@ class Form {
return "";
}
}
public function returnErrors() {
return $this->errorcount;
}
public function getErrors() {
return $this->errorarray;
}
+3 -3
View File
@@ -11,6 +11,6 @@
include("../Village.php");
$database->submitWWname($_POST['vref'],$_POST['wwname']);
header("Location: ../../build.php?id=99&n");
?>
header("Location: ../../build.php?id=99&n");
?>
+58 -58
View File
@@ -10,31 +10,31 @@
#################################################################################
class Generator {
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;
$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) {
global $bid28,$bid14,$building;
$xdistance = ABS($thiscoor['x'] - $coor['x']);
@@ -54,7 +54,7 @@ class Generator {
$speed = 12;
}
else if($ref == 3) {
$speed = 24;
$speed = 24;
}
else if($ref == 300) {
$speed = 5;
@@ -75,7 +75,7 @@ class Generator {
return round($distance * 3600 / INCREASE_SPEED);
}
}
public function getTimeFormat($time) {
$min = 0;
$hr = 0;
@@ -98,55 +98,55 @@ class Generator {
}
public function procMtime($time, $pref = 3) {
/*
$timezone = 7;
switch($timezone) {
case 7:
$time -= 3600;
break;
}
*/
/*
$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);
}
$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() {
$starttime = microtime();
$startarray = explode(" ", $starttime);
@@ -160,6 +160,6 @@ if (date('Ymd',time()) == date('Ymd',$time)) {
//$endtime = $endarray[1] + $endarray[0];
return $endarray[0];
}
};
$generator = new Generator;
$generator = new Generator;
+29 -29
View File
@@ -7,20 +7,20 @@
// - TravianX = Travian Clone Project - //
// DO NOT REMOVE COPYRIGHT NOTICE! //
//////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// //
// ENGLISH //
// Author: Dzoki //
// Author: Dzoki //
/////////////////////////////
//MAIN MENU
define("TRIBE1","Romans");
define("TRIBE1","Romans");
define("TRIBE2","Teutons");
define("TRIBE3","Gauls");
define("TRIBE4","Nature");
define("TRIBE3","Gauls");
define("TRIBE4","Nature");
define("TRIBE5","Natars");
define("TRIBE6","Monsters");
define("HOME","Homepage");
define("HOME","Homepage");
define("INSTRUCT","Instructions");
define("ADMIN_PANEL","Admin Panel");
define("MASS_MESSAGE","Mass Message");
@@ -105,9 +105,9 @@ define("WAITING_LOOP","(waiting loop)");
define("HRS","(hrs.)");
define("DONE_AT","done at");
define("CANCEL","cancel");
define("LOYALTY","Loyalty:");
define("LOYALTY","Loyalty:");
define("CALCULATED_IN","Calculated in");
define("SEVER_TIME","Server time:");
define("SEVER_TIME","Server time:");
//QUEST
define("Q_CONTINUE","Continue with the next task.");
@@ -331,29 +331,29 @@ define("MASS_SENT","Mass IGM was sent");
/*
|--------------------------------------------------------------------------
| Index
| Index
|--------------------------------------------------------------------------
*/
$lang['index'][0][1] = "Welcome to " . SERVER_NAME . "";
$lang['index'][0][2] = "Manual";
$lang['index'][0][3] = "Play now, for free!";
$lang['index'][0][4] = "What is " . SERVER_NAME . "";
$lang['index'][0][5] = "" . SERVER_NAME . " is a <b>browser game</b> featuring an engaging ancient world with thousands of other real players.</p><p>It`s <strong>free to play</strong> and requires <strong>no downloads</strong>.";
$lang['index'][0][6] = "Click here to play " . SERVER_NAME . "";
$lang['index'][0][7] = "Total players";
$lang['index'][0][8] = "Players active";
$lang['index'][0][9] = "Players online";
$lang['index'][0][10] = "About the game";
$lang['index'][0][11] = "You will begin as the chief of a tiny village and will embark on an exciting quest.";
$lang['index'][0][12] = "Build up villages, wage wars or establish trade routes with your neighbours.";
$lang['index'][0][13] = "Play with and against thousands of other real players and conquer the the world of Travian.";
$lang['index'][0][14] = "News";
$lang['index'][0][15] = "FAQ";
$lang['index'][0][16] = "Screenshots";
$lang['forum'] = "Forum";
$lang['register'] = "Register";
$lang['login'] = "Login";
$lang['index'][0][1] = "Welcome to " . SERVER_NAME . "";
$lang['index'][0][2] = "Manual";
$lang['index'][0][3] = "Play now, for free!";
$lang['index'][0][4] = "What is " . SERVER_NAME . "";
$lang['index'][0][5] = "" . SERVER_NAME . " is a <b>browser game</b> featuring an engaging ancient world with thousands of other real players.</p><p>It`s <strong>free to play</strong> and requires <strong>no downloads</strong>.";
$lang['index'][0][6] = "Click here to play " . SERVER_NAME . "";
$lang['index'][0][7] = "Total players";
$lang['index'][0][8] = "Players active";
$lang['index'][0][9] = "Players online";
$lang['index'][0][10] = "About the game";
$lang['index'][0][11] = "You will begin as the chief of a tiny village and will embark on an exciting quest.";
$lang['index'][0][12] = "Build up villages, wage wars or establish trade routes with your neighbours.";
$lang['index'][0][13] = "Play with and against thousands of other real players and conquer the the world of Travian.";
$lang['index'][0][14] = "News";
$lang['index'][0][15] = "FAQ";
$lang['index'][0][16] = "Screenshots";
$lang['forum'] = "Forum";
$lang['register'] = "Register";
$lang['login'] = "Login";
?>
+2 -2
View File
@@ -7,9 +7,9 @@
// - TravianX = Travian Clone Project - //
// DO NOT REMOVE COPYRIGHT NOTICE! //
//////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// //
// SPANISH //
// author: Thyphoon //
// author: Thyphoon //
/////////////////////////////
//MAIN MENU
+35 -35
View File
@@ -7,20 +7,20 @@
// - TravianX = Travian Clone Project - //
// DO NOT REMOVE COPYRIGHT NOTICE! //
//////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// //
// Русский //
// Author: kylesv (sV) //
// Author: kylesv (sV) //
/////////////////////////////
//MAIN MENU
define("TRIBE1","Римляне");
define("TRIBE1","Римляне");
define("TRIBE2","Германцы");
define("TRIBE3","Галлы");
define("TRIBE4","Природа");
define("TRIBE3","Галлы");
define("TRIBE4","Природа");
define("TRIBE5","Натары");
define("TRIBE6","Монстры");
define("HOME","Главная");
define("HOME","Главная");
define("INSTRUCT","Инструкции");
define("ADMIN_PANEL","Админка");
define("MULTIHUNTER_PAN","Мультих. панель");
@@ -108,9 +108,9 @@ define("WAITING_LOOP","(очередь)");
define("HRS","ч.");
define("DONE_AT","будет завершено в");
define("CANCEL","отмена");
define("LOYALTY","Лояльность:");
define("LOYALTY","Лояльность:");
define("CALCULATED_IN","Создана за");
define("SEVER_TIME","Время сервера:");
define("SEVER_TIME","Время сервера:");
define("MILISECS","мс");
//QUEST
@@ -333,33 +333,33 @@ define("MASS_SENT","Mass IGM was sent");
/*
|--------------------------------------------------------------------------
| Index
| Index
|--------------------------------------------------------------------------
*/
$lang['index'][0][1] = "Welcome to " . SERVER_NAME . "";
$lang['index'][0][2] = "Manual";
$lang['index'][0][3] = "Play now, for free!";
$lang['index'][0][4] = "What is " . SERVER_NAME . "";
$lang['index'][0][5] = "" . SERVER_NAME . " is a <b>browser game</b> featuring an engaging ancient world with thousands of other real players.</p><p>It`s <strong>free to play</strong> and requires <strong>no downloads</strong>.";
$lang['index'][0][6] = "Click here to play " . SERVER_NAME . "";
$lang['index'][0][7] = "Total players";
$lang['index'][0][8] = "Players active";
$lang['index'][0][9] = "Players online";
$lang['index'][0][10] = "About the game";
$lang['index'][0][11] = "You will begin as the chief of a tiny village and will embark on an exciting quest.";
$lang['index'][0][12] = "Build up villages, wage wars or establish trade routes with your neighbours.";
$lang['index'][0][13] = "Play with and against thousands of other real players and conquer the the world of Travian.";
$lang['index'][0][14] = "News";
$lang['index'][0][15] = "FAQ";
$lang['index'][0][16] = "Screenshots";
$lang['forum'] = "Forum";
$lang['register'] = "Регистрация";
$lang['login'] = "Login";
$lang['index'][0][1] = "Welcome to " . SERVER_NAME . "";
$lang['index'][0][2] = "Manual";
$lang['index'][0][3] = "Play now, for free!";
$lang['index'][0][4] = "What is " . SERVER_NAME . "";
$lang['index'][0][5] = "" . SERVER_NAME . " is a <b>browser game</b> featuring an engaging ancient world with thousands of other real players.</p><p>It`s <strong>free to play</strong> and requires <strong>no downloads</strong>.";
$lang['index'][0][6] = "Click here to play " . SERVER_NAME . "";
$lang['index'][0][7] = "Total players";
$lang['index'][0][8] = "Players active";
$lang['index'][0][9] = "Players online";
$lang['index'][0][10] = "About the game";
$lang['index'][0][11] = "You will begin as the chief of a tiny village and will embark on an exciting quest.";
$lang['index'][0][12] = "Build up villages, wage wars or establish trade routes with your neighbours.";
$lang['index'][0][13] = "Play with and against thousands of other real players and conquer the the world of Travian.";
$lang['index'][0][14] = "News";
$lang['index'][0][15] = "FAQ";
$lang['index'][0][16] = "Screenshots";
$lang['forum'] = "Forum";
$lang['register'] = "Регистрация";
$lang['login'] = "Login";
/*
|--------------------------------------------------------------------------
| top_menu
| top_menu
|--------------------------------------------------------------------------
*/
$lang['header'] = array (
@@ -370,7 +370,7 @@ define("MASS_SENT","Mass IGM was sent");
4 => 'Отчеты',
5 => 'Сообщения',
6 => 'Plus меню');
$lang['buildings'] = array (
1 => "Лесопилка",
2 => "Глиняный карьер",
@@ -416,7 +416,7 @@ define("MASS_SENT","Mass IGM was sent");
42 => "Большая мастерская",
43 => "Ошибка",
44 => "&nbsp;(уровень&nbsp;");
$lang['fields'] = array (
0 => '&nbsp;уровень',
1 => 'Лесопилка уровень',
@@ -429,7 +429,7 @@ define("MASS_SENT","Mass IGM was sent");
$lang['npc'] = array (
0 => 'NPC торговец');
$lang['upgrade'] = array (
0 => 'Здание уже на максимальном уровне',
1 => 'Максимальный уровень здания строится',
@@ -444,10 +444,10 @@ define("MASS_SENT","Mass IGM was sent");
10 => 'Улучшить до уровня&nbsp;',
11 => 'сегодня',
12 => 'завтра');
$lang['movement'] = array (
0 => 'в&nbsp;');
$lang['troops'] = array (
0 => 'нет',
1 => 'Герой');
+9 -9
View File
@@ -10,7 +10,7 @@
#################################################################################
class Logging {
public function addIllegal($uid,$ref,$type) {
global $database;
if(LOG_ILLEGAL) {
@@ -24,7 +24,7 @@ class Logging {
$database->query($q);
}
}
public function addLoginLog($id,$ip) {
global $database;
if(LOG_LOGIN) {
@@ -32,7 +32,7 @@ class Logging {
$database->query($q);
}
}
public function addBuildLog($wid,$building,$level,$type) {
global $database;
if(LOG_BUILD) {
@@ -47,7 +47,7 @@ class Logging {
$database->query($q);
}
}
public function addTechLog($wid,$tech,$level) {
global $database;
if(LOG_TECH) {
@@ -56,7 +56,7 @@ class Logging {
$database->query($q);
}
}
public function goldFinLog($wid) {
global $database;
if(LOG_GOLD_FIN) {
@@ -65,11 +65,11 @@ class Logging {
$database->query($q);
}
}
public function addAdminLog() {
global $database;
}
public function addMarketLog($wid,$type,$data) {
global $database;
if(LOG_MARKET) {
@@ -83,11 +83,11 @@ class Logging {
$database->query($q);
}
}
public function addWarLog() {
global $database;
}
public function clearLogs() {
global $database;
}
+253 -253
View File
@@ -1,269 +1,269 @@
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename Market.php ##
## Developed by: Dzoki ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ##
#################################################################################
class Market {
public $onsale,$onmarket,$sending,$recieving,$return = array();
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,"gtype");
$amt = $database->getMarketField($village->wid,"gamt");
$vref = $village->wid;
$database->getResourcesBack($vref,$type,$amt);
$database->addMarket($village->wid,$get['del'],0,0,0,0,0,0,1);
header("Location: build.php?id=".$get['id']."&t=2");
}
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);
<?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
## Filename Market.php ##
## Developed by: Dzoki ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ##
#################################################################################
class Market {
public $onsale,$onmarket,$sending,$recieving,$return = array();
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,"gtype");
$amt = $database->getMarketField($village->wid,"gamt");
$vref = $village->wid;
$database->getResourcesBack($vref,$type,$amt);
$database->addMarket($village->wid,$get['del'],0,0,0,0,0,0,1);
header("Location: build.php?id=".$get['id']."&t=2");
}
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;
$wtrans = (isset($post['r1']) && $post['r1'] != "")? $post['r1'] : 0;
$ctrans = (isset($post['r2']) && $post['r2'] != "")? $post['r2'] : 0;
$itrans = (isset($post['r3']) && $post['r3'] != "")? $post['r3'] : 0;
$crtrans = (isset($post['r4']) && $post['r4'] != "")? $post['r4'] : 0;
$wtrans = str_replace("-", "", $wtrans);
$ctrans = str_replace("-", "", $ctrans);
$itrans = str_replace("-", "", $itrans);
$crtrans = str_replace("-", "", $crtrans);
$availableWood = $database->getWoodAvailable($village->wid);
$availableClay = $database->getClayAvailable($village->wid);
$availableIron = $database->getIronAvailable($village->wid);
$availableCrop = $database->getCropAvailable($village->wid);
if($building->getTypeLevel(28) != 0) {
$this->maxcarry *= $bid28[$building->getTypeLevel(28)]['attri'] / 100;
}
}
private function sendResource($post) {
global $database,$village,$session,$generator,$logging;
$wtrans = (isset($post['r1']) && $post['r1'] != "")? $post['r1'] : 0;
$ctrans = (isset($post['r2']) && $post['r2'] != "")? $post['r2'] : 0;
$itrans = (isset($post['r3']) && $post['r3'] != "")? $post['r3'] : 0;
$crtrans = (isset($post['r4']) && $post['r4'] != "")? $post['r4'] : 0;
$wtrans = str_replace("-", "", $wtrans);
$ctrans = str_replace("-", "", $ctrans);
$itrans = str_replace("-", "", $itrans);
$crtrans = str_replace("-", "", $crtrans);
$availableWood = $database->getWoodAvailable($village->wid);
$availableClay = $database->getClayAvailable($village->wid);
$availableIron = $database->getIronAvailable($village->wid);
$availableCrop = $database->getCropAvailable($village->wid);
if($session->access == BANNED){
header("Location: banned.php");
}else if($availableWood >= $post['r1'] AND $availableClay >= $post['r2'] AND $availableIron >= $post['r3'] AND $availableCrop >= $post['r4']){
$resource = array($wtrans,$ctrans,$itrans,$crtrans);
$reqMerc = ceil((array_sum($resource)-0.1)/$this->maxcarry);
}else if($availableWood >= $post['r1'] AND $availableClay >= $post['r2'] AND $availableIron >= $post['r3'] AND $availableCrop >= $post['r4']){
if($this->merchantAvail() != 0 && $reqMerc <= $this->merchantAvail()) {
if(isset($post['x']) && isset($post['y']) && $post['x'] != "" && $post['y'] != "") {
$coor = array('x'=>$post['x'], 'y'=>$post['y']);
$id = $generator->getBaseID($coor['x'],$coor['y']);
}else if(isset($post['dname']) && $post['dname'] != "") {
$id = $database->getVillageByName($post['dname']);
$coor = $database->getCoor($id);
}
if($database->getVillageState($id)) {
$timetaken = $generator->procDistanceTime($coor,$village->coor,$session->tribe,0);
$resource = array($wtrans,$ctrans,$itrans,$crtrans);
$reqMerc = ceil((array_sum($resource)-0.1)/$this->maxcarry);
if($this->merchantAvail() != 0 && $reqMerc <= $this->merchantAvail()) {
if(isset($post['x']) && isset($post['y']) && $post['x'] != "" && $post['y'] != "") {
$coor = array('x'=>$post['x'], 'y'=>$post['y']);
$id = $generator->getBaseID($coor['x'],$coor['y']);
}else if(isset($post['dname']) && $post['dname'] != "") {
$id = $database->getVillageByName($post['dname']);
$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,array($resource[0],$resource[1],$resource[2],$resource[3],$id));
$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,array($resource[0],$resource[1],$resource[2],$resource[3],$id));
}
}
}
header("Location: build.php?id=".$post['id']);
} else {}
}
private function addOffer($post) {
global $database,$village,$session;
$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;
$availableWood = $database->getWoodAvailable($village->wid);
$availableClay = $database->getClayAvailable($village->wid);
$availableIron = $database->getIronAvailable($village->wid);
$availableCrop = $database->getCropAvailable($village->wid);
}
header("Location: build.php?id=".$post['id']);
} else {}
}
private function addOffer($post) {
global $database,$village,$session;
$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;
$availableWood = $database->getWoodAvailable($village->wid);
$availableClay = $database->getClayAvailable($village->wid);
$availableIron = $database->getIronAvailable($village->wid);
$availableCrop = $database->getCropAvailable($village->wid);
if($session->access == BANNED){
header("Location: banned.php");
}else if($availableWood >= $wood AND $availableClay >= $clay AND $availableIron >= $iron AND $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);
}
}
header("Location: build.php?id=".$post['id']."&t=2");
} else {}
}
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;
}
}
$myresource = $hisresource = array(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);
$database->addMovement(0,$village->wid,$infoarray['vref'],$mysendid,time(),$mytime+time());
$database->addMovement(0,$infoarray['vref'],$village->wid,$hissendid,time(),$histime+time());
$resource = array(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,array($infoarray['vref'],$get['g']));
header("Location: build.php?id=".$get['id']);
}
private function loadOnsale() {
global $database,$village,$session,$multisort,$generator;
$displayarray = $database->getMarket($village->wid,1);
$holderarray = array();
foreach($displayarray as $value) {
$targetcoor = $database->getCoor($value['vref']);
$duration = $generator->procDistanceTime($targetcoor,$village->coor,$session->tribe,0);
if($duration <= $value['maxtime'] || $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 = array();
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;
}else if($availableWood >= $wood AND $availableClay >= $clay AND $availableIron >= $iron AND $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);
}
}
header("Location: build.php?id=".$post['id']."&t=2");
} else {}
}
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;
}
}
$myresource = $hisresource = array(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);
$database->addMovement(0,$village->wid,$infoarray['vref'],$mysendid,time(),$mytime+time());
$database->addMovement(0,$infoarray['vref'],$village->wid,$hissendid,time(),$histime+time());
$resource = array(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,array($infoarray['vref'],$get['g']));
header("Location: build.php?id=".$get['id']);
}
private function loadOnsale() {
global $database,$village,$session,$multisort,$generator;
$displayarray = $database->getMarket($village->wid,1);
$holderarray = array();
foreach($displayarray as $value) {
$targetcoor = $database->getCoor($value['vref']);
$duration = $generator->procDistanceTime($targetcoor,$village->coor,$session->tribe,0);
if($duration <= $value['maxtime'] || $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 = array();
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) {
//kijken of ze niet meer gs invoeren dan ze hebben
if($session->userinfo['gold'] >= 3) {
//kijken of ze niet meer gs invoeren dan ze hebben
if($session->access == BANNED){
header("Location: banned.php");
}else 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",$post['m2'][0]);
$database->setVillageField($village->wid,"clay",$post['m2'][1]);
$database->setVillageField($village->wid,"iron",$post['m2'][2]);
$database->setVillageField($village->wid,"crop",$post['m2'][3]);
$database->modifyGold($session->uid,3,0);
header("Location: build.php?id=".$post['id']."&t=3&c");;
} else {
header("Location: build.php?id=".$post['id']."&t=3");
}
} else {
header("Location: build.php?id=".$post['id']."&t=3");
}
}else 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",$post['m2'][0]);
$database->setVillageField($village->wid,"clay",$post['m2'][1]);
$database->setVillageField($village->wid,"iron",$post['m2'][2]);
$database->setVillageField($village->wid,"crop",$post['m2'][3]);
$database->modifyGold($session->uid,3,0);
header("Location: build.php?id=".$post['id']."&t=3&c");;
} else {
header("Location: build.php?id=".$post['id']."&t=3");
}
} else {
header("Location: build.php?id=".$post['id']."&t=3");
}
}
}
};
$market = new Market;
?>
};
$market = new Market;
?>
+439 -439
View File
@@ -9,452 +9,452 @@
| Copyright: TravianX Project All rights reserved |
\** --------------------------------------------------- **/
class Message {
class Message {
public $unread, $nunread = false;
public $note;
public $inbox, $inbox1, $sent, $sent1, $reading, $reply, $archived, $archived1, $noticearray, $notice, $readingNotice = array();
private $totalMessage, $totalNotice;
private $allNotice = array();
public $unread, $nunread = false;
public $note;
public $inbox, $inbox1, $sent, $sent1, $reading, $reply, $archived, $archived1, $noticearray, $notice, $readingNotice = array();
private $totalMessage, $totalNotice;
private $allNotice = array();
function Message() {
$this->getMessages();
$this->getNotice();
if($this->totalMessage > 0) {
$this->unread = $this->checkUnread();
}
if($this->totalNotice > 0) {
$this->nunread = $this->checkNUnread();
}
if(isset($_SESSION['reply'])) {
$this->reply = $_SESSION['reply'];
unset($_SESSION['reply']);
}
}
function Message() {
$this->getMessages();
$this->getNotice();
if($this->totalMessage > 0) {
$this->unread = $this->checkUnread();
}
if($this->totalNotice > 0) {
$this->nunread = $this->checkNUnread();
}
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'],$post['message']);
}else{
$this->sendMessage($post['an'],$post['be'],$post['message']);
}
header("Location: nachrichten.php?t=2");
break;
case "m3":
case "m4":
case "m5":
if(isset($post['delmsg_x'])) {
$this->removeMessage($post);
$this->header($get);
}
if(isset($post['archive_x'])) {
$this->archiveMessage($post);
}
if(isset($post['start_x'])) {
$this->unarchiveMessage($post);
}
break;
case "m6":
$this->createNote($post);
break;
case "m7":
$this->addFriends($post);
break;
}
}
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'],$post['message']);
}else{
$this->sendMessage($post['an'],$post['be'],$post['message']);
}
header("Location: nachrichten.php?t=2");
break;
case "m3":
case "m4":
case "m5":
if(isset($post['delmsg_x'])) {
$this->removeMessage($post);
$this->header($get);
}
if(isset($post['archive_x'])) {
$this->archiveMessage($post);
}
if(isset($post['start_x'])) {
$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 = array(8, 15, 16, 17);
}
if($get['t'] == 2) {
$type = array(10, 11, 12, 13);
}
if($get['t'] == 3) {
$type = array(1, 2, 3, 4, 5, 6, 7);
}
if($get['t'] == 4) {
$type = array(0, 18, 19, 20, 21);
}
if($get['t'] == 5) {
if(!$session->plus){
header("Location: berichte.php");
} else {
$type = 9;
}
}
if (!is_array($type)) { $type = array($type); }
$this->noticearray = $this->filter_by_value($database->getNotice($session->uid), "ntype", $type);
$this->notice = $this->filter_by_value($database->getNotice3($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);
$this->reply = $_SESSION['reply'] = $message;
header("Location: nachrichten.php?t=1&id=" . $message['owner']);
}
}
}
public function loadMessage($id) {
global $database, $session;
if($this->findInbox($id)) {
foreach($this->inbox as $message) {
if($message['id'] == $id) {
$this->reading = $message;
}
}
}
if($this->findSent($id)) {
foreach($this->sent as $message) {
if($message['id'] == $id) {
$this->reading = $message;
}
}
}
if($session->plus && $this->findArchive($id)) {
foreach($this->archived as $message) {
if($message['id'] == $id) {
$this->reading = $message;
}
}
}
if($this->reading['viewed'] == 0) {
$database->getMessage($id, 4);
}
}
private function filter_by_value_except($array, $index, $value) {
$newarray = array();
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 = array();
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->allNotice = $database->getNotice3($session->uid);
$this->noticearray = $this->filter_by_value_except($database->getNotice($session->uid), "ntype", 9);
$this->notice = $this->filter_by_value_except($this->allNotice, "ntype", 9);
$this->totalNotice = count($this->allNotice);
}
private function removeMessage($post) {
global $database,$session;
for($i = 1; $i <= 10; $i++) {
if(isset($post['n' . $i])) {
$message1 = mysql_query("SELECT * FROM " . TB_PREFIX . "mdata where id = ".$post['n' . $i]."");
$message = mysql_fetch_array($message1);
if($message['target'] == $session->uid && $message['owner'] == $session->uid){
$database->getMessage($post['n' . $i], 8);
}else if($message['target'] == $session->uid){
$database->getMessage($post['n' . $i], 5);
}else if($message['owner'] == $session->uid){
$database->getMessage($post['n' . $i], 7);
}
}
}
header("Location: nachrichten.php");
}
private function archiveMessage($post) {
global $database;
for($i = 1; $i <= 10; $i++) {
if(isset($post['n' . $i])) {
$database->setArchived($post['n' . $i]);
}
}
header("Location: nachrichten.php");
}
private function unarchiveMessage($post) {
global $database;
for($i = 1; $i <= 10; $i++) {
if(isset($post['n' . $i])) {
$database->setNorm($post['n' . $i]);
}
}
header("Location: nachrichten.php");
}
private function removeNotice($post) {
global $database;
for($i = 1; $i <= 10; $i++) {
if(isset($post['n' . $i])) {
$database->removeNotice($post['n' . $i], 5);
}
}
header("Location: berichte.php");
}
private function archiveNotice($post) {
global $database;
for($i = 1; $i <= 10; $i++) {
if(isset($post['n' . $i])) {
$database->archiveNotice($post['n' . $i]);
}
}
header("Location: berichte.php");
}
private function unarchiveNotice($post) {
global $database;
for($i = 1; $i <= 10; $i++) {
if(isset($post['n' . $i])) {
$database->unarchiveNotice($post['n' . $i]);
}
}
header("Location: berichte.php");
}
private function getReadNotice($id) {
global $database;
foreach($this->allNotice as $notice) {
if($notice['id'] == $id) {
$database->noticeViewed($notice['id']);
return $notice;
}
}
}
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() {
global $database, $session;
$this->inbox = $database->getMessage($session->uid, 1);
$this->sent = $database->getMessage($session->uid, 2);
$this->inbox1 = $database->getMessage($session->uid, 9);
$this->sent1 = $database->getMessage($session->uid, 10);
if($session->plus) {
$this->archived = $database->getMessage($session->uid, 6);
$this->archived1 = $database->getMessage($session->uid, 11);
}
$this->totalMessage = count($this->inbox) + count($this->sent);
}
private function sendAMessage($topic,$text) {
global $session,$database;
$allmembersQ = mysql_query("SELECT id FROM ".TB_PREFIX."users WHERE alliance='".$session->alliance."'");
$userally = $database->getUserField($session->uid,"alliance",0);
$permission=mysql_fetch_array(mysql_query("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]";
if($permission[opt7]==1){
if ($userally != 0) {
while ($allmembers = mysql_fetch_array($allmembersQ)) {
$database->sendMessage($allmembers[id],$session->uid,$topic,$text,0);
}
}
}
public function noticeType($get) {
global $session, $database;
if(isset($get['t'])) {
if($get['t'] == 1) {
$type = array(8, 15, 16, 17);
}
if($get['t'] == 2) {
$type = array(10, 11, 12, 13);
}
if($get['t'] == 3) {
$type = array(1, 2, 3, 4, 5, 6, 7);
}
if($get['t'] == 4) {
$type = array(0, 18, 19, 20, 21);
}
if($get['t'] == 5) {
if(!$session->plus){
header("Location: berichte.php");
} else {
$type = 9;
}
}
private function sendMessage($recieve, $topic, $text) {
global $session, $database;
$user = $database->getUserField($recieve, "id", 1);
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]";
//if to multihunter
if($user == "0") {
//make mail server
$database->sendMessage($user, $session->uid, $topic, $text, 0);
} else {
$database->sendMessage($user, $session->uid, $topic, $text, 0);
}
}
if (!is_array($type)) { $type = array($type); }
$this->noticearray = $this->filter_by_value($database->getNotice($session->uid), "ntype", $type);
$this->notice = $this->filter_by_value($database->getNotice3($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);
$this->reply = $_SESSION['reply'] = $message;
header("Location: nachrichten.php?t=1&id=" . $message['owner']);
}
}
}
public function loadMessage($id) {
global $database, $session;
if($this->findInbox($id)) {
foreach($this->inbox as $message) {
if($message['id'] == $id) {
$this->reading = $message;
}
}
//7 = village, attacker, att tribe, u1 - u10, lost %, w,c,i,c , cap
//8 = village, attacker, att tribe, enforcement
private function sendNotice($from, $vid, $fowner, $owner, $type, $extra) {
}
public function sendWelcome($uid, $username) {
global $database;
$welcomemsg = file_get_contents("GameEngine/Admin/welcome.tpl");
$welcomemsg = preg_replace("'%USER%'", $username, $welcomemsg);
$welcomemsg = preg_replace("'%START%'", date("y.m.d", COMMENCE), $welcomemsg);
$welcomemsg = preg_replace("'%TIME%'", date("H:i", COMMENCE), $welcomemsg);
$welcomemsg = preg_replace("'%PLAYERS%'", $database->countUser()-4, $welcomemsg);
$welcomemsg = preg_replace("'%ALLI%'", $database->countAlli(), $welcomemsg);
$welcomemsg = preg_replace("'%SERVER_NAME%'", SERVER_NAME, $welcomemsg);
$welcomemsg = "[message]".$welcomemsg."[/message]";
return $database->sendMessage($uid, 5, WEL_TOPIC, $welcomemsg, 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() {
foreach($this->inbox as $message) {
if($message['viewed'] == 0) {
return true;
}
}
return false;
}
private function checkNUnread() {
foreach($this->allNotice as $notice) {
if($notice['viewed'] == 0) {
return true;
}
}
return false;
}
private function findInbox($id) {
foreach($this->inbox as $message) {
if($message['id'] == $id) {
return true;
}
}
return false;
}
private function findSent($id) {
foreach($this->sent as $message) {
if($message['id'] == $id) {
return true;
}
}
return false;
}
private function findArchive($id) {
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($this->findSent($id)) {
foreach($this->sent as $message) {
if($message['id'] == $id) {
$this->reading = $message;
}
}
}
if($session->plus && $this->findArchive($id)) {
foreach($this->archived as $message) {
if($message['id'] == $id) {
$this->reading = $message;
}
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");
}
}
}
if($this->reading['viewed'] == 0) {
$database->getMessage($id, 4);
}
}
}
;
private function filter_by_value_except($array, $index, $value) {
$newarray = array();
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 = array();
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->allNotice = $database->getNotice3($session->uid);
$this->noticearray = $this->filter_by_value_except($database->getNotice($session->uid), "ntype", 9);
$this->notice = $this->filter_by_value_except($this->allNotice, "ntype", 9);
$this->totalNotice = count($this->allNotice);
}
private function removeMessage($post) {
global $database,$session;
for($i = 1; $i <= 10; $i++) {
if(isset($post['n' . $i])) {
$message1 = mysql_query("SELECT * FROM " . TB_PREFIX . "mdata where id = ".$post['n' . $i]."");
$message = mysql_fetch_array($message1);
if($message['target'] == $session->uid && $message['owner'] == $session->uid){
$database->getMessage($post['n' . $i], 8);
}else if($message['target'] == $session->uid){
$database->getMessage($post['n' . $i], 5);
}else if($message['owner'] == $session->uid){
$database->getMessage($post['n' . $i], 7);
}
}
}
header("Location: nachrichten.php");
}
private function archiveMessage($post) {
global $database;
for($i = 1; $i <= 10; $i++) {
if(isset($post['n' . $i])) {
$database->setArchived($post['n' . $i]);
}
}
header("Location: nachrichten.php");
}
private function unarchiveMessage($post) {
global $database;
for($i = 1; $i <= 10; $i++) {
if(isset($post['n' . $i])) {
$database->setNorm($post['n' . $i]);
}
}
header("Location: nachrichten.php");
}
private function removeNotice($post) {
global $database;
for($i = 1; $i <= 10; $i++) {
if(isset($post['n' . $i])) {
$database->removeNotice($post['n' . $i], 5);
}
}
header("Location: berichte.php");
}
private function archiveNotice($post) {
global $database;
for($i = 1; $i <= 10; $i++) {
if(isset($post['n' . $i])) {
$database->archiveNotice($post['n' . $i]);
}
}
header("Location: berichte.php");
}
private function unarchiveNotice($post) {
global $database;
for($i = 1; $i <= 10; $i++) {
if(isset($post['n' . $i])) {
$database->unarchiveNotice($post['n' . $i]);
}
}
header("Location: berichte.php");
}
private function getReadNotice($id) {
global $database;
foreach($this->allNotice as $notice) {
if($notice['id'] == $id) {
$database->noticeViewed($notice['id']);
return $notice;
}
}
}
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() {
global $database, $session;
$this->inbox = $database->getMessage($session->uid, 1);
$this->sent = $database->getMessage($session->uid, 2);
$this->inbox1 = $database->getMessage($session->uid, 9);
$this->sent1 = $database->getMessage($session->uid, 10);
if($session->plus) {
$this->archived = $database->getMessage($session->uid, 6);
$this->archived1 = $database->getMessage($session->uid, 11);
}
$this->totalMessage = count($this->inbox) + count($this->sent);
}
private function sendAMessage($topic,$text) {
global $session,$database;
$allmembersQ = mysql_query("SELECT id FROM ".TB_PREFIX."users WHERE alliance='".$session->alliance."'");
$userally = $database->getUserField($session->uid,"alliance",0);
$permission=mysql_fetch_array(mysql_query("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]";
if($permission[opt7]==1){
if ($userally != 0) {
while ($allmembers = mysql_fetch_array($allmembersQ)) {
$database->sendMessage($allmembers[id],$session->uid,$topic,$text,0);
}
}
}
}
}
private function sendMessage($recieve, $topic, $text) {
global $session, $database;
$user = $database->getUserField($recieve, "id", 1);
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]";
//if to multihunter
if($user == "0") {
//make mail server
$database->sendMessage($user, $session->uid, $topic, $text, 0);
} else {
$database->sendMessage($user, $session->uid, $topic, $text, 0);
}
}
}
//7 = village, attacker, att tribe, u1 - u10, lost %, w,c,i,c , cap
//8 = village, attacker, att tribe, enforcement
private function sendNotice($from, $vid, $fowner, $owner, $type, $extra) {
}
public function sendWelcome($uid, $username) {
global $database;
$welcomemsg = file_get_contents("GameEngine/Admin/welcome.tpl");
$welcomemsg = preg_replace("'%USER%'", $username, $welcomemsg);
$welcomemsg = preg_replace("'%START%'", date("y.m.d", COMMENCE), $welcomemsg);
$welcomemsg = preg_replace("'%TIME%'", date("H:i", COMMENCE), $welcomemsg);
$welcomemsg = preg_replace("'%PLAYERS%'", $database->countUser()-4, $welcomemsg);
$welcomemsg = preg_replace("'%ALLI%'", $database->countAlli(), $welcomemsg);
$welcomemsg = preg_replace("'%SERVER_NAME%'", SERVER_NAME, $welcomemsg);
$welcomemsg = "[message]".$welcomemsg."[/message]";
return $database->sendMessage($uid, 5, WEL_TOPIC, $welcomemsg, 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() {
foreach($this->inbox as $message) {
if($message['viewed'] == 0) {
return true;
}
}
return false;
}
private function checkNUnread() {
foreach($this->allNotice as $notice) {
if($notice['viewed'] == 0) {
return true;
}
}
return false;
}
private function findInbox($id) {
foreach($this->inbox as $message) {
if($message['id'] == $id) {
return true;
}
}
return false;
}
private function findSent($id) {
foreach($this->sent as $message) {
if($message['id'] == $id) {
return true;
}
}
return false;
}
private function findArchive($id) {
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");
}
}
;
+5 -5
View File
@@ -10,21 +10,21 @@
#################################################################################
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);
switch($type)
{
case 1: // Case insensitive natural.
@@ -44,7 +44,7 @@ class multiSort {
break;
}
usort($array, create_function('$a, $b', 'return ' . ($order ? '' : '-') . '(' . $t . ');'));
}
return $array;
}
@@ -1 +0,0 @@
es
+1 -1
View File
@@ -97,7 +97,7 @@ class Profile {
}else{
header("Location: banned.php");
}
}
}
private function updateAccount($post) {
global $database,$session,$form;
if($post['pw2'] == $post['pw3']) {
+1 -1
View File
@@ -11,7 +11,7 @@
#################################################################################
//heef npc uitzondering omdat die met speciaal $_post werken
if(isset($_POST)){
if(isset($_POST)){
if(!isset($_POST['ft'])){
$_POST = @array_map('mysql_real_escape_string', $_POST);
$_POST = array_map('htmlspecialchars', $_POST);
+466 -466
View File
@@ -9,531 +9,531 @@
| Copyright: TravianX Project All rights reserved |
\** --------------------------------------------------- **/
class Ranking {
class Ranking {
private $rankarray = array();
private $rlastupdate;
private $rankarray = array();
private $rlastupdate;
public function getRank() {
return $this->rankarray;
}
public function getRank() {
return $this->rankarray;
}
public function getUserRank($username) {
$ranking = $this->getRank();
$start = $_SESSION['start']+1;
if(count($ranking) > 0) {
for($i=$start;$i<($start+20);$i++) {
for($i=$start;$i<($start+20);$i++) {
if($ranking[$i]['username'] == $username && $ranking[$i] != "pad") {
$myrank = $i;
}
}
}
return $myrank;
}
}
public function procRankReq($get) {
global $village, $session, $database;
if(isset($get['id'])) {
switch($get['id']) {
case 1:
$this->procRankArray();
break;
case 8:
$this->procHeroRankArray();
break;
case 11:
$this->procRankRaceArray(1);
break;
case 12:
$this->procRankRaceArray(2);
break;
case 13:
$this->procRankRaceArray(3);
break;
case 31:
$this->procAttRankArray();
break;
case 32:
$this->procDefRankArray();
break;
case 2:
$this->procVRankArray();
$this->getStart($this->searchRank($village->wid, "wref"));
break;
case 4:
$this->procARankArray();
if($session->alliance == 0) {
$this->getStart(1);
} else {
$this->getStart($this->searchRank($session->alliance, "id"));
$oldrank = $this->searchRank($session->alliance, "id");
public function procRankReq($get) {
global $village, $session, $database;
if(isset($get['id'])) {
switch($get['id']) {
case 1:
$this->procRankArray();
break;
case 8:
$this->procHeroRankArray();
break;
case 11:
$this->procRankRaceArray(1);
break;
case 12:
$this->procRankRaceArray(2);
break;
case 13:
$this->procRankRaceArray(3);
break;
case 31:
$this->procAttRankArray();
break;
case 32:
$this->procDefRankArray();
break;
case 2:
$this->procVRankArray();
$this->getStart($this->searchRank($village->wid, "wref"));
break;
case 4:
$this->procARankArray();
if($session->alliance == 0) {
$this->getStart(1);
} else {
$this->getStart($this->searchRank($session->alliance, "id"));
$oldrank = $this->searchRank($session->alliance, "id");
$ally = $database->getAlliance($session->alliance);
if($ally['oldrank'] > $oldrank) {
$totalpoints = $ally['oldrank'] - $oldrank;
$database->addclimberrankpopAlly($ally['id'], $totalpoints);
$database->updateoldrankAlly($ally['id'], $oldrank);
} else
if($ally['oldrank'] < $oldrank) {
$totalpoints = $oldrank - $ally['oldrank'];
$database->removeclimberrankpopAlly($ally['id'], $totalpoints);
$database->updateoldrankAlly($ally['id'], $oldrank);
}
$database->updateoldrankAlly($ally['id'], $oldrank);
}
break;
case 41:
$this->procAAttRankArray();
if($session->alliance == 0) {
$this->getStart(1);
} else {
$this->getStart($this->searchRank($session->alliance, "id"));
}
break;
case 42:
$this->procADefRankArray();
if($session->alliance == 0) {
$this->getStart(1);
} else {
$this->getStart($this->searchRank($session->alliance, "id"));
}
break;
}
} else {
$this->procRankArray();
$this->getStart($this->searchRank($session->username, "username"));
$oldrank = $this->searchRank($session->username, "username");
if($session->oldrank > $oldrank) {
$totalpoints = $session->oldrank - $oldrank;
$database->addclimberrankpop($session->uid, $totalpoints);
$database->updateoldrank($session->uid, $oldrank);
} else
if($session->oldrank < $oldrank) {
$totalpoints = $oldrank - $session->oldrank;
$database->removeclimberrankpop($session->uid, $session->oldrank);
$database->updateoldrank($session->uid, $oldrank);
}
$database->updateoldrank($session->uid, $oldrank);
}
}
$ally = $database->getAlliance($session->alliance);
if($ally['oldrank'] > $oldrank) {
$totalpoints = $ally['oldrank'] - $oldrank;
$database->addclimberrankpopAlly($ally['id'], $totalpoints);
$database->updateoldrankAlly($ally['id'], $oldrank);
} else
if($ally['oldrank'] < $oldrank) {
$totalpoints = $oldrank - $ally['oldrank'];
$database->removeclimberrankpopAlly($ally['id'], $totalpoints);
$database->updateoldrankAlly($ally['id'], $oldrank);
}
$database->updateoldrankAlly($ally['id'], $oldrank);
}
break;
case 41:
$this->procAAttRankArray();
if($session->alliance == 0) {
$this->getStart(1);
} else {
$this->getStart($this->searchRank($session->alliance, "id"));
}
break;
case 42:
$this->procADefRankArray();
if($session->alliance == 0) {
$this->getStart(1);
} else {
$this->getStart($this->searchRank($session->alliance, "id"));
}
break;
}
} else {
$this->procRankArray();
$this->getStart($this->searchRank($session->username, "username"));
$oldrank = $this->searchRank($session->username, "username");
if($session->oldrank > $oldrank) {
$totalpoints = $session->oldrank - $oldrank;
$database->addclimberrankpop($session->uid, $totalpoints);
$database->updateoldrank($session->uid, $oldrank);
} else
if($session->oldrank < $oldrank) {
$totalpoints = $oldrank - $session->oldrank;
$database->removeclimberrankpop($session->uid, $session->oldrank);
$database->updateoldrank($session->uid, $oldrank);
}
$database->updateoldrank($session->uid, $oldrank);
}
}
public function procRank($post) {
if(isset($post['ft'])) {
switch($post['ft']) {
case "r1":
case "r31":
case "r32":
if(isset($post['rank']) && $post['rank'] != "") {
$this->getStart($post['rank']);
}
if(isset($post['name']) && $post['name'] != "") {
$this->getStart($this->searchRank($post['name'], "username"));
}
break;
case "r2":
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($post['name'], "name"));
}
break;
}
}
}
public function procRank($post) {
if(isset($post['ft'])) {
switch($post['ft']) {
case "r1":
case "r31":
case "r32":
if(isset($post['rank']) && $post['rank'] != "") {
$this->getStart($post['rank']);
}
if(isset($post['name']) && $post['name'] != "") {
$this->getStart($this->searchRank($post['name'], "username"));
}
break;
case "r2":
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($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;
}
}
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($this->rankarray[$key]["id"] == $id) {
return $key;
break;
} else {
if(!next($this->rankarray)) {
return false;
break;
}
}
} else {
return 1;
}
}
}
public function getAllianceRank($id) {
$this->procARankArray();
while(1) {
if(count($this->rankarray) > 1) {
$key = key($this->rankarray);
if($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);
if($this->rankarray[$key][$field] == $name) {
return $key;
break;
} else {
if(!next($this->rankarray)) {
return $name;
break;
}
}
}
}
public function searchRank($name, $field) {
while(1) {
$key = key($this->rankarray);
if($this->rankarray[$key][$field] == $name) {
return $key;
break;
} else {
if(!next($this->rankarray)) {
return $name;
break;
}
}
}
}
private function procRankArray() {
global $database, $multisort;
//$array = $database->getRanking();
$holder = array();
//$value['totalvillage'] = count($database->getVillagesID($value['id']));
//$value['totalvillage'] = count($database->getVillagesID($value['id']));
//$value['totalpop'] = $database->getVSumField($value['id'],"pop");
//$value['aname'] = $database->getAllianceName($value['alliance']);
$q = "SELECT " . TB_PREFIX . "users.id userid, " . TB_PREFIX . "users.username username," . TB_PREFIX . "users.alliance alliance, (
private function procRankArray() {
global $database, $multisort;
//$array = $database->getRanking();
$holder = array();
//$value['totalvillage'] = count($database->getVillagesID($value['id']));
//$value['totalvillage'] = count($database->getVillagesID($value['id']));
//$value['totalpop'] = $database->getVSumField($value['id'],"pop");
//$value['aname'] = $database->getAllianceName($value['alliance']);
$q = "SELECT " . TB_PREFIX . "users.id userid, " . 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 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 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") . "
ORDER BY totalpop DESC, totalvillages DESC, username ASC";
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") . "
ORDER BY totalpop DESC, totalvillages DESC, username ASC";
$result = (mysql_query($q));
while($row = mysql_fetch_assoc($result)) {
$datas[] = $row;
}
$result = (mysql_query($q));
while($row = mysql_fetch_assoc($result)) {
$datas[] = $row;
}
foreach($datas as $result) {
//$value = $array[$result['userid']];
$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);
}
foreach($datas as $result) {
//$value = $array[$result['userid']];
$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);
}
//$holder = $multisort->sorte($holder, "'totalvillage'", false, 2, "'totalpop'", false, 2);
$newholder = array("pad");
foreach($holder as $key) {
array_push($newholder, $key);
}
$this->rankarray = $newholder;
}
//$holder = $multisort->sorte($holder, "'totalvillage'", false, 2, "'totalpop'", false, 2);
$newholder = array("pad");
foreach($holder as $key) {
array_push($newholder, $key);
}
$this->rankarray = $newholder;
}
private function procRankRaceArray($race) {
global $database, $multisort;
//$array = $database->getRanking();
$holder = array();
//$value['totalvillage'] = count($database->getVillagesID($value['id']));
//$value['totalvillage'] = count($database->getVillagesID($value['id']));
//$value['totalpop'] = $database->getVSumField($value['id'],"pop");
//$value['aname'] = $database->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, (
private function procRankRaceArray($race) {
global $database, $multisort;
//$array = $database->getRanking();
$holder = array();
//$value['totalvillage'] = count($database->getVillagesID($value['id']));
//$value['totalvillage'] = count($database->getVillagesID($value['id']));
//$value['totalpop'] = $database->getVSumField($value['id'],"pop");
//$value['aname'] = $database->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 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 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") . "
ORDER BY totalpop DESC, totalvillages DESC, username ASC";
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") . "
ORDER BY totalpop DESC, totalvillages DESC, username ASC";
$result = (mysql_query($q));
while($row = mysql_fetch_assoc($result)) {
$datas[] = $row;
}
$result = (mysql_query($q));
while($row = mysql_fetch_assoc($result)) {
$datas[] = $row;
}
if(mysql_num_rows($result)) {
if(mysql_num_rows($result)) {
foreach($datas as $result) {
//$value = $array[$result['userid']];
$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;
}
foreach($datas as $result) {
//$value = $array[$result['userid']];
$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;
}
private function procAttRankArray() {
global $database, $multisort;
//$array = $database->getRanking();
$holder = array();
private function procAttRankArray() {
global $database, $multisort;
//$array = $database->getRanking();
$holder = array();
//$value['totalvillage'] = count($database->getVillagesID($value['id']));
//$value['totalpop'] = $database->getVSumField($value['id'],"pop");
$q = "SELECT " . TB_PREFIX . "users.id userid, " . TB_PREFIX . "users.username username, " . TB_PREFIX . "users.apall, (
//$value['totalvillage'] = count($database->getVillagesID($value['id']));
//$value['totalpop'] = $database->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 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
ORDER BY " . TB_PREFIX . "users.apall DESC, pop DESC, username ASC";
$result = mysql_query($q) or die(mysql_error());
while($row = mysql_Fetch_assoc($result)) {
$datas[] = $row;
}
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
ORDER BY " . TB_PREFIX . "users.apall DESC, pop DESC, username ASC";
$result = mysql_query($q) or die(mysql_error());
while($row = mysql_Fetch_assoc($result)) {
$datas[] = $row;
}
foreach($datas as $key => $row) {
//$value = $array[$row['userid']];
$value['username'] = $row['username'];
$value['totalvillages'] = $row['totalvillages'];
//$value['totalvillage'] = $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']);
}
foreach($datas as $key => $row) {
//$value = $array[$row['userid']];
$value['username'] = $row['username'];
$value['totalvillages'] = $row['totalvillages'];
//$value['totalvillage'] = $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;
}
//$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;
}
private function procDefRankArray() {
//global $database, $multisort;
//$array = $database->getRanking();
$holder = array();
$q = "SELECT " . TB_PREFIX . "users.id userid, " . TB_PREFIX . "users.username username, " . TB_PREFIX . "users.dpall, (
private function procDefRankArray() {
//global $database, $multisort;
//$array = $database->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 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") . "
ORDER BY " . TB_PREFIX . "users.dpall DESC, pop DESC, username ASC";
$result = mysql_query($q) or die(mysql_error());
while($row = mysql_Fetch_assoc($result)) {
$datas[] = $row;
}
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") . "
ORDER BY " . TB_PREFIX . "users.dpall DESC, pop DESC, username ASC";
$result = mysql_query($q) or die(mysql_error());
while($row = mysql_Fetch_assoc($result)) {
$datas[] = $row;
}
foreach($datas as $key => $row) {
//$value = $array[$row['userid']];
$value['username'] = $row['username'];
$value['totalvillages'] = $row['totalvillages'];
//$value['totalvillage'] = $row['totalvillages'];
$value['id'] = $row['userid'];
$value['totalpop'] = $row['pop'];
$value['dpall'] = $row['dpall'];
array_push($holder, $value);
foreach($datas as $key => $row) {
//$value = $array[$row['userid']];
$value['username'] = $row['username'];
$value['totalvillages'] = $row['totalvillages'];
//$value['totalvillage'] = $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;
}
//$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;
}
private function procVRankArray() {
global $database, $multisort;
$array = $database->getVRanking();
$holder = array();
foreach($array as $value) {
$coor = $database->getCoor($value['wref']);
$value['x'] = $coor['x'];
$value['y'] = $coor['y'];
$value['user'] = $database->getUserField($value['owner'], "username", 0);
private function procVRankArray() {
global $database, $multisort;
$array = $database->getVRanking();
$holder = array();
foreach($array as $value) {
$coor = $database->getCoor($value['wref']);
$value['x'] = $coor['x'];
$value['y'] = $coor['y'];
$value['user'] = $database->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;
}
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;
}
private function procARankArray() {
global $database, $multisort;
$array = $database->getARanking();
$holder = array();
private function procARankArray() {
global $database, $multisort;
$array = $database->getARanking();
$holder = array();
foreach($array as $value) {
$memberlist = $database->getAllMember($value['id']);
$totalpop = 0;
foreach($memberlist as $member) {
$totalpop += $database->getVSumField($member['id'], "pop");
}
$value['players'] = count($memberlist);
$value['totalpop'] = $totalpop;
if(!isset($value['avg'])) {
$value['avg'] = @round($totalpop / count($memberlist));
} else {
$value['avg'] = 0;
}
foreach($array as $value) {
$memberlist = $database->getAllMember($value['id']);
$totalpop = 0;
foreach($memberlist as $member) {
$totalpop += $database->getVSumField($member['id'], "pop");
}
$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;
}
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;
}
private function procHeroRankArray() {
global $database, $multisort;
$array = $database->getHeroRanking();
$holder = array();
foreach($array as $value) {
$value['owner'] = $database->getUserField($value['uid'], "username", 0);
$value['level'];
$value['uid'];
private function procHeroRankArray() {
global $database, $multisort;
$array = $database->getHeroRanking();
$holder = array();
foreach($array as $value) {
$value['owner'] = $database->getUserField($value['uid'], "username", 0);
$value['level'];
$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;
}
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;
}
private function procAAttRankArray() {
global $database, $multisort;
$array = $database->getARanking();
$holder = array();
foreach($array as $value) {
$memberlist = $database->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;
}
private function procAAttRankArray() {
global $database, $multisort;
$array = $database->getARanking();
$holder = array();
foreach($array as $value) {
$memberlist = $database->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, "'totalap'", false, 2);
$newholder = array("pad");
foreach($holder as $key) {
array_push($newholder, $key);
}
$this->rankarray = $newholder;
}
array_push($holder, $value);
}
$holder = $multisort->sorte($holder, "'totalap'", false, 2);
$newholder = array("pad");
foreach($holder as $key) {
array_push($newholder, $key);
}
$this->rankarray = $newholder;
}
private function procADefRankArray() {
global $database, $multisort;
$array = $database->getARanking();
$holder = array();
foreach($array as $value) {
$memberlist = $database->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;
}
private function procADefRankArray() {
global $database, $multisort;
$array = $database->getARanking();
$holder = array();
foreach($array as $value) {
$memberlist = $database->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, "'totaldp'", false, 2);
$newholder = array("pad");
foreach($holder as $key) {
array_push($newholder, $key);
}
$this->rankarray = $newholder;
}
}
;
array_push($holder, $value);
}
$holder = $multisort->sorte($holder, "'totaldp'", false, 2);
$newholder = array("pad");
foreach($holder as $key) {
array_push($newholder, $key);
}
$this->rankarray = $newholder;
}
}
;
$ranking = new Ranking;
$ranking = new Ranking;
?>
+135 -138
View File
@@ -38,164 +38,161 @@ include ("Profile.php");
class Session {
private $time;
var $logged_in = false;
var $referrer, $url;
var $username, $uid, $access, $plus, $tribe, $isAdmin, $alliance, $gold, $oldrank, $gpack;
var $bonus = 0;
var $bonus1 = 0;
var $bonus2 = 0;
var $bonus3 = 0;
var $bonus4 = 0;
var $checker, $mchecker;
public $userinfo = array();
private $userarray = array();
var $villages = array();
private $time;
var $logged_in = false;
var $referrer, $url;
var $username, $uid, $access, $plus, $tribe, $isAdmin, $alliance, $gold, $oldrank, $gpack;
var $bonus = 0;
var $bonus1 = 0;
var $bonus2 = 0;
var $bonus3 = 0;
var $bonus4 = 0;
var $checker, $mchecker;
public $userinfo = array();
private $userarray = array();
var $villages = array();
function Session() {
$this->time = time();
session_start();
function Session() {
$this->time = time();
session_start();
$this->logged_in = $this->checkLogin();
$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();
}
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;
$_SESSION['checker'] = $generator->generateRandStr(3);
$_SESSION['mchecker'] = $generator->generateRandStr(5);
$_SESSION['qst'] = $database->getUserField($_SESSION['username'], "quest", 1);
if(!isset($_SESSION['wid'])) {
$query = mysql_query('SELECT * FROM `' . TB_PREFIX . 'vdata` WHERE `owner` = ' . $database->getUserField($_SESSION['username'], "id", 1) . ' LIMIT 1');
$data = mysql_fetch_assoc($query);
$_SESSION['wid'] = $data['wref'];
} else
if($_SESSION['wid'] == '') {
$query = mysql_query('SELECT * FROM `' . TB_PREFIX . 'vdata` WHERE `owner` = ' . $database->getUserField($_SESSION['username'], "id", 1) . ' LIMIT 1');
$data = mysql_fetch_assoc($query);
$_SESSION['wid'] = $data['wref'];
}
$this->PopulateVar();
public function Login($user) {
global $database, $generator, $logging;
$this->logged_in = true;
$_SESSION['sessid'] = $generator->generateRandID();
$_SESSION['username'] = $user;
$_SESSION['checker'] = $generator->generateRandStr(3);
$_SESSION['mchecker'] = $generator->generateRandStr(5);
$_SESSION['qst'] = $database->getUserField($_SESSION['username'], "quest", 1);
if(!isset($_SESSION['wid'])) {
$query = mysql_query('SELECT * FROM `' . TB_PREFIX . 'vdata` WHERE `owner` = ' . $database->getUserField($_SESSION['username'], "id", 1) . ' LIMIT 1');
$data = mysql_fetch_assoc($query);
$_SESSION['wid'] = $data['wref'];
} else
if($_SESSION['wid'] == '') {
$query = mysql_query('SELECT * FROM `' . TB_PREFIX . 'vdata` WHERE `owner` = ' . $database->getUserField($_SESSION['username'], "id", 1) . ' LIMIT 1');
$data = mysql_fetch_assoc($query);
$_SESSION['wid'] = $data['wref'];
}
$this->PopulateVar();
$logging->addLoginLog($this->uid, $_SERVER['REMOTE_ADDR']);
$database->addActiveUser($_SESSION['username'], $this->time);
$database->updateUserField($_SESSION['username'], "sessid", $_SESSION['sessid'], 0);
$logging->addLoginLog($this->uid, $_SERVER['REMOTE_ADDR']);
$database->addActiveUser($_SESSION['username'], $this->time);
$database->updateUserField($_SESSION['username'], "sessid", $_SESSION['sessid'], 0);
header("Location: dorf1.php");
}
header("Location: dorf1.php");
}
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 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);
}
public function changeChecker() {
global $generator;
$this->checker = $_SESSION['checker'] = $generator->generateRandStr(3);
$this->mchecker = $_SESSION['mchecker'] = $generator->generateRandStr(5);
}
private function checkLogin(){
global $database;
if(isset($_SESSION['username']) && isset($_SESSION['sessid'])) {
if(!$database->checkActiveSession($_SESSION['username'], $_SESSION['sessid'])) {
$this->Logout();
return false;
} else {
//Get and Populate Data
$this->PopulateVar();
//update database
$database->addActiveUser($_SESSION['username'], $this->time);
$database->updateUserField($_SESSION['username'], "timestamp", $this->time, 0);
return true;
}
} else {
return false;
}
}
private function checkLogin(){
global $database;
if(isset($_SESSION['username']) && isset($_SESSION['sessid'])) {
if(!$database->checkActiveSession($_SESSION['username'], $_SESSION['sessid'])) {
$this->Logout();
return false;
} else {
//Get and Populate Data
$this->PopulateVar();
//update database
$database->addActiveUser($_SESSION['username'], $this->time);
$database->updateUserField($_SESSION['username'], "timestamp", $this->time, 0);
return true;
}
} else {
return false;
}
}
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);
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->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'];
$_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;
}
}
$this->gold = $this->userarray['gold'];
$this->oldrank = $this->userarray['oldrank'];
$_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;
}
}
private function SurfControl(){
if(SERVER_WEB_ROOT) {
$page = $_SERVER['SCRIPT_NAME'];
} else {
$explode = explode("/", $_SERVER['SCRIPT_NAME']);
$i = count($explode) - 1;
$page = $explode[$i];
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");
}
} else {
if(in_array($page, $pagearray)) {
header("Location: dorf1.php");
}
}
$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");
}
} else {
if(in_array($page, $pagearray)) {
header("Location: dorf1.php");
}
}
}
}
}
};
$session = new Session;
$form = new Form;
$message = new Message;
?>
+137 -137
View File
@@ -11,8 +11,8 @@
#################################################################################
class Technology {
public $unarray = array(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 $unarray = array(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;
@@ -24,7 +24,7 @@ class Technology {
}
return $holder;
}
public function getABUpgrades($type='a') {
global $village;
$holder = array();
@@ -35,7 +35,7 @@ class Technology {
}
return $holder;
}
public function isResearch($tech,$type) {
global $village;
if(count($village->researching) == 0) {
@@ -55,7 +55,7 @@ class Technology {
return false;
}
}
public function procTech($post) {
if(isset($post['ft'])) {
switch($post['ft']) {
@@ -68,7 +68,7 @@ class Technology {
}
}
}
public function procTechno($get) {
global $village;
if(isset($get['a'])) {
@@ -85,11 +85,11 @@ class Technology {
}
}
}
public function getTrainingList($type) {
global $database,$village;
$trainingarray = $database->getTraining($village->wid);
$listarray = array();
$listarray = array();
$barracks = array(1,2,3,11,12,13,14,21,22,31,32,33,34,41,42,43,44);
$greatbarracks = array(61,62,63,71,72,73,84,81,82,91,92,93,94,101,102,103,104);
$stables = array(4,5,6,15,16,23,24,25,26,35,36,45,46);
@@ -139,7 +139,7 @@ class Technology {
}
return $listarray;
}
public function getUnitList() {
global $database,$village;
$unitarray = func_num_args() == 1? $database->getUnit(func_get_arg(0)) : $village->unitall;
@@ -153,14 +153,14 @@ class Technology {
array_push($listArray,$holder);
}
}if($unitarray['hero'] != 0 && $unitarray['hero'] != "") {
$holder['id'] = "hero";
$holder['name'] = $this->unarray[$i];
$holder['amt'] = $unitarray['hero'];
array_push($listArray,$holder);
}
$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;
@@ -182,19 +182,19 @@ class Technology {
$popcalc = floor($village->getProd("crop")/$unitarray['pop']);
return min($woodcalc,$claycalc,$ironcalc,$cropcalc);
}
public function maxUnitPlus($unit,$great=false) {
$unit = "u".$unit;
global $village,$$unit;
$unitarray = $$unit;
$res = array();
$res = mysql_fetch_assoc(mysql_query("SELECT maxstore, maxcrop, wood, clay, iron, crop FROM ".TB_PREFIX."vdata WHERE wref = ".$village->wid)) or die(mysql_error());
$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 maxUnitPlus($unit,$great=false) {
$unit = "u".$unit;
global $village,$$unit;
$unitarray = $$unit;
$res = array();
$res = mysql_fetch_assoc(mysql_query("SELECT maxstore, maxcrop, wood, clay, iron, crop FROM ".TB_PREFIX."vdata WHERE wref = ".$village->wid)) or die(mysql_error());
$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) {
@@ -211,7 +211,7 @@ class Technology {
}
return $ownunit;
}
function getAllUnits($base,$InVillageOnly=False) {
global $database;
$ownunit = $database->getUnit($base);
@@ -236,8 +236,8 @@ class Technology {
}
}
return $ownunit;
}
}
public function meetTRequirement($unit) {
global $session;
switch($unit) {
@@ -274,7 +274,7 @@ class Technology {
case 21:
if($session->tribe == 3) { return true; } else { return false; }
break;
case 22:
case 22:
case 23:
case 24:
case 25:
@@ -286,50 +286,50 @@ class Technology {
case 30:
if($session->tribe == 3) { return true; } else { return false; }
break;
case 31:
if($session->tribe == 4) { return true; } else { return false; }
break;
case 32:
case 33:
case 34:
case 35:
case 36:
case 37:
case 38:
if($session->tribe == 4 && $this->getTech($unit)) { return true; } else { return false; }
break;
case 40:
if($session->tribe == 4) { return true; } else { return false; }
break;
case 41:
if($session->tribe == 5) { return true; } else { return false; }
break;
case 42:
case 43:
case 44:
case 45:
case 46:
case 47:
case 48:
if($session->tribe == 5 && $this->getTech($unit)) { return true; } else { return false; }
break;
case 50:
if($session->tribe == 5) { return true; } else { return false; }
break;
case 31:
if($session->tribe == 4) { return true; } else { return false; }
break;
case 32:
case 33:
case 34:
case 35:
case 36:
case 37:
case 38:
if($session->tribe == 4 && $this->getTech($unit)) { return true; } else { return false; }
break;
case 40:
if($session->tribe == 4) { return true; } else { return false; }
break;
case 41:
if($session->tribe == 5) { return true; } else { return false; }
break;
case 42:
case 43:
case 44:
case 45:
case 46:
case 47:
case 48:
if($session->tribe == 5 && $this->getTech($unit)) { return true; } else { return false; }
break;
case 50:
if($session->tribe == 5) { return true; } else { return false; }
break;
}
}
public function getTech($tech) {
global $village;
return ($village->techarray['t'.$tech] == 1);
}
private function procTrain($post,$great=false) {
global $session;
if($session->access != BANNED){
$start = ($session->tribe-1)*10+1;
$end = ($session->tribe*10);
for($i=$start;$i<=($end);$i++) {
$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 = $post['t'.$i];
$amt = intval($amt);
@@ -350,7 +350,7 @@ class Technology {
header("Location: banned.php");
}
}
public function getUpkeep($array,$type,$vid=0) {
global $database,$session,$village;
if($vid==0) { $vid=$village->wid; }
@@ -378,17 +378,17 @@ class Technology {
$start = 31;
$end = 40;
break;
case 5:
$start = 41;
$end = 50;
break;
}
case 5:
$start = 41;
$end = 50;
break;
}
for($i=$start;$i<=$end;$i++) {
$unit = "u".$i;
global $$unit;
$dataarray = $$unit;
for($j=19;$j<=38;$j++) {
if($buildarray['f'.$j.'t'] == 41) {
if($buildarray['f'.$j.'t'] == 41) {
$horsedrinking = $j;
}
}
@@ -403,9 +403,9 @@ class Technology {
$upkeep += $dataarray['pop'] * $array[$unit];
}
}
// $unit = "hero";
// global $$unit;
// $dataarray = $$unit;
// $unit = "hero";
// global $$unit;
// $dataarray = $$unit;
$upkeep += $array['hero'] * 6;
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,4,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($vid,4,1,1));
@@ -425,45 +425,45 @@ class Technology {
}
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 = array(1,2,3,11,12,13,14,21,22,31,32,33,34,41,42,43,44);
$calvary = array(4,5,6,15,16,23,24,25,26,35,36,45,46);
$workshop = array(7,8,17,18,27,28,37,38,47,48);
$special = array(9,10,19,20,29,30,39,40,49,50);
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 = array(1,2,3,11,12,13,14,21,22,31,32,33,34,41,42,43,44);
$calvary = array(4,5,6,15,16,23,24,25,26,35,36,45,46);
$workshop = array(7,8,17,18,27,28,37,38,47,48);
$special = array(9,10,19,20,29,30,39,40,49,50);
$trapper = array(99);
if(in_array($unit,$footies)) {
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(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(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){
}
if(in_array($unit,$special)) {
if($building->getTypeLevel(25) > 0){
$each = round(($bid25[$building->getTypeLevel(25)]['attri'] / 100) * ${'u'.$unit}['time'] / SPEED);
} else {
} else {
$each = round(($bid26[$building->getTypeLevel(26)]['attri'] / 100) * ${'u'.$unit}['time'] / SPEED);
}
}
if(in_array($unit,$trapper)) {
}
}
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']; }
@@ -483,19 +483,19 @@ private function trainUnit($unit,$amt,$great=false) {
$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);
}
$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);
$each = ($each == 0) ? 1 : $each;
$time = $each*$amt;
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,time()+$time,0);
}
}
}
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,time()+$time,0);
}
}
}
public function meetRRequirement($tech) {
global $session,$building;
switch($tech) {
@@ -515,54 +515,54 @@ private function trainUnit($unit,$amt,$great=false) {
break;
case 6:
if($building->getTypeLevel(22) >= 5 && $building->getTypeLevel(20) >= 10) { return true; } else { return false; }
break;
break;
case 9:
case 29:
if($building->getTypeLevel(22) >= 20 && $building->getTypeLevel(16) >= 10) { return true; } else { return false; }
break;
case 12:
case 32:
case 42:
case 32:
case 42:
if($building->getTypeLevel(22) >= 1 && $building->getTypeLevel(19) >= 3) { return true; } else { return false; }
break;
case 13:
case 33:
case 43:
case 33:
case 43:
if($building->getTypeLevel(22) >= 3 && $building->getTypeLevel(12) >= 1) { return true; } else { return false; }
break;
case 14:
case 34:
case 44:
case 34:
case 44:
if($building->getTypeLevel(22) >= 1 && $building->getTypeLevel(15) >= 5) { return true; } else { return false; }
break;
case 15:
case 35:
case 45:
case 35:
case 45:
if($building->getTypeLevel(22) >= 1 && $building->getTypeLevel(20) >= 3) { return true; } else { return false; }
break;
case 16:
case 26:
case 36:
case 46:
case 36:
case 46:
if($building->getTypeLevel(22) >= 15 && $building->getTypeLevel(20) >= 10) { return true; } else { return false; }
break;
case 7:
case 17:
case 27:
case 37:
case 47:
case 37:
case 47:
if($building->getTypeLevel(22) >= 10 && $building->getTypeLevel(21) >= 1) { return true; } else { return false; }
break;
case 8:
case 18:
case 28:
case 38:
case 48:
case 38:
case 48:
if($building->getTypeLevel(22) >= 15 && $building->getTypeLevel(21) >= 10) { return true; } else { return false; }
break;
case 19:
case 39:
case 49:
case 39:
case 49:
if($building->getTypeLevel(22) >= 20 && $building->getTypeLevel(16) >= 5) { return true; } else { return false; }
break;
case 22:
@@ -573,7 +573,7 @@ private function trainUnit($unit,$amt,$great=false) {
break;
}
}
private function researchTech($get) {
//global $database,$session,${'r'.$get['a']},$village,$logging;
global $database,$session,${'r'.$get['a']},$bid22,$building,$village,$logging;
@@ -588,7 +588,7 @@ private function trainUnit($unit,$amt,$great=false) {
$session->changeChecker();
header("Location: build.php?id=".$get['id']);
}
private function upgradeSword($get) {
global $database,$session,$bid12,$building,$village,$logging;
$ABTech = $database->getABTech($village->wid);
@@ -606,7 +606,7 @@ private function trainUnit($unit,$amt,$great=false) {
$session->changeChecker();
header("Location: build.php?id=".$get['id']);
}
private function upgradeArmour($get) {
global $database,$session,$bid13,$building,$village,$logging;
$ABTech = $database->getABTech($village->wid);
@@ -624,17 +624,17 @@ private function trainUnit($unit,$amt,$great=false) {
$session->changeChecker();
header("Location: build.php?id=".$get['id']);
}
public function getUnitName($i) {
return $this->unarray[$i];
}
public function finishTech() {
public function finishTech() {
global $database,$village;
$q = "UPDATE ".TB_PREFIX."research SET timestamp=".(time()-1)." WHERE vref = ".$village->wid;
$database->query($q);
}
}
public function calculateAvaliable($id,$resarray=array()) {
global $village,$generator,${'r'.$id};
if(count($resarray)==0) {
@@ -651,7 +651,7 @@ private function trainUnit($unit,$amt,$great=false) {
$reqtime = max($rwtime,$rcltime,$ritime,$rctime) + time();
} else {
$reqtime = max($rwtime,$rcltime,$ritime);
if($reqtime > $rctime) {
if($reqtime > $rctime) {
$reqtime = 0;
} else {
$reqtime += time();
@@ -669,12 +669,12 @@ private function trainUnit($unit,$amt,$great=false) {
$fail='1';
}
}
if($fail==0){
if($fail==0){
$database->deleteReinf($id);
}
}
}
$technology = new Technology;
?>
?>
+160 -160
View File
@@ -15,52 +15,52 @@ class Units {
public function procUnits($post) {
if(isset($post['c'])) {
switch($post['c']) {
case "1":
if (isset($post['a'])&& $post['a']==533374){
$this->sendTroops($post);
}else{
$post = $this->loadUnits($post);
return $post;
return $post;
}
break;
case "2":
if (isset($post['a'])&& $post['a']==533374 && $post['disabledr'] == ""){
$this->sendTroops($post);
}else{
$post = $this->loadUnits($post);
return $post;
return $post;
}
break;
break;
case "8":
$this->sendTroopsBack($post);
break;
break;
case "3":
if (isset($post['a'])&& $post['a']==533374 && $post['disabled'] == ""){
$this->sendTroops($post);
}else{
$post = $this->loadUnits($post);
return $post;
return $post;
}
break;
case "4":
if (isset($post['a'])&& $post['a']==533374){
$this->sendTroops($post);
}else{
$post = $this->loadUnits($post);
return $post;
return $post;
}
case "5":
if (isset($post['a'])&& $post['a']== "new"){
$this->Settlers($post);
}else{
$post = $this->loadUnits($post);
return $post;
return $post;
}
break;
}
@@ -76,7 +76,7 @@ class Units {
$oid = $database->getVillageByName(stripslashes($post['dname']));
}
if($database->isVillageOases($oid) != 0){
$too = $database->getOasisField($oid,"conqured");
$too = $database->getOasisField($oid,"conqured");
if($too['conqured'] == 0){$disabledr ="disabled=disabled"; $disabled ="disabled=disabled";}else{
$disabledr ="";
if($session->sit == 0){
@@ -94,30 +94,30 @@ class Units {
}
}
if($disabledr != "" && $post['c'] == 2){
$form->addError("error","You can't reinforce this village/oasis");
$form->addError("error","You can't reinforce this village/oasis");
}
if($disabled != "" && $post['c'] == 3){
$form->addError("error","You can't attack this village/oasis with normal attack");
$form->addError("error","You can't attack this village/oasis with normal attack");
}
if( !$post['t1'] && !$post['t2'] && !$post['t3'] && !$post['t4'] && !$post['t5'] &&
if( !$post['t1'] && !$post['t2'] && !$post['t3'] && !$post['t4'] && !$post['t5'] &&
!$post['t6'] && !$post['t7'] && !$post['t8'] && !$post['t9'] && !$post['t10'] && !$post['t11']){
$form->addError("error","You need to mark min. one troop");
}
if(!$post['dname'] && !$post['x'] && !$post['y']){
$form->addError("error","Insert name or coordinates");
$form->addError("error","You need to mark min. one troop");
}
if(!$post['dname'] && !$post['x'] && !$post['y']){
$form->addError("error","Insert name or coordinates");
}
if(isset($post['dname']) && $post['dname'] != "") {
$id = $database->getVillageByName(stripslashes($post['dname']));
if (!isset($id)){
if (!isset($id)){
$form->addError("error","Village do not exist");
}else{
$coor = $database->getCoor($id);
}
}
// Busqueda por coordenadas de pueblo
// Confirmamos y buscamos las coordenadas por coordenadas de pueblo
// Confirmamos y buscamos las coordenadas por coordenadas de pueblo
if(isset($post['x']) && isset($post['y']) && $post['x'] != "" && $post['y'] != "") {
$coor = array('x'=>$post['x'], 'y'=>$post['y']);
$id = $generator->getBaseID($coor['x'],$coor['y']);
@@ -129,38 +129,38 @@ class Units {
{
if(isset($post['t'.$i]))
{
if ($post['t'.$i] > $village->unitarray['u'.$Gtribe.$i])
{
$form->addError("error","You can't send more units than you have");
break;
}
if($post['t'.$i]<0)
{
$form->addError("error","You can't send negative units.");
break;
}
}
}
}
if ($post['t11'] > $village->unitarray['hero'])
{
$form->addError("error","You can't send more units than you have");
break;
}
if($post['t11']<0)
{
$form->addError("error","You can't send negative units.");
break;
}
if ($post['t11'] > $village->unitarray['hero'])
{
$form->addError("error","You can't send more units than you have");
break;
}
if($post['t11']<0)
{
$form->addError("error","You can't send negative units.");
break;
}
}
if ($database->isVillageOases($id) == 0) {
if ($database->isVillageOases($id) == 0) {
if($database->hasBeginnerProtection($id)==1) {
$form->addError("error","Player is under beginners protection. You can't attack him");
}
$form->addError("error","Player is under beginners protection. You can't attack him");
}
//check if banned:
$villageOwner = $database->getVillageField($id,'owner');
$userAccess = $database->getUserField($villageOwner,'access',0);
@@ -175,7 +175,7 @@ class Units {
$form->addError("error","Player is Admin. You can't attack him");
//break;
}
//check if attacking same village that units are in
if($id == $village->wid){
$form->addError("error","You cant attack same village you are sending from.");
@@ -185,107 +185,107 @@ class Units {
if($form->returnErrors() > 0) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $_POST;
header("Location: a2b.php");
}else{
// Debemos devolver un array con $post, que contiene todos los datos mas
header("Location: a2b.php");
}else{
// Debemos devolver un array con $post, que contiene todos los datos mas
// otra variable que definira que el flag esta levantado y se va a enviar y el tipo de envio
$villageName = $database->getVillageField($id,'name');
$speed= 300;
$timetaken = $generator->procDistanceTime($coor,$village->coor,INCREASE_SPEED,1);
$timetaken = $generator->procDistanceTime($coor,$village->coor,INCREASE_SPEED,1);
array_push($post, "$id", "$villageName", "$villageOwner","$timetaken");
return $post;
}
}else{
if($form->returnErrors() > 0) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $_POST;
header("Location: a2b.php");
}else{
$villageName = "Unoccupied Oasis";
$speed= 300;
$timetaken = $generator->procDistanceTime($coor,$village->coor,INCREASE_SPEED,1);
array_push($post, "$id", "$villageName", "2","$timetaken");
return $post;
}
}
}
}else{
if($form->returnErrors() > 0) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $_POST;
header("Location: a2b.php");
}else{
$villageName = "Unoccupied Oasis";
$speed= 300;
$timetaken = $generator->procDistanceTime($coor,$village->coor,INCREASE_SPEED,1);
array_push($post, "$id", "$villageName", "2","$timetaken");
return $post;
}
}
}
private function sendTroops($post) {
global $form, $database, $village, $generator, $session;
$data = $database->getA2b($post['timestamp_checksum'], $post['timestamp']);
$Gtribe = "";
if ($session->tribe == '2'){ $Gtribe = "1"; } else if ($session->tribe == '3'){ $Gtribe = "2"; }else if ($session->tribe == '4'){ $Gtribe = "3"; }else if ($session->tribe == '5'){ $Gtribe = "4"; }
for($i=1; $i<10; $i++){
if(isset($data['u'.$i])){
if ($data['u'.$i] > $village->unitarray['u'.$Gtribe.$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");
break;
}
if($data['u11']<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");
break;
}
if($data['u11']<0)
{
$form->addError("error","You can't send negative units.");
break;
}
if($form->returnErrors() > 0) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $_POST;
header("Location: a2b.php");
header("Location: a2b.php");
} else {
if($session->tribe == 1){ $u = ""; } elseif($session->tribe == 2){ $u = "1"; } elseif($session->tribe == 3){ $u = "2"; }elseif($session->tribe == 4){ $u = "3"; }else {$u = "4"; }
$database->modifyUnit(
$village->wid,
array($u."1",$u."2",$u."3",$u."4",$u."5",$u."6",$u."7",$u."8",$u."9",$u.$session->tribe."0","hero"),
array($data['u1'],$data['u2'],$data['u3'],$data['u4'],$data['u5'],$data['u6'],$data['u7'],$data['u8'],$data['u9'],$data['u10'],$data['u11']),
array(0,0,0,0,0,0,0,0,0,0,0)
);
$query1 = mysql_query('SELECT * FROM `' . TB_PREFIX . 'vdata` WHERE `wref` = ' . mysql_escape_string($data['to_vid']));
$data1 = mysql_fetch_assoc($query1);
$query2 = mysql_query('SELECT * FROM `' . TB_PREFIX . 'users` WHERE `id` = ' . $data1['owner']);
$data2 = mysql_fetch_assoc($query2);
$query11 = mysql_query('SELECT * FROM `' . TB_PREFIX . 'vdata` WHERE `wref` = ' . mysql_escape_string($village->wid));
$data11 = mysql_fetch_assoc($query11);
$query21 = mysql_query('SELECT * FROM `' . TB_PREFIX . 'users` WHERE `id` = ' . $data11['owner']);
$data21 = mysql_fetch_assoc($query21);
if($session->tribe == 1){ $u = ""; } elseif($session->tribe == 2){ $u = "1"; } elseif($session->tribe == 3){ $u = "2"; }elseif($session->tribe == 4){ $u = "3"; }else {$u = "4"; }
$database->modifyUnit(
$village->wid,
array($u."1",$u."2",$u."3",$u."4",$u."5",$u."6",$u."7",$u."8",$u."9",$u.$session->tribe."0","hero"),
array($data['u1'],$data['u2'],$data['u3'],$data['u4'],$data['u5'],$data['u6'],$data['u7'],$data['u8'],$data['u9'],$data['u10'],$data['u11']),
array(0,0,0,0,0,0,0,0,0,0,0)
);
$query1 = mysql_query('SELECT * FROM `' . TB_PREFIX . 'vdata` WHERE `wref` = ' . mysql_escape_string($data['to_vid']));
$data1 = mysql_fetch_assoc($query1);
$query2 = mysql_query('SELECT * FROM `' . TB_PREFIX . 'users` WHERE `id` = ' . $data1['owner']);
$data2 = mysql_fetch_assoc($query2);
$query11 = mysql_query('SELECT * FROM `' . TB_PREFIX . 'vdata` WHERE `wref` = ' . mysql_escape_string($village->wid));
$data11 = mysql_fetch_assoc($query11);
$query21 = mysql_query('SELECT * FROM `' . TB_PREFIX . 'users` WHERE `id` = ' . $data11['owner']);
$data21 = mysql_fetch_assoc($query21);
$eigen = $database->getCoor($village->wid);
$from = array('x'=>$eigen['x'], 'y'=>$eigen['y']);
$ander = $database->getCoor($data['to_vid']);
$to = array('x'=>$ander['x'], 'y'=>$ander['y']);
$start = ($data21['tribe']-1)*10+1;
$end = ($data21['tribe']*10);
$start = ($data21['tribe']-1)*10+1;
$end = ($data21['tribe']*10);
$speeds = array();
$scout = 1;
@@ -296,7 +296,7 @@ class Units {
if($unitarray) { reset($unitarray); }
$unitarray = $GLOBALS["u".(($session->tribe-1)*10+$i)];
$speeds[] = $unitarray['speed'];
}
}
}
}
if (isset($data['u11'])) {
@@ -306,7 +306,7 @@ class Units {
$speeds[] = $herodata['speed'];
}
}
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,2,3,0));
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,2,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,2,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,2,2,0));
if($artefact > 0){
@@ -323,26 +323,26 @@ class Units {
$artefact_2 = count($database->getOwnUniqueArtefactInfo2($to_owner,7,3,0));
$artefact1_2 = count($database->getOwnUniqueArtefactInfo2($data['to_vid'],7,1,1));
$artefact2_2 = count($database->getOwnUniqueArtefactInfo2($to_owner,7,2,0));
if (isset($post['ctar1'])){if($artefact_2 > 0 or $artefact1_2 > 0 or $artefact2_2 > 0){$post['ctar1'] = 99;}else{$post['ctar1'] = $post['ctar1'];}}else{ $post['ctar1'] = 0;}
if (isset($post['ctar2'])){if($artefact_2 > 0 or $artefact1_2 > 0 or $artefact2_2 > 0){$post['ctar2'] = 99;}else{$post['ctar2'] = $post['ctar2'];}}else{ $post['ctar2'] = 0;}
if (isset($post['spy'])){$post['spy'] = $post['spy'];}else{ $post['spy'] = 0;}
if (isset($post['ctar1'])){if($artefact_2 > 0 or $artefact1_2 > 0 or $artefact2_2 > 0){$post['ctar1'] = 99;}else{$post['ctar1'] = $post['ctar1'];}}else{ $post['ctar1'] = 0;}
if (isset($post['ctar2'])){if($artefact_2 > 0 or $artefact1_2 > 0 or $artefact2_2 > 0){$post['ctar2'] = 99;}else{$post['ctar2'] = $post['ctar2'];}}else{ $post['ctar2'] = 0;}
if (isset($post['spy'])){$post['spy'] = $post['spy'];}else{ $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']);
$checkexist = $database->checkVilExist($data['to_vid']);
$checkoexist = $database->checkOasisExist($data['to_vid']);
if($checkexist or $checkoexist){
$database->addMovement(3,$village->wid,$data['to_vid'],$reference,time(),($time+time()));
}
if($form->returnErrors() > 0) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $_POST;
header("Location: a2b.php");
}
}
header("Location: build.php?id=39");
}}
private function sendTroopsBack($post) {
global $form, $database, $village, $generator, $session, $technology;
@@ -350,8 +350,8 @@ class Units {
if(($enforce['from']==$village->wid) || ($enforce['vref']==$village->wid)){
$to = $database->getVillage($enforce['from']);
$Gtribe = "";
if ($database->getUserField($to['owner'],'tribe',0) == '2'){ $Gtribe = "1"; } else if ($database->getUserField($to['owner'],'tribe',0) == '3'){ $Gtribe = "2"; } else if ($database->getUserField($to['owner'],'tribe',0) == '4'){ $Gtribe = "3"; }else if ($database->getUserField($to['owner'],'tribe',0) == '5'){ $Gtribe = "4"; }
if ($database->getUserField($to['owner'],'tribe',0) == '2'){ $Gtribe = "1"; } else if ($database->getUserField($to['owner'],'tribe',0) == '3'){ $Gtribe = "2"; } else if ($database->getUserField($to['owner'],'tribe',0) == '4'){ $Gtribe = "3"; }else if ($database->getUserField($to['owner'],'tribe',0) == '5'){ $Gtribe = "4"; }
for($i=1; $i<10; $i++){
if(isset($post['t'.$i])){
if($i!=10){
@@ -360,7 +360,7 @@ class Units {
$form->addError("error","You can't send more units than you have");
break;
}
if($post['t'.$i]<0)
{
$form->addError("error","You can't send negative units.");
@@ -369,7 +369,7 @@ class Units {
}
} else {
$post['t'.$i.'']='0';
}
}
}
if(isset($post['t11'])){
if ($post['t11'] > $enforce['hero'])
@@ -377,7 +377,7 @@ class Units {
$form->addError("error","You can't send more units than you have");
break;
}
if($post['t11']<0)
{
$form->addError("error","You can't send negative units.");
@@ -385,40 +385,40 @@ class Units {
}
} else {
$post['t11']='0';
}
}
if($form->returnErrors() > 0) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $_POST;
header("Location: a2b.php");
header("Location: a2b.php");
} else {
//change units
$start = ($database->getUserField($to['owner'],'tribe',0)-1)*10+1;
$end = ($database->getUserField($to['owner'],'tribe',0)*10);
$j='1';
$start = ($database->getUserField($to['owner'],'tribe',0)-1)*10+1;
$end = ($database->getUserField($to['owner'],'tribe',0)*10);
$j='1';
for($i=$start;$i<=$end;$i++){
$database->modifyEnforce($post['ckey'],$i,$post['t'.$j.''],0); $j++;
}
$database->modifyEnforce($post['ckey'],'hero',$post['t11'],0); $j++;
//get cord
//get cord
$from = $database->getVillage($enforce['from']);
$fromcoor = $database->getCoor($enforce['from']);
$tocoor = $database->getCoor($enforce['vref']);
$fromCor = array('x'=>$tocoor['x'], 'y'=>$tocoor['y']);
$toCor = array('x'=>$fromcoor['x'], 'y'=>$fromcoor['y']);
$speeds = array();
//find slowest unit.
for($i=1;$i<=10;$i++){
if (isset($post['t'.$i])){
if( $post['t'.$i] != '' && $post['t'.$i] > 0){
if($unitarray) { reset($unitarray); }
$unitarray = $GLOBALS["u".(($session->tribe-1)*10+$i)];
$speeds[] = $unitarray['speed'];
} else {
if($unitarray) { reset($unitarray); }
$unitarray = $GLOBALS["u".(($session->tribe-1)*10+$i)];
$speeds[] = $unitarray['speed'];
} else {
$post['t'.$i.'']='0';
}
} else {
@@ -427,18 +427,18 @@ class Units {
}
if (isset($post['t11'])){
if( $post['t11'] != '' && $post['t11'] > 0){
$qh = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = ".$from['owner']."";
$resulth = mysql_query($qh);
$hero_f=mysql_fetch_array($resulth);
$qh = "SELECT * FROM ".TB_PREFIX."hero WHERE uid = ".$from['owner']."";
$resulth = mysql_query($qh);
$hero_f=mysql_fetch_array($resulth);
$hero_unit=$hero_f['unit'];
$speeds[] = $GLOBALS['u'.$hero_unit]['speed'];
} else {
$speeds[] = $GLOBALS['u'.$hero_unit]['speed'];
} else {
$post['t11']='0';
}
} else {
$post['t11']='0';
}
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,2,3,0));
$artefact = count($database->getOwnUniqueArtefactInfo2($session->uid,2,3,0));
$artefact1 = count($database->getOwnUniqueArtefactInfo2($village->wid,2,1,1));
$artefact2 = count($database->getOwnUniqueArtefactInfo2($session->uid,2,2,0));
if($artefact > 0){
@@ -463,37 +463,37 @@ class Units {
if($form->returnErrors() > 0) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $_POST;
header("Location: a2b.php");
header("Location: a2b.php");
}
}
}
public function Settlers($post) {
global $form, $database, $village, $session;
if($session->access != BANNED){
$mode = CP;
$total = count($database->getProfileVillages($session->uid));
$need_cps = ${'cp'.$mode}[$total+1];
$cps = $session->cp;
$mode = CP;
$total = count($database->getProfileVillages($session->uid));
$need_cps = ${'cp'.$mode}[$total+1];
$cps = $session->cp;
$rallypoint = $database->getResourceLevel($village->wid);
if($rallypoint['f39'] > 0){
if($cps >= $need_cps) {
$unit = ($session->tribe*10);
if($cps >= $need_cps) {
$unit = ($session->tribe*10);
$database->modifyResource($village->wid,750,750,750,750,0);
$database->modifyUnit($village->wid,array($unit),array(3),array(0));
$database->addMovement(5,$village->wid,$post['s'],0,time(),time()+$post['timestamp']);
header("Location: build.php?id=39");
if($form->returnErrors() > 0) {
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $_POST;
header("Location: a2b.php");
}
} else {
header("Location: build.php?id=39");
}
} else {
header("Location: build.php?id=39");
}
}else{
header("Location: dorf1.php");
header("Location: dorf1.php");
}
}else{
header("Location: banned.php");
@@ -504,7 +504,7 @@ class Units {
global $database;
$heroarray = $database->getHero($uid);
$herodata = $GLOBALS["h".$heroarray[0]['unit']];
$h_atk = $herodata['atk'] + 5 * floor($heroarray[0]['attack'] * $herodata['atkp'] / 5);
$h_di = $herodata['di'] + 5 * floor($heroarray[0]['defence'] * $herodata['dip'] / 5);
$h_dc = $herodata['dc'] + 5 * floor($heroarray[0]['defence'] * $herodata['dcp'] / 5);
@@ -512,7 +512,7 @@ class Units {
$h_db = 1 + 0.002 * $heroarray[0]['defencebonus'];
return array('heroid'=>$heroarray[0]['heroid'],'unit'=>$heroarray[0]['unit'],'atk'=>$h_atk,'di'=>$h_di,'dc'=>$h_dc,'ob'=>$h_ob,'db'=>$h_db,'health'=>$heroarray[0]['health']);
}
}
};
$units = new Units;
+33 -33
View File
@@ -15,7 +15,7 @@ include("Market.php");
include("Technology.php");
class Village {
public $type;
public $coor = array();
public $awood,$aclay,$airon,$acrop,$pop,$maxstore,$maxcrop;
@@ -25,7 +25,7 @@ class Village {
private $infoarray = array();
private $production = array();
private $oasisowned,$ocounter = array();
function Village() {
global $session;
if(isset($_SESSION['wid'])) {
@@ -39,16 +39,16 @@ class Village {
$this->processProduction();
$this->ActionControl();
}
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() {
global $database,$session,$logging,$technology;
$this->infoarray = $database->getVillage($this->wid);
@@ -70,7 +70,7 @@ class Village {
$this->techarray = $database->getTech($this->wid);
$this->abarray = $database->getABTech($this->wid);
$this->researching = $database->getResearching($this->wid);
$this->capital = $this->infoarray['capital'];
$this->natar = $this->infoarray['natar'];
$this->currentcel = $this->infoarray['celebration'];
@@ -93,31 +93,31 @@ class Village {
if($this->acrop>$this->maxcrop){ $this->acrop=$this->maxcrop; $database->updateResource($this->wid,'crop',$this->maxcrop); }
}
private function calculateProduction() {
private function calculateProduction() {
global $technology,$database,$session;
$normalA = $database->getOwnArtefactInfoByType($_SESSION['wid'],4);
$normalA = $database->getOwnArtefactInfoByType($_SESSION['wid'],4);
$largeA = $database->getOwnUniqueArtefactInfo($session->uid,4,2);
$uniqueA = $database->getOwnUniqueArtefactInfo($session->uid,4,3);
$upkeep = $technology->getUpkeep($this->unitall,0,$this->wid);
$this->production['wood'] = $this->getWoodProd();
$uniqueA = $database->getOwnUniqueArtefactInfo($session->uid,4,3);
$upkeep = $technology->getUpkeep($this->unitall,0,$this->wid);
$this->production['wood'] = $this->getWoodProd();
$this->production['clay'] = $this->getClayProd();
$this->production['iron'] = $this->getIronProd();
if ($uniqueA['size']==3 && $uniqueA['owner']==$session->uid){
$this->production['crop'] = $this->getCropProd()-$this->pop-(($upkeep)-round($upkeep*0.50));
}else if ($normalA['type']==4 && $normalA['size']==1 && $normalA['owner']==$session->uid){
$this->production['crop'] = $this->getCropProd()-$this->pop-(($upkeep)-round($upkeep*0.25));
}else if ($largeA['size']==2 && $largeA['owner']==$session->uid){
$this->production['crop'] = $this->getCropProd()-$this->pop-(($upkeep)-round($upkeep*0.25));
}else{
if ($uniqueA['size']==3 && $uniqueA['owner']==$session->uid){
$this->production['crop'] = $this->getCropProd()-$this->pop-(($upkeep)-round($upkeep*0.50));
}else if ($normalA['type']==4 && $normalA['size']==1 && $normalA['owner']==$session->uid){
$this->production['crop'] = $this->getCropProd()-$this->pop-(($upkeep)-round($upkeep*0.25));
}else if ($largeA['size']==2 && $largeA['owner']==$session->uid){
$this->production['crop'] = $this->getCropProd()-$this->pop-(($upkeep)-round($upkeep*0.25));
}else{
$this->production['crop'] = $this->getCropProd()-$this->pop-$upkeep;
}
}
}
private function processProduction() {
global $database;
$timepast = time() - $this->infoarray['lastupdate'];
@@ -130,7 +130,7 @@ class Village {
$database->updateVillage($this->wid);
$this->LoadTown();
}
private function getWoodProd() {
global $bid1,$bid5,$session;
$basewood = $sawmill = 0;
@@ -154,7 +154,7 @@ class Village {
$wood *= SPEED;
return round($wood);
}
private function getClayProd() {
global $bid2,$bid6,$session;
$baseclay = $clay = $brick = 0;
@@ -178,7 +178,7 @@ class Village {
$clay *= SPEED;
return round($clay);
}
private function getIronProd() {
global $bid3,$bid7,$session;
$baseiron = $foundry = 0;
@@ -202,7 +202,7 @@ class Village {
$iron *= SPEED;
return round($iron);
}
private function getCropProd() {
global $bid4,$bid8,$bid9,$session;
$basecrop = $grainmill = $bakery = 0;
@@ -229,7 +229,7 @@ class Village {
$crop *= SPEED;
return round($crop);
}
private function sortOasis() {
$crop = $clay = $wood = $iron = 0;
if (!empty($this->oasisowned)) {
@@ -271,7 +271,7 @@ class Village {
}
return array($wood,$clay,$iron,$crop);
}
private function ActionControl() {
global $session;
if(SERVER_WEB_ROOT) {
@@ -287,9 +287,9 @@ class Village {
header("Location: dorf1.php");
}
}
};
$village = new Village;
$building = new Building;
?>
?>
+2 -2
View File
@@ -21,12 +21,12 @@ function template($filepath, $subs)
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();