|
|
|
@ -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
|
|
|
|
|