All pastes #55156 Raw Edit

Someone

public text v1 · immutable
#55156 ·published 2006-05-11 18:10 UTC
rendered paste body
Index: D:/olympus/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/handler/itemhandlers/SoulShots.java
===================================================================
--- D:/olympus/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/handler/itemhandlers/SoulShots.java	(revision 1927)
+++ D:/olympus/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/handler/itemhandlers/SoulShots.java	(working copy)
@@ -98,7 +98,7 @@
         
 		// Send message to client
         activeChar.sendPacket(new SystemMessage(SystemMessage.ENABLED_SOULSHOT));
-        Broadcast.toSelfAndKnownPlayers(activeChar, new MagicSkillUser(activeChar, activeChar, _skillIds[weaponGrade], 1, 0, 0));
+        Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUser(activeChar, activeChar, _skillIds[weaponGrade], 1, 0, 0),600);
 	}
 	
 	public int[] getItemIds()
Index: D:/olympus/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/handler/itemhandlers/SpiritShot.java
===================================================================
--- D:/olympus/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/handler/itemhandlers/SpiritShot.java	(revision 1927)
+++ D:/olympus/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/handler/itemhandlers/SpiritShot.java	(working copy)
@@ -98,7 +98,7 @@
 
         // Send message to client
 		activeChar.sendPacket(new SystemMessage(SystemMessage.ENABLED_SPIRITSHOT));
-        Broadcast.toSelfAndKnownPlayers(activeChar, new MagicSkillUser(activeChar, activeChar, _skillIds[weaponGrade], 1, 0, 0));
+        Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUser(activeChar, activeChar, _skillIds[weaponGrade], 1, 0, 0),600);
 	} 
 
 	public int[] getItemIds() 
Index: D:/olympus/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/handler/itemhandlers/BlessedSpiritShot.java
===================================================================
--- D:/olympus/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/handler/itemhandlers/BlessedSpiritShot.java	(revision 1927)
+++ D:/olympus/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/handler/itemhandlers/BlessedSpiritShot.java	(working copy)
@@ -98,7 +98,7 @@
 
         // Send message to client
         activeChar.sendPacket(new SystemMessage(SystemMessage.ENABLED_SPIRITSHOT));
-        Broadcast.toSelfAndKnownPlayers(activeChar, new MagicSkillUser(activeChar, activeChar, _skillIds[weaponGrade], 1, 0, 0));
+        Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUser(activeChar, activeChar, _skillIds[weaponGrade], 1, 0, 0),600);
 	} 
 
 	public int[] getItemIds() 
Index: D:/olympus/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java
===================================================================
--- D:/olympus/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java	(revision 1927)
+++ D:/olympus/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java	(working copy)
@@ -57,7 +57,7 @@
         activeChar.disableAllSkills();
 
         MagicSkillUser msk = new MagicSkillUser(activeChar, 1050, 1, unstuckTimer, 0);
-        Broadcast.toSelfAndKnownPlayers(activeChar, msk);
+        Broadcast.toSelfAndKnownPlayersInRadius(activeChar, msk,900);
         SetupGauge sg = new SetupGauge(0, unstuckTimer);
         activeChar.sendPacket(sg);
         //End SoE Animation section
Index: D:/olympus/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/util/Broadcast.java
===================================================================
--- D:/olympus/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/util/Broadcast.java	(revision 1927)
+++ D:/olympus/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/util/Broadcast.java	(working copy)
@@ -134,6 +134,24 @@
         toKnownPlayers(character, mov);
     }
     
+    public static void toSelfAndKnownPlayersInRadius(L2Character character, ServerBasePacket mov, int radius)
+    {
+    	if (radius < 0)
+    		radius = 500;
+
+    	if (character instanceof L2PcInstance)
+    	   character.sendPacket(mov);
+
+    	for (L2PcInstance player : character.getKnownList().getKnownPlayers())
+    	{
+    		if (player == null) 
+    			continue;
+
+    		if (character.getDistance(player.getX(), player.getY(), player.getZ()) <= radius)
+    			player.sendPacket(mov);
+    	}
+	}
+
     /**
      * Send a packet to all L2PcInstance in the _KnownPlayers of the L2Character and to the specified characters within
      * the given radius.<BR><BR>
Index: D:/olympus/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- D:/olympus/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(revision 1927)
+++ D:/olympus/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -4029,7 +4029,7 @@
 		MagicSkillCanceld msc = new MagicSkillCanceld(getObjectId());
 		
         // Broadcast the packet to self and known players.
-		Broadcast.toSelfAndKnownPlayers(this, msc);
+		Broadcast.toSelfAndKnownPlayersInRadius(this, msc, 900);
 	}
 	
 	/**
Index: D:/olympus/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/model/L2Character.java
===================================================================
--- D:/olympus/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/model/L2Character.java	(revision 1927)
+++ D:/olympus/trunk/L2_Gameserver/java/net/sf/l2j/gameserver/model/L2Character.java	(working copy)
@@ -3379,6 +3379,16 @@
 		return distance;
 	}
 	
+	public final double getDistance(int x, int y, int z) 
+	{ 
+		long dx = x-getX(); 
+		long dy = y-getY(); 
+		long dz = z-getZ(); 
+		double distance = Math.sqrt(dx*dx + dy*dy + dz*dz); 
+
+		return distance;
+	}
+	
 //	/**
 //	* event that is called when the destination coordinates are reached
 //	*/