diff --git a/GameEngine/Automation.php b/GameEngine/Automation.php index 6515f14c..a8da60e5 100644 --- a/GameEngine/Automation.php +++ b/GameEngine/Automation.php @@ -385,7 +385,7 @@ private function loyaltyRegeneration() { $needDelete = $database->getNeedDelete(); if(count($needDelete) > 0) { foreach($needDelete as $need) { - $needVillage = $database->getVillagesID($need['uid']); //wref + $needVillage = $database->getVillagesID($need['uid']); foreach($needVillage as $village) { $q = "DELETE FROM ".TB_PREFIX."abdata where wref = ".$village; $database->query($q); @@ -409,7 +409,7 @@ private function loyaltyRegeneration() { $database->query($q); $q = "DELETE FROM ".TB_PREFIX."units where vref =".$village; $database->query($q); - $q = "DELETE FROM ".TB_PREFIX."vdata where owner = ".$village; + $q = "DELETE FROM ".TB_PREFIX."vdata where vref = ".$village; $database->query($q); $q = "UPDATE ".TB_PREFIX."wdata set occupied = 0 where id = ".$village; $database->query($q); @@ -1331,8 +1331,8 @@ ${dead.$i}=$data['t'.$i]; { if ($catp!='0') { - $villpop=$this->recountPop($data['to']); - if($villpop<=0) + $pop=$this->recountPop($data['to']); + if($pop<=0) { $info_cat = ",".$catp_pic.", Village already destroyed."; } diff --git a/GameEngine/Database/db_MYSQL.php b/GameEngine/Database/db_MYSQL.php index 6386db29..d8f59fb4 100644 --- a/GameEngine/Database/db_MYSQL.php +++ b/GameEngine/Database/db_MYSQL.php @@ -114,7 +114,7 @@ return $this->mysql_fetch_all($result); } -function getVilWref($x, $y) { + function getVilWref($x, $y) { $q = "SELECT * FROM " . TB_PREFIX . "wdata where x = $x AND y = $y"; $result = mysql_query($q, $this->connection); $dbarray = mysql_fetch_array($result); @@ -299,8 +299,8 @@ function getVilWref($x, $y) { } } - function generateBase($sector) { - switch($sector) { + function generateBase($sector) { + switch($sector) { case 1: $q = "Select * from ".TB_PREFIX."wdata where fieldtype = 3 and x < 0 and y > 0 and occupied = 0"; break; @@ -313,13 +313,13 @@ function getVilWref($x, $y) { case 4: $q = "Select * from ".TB_PREFIX."wdata where fieldtype = 3 and x > 0 and y < 0 and occupied = 0"; break; - } + } $result = mysql_query($q, $this->connection); $num_rows = mysql_num_rows($result); $result = $this->mysql_fetch_all($result); $base = rand(0, ($num_rows-1)); return $result[$base]['id']; - } + } function setFieldTaken($id) { $q = "UPDATE " . TB_PREFIX . "wdata set occupied = 1 where id = $id"; @@ -883,21 +883,20 @@ function getVilWref($x, $y) { return mysql_query($q, $this->connection); } -function getVillageType2($wref) { + function getVillageType2($wref) { $q = "SELECT * FROM " . TB_PREFIX . "wdata where id = $wref"; -//$q = "SELECT * FROM " . TB_PREFIX . "units where id = $wref"; $result = mysql_query($q, $this->connection); $dbarray = mysql_fetch_array($result); return $dbarray['oasistype']; } -function getFLData($id) { + function getFLData($id) { $q = "SELECT * FROM " . TB_PREFIX . "farmlist where id = $id"; $result = mysql_query($q, $this->connection); return mysql_fetch_array($result); } -function checkVilExist($wref) { + function checkVilExist($wref) { $q = "SELECT * FROM " . TB_PREFIX . "vdata where wref = '$wref'"; $result = mysql_query($q, $this->connection); if(mysql_num_rows($result)) { diff --git a/Templates/Build/17.tpl b/Templates/Build/17.tpl index bd1bef40..eadbcfde 100644 --- a/Templates/Build/17.tpl +++ b/Templates/Build/17.tpl @@ -12,8 +12,98 @@ var haendler = merchantAvail(); ?>; var carry = maxcarry; ?>; //--> -
+ +getVilWref($_POST['x'],$_POST['y']); + $checkexist = $database->checkVilExist($getwref); +} +else if($_POST['dname']!=""){ + $getwref = $database->getVillageByName($_POST['dname']); + $checkexist = $database->checkVilExist($getwref); +} +if(isset($_POST['ft'])=='check' && $allres!=0 && ($_POST['x']!="" && $_POST['y']!="" or $_POST['dname']!="") && $checkexist){ +?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Fa Wood / maxcarry; ?>
Agyag Clay / maxcarry; ?>
Vas?rc Iron + / maxcarry; ?>
B?za Wheat + / maxcarry; ?>
+ + + + getVilWref($_POST['x'],$_POST['y']); + $getvilname = $database->getVillageField($getwref, "name"); + $getvilowner = $database->getVillageField($getwref, "owner"); + $getvilcoor['y'] = $_POST['y']; + $getvilcoor['x'] = $_POST['x']; + } + else if($_POST['dname']!=""){ + $getwref = $database->getVillageByName($_POST['dname']); + $getvilcoor = $database->getCoor($getwref); + $getvilname = $database->getVillageField($getwref, "name"); + $getvilowner = $database->getVillageField($getwref, "owner"); + } + ?> + + + + + + + + + + + + + + + + + + + +
Coordinates:(|)
Player:getUserField($getvilowner,username,0); ?>
duration:-
Merchants:maxcarry); ?>
+
+
+

+

merchantAvail()) { echo "DISABLED"; }?>/>

+ +
+
@@ -97,11 +187,25 @@ $coor['y'] = "";
-

merchantAvail()) { echo "DISABLED"; }?>/>

+

merchantAvail()) { echo "DISABLED"; }?>/>

+No Coordinates selected'; + }elseif($_POST['r1']==0){ + $error = 'Resources not selected.'; + }elseif(!$_POST['x'] && !$_POST['y'] && !$_POST['dname']){ + $error = 'Enter the coordinates.'; + }elseif($_POST['x']==0 && $_POST['y']==0 && !$_POST['dname']){ + $error = 'Enter the coordinates.'; + } + echo $error; +} +?> +

+

Each merchant can carry maxcarry; ?> units of resource