mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-26 13:17:15 +00:00
Merge pull request #302 from Shadowss/patch-47
fix conquer oasis. Thanks to IngMak
This commit is contained in:
@@ -480,7 +480,14 @@ class MYSQL_DB {
|
|||||||
if($OasisInfo['conqured'] == 0 || $OasisInfo['conqured'] != 0 && $OasisInfo['loyalty'] < 99 / min(3,(4-$this->VillageOasisCount($OasisInfo['conqured']))) && $troopcount == 0) {
|
if($OasisInfo['conqured'] == 0 || $OasisInfo['conqured'] != 0 && $OasisInfo['loyalty'] < 99 / min(3,(4-$this->VillageOasisCount($OasisInfo['conqured']))) && $troopcount == 0) {
|
||||||
$CoordsVillage = $this->getCoor($vref);
|
$CoordsVillage = $this->getCoor($vref);
|
||||||
$CoordsOasis = $this->getCoor($wref);
|
$CoordsOasis = $this->getCoor($wref);
|
||||||
if(abs($CoordsOasis['x']-$CoordsVillage['x'])<=3 && abs($CoordsOasis['y']-$CoordsVillage['y'])<=3) {
|
$max = 2 * WORLD_MAX + 1;
|
||||||
|
$x1 = intval($CoordsOasis['x']);
|
||||||
|
$y1 = intval($CoordsOasis['y']);
|
||||||
|
$x2 = intval($CoordsVillage['x']);
|
||||||
|
$y2 = intval($CoordsVillage['y']);
|
||||||
|
$distanceX = min(abs($x2 - $x1), abs($max - abs($x2 - $x1)));
|
||||||
|
$distanceY = min(abs($y2 - $y1), abs($max - abs($y2 - $y1)));
|
||||||
|
if ($distanceX<=3 && $distanceY<=3) {
|
||||||
return True;
|
return True;
|
||||||
} else {
|
} else {
|
||||||
return False;
|
return False;
|
||||||
|
|||||||
Reference in New Issue
Block a user