Broadcast MoveToLocation when Playable tries to reach a Playable target.
Thanks to Trance.
This commit is contained in:
@@ -480,7 +480,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToPawn/MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
if (pawn.isCreature())
|
if (pawn.isCreature())
|
||||||
{
|
{
|
||||||
if (_actor.isOnGeodataPath())
|
if (_actor.isOnGeodataPath())
|
||||||
@@ -514,7 +514,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation <i>(broadcast)</i>.<br>
|
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation <i>(broadcast)</i>.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@@ -532,7 +532,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
||||||
_actor.moveToLocation(x, y, z, 0);
|
_actor.moveToLocation(x, y, z, 0);
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
_actor.broadcastMoveToLocation();
|
_actor.broadcastMoveToLocation();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -679,7 +679,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param player The PlayerIstance to notify with state of this Creature
|
* @param player The PlayerIstance to notify with state of this Creature
|
||||||
*/
|
*/
|
||||||
@@ -694,7 +694,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
player.sendPacket(new MoveToLocation(_actor));
|
player.sendPacket(new MoveToLocation(_actor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -526,7 +526,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
y1 = (leader.getY() - y1) + minRadius;
|
y1 = (leader.getY() - y1) + minRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(x1, y1, leader.getZ());
|
moveTo(x1, y1, leader.getZ());
|
||||||
}
|
}
|
||||||
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
|
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
|
||||||
@@ -574,7 +574,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
z1 = npc.getZ();
|
z1 = npc.getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceWorld());
|
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceWorld());
|
||||||
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -379,7 +379,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -248,7 +248,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3142,6 +3142,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// Set the timer of last position update to now
|
// Set the timer of last position update to now
|
||||||
m._moveTimestamp = gameTicks;
|
m._moveTimestamp = gameTicks;
|
||||||
|
|
||||||
|
// Broadcast MoveToLocation when Playable tries to reach a Playable target (once per second).
|
||||||
|
if (isPlayable())
|
||||||
|
{
|
||||||
|
final WorldObject target = _target;
|
||||||
|
if ((target != null) && target.isPlayable() && ((gameTicks % 10) == 0) && (calculateDistance3D(target) > 150))
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (distFraction > 1)
|
if (distFraction > 1)
|
||||||
{
|
{
|
||||||
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
||||||
@@ -3282,7 +3292,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
||||||
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/CharMoveToLocation.</b></font><br>
|
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/MoveToLocation.</b></font><br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
@@ -3630,7 +3640,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
||||||
// to destination by GameTimeTaskManager
|
// to destination by GameTimeTaskManager
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
broadcastMoveToLocation();
|
broadcastMoveToLocation();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ public class RequestRecordInfo implements IClientIncomingPacket
|
|||||||
if (object.isCreature())
|
if (object.isCreature())
|
||||||
{
|
{
|
||||||
// Update the state of the Creature object client side by sending Server->Client packet
|
// Update the state of the Creature object client side by sending Server->Client packet
|
||||||
// MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance
|
// MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance
|
||||||
final Creature creature = (Creature) object;
|
final Creature creature = (Creature) object;
|
||||||
if (creature.hasAI())
|
if (creature.hasAI())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -480,7 +480,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToPawn/MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
if (pawn.isCreature())
|
if (pawn.isCreature())
|
||||||
{
|
{
|
||||||
if (_actor.isOnGeodataPath())
|
if (_actor.isOnGeodataPath())
|
||||||
@@ -514,7 +514,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation <i>(broadcast)</i>.<br>
|
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation <i>(broadcast)</i>.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@@ -532,7 +532,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
||||||
_actor.moveToLocation(x, y, z, 0);
|
_actor.moveToLocation(x, y, z, 0);
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
_actor.broadcastMoveToLocation();
|
_actor.broadcastMoveToLocation();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -679,7 +679,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param player The PlayerIstance to notify with state of this Creature
|
* @param player The PlayerIstance to notify with state of this Creature
|
||||||
*/
|
*/
|
||||||
@@ -694,7 +694,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
player.sendPacket(new MoveToLocation(_actor));
|
player.sendPacket(new MoveToLocation(_actor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -526,7 +526,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
y1 = (leader.getY() - y1) + minRadius;
|
y1 = (leader.getY() - y1) + minRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(x1, y1, leader.getZ());
|
moveTo(x1, y1, leader.getZ());
|
||||||
}
|
}
|
||||||
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
|
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
|
||||||
@@ -574,7 +574,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
z1 = npc.getZ();
|
z1 = npc.getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceWorld());
|
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceWorld());
|
||||||
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -379,7 +379,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -248,7 +248,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-2
@@ -3142,6 +3142,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// Set the timer of last position update to now
|
// Set the timer of last position update to now
|
||||||
m._moveTimestamp = gameTicks;
|
m._moveTimestamp = gameTicks;
|
||||||
|
|
||||||
|
// Broadcast MoveToLocation when Playable tries to reach a Playable target (once per second).
|
||||||
|
if (isPlayable())
|
||||||
|
{
|
||||||
|
final WorldObject target = _target;
|
||||||
|
if ((target != null) && target.isPlayable() && ((gameTicks % 10) == 0) && (calculateDistance3D(target) > 150))
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (distFraction > 1)
|
if (distFraction > 1)
|
||||||
{
|
{
|
||||||
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
||||||
@@ -3282,7 +3292,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
||||||
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/CharMoveToLocation.</b></font><br>
|
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/MoveToLocation.</b></font><br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
@@ -3630,7 +3640,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
||||||
// to destination by GameTimeTaskManager
|
// to destination by GameTimeTaskManager
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
broadcastMoveToLocation();
|
broadcastMoveToLocation();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ public class RequestRecordInfo implements IClientIncomingPacket
|
|||||||
if (object.isCreature())
|
if (object.isCreature())
|
||||||
{
|
{
|
||||||
// Update the state of the Creature object client side by sending Server->Client packet
|
// Update the state of the Creature object client side by sending Server->Client packet
|
||||||
// MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance
|
// MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance
|
||||||
final Creature creature = (Creature) object;
|
final Creature creature = (Creature) object;
|
||||||
if (creature.hasAI())
|
if (creature.hasAI())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -480,7 +480,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToPawn/MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
if (pawn.isCreature())
|
if (pawn.isCreature())
|
||||||
{
|
{
|
||||||
if (_actor.isOnGeodataPath())
|
if (_actor.isOnGeodataPath())
|
||||||
@@ -514,7 +514,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation <i>(broadcast)</i>.<br>
|
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation <i>(broadcast)</i>.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@@ -532,7 +532,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
||||||
_actor.moveToLocation(x, y, z, 0);
|
_actor.moveToLocation(x, y, z, 0);
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
_actor.broadcastMoveToLocation();
|
_actor.broadcastMoveToLocation();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -679,7 +679,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param player The PlayerIstance to notify with state of this Creature
|
* @param player The PlayerIstance to notify with state of this Creature
|
||||||
*/
|
*/
|
||||||
@@ -694,7 +694,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
player.sendPacket(new MoveToLocation(_actor));
|
player.sendPacket(new MoveToLocation(_actor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -526,7 +526,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
y1 = (leader.getY() - y1) + minRadius;
|
y1 = (leader.getY() - y1) + minRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(x1, y1, leader.getZ());
|
moveTo(x1, y1, leader.getZ());
|
||||||
}
|
}
|
||||||
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
|
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
|
||||||
@@ -574,7 +574,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
z1 = npc.getZ();
|
z1 = npc.getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceWorld());
|
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceWorld());
|
||||||
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -379,7 +379,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -248,7 +248,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3142,6 +3142,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// Set the timer of last position update to now
|
// Set the timer of last position update to now
|
||||||
m._moveTimestamp = gameTicks;
|
m._moveTimestamp = gameTicks;
|
||||||
|
|
||||||
|
// Broadcast MoveToLocation when Playable tries to reach a Playable target (once per second).
|
||||||
|
if (isPlayable())
|
||||||
|
{
|
||||||
|
final WorldObject target = _target;
|
||||||
|
if ((target != null) && target.isPlayable() && ((gameTicks % 10) == 0) && (calculateDistance3D(target) > 150))
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (distFraction > 1)
|
if (distFraction > 1)
|
||||||
{
|
{
|
||||||
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
||||||
@@ -3282,7 +3292,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
||||||
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/CharMoveToLocation.</b></font><br>
|
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/MoveToLocation.</b></font><br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
@@ -3630,7 +3640,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
||||||
// to destination by GameTimeTaskManager
|
// to destination by GameTimeTaskManager
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
broadcastMoveToLocation();
|
broadcastMoveToLocation();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ public class RequestRecordInfo implements IClientIncomingPacket
|
|||||||
if (object.isCreature())
|
if (object.isCreature())
|
||||||
{
|
{
|
||||||
// Update the state of the Creature object client side by sending Server->Client packet
|
// Update the state of the Creature object client side by sending Server->Client packet
|
||||||
// MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance
|
// MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance
|
||||||
final Creature creature = (Creature) object;
|
final Creature creature = (Creature) object;
|
||||||
if (creature.hasAI())
|
if (creature.hasAI())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -480,7 +480,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToPawn/MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
if (pawn.isCreature())
|
if (pawn.isCreature())
|
||||||
{
|
{
|
||||||
if (_actor.isOnGeodataPath())
|
if (_actor.isOnGeodataPath())
|
||||||
@@ -514,7 +514,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation <i>(broadcast)</i>.<br>
|
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation <i>(broadcast)</i>.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@@ -532,7 +532,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
||||||
_actor.moveToLocation(x, y, z, 0);
|
_actor.moveToLocation(x, y, z, 0);
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
_actor.broadcastMoveToLocation();
|
_actor.broadcastMoveToLocation();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -679,7 +679,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param player The PlayerIstance to notify with state of this Creature
|
* @param player The PlayerIstance to notify with state of this Creature
|
||||||
*/
|
*/
|
||||||
@@ -694,7 +694,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
player.sendPacket(new MoveToLocation(_actor));
|
player.sendPacket(new MoveToLocation(_actor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -526,7 +526,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
y1 = (leader.getY() - y1) + minRadius;
|
y1 = (leader.getY() - y1) + minRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(x1, y1, leader.getZ());
|
moveTo(x1, y1, leader.getZ());
|
||||||
}
|
}
|
||||||
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
|
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
|
||||||
@@ -574,7 +574,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
z1 = npc.getZ();
|
z1 = npc.getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceWorld());
|
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceWorld());
|
||||||
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -379,7 +379,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -248,7 +248,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-2
@@ -3142,6 +3142,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// Set the timer of last position update to now
|
// Set the timer of last position update to now
|
||||||
m._moveTimestamp = gameTicks;
|
m._moveTimestamp = gameTicks;
|
||||||
|
|
||||||
|
// Broadcast MoveToLocation when Playable tries to reach a Playable target (once per second).
|
||||||
|
if (isPlayable())
|
||||||
|
{
|
||||||
|
final WorldObject target = _target;
|
||||||
|
if ((target != null) && target.isPlayable() && ((gameTicks % 10) == 0) && (calculateDistance3D(target) > 150))
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (distFraction > 1)
|
if (distFraction > 1)
|
||||||
{
|
{
|
||||||
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
||||||
@@ -3282,7 +3292,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
||||||
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/CharMoveToLocation.</b></font><br>
|
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/MoveToLocation.</b></font><br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
@@ -3630,7 +3640,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
||||||
// to destination by GameTimeTaskManager
|
// to destination by GameTimeTaskManager
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
broadcastMoveToLocation();
|
broadcastMoveToLocation();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ public class RequestRecordInfo implements IClientIncomingPacket
|
|||||||
if (object.isCreature())
|
if (object.isCreature())
|
||||||
{
|
{
|
||||||
// Update the state of the Creature object client side by sending Server->Client packet
|
// Update the state of the Creature object client side by sending Server->Client packet
|
||||||
// MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance
|
// MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance
|
||||||
final Creature creature = (Creature) object;
|
final Creature creature = (Creature) object;
|
||||||
if (creature.hasAI())
|
if (creature.hasAI())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -480,7 +480,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToPawn/MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
if (pawn.isCreature())
|
if (pawn.isCreature())
|
||||||
{
|
{
|
||||||
if (_actor.isOnGeodataPath())
|
if (_actor.isOnGeodataPath())
|
||||||
@@ -514,7 +514,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation <i>(broadcast)</i>.<br>
|
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation <i>(broadcast)</i>.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@@ -532,7 +532,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
||||||
_actor.moveToLocation(x, y, z, 0);
|
_actor.moveToLocation(x, y, z, 0);
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
_actor.broadcastMoveToLocation();
|
_actor.broadcastMoveToLocation();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -679,7 +679,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param player The PlayerIstance to notify with state of this Creature
|
* @param player The PlayerIstance to notify with state of this Creature
|
||||||
*/
|
*/
|
||||||
@@ -694,7 +694,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
player.sendPacket(new MoveToLocation(_actor));
|
player.sendPacket(new MoveToLocation(_actor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -526,7 +526,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
y1 = (leader.getY() - y1) + minRadius;
|
y1 = (leader.getY() - y1) + minRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(x1, y1, leader.getZ());
|
moveTo(x1, y1, leader.getZ());
|
||||||
}
|
}
|
||||||
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
|
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
|
||||||
@@ -574,7 +574,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
z1 = npc.getZ();
|
z1 = npc.getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceWorld());
|
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceWorld());
|
||||||
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -379,7 +379,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -248,7 +248,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3142,6 +3142,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// Set the timer of last position update to now
|
// Set the timer of last position update to now
|
||||||
m._moveTimestamp = gameTicks;
|
m._moveTimestamp = gameTicks;
|
||||||
|
|
||||||
|
// Broadcast MoveToLocation when Playable tries to reach a Playable target (once per second).
|
||||||
|
if (isPlayable())
|
||||||
|
{
|
||||||
|
final WorldObject target = _target;
|
||||||
|
if ((target != null) && target.isPlayable() && ((gameTicks % 10) == 0) && (calculateDistance3D(target) > 150))
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (distFraction > 1)
|
if (distFraction > 1)
|
||||||
{
|
{
|
||||||
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
||||||
@@ -3282,7 +3292,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
||||||
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/CharMoveToLocation.</b></font><br>
|
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/MoveToLocation.</b></font><br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
@@ -3630,7 +3640,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
||||||
// to destination by GameTimeTaskManager
|
// to destination by GameTimeTaskManager
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
broadcastMoveToLocation();
|
broadcastMoveToLocation();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ public class RequestRecordInfo implements IClientIncomingPacket
|
|||||||
if (object.isCreature())
|
if (object.isCreature())
|
||||||
{
|
{
|
||||||
// Update the state of the Creature object client side by sending Server->Client packet
|
// Update the state of the Creature object client side by sending Server->Client packet
|
||||||
// MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance
|
// MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance
|
||||||
final Creature creature = (Creature) object;
|
final Creature creature = (Creature) object;
|
||||||
if (creature.hasAI())
|
if (creature.hasAI())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -480,7 +480,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToPawn/MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
if (pawn.isCreature())
|
if (pawn.isCreature())
|
||||||
{
|
{
|
||||||
if (_actor.isOnGeodataPath())
|
if (_actor.isOnGeodataPath())
|
||||||
@@ -514,7 +514,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation <i>(broadcast)</i>.<br>
|
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation <i>(broadcast)</i>.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@@ -532,7 +532,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
||||||
_actor.moveToLocation(x, y, z, 0);
|
_actor.moveToLocation(x, y, z, 0);
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
_actor.broadcastMoveToLocation();
|
_actor.broadcastMoveToLocation();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -679,7 +679,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param player The PlayerIstance to notify with state of this Creature
|
* @param player The PlayerIstance to notify with state of this Creature
|
||||||
*/
|
*/
|
||||||
@@ -694,7 +694,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
player.sendPacket(new MoveToLocation(_actor));
|
player.sendPacket(new MoveToLocation(_actor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -526,7 +526,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
y1 = (leader.getY() - y1) + minRadius;
|
y1 = (leader.getY() - y1) + minRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(x1, y1, leader.getZ());
|
moveTo(x1, y1, leader.getZ());
|
||||||
}
|
}
|
||||||
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
|
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
|
||||||
@@ -574,7 +574,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
z1 = npc.getZ();
|
z1 = npc.getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceWorld());
|
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceWorld());
|
||||||
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -379,7 +379,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -248,7 +248,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3142,6 +3142,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// Set the timer of last position update to now
|
// Set the timer of last position update to now
|
||||||
m._moveTimestamp = gameTicks;
|
m._moveTimestamp = gameTicks;
|
||||||
|
|
||||||
|
// Broadcast MoveToLocation when Playable tries to reach a Playable target (once per second).
|
||||||
|
if (isPlayable())
|
||||||
|
{
|
||||||
|
final WorldObject target = _target;
|
||||||
|
if ((target != null) && target.isPlayable() && ((gameTicks % 10) == 0) && (calculateDistance3D(target) > 150))
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (distFraction > 1)
|
if (distFraction > 1)
|
||||||
{
|
{
|
||||||
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
||||||
@@ -3282,7 +3292,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
||||||
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/CharMoveToLocation.</b></font><br>
|
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/MoveToLocation.</b></font><br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
@@ -3630,7 +3640,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
||||||
// to destination by GameTimeTaskManager
|
// to destination by GameTimeTaskManager
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
broadcastMoveToLocation();
|
broadcastMoveToLocation();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ public class RequestRecordInfo implements IClientIncomingPacket
|
|||||||
if (object.isCreature())
|
if (object.isCreature())
|
||||||
{
|
{
|
||||||
// Update the state of the Creature object client side by sending Server->Client packet
|
// Update the state of the Creature object client side by sending Server->Client packet
|
||||||
// MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance
|
// MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance
|
||||||
final Creature creature = (Creature) object;
|
final Creature creature = (Creature) object;
|
||||||
if (creature.hasAI())
|
if (creature.hasAI())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -480,7 +480,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToPawn/MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
if (pawn.isCreature())
|
if (pawn.isCreature())
|
||||||
{
|
{
|
||||||
if (_actor.isOnGeodataPath())
|
if (_actor.isOnGeodataPath())
|
||||||
@@ -514,7 +514,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation <i>(broadcast)</i>.<br>
|
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation <i>(broadcast)</i>.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@@ -532,7 +532,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
||||||
_actor.moveToLocation(x, y, z, 0);
|
_actor.moveToLocation(x, y, z, 0);
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
_actor.broadcastMoveToLocation();
|
_actor.broadcastMoveToLocation();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -679,7 +679,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param player The PlayerIstance to notify with state of this Creature
|
* @param player The PlayerIstance to notify with state of this Creature
|
||||||
*/
|
*/
|
||||||
@@ -694,7 +694,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
player.sendPacket(new MoveToLocation(_actor));
|
player.sendPacket(new MoveToLocation(_actor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -526,7 +526,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
y1 = (leader.getY() - y1) + minRadius;
|
y1 = (leader.getY() - y1) + minRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(x1, y1, leader.getZ());
|
moveTo(x1, y1, leader.getZ());
|
||||||
}
|
}
|
||||||
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
|
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
|
||||||
@@ -574,7 +574,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
z1 = npc.getZ();
|
z1 = npc.getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceWorld());
|
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceWorld());
|
||||||
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -379,7 +379,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -248,7 +248,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3142,6 +3142,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// Set the timer of last position update to now
|
// Set the timer of last position update to now
|
||||||
m._moveTimestamp = gameTicks;
|
m._moveTimestamp = gameTicks;
|
||||||
|
|
||||||
|
// Broadcast MoveToLocation when Playable tries to reach a Playable target (once per second).
|
||||||
|
if (isPlayable())
|
||||||
|
{
|
||||||
|
final WorldObject target = _target;
|
||||||
|
if ((target != null) && target.isPlayable() && ((gameTicks % 10) == 0) && (calculateDistance3D(target) > 150))
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (distFraction > 1)
|
if (distFraction > 1)
|
||||||
{
|
{
|
||||||
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
||||||
@@ -3282,7 +3292,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
||||||
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/CharMoveToLocation.</b></font><br>
|
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/MoveToLocation.</b></font><br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
@@ -3630,7 +3640,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
||||||
// to destination by GameTimeTaskManager
|
// to destination by GameTimeTaskManager
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
broadcastMoveToLocation();
|
broadcastMoveToLocation();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ public class RequestRecordInfo implements IClientIncomingPacket
|
|||||||
if (object.isCreature())
|
if (object.isCreature())
|
||||||
{
|
{
|
||||||
// Update the state of the Creature object client side by sending Server->Client packet
|
// Update the state of the Creature object client side by sending Server->Client packet
|
||||||
// MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance
|
// MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance
|
||||||
final Creature creature = (Creature) object;
|
final Creature creature = (Creature) object;
|
||||||
if (creature.hasAI())
|
if (creature.hasAI())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -480,7 +480,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToPawn/MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
if (pawn.isCreature())
|
if (pawn.isCreature())
|
||||||
{
|
{
|
||||||
if (_actor.isOnGeodataPath())
|
if (_actor.isOnGeodataPath())
|
||||||
@@ -514,7 +514,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation <i>(broadcast)</i>.<br>
|
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation <i>(broadcast)</i>.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@@ -532,7 +532,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
||||||
_actor.moveToLocation(x, y, z, 0);
|
_actor.moveToLocation(x, y, z, 0);
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
_actor.broadcastMoveToLocation();
|
_actor.broadcastMoveToLocation();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -679,7 +679,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param player The PlayerIstance to notify with state of this Creature
|
* @param player The PlayerIstance to notify with state of this Creature
|
||||||
*/
|
*/
|
||||||
@@ -694,7 +694,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
player.sendPacket(new MoveToLocation(_actor));
|
player.sendPacket(new MoveToLocation(_actor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -526,7 +526,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
y1 = (leader.getY() - y1) + minRadius;
|
y1 = (leader.getY() - y1) + minRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(x1, y1, leader.getZ());
|
moveTo(x1, y1, leader.getZ());
|
||||||
}
|
}
|
||||||
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
|
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
|
||||||
@@ -574,7 +574,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
z1 = npc.getZ();
|
z1 = npc.getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceWorld());
|
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceWorld());
|
||||||
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -379,7 +379,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -248,7 +248,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-2
@@ -3141,6 +3141,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// Set the timer of last position update to now
|
// Set the timer of last position update to now
|
||||||
m._moveTimestamp = gameTicks;
|
m._moveTimestamp = gameTicks;
|
||||||
|
|
||||||
|
// Broadcast MoveToLocation when Playable tries to reach a Playable target (once per second).
|
||||||
|
if (isPlayable())
|
||||||
|
{
|
||||||
|
final WorldObject target = _target;
|
||||||
|
if ((target != null) && target.isPlayable() && ((gameTicks % 10) == 0) && (calculateDistance3D(target) > 150))
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (distFraction > 1)
|
if (distFraction > 1)
|
||||||
{
|
{
|
||||||
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
||||||
@@ -3281,7 +3291,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
||||||
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/CharMoveToLocation.</b></font><br>
|
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/MoveToLocation.</b></font><br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
@@ -3629,7 +3639,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
||||||
// to destination by GameTimeTaskManager
|
// to destination by GameTimeTaskManager
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
broadcastMoveToLocation();
|
broadcastMoveToLocation();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ public class RequestRecordInfo implements IClientIncomingPacket
|
|||||||
if (object.isCreature())
|
if (object.isCreature())
|
||||||
{
|
{
|
||||||
// Update the state of the Creature object client side by sending Server->Client packet
|
// Update the state of the Creature object client side by sending Server->Client packet
|
||||||
// MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance
|
// MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance
|
||||||
final Creature creature = (Creature) object;
|
final Creature creature = (Creature) object;
|
||||||
if (creature.hasAI())
|
if (creature.hasAI())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -480,7 +480,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToPawn/MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
if (pawn.isCreature())
|
if (pawn.isCreature())
|
||||||
{
|
{
|
||||||
if (_actor.isOnGeodataPath())
|
if (_actor.isOnGeodataPath())
|
||||||
@@ -514,7 +514,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation <i>(broadcast)</i>.<br>
|
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation <i>(broadcast)</i>.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@@ -532,7 +532,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
||||||
_actor.moveToLocation(x, y, z, 0);
|
_actor.moveToLocation(x, y, z, 0);
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
_actor.broadcastMoveToLocation();
|
_actor.broadcastMoveToLocation();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -679,7 +679,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param player The PlayerIstance to notify with state of this Creature
|
* @param player The PlayerIstance to notify with state of this Creature
|
||||||
*/
|
*/
|
||||||
@@ -694,7 +694,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
player.sendPacket(new MoveToLocation(_actor));
|
player.sendPacket(new MoveToLocation(_actor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -526,7 +526,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
y1 = (leader.getY() - y1) + minRadius;
|
y1 = (leader.getY() - y1) + minRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(x1, y1, leader.getZ());
|
moveTo(x1, y1, leader.getZ());
|
||||||
}
|
}
|
||||||
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
|
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
|
||||||
@@ -574,7 +574,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
z1 = npc.getZ();
|
z1 = npc.getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceWorld());
|
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceWorld());
|
||||||
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -379,7 +379,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -248,7 +248,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3141,6 +3141,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// Set the timer of last position update to now
|
// Set the timer of last position update to now
|
||||||
m._moveTimestamp = gameTicks;
|
m._moveTimestamp = gameTicks;
|
||||||
|
|
||||||
|
// Broadcast MoveToLocation when Playable tries to reach a Playable target (once per second).
|
||||||
|
if (isPlayable())
|
||||||
|
{
|
||||||
|
final WorldObject target = _target;
|
||||||
|
if ((target != null) && target.isPlayable() && ((gameTicks % 10) == 0) && (calculateDistance3D(target) > 150))
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (distFraction > 1)
|
if (distFraction > 1)
|
||||||
{
|
{
|
||||||
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
||||||
@@ -3281,7 +3291,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
||||||
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/CharMoveToLocation.</b></font><br>
|
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/MoveToLocation.</b></font><br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
@@ -3629,7 +3639,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
||||||
// to destination by GameTimeTaskManager
|
// to destination by GameTimeTaskManager
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
broadcastMoveToLocation();
|
broadcastMoveToLocation();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ public class RequestRecordInfo implements IClientIncomingPacket
|
|||||||
if (object.isCreature())
|
if (object.isCreature())
|
||||||
{
|
{
|
||||||
// Update the state of the Creature object client side by sending Server->Client packet
|
// Update the state of the Creature object client side by sending Server->Client packet
|
||||||
// MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance
|
// MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance
|
||||||
final Creature creature = (Creature) object;
|
final Creature creature = (Creature) object;
|
||||||
if (creature.hasAI())
|
if (creature.hasAI())
|
||||||
{
|
{
|
||||||
|
|||||||
+5
-5
@@ -480,7 +480,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToPawn/MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
if (pawn.isCreature())
|
if (pawn.isCreature())
|
||||||
{
|
{
|
||||||
if (_actor.isOnGeodataPath())
|
if (_actor.isOnGeodataPath())
|
||||||
@@ -514,7 +514,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation <i>(broadcast)</i>.<br>
|
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation <i>(broadcast)</i>.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@@ -532,7 +532,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
||||||
_actor.moveToLocation(x, y, z, 0);
|
_actor.moveToLocation(x, y, z, 0);
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
_actor.broadcastMoveToLocation();
|
_actor.broadcastMoveToLocation();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -679,7 +679,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param player The PlayerIstance to notify with state of this Creature
|
* @param player The PlayerIstance to notify with state of this Creature
|
||||||
*/
|
*/
|
||||||
@@ -694,7 +694,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
player.sendPacket(new MoveToLocation(_actor));
|
player.sendPacket(new MoveToLocation(_actor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -526,7 +526,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
y1 = (leader.getY() - y1) + minRadius;
|
y1 = (leader.getY() - y1) + minRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(x1, y1, leader.getZ());
|
moveTo(x1, y1, leader.getZ());
|
||||||
}
|
}
|
||||||
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
|
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
|
||||||
@@ -574,7 +574,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
z1 = npc.getZ();
|
z1 = npc.getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceWorld());
|
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceWorld());
|
||||||
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -350,7 +350,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -379,7 +379,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -248,7 +248,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-2
@@ -3141,6 +3141,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// Set the timer of last position update to now
|
// Set the timer of last position update to now
|
||||||
m._moveTimestamp = gameTicks;
|
m._moveTimestamp = gameTicks;
|
||||||
|
|
||||||
|
// Broadcast MoveToLocation when Playable tries to reach a Playable target (once per second).
|
||||||
|
if (isPlayable())
|
||||||
|
{
|
||||||
|
final WorldObject target = _target;
|
||||||
|
if ((target != null) && target.isPlayable() && ((gameTicks % 10) == 0) && (calculateDistance3D(target) > 150))
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (distFraction > 1)
|
if (distFraction > 1)
|
||||||
{
|
{
|
||||||
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
||||||
@@ -3281,7 +3291,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
||||||
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/CharMoveToLocation.</b></font><br>
|
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/MoveToLocation.</b></font><br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
@@ -3629,7 +3639,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
||||||
// to destination by GameTimeTaskManager
|
// to destination by GameTimeTaskManager
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
broadcastMoveToLocation();
|
broadcastMoveToLocation();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ public class RequestRecordInfo implements IClientIncomingPacket
|
|||||||
if (object.isCreature())
|
if (object.isCreature())
|
||||||
{
|
{
|
||||||
// Update the state of the Creature object client side by sending Server->Client packet
|
// Update the state of the Creature object client side by sending Server->Client packet
|
||||||
// MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance
|
// MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance
|
||||||
final Creature creature = (Creature) object;
|
final Creature creature = (Creature) object;
|
||||||
if (creature.hasAI())
|
if (creature.hasAI())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -480,7 +480,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToPawn/MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
if (pawn.isCreature())
|
if (pawn.isCreature())
|
||||||
{
|
{
|
||||||
if (_actor.isOnGeodataPath())
|
if (_actor.isOnGeodataPath())
|
||||||
@@ -514,7 +514,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation <i>(broadcast)</i>.<br>
|
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation <i>(broadcast)</i>.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@@ -532,7 +532,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
||||||
_actor.moveToLocation(x, y, z, 0);
|
_actor.moveToLocation(x, y, z, 0);
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
_actor.broadcastMoveToLocation();
|
_actor.broadcastMoveToLocation();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -679,7 +679,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param player The PlayerIstance to notify with state of this Creature
|
* @param player The PlayerIstance to notify with state of this Creature
|
||||||
*/
|
*/
|
||||||
@@ -694,7 +694,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
player.sendPacket(new MoveToLocation(_actor));
|
player.sendPacket(new MoveToLocation(_actor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -526,7 +526,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
y1 = (leader.getY() - y1) + minRadius;
|
y1 = (leader.getY() - y1) + minRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(x1, y1, leader.getZ());
|
moveTo(x1, y1, leader.getZ());
|
||||||
}
|
}
|
||||||
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
|
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
|
||||||
@@ -574,7 +574,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
z1 = npc.getZ();
|
z1 = npc.getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceWorld());
|
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceWorld());
|
||||||
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -379,7 +379,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -248,7 +248,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-2
@@ -3141,6 +3141,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// Set the timer of last position update to now
|
// Set the timer of last position update to now
|
||||||
m._moveTimestamp = gameTicks;
|
m._moveTimestamp = gameTicks;
|
||||||
|
|
||||||
|
// Broadcast MoveToLocation when Playable tries to reach a Playable target (once per second).
|
||||||
|
if (isPlayable())
|
||||||
|
{
|
||||||
|
final WorldObject target = _target;
|
||||||
|
if ((target != null) && target.isPlayable() && ((gameTicks % 10) == 0) && (calculateDistance3D(target) > 150))
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (distFraction > 1)
|
if (distFraction > 1)
|
||||||
{
|
{
|
||||||
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
||||||
@@ -3281,7 +3291,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
||||||
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/CharMoveToLocation.</b></font><br>
|
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/MoveToLocation.</b></font><br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
@@ -3629,7 +3639,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
||||||
// to destination by GameTimeTaskManager
|
// to destination by GameTimeTaskManager
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
broadcastMoveToLocation();
|
broadcastMoveToLocation();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ public class RequestRecordInfo implements IClientIncomingPacket
|
|||||||
if (object.isCreature())
|
if (object.isCreature())
|
||||||
{
|
{
|
||||||
// Update the state of the Creature object client side by sending Server->Client packet
|
// Update the state of the Creature object client side by sending Server->Client packet
|
||||||
// MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance
|
// MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance
|
||||||
final Creature creature = (Creature) object;
|
final Creature creature = (Creature) object;
|
||||||
if (creature.hasAI())
|
if (creature.hasAI())
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -33,7 +33,7 @@ import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
|||||||
import org.l2jmobius.gameserver.network.serverpackets.Attack;
|
import org.l2jmobius.gameserver.network.serverpackets.Attack;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.AutoAttackStart;
|
import org.l2jmobius.gameserver.network.serverpackets.AutoAttackStart;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.AutoAttackStop;
|
import org.l2jmobius.gameserver.network.serverpackets.AutoAttackStop;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.CharMoveToLocation;
|
import org.l2jmobius.gameserver.network.serverpackets.MoveToLocation;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.Die;
|
import org.l2jmobius.gameserver.network.serverpackets.Die;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.FinishRotation;
|
import org.l2jmobius.gameserver.network.serverpackets.FinishRotation;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.MoveToPawn;
|
import org.l2jmobius.gameserver.network.serverpackets.MoveToPawn;
|
||||||
@@ -845,7 +845,7 @@ public abstract class Creature extends WorldObject
|
|||||||
setPawnTarget(null);
|
setPawnTarget(null);
|
||||||
}
|
}
|
||||||
calculateMovement(x, y, z, distance);
|
calculateMovement(x, y, z, distance);
|
||||||
final CharMoveToLocation mov = new CharMoveToLocation(this);
|
final MoveToLocation mov = new MoveToLocation(this);
|
||||||
if (getCurrentState() == CreatureState.CASTING)
|
if (getCurrentState() == CreatureState.CASTING)
|
||||||
{
|
{
|
||||||
setCurrentState(CreatureState.IDLE);
|
setCurrentState(CreatureState.IDLE);
|
||||||
|
|||||||
+2
-2
@@ -54,7 +54,7 @@ import org.l2jmobius.gameserver.network.Connection;
|
|||||||
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ChangeWaitType;
|
import org.l2jmobius.gameserver.network.serverpackets.ChangeWaitType;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.CharInfo;
|
import org.l2jmobius.gameserver.network.serverpackets.CharInfo;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.CharMoveToLocation;
|
import org.l2jmobius.gameserver.network.serverpackets.MoveToLocation;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.DeleteObject;
|
import org.l2jmobius.gameserver.network.serverpackets.DeleteObject;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.GetItem;
|
import org.l2jmobius.gameserver.network.serverpackets.GetItem;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
|
import org.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
|
||||||
@@ -1119,7 +1119,7 @@ public class PlayerInstance extends Creature
|
|||||||
final Creature obj = (Creature) object;
|
final Creature obj = (Creature) object;
|
||||||
if (obj.isMoving())
|
if (obj.isMoving())
|
||||||
{
|
{
|
||||||
sendPacket(new CharMoveToLocation(obj));
|
sendPacket(new MoveToLocation(obj));
|
||||||
}
|
}
|
||||||
else if (obj.isMovingToPawn())
|
else if (obj.isMovingToPawn())
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -19,11 +19,11 @@ package org.l2jmobius.gameserver.network.serverpackets;
|
|||||||
|
|
||||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||||
|
|
||||||
public class CharMoveToLocation extends ServerBasePacket
|
public class MoveToLocation extends ServerBasePacket
|
||||||
{
|
{
|
||||||
private final Creature _cha;
|
private final Creature _cha;
|
||||||
|
|
||||||
public CharMoveToLocation(Creature cha)
|
public MoveToLocation(Creature cha)
|
||||||
{
|
{
|
||||||
_cha = cha;
|
_cha = cha;
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
|||||||
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.AutoAttackStart;
|
import org.l2jmobius.gameserver.network.serverpackets.AutoAttackStart;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.AutoAttackStop;
|
import org.l2jmobius.gameserver.network.serverpackets.AutoAttackStop;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.CharMoveToLocation;
|
import org.l2jmobius.gameserver.network.serverpackets.MoveToLocation;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.Die;
|
import org.l2jmobius.gameserver.network.serverpackets.Die;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.MoveToLocationInVehicle;
|
import org.l2jmobius.gameserver.network.serverpackets.MoveToLocationInVehicle;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.MoveToPawn;
|
import org.l2jmobius.gameserver.network.serverpackets.MoveToPawn;
|
||||||
@@ -483,7 +483,7 @@ abstract class AbstractAI implements Ctrl
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToPawn/MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
if (pawn instanceof Creature)
|
if (pawn instanceof Creature)
|
||||||
{
|
{
|
||||||
if (_actor.isOnGeodataPath())
|
if (_actor.isOnGeodataPath())
|
||||||
@@ -512,7 +512,7 @@ abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation <i>(broadcast)</i>.<br>
|
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation <i>(broadcast)</i>.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@@ -530,7 +530,7 @@ abstract class AbstractAI implements Ctrl
|
|||||||
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
||||||
_accessor.moveTo(x, y, z);
|
_accessor.moveTo(x, y, z);
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
_actor.broadcastMoveToLocation();
|
_actor.broadcastMoveToLocation();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -544,8 +544,8 @@ abstract class AbstractAI implements Ctrl
|
|||||||
// Chek if actor can move
|
// Chek if actor can move
|
||||||
if (!_actor.isMovementDisabled())
|
if (!_actor.isMovementDisabled())
|
||||||
{
|
{
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
// CharMoveToLocation msg = new CharMoveToLocation(_actor);
|
// MoveToLocation msg = new MoveToLocation(_actor);
|
||||||
if (((PlayerInstance) _actor).getBoat() != null)
|
if (((PlayerInstance) _actor).getBoat() != null)
|
||||||
{
|
{
|
||||||
_actor.broadcastPacket(new MoveToLocationInVehicle(_actor, destination, origin));
|
_actor.broadcastPacket(new MoveToLocationInVehicle(_actor, destination, origin));
|
||||||
@@ -687,7 +687,7 @@ abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param player The PlayerIstance to notify with state of this Creature
|
* @param player The PlayerIstance to notify with state of this Creature
|
||||||
*/
|
*/
|
||||||
@@ -702,8 +702,8 @@ abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
player.sendPacket(new CharMoveToLocation(_actor));
|
player.sendPacket(new MoveToLocation(_actor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -530,7 +530,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
x1 = (((MinionInstance) _actor).getLeader().getX() + Rnd.get((offset - 30) * 2)) - (offset - 30);
|
x1 = (((MinionInstance) _actor).getLeader().getX() + Rnd.get((offset - 30) * 2)) - (offset - 30);
|
||||||
y1 = (((MinionInstance) _actor).getLeader().getY() + Rnd.get((offset - 30) * 2)) - (offset - 30);
|
y1 = (((MinionInstance) _actor).getLeader().getY() + Rnd.get((offset - 30) * 2)) - (offset - 30);
|
||||||
z1 = ((MinionInstance) _actor).getLeader().getZ();
|
z1 = ((MinionInstance) _actor).getLeader().getZ();
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(x1, y1, z1);
|
moveTo(x1, y1, z1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -355,7 +355,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(pos.getX(), pos.getY(), pos.getZ());
|
moveTo(pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -390,7 +390,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveToInABoat(destination, origin);
|
moveToInABoat(destination, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+16
-5
@@ -103,13 +103,13 @@ import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
|||||||
import org.l2jmobius.gameserver.network.serverpackets.Attack;
|
import org.l2jmobius.gameserver.network.serverpackets.Attack;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ChangeMoveType;
|
import org.l2jmobius.gameserver.network.serverpackets.ChangeMoveType;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ChangeWaitType;
|
import org.l2jmobius.gameserver.network.serverpackets.ChangeWaitType;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.CharMoveToLocation;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ExOlympiadSpelledInfo;
|
import org.l2jmobius.gameserver.network.serverpackets.ExOlympiadSpelledInfo;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.MagicEffectIcons;
|
import org.l2jmobius.gameserver.network.serverpackets.MagicEffectIcons;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.MagicSkillCanceld;
|
import org.l2jmobius.gameserver.network.serverpackets.MagicSkillCanceld;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.MagicSkillLaunched;
|
import org.l2jmobius.gameserver.network.serverpackets.MagicSkillLaunched;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
|
import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.MoveToLocation;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.MyTargetSelected;
|
import org.l2jmobius.gameserver.network.serverpackets.MyTargetSelected;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.NpcInfo;
|
import org.l2jmobius.gameserver.network.serverpackets.NpcInfo;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.PartySpelled;
|
import org.l2jmobius.gameserver.network.serverpackets.PartySpelled;
|
||||||
@@ -385,14 +385,14 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
{
|
{
|
||||||
if (isPlayable())
|
if (isPlayable())
|
||||||
{
|
{
|
||||||
broadcastPacket(new CharMoveToLocation(this));
|
broadcastPacket(new MoveToLocation(this));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
final WorldRegion region = getWorldRegion();
|
||||||
if ((region != null) && region.areNeighborsActive())
|
if ((region != null) && region.areNeighborsActive())
|
||||||
{
|
{
|
||||||
broadcastPacket(new CharMoveToLocation(this));
|
broadcastPacket(new MoveToLocation(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4989,6 +4989,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
|
|
||||||
// Set the timer of last position update to now
|
// Set the timer of last position update to now
|
||||||
m._moveTimestamp = gameTicks;
|
m._moveTimestamp = gameTicks;
|
||||||
|
|
||||||
|
// Broadcast MoveToLocation when Playable tries to reach a Playable target (once per second).
|
||||||
|
if (isPlayable())
|
||||||
|
{
|
||||||
|
final WorldObject target = _target;
|
||||||
|
if ((target != null) && target.isPlayable() && ((gameTicks % 10) == 0) && (calculateDistance3D(target.getLocation()) > 150))
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return distFraction > 1;
|
return distFraction > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5157,7 +5168,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
* <li>Set the Creature _move object to MoveData object</li>
|
* <li>Set the Creature _move object to MoveData object</li>
|
||||||
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
||||||
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li><br>
|
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li><br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/CharMoveToLocation </b></font><br>
|
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/MoveToLocation </b></font><br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b><br>
|
* <b><u>Example of use</u>:</b><br>
|
||||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||||
@@ -5530,7 +5541,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
|
|
||||||
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive to destination by GameTimeTaskManager
|
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive to destination by GameTimeTaskManager
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
broadcastMoveToLocation();
|
broadcastMoveToLocation();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -64,20 +64,20 @@ public class PlayerKnownList extends PlayableKnownList
|
|||||||
* <br>
|
* <br>
|
||||||
* <b><u>object is a DoorInstance</u>:</b><br>
|
* <b><u>object is a DoorInstance</u>:</b><br>
|
||||||
* <li>Send Server-Client Packets DoorInfo and DoorStatusUpdate to the PlayerInstance</li>
|
* <li>Send Server-Client Packets DoorInfo and DoorStatusUpdate to the PlayerInstance</li>
|
||||||
* <li>Send Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance</li><br>
|
* <li>Send Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance</li><br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>object is a NpcInstance</u>:</b><br>
|
* <b><u>object is a NpcInstance</u>:</b><br>
|
||||||
* <li>Send Server-Client Packet NpcInfo to the PlayerInstance</li>
|
* <li>Send Server-Client Packet NpcInfo to the PlayerInstance</li>
|
||||||
* <li>Send Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance</li><br>
|
* <li>Send Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance</li><br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>object is a Summon</u>:</b><br>
|
* <b><u>object is a Summon</u>:</b><br>
|
||||||
* <li>Send Server-Client Packet NpcInfo/PetItemList (if the PlayerInstance is the owner) to the PlayerInstance</li>
|
* <li>Send Server-Client Packet NpcInfo/PetItemList (if the PlayerInstance is the owner) to the PlayerInstance</li>
|
||||||
* <li>Send Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance</li><br>
|
* <li>Send Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance</li><br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>object is a PlayerInstance</u>:</b><br>
|
* <b><u>object is a PlayerInstance</u>:</b><br>
|
||||||
* <li>Send Server-Client Packet CharInfo to the PlayerInstance</li>
|
* <li>Send Server-Client Packet CharInfo to the PlayerInstance</li>
|
||||||
* <li>If the object has a private store, Send Server-Client Packet PrivateStoreMsgSell to the PlayerInstance</li>
|
* <li>If the object has a private store, Send Server-Client Packet PrivateStoreMsgSell to the PlayerInstance</li>
|
||||||
* <li>Send Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance</li><br>
|
* <li>Send Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance</li><br>
|
||||||
* @param object The WorldObject to add to _knownObjects and _knownPlayer
|
* @param object The WorldObject to add to _knownObjects and _knownPlayer
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -225,7 +225,7 @@ public class PlayerKnownList extends PlayableKnownList
|
|||||||
|
|
||||||
if (object.isCreature())
|
if (object.isCreature())
|
||||||
{
|
{
|
||||||
// Update the state of the Creature object client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance
|
// Update the state of the Creature object client side by sending Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance
|
||||||
final Creature obj = (Creature) object;
|
final Creature obj = (Creature) object;
|
||||||
final CreatureAI objAi = obj.getAI();
|
final CreatureAI objAi = obj.getAI();
|
||||||
if (objAi != null)
|
if (objAi != null)
|
||||||
|
|||||||
+1
-1
@@ -147,7 +147,7 @@ public class RequestRecordInfo implements IClientIncomingPacket
|
|||||||
|
|
||||||
if (object instanceof Creature)
|
if (object instanceof Creature)
|
||||||
{
|
{
|
||||||
// Update the state of the Creature object client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance
|
// Update the state of the Creature object client side by sending Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance
|
||||||
final Creature obj = (Creature) object;
|
final Creature obj = (Creature) object;
|
||||||
if (obj.hasAI())
|
if (obj.hasAI())
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -24,7 +24,7 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
|||||||
* 0000: 01 7a 73 10 4c b2 0b 00 00 a3 fc 00 00 e8 f1 ff .zs.L........... 0010: ff bd 0b 00 00 b3 fc 00 00 e8 f1 ff ff ............. ddddddd
|
* 0000: 01 7a 73 10 4c b2 0b 00 00 a3 fc 00 00 e8 f1 ff .zs.L........... 0010: ff bd 0b 00 00 b3 fc 00 00 e8 f1 ff ff ............. ddddddd
|
||||||
* @version $Revision: 1.3.4.3 $ $Date: 2005/03/27 15:29:57 $
|
* @version $Revision: 1.3.4.3 $ $Date: 2005/03/27 15:29:57 $
|
||||||
*/
|
*/
|
||||||
public class CharMoveToLocation implements IClientOutgoingPacket
|
public class MoveToLocation implements IClientOutgoingPacket
|
||||||
{
|
{
|
||||||
private final int _objectId;
|
private final int _objectId;
|
||||||
private final int _x;
|
private final int _x;
|
||||||
@@ -34,7 +34,7 @@ public class CharMoveToLocation implements IClientOutgoingPacket
|
|||||||
private final int _yDst;
|
private final int _yDst;
|
||||||
private final int _zDst;
|
private final int _zDst;
|
||||||
|
|
||||||
public CharMoveToLocation(Creature creature)
|
public MoveToLocation(Creature creature)
|
||||||
{
|
{
|
||||||
_objectId = creature.getObjectId();
|
_objectId = creature.getObjectId();
|
||||||
_x = creature.getX();
|
_x = creature.getX();
|
||||||
@@ -33,7 +33,7 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
|||||||
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.AutoAttackStart;
|
import org.l2jmobius.gameserver.network.serverpackets.AutoAttackStart;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.AutoAttackStop;
|
import org.l2jmobius.gameserver.network.serverpackets.AutoAttackStop;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.CharMoveToLocation;
|
import org.l2jmobius.gameserver.network.serverpackets.MoveToLocation;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.Die;
|
import org.l2jmobius.gameserver.network.serverpackets.Die;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.MoveToLocationInVehicle;
|
import org.l2jmobius.gameserver.network.serverpackets.MoveToLocationInVehicle;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.MoveToPawn;
|
import org.l2jmobius.gameserver.network.serverpackets.MoveToPawn;
|
||||||
@@ -483,7 +483,7 @@ abstract class AbstractAI implements Ctrl
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToPawn/MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
if (pawn instanceof Creature)
|
if (pawn instanceof Creature)
|
||||||
{
|
{
|
||||||
if (_actor.isOnGeodataPath())
|
if (_actor.isOnGeodataPath())
|
||||||
@@ -512,7 +512,7 @@ abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation <i>(broadcast)</i>.<br>
|
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation <i>(broadcast)</i>.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@@ -530,7 +530,7 @@ abstract class AbstractAI implements Ctrl
|
|||||||
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
||||||
_accessor.moveTo(x, y, z);
|
_accessor.moveTo(x, y, z);
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
_actor.broadcastMoveToLocation();
|
_actor.broadcastMoveToLocation();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -544,8 +544,8 @@ abstract class AbstractAI implements Ctrl
|
|||||||
// Chek if actor can move
|
// Chek if actor can move
|
||||||
if (!_actor.isMovementDisabled())
|
if (!_actor.isMovementDisabled())
|
||||||
{
|
{
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
// CharMoveToLocation msg = new CharMoveToLocation(_actor);
|
// MoveToLocation msg = new MoveToLocation(_actor);
|
||||||
if (((PlayerInstance) _actor).getBoat() != null)
|
if (((PlayerInstance) _actor).getBoat() != null)
|
||||||
{
|
{
|
||||||
_actor.broadcastPacket(new MoveToLocationInVehicle(_actor, destination, origin));
|
_actor.broadcastPacket(new MoveToLocationInVehicle(_actor, destination, origin));
|
||||||
@@ -687,7 +687,7 @@ abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param player The PlayerIstance to notify with state of this Creature
|
* @param player The PlayerIstance to notify with state of this Creature
|
||||||
*/
|
*/
|
||||||
@@ -702,8 +702,8 @@ abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
player.sendPacket(new CharMoveToLocation(_actor));
|
player.sendPacket(new MoveToLocation(_actor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -530,7 +530,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
x1 = (((MinionInstance) _actor).getLeader().getX() + Rnd.get((offset - 30) * 2)) - (offset - 30);
|
x1 = (((MinionInstance) _actor).getLeader().getX() + Rnd.get((offset - 30) * 2)) - (offset - 30);
|
||||||
y1 = (((MinionInstance) _actor).getLeader().getY() + Rnd.get((offset - 30) * 2)) - (offset - 30);
|
y1 = (((MinionInstance) _actor).getLeader().getY() + Rnd.get((offset - 30) * 2)) - (offset - 30);
|
||||||
z1 = ((MinionInstance) _actor).getLeader().getZ();
|
z1 = ((MinionInstance) _actor).getLeader().getZ();
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(x1, y1, z1);
|
moveTo(x1, y1, z1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -355,7 +355,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(pos.getX(), pos.getY(), pos.getZ());
|
moveTo(pos.getX(), pos.getY(), pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -390,7 +390,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveToInABoat(destination, origin);
|
moveToInABoat(destination, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -105,13 +105,13 @@ import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
|||||||
import org.l2jmobius.gameserver.network.serverpackets.Attack;
|
import org.l2jmobius.gameserver.network.serverpackets.Attack;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ChangeMoveType;
|
import org.l2jmobius.gameserver.network.serverpackets.ChangeMoveType;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ChangeWaitType;
|
import org.l2jmobius.gameserver.network.serverpackets.ChangeWaitType;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.CharMoveToLocation;
|
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.ExOlympiadSpelledInfo;
|
import org.l2jmobius.gameserver.network.serverpackets.ExOlympiadSpelledInfo;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.MagicEffectIcons;
|
import org.l2jmobius.gameserver.network.serverpackets.MagicEffectIcons;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.MagicSkillCanceld;
|
import org.l2jmobius.gameserver.network.serverpackets.MagicSkillCanceld;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.MagicSkillLaunched;
|
import org.l2jmobius.gameserver.network.serverpackets.MagicSkillLaunched;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
|
import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
|
||||||
|
import org.l2jmobius.gameserver.network.serverpackets.MoveToLocation;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.MyTargetSelected;
|
import org.l2jmobius.gameserver.network.serverpackets.MyTargetSelected;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.NpcInfo;
|
import org.l2jmobius.gameserver.network.serverpackets.NpcInfo;
|
||||||
import org.l2jmobius.gameserver.network.serverpackets.PartySpelled;
|
import org.l2jmobius.gameserver.network.serverpackets.PartySpelled;
|
||||||
@@ -387,14 +387,14 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
{
|
{
|
||||||
if (isPlayable())
|
if (isPlayable())
|
||||||
{
|
{
|
||||||
broadcastPacket(new CharMoveToLocation(this));
|
broadcastPacket(new MoveToLocation(this));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
final WorldRegion region = getWorldRegion();
|
final WorldRegion region = getWorldRegion();
|
||||||
if ((region != null) && region.areNeighborsActive())
|
if ((region != null) && region.areNeighborsActive())
|
||||||
{
|
{
|
||||||
broadcastPacket(new CharMoveToLocation(this));
|
broadcastPacket(new MoveToLocation(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5035,6 +5035,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
|
|
||||||
// Set the timer of last position update to now
|
// Set the timer of last position update to now
|
||||||
m._moveTimestamp = gameTicks;
|
m._moveTimestamp = gameTicks;
|
||||||
|
|
||||||
|
// Broadcast MoveToLocation when Playable tries to reach a Playable target (once per second).
|
||||||
|
if (isPlayable())
|
||||||
|
{
|
||||||
|
final WorldObject target = _target;
|
||||||
|
if ((target != null) && target.isPlayable() && ((gameTicks % 10) == 0) && (calculateDistance3D(target.getLocation()) > 150))
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return distFraction > 1;
|
return distFraction > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5203,7 +5214,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
* <li>Set the Creature _move object to MoveData object</li>
|
* <li>Set the Creature _move object to MoveData object</li>
|
||||||
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
||||||
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li><br>
|
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li><br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/CharMoveToLocation </b></font><br>
|
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/MoveToLocation </b></font><br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b><br>
|
* <b><u>Example of use</u>:</b><br>
|
||||||
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||||
@@ -5576,7 +5587,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
|||||||
|
|
||||||
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive to destination by GameTimeTaskManager
|
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive to destination by GameTimeTaskManager
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
broadcastMoveToLocation();
|
broadcastMoveToLocation();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -64,20 +64,20 @@ public class PlayerKnownList extends PlayableKnownList
|
|||||||
* <br>
|
* <br>
|
||||||
* <b><u>object is a DoorInstance</u>:</b><br>
|
* <b><u>object is a DoorInstance</u>:</b><br>
|
||||||
* <li>Send Server-Client Packets DoorInfo and DoorStatusUpdate to the PlayerInstance</li>
|
* <li>Send Server-Client Packets DoorInfo and DoorStatusUpdate to the PlayerInstance</li>
|
||||||
* <li>Send Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance</li><br>
|
* <li>Send Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance</li><br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>object is a NpcInstance</u>:</b><br>
|
* <b><u>object is a NpcInstance</u>:</b><br>
|
||||||
* <li>Send Server-Client Packet NpcInfo to the PlayerInstance</li>
|
* <li>Send Server-Client Packet NpcInfo to the PlayerInstance</li>
|
||||||
* <li>Send Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance</li><br>
|
* <li>Send Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance</li><br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>object is a Summon</u>:</b><br>
|
* <b><u>object is a Summon</u>:</b><br>
|
||||||
* <li>Send Server-Client Packet NpcInfo/PetItemList (if the PlayerInstance is the owner) to the PlayerInstance</li>
|
* <li>Send Server-Client Packet NpcInfo/PetItemList (if the PlayerInstance is the owner) to the PlayerInstance</li>
|
||||||
* <li>Send Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance</li><br>
|
* <li>Send Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance</li><br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>object is a PlayerInstance</u>:</b><br>
|
* <b><u>object is a PlayerInstance</u>:</b><br>
|
||||||
* <li>Send Server-Client Packet CharInfo to the PlayerInstance</li>
|
* <li>Send Server-Client Packet CharInfo to the PlayerInstance</li>
|
||||||
* <li>If the object has a private store, Send Server-Client Packet PrivateStoreMsgSell to the PlayerInstance</li>
|
* <li>If the object has a private store, Send Server-Client Packet PrivateStoreMsgSell to the PlayerInstance</li>
|
||||||
* <li>Send Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance</li><br>
|
* <li>Send Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance</li><br>
|
||||||
* @param object The WorldObject to add to _knownObjects and _knownPlayer
|
* @param object The WorldObject to add to _knownObjects and _knownPlayer
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -225,7 +225,7 @@ public class PlayerKnownList extends PlayableKnownList
|
|||||||
|
|
||||||
if (object.isCreature())
|
if (object.isCreature())
|
||||||
{
|
{
|
||||||
// Update the state of the Creature object client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance
|
// Update the state of the Creature object client side by sending Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance
|
||||||
final Creature obj = (Creature) object;
|
final Creature obj = (Creature) object;
|
||||||
final CreatureAI objAi = obj.getAI();
|
final CreatureAI objAi = obj.getAI();
|
||||||
if (objAi != null)
|
if (objAi != null)
|
||||||
|
|||||||
+1
-1
@@ -147,7 +147,7 @@ public class RequestRecordInfo implements IClientIncomingPacket
|
|||||||
|
|
||||||
if (object instanceof Creature)
|
if (object instanceof Creature)
|
||||||
{
|
{
|
||||||
// Update the state of the Creature object client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance
|
// Update the state of the Creature object client side by sending Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance
|
||||||
final Creature obj = (Creature) object;
|
final Creature obj = (Creature) object;
|
||||||
if (obj.hasAI())
|
if (obj.hasAI())
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -24,7 +24,7 @@ import org.l2jmobius.gameserver.network.OutgoingPackets;
|
|||||||
* 0000: 01 7a 73 10 4c b2 0b 00 00 a3 fc 00 00 e8 f1 ff .zs.L........... 0010: ff bd 0b 00 00 b3 fc 00 00 e8 f1 ff ff ............. ddddddd
|
* 0000: 01 7a 73 10 4c b2 0b 00 00 a3 fc 00 00 e8 f1 ff .zs.L........... 0010: ff bd 0b 00 00 b3 fc 00 00 e8 f1 ff ff ............. ddddddd
|
||||||
* @version $Revision: 1.3.4.3 $ $Date: 2005/03/27 15:29:57 $
|
* @version $Revision: 1.3.4.3 $ $Date: 2005/03/27 15:29:57 $
|
||||||
*/
|
*/
|
||||||
public class CharMoveToLocation implements IClientOutgoingPacket
|
public class MoveToLocation implements IClientOutgoingPacket
|
||||||
{
|
{
|
||||||
private final int _objectId;
|
private final int _objectId;
|
||||||
private final int _x;
|
private final int _x;
|
||||||
@@ -34,7 +34,7 @@ public class CharMoveToLocation implements IClientOutgoingPacket
|
|||||||
private final int _yDst;
|
private final int _yDst;
|
||||||
private final int _zDst;
|
private final int _zDst;
|
||||||
|
|
||||||
public CharMoveToLocation(Creature creature)
|
public MoveToLocation(Creature creature)
|
||||||
{
|
{
|
||||||
_objectId = creature.getObjectId();
|
_objectId = creature.getObjectId();
|
||||||
_x = creature.getX();
|
_x = creature.getX();
|
||||||
@@ -527,7 +527,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToPawn/MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
if (pawn.isCreature())
|
if (pawn.isCreature())
|
||||||
{
|
{
|
||||||
if (_actor.isOnGeodataPath())
|
if (_actor.isOnGeodataPath())
|
||||||
@@ -561,7 +561,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation <i>(broadcast)</i>.<br>
|
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation <i>(broadcast)</i>.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@@ -579,7 +579,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
||||||
_actor.moveToLocation(x, y, z, 0);
|
_actor.moveToLocation(x, y, z, 0);
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
_actor.broadcastMoveToLocation();
|
_actor.broadcastMoveToLocation();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -729,7 +729,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param player The PlayerIstance to notify with state of this Creature
|
* @param player The PlayerIstance to notify with state of this Creature
|
||||||
*/
|
*/
|
||||||
@@ -744,7 +744,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
player.sendPacket(new MoveToLocation(_actor));
|
player.sendPacket(new MoveToLocation(_actor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -663,7 +663,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
x1 = x1 > (offset + minRadius) ? (leader.getX() + x1) - offset : (leader.getX() - x1) + minRadius;
|
x1 = x1 > (offset + minRadius) ? (leader.getX() + x1) - offset : (leader.getX() - x1) + minRadius;
|
||||||
y1 = y1 > (offset + minRadius) ? (leader.getY() + y1) - offset : (leader.getY() - y1) + minRadius;
|
y1 = y1 > (offset + minRadius) ? (leader.getY() + y1) - offset : (leader.getY() - y1) + minRadius;
|
||||||
z1 = leader.getZ();
|
z1 = leader.getZ();
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(x1, y1, z1);
|
moveTo(x1, y1, z1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -708,7 +708,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
z1 = npc.getZ();
|
z1 = npc.getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceId());
|
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceId());
|
||||||
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -340,7 +340,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -362,7 +362,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -227,7 +227,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4100,6 +4100,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// Set the timer of last position update to now
|
// Set the timer of last position update to now
|
||||||
m._moveTimestamp = gameTicks;
|
m._moveTimestamp = gameTicks;
|
||||||
|
|
||||||
|
// Broadcast MoveToLocation when Playable tries to reach a Playable target (once per second).
|
||||||
|
if (isPlayable())
|
||||||
|
{
|
||||||
|
final WorldObject target = _target;
|
||||||
|
if ((target != null) && target.isPlayable() && ((gameTicks % 10) == 0) && (calculateDistance3D(target) > 150))
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (distFraction > 1)
|
if (distFraction > 1)
|
||||||
{
|
{
|
||||||
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
||||||
@@ -4238,7 +4248,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
||||||
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/CharMoveToLocation.</b></font><br>
|
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/MoveToLocation.</b></font><br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
@@ -4586,7 +4596,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
||||||
// to destination by GameTimeTaskManager
|
// to destination by GameTimeTaskManager
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
broadcastMoveToLocation();
|
broadcastMoveToLocation();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -53,7 +53,7 @@ public class RequestRecordInfo implements IClientIncomingPacket
|
|||||||
if (object.isCreature())
|
if (object.isCreature())
|
||||||
{
|
{
|
||||||
// Update the state of the Creature object client side by sending Server->Client packet
|
// Update the state of the Creature object client side by sending Server->Client packet
|
||||||
// MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance
|
// MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance
|
||||||
final Creature creature = (Creature) object;
|
final Creature creature = (Creature) object;
|
||||||
if (creature.hasAI())
|
if (creature.hasAI())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -529,7 +529,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToPawn/MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
if (pawn.isCreature())
|
if (pawn.isCreature())
|
||||||
{
|
{
|
||||||
if (_actor.isOnGeodataPath())
|
if (_actor.isOnGeodataPath())
|
||||||
@@ -563,7 +563,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation <i>(broadcast)</i>.<br>
|
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation <i>(broadcast)</i>.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@@ -581,7 +581,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
||||||
_actor.moveToLocation(x, y, z, 0);
|
_actor.moveToLocation(x, y, z, 0);
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
_actor.broadcastMoveToLocation();
|
_actor.broadcastMoveToLocation();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -731,7 +731,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param player The PlayerIstance to notify with state of this Creature
|
* @param player The PlayerIstance to notify with state of this Creature
|
||||||
*/
|
*/
|
||||||
@@ -746,7 +746,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
player.sendPacket(new MoveToLocation(_actor));
|
player.sendPacket(new MoveToLocation(_actor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -663,7 +663,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
x1 = x1 > (offset + minRadius) ? (leader.getX() + x1) - offset : (leader.getX() - x1) + minRadius;
|
x1 = x1 > (offset + minRadius) ? (leader.getX() + x1) - offset : (leader.getX() - x1) + minRadius;
|
||||||
y1 = y1 > (offset + minRadius) ? (leader.getY() + y1) - offset : (leader.getY() - y1) + minRadius;
|
y1 = y1 > (offset + minRadius) ? (leader.getY() + y1) - offset : (leader.getY() - y1) + minRadius;
|
||||||
z1 = leader.getZ();
|
z1 = leader.getZ();
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(x1, y1, z1);
|
moveTo(x1, y1, z1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -708,7 +708,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
z1 = npc.getZ();
|
z1 = npc.getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceId());
|
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceId());
|
||||||
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -340,7 +340,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -362,7 +362,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -227,7 +227,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4102,6 +4102,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// Set the timer of last position update to now
|
// Set the timer of last position update to now
|
||||||
m._moveTimestamp = gameTicks;
|
m._moveTimestamp = gameTicks;
|
||||||
|
|
||||||
|
// Broadcast MoveToLocation when Playable tries to reach a Playable target (once per second).
|
||||||
|
if (isPlayable())
|
||||||
|
{
|
||||||
|
final WorldObject target = _target;
|
||||||
|
if ((target != null) && target.isPlayable() && ((gameTicks % 10) == 0) && (calculateDistance3D(target) > 150))
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (distFraction > 1)
|
if (distFraction > 1)
|
||||||
{
|
{
|
||||||
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
||||||
@@ -4240,7 +4250,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
||||||
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/CharMoveToLocation.</b></font><br>
|
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/MoveToLocation.</b></font><br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
@@ -4588,7 +4598,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
||||||
// to destination by GameTimeTaskManager
|
// to destination by GameTimeTaskManager
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
broadcastMoveToLocation();
|
broadcastMoveToLocation();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -53,7 +53,7 @@ public class RequestRecordInfo implements IClientIncomingPacket
|
|||||||
if (object.isCreature())
|
if (object.isCreature())
|
||||||
{
|
{
|
||||||
// Update the state of the Creature object client side by sending Server->Client packet
|
// Update the state of the Creature object client side by sending Server->Client packet
|
||||||
// MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance
|
// MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance
|
||||||
final Creature creature = (Creature) object;
|
final Creature creature = (Creature) object;
|
||||||
if (creature.hasAI())
|
if (creature.hasAI())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -480,7 +480,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Send a Server->Client packet MoveToPawn/CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToPawn/MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
if (pawn.isCreature())
|
if (pawn.isCreature())
|
||||||
{
|
{
|
||||||
if (_actor.isOnGeodataPath())
|
if (_actor.isOnGeodataPath())
|
||||||
@@ -514,7 +514,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation <i>(broadcast)</i>.<br>
|
* Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation <i>(broadcast)</i>.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param x
|
* @param x
|
||||||
* @param y
|
* @param y
|
||||||
@@ -532,7 +532,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
// Calculate movement data for a move to location action and add the actor to movingObjects of GameTimeTaskManager
|
||||||
_actor.moveToLocation(x, y, z, 0);
|
_actor.moveToLocation(x, y, z, 0);
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
_actor.broadcastMoveToLocation();
|
_actor.broadcastMoveToLocation();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -679,7 +679,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
* Update the state of this actor client side by sending Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance player.<br>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
|
||||||
* @param player The PlayerIstance to notify with state of this Creature
|
* @param player The PlayerIstance to notify with state of this Creature
|
||||||
*/
|
*/
|
||||||
@@ -694,7 +694,7 @@ public abstract class AbstractAI implements Ctrl
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
player.sendPacket(new MoveToLocation(_actor));
|
player.sendPacket(new MoveToLocation(_actor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -526,7 +526,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
y1 = (leader.getY() - y1) + minRadius;
|
y1 = (leader.getY() - y1) + minRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(x1, y1, leader.getZ());
|
moveTo(x1, y1, leader.getZ());
|
||||||
}
|
}
|
||||||
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
|
else if (Rnd.get(RANDOM_WALK_RATE) == 0)
|
||||||
@@ -574,7 +574,7 @@ public class AttackableAI extends CreatureAI
|
|||||||
z1 = npc.getZ();
|
z1 = npc.getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceWorld());
|
final Location moveLoc = _actor.isFlying() ? new Location(x1, y1, z1) : GeoEngine.getInstance().getValidLocation(npc.getX(), npc.getY(), npc.getZ(), x1, y1, z1, npc.getInstanceWorld());
|
||||||
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
moveTo(moveLoc.getX(), moveLoc.getY(), moveLoc.getZ());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -379,7 +379,7 @@ public class CreatureAI extends AbstractAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
* <ul>
|
* <ul>
|
||||||
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
* <li>Stop the actor auto-attack server side AND client side by sending Server->Client packet AutoAttackStop (broadcast)</li>
|
||||||
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
* <li>Set the Intention of this AI to AI_INTENTION_MOVE_TO</li>
|
||||||
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)</li>
|
* <li>Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -248,7 +248,7 @@ public class PlayerAI extends PlayableAI
|
|||||||
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
// Abort the attack of the Creature and send Server->Client ActionFailed packet
|
||||||
_actor.abortAttack();
|
_actor.abortAttack();
|
||||||
|
|
||||||
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
|
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet MoveToLocation (broadcast)
|
||||||
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
moveTo(loc.getX(), loc.getY(), loc.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-2
@@ -3142,6 +3142,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// Set the timer of last position update to now
|
// Set the timer of last position update to now
|
||||||
m._moveTimestamp = gameTicks;
|
m._moveTimestamp = gameTicks;
|
||||||
|
|
||||||
|
// Broadcast MoveToLocation when Playable tries to reach a Playable target (once per second).
|
||||||
|
if (isPlayable())
|
||||||
|
{
|
||||||
|
final WorldObject target = _target;
|
||||||
|
if ((target != null) && target.isPlayable() && ((gameTicks % 10) == 0) && (calculateDistance3D(target) > 150))
|
||||||
|
{
|
||||||
|
broadcastPacket(new MoveToLocation(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (distFraction > 1)
|
if (distFraction > 1)
|
||||||
{
|
{
|
||||||
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED));
|
||||||
@@ -3282,7 +3292,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
* <li>Add the Creature to movingObjects of the GameTimeTaskManager</li>
|
||||||
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
* <li>Create a task to notify the AI that Creature arrives at a check point of the movement</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/CharMoveToLocation.</b></font><br>
|
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T send Server->Client packet MoveToPawn/MoveToLocation.</b></font><br>
|
||||||
* <br>
|
* <br>
|
||||||
* <b><u>Example of use</u>:</b>
|
* <b><u>Example of use</u>:</b>
|
||||||
* <ul>
|
* <ul>
|
||||||
@@ -3630,7 +3640,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
|||||||
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
// the CtrlEvent.EVT_ARRIVED will be sent when the character will actually arrive
|
||||||
// to destination by GameTimeTaskManager
|
// to destination by GameTimeTaskManager
|
||||||
|
|
||||||
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
|
||||||
broadcastMoveToLocation();
|
broadcastMoveToLocation();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user