diff --git a/L2J_Mobius_Classic/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java b/L2J_Mobius_Classic/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java index 9cb85c282f..4cd64d35e4 100644 --- a/L2J_Mobius_Classic/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java +++ b/L2J_Mobius_Classic/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java @@ -38,7 +38,7 @@ public class AdminPathNode implements IAdminCommandHandler { if (activeChar.getTarget() != null) { - List path = GeoEngine.getInstance().findPath(activeChar.getX(), activeChar.getY(), (short) activeChar.getZ(), activeChar.getTarget().getX(), activeChar.getTarget().getY(), (short) activeChar.getTarget().getZ(), activeChar.getInstanceWorld(), true); + final List path = GeoEngine.getInstance().findPath(activeChar.getX(), activeChar.getY(), (short) activeChar.getZ(), activeChar.getTarget().getX(), activeChar.getTarget().getY(), (short) activeChar.getTarget().getZ(), activeChar.getInstanceWorld()); if (path == null) { activeChar.sendMessage("No route found or pathfinding disabled."); diff --git a/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/geoengine/GeoEngine.java b/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/geoengine/GeoEngine.java index bb9058636a..ab77a6a3ab 100644 --- a/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/geoengine/GeoEngine.java +++ b/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/geoengine/GeoEngine.java @@ -1288,10 +1288,9 @@ public class GeoEngine * @param ty : target y * @param tz : target z * @param instance - * @param playable : moving object is playable? * @return {@code List} : complete path from nodes */ - public List findPath(int ox, int oy, int oz, int tx, int ty, int tz, Instance instance, boolean playable) + public List findPath(int ox, int oy, int oz, int tx, int ty, int tz, Instance instance) { return null; } diff --git a/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/geoengine/GeoEnginePathfinding.java b/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/geoengine/GeoEnginePathfinding.java index 5447dcc767..25738c7f98 100644 --- a/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/geoengine/GeoEnginePathfinding.java +++ b/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/geoengine/GeoEnginePathfinding.java @@ -65,7 +65,7 @@ final class GeoEnginePathfinding extends GeoEngine } @Override - public List findPath(int ox, int oy, int oz, int tx, int ty, int tz, Instance instance, boolean playable) + public List findPath(int ox, int oy, int oz, int tx, int ty, int tz, Instance instance) { // get origin and check existing geo coords int gox = getGeoX(ox); @@ -88,7 +88,7 @@ final class GeoEnginePathfinding extends GeoEngine short gtz = getHeightNearest(gtx, gty, tz); // Prepare buffer for pathfinding calculations - NodeBuffer buffer = getBuffer(64 + (2 * Math.max(Math.abs(gox - gtx), Math.abs(goy - gty))), playable); + final NodeBuffer buffer = getBuffer(64 + (2 * Math.max(Math.abs(gox - gtx), Math.abs(goy - gty)))); if (buffer == null) { return null; @@ -213,10 +213,9 @@ final class GeoEnginePathfinding extends GeoEngine /** * Provides optimize selection of the buffer. When all pre-initialized buffer are locked, creates new buffer. * @param size : pre-calculated minimal required size - * @param playable : moving object is playable? * @return NodeBuffer : buffer */ - private final NodeBuffer getBuffer(int size, boolean playable) + private final NodeBuffer getBuffer(int size) { NodeBuffer current = null; for (BufferHolder holder : _buffers) diff --git a/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/model/actor/L2Character.java index 1ea1c674fb..c8a5fc0808 100644 --- a/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -3521,15 +3521,17 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe distance = Math.hypot(dx, dy); } + // @formatter:off // Define movement angles needed // ^ - // | X (x,y) - // | / - // | /distance + // | X (x,y) + // | / + // | / distance // | / // |/ angle // X ----------> // (curx,cury) + // @formatter:on double cos; double sin; @@ -3643,13 +3645,13 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe dz = z - curZ; distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy); } - // Pathfinding checks. Only when geodata setting is 2, the LoS check gives shorter result than the original movement was and the LoS gives a shorter distance than 2000 + // Pathfinding checks. Only when geodata setting is 2, the LoS check gives shorter result // This way of detecting need for pathfinding could be changed. if (Config.PATHFINDING && ((originalDistance - distance) > 30) && !isControlBlocked() && !isInVehicle) { // Path calculation -- overrides previous movement check - m.geoPath = GeoEngine.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld(), isPlayable()); - if ((m.geoPath == null) || (m.geoPath.size() < 2)) + m.geoPath = GeoEngine.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld()); + if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found { // No path found // Even though there's no path found (remember geonodes aren't perfect), the mob is attacking and right now we set it so that the mob will go after target anyway, is dz is small enough. @@ -3735,9 +3737,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe { ThreadPoolManager.schedule(new NotifyAITask(this, CtrlEvent.EVT_ARRIVED_REVALIDATE), 2000); } - - // the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive - // to destination by GameTimeController + // the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive to destination by GameTimeController } public boolean moveToNextRoutePoint() diff --git a/L2J_Mobius_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java b/L2J_Mobius_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java index 9cb85c282f..4cd64d35e4 100644 --- a/L2J_Mobius_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java +++ b/L2J_Mobius_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java @@ -38,7 +38,7 @@ public class AdminPathNode implements IAdminCommandHandler { if (activeChar.getTarget() != null) { - List path = GeoEngine.getInstance().findPath(activeChar.getX(), activeChar.getY(), (short) activeChar.getZ(), activeChar.getTarget().getX(), activeChar.getTarget().getY(), (short) activeChar.getTarget().getZ(), activeChar.getInstanceWorld(), true); + final List path = GeoEngine.getInstance().findPath(activeChar.getX(), activeChar.getY(), (short) activeChar.getZ(), activeChar.getTarget().getX(), activeChar.getTarget().getY(), (short) activeChar.getTarget().getZ(), activeChar.getInstanceWorld()); if (path == null) { activeChar.sendMessage("No route found or pathfinding disabled."); diff --git a/L2J_Mobius_Ertheia/java/com/l2jmobius/gameserver/geoengine/GeoEngine.java b/L2J_Mobius_Ertheia/java/com/l2jmobius/gameserver/geoengine/GeoEngine.java index bb9058636a..ab77a6a3ab 100644 --- a/L2J_Mobius_Ertheia/java/com/l2jmobius/gameserver/geoengine/GeoEngine.java +++ b/L2J_Mobius_Ertheia/java/com/l2jmobius/gameserver/geoengine/GeoEngine.java @@ -1288,10 +1288,9 @@ public class GeoEngine * @param ty : target y * @param tz : target z * @param instance - * @param playable : moving object is playable? * @return {@code List} : complete path from nodes */ - public List findPath(int ox, int oy, int oz, int tx, int ty, int tz, Instance instance, boolean playable) + public List findPath(int ox, int oy, int oz, int tx, int ty, int tz, Instance instance) { return null; } diff --git a/L2J_Mobius_Ertheia/java/com/l2jmobius/gameserver/geoengine/GeoEnginePathfinding.java b/L2J_Mobius_Ertheia/java/com/l2jmobius/gameserver/geoengine/GeoEnginePathfinding.java index 5447dcc767..25738c7f98 100644 --- a/L2J_Mobius_Ertheia/java/com/l2jmobius/gameserver/geoengine/GeoEnginePathfinding.java +++ b/L2J_Mobius_Ertheia/java/com/l2jmobius/gameserver/geoengine/GeoEnginePathfinding.java @@ -65,7 +65,7 @@ final class GeoEnginePathfinding extends GeoEngine } @Override - public List findPath(int ox, int oy, int oz, int tx, int ty, int tz, Instance instance, boolean playable) + public List findPath(int ox, int oy, int oz, int tx, int ty, int tz, Instance instance) { // get origin and check existing geo coords int gox = getGeoX(ox); @@ -88,7 +88,7 @@ final class GeoEnginePathfinding extends GeoEngine short gtz = getHeightNearest(gtx, gty, tz); // Prepare buffer for pathfinding calculations - NodeBuffer buffer = getBuffer(64 + (2 * Math.max(Math.abs(gox - gtx), Math.abs(goy - gty))), playable); + final NodeBuffer buffer = getBuffer(64 + (2 * Math.max(Math.abs(gox - gtx), Math.abs(goy - gty)))); if (buffer == null) { return null; @@ -213,10 +213,9 @@ final class GeoEnginePathfinding extends GeoEngine /** * Provides optimize selection of the buffer. When all pre-initialized buffer are locked, creates new buffer. * @param size : pre-calculated minimal required size - * @param playable : moving object is playable? * @return NodeBuffer : buffer */ - private final NodeBuffer getBuffer(int size, boolean playable) + private final NodeBuffer getBuffer(int size) { NodeBuffer current = null; for (BufferHolder holder : _buffers) diff --git a/L2J_Mobius_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Character.java index 1ea1c674fb..c8a5fc0808 100644 --- a/L2J_Mobius_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -3521,15 +3521,17 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe distance = Math.hypot(dx, dy); } + // @formatter:off // Define movement angles needed // ^ - // | X (x,y) - // | / - // | /distance + // | X (x,y) + // | / + // | / distance // | / // |/ angle // X ----------> // (curx,cury) + // @formatter:on double cos; double sin; @@ -3643,13 +3645,13 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe dz = z - curZ; distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy); } - // Pathfinding checks. Only when geodata setting is 2, the LoS check gives shorter result than the original movement was and the LoS gives a shorter distance than 2000 + // Pathfinding checks. Only when geodata setting is 2, the LoS check gives shorter result // This way of detecting need for pathfinding could be changed. if (Config.PATHFINDING && ((originalDistance - distance) > 30) && !isControlBlocked() && !isInVehicle) { // Path calculation -- overrides previous movement check - m.geoPath = GeoEngine.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld(), isPlayable()); - if ((m.geoPath == null) || (m.geoPath.size() < 2)) + m.geoPath = GeoEngine.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld()); + if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found { // No path found // Even though there's no path found (remember geonodes aren't perfect), the mob is attacking and right now we set it so that the mob will go after target anyway, is dz is small enough. @@ -3735,9 +3737,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe { ThreadPoolManager.schedule(new NotifyAITask(this, CtrlEvent.EVT_ARRIVED_REVALIDATE), 2000); } - - // the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive - // to destination by GameTimeController + // the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive to destination by GameTimeController } public boolean moveToNextRoutePoint() diff --git a/L2J_Mobius_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java b/L2J_Mobius_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java index 9cb85c282f..4cd64d35e4 100644 --- a/L2J_Mobius_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java +++ b/L2J_Mobius_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java @@ -38,7 +38,7 @@ public class AdminPathNode implements IAdminCommandHandler { if (activeChar.getTarget() != null) { - List path = GeoEngine.getInstance().findPath(activeChar.getX(), activeChar.getY(), (short) activeChar.getZ(), activeChar.getTarget().getX(), activeChar.getTarget().getY(), (short) activeChar.getTarget().getZ(), activeChar.getInstanceWorld(), true); + final List path = GeoEngine.getInstance().findPath(activeChar.getX(), activeChar.getY(), (short) activeChar.getZ(), activeChar.getTarget().getX(), activeChar.getTarget().getY(), (short) activeChar.getTarget().getZ(), activeChar.getInstanceWorld()); if (path == null) { activeChar.sendMessage("No route found or pathfinding disabled."); diff --git a/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/geoengine/GeoEngine.java b/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/geoengine/GeoEngine.java index bb9058636a..ab77a6a3ab 100644 --- a/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/geoengine/GeoEngine.java +++ b/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/geoengine/GeoEngine.java @@ -1288,10 +1288,9 @@ public class GeoEngine * @param ty : target y * @param tz : target z * @param instance - * @param playable : moving object is playable? * @return {@code List} : complete path from nodes */ - public List findPath(int ox, int oy, int oz, int tx, int ty, int tz, Instance instance, boolean playable) + public List findPath(int ox, int oy, int oz, int tx, int ty, int tz, Instance instance) { return null; } diff --git a/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/geoengine/GeoEnginePathfinding.java b/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/geoengine/GeoEnginePathfinding.java index 5447dcc767..25738c7f98 100644 --- a/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/geoengine/GeoEnginePathfinding.java +++ b/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/geoengine/GeoEnginePathfinding.java @@ -65,7 +65,7 @@ final class GeoEnginePathfinding extends GeoEngine } @Override - public List findPath(int ox, int oy, int oz, int tx, int ty, int tz, Instance instance, boolean playable) + public List findPath(int ox, int oy, int oz, int tx, int ty, int tz, Instance instance) { // get origin and check existing geo coords int gox = getGeoX(ox); @@ -88,7 +88,7 @@ final class GeoEnginePathfinding extends GeoEngine short gtz = getHeightNearest(gtx, gty, tz); // Prepare buffer for pathfinding calculations - NodeBuffer buffer = getBuffer(64 + (2 * Math.max(Math.abs(gox - gtx), Math.abs(goy - gty))), playable); + final NodeBuffer buffer = getBuffer(64 + (2 * Math.max(Math.abs(gox - gtx), Math.abs(goy - gty)))); if (buffer == null) { return null; @@ -213,10 +213,9 @@ final class GeoEnginePathfinding extends GeoEngine /** * Provides optimize selection of the buffer. When all pre-initialized buffer are locked, creates new buffer. * @param size : pre-calculated minimal required size - * @param playable : moving object is playable? * @return NodeBuffer : buffer */ - private final NodeBuffer getBuffer(int size, boolean playable) + private final NodeBuffer getBuffer(int size) { NodeBuffer current = null; for (BufferHolder holder : _buffers) diff --git a/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/model/actor/L2Character.java index 1ea1c674fb..c8a5fc0808 100644 --- a/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -3521,15 +3521,17 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe distance = Math.hypot(dx, dy); } + // @formatter:off // Define movement angles needed // ^ - // | X (x,y) - // | / - // | /distance + // | X (x,y) + // | / + // | / distance // | / // |/ angle // X ----------> // (curx,cury) + // @formatter:on double cos; double sin; @@ -3643,13 +3645,13 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe dz = z - curZ; distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy); } - // Pathfinding checks. Only when geodata setting is 2, the LoS check gives shorter result than the original movement was and the LoS gives a shorter distance than 2000 + // Pathfinding checks. Only when geodata setting is 2, the LoS check gives shorter result // This way of detecting need for pathfinding could be changed. if (Config.PATHFINDING && ((originalDistance - distance) > 30) && !isControlBlocked() && !isInVehicle) { // Path calculation -- overrides previous movement check - m.geoPath = GeoEngine.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld(), isPlayable()); - if ((m.geoPath == null) || (m.geoPath.size() < 2)) + m.geoPath = GeoEngine.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld()); + if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found { // No path found // Even though there's no path found (remember geonodes aren't perfect), the mob is attacking and right now we set it so that the mob will go after target anyway, is dz is small enough. @@ -3735,9 +3737,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe { ThreadPoolManager.schedule(new NotifyAITask(this, CtrlEvent.EVT_ARRIVED_REVALIDATE), 2000); } - - // the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive - // to destination by GameTimeController + // the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive to destination by GameTimeController } public boolean moveToNextRoutePoint() diff --git a/L2J_Mobius_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java b/L2J_Mobius_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java index 795e401159..e689c950bd 100644 --- a/L2J_Mobius_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java +++ b/L2J_Mobius_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java @@ -38,7 +38,7 @@ public class AdminPathNode implements IAdminCommandHandler { if (activeChar.getTarget() != null) { - List path = GeoEngine.getInstance().findPath(activeChar.getX(), activeChar.getY(), (short) activeChar.getZ(), activeChar.getTarget().getX(), activeChar.getTarget().getY(), (short) activeChar.getTarget().getZ(), activeChar.getInstanceId(), true); + List path = GeoEngine.getInstance().findPath(activeChar.getX(), activeChar.getY(), (short) activeChar.getZ(), activeChar.getTarget().getX(), activeChar.getTarget().getY(), (short) activeChar.getTarget().getZ(), activeChar.getInstanceId()); if (path == null) { activeChar.sendMessage("No route found or pathfinding disabled."); diff --git a/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/ai/L2SummonAI.java b/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/ai/L2SummonAI.java index 312f5ed33f..f1d3449ab0 100644 --- a/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/ai/L2SummonAI.java +++ b/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/ai/L2SummonAI.java @@ -50,7 +50,7 @@ public class L2SummonAI extends L2PlayableAI implements Runnable @Override protected void onIntentionAttack(L2Character target) { - if (Config.PATHFINDING && (GeoEngine.getInstance().findPath(_actor.getX(), _actor.getY(), _actor.getZ(), target.getX(), target.getY(), target.getZ(), _actor.getInstanceId(), true) == null)) + if (Config.PATHFINDING && (GeoEngine.getInstance().findPath(_actor.getX(), _actor.getY(), _actor.getZ(), target.getX(), target.getY(), target.getZ(), _actor.getInstanceId()) == null)) { return; } diff --git a/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/geoengine/GeoEngine.java b/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/geoengine/GeoEngine.java index cc98e5e6b9..b416b74a3d 100644 --- a/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/geoengine/GeoEngine.java +++ b/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/geoengine/GeoEngine.java @@ -1271,10 +1271,9 @@ public class GeoEngine * @param ty : target y * @param tz : target z * @param instanceId - * @param playable : moving object is playable? * @return {@code List} : complete path from nodes */ - public List findPath(int ox, int oy, int oz, int tx, int ty, int tz, int instanceId, boolean playable) + public List findPath(int ox, int oy, int oz, int tx, int ty, int tz, int instanceId) { return null; } diff --git a/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/geoengine/GeoEnginePathfinding.java b/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/geoengine/GeoEnginePathfinding.java index 14c00be2a4..5451be0a4f 100644 --- a/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/geoengine/GeoEnginePathfinding.java +++ b/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/geoengine/GeoEnginePathfinding.java @@ -64,7 +64,7 @@ final class GeoEnginePathfinding extends GeoEngine } @Override - public List findPath(int ox, int oy, int oz, int tx, int ty, int tz, int instance, boolean playable) + public List findPath(int ox, int oy, int oz, int tx, int ty, int tz, int instance) { // get origin and check existing geo coords int gox = getGeoX(ox); @@ -87,7 +87,7 @@ final class GeoEnginePathfinding extends GeoEngine short gtz = getHeightNearest(gtx, gty, tz); // Prepare buffer for pathfinding calculations - NodeBuffer buffer = getBuffer(64 + (2 * Math.max(Math.abs(gox - gtx), Math.abs(goy - gty))), playable); + final NodeBuffer buffer = getBuffer(64 + (2 * Math.max(Math.abs(gox - gtx), Math.abs(goy - gty)))); if (buffer == null) { return null; @@ -212,10 +212,9 @@ final class GeoEnginePathfinding extends GeoEngine /** * Provides optimize selection of the buffer. When all pre-initialized buffer are locked, creates new buffer. * @param size : pre-calculated minimal required size - * @param playable : moving object is playable? * @return NodeBuffer : buffer */ - private final NodeBuffer getBuffer(int size, boolean playable) + private final NodeBuffer getBuffer(int size) { NodeBuffer current = null; for (BufferHolder holder : _buffers) diff --git a/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Character.java index d66dd8ccad..6476b86ab7 100644 --- a/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -4274,6 +4274,13 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe */ public void moveToLocation(int x, int y, int z, int offset) { + // Do not move while character is attacking or casting. + // Fixes player attack glitch while target is moving. + if (isAttackingNow() || isCastingNow()) + { + return; + } + // Get the Move Speed of the L2Charcater final double speed = getMoveSpeed(); if ((speed <= 0) || isMovementDisabled()) @@ -4282,9 +4289,9 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe } // Get current position of the L2Character - final int curX = super.getX(); - final int curY = super.getY(); - final int curZ = super.getZ(); + final int curX = getX(); + final int curY = getY(); + final int curZ = getZ(); // Calculate distance (dx,dy) between current position and destination // TODO: improve Z axis move/follow support when dx,dy are small compared to dz @@ -4344,9 +4351,9 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe { // Notify the AI that the L2Character is arrived at destination getAI().notifyEvent(CtrlEvent.EVT_ARRIVED); - return; } + // Calculate movement angles needed sin = dy / distance; cos = dx / distance; @@ -4389,9 +4396,10 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe final int gty = (originalY - L2World.MAP_MIN_Y) >> 4; // Movement checks: - // When pathfinding enabled, for all characters except monsters returning home (could be changed later to teleport if pathfinding fails) + // when geodata == 2, for all characters except mobs returning home (could be changed later to teleport if pathfinding fails) + // when geodata == 1, for l2playableinstance + // assuming intention_follow only when following owner if ((Config.PATHFINDING && (!(isAttackable() && ((L2Attackable) this).isReturningToSpawnPoint()))) // - || (isPlayer() && !(isInVehicle && (distance > 1500))) // || (this instanceof L2RiftInvaderInstance)) { if (isOnGeodataPath()) @@ -4440,20 +4448,16 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy); } // Pathfinding checks. Only when geodata setting is 2, the LoS check gives shorter result - // than the original movement was and the LoS gives a shorter distance than 2000 // This way of detecting need for pathfinding could be changed. - if (Config.PATHFINDING && ((originalDistance - distance) > 30)) + if (Config.PATHFINDING && ((originalDistance - distance) > 30) && !isInVehicle) { - // Path calculation - // Overrides previous movement check - m.geoPath = GeoEngine.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceId(), isPlayable()); + // Path calculation -- overrides previous movement check + m.geoPath = GeoEngine.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceId()); if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found { - // Even though there's no path found (remember geonodes aren't perfect), - // the mob is attacking and right now we set it so that the mob will go - // after target anyway, is dz is small enough. - // With cellpathfinding this approach could be changed but would require taking - // off the geonodes and some more checks. + // No path found + // Even though there's no path found (remember geonodes aren't perfect), the mob is attacking and right now we set it so that the mob will go after target anyway, is dz is small enough. + // With cellpathfinding this approach could be changed but would require taking off the geonodes and some more checks. // Summons will follow their masters no matter what. // Currently minions also must move freely since L2AttackableAI commands them to move along with their leader if (isPlayer() || (!isPlayable() && !isMinion() && (Math.abs(z - curZ) > 140)) || (isSummon() && !((L2Summon) this).getFollowStatus())) diff --git a/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Summon.java b/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Summon.java index f84d6471ed..287d8e1f4e 100644 --- a/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Summon.java +++ b/L2J_Mobius_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Summon.java @@ -660,7 +660,7 @@ public abstract class L2Summon extends L2Playable return false; } - if ((this != target) && skill.isPhysical() && Config.PATHFINDING && (GeoEngine.getInstance().findPath(getX(), getY(), getZ(), target.getX(), target.getY(), target.getZ(), getInstanceId(), true) == null)) + if ((this != target) && skill.isPhysical() && Config.PATHFINDING && (GeoEngine.getInstance().findPath(getX(), getY(), getZ(), target.getX(), target.getY(), target.getZ(), getInstanceId()) == null)) { sendPacket(SystemMessageId.CANNOT_SEE_TARGET); return false; diff --git a/L2J_Mobius_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java b/L2J_Mobius_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java index 9cb85c282f..4cd64d35e4 100644 --- a/L2J_Mobius_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java +++ b/L2J_Mobius_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminPathNode.java @@ -38,7 +38,7 @@ public class AdminPathNode implements IAdminCommandHandler { if (activeChar.getTarget() != null) { - List path = GeoEngine.getInstance().findPath(activeChar.getX(), activeChar.getY(), (short) activeChar.getZ(), activeChar.getTarget().getX(), activeChar.getTarget().getY(), (short) activeChar.getTarget().getZ(), activeChar.getInstanceWorld(), true); + final List path = GeoEngine.getInstance().findPath(activeChar.getX(), activeChar.getY(), (short) activeChar.getZ(), activeChar.getTarget().getX(), activeChar.getTarget().getY(), (short) activeChar.getTarget().getZ(), activeChar.getInstanceWorld()); if (path == null) { activeChar.sendMessage("No route found or pathfinding disabled."); diff --git a/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/geoengine/GeoEngine.java b/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/geoengine/GeoEngine.java index bb9058636a..ab77a6a3ab 100644 --- a/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/geoengine/GeoEngine.java +++ b/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/geoengine/GeoEngine.java @@ -1288,10 +1288,9 @@ public class GeoEngine * @param ty : target y * @param tz : target z * @param instance - * @param playable : moving object is playable? * @return {@code List} : complete path from nodes */ - public List findPath(int ox, int oy, int oz, int tx, int ty, int tz, Instance instance, boolean playable) + public List findPath(int ox, int oy, int oz, int tx, int ty, int tz, Instance instance) { return null; } diff --git a/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/geoengine/GeoEnginePathfinding.java b/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/geoengine/GeoEnginePathfinding.java index 5447dcc767..25738c7f98 100644 --- a/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/geoengine/GeoEnginePathfinding.java +++ b/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/geoengine/GeoEnginePathfinding.java @@ -65,7 +65,7 @@ final class GeoEnginePathfinding extends GeoEngine } @Override - public List findPath(int ox, int oy, int oz, int tx, int ty, int tz, Instance instance, boolean playable) + public List findPath(int ox, int oy, int oz, int tx, int ty, int tz, Instance instance) { // get origin and check existing geo coords int gox = getGeoX(ox); @@ -88,7 +88,7 @@ final class GeoEnginePathfinding extends GeoEngine short gtz = getHeightNearest(gtx, gty, tz); // Prepare buffer for pathfinding calculations - NodeBuffer buffer = getBuffer(64 + (2 * Math.max(Math.abs(gox - gtx), Math.abs(goy - gty))), playable); + final NodeBuffer buffer = getBuffer(64 + (2 * Math.max(Math.abs(gox - gtx), Math.abs(goy - gty)))); if (buffer == null) { return null; @@ -213,10 +213,9 @@ final class GeoEnginePathfinding extends GeoEngine /** * Provides optimize selection of the buffer. When all pre-initialized buffer are locked, creates new buffer. * @param size : pre-calculated minimal required size - * @param playable : moving object is playable? * @return NodeBuffer : buffer */ - private final NodeBuffer getBuffer(int size, boolean playable) + private final NodeBuffer getBuffer(int size) { NodeBuffer current = null; for (BufferHolder holder : _buffers) diff --git a/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/model/actor/L2Character.java b/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/model/actor/L2Character.java index 1ea1c674fb..c8a5fc0808 100644 --- a/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/model/actor/L2Character.java +++ b/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/model/actor/L2Character.java @@ -3521,15 +3521,17 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe distance = Math.hypot(dx, dy); } + // @formatter:off // Define movement angles needed // ^ - // | X (x,y) - // | / - // | /distance + // | X (x,y) + // | / + // | / distance // | / // |/ angle // X ----------> // (curx,cury) + // @formatter:on double cos; double sin; @@ -3643,13 +3645,13 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe dz = z - curZ; distance = verticalMovementOnly ? Math.pow(dz, 2) : Math.hypot(dx, dy); } - // Pathfinding checks. Only when geodata setting is 2, the LoS check gives shorter result than the original movement was and the LoS gives a shorter distance than 2000 + // Pathfinding checks. Only when geodata setting is 2, the LoS check gives shorter result // This way of detecting need for pathfinding could be changed. if (Config.PATHFINDING && ((originalDistance - distance) > 30) && !isControlBlocked() && !isInVehicle) { // Path calculation -- overrides previous movement check - m.geoPath = GeoEngine.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld(), isPlayable()); - if ((m.geoPath == null) || (m.geoPath.size() < 2)) + m.geoPath = GeoEngine.getInstance().findPath(curX, curY, curZ, originalX, originalY, originalZ, getInstanceWorld()); + if ((m.geoPath == null) || (m.geoPath.size() < 2)) // No path found { // No path found // Even though there's no path found (remember geonodes aren't perfect), the mob is attacking and right now we set it so that the mob will go after target anyway, is dz is small enough. @@ -3735,9 +3737,7 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe { ThreadPoolManager.schedule(new NotifyAITask(this, CtrlEvent.EVT_ARRIVED_REVALIDATE), 2000); } - - // the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive - // to destination by GameTimeController + // the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive to destination by GameTimeController } public boolean moveToNextRoutePoint()