Ignore no path found issues.
Thanks to Trance.
This commit is contained in:
+5
-16
@@ -2,16 +2,14 @@
|
|||||||
GEODATA COMPENDIUM
|
GEODATA COMPENDIUM
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
Comprehensive guide for geodata, by Tryskell and Hasha.
|
Comprehensive guide for geodata.
|
||||||
|
|
||||||
I - How to configure it
|
How to configure it
|
||||||
a - Prerequisites
|
a - Prerequisites
|
||||||
b - Make it work
|
b - Make it work
|
||||||
c - L2D format
|
|
||||||
II - Addendum
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
I - How to configure it
|
How to configure it
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
@@ -30,12 +28,3 @@ To make geodata working:
|
|||||||
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
||||||
- CoordSynchronize = 2
|
- CoordSynchronize = 2
|
||||||
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
||||||
|
|
||||||
----------------------------------------------
|
|
||||||
c - L2D format
|
|
||||||
----------------------------------------------
|
|
||||||
|
|
||||||
* L2D is a new geodata file format. It holds diagonal movement informations, in addition to regular NSWE flags.
|
|
||||||
* Heavier file weight (+30%), but the pathfinding algorithms are processed way faster (-35% calculation times).
|
|
||||||
* L2D files can be converted from L2OFF/L2J formats without losing any information. Converter is part of the gameserver.
|
|
||||||
* Keep in mind to convert new geodata files, once you update your L2OFF/L2J ones.
|
|
||||||
|
|||||||
@@ -180,6 +180,17 @@ public class GeoEngine
|
|||||||
return region.hasGeo();
|
return region.hasGeo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the specified position for available geodata.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
||||||
|
*/
|
||||||
|
public boolean hasGeo(int x, int y)
|
||||||
|
{
|
||||||
|
return hasGeoPos(getGeoX(x), getGeoY(y));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param geoX
|
* @param geoX
|
||||||
* @param geoY
|
* @param geoY
|
||||||
@@ -274,6 +285,42 @@ public class GeoEngine
|
|||||||
return region.getNextHigherZ(geoX, geoY, worldZ);
|
return region.getNextHigherZ(geoX, geoY, worldZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next lower Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getLowerHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextLowerZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next higher Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHigherHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextHigherZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param worldX
|
* @param worldX
|
||||||
* @return the geo X
|
* @return the geo X
|
||||||
@@ -328,18 +375,6 @@ public class GeoEngine
|
|||||||
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the Z height.
|
|
||||||
* @param x the x coordinate
|
|
||||||
* @param y the y coordinate
|
|
||||||
* @param z the z coordinate
|
|
||||||
* @return the nearest Z height
|
|
||||||
*/
|
|
||||||
public int getHeight(int x, int y, int z)
|
|
||||||
{
|
|
||||||
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can see target. Doors as target always return true. Checks doors between.
|
* Can see target. Doors as target always return true. Checks doors between.
|
||||||
* @param cha the character
|
* @param cha the character
|
||||||
@@ -710,17 +745,6 @@ public class GeoEngine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the specified position for available geodata.
|
|
||||||
* @param x the X coordinate
|
|
||||||
* @param y the Y coordinate
|
|
||||||
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
|
||||||
*/
|
|
||||||
public boolean hasGeo(int x, int y)
|
|
||||||
{
|
|
||||||
return hasGeoPos(getGeoX(x), getGeoY(y));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GeoEngine getInstance()
|
public static GeoEngine getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
|||||||
@@ -3384,6 +3384,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
||||||
x = destiny.getX();
|
x = destiny.getX();
|
||||||
y = destiny.getY();
|
y = destiny.getY();
|
||||||
|
z = destiny.getZ();
|
||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
@@ -3397,13 +3398,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
||||||
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
||||||
{
|
{
|
||||||
|
if ((isPlayer()) || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((Summon) this).getFollowStatus()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m.disregardingGeodata = true;
|
m.disregardingGeodata = true;
|
||||||
|
|
||||||
// Mobius: Verify destination. Prevents wall collision issues.
|
x = originalX;
|
||||||
final Location newDestination = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
y = originalY;
|
||||||
x = newDestination.getX();
|
z = originalZ;
|
||||||
y = newDestination.getY();
|
distance = originalDistance;
|
||||||
z = newDestination.getZ();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -12708,7 +12708,7 @@ public class PlayerInstance extends Playable
|
|||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
if (Config.CORRECT_PLAYER_Z)
|
||||||
{
|
{
|
||||||
final int nearestZ = GeoEngine.getInstance().getNextLowerZ(getX(), getY(), getZ());
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
||||||
if (getZ() < nearestZ)
|
if (getZ() < nearestZ)
|
||||||
{
|
{
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
teleToLocation(new Location(getX(), getY(), nearestZ));
|
||||||
|
|||||||
@@ -2,16 +2,14 @@
|
|||||||
GEODATA COMPENDIUM
|
GEODATA COMPENDIUM
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
Comprehensive guide for geodata, by Tryskell and Hasha.
|
Comprehensive guide for geodata.
|
||||||
|
|
||||||
I - How to configure it
|
How to configure it
|
||||||
a - Prerequisites
|
a - Prerequisites
|
||||||
b - Make it work
|
b - Make it work
|
||||||
c - L2D format
|
|
||||||
II - Addendum
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
I - How to configure it
|
How to configure it
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
@@ -30,12 +28,3 @@ To make geodata working:
|
|||||||
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
||||||
- CoordSynchronize = 2
|
- CoordSynchronize = 2
|
||||||
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
||||||
|
|
||||||
----------------------------------------------
|
|
||||||
c - L2D format
|
|
||||||
----------------------------------------------
|
|
||||||
|
|
||||||
* L2D is a new geodata file format. It holds diagonal movement informations, in addition to regular NSWE flags.
|
|
||||||
* Heavier file weight (+30%), but the pathfinding algorithms are processed way faster (-35% calculation times).
|
|
||||||
* L2D files can be converted from L2OFF/L2J formats without losing any information. Converter is part of the gameserver.
|
|
||||||
* Keep in mind to convert new geodata files, once you update your L2OFF/L2J ones.
|
|
||||||
|
|||||||
@@ -180,6 +180,17 @@ public class GeoEngine
|
|||||||
return region.hasGeo();
|
return region.hasGeo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the specified position for available geodata.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
||||||
|
*/
|
||||||
|
public boolean hasGeo(int x, int y)
|
||||||
|
{
|
||||||
|
return hasGeoPos(getGeoX(x), getGeoY(y));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param geoX
|
* @param geoX
|
||||||
* @param geoY
|
* @param geoY
|
||||||
@@ -274,6 +285,42 @@ public class GeoEngine
|
|||||||
return region.getNextHigherZ(geoX, geoY, worldZ);
|
return region.getNextHigherZ(geoX, geoY, worldZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next lower Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getLowerHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextLowerZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next higher Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHigherHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextHigherZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param worldX
|
* @param worldX
|
||||||
* @return the geo X
|
* @return the geo X
|
||||||
@@ -328,18 +375,6 @@ public class GeoEngine
|
|||||||
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the Z height.
|
|
||||||
* @param x the x coordinate
|
|
||||||
* @param y the y coordinate
|
|
||||||
* @param z the z coordinate
|
|
||||||
* @return the nearest Z height
|
|
||||||
*/
|
|
||||||
public int getHeight(int x, int y, int z)
|
|
||||||
{
|
|
||||||
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can see target. Doors as target always return true. Checks doors between.
|
* Can see target. Doors as target always return true. Checks doors between.
|
||||||
* @param cha the character
|
* @param cha the character
|
||||||
@@ -710,17 +745,6 @@ public class GeoEngine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the specified position for available geodata.
|
|
||||||
* @param x the X coordinate
|
|
||||||
* @param y the Y coordinate
|
|
||||||
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
|
||||||
*/
|
|
||||||
public boolean hasGeo(int x, int y)
|
|
||||||
{
|
|
||||||
return hasGeoPos(getGeoX(x), getGeoY(y));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GeoEngine getInstance()
|
public static GeoEngine getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
|||||||
@@ -3384,6 +3384,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
||||||
x = destiny.getX();
|
x = destiny.getX();
|
||||||
y = destiny.getY();
|
y = destiny.getY();
|
||||||
|
z = destiny.getZ();
|
||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
@@ -3397,13 +3398,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
||||||
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
||||||
{
|
{
|
||||||
|
if ((isPlayer()) || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((Summon) this).getFollowStatus()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m.disregardingGeodata = true;
|
m.disregardingGeodata = true;
|
||||||
|
|
||||||
// Mobius: Verify destination. Prevents wall collision issues.
|
x = originalX;
|
||||||
final Location newDestination = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
y = originalY;
|
||||||
x = newDestination.getX();
|
z = originalZ;
|
||||||
y = newDestination.getY();
|
distance = originalDistance;
|
||||||
z = newDestination.getZ();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -12715,7 +12715,7 @@ public class PlayerInstance extends Playable
|
|||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
if (Config.CORRECT_PLAYER_Z)
|
||||||
{
|
{
|
||||||
final int nearestZ = GeoEngine.getInstance().getNextLowerZ(getX(), getY(), getZ());
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
||||||
if (getZ() < nearestZ)
|
if (getZ() < nearestZ)
|
||||||
{
|
{
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
teleToLocation(new Location(getX(), getY(), nearestZ));
|
||||||
|
|||||||
+5
-16
@@ -2,16 +2,14 @@
|
|||||||
GEODATA COMPENDIUM
|
GEODATA COMPENDIUM
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
Comprehensive guide for geodata, by Tryskell and Hasha.
|
Comprehensive guide for geodata.
|
||||||
|
|
||||||
I - How to configure it
|
How to configure it
|
||||||
a - Prerequisites
|
a - Prerequisites
|
||||||
b - Make it work
|
b - Make it work
|
||||||
c - L2D format
|
|
||||||
II - Addendum
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
I - How to configure it
|
How to configure it
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
@@ -30,12 +28,3 @@ To make geodata working:
|
|||||||
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
||||||
- CoordSynchronize = 2
|
- CoordSynchronize = 2
|
||||||
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
||||||
|
|
||||||
----------------------------------------------
|
|
||||||
c - L2D format
|
|
||||||
----------------------------------------------
|
|
||||||
|
|
||||||
* L2D is a new geodata file format. It holds diagonal movement informations, in addition to regular NSWE flags.
|
|
||||||
* Heavier file weight (+30%), but the pathfinding algorithms are processed way faster (-35% calculation times).
|
|
||||||
* L2D files can be converted from L2OFF/L2J formats without losing any information. Converter is part of the gameserver.
|
|
||||||
* Keep in mind to convert new geodata files, once you update your L2OFF/L2J ones.
|
|
||||||
|
|||||||
@@ -180,6 +180,17 @@ public class GeoEngine
|
|||||||
return region.hasGeo();
|
return region.hasGeo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the specified position for available geodata.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
||||||
|
*/
|
||||||
|
public boolean hasGeo(int x, int y)
|
||||||
|
{
|
||||||
|
return hasGeoPos(getGeoX(x), getGeoY(y));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param geoX
|
* @param geoX
|
||||||
* @param geoY
|
* @param geoY
|
||||||
@@ -274,6 +285,42 @@ public class GeoEngine
|
|||||||
return region.getNextHigherZ(geoX, geoY, worldZ);
|
return region.getNextHigherZ(geoX, geoY, worldZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next lower Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getLowerHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextLowerZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next higher Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHigherHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextHigherZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param worldX
|
* @param worldX
|
||||||
* @return the geo X
|
* @return the geo X
|
||||||
@@ -328,18 +375,6 @@ public class GeoEngine
|
|||||||
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the Z height.
|
|
||||||
* @param x the x coordinate
|
|
||||||
* @param y the y coordinate
|
|
||||||
* @param z the z coordinate
|
|
||||||
* @return the nearest Z height
|
|
||||||
*/
|
|
||||||
public int getHeight(int x, int y, int z)
|
|
||||||
{
|
|
||||||
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can see target. Doors as target always return true. Checks doors between.
|
* Can see target. Doors as target always return true. Checks doors between.
|
||||||
* @param cha the character
|
* @param cha the character
|
||||||
@@ -710,17 +745,6 @@ public class GeoEngine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the specified position for available geodata.
|
|
||||||
* @param x the X coordinate
|
|
||||||
* @param y the Y coordinate
|
|
||||||
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
|
||||||
*/
|
|
||||||
public boolean hasGeo(int x, int y)
|
|
||||||
{
|
|
||||||
return hasGeoPos(getGeoX(x), getGeoY(y));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GeoEngine getInstance()
|
public static GeoEngine getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
|||||||
@@ -3384,6 +3384,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
||||||
x = destiny.getX();
|
x = destiny.getX();
|
||||||
y = destiny.getY();
|
y = destiny.getY();
|
||||||
|
z = destiny.getZ();
|
||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
@@ -3397,13 +3398,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
||||||
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
||||||
{
|
{
|
||||||
|
if ((isPlayer()) || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((Summon) this).getFollowStatus()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m.disregardingGeodata = true;
|
m.disregardingGeodata = true;
|
||||||
|
|
||||||
// Mobius: Verify destination. Prevents wall collision issues.
|
x = originalX;
|
||||||
final Location newDestination = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
y = originalY;
|
||||||
x = newDestination.getX();
|
z = originalZ;
|
||||||
y = newDestination.getY();
|
distance = originalDistance;
|
||||||
z = newDestination.getZ();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -12717,7 +12717,7 @@ public class PlayerInstance extends Playable
|
|||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
if (Config.CORRECT_PLAYER_Z)
|
||||||
{
|
{
|
||||||
final int nearestZ = GeoEngine.getInstance().getNextLowerZ(getX(), getY(), getZ());
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
||||||
if (getZ() < nearestZ)
|
if (getZ() < nearestZ)
|
||||||
{
|
{
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
teleToLocation(new Location(getX(), getY(), nearestZ));
|
||||||
|
|||||||
@@ -2,16 +2,14 @@
|
|||||||
GEODATA COMPENDIUM
|
GEODATA COMPENDIUM
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
Comprehensive guide for geodata, by Tryskell and Hasha.
|
Comprehensive guide for geodata.
|
||||||
|
|
||||||
I - How to configure it
|
How to configure it
|
||||||
a - Prerequisites
|
a - Prerequisites
|
||||||
b - Make it work
|
b - Make it work
|
||||||
c - L2D format
|
|
||||||
II - Addendum
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
I - How to configure it
|
How to configure it
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
@@ -30,12 +28,3 @@ To make geodata working:
|
|||||||
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
||||||
- CoordSynchronize = 2
|
- CoordSynchronize = 2
|
||||||
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
||||||
|
|
||||||
----------------------------------------------
|
|
||||||
c - L2D format
|
|
||||||
----------------------------------------------
|
|
||||||
|
|
||||||
* L2D is a new geodata file format. It holds diagonal movement informations, in addition to regular NSWE flags.
|
|
||||||
* Heavier file weight (+30%), but the pathfinding algorithms are processed way faster (-35% calculation times).
|
|
||||||
* L2D files can be converted from L2OFF/L2J formats without losing any information. Converter is part of the gameserver.
|
|
||||||
* Keep in mind to convert new geodata files, once you update your L2OFF/L2J ones.
|
|
||||||
|
|||||||
+47
-23
@@ -180,6 +180,17 @@ public class GeoEngine
|
|||||||
return region.hasGeo();
|
return region.hasGeo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the specified position for available geodata.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
||||||
|
*/
|
||||||
|
public boolean hasGeo(int x, int y)
|
||||||
|
{
|
||||||
|
return hasGeoPos(getGeoX(x), getGeoY(y));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param geoX
|
* @param geoX
|
||||||
* @param geoY
|
* @param geoY
|
||||||
@@ -274,6 +285,42 @@ public class GeoEngine
|
|||||||
return region.getNextHigherZ(geoX, geoY, worldZ);
|
return region.getNextHigherZ(geoX, geoY, worldZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next lower Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getLowerHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextLowerZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next higher Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHigherHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextHigherZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param worldX
|
* @param worldX
|
||||||
* @return the geo X
|
* @return the geo X
|
||||||
@@ -328,18 +375,6 @@ public class GeoEngine
|
|||||||
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the Z height.
|
|
||||||
* @param x the x coordinate
|
|
||||||
* @param y the y coordinate
|
|
||||||
* @param z the z coordinate
|
|
||||||
* @return the nearest Z height
|
|
||||||
*/
|
|
||||||
public int getHeight(int x, int y, int z)
|
|
||||||
{
|
|
||||||
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can see target. Doors as target always return true. Checks doors between.
|
* Can see target. Doors as target always return true. Checks doors between.
|
||||||
* @param cha the character
|
* @param cha the character
|
||||||
@@ -710,17 +745,6 @@ public class GeoEngine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the specified position for available geodata.
|
|
||||||
* @param x the X coordinate
|
|
||||||
* @param y the Y coordinate
|
|
||||||
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
|
||||||
*/
|
|
||||||
public boolean hasGeo(int x, int y)
|
|
||||||
{
|
|
||||||
return hasGeoPos(getGeoX(x), getGeoY(y));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GeoEngine getInstance()
|
public static GeoEngine getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
|||||||
+10
-5
@@ -3384,6 +3384,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
||||||
x = destiny.getX();
|
x = destiny.getX();
|
||||||
y = destiny.getY();
|
y = destiny.getY();
|
||||||
|
z = destiny.getZ();
|
||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
@@ -3397,13 +3398,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
||||||
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
||||||
{
|
{
|
||||||
|
if ((isPlayer()) || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((Summon) this).getFollowStatus()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m.disregardingGeodata = true;
|
m.disregardingGeodata = true;
|
||||||
|
|
||||||
// Mobius: Verify destination. Prevents wall collision issues.
|
x = originalX;
|
||||||
final Location newDestination = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
y = originalY;
|
||||||
x = newDestination.getX();
|
z = originalZ;
|
||||||
y = newDestination.getY();
|
distance = originalDistance;
|
||||||
z = newDestination.getZ();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -12697,7 +12697,7 @@ public class PlayerInstance extends Playable
|
|||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
if (Config.CORRECT_PLAYER_Z)
|
||||||
{
|
{
|
||||||
final int nearestZ = GeoEngine.getInstance().getNextLowerZ(getX(), getY(), getZ());
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
||||||
if (getZ() < nearestZ)
|
if (getZ() < nearestZ)
|
||||||
{
|
{
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
teleToLocation(new Location(getX(), getY(), nearestZ));
|
||||||
|
|||||||
+5
-16
@@ -2,16 +2,14 @@
|
|||||||
GEODATA COMPENDIUM
|
GEODATA COMPENDIUM
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
Comprehensive guide for geodata, by Tryskell and Hasha.
|
Comprehensive guide for geodata.
|
||||||
|
|
||||||
I - How to configure it
|
How to configure it
|
||||||
a - Prerequisites
|
a - Prerequisites
|
||||||
b - Make it work
|
b - Make it work
|
||||||
c - L2D format
|
|
||||||
II - Addendum
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
I - How to configure it
|
How to configure it
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
@@ -30,12 +28,3 @@ To make geodata working:
|
|||||||
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
||||||
- CoordSynchronize = 2
|
- CoordSynchronize = 2
|
||||||
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
||||||
|
|
||||||
----------------------------------------------
|
|
||||||
c - L2D format
|
|
||||||
----------------------------------------------
|
|
||||||
|
|
||||||
* L2D is a new geodata file format. It holds diagonal movement informations, in addition to regular NSWE flags.
|
|
||||||
* Heavier file weight (+30%), but the pathfinding algorithms are processed way faster (-35% calculation times).
|
|
||||||
* L2D files can be converted from L2OFF/L2J formats without losing any information. Converter is part of the gameserver.
|
|
||||||
* Keep in mind to convert new geodata files, once you update your L2OFF/L2J ones.
|
|
||||||
|
|||||||
@@ -180,6 +180,17 @@ public class GeoEngine
|
|||||||
return region.hasGeo();
|
return region.hasGeo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the specified position for available geodata.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
||||||
|
*/
|
||||||
|
public boolean hasGeo(int x, int y)
|
||||||
|
{
|
||||||
|
return hasGeoPos(getGeoX(x), getGeoY(y));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param geoX
|
* @param geoX
|
||||||
* @param geoY
|
* @param geoY
|
||||||
@@ -274,6 +285,42 @@ public class GeoEngine
|
|||||||
return region.getNextHigherZ(geoX, geoY, worldZ);
|
return region.getNextHigherZ(geoX, geoY, worldZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next lower Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getLowerHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextLowerZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next higher Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHigherHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextHigherZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param worldX
|
* @param worldX
|
||||||
* @return the geo X
|
* @return the geo X
|
||||||
@@ -328,18 +375,6 @@ public class GeoEngine
|
|||||||
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the Z height.
|
|
||||||
* @param x the x coordinate
|
|
||||||
* @param y the y coordinate
|
|
||||||
* @param z the z coordinate
|
|
||||||
* @return the nearest Z height
|
|
||||||
*/
|
|
||||||
public int getHeight(int x, int y, int z)
|
|
||||||
{
|
|
||||||
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can see target. Doors as target always return true. Checks doors between.
|
* Can see target. Doors as target always return true. Checks doors between.
|
||||||
* @param cha the character
|
* @param cha the character
|
||||||
@@ -710,17 +745,6 @@ public class GeoEngine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the specified position for available geodata.
|
|
||||||
* @param x the X coordinate
|
|
||||||
* @param y the Y coordinate
|
|
||||||
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
|
||||||
*/
|
|
||||||
public boolean hasGeo(int x, int y)
|
|
||||||
{
|
|
||||||
return hasGeoPos(getGeoX(x), getGeoY(y));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GeoEngine getInstance()
|
public static GeoEngine getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
|||||||
@@ -3384,6 +3384,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
||||||
x = destiny.getX();
|
x = destiny.getX();
|
||||||
y = destiny.getY();
|
y = destiny.getY();
|
||||||
|
z = destiny.getZ();
|
||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
@@ -3397,13 +3398,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
||||||
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
||||||
{
|
{
|
||||||
|
if ((isPlayer()) || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((Summon) this).getFollowStatus()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m.disregardingGeodata = true;
|
m.disregardingGeodata = true;
|
||||||
|
|
||||||
// Mobius: Verify destination. Prevents wall collision issues.
|
x = originalX;
|
||||||
final Location newDestination = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
y = originalY;
|
||||||
x = newDestination.getX();
|
z = originalZ;
|
||||||
y = newDestination.getY();
|
distance = originalDistance;
|
||||||
z = newDestination.getZ();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -12684,7 +12684,7 @@ public class PlayerInstance extends Playable
|
|||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
if (Config.CORRECT_PLAYER_Z)
|
||||||
{
|
{
|
||||||
final int nearestZ = GeoEngine.getInstance().getNextLowerZ(getX(), getY(), getZ());
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
||||||
if (getZ() < nearestZ)
|
if (getZ() < nearestZ)
|
||||||
{
|
{
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
teleToLocation(new Location(getX(), getY(), nearestZ));
|
||||||
|
|||||||
+5
-16
@@ -2,16 +2,14 @@
|
|||||||
GEODATA COMPENDIUM
|
GEODATA COMPENDIUM
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
Comprehensive guide for geodata, by Tryskell and Hasha.
|
Comprehensive guide for geodata.
|
||||||
|
|
||||||
I - How to configure it
|
How to configure it
|
||||||
a - Prerequisites
|
a - Prerequisites
|
||||||
b - Make it work
|
b - Make it work
|
||||||
c - L2D format
|
|
||||||
II - Addendum
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
I - How to configure it
|
How to configure it
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
@@ -30,12 +28,3 @@ To make geodata working:
|
|||||||
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
||||||
- CoordSynchronize = 2
|
- CoordSynchronize = 2
|
||||||
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
||||||
|
|
||||||
----------------------------------------------
|
|
||||||
c - L2D format
|
|
||||||
----------------------------------------------
|
|
||||||
|
|
||||||
* L2D is a new geodata file format. It holds diagonal movement informations, in addition to regular NSWE flags.
|
|
||||||
* Heavier file weight (+30%), but the pathfinding algorithms are processed way faster (-35% calculation times).
|
|
||||||
* L2D files can be converted from L2OFF/L2J formats without losing any information. Converter is part of the gameserver.
|
|
||||||
* Keep in mind to convert new geodata files, once you update your L2OFF/L2J ones.
|
|
||||||
|
|||||||
@@ -180,6 +180,17 @@ public class GeoEngine
|
|||||||
return region.hasGeo();
|
return region.hasGeo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the specified position for available geodata.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
||||||
|
*/
|
||||||
|
public boolean hasGeo(int x, int y)
|
||||||
|
{
|
||||||
|
return hasGeoPos(getGeoX(x), getGeoY(y));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param geoX
|
* @param geoX
|
||||||
* @param geoY
|
* @param geoY
|
||||||
@@ -274,6 +285,42 @@ public class GeoEngine
|
|||||||
return region.getNextHigherZ(geoX, geoY, worldZ);
|
return region.getNextHigherZ(geoX, geoY, worldZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next lower Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getLowerHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextLowerZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next higher Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHigherHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextHigherZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param worldX
|
* @param worldX
|
||||||
* @return the geo X
|
* @return the geo X
|
||||||
@@ -328,18 +375,6 @@ public class GeoEngine
|
|||||||
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the Z height.
|
|
||||||
* @param x the x coordinate
|
|
||||||
* @param y the y coordinate
|
|
||||||
* @param z the z coordinate
|
|
||||||
* @return the nearest Z height
|
|
||||||
*/
|
|
||||||
public int getHeight(int x, int y, int z)
|
|
||||||
{
|
|
||||||
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can see target. Doors as target always return true. Checks doors between.
|
* Can see target. Doors as target always return true. Checks doors between.
|
||||||
* @param cha the character
|
* @param cha the character
|
||||||
@@ -710,17 +745,6 @@ public class GeoEngine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the specified position for available geodata.
|
|
||||||
* @param x the X coordinate
|
|
||||||
* @param y the Y coordinate
|
|
||||||
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
|
||||||
*/
|
|
||||||
public boolean hasGeo(int x, int y)
|
|
||||||
{
|
|
||||||
return hasGeoPos(getGeoX(x), getGeoY(y));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GeoEngine getInstance()
|
public static GeoEngine getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
|||||||
@@ -3384,6 +3384,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
||||||
x = destiny.getX();
|
x = destiny.getX();
|
||||||
y = destiny.getY();
|
y = destiny.getY();
|
||||||
|
z = destiny.getZ();
|
||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
@@ -3397,13 +3398,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
||||||
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
||||||
{
|
{
|
||||||
|
if ((isPlayer()) || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((Summon) this).getFollowStatus()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m.disregardingGeodata = true;
|
m.disregardingGeodata = true;
|
||||||
|
|
||||||
// Mobius: Verify destination. Prevents wall collision issues.
|
x = originalX;
|
||||||
final Location newDestination = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
y = originalY;
|
||||||
x = newDestination.getX();
|
z = originalZ;
|
||||||
y = newDestination.getY();
|
distance = originalDistance;
|
||||||
z = newDestination.getZ();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -12687,7 +12687,7 @@ public class PlayerInstance extends Playable
|
|||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
if (Config.CORRECT_PLAYER_Z)
|
||||||
{
|
{
|
||||||
final int nearestZ = GeoEngine.getInstance().getNextLowerZ(getX(), getY(), getZ());
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
||||||
if (getZ() < nearestZ)
|
if (getZ() < nearestZ)
|
||||||
{
|
{
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
teleToLocation(new Location(getX(), getY(), nearestZ));
|
||||||
|
|||||||
+5
-16
@@ -2,16 +2,14 @@
|
|||||||
GEODATA COMPENDIUM
|
GEODATA COMPENDIUM
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
Comprehensive guide for geodata, by Tryskell and Hasha.
|
Comprehensive guide for geodata.
|
||||||
|
|
||||||
I - How to configure it
|
How to configure it
|
||||||
a - Prerequisites
|
a - Prerequisites
|
||||||
b - Make it work
|
b - Make it work
|
||||||
c - L2D format
|
|
||||||
II - Addendum
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
I - How to configure it
|
How to configure it
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
@@ -30,12 +28,3 @@ To make geodata working:
|
|||||||
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
||||||
- CoordSynchronize = 2
|
- CoordSynchronize = 2
|
||||||
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
||||||
|
|
||||||
----------------------------------------------
|
|
||||||
c - L2D format
|
|
||||||
----------------------------------------------
|
|
||||||
|
|
||||||
* L2D is a new geodata file format. It holds diagonal movement informations, in addition to regular NSWE flags.
|
|
||||||
* Heavier file weight (+30%), but the pathfinding algorithms are processed way faster (-35% calculation times).
|
|
||||||
* L2D files can be converted from L2OFF/L2J formats without losing any information. Converter is part of the gameserver.
|
|
||||||
* Keep in mind to convert new geodata files, once you update your L2OFF/L2J ones.
|
|
||||||
|
|||||||
@@ -180,6 +180,17 @@ public class GeoEngine
|
|||||||
return region.hasGeo();
|
return region.hasGeo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the specified position for available geodata.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
||||||
|
*/
|
||||||
|
public boolean hasGeo(int x, int y)
|
||||||
|
{
|
||||||
|
return hasGeoPos(getGeoX(x), getGeoY(y));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param geoX
|
* @param geoX
|
||||||
* @param geoY
|
* @param geoY
|
||||||
@@ -274,6 +285,42 @@ public class GeoEngine
|
|||||||
return region.getNextHigherZ(geoX, geoY, worldZ);
|
return region.getNextHigherZ(geoX, geoY, worldZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next lower Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getLowerHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextLowerZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next higher Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHigherHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextHigherZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param worldX
|
* @param worldX
|
||||||
* @return the geo X
|
* @return the geo X
|
||||||
@@ -328,18 +375,6 @@ public class GeoEngine
|
|||||||
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the Z height.
|
|
||||||
* @param x the x coordinate
|
|
||||||
* @param y the y coordinate
|
|
||||||
* @param z the z coordinate
|
|
||||||
* @return the nearest Z height
|
|
||||||
*/
|
|
||||||
public int getHeight(int x, int y, int z)
|
|
||||||
{
|
|
||||||
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can see target. Doors as target always return true. Checks doors between.
|
* Can see target. Doors as target always return true. Checks doors between.
|
||||||
* @param cha the character
|
* @param cha the character
|
||||||
@@ -710,17 +745,6 @@ public class GeoEngine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the specified position for available geodata.
|
|
||||||
* @param x the X coordinate
|
|
||||||
* @param y the Y coordinate
|
|
||||||
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
|
||||||
*/
|
|
||||||
public boolean hasGeo(int x, int y)
|
|
||||||
{
|
|
||||||
return hasGeoPos(getGeoX(x), getGeoY(y));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GeoEngine getInstance()
|
public static GeoEngine getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
|||||||
@@ -3384,6 +3384,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
||||||
x = destiny.getX();
|
x = destiny.getX();
|
||||||
y = destiny.getY();
|
y = destiny.getY();
|
||||||
|
z = destiny.getZ();
|
||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
@@ -3397,13 +3398,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
||||||
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
||||||
{
|
{
|
||||||
|
if ((isPlayer()) || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((Summon) this).getFollowStatus()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m.disregardingGeodata = true;
|
m.disregardingGeodata = true;
|
||||||
|
|
||||||
// Mobius: Verify destination. Prevents wall collision issues.
|
x = originalX;
|
||||||
final Location newDestination = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
y = originalY;
|
||||||
x = newDestination.getX();
|
z = originalZ;
|
||||||
y = newDestination.getY();
|
distance = originalDistance;
|
||||||
z = newDestination.getZ();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -12693,7 +12693,7 @@ public class PlayerInstance extends Playable
|
|||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
if (Config.CORRECT_PLAYER_Z)
|
||||||
{
|
{
|
||||||
final int nearestZ = GeoEngine.getInstance().getNextLowerZ(getX(), getY(), getZ());
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
||||||
if (getZ() < nearestZ)
|
if (getZ() < nearestZ)
|
||||||
{
|
{
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
teleToLocation(new Location(getX(), getY(), nearestZ));
|
||||||
|
|||||||
@@ -2,16 +2,14 @@
|
|||||||
GEODATA COMPENDIUM
|
GEODATA COMPENDIUM
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
Comprehensive guide for geodata, by Tryskell and Hasha.
|
Comprehensive guide for geodata.
|
||||||
|
|
||||||
I - How to configure it
|
How to configure it
|
||||||
a - Prerequisites
|
a - Prerequisites
|
||||||
b - Make it work
|
b - Make it work
|
||||||
c - L2D format
|
|
||||||
II - Addendum
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
I - How to configure it
|
How to configure it
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
@@ -30,12 +28,3 @@ To make geodata working:
|
|||||||
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
||||||
- CoordSynchronize = 2
|
- CoordSynchronize = 2
|
||||||
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
||||||
|
|
||||||
----------------------------------------------
|
|
||||||
c - L2D format
|
|
||||||
----------------------------------------------
|
|
||||||
|
|
||||||
* L2D is a new geodata file format. It holds diagonal movement informations, in addition to regular NSWE flags.
|
|
||||||
* Heavier file weight (+30%), but the pathfinding algorithms are processed way faster (-35% calculation times).
|
|
||||||
* L2D files can be converted from L2OFF/L2J formats without losing any information. Converter is part of the gameserver.
|
|
||||||
* Keep in mind to convert new geodata files, once you update your L2OFF/L2J ones.
|
|
||||||
|
|||||||
+47
-23
@@ -180,6 +180,17 @@ public class GeoEngine
|
|||||||
return region.hasGeo();
|
return region.hasGeo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the specified position for available geodata.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
||||||
|
*/
|
||||||
|
public boolean hasGeo(int x, int y)
|
||||||
|
{
|
||||||
|
return hasGeoPos(getGeoX(x), getGeoY(y));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param geoX
|
* @param geoX
|
||||||
* @param geoY
|
* @param geoY
|
||||||
@@ -274,6 +285,42 @@ public class GeoEngine
|
|||||||
return region.getNextHigherZ(geoX, geoY, worldZ);
|
return region.getNextHigherZ(geoX, geoY, worldZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next lower Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getLowerHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextLowerZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next higher Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHigherHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextHigherZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param worldX
|
* @param worldX
|
||||||
* @return the geo X
|
* @return the geo X
|
||||||
@@ -328,18 +375,6 @@ public class GeoEngine
|
|||||||
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the Z height.
|
|
||||||
* @param x the x coordinate
|
|
||||||
* @param y the y coordinate
|
|
||||||
* @param z the z coordinate
|
|
||||||
* @return the nearest Z height
|
|
||||||
*/
|
|
||||||
public int getHeight(int x, int y, int z)
|
|
||||||
{
|
|
||||||
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can see target. Doors as target always return true. Checks doors between.
|
* Can see target. Doors as target always return true. Checks doors between.
|
||||||
* @param cha the character
|
* @param cha the character
|
||||||
@@ -710,17 +745,6 @@ public class GeoEngine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the specified position for available geodata.
|
|
||||||
* @param x the X coordinate
|
|
||||||
* @param y the Y coordinate
|
|
||||||
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
|
||||||
*/
|
|
||||||
public boolean hasGeo(int x, int y)
|
|
||||||
{
|
|
||||||
return hasGeoPos(getGeoX(x), getGeoY(y));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GeoEngine getInstance()
|
public static GeoEngine getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
|||||||
+10
-5
@@ -3383,6 +3383,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
||||||
x = destiny.getX();
|
x = destiny.getX();
|
||||||
y = destiny.getY();
|
y = destiny.getY();
|
||||||
|
z = destiny.getZ();
|
||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
@@ -3396,13 +3397,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
||||||
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
||||||
{
|
{
|
||||||
|
if ((isPlayer()) || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((Summon) this).getFollowStatus()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m.disregardingGeodata = true;
|
m.disregardingGeodata = true;
|
||||||
|
|
||||||
// Mobius: Verify destination. Prevents wall collision issues.
|
x = originalX;
|
||||||
final Location newDestination = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
y = originalY;
|
||||||
x = newDestination.getX();
|
z = originalZ;
|
||||||
y = newDestination.getY();
|
distance = originalDistance;
|
||||||
z = newDestination.getZ();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -12701,7 +12701,7 @@ public class PlayerInstance extends Playable
|
|||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
if (Config.CORRECT_PLAYER_Z)
|
||||||
{
|
{
|
||||||
final int nearestZ = GeoEngine.getInstance().getNextLowerZ(getX(), getY(), getZ());
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
||||||
if (getZ() < nearestZ)
|
if (getZ() < nearestZ)
|
||||||
{
|
{
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
teleToLocation(new Location(getX(), getY(), nearestZ));
|
||||||
|
|||||||
+5
-16
@@ -2,16 +2,14 @@
|
|||||||
GEODATA COMPENDIUM
|
GEODATA COMPENDIUM
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
Comprehensive guide for geodata, by Tryskell and Hasha.
|
Comprehensive guide for geodata.
|
||||||
|
|
||||||
I - How to configure it
|
How to configure it
|
||||||
a - Prerequisites
|
a - Prerequisites
|
||||||
b - Make it work
|
b - Make it work
|
||||||
c - L2D format
|
|
||||||
II - Addendum
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
I - How to configure it
|
How to configure it
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
@@ -30,12 +28,3 @@ To make geodata working:
|
|||||||
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
||||||
- CoordSynchronize = 2
|
- CoordSynchronize = 2
|
||||||
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
||||||
|
|
||||||
----------------------------------------------
|
|
||||||
c - L2D format
|
|
||||||
----------------------------------------------
|
|
||||||
|
|
||||||
* L2D is a new geodata file format. It holds diagonal movement informations, in addition to regular NSWE flags.
|
|
||||||
* Heavier file weight (+30%), but the pathfinding algorithms are processed way faster (-35% calculation times).
|
|
||||||
* L2D files can be converted from L2OFF/L2J formats without losing any information. Converter is part of the gameserver.
|
|
||||||
* Keep in mind to convert new geodata files, once you update your L2OFF/L2J ones.
|
|
||||||
|
|||||||
@@ -180,6 +180,17 @@ public class GeoEngine
|
|||||||
return region.hasGeo();
|
return region.hasGeo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the specified position for available geodata.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
||||||
|
*/
|
||||||
|
public boolean hasGeo(int x, int y)
|
||||||
|
{
|
||||||
|
return hasGeoPos(getGeoX(x), getGeoY(y));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param geoX
|
* @param geoX
|
||||||
* @param geoY
|
* @param geoY
|
||||||
@@ -274,6 +285,42 @@ public class GeoEngine
|
|||||||
return region.getNextHigherZ(geoX, geoY, worldZ);
|
return region.getNextHigherZ(geoX, geoY, worldZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next lower Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getLowerHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextLowerZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next higher Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHigherHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextHigherZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param worldX
|
* @param worldX
|
||||||
* @return the geo X
|
* @return the geo X
|
||||||
@@ -328,18 +375,6 @@ public class GeoEngine
|
|||||||
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the Z height.
|
|
||||||
* @param x the x coordinate
|
|
||||||
* @param y the y coordinate
|
|
||||||
* @param z the z coordinate
|
|
||||||
* @return the nearest Z height
|
|
||||||
*/
|
|
||||||
public int getHeight(int x, int y, int z)
|
|
||||||
{
|
|
||||||
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can see target. Doors as target always return true. Checks doors between.
|
* Can see target. Doors as target always return true. Checks doors between.
|
||||||
* @param cha the character
|
* @param cha the character
|
||||||
@@ -710,17 +745,6 @@ public class GeoEngine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the specified position for available geodata.
|
|
||||||
* @param x the X coordinate
|
|
||||||
* @param y the Y coordinate
|
|
||||||
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
|
||||||
*/
|
|
||||||
public boolean hasGeo(int x, int y)
|
|
||||||
{
|
|
||||||
return hasGeoPos(getGeoX(x), getGeoY(y));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GeoEngine getInstance()
|
public static GeoEngine getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
|||||||
@@ -3383,6 +3383,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
||||||
x = destiny.getX();
|
x = destiny.getX();
|
||||||
y = destiny.getY();
|
y = destiny.getY();
|
||||||
|
z = destiny.getZ();
|
||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
@@ -3396,13 +3397,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
||||||
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
||||||
{
|
{
|
||||||
|
if ((isPlayer()) || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((Summon) this).getFollowStatus()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m.disregardingGeodata = true;
|
m.disregardingGeodata = true;
|
||||||
|
|
||||||
// Mobius: Verify destination. Prevents wall collision issues.
|
x = originalX;
|
||||||
final Location newDestination = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
y = originalY;
|
||||||
x = newDestination.getX();
|
z = originalZ;
|
||||||
y = newDestination.getY();
|
distance = originalDistance;
|
||||||
z = newDestination.getZ();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -12742,7 +12742,7 @@ public class PlayerInstance extends Playable
|
|||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
if (Config.CORRECT_PLAYER_Z)
|
||||||
{
|
{
|
||||||
final int nearestZ = GeoEngine.getInstance().getNextLowerZ(getX(), getY(), getZ());
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
||||||
if (getZ() < nearestZ)
|
if (getZ() < nearestZ)
|
||||||
{
|
{
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
teleToLocation(new Location(getX(), getY(), nearestZ));
|
||||||
|
|||||||
@@ -2,16 +2,14 @@
|
|||||||
GEODATA COMPENDIUM
|
GEODATA COMPENDIUM
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
Comprehensive guide for geodata, by Tryskell and Hasha.
|
Comprehensive guide for geodata.
|
||||||
|
|
||||||
I - How to configure it
|
How to configure it
|
||||||
a - Prerequisites
|
a - Prerequisites
|
||||||
b - Make it work
|
b - Make it work
|
||||||
c - L2D format
|
|
||||||
II - Addendum
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
I - How to configure it
|
How to configure it
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
@@ -30,12 +28,3 @@ To make geodata working:
|
|||||||
* open "/config/main/GeoEngine.ini" with your favorite text editor and then edit following config:
|
* open "/config/main/GeoEngine.ini" with your favorite text editor and then edit following config:
|
||||||
- CoordSynchronize = 2
|
- CoordSynchronize = 2
|
||||||
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
||||||
|
|
||||||
----------------------------------------------
|
|
||||||
c - L2D format
|
|
||||||
----------------------------------------------
|
|
||||||
|
|
||||||
* L2D is a new geodata file format. It holds diagonal movement informations, in addition to regular NSWE flags.
|
|
||||||
* Heavier file weight (+30%), but the pathfinding algorithms are processed way faster (-35% calculation times).
|
|
||||||
* L2D files can be converted from L2OFF/L2J formats without losing any information. Converter is part of the gameserver.
|
|
||||||
* Keep in mind to convert new geodata files, once you update your L2OFF/L2J ones.
|
|
||||||
|
|||||||
+47
-23
@@ -177,6 +177,17 @@ public class GeoEngine
|
|||||||
return region.hasGeo();
|
return region.hasGeo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the specified position for available geodata.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
||||||
|
*/
|
||||||
|
public boolean hasGeo(int x, int y)
|
||||||
|
{
|
||||||
|
return hasGeoPos(getGeoX(x), getGeoY(y));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param geoX
|
* @param geoX
|
||||||
* @param geoY
|
* @param geoY
|
||||||
@@ -271,6 +282,42 @@ public class GeoEngine
|
|||||||
return region.getNextHigherZ(geoX, geoY, worldZ);
|
return region.getNextHigherZ(geoX, geoY, worldZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next lower Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getLowerHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextLowerZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next higher Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHigherHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextHigherZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param worldX
|
* @param worldX
|
||||||
* @return the geo X
|
* @return the geo X
|
||||||
@@ -325,18 +372,6 @@ public class GeoEngine
|
|||||||
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the Z height.
|
|
||||||
* @param x the x coordinate
|
|
||||||
* @param y the y coordinate
|
|
||||||
* @param z the z coordinate
|
|
||||||
* @return the nearest Z height
|
|
||||||
*/
|
|
||||||
public int getHeight(int x, int y, int z)
|
|
||||||
{
|
|
||||||
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can see target. Doors as target always return true. Checks doors between.
|
* Can see target. Doors as target always return true. Checks doors between.
|
||||||
* @param cha the character
|
* @param cha the character
|
||||||
@@ -699,17 +734,6 @@ public class GeoEngine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the specified position for available geodata.
|
|
||||||
* @param x the X coordinate
|
|
||||||
* @param y the Y coordinate
|
|
||||||
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
|
||||||
*/
|
|
||||||
public boolean hasGeo(int x, int y)
|
|
||||||
{
|
|
||||||
return hasGeoPos(getGeoX(x), getGeoY(y));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GeoEngine getInstance()
|
public static GeoEngine getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
|||||||
+10
-5
@@ -5516,6 +5516,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceId());
|
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceId());
|
||||||
x = destiny.getX();
|
x = destiny.getX();
|
||||||
y = destiny.getY();
|
y = destiny.getY();
|
||||||
|
z = destiny.getZ();
|
||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
@@ -5529,13 +5530,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceId());
|
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceId());
|
||||||
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
||||||
{
|
{
|
||||||
|
if ((isPlayer()) || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((Summon) this).getFollowStatus()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m.disregardingGeodata = true;
|
m.disregardingGeodata = true;
|
||||||
|
|
||||||
// Mobius: Verify destination. Prevents wall collision issues.
|
x = originalX;
|
||||||
final Location newDestination = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, originalX, originalY, originalZ, getInstanceId());
|
y = originalY;
|
||||||
x = newDestination.getX();
|
z = originalZ;
|
||||||
y = newDestination.getY();
|
distance = originalDistance;
|
||||||
z = newDestination.getZ();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -15483,7 +15483,7 @@ public class PlayerInstance extends Playable
|
|||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
if (Config.CORRECT_PLAYER_Z)
|
||||||
{
|
{
|
||||||
final int nearestZ = GeoEngine.getInstance().getNextLowerZ(getX(), getY(), getZ());
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
||||||
if (getZ() < nearestZ)
|
if (getZ() < nearestZ)
|
||||||
{
|
{
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ), false);
|
teleToLocation(new Location(getX(), getY(), nearestZ), false);
|
||||||
|
|||||||
+5
-16
@@ -2,16 +2,14 @@
|
|||||||
GEODATA COMPENDIUM
|
GEODATA COMPENDIUM
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
Comprehensive guide for geodata, by Tryskell and Hasha.
|
Comprehensive guide for geodata.
|
||||||
|
|
||||||
I - How to configure it
|
How to configure it
|
||||||
a - Prerequisites
|
a - Prerequisites
|
||||||
b - Make it work
|
b - Make it work
|
||||||
c - L2D format
|
|
||||||
II - Addendum
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
I - How to configure it
|
How to configure it
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
@@ -30,12 +28,3 @@ To make geodata working:
|
|||||||
* open "/config/main/GeoEngine.ini" with your favorite text editor and then edit following config:
|
* open "/config/main/GeoEngine.ini" with your favorite text editor and then edit following config:
|
||||||
- CoordSynchronize = 2
|
- CoordSynchronize = 2
|
||||||
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
||||||
|
|
||||||
----------------------------------------------
|
|
||||||
c - L2D format
|
|
||||||
----------------------------------------------
|
|
||||||
|
|
||||||
* L2D is a new geodata file format. It holds diagonal movement informations, in addition to regular NSWE flags.
|
|
||||||
* Heavier file weight (+30%), but the pathfinding algorithms are processed way faster (-35% calculation times).
|
|
||||||
* L2D files can be converted from L2OFF/L2J formats without losing any information. Converter is part of the gameserver.
|
|
||||||
* Keep in mind to convert new geodata files, once you update your L2OFF/L2J ones.
|
|
||||||
|
|||||||
@@ -177,6 +177,17 @@ public class GeoEngine
|
|||||||
return region.hasGeo();
|
return region.hasGeo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the specified position for available geodata.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
||||||
|
*/
|
||||||
|
public boolean hasGeo(int x, int y)
|
||||||
|
{
|
||||||
|
return hasGeoPos(getGeoX(x), getGeoY(y));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param geoX
|
* @param geoX
|
||||||
* @param geoY
|
* @param geoY
|
||||||
@@ -271,6 +282,42 @@ public class GeoEngine
|
|||||||
return region.getNextHigherZ(geoX, geoY, worldZ);
|
return region.getNextHigherZ(geoX, geoY, worldZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next lower Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getLowerHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextLowerZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next higher Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHigherHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextHigherZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param worldX
|
* @param worldX
|
||||||
* @return the geo X
|
* @return the geo X
|
||||||
@@ -325,18 +372,6 @@ public class GeoEngine
|
|||||||
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the Z height.
|
|
||||||
* @param x the x coordinate
|
|
||||||
* @param y the y coordinate
|
|
||||||
* @param z the z coordinate
|
|
||||||
* @return the nearest Z height
|
|
||||||
*/
|
|
||||||
public int getHeight(int x, int y, int z)
|
|
||||||
{
|
|
||||||
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can see target. Doors as target always return true. Checks doors between.
|
* Can see target. Doors as target always return true. Checks doors between.
|
||||||
* @param cha the character
|
* @param cha the character
|
||||||
@@ -699,17 +734,6 @@ public class GeoEngine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the specified position for available geodata.
|
|
||||||
* @param x the X coordinate
|
|
||||||
* @param y the Y coordinate
|
|
||||||
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
|
||||||
*/
|
|
||||||
public boolean hasGeo(int x, int y)
|
|
||||||
{
|
|
||||||
return hasGeoPos(getGeoX(x), getGeoY(y));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GeoEngine getInstance()
|
public static GeoEngine getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
|||||||
@@ -5562,6 +5562,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceId());
|
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceId());
|
||||||
x = destiny.getX();
|
x = destiny.getX();
|
||||||
y = destiny.getY();
|
y = destiny.getY();
|
||||||
|
z = destiny.getZ();
|
||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
@@ -5575,13 +5576,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceId());
|
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceId());
|
||||||
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
||||||
{
|
{
|
||||||
|
if ((isPlayer()) || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((Summon) this).getFollowStatus()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m.disregardingGeodata = true;
|
m.disregardingGeodata = true;
|
||||||
|
|
||||||
// Mobius: Verify destination. Prevents wall collision issues.
|
x = originalX;
|
||||||
final Location newDestination = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, originalX, originalY, originalZ, getInstanceId());
|
y = originalY;
|
||||||
x = newDestination.getX();
|
z = originalZ;
|
||||||
y = newDestination.getY();
|
distance = originalDistance;
|
||||||
z = newDestination.getZ();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -15849,7 +15849,7 @@ public class PlayerInstance extends Playable
|
|||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
if (Config.CORRECT_PLAYER_Z)
|
||||||
{
|
{
|
||||||
final int nearestZ = GeoEngine.getInstance().getNextLowerZ(getX(), getY(), getZ());
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
||||||
if (getZ() < nearestZ)
|
if (getZ() < nearestZ)
|
||||||
{
|
{
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ), false);
|
teleToLocation(new Location(getX(), getY(), nearestZ), false);
|
||||||
|
|||||||
@@ -2,16 +2,14 @@
|
|||||||
GEODATA COMPENDIUM
|
GEODATA COMPENDIUM
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
Comprehensive guide for geodata, by Tryskell and Hasha.
|
Comprehensive guide for geodata.
|
||||||
|
|
||||||
I - How to configure it
|
How to configure it
|
||||||
a - Prerequisites
|
a - Prerequisites
|
||||||
b - Make it work
|
b - Make it work
|
||||||
c - L2D format
|
|
||||||
II - Addendum
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
I - How to configure it
|
How to configure it
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
@@ -30,12 +28,3 @@ To make geodata working:
|
|||||||
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
||||||
- CoordSynchronize = 2
|
- CoordSynchronize = 2
|
||||||
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
||||||
|
|
||||||
----------------------------------------------
|
|
||||||
c - L2D format
|
|
||||||
----------------------------------------------
|
|
||||||
|
|
||||||
* L2D is a new geodata file format. It holds diagonal movement informations, in addition to regular NSWE flags.
|
|
||||||
* Heavier file weight (+30%), but the pathfinding algorithms are processed way faster (-35% calculation times).
|
|
||||||
* L2D files can be converted from L2OFF/L2J formats without losing any information. Converter is part of the gameserver.
|
|
||||||
* Keep in mind to convert new geodata files, once you update your L2OFF/L2J ones.
|
|
||||||
|
|||||||
@@ -178,6 +178,17 @@ public class GeoEngine
|
|||||||
return region.hasGeo();
|
return region.hasGeo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the specified position for available geodata.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
||||||
|
*/
|
||||||
|
public boolean hasGeo(int x, int y)
|
||||||
|
{
|
||||||
|
return hasGeoPos(getGeoX(x), getGeoY(y));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param geoX
|
* @param geoX
|
||||||
* @param geoY
|
* @param geoY
|
||||||
@@ -272,6 +283,42 @@ public class GeoEngine
|
|||||||
return region.getNextHigherZ(geoX, geoY, worldZ);
|
return region.getNextHigherZ(geoX, geoY, worldZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next lower Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getLowerHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextLowerZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next higher Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHigherHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextHigherZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param worldX
|
* @param worldX
|
||||||
* @return the geo X
|
* @return the geo X
|
||||||
@@ -326,18 +373,6 @@ public class GeoEngine
|
|||||||
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the Z height.
|
|
||||||
* @param x the x coordinate
|
|
||||||
* @param y the y coordinate
|
|
||||||
* @param z the z coordinate
|
|
||||||
* @return the nearest Z height
|
|
||||||
*/
|
|
||||||
public int getHeight(int x, int y, int z)
|
|
||||||
{
|
|
||||||
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can see target. Doors as target always return true. Checks doors between.
|
* Can see target. Doors as target always return true. Checks doors between.
|
||||||
* @param cha the character
|
* @param cha the character
|
||||||
@@ -700,17 +735,6 @@ public class GeoEngine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the specified position for available geodata.
|
|
||||||
* @param x the X coordinate
|
|
||||||
* @param y the Y coordinate
|
|
||||||
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
|
||||||
*/
|
|
||||||
public boolean hasGeo(int x, int y)
|
|
||||||
{
|
|
||||||
return hasGeoPos(getGeoX(x), getGeoY(y));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GeoEngine getInstance()
|
public static GeoEngine getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
|||||||
@@ -4325,6 +4325,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceId());
|
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceId());
|
||||||
x = destiny.getX();
|
x = destiny.getX();
|
||||||
y = destiny.getY();
|
y = destiny.getY();
|
||||||
|
z = destiny.getZ();
|
||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
@@ -4338,13 +4339,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceId());
|
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceId());
|
||||||
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
||||||
{
|
{
|
||||||
|
if ((isPlayer()) || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((Summon) this).getFollowStatus()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m.disregardingGeodata = true;
|
m.disregardingGeodata = true;
|
||||||
|
|
||||||
// Mobius: Verify destination. Prevents wall collision issues.
|
x = originalX;
|
||||||
final Location newDestination = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, originalX, originalY, originalZ, getInstanceId());
|
y = originalY;
|
||||||
x = newDestination.getX();
|
z = originalZ;
|
||||||
y = newDestination.getY();
|
distance = originalDistance;
|
||||||
z = newDestination.getZ();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -13513,7 +13513,7 @@ public class PlayerInstance extends Playable
|
|||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
if (Config.CORRECT_PLAYER_Z)
|
||||||
{
|
{
|
||||||
final int nearestZ = GeoEngine.getInstance().getNextLowerZ(getX(), getY(), getZ());
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
||||||
if (getZ() < nearestZ)
|
if (getZ() < nearestZ)
|
||||||
{
|
{
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
teleToLocation(new Location(getX(), getY(), nearestZ));
|
||||||
|
|||||||
@@ -2,16 +2,14 @@
|
|||||||
GEODATA COMPENDIUM
|
GEODATA COMPENDIUM
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
Comprehensive guide for geodata, by Tryskell and Hasha.
|
Comprehensive guide for geodata.
|
||||||
|
|
||||||
I - How to configure it
|
How to configure it
|
||||||
a - Prerequisites
|
a - Prerequisites
|
||||||
b - Make it work
|
b - Make it work
|
||||||
c - L2D format
|
|
||||||
II - Addendum
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
I - How to configure it
|
How to configure it
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
@@ -30,12 +28,3 @@ To make geodata working:
|
|||||||
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
||||||
- CoordSynchronize = 2
|
- CoordSynchronize = 2
|
||||||
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
||||||
|
|
||||||
----------------------------------------------
|
|
||||||
c - L2D format
|
|
||||||
----------------------------------------------
|
|
||||||
|
|
||||||
* L2D is a new geodata file format. It holds diagonal movement informations, in addition to regular NSWE flags.
|
|
||||||
* Heavier file weight (+30%), but the pathfinding algorithms are processed way faster (-35% calculation times).
|
|
||||||
* L2D files can be converted from L2OFF/L2J formats without losing any information. Converter is part of the gameserver.
|
|
||||||
* Keep in mind to convert new geodata files, once you update your L2OFF/L2J ones.
|
|
||||||
|
|||||||
@@ -178,6 +178,17 @@ public class GeoEngine
|
|||||||
return region.hasGeo();
|
return region.hasGeo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the specified position for available geodata.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
||||||
|
*/
|
||||||
|
public boolean hasGeo(int x, int y)
|
||||||
|
{
|
||||||
|
return hasGeoPos(getGeoX(x), getGeoY(y));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param geoX
|
* @param geoX
|
||||||
* @param geoY
|
* @param geoY
|
||||||
@@ -272,6 +283,42 @@ public class GeoEngine
|
|||||||
return region.getNextHigherZ(geoX, geoY, worldZ);
|
return region.getNextHigherZ(geoX, geoY, worldZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next lower Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getLowerHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextLowerZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next higher Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHigherHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextHigherZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param worldX
|
* @param worldX
|
||||||
* @return the geo X
|
* @return the geo X
|
||||||
@@ -326,18 +373,6 @@ public class GeoEngine
|
|||||||
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the Z height.
|
|
||||||
* @param x the x coordinate
|
|
||||||
* @param y the y coordinate
|
|
||||||
* @param z the z coordinate
|
|
||||||
* @return the nearest Z height
|
|
||||||
*/
|
|
||||||
public int getHeight(int x, int y, int z)
|
|
||||||
{
|
|
||||||
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can see target. Doors as target always return true. Checks doors between.
|
* Can see target. Doors as target always return true. Checks doors between.
|
||||||
* @param cha the character
|
* @param cha the character
|
||||||
@@ -700,17 +735,6 @@ public class GeoEngine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the specified position for available geodata.
|
|
||||||
* @param x the X coordinate
|
|
||||||
* @param y the Y coordinate
|
|
||||||
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
|
||||||
*/
|
|
||||||
public boolean hasGeo(int x, int y)
|
|
||||||
{
|
|
||||||
return hasGeoPos(getGeoX(x), getGeoY(y));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GeoEngine getInstance()
|
public static GeoEngine getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
|||||||
@@ -4327,6 +4327,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceId());
|
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceId());
|
||||||
x = destiny.getX();
|
x = destiny.getX();
|
||||||
y = destiny.getY();
|
y = destiny.getY();
|
||||||
|
z = destiny.getZ();
|
||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
@@ -4340,13 +4341,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceId());
|
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceId());
|
||||||
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
||||||
{
|
{
|
||||||
|
if ((isPlayer()) || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((Summon) this).getFollowStatus()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m.disregardingGeodata = true;
|
m.disregardingGeodata = true;
|
||||||
|
|
||||||
// Mobius: Verify destination. Prevents wall collision issues.
|
x = originalX;
|
||||||
final Location newDestination = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, originalX, originalY, originalZ, getInstanceId());
|
y = originalY;
|
||||||
x = newDestination.getX();
|
z = originalZ;
|
||||||
y = newDestination.getY();
|
distance = originalDistance;
|
||||||
z = newDestination.getZ();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -13406,7 +13406,7 @@ public class PlayerInstance extends Playable
|
|||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
if (Config.CORRECT_PLAYER_Z)
|
||||||
{
|
{
|
||||||
final int nearestZ = GeoEngine.getInstance().getNextLowerZ(getX(), getY(), getZ());
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
||||||
if (getZ() < nearestZ)
|
if (getZ() < nearestZ)
|
||||||
{
|
{
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
teleToLocation(new Location(getX(), getY(), nearestZ));
|
||||||
|
|||||||
@@ -2,16 +2,14 @@
|
|||||||
GEODATA COMPENDIUM
|
GEODATA COMPENDIUM
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
Comprehensive guide for geodata, by Tryskell and Hasha.
|
Comprehensive guide for geodata.
|
||||||
|
|
||||||
I - How to configure it
|
How to configure it
|
||||||
a - Prerequisites
|
a - Prerequisites
|
||||||
b - Make it work
|
b - Make it work
|
||||||
c - L2D format
|
|
||||||
II - Addendum
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
I - How to configure it
|
How to configure it
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
@@ -30,12 +28,3 @@ To make geodata working:
|
|||||||
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
||||||
- CoordSynchronize = 2
|
- CoordSynchronize = 2
|
||||||
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
||||||
|
|
||||||
----------------------------------------------
|
|
||||||
c - L2D format
|
|
||||||
----------------------------------------------
|
|
||||||
|
|
||||||
* L2D is a new geodata file format. It holds diagonal movement informations, in addition to regular NSWE flags.
|
|
||||||
* Heavier file weight (+30%), but the pathfinding algorithms are processed way faster (-35% calculation times).
|
|
||||||
* L2D files can be converted from L2OFF/L2J formats without losing any information. Converter is part of the gameserver.
|
|
||||||
* Keep in mind to convert new geodata files, once you update your L2OFF/L2J ones.
|
|
||||||
|
|||||||
+47
-23
@@ -180,6 +180,17 @@ public class GeoEngine
|
|||||||
return region.hasGeo();
|
return region.hasGeo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the specified position for available geodata.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
||||||
|
*/
|
||||||
|
public boolean hasGeo(int x, int y)
|
||||||
|
{
|
||||||
|
return hasGeoPos(getGeoX(x), getGeoY(y));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param geoX
|
* @param geoX
|
||||||
* @param geoY
|
* @param geoY
|
||||||
@@ -274,6 +285,42 @@ public class GeoEngine
|
|||||||
return region.getNextHigherZ(geoX, geoY, worldZ);
|
return region.getNextHigherZ(geoX, geoY, worldZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next lower Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getLowerHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextLowerZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next higher Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHigherHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextHigherZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param worldX
|
* @param worldX
|
||||||
* @return the geo X
|
* @return the geo X
|
||||||
@@ -328,18 +375,6 @@ public class GeoEngine
|
|||||||
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the Z height.
|
|
||||||
* @param x the x coordinate
|
|
||||||
* @param y the y coordinate
|
|
||||||
* @param z the z coordinate
|
|
||||||
* @return the nearest Z height
|
|
||||||
*/
|
|
||||||
public int getHeight(int x, int y, int z)
|
|
||||||
{
|
|
||||||
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can see target. Doors as target always return true. Checks doors between.
|
* Can see target. Doors as target always return true. Checks doors between.
|
||||||
* @param cha the character
|
* @param cha the character
|
||||||
@@ -710,17 +745,6 @@ public class GeoEngine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the specified position for available geodata.
|
|
||||||
* @param x the X coordinate
|
|
||||||
* @param y the Y coordinate
|
|
||||||
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
|
||||||
*/
|
|
||||||
public boolean hasGeo(int x, int y)
|
|
||||||
{
|
|
||||||
return hasGeoPos(getGeoX(x), getGeoY(y));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GeoEngine getInstance()
|
public static GeoEngine getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
|||||||
+10
-5
@@ -3384,6 +3384,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
||||||
x = destiny.getX();
|
x = destiny.getX();
|
||||||
y = destiny.getY();
|
y = destiny.getY();
|
||||||
|
z = destiny.getZ();
|
||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
@@ -3397,13 +3398,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
||||||
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
||||||
{
|
{
|
||||||
|
if ((isPlayer()) || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((Summon) this).getFollowStatus()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m.disregardingGeodata = true;
|
m.disregardingGeodata = true;
|
||||||
|
|
||||||
// Mobius: Verify destination. Prevents wall collision issues.
|
x = originalX;
|
||||||
final Location newDestination = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
y = originalY;
|
||||||
x = newDestination.getX();
|
z = originalZ;
|
||||||
y = newDestination.getY();
|
distance = originalDistance;
|
||||||
z = newDestination.getZ();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -12492,7 +12492,7 @@ public class PlayerInstance extends Playable
|
|||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
if (Config.CORRECT_PLAYER_Z)
|
||||||
{
|
{
|
||||||
final int nearestZ = GeoEngine.getInstance().getNextLowerZ(getX(), getY(), getZ());
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
||||||
if (getZ() < nearestZ)
|
if (getZ() < nearestZ)
|
||||||
{
|
{
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
teleToLocation(new Location(getX(), getY(), nearestZ));
|
||||||
|
|||||||
@@ -2,16 +2,14 @@
|
|||||||
GEODATA COMPENDIUM
|
GEODATA COMPENDIUM
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
Comprehensive guide for geodata, by Tryskell and Hasha.
|
Comprehensive guide for geodata.
|
||||||
|
|
||||||
I - How to configure it
|
How to configure it
|
||||||
a - Prerequisites
|
a - Prerequisites
|
||||||
b - Make it work
|
b - Make it work
|
||||||
c - L2D format
|
|
||||||
II - Addendum
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
I - How to configure it
|
How to configure it
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
@@ -30,12 +28,3 @@ To make geodata working:
|
|||||||
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
||||||
- CoordSynchronize = 2
|
- CoordSynchronize = 2
|
||||||
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
||||||
|
|
||||||
----------------------------------------------
|
|
||||||
c - L2D format
|
|
||||||
----------------------------------------------
|
|
||||||
|
|
||||||
* L2D is a new geodata file format. It holds diagonal movement informations, in addition to regular NSWE flags.
|
|
||||||
* Heavier file weight (+30%), but the pathfinding algorithms are processed way faster (-35% calculation times).
|
|
||||||
* L2D files can be converted from L2OFF/L2J formats without losing any information. Converter is part of the gameserver.
|
|
||||||
* Keep in mind to convert new geodata files, once you update your L2OFF/L2J ones.
|
|
||||||
|
|||||||
+47
-23
@@ -180,6 +180,17 @@ public class GeoEngine
|
|||||||
return region.hasGeo();
|
return region.hasGeo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the specified position for available geodata.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
||||||
|
*/
|
||||||
|
public boolean hasGeo(int x, int y)
|
||||||
|
{
|
||||||
|
return hasGeoPos(getGeoX(x), getGeoY(y));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param geoX
|
* @param geoX
|
||||||
* @param geoY
|
* @param geoY
|
||||||
@@ -274,6 +285,42 @@ public class GeoEngine
|
|||||||
return region.getNextHigherZ(geoX, geoY, worldZ);
|
return region.getNextHigherZ(geoX, geoY, worldZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next lower Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getLowerHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextLowerZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next higher Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHigherHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextHigherZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param worldX
|
* @param worldX
|
||||||
* @return the geo X
|
* @return the geo X
|
||||||
@@ -328,18 +375,6 @@ public class GeoEngine
|
|||||||
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the Z height.
|
|
||||||
* @param x the x coordinate
|
|
||||||
* @param y the y coordinate
|
|
||||||
* @param z the z coordinate
|
|
||||||
* @return the nearest Z height
|
|
||||||
*/
|
|
||||||
public int getHeight(int x, int y, int z)
|
|
||||||
{
|
|
||||||
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can see target. Doors as target always return true. Checks doors between.
|
* Can see target. Doors as target always return true. Checks doors between.
|
||||||
* @param cha the character
|
* @param cha the character
|
||||||
@@ -710,17 +745,6 @@ public class GeoEngine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the specified position for available geodata.
|
|
||||||
* @param x the X coordinate
|
|
||||||
* @param y the Y coordinate
|
|
||||||
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
|
||||||
*/
|
|
||||||
public boolean hasGeo(int x, int y)
|
|
||||||
{
|
|
||||||
return hasGeoPos(getGeoX(x), getGeoY(y));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GeoEngine getInstance()
|
public static GeoEngine getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
|||||||
+10
-5
@@ -3384,6 +3384,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
||||||
x = destiny.getX();
|
x = destiny.getX();
|
||||||
y = destiny.getY();
|
y = destiny.getY();
|
||||||
|
z = destiny.getZ();
|
||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
@@ -3397,13 +3398,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
||||||
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
||||||
{
|
{
|
||||||
|
if ((isPlayer()) || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((Summon) this).getFollowStatus()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m.disregardingGeodata = true;
|
m.disregardingGeodata = true;
|
||||||
|
|
||||||
// Mobius: Verify destination. Prevents wall collision issues.
|
x = originalX;
|
||||||
final Location newDestination = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
y = originalY;
|
||||||
x = newDestination.getX();
|
z = originalZ;
|
||||||
y = newDestination.getY();
|
distance = originalDistance;
|
||||||
z = newDestination.getZ();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -12492,7 +12492,7 @@ public class PlayerInstance extends Playable
|
|||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
if (Config.CORRECT_PLAYER_Z)
|
||||||
{
|
{
|
||||||
final int nearestZ = GeoEngine.getInstance().getNextLowerZ(getX(), getY(), getZ());
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
||||||
if (getZ() < nearestZ)
|
if (getZ() < nearestZ)
|
||||||
{
|
{
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
teleToLocation(new Location(getX(), getY(), nearestZ));
|
||||||
|
|||||||
@@ -2,16 +2,14 @@
|
|||||||
GEODATA COMPENDIUM
|
GEODATA COMPENDIUM
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
Comprehensive guide for geodata, by Tryskell and Hasha.
|
Comprehensive guide for geodata.
|
||||||
|
|
||||||
I - How to configure it
|
How to configure it
|
||||||
a - Prerequisites
|
a - Prerequisites
|
||||||
b - Make it work
|
b - Make it work
|
||||||
c - L2D format
|
|
||||||
II - Addendum
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
I - How to configure it
|
How to configure it
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
@@ -30,12 +28,3 @@ To make geodata working:
|
|||||||
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
||||||
- CoordSynchronize = 2
|
- CoordSynchronize = 2
|
||||||
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
||||||
|
|
||||||
----------------------------------------------
|
|
||||||
c - L2D format
|
|
||||||
----------------------------------------------
|
|
||||||
|
|
||||||
* L2D is a new geodata file format. It holds diagonal movement informations, in addition to regular NSWE flags.
|
|
||||||
* Heavier file weight (+30%), but the pathfinding algorithms are processed way faster (-35% calculation times).
|
|
||||||
* L2D files can be converted from L2OFF/L2J formats without losing any information. Converter is part of the gameserver.
|
|
||||||
* Keep in mind to convert new geodata files, once you update your L2OFF/L2J ones.
|
|
||||||
|
|||||||
+47
-23
@@ -180,6 +180,17 @@ public class GeoEngine
|
|||||||
return region.hasGeo();
|
return region.hasGeo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the specified position for available geodata.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
||||||
|
*/
|
||||||
|
public boolean hasGeo(int x, int y)
|
||||||
|
{
|
||||||
|
return hasGeoPos(getGeoX(x), getGeoY(y));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param geoX
|
* @param geoX
|
||||||
* @param geoY
|
* @param geoY
|
||||||
@@ -274,6 +285,42 @@ public class GeoEngine
|
|||||||
return region.getNextHigherZ(geoX, geoY, worldZ);
|
return region.getNextHigherZ(geoX, geoY, worldZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next lower Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getLowerHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextLowerZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next higher Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHigherHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextHigherZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param worldX
|
* @param worldX
|
||||||
* @return the geo X
|
* @return the geo X
|
||||||
@@ -328,18 +375,6 @@ public class GeoEngine
|
|||||||
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the Z height.
|
|
||||||
* @param x the x coordinate
|
|
||||||
* @param y the y coordinate
|
|
||||||
* @param z the z coordinate
|
|
||||||
* @return the nearest Z height
|
|
||||||
*/
|
|
||||||
public int getHeight(int x, int y, int z)
|
|
||||||
{
|
|
||||||
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can see target. Doors as target always return true. Checks doors between.
|
* Can see target. Doors as target always return true. Checks doors between.
|
||||||
* @param cha the character
|
* @param cha the character
|
||||||
@@ -710,17 +745,6 @@ public class GeoEngine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the specified position for available geodata.
|
|
||||||
* @param x the X coordinate
|
|
||||||
* @param y the Y coordinate
|
|
||||||
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
|
||||||
*/
|
|
||||||
public boolean hasGeo(int x, int y)
|
|
||||||
{
|
|
||||||
return hasGeoPos(getGeoX(x), getGeoY(y));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GeoEngine getInstance()
|
public static GeoEngine getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
|||||||
+10
-5
@@ -3384,6 +3384,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
||||||
x = destiny.getX();
|
x = destiny.getX();
|
||||||
y = destiny.getY();
|
y = destiny.getY();
|
||||||
|
z = destiny.getZ();
|
||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
@@ -3397,13 +3398,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
||||||
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
||||||
{
|
{
|
||||||
|
if ((isPlayer()) || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((Summon) this).getFollowStatus()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m.disregardingGeodata = true;
|
m.disregardingGeodata = true;
|
||||||
|
|
||||||
// Mobius: Verify destination. Prevents wall collision issues.
|
x = originalX;
|
||||||
final Location newDestination = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
y = originalY;
|
||||||
x = newDestination.getX();
|
z = originalZ;
|
||||||
y = newDestination.getY();
|
distance = originalDistance;
|
||||||
z = newDestination.getZ();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -12478,7 +12478,7 @@ public class PlayerInstance extends Playable
|
|||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
if (Config.CORRECT_PLAYER_Z)
|
||||||
{
|
{
|
||||||
final int nearestZ = GeoEngine.getInstance().getNextLowerZ(getX(), getY(), getZ());
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
||||||
if (getZ() < nearestZ)
|
if (getZ() < nearestZ)
|
||||||
{
|
{
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
teleToLocation(new Location(getX(), getY(), nearestZ));
|
||||||
|
|||||||
@@ -2,16 +2,14 @@
|
|||||||
GEODATA COMPENDIUM
|
GEODATA COMPENDIUM
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
Comprehensive guide for geodata, by Tryskell and Hasha.
|
Comprehensive guide for geodata.
|
||||||
|
|
||||||
I - How to configure it
|
How to configure it
|
||||||
a - Prerequisites
|
a - Prerequisites
|
||||||
b - Make it work
|
b - Make it work
|
||||||
c - L2D format
|
|
||||||
II - Addendum
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
I - How to configure it
|
How to configure it
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
@@ -30,12 +28,3 @@ To make geodata working:
|
|||||||
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
||||||
- CoordSynchronize = 2
|
- CoordSynchronize = 2
|
||||||
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
||||||
|
|
||||||
----------------------------------------------
|
|
||||||
c - L2D format
|
|
||||||
----------------------------------------------
|
|
||||||
|
|
||||||
* L2D is a new geodata file format. It holds diagonal movement informations, in addition to regular NSWE flags.
|
|
||||||
* Heavier file weight (+30%), but the pathfinding algorithms are processed way faster (-35% calculation times).
|
|
||||||
* L2D files can be converted from L2OFF/L2J formats without losing any information. Converter is part of the gameserver.
|
|
||||||
* Keep in mind to convert new geodata files, once you update your L2OFF/L2J ones.
|
|
||||||
|
|||||||
+47
-23
@@ -180,6 +180,17 @@ public class GeoEngine
|
|||||||
return region.hasGeo();
|
return region.hasGeo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the specified position for available geodata.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
||||||
|
*/
|
||||||
|
public boolean hasGeo(int x, int y)
|
||||||
|
{
|
||||||
|
return hasGeoPos(getGeoX(x), getGeoY(y));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param geoX
|
* @param geoX
|
||||||
* @param geoY
|
* @param geoY
|
||||||
@@ -274,6 +285,42 @@ public class GeoEngine
|
|||||||
return region.getNextHigherZ(geoX, geoY, worldZ);
|
return region.getNextHigherZ(geoX, geoY, worldZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next lower Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getLowerHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextLowerZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next higher Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHigherHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextHigherZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param worldX
|
* @param worldX
|
||||||
* @return the geo X
|
* @return the geo X
|
||||||
@@ -328,18 +375,6 @@ public class GeoEngine
|
|||||||
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the Z height.
|
|
||||||
* @param x the x coordinate
|
|
||||||
* @param y the y coordinate
|
|
||||||
* @param z the z coordinate
|
|
||||||
* @return the nearest Z height
|
|
||||||
*/
|
|
||||||
public int getHeight(int x, int y, int z)
|
|
||||||
{
|
|
||||||
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can see target. Doors as target always return true. Checks doors between.
|
* Can see target. Doors as target always return true. Checks doors between.
|
||||||
* @param cha the character
|
* @param cha the character
|
||||||
@@ -710,17 +745,6 @@ public class GeoEngine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the specified position for available geodata.
|
|
||||||
* @param x the X coordinate
|
|
||||||
* @param y the Y coordinate
|
|
||||||
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
|
||||||
*/
|
|
||||||
public boolean hasGeo(int x, int y)
|
|
||||||
{
|
|
||||||
return hasGeoPos(getGeoX(x), getGeoY(y));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GeoEngine getInstance()
|
public static GeoEngine getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
|||||||
+10
-5
@@ -3397,6 +3397,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
||||||
x = destiny.getX();
|
x = destiny.getX();
|
||||||
y = destiny.getY();
|
y = destiny.getY();
|
||||||
|
z = destiny.getZ();
|
||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
@@ -3410,13 +3411,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
||||||
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
||||||
{
|
{
|
||||||
|
if ((isPlayer()) || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((Summon) this).getFollowStatus()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m.disregardingGeodata = true;
|
m.disregardingGeodata = true;
|
||||||
|
|
||||||
// Mobius: Verify destination. Prevents wall collision issues.
|
x = originalX;
|
||||||
final Location newDestination = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
y = originalY;
|
||||||
x = newDestination.getX();
|
z = originalZ;
|
||||||
y = newDestination.getY();
|
distance = originalDistance;
|
||||||
z = newDestination.getZ();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -12527,7 +12527,7 @@ public class PlayerInstance extends Playable
|
|||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
if (Config.CORRECT_PLAYER_Z)
|
||||||
{
|
{
|
||||||
final int nearestZ = GeoEngine.getInstance().getNextLowerZ(getX(), getY(), getZ());
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
||||||
if (getZ() < nearestZ)
|
if (getZ() < nearestZ)
|
||||||
{
|
{
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
teleToLocation(new Location(getX(), getY(), nearestZ));
|
||||||
|
|||||||
@@ -2,16 +2,14 @@
|
|||||||
GEODATA COMPENDIUM
|
GEODATA COMPENDIUM
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
Comprehensive guide for geodata, by Tryskell and Hasha.
|
Comprehensive guide for geodata.
|
||||||
|
|
||||||
I - How to configure it
|
How to configure it
|
||||||
a - Prerequisites
|
a - Prerequisites
|
||||||
b - Make it work
|
b - Make it work
|
||||||
c - L2D format
|
|
||||||
II - Addendum
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
I - How to configure it
|
How to configure it
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
@@ -30,12 +28,3 @@ To make geodata working:
|
|||||||
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
||||||
- CoordSynchronize = 2
|
- CoordSynchronize = 2
|
||||||
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
||||||
|
|
||||||
----------------------------------------------
|
|
||||||
c - L2D format
|
|
||||||
----------------------------------------------
|
|
||||||
|
|
||||||
* L2D is a new geodata file format. It holds diagonal movement informations, in addition to regular NSWE flags.
|
|
||||||
* Heavier file weight (+30%), but the pathfinding algorithms are processed way faster (-35% calculation times).
|
|
||||||
* L2D files can be converted from L2OFF/L2J formats without losing any information. Converter is part of the gameserver.
|
|
||||||
* Keep in mind to convert new geodata files, once you update your L2OFF/L2J ones.
|
|
||||||
|
|||||||
+47
-23
@@ -180,6 +180,17 @@ public class GeoEngine
|
|||||||
return region.hasGeo();
|
return region.hasGeo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the specified position for available geodata.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
||||||
|
*/
|
||||||
|
public boolean hasGeo(int x, int y)
|
||||||
|
{
|
||||||
|
return hasGeoPos(getGeoX(x), getGeoY(y));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param geoX
|
* @param geoX
|
||||||
* @param geoY
|
* @param geoY
|
||||||
@@ -274,6 +285,42 @@ public class GeoEngine
|
|||||||
return region.getNextHigherZ(geoX, geoY, worldZ);
|
return region.getNextHigherZ(geoX, geoY, worldZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next lower Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getLowerHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextLowerZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next higher Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHigherHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextHigherZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param worldX
|
* @param worldX
|
||||||
* @return the geo X
|
* @return the geo X
|
||||||
@@ -328,18 +375,6 @@ public class GeoEngine
|
|||||||
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the Z height.
|
|
||||||
* @param x the x coordinate
|
|
||||||
* @param y the y coordinate
|
|
||||||
* @param z the z coordinate
|
|
||||||
* @return the nearest Z height
|
|
||||||
*/
|
|
||||||
public int getHeight(int x, int y, int z)
|
|
||||||
{
|
|
||||||
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can see target. Doors as target always return true. Checks doors between.
|
* Can see target. Doors as target always return true. Checks doors between.
|
||||||
* @param cha the character
|
* @param cha the character
|
||||||
@@ -710,17 +745,6 @@ public class GeoEngine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the specified position for available geodata.
|
|
||||||
* @param x the X coordinate
|
|
||||||
* @param y the Y coordinate
|
|
||||||
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
|
||||||
*/
|
|
||||||
public boolean hasGeo(int x, int y)
|
|
||||||
{
|
|
||||||
return hasGeoPos(getGeoX(x), getGeoY(y));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GeoEngine getInstance()
|
public static GeoEngine getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
|||||||
+10
-5
@@ -3397,6 +3397,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
||||||
x = destiny.getX();
|
x = destiny.getX();
|
||||||
y = destiny.getY();
|
y = destiny.getY();
|
||||||
|
z = destiny.getZ();
|
||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
@@ -3410,13 +3411,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
||||||
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
||||||
{
|
{
|
||||||
|
if ((isPlayer()) || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((Summon) this).getFollowStatus()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m.disregardingGeodata = true;
|
m.disregardingGeodata = true;
|
||||||
|
|
||||||
// Mobius: Verify destination. Prevents wall collision issues.
|
x = originalX;
|
||||||
final Location newDestination = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
y = originalY;
|
||||||
x = newDestination.getX();
|
z = originalZ;
|
||||||
y = newDestination.getY();
|
distance = originalDistance;
|
||||||
z = newDestination.getZ();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -12527,7 +12527,7 @@ public class PlayerInstance extends Playable
|
|||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
if (Config.CORRECT_PLAYER_Z)
|
||||||
{
|
{
|
||||||
final int nearestZ = GeoEngine.getInstance().getNextLowerZ(getX(), getY(), getZ());
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
||||||
if (getZ() < nearestZ)
|
if (getZ() < nearestZ)
|
||||||
{
|
{
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
teleToLocation(new Location(getX(), getY(), nearestZ));
|
||||||
|
|||||||
@@ -2,16 +2,14 @@
|
|||||||
GEODATA COMPENDIUM
|
GEODATA COMPENDIUM
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
Comprehensive guide for geodata, by Tryskell and Hasha.
|
Comprehensive guide for geodata.
|
||||||
|
|
||||||
I - How to configure it
|
How to configure it
|
||||||
a - Prerequisites
|
a - Prerequisites
|
||||||
b - Make it work
|
b - Make it work
|
||||||
c - L2D format
|
|
||||||
II - Addendum
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
I - How to configure it
|
How to configure it
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
@@ -30,12 +28,3 @@ To make geodata working:
|
|||||||
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
||||||
- CoordSynchronize = 2
|
- CoordSynchronize = 2
|
||||||
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
||||||
|
|
||||||
----------------------------------------------
|
|
||||||
c - L2D format
|
|
||||||
----------------------------------------------
|
|
||||||
|
|
||||||
* L2D is a new geodata file format. It holds diagonal movement informations, in addition to regular NSWE flags.
|
|
||||||
* Heavier file weight (+30%), but the pathfinding algorithms are processed way faster (-35% calculation times).
|
|
||||||
* L2D files can be converted from L2OFF/L2J formats without losing any information. Converter is part of the gameserver.
|
|
||||||
* Keep in mind to convert new geodata files, once you update your L2OFF/L2J ones.
|
|
||||||
|
|||||||
+47
-23
@@ -180,6 +180,17 @@ public class GeoEngine
|
|||||||
return region.hasGeo();
|
return region.hasGeo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the specified position for available geodata.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
||||||
|
*/
|
||||||
|
public boolean hasGeo(int x, int y)
|
||||||
|
{
|
||||||
|
return hasGeoPos(getGeoX(x), getGeoY(y));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param geoX
|
* @param geoX
|
||||||
* @param geoY
|
* @param geoY
|
||||||
@@ -274,6 +285,42 @@ public class GeoEngine
|
|||||||
return region.getNextHigherZ(geoX, geoY, worldZ);
|
return region.getNextHigherZ(geoX, geoY, worldZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next lower Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getLowerHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextLowerZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next higher Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHigherHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextHigherZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param worldX
|
* @param worldX
|
||||||
* @return the geo X
|
* @return the geo X
|
||||||
@@ -328,18 +375,6 @@ public class GeoEngine
|
|||||||
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the Z height.
|
|
||||||
* @param x the x coordinate
|
|
||||||
* @param y the y coordinate
|
|
||||||
* @param z the z coordinate
|
|
||||||
* @return the nearest Z height
|
|
||||||
*/
|
|
||||||
public int getHeight(int x, int y, int z)
|
|
||||||
{
|
|
||||||
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can see target. Doors as target always return true. Checks doors between.
|
* Can see target. Doors as target always return true. Checks doors between.
|
||||||
* @param cha the character
|
* @param cha the character
|
||||||
@@ -710,17 +745,6 @@ public class GeoEngine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the specified position for available geodata.
|
|
||||||
* @param x the X coordinate
|
|
||||||
* @param y the Y coordinate
|
|
||||||
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
|
||||||
*/
|
|
||||||
public boolean hasGeo(int x, int y)
|
|
||||||
{
|
|
||||||
return hasGeoPos(getGeoX(x), getGeoY(y));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GeoEngine getInstance()
|
public static GeoEngine getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
|||||||
+10
-5
@@ -3396,6 +3396,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
||||||
x = destiny.getX();
|
x = destiny.getX();
|
||||||
y = destiny.getY();
|
y = destiny.getY();
|
||||||
|
z = destiny.getZ();
|
||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
@@ -3409,13 +3410,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
||||||
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
||||||
{
|
{
|
||||||
|
if ((isPlayer()) || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((Summon) this).getFollowStatus()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m.disregardingGeodata = true;
|
m.disregardingGeodata = true;
|
||||||
|
|
||||||
// Mobius: Verify destination. Prevents wall collision issues.
|
x = originalX;
|
||||||
final Location newDestination = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
y = originalY;
|
||||||
x = newDestination.getX();
|
z = originalZ;
|
||||||
y = newDestination.getY();
|
distance = originalDistance;
|
||||||
z = newDestination.getZ();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -12505,7 +12505,7 @@ public class PlayerInstance extends Playable
|
|||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
if (Config.CORRECT_PLAYER_Z)
|
||||||
{
|
{
|
||||||
final int nearestZ = GeoEngine.getInstance().getNextLowerZ(getX(), getY(), getZ());
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
||||||
if (getZ() < nearestZ)
|
if (getZ() < nearestZ)
|
||||||
{
|
{
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
teleToLocation(new Location(getX(), getY(), nearestZ));
|
||||||
|
|||||||
@@ -2,16 +2,14 @@
|
|||||||
GEODATA COMPENDIUM
|
GEODATA COMPENDIUM
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
Comprehensive guide for geodata, by Tryskell and Hasha.
|
Comprehensive guide for geodata.
|
||||||
|
|
||||||
I - How to configure it
|
How to configure it
|
||||||
a - Prerequisites
|
a - Prerequisites
|
||||||
b - Make it work
|
b - Make it work
|
||||||
c - L2D format
|
|
||||||
II - Addendum
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
I - How to configure it
|
How to configure it
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
@@ -30,12 +28,3 @@ To make geodata working:
|
|||||||
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
||||||
- CoordSynchronize = 2
|
- CoordSynchronize = 2
|
||||||
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
||||||
|
|
||||||
----------------------------------------------
|
|
||||||
c - L2D format
|
|
||||||
----------------------------------------------
|
|
||||||
|
|
||||||
* L2D is a new geodata file format. It holds diagonal movement informations, in addition to regular NSWE flags.
|
|
||||||
* Heavier file weight (+30%), but the pathfinding algorithms are processed way faster (-35% calculation times).
|
|
||||||
* L2D files can be converted from L2OFF/L2J formats without losing any information. Converter is part of the gameserver.
|
|
||||||
* Keep in mind to convert new geodata files, once you update your L2OFF/L2J ones.
|
|
||||||
|
|||||||
+47
-23
@@ -180,6 +180,17 @@ public class GeoEngine
|
|||||||
return region.hasGeo();
|
return region.hasGeo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the specified position for available geodata.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
||||||
|
*/
|
||||||
|
public boolean hasGeo(int x, int y)
|
||||||
|
{
|
||||||
|
return hasGeoPos(getGeoX(x), getGeoY(y));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param geoX
|
* @param geoX
|
||||||
* @param geoY
|
* @param geoY
|
||||||
@@ -274,6 +285,42 @@ public class GeoEngine
|
|||||||
return region.getNextHigherZ(geoX, geoY, worldZ);
|
return region.getNextHigherZ(geoX, geoY, worldZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next lower Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getLowerHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextLowerZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next higher Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHigherHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextHigherZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param worldX
|
* @param worldX
|
||||||
* @return the geo X
|
* @return the geo X
|
||||||
@@ -328,18 +375,6 @@ public class GeoEngine
|
|||||||
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the Z height.
|
|
||||||
* @param x the x coordinate
|
|
||||||
* @param y the y coordinate
|
|
||||||
* @param z the z coordinate
|
|
||||||
* @return the nearest Z height
|
|
||||||
*/
|
|
||||||
public int getHeight(int x, int y, int z)
|
|
||||||
{
|
|
||||||
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can see target. Doors as target always return true. Checks doors between.
|
* Can see target. Doors as target always return true. Checks doors between.
|
||||||
* @param cha the character
|
* @param cha the character
|
||||||
@@ -710,17 +745,6 @@ public class GeoEngine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the specified position for available geodata.
|
|
||||||
* @param x the X coordinate
|
|
||||||
* @param y the Y coordinate
|
|
||||||
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
|
||||||
*/
|
|
||||||
public boolean hasGeo(int x, int y)
|
|
||||||
{
|
|
||||||
return hasGeoPos(getGeoX(x), getGeoY(y));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GeoEngine getInstance()
|
public static GeoEngine getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
|||||||
+10
-5
@@ -3384,6 +3384,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
||||||
x = destiny.getX();
|
x = destiny.getX();
|
||||||
y = destiny.getY();
|
y = destiny.getY();
|
||||||
|
z = destiny.getZ();
|
||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
@@ -3397,13 +3398,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
||||||
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
||||||
{
|
{
|
||||||
|
if ((isPlayer()) || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((Summon) this).getFollowStatus()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m.disregardingGeodata = true;
|
m.disregardingGeodata = true;
|
||||||
|
|
||||||
// Mobius: Verify destination. Prevents wall collision issues.
|
x = originalX;
|
||||||
final Location newDestination = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
y = originalY;
|
||||||
x = newDestination.getX();
|
z = originalZ;
|
||||||
y = newDestination.getY();
|
distance = originalDistance;
|
||||||
z = newDestination.getZ();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -12513,7 +12513,7 @@ public class PlayerInstance extends Playable
|
|||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
if (Config.CORRECT_PLAYER_Z)
|
||||||
{
|
{
|
||||||
final int nearestZ = GeoEngine.getInstance().getNextLowerZ(getX(), getY(), getZ());
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
||||||
if (getZ() < nearestZ)
|
if (getZ() < nearestZ)
|
||||||
{
|
{
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
teleToLocation(new Location(getX(), getY(), nearestZ));
|
||||||
|
|||||||
+5
-16
@@ -2,16 +2,14 @@
|
|||||||
GEODATA COMPENDIUM
|
GEODATA COMPENDIUM
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
Comprehensive guide for geodata, by Tryskell and Hasha.
|
Comprehensive guide for geodata.
|
||||||
|
|
||||||
I - How to configure it
|
How to configure it
|
||||||
a - Prerequisites
|
a - Prerequisites
|
||||||
b - Make it work
|
b - Make it work
|
||||||
c - L2D format
|
|
||||||
II - Addendum
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
I - How to configure it
|
How to configure it
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
@@ -30,12 +28,3 @@ To make geodata working:
|
|||||||
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
||||||
- CoordSynchronize = 2
|
- CoordSynchronize = 2
|
||||||
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
||||||
|
|
||||||
----------------------------------------------
|
|
||||||
c - L2D format
|
|
||||||
----------------------------------------------
|
|
||||||
|
|
||||||
* L2D is a new geodata file format. It holds diagonal movement informations, in addition to regular NSWE flags.
|
|
||||||
* Heavier file weight (+30%), but the pathfinding algorithms are processed way faster (-35% calculation times).
|
|
||||||
* L2D files can be converted from L2OFF/L2J formats without losing any information. Converter is part of the gameserver.
|
|
||||||
* Keep in mind to convert new geodata files, once you update your L2OFF/L2J ones.
|
|
||||||
|
|||||||
+47
-23
@@ -180,6 +180,17 @@ public class GeoEngine
|
|||||||
return region.hasGeo();
|
return region.hasGeo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the specified position for available geodata.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
||||||
|
*/
|
||||||
|
public boolean hasGeo(int x, int y)
|
||||||
|
{
|
||||||
|
return hasGeoPos(getGeoX(x), getGeoY(y));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param geoX
|
* @param geoX
|
||||||
* @param geoY
|
* @param geoY
|
||||||
@@ -274,6 +285,42 @@ public class GeoEngine
|
|||||||
return region.getNextHigherZ(geoX, geoY, worldZ);
|
return region.getNextHigherZ(geoX, geoY, worldZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next lower Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getLowerHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextLowerZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next higher Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHigherHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextHigherZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param worldX
|
* @param worldX
|
||||||
* @return the geo X
|
* @return the geo X
|
||||||
@@ -328,18 +375,6 @@ public class GeoEngine
|
|||||||
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the Z height.
|
|
||||||
* @param x the x coordinate
|
|
||||||
* @param y the y coordinate
|
|
||||||
* @param z the z coordinate
|
|
||||||
* @return the nearest Z height
|
|
||||||
*/
|
|
||||||
public int getHeight(int x, int y, int z)
|
|
||||||
{
|
|
||||||
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can see target. Doors as target always return true. Checks doors between.
|
* Can see target. Doors as target always return true. Checks doors between.
|
||||||
* @param cha the character
|
* @param cha the character
|
||||||
@@ -710,17 +745,6 @@ public class GeoEngine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the specified position for available geodata.
|
|
||||||
* @param x the X coordinate
|
|
||||||
* @param y the Y coordinate
|
|
||||||
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
|
||||||
*/
|
|
||||||
public boolean hasGeo(int x, int y)
|
|
||||||
{
|
|
||||||
return hasGeoPos(getGeoX(x), getGeoY(y));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GeoEngine getInstance()
|
public static GeoEngine getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
|||||||
+10
-5
@@ -3399,6 +3399,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
||||||
x = destiny.getX();
|
x = destiny.getX();
|
||||||
y = destiny.getY();
|
y = destiny.getY();
|
||||||
|
z = destiny.getZ();
|
||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
@@ -3412,13 +3413,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
||||||
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
||||||
{
|
{
|
||||||
|
if ((isPlayer()) || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((Summon) this).getFollowStatus()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m.disregardingGeodata = true;
|
m.disregardingGeodata = true;
|
||||||
|
|
||||||
// Mobius: Verify destination. Prevents wall collision issues.
|
x = originalX;
|
||||||
final Location newDestination = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
y = originalY;
|
||||||
x = newDestination.getX();
|
z = originalZ;
|
||||||
y = newDestination.getY();
|
distance = originalDistance;
|
||||||
z = newDestination.getZ();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -12696,7 +12696,7 @@ public class PlayerInstance extends Playable
|
|||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
if (Config.CORRECT_PLAYER_Z)
|
||||||
{
|
{
|
||||||
final int nearestZ = GeoEngine.getInstance().getNextLowerZ(getX(), getY(), getZ());
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
||||||
if (getZ() < nearestZ)
|
if (getZ() < nearestZ)
|
||||||
{
|
{
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
teleToLocation(new Location(getX(), getY(), nearestZ));
|
||||||
|
|||||||
@@ -2,16 +2,14 @@
|
|||||||
GEODATA COMPENDIUM
|
GEODATA COMPENDIUM
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
Comprehensive guide for geodata, by Tryskell and Hasha.
|
Comprehensive guide for geodata.
|
||||||
|
|
||||||
I - How to configure it
|
How to configure it
|
||||||
a - Prerequisites
|
a - Prerequisites
|
||||||
b - Make it work
|
b - Make it work
|
||||||
c - L2D format
|
|
||||||
II - Addendum
|
|
||||||
|
|
||||||
##############################################
|
##############################################
|
||||||
I - How to configure it
|
How to configure it
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
@@ -30,12 +28,3 @@ To make geodata working:
|
|||||||
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
* open "/config/GeoEngine.ini" with your favorite text editor and then edit following config:
|
||||||
- CoordSynchronize = 2
|
- CoordSynchronize = 2
|
||||||
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
* If you do not use any geodata files, the server will automatically change this setting to -1.
|
||||||
|
|
||||||
----------------------------------------------
|
|
||||||
c - L2D format
|
|
||||||
----------------------------------------------
|
|
||||||
|
|
||||||
* L2D is a new geodata file format. It holds diagonal movement informations, in addition to regular NSWE flags.
|
|
||||||
* Heavier file weight (+30%), but the pathfinding algorithms are processed way faster (-35% calculation times).
|
|
||||||
* L2D files can be converted from L2OFF/L2J formats without losing any information. Converter is part of the gameserver.
|
|
||||||
* Keep in mind to convert new geodata files, once you update your L2OFF/L2J ones.
|
|
||||||
|
|||||||
+47
-23
@@ -180,6 +180,17 @@ public class GeoEngine
|
|||||||
return region.hasGeo();
|
return region.hasGeo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the specified position for available geodata.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
||||||
|
*/
|
||||||
|
public boolean hasGeo(int x, int y)
|
||||||
|
{
|
||||||
|
return hasGeoPos(getGeoX(x), getGeoY(y));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param geoX
|
* @param geoX
|
||||||
* @param geoY
|
* @param geoY
|
||||||
@@ -274,6 +285,42 @@ public class GeoEngine
|
|||||||
return region.getNextHigherZ(geoX, geoY, worldZ);
|
return region.getNextHigherZ(geoX, geoY, worldZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next lower Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getLowerHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextLowerZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the next higher Z height.
|
||||||
|
* @param x the world x
|
||||||
|
* @param y the world y
|
||||||
|
* @param z the world z
|
||||||
|
* @return the nearest Z height
|
||||||
|
*/
|
||||||
|
public int getHigherHeight(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getNextHigherZ(getGeoX(x), getGeoY(y), z);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param worldX
|
* @param worldX
|
||||||
* @return the geo X
|
* @return the geo X
|
||||||
@@ -328,18 +375,6 @@ public class GeoEngine
|
|||||||
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
return (geoZ * 16) + WORLD_MIN_Z + 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the Z height.
|
|
||||||
* @param x the x coordinate
|
|
||||||
* @param y the y coordinate
|
|
||||||
* @param z the z coordinate
|
|
||||||
* @return the nearest Z height
|
|
||||||
*/
|
|
||||||
public int getHeight(int x, int y, int z)
|
|
||||||
{
|
|
||||||
return getNearestZ(getGeoX(x), getGeoY(y), z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can see target. Doors as target always return true. Checks doors between.
|
* Can see target. Doors as target always return true. Checks doors between.
|
||||||
* @param cha the character
|
* @param cha the character
|
||||||
@@ -710,17 +745,6 @@ public class GeoEngine
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the specified position for available geodata.
|
|
||||||
* @param x the X coordinate
|
|
||||||
* @param y the Y coordinate
|
|
||||||
* @return {@code true} if there is geodata for the given coordinates, {@code false} otherwise
|
|
||||||
*/
|
|
||||||
public boolean hasGeo(int x, int y)
|
|
||||||
{
|
|
||||||
return hasGeoPos(getGeoX(x), getGeoY(y));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GeoEngine getInstance()
|
public static GeoEngine getInstance()
|
||||||
{
|
{
|
||||||
return SingletonHolder.INSTANCE;
|
return SingletonHolder.INSTANCE;
|
||||||
|
|||||||
+10
-5
@@ -3406,6 +3406,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
final Location destiny = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, x, y, z, getInstanceWorld());
|
||||||
x = destiny.getX();
|
x = destiny.getX();
|
||||||
y = destiny.getY();
|
y = destiny.getY();
|
||||||
|
z = destiny.getZ();
|
||||||
dx = x - curX;
|
dx = x - curX;
|
||||||
dy = y - curY;
|
dy = y - curY;
|
||||||
dz = z - curZ;
|
dz = z - curZ;
|
||||||
@@ -3419,13 +3420,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
m.geoPath = GeoEnginePathfinding.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
||||||
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found
|
||||||
{
|
{
|
||||||
|
if ((isPlayer()) || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((Summon) this).getFollowStatus()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m.disregardingGeodata = true;
|
m.disregardingGeodata = true;
|
||||||
|
|
||||||
// Mobius: Verify destination. Prevents wall collision issues.
|
x = originalX;
|
||||||
final Location newDestination = GeoEngine.getInstance().canMoveToTargetLoc(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld());
|
y = originalY;
|
||||||
x = newDestination.getX();
|
z = originalZ;
|
||||||
y = newDestination.getY();
|
distance = originalDistance;
|
||||||
z = newDestination.getZ();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -12700,7 +12700,7 @@ public class PlayerInstance extends Playable
|
|||||||
{
|
{
|
||||||
if (Config.CORRECT_PLAYER_Z)
|
if (Config.CORRECT_PLAYER_Z)
|
||||||
{
|
{
|
||||||
final int nearestZ = GeoEngine.getInstance().getNextLowerZ(getX(), getY(), getZ());
|
final int nearestZ = GeoEngine.getInstance().getHigherHeight(getX(), getY(), getZ());
|
||||||
if (getZ() < nearestZ)
|
if (getZ() < nearestZ)
|
||||||
{
|
{
|
||||||
teleToLocation(new Location(getX(), getY(), nearestZ));
|
teleToLocation(new Location(getX(), getY(), nearestZ));
|
||||||
|
|||||||
Reference in New Issue
Block a user