diff --git a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/ai/AbstractAI.java index b39d8371cf..d3a82b60cd 100644 --- a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -182,7 +182,7 @@ public abstract class AbstractAI implements Ctrl } case AI_INTENTION_CAST: { - onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, args.length > 3 && (boolean) args[3], args.length > 4 && (boolean) args[4]); + onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, (args.length > 3) && (boolean) args[3], (args.length > 4) && (boolean) args[4]); break; } case AI_INTENTION_MOVE_TO: @@ -470,7 +470,7 @@ public abstract class AbstractAI implements Ctrl } // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager - _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); + _actor.moveToLocation(pawn.getX(), pawn.getY(), pawn.getZ(), offset); // May result to make monsters stop moving. // if (!_actor.isMoving()) diff --git a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/ai/CreatureAI.java index dc71f92bf0..2f26519ea6 100644 --- a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -977,7 +977,7 @@ public class CreatureAI extends AbstractAI if (isFollowing()) { // allow larger hit range when the target is moving (check is run only once per second) - if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100)) + if (!_actor.isInsideRadius2D(target, offsetWithCollision + 30)) { return true; } diff --git a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Creature.java index bf417e78c9..02fc111e35 100644 --- a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2628,7 +2628,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // to recalculate position public int _moveStartTime; public int _moveTimestamp; // last update - public WorldObject _target; public int _xDestination; public int _yDestination; public int _zDestination; @@ -2858,12 +2857,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getX(); - } - return m._xDestination; } return getX(); @@ -2877,12 +2870,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getY(); - } - return m._yDestination; } return getY(); @@ -2896,12 +2883,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getZ(); - } - return m._zDestination; } return getZ(); @@ -3086,27 +3067,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return false; } - final WorldObject target = m._target; final int xPrev = getX(); final int yPrev = getY(); final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations - double dx; - double dy; - double dz; - // Save temporary values to avoid rounding errors. - if (target != null) - { - dx = target.getX() - m._xAccurate; - dy = target.getY() - m._yAccurate; - } - else - { - dx = m._xDestination - m._xAccurate; - dy = m._yDestination - m._yAccurate; - } - - // Z coordinate will follow client values - dz = m._zDestination - zPrev; + double dx = m._xDestination - m._xAccurate; + double dy = m._yDestination - m._yAccurate; + double dz = m._zDestination - zPrev; // Z coordinate will follow client values if (isPlayer() && !_isFlying) { final double distance = Math.hypot(dx, dy); @@ -3161,14 +3127,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (distFraction > 1) { // Set the position of the Creature to the destination - if (target != null) - { - super.setXYZ(target.getX(), target.getY(), target.getZ()); - } - else - { - super.setXYZ(m._xDestination, m._yDestination, m._zDestination); - } + super.setXYZ(m._xDestination, m._yDestination, m._zDestination); } else { @@ -3305,11 +3264,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // called from AIAccessor only - public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) - { - moveToLocation(null, xValue, yValue, zValue, offsetValue); - } - /** * Calculate movement data for a move to location action and add the Creature to movingObjects of GameTimeTaskManager (only called by AI Accessor).
*
@@ -3335,13 +3289,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe *
  • AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)
  • *
  • FollowTask
  • * - * @param target The target to follow, if any. * @param xValue The X position of the destination * @param yValue The Y position of the destination * @param zValue The Y position of the destination * @param offsetValue The size of the interaction area of the Creature targeted */ - public void moveToLocation(WorldObject target, int xValue, int yValue, int zValue, int offsetValue) + public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) { // Get the Move Speed of the Creature final double speed = _stat.getMoveSpeed(); @@ -3568,7 +3521,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // Calculate the number of ticks between the current position and the destination // One tick added for rounding reasons final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed); - m._target = target; m._xDestination = x; m._yDestination = y; m._zDestination = z; // this is what was requested from client diff --git a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java index e1182ad439..b71b6a7789 100644 --- a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java +++ b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.gameserver.ai.CreatureAI; -import org.l2jmobius.gameserver.ai.CtrlEvent; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; @@ -107,8 +106,7 @@ public class CreatureFollowTaskManager } final int followRange = range == -1 ? Rnd.get(50, 100) : range; - final int followRangeWithCollision = followRange + creature.getTemplate().getCollisionRadius() + ((Creature) followTarget).getTemplate().getCollisionRadius(); - if (!creature.isInsideRadius3D(followTarget, followRangeWithCollision)) + if (!creature.isInsideRadius3D(followTarget, followRange)) { if (!creature.isInsideRadius3D(followTarget, 3000)) { @@ -122,10 +120,6 @@ public class CreatureFollowTaskManager } ai.moveToPawn(followTarget, followRange); } - else - { - ai.notifyEvent(CtrlEvent.EVT_ARRIVED); - } } else { diff --git a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/ai/AbstractAI.java index b39d8371cf..d3a82b60cd 100644 --- a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -182,7 +182,7 @@ public abstract class AbstractAI implements Ctrl } case AI_INTENTION_CAST: { - onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, args.length > 3 && (boolean) args[3], args.length > 4 && (boolean) args[4]); + onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, (args.length > 3) && (boolean) args[3], (args.length > 4) && (boolean) args[4]); break; } case AI_INTENTION_MOVE_TO: @@ -470,7 +470,7 @@ public abstract class AbstractAI implements Ctrl } // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager - _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); + _actor.moveToLocation(pawn.getX(), pawn.getY(), pawn.getZ(), offset); // May result to make monsters stop moving. // if (!_actor.isMoving()) diff --git a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/ai/CreatureAI.java index dc71f92bf0..2f26519ea6 100644 --- a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -977,7 +977,7 @@ public class CreatureAI extends AbstractAI if (isFollowing()) { // allow larger hit range when the target is moving (check is run only once per second) - if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100)) + if (!_actor.isInsideRadius2D(target, offsetWithCollision + 30)) { return true; } diff --git a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/actor/Creature.java index bf417e78c9..02fc111e35 100644 --- a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2628,7 +2628,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // to recalculate position public int _moveStartTime; public int _moveTimestamp; // last update - public WorldObject _target; public int _xDestination; public int _yDestination; public int _zDestination; @@ -2858,12 +2857,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getX(); - } - return m._xDestination; } return getX(); @@ -2877,12 +2870,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getY(); - } - return m._yDestination; } return getY(); @@ -2896,12 +2883,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getZ(); - } - return m._zDestination; } return getZ(); @@ -3086,27 +3067,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return false; } - final WorldObject target = m._target; final int xPrev = getX(); final int yPrev = getY(); final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations - double dx; - double dy; - double dz; - // Save temporary values to avoid rounding errors. - if (target != null) - { - dx = target.getX() - m._xAccurate; - dy = target.getY() - m._yAccurate; - } - else - { - dx = m._xDestination - m._xAccurate; - dy = m._yDestination - m._yAccurate; - } - - // Z coordinate will follow client values - dz = m._zDestination - zPrev; + double dx = m._xDestination - m._xAccurate; + double dy = m._yDestination - m._yAccurate; + double dz = m._zDestination - zPrev; // Z coordinate will follow client values if (isPlayer() && !_isFlying) { final double distance = Math.hypot(dx, dy); @@ -3161,14 +3127,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (distFraction > 1) { // Set the position of the Creature to the destination - if (target != null) - { - super.setXYZ(target.getX(), target.getY(), target.getZ()); - } - else - { - super.setXYZ(m._xDestination, m._yDestination, m._zDestination); - } + super.setXYZ(m._xDestination, m._yDestination, m._zDestination); } else { @@ -3305,11 +3264,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // called from AIAccessor only - public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) - { - moveToLocation(null, xValue, yValue, zValue, offsetValue); - } - /** * Calculate movement data for a move to location action and add the Creature to movingObjects of GameTimeTaskManager (only called by AI Accessor).
    *
    @@ -3335,13 +3289,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe *
  • AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)
  • *
  • FollowTask
  • * - * @param target The target to follow, if any. * @param xValue The X position of the destination * @param yValue The Y position of the destination * @param zValue The Y position of the destination * @param offsetValue The size of the interaction area of the Creature targeted */ - public void moveToLocation(WorldObject target, int xValue, int yValue, int zValue, int offsetValue) + public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) { // Get the Move Speed of the Creature final double speed = _stat.getMoveSpeed(); @@ -3568,7 +3521,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // Calculate the number of ticks between the current position and the destination // One tick added for rounding reasons final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed); - m._target = target; m._xDestination = x; m._yDestination = y; m._zDestination = z; // this is what was requested from client diff --git a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java index e1182ad439..b71b6a7789 100644 --- a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java +++ b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.gameserver.ai.CreatureAI; -import org.l2jmobius.gameserver.ai.CtrlEvent; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; @@ -107,8 +106,7 @@ public class CreatureFollowTaskManager } final int followRange = range == -1 ? Rnd.get(50, 100) : range; - final int followRangeWithCollision = followRange + creature.getTemplate().getCollisionRadius() + ((Creature) followTarget).getTemplate().getCollisionRadius(); - if (!creature.isInsideRadius3D(followTarget, followRangeWithCollision)) + if (!creature.isInsideRadius3D(followTarget, followRange)) { if (!creature.isInsideRadius3D(followTarget, 3000)) { @@ -122,10 +120,6 @@ public class CreatureFollowTaskManager } ai.moveToPawn(followTarget, followRange); } - else - { - ai.notifyEvent(CtrlEvent.EVT_ARRIVED); - } } else { diff --git a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/ai/AbstractAI.java index b39d8371cf..d3a82b60cd 100644 --- a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -182,7 +182,7 @@ public abstract class AbstractAI implements Ctrl } case AI_INTENTION_CAST: { - onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, args.length > 3 && (boolean) args[3], args.length > 4 && (boolean) args[4]); + onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, (args.length > 3) && (boolean) args[3], (args.length > 4) && (boolean) args[4]); break; } case AI_INTENTION_MOVE_TO: @@ -470,7 +470,7 @@ public abstract class AbstractAI implements Ctrl } // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager - _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); + _actor.moveToLocation(pawn.getX(), pawn.getY(), pawn.getZ(), offset); // May result to make monsters stop moving. // if (!_actor.isMoving()) diff --git a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/ai/CreatureAI.java index dc71f92bf0..2f26519ea6 100644 --- a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -977,7 +977,7 @@ public class CreatureAI extends AbstractAI if (isFollowing()) { // allow larger hit range when the target is moving (check is run only once per second) - if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100)) + if (!_actor.isInsideRadius2D(target, offsetWithCollision + 30)) { return true; } diff --git a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/actor/Creature.java index 9684a98168..8ff59ca614 100644 --- a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2628,7 +2628,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // to recalculate position public int _moveStartTime; public int _moveTimestamp; // last update - public WorldObject _target; public int _xDestination; public int _yDestination; public int _zDestination; @@ -2858,12 +2857,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getX(); - } - return m._xDestination; } return getX(); @@ -2877,12 +2870,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getY(); - } - return m._yDestination; } return getY(); @@ -2896,12 +2883,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getZ(); - } - return m._zDestination; } return getZ(); @@ -3086,27 +3067,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return false; } - final WorldObject target = m._target; final int xPrev = getX(); final int yPrev = getY(); final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations - double dx; - double dy; - double dz; - // Save temporary values to avoid rounding errors. - if (target != null) - { - dx = target.getX() - m._xAccurate; - dy = target.getY() - m._yAccurate; - } - else - { - dx = m._xDestination - m._xAccurate; - dy = m._yDestination - m._yAccurate; - } - - // Z coordinate will follow client values - dz = m._zDestination - zPrev; + double dx = m._xDestination - m._xAccurate; + double dy = m._yDestination - m._yAccurate; + double dz = m._zDestination - zPrev; // Z coordinate will follow client values if (isPlayer() && !_isFlying) { final double distance = Math.hypot(dx, dy); @@ -3161,14 +3127,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (distFraction > 1) { // Set the position of the Creature to the destination - if (target != null) - { - super.setXYZ(target.getX(), target.getY(), target.getZ()); - } - else - { - super.setXYZ(m._xDestination, m._yDestination, m._zDestination); - } + super.setXYZ(m._xDestination, m._yDestination, m._zDestination); } else { @@ -3305,11 +3264,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // called from AIAccessor only - public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) - { - moveToLocation(null, xValue, yValue, zValue, offsetValue); - } - /** * Calculate movement data for a move to location action and add the Creature to movingObjects of GameTimeTaskManager (only called by AI Accessor).
    *
    @@ -3335,13 +3289,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe *
  • AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)
  • *
  • FollowTask
  • * - * @param target The target to follow, if any. * @param xValue The X position of the destination * @param yValue The Y position of the destination * @param zValue The Y position of the destination * @param offsetValue The size of the interaction area of the Creature targeted */ - public void moveToLocation(WorldObject target, int xValue, int yValue, int zValue, int offsetValue) + public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) { // Get the Move Speed of the Creature final double speed = _stat.getMoveSpeed(); @@ -3568,7 +3521,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // Calculate the number of ticks between the current position and the destination // One tick added for rounding reasons final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed); - m._target = target; m._xDestination = x; m._yDestination = y; m._zDestination = z; // this is what was requested from client diff --git a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java index e1182ad439..b71b6a7789 100644 --- a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java +++ b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.gameserver.ai.CreatureAI; -import org.l2jmobius.gameserver.ai.CtrlEvent; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; @@ -107,8 +106,7 @@ public class CreatureFollowTaskManager } final int followRange = range == -1 ? Rnd.get(50, 100) : range; - final int followRangeWithCollision = followRange + creature.getTemplate().getCollisionRadius() + ((Creature) followTarget).getTemplate().getCollisionRadius(); - if (!creature.isInsideRadius3D(followTarget, followRangeWithCollision)) + if (!creature.isInsideRadius3D(followTarget, followRange)) { if (!creature.isInsideRadius3D(followTarget, 3000)) { @@ -122,10 +120,6 @@ public class CreatureFollowTaskManager } ai.moveToPawn(followTarget, followRange); } - else - { - ai.notifyEvent(CtrlEvent.EVT_ARRIVED); - } } else { diff --git a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/ai/AbstractAI.java index b39d8371cf..d3a82b60cd 100644 --- a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -182,7 +182,7 @@ public abstract class AbstractAI implements Ctrl } case AI_INTENTION_CAST: { - onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, args.length > 3 && (boolean) args[3], args.length > 4 && (boolean) args[4]); + onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, (args.length > 3) && (boolean) args[3], (args.length > 4) && (boolean) args[4]); break; } case AI_INTENTION_MOVE_TO: @@ -470,7 +470,7 @@ public abstract class AbstractAI implements Ctrl } // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager - _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); + _actor.moveToLocation(pawn.getX(), pawn.getY(), pawn.getZ(), offset); // May result to make monsters stop moving. // if (!_actor.isMoving()) diff --git a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/ai/CreatureAI.java index dc71f92bf0..2f26519ea6 100644 --- a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -977,7 +977,7 @@ public class CreatureAI extends AbstractAI if (isFollowing()) { // allow larger hit range when the target is moving (check is run only once per second) - if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100)) + if (!_actor.isInsideRadius2D(target, offsetWithCollision + 30)) { return true; } diff --git a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Creature.java index 9684a98168..8ff59ca614 100644 --- a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2628,7 +2628,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // to recalculate position public int _moveStartTime; public int _moveTimestamp; // last update - public WorldObject _target; public int _xDestination; public int _yDestination; public int _zDestination; @@ -2858,12 +2857,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getX(); - } - return m._xDestination; } return getX(); @@ -2877,12 +2870,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getY(); - } - return m._yDestination; } return getY(); @@ -2896,12 +2883,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getZ(); - } - return m._zDestination; } return getZ(); @@ -3086,27 +3067,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return false; } - final WorldObject target = m._target; final int xPrev = getX(); final int yPrev = getY(); final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations - double dx; - double dy; - double dz; - // Save temporary values to avoid rounding errors. - if (target != null) - { - dx = target.getX() - m._xAccurate; - dy = target.getY() - m._yAccurate; - } - else - { - dx = m._xDestination - m._xAccurate; - dy = m._yDestination - m._yAccurate; - } - - // Z coordinate will follow client values - dz = m._zDestination - zPrev; + double dx = m._xDestination - m._xAccurate; + double dy = m._yDestination - m._yAccurate; + double dz = m._zDestination - zPrev; // Z coordinate will follow client values if (isPlayer() && !_isFlying) { final double distance = Math.hypot(dx, dy); @@ -3161,14 +3127,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (distFraction > 1) { // Set the position of the Creature to the destination - if (target != null) - { - super.setXYZ(target.getX(), target.getY(), target.getZ()); - } - else - { - super.setXYZ(m._xDestination, m._yDestination, m._zDestination); - } + super.setXYZ(m._xDestination, m._yDestination, m._zDestination); } else { @@ -3305,11 +3264,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // called from AIAccessor only - public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) - { - moveToLocation(null, xValue, yValue, zValue, offsetValue); - } - /** * Calculate movement data for a move to location action and add the Creature to movingObjects of GameTimeTaskManager (only called by AI Accessor).
    *
    @@ -3335,13 +3289,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe *
  • AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)
  • *
  • FollowTask
  • * - * @param target The target to follow, if any. * @param xValue The X position of the destination * @param yValue The Y position of the destination * @param zValue The Y position of the destination * @param offsetValue The size of the interaction area of the Creature targeted */ - public void moveToLocation(WorldObject target, int xValue, int yValue, int zValue, int offsetValue) + public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) { // Get the Move Speed of the Creature final double speed = _stat.getMoveSpeed(); @@ -3568,7 +3521,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // Calculate the number of ticks between the current position and the destination // One tick added for rounding reasons final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed); - m._target = target; m._xDestination = x; m._yDestination = y; m._zDestination = z; // this is what was requested from client diff --git a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java index e1182ad439..b71b6a7789 100644 --- a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java +++ b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.gameserver.ai.CreatureAI; -import org.l2jmobius.gameserver.ai.CtrlEvent; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; @@ -107,8 +106,7 @@ public class CreatureFollowTaskManager } final int followRange = range == -1 ? Rnd.get(50, 100) : range; - final int followRangeWithCollision = followRange + creature.getTemplate().getCollisionRadius() + ((Creature) followTarget).getTemplate().getCollisionRadius(); - if (!creature.isInsideRadius3D(followTarget, followRangeWithCollision)) + if (!creature.isInsideRadius3D(followTarget, followRange)) { if (!creature.isInsideRadius3D(followTarget, 3000)) { @@ -122,10 +120,6 @@ public class CreatureFollowTaskManager } ai.moveToPawn(followTarget, followRange); } - else - { - ai.notifyEvent(CtrlEvent.EVT_ARRIVED); - } } else { diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/ai/AbstractAI.java index b39d8371cf..d3a82b60cd 100644 --- a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -182,7 +182,7 @@ public abstract class AbstractAI implements Ctrl } case AI_INTENTION_CAST: { - onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, args.length > 3 && (boolean) args[3], args.length > 4 && (boolean) args[4]); + onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, (args.length > 3) && (boolean) args[3], (args.length > 4) && (boolean) args[4]); break; } case AI_INTENTION_MOVE_TO: @@ -470,7 +470,7 @@ public abstract class AbstractAI implements Ctrl } // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager - _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); + _actor.moveToLocation(pawn.getX(), pawn.getY(), pawn.getZ(), offset); // May result to make monsters stop moving. // if (!_actor.isMoving()) diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/ai/CreatureAI.java index dc71f92bf0..2f26519ea6 100644 --- a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -977,7 +977,7 @@ public class CreatureAI extends AbstractAI if (isFollowing()) { // allow larger hit range when the target is moving (check is run only once per second) - if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100)) + if (!_actor.isInsideRadius2D(target, offsetWithCollision + 30)) { return true; } diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Creature.java index 14b715725d..66a3aaa0a1 100644 --- a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2628,7 +2628,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // to recalculate position public int _moveStartTime; public int _moveTimestamp; // last update - public WorldObject _target; public int _xDestination; public int _yDestination; public int _zDestination; @@ -2858,12 +2857,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getX(); - } - return m._xDestination; } return getX(); @@ -2877,12 +2870,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getY(); - } - return m._yDestination; } return getY(); @@ -2896,12 +2883,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getZ(); - } - return m._zDestination; } return getZ(); @@ -3086,27 +3067,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return false; } - final WorldObject target = m._target; final int xPrev = getX(); final int yPrev = getY(); final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations - double dx; - double dy; - double dz; - // Save temporary values to avoid rounding errors. - if (target != null) - { - dx = target.getX() - m._xAccurate; - dy = target.getY() - m._yAccurate; - } - else - { - dx = m._xDestination - m._xAccurate; - dy = m._yDestination - m._yAccurate; - } - - // Z coordinate will follow client values - dz = m._zDestination - zPrev; + double dx = m._xDestination - m._xAccurate; + double dy = m._yDestination - m._yAccurate; + double dz = m._zDestination - zPrev; // Z coordinate will follow client values if (isPlayer() && !_isFlying) { final double distance = Math.hypot(dx, dy); @@ -3161,14 +3127,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (distFraction > 1) { // Set the position of the Creature to the destination - if (target != null) - { - super.setXYZ(target.getX(), target.getY(), target.getZ()); - } - else - { - super.setXYZ(m._xDestination, m._yDestination, m._zDestination); - } + super.setXYZ(m._xDestination, m._yDestination, m._zDestination); } else { @@ -3305,11 +3264,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // called from AIAccessor only - public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) - { - moveToLocation(null, xValue, yValue, zValue, offsetValue); - } - /** * Calculate movement data for a move to location action and add the Creature to movingObjects of GameTimeTaskManager (only called by AI Accessor).
    *
    @@ -3335,13 +3289,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe *
  • AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)
  • *
  • FollowTask
  • * - * @param target The target to follow, if any. * @param xValue The X position of the destination * @param yValue The Y position of the destination * @param zValue The Y position of the destination * @param offsetValue The size of the interaction area of the Creature targeted */ - public void moveToLocation(WorldObject target, int xValue, int yValue, int zValue, int offsetValue) + public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) { // Get the Move Speed of the Creature final double speed = _stat.getMoveSpeed(); @@ -3568,7 +3521,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // Calculate the number of ticks between the current position and the destination // One tick added for rounding reasons final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed); - m._target = target; m._xDestination = x; m._yDestination = y; m._zDestination = z; // this is what was requested from client diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java index e1182ad439..b71b6a7789 100644 --- a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java +++ b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.gameserver.ai.CreatureAI; -import org.l2jmobius.gameserver.ai.CtrlEvent; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; @@ -107,8 +106,7 @@ public class CreatureFollowTaskManager } final int followRange = range == -1 ? Rnd.get(50, 100) : range; - final int followRangeWithCollision = followRange + creature.getTemplate().getCollisionRadius() + ((Creature) followTarget).getTemplate().getCollisionRadius(); - if (!creature.isInsideRadius3D(followTarget, followRangeWithCollision)) + if (!creature.isInsideRadius3D(followTarget, followRange)) { if (!creature.isInsideRadius3D(followTarget, 3000)) { @@ -122,10 +120,6 @@ public class CreatureFollowTaskManager } ai.moveToPawn(followTarget, followRange); } - else - { - ai.notifyEvent(CtrlEvent.EVT_ARRIVED); - } } else { diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/ai/AbstractAI.java index b39d8371cf..d3a82b60cd 100644 --- a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -182,7 +182,7 @@ public abstract class AbstractAI implements Ctrl } case AI_INTENTION_CAST: { - onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, args.length > 3 && (boolean) args[3], args.length > 4 && (boolean) args[4]); + onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, (args.length > 3) && (boolean) args[3], (args.length > 4) && (boolean) args[4]); break; } case AI_INTENTION_MOVE_TO: @@ -470,7 +470,7 @@ public abstract class AbstractAI implements Ctrl } // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager - _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); + _actor.moveToLocation(pawn.getX(), pawn.getY(), pawn.getZ(), offset); // May result to make monsters stop moving. // if (!_actor.isMoving()) diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/ai/CreatureAI.java index dc71f92bf0..2f26519ea6 100644 --- a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -977,7 +977,7 @@ public class CreatureAI extends AbstractAI if (isFollowing()) { // allow larger hit range when the target is moving (check is run only once per second) - if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100)) + if (!_actor.isInsideRadius2D(target, offsetWithCollision + 30)) { return true; } diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Creature.java index 14b715725d..66a3aaa0a1 100644 --- a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2628,7 +2628,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // to recalculate position public int _moveStartTime; public int _moveTimestamp; // last update - public WorldObject _target; public int _xDestination; public int _yDestination; public int _zDestination; @@ -2858,12 +2857,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getX(); - } - return m._xDestination; } return getX(); @@ -2877,12 +2870,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getY(); - } - return m._yDestination; } return getY(); @@ -2896,12 +2883,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getZ(); - } - return m._zDestination; } return getZ(); @@ -3086,27 +3067,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return false; } - final WorldObject target = m._target; final int xPrev = getX(); final int yPrev = getY(); final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations - double dx; - double dy; - double dz; - // Save temporary values to avoid rounding errors. - if (target != null) - { - dx = target.getX() - m._xAccurate; - dy = target.getY() - m._yAccurate; - } - else - { - dx = m._xDestination - m._xAccurate; - dy = m._yDestination - m._yAccurate; - } - - // Z coordinate will follow client values - dz = m._zDestination - zPrev; + double dx = m._xDestination - m._xAccurate; + double dy = m._yDestination - m._yAccurate; + double dz = m._zDestination - zPrev; // Z coordinate will follow client values if (isPlayer() && !_isFlying) { final double distance = Math.hypot(dx, dy); @@ -3161,14 +3127,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (distFraction > 1) { // Set the position of the Creature to the destination - if (target != null) - { - super.setXYZ(target.getX(), target.getY(), target.getZ()); - } - else - { - super.setXYZ(m._xDestination, m._yDestination, m._zDestination); - } + super.setXYZ(m._xDestination, m._yDestination, m._zDestination); } else { @@ -3305,11 +3264,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // called from AIAccessor only - public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) - { - moveToLocation(null, xValue, yValue, zValue, offsetValue); - } - /** * Calculate movement data for a move to location action and add the Creature to movingObjects of GameTimeTaskManager (only called by AI Accessor).
    *
    @@ -3335,13 +3289,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe *
  • AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)
  • *
  • FollowTask
  • * - * @param target The target to follow, if any. * @param xValue The X position of the destination * @param yValue The Y position of the destination * @param zValue The Y position of the destination * @param offsetValue The size of the interaction area of the Creature targeted */ - public void moveToLocation(WorldObject target, int xValue, int yValue, int zValue, int offsetValue) + public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) { // Get the Move Speed of the Creature final double speed = _stat.getMoveSpeed(); @@ -3568,7 +3521,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // Calculate the number of ticks between the current position and the destination // One tick added for rounding reasons final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed); - m._target = target; m._xDestination = x; m._yDestination = y; m._zDestination = z; // this is what was requested from client diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java index e1182ad439..b71b6a7789 100644 --- a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java +++ b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.gameserver.ai.CreatureAI; -import org.l2jmobius.gameserver.ai.CtrlEvent; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; @@ -107,8 +106,7 @@ public class CreatureFollowTaskManager } final int followRange = range == -1 ? Rnd.get(50, 100) : range; - final int followRangeWithCollision = followRange + creature.getTemplate().getCollisionRadius() + ((Creature) followTarget).getTemplate().getCollisionRadius(); - if (!creature.isInsideRadius3D(followTarget, followRangeWithCollision)) + if (!creature.isInsideRadius3D(followTarget, followRange)) { if (!creature.isInsideRadius3D(followTarget, 3000)) { @@ -122,10 +120,6 @@ public class CreatureFollowTaskManager } ai.moveToPawn(followTarget, followRange); } - else - { - ai.notifyEvent(CtrlEvent.EVT_ARRIVED); - } } else { diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/ai/AbstractAI.java index b39d8371cf..d3a82b60cd 100644 --- a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -182,7 +182,7 @@ public abstract class AbstractAI implements Ctrl } case AI_INTENTION_CAST: { - onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, args.length > 3 && (boolean) args[3], args.length > 4 && (boolean) args[4]); + onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, (args.length > 3) && (boolean) args[3], (args.length > 4) && (boolean) args[4]); break; } case AI_INTENTION_MOVE_TO: @@ -470,7 +470,7 @@ public abstract class AbstractAI implements Ctrl } // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager - _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); + _actor.moveToLocation(pawn.getX(), pawn.getY(), pawn.getZ(), offset); // May result to make monsters stop moving. // if (!_actor.isMoving()) diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/ai/CreatureAI.java index dc71f92bf0..2f26519ea6 100644 --- a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -977,7 +977,7 @@ public class CreatureAI extends AbstractAI if (isFollowing()) { // allow larger hit range when the target is moving (check is run only once per second) - if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100)) + if (!_actor.isInsideRadius2D(target, offsetWithCollision + 30)) { return true; } diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Creature.java index 14b715725d..66a3aaa0a1 100644 --- a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2628,7 +2628,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // to recalculate position public int _moveStartTime; public int _moveTimestamp; // last update - public WorldObject _target; public int _xDestination; public int _yDestination; public int _zDestination; @@ -2858,12 +2857,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getX(); - } - return m._xDestination; } return getX(); @@ -2877,12 +2870,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getY(); - } - return m._yDestination; } return getY(); @@ -2896,12 +2883,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getZ(); - } - return m._zDestination; } return getZ(); @@ -3086,27 +3067,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return false; } - final WorldObject target = m._target; final int xPrev = getX(); final int yPrev = getY(); final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations - double dx; - double dy; - double dz; - // Save temporary values to avoid rounding errors. - if (target != null) - { - dx = target.getX() - m._xAccurate; - dy = target.getY() - m._yAccurate; - } - else - { - dx = m._xDestination - m._xAccurate; - dy = m._yDestination - m._yAccurate; - } - - // Z coordinate will follow client values - dz = m._zDestination - zPrev; + double dx = m._xDestination - m._xAccurate; + double dy = m._yDestination - m._yAccurate; + double dz = m._zDestination - zPrev; // Z coordinate will follow client values if (isPlayer() && !_isFlying) { final double distance = Math.hypot(dx, dy); @@ -3161,14 +3127,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (distFraction > 1) { // Set the position of the Creature to the destination - if (target != null) - { - super.setXYZ(target.getX(), target.getY(), target.getZ()); - } - else - { - super.setXYZ(m._xDestination, m._yDestination, m._zDestination); - } + super.setXYZ(m._xDestination, m._yDestination, m._zDestination); } else { @@ -3305,11 +3264,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // called from AIAccessor only - public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) - { - moveToLocation(null, xValue, yValue, zValue, offsetValue); - } - /** * Calculate movement data for a move to location action and add the Creature to movingObjects of GameTimeTaskManager (only called by AI Accessor).
    *
    @@ -3335,13 +3289,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe *
  • AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)
  • *
  • FollowTask
  • * - * @param target The target to follow, if any. * @param xValue The X position of the destination * @param yValue The Y position of the destination * @param zValue The Y position of the destination * @param offsetValue The size of the interaction area of the Creature targeted */ - public void moveToLocation(WorldObject target, int xValue, int yValue, int zValue, int offsetValue) + public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) { // Get the Move Speed of the Creature final double speed = _stat.getMoveSpeed(); @@ -3568,7 +3521,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // Calculate the number of ticks between the current position and the destination // One tick added for rounding reasons final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed); - m._target = target; m._xDestination = x; m._yDestination = y; m._zDestination = z; // this is what was requested from client diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java index e1182ad439..b71b6a7789 100644 --- a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java +++ b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.gameserver.ai.CreatureAI; -import org.l2jmobius.gameserver.ai.CtrlEvent; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; @@ -107,8 +106,7 @@ public class CreatureFollowTaskManager } final int followRange = range == -1 ? Rnd.get(50, 100) : range; - final int followRangeWithCollision = followRange + creature.getTemplate().getCollisionRadius() + ((Creature) followTarget).getTemplate().getCollisionRadius(); - if (!creature.isInsideRadius3D(followTarget, followRangeWithCollision)) + if (!creature.isInsideRadius3D(followTarget, followRange)) { if (!creature.isInsideRadius3D(followTarget, 3000)) { @@ -122,10 +120,6 @@ public class CreatureFollowTaskManager } ai.moveToPawn(followTarget, followRange); } - else - { - ai.notifyEvent(CtrlEvent.EVT_ARRIVED); - } } else { diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/ai/AbstractAI.java index b39d8371cf..d3a82b60cd 100644 --- a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -182,7 +182,7 @@ public abstract class AbstractAI implements Ctrl } case AI_INTENTION_CAST: { - onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, args.length > 3 && (boolean) args[3], args.length > 4 && (boolean) args[4]); + onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, (args.length > 3) && (boolean) args[3], (args.length > 4) && (boolean) args[4]); break; } case AI_INTENTION_MOVE_TO: @@ -470,7 +470,7 @@ public abstract class AbstractAI implements Ctrl } // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager - _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); + _actor.moveToLocation(pawn.getX(), pawn.getY(), pawn.getZ(), offset); // May result to make monsters stop moving. // if (!_actor.isMoving()) diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/ai/CreatureAI.java index dc71f92bf0..2f26519ea6 100644 --- a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -977,7 +977,7 @@ public class CreatureAI extends AbstractAI if (isFollowing()) { // allow larger hit range when the target is moving (check is run only once per second) - if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100)) + if (!_actor.isInsideRadius2D(target, offsetWithCollision + 30)) { return true; } diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java index 8cb214715e..f0ca17dc58 100644 --- a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2628,7 +2628,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // to recalculate position public int _moveStartTime; public int _moveTimestamp; // last update - public WorldObject _target; public int _xDestination; public int _yDestination; public int _zDestination; @@ -2857,12 +2856,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getX(); - } - return m._xDestination; } return getX(); @@ -2876,12 +2869,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getY(); - } - return m._yDestination; } return getY(); @@ -2895,12 +2882,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getZ(); - } - return m._zDestination; } return getZ(); @@ -3085,27 +3066,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return false; } - final WorldObject target = m._target; final int xPrev = getX(); final int yPrev = getY(); final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations - double dx; - double dy; - double dz; - // Save temporary values to avoid rounding errors. - if (target != null) - { - dx = target.getX() - m._xAccurate; - dy = target.getY() - m._yAccurate; - } - else - { - dx = m._xDestination - m._xAccurate; - dy = m._yDestination - m._yAccurate; - } - - // Z coordinate will follow client values - dz = m._zDestination - zPrev; + double dx = m._xDestination - m._xAccurate; + double dy = m._yDestination - m._yAccurate; + double dz = m._zDestination - zPrev; // Z coordinate will follow client values if (isPlayer() && !_isFlying) { final double distance = Math.hypot(dx, dy); @@ -3160,14 +3126,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (distFraction > 1) { // Set the position of the Creature to the destination - if (target != null) - { - super.setXYZ(target.getX(), target.getY(), target.getZ()); - } - else - { - super.setXYZ(m._xDestination, m._yDestination, m._zDestination); - } + super.setXYZ(m._xDestination, m._yDestination, m._zDestination); } else { @@ -3304,11 +3263,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // called from AIAccessor only - public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) - { - moveToLocation(null, xValue, yValue, zValue, offsetValue); - } - /** * Calculate movement data for a move to location action and add the Creature to movingObjects of GameTimeTaskManager (only called by AI Accessor).
    *
    @@ -3334,13 +3288,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe *
  • AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)
  • *
  • FollowTask
  • * - * @param target The target to follow, if any. * @param xValue The X position of the destination * @param yValue The Y position of the destination * @param zValue The Y position of the destination * @param offsetValue The size of the interaction area of the Creature targeted */ - public void moveToLocation(WorldObject target, int xValue, int yValue, int zValue, int offsetValue) + public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) { // Get the Move Speed of the Creature final double speed = _stat.getMoveSpeed(); @@ -3567,7 +3520,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // Calculate the number of ticks between the current position and the destination // One tick added for rounding reasons final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed); - m._target = target; m._xDestination = x; m._yDestination = y; m._zDestination = z; // this is what was requested from client diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java index e1182ad439..b71b6a7789 100644 --- a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java +++ b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.gameserver.ai.CreatureAI; -import org.l2jmobius.gameserver.ai.CtrlEvent; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; @@ -107,8 +106,7 @@ public class CreatureFollowTaskManager } final int followRange = range == -1 ? Rnd.get(50, 100) : range; - final int followRangeWithCollision = followRange + creature.getTemplate().getCollisionRadius() + ((Creature) followTarget).getTemplate().getCollisionRadius(); - if (!creature.isInsideRadius3D(followTarget, followRangeWithCollision)) + if (!creature.isInsideRadius3D(followTarget, followRange)) { if (!creature.isInsideRadius3D(followTarget, 3000)) { @@ -122,10 +120,6 @@ public class CreatureFollowTaskManager } ai.moveToPawn(followTarget, followRange); } - else - { - ai.notifyEvent(CtrlEvent.EVT_ARRIVED); - } } else { diff --git a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/ai/AbstractAI.java index b39d8371cf..d3a82b60cd 100644 --- a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -182,7 +182,7 @@ public abstract class AbstractAI implements Ctrl } case AI_INTENTION_CAST: { - onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, args.length > 3 && (boolean) args[3], args.length > 4 && (boolean) args[4]); + onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, (args.length > 3) && (boolean) args[3], (args.length > 4) && (boolean) args[4]); break; } case AI_INTENTION_MOVE_TO: @@ -470,7 +470,7 @@ public abstract class AbstractAI implements Ctrl } // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager - _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); + _actor.moveToLocation(pawn.getX(), pawn.getY(), pawn.getZ(), offset); // May result to make monsters stop moving. // if (!_actor.isMoving()) diff --git a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/ai/CreatureAI.java index dc71f92bf0..2f26519ea6 100644 --- a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -977,7 +977,7 @@ public class CreatureAI extends AbstractAI if (isFollowing()) { // allow larger hit range when the target is moving (check is run only once per second) - if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100)) + if (!_actor.isInsideRadius2D(target, offsetWithCollision + 30)) { return true; } diff --git a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/actor/Creature.java index 5967c0b811..41e1ab4541 100644 --- a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2628,7 +2628,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // to recalculate position public int _moveStartTime; public int _moveTimestamp; // last update - public WorldObject _target; public int _xDestination; public int _yDestination; public int _zDestination; @@ -2857,12 +2856,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getX(); - } - return m._xDestination; } return getX(); @@ -2876,12 +2869,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getY(); - } - return m._yDestination; } return getY(); @@ -2895,12 +2882,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getZ(); - } - return m._zDestination; } return getZ(); @@ -3085,27 +3066,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return false; } - final WorldObject target = m._target; final int xPrev = getX(); final int yPrev = getY(); final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations - double dx; - double dy; - double dz; - // Save temporary values to avoid rounding errors. - if (target != null) - { - dx = target.getX() - m._xAccurate; - dy = target.getY() - m._yAccurate; - } - else - { - dx = m._xDestination - m._xAccurate; - dy = m._yDestination - m._yAccurate; - } - - // Z coordinate will follow client values - dz = m._zDestination - zPrev; + double dx = m._xDestination - m._xAccurate; + double dy = m._yDestination - m._yAccurate; + double dz = m._zDestination - zPrev; // Z coordinate will follow client values if (isPlayer() && !_isFlying) { final double distance = Math.hypot(dx, dy); @@ -3160,14 +3126,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (distFraction > 1) { // Set the position of the Creature to the destination - if (target != null) - { - super.setXYZ(target.getX(), target.getY(), target.getZ()); - } - else - { - super.setXYZ(m._xDestination, m._yDestination, m._zDestination); - } + super.setXYZ(m._xDestination, m._yDestination, m._zDestination); } else { @@ -3304,11 +3263,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // called from AIAccessor only - public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) - { - moveToLocation(null, xValue, yValue, zValue, offsetValue); - } - /** * Calculate movement data for a move to location action and add the Creature to movingObjects of GameTimeTaskManager (only called by AI Accessor).
    *
    @@ -3334,13 +3288,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe *
  • AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)
  • *
  • FollowTask
  • * - * @param target The target to follow, if any. * @param xValue The X position of the destination * @param yValue The Y position of the destination * @param zValue The Y position of the destination * @param offsetValue The size of the interaction area of the Creature targeted */ - public void moveToLocation(WorldObject target, int xValue, int yValue, int zValue, int offsetValue) + public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) { // Get the Move Speed of the Creature final double speed = _stat.getMoveSpeed(); @@ -3567,7 +3520,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // Calculate the number of ticks between the current position and the destination // One tick added for rounding reasons final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed); - m._target = target; m._xDestination = x; m._yDestination = y; m._zDestination = z; // this is what was requested from client diff --git a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java index e1182ad439..b71b6a7789 100644 --- a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java +++ b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.gameserver.ai.CreatureAI; -import org.l2jmobius.gameserver.ai.CtrlEvent; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; @@ -107,8 +106,7 @@ public class CreatureFollowTaskManager } final int followRange = range == -1 ? Rnd.get(50, 100) : range; - final int followRangeWithCollision = followRange + creature.getTemplate().getCollisionRadius() + ((Creature) followTarget).getTemplate().getCollisionRadius(); - if (!creature.isInsideRadius3D(followTarget, followRangeWithCollision)) + if (!creature.isInsideRadius3D(followTarget, followRange)) { if (!creature.isInsideRadius3D(followTarget, 3000)) { @@ -122,10 +120,6 @@ public class CreatureFollowTaskManager } ai.moveToPawn(followTarget, followRange); } - else - { - ai.notifyEvent(CtrlEvent.EVT_ARRIVED); - } } else { diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/ai/AbstractAI.java index b39d8371cf..d3a82b60cd 100644 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -182,7 +182,7 @@ public abstract class AbstractAI implements Ctrl } case AI_INTENTION_CAST: { - onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, args.length > 3 && (boolean) args[3], args.length > 4 && (boolean) args[4]); + onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, (args.length > 3) && (boolean) args[3], (args.length > 4) && (boolean) args[4]); break; } case AI_INTENTION_MOVE_TO: @@ -470,7 +470,7 @@ public abstract class AbstractAI implements Ctrl } // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager - _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); + _actor.moveToLocation(pawn.getX(), pawn.getY(), pawn.getZ(), offset); // May result to make monsters stop moving. // if (!_actor.isMoving()) diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/ai/CreatureAI.java index dc71f92bf0..2f26519ea6 100644 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -977,7 +977,7 @@ public class CreatureAI extends AbstractAI if (isFollowing()) { // allow larger hit range when the target is moving (check is run only once per second) - if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100)) + if (!_actor.isInsideRadius2D(target, offsetWithCollision + 30)) { return true; } diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/Creature.java index 5967c0b811..41e1ab4541 100644 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2628,7 +2628,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // to recalculate position public int _moveStartTime; public int _moveTimestamp; // last update - public WorldObject _target; public int _xDestination; public int _yDestination; public int _zDestination; @@ -2857,12 +2856,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getX(); - } - return m._xDestination; } return getX(); @@ -2876,12 +2869,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getY(); - } - return m._yDestination; } return getY(); @@ -2895,12 +2882,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getZ(); - } - return m._zDestination; } return getZ(); @@ -3085,27 +3066,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return false; } - final WorldObject target = m._target; final int xPrev = getX(); final int yPrev = getY(); final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations - double dx; - double dy; - double dz; - // Save temporary values to avoid rounding errors. - if (target != null) - { - dx = target.getX() - m._xAccurate; - dy = target.getY() - m._yAccurate; - } - else - { - dx = m._xDestination - m._xAccurate; - dy = m._yDestination - m._yAccurate; - } - - // Z coordinate will follow client values - dz = m._zDestination - zPrev; + double dx = m._xDestination - m._xAccurate; + double dy = m._yDestination - m._yAccurate; + double dz = m._zDestination - zPrev; // Z coordinate will follow client values if (isPlayer() && !_isFlying) { final double distance = Math.hypot(dx, dy); @@ -3160,14 +3126,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (distFraction > 1) { // Set the position of the Creature to the destination - if (target != null) - { - super.setXYZ(target.getX(), target.getY(), target.getZ()); - } - else - { - super.setXYZ(m._xDestination, m._yDestination, m._zDestination); - } + super.setXYZ(m._xDestination, m._yDestination, m._zDestination); } else { @@ -3304,11 +3263,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // called from AIAccessor only - public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) - { - moveToLocation(null, xValue, yValue, zValue, offsetValue); - } - /** * Calculate movement data for a move to location action and add the Creature to movingObjects of GameTimeTaskManager (only called by AI Accessor).
    *
    @@ -3334,13 +3288,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe *
  • AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)
  • *
  • FollowTask
  • * - * @param target The target to follow, if any. * @param xValue The X position of the destination * @param yValue The Y position of the destination * @param zValue The Y position of the destination * @param offsetValue The size of the interaction area of the Creature targeted */ - public void moveToLocation(WorldObject target, int xValue, int yValue, int zValue, int offsetValue) + public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) { // Get the Move Speed of the Creature final double speed = _stat.getMoveSpeed(); @@ -3567,7 +3520,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // Calculate the number of ticks between the current position and the destination // One tick added for rounding reasons final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed); - m._target = target; m._xDestination = x; m._yDestination = y; m._zDestination = z; // this is what was requested from client diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java index e1182ad439..b71b6a7789 100644 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.gameserver.ai.CreatureAI; -import org.l2jmobius.gameserver.ai.CtrlEvent; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; @@ -107,8 +106,7 @@ public class CreatureFollowTaskManager } final int followRange = range == -1 ? Rnd.get(50, 100) : range; - final int followRangeWithCollision = followRange + creature.getTemplate().getCollisionRadius() + ((Creature) followTarget).getTemplate().getCollisionRadius(); - if (!creature.isInsideRadius3D(followTarget, followRangeWithCollision)) + if (!creature.isInsideRadius3D(followTarget, followRange)) { if (!creature.isInsideRadius3D(followTarget, 3000)) { @@ -122,10 +120,6 @@ public class CreatureFollowTaskManager } ai.moveToPawn(followTarget, followRange); } - else - { - ai.notifyEvent(CtrlEvent.EVT_ARRIVED); - } } else { diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/AbstractAI.java index 62008fc42b..1e4baf0ddd 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -474,7 +474,7 @@ abstract class AbstractAI implements Ctrl } // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager - _accessor.moveTo(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); + _accessor.moveTo(pawn.getX(), pawn.getY(), pawn.getZ(), offset); // May result to make monsters stop moving. // if (!_actor.isMoving()) diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/CreatureAI.java index fdf3d6a1a0..8fa4e7cf68 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -1028,7 +1028,7 @@ public class CreatureAI extends AbstractAI return true; } // allow larger hit range when the target is moving (check is run only once per second) - if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100)) + if (!_actor.isInsideRadius2D(target, offsetWithCollision + 30)) { return true; } diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/actor/Creature.java index 65543f6f01..843316ef78 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -4056,15 +4056,14 @@ public abstract class Creature extends WorldObject implements ISkillsHolder /** * Accessor to Creature moveToLocation() method with an interaction area. - * @param target The target to follow, if any. * @param x the x * @param y the y * @param z the z * @param offset the offset */ - public void moveTo(WorldObject target, int x, int y, int z, int offset) + public void moveTo(int x, int y, int z, int offset) { - moveToLocation(target, x, y, z, offset); + moveToLocation(x, y, z, offset); } /** @@ -4142,7 +4141,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder public int _moveStartTime; public int _moveTimestamp; - public WorldObject _target; public int _xDestination; public int _yDestination; public int _zDestination; @@ -4665,12 +4663,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getX(); - } - return m._xDestination; } return getX(); @@ -4685,12 +4677,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getY(); - } - return m._yDestination; } return getY(); @@ -4705,12 +4691,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getZ(); - } - return m._zDestination; } return getZ(); @@ -4916,28 +4896,13 @@ public abstract class Creature extends WorldObject implements ISkillsHolder return false; } - final WorldObject target = m._target; final int xPrev = getX(); final int yPrev = getY(); final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations - double dx; - double dy; - double dz; - double distFraction; - // Save temporary values to avoid rounding errors. - if (target != null) - { - dx = target.getX() - m._xAccurate; - dy = target.getY() - m._yAccurate; - } - else - { - dx = m._xDestination - m._xAccurate; - dy = m._yDestination - m._yAccurate; - } + double dx = m._xDestination - m._xAccurate; + double dy = m._yDestination - m._yAccurate; + double dz = m._zDestination - zPrev; // Z coordinate will follow client values - // Z coordinate will follow client values - dz = m._zDestination - zPrev; float speed; if (this instanceof BoatInstance) { @@ -4979,6 +4944,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder } } + double distFraction; final double distPassed = (speed * (gameTicks - m._moveTimestamp)) / GameTimeTaskManager.TICKS_PER_SECOND; if ((((dx * dx) + (dy * dy)) < 10000) && ((dz * dz) > 2500)) // close enough, allows error between client and server geodata if it cannot be avoided { @@ -4992,14 +4958,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder if (distFraction > 1) { // Set the position of the Creature to the destination - if (target != null) - { - super.setXYZ(target.getX(), target.getY(), target.getZ()); - } - else - { - super.setXYZ(m._xDestination, m._yDestination, m._zDestination); - } + super.setXYZ(m._xDestination, m._yDestination, m._zDestination); if (isBoat()) { @@ -5182,11 +5141,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder return _target; } - public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) - { - moveToLocation(null, xValue, yValue, zValue, offsetValue); - } - /** * Calculate movement data for a move to location action and add the Creature to movingObjects of GameTimeTaskManager (only called by AI Accessor).
    *
    @@ -5207,13 +5161,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder * Example of use:
    *
  • AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)
  • *
  • FollowTask

  • - * @param target The target to follow, if any. * @param xValue The X position of the destination * @param yValue The Y position of the destination * @param zValue The Y position of the destination * @param offsetValue The size of the interaction area of the Creature targeted */ - protected void moveToLocation(WorldObject target, int xValue, int yValue, int zValue, int offsetValue) + protected void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) { // Get the Move Speed of the Creature final float speed = getStat().getMoveSpeed(); @@ -5466,7 +5419,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder // Calculate the number of ticks between the current position and the destination // One tick added for rounding reasons final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed); - m._target = target; m._xDestination = x; m._yDestination = y; m._zDestination = z; // this is what was requested from client diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/actor/instance/DoorInstance.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/actor/instance/DoorInstance.java index 7da6741911..4548889c49 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/actor/instance/DoorInstance.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/model/actor/instance/DoorInstance.java @@ -92,7 +92,7 @@ public class DoorInstance extends Creature } @Override - public void moveTo(WorldObject target, int x, int y, int z, int offset) + public void moveTo(int x, int y, int z, int offset) { } diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java index 24893e3a17..6d767e5e48 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.gameserver.ai.CreatureAI; -import org.l2jmobius.gameserver.ai.CtrlEvent; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; @@ -107,8 +106,7 @@ public class CreatureFollowTaskManager } final int followRange = range == -1 ? Rnd.get(50, 100) : range; - final int followRangeWithCollision = followRange + creature.getTemplate().getCollisionRadius() + ((Creature) followTarget).getTemplate().getCollisionRadius(); - if (!creature.isInsideRadius3D(followTarget, followRangeWithCollision)) + if (!creature.isInsideRadius3D(followTarget, followRange)) { if (!creature.isInsideRadius3D(followTarget, 3000)) { @@ -122,10 +120,6 @@ public class CreatureFollowTaskManager } ai.moveToPawn(followTarget, followRange); } - else - { - ai.notifyEvent(CtrlEvent.EVT_ARRIVED); - } } else { diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/AbstractAI.java index 62008fc42b..1e4baf0ddd 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -474,7 +474,7 @@ abstract class AbstractAI implements Ctrl } // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager - _accessor.moveTo(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); + _accessor.moveTo(pawn.getX(), pawn.getY(), pawn.getZ(), offset); // May result to make monsters stop moving. // if (!_actor.isMoving()) diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/CreatureAI.java index fdf3d6a1a0..8fa4e7cf68 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -1028,7 +1028,7 @@ public class CreatureAI extends AbstractAI return true; } // allow larger hit range when the target is moving (check is run only once per second) - if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100)) + if (!_actor.isInsideRadius2D(target, offsetWithCollision + 30)) { return true; } diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java index 952b44d882..21296b564c 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -4102,15 +4102,14 @@ public abstract class Creature extends WorldObject implements ISkillsHolder /** * Accessor to Creature moveToLocation() method with an interaction area. - * @param target The target to follow, if any. * @param x the x * @param y the y * @param z the z * @param offset the offset */ - public void moveTo(WorldObject target, int x, int y, int z, int offset) + public void moveTo(int x, int y, int z, int offset) { - moveToLocation(target, x, y, z, offset); + moveToLocation(x, y, z, offset); } /** @@ -4188,7 +4187,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder public int _moveStartTime; public int _moveTimestamp; - public WorldObject _target; public int _xDestination; public int _yDestination; public int _zDestination; @@ -4711,12 +4709,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getX(); - } - return m._xDestination; } return getX(); @@ -4731,12 +4723,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getY(); - } - return m._yDestination; } return getY(); @@ -4751,12 +4737,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getZ(); - } - return m._zDestination; } return getZ(); @@ -4962,28 +4942,13 @@ public abstract class Creature extends WorldObject implements ISkillsHolder return false; } - final WorldObject target = m._target; final int xPrev = getX(); final int yPrev = getY(); final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations - double dx; - double dy; - double dz; - double distFraction; - // Save temporary values to avoid rounding errors. - if (target != null) - { - dx = target.getX() - m._xAccurate; - dy = target.getY() - m._yAccurate; - } - else - { - dx = m._xDestination - m._xAccurate; - dy = m._yDestination - m._yAccurate; - } + double dx = m._xDestination - m._xAccurate; + double dy = m._yDestination - m._yAccurate; + double dz = m._zDestination - zPrev; // Z coordinate will follow client values - // Z coordinate will follow client values - dz = m._zDestination - zPrev; float speed; if (this instanceof BoatInstance) { @@ -5025,6 +4990,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder } } + double distFraction; final double distPassed = (speed * (gameTicks - m._moveTimestamp)) / GameTimeTaskManager.TICKS_PER_SECOND; if ((((dx * dx) + (dy * dy)) < 10000) && ((dz * dz) > 2500)) // close enough, allows error between client and server geodata if it cannot be avoided { @@ -5038,14 +5004,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder if (distFraction > 1) { // Set the position of the Creature to the destination - if (target != null) - { - super.setXYZ(target.getX(), target.getY(), target.getZ()); - } - else - { - super.setXYZ(m._xDestination, m._yDestination, m._zDestination); - } + super.setXYZ(m._xDestination, m._yDestination, m._zDestination); if (isBoat()) { @@ -5228,11 +5187,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder return _target; } - public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) - { - moveToLocation(null, xValue, yValue, zValue, offsetValue); - } - /** * Calculate movement data for a move to location action and add the Creature to movingObjects of GameTimeTaskManager (only called by AI Accessor).
    *
    @@ -5253,13 +5207,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder * Example of use:
    *
  • AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)
  • *
  • FollowTask

  • - * @param target The target to follow, if any. * @param xValue The X position of the destination * @param yValue The Y position of the destination * @param zValue The Y position of the destination * @param offsetValue The size of the interaction area of the Creature targeted */ - protected void moveToLocation(WorldObject target, int xValue, int yValue, int zValue, int offsetValue) + protected void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) { // Get the Move Speed of the Creature final float speed = getStat().getMoveSpeed(); @@ -5512,7 +5465,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder // Calculate the number of ticks between the current position and the destination // One tick added for rounding reasons final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed); - m._target = target; m._xDestination = x; m._yDestination = y; m._zDestination = z; // this is what was requested from client diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/DoorInstance.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/DoorInstance.java index 7da6741911..4548889c49 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/DoorInstance.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/DoorInstance.java @@ -92,7 +92,7 @@ public class DoorInstance extends Creature } @Override - public void moveTo(WorldObject target, int x, int y, int z, int offset) + public void moveTo(int x, int y, int z, int offset) { } diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java index 24893e3a17..6d767e5e48 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.gameserver.ai.CreatureAI; -import org.l2jmobius.gameserver.ai.CtrlEvent; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; @@ -107,8 +106,7 @@ public class CreatureFollowTaskManager } final int followRange = range == -1 ? Rnd.get(50, 100) : range; - final int followRangeWithCollision = followRange + creature.getTemplate().getCollisionRadius() + ((Creature) followTarget).getTemplate().getCollisionRadius(); - if (!creature.isInsideRadius3D(followTarget, followRangeWithCollision)) + if (!creature.isInsideRadius3D(followTarget, followRange)) { if (!creature.isInsideRadius3D(followTarget, 3000)) { @@ -122,10 +120,6 @@ public class CreatureFollowTaskManager } ai.moveToPawn(followTarget, followRange); } - else - { - ai.notifyEvent(CtrlEvent.EVT_ARRIVED); - } } else { diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/AbstractAI.java index 8541ca3e39..48650bf0df 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -545,7 +545,7 @@ public abstract class AbstractAI implements Ctrl } // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager - _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); + _actor.moveToLocation(pawn.getX(), pawn.getY(), pawn.getZ(), offset); // May result to make monsters stop moving. // if (!_actor.isMoving()) diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/CreatureAI.java index 22b94067d0..3ef46393ed 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -1029,7 +1029,7 @@ public class CreatureAI extends AbstractAI if (isFollowing()) { // allow larger hit range when the target is moving (check is run only once per second) - if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100)) + if (!_actor.isInsideRadius2D(target, offsetWithCollision + 30)) { return true; } diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Creature.java index 5c141c5581..3a12986fd8 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -3445,7 +3445,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // to recalculate position public int _moveStartTime; public int _moveTimestamp; // last update - public WorldObject _target; public int _xDestination; public int _yDestination; public int _zDestination; @@ -3811,12 +3810,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getX(); - } - return m._xDestination; } return getX(); @@ -3830,12 +3823,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getY(); - } - return m._yDestination; } return getY(); @@ -3849,12 +3836,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getZ(); - } - return m._zDestination; } return getZ(); @@ -4044,27 +4025,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return false; } - final WorldObject target = m._target; final int xPrev = getX(); final int yPrev = getY(); final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations - double dx; - double dy; - double dz; - // Save temporary values to avoid rounding errors. - if (target != null) - { - dx = target.getX() - m._xAccurate; - dy = target.getY() - m._yAccurate; - } - else - { - dx = m._xDestination - m._xAccurate; - dy = m._yDestination - m._yAccurate; - } - - // Z coordinate will follow client values - dz = m._zDestination - zPrev; + double dx = m._xDestination - m._xAccurate; + double dy = m._yDestination - m._yAccurate; + double dz = m._zDestination - zPrev; // Z coordinate will follow client values if (isPlayer() && !_isFlying) { final double distance = Math.hypot(dx, dy); @@ -4119,14 +4085,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (distFraction > 1) { // Set the position of the Creature to the destination - if (target != null) - { - super.setXYZ(target.getX(), target.getY(), target.getZ()); - } - else - { - super.setXYZ(m._xDestination, m._yDestination, m._zDestination); - } + super.setXYZ(m._xDestination, m._yDestination, m._zDestination); } else { @@ -4261,11 +4220,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return _target; } - public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) - { - moveToLocation(null, xValue, yValue, zValue, offsetValue); - } - /** * Calculate movement data for a move to location action and add the Creature to movingObjects of GameTimeTaskManager (only called by AI Accessor).
    *
    @@ -4291,13 +4245,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe *
  • AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)
  • *
  • FollowTask
  • * - * @param target The target to follow, if any. * @param xValue The X position of the destination * @param yValue The Y position of the destination * @param zValue The Y position of the destination * @param offsetValue The size of the interaction area of the Creature targeted */ - public void moveToLocation(WorldObject target, int xValue, int yValue, int zValue, int offsetValue) + public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) { // Get the Move Speed of the Creature final double speed = _stat.getMoveSpeed(); @@ -4524,7 +4477,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // Calculate the number of ticks between the current position and the destination // One tick added for rounding reasons final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed); - m._target = target; m._xDestination = x; m._yDestination = y; m._zDestination = z; // this is what was requested from client diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java index 24893e3a17..6d767e5e48 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.gameserver.ai.CreatureAI; -import org.l2jmobius.gameserver.ai.CtrlEvent; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; @@ -107,8 +106,7 @@ public class CreatureFollowTaskManager } final int followRange = range == -1 ? Rnd.get(50, 100) : range; - final int followRangeWithCollision = followRange + creature.getTemplate().getCollisionRadius() + ((Creature) followTarget).getTemplate().getCollisionRadius(); - if (!creature.isInsideRadius3D(followTarget, followRangeWithCollision)) + if (!creature.isInsideRadius3D(followTarget, followRange)) { if (!creature.isInsideRadius3D(followTarget, 3000)) { @@ -122,10 +120,6 @@ public class CreatureFollowTaskManager } ai.moveToPawn(followTarget, followRange); } - else - { - ai.notifyEvent(CtrlEvent.EVT_ARRIVED); - } } else { diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/AbstractAI.java index 8541ca3e39..48650bf0df 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -545,7 +545,7 @@ public abstract class AbstractAI implements Ctrl } // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager - _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); + _actor.moveToLocation(pawn.getX(), pawn.getY(), pawn.getZ(), offset); // May result to make monsters stop moving. // if (!_actor.isMoving()) diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/CreatureAI.java index 22b94067d0..3ef46393ed 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -1029,7 +1029,7 @@ public class CreatureAI extends AbstractAI if (isFollowing()) { // allow larger hit range when the target is moving (check is run only once per second) - if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100)) + if (!_actor.isInsideRadius2D(target, offsetWithCollision + 30)) { return true; } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Creature.java index 237be3dfc3..ff8a8065db 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -3447,7 +3447,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // to recalculate position public int _moveStartTime; public int _moveTimestamp; // last update - public WorldObject _target; public int _xDestination; public int _yDestination; public int _zDestination; @@ -3813,12 +3812,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getX(); - } - return m._xDestination; } return getX(); @@ -3832,12 +3825,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getY(); - } - return m._yDestination; } return getY(); @@ -3851,12 +3838,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getZ(); - } - return m._zDestination; } return getZ(); @@ -4046,27 +4027,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return false; } - final WorldObject target = m._target; final int xPrev = getX(); final int yPrev = getY(); final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations - double dx; - double dy; - double dz; - // Save temporary values to avoid rounding errors. - if (target != null) - { - dx = target.getX() - m._xAccurate; - dy = target.getY() - m._yAccurate; - } - else - { - dx = m._xDestination - m._xAccurate; - dy = m._yDestination - m._yAccurate; - } - - // Z coordinate will follow client values - dz = m._zDestination - zPrev; + double dx = m._xDestination - m._xAccurate; + double dy = m._yDestination - m._yAccurate; + double dz = m._zDestination - zPrev; // Z coordinate will follow client values if (isPlayer() && !_isFlying) { final double distance = Math.hypot(dx, dy); @@ -4121,14 +4087,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (distFraction > 1) { // Set the position of the Creature to the destination - if (target != null) - { - super.setXYZ(target.getX(), target.getY(), target.getZ()); - } - else - { - super.setXYZ(m._xDestination, m._yDestination, m._zDestination); - } + super.setXYZ(m._xDestination, m._yDestination, m._zDestination); } else { @@ -4263,11 +4222,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return _target; } - public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) - { - moveToLocation(null, xValue, yValue, zValue, offsetValue); - } - /** * Calculate movement data for a move to location action and add the Creature to movingObjects of GameTimeTaskManager (only called by AI Accessor).
    *
    @@ -4293,13 +4247,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe *
  • AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)
  • *
  • FollowTask
  • * - * @param target The target to follow, if any. * @param xValue The X position of the destination * @param yValue The Y position of the destination * @param zValue The Y position of the destination * @param offsetValue The size of the interaction area of the Creature targeted */ - public void moveToLocation(WorldObject target, int xValue, int yValue, int zValue, int offsetValue) + public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) { // Get the Move Speed of the Creature final double speed = _stat.getMoveSpeed(); @@ -4526,7 +4479,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // Calculate the number of ticks between the current position and the destination // One tick added for rounding reasons final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed); - m._target = target; m._xDestination = x; m._yDestination = y; m._zDestination = z; // this is what was requested from client diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java index 24893e3a17..6d767e5e48 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.gameserver.ai.CreatureAI; -import org.l2jmobius.gameserver.ai.CtrlEvent; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; @@ -107,8 +106,7 @@ public class CreatureFollowTaskManager } final int followRange = range == -1 ? Rnd.get(50, 100) : range; - final int followRangeWithCollision = followRange + creature.getTemplate().getCollisionRadius() + ((Creature) followTarget).getTemplate().getCollisionRadius(); - if (!creature.isInsideRadius3D(followTarget, followRangeWithCollision)) + if (!creature.isInsideRadius3D(followTarget, followRange)) { if (!creature.isInsideRadius3D(followTarget, 3000)) { @@ -122,10 +120,6 @@ public class CreatureFollowTaskManager } ai.moveToPawn(followTarget, followRange); } - else - { - ai.notifyEvent(CtrlEvent.EVT_ARRIVED); - } } else { diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ai/AbstractAI.java index b39d8371cf..d3a82b60cd 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -182,7 +182,7 @@ public abstract class AbstractAI implements Ctrl } case AI_INTENTION_CAST: { - onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, args.length > 3 && (boolean) args[3], args.length > 4 && (boolean) args[4]); + onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, (args.length > 3) && (boolean) args[3], (args.length > 4) && (boolean) args[4]); break; } case AI_INTENTION_MOVE_TO: @@ -470,7 +470,7 @@ public abstract class AbstractAI implements Ctrl } // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager - _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); + _actor.moveToLocation(pawn.getX(), pawn.getY(), pawn.getZ(), offset); // May result to make monsters stop moving. // if (!_actor.isMoving()) diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ai/CreatureAI.java index a1fc674148..359028c34b 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -977,7 +977,7 @@ public class CreatureAI extends AbstractAI if (isFollowing()) { // allow larger hit range when the target is moving (check is run only once per second) - if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100)) + if (!_actor.isInsideRadius2D(target, offsetWithCollision + 30)) { return true; } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java index 60035f75fe..9713c4af1c 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2628,7 +2628,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // to recalculate position public int _moveStartTime; public int _moveTimestamp; // last update - public WorldObject _target; public int _xDestination; public int _yDestination; public int _zDestination; @@ -2858,12 +2857,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getX(); - } - return m._xDestination; } return getX(); @@ -2877,12 +2870,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getY(); - } - return m._yDestination; } return getY(); @@ -2896,12 +2883,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getZ(); - } - return m._zDestination; } return getZ(); @@ -3086,27 +3067,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return false; } - final WorldObject target = m._target; final int xPrev = getX(); final int yPrev = getY(); final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations - double dx; - double dy; - double dz; - // Save temporary values to avoid rounding errors. - if (target != null) - { - dx = target.getX() - m._xAccurate; - dy = target.getY() - m._yAccurate; - } - else - { - dx = m._xDestination - m._xAccurate; - dy = m._yDestination - m._yAccurate; - } - - // Z coordinate will follow client values - dz = m._zDestination - zPrev; + double dx = m._xDestination - m._xAccurate; + double dy = m._yDestination - m._yAccurate; + double dz = m._zDestination - zPrev; // Z coordinate will follow client values if (isPlayer() && !_isFlying) { final double distance = Math.hypot(dx, dy); @@ -3161,14 +3127,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (distFraction > 1) { // Set the position of the Creature to the destination - if (target != null) - { - super.setXYZ(target.getX(), target.getY(), target.getZ()); - } - else - { - super.setXYZ(m._xDestination, m._yDestination, m._zDestination); - } + super.setXYZ(m._xDestination, m._yDestination, m._zDestination); } else { @@ -3305,11 +3264,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // called from AIAccessor only - public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) - { - moveToLocation(null, xValue, yValue, zValue, offsetValue); - } - /** * Calculate movement data for a move to location action and add the Creature to movingObjects of GameTimeTaskManager (only called by AI Accessor).
    *
    @@ -3335,13 +3289,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe *
  • AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)
  • *
  • FollowTask
  • * - * @param target The target to follow, if any. * @param xValue The X position of the destination * @param yValue The Y position of the destination * @param zValue The Y position of the destination * @param offsetValue The size of the interaction area of the Creature targeted */ - public void moveToLocation(WorldObject target, int xValue, int yValue, int zValue, int offsetValue) + public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) { // Get the Move Speed of the Creature final double speed = _stat.getMoveSpeed(); @@ -3568,7 +3521,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // Calculate the number of ticks between the current position and the destination // One tick added for rounding reasons final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed); - m._target = target; m._xDestination = x; m._yDestination = y; m._zDestination = z; // this is what was requested from client diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java index e1182ad439..b71b6a7789 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.gameserver.ai.CreatureAI; -import org.l2jmobius.gameserver.ai.CtrlEvent; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; @@ -107,8 +106,7 @@ public class CreatureFollowTaskManager } final int followRange = range == -1 ? Rnd.get(50, 100) : range; - final int followRangeWithCollision = followRange + creature.getTemplate().getCollisionRadius() + ((Creature) followTarget).getTemplate().getCollisionRadius(); - if (!creature.isInsideRadius3D(followTarget, followRangeWithCollision)) + if (!creature.isInsideRadius3D(followTarget, followRange)) { if (!creature.isInsideRadius3D(followTarget, 3000)) { @@ -122,10 +120,6 @@ public class CreatureFollowTaskManager } ai.moveToPawn(followTarget, followRange); } - else - { - ai.notifyEvent(CtrlEvent.EVT_ARRIVED); - } } else { diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ai/AbstractAI.java index b39d8371cf..d3a82b60cd 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -182,7 +182,7 @@ public abstract class AbstractAI implements Ctrl } case AI_INTENTION_CAST: { - onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, args.length > 3 && (boolean) args[3], args.length > 4 && (boolean) args[4]); + onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, (args.length > 3) && (boolean) args[3], (args.length > 4) && (boolean) args[4]); break; } case AI_INTENTION_MOVE_TO: @@ -470,7 +470,7 @@ public abstract class AbstractAI implements Ctrl } // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager - _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); + _actor.moveToLocation(pawn.getX(), pawn.getY(), pawn.getZ(), offset); // May result to make monsters stop moving. // if (!_actor.isMoving()) diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ai/CreatureAI.java index a1fc674148..359028c34b 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -977,7 +977,7 @@ public class CreatureAI extends AbstractAI if (isFollowing()) { // allow larger hit range when the target is moving (check is run only once per second) - if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100)) + if (!_actor.isInsideRadius2D(target, offsetWithCollision + 30)) { return true; } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java index 60035f75fe..9713c4af1c 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2628,7 +2628,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // to recalculate position public int _moveStartTime; public int _moveTimestamp; // last update - public WorldObject _target; public int _xDestination; public int _yDestination; public int _zDestination; @@ -2858,12 +2857,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getX(); - } - return m._xDestination; } return getX(); @@ -2877,12 +2870,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getY(); - } - return m._yDestination; } return getY(); @@ -2896,12 +2883,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getZ(); - } - return m._zDestination; } return getZ(); @@ -3086,27 +3067,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return false; } - final WorldObject target = m._target; final int xPrev = getX(); final int yPrev = getY(); final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations - double dx; - double dy; - double dz; - // Save temporary values to avoid rounding errors. - if (target != null) - { - dx = target.getX() - m._xAccurate; - dy = target.getY() - m._yAccurate; - } - else - { - dx = m._xDestination - m._xAccurate; - dy = m._yDestination - m._yAccurate; - } - - // Z coordinate will follow client values - dz = m._zDestination - zPrev; + double dx = m._xDestination - m._xAccurate; + double dy = m._yDestination - m._yAccurate; + double dz = m._zDestination - zPrev; // Z coordinate will follow client values if (isPlayer() && !_isFlying) { final double distance = Math.hypot(dx, dy); @@ -3161,14 +3127,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (distFraction > 1) { // Set the position of the Creature to the destination - if (target != null) - { - super.setXYZ(target.getX(), target.getY(), target.getZ()); - } - else - { - super.setXYZ(m._xDestination, m._yDestination, m._zDestination); - } + super.setXYZ(m._xDestination, m._yDestination, m._zDestination); } else { @@ -3305,11 +3264,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // called from AIAccessor only - public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) - { - moveToLocation(null, xValue, yValue, zValue, offsetValue); - } - /** * Calculate movement data for a move to location action and add the Creature to movingObjects of GameTimeTaskManager (only called by AI Accessor).
    *
    @@ -3335,13 +3289,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe *
  • AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)
  • *
  • FollowTask
  • * - * @param target The target to follow, if any. * @param xValue The X position of the destination * @param yValue The Y position of the destination * @param zValue The Y position of the destination * @param offsetValue The size of the interaction area of the Creature targeted */ - public void moveToLocation(WorldObject target, int xValue, int yValue, int zValue, int offsetValue) + public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) { // Get the Move Speed of the Creature final double speed = _stat.getMoveSpeed(); @@ -3568,7 +3521,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // Calculate the number of ticks between the current position and the destination // One tick added for rounding reasons final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed); - m._target = target; m._xDestination = x; m._yDestination = y; m._zDestination = z; // this is what was requested from client diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java index e1182ad439..b71b6a7789 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.gameserver.ai.CreatureAI; -import org.l2jmobius.gameserver.ai.CtrlEvent; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; @@ -107,8 +106,7 @@ public class CreatureFollowTaskManager } final int followRange = range == -1 ? Rnd.get(50, 100) : range; - final int followRangeWithCollision = followRange + creature.getTemplate().getCollisionRadius() + ((Creature) followTarget).getTemplate().getCollisionRadius(); - if (!creature.isInsideRadius3D(followTarget, followRangeWithCollision)) + if (!creature.isInsideRadius3D(followTarget, followRange)) { if (!creature.isInsideRadius3D(followTarget, 3000)) { @@ -122,10 +120,6 @@ public class CreatureFollowTaskManager } ai.moveToPawn(followTarget, followRange); } - else - { - ai.notifyEvent(CtrlEvent.EVT_ARRIVED); - } } else { diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ai/AbstractAI.java index b39d8371cf..d3a82b60cd 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -182,7 +182,7 @@ public abstract class AbstractAI implements Ctrl } case AI_INTENTION_CAST: { - onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, args.length > 3 && (boolean) args[3], args.length > 4 && (boolean) args[4]); + onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, (args.length > 3) && (boolean) args[3], (args.length > 4) && (boolean) args[4]); break; } case AI_INTENTION_MOVE_TO: @@ -470,7 +470,7 @@ public abstract class AbstractAI implements Ctrl } // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager - _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); + _actor.moveToLocation(pawn.getX(), pawn.getY(), pawn.getZ(), offset); // May result to make monsters stop moving. // if (!_actor.isMoving()) diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ai/CreatureAI.java index a1fc674148..359028c34b 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -977,7 +977,7 @@ public class CreatureAI extends AbstractAI if (isFollowing()) { // allow larger hit range when the target is moving (check is run only once per second) - if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100)) + if (!_actor.isInsideRadius2D(target, offsetWithCollision + 30)) { return true; } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java index d017175a85..87d98bfddb 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2628,7 +2628,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // to recalculate position public int _moveStartTime; public int _moveTimestamp; // last update - public WorldObject _target; public int _xDestination; public int _yDestination; public int _zDestination; @@ -2858,12 +2857,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getX(); - } - return m._xDestination; } return getX(); @@ -2877,12 +2870,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getY(); - } - return m._yDestination; } return getY(); @@ -2896,12 +2883,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getZ(); - } - return m._zDestination; } return getZ(); @@ -3086,27 +3067,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return false; } - final WorldObject target = m._target; final int xPrev = getX(); final int yPrev = getY(); final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations - double dx; - double dy; - double dz; - // Save temporary values to avoid rounding errors. - if (target != null) - { - dx = target.getX() - m._xAccurate; - dy = target.getY() - m._yAccurate; - } - else - { - dx = m._xDestination - m._xAccurate; - dy = m._yDestination - m._yAccurate; - } - - // Z coordinate will follow client values - dz = m._zDestination - zPrev; + double dx = m._xDestination - m._xAccurate; + double dy = m._yDestination - m._yAccurate; + double dz = m._zDestination - zPrev; // Z coordinate will follow client values if (isPlayer() && !_isFlying) { final double distance = Math.hypot(dx, dy); @@ -3161,14 +3127,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (distFraction > 1) { // Set the position of the Creature to the destination - if (target != null) - { - super.setXYZ(target.getX(), target.getY(), target.getZ()); - } - else - { - super.setXYZ(m._xDestination, m._yDestination, m._zDestination); - } + super.setXYZ(m._xDestination, m._yDestination, m._zDestination); } else { @@ -3305,11 +3264,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // called from AIAccessor only - public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) - { - moveToLocation(null, xValue, yValue, zValue, offsetValue); - } - /** * Calculate movement data for a move to location action and add the Creature to movingObjects of GameTimeTaskManager (only called by AI Accessor).
    *
    @@ -3335,13 +3289,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe *
  • AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)
  • *
  • FollowTask
  • * - * @param target The target to follow, if any. * @param xValue The X position of the destination * @param yValue The Y position of the destination * @param zValue The Y position of the destination * @param offsetValue The size of the interaction area of the Creature targeted */ - public void moveToLocation(WorldObject target, int xValue, int yValue, int zValue, int offsetValue) + public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) { // Get the Move Speed of the Creature final double speed = _stat.getMoveSpeed(); @@ -3568,7 +3521,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // Calculate the number of ticks between the current position and the destination // One tick added for rounding reasons final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed); - m._target = target; m._xDestination = x; m._yDestination = y; m._zDestination = z; // this is what was requested from client diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java index e1182ad439..b71b6a7789 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.gameserver.ai.CreatureAI; -import org.l2jmobius.gameserver.ai.CtrlEvent; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; @@ -107,8 +106,7 @@ public class CreatureFollowTaskManager } final int followRange = range == -1 ? Rnd.get(50, 100) : range; - final int followRangeWithCollision = followRange + creature.getTemplate().getCollisionRadius() + ((Creature) followTarget).getTemplate().getCollisionRadius(); - if (!creature.isInsideRadius3D(followTarget, followRangeWithCollision)) + if (!creature.isInsideRadius3D(followTarget, followRange)) { if (!creature.isInsideRadius3D(followTarget, 3000)) { @@ -122,10 +120,6 @@ public class CreatureFollowTaskManager } ai.moveToPawn(followTarget, followRange); } - else - { - ai.notifyEvent(CtrlEvent.EVT_ARRIVED); - } } else { diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ai/AbstractAI.java index b39d8371cf..d3a82b60cd 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -182,7 +182,7 @@ public abstract class AbstractAI implements Ctrl } case AI_INTENTION_CAST: { - onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, args.length > 3 && (boolean) args[3], args.length > 4 && (boolean) args[4]); + onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, (args.length > 3) && (boolean) args[3], (args.length > 4) && (boolean) args[4]); break; } case AI_INTENTION_MOVE_TO: @@ -470,7 +470,7 @@ public abstract class AbstractAI implements Ctrl } // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager - _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); + _actor.moveToLocation(pawn.getX(), pawn.getY(), pawn.getZ(), offset); // May result to make monsters stop moving. // if (!_actor.isMoving()) diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ai/CreatureAI.java index a1fc674148..359028c34b 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -977,7 +977,7 @@ public class CreatureAI extends AbstractAI if (isFollowing()) { // allow larger hit range when the target is moving (check is run only once per second) - if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100)) + if (!_actor.isInsideRadius2D(target, offsetWithCollision + 30)) { return true; } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java index 15d0cb1cbc..74f5e80686 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2629,7 +2629,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // to recalculate position public int _moveStartTime; public int _moveTimestamp; // last update - public WorldObject _target; public int _xDestination; public int _yDestination; public int _zDestination; @@ -2871,12 +2870,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getX(); - } - return m._xDestination; } return getX(); @@ -2890,12 +2883,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getY(); - } - return m._yDestination; } return getY(); @@ -2909,12 +2896,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getZ(); - } - return m._zDestination; } return getZ(); @@ -3099,27 +3080,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return false; } - final WorldObject target = m._target; final int xPrev = getX(); final int yPrev = getY(); final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations - double dx; - double dy; - double dz; - // Save temporary values to avoid rounding errors. - if (target != null) - { - dx = target.getX() - m._xAccurate; - dy = target.getY() - m._yAccurate; - } - else - { - dx = m._xDestination - m._xAccurate; - dy = m._yDestination - m._yAccurate; - } - - // Z coordinate will follow client values - dz = m._zDestination - zPrev; + double dx = m._xDestination - m._xAccurate; + double dy = m._yDestination - m._yAccurate; + double dz = m._zDestination - zPrev; // Z coordinate will follow client values if (isPlayer() && !_isFlying) { final double distance = Math.hypot(dx, dy); @@ -3174,14 +3140,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (distFraction > 1) { // Set the position of the Creature to the destination - if (target != null) - { - super.setXYZ(target.getX(), target.getY(), target.getZ()); - } - else - { - super.setXYZ(m._xDestination, m._yDestination, m._zDestination); - } + super.setXYZ(m._xDestination, m._yDestination, m._zDestination); } else { @@ -3318,11 +3277,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // called from AIAccessor only - public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) - { - moveToLocation(null, xValue, yValue, zValue, offsetValue); - } - /** * Calculate movement data for a move to location action and add the Creature to movingObjects of GameTimeTaskManager (only called by AI Accessor).
    *
    @@ -3348,13 +3302,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe *
  • AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)
  • *
  • FollowTask
  • * - * @param target The target to follow, if any. * @param xValue The X position of the destination * @param yValue The Y position of the destination * @param zValue The Y position of the destination * @param offsetValue The size of the interaction area of the Creature targeted */ - public void moveToLocation(WorldObject target, int xValue, int yValue, int zValue, int offsetValue) + public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) { // Get the Move Speed of the Creature final double speed = _stat.getMoveSpeed(); @@ -3581,7 +3534,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // Calculate the number of ticks between the current position and the destination // One tick added for rounding reasons final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed); - m._target = target; m._xDestination = x; m._yDestination = y; m._zDestination = z; // this is what was requested from client diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java index e1182ad439..b71b6a7789 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.gameserver.ai.CreatureAI; -import org.l2jmobius.gameserver.ai.CtrlEvent; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; @@ -107,8 +106,7 @@ public class CreatureFollowTaskManager } final int followRange = range == -1 ? Rnd.get(50, 100) : range; - final int followRangeWithCollision = followRange + creature.getTemplate().getCollisionRadius() + ((Creature) followTarget).getTemplate().getCollisionRadius(); - if (!creature.isInsideRadius3D(followTarget, followRangeWithCollision)) + if (!creature.isInsideRadius3D(followTarget, followRange)) { if (!creature.isInsideRadius3D(followTarget, 3000)) { @@ -122,10 +120,6 @@ public class CreatureFollowTaskManager } ai.moveToPawn(followTarget, followRange); } - else - { - ai.notifyEvent(CtrlEvent.EVT_ARRIVED); - } } else { diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ai/AbstractAI.java index b39d8371cf..d3a82b60cd 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -182,7 +182,7 @@ public abstract class AbstractAI implements Ctrl } case AI_INTENTION_CAST: { - onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, args.length > 3 && (boolean) args[3], args.length > 4 && (boolean) args[4]); + onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, (args.length > 3) && (boolean) args[3], (args.length > 4) && (boolean) args[4]); break; } case AI_INTENTION_MOVE_TO: @@ -470,7 +470,7 @@ public abstract class AbstractAI implements Ctrl } // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager - _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); + _actor.moveToLocation(pawn.getX(), pawn.getY(), pawn.getZ(), offset); // May result to make monsters stop moving. // if (!_actor.isMoving()) diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ai/CreatureAI.java index a1fc674148..359028c34b 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -977,7 +977,7 @@ public class CreatureAI extends AbstractAI if (isFollowing()) { // allow larger hit range when the target is moving (check is run only once per second) - if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100)) + if (!_actor.isInsideRadius2D(target, offsetWithCollision + 30)) { return true; } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java index 15d0cb1cbc..74f5e80686 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2629,7 +2629,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // to recalculate position public int _moveStartTime; public int _moveTimestamp; // last update - public WorldObject _target; public int _xDestination; public int _yDestination; public int _zDestination; @@ -2871,12 +2870,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getX(); - } - return m._xDestination; } return getX(); @@ -2890,12 +2883,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getY(); - } - return m._yDestination; } return getY(); @@ -2909,12 +2896,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getZ(); - } - return m._zDestination; } return getZ(); @@ -3099,27 +3080,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return false; } - final WorldObject target = m._target; final int xPrev = getX(); final int yPrev = getY(); final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations - double dx; - double dy; - double dz; - // Save temporary values to avoid rounding errors. - if (target != null) - { - dx = target.getX() - m._xAccurate; - dy = target.getY() - m._yAccurate; - } - else - { - dx = m._xDestination - m._xAccurate; - dy = m._yDestination - m._yAccurate; - } - - // Z coordinate will follow client values - dz = m._zDestination - zPrev; + double dx = m._xDestination - m._xAccurate; + double dy = m._yDestination - m._yAccurate; + double dz = m._zDestination - zPrev; // Z coordinate will follow client values if (isPlayer() && !_isFlying) { final double distance = Math.hypot(dx, dy); @@ -3174,14 +3140,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (distFraction > 1) { // Set the position of the Creature to the destination - if (target != null) - { - super.setXYZ(target.getX(), target.getY(), target.getZ()); - } - else - { - super.setXYZ(m._xDestination, m._yDestination, m._zDestination); - } + super.setXYZ(m._xDestination, m._yDestination, m._zDestination); } else { @@ -3318,11 +3277,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // called from AIAccessor only - public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) - { - moveToLocation(null, xValue, yValue, zValue, offsetValue); - } - /** * Calculate movement data for a move to location action and add the Creature to movingObjects of GameTimeTaskManager (only called by AI Accessor).
    *
    @@ -3348,13 +3302,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe *
  • AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)
  • *
  • FollowTask
  • * - * @param target The target to follow, if any. * @param xValue The X position of the destination * @param yValue The Y position of the destination * @param zValue The Y position of the destination * @param offsetValue The size of the interaction area of the Creature targeted */ - public void moveToLocation(WorldObject target, int xValue, int yValue, int zValue, int offsetValue) + public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) { // Get the Move Speed of the Creature final double speed = _stat.getMoveSpeed(); @@ -3581,7 +3534,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // Calculate the number of ticks between the current position and the destination // One tick added for rounding reasons final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed); - m._target = target; m._xDestination = x; m._yDestination = y; m._zDestination = z; // this is what was requested from client diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java index e1182ad439..b71b6a7789 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.gameserver.ai.CreatureAI; -import org.l2jmobius.gameserver.ai.CtrlEvent; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; @@ -107,8 +106,7 @@ public class CreatureFollowTaskManager } final int followRange = range == -1 ? Rnd.get(50, 100) : range; - final int followRangeWithCollision = followRange + creature.getTemplate().getCollisionRadius() + ((Creature) followTarget).getTemplate().getCollisionRadius(); - if (!creature.isInsideRadius3D(followTarget, followRangeWithCollision)) + if (!creature.isInsideRadius3D(followTarget, followRange)) { if (!creature.isInsideRadius3D(followTarget, 3000)) { @@ -122,10 +120,6 @@ public class CreatureFollowTaskManager } ai.moveToPawn(followTarget, followRange); } - else - { - ai.notifyEvent(CtrlEvent.EVT_ARRIVED); - } } else { diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ai/AbstractAI.java index b39d8371cf..d3a82b60cd 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -182,7 +182,7 @@ public abstract class AbstractAI implements Ctrl } case AI_INTENTION_CAST: { - onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, args.length > 3 && (boolean) args[3], args.length > 4 && (boolean) args[4]); + onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, (args.length > 3) && (boolean) args[3], (args.length > 4) && (boolean) args[4]); break; } case AI_INTENTION_MOVE_TO: @@ -470,7 +470,7 @@ public abstract class AbstractAI implements Ctrl } // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager - _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); + _actor.moveToLocation(pawn.getX(), pawn.getY(), pawn.getZ(), offset); // May result to make monsters stop moving. // if (!_actor.isMoving()) diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ai/CreatureAI.java index a1fc674148..359028c34b 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -977,7 +977,7 @@ public class CreatureAI extends AbstractAI if (isFollowing()) { // allow larger hit range when the target is moving (check is run only once per second) - if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100)) + if (!_actor.isInsideRadius2D(target, offsetWithCollision + 30)) { return true; } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java index 147ad4d83a..93a14492a0 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2629,7 +2629,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // to recalculate position public int _moveStartTime; public int _moveTimestamp; // last update - public WorldObject _target; public int _xDestination; public int _yDestination; public int _zDestination; @@ -2870,12 +2869,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getX(); - } - return m._xDestination; } return getX(); @@ -2889,12 +2882,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getY(); - } - return m._yDestination; } return getY(); @@ -2908,12 +2895,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getZ(); - } - return m._zDestination; } return getZ(); @@ -3098,27 +3079,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return false; } - final WorldObject target = m._target; final int xPrev = getX(); final int yPrev = getY(); final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations - double dx; - double dy; - double dz; - // Save temporary values to avoid rounding errors. - if (target != null) - { - dx = target.getX() - m._xAccurate; - dy = target.getY() - m._yAccurate; - } - else - { - dx = m._xDestination - m._xAccurate; - dy = m._yDestination - m._yAccurate; - } - - // Z coordinate will follow client values - dz = m._zDestination - zPrev; + double dx = m._xDestination - m._xAccurate; + double dy = m._yDestination - m._yAccurate; + double dz = m._zDestination - zPrev; // Z coordinate will follow client values if (isPlayer() && !_isFlying) { final double distance = Math.hypot(dx, dy); @@ -3173,14 +3139,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (distFraction > 1) { // Set the position of the Creature to the destination - if (target != null) - { - super.setXYZ(target.getX(), target.getY(), target.getZ()); - } - else - { - super.setXYZ(m._xDestination, m._yDestination, m._zDestination); - } + super.setXYZ(m._xDestination, m._yDestination, m._zDestination); } else { @@ -3317,11 +3276,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // called from AIAccessor only - public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) - { - moveToLocation(null, xValue, yValue, zValue, offsetValue); - } - /** * Calculate movement data for a move to location action and add the Creature to movingObjects of GameTimeTaskManager (only called by AI Accessor).
    *
    @@ -3347,13 +3301,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe *
  • AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)
  • *
  • FollowTask
  • * - * @param target The target to follow, if any. * @param xValue The X position of the destination * @param yValue The Y position of the destination * @param zValue The Y position of the destination * @param offsetValue The size of the interaction area of the Creature targeted */ - public void moveToLocation(WorldObject target, int xValue, int yValue, int zValue, int offsetValue) + public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) { // Get the Move Speed of the Creature final double speed = _stat.getMoveSpeed(); @@ -3580,7 +3533,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // Calculate the number of ticks between the current position and the destination // One tick added for rounding reasons final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed); - m._target = target; m._xDestination = x; m._yDestination = y; m._zDestination = z; // this is what was requested from client diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java index e1182ad439..b71b6a7789 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.gameserver.ai.CreatureAI; -import org.l2jmobius.gameserver.ai.CtrlEvent; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; @@ -107,8 +106,7 @@ public class CreatureFollowTaskManager } final int followRange = range == -1 ? Rnd.get(50, 100) : range; - final int followRangeWithCollision = followRange + creature.getTemplate().getCollisionRadius() + ((Creature) followTarget).getTemplate().getCollisionRadius(); - if (!creature.isInsideRadius3D(followTarget, followRangeWithCollision)) + if (!creature.isInsideRadius3D(followTarget, followRange)) { if (!creature.isInsideRadius3D(followTarget, 3000)) { @@ -122,10 +120,6 @@ public class CreatureFollowTaskManager } ai.moveToPawn(followTarget, followRange); } - else - { - ai.notifyEvent(CtrlEvent.EVT_ARRIVED); - } } else { diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ai/AbstractAI.java index b39d8371cf..d3a82b60cd 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -182,7 +182,7 @@ public abstract class AbstractAI implements Ctrl } case AI_INTENTION_CAST: { - onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, args.length > 3 && (boolean) args[3], args.length > 4 && (boolean) args[4]); + onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, (args.length > 3) && (boolean) args[3], (args.length > 4) && (boolean) args[4]); break; } case AI_INTENTION_MOVE_TO: @@ -470,7 +470,7 @@ public abstract class AbstractAI implements Ctrl } // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager - _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); + _actor.moveToLocation(pawn.getX(), pawn.getY(), pawn.getZ(), offset); // May result to make monsters stop moving. // if (!_actor.isMoving()) diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ai/CreatureAI.java index a1fc674148..359028c34b 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -977,7 +977,7 @@ public class CreatureAI extends AbstractAI if (isFollowing()) { // allow larger hit range when the target is moving (check is run only once per second) - if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100)) + if (!_actor.isInsideRadius2D(target, offsetWithCollision + 30)) { return true; } diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java index 60035f75fe..9713c4af1c 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2628,7 +2628,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // to recalculate position public int _moveStartTime; public int _moveTimestamp; // last update - public WorldObject _target; public int _xDestination; public int _yDestination; public int _zDestination; @@ -2858,12 +2857,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getX(); - } - return m._xDestination; } return getX(); @@ -2877,12 +2870,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getY(); - } - return m._yDestination; } return getY(); @@ -2896,12 +2883,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getZ(); - } - return m._zDestination; } return getZ(); @@ -3086,27 +3067,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return false; } - final WorldObject target = m._target; final int xPrev = getX(); final int yPrev = getY(); final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations - double dx; - double dy; - double dz; - // Save temporary values to avoid rounding errors. - if (target != null) - { - dx = target.getX() - m._xAccurate; - dy = target.getY() - m._yAccurate; - } - else - { - dx = m._xDestination - m._xAccurate; - dy = m._yDestination - m._yAccurate; - } - - // Z coordinate will follow client values - dz = m._zDestination - zPrev; + double dx = m._xDestination - m._xAccurate; + double dy = m._yDestination - m._yAccurate; + double dz = m._zDestination - zPrev; // Z coordinate will follow client values if (isPlayer() && !_isFlying) { final double distance = Math.hypot(dx, dy); @@ -3161,14 +3127,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (distFraction > 1) { // Set the position of the Creature to the destination - if (target != null) - { - super.setXYZ(target.getX(), target.getY(), target.getZ()); - } - else - { - super.setXYZ(m._xDestination, m._yDestination, m._zDestination); - } + super.setXYZ(m._xDestination, m._yDestination, m._zDestination); } else { @@ -3305,11 +3264,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // called from AIAccessor only - public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) - { - moveToLocation(null, xValue, yValue, zValue, offsetValue); - } - /** * Calculate movement data for a move to location action and add the Creature to movingObjects of GameTimeTaskManager (only called by AI Accessor).
    *
    @@ -3335,13 +3289,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe *
  • AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)
  • *
  • FollowTask
  • * - * @param target The target to follow, if any. * @param xValue The X position of the destination * @param yValue The Y position of the destination * @param zValue The Y position of the destination * @param offsetValue The size of the interaction area of the Creature targeted */ - public void moveToLocation(WorldObject target, int xValue, int yValue, int zValue, int offsetValue) + public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) { // Get the Move Speed of the Creature final double speed = _stat.getMoveSpeed(); @@ -3568,7 +3521,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // Calculate the number of ticks between the current position and the destination // One tick added for rounding reasons final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed); - m._target = target; m._xDestination = x; m._yDestination = y; m._zDestination = z; // this is what was requested from client diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java index e1182ad439..b71b6a7789 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.gameserver.ai.CreatureAI; -import org.l2jmobius.gameserver.ai.CtrlEvent; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; @@ -107,8 +106,7 @@ public class CreatureFollowTaskManager } final int followRange = range == -1 ? Rnd.get(50, 100) : range; - final int followRangeWithCollision = followRange + creature.getTemplate().getCollisionRadius() + ((Creature) followTarget).getTemplate().getCollisionRadius(); - if (!creature.isInsideRadius3D(followTarget, followRangeWithCollision)) + if (!creature.isInsideRadius3D(followTarget, followRange)) { if (!creature.isInsideRadius3D(followTarget, 3000)) { @@ -122,10 +120,6 @@ public class CreatureFollowTaskManager } ai.moveToPawn(followTarget, followRange); } - else - { - ai.notifyEvent(CtrlEvent.EVT_ARRIVED); - } } else { diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/ai/AbstractAI.java index b39d8371cf..d3a82b60cd 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -182,7 +182,7 @@ public abstract class AbstractAI implements Ctrl } case AI_INTENTION_CAST: { - onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, args.length > 3 && (boolean) args[3], args.length > 4 && (boolean) args[4]); + onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, (args.length > 3) && (boolean) args[3], (args.length > 4) && (boolean) args[4]); break; } case AI_INTENTION_MOVE_TO: @@ -470,7 +470,7 @@ public abstract class AbstractAI implements Ctrl } // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager - _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); + _actor.moveToLocation(pawn.getX(), pawn.getY(), pawn.getZ(), offset); // May result to make monsters stop moving. // if (!_actor.isMoving()) diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/ai/CreatureAI.java index a1fc674148..359028c34b 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -977,7 +977,7 @@ public class CreatureAI extends AbstractAI if (isFollowing()) { // allow larger hit range when the target is moving (check is run only once per second) - if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100)) + if (!_actor.isInsideRadius2D(target, offsetWithCollision + 30)) { return true; } diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/Creature.java index c21d8ef9aa..44a62f6725 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2632,7 +2632,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // to recalculate position public int _moveStartTime; public int _moveTimestamp; // last update - public WorldObject _target; public int _xDestination; public int _yDestination; public int _zDestination; @@ -2873,12 +2872,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getX(); - } - return m._xDestination; } return getX(); @@ -2892,12 +2885,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getY(); - } - return m._yDestination; } return getY(); @@ -2911,12 +2898,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getZ(); - } - return m._zDestination; } return getZ(); @@ -3101,27 +3082,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return false; } - final WorldObject target = m._target; final int xPrev = getX(); final int yPrev = getY(); final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations - double dx; - double dy; - double dz; - // Save temporary values to avoid rounding errors. - if (target != null) - { - dx = target.getX() - m._xAccurate; - dy = target.getY() - m._yAccurate; - } - else - { - dx = m._xDestination - m._xAccurate; - dy = m._yDestination - m._yAccurate; - } - - // Z coordinate will follow client values - dz = m._zDestination - zPrev; + double dx = m._xDestination - m._xAccurate; + double dy = m._yDestination - m._yAccurate; + double dz = m._zDestination - zPrev; // Z coordinate will follow client values if (isPlayer() && !_isFlying) { final double distance = Math.hypot(dx, dy); @@ -3176,14 +3142,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (distFraction > 1) { // Set the position of the Creature to the destination - if (target != null) - { - super.setXYZ(target.getX(), target.getY(), target.getZ()); - } - else - { - super.setXYZ(m._xDestination, m._yDestination, m._zDestination); - } + super.setXYZ(m._xDestination, m._yDestination, m._zDestination); } else { @@ -3320,11 +3279,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // called from AIAccessor only - public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) - { - moveToLocation(null, xValue, yValue, zValue, offsetValue); - } - /** * Calculate movement data for a move to location action and add the Creature to movingObjects of GameTimeTaskManager (only called by AI Accessor).
    *
    @@ -3350,13 +3304,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe *
  • AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)
  • *
  • FollowTask
  • * - * @param target The target to follow, if any. * @param xValue The X position of the destination * @param yValue The Y position of the destination * @param zValue The Y position of the destination * @param offsetValue The size of the interaction area of the Creature targeted */ - public void moveToLocation(WorldObject target, int xValue, int yValue, int zValue, int offsetValue) + public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) { // Get the Move Speed of the Creature final double speed = _stat.getMoveSpeed(); @@ -3583,7 +3536,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // Calculate the number of ticks between the current position and the destination // One tick added for rounding reasons final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed); - m._target = target; m._xDestination = x; m._yDestination = y; m._zDestination = z; // this is what was requested from client diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java index e1182ad439..b71b6a7789 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.gameserver.ai.CreatureAI; -import org.l2jmobius.gameserver.ai.CtrlEvent; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; @@ -107,8 +106,7 @@ public class CreatureFollowTaskManager } final int followRange = range == -1 ? Rnd.get(50, 100) : range; - final int followRangeWithCollision = followRange + creature.getTemplate().getCollisionRadius() + ((Creature) followTarget).getTemplate().getCollisionRadius(); - if (!creature.isInsideRadius3D(followTarget, followRangeWithCollision)) + if (!creature.isInsideRadius3D(followTarget, followRange)) { if (!creature.isInsideRadius3D(followTarget, 3000)) { @@ -122,10 +120,6 @@ public class CreatureFollowTaskManager } ai.moveToPawn(followTarget, followRange); } - else - { - ai.notifyEvent(CtrlEvent.EVT_ARRIVED); - } } else { diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/ai/AbstractAI.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/ai/AbstractAI.java index b39d8371cf..d3a82b60cd 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/ai/AbstractAI.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/ai/AbstractAI.java @@ -182,7 +182,7 @@ public abstract class AbstractAI implements Ctrl } case AI_INTENTION_CAST: { - onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, args.length > 3 && (boolean) args[3], args.length > 4 && (boolean) args[4]); + onIntentionCast((Skill) args[0], (WorldObject) args[1], args.length > 2 ? (ItemInstance) args[2] : null, (args.length > 3) && (boolean) args[3], (args.length > 4) && (boolean) args[4]); break; } case AI_INTENTION_MOVE_TO: @@ -470,7 +470,7 @@ public abstract class AbstractAI implements Ctrl } // Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager - _actor.moveToLocation(_actor.isPlayable() ? pawn : null, pawn.getX(), pawn.getY(), pawn.getZ(), offset); + _actor.moveToLocation(pawn.getX(), pawn.getY(), pawn.getZ(), offset); // May result to make monsters stop moving. // if (!_actor.isMoving()) diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/ai/CreatureAI.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/ai/CreatureAI.java index a1fc674148..359028c34b 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/ai/CreatureAI.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/ai/CreatureAI.java @@ -977,7 +977,7 @@ public class CreatureAI extends AbstractAI if (isFollowing()) { // allow larger hit range when the target is moving (check is run only once per second) - if (!_actor.isInsideRadius2D(target, offsetWithCollision + 100)) + if (!_actor.isInsideRadius2D(target, offsetWithCollision + 30)) { return true; } diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/Creature.java index a1bdc38cd1..0c6b32aae8 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -2639,7 +2639,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // to recalculate position public int _moveStartTime; public int _moveTimestamp; // last update - public WorldObject _target; public int _xDestination; public int _yDestination; public int _zDestination; @@ -2880,12 +2879,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getX(); - } - return m._xDestination; } return getX(); @@ -2899,12 +2892,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getY(); - } - return m._yDestination; } return getY(); @@ -2918,12 +2905,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe final MoveData m = _move; if (m != null) { - final WorldObject target = m._target; - if (target != null) - { - return target.getZ(); - } - return m._zDestination; } return getZ(); @@ -3108,27 +3089,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return false; } - final WorldObject target = m._target; final int xPrev = getX(); final int yPrev = getY(); final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations - double dx; - double dy; - double dz; - // Save temporary values to avoid rounding errors. - if (target != null) - { - dx = target.getX() - m._xAccurate; - dy = target.getY() - m._yAccurate; - } - else - { - dx = m._xDestination - m._xAccurate; - dy = m._yDestination - m._yAccurate; - } - - // Z coordinate will follow client values - dz = m._zDestination - zPrev; + double dx = m._xDestination - m._xAccurate; + double dy = m._yDestination - m._yAccurate; + double dz = m._zDestination - zPrev; // Z coordinate will follow client values if (isPlayer() && !_isFlying) { final double distance = Math.hypot(dx, dy); @@ -3183,14 +3149,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (distFraction > 1) { // Set the position of the Creature to the destination - if (target != null) - { - super.setXYZ(target.getX(), target.getY(), target.getZ()); - } - else - { - super.setXYZ(m._xDestination, m._yDestination, m._zDestination); - } + super.setXYZ(m._xDestination, m._yDestination, m._zDestination); } else { @@ -3327,11 +3286,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // called from AIAccessor only - public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) - { - moveToLocation(null, xValue, yValue, zValue, offsetValue); - } - /** * Calculate movement data for a move to location action and add the Creature to movingObjects of GameTimeTaskManager (only called by AI Accessor).
    *
    @@ -3357,13 +3311,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe *
  • AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)
  • *
  • FollowTask
  • * - * @param target The target to follow, if any. * @param xValue The X position of the destination * @param yValue The Y position of the destination * @param zValue The Y position of the destination * @param offsetValue The size of the interaction area of the Creature targeted */ - public void moveToLocation(WorldObject target, int xValue, int yValue, int zValue, int offsetValue) + public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue) { // Get the Move Speed of the Creature final double speed = _stat.getMoveSpeed(); @@ -3590,7 +3543,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe // Calculate the number of ticks between the current position and the destination // One tick added for rounding reasons final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed); - m._target = target; m._xDestination = x; m._yDestination = y; m._zDestination = z; // this is what was requested from client diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java index e1182ad439..b71b6a7789 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/taskmanager/CreatureFollowTaskManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.util.Rnd; import org.l2jmobius.gameserver.ai.CreatureAI; -import org.l2jmobius.gameserver.ai.CtrlEvent; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Summon; @@ -107,8 +106,7 @@ public class CreatureFollowTaskManager } final int followRange = range == -1 ? Rnd.get(50, 100) : range; - final int followRangeWithCollision = followRange + creature.getTemplate().getCollisionRadius() + ((Creature) followTarget).getTemplate().getCollisionRadius(); - if (!creature.isInsideRadius3D(followTarget, followRangeWithCollision)) + if (!creature.isInsideRadius3D(followTarget, followRange)) { if (!creature.isInsideRadius3D(followTarget, 3000)) { @@ -122,10 +120,6 @@ public class CreatureFollowTaskManager } ai.moveToPawn(followTarget, followRange); } - else - { - ai.notifyEvent(CtrlEvent.EVT_ARRIVED); - } } else {