Implemented Spawn chaseRange parameter.

This commit is contained in:
MobiusDevelopment
2022-08-07 21:05:53 +00:00
parent b47ac4b571
commit 0eebada4bd
142 changed files with 579 additions and 116 deletions

View File

@@ -111,8 +111,9 @@ MaxDriftRange = 300
AggroDistanceCheckEnabled = False
# Maximum distance monsters can be pulled away from spawn.
# Default: 1500
AggroDistanceCheckRange = 1500
# Overridden by Spawn chaseRange parameter.
# Default: 2000
AggroDistanceCheckRange = 2000
# Use maximum aggro distance check for raids.
# Grandbosses are excluded.
@@ -120,8 +121,9 @@ AggroDistanceCheckRange = 1500
AggroDistanceCheckRaids = False
# Maximum distance raids can be pulled away from spawn.
# Default: 3000
AggroDistanceCheckRaidRange = 3000
# Overridden by Spawn chaseRange parameter.
# Default: 4000
AggroDistanceCheckRaidRange = 4000
# Use maximum aggro distance check in instances.
# Default: False

View File

@@ -50,6 +50,7 @@
<xs:attribute name="count" type="xs:positiveInteger" use="optional" />
<xs:attribute name="respawnDelay" type="xs:nonNegativeInteger" use="optional" />
<xs:attribute name="respawnRandom" type="xs:nonNegativeInteger" use="optional" />
<xs:attribute name="chaseRange" type="xs:nonNegativeInteger" use="optional" />
<xs:attribute name="periodOfDay" use="optional">
<xs:simpleType>
<xs:restriction base="xs:token">

View File

@@ -733,7 +733,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.getInstanceId() == 0)))
{

View File

@@ -335,6 +335,11 @@ public class SpawnTable implements IXmlReader
spawnInfo.set("respawnRandom", parseInteger(attrs, "respawnRandom"));
}
if (attrs.getNamedItem("chaseRange") != null)
{
spawnInfo.set("chaseRange", parseInteger(attrs, "chaseRange"));
}
if (attrs.getNamedItem("periodOfDay") != null)
{
final String period = attrs.getNamedItem("periodOfDay").getNodeValue();
@@ -371,6 +376,7 @@ public class SpawnTable implements IXmlReader
spawnDat.setXYZ(spawnInfo.getInt("x", 0), spawnInfo.getInt("y", 0), spawnInfo.getInt("z", 0));
spawnDat.setHeading(spawnInfo.getInt("heading", -1));
spawnDat.setRespawnDelay(spawnInfo.getInt("respawnDelay", 0), spawnInfo.getInt("respawnRandom", 0));
spawnDat.setChaseRange(spawnInfo.getInt("chaseRange", 0));
spawnDat.setLocationId(spawnInfo.getInt("locId", 0));
final String territoryName = spawnInfo.getString("territoryName", "");
final String spawnName = spawnInfo.getString("spawnName", "");

View File

@@ -71,6 +71,8 @@ public class Spawn extends Location implements IIdentifiable, INamable
private int _respawnMinDelay;
/** Maximum respawn delay */
private int _respawnMaxDelay;
/** Maximum distance monsters can be pulled away from spawn. */
private int _chaseRange;
/** The generic constructor of Npc managed by this Spawn */
private Constructor<? extends Npc> _constructor;
/** If True an Npc is respawned each time that another is killed */
@@ -540,6 +542,16 @@ public class Spawn extends Location implements IIdentifiable, INamable
return _respawnMinDelay != _respawnMaxDelay;
}
public void setChaseRange(int chaseRange)
{
_chaseRange = chaseRange;
}
public int getChaseRange()
{
return _chaseRange;
}
public void setSpawnTerritory(NpcSpawnTerritory territory)
{
_spawnTerritory = territory;