Reverted follow while target is running changes.
Contributed by Trance.
This commit is contained in:
parent
0b9006f5c4
commit
79e4b4024a
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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).<br>
|
||||
* <br>
|
||||
@ -3335,13 +3289,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li>
|
||||
* </ul>
|
||||
* @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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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).<br>
|
||||
* <br>
|
||||
@ -3335,13 +3289,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li>
|
||||
* </ul>
|
||||
* @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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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).<br>
|
||||
* <br>
|
||||
@ -3335,13 +3289,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li>
|
||||
* </ul>
|
||||
* @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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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).<br>
|
||||
* <br>
|
||||
@ -3335,13 +3289,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li>
|
||||
* </ul>
|
||||
* @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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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).<br>
|
||||
* <br>
|
||||
@ -3335,13 +3289,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li>
|
||||
* </ul>
|
||||
* @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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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).<br>
|
||||
* <br>
|
||||
@ -3335,13 +3289,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li>
|
||||
* </ul>
|
||||
* @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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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).<br>
|
||||
* <br>
|
||||
@ -3335,13 +3289,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li>
|
||||
* </ul>
|
||||
* @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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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).<br>
|
||||
* <br>
|
||||
@ -3334,13 +3288,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li>
|
||||
* </ul>
|
||||
* @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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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).<br>
|
||||
* <br>
|
||||
@ -3334,13 +3288,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li>
|
||||
* </ul>
|
||||
* @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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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).<br>
|
||||
* <br>
|
||||
@ -3334,13 +3288,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li>
|
||||
* </ul>
|
||||
* @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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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).<br>
|
||||
* <br>
|
||||
@ -5207,13 +5161,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
* <b><u>Example of use</u>:</b><br>
|
||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li><br>
|
||||
* @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
|
||||
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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).<br>
|
||||
* <br>
|
||||
@ -5253,13 +5207,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
* <b><u>Example of use</u>:</b><br>
|
||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li><br>
|
||||
* @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
|
||||
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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).<br>
|
||||
* <br>
|
||||
@ -4291,13 +4245,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li>
|
||||
* </ul>
|
||||
* @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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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).<br>
|
||||
* <br>
|
||||
@ -4293,13 +4247,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li>
|
||||
* </ul>
|
||||
* @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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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).<br>
|
||||
* <br>
|
||||
@ -3335,13 +3289,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li>
|
||||
* </ul>
|
||||
* @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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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).<br>
|
||||
* <br>
|
||||
@ -3335,13 +3289,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li>
|
||||
* </ul>
|
||||
* @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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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).<br>
|
||||
* <br>
|
||||
@ -3335,13 +3289,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li>
|
||||
* </ul>
|
||||
* @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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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).<br>
|
||||
* <br>
|
||||
@ -3348,13 +3302,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li>
|
||||
* </ul>
|
||||
* @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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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).<br>
|
||||
* <br>
|
||||
@ -3348,13 +3302,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li>
|
||||
* </ul>
|
||||
* @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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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).<br>
|
||||
* <br>
|
||||
@ -3347,13 +3301,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li>
|
||||
* </ul>
|
||||
* @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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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).<br>
|
||||
* <br>
|
||||
@ -3335,13 +3289,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li>
|
||||
* </ul>
|
||||
* @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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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).<br>
|
||||
* <br>
|
||||
@ -3350,13 +3304,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li>
|
||||
* </ul>
|
||||
* @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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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())
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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).<br>
|
||||
* <br>
|
||||
@ -3357,13 +3311,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li>
|
||||
* </ul>
|
||||
* @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
|
||||
|
@ -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
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user