diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php
index 2ae5f073..693ce035 100644
--- a/GameEngine/Automation.php
+++ b/GameEngine/Automation.php
@@ -473,32 +473,6 @@ class Automation {
$q = "UPDATE " . TB_PREFIX . "odata set maxstore = $maxstore, maxcrop = $maxcrop where wref = ".$getoasis['wref']."";
$database->query($q);
}
- $q = "SELECT * FROM ".TB_PREFIX."odata WHERE wood > maxstore OR clay > maxstore OR iron > maxstore OR crop > maxcrop";
- $array = $database->query_return($q);
- foreach($array as $getoasis) {
- if($getoasis['wood'] > $getoasis['maxstore']){
- $wood = $getoasis['maxstore'];
- }else{
- $wood = $getoasis['wood'];
- }
- if($getoasis['clay'] > $getoasis['maxstore']){
- $clay = $getoasis['maxstore'];
- }else{
- $clay = $getoasis['clay'];
- }
- if($getoasis['iron'] > $getoasis['maxstore']){
- $iron = $getoasis['maxstore'];
- }else{
- $iron = $getoasis['iron'];
- }
- if($getoasis['crop'] > $getoasis['maxstore']){
- $crop = $getoasis['maxstore'];
- }else{
- $crop = $getoasis['crop'];
- }
- $q = "UPDATE " . TB_PREFIX . "odata set wood = $wood, clay = $clay, iron = $iron, crop = $crop where wref = ".$getoasis['wref']."";
- $database->query($q);
- }
$q = "SELECT * FROM ".TB_PREFIX."odata WHERE wood < 0 OR clay < 0 OR iron < 0 OR crop < 0";
$array = $database->query_return($q);
foreach($array as $getoasis) {
@@ -698,6 +672,9 @@ class Automation {
if($indi['type'] == 40 and ($indi['level'] % 5 == 0 or $indi['level'] > 95) and $indi['level'] != 100){
$this->startNatarAttack($indi['level'], $indi['wid'], $indi['timestamp']);
}
+ if($indi['type'] == 40 && $indi['level'] == 100){ //now can't be more than one winners if ww to level 100 is build by 2 users or more on same time
+ mysql_query("TRUNCATE ".TB_PREFIX."bdata");
+ }
if($database->getUserField($database->getVillageField($indi['wid'],"owner"),"tribe",0) != 1){
$q4 = "UPDATE ".TB_PREFIX."bdata set loopcon = 0 where loopcon = 1 and master = 0 and wid = ".$indi['wid'];
$database->query($q4);
@@ -914,6 +891,7 @@ class Automation {
$q = "SELECT * FROM ".TB_PREFIX."route where timestamp < $time";
$dataarray = $database->query_return($q);
foreach($dataarray as $data) {
+ $database->modifyResource($data['from'],$data['wood'],$data['clay'],$data['iron'],$data['crop'],0);
$targettribe = $database->getUserField($database->getVillageField($data['from'],"owner"),"tribe",0);
$this->sendResource2($data['wood'],$data['clay'],$data['iron'],$data['crop'],$data['from'],$data['wid'],$targettribe,$data['deliveries']);
$database->editTradeRoute($data['id'],"timestamp",86400,1);
@@ -1626,7 +1604,7 @@ class Automation {
$cranny = 0;
for($i=19;$i<39;$i++){
if($buildarray['f'.$i.'t']==23){
- $cranny += $bid23[$buildarray['f'.$i.'']]['attri'];
+ $cranny += $bid23[$buildarray['f'.$i.'']]['attri']*CRANNY_CAPACITY;
}
}
@@ -3929,11 +3907,24 @@ $crannyimg = "
query_return($q);
foreach($array as $getoasis) {
- $oasiswood = (8*SPEED/3600)*(time()-$getoasis['lastupdated']);
- $oasisclay = (8*SPEED/3600)*(time()-$getoasis['lastupdated']);
- $oasisiron = (8*SPEED/3600)*(time()-$getoasis['lastupdated']);
- $oasiscrop = (8*SPEED/3600)*(time()-$getoasis['lastupdated']);
- $database->modifyOasisResource($getoasis['wref'],$oasiswood,$oasisclay,$oasisiron,$oasiscrop,1);
+ $oasiswood = $getoasis['wood'] + (8*SPEED/3600)*(time()-$getoasis['lastupdated']);
+ $oasisclay = $getoasis['clay'] + (8*SPEED/3600)*(time()-$getoasis['lastupdated']);
+ $oasisiron = $getoasis['iron'] + (8*SPEED/3600)*(time()-$getoasis['lastupdated']);
+ $oasiscrop = $getoasis['crop'] + (8*SPEED/3600)*(time()-$getoasis['lastupdated']);
+ if($oasiswood > $getoasis['maxstore']){
+ $oasiswood = $getoasis['maxstore'];
+ }
+ if($oasisclay > $getoasis['maxstore']){
+ $oasisclay = $getoasis['maxstore'];
+ }
+ if($oasisiron > $getoasis['maxstore']){
+ $oasisiron = $getoasis['maxstore'];
+ }
+ if($oasiscrop > $getoasis['maxcrop']){
+ $oasiscrop = $getoasis['maxcrop'];
+ }
+ $q = "UPDATE " . TB_PREFIX . "odata set wood = $oasiswood, clay = $oasisclay, iron = $oasisiron, crop = $oasiscrop where wref = ".$getoasis['wref']."";
+ $database->query($q);
$database->updateOasis($getoasis['wref']);
}
}
diff --git a/GameEngine/Building.php b/GameEngine/Building.php
index 19596f57..a4f2bb2b 100644
--- a/GameEngine/Building.php
+++ b/GameEngine/Building.php
@@ -695,6 +695,8 @@ class Building {
$buildiron = $buildarray[$level]['iron'];
$buildcrop = $buildarray[$level]['crop'];
if($buildwood < $villwood && $buildclay < $villclay && $buildiron < $villiron && $buildcrop < $villcrop){
+ $newgold = $session->gold-1;
+ $database->updateUserField($session->uid, "gold", $newgold, 1);
$enought_res = 1;
$q = "UPDATE ".TB_PREFIX."fdata set f".$jobs['field']." = ".$jobs['level'].", f".$jobs['field']."t = ".$jobs['type']." where vref = ".$jobs['wid'];
}
diff --git a/GameEngine/Database/db_MYSQL.php b/GameEngine/Database/db_MYSQL.php
index 0a7c4c07..66a8dee6 100644
--- a/GameEngine/Database/db_MYSQL.php
+++ b/GameEngine/Database/db_MYSQL.php
@@ -20,7 +20,7 @@ class MYSQL_DB {
function register($username, $password, $email, $tribe, $act) {
$time = time();
- $timep = (time() + PROTECTION);
+ $timep = (strtotime(START_TIME) + PROTECTION);
$q = "INSERT INTO " . TB_PREFIX . "users (username,password,access,email,timestamp,tribe,act,protect,lastupdate,regtime) VALUES ('$username', '$password', " . USER . ", '$email', $time, $tribe, '$act', $timep, $time, $time)";
if(mysql_query($q, $this->connection)) {
return mysql_insert_id($this->connection);
@@ -2151,7 +2151,7 @@ class MYSQL_DB {
}
function getARanking() {
- $q = "SELECT id,name,tag,oldrank FROM " . TB_PREFIX . "alidata where id != '' ORDER BY id DESC";
+ $q = "SELECT id,name,tag,oldrank,Aap,Adp FROM " . TB_PREFIX . "alidata where id != '' ORDER BY id DESC";
$result = mysql_query($q, $this->connection);
return $this->mysql_fetch_all($result);
}
diff --git a/GameEngine/Message.php b/GameEngine/Message.php
index e213102d..881cc1ef 100644
--- a/GameEngine/Message.php
+++ b/GameEngine/Message.php
@@ -118,6 +118,22 @@ class Message {
if($message['id'] == $id) {
$message = preg_replace('/\[message\]/', '', $message);
$message = preg_replace('/\[\/message\]/', '', $message);
+ for($i=1;$i<=$message['alliance'];$i++){
+ $message = preg_replace('/\[alliance'.$i.'\]/', '[alliance0]', $message);
+ $message = preg_replace('/\[\/alliance'.$i.'\]/', '[/alliance0]', $message);
+ }
+ for($i=0;$i<=$message['player'];$i++){
+ $message = preg_replace('/\[player'.$i.'\]/', '[player0]', $message);
+ $message = preg_replace('/\[\/player'.$i.'\]/', '[/player0]', $message);
+ }
+ for($i=0;$i<=$message['coor'];$i++){
+ $message = preg_replace('/\[coor'.$i.'\]/', '[coor0]', $message);
+ $message = preg_replace('/\[\/coor'.$i.'\]/', '[/coor0]', $message);
+ }
+ for($i=0;$i<=$message['report'];$i++){
+ $message = preg_replace('/\[report'.$i.'\]/', '[report0]', $message);
+ $message = preg_replace('/\[\/report'.$i.'\]/', '[/report0]', $message);
+ }
$this->reply = $_SESSION['reply'] = $message;
header("Location: nachrichten.php?t=1&id=" . $message['owner']);
}
@@ -392,18 +408,6 @@ class Message {
$alliance = $player = $coor = $report = 0;
for($i=0;$i<=$alliance;$i++){
if(preg_match('/\[alliance'.$i.'\]/',$text) && preg_match('/\[\/alliance'.$i.'\]/',$text)){
- $alliance1 = preg_replace('/\[alliance'.$i.'\]/', '', $input);
- $alliance1 = preg_replace('/\[\/alliance'.$i.'\]/', '', $alliance1);
- if(preg_match('/\[alliance'.$i.'\]/',$alliance1) && preg_match('/\[\/alliance'.$i.'\]/',$alliance1)){
- $j = $i+1;
- $text = preg_replace('/\[alliance'.$i.'\]/', '/\[alliance'.$j.'\]/', $text);
- $text = preg_replace('/\[\/alliance'.$i.'\]/', '/\[\/alliance'.$j.'\]/', $text);
- $alliance += 1;
- }
- }
- }
- for($i=0;$i<=$alliance;$i++){
- if(preg_match('/\[alliance'.$i.'\]/',$text) && preg_match('/\[\/alliance'.$i.'\]/',$text)){
$alliance1 = preg_replace('/\[message\](.*?)\[\/alliance'.$i.'\]/is', '', $text);
if(preg_match('/\[alliance'.$i.'\]/',$alliance1) && preg_match('/\[\/alliance'.$i.'\]/',$alliance1)){
$j = $i+1;
diff --git a/GameEngine/Ranking.php b/GameEngine/Ranking.php
index 21d42b05..87ce2983 100644
--- a/GameEngine/Ranking.php
+++ b/GameEngine/Ranking.php
@@ -484,10 +484,7 @@
$holder = array();
foreach($array as $value) {
$memberlist = $database->getAllMember($value['id']);
- $totalap = 0;
- foreach($memberlist as $member) {
- $totalap += $member['ap'];
- }
+ $totalap = $value['Aap'];
$value['players'] = count($memberlist);
$value['totalap'] = $totalap;
if($value['avg'] > 0) {
@@ -512,14 +509,11 @@
$holder = array();
foreach($array as $value) {
$memberlist = $database->getAllMember($value['id']);
- $totaldp = 0;
- foreach($memberlist as $member) {
- $totaldp += $member['dp'];
- }
+ $totaldp = $value['Adp'];
$value['players'] = count($memberlist);
$value['totaldp'] = $totaldp;
if($value['avg'] > 0) {
- $value['avg'] = round($totalap / count($memberlist));
+ $value['avg'] = round($totaldp / count($memberlist));
} else {
$value['avg'] = 0;
}
diff --git a/GameEngine/Technology.php b/GameEngine/Technology.php
index a005a1bd..8f0958f6 100644
--- a/GameEngine/Technology.php
+++ b/GameEngine/Technology.php
@@ -179,7 +179,11 @@ class Technology {
}else{
$cropcalc = 0;
}
+ if($unit != "u99"){
$popcalc = floor($village->getProd("crop")/$unitarray['pop']);
+ }else{
+ $popcalc = $village->getProd("crop");
+ }
return min($woodcalc,$claycalc,$ironcalc,$cropcalc);
}
diff --git a/Templates/Alliance/Forum/forum_10.tpl b/Templates/Alliance/Forum/forum_10.tpl
index bb6c2659..317a7da0 100644
--- a/Templates/Alliance/Forum/forum_10.tpl
+++ b/Templates/Alliance/Forum/forum_10.tpl
@@ -6,10 +6,12 @@ $post_id = $_GET['pod'];
$topics = $database->ShowTopic($topic_id);
$posts = $database->ShowPostEdit($post_id);
foreach($topics as $top) {
- $title = $top['title'];
+ $title = stripslashes($top['title']);
}
foreach($posts as $pos) {
- $poss = $pos['post'];
+ $poss = stripslashes($pos['post']);
+ $poss = preg_replace('/\[message\]/', '', $poss);
+ $poss = preg_replace('/\[\/message\]/', '', $poss);
}
?>