Broadcast MoveToLocation when Playable tries to reach a Playable target.

Thanks to Trance.
This commit is contained in:
MobiusDevelopment
2021-11-15 03:09:33 +00:00
parent 2e213a1133
commit 9c6f431961
155 changed files with 632 additions and 380 deletions

View File

@@ -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.AutoAttackStart;
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.MoveToLocationInVehicle;
import org.l2jmobius.gameserver.network.serverpackets.MoveToPawn;
@@ -483,7 +483,7 @@ abstract class AbstractAI implements Ctrl
// 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 (_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>
* @param x
* @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
_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();
}
else
@@ -544,8 +544,8 @@ abstract class AbstractAI implements Ctrl
// Chek if actor can move
if (!_actor.isMovementDisabled())
{
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
// CharMoveToLocation msg = new CharMoveToLocation(_actor);
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
// MoveToLocation msg = new MoveToLocation(_actor);
if (((PlayerInstance) _actor).getBoat() != null)
{
_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>
* @param player The PlayerIstance to notify with state of this Creature
*/
@@ -702,8 +702,8 @@ abstract class AbstractAI implements Ctrl
}
else
{
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
player.sendPacket(new CharMoveToLocation(_actor));
// Send a Server->Client packet MoveToLocation to the actor and all PlayerInstance in its _knownPlayers
player.sendPacket(new MoveToLocation(_actor));
}
}
}

View File

@@ -530,7 +530,7 @@ public class AttackableAI extends CreatureAI
x1 = (((MinionInstance) _actor).getLeader().getX() + Rnd.get((offset - 30) * 2)) - (offset - 30);
y1 = (((MinionInstance) _actor).getLeader().getY() + Rnd.get((offset - 30) * 2)) - (offset - 30);
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);
}
}

View File

@@ -308,7 +308,7 @@ public class CreatureAI extends AbstractAI
* <ul>
* <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>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>
*/
@Override
@@ -355,7 +355,7 @@ public class CreatureAI extends AbstractAI
_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());
}
@@ -390,7 +390,7 @@ public class CreatureAI extends AbstractAI
// Abort the attack of the Creature and send Server->Client ActionFailed packet
_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);
}

View File

@@ -103,13 +103,13 @@ import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
import org.l2jmobius.gameserver.network.serverpackets.Attack;
import org.l2jmobius.gameserver.network.serverpackets.ChangeMoveType;
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.IClientOutgoingPacket;
import org.l2jmobius.gameserver.network.serverpackets.MagicEffectIcons;
import org.l2jmobius.gameserver.network.serverpackets.MagicSkillCanceld;
import org.l2jmobius.gameserver.network.serverpackets.MagicSkillLaunched;
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.NpcInfo;
import org.l2jmobius.gameserver.network.serverpackets.PartySpelled;
@@ -385,14 +385,14 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
{
if (isPlayable())
{
broadcastPacket(new CharMoveToLocation(this));
broadcastPacket(new MoveToLocation(this));
}
else
{
final WorldRegion region = getWorldRegion();
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
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;
}
@@ -5157,7 +5168,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
* <li>Set the Creature _move object to MoveData object</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>
* <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>
* <b><u>Example of use</u>:</b><br>
* <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
// 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();
return true;
}

View File

@@ -64,20 +64,20 @@ public class PlayerKnownList extends PlayableKnownList
* <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 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>
* <b><u>object is a NpcInstance</u>:</b><br>
* <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>
* <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 MoveToPawn/CharMoveToLocation and AutoAttackStart to the PlayerInstance</li><br>
* <li>Send Server->Client packet MoveToPawn/MoveToLocation and AutoAttackStart to the PlayerInstance</li><br>
* <br>
* <b><u>object is a PlayerInstance</u>:</b><br>
* <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>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
*/
@Override
@@ -225,7 +225,7 @@ public class PlayerKnownList extends PlayableKnownList
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 CreatureAI objAi = obj.getAI();
if (objAi != null)

View File

@@ -147,7 +147,7 @@ public class RequestRecordInfo implements IClientIncomingPacket
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;
if (obj.hasAI())
{

View File

@@ -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
* @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 _x;
@@ -34,7 +34,7 @@ public class CharMoveToLocation implements IClientOutgoingPacket
private final int _yDst;
private final int _zDst;
public CharMoveToLocation(Creature creature)
public MoveToLocation(Creature creature)
{
_objectId = creature.getObjectId();
_x = creature.getX();