Sync with L2JServer Jan 24th 2015.
This commit is contained in:
@ -18,13 +18,13 @@
|
||||
*/
|
||||
package com.l2jserver.gameserver;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.datatables.DoorTable;
|
||||
import com.l2jserver.gameserver.data.xml.impl.DoorData;
|
||||
import com.l2jserver.gameserver.model.L2Object;
|
||||
import com.l2jserver.gameserver.model.L2World;
|
||||
import com.l2jserver.gameserver.model.Location;
|
||||
@ -50,12 +50,6 @@ public class GeoData
|
||||
|
||||
protected GeoData()
|
||||
{
|
||||
if (Config.GEODATA == 0)
|
||||
{
|
||||
LOGGER.info(getClass().getSimpleName() + ": Disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
int loadedRegions = 0;
|
||||
try
|
||||
{
|
||||
@ -74,7 +68,7 @@ public class GeoData
|
||||
loadedRegions++;
|
||||
}
|
||||
}
|
||||
else if (Config.TRY_LOAD_UNSPECIFIED_REGIONS)
|
||||
else if (Config.TRY_LOAD_UNSPECIFIED_REGIONS && Files.exists(geoFilePath))
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -84,11 +78,7 @@ public class GeoData
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// ignore file not found errors
|
||||
if (!(e instanceof FileNotFoundException))
|
||||
{
|
||||
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Failed to load " + geoFilePath.getFileName() + "!", e);
|
||||
}
|
||||
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Failed to load " + geoFilePath.getFileName() + "!", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -121,25 +111,25 @@ public class GeoData
|
||||
public boolean checkNearestNsweAntiCornerCut(int geoX, int geoY, int worldZ, int nswe)
|
||||
{
|
||||
boolean can = true;
|
||||
if ((nswe & Cell.NSWE_NORTH_EAST) != 0)
|
||||
if ((nswe & Cell.NSWE_NORTH_EAST) == Cell.NSWE_NORTH_EAST)
|
||||
{
|
||||
// can = canEnterNeighbors(prevX, prevY - 1, prevGeoZ, Direction.EAST) && canEnterNeighbors(prevX + 1, prevY, prevGeoZ, Direction.NORTH);
|
||||
can = checkNearestNswe(geoX, geoY - 1, worldZ, Cell.NSWE_EAST) && checkNearestNswe(geoX + 1, geoY, worldZ, Cell.NSWE_NORTH);
|
||||
}
|
||||
|
||||
if (can && ((nswe & Cell.NSWE_NORTH_WEST) != 0))
|
||||
if (can && ((nswe & Cell.NSWE_NORTH_WEST) == Cell.NSWE_NORTH_WEST))
|
||||
{
|
||||
// can = canEnterNeighbors(prevX, prevY - 1, prevGeoZ, Direction.WEST) && canEnterNeighbors(prevX - 1, prevY, prevGeoZ, Direction.NORTH);
|
||||
can = checkNearestNswe(geoX, geoY - 1, worldZ, Cell.NSWE_WEST) && checkNearestNswe(geoX, geoY - 1, worldZ, Cell.NSWE_NORTH);
|
||||
}
|
||||
|
||||
if (can && ((nswe & Cell.NSWE_SOUTH_EAST) != 0))
|
||||
if (can && ((nswe & Cell.NSWE_SOUTH_EAST) == Cell.NSWE_SOUTH_EAST))
|
||||
{
|
||||
// can = canEnterNeighbors(prevX, prevY + 1, prevGeoZ, Direction.EAST) && canEnterNeighbors(prevX + 1, prevY, prevGeoZ, Direction.SOUTH);
|
||||
can = checkNearestNswe(geoX, geoY + 1, worldZ, Cell.NSWE_EAST) && checkNearestNswe(geoX + 1, geoY, worldZ, Cell.NSWE_SOUTH);
|
||||
}
|
||||
|
||||
if (can && ((nswe & Cell.NSWE_SOUTH_WEST) != 0))
|
||||
if (can && ((nswe & Cell.NSWE_SOUTH_WEST) == Cell.NSWE_SOUTH_WEST))
|
||||
{
|
||||
// can = canEnterNeighbors(prevX, prevY + 1, prevGeoZ, Direction.WEST) && canEnterNeighbors(prevX - 1, prevY, prevGeoZ, Direction.SOUTH);
|
||||
can = checkNearestNswe(geoX, geoY + 1, worldZ, Cell.NSWE_WEST) && checkNearestNswe(geoX - 1, geoY, worldZ, Cell.NSWE_SOUTH);
|
||||
@ -151,25 +141,25 @@ public class GeoData
|
||||
public boolean checkNearestNsweAntiCornerCut(int geoX, int geoY, int worldZ, int nswe, int zDeltaLimit)
|
||||
{
|
||||
boolean can = true;
|
||||
if ((nswe & Cell.NSWE_NORTH_EAST) != 0)
|
||||
if ((nswe & Cell.NSWE_NORTH_EAST) == Cell.NSWE_NORTH_EAST)
|
||||
{
|
||||
// can = canEnterNeighbors(prevX, prevY - 1, prevGeoZ, Direction.EAST) && canEnterNeighbors(prevX + 1, prevY, prevGeoZ, Direction.NORTH);
|
||||
can = checkNearestNswe(geoX, geoY - 1, worldZ, Cell.NSWE_EAST, zDeltaLimit) && checkNearestNswe(geoX + 1, geoY, worldZ, Cell.NSWE_NORTH, zDeltaLimit);
|
||||
}
|
||||
|
||||
if (can && ((nswe & Cell.NSWE_NORTH_WEST) != 0))
|
||||
if (can && ((nswe & Cell.NSWE_NORTH_WEST) == Cell.NSWE_NORTH_WEST))
|
||||
{
|
||||
// can = canEnterNeighbors(prevX, prevY - 1, prevGeoZ, Direction.WEST) && canEnterNeighbors(prevX - 1, prevY, prevGeoZ, Direction.NORTH);
|
||||
can = checkNearestNswe(geoX, geoY - 1, worldZ, Cell.NSWE_WEST, zDeltaLimit) && checkNearestNswe(geoX, geoY - 1, worldZ, Cell.NSWE_NORTH, zDeltaLimit);
|
||||
}
|
||||
|
||||
if (can && ((nswe & Cell.NSWE_SOUTH_EAST) != 0))
|
||||
if (can && ((nswe & Cell.NSWE_SOUTH_EAST) == Cell.NSWE_SOUTH_EAST))
|
||||
{
|
||||
// can = canEnterNeighbors(prevX, prevY + 1, prevGeoZ, Direction.EAST) && canEnterNeighbors(prevX + 1, prevY, prevGeoZ, Direction.SOUTH);
|
||||
can = checkNearestNswe(geoX, geoY + 1, worldZ, Cell.NSWE_EAST, zDeltaLimit) && checkNearestNswe(geoX + 1, geoY, worldZ, Cell.NSWE_SOUTH, zDeltaLimit);
|
||||
}
|
||||
|
||||
if (can && ((nswe & Cell.NSWE_SOUTH_WEST) != 0))
|
||||
if (can && ((nswe & Cell.NSWE_SOUTH_WEST) == Cell.NSWE_SOUTH_WEST))
|
||||
{
|
||||
// can = canEnterNeighbors(prevX, prevY + 1, prevGeoZ, Direction.WEST) && canEnterNeighbors(prevX - 1, prevY, prevGeoZ, Direction.SOUTH);
|
||||
can = checkNearestNswe(geoX, geoY + 1, worldZ, Cell.NSWE_WEST, zDeltaLimit) && checkNearestNswe(geoX - 1, geoY, worldZ, Cell.NSWE_SOUTH, zDeltaLimit);
|
||||
@ -326,7 +316,7 @@ public class GeoData
|
||||
*/
|
||||
public boolean canSeeTarget(int x, int y, int z, int instanceId, int tx, int ty, int tz)
|
||||
{
|
||||
if (DoorTable.getInstance().checkIfDoorsBetween(x, y, z, tx, ty, tz, instanceId, true))
|
||||
if (DoorData.getInstance().checkIfDoorsBetween(x, y, z, tx, ty, tz, instanceId, true))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -442,25 +432,25 @@ public class GeoData
|
||||
boolean canSeeThrough = false;
|
||||
if ((curGeoZ <= maxHeight) && (curGeoZ <= beeCurGeoZ))
|
||||
{
|
||||
if ((nswe & Cell.NSWE_NORTH_EAST) != 0)
|
||||
if ((nswe & Cell.NSWE_NORTH_EAST) == Cell.NSWE_NORTH_EAST)
|
||||
{
|
||||
int northGeoZ = getLosGeoZ(prevX, prevY, prevGeoZ, prevX, prevY - 1, Cell.NSWE_EAST);
|
||||
int eastGeoZ = getLosGeoZ(prevX, prevY, prevGeoZ, prevX + 1, prevY, Cell.NSWE_NORTH);
|
||||
canSeeThrough = (northGeoZ <= maxHeight) && (eastGeoZ <= maxHeight) && (northGeoZ <= getNearestZ(prevX, prevY - 1, beeCurZ)) && (eastGeoZ <= getNearestZ(prevX + 1, prevY, beeCurZ));
|
||||
}
|
||||
else if ((nswe & Cell.NSWE_NORTH_WEST) != 0)
|
||||
else if ((nswe & Cell.NSWE_NORTH_WEST) == Cell.NSWE_NORTH_WEST)
|
||||
{
|
||||
int northGeoZ = getLosGeoZ(prevX, prevY, prevGeoZ, prevX, prevY - 1, Cell.NSWE_WEST);
|
||||
int westGeoZ = getLosGeoZ(prevX, prevY, prevGeoZ, prevX - 1, prevY, Cell.NSWE_NORTH);
|
||||
canSeeThrough = (northGeoZ <= maxHeight) && (westGeoZ <= maxHeight) && (northGeoZ <= getNearestZ(prevX, prevY - 1, beeCurZ)) && (westGeoZ <= getNearestZ(prevX - 1, prevY, beeCurZ));
|
||||
}
|
||||
else if ((nswe & Cell.NSWE_SOUTH_EAST) != 0)
|
||||
else if ((nswe & Cell.NSWE_SOUTH_EAST) == Cell.NSWE_SOUTH_EAST)
|
||||
{
|
||||
int southGeoZ = getLosGeoZ(prevX, prevY, prevGeoZ, prevX, prevY + 1, Cell.NSWE_EAST);
|
||||
int eastGeoZ = getLosGeoZ(prevX, prevY, prevGeoZ, prevX + 1, prevY, Cell.NSWE_SOUTH);
|
||||
canSeeThrough = (southGeoZ <= maxHeight) && (eastGeoZ <= maxHeight) && (southGeoZ <= getNearestZ(prevX, prevY + 1, beeCurZ)) && (eastGeoZ <= getNearestZ(prevX + 1, prevY, beeCurZ));
|
||||
}
|
||||
else if ((nswe & Cell.NSWE_SOUTH_WEST) != 0)
|
||||
else if ((nswe & Cell.NSWE_SOUTH_WEST) == Cell.NSWE_SOUTH_WEST)
|
||||
{
|
||||
int southGeoZ = getLosGeoZ(prevX, prevY, prevGeoZ, prevX, prevY + 1, Cell.NSWE_WEST);
|
||||
int westGeoZ = getLosGeoZ(prevX, prevY, prevGeoZ, prevX - 1, prevY, Cell.NSWE_SOUTH);
|
||||
@ -507,7 +497,7 @@ public class GeoData
|
||||
int tGeoY = getGeoY(ty);
|
||||
tz = getNearestZ(tGeoX, tGeoY, tz, Z_DELTA_LIMIT);
|
||||
|
||||
if (DoorTable.getInstance().checkIfDoorsBetween(x, y, z, tx, ty, tz, instanceId, false))
|
||||
if (DoorData.getInstance().checkIfDoorsBetween(x, y, z, tx, ty, tz, instanceId, false))
|
||||
{
|
||||
return new Location(x, y, getHeight(x, y, z));
|
||||
}
|
||||
@ -569,7 +559,7 @@ public class GeoData
|
||||
int tGeoY = getGeoY(toY);
|
||||
toZ = getNearestZ(tGeoX, tGeoY, toZ, Z_DELTA_LIMIT);
|
||||
|
||||
if (DoorTable.getInstance().checkIfDoorsBetween(fromX, fromY, fromZ, toX, toY, toZ, instanceId, false))
|
||||
if (DoorData.getInstance().checkIfDoorsBetween(fromX, fromY, fromZ, toX, toY, toZ, instanceId, false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user