Implemented Spawn chaseRange parameter.
This commit is contained in:
		@@ -98,6 +98,7 @@ MaxDriftRange = 300
 | 
			
		||||
AggroDistanceCheckEnabled = False
 | 
			
		||||
 | 
			
		||||
# Maximum distance monsters can be pulled away from spawn.
 | 
			
		||||
# Overridden by Spawn chaseRange parameter.
 | 
			
		||||
# Default: 1500
 | 
			
		||||
AggroDistanceCheckRange = 1500
 | 
			
		||||
 | 
			
		||||
@@ -107,6 +108,7 @@ AggroDistanceCheckRange = 1500
 | 
			
		||||
AggroDistanceCheckRaids = False
 | 
			
		||||
 | 
			
		||||
# Maximum distance raids can be pulled away from spawn.
 | 
			
		||||
# Overridden by Spawn chaseRange parameter.
 | 
			
		||||
# Default: 3000
 | 
			
		||||
AggroDistanceCheckRaidRange = 3000
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -113,6 +113,7 @@
 | 
			
		||||
		<xs:attribute type="xs:positiveInteger" name="count" />
 | 
			
		||||
		<xs:attribute type="xs:string" name="respawnTime" />
 | 
			
		||||
		<xs:attribute type="xs:string" name="respawnRandom" />
 | 
			
		||||
		<xs:attribute type="xs:integer" name="chaseRange" />
 | 
			
		||||
		<xs:attribute type="xs:integer" name="x" />
 | 
			
		||||
		<xs:attribute type="xs:integer" name="y" />
 | 
			
		||||
		<xs:attribute type="xs:integer" name="z" />
 | 
			
		||||
 
 | 
			
		||||
@@ -608,7 +608,7 @@ public class AttackableAI extends CreatureAI
 | 
			
		||||
		if (Config.AGGRO_DISTANCE_CHECK_ENABLED && npc.isMonster() && !npc.isWalker() && !(npc instanceof GrandBoss))
 | 
			
		||||
		{
 | 
			
		||||
			final Spawn spawn = npc.getSpawn();
 | 
			
		||||
			if ((spawn != null) && (npc.calculateDistance3D(spawn.getLocation()) > (npc.isRaid() ? Config.AGGRO_DISTANCE_CHECK_RAID_RANGE : Config.AGGRO_DISTANCE_CHECK_RANGE)))
 | 
			
		||||
			if ((spawn != null) && (npc.calculateDistance3D(spawn.getLocation()) > (spawn.getChaseRange() > 0 ? Math.max(Config.MAX_DRIFT_RANGE, spawn.getChaseRange()) : (npc.isRaid() ? Config.AGGRO_DISTANCE_CHECK_RAID_RANGE : Config.AGGRO_DISTANCE_CHECK_RANGE))))
 | 
			
		||||
			{
 | 
			
		||||
				if ((Config.AGGRO_DISTANCE_CHECK_RAIDS || !npc.isRaid()) && (Config.AGGRO_DISTANCE_CHECK_INSTANCES || !npc.isInInstance()))
 | 
			
		||||
				{
 | 
			
		||||
 
 | 
			
		||||
@@ -517,6 +517,11 @@ public class Spawn extends Location implements IIdentifiable, INamable
 | 
			
		||||
		return _respawnMinDelay != _respawnMaxDelay;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public int getChaseRange()
 | 
			
		||||
	{
 | 
			
		||||
		return _spawnTemplate.getChaseRange();
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Npc getLastSpawn()
 | 
			
		||||
	{
 | 
			
		||||
		if (!_spawnedNpcs.isEmpty())
 | 
			
		||||
 
 | 
			
		||||
@@ -54,6 +54,7 @@ public class NpcSpawnTemplate implements Cloneable, IParameterized<StatSet>
 | 
			
		||||
	private final int _count;
 | 
			
		||||
	private final Duration _respawnTime;
 | 
			
		||||
	private final Duration _respawnTimeRandom;
 | 
			
		||||
	private final int _chaseRange;
 | 
			
		||||
	private List<ChanceLocation> _locations;
 | 
			
		||||
	private SpawnTerritory _zone;
 | 
			
		||||
	private StatSet _parameters;
 | 
			
		||||
@@ -73,6 +74,7 @@ public class NpcSpawnTemplate implements Cloneable, IParameterized<StatSet>
 | 
			
		||||
		_count = template._count;
 | 
			
		||||
		_respawnTime = template._respawnTime;
 | 
			
		||||
		_respawnTimeRandom = template._respawnTimeRandom;
 | 
			
		||||
		_chaseRange = template._chaseRange;
 | 
			
		||||
		_spawnAnimation = template._spawnAnimation;
 | 
			
		||||
		_saveInDB = template._saveInDB;
 | 
			
		||||
		_dbName = template._dbName;
 | 
			
		||||
@@ -90,6 +92,7 @@ public class NpcSpawnTemplate implements Cloneable, IParameterized<StatSet>
 | 
			
		||||
		_count = set.getInt("count", 1);
 | 
			
		||||
		_respawnTime = set.getDuration("respawnTime", null);
 | 
			
		||||
		_respawnTimeRandom = set.getDuration("respawnRandom", null);
 | 
			
		||||
		_chaseRange = set.getInt("chaseRange", 0);
 | 
			
		||||
		_spawnAnimation = set.getBoolean("spawnAnimation", false);
 | 
			
		||||
		_saveInDB = set.getBoolean("dbSave", false);
 | 
			
		||||
		_dbName = set.getString("dbName", null);
 | 
			
		||||
@@ -195,6 +198,11 @@ public class NpcSpawnTemplate implements Cloneable, IParameterized<StatSet>
 | 
			
		||||
		return _respawnTimeRandom;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public int getChaseRange()
 | 
			
		||||
	{
 | 
			
		||||
		return _chaseRange;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public List<ChanceLocation> getLocation()
 | 
			
		||||
	{
 | 
			
		||||
		return _locations;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user