General fixes

+Fixed a bug that permitted to attack occupied oasis (even through the
farmlist) even if the oasis' owner was banned
+Rewritten some code in Units.php, for a better errors handling
+Fixed some errors that could have showed sometimes
+Fixed a bug that didn't permit to send an attack under certain
circumstances
+Villages/oasis with X = 0 or Y = 0 as a coordinates, can now be raided
+You are now be able to send resources with the merchants, at villages
with X = 0 or Y = 0 as a coordinates
This commit is contained in:
iopietro
2018-05-29 18:57:14 +02:00
parent 498aaa962a
commit 36b790d08a
9 changed files with 181 additions and 226 deletions
+1 -2
View File
@@ -13,8 +13,7 @@ if($session->access == BANNED){
$opt = $database->getAlliPermissions($session->uid, $aid);
$displayarray = $database->getUserArray($session->uid, 1);
$forumcat = $database->ForumCat(htmlspecialchars($displayarray['alliance']));
$forumcat = array_merge($forumcat,
$forumcat = array_merge(!empty($forumcat) ? $forumcat : [],
$session->sharedForums['alliance'],
$session->sharedForums['confederation'],
$session->sharedForums['closed']);
+2 -2
View File
@@ -20,7 +20,7 @@ for ($a = 1; $a <= 4; $a++) {
}
}
$allres = (int) $_POST['r1'] + (int) $_POST['r2'] + (int) $_POST['r3'] + (int) $_POST['r4'];
if(!empty($_POST['x']) && !empty($_POST['y']) && is_numeric($_POST['x']) && is_numeric($_POST['y'])){
if($_POST['x'] != "" && $_POST['y'] != "" && is_numeric($_POST['x']) && is_numeric($_POST['y'])){
$getwref = $database->getVilWref($_POST['x'],$_POST['y']);
$checkexist = $database->checkVilExist($getwref);
}
@@ -72,7 +72,7 @@ if(isset($_POST['ft'])=='check' && (($_POST['send3'] > 1 && $_POST['send3'] <= 3
<tbody><tr>
<th><?php echo COORDINATES;?>:</th>
<?php
if(!empty($_POST['x']) && !empty($_POST['y']) && is_numeric($_POST['x']) && is_numeric($_POST['y'])){
if($_POST['x'] != "" && $_POST['y'] != "" && is_numeric($_POST['x']) && is_numeric($_POST['y'])){
$getwref = $database->getVilWref($_POST['x'],$_POST['y']);
$getvilname = $database->getVillageField($getwref, "name");
$getvilowner = $database->getVillageField($getwref, "owner");
+3 -3
View File
@@ -20,7 +20,7 @@ if(isset($_POST['action']) && $_POST['action'] == 'addSlot' && isset($_POST['lid
$type = $database->getVillageType2($Wref);
$oasistype = $type;
$vdata = $database->getVillage($Wref);
}elseif(!empty($_POST['x']) && !empty($_POST['y']) && is_numeric($_POST['x']) && is_numeric($_POST['y']) && $_POST['x'] <= WORLD_MAX && $_POST['y'] <= WORLD_MAX){
}elseif($_POST['x'] != "" && $_POST['y'] != "" && is_numeric($_POST['x']) && is_numeric($_POST['y']) && $_POST['x'] <= WORLD_MAX && $_POST['y'] <= WORLD_MAX){
$Wref = $database->getVilWref($_POST['x'], $_POST['y']);
$WrefX = $_POST['x'];
$WrefY = $_POST['y'];
@@ -29,8 +29,8 @@ if(isset($_POST['action']) && $_POST['action'] == 'addSlot' && isset($_POST['lid
$vdata = $database->getVillage($Wref);
}
if(empty($_POST['x']) && empty($_POST['y']) && empty($_POST['target_id'])) $errormsg = "Enter coordinates.";
elseif((empty($_POST['x']) || empty($_POST['y'])) && empty($_POST['target_id'])) $errormsg = "Enter the correct coordinates.";
if($_POST['x'] == "" && $_POST['y'] == "" && empty($_POST['target_id'])) $errormsg = "Enter coordinates.";
elseif(($_POST['x'] = "" || $_POST['y'] = "") && empty($_POST['target_id'])) $errormsg = "Enter the correct coordinates.";
elseif($oasistype == 0 && $vdata == 0) $errormsg = "There is no village on those coordinates.";
elseif($troops == 0) $errormsg = "No troops has been selected.";
elseif($database->hasBeginnerProtection($Wref) == 1) $errormsg = "Player under protection.";
+3 -3
View File
@@ -24,7 +24,7 @@ if(isset($_POST['action']) == 'editSlot' && isset($_GET['eid']) && !empty($_GET[
$type = $database->getVillageType2($Wref);
$oasistype = $type;
$vdata = $database->getVillage($Wref);
}elseif(!empty($_POST['x']) && !empty($_POST['y']) && is_numeric($_POST['x']) && is_numeric($_POST['y'])){
}elseif($_POST['x'] != "" && $_POST['y'] != "" && is_numeric($_POST['x']) && is_numeric($_POST['y'])){
$Wref = $database->getVilWref($_POST['x'], $_POST['y']);
$WrefX = $_POST['x'];
$WrefY = $_POST['y'];
@@ -38,8 +38,8 @@ if(isset($_POST['action']) == 'editSlot' && isset($_GET['eid']) && !empty($_GET[
if(!in_array($i + ($session->tribe - 1) * 10, [4, 14, 23])) $troops += $_POST['t'.$i];
}
if(empty($_POST['x']) && empty($_POST['y']) && empty($_POST['target_id'])) $errormsg = "Enter coordinates.";
elseif((empty($_POST['x']) || empty($_POST['y'])) && empty($_POST['target_id'])) $errormsg = "Enter the correct coordinates.";
if($_POST['x'] == "" && $_POST['y'] == "" && empty($_POST['target_id'])) $errormsg = "Enter coordinates.";
elseif(($_POST['x'] == "" || $_POST['y'] == "") && empty($_POST['target_id'])) $errormsg = "Enter the correct coordinates.";
elseif($oasistype == 0 && $vdata == 0) $errormsg = "There is no village on those coordinates.";
elseif($troops == 0) $errormsg = "No troops has been selected.";
elseif($database->hasBeginnerProtection($Wref) == 1) $errormsg = "Player under protection.";