Broadcast movement and social action packets when region is active.
This commit is contained in:
		| @@ -23,6 +23,7 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE; | ||||
| import org.l2jmobius.gameserver.GameTimeController; | ||||
| import org.l2jmobius.gameserver.model.Location; | ||||
| import org.l2jmobius.gameserver.model.WorldObject; | ||||
| import org.l2jmobius.gameserver.model.WorldRegion; | ||||
| import org.l2jmobius.gameserver.model.actor.Creature; | ||||
| import org.l2jmobius.gameserver.model.actor.Summon; | ||||
| import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; | ||||
| @@ -480,17 +481,21 @@ public abstract class AbstractAI implements Ctrl | ||||
| 			{ | ||||
| 				if (_actor.isOnGeodataPath()) | ||||
| 				{ | ||||
| 					_actor.broadcastPacket(new MoveToLocation(_actor)); | ||||
| 					_actor.broadcastMoveToLocation(); | ||||
| 					_clientMovingToPawnOffset = 0; | ||||
| 				} | ||||
| 				else | ||||
| 				{ | ||||
| 					_actor.broadcastPacket(new MoveToPawn(_actor, pawn, offset)); | ||||
| 					final WorldRegion region = _actor.getWorldRegion(); | ||||
| 					if ((region != null) && region.isActive()) | ||||
| 					{ | ||||
| 						_actor.broadcastPacket(new MoveToPawn(_actor, pawn, offset)); | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 			else | ||||
| 			{ | ||||
| 				_actor.broadcastPacket(new MoveToLocation(_actor)); | ||||
| 				_actor.broadcastMoveToLocation(); | ||||
| 			} | ||||
| 		} | ||||
| 		else | ||||
| @@ -524,7 +529,7 @@ public abstract class AbstractAI implements Ctrl | ||||
| 			_actor.moveToLocation(x, y, z, 0); | ||||
| 			 | ||||
| 			// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers | ||||
| 			_actor.broadcastPacket(new MoveToLocation(_actor)); | ||||
| 			_actor.broadcastMoveToLocation(); | ||||
| 		} | ||||
| 		else | ||||
| 		{ | ||||
|   | ||||
| @@ -29,7 +29,6 @@ import org.l2jmobius.gameserver.model.actor.instance.DoppelgangerInstance; | ||||
| import org.l2jmobius.gameserver.model.items.instance.ItemInstance; | ||||
| import org.l2jmobius.gameserver.model.skills.Skill; | ||||
| import org.l2jmobius.gameserver.model.skills.SkillCaster; | ||||
| import org.l2jmobius.gameserver.network.serverpackets.MoveToLocation; | ||||
|  | ||||
| public class DoppelgangerAI extends CreatureAI | ||||
| { | ||||
| @@ -261,7 +260,7 @@ public class DoppelgangerAI extends CreatureAI | ||||
| 			// Doppelgangers always send MoveToLocation packet. | ||||
| 			if (sendPacket) | ||||
| 			{ | ||||
| 				_actor.broadcastPacket(new MoveToLocation(_actor)); | ||||
| 				_actor.broadcastMoveToLocation(); | ||||
| 			} | ||||
| 		} | ||||
| 		else | ||||
|   | ||||
| @@ -653,6 +653,24 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe | ||||
| 		}); | ||||
| 	} | ||||
| 	 | ||||
| 	public void broadcastMoveToLocation() | ||||
| 	{ | ||||
| 		final WorldRegion region = getWorldRegion(); | ||||
| 		if ((region != null) && region.isActive()) | ||||
| 		{ | ||||
| 			broadcastPacket(new MoveToLocation(this)); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	public void broadcastSocialAction(int id) | ||||
| 	{ | ||||
| 		final WorldRegion region = getWorldRegion(); | ||||
| 		if ((region != null) && region.isActive()) | ||||
| 		{ | ||||
| 			broadcastPacket(new SocialAction(getObjectId(), id)); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| 	 * @return true if hp update should be done, false if not | ||||
| 	 */ | ||||
| @@ -3140,7 +3158,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe | ||||
| 		m._moveTimestamp = gameTicks; | ||||
| 		 | ||||
| 		// Send a Server->Client packet MoveToLocation to the actor and all known PlayerInstance. | ||||
| 		broadcastPacket(new MoveToLocation(this)); | ||||
| 		broadcastMoveToLocation(); | ||||
| 		if (distFraction > 1) | ||||
| 		{ | ||||
| 			ThreadPool.execute(() -> getAI().notifyEvent(CtrlEvent.EVT_ARRIVED)); | ||||
| @@ -3637,7 +3655,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe | ||||
| 		// to destination by GameTimeController | ||||
| 		 | ||||
| 		// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers | ||||
| 		broadcastPacket(new MoveToLocation(this)); | ||||
| 		broadcastMoveToLocation(); | ||||
| 		return true; | ||||
| 	} | ||||
| 	 | ||||
| @@ -4875,11 +4893,6 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe | ||||
| 		return _effectList.isAffected(flag); | ||||
| 	} | ||||
| 	 | ||||
| 	public void broadcastSocialAction(int id) | ||||
| 	{ | ||||
| 		broadcastPacket(new SocialAction(getObjectId(), id)); | ||||
| 	} | ||||
| 	 | ||||
| 	public Team getTeam() | ||||
| 	{ | ||||
| 		return _team; | ||||
|   | ||||
| @@ -102,7 +102,6 @@ import org.l2jmobius.gameserver.network.serverpackets.NpcInfo; | ||||
| import org.l2jmobius.gameserver.network.serverpackets.NpcInfoAbnormalVisualEffect; | ||||
| import org.l2jmobius.gameserver.network.serverpackets.NpcSay; | ||||
| import org.l2jmobius.gameserver.network.serverpackets.ServerObjectInfo; | ||||
| import org.l2jmobius.gameserver.network.serverpackets.SocialAction; | ||||
| import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; | ||||
| import org.l2jmobius.gameserver.taskmanager.DecayTaskManager; | ||||
| import org.l2jmobius.gameserver.util.Broadcast; | ||||
| @@ -209,7 +208,7 @@ public class Npc extends Creature | ||||
| 		if ((now - _lastSocialBroadcast) > MINIMUM_SOCIAL_INTERVAL) | ||||
| 		{ | ||||
| 			_lastSocialBroadcast = now; | ||||
| 			broadcastPacket(new SocialAction(getObjectId(), animationId)); | ||||
| 			broadcastSocialAction(animationId); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 MobiusDevelopment
					MobiusDevelopment