Implemented Spawn chaseRange parameter.
This commit is contained in:
@ -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