fixes by songeriux + minor changes

This commit is contained in:
unknown
2012-06-08 17:04:17 +03:00
parent 8e68cf71bd
commit 16313402e6
10 changed files with 162 additions and 244 deletions
+8 -3
View File
@@ -3,7 +3,7 @@
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ## ## --------------------------------------------------------------------------- ##
## Filename Account.php ## ## Filename Account.php ##
## Developed by: Dzoki ## ## Developed by: Songer & Dzoki ##
## License: TravianX Project ## ## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ## ## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ## ## ##
@@ -57,7 +57,9 @@ class Account {
} }
else if($database->checkExist_activate($_POST['name'],0)) { else if($database->checkExist_activate($_POST['name'],0)) {
$form->addError("name",USRNM_TAKEN); $form->addError("name",USRNM_TAKEN);
} } elseif(preg_replace("/[a-zA-Z0-9_-]/","",$_POST['name'])){
$form->addError("name","Unusable simbols. Allowed text format: a-z, A-Z, 0-9 and _ -");
}
} }
if(!isset($_POST['pw']) || $_POST['pw'] == "") { if(!isset($_POST['pw']) || $_POST['pw'] == "") {
@@ -69,7 +71,10 @@ class Account {
} }
else if($_POST['pw'] == $_POST['name']) { else if($_POST['pw'] == $_POST['name']) {
$form->addError("pw",PW_INSECURE); $form->addError("pw",PW_INSECURE);
}
} elseif(preg_replace("/[a-zA-Z0-9]/","",$_POST['pw'])){
$form->addError("name","Unusable simbols. Allowed text format: a-z, A-Z, 0-9");
}
} }
if(!isset($_POST['email'])) { if(!isset($_POST['email'])) {
$form->addError("email",EMAIL_EMPTY); $form->addError("email",EMAIL_EMPTY);
+115 -187
View File
@@ -243,7 +243,7 @@ class Automation {
} }
} }
if(file_exists("GameEngine/Prevention/loyalty.txt")) { if(file_exists("GameEngine/Prevention/loyalty.txt")) {
@unlink("GameEngine/Prevention/loyalty.txt"); unlink("GameEngine/Prevention/loyalty.txt");
} }
} }
@@ -308,8 +308,8 @@ class Automation {
private function clearDeleting() { private function clearDeleting() {
global $database; global $database;
$ourFileHandle = @fopen("GameEngine/Prevention/cleardeleting.txt", 'w'); $ourFileHandle = fopen("GameEngine/Prevention/cleardeleting.txt", 'w');
@fclose($ourFileHandle); fclose($ourFileHandle);
$needDelete = $database->getNeedDelete(); $needDelete = $database->getNeedDelete();
if(count($needDelete) > 0) { if(count($needDelete) > 0) {
foreach($needDelete as $need) { foreach($needDelete as $need) {
@@ -351,7 +351,7 @@ class Automation {
} }
} }
if(file_exists("GameEngine/Prevention/cleardeleting.txt")) { if(file_exists("GameEngine/Prevention/cleardeleting.txt")) {
@unlink("GameEngine/Prevention/cleardeleting.txt"); unlink("GameEngine/Prevention/cleardeleting.txt");
} }
} }
@@ -423,14 +423,14 @@ class Automation {
private function culturePoints() { private function culturePoints() {
global $database,$session; global $database,$session;
$time = time()-600; $time = time()-600; // 10minutes
$array = array(); $array = array();
$q = "SELECT id, lastupdate FROM ".TB_PREFIX."users WHERE lastupdate < $time"; $q = "SELECT id, lastupdate FROM ".TB_PREFIX."users WHERE lastupdate < $time";
$array = $database->query_return($q); $array = $database->query_return($q);
foreach($array as $indi) { foreach($array as $indi) {
if($indi['lastupdate'] <= $time && $indi['lastupdate'] > 0){ if($indi['lastupdate'] <= $time && $indi['lastupdate'] > 0){
$cp = $database->getVSumField($indi['id'], 'cp') * (time()-$indi['lastupdate'])/86400; $cp = $database->getVSumField($indi['id'], 'cp') * (time()-$indi['lastupdate'])/86400; // 24 hours
$newupdate = time(); $newupdate = time();
$q = "UPDATE ".TB_PREFIX."users set cp = cp + $cp, lastupdate = $newupdate where id = '".$indi['id']."'"; $q = "UPDATE ".TB_PREFIX."users set cp = cp + $cp, lastupdate = $newupdate where id = '".$indi['id']."'";
@@ -438,7 +438,7 @@ class Automation {
} }
} }
if(file_exists("GameEngine/Prevention/culturepoints.txt")) { if(file_exists("GameEngine/Prevention/culturepoints.txt")) {
@unlink("GameEngine/Prevention/culturepoints.txt"); unlink("GameEngine/Prevention/culturepoints.txt");
} }
} }
@@ -522,7 +522,7 @@ class Automation {
} }
} }
if(file_exists("GameEngine/Prevention/build.txt")) { if(file_exists("GameEngine/Prevention/build.txt")) {
@unlink("GameEngine/Prevention/build.txt"); unlink("GameEngine/Prevention/build.txt");
} }
} }
@@ -703,8 +703,8 @@ class Automation {
private function marketComplete() { private function marketComplete() {
global $database; global $database;
$ourFileHandle = @fopen("GameEngine/Prevention/market.txt", 'w'); $ourFileHandle = fopen("GameEngine/Prevention/market.txt", 'w');
@fclose($ourFileHandle); fclose($ourFileHandle);
$time = time(); $time = time();
$q = "SELECT * FROM ".TB_PREFIX."movement, ".TB_PREFIX."send where ".TB_PREFIX."movement.ref = ".TB_PREFIX."send.id and ".TB_PREFIX."movement.proc = 0 and sort_type = 0 and endtime < $time"; $q = "SELECT * FROM ".TB_PREFIX."movement, ".TB_PREFIX."send where ".TB_PREFIX."movement.ref = ".TB_PREFIX."send.id and ".TB_PREFIX."movement.proc = 0 and sort_type = 0 and endtime < $time";
$dataarray = $database->query_return($q); $dataarray = $database->query_return($q);
@@ -740,7 +740,7 @@ class Automation {
} }
} }
if(file_exists("GameEngine/Prevention/market.txt")) { if(file_exists("GameEngine/Prevention/market.txt")) {
@unlink("GameEngine/Prevention/market.txt"); unlink("GameEngine/Prevention/market.txt");
} }
} }
@@ -780,8 +780,8 @@ class Automation {
private function sendunitsComplete() { private function sendunitsComplete() {
global $bid23,$bid34,$database,$battle,$village,$technology,$logging; global $bid23,$bid34,$database,$battle,$village,$technology,$logging;
$ourFileHandle = @fopen("GameEngine/Prevention/sendunits.txt", 'w'); $ourFileHandle = fopen("GameEngine/Prevention/sendunits.txt", 'w');
@fclose($ourFileHandle); fclose($ourFileHandle);
$time = time(); $time = time();
$q = "SELECT * FROM ".TB_PREFIX."movement, ".TB_PREFIX."attacks where ".TB_PREFIX."movement.ref = ".TB_PREFIX."attacks.id and ".TB_PREFIX."movement.proc = '0' and ".TB_PREFIX."movement.sort_type = '3' and ".TB_PREFIX."attacks.attack_type != '2' and endtime < $time ORDER BY endtime ASC"; $q = "SELECT * FROM ".TB_PREFIX."movement, ".TB_PREFIX."attacks where ".TB_PREFIX."movement.ref = ".TB_PREFIX."attacks.id and ".TB_PREFIX."movement.proc = '0' and ".TB_PREFIX."movement.sort_type = '3' and ".TB_PREFIX."attacks.attack_type != '2' and endtime < $time ORDER BY endtime ASC";
$dataarray = $database->query_return($q); $dataarray = $database->query_return($q);
@@ -809,24 +809,6 @@ class Automation {
$toF = $database->getVillage($data['to']); $toF = $database->getVillage($data['to']);
$fromF = $database->getVillage($data['from']); $fromF = $database->getVillage($data['from']);
/*--------------------------------
// Battle part
--------------------------------*/
//get defence units
/* $q = "SELECT * FROM ".TB_PREFIX."units WHERE vref='".$data['to']."'";
$unitlist = $database->query_return($q);
$Defender = array();
$start = ($targettribe == 1)? 1 : (($targettribe == 2)? 11: 21);
$end = ($targettribe == 1)? 10 : (($targettribe == 2)? 20: 30);
for($i=$start;$i<=$end;$i++) {
if($unitlist)
$Defender['u'.$i] = $unitlist[0]['u'.$i];
else
$Defender['u'.$i] = '';
}*/
//get defence units //get defence units
$Defender = array(); $rom = $ger = $gal = $nat = $natar = 0; $Defender = array(); $rom = $ger = $gal = $nat = $natar = 0;
$Defender = $database->getUnit($data['to']); $Defender = $database->getUnit($data['to']);
@@ -961,50 +943,6 @@ class Automation {
} }
} }
//choose a building to attack
/* if($catp > 0 and $type=='3'){
if($toF['pop']>'1'){
for ($i=1; $i<2; $i++){
//$rand=rand(1,39);
$basearray = $database->getMInfo($data['to']);
$resarray = $database->getResourceLevel($basearray['wref']);
if($data['ctar1'] == 0){
$rand = 0;
for($j=19;$j<=40;$j++) {
if($resarray['f'.$j.'t'] != 0 ) {
$rand = $j;
}
}
}else{
//$resarray = $database->getResourceLevel($data['to']);
$rand = 0;
for($j=19;$j<=40;$j++) {
if($resarray['f'.$j.'t'] == $data['ctar1']) {
$rand = $j;
}
}
}
if ($rand == 0){
for($j=19;$j<=40;$j++) {
if($resarray['f'.$j.'t'] != 0 ) {
$rand = $j;
}
}
}
//$rand=$data['ctar1'];
if ($database->getFieldLevel($basearray['wref'],$rand)!='0'){
$tblevel = $database->getFieldLevel($basearray['wref'],$rand);
$tbgid = $database->getFieldLevel($basearray['wref'],"".$rand."t");
$tbid = $rand;
$i="4";
} else { $i--; }
}
} else { $empty='1'; }
} else { $tblevel = '0'; }
$stonemason = "1"; */
$tblevel = '1'; $tblevel = '1';
$stonemason = "1"; $stonemason = "1";
@@ -1031,6 +969,7 @@ class Automation {
$Defender = array(); $rom = $ger = $gal = $nat = $natar = 0; $Defender = array(); $rom = $ger = $gal = $nat = $natar = 0;
$Defender = $database->getUnit($data['to']); $Defender = $database->getUnit($data['to']);
$enforcementarray = $database->getEnforceVillage($data['to'],0); $enforcementarray = $database->getEnforceVillage($data['to'],0);
if(count($enforcementarray) > 0) { if(count($enforcementarray) > 0) {
foreach($enforcementarray as $enforce) { foreach($enforcementarray as $enforce) {
for($i=1;$i<=50;$i++) { for($i=1;$i<=50;$i++) {
@@ -1175,11 +1114,19 @@ class Automation {
$unitssend_deff[4] = '?,?,?,?,?,?,?,?,?,?,'; $unitssend_deff[4] = '?,?,?,?,?,?,?,?,?,?,';
$unitssend_deff[5] = '?,?,?,?,?,?,?,?,?,?,'; $unitssend_deff[5] = '?,?,?,?,?,?,?,?,?,?,';
//how many troops died? for battleraport //how many troops died? for battleraport
#################################################
################FIXED BY SONGER################
#################################################
for($i=1;$i<=11;$i++){ for($i=1;$i<=11;$i++){
if($battlepart['casualties_attacker'][$i] <= 0) { ${dead.$i} = 0; }elseif($battlepart['casualties_attacker'][$i] > $data['t'.$i]){ if($battlepart['casualties_attacker'][$i] <= 0) { ${dead.$i} = 0; }elseif($battlepart['casualties_attacker'][$i] > $data['t'.$i]){
${dead.$i}=$data['t'.$i]; ${dead.$i}=$data['t'.$i];
}else { ${dead.$i} = $battlepart['casualties_attacker'][$i]; } }else { ${dead.$i} = $battlepart['casualties_attacker'][$i]; }
} }
#################################################
$heroAttackDead=$dead11; $heroAttackDead=$dead11;
//kill own defence //kill own defence
$q = "SELECT * FROM ".TB_PREFIX."units WHERE vref='".$data['to']."'"; $q = "SELECT * FROM ".TB_PREFIX."units WHERE vref='".$data['to']."'";
@@ -1280,18 +1227,7 @@ class Automation {
$totaldead_alldef = $totaldead_alldef[1]+$totaldead_alldef[2]+$totaldead_alldef[3]+$totaldead_alldef[4]+$totaldead_alldef[5]+$deadhero; $totaldead_alldef = $totaldead_alldef[1]+$totaldead_alldef[2]+$totaldead_alldef[3]+$totaldead_alldef[4]+$totaldead_alldef[5]+$deadhero;
$totalattackdead += $totaldead_alldef; $totalattackdead += $totaldead_alldef;
/*
if($battlepart['casualties_defender'][1] == 0) { $dead11 = 0; } else { $dead11 = $battlepart['casualties_defender'][1]; }
if($battlepart['casualties_defender'][2] == 0) { $dead12 = 0; } else { $dead12 = $battlepart['casualties_defender'][2]; }
if($battlepart['casualties_defender'][3] == 0) { $dead13 = 0; } else { $dead13 = $battlepart['casualties_defender'][3]; }
if($battlepart['casualties_defender'][4] == 0) { $dead14 = 0; } else { $dead14 = $battlepart['casualties_defender'][4]; }
if($battlepart['casualties_defender'][5] == 0) { $dead15 = 0; } else { $dead15 = $battlepart['casualties_defender'][5]; }
if($battlepart['casualties_defender'][6] == 0) { $dead16 = 0; } else { $dead16 = $battlepart['casualties_defender'][6]; }
if($battlepart['casualties_defender'][7] == 0) { $dead17 = 0; } else { $dead17 = $battlepart['casualties_defender'][7]; }
if($battlepart['casualties_defender'][8] == 0) { $dead18 = 0; } else { $dead18 = $battlepart['casualties_defender'][8]; }
if($battlepart['casualties_defender'][9] == 0) { $dead19 = 0; } else { $dead19 = $battlepart['casualties_defender'][9]; }
if($battlepart['casualties_defender'][10] == 0) { $dead20 = 0; } else { $dead20 = $battlepart['casualties_defender'][10]; }
*/
// Set units returning from attack // Set units returning from attack
$database->modifyAttack($data['ref'],1,$dead1); $database->modifyAttack($data['ref'],1,$dead1);
@@ -2369,57 +2305,71 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
$database->addNotice($from['owner'],$to['wref'],$ownally,22,''.addslashes($from['name']).' attacks '.addslashes($to['name']).'',$data2,time()); $database->addNotice($from['owner'],$to['wref'],$ownally,22,''.addslashes($from['name']).' attacks '.addslashes($to['name']).'',$data2,time());
$database->addNotice($to['owner'],$to['wref'],$targetally,22,''.addslashes($from['name']).' attacks '.addslashes($to['name']).'',$data2,time()); $database->addNotice($to['owner'],$to['wref'],$targetally,22,''.addslashes($from['name']).' attacks '.addslashes($to['name']).'',$data2,time());
} }
unset($Attacker);
unset($Defender); #################################################
unset($enforce); ################FIXED BY SONGER################
unset($unitssend_att); #################################################
unset($unitssend_def);
unset($battlepart); ################################################################################
unset($unitsdead_def); ##############ISUE: Lag, fixed3####################################################
unset($dead); #### PHP.NET manual: unset() destroy more than one variable unset($foo1, $foo2, $foo3);######
unset($steal); ################################################################################
unset($from);
unset($data); unset(
unset($data2); $Attacker
unset($to); ,$Defender
unset($artifact); ,$enforce
unset($artifactBig); ,$unitssend_att
unset($canclaim); ,$unitssend_def
unset($data_fail); ,$battlepart
unset($owntribe); ,$unitsdead_def
unset($unitsdead_att); ,$dead
unset($herosend_def); ,$steal
unset($deadhero); ,$from
unset($heroxp); ,$data
unset($AttackerID); ,$data2
unset($DefenderID); ,$to
unset($totalsend_alldef); ,$artifact
unset($totaldead_att); ,$artifactBig
unset($totaldead_def); ,$canclaim
unset($unitsdead_att_check); ,$data_fail
unset($totalattackdead); ,$owntribe
unset($Defender1); ,$unitsdead_att
unset($enforce1); ,$herosend_def
unset($defheroowner); ,$deadhero
unset($enforceowner); ,$heroxp
unset($defheroxp); ,$AttackerID
unset($reinfheroxp); ,$DefenderID
unset($AttackerWref); ,$totalsend_alldef
unset($DefenderWref); ,$totaldead_att
unset($troopsdead1); ,$totaldead_def
unset($troopsdead2); ,$unitsdead_att_check
unset($troopsdead3); ,$totalattackdead
unset($troopsdead4); ,$Defender1
unset($troopsdead5); ,$enforce1
unset($troopsdead6); ,$defheroowner
unset($troopsdead7); ,$enforceowner
unset($troopsdead8); ,$defheroxp
unset($troopsdead9); ,$reinfheroxp
unset($troopsdead10); ,$AttackerWref
unset($troopsdead11); ,$DefenderWref
,$troopsdead1
,$troopsdead2
,$troopsdead3
,$troopsdead4
,$troopsdead5
,$troopsdead6
,$troopsdead7
,$troopsdead8
,$troopsdead9
,$troopsdead10
,$troopsdead11);
#################################################
} }
if(file_exists("GameEngine/Prevention/sendunits.txt")) { if(file_exists("GameEngine/Prevention/sendunits.txt")) {
@unlink("GameEngine/Prevention/sendunits.txt"); unlink("GameEngine/Prevention/sendunits.txt");
} }
} }
@@ -2542,8 +2492,8 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
private function sendreinfunitsComplete() { private function sendreinfunitsComplete() {
global $bid23,$database,$battle; global $bid23,$database,$battle;
$time = time(); $time = time();
$ourFileHandle = @fopen("GameEngine/Prevention/sendreinfunits.txt", 'w'); $ourFileHandle = fopen("GameEngine/Prevention/sendreinfunits.txt", 'w');
@fclose($ourFileHandle); fclose($ourFileHandle);
$q = "SELECT * FROM ".TB_PREFIX."movement, ".TB_PREFIX."attacks where ".TB_PREFIX."movement.ref = ".TB_PREFIX."attacks.id and ".TB_PREFIX."movement.proc = '0' and ".TB_PREFIX."movement.sort_type = '3' and ".TB_PREFIX."attacks.attack_type = '2' and endtime < $time"; $q = "SELECT * FROM ".TB_PREFIX."movement, ".TB_PREFIX."attacks where ".TB_PREFIX."movement.ref = ".TB_PREFIX."attacks.id and ".TB_PREFIX."movement.proc = '0' and ".TB_PREFIX."movement.sort_type = '3' and ".TB_PREFIX."attacks.attack_type = '2' and endtime < $time";
$dataarray = $database->query_return($q); $dataarray = $database->query_return($q);
foreach($dataarray as $data) { foreach($dataarray as $data) {
@@ -2606,14 +2556,14 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
} }
} }
if(file_exists("GameEngine/Prevention/sendreinfunits.txt")) { if(file_exists("GameEngine/Prevention/sendreinfunits.txt")) {
@unlink("GameEngine/Prevention/sendreinfunits.txt"); unlink("GameEngine/Prevention/sendreinfunits.txt");
} }
} }
private function returnunitsComplete() { private function returnunitsComplete() {
global $database; global $database;
$ourFileHandle = @fopen("GameEngine/Prevention/returnunits.txt", 'w'); $ourFileHandle = fopen("GameEngine/Prevention/returnunits.txt", 'w');
@fclose($ourFileHandle); fclose($ourFileHandle);
$time = time(); $time = time();
$q = "SELECT * FROM ".TB_PREFIX."movement, ".TB_PREFIX."attacks where ".TB_PREFIX."movement.ref = ".TB_PREFIX."attacks.id and ".TB_PREFIX."movement.proc = '0' and ".TB_PREFIX."movement.sort_type = '4' and endtime < $time"; $q = "SELECT * FROM ".TB_PREFIX."movement, ".TB_PREFIX."attacks where ".TB_PREFIX."movement.ref = ".TB_PREFIX."attacks.id and ".TB_PREFIX."movement.proc = '0' and ".TB_PREFIX."movement.sort_type = '4' and endtime < $time";
$dataarray = $database->query_return($q); $dataarray = $database->query_return($q);
@@ -2653,14 +2603,14 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
if(file_exists("GameEngine/Prevention/returnunits.txt")) { if(file_exists("GameEngine/Prevention/returnunits.txt")) {
@unlink("GameEngine/Prevention/returnunits.txt"); unlink("GameEngine/Prevention/returnunits.txt");
} }
} }
private function sendSettlersComplete() { private function sendSettlersComplete() {
global $database, $building; global $database, $building;
$ourFileHandle = @fopen("GameEngine/Prevention/settlers.txt", 'w'); $ourFileHandle = fopen("GameEngine/Prevention/settlers.txt", 'w');
@fclose($ourFileHandle); fclose($ourFileHandle);
$time = time(); $time = time();
$q = "SELECT * FROM ".TB_PREFIX."movement where proc = 0 and sort_type = 5 and endtime < $time"; $q = "SELECT * FROM ".TB_PREFIX."movement where proc = 0 and sort_type = 5 and endtime < $time";
$dataarray = $database->query_return($q); $dataarray = $database->query_return($q);
@@ -2701,14 +2651,14 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
} }
} }
if(file_exists("GameEngine/Prevention/settlers.txt")) { if(file_exists("GameEngine/Prevention/settlers.txt")) {
@unlink("GameEngine/Prevention/settlers.txt"); unlink("GameEngine/Prevention/settlers.txt");
} }
} }
private function researchComplete() { private function researchComplete() {
global $database; global $database;
$ourFileHandle = @fopen("GameEngine/Prevention/research.txt", 'w'); $ourFileHandle = fopen("GameEngine/Prevention/research.txt", 'w');
@fclose($ourFileHandle); fclose($ourFileHandle);
$time = time(); $time = time();
$q = "SELECT * FROM ".TB_PREFIX."research where timestamp < $time"; $q = "SELECT * FROM ".TB_PREFIX."research where timestamp < $time";
$dataarray = $database->query_return($q); $dataarray = $database->query_return($q);
@@ -2728,7 +2678,7 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
$database->query($q); $database->query($q);
} }
if(file_exists("GameEngine/Prevention/research.txt")) { if(file_exists("GameEngine/Prevention/research.txt")) {
@unlink("GameEngine/Prevention/research.txt"); unlink("GameEngine/Prevention/research.txt");
} }
} }
@@ -2762,20 +2712,6 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
$this->bountyocounter = $this->bountysortOasis(); $this->bountyocounter = $this->bountysortOasis();
$this->bountypop = $this->bountyinfoarray['pop']; $this->bountypop = $this->bountyinfoarray['pop'];
//$unitarray = $database->getUnit($bountywid);
//if(count($unitarray) > 0) {
// for($i=1;$i<=50;$i++) {
// $this->bountyunitall['u'.$i] = $unitarray['u'.$i];
// }
//}
//$enforcearray = $database->getEnforceVillage($bountywid,0);
//if(count($enforcearray) > 0) {
// foreach($enforcearray as $enforce) {
// for($i=1;$i<=50;$i++) {
// $this->bountyunitall['u'.$i] += $enforce['u'.$i];
// }
// }
//}
} }
private function bountysortOasis() { private function bountysortOasis() {
@@ -2944,7 +2880,6 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
if($this->bountyocounter[0] != 0) { if($this->bountyocounter[0] != 0) {
$wood += $wood*0.25*$this->bountyocounter[0]; $wood += $wood*0.25*$this->bountyocounter[0];
} }
// $wood += $wood*$this->bountyocounter[0]*0.25;
$wood *= SPEED; $wood *= SPEED;
return round($wood); return round($wood);
} }
@@ -2995,7 +2930,6 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
if($this->bountyocounter[1] != 0) { if($this->bountyocounter[1] != 0) {
$clay += $clay*0.25*$this->bountyocounter[1]; $clay += $clay*0.25*$this->bountyocounter[1];
} }
// $clay += $clay*$this->bountyocounter[1]*0.25;
$clay *= SPEED; $clay *= SPEED;
return round($clay); return round($clay);
} }
@@ -3019,7 +2953,6 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
if($this->bountyocounter[2] != 0) { if($this->bountyocounter[2] != 0) {
$iron += $iron*0.25*$this->bountyocounter[2]; $iron += $iron*0.25*$this->bountyocounter[2];
} }
// $iron += $iron*$this->bountyocounter[2]*0.25;
$iron *= SPEED; $iron *= SPEED;
return round($iron); return round($iron);
} }
@@ -3049,16 +2982,14 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
if($this->bountyocounter[3] != 0) { if($this->bountyocounter[3] != 0) {
$crop += $crop*0.25*$this->bountyocounter[3]; $crop += $crop*0.25*$this->bountyocounter[3];
} }
// $crop += $crop*$this->bountyocounter[3]*0.25;
$crop *= SPEED; $crop *= SPEED;
return round($crop); return round($crop);
} }
private function trainingComplete() { private function trainingComplete() {
global $database; global $database;
$ourFileHandle = @fopen("GameEngine/Prevention/training.txt", 'w'); $ourFileHandle = fopen("GameEngine/Prevention/training.txt", 'w');
@fclose($ourFileHandle); fclose($ourFileHandle);
$trainlist = $database->getTrainingList(); $trainlist = $database->getTrainingList();
if(count($trainlist) > 0) { if(count($trainlist) > 0) {
foreach($trainlist as $train) { foreach($trainlist as $train) {
@@ -3088,7 +3019,7 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
} }
} }
if(file_exists("GameEngine/Prevention/training.txt")) { if(file_exists("GameEngine/Prevention/training.txt")) {
@unlink("GameEngine/Prevention/training.txt"); unlink("GameEngine/Prevention/training.txt");
} }
} }
@@ -3161,11 +3092,12 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
} }
} }
else { else {
for($i=0;$i<=$element-1;$i++) { /*for($i=0;$i<=$element-1;$i++) {
//if($resarray['f'.$keyholder[$i]] != $this->getsort_typeMaxLevel($tid)) { //if($resarray['f'.$keyholder[$i]] != $this->getsort_typeMaxLevel($tid)) {
// $target = $i; // $target = $i;
//} //}
} }
*/
} }
} }
else if($element == 1) { else if($element == 1) {
@@ -3184,8 +3116,8 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
private function celebrationComplete() { private function celebrationComplete() {
global $database; global $database;
$ourFileHandle = @fopen("GameEngine/Prevention/celebration.txt", 'w'); $ourFileHandle = fopen("GameEngine/Prevention/celebration.txt", 'w');
@fclose($ourFileHandle); fclose($ourFileHandle);
$varray = $database->getCel(); $varray = $database->getCel();
foreach($varray as $vil){ foreach($varray as $vil){
@@ -3197,14 +3129,14 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
$database->setCelCp($user,$cp); $database->setCelCp($user,$cp);
} }
if(file_exists("GameEngine/Prevention/celebration.txt")) { if(file_exists("GameEngine/Prevention/celebration.txt")) {
@unlink("GameEngine/Prevention/celebration.txt"); unlink("GameEngine/Prevention/celebration.txt");
} }
} }
private function demolitionComplete() { private function demolitionComplete() {
global $building,$database; global $building,$database;
$ourFileHandle = @fopen("GameEngine/Prevention/demolition.txt", 'w'); $ourFileHandle = fopen("GameEngine/Prevention/demolition.txt", 'w');
@fclose($ourFileHandle); fclose($ourFileHandle);
$varray = $database->getDemolition(); $varray = $database->getDemolition();
foreach($varray as $vil) { foreach($varray as $vil) {
@@ -3233,7 +3165,7 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
} }
} }
if(file_exists("GameEngine/Prevention/demolition.txt")) { if(file_exists("GameEngine/Prevention/demolition.txt")) {
@unlink("GameEngine/Prevention/demolition.txt"); unlink("GameEngine/Prevention/demolition.txt");
} }
} }
@@ -3260,13 +3192,13 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
} }
} }
if(file_exists("GameEngine/Prevention/updatehero.txt")) { if(file_exists("GameEngine/Prevention/updatehero.txt")) {
@unlink("GameEngine/Prevention/updatehero.txt"); unlink("GameEngine/Prevention/updatehero.txt");
} }
} }
// by SlimShady95, aka Manuel Mannhardt < manuel_mannhardt@web.de > // by SlimShady95, aka Manuel Mannhardt < manuel_mannhardt@web.de > UPDATED FROM songeriux < haroldas.snei@gmail.com >
private function updateStore() { private function updateStore() {
global $bid10, $bid38, $bid11, $bid39; global $bid10, $bid38, $bid11, $bid39;
@@ -3413,8 +3345,8 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
private function starvation() { private function starvation() {
global $database; global $database;
$ourFileHandle = @fopen("GameEngine/Prevention/starvation.txt", 'w'); $ourFileHandle = fopen("GameEngine/Prevention/starvation.txt", 'w');
@fclose($ourFileHandle); fclose($ourFileHandle);
$starvcost = array( $starvcost = array(
'1'=>30, '1'=>30,
@@ -3609,15 +3541,11 @@ $crannyimg = "<img src=\"".GP_LOCATE."img/g/g23.gif\" height=\"20\" width=\"15\"
$database->setVillageField($starv['wref'], 'crop', $newcrop); $database->setVillageField($starv['wref'], 'crop', $newcrop);
} }
} }
unset ($starv); unset ($starv,$unitarray,$enforcearray,$enforce,$starvarray);
unset ($unitarray);
unset ($enforcearray);
unset ($enforce);
unset ($starvarray);
} }
if(file_exists("GameEngine/Prevention/starvation.txt")) { if(file_exists("GameEngine/Prevention/starvation.txt")) {
@unlink("GameEngine/Prevention/starvation.txt"); unlink("GameEngine/Prevention/starvation.txt");
} }
} }
+5 -33
View File
@@ -533,20 +533,14 @@ class Battle {
$total_att_units = count($units['Att_unit']); $total_att_units = count($units['Att_unit']);
$start = intval(($att_tribe-1)*10+1); $start = intval(($att_tribe-1)*10+1);
$end = intval(($att_tribe*10)); $end = intval(($att_tribe*10));
//exit($start."|".$end."|".$att_tribe);
//$y=1;
for($i=$start;$i <= $end;$i++) for($i=$start;$i <= $end;$i++)
{ {
$y = $i-(($att_tribe-1)*10); $y = $i-(($att_tribe-1)*10);
//exit(intval("$y"));
$result['casualties_attacker'][$y] = round($result[1]*$units['Att_unit'][$i]); $result['casualties_attacker'][$y] = round($result[1]*$units['Att_unit'][$i]);
//$y++;
//exit($result['casualties_attacker'][$y]);
} }
//$result['casualties_attacker']['11'] = 0;
//exit($result['casualties_attacker']['2']);
//$_hero=11;
if ($units['Att_unit']['hero']>0) if ($units['Att_unit']['hero']>0)
{ {
@@ -568,18 +562,9 @@ class Battle {
mysql_query("update " . TB_PREFIX . "hero set `health`=`health`-".$damage_health." where `heroid`='".$hero_id."'"); mysql_query("update " . TB_PREFIX . "hero set `health`=`health`-".$damage_health." where `heroid`='".$hero_id."'");
} }
} }
unset($_result); unset($_result,$fdb,$hero_id,$hero_health,$damage_health);
unset($fdb);
unset($hero_id);
unset($hero_health);
unset($damage_health);
//exit($result['casualties_attacker']['11']);
//$result['casualties_attacker'][11] = round($result[1]*$units['Att_unit']['hero']);
//$result['casualties_defender']['11'] = 0;
//exit($result['casualties_defender']['2']);
//$_hero=11;
if ($units['Def_unit']['hero']>0) if ($units['Def_unit']['hero']>0)
{ {
@@ -588,7 +573,6 @@ class Battle {
$hero_id=$fdb['heroid']; $hero_id=$fdb['heroid'];
$hero_health=$fdb['health']; $hero_health=$fdb['health'];
$damage_health=round(100*$result[2]); $damage_health=round(100*$result[2]);
//exit($damage_health."|".$hero_health."|".$defhero['heroid']);
if ($hero_health<=$damage_health or $damage_health>90) if ($hero_health<=$damage_health or $damage_health>90)
{ {
//hero die //hero die
@@ -601,11 +585,7 @@ class Battle {
$result['deadherodef'] = 0; $result['deadherodef'] = 0;
mysql_query("update " . TB_PREFIX . "hero set `health`=`health`-".$damage_health." where `heroid`='".$hero_id."'"); mysql_query("update " . TB_PREFIX . "hero set `health`=`health`-".$damage_health." where `heroid`='".$hero_id."'");
} }
unset($_result); unset($_result,$fdb,$hero_id,$hero_health,$damage_health);
unset($fdb);
unset($hero_id);
unset($hero_health);
unset($damage_health);
$DefendersAll = $database->getEnforceVillage($DefenderWref,0); $DefendersAll = $database->getEnforceVillage($DefenderWref,0);
if(!empty($DefendersAll)){ if(!empty($DefendersAll)){
@@ -619,7 +599,6 @@ class Battle {
$hero_id=$fdb['heroid']; $hero_id=$fdb['heroid'];
$hero_health=$fdb['health']; $hero_health=$fdb['health'];
$damage_health=round(100*$result[2]); $damage_health=round(100*$result[2]);
//exit($damage_health."|".$hero_health."|".$defhero['heroid']);
if ($hero_health<=$damage_health or $damage_health>90) if ($hero_health<=$damage_health or $damage_health>90)
{ {
//hero die //hero die
@@ -637,14 +616,7 @@ class Battle {
} }
} }
unset($_result); unset($_result,$fdb,$hero_id,$hero_health,$damage_health);
unset($fdb);
unset($hero_id);
unset($hero_health);
unset($damage_health);
//exit($result['casualties_defender']['11']);
//$result['casualties_defender'][11] = round($result[1]*$units['Def_unit']['hero']);
// Work out bounty // Work out bounty
+2 -2
View File
@@ -268,9 +268,9 @@ define("CHOOSE","Please choose a server.");
define("STARTED"," The server started ". round((time()-COMMENCE)/86400) ." days ago."); define("STARTED"," The server started ". round((time()-COMMENCE)/86400) ." days ago.");
//ANMELDEN.php //ANMELDEN.php
define("NICKNAME","Nickname"); define("NICKNAME","Nickname [a-z, A-Z, 0-9 , _, -]");
define("EMAIL","Email"); define("EMAIL","Email");
define("PASSWORD","Password"); define("PASSWORD","Password [a-z, A-Z, 0-9]");
define("ROMANS","Romans"); define("ROMANS","Romans");
define("TEUTONS","Teutons"); define("TEUTONS","Teutons");
define("GAULS","Gauls"); define("GAULS","Gauls");
+6 -6
View File
@@ -9,11 +9,11 @@
| Copyright: TravianX Project All rights reserved | | Copyright: TravianX Project All rights reserved |
\** --------------------------------------------------- **/ \** --------------------------------------------------- **/
$tribe1 = mysql_query("SELECT SQL_CACHE * FROM ".TB_PREFIX."users WHERE tribe = 1"); $tribe1 = mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE tribe = 1");
$tribe2 = mysql_query("SELECT SQL_CACHE * FROM ".TB_PREFIX."users WHERE tribe = 2"); $tribe2 = mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE tribe = 2");
$tribe3 = mysql_query("SELECT SQL_CACHE * FROM ".TB_PREFIX."users WHERE tribe = 3"); $tribe3 = mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE tribe = 3");
$tribes = array(mysql_num_rows($tribe1), mysql_num_rows($tribe2), mysql_num_rows($tribe3)); $tribes = array(mysql_num_rows($tribe1), mysql_num_rows($tribe2), mysql_num_rows($tribe3));
$users = mysql_num_rows(mysql_query("SELECT SQL_CACHE * FROM ".TB_PREFIX."users")) - 4; ?> $users = mysql_num_rows(mysql_query("SELECT * FROM " . TB_PREFIX . "users WHERE tribe!=0 AND tribe!=4 AND tribe!=5")); ?>
<table cellpadding="1" cellspacing="1" id="world_player" class="world"> <table cellpadding="1" cellspacing="1" id="world_player" class="world">
<thead> <thead>
@@ -34,7 +34,7 @@
<th>Active players</th> <th>Active players</th>
<td><?php <td><?php
$active = mysql_num_rows(mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE ".time()."-timestamp < (3600*24)")); $active = mysql_num_rows(mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE ".time()."-timestamp < (3600*24) AND tribe!=0 AND tribe!=4 AND tribe!=5"));
echo $active; ?></td> echo $active; ?></td>
</tr> </tr>
@@ -42,7 +42,7 @@
<th>Players online</th> <th>Players online</th>
<td><?php <td><?php
$online = mysql_num_rows(mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE ".time()."-timestamp < (60*5)")); $online = mysql_num_rows(mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE ".time()."-timestamp < (60*30) AND tribe!=0 AND tribe!=4 AND tribe!=5"));
echo $online; ?></td> echo $online; ?></td>
</tr> </tr>
</tbody> </tbody>
+1 -1
View File
@@ -132,7 +132,7 @@ include ("GameEngine/Lang/".LANG.".php");
<td><?php <td><?php
$online = mysql_num_rows(mysql_query("SELECT * FROM " . TB_PREFIX . "users WHERE " . time() . "-timestamp < (60*5) AND tribe!=0 AND tribe!=4 AND tribe!=5")); $online = mysql_num_rows(mysql_query("SELECT * FROM " . TB_PREFIX . "users WHERE " . time() . "-timestamp < (60*30) AND tribe!=0 AND tribe!=4 AND tribe!=5"));
echo $online; echo $online;
?></td> ?></td>
+9 -6
View File
@@ -127,7 +127,7 @@ echo "<div class=\"headline\"><span class=\"f10 c5\">Error creating constant.php
<td><span class="f9 c6">Prefix:</span></td><td><input type="text" name="prefix" id="prefix" value="s1_" size="5"></td></tr> <td><span class="f9 c6">Prefix:</span></td><td><input type="text" name="prefix" id="prefix" value="s1_" size="5"></td></tr>
<td><span class="f9 c6">Type:</span></td><td><select name="connectt"> <td><span class="f9 c6">Type:</span></td><td><select name="connectt">
<option value="0" selected="selected">MYSQL</option> <option value="0" selected="selected">MYSQL</option>
<option value="1" disabled="disabled">MYSQLi</option> <option value="1" disabled="disabled">MYSQLi (NOT DONE)</option>
</select></td></tr> </select></td></tr>
</table> </table>
</p> </p>
@@ -180,6 +180,9 @@ echo "<div class=\"headline\"><span class=\"f10 c5\">Error creating constant.php
<p> <p>
<span class="f10 c">LOG RELATED</span> <span class="f10 c">LOG RELATED</span>
<table><tr> <table><tr>
<td><span style="red"><b>WARNING:</b></span> May increase some preformence (Higher CPU/RAM usage, More lag)</td>
</tr>
<tr>
<td><span class="f9 c6">Log Building:</span></td><td><select name="log_build"> <td><span class="f9 c6">Log Building:</span></td><td><select name="log_build">
<option value="true" selected="selected">Yes</option> <option value="true" selected="selected">Yes</option>
<option value="false">No</option> <option value="false">No</option>
@@ -232,14 +235,14 @@ echo "<div class=\"headline\"><span class=\"f10 c5\">Error creating constant.php
<option value="false" selected="selected">No</option> <option value="false" selected="selected">No</option>
</select></td></tr><tr> </select></td></tr><tr>
<td><span class="f9 c6">Limit Mailbox:</span></td><td><select name="limit_mailbox"> <td><span class="f9 c6">Limit Mailbox:</span></td><td><select name="limit_mailbox">
<option value="true" selected="selected">Yes</option> <option value="true">Yes</option>
<option value="false">No</option> <option value="false" selected="selected">No</option>
</select></td></tr> </select> (NOT DONE)</td></tr>
<tr><td><span class="f9 c6">Max mails:</span></td><td><input type="text" name="max_mails" id="max_mails" value="30" size="4"></td></tr> <tr><td><span class="f9 c6">Max mails:</span></td><td><input type="text" name="max_mails" id="max_mails" value="30" size="4"> (NOT DONE)</td></tr>
<tr> <tr>
<td><span class="f9 c6">Demolish - lvl required:</span></td><td><select name="demolish"> <td><span class="f9 c6">Demolish - lvl required:</span></td><td><select name="demolish">
<option value="5">5</option> <option value="5">5</option>
<option value="10" selected="selected">10</option> <option value="10" selected="selected">10 - Default</option>
<option value="15">15</option> <option value="15">15</option>
<option value="20">20</option> <option value="20">20</option>
</select></td></tr> </select></td></tr>
+10
View File
@@ -19,6 +19,16 @@
<li>Last but not least, Enjoy.</li> <li>Last but not least, Enjoy.</li>
</ul> </ul>
<ul>
<li><h4>CHMOD:</h4></li>
<li>install to 777</li>
<li>GameEngine to 777</li>
<li><h4>After CHMOD:</h4></li>
<li>Delete install folder</li>
<li>Change CHMOD GameEngine back to 644 and CHMOD 777: Prevention, Notes</li>
</ul>
<div class="lbox"> <div class="lbox">
TravianX Team TravianX Team
</div> </div>
+1 -1
View File
@@ -150,7 +150,7 @@ if(T4_COMING==true){
<a href="../index.php#spielregeln" target="_blank"><?php echo SPIELREGELN; ?></a> | <a href="../index.php#spielregeln" target="_blank"><?php echo SPIELREGELN; ?></a> |
<a href="../index.php#impressum" target="_blank"><?php echo SPIELREGELN; ?></a> <a href="../index.php#impressum" target="_blank"><?php echo SPIELREGELN; ?></a>
<br /> <br />
© 2011 ZravianX | By <a href="http://zzjhons.com">ZZJHONS</a> © 2012 Travian
</div> </div>
</div> </div>
</div> </div>
+4 -4
View File
@@ -5,14 +5,14 @@
## ## ## ##
## --------------------------------------------------------------------------- ## ## --------------------------------------------------------------------------- ##
## ## ## ##
## Project: ZravianX ## ## Project: ZravianX & TravianZ ##
## Version: 2011.11.02 ## ## Version: 2011.11.02 ##
## Filename: notification/lang/en.php ## ## Filename: notification/lang/en.php ##
## Developed by: ZZJHONS ## ## Developed by: ZZJHONS & Songeriux ##
## License: Creative Commons BY-NC-SA 3.0 ## ## License: Creative Commons BY-NC-SA 3.0 ##
## Copyright: ZravianX (c) 2011 - All rights reserved ## ## Copyright: ZravianX (c) 2011 - All rights reserved ##
## URLs: http://zravianx.zzjhons.com ## ## URLs: http://zravianx.zzjhons.com ##
## Source code: http://www.github.com/ZZJHONS/ZravianX ## ## Source code: http://www.github.com/songeriux/TravianZ ##
## ## ## ##
################################################################################# #################################################################################
@@ -23,7 +23,7 @@ $lang['notification']['notify_me'] = "Please notify me when TRAVIAN 4 begins";
$lang['notification']['email'] = "Email address"; $lang['notification']['email'] = "Email address";
$lang['notification']['send'] = "Send"; $lang['notification']['send'] = "Send";
$lang['notification']['error'] = "Sorry, but this don't work now."; $lang['notification']['error'] = "Sorry, but this don't work now.";
$lang['notification']['i_agree'] = "I agree that ZravianX can inform me about interesting news and game related information."; $lang['notification']['i_agree'] = "I agree that TRAVIAN can inform me about interesting news and game related information.";
$lang['notification']['facebook_page'] = "http%3A%2F%2Fwww.facebook.com%2Ftravianx"; $lang['notification']['facebook_page'] = "http%3A%2F%2Fwww.facebook.com%2Ftravianx";
$lang['notification']['see_features'] = "See the new features of TRAVIAN 4"; $lang['notification']['see_features'] = "See the new features of TRAVIAN 4";
$lang['notification']['screenshots'] = "Screenshots"; $lang['notification']['screenshots'] = "Screenshots";