|
@@ -64,24 +64,18 @@ public class GeoEngine extends GeoData
|
|
return SingletonHolder._instance;
|
|
return SingletonHolder._instance;
|
|
}
|
|
}
|
|
|
|
|
|
- private GeoEngine()
|
|
|
|
|
|
+ protected GeoEngine()
|
|
{
|
|
{
|
|
nInitGeodata();
|
|
nInitGeodata();
|
|
}
|
|
}
|
|
|
|
|
|
//Public Methods
|
|
//Public Methods
|
|
- /**
|
|
|
|
- * @see com.l2jserver.gameserver.GeoData#getType(int, int)
|
|
|
|
- */
|
|
|
|
@Override
|
|
@Override
|
|
public short getType(int x, int y)
|
|
public short getType(int x, int y)
|
|
{
|
|
{
|
|
return nGetType((x - L2World.MAP_MIN_X) >> 4, (y - L2World.MAP_MIN_Y) >> 4);
|
|
return nGetType((x - L2World.MAP_MIN_X) >> 4, (y - L2World.MAP_MIN_Y) >> 4);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * @see com.l2jserver.gameserver.GeoData#getHeight(int, int, int)
|
|
|
|
- */
|
|
|
|
@Override
|
|
@Override
|
|
public short getHeight(int x, int y, int z)
|
|
public short getHeight(int x, int y, int z)
|
|
{
|
|
{
|
|
@@ -94,9 +88,6 @@ public class GeoEngine extends GeoData
|
|
return nGetSpawnHeight((x - L2World.MAP_MIN_X) >> 4, (y - L2World.MAP_MIN_Y) >> 4, zmin, zmax, spawn);
|
|
return nGetSpawnHeight((x - L2World.MAP_MIN_X) >> 4, (y - L2World.MAP_MIN_Y) >> 4, zmin, zmax, spawn);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * @see com.l2jserver.gameserver.GeoData#geoPosition(int, int)
|
|
|
|
- */
|
|
|
|
@Override
|
|
@Override
|
|
public String geoPosition(int x, int y)
|
|
public String geoPosition(int x, int y)
|
|
{
|
|
{
|
|
@@ -106,9 +97,6 @@ public class GeoEngine extends GeoData
|
|
+ getRegionOffset(gx, gy);
|
|
+ getRegionOffset(gx, gy);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * @see com.l2jserver.gameserver.GeoData#canSeeTarget(L2Object, Point3D)
|
|
|
|
- */
|
|
|
|
@Override
|
|
@Override
|
|
public boolean canSeeTarget(L2Object cha, Point3D target)
|
|
public boolean canSeeTarget(L2Object cha, Point3D target)
|
|
{
|
|
{
|
|
@@ -119,9 +107,6 @@ public class GeoEngine extends GeoData
|
|
return canSeeTarget(target.getX(), target.getY(), target.getZ(), cha.getX(), cha.getY(), cha.getZ());
|
|
return canSeeTarget(target.getX(), target.getY(), target.getZ(), cha.getX(), cha.getY(), cha.getZ());
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * @see com.l2jserver.gameserver.GeoData#canSeeTarget(com.l2jserver.gameserver.model.L2Object, com.l2jserver.gameserver.model.L2Object)
|
|
|
|
- */
|
|
|
|
@Override
|
|
@Override
|
|
public boolean canSeeTarget(L2Object cha, L2Object target)
|
|
public boolean canSeeTarget(L2Object cha, L2Object target)
|
|
{
|
|
{
|
|
@@ -152,9 +137,6 @@ public class GeoEngine extends GeoData
|
|
return canSeeTarget(target.getX(), target.getY(), z2, cha.getX(), cha.getY(), z);
|
|
return canSeeTarget(target.getX(), target.getY(), z2, cha.getX(), cha.getY(), z);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * @see com.l2jserver.gameserver.GeoData#canSeeTargetDebug(com.l2jserver.gameserver.model.actor.instance.L2PcInstance, com.l2jserver.gameserver.model.L2Object)
|
|
|
|
- */
|
|
|
|
@Override
|
|
@Override
|
|
public boolean canSeeTargetDebug(L2PcInstance gm, L2Object target)
|
|
public boolean canSeeTargetDebug(L2PcInstance gm, L2Object target)
|
|
{
|
|
{
|
|
@@ -172,9 +154,6 @@ public class GeoEngine extends GeoData
|
|
return canSeeDebug(gm, (target.getX() - L2World.MAP_MIN_X) >> 4, (target.getY() - L2World.MAP_MIN_Y) >> 4, z2, (gm.getX() - L2World.MAP_MIN_X) >> 4, (gm.getY() - L2World.MAP_MIN_Y) >> 4, z);
|
|
return canSeeDebug(gm, (target.getX() - L2World.MAP_MIN_X) >> 4, (target.getY() - L2World.MAP_MIN_Y) >> 4, z2, (gm.getX() - L2World.MAP_MIN_X) >> 4, (gm.getY() - L2World.MAP_MIN_Y) >> 4, z);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * @see com.l2jserver.gameserver.GeoData#getNSWE(int, int, int)
|
|
|
|
- */
|
|
|
|
@Override
|
|
@Override
|
|
public short getNSWE(int x, int y, int z)
|
|
public short getNSWE(int x, int y, int z)
|
|
{
|
|
{
|
|
@@ -188,9 +167,6 @@ public class GeoEngine extends GeoData
|
|
return (destiny.getX() == tx && destiny.getY() == ty && destiny.getZ() == tz);
|
|
return (destiny.getX() == tx && destiny.getY() == ty && destiny.getZ() == tz);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * @see com.l2jserver.gameserver.GeoData#moveCheck(int, int, int, int, int, int, int)
|
|
|
|
- */
|
|
|
|
@Override
|
|
@Override
|
|
public Location moveCheck(int x, int y, int z, int tx, int ty, int tz, int instanceId)
|
|
public Location moveCheck(int x, int y, int z, int tx, int ty, int tz, int instanceId)
|
|
{
|
|
{
|
|
@@ -202,9 +178,6 @@ public class GeoEngine extends GeoData
|
|
return moveCheck(startpoint, destiny, (x - L2World.MAP_MIN_X) >> 4, (y - L2World.MAP_MIN_Y) >> 4, z, (tx - L2World.MAP_MIN_X) >> 4, (ty - L2World.MAP_MIN_Y) >> 4, tz);
|
|
return moveCheck(startpoint, destiny, (x - L2World.MAP_MIN_X) >> 4, (y - L2World.MAP_MIN_Y) >> 4, z, (tx - L2World.MAP_MIN_X) >> 4, (ty - L2World.MAP_MIN_Y) >> 4, tz);
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * @see com.l2jserver.gameserver.GeoData#addGeoDataBug(com.l2jserver.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
|
|
|
|
- */
|
|
|
|
@Override
|
|
@Override
|
|
public void addGeoDataBug(L2PcInstance gm, String comment)
|
|
public void addGeoDataBug(L2PcInstance gm, String comment)
|
|
{
|
|
{
|
|
@@ -489,8 +462,17 @@ public class GeoEngine extends GeoData
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
- /*
|
|
|
|
|
|
+ /**
|
|
* MoveCheck
|
|
* MoveCheck
|
|
|
|
+ * @param startpoint
|
|
|
|
+ * @param destiny
|
|
|
|
+ * @param x
|
|
|
|
+ * @param y
|
|
|
|
+ * @param z
|
|
|
|
+ * @param tx
|
|
|
|
+ * @param ty
|
|
|
|
+ * @param tz
|
|
|
|
+ * @return
|
|
*/
|
|
*/
|
|
private static Location moveCheck(Location startpoint, Location destiny, int x, int y, double z, int tx, int ty, int tz)
|
|
private static Location moveCheck(Location startpoint, Location destiny, int x, int y, double z, int tx, int ty, int tz)
|
|
{
|
|
{
|
|
@@ -628,24 +610,13 @@ public class GeoEngine extends GeoData
|
|
//GeoEngine
|
|
//GeoEngine
|
|
private static void nInitGeodata()
|
|
private static void nInitGeodata()
|
|
{
|
|
{
|
|
- LineNumberReader lnr = null;
|
|
|
|
- try
|
|
|
|
|
|
+ final File file = new File("./data/geodata/geo_index.txt");
|
|
|
|
+ try (FileReader fr = new FileReader(file);
|
|
|
|
+ BufferedReader br = new BufferedReader(fr);
|
|
|
|
+ LineNumberReader lnr = new LineNumberReader(br))
|
|
{
|
|
{
|
|
_log.info("Geo Engine: - Loading Geodata...");
|
|
_log.info("Geo Engine: - Loading Geodata...");
|
|
- File Data = new File("./data/geodata/geo_index.txt");
|
|
|
|
- if (!Data.exists())
|
|
|
|
- return;
|
|
|
|
-
|
|
|
|
- lnr = new LineNumberReader(new BufferedReader(new FileReader(Data)));
|
|
|
|
- }
|
|
|
|
- catch (Exception e)
|
|
|
|
- {
|
|
|
|
- _log.log(Level.WARNING, "", e);
|
|
|
|
- throw new Error("Failed to Load geo_index File.");
|
|
|
|
- }
|
|
|
|
- String line;
|
|
|
|
- try
|
|
|
|
- {
|
|
|
|
|
|
+ String line;
|
|
while ((line = lnr.readLine()) != null)
|
|
while ((line = lnr.readLine()) != null)
|
|
{
|
|
{
|
|
if (line.trim().length() == 0)
|
|
if (line.trim().length() == 0)
|
|
@@ -661,16 +632,7 @@ public class GeoEngine extends GeoData
|
|
_log.log(Level.WARNING, "", e);
|
|
_log.log(Level.WARNING, "", e);
|
|
throw new Error("Failed to Read geo_index File.");
|
|
throw new Error("Failed to Read geo_index File.");
|
|
}
|
|
}
|
|
- finally
|
|
|
|
- {
|
|
|
|
- try
|
|
|
|
- {
|
|
|
|
- lnr.close();
|
|
|
|
- }
|
|
|
|
- catch (Exception e)
|
|
|
|
- {
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
try
|
|
try
|
|
{
|
|
{
|
|
File geo_bugs = new File("./data/geodata/geo_bugs.txt");
|
|
File geo_bugs = new File("./data/geodata/geo_bugs.txt");
|
|
@@ -1516,7 +1478,6 @@ public class GeoEngine extends GeoData
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
- @SuppressWarnings("synthetic-access")
|
|
|
|
private static class SingletonHolder
|
|
private static class SingletonHolder
|
|
{
|
|
{
|
|
protected static final GeoEngine _instance = new GeoEngine();
|
|
protected static final GeoEngine _instance = new GeoEngine();
|