Fixed attacking throu doors.
This commit is contained in:
@@ -226,7 +226,7 @@ public class GeoEngine
|
||||
* @param worldX
|
||||
* @return int : Geo X
|
||||
*/
|
||||
public final int getGeoX(int worldX)
|
||||
public static final int getGeoX(int worldX)
|
||||
{
|
||||
return (MathUtil.limit(worldX, L2World.MAP_MIN_X, L2World.MAP_MAX_X) - L2World.MAP_MIN_X) >> 4;
|
||||
}
|
||||
@@ -236,7 +236,7 @@ public class GeoEngine
|
||||
* @param worldY
|
||||
* @return int : Geo Y
|
||||
*/
|
||||
public final int getGeoY(int worldY)
|
||||
public static final int getGeoY(int worldY)
|
||||
{
|
||||
return (MathUtil.limit(worldY, L2World.MAP_MIN_Y, L2World.MAP_MAX_Y) - L2World.MAP_MIN_Y) >> 4;
|
||||
}
|
||||
@@ -246,7 +246,7 @@ public class GeoEngine
|
||||
* @param geoX
|
||||
* @return int : World X
|
||||
*/
|
||||
public final int getWorldX(int geoX)
|
||||
public static final int getWorldX(int geoX)
|
||||
{
|
||||
return (MathUtil.limit(geoX, 0, GeoStructure.GEO_CELLS_X) << 4) + L2World.MAP_MIN_X + 8;
|
||||
}
|
||||
@@ -256,7 +256,7 @@ public class GeoEngine
|
||||
* @param geoY
|
||||
* @return int : World Y
|
||||
*/
|
||||
public final int getWorldY(int geoY)
|
||||
public static final int getWorldY(int geoY)
|
||||
{
|
||||
return (MathUtil.limit(geoY, 0, GeoStructure.GEO_CELLS_Y) << 4) + L2World.MAP_MIN_Y + 8;
|
||||
}
|
||||
@@ -568,6 +568,16 @@ public class GeoEngine
|
||||
final int ty = target.getY();
|
||||
final int tz = target.getZ();
|
||||
|
||||
if (DoorData.getInstance().checkIfDoorsBetween(ox, oy, oz, tx, ty, tz, origin.getInstanceWorld(), false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (WarpedSpaceManager.getInstance().checkForWarpedSpace(new Location(ox, oy, oz), new Location(tx, ty, tz), origin.getInstanceWorld()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// get origin and check existing geo coordinates
|
||||
final int gox = getGeoX(ox);
|
||||
final int goy = getGeoY(oy);
|
||||
@@ -609,7 +619,7 @@ public class GeoEngine
|
||||
}
|
||||
|
||||
// perform geodata check
|
||||
return door ? checkSeeOriginal(gox, goy, goz, oheight, gtx, gty, gtz, theight) : checkSee(gox, goy, goz, oheight, gtx, gty, gtz, theight);
|
||||
return door ? checkSeeOriginal(gox, goy, goz, oheight, gtx, gty, gtz, theight, origin.getInstanceWorld()) : checkSee(gox, goy, goz, oheight, gtx, gty, gtz, theight, origin.getInstanceWorld());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -628,6 +638,16 @@ public class GeoEngine
|
||||
final int ty = position.getY();
|
||||
final int tz = position.getZ();
|
||||
|
||||
if (DoorData.getInstance().checkIfDoorsBetween(ox, oy, oz, tx, ty, tz, origin.getInstanceWorld(), false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (WarpedSpaceManager.getInstance().checkForWarpedSpace(new Location(ox, oy, oz), new Location(tx, ty, tz), origin.getInstanceWorld()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// get origin and check existing geo coordinates
|
||||
final int gox = getGeoX(ox);
|
||||
final int goy = getGeoY(oy);
|
||||
@@ -662,7 +682,7 @@ public class GeoEngine
|
||||
}
|
||||
|
||||
// perform geodata check
|
||||
return checkSee(gox, goy, goz, oheight, gtx, gty, gtz, 0);
|
||||
return checkSee(gox, goy, goz, oheight, gtx, gty, gtz, 0, origin.getInstanceWorld());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -675,9 +695,10 @@ public class GeoEngine
|
||||
* @param gty : target Y geodata coordinate
|
||||
* @param gtz : target Z geodata coordinate
|
||||
* @param theight : target height (if instance of {@link Character})
|
||||
* @param instance
|
||||
* @return {@code boolean} : True, when target can be seen.
|
||||
*/
|
||||
protected final boolean checkSee(int gox, int goy, int goz, double oheight, int gtx, int gty, int gtz, double theight)
|
||||
protected final boolean checkSee(int gox, int goy, int goz, double oheight, int gtx, int gty, int gtz, double theight, Instance instance)
|
||||
{
|
||||
// get line of sight Z coordinates
|
||||
double losoz = goz + ((oheight * Config.PART_OF_CHARACTER_HEIGHT) / 100);
|
||||
@@ -857,9 +878,10 @@ public class GeoEngine
|
||||
* @param gty : target Y geodata coordinate
|
||||
* @param gtz : target Z geodata coordinate
|
||||
* @param theight : target height (if instance of {@link Character} or {@link L2DoorInstance})
|
||||
* @param instance
|
||||
* @return {@code boolean} : True, when target can be seen.
|
||||
*/
|
||||
protected final boolean checkSeeOriginal(int gox, int goy, int goz, double oheight, int gtx, int gty, int gtz, double theight)
|
||||
protected final boolean checkSeeOriginal(int gox, int goy, int goz, double oheight, int gtx, int gty, int gtz, double theight, Instance instance)
|
||||
{
|
||||
// get line of sight Z coordinates
|
||||
double losoz = goz + ((oheight * Config.PART_OF_CHARACTER_HEIGHT) / 100);
|
||||
@@ -1040,16 +1062,6 @@ public class GeoEngine
|
||||
*/
|
||||
public final boolean canMoveToTarget(int ox, int oy, int oz, int tx, int ty, int tz, Instance instance)
|
||||
{
|
||||
if (DoorData.getInstance().checkIfDoorsBetween(ox, oy, oz, tx, ty, tz, instance, false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (WarpedSpaceManager.getInstance().checkForWarpedSpace(new Location(ox, oy, oz), new Location(tx, ty, tz), instance))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// get origin and check existing geo coordinates
|
||||
final int gox = getGeoX(ox);
|
||||
final int goy = getGeoY(oy);
|
||||
@@ -1094,16 +1106,6 @@ public class GeoEngine
|
||||
*/
|
||||
public final Location canMoveToTargetLoc(int ox, int oy, int oz, int tx, int ty, int tz, Instance instance)
|
||||
{
|
||||
if (DoorData.getInstance().checkIfDoorsBetween(ox, oy, oz, tx, ty, tz, instance, false))
|
||||
{
|
||||
return new Location(ox, oy, getHeight(ox, oy, oz));
|
||||
}
|
||||
|
||||
if (WarpedSpaceManager.getInstance().checkForWarpedSpace(new Location(ox, oy, oz), new Location(tx, ty, tz), instance))
|
||||
{
|
||||
return new Location(ox, oy, getHeight(ox, oy, oz));
|
||||
}
|
||||
|
||||
// get origin and check existing geo coordinates
|
||||
final int gox = getGeoX(ox);
|
||||
final int goy = getGeoY(oy);
|
||||
|
@@ -51,13 +51,13 @@ public class GeoLocation extends Location
|
||||
@Override
|
||||
public int getX()
|
||||
{
|
||||
return GeoEngine.getInstance().getWorldX(_x);
|
||||
return GeoEngine.getWorldX(_x);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getY()
|
||||
{
|
||||
return GeoEngine.getInstance().getWorldY(_y);
|
||||
return GeoEngine.getWorldY(_y);
|
||||
}
|
||||
|
||||
public byte getNSWE()
|
||||
|
Reference in New Issue
Block a user