Pārlūkot izejas kodu

BETA: Core support for [DP10049]
* Reviewed by: xban1x

VlLight 11 gadi atpakaļ
vecāks
revīzija
774c739b73

+ 1 - 1
L2J_Server_BETA/dist/game/config/NPC.properties

@@ -194,4 +194,4 @@ MinionChaosTime = 10
 
 # A comma separated list of all NPCs who have no dialog, i.e. double-clicking on them doesn't open a chat window
 # Default: 18684,18685,18686,18687,18688,18689,18690,19691,18692,31202,31203,31204,31205,31206,31207,31208,31209,31266,31557,31593,31606,31671,31672,31673,31674,31758,31955,32026,32030,32031,32032,32306,32619,32620,32621
-NonTalkingNpcs = 18684,18685,18686,18687,18688,18689,18690,19691,18692,31202,31203,31204,31205,31206,31207,31208,31209,31266,31557,31593,31606,31671,31672,31673,31674,31758,31955,32026,32030,32031,32032,32306,32619,32620,32621
+NonTalkingNpcs = 18684,18685,18686,18687,18688,18689,18690,19691,18692,18927,18933,31202,31203,31204,31205,31206,31207,31208,31209,31266,31557,31593,31606,31671,31672,31673,31674,31758,31955,32026,32030,32031,32032,32306,32619,32620,32621

+ 20 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/L2Npc.java

@@ -51,6 +51,7 @@ import com.l2jserver.gameserver.model.L2Object;
 import com.l2jserver.gameserver.model.L2Spawn;
 import com.l2jserver.gameserver.model.L2World;
 import com.l2jserver.gameserver.model.L2WorldRegion;
+import com.l2jserver.gameserver.model.Location;
 import com.l2jserver.gameserver.model.actor.instance.L2ClanHallManagerInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2DoormenInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2FestivalGuideInstance;
@@ -1949,6 +1950,25 @@ public class L2Npc extends L2Character
 		}
 	}
 	
+	/**
+	 * Gets point in range between radiusMin and radiusMax from this NPC
+	 * @param radiusMin miminal range from NPC (not closer than)
+	 * @param radiusMax maximal range from NPC (not further than)	 
+	 * @return Location in given range from this NPC 
+	 */
+	public Location getPointInRange(int radiusMin, int radiusMax)
+	{
+		if((radiusMax == 0) || (radiusMax < radiusMin))
+		{
+			return new Location(getX(), getY(), getZ());
+		}
+		
+		final int radius = Rnd.get(radiusMin, radiusMax);
+		final double angle = Rnd.nextDouble() * 2 * Math.PI;
+		
+		return new Location((int) (getX() + radius * Math.cos(angle)), (int) (getY() + radius * Math.sin(angle)), getZ());
+	}
+	
 	@Override
 	public boolean isInCategory(CategoryType type)
 	{