Configurations for monster aggro distance reset.

This commit is contained in:
MobiusDevelopment 2020-02-13 19:56:19 +00:00
parent 49456557d5
commit e56dad5f81
54 changed files with 1636 additions and 170 deletions

View File

@ -28,11 +28,6 @@ AltAttackableNpcs = True
# Default: False
AltGameViewNpc = False
# Maximum distance mobs can randomly go from spawn point.
# DEFAULT NEEDS TO BE VERIFIED, MUST BE CHANGED HERE AND IN CONFIG.JAVA IF NOT CORRECT
# Default: 300
MaxDriftRange = 300
# Default: False
ShowNpcLevel = False
@ -90,6 +85,31 @@ SpoiledCorpseExtendTime = 10
# Default: 2000
CorpseConsumeSkillAllowedTimeBeforeDecay = 2000
# Maximum distance monsters can randomly move from spawn.
# Default: 300
MaxDriftRange = 300
# Enable monster aggro distance check.
# When enabled monsters will lose aggro if pulled far away from spawn.
# Default: False
AggroDistanceCheckEnabled = False
# Maximum distance monsters can be pulled away from spawn.
# Default: 1500
AggroDistanceCheckRange = 1500
# Use maximum aggro distance check for raids.
# Default: False
AggroDistanceCheckRaids = False
# Use maximum aggro distance check in instances.
# Default: False
AggroDistanceCheckInstances = False
# Restore monster HP and MP when aggro is reset by distance.
# Default: True
AggroDistanceCheckRestoreLife = True
# ---------------------------------------------------------------------------
# Guards

View File

@ -610,7 +610,6 @@ public class Config
public static boolean ALT_MOB_AGRO_IN_PEACEZONE;
public static boolean ALT_ATTACKABLE_NPCS;
public static boolean ALT_GAME_VIEWNPC;
public static int MAX_DRIFT_RANGE;
public static boolean SHOW_NPC_LVL;
public static boolean SHOW_NPC_AGGRESSION;
public static boolean SHOW_CREST_WITHOUT_QUEST;
@ -624,6 +623,12 @@ public class Config
public static int DEFAULT_CORPSE_TIME;
public static int SPOILED_CORPSE_EXTEND_TIME;
public static int CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY;
public static int MAX_DRIFT_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_ENABLED;
public static int AGGRO_DISTANCE_CHECK_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_RAIDS;
public static boolean AGGRO_DISTANCE_CHECK_INSTANCES;
public static boolean AGGRO_DISTANCE_CHECK_RESTORE_LIFE;
public static boolean GUARD_ATTACK_AGGRO_MOB;
public static double RAID_HP_REGEN_MULTIPLIER;
public static double RAID_MP_REGEN_MULTIPLIER;
@ -2098,7 +2103,6 @@ public class Config
ALT_MOB_AGRO_IN_PEACEZONE = NPC.getBoolean("AltMobAgroInPeaceZone", true);
ALT_ATTACKABLE_NPCS = NPC.getBoolean("AltAttackableNpcs", true);
ALT_GAME_VIEWNPC = NPC.getBoolean("AltGameViewNpc", false);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
SHOW_NPC_LVL = NPC.getBoolean("ShowNpcLevel", false);
SHOW_NPC_AGGRESSION = NPC.getBoolean("ShowNpcAggression", false);
SHOW_CREST_WITHOUT_QUEST = NPC.getBoolean("ShowCrestWithoutQuest", false);
@ -2112,6 +2116,12 @@ public class Config
DEFAULT_CORPSE_TIME = NPC.getInt("DefaultCorpseTime", 7);
SPOILED_CORPSE_EXTEND_TIME = NPC.getInt("SpoiledCorpseExtendTime", 10);
CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY = NPC.getInt("CorpseConsumeSkillAllowedTimeBeforeDecay", 2000);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
AGGRO_DISTANCE_CHECK_ENABLED = NPC.getBoolean("AggroDistanceCheckEnabled", true);
AGGRO_DISTANCE_CHECK_RANGE = NPC.getInt("AggroDistanceCheckRange", 1500);
AGGRO_DISTANCE_CHECK_RAIDS = NPC.getBoolean("AggroDistanceCheckRaids", false);
AGGRO_DISTANCE_CHECK_INSTANCES = NPC.getBoolean("AggroDistanceCheckInstances", false);
AGGRO_DISTANCE_CHECK_RESTORE_LIFE = NPC.getBoolean("AggroDistanceCheckRestoreLife", true);
GUARD_ATTACK_AGGRO_MOB = NPC.getBoolean("GuardAttackAggroMob", false);
RAID_HP_REGEN_MULTIPLIER = NPC.getDouble("RaidHpRegenMultiplier", 100) / 100;
RAID_MP_REGEN_MULTIPLIER = NPC.getDouble("RaidMpRegenMultiplier", 100) / 100;

View File

@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.Spawn;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Attackable;
@ -629,12 +630,63 @@ public class AttackableAI extends CreatureAI
protected void thinkAttack()
{
final Attackable npc = getActiveChar();
if ((npc == null) || npc.isCastingNow())
{
return;
}
if (Config.AGGRO_DISTANCE_CHECK_ENABLED && npc.isMonster() && !npc.isWalker())
{
final Spawn spawn = npc.getSpawn();
if ((spawn != null) && (npc.calculateDistance3D(spawn.getLocation()) > Config.AGGRO_DISTANCE_CHECK_RANGE))
{
if ((Config.AGGRO_DISTANCE_CHECK_RAIDS || !npc.isRaid()) && (Config.AGGRO_DISTANCE_CHECK_INSTANCES || !npc.isInInstance()))
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
npc.setCurrentHp(npc.getMaxHp());
npc.setCurrentMp(npc.getMaxMp());
}
npc.abortAttack();
npc.clearAggroList();
npc.getAttackByList().clear();
if (npc.hasAI())
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
npc.teleToLocation(spawn.getLocation(), true);
}
// Minions should return as well.
if (((MonsterInstance) _actor).hasMinions())
{
for (MonsterInstance minion : ((MonsterInstance) _actor).getMinionList().getSpawnedMinions())
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
minion.setCurrentHp(minion.getMaxHp());
minion.setCurrentMp(minion.getMaxMp());
}
minion.abortAttack();
minion.clearAggroList();
minion.getAttackByList().clear();
if (minion.hasAI())
{
minion.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
minion.teleToLocation(spawn.getLocation(), true);
}
}
}
return;
}
}
}
Creature target = npc.getMostHated();
if (getTarget() != target)
{

View File

@ -28,11 +28,6 @@ AltAttackableNpcs = True
# Default: False
AltGameViewNpc = False
# Maximum distance mobs can randomly go from spawn point.
# DEFAULT NEEDS TO BE VERIFIED, MUST BE CHANGED HERE AND IN CONFIG.JAVA IF NOT CORRECT
# Default: 300
MaxDriftRange = 300
# Default: False
ShowNpcLevel = False
@ -90,6 +85,31 @@ SpoiledCorpseExtendTime = 10
# Default: 2000
CorpseConsumeSkillAllowedTimeBeforeDecay = 2000
# Maximum distance monsters can randomly move from spawn.
# Default: 300
MaxDriftRange = 300
# Enable monster aggro distance check.
# When enabled monsters will lose aggro if pulled far away from spawn.
# Default: False
AggroDistanceCheckEnabled = False
# Maximum distance monsters can be pulled away from spawn.
# Default: 1500
AggroDistanceCheckRange = 1500
# Use maximum aggro distance check for raids.
# Default: False
AggroDistanceCheckRaids = False
# Use maximum aggro distance check in instances.
# Default: False
AggroDistanceCheckInstances = False
# Restore monster HP and MP when aggro is reset by distance.
# Default: True
AggroDistanceCheckRestoreLife = True
# ---------------------------------------------------------------------------
# Guards

View File

@ -617,7 +617,6 @@ public class Config
public static boolean ALT_MOB_AGRO_IN_PEACEZONE;
public static boolean ALT_ATTACKABLE_NPCS;
public static boolean ALT_GAME_VIEWNPC;
public static int MAX_DRIFT_RANGE;
public static boolean SHOW_NPC_LVL;
public static boolean SHOW_NPC_AGGRESSION;
public static boolean SHOW_CREST_WITHOUT_QUEST;
@ -631,6 +630,12 @@ public class Config
public static int DEFAULT_CORPSE_TIME;
public static int SPOILED_CORPSE_EXTEND_TIME;
public static int CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY;
public static int MAX_DRIFT_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_ENABLED;
public static int AGGRO_DISTANCE_CHECK_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_RAIDS;
public static boolean AGGRO_DISTANCE_CHECK_INSTANCES;
public static boolean AGGRO_DISTANCE_CHECK_RESTORE_LIFE;
public static boolean GUARD_ATTACK_AGGRO_MOB;
public static double RAID_HP_REGEN_MULTIPLIER;
public static double RAID_MP_REGEN_MULTIPLIER;
@ -2116,7 +2121,6 @@ public class Config
ALT_MOB_AGRO_IN_PEACEZONE = NPC.getBoolean("AltMobAgroInPeaceZone", true);
ALT_ATTACKABLE_NPCS = NPC.getBoolean("AltAttackableNpcs", true);
ALT_GAME_VIEWNPC = NPC.getBoolean("AltGameViewNpc", false);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
SHOW_NPC_LVL = NPC.getBoolean("ShowNpcLevel", false);
SHOW_NPC_AGGRESSION = NPC.getBoolean("ShowNpcAggression", false);
SHOW_CREST_WITHOUT_QUEST = NPC.getBoolean("ShowCrestWithoutQuest", false);
@ -2130,6 +2134,12 @@ public class Config
DEFAULT_CORPSE_TIME = NPC.getInt("DefaultCorpseTime", 7);
SPOILED_CORPSE_EXTEND_TIME = NPC.getInt("SpoiledCorpseExtendTime", 10);
CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY = NPC.getInt("CorpseConsumeSkillAllowedTimeBeforeDecay", 2000);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
AGGRO_DISTANCE_CHECK_ENABLED = NPC.getBoolean("AggroDistanceCheckEnabled", true);
AGGRO_DISTANCE_CHECK_RANGE = NPC.getInt("AggroDistanceCheckRange", 1500);
AGGRO_DISTANCE_CHECK_RAIDS = NPC.getBoolean("AggroDistanceCheckRaids", false);
AGGRO_DISTANCE_CHECK_INSTANCES = NPC.getBoolean("AggroDistanceCheckInstances", false);
AGGRO_DISTANCE_CHECK_RESTORE_LIFE = NPC.getBoolean("AggroDistanceCheckRestoreLife", true);
GUARD_ATTACK_AGGRO_MOB = NPC.getBoolean("GuardAttackAggroMob", false);
RAID_HP_REGEN_MULTIPLIER = NPC.getDouble("RaidHpRegenMultiplier", 100) / 100;
RAID_MP_REGEN_MULTIPLIER = NPC.getDouble("RaidMpRegenMultiplier", 100) / 100;

View File

@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.Spawn;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Attackable;
@ -629,12 +630,63 @@ public class AttackableAI extends CreatureAI
protected void thinkAttack()
{
final Attackable npc = getActiveChar();
if ((npc == null) || npc.isCastingNow())
{
return;
}
if (Config.AGGRO_DISTANCE_CHECK_ENABLED && npc.isMonster() && !npc.isWalker())
{
final Spawn spawn = npc.getSpawn();
if ((spawn != null) && (npc.calculateDistance3D(spawn.getLocation()) > Config.AGGRO_DISTANCE_CHECK_RANGE))
{
if ((Config.AGGRO_DISTANCE_CHECK_RAIDS || !npc.isRaid()) && (Config.AGGRO_DISTANCE_CHECK_INSTANCES || !npc.isInInstance()))
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
npc.setCurrentHp(npc.getMaxHp());
npc.setCurrentMp(npc.getMaxMp());
}
npc.abortAttack();
npc.clearAggroList();
npc.getAttackByList().clear();
if (npc.hasAI())
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
npc.teleToLocation(spawn.getLocation(), true);
}
// Minions should return as well.
if (((MonsterInstance) _actor).hasMinions())
{
for (MonsterInstance minion : ((MonsterInstance) _actor).getMinionList().getSpawnedMinions())
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
minion.setCurrentHp(minion.getMaxHp());
minion.setCurrentMp(minion.getMaxMp());
}
minion.abortAttack();
minion.clearAggroList();
minion.getAttackByList().clear();
if (minion.hasAI())
{
minion.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
minion.teleToLocation(spawn.getLocation(), true);
}
}
}
return;
}
}
}
Creature target = npc.getMostHated();
if (getTarget() != target)
{

View File

@ -28,11 +28,6 @@ AltAttackableNpcs = True
# Default: False
AltGameViewNpc = False
# Maximum distance mobs can randomly go from spawn point.
# DEFAULT NEEDS TO BE VERIFIED, MUST BE CHANGED HERE AND IN CONFIG.JAVA IF NOT CORRECT
# Default: 300
MaxDriftRange = 300
# Default: False
ShowNpcLevel = False
@ -90,6 +85,31 @@ SpoiledCorpseExtendTime = 10
# Default: 2000
CorpseConsumeSkillAllowedTimeBeforeDecay = 2000
# Maximum distance monsters can randomly move from spawn.
# Default: 300
MaxDriftRange = 300
# Enable monster aggro distance check.
# When enabled monsters will lose aggro if pulled far away from spawn.
# Default: False
AggroDistanceCheckEnabled = False
# Maximum distance monsters can be pulled away from spawn.
# Default: 1500
AggroDistanceCheckRange = 1500
# Use maximum aggro distance check for raids.
# Default: False
AggroDistanceCheckRaids = False
# Use maximum aggro distance check in instances.
# Default: False
AggroDistanceCheckInstances = False
# Restore monster HP and MP when aggro is reset by distance.
# Default: True
AggroDistanceCheckRestoreLife = True
# ---------------------------------------------------------------------------
# Guards

View File

@ -617,7 +617,6 @@ public class Config
public static boolean ALT_MOB_AGRO_IN_PEACEZONE;
public static boolean ALT_ATTACKABLE_NPCS;
public static boolean ALT_GAME_VIEWNPC;
public static int MAX_DRIFT_RANGE;
public static boolean SHOW_NPC_LVL;
public static boolean SHOW_NPC_AGGRESSION;
public static boolean SHOW_CREST_WITHOUT_QUEST;
@ -631,6 +630,12 @@ public class Config
public static int DEFAULT_CORPSE_TIME;
public static int SPOILED_CORPSE_EXTEND_TIME;
public static int CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY;
public static int MAX_DRIFT_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_ENABLED;
public static int AGGRO_DISTANCE_CHECK_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_RAIDS;
public static boolean AGGRO_DISTANCE_CHECK_INSTANCES;
public static boolean AGGRO_DISTANCE_CHECK_RESTORE_LIFE;
public static boolean GUARD_ATTACK_AGGRO_MOB;
public static double RAID_HP_REGEN_MULTIPLIER;
public static double RAID_MP_REGEN_MULTIPLIER;
@ -2129,7 +2134,6 @@ public class Config
ALT_MOB_AGRO_IN_PEACEZONE = NPC.getBoolean("AltMobAgroInPeaceZone", true);
ALT_ATTACKABLE_NPCS = NPC.getBoolean("AltAttackableNpcs", true);
ALT_GAME_VIEWNPC = NPC.getBoolean("AltGameViewNpc", false);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
SHOW_NPC_LVL = NPC.getBoolean("ShowNpcLevel", false);
SHOW_NPC_AGGRESSION = NPC.getBoolean("ShowNpcAggression", false);
SHOW_CREST_WITHOUT_QUEST = NPC.getBoolean("ShowCrestWithoutQuest", false);
@ -2143,6 +2147,12 @@ public class Config
DEFAULT_CORPSE_TIME = NPC.getInt("DefaultCorpseTime", 7);
SPOILED_CORPSE_EXTEND_TIME = NPC.getInt("SpoiledCorpseExtendTime", 10);
CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY = NPC.getInt("CorpseConsumeSkillAllowedTimeBeforeDecay", 2000);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
AGGRO_DISTANCE_CHECK_ENABLED = NPC.getBoolean("AggroDistanceCheckEnabled", true);
AGGRO_DISTANCE_CHECK_RANGE = NPC.getInt("AggroDistanceCheckRange", 1500);
AGGRO_DISTANCE_CHECK_RAIDS = NPC.getBoolean("AggroDistanceCheckRaids", false);
AGGRO_DISTANCE_CHECK_INSTANCES = NPC.getBoolean("AggroDistanceCheckInstances", false);
AGGRO_DISTANCE_CHECK_RESTORE_LIFE = NPC.getBoolean("AggroDistanceCheckRestoreLife", true);
GUARD_ATTACK_AGGRO_MOB = NPC.getBoolean("GuardAttackAggroMob", false);
RAID_HP_REGEN_MULTIPLIER = NPC.getDouble("RaidHpRegenMultiplier", 100) / 100;
RAID_MP_REGEN_MULTIPLIER = NPC.getDouble("RaidMpRegenMultiplier", 100) / 100;

View File

@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.Spawn;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Attackable;
@ -629,12 +630,63 @@ public class AttackableAI extends CreatureAI
protected void thinkAttack()
{
final Attackable npc = getActiveChar();
if ((npc == null) || npc.isCastingNow())
{
return;
}
if (Config.AGGRO_DISTANCE_CHECK_ENABLED && npc.isMonster() && !npc.isWalker())
{
final Spawn spawn = npc.getSpawn();
if ((spawn != null) && (npc.calculateDistance3D(spawn.getLocation()) > Config.AGGRO_DISTANCE_CHECK_RANGE))
{
if ((Config.AGGRO_DISTANCE_CHECK_RAIDS || !npc.isRaid()) && (Config.AGGRO_DISTANCE_CHECK_INSTANCES || !npc.isInInstance()))
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
npc.setCurrentHp(npc.getMaxHp());
npc.setCurrentMp(npc.getMaxMp());
}
npc.abortAttack();
npc.clearAggroList();
npc.getAttackByList().clear();
if (npc.hasAI())
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
npc.teleToLocation(spawn.getLocation(), true);
}
// Minions should return as well.
if (((MonsterInstance) _actor).hasMinions())
{
for (MonsterInstance minion : ((MonsterInstance) _actor).getMinionList().getSpawnedMinions())
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
minion.setCurrentHp(minion.getMaxHp());
minion.setCurrentMp(minion.getMaxMp());
}
minion.abortAttack();
minion.clearAggroList();
minion.getAttackByList().clear();
if (minion.hasAI())
{
minion.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
minion.teleToLocation(spawn.getLocation(), true);
}
}
}
return;
}
}
}
Creature target = npc.getMostHated();
if (getTarget() != target)
{

View File

@ -28,11 +28,6 @@ AltAttackableNpcs = True
# Default: False
AltGameViewNpc = False
# Maximum distance mobs can randomly go from spawn point.
# DEFAULT NEEDS TO BE VERIFIED, MUST BE CHANGED HERE AND IN CONFIG.JAVA IF NOT CORRECT
# Default: 300
MaxDriftRange = 300
# Default: False
ShowNpcLevel = False
@ -90,6 +85,31 @@ SpoiledCorpseExtendTime = 10
# Default: 2000
CorpseConsumeSkillAllowedTimeBeforeDecay = 2000
# Maximum distance monsters can randomly move from spawn.
# Default: 300
MaxDriftRange = 300
# Enable monster aggro distance check.
# When enabled monsters will lose aggro if pulled far away from spawn.
# Default: False
AggroDistanceCheckEnabled = False
# Maximum distance monsters can be pulled away from spawn.
# Default: 1500
AggroDistanceCheckRange = 1500
# Use maximum aggro distance check for raids.
# Default: False
AggroDistanceCheckRaids = False
# Use maximum aggro distance check in instances.
# Default: False
AggroDistanceCheckInstances = False
# Restore monster HP and MP when aggro is reset by distance.
# Default: True
AggroDistanceCheckRestoreLife = True
# ---------------------------------------------------------------------------
# Guards

View File

@ -604,7 +604,6 @@ public class Config
public static boolean ALT_MOB_AGRO_IN_PEACEZONE;
public static boolean ALT_ATTACKABLE_NPCS;
public static boolean ALT_GAME_VIEWNPC;
public static int MAX_DRIFT_RANGE;
public static boolean SHOW_NPC_LVL;
public static boolean SHOW_NPC_AGGRESSION;
public static boolean SHOW_CREST_WITHOUT_QUEST;
@ -618,6 +617,12 @@ public class Config
public static int DEFAULT_CORPSE_TIME;
public static int SPOILED_CORPSE_EXTEND_TIME;
public static int CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY;
public static int MAX_DRIFT_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_ENABLED;
public static int AGGRO_DISTANCE_CHECK_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_RAIDS;
public static boolean AGGRO_DISTANCE_CHECK_INSTANCES;
public static boolean AGGRO_DISTANCE_CHECK_RESTORE_LIFE;
public static boolean GUARD_ATTACK_AGGRO_MOB;
public static double RAID_HP_REGEN_MULTIPLIER;
public static double RAID_MP_REGEN_MULTIPLIER;
@ -2109,7 +2114,6 @@ public class Config
ALT_MOB_AGRO_IN_PEACEZONE = NPC.getBoolean("AltMobAgroInPeaceZone", true);
ALT_ATTACKABLE_NPCS = NPC.getBoolean("AltAttackableNpcs", true);
ALT_GAME_VIEWNPC = NPC.getBoolean("AltGameViewNpc", false);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
SHOW_NPC_LVL = NPC.getBoolean("ShowNpcLevel", false);
SHOW_NPC_AGGRESSION = NPC.getBoolean("ShowNpcAggression", false);
SHOW_CREST_WITHOUT_QUEST = NPC.getBoolean("ShowCrestWithoutQuest", false);
@ -2123,6 +2127,12 @@ public class Config
DEFAULT_CORPSE_TIME = NPC.getInt("DefaultCorpseTime", 7);
SPOILED_CORPSE_EXTEND_TIME = NPC.getInt("SpoiledCorpseExtendTime", 10);
CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY = NPC.getInt("CorpseConsumeSkillAllowedTimeBeforeDecay", 2000);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
AGGRO_DISTANCE_CHECK_ENABLED = NPC.getBoolean("AggroDistanceCheckEnabled", true);
AGGRO_DISTANCE_CHECK_RANGE = NPC.getInt("AggroDistanceCheckRange", 1500);
AGGRO_DISTANCE_CHECK_RAIDS = NPC.getBoolean("AggroDistanceCheckRaids", false);
AGGRO_DISTANCE_CHECK_INSTANCES = NPC.getBoolean("AggroDistanceCheckInstances", false);
AGGRO_DISTANCE_CHECK_RESTORE_LIFE = NPC.getBoolean("AggroDistanceCheckRestoreLife", true);
GUARD_ATTACK_AGGRO_MOB = NPC.getBoolean("GuardAttackAggroMob", false);
RAID_HP_REGEN_MULTIPLIER = NPC.getDouble("RaidHpRegenMultiplier", 100) / 100;
RAID_MP_REGEN_MULTIPLIER = NPC.getDouble("RaidMpRegenMultiplier", 100) / 100;

View File

@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.Spawn;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Attackable;
@ -629,12 +630,63 @@ public class AttackableAI extends CreatureAI
protected void thinkAttack()
{
final Attackable npc = getActiveChar();
if ((npc == null) || npc.isCastingNow())
{
return;
}
if (Config.AGGRO_DISTANCE_CHECK_ENABLED && npc.isMonster() && !npc.isWalker())
{
final Spawn spawn = npc.getSpawn();
if ((spawn != null) && (npc.calculateDistance3D(spawn.getLocation()) > Config.AGGRO_DISTANCE_CHECK_RANGE))
{
if ((Config.AGGRO_DISTANCE_CHECK_RAIDS || !npc.isRaid()) && (Config.AGGRO_DISTANCE_CHECK_INSTANCES || !npc.isInInstance()))
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
npc.setCurrentHp(npc.getMaxHp());
npc.setCurrentMp(npc.getMaxMp());
}
npc.abortAttack();
npc.clearAggroList();
npc.getAttackByList().clear();
if (npc.hasAI())
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
npc.teleToLocation(spawn.getLocation(), true);
}
// Minions should return as well.
if (((MonsterInstance) _actor).hasMinions())
{
for (MonsterInstance minion : ((MonsterInstance) _actor).getMinionList().getSpawnedMinions())
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
minion.setCurrentHp(minion.getMaxHp());
minion.setCurrentMp(minion.getMaxMp());
}
minion.abortAttack();
minion.clearAggroList();
minion.getAttackByList().clear();
if (minion.hasAI())
{
minion.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
minion.teleToLocation(spawn.getLocation(), true);
}
}
}
return;
}
}
}
Creature target = npc.getMostHated();
if (getTarget() != target)
{

View File

@ -28,11 +28,6 @@ AltAttackableNpcs = True
# Default: False
AltGameViewNpc = False
# Maximum distance mobs can randomly go from spawn point.
# DEFAULT NEEDS TO BE VERIFIED, MUST BE CHANGED HERE AND IN CONFIG.JAVA IF NOT CORRECT
# Default: 300
MaxDriftRange = 300
# Default: False
ShowNpcLevel = False
@ -90,6 +85,31 @@ SpoiledCorpseExtendTime = 10
# Default: 2000
CorpseConsumeSkillAllowedTimeBeforeDecay = 2000
# Maximum distance monsters can randomly move from spawn.
# Default: 300
MaxDriftRange = 300
# Enable monster aggro distance check.
# When enabled monsters will lose aggro if pulled far away from spawn.
# Default: False
AggroDistanceCheckEnabled = False
# Maximum distance monsters can be pulled away from spawn.
# Default: 1500
AggroDistanceCheckRange = 1500
# Use maximum aggro distance check for raids.
# Default: False
AggroDistanceCheckRaids = False
# Use maximum aggro distance check in instances.
# Default: False
AggroDistanceCheckInstances = False
# Restore monster HP and MP when aggro is reset by distance.
# Default: True
AggroDistanceCheckRestoreLife = True
# ---------------------------------------------------------------------------
# Guards

View File

@ -599,7 +599,6 @@ public class Config
public static boolean ALT_MOB_AGRO_IN_PEACEZONE;
public static boolean ALT_ATTACKABLE_NPCS;
public static boolean ALT_GAME_VIEWNPC;
public static int MAX_DRIFT_RANGE;
public static boolean SHOW_NPC_LVL;
public static boolean SHOW_NPC_AGGRESSION;
public static boolean SHOW_CREST_WITHOUT_QUEST;
@ -613,6 +612,12 @@ public class Config
public static int DEFAULT_CORPSE_TIME;
public static int SPOILED_CORPSE_EXTEND_TIME;
public static int CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY;
public static int MAX_DRIFT_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_ENABLED;
public static int AGGRO_DISTANCE_CHECK_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_RAIDS;
public static boolean AGGRO_DISTANCE_CHECK_INSTANCES;
public static boolean AGGRO_DISTANCE_CHECK_RESTORE_LIFE;
public static boolean GUARD_ATTACK_AGGRO_MOB;
public static double RAID_HP_REGEN_MULTIPLIER;
public static double RAID_MP_REGEN_MULTIPLIER;
@ -2111,7 +2116,6 @@ public class Config
ALT_MOB_AGRO_IN_PEACEZONE = NPC.getBoolean("AltMobAgroInPeaceZone", true);
ALT_ATTACKABLE_NPCS = NPC.getBoolean("AltAttackableNpcs", true);
ALT_GAME_VIEWNPC = NPC.getBoolean("AltGameViewNpc", false);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
SHOW_NPC_LVL = NPC.getBoolean("ShowNpcLevel", false);
SHOW_NPC_AGGRESSION = NPC.getBoolean("ShowNpcAggression", false);
SHOW_CREST_WITHOUT_QUEST = NPC.getBoolean("ShowCrestWithoutQuest", false);
@ -2125,6 +2129,12 @@ public class Config
DEFAULT_CORPSE_TIME = NPC.getInt("DefaultCorpseTime", 7);
SPOILED_CORPSE_EXTEND_TIME = NPC.getInt("SpoiledCorpseExtendTime", 10);
CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY = NPC.getInt("CorpseConsumeSkillAllowedTimeBeforeDecay", 2000);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
AGGRO_DISTANCE_CHECK_ENABLED = NPC.getBoolean("AggroDistanceCheckEnabled", true);
AGGRO_DISTANCE_CHECK_RANGE = NPC.getInt("AggroDistanceCheckRange", 1500);
AGGRO_DISTANCE_CHECK_RAIDS = NPC.getBoolean("AggroDistanceCheckRaids", false);
AGGRO_DISTANCE_CHECK_INSTANCES = NPC.getBoolean("AggroDistanceCheckInstances", false);
AGGRO_DISTANCE_CHECK_RESTORE_LIFE = NPC.getBoolean("AggroDistanceCheckRestoreLife", true);
GUARD_ATTACK_AGGRO_MOB = NPC.getBoolean("GuardAttackAggroMob", false);
RAID_HP_REGEN_MULTIPLIER = NPC.getDouble("RaidHpRegenMultiplier", 100) / 100;
RAID_MP_REGEN_MULTIPLIER = NPC.getDouble("RaidMpRegenMultiplier", 100) / 100;

View File

@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.Spawn;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Attackable;
@ -629,12 +630,63 @@ public class AttackableAI extends CreatureAI
protected void thinkAttack()
{
final Attackable npc = getActiveChar();
if ((npc == null) || npc.isCastingNow())
{
return;
}
if (Config.AGGRO_DISTANCE_CHECK_ENABLED && npc.isMonster() && !npc.isWalker())
{
final Spawn spawn = npc.getSpawn();
if ((spawn != null) && (npc.calculateDistance3D(spawn.getLocation()) > Config.AGGRO_DISTANCE_CHECK_RANGE))
{
if ((Config.AGGRO_DISTANCE_CHECK_RAIDS || !npc.isRaid()) && (Config.AGGRO_DISTANCE_CHECK_INSTANCES || !npc.isInInstance()))
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
npc.setCurrentHp(npc.getMaxHp());
npc.setCurrentMp(npc.getMaxMp());
}
npc.abortAttack();
npc.clearAggroList();
npc.getAttackByList().clear();
if (npc.hasAI())
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
npc.teleToLocation(spawn.getLocation(), true);
}
// Minions should return as well.
if (((MonsterInstance) _actor).hasMinions())
{
for (MonsterInstance minion : ((MonsterInstance) _actor).getMinionList().getSpawnedMinions())
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
minion.setCurrentHp(minion.getMaxHp());
minion.setCurrentMp(minion.getMaxMp());
}
minion.abortAttack();
minion.clearAggroList();
minion.getAttackByList().clear();
if (minion.hasAI())
{
minion.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
minion.teleToLocation(spawn.getLocation(), true);
}
}
}
return;
}
}
}
Creature target = npc.getMostHated();
if (getTarget() != target)
{

View File

@ -28,11 +28,6 @@ AltAttackableNpcs = True
# Default: False
AltGameViewNpc = False
# Maximum distance mobs can randomly go from spawn point.
# DEFAULT NEEDS TO BE VERIFIED, MUST BE CHANGED HERE AND IN CONFIG.JAVA IF NOT CORRECT
# Default: 300
MaxDriftRange = 300
# Default: False
ShowNpcLevel = False
@ -90,6 +85,31 @@ SpoiledCorpseExtendTime = 10
# Default: 2000
CorpseConsumeSkillAllowedTimeBeforeDecay = 2000
# Maximum distance monsters can randomly move from spawn.
# Default: 300
MaxDriftRange = 300
# Enable monster aggro distance check.
# When enabled monsters will lose aggro if pulled far away from spawn.
# Default: False
AggroDistanceCheckEnabled = False
# Maximum distance monsters can be pulled away from spawn.
# Default: 1500
AggroDistanceCheckRange = 1500
# Use maximum aggro distance check for raids.
# Default: False
AggroDistanceCheckRaids = False
# Use maximum aggro distance check in instances.
# Default: False
AggroDistanceCheckInstances = False
# Restore monster HP and MP when aggro is reset by distance.
# Default: True
AggroDistanceCheckRestoreLife = True
# ---------------------------------------------------------------------------
# Guards

View File

@ -599,7 +599,6 @@ public class Config
public static boolean ALT_MOB_AGRO_IN_PEACEZONE;
public static boolean ALT_ATTACKABLE_NPCS;
public static boolean ALT_GAME_VIEWNPC;
public static int MAX_DRIFT_RANGE;
public static boolean SHOW_NPC_LVL;
public static boolean SHOW_NPC_AGGRESSION;
public static boolean SHOW_CREST_WITHOUT_QUEST;
@ -613,6 +612,12 @@ public class Config
public static int DEFAULT_CORPSE_TIME;
public static int SPOILED_CORPSE_EXTEND_TIME;
public static int CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY;
public static int MAX_DRIFT_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_ENABLED;
public static int AGGRO_DISTANCE_CHECK_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_RAIDS;
public static boolean AGGRO_DISTANCE_CHECK_INSTANCES;
public static boolean AGGRO_DISTANCE_CHECK_RESTORE_LIFE;
public static boolean GUARD_ATTACK_AGGRO_MOB;
public static double RAID_HP_REGEN_MULTIPLIER;
public static double RAID_MP_REGEN_MULTIPLIER;
@ -2111,7 +2116,6 @@ public class Config
ALT_MOB_AGRO_IN_PEACEZONE = NPC.getBoolean("AltMobAgroInPeaceZone", true);
ALT_ATTACKABLE_NPCS = NPC.getBoolean("AltAttackableNpcs", true);
ALT_GAME_VIEWNPC = NPC.getBoolean("AltGameViewNpc", false);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
SHOW_NPC_LVL = NPC.getBoolean("ShowNpcLevel", false);
SHOW_NPC_AGGRESSION = NPC.getBoolean("ShowNpcAggression", false);
SHOW_CREST_WITHOUT_QUEST = NPC.getBoolean("ShowCrestWithoutQuest", false);
@ -2125,6 +2129,12 @@ public class Config
DEFAULT_CORPSE_TIME = NPC.getInt("DefaultCorpseTime", 7);
SPOILED_CORPSE_EXTEND_TIME = NPC.getInt("SpoiledCorpseExtendTime", 10);
CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY = NPC.getInt("CorpseConsumeSkillAllowedTimeBeforeDecay", 2000);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
AGGRO_DISTANCE_CHECK_ENABLED = NPC.getBoolean("AggroDistanceCheckEnabled", true);
AGGRO_DISTANCE_CHECK_RANGE = NPC.getInt("AggroDistanceCheckRange", 1500);
AGGRO_DISTANCE_CHECK_RAIDS = NPC.getBoolean("AggroDistanceCheckRaids", false);
AGGRO_DISTANCE_CHECK_INSTANCES = NPC.getBoolean("AggroDistanceCheckInstances", false);
AGGRO_DISTANCE_CHECK_RESTORE_LIFE = NPC.getBoolean("AggroDistanceCheckRestoreLife", true);
GUARD_ATTACK_AGGRO_MOB = NPC.getBoolean("GuardAttackAggroMob", false);
RAID_HP_REGEN_MULTIPLIER = NPC.getDouble("RaidHpRegenMultiplier", 100) / 100;
RAID_MP_REGEN_MULTIPLIER = NPC.getDouble("RaidMpRegenMultiplier", 100) / 100;

View File

@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.Spawn;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Attackable;
@ -629,12 +630,63 @@ public class AttackableAI extends CreatureAI
protected void thinkAttack()
{
final Attackable npc = getActiveChar();
if ((npc == null) || npc.isCastingNow())
{
return;
}
if (Config.AGGRO_DISTANCE_CHECK_ENABLED && npc.isMonster() && !npc.isWalker())
{
final Spawn spawn = npc.getSpawn();
if ((spawn != null) && (npc.calculateDistance3D(spawn.getLocation()) > Config.AGGRO_DISTANCE_CHECK_RANGE))
{
if ((Config.AGGRO_DISTANCE_CHECK_RAIDS || !npc.isRaid()) && (Config.AGGRO_DISTANCE_CHECK_INSTANCES || !npc.isInInstance()))
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
npc.setCurrentHp(npc.getMaxHp());
npc.setCurrentMp(npc.getMaxMp());
}
npc.abortAttack();
npc.clearAggroList();
npc.getAttackByList().clear();
if (npc.hasAI())
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
npc.teleToLocation(spawn.getLocation(), true);
}
// Minions should return as well.
if (((MonsterInstance) _actor).hasMinions())
{
for (MonsterInstance minion : ((MonsterInstance) _actor).getMinionList().getSpawnedMinions())
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
minion.setCurrentHp(minion.getMaxHp());
minion.setCurrentMp(minion.getMaxMp());
}
minion.abortAttack();
minion.clearAggroList();
minion.getAttackByList().clear();
if (minion.hasAI())
{
minion.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
minion.teleToLocation(spawn.getLocation(), true);
}
}
}
return;
}
}
}
Creature target = npc.getMostHated();
if (getTarget() != target)
{

View File

@ -28,11 +28,6 @@ AltAttackableNpcs = True
# Default: False
AltGameViewNpc = False
# Maximum distance mobs can randomly go from spawn point.
# DEFAULT NEEDS TO BE VERIFIED, MUST BE CHANGED HERE AND IN CONFIG.JAVA IF NOT CORRECT
# Default: 300
MaxDriftRange = 300
# Default: False
ShowNpcLevel = False
@ -90,6 +85,31 @@ SpoiledCorpseExtendTime = 10
# Default: 2000
CorpseConsumeSkillAllowedTimeBeforeDecay = 2000
# Maximum distance monsters can randomly move from spawn.
# Default: 300
MaxDriftRange = 300
# Enable monster aggro distance check.
# When enabled monsters will lose aggro if pulled far away from spawn.
# Default: True
AggroDistanceCheckEnabled = True
# Maximum distance monsters can be pulled away from spawn.
# Default: 1500
AggroDistanceCheckRange = 1500
# Use maximum aggro distance check for raids.
# Default: False
AggroDistanceCheckRaids = False
# Use maximum aggro distance check in instances.
# Default: False
AggroDistanceCheckInstances = False
# Restore monster HP and MP when aggro is reset by distance.
# Default: True
AggroDistanceCheckRestoreLife = True
# ---------------------------------------------------------------------------
# Guards

View File

@ -600,7 +600,6 @@ public class Config
public static boolean ALT_MOB_AGRO_IN_PEACEZONE;
public static boolean ALT_ATTACKABLE_NPCS;
public static boolean ALT_GAME_VIEWNPC;
public static int MAX_DRIFT_RANGE;
public static boolean SHOW_NPC_LVL;
public static boolean SHOW_NPC_AGGRESSION;
public static boolean SHOW_CREST_WITHOUT_QUEST;
@ -614,6 +613,12 @@ public class Config
public static int DEFAULT_CORPSE_TIME;
public static int SPOILED_CORPSE_EXTEND_TIME;
public static int CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY;
public static int MAX_DRIFT_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_ENABLED;
public static int AGGRO_DISTANCE_CHECK_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_RAIDS;
public static boolean AGGRO_DISTANCE_CHECK_INSTANCES;
public static boolean AGGRO_DISTANCE_CHECK_RESTORE_LIFE;
public static boolean GUARD_ATTACK_AGGRO_MOB;
public static double RAID_HP_REGEN_MULTIPLIER;
public static double RAID_MP_REGEN_MULTIPLIER;
@ -2149,7 +2154,6 @@ public class Config
ALT_MOB_AGRO_IN_PEACEZONE = NPC.getBoolean("AltMobAgroInPeaceZone", true);
ALT_ATTACKABLE_NPCS = NPC.getBoolean("AltAttackableNpcs", true);
ALT_GAME_VIEWNPC = NPC.getBoolean("AltGameViewNpc", false);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
SHOW_NPC_LVL = NPC.getBoolean("ShowNpcLevel", false);
SHOW_NPC_AGGRESSION = NPC.getBoolean("ShowNpcAggression", false);
SHOW_CREST_WITHOUT_QUEST = NPC.getBoolean("ShowCrestWithoutQuest", false);
@ -2163,6 +2167,12 @@ public class Config
DEFAULT_CORPSE_TIME = NPC.getInt("DefaultCorpseTime", 7);
SPOILED_CORPSE_EXTEND_TIME = NPC.getInt("SpoiledCorpseExtendTime", 10);
CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY = NPC.getInt("CorpseConsumeSkillAllowedTimeBeforeDecay", 2000);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
AGGRO_DISTANCE_CHECK_ENABLED = NPC.getBoolean("AggroDistanceCheckEnabled", true);
AGGRO_DISTANCE_CHECK_RANGE = NPC.getInt("AggroDistanceCheckRange", 1500);
AGGRO_DISTANCE_CHECK_RAIDS = NPC.getBoolean("AggroDistanceCheckRaids", false);
AGGRO_DISTANCE_CHECK_INSTANCES = NPC.getBoolean("AggroDistanceCheckInstances", false);
AGGRO_DISTANCE_CHECK_RESTORE_LIFE = NPC.getBoolean("AggroDistanceCheckRestoreLife", true);
GUARD_ATTACK_AGGRO_MOB = NPC.getBoolean("GuardAttackAggroMob", false);
RAID_HP_REGEN_MULTIPLIER = NPC.getDouble("RaidHpRegenMultiplier", 100) / 100;
RAID_MP_REGEN_MULTIPLIER = NPC.getDouble("RaidMpRegenMultiplier", 100) / 100;

View File

@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.Spawn;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Attackable;
@ -629,12 +630,63 @@ public class AttackableAI extends CreatureAI
protected void thinkAttack()
{
final Attackable npc = getActiveChar();
if ((npc == null) || npc.isCastingNow())
{
return;
}
if (Config.AGGRO_DISTANCE_CHECK_ENABLED && npc.isMonster() && !npc.isWalker())
{
final Spawn spawn = npc.getSpawn();
if ((spawn != null) && (npc.calculateDistance3D(spawn.getLocation()) > Config.AGGRO_DISTANCE_CHECK_RANGE))
{
if ((Config.AGGRO_DISTANCE_CHECK_RAIDS || !npc.isRaid()) && (Config.AGGRO_DISTANCE_CHECK_INSTANCES || !npc.isInInstance()))
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
npc.setCurrentHp(npc.getMaxHp());
npc.setCurrentMp(npc.getMaxMp());
}
npc.abortAttack();
npc.clearAggroList();
npc.getAttackByList().clear();
if (npc.hasAI())
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
npc.teleToLocation(spawn.getLocation(), true);
}
// Minions should return as well.
if (((MonsterInstance) _actor).hasMinions())
{
for (MonsterInstance minion : ((MonsterInstance) _actor).getMinionList().getSpawnedMinions())
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
minion.setCurrentHp(minion.getMaxHp());
minion.setCurrentMp(minion.getMaxMp());
}
minion.abortAttack();
minion.clearAggroList();
minion.getAttackByList().clear();
if (minion.hasAI())
{
minion.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
minion.teleToLocation(spawn.getLocation(), true);
}
}
}
return;
}
}
}
Creature target = npc.getMostHated();
if (getTarget() != target)
{

View File

@ -28,11 +28,6 @@ AltAttackableNpcs = True
# Default: False
AltGameViewNpc = False
# Maximum distance mobs can randomly go from spawn point.
# DEFAULT NEEDS TO BE VERIFIED, MUST BE CHANGED HERE AND IN CONFIG.JAVA IF NOT CORRECT
# Default: 300
MaxDriftRange = 300
# Default: False
ShowNpcLevel = False
@ -90,6 +85,31 @@ SpoiledCorpseExtendTime = 10
# Default: 2000
CorpseConsumeSkillAllowedTimeBeforeDecay = 2000
# Maximum distance monsters can randomly move from spawn.
# Default: 300
MaxDriftRange = 300
# Enable monster aggro distance check.
# When enabled monsters will lose aggro if pulled far away from spawn.
# Default: True
AggroDistanceCheckEnabled = True
# Maximum distance monsters can be pulled away from spawn.
# Default: 1500
AggroDistanceCheckRange = 1500
# Use maximum aggro distance check for raids.
# Default: False
AggroDistanceCheckRaids = False
# Use maximum aggro distance check in instances.
# Default: False
AggroDistanceCheckInstances = False
# Restore monster HP and MP when aggro is reset by distance.
# Default: True
AggroDistanceCheckRestoreLife = True
# ---------------------------------------------------------------------------
# Guards

View File

@ -600,7 +600,6 @@ public class Config
public static boolean ALT_MOB_AGRO_IN_PEACEZONE;
public static boolean ALT_ATTACKABLE_NPCS;
public static boolean ALT_GAME_VIEWNPC;
public static int MAX_DRIFT_RANGE;
public static boolean SHOW_NPC_LVL;
public static boolean SHOW_NPC_AGGRESSION;
public static boolean SHOW_CREST_WITHOUT_QUEST;
@ -614,6 +613,12 @@ public class Config
public static int DEFAULT_CORPSE_TIME;
public static int SPOILED_CORPSE_EXTEND_TIME;
public static int CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY;
public static int MAX_DRIFT_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_ENABLED;
public static int AGGRO_DISTANCE_CHECK_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_RAIDS;
public static boolean AGGRO_DISTANCE_CHECK_INSTANCES;
public static boolean AGGRO_DISTANCE_CHECK_RESTORE_LIFE;
public static boolean GUARD_ATTACK_AGGRO_MOB;
public static double RAID_HP_REGEN_MULTIPLIER;
public static double RAID_MP_REGEN_MULTIPLIER;
@ -2164,7 +2169,6 @@ public class Config
ALT_MOB_AGRO_IN_PEACEZONE = NPC.getBoolean("AltMobAgroInPeaceZone", true);
ALT_ATTACKABLE_NPCS = NPC.getBoolean("AltAttackableNpcs", true);
ALT_GAME_VIEWNPC = NPC.getBoolean("AltGameViewNpc", false);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
SHOW_NPC_LVL = NPC.getBoolean("ShowNpcLevel", false);
SHOW_NPC_AGGRESSION = NPC.getBoolean("ShowNpcAggression", false);
SHOW_CREST_WITHOUT_QUEST = NPC.getBoolean("ShowCrestWithoutQuest", false);
@ -2178,6 +2182,12 @@ public class Config
DEFAULT_CORPSE_TIME = NPC.getInt("DefaultCorpseTime", 7);
SPOILED_CORPSE_EXTEND_TIME = NPC.getInt("SpoiledCorpseExtendTime", 10);
CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY = NPC.getInt("CorpseConsumeSkillAllowedTimeBeforeDecay", 2000);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
AGGRO_DISTANCE_CHECK_ENABLED = NPC.getBoolean("AggroDistanceCheckEnabled", true);
AGGRO_DISTANCE_CHECK_RANGE = NPC.getInt("AggroDistanceCheckRange", 1500);
AGGRO_DISTANCE_CHECK_RAIDS = NPC.getBoolean("AggroDistanceCheckRaids", false);
AGGRO_DISTANCE_CHECK_INSTANCES = NPC.getBoolean("AggroDistanceCheckInstances", false);
AGGRO_DISTANCE_CHECK_RESTORE_LIFE = NPC.getBoolean("AggroDistanceCheckRestoreLife", true);
GUARD_ATTACK_AGGRO_MOB = NPC.getBoolean("GuardAttackAggroMob", false);
RAID_HP_REGEN_MULTIPLIER = NPC.getDouble("RaidHpRegenMultiplier", 100) / 100;
RAID_MP_REGEN_MULTIPLIER = NPC.getDouble("RaidMpRegenMultiplier", 100) / 100;

View File

@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.Spawn;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Attackable;
@ -629,12 +630,63 @@ public class AttackableAI extends CreatureAI
protected void thinkAttack()
{
final Attackable npc = getActiveChar();
if ((npc == null) || npc.isCastingNow())
{
return;
}
if (Config.AGGRO_DISTANCE_CHECK_ENABLED && npc.isMonster() && !npc.isWalker())
{
final Spawn spawn = npc.getSpawn();
if ((spawn != null) && (npc.calculateDistance3D(spawn.getLocation()) > Config.AGGRO_DISTANCE_CHECK_RANGE))
{
if ((Config.AGGRO_DISTANCE_CHECK_RAIDS || !npc.isRaid()) && (Config.AGGRO_DISTANCE_CHECK_INSTANCES || !npc.isInInstance()))
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
npc.setCurrentHp(npc.getMaxHp());
npc.setCurrentMp(npc.getMaxMp());
}
npc.abortAttack();
npc.clearAggroList();
npc.getAttackByList().clear();
if (npc.hasAI())
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
npc.teleToLocation(spawn.getLocation(), true);
}
// Minions should return as well.
if (((MonsterInstance) _actor).hasMinions())
{
for (MonsterInstance minion : ((MonsterInstance) _actor).getMinionList().getSpawnedMinions())
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
minion.setCurrentHp(minion.getMaxHp());
minion.setCurrentMp(minion.getMaxMp());
}
minion.abortAttack();
minion.clearAggroList();
minion.getAttackByList().clear();
if (minion.hasAI())
{
minion.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
minion.teleToLocation(spawn.getLocation(), true);
}
}
}
return;
}
}
}
Creature target = npc.getMostHated();
if (getTarget() != target)
{

View File

@ -583,8 +583,30 @@ ForceInventoryUpdate = False
# WARNING: Higher traffic loads.
ForceCompletePlayerStatusUpdate = True
# The maximum deviation from the point of Spawn mobs
MaxDriftRange = 200
# Maximum distance monsters can randomly move from spawn.
# Default: 300
MaxDriftRange = 300
# Enable monster aggro distance check.
# When enabled monsters will lose aggro if pulled far away from spawn.
# Default: False
AggroDistanceCheckEnabled = False
# Maximum distance monsters can be pulled away from spawn.
# Default: 1500
AggroDistanceCheckRange = 1500
# Use maximum aggro distance check for raids.
# Default: False
AggroDistanceCheckRaids = False
# Use maximum aggro distance check in instances.
# Default: False
AggroDistanceCheckInstances = False
# Restore monster HP and MP when aggro is reset by distance.
# Default: True
AggroDistanceCheckRestoreLife = True
# Minimum and maximum variables in seconds for NPC animation delay.
# You must keep MinNpcAnimation lower or equal to MaxNpcAnimation.

View File

@ -138,6 +138,11 @@ public class Config
public static boolean MULTIPLE_ITEM_DROP;
public static int DELETE_DAYS;
public static int MAX_DRIFT_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_ENABLED;
public static int AGGRO_DISTANCE_CHECK_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_RAIDS;
public static boolean AGGRO_DISTANCE_CHECK_INSTANCES;
public static boolean AGGRO_DISTANCE_CHECK_RESTORE_LIFE;
public static boolean ALLOWFISHING;
public static boolean ALLOW_MANOR;
public static int AUTODESTROY_ITEM_AFTER;
@ -1635,6 +1640,11 @@ public class Config
ZONE_TOWN = Integer.parseInt(generalSettings.getProperty("ZoneTown", "0"));
MAX_DRIFT_RANGE = Integer.parseInt(generalSettings.getProperty("MaxDriftRange", "300"));
AGGRO_DISTANCE_CHECK_ENABLED = Boolean.parseBoolean(generalSettings.getProperty("AggroDistanceCheckEnabled", "false"));
AGGRO_DISTANCE_CHECK_RANGE = Integer.parseInt(generalSettings.getProperty("AggroDistanceCheckRange", "1500"));
AGGRO_DISTANCE_CHECK_RAIDS = Boolean.parseBoolean(generalSettings.getProperty("AggroDistanceCheckRaids", "false"));
AGGRO_DISTANCE_CHECK_INSTANCES = Boolean.parseBoolean(generalSettings.getProperty("AggroDistanceCheckInstances", "false"));
AGGRO_DISTANCE_CHECK_RESTORE_LIFE = Boolean.parseBoolean(generalSettings.getProperty("AggroDistanceCheckRestoreLife", "true"));
MIN_NPC_ANIMATION = Integer.parseInt(generalSettings.getProperty("MinNpcAnimation", "5"));
MAX_NPC_ANIMATION = Integer.parseInt(generalSettings.getProperty("MaxNpcAnimation", "60"));

View File

@ -46,6 +46,7 @@ import org.l2jmobius.gameserver.model.actor.instance.GuardInstance;
import org.l2jmobius.gameserver.model.actor.instance.MinionInstance;
import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
import org.l2jmobius.gameserver.model.actor.instance.NpcWalkerInstance;
import org.l2jmobius.gameserver.model.actor.instance.PenaltyMonsterInstance;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.instance.RaidBossInstance;
@ -54,6 +55,7 @@ import org.l2jmobius.gameserver.model.items.Weapon;
import org.l2jmobius.gameserver.model.items.type.WeaponType;
import org.l2jmobius.gameserver.model.quest.EventType;
import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.model.spawn.Spawn;
/**
* This class manages AI of Attackable.<BR>
@ -609,8 +611,6 @@ public class AttackableAI extends CreatureAI
z1 = npc.getZ();
}
// LOGGER.config("Curent pos ("+getX()+", "+getY()+"), moving to ("+x1+", "+y1+").");
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
moveTo(x1, y1, z1);
}
}
@ -633,6 +633,58 @@ public class AttackableAI extends CreatureAI
{
return;
}
if (Config.AGGRO_DISTANCE_CHECK_ENABLED && _actor.isMonster() && !(_actor instanceof NpcWalkerInstance))
{
final Spawn spawn = ((NpcInstance) _actor).getSpawn();
if ((spawn != null) && !_actor.isInsideRadius(spawn.getX(), spawn.getY(), spawn.getZ(), Config.AGGRO_DISTANCE_CHECK_RANGE, true, false))
{
if ((Config.AGGRO_DISTANCE_CHECK_RAIDS || !_actor.isRaid()) && (Config.AGGRO_DISTANCE_CHECK_INSTANCES || (_actor.getInstanceId() == 0)))
{
final Location spawnLocation = new Location(spawn.getX(), spawn.getY(), spawn.getZ());
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
_actor.setCurrentHp(_actor.getMaxHp());
_actor.setCurrentMp(_actor.getMaxMp());
}
_actor.abortAttack();
_actor.getAttackByList().clear();
if (_actor.hasAI())
{
setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawnLocation);
}
else
{
_actor.teleToLocation(spawnLocation, true);
}
// Minions should return as well.
if (((MonsterInstance) _actor).hasMinions())
{
for (MinionInstance minion : ((MonsterInstance) _actor).getSpawnedMinions())
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
minion.setCurrentHp(minion.getMaxHp());
minion.setCurrentMp(minion.getMaxMp());
}
minion.abortAttack();
minion.getAttackByList().clear();
if (minion.hasAI())
{
minion.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new Location(spawn.getX(), spawn.getY(), spawn.getZ()));
}
else
{
minion.teleToLocation(spawnLocation, true);
}
}
}
return;
}
}
}
if (_attackTimeout < GameTimeController.getGameTicks())
{
// Check if the actor is running
@ -663,20 +715,6 @@ public class AttackableAI extends CreatureAI
return;
}
/*
* // Handle all WorldObject of its Faction inside the Faction Range if (_actor instanceof NpcInstance && ((NpcInstance) _actor).getFactionId() != null) { String faction_id = ((NpcInstance) _actor).getFactionId(); // Go through all WorldObject that belong to its faction
* Collection<WorldObject> objs = _actor.getKnownList().getKnownObjects().values(); //synchronized (_actor.getKnownList().getKnownObjects()) try { for (WorldObject obj : objs) { if (obj instanceof NpcInstance) { NpcInstance npc = (NpcInstance) obj; //Handle SevenSigns mob Factions String
* npcfaction = npc.getFactionId(); boolean sevenSignFaction = false; // TODO: Unhardcode this by AI scripts (DrHouse) //Catacomb mobs should assist lilim and nephilim other than dungeon if ("c_dungeon_clan".equals(faction_id) && ("c_dungeon_lilim".equals(npcfaction) ||
* "c_dungeon_nephi".equals(npcfaction))) sevenSignFaction = true; //Lilim mobs should assist other Lilim and catacomb mobs else if ("c_dungeon_lilim".equals(faction_id) && "c_dungeon_clan".equals(npcfaction)) sevenSignFaction = true; //Nephilim mobs should assist other Nephilim and catacomb
* mobs else if ("c_dungeon_nephi".equals(faction_id) && "c_dungeon_clan".equals(npcfaction)) sevenSignFaction = true; if (!faction_id.equals(npc.getFactionId()) && !sevenSignFaction) continue; // Check if the WorldObject is inside the Faction Range of // the actor if
* (_actor.isInsideRadius(npc, npc.getFactionRange() + npc.getTemplate().collisionRadius, true, false) && npc.getAI() != null) { if (Math.abs(originalAttackTarget.getZ() - npc.getZ()) < 600 && _actor.getAttackByList().contains(originalAttackTarget) && (npc.getAI()._intention ==
* CtrlIntention.AI_INTENTION_IDLE || npc.getAI()._intention == CtrlIntention.AI_INTENTION_ACTIVE) && GeoEngine.getInstance().canSeeTarget(_actor, npc)) { if ((originalAttackTarget instanceof PlayerInstance) || (originalAttackTarget instanceof Summon)) { if
* (npc.getTemplate().getEventQuests(EventType.ON_FACTION_CALL) != null) { PlayerInstance player = (originalAttackTarget instanceof PlayerInstance) ? (PlayerInstance) originalAttackTarget : ((Summon) originalAttackTarget).getOwner(); for (Quest quest :
* npc.getTemplate().getEventQuests(EventType.ON_FACTION_CALL)) quest.notifyFactionCall(npc, (NpcInstance) _actor, player, (originalAttackTarget instanceof Summon)); } } else if (npc instanceof Attackable && getAttackTarget() != null && npc.getAI()._intention !=
* CtrlIntention.AI_INTENTION_ATTACK) { ((Attackable) npc).addDamageHate(getAttackTarget(), 0, ((Attackable) _actor).getHating(getAttackTarget())); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, getAttackTarget()); } } } } } } catch (NullPointerException e) { LOGGER.warning(
* "AttackableAI: thinkAttack() faction call failed: " + e.getMessage()); } }
*/
// Call all WorldObject of its Faction inside the Faction Range
if (((NpcInstance) _actor).getFactionId() != null)
{

View File

@ -28,17 +28,6 @@ AltAttackableNpcs = True
# Default: False
AltGameViewNpc = False
# Maximum distance mobs can get aggro.
# Related post at https://l2jserver.com/forum/viewtopic.php?f=128&t=31588
# Default: 1500
# L2jMobius: 450
MaxAggroRange = 450
# Maximum distance mobs can randomly go from spawn point.
# DEFAULT NEEDS TO BE VERIFIED, MUST BE CHANGED HERE AND IN CONFIG.JAVA IF NOT CORRECT
# Default: 300
MaxDriftRange = 300
# Default: False
ShowNpcLevel = False
@ -103,6 +92,37 @@ SpoiledCorpseExtendTime = 10
# Default: 2000
CorpseConsumeSkillAllowedTimeBeforeDecay = 2000
# Maximum distance mobs can get aggro.
# Related post at https://l2jserver.com/forum/viewtopic.php?f=128&t=31588
# Default: 1500
# L2jMobius: 450
MaxAggroRange = 450
# Maximum distance monsters can randomly move from spawn.
# Default: 300
MaxDriftRange = 300
# Enable monster aggro distance check.
# When enabled monsters will lose aggro if pulled far away from spawn.
# Default: False
AggroDistanceCheckEnabled = False
# Maximum distance monsters can be pulled away from spawn.
# Default: 1500
AggroDistanceCheckRange = 1500
# Use maximum aggro distance check for raids.
# Default: False
AggroDistanceCheckRaids = False
# Use maximum aggro distance check in instances.
# Default: False
AggroDistanceCheckInstances = False
# Restore monster HP and MP when aggro is reset by distance.
# Default: True
AggroDistanceCheckRestoreLife = True
# ---------------------------------------------------------------------------
# Guards

View File

@ -708,8 +708,6 @@ public class Config
public static boolean ALT_MOB_AGRO_IN_PEACEZONE;
public static boolean ALT_ATTACKABLE_NPCS;
public static boolean ALT_GAME_VIEWNPC;
public static int MAX_AGGRO_RANGE;
public static int MAX_DRIFT_RANGE;
public static boolean SHOW_NPC_LVL;
public static boolean SHOW_NPC_AGGRESSION;
public static boolean SHOW_CREST_WITHOUT_QUEST;
@ -724,6 +722,13 @@ public class Config
public static int DEFAULT_CORPSE_TIME;
public static int SPOILED_CORPSE_EXTEND_TIME;
public static int CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY;
public static int MAX_AGGRO_RANGE;
public static int MAX_DRIFT_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_ENABLED;
public static int AGGRO_DISTANCE_CHECK_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_RAIDS;
public static boolean AGGRO_DISTANCE_CHECK_INSTANCES;
public static boolean AGGRO_DISTANCE_CHECK_RESTORE_LIFE;
public static boolean GUARD_ATTACK_AGGRO_MOB;
public static boolean ENABLE_GUARD_RETURN;
public static boolean ALLOW_WYVERN_UPGRADER;
@ -2238,8 +2243,6 @@ public class Config
ALT_MOB_AGRO_IN_PEACEZONE = NPC.getBoolean("AltMobAgroInPeaceZone", true);
ALT_ATTACKABLE_NPCS = NPC.getBoolean("AltAttackableNpcs", true);
ALT_GAME_VIEWNPC = NPC.getBoolean("AltGameViewNpc", false);
MAX_AGGRO_RANGE = NPC.getInt("MaxAggroRange", 450);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
SHOW_NPC_LVL = NPC.getBoolean("ShowNpcLevel", false);
SHOW_NPC_AGGRESSION = NPC.getBoolean("ShowNpcAggression", false);
SHOW_CREST_WITHOUT_QUEST = NPC.getBoolean("ShowCrestWithoutQuest", false);
@ -2254,6 +2257,13 @@ public class Config
DEFAULT_CORPSE_TIME = NPC.getInt("DefaultCorpseTime", 7);
SPOILED_CORPSE_EXTEND_TIME = NPC.getInt("SpoiledCorpseExtendTime", 10);
CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY = NPC.getInt("CorpseConsumeSkillAllowedTimeBeforeDecay", 2000);
MAX_AGGRO_RANGE = NPC.getInt("MaxAggroRange", 450);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
AGGRO_DISTANCE_CHECK_ENABLED = NPC.getBoolean("AggroDistanceCheckEnabled", false);
AGGRO_DISTANCE_CHECK_RANGE = NPC.getInt("AggroDistanceCheckRange", 1500);
AGGRO_DISTANCE_CHECK_RAIDS = NPC.getBoolean("AggroDistanceCheckRaids", false);
AGGRO_DISTANCE_CHECK_INSTANCES = NPC.getBoolean("AggroDistanceCheckInstances", false);
AGGRO_DISTANCE_CHECK_RESTORE_LIFE = NPC.getBoolean("AggroDistanceCheckRestoreLife", true);
GUARD_ATTACK_AGGRO_MOB = NPC.getBoolean("GuardAttackAggroMob", false);
ENABLE_GUARD_RETURN = NPC.getBoolean("EnableGuardReturn", false);
ALLOW_WYVERN_UPGRADER = NPC.getBoolean("AllowWyvernUpgrader", false);

View File

@ -35,6 +35,7 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.instancemanager.DimensionalRiftManager;
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.Spawn;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Attackable;
@ -760,11 +761,63 @@ public class AttackableAI extends CreatureAI
protected void thinkAttack()
{
final Attackable npc = getActiveChar();
if (npc.isCastingNow())
if ((npc == null) || npc.isCastingNow())
{
return;
}
if (Config.AGGRO_DISTANCE_CHECK_ENABLED && npc.isMonster() && !npc.isWalker())
{
final Spawn spawn = npc.getSpawn();
if ((spawn != null) && (npc.calculateDistance3D(spawn.getLocation()) > Config.AGGRO_DISTANCE_CHECK_RANGE))
{
if ((Config.AGGRO_DISTANCE_CHECK_RAIDS || !npc.isRaid()) && (Config.AGGRO_DISTANCE_CHECK_INSTANCES || (npc.getInstanceId() == 0)))
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
npc.setCurrentHp(npc.getMaxHp());
npc.setCurrentMp(npc.getMaxMp());
}
npc.abortAttack();
npc.clearAggroList();
npc.getAttackByList().clear();
if (npc.hasAI())
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
npc.teleToLocation(spawn.getLocation(), true);
}
// Minions should return as well.
if (((MonsterInstance) _actor).hasMinions())
{
for (MonsterInstance minion : ((MonsterInstance) _actor).getMinionList().getSpawnedMinions())
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
minion.setCurrentHp(minion.getMaxHp());
minion.setCurrentMp(minion.getMaxMp());
}
minion.abortAttack();
minion.clearAggroList();
minion.getAttackByList().clear();
if (minion.hasAI())
{
minion.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
minion.teleToLocation(spawn.getLocation(), true);
}
}
}
return;
}
}
}
if (npc.isCoreAIDisabled())
{
return;

View File

@ -28,17 +28,6 @@ AltAttackableNpcs = True
# Default: False
AltGameViewNpc = False
# Maximum distance mobs can get aggro.
# Related post at https://l2jserver.com/forum/viewtopic.php?f=128&t=31588
# Default: 1500
# L2jMobius: 450
MaxAggroRange = 450
# Maximum distance mobs can randomly go from spawn point.
# DEFAULT NEEDS TO BE VERIFIED, MUST BE CHANGED HERE AND IN CONFIG.JAVA IF NOT CORRECT
# Default: 300
MaxDriftRange = 300
# Default: False
ShowNpcLevel = False
@ -103,6 +92,37 @@ SpoiledCorpseExtendTime = 10
# Default: 2000
CorpseConsumeSkillAllowedTimeBeforeDecay = 2000
# Maximum distance mobs can get aggro.
# Related post at https://l2jserver.com/forum/viewtopic.php?f=128&t=31588
# Default: 1500
# L2jMobius: 450
MaxAggroRange = 450
# Maximum distance monsters can randomly move from spawn.
# Default: 300
MaxDriftRange = 300
# Enable monster aggro distance check.
# When enabled monsters will lose aggro if pulled far away from spawn.
# Default: False
AggroDistanceCheckEnabled = False
# Maximum distance monsters can be pulled away from spawn.
# Default: 1500
AggroDistanceCheckRange = 1500
# Use maximum aggro distance check for raids.
# Default: False
AggroDistanceCheckRaids = False
# Use maximum aggro distance check in instances.
# Default: False
AggroDistanceCheckInstances = False
# Restore monster HP and MP when aggro is reset by distance.
# Default: True
AggroDistanceCheckRestoreLife = True
# ---------------------------------------------------------------------------
# Guards

View File

@ -713,8 +713,6 @@ public class Config
public static boolean ALT_MOB_AGRO_IN_PEACEZONE;
public static boolean ALT_ATTACKABLE_NPCS;
public static boolean ALT_GAME_VIEWNPC;
public static int MAX_AGGRO_RANGE;
public static int MAX_DRIFT_RANGE;
public static boolean SHOW_NPC_LVL;
public static boolean SHOW_NPC_AGGRESSION;
public static boolean SHOW_CREST_WITHOUT_QUEST;
@ -729,6 +727,13 @@ public class Config
public static int DEFAULT_CORPSE_TIME;
public static int SPOILED_CORPSE_EXTEND_TIME;
public static int CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY;
public static int MAX_AGGRO_RANGE;
public static int MAX_DRIFT_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_ENABLED;
public static int AGGRO_DISTANCE_CHECK_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_RAIDS;
public static boolean AGGRO_DISTANCE_CHECK_INSTANCES;
public static boolean AGGRO_DISTANCE_CHECK_RESTORE_LIFE;
public static boolean GUARD_ATTACK_AGGRO_MOB;
public static boolean ENABLE_GUARD_RETURN;
public static boolean ALLOW_WYVERN_UPGRADER;
@ -2244,8 +2249,6 @@ public class Config
ALT_MOB_AGRO_IN_PEACEZONE = NPC.getBoolean("AltMobAgroInPeaceZone", true);
ALT_ATTACKABLE_NPCS = NPC.getBoolean("AltAttackableNpcs", true);
ALT_GAME_VIEWNPC = NPC.getBoolean("AltGameViewNpc", false);
MAX_AGGRO_RANGE = NPC.getInt("MaxAggroRange", 450);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
SHOW_NPC_LVL = NPC.getBoolean("ShowNpcLevel", false);
SHOW_NPC_AGGRESSION = NPC.getBoolean("ShowNpcAggression", false);
SHOW_CREST_WITHOUT_QUEST = NPC.getBoolean("ShowCrestWithoutQuest", false);
@ -2260,6 +2263,13 @@ public class Config
DEFAULT_CORPSE_TIME = NPC.getInt("DefaultCorpseTime", 7);
SPOILED_CORPSE_EXTEND_TIME = NPC.getInt("SpoiledCorpseExtendTime", 10);
CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY = NPC.getInt("CorpseConsumeSkillAllowedTimeBeforeDecay", 2000);
MAX_AGGRO_RANGE = NPC.getInt("MaxAggroRange", 450);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
AGGRO_DISTANCE_CHECK_ENABLED = NPC.getBoolean("AggroDistanceCheckEnabled", false);
AGGRO_DISTANCE_CHECK_RANGE = NPC.getInt("AggroDistanceCheckRange", 1500);
AGGRO_DISTANCE_CHECK_RAIDS = NPC.getBoolean("AggroDistanceCheckRaids", false);
AGGRO_DISTANCE_CHECK_INSTANCES = NPC.getBoolean("AggroDistanceCheckInstances", false);
AGGRO_DISTANCE_CHECK_RESTORE_LIFE = NPC.getBoolean("AggroDistanceCheckRestoreLife", true);
GUARD_ATTACK_AGGRO_MOB = NPC.getBoolean("GuardAttackAggroMob", false);
ENABLE_GUARD_RETURN = NPC.getBoolean("EnableGuardReturn", false);
ALLOW_WYVERN_UPGRADER = NPC.getBoolean("AllowWyvernUpgrader", false);

View File

@ -35,6 +35,7 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.instancemanager.DimensionalRiftManager;
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.Spawn;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Attackable;
@ -760,11 +761,63 @@ public class AttackableAI extends CreatureAI
protected void thinkAttack()
{
final Attackable npc = getActiveChar();
if (npc.isCastingNow())
if ((npc == null) || npc.isCastingNow())
{
return;
}
if (Config.AGGRO_DISTANCE_CHECK_ENABLED && npc.isMonster() && !npc.isWalker())
{
final Spawn spawn = npc.getSpawn();
if ((spawn != null) && (npc.calculateDistance3D(spawn.getLocation()) > Config.AGGRO_DISTANCE_CHECK_RANGE))
{
if ((Config.AGGRO_DISTANCE_CHECK_RAIDS || !npc.isRaid()) && (Config.AGGRO_DISTANCE_CHECK_INSTANCES || (npc.getInstanceId() == 0)))
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
npc.setCurrentHp(npc.getMaxHp());
npc.setCurrentMp(npc.getMaxMp());
}
npc.abortAttack();
npc.clearAggroList();
npc.getAttackByList().clear();
if (npc.hasAI())
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
npc.teleToLocation(spawn.getLocation(), true);
}
// Minions should return as well.
if (((MonsterInstance) _actor).hasMinions())
{
for (MonsterInstance minion : ((MonsterInstance) _actor).getMinionList().getSpawnedMinions())
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
minion.setCurrentHp(minion.getMaxHp());
minion.setCurrentMp(minion.getMaxMp());
}
minion.abortAttack();
minion.clearAggroList();
minion.getAttackByList().clear();
if (minion.hasAI())
{
minion.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
minion.teleToLocation(spawn.getLocation(), true);
}
}
}
return;
}
}
}
if (npc.isCoreAIDisabled())
{
return;

View File

@ -28,11 +28,6 @@ AltAttackableNpcs = True
# Default: False
AltGameViewNpc = False
# Maximum distance mobs can randomly go from spawn point.
# DEFAULT NEEDS TO BE VERIFIED, MUST BE CHANGED HERE AND IN CONFIG.JAVA IF NOT CORRECT
# Default: 300
MaxDriftRange = 300
# Default: False
ShowNpcLevel = False
@ -90,6 +85,31 @@ SpoiledCorpseExtendTime = 10
# Default: 2000
CorpseConsumeSkillAllowedTimeBeforeDecay = 2000
# Maximum distance monsters can randomly move from spawn.
# Default: 300
MaxDriftRange = 300
# Enable monster aggro distance check.
# When enabled monsters will lose aggro if pulled far away from spawn.
# Default: False
AggroDistanceCheckEnabled = False
# Maximum distance monsters can be pulled away from spawn.
# Default: 1500
AggroDistanceCheckRange = 1500
# Use maximum aggro distance check for raids.
# Default: False
AggroDistanceCheckRaids = False
# Use maximum aggro distance check in instances.
# Default: False
AggroDistanceCheckInstances = False
# Restore monster HP and MP when aggro is reset by distance.
# Default: True
AggroDistanceCheckRestoreLife = True
# ---------------------------------------------------------------------------
# Guards

View File

@ -610,7 +610,6 @@ public class Config
public static boolean ALT_MOB_AGRO_IN_PEACEZONE;
public static boolean ALT_ATTACKABLE_NPCS;
public static boolean ALT_GAME_VIEWNPC;
public static int MAX_DRIFT_RANGE;
public static boolean SHOW_NPC_LVL;
public static boolean SHOW_NPC_AGGRESSION;
public static boolean SHOW_CREST_WITHOUT_QUEST;
@ -624,6 +623,12 @@ public class Config
public static int DEFAULT_CORPSE_TIME;
public static int SPOILED_CORPSE_EXTEND_TIME;
public static int CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY;
public static int MAX_DRIFT_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_ENABLED;
public static int AGGRO_DISTANCE_CHECK_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_RAIDS;
public static boolean AGGRO_DISTANCE_CHECK_INSTANCES;
public static boolean AGGRO_DISTANCE_CHECK_RESTORE_LIFE;
public static boolean GUARD_ATTACK_AGGRO_MOB;
public static double RAID_HP_REGEN_MULTIPLIER;
public static double RAID_MP_REGEN_MULTIPLIER;
@ -2023,7 +2028,6 @@ public class Config
ALT_MOB_AGRO_IN_PEACEZONE = NPC.getBoolean("AltMobAgroInPeaceZone", true);
ALT_ATTACKABLE_NPCS = NPC.getBoolean("AltAttackableNpcs", true);
ALT_GAME_VIEWNPC = NPC.getBoolean("AltGameViewNpc", false);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
SHOW_NPC_LVL = NPC.getBoolean("ShowNpcLevel", false);
SHOW_NPC_AGGRESSION = NPC.getBoolean("ShowNpcAggression", false);
SHOW_CREST_WITHOUT_QUEST = NPC.getBoolean("ShowCrestWithoutQuest", false);
@ -2037,6 +2041,12 @@ public class Config
DEFAULT_CORPSE_TIME = NPC.getInt("DefaultCorpseTime", 7);
SPOILED_CORPSE_EXTEND_TIME = NPC.getInt("SpoiledCorpseExtendTime", 10);
CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY = NPC.getInt("CorpseConsumeSkillAllowedTimeBeforeDecay", 2000);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
AGGRO_DISTANCE_CHECK_ENABLED = NPC.getBoolean("AggroDistanceCheckEnabled", true);
AGGRO_DISTANCE_CHECK_RANGE = NPC.getInt("AggroDistanceCheckRange", 1500);
AGGRO_DISTANCE_CHECK_RAIDS = NPC.getBoolean("AggroDistanceCheckRaids", false);
AGGRO_DISTANCE_CHECK_INSTANCES = NPC.getBoolean("AggroDistanceCheckInstances", false);
AGGRO_DISTANCE_CHECK_RESTORE_LIFE = NPC.getBoolean("AggroDistanceCheckRestoreLife", true);
GUARD_ATTACK_AGGRO_MOB = NPC.getBoolean("GuardAttackAggroMob", false);
RAID_HP_REGEN_MULTIPLIER = NPC.getDouble("RaidHpRegenMultiplier", 100) / 100;
RAID_MP_REGEN_MULTIPLIER = NPC.getDouble("RaidMpRegenMultiplier", 100) / 100;

View File

@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.Spawn;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Attackable;
@ -629,12 +630,63 @@ public class AttackableAI extends CreatureAI
protected void thinkAttack()
{
final Attackable npc = getActiveChar();
if ((npc == null) || npc.isCastingNow())
{
return;
}
if (Config.AGGRO_DISTANCE_CHECK_ENABLED && npc.isMonster() && !npc.isWalker())
{
final Spawn spawn = npc.getSpawn();
if ((spawn != null) && (npc.calculateDistance3D(spawn.getLocation()) > Config.AGGRO_DISTANCE_CHECK_RANGE))
{
if ((Config.AGGRO_DISTANCE_CHECK_RAIDS || !npc.isRaid()) && (Config.AGGRO_DISTANCE_CHECK_INSTANCES || !npc.isInInstance()))
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
npc.setCurrentHp(npc.getMaxHp());
npc.setCurrentMp(npc.getMaxMp());
}
npc.abortAttack();
npc.clearAggroList();
npc.getAttackByList().clear();
if (npc.hasAI())
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
npc.teleToLocation(spawn.getLocation(), true);
}
// Minions should return as well.
if (((MonsterInstance) _actor).hasMinions())
{
for (MonsterInstance minion : ((MonsterInstance) _actor).getMinionList().getSpawnedMinions())
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
minion.setCurrentHp(minion.getMaxHp());
minion.setCurrentMp(minion.getMaxMp());
}
minion.abortAttack();
minion.clearAggroList();
minion.getAttackByList().clear();
if (minion.hasAI())
{
minion.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
minion.teleToLocation(spawn.getLocation(), true);
}
}
}
return;
}
}
}
Creature target = npc.getMostHated();
if (getTarget() != target)
{

View File

@ -28,11 +28,6 @@ AltAttackableNpcs = True
# Default: False
AltGameViewNpc = False
# Maximum distance mobs can randomly go from spawn point.
# DEFAULT NEEDS TO BE VERIFIED, MUST BE CHANGED HERE AND IN CONFIG.JAVA IF NOT CORRECT
# Default: 300
MaxDriftRange = 300
# Default: False
ShowNpcLevel = False
@ -90,6 +85,31 @@ SpoiledCorpseExtendTime = 10
# Default: 2000
CorpseConsumeSkillAllowedTimeBeforeDecay = 2000
# Maximum distance monsters can randomly move from spawn.
# Default: 300
MaxDriftRange = 300
# Enable monster aggro distance check.
# When enabled monsters will lose aggro if pulled far away from spawn.
# Default: False
AggroDistanceCheckEnabled = False
# Maximum distance monsters can be pulled away from spawn.
# Default: 1500
AggroDistanceCheckRange = 1500
# Use maximum aggro distance check for raids.
# Default: False
AggroDistanceCheckRaids = False
# Use maximum aggro distance check in instances.
# Default: False
AggroDistanceCheckInstances = False
# Restore monster HP and MP when aggro is reset by distance.
# Default: True
AggroDistanceCheckRestoreLife = True
# ---------------------------------------------------------------------------
# Guards

View File

@ -610,7 +610,6 @@ public class Config
public static boolean ALT_MOB_AGRO_IN_PEACEZONE;
public static boolean ALT_ATTACKABLE_NPCS;
public static boolean ALT_GAME_VIEWNPC;
public static int MAX_DRIFT_RANGE;
public static boolean SHOW_NPC_LVL;
public static boolean SHOW_NPC_AGGRESSION;
public static boolean SHOW_CREST_WITHOUT_QUEST;
@ -624,6 +623,12 @@ public class Config
public static int DEFAULT_CORPSE_TIME;
public static int SPOILED_CORPSE_EXTEND_TIME;
public static int CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY;
public static int MAX_DRIFT_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_ENABLED;
public static int AGGRO_DISTANCE_CHECK_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_RAIDS;
public static boolean AGGRO_DISTANCE_CHECK_INSTANCES;
public static boolean AGGRO_DISTANCE_CHECK_RESTORE_LIFE;
public static boolean GUARD_ATTACK_AGGRO_MOB;
public static double RAID_HP_REGEN_MULTIPLIER;
public static double RAID_MP_REGEN_MULTIPLIER;
@ -2027,7 +2032,6 @@ public class Config
ALT_MOB_AGRO_IN_PEACEZONE = NPC.getBoolean("AltMobAgroInPeaceZone", true);
ALT_ATTACKABLE_NPCS = NPC.getBoolean("AltAttackableNpcs", true);
ALT_GAME_VIEWNPC = NPC.getBoolean("AltGameViewNpc", false);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
SHOW_NPC_LVL = NPC.getBoolean("ShowNpcLevel", false);
SHOW_NPC_AGGRESSION = NPC.getBoolean("ShowNpcAggression", false);
SHOW_CREST_WITHOUT_QUEST = NPC.getBoolean("ShowCrestWithoutQuest", false);
@ -2041,6 +2045,12 @@ public class Config
DEFAULT_CORPSE_TIME = NPC.getInt("DefaultCorpseTime", 7);
SPOILED_CORPSE_EXTEND_TIME = NPC.getInt("SpoiledCorpseExtendTime", 10);
CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY = NPC.getInt("CorpseConsumeSkillAllowedTimeBeforeDecay", 2000);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
AGGRO_DISTANCE_CHECK_ENABLED = NPC.getBoolean("AggroDistanceCheckEnabled", true);
AGGRO_DISTANCE_CHECK_RANGE = NPC.getInt("AggroDistanceCheckRange", 1500);
AGGRO_DISTANCE_CHECK_RAIDS = NPC.getBoolean("AggroDistanceCheckRaids", false);
AGGRO_DISTANCE_CHECK_INSTANCES = NPC.getBoolean("AggroDistanceCheckInstances", false);
AGGRO_DISTANCE_CHECK_RESTORE_LIFE = NPC.getBoolean("AggroDistanceCheckRestoreLife", true);
GUARD_ATTACK_AGGRO_MOB = NPC.getBoolean("GuardAttackAggroMob", false);
RAID_HP_REGEN_MULTIPLIER = NPC.getDouble("RaidHpRegenMultiplier", 100) / 100;
RAID_MP_REGEN_MULTIPLIER = NPC.getDouble("RaidMpRegenMultiplier", 100) / 100;

View File

@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.Spawn;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Attackable;
@ -629,12 +630,63 @@ public class AttackableAI extends CreatureAI
protected void thinkAttack()
{
final Attackable npc = getActiveChar();
if ((npc == null) || npc.isCastingNow())
{
return;
}
if (Config.AGGRO_DISTANCE_CHECK_ENABLED && npc.isMonster() && !npc.isWalker())
{
final Spawn spawn = npc.getSpawn();
if ((spawn != null) && (npc.calculateDistance3D(spawn.getLocation()) > Config.AGGRO_DISTANCE_CHECK_RANGE))
{
if ((Config.AGGRO_DISTANCE_CHECK_RAIDS || !npc.isRaid()) && (Config.AGGRO_DISTANCE_CHECK_INSTANCES || !npc.isInInstance()))
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
npc.setCurrentHp(npc.getMaxHp());
npc.setCurrentMp(npc.getMaxMp());
}
npc.abortAttack();
npc.clearAggroList();
npc.getAttackByList().clear();
if (npc.hasAI())
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
npc.teleToLocation(spawn.getLocation(), true);
}
// Minions should return as well.
if (((MonsterInstance) _actor).hasMinions())
{
for (MonsterInstance minion : ((MonsterInstance) _actor).getMinionList().getSpawnedMinions())
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
minion.setCurrentHp(minion.getMaxHp());
minion.setCurrentMp(minion.getMaxMp());
}
minion.abortAttack();
minion.clearAggroList();
minion.getAttackByList().clear();
if (minion.hasAI())
{
minion.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
minion.teleToLocation(spawn.getLocation(), true);
}
}
}
return;
}
}
}
Creature target = npc.getMostHated();
if (getTarget() != target)
{

View File

@ -28,11 +28,6 @@ AltAttackableNpcs = True
# Default: False
AltGameViewNpc = False
# Maximum distance mobs can randomly go from spawn point.
# DEFAULT NEEDS TO BE VERIFIED, MUST BE CHANGED HERE AND IN CONFIG.JAVA IF NOT CORRECT
# Default: 300
MaxDriftRange = 300
# Default: False
ShowNpcLevel = False
@ -90,6 +85,31 @@ SpoiledCorpseExtendTime = 10
# Default: 2000
CorpseConsumeSkillAllowedTimeBeforeDecay = 2000
# Maximum distance monsters can randomly move from spawn.
# Default: 300
MaxDriftRange = 300
# Enable monster aggro distance check.
# When enabled monsters will lose aggro if pulled far away from spawn.
# Default: False
AggroDistanceCheckEnabled = False
# Maximum distance monsters can be pulled away from spawn.
# Default: 1500
AggroDistanceCheckRange = 1500
# Use maximum aggro distance check for raids.
# Default: False
AggroDistanceCheckRaids = False
# Use maximum aggro distance check in instances.
# Default: False
AggroDistanceCheckInstances = False
# Restore monster HP and MP when aggro is reset by distance.
# Default: True
AggroDistanceCheckRestoreLife = True
# ---------------------------------------------------------------------------
# Guards

View File

@ -610,7 +610,6 @@ public class Config
public static boolean ALT_MOB_AGRO_IN_PEACEZONE;
public static boolean ALT_ATTACKABLE_NPCS;
public static boolean ALT_GAME_VIEWNPC;
public static int MAX_DRIFT_RANGE;
public static boolean SHOW_NPC_LVL;
public static boolean SHOW_NPC_AGGRESSION;
public static boolean SHOW_CREST_WITHOUT_QUEST;
@ -624,6 +623,12 @@ public class Config
public static int DEFAULT_CORPSE_TIME;
public static int SPOILED_CORPSE_EXTEND_TIME;
public static int CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY;
public static int MAX_DRIFT_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_ENABLED;
public static int AGGRO_DISTANCE_CHECK_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_RAIDS;
public static boolean AGGRO_DISTANCE_CHECK_INSTANCES;
public static boolean AGGRO_DISTANCE_CHECK_RESTORE_LIFE;
public static boolean GUARD_ATTACK_AGGRO_MOB;
public static double RAID_HP_REGEN_MULTIPLIER;
public static double RAID_MP_REGEN_MULTIPLIER;
@ -2027,7 +2032,6 @@ public class Config
ALT_MOB_AGRO_IN_PEACEZONE = NPC.getBoolean("AltMobAgroInPeaceZone", true);
ALT_ATTACKABLE_NPCS = NPC.getBoolean("AltAttackableNpcs", true);
ALT_GAME_VIEWNPC = NPC.getBoolean("AltGameViewNpc", false);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
SHOW_NPC_LVL = NPC.getBoolean("ShowNpcLevel", false);
SHOW_NPC_AGGRESSION = NPC.getBoolean("ShowNpcAggression", false);
SHOW_CREST_WITHOUT_QUEST = NPC.getBoolean("ShowCrestWithoutQuest", false);
@ -2041,6 +2045,12 @@ public class Config
DEFAULT_CORPSE_TIME = NPC.getInt("DefaultCorpseTime", 7);
SPOILED_CORPSE_EXTEND_TIME = NPC.getInt("SpoiledCorpseExtendTime", 10);
CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY = NPC.getInt("CorpseConsumeSkillAllowedTimeBeforeDecay", 2000);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
AGGRO_DISTANCE_CHECK_ENABLED = NPC.getBoolean("AggroDistanceCheckEnabled", true);
AGGRO_DISTANCE_CHECK_RANGE = NPC.getInt("AggroDistanceCheckRange", 1500);
AGGRO_DISTANCE_CHECK_RAIDS = NPC.getBoolean("AggroDistanceCheckRaids", false);
AGGRO_DISTANCE_CHECK_INSTANCES = NPC.getBoolean("AggroDistanceCheckInstances", false);
AGGRO_DISTANCE_CHECK_RESTORE_LIFE = NPC.getBoolean("AggroDistanceCheckRestoreLife", true);
GUARD_ATTACK_AGGRO_MOB = NPC.getBoolean("GuardAttackAggroMob", false);
RAID_HP_REGEN_MULTIPLIER = NPC.getDouble("RaidHpRegenMultiplier", 100) / 100;
RAID_MP_REGEN_MULTIPLIER = NPC.getDouble("RaidMpRegenMultiplier", 100) / 100;

View File

@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.Spawn;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Attackable;
@ -629,12 +630,63 @@ public class AttackableAI extends CreatureAI
protected void thinkAttack()
{
final Attackable npc = getActiveChar();
if ((npc == null) || npc.isCastingNow())
{
return;
}
if (Config.AGGRO_DISTANCE_CHECK_ENABLED && npc.isMonster() && !npc.isWalker())
{
final Spawn spawn = npc.getSpawn();
if ((spawn != null) && (npc.calculateDistance3D(spawn.getLocation()) > Config.AGGRO_DISTANCE_CHECK_RANGE))
{
if ((Config.AGGRO_DISTANCE_CHECK_RAIDS || !npc.isRaid()) && (Config.AGGRO_DISTANCE_CHECK_INSTANCES || !npc.isInInstance()))
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
npc.setCurrentHp(npc.getMaxHp());
npc.setCurrentMp(npc.getMaxMp());
}
npc.abortAttack();
npc.clearAggroList();
npc.getAttackByList().clear();
if (npc.hasAI())
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
npc.teleToLocation(spawn.getLocation(), true);
}
// Minions should return as well.
if (((MonsterInstance) _actor).hasMinions())
{
for (MonsterInstance minion : ((MonsterInstance) _actor).getMinionList().getSpawnedMinions())
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
minion.setCurrentHp(minion.getMaxHp());
minion.setCurrentMp(minion.getMaxMp());
}
minion.abortAttack();
minion.clearAggroList();
minion.getAttackByList().clear();
if (minion.hasAI())
{
minion.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
minion.teleToLocation(spawn.getLocation(), true);
}
}
}
return;
}
}
}
Creature target = npc.getMostHated();
if (getTarget() != target)
{

View File

@ -28,11 +28,6 @@ AltAttackableNpcs = True
# Default: False
AltGameViewNpc = False
# Maximum distance mobs can randomly go from spawn point.
# DEFAULT NEEDS TO BE VERIFIED, MUST BE CHANGED HERE AND IN CONFIG.JAVA IF NOT CORRECT
# Default: 300
MaxDriftRange = 300
# Default: False
ShowNpcLevel = False
@ -90,6 +85,31 @@ SpoiledCorpseExtendTime = 10
# Default: 2000
CorpseConsumeSkillAllowedTimeBeforeDecay = 2000
# Maximum distance monsters can randomly move from spawn.
# Default: 300
MaxDriftRange = 300
# Enable monster aggro distance check.
# When enabled monsters will lose aggro if pulled far away from spawn.
# Default: False
AggroDistanceCheckEnabled = False
# Maximum distance monsters can be pulled away from spawn.
# Default: 1500
AggroDistanceCheckRange = 1500
# Use maximum aggro distance check for raids.
# Default: False
AggroDistanceCheckRaids = False
# Use maximum aggro distance check in instances.
# Default: False
AggroDistanceCheckInstances = False
# Restore monster HP and MP when aggro is reset by distance.
# Default: True
AggroDistanceCheckRestoreLife = True
# ---------------------------------------------------------------------------
# Guards

View File

@ -610,7 +610,6 @@ public class Config
public static boolean ALT_MOB_AGRO_IN_PEACEZONE;
public static boolean ALT_ATTACKABLE_NPCS;
public static boolean ALT_GAME_VIEWNPC;
public static int MAX_DRIFT_RANGE;
public static boolean SHOW_NPC_LVL;
public static boolean SHOW_NPC_AGGRESSION;
public static boolean SHOW_CREST_WITHOUT_QUEST;
@ -624,6 +623,12 @@ public class Config
public static int DEFAULT_CORPSE_TIME;
public static int SPOILED_CORPSE_EXTEND_TIME;
public static int CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY;
public static int MAX_DRIFT_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_ENABLED;
public static int AGGRO_DISTANCE_CHECK_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_RAIDS;
public static boolean AGGRO_DISTANCE_CHECK_INSTANCES;
public static boolean AGGRO_DISTANCE_CHECK_RESTORE_LIFE;
public static boolean GUARD_ATTACK_AGGRO_MOB;
public static double RAID_HP_REGEN_MULTIPLIER;
public static double RAID_MP_REGEN_MULTIPLIER;
@ -2027,7 +2032,6 @@ public class Config
ALT_MOB_AGRO_IN_PEACEZONE = NPC.getBoolean("AltMobAgroInPeaceZone", true);
ALT_ATTACKABLE_NPCS = NPC.getBoolean("AltAttackableNpcs", true);
ALT_GAME_VIEWNPC = NPC.getBoolean("AltGameViewNpc", false);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
SHOW_NPC_LVL = NPC.getBoolean("ShowNpcLevel", false);
SHOW_NPC_AGGRESSION = NPC.getBoolean("ShowNpcAggression", false);
SHOW_CREST_WITHOUT_QUEST = NPC.getBoolean("ShowCrestWithoutQuest", false);
@ -2041,6 +2045,12 @@ public class Config
DEFAULT_CORPSE_TIME = NPC.getInt("DefaultCorpseTime", 7);
SPOILED_CORPSE_EXTEND_TIME = NPC.getInt("SpoiledCorpseExtendTime", 10);
CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY = NPC.getInt("CorpseConsumeSkillAllowedTimeBeforeDecay", 2000);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
AGGRO_DISTANCE_CHECK_ENABLED = NPC.getBoolean("AggroDistanceCheckEnabled", true);
AGGRO_DISTANCE_CHECK_RANGE = NPC.getInt("AggroDistanceCheckRange", 1500);
AGGRO_DISTANCE_CHECK_RAIDS = NPC.getBoolean("AggroDistanceCheckRaids", false);
AGGRO_DISTANCE_CHECK_INSTANCES = NPC.getBoolean("AggroDistanceCheckInstances", false);
AGGRO_DISTANCE_CHECK_RESTORE_LIFE = NPC.getBoolean("AggroDistanceCheckRestoreLife", true);
GUARD_ATTACK_AGGRO_MOB = NPC.getBoolean("GuardAttackAggroMob", false);
RAID_HP_REGEN_MULTIPLIER = NPC.getDouble("RaidHpRegenMultiplier", 100) / 100;
RAID_MP_REGEN_MULTIPLIER = NPC.getDouble("RaidMpRegenMultiplier", 100) / 100;

View File

@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.Spawn;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Attackable;
@ -629,12 +630,63 @@ public class AttackableAI extends CreatureAI
protected void thinkAttack()
{
final Attackable npc = getActiveChar();
if ((npc == null) || npc.isCastingNow())
{
return;
}
if (Config.AGGRO_DISTANCE_CHECK_ENABLED && npc.isMonster() && !npc.isWalker())
{
final Spawn spawn = npc.getSpawn();
if ((spawn != null) && (npc.calculateDistance3D(spawn.getLocation()) > Config.AGGRO_DISTANCE_CHECK_RANGE))
{
if ((Config.AGGRO_DISTANCE_CHECK_RAIDS || !npc.isRaid()) && (Config.AGGRO_DISTANCE_CHECK_INSTANCES || !npc.isInInstance()))
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
npc.setCurrentHp(npc.getMaxHp());
npc.setCurrentMp(npc.getMaxMp());
}
npc.abortAttack();
npc.clearAggroList();
npc.getAttackByList().clear();
if (npc.hasAI())
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
npc.teleToLocation(spawn.getLocation(), true);
}
// Minions should return as well.
if (((MonsterInstance) _actor).hasMinions())
{
for (MonsterInstance minion : ((MonsterInstance) _actor).getMinionList().getSpawnedMinions())
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
minion.setCurrentHp(minion.getMaxHp());
minion.setCurrentMp(minion.getMaxMp());
}
minion.abortAttack();
minion.clearAggroList();
minion.getAttackByList().clear();
if (minion.hasAI())
{
minion.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
minion.teleToLocation(spawn.getLocation(), true);
}
}
}
return;
}
}
}
Creature target = npc.getMostHated();
if (getTarget() != target)
{

View File

@ -28,11 +28,6 @@ AltAttackableNpcs = True
# Default: False
AltGameViewNpc = False
# Maximum distance mobs can randomly go from spawn point.
# DEFAULT NEEDS TO BE VERIFIED, MUST BE CHANGED HERE AND IN CONFIG.JAVA IF NOT CORRECT
# Default: 300
MaxDriftRange = 300
# Default: False
ShowNpcLevel = False
@ -90,6 +85,31 @@ SpoiledCorpseExtendTime = 10
# Default: 2000
CorpseConsumeSkillAllowedTimeBeforeDecay = 2000
# Maximum distance monsters can randomly move from spawn.
# Default: 300
MaxDriftRange = 300
# Enable monster aggro distance check.
# When enabled monsters will lose aggro if pulled far away from spawn.
# Default: False
AggroDistanceCheckEnabled = False
# Maximum distance monsters can be pulled away from spawn.
# Default: 1500
AggroDistanceCheckRange = 1500
# Use maximum aggro distance check for raids.
# Default: False
AggroDistanceCheckRaids = False
# Use maximum aggro distance check in instances.
# Default: False
AggroDistanceCheckInstances = False
# Restore monster HP and MP when aggro is reset by distance.
# Default: True
AggroDistanceCheckRestoreLife = True
# ---------------------------------------------------------------------------
# Guards

View File

@ -610,7 +610,6 @@ public class Config
public static boolean ALT_MOB_AGRO_IN_PEACEZONE;
public static boolean ALT_ATTACKABLE_NPCS;
public static boolean ALT_GAME_VIEWNPC;
public static int MAX_DRIFT_RANGE;
public static boolean SHOW_NPC_LVL;
public static boolean SHOW_NPC_AGGRESSION;
public static boolean SHOW_CREST_WITHOUT_QUEST;
@ -624,6 +623,12 @@ public class Config
public static int DEFAULT_CORPSE_TIME;
public static int SPOILED_CORPSE_EXTEND_TIME;
public static int CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY;
public static int MAX_DRIFT_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_ENABLED;
public static int AGGRO_DISTANCE_CHECK_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_RAIDS;
public static boolean AGGRO_DISTANCE_CHECK_INSTANCES;
public static boolean AGGRO_DISTANCE_CHECK_RESTORE_LIFE;
public static boolean GUARD_ATTACK_AGGRO_MOB;
public static double RAID_HP_REGEN_MULTIPLIER;
public static double RAID_MP_REGEN_MULTIPLIER;
@ -2035,7 +2040,6 @@ public class Config
ALT_MOB_AGRO_IN_PEACEZONE = NPC.getBoolean("AltMobAgroInPeaceZone", true);
ALT_ATTACKABLE_NPCS = NPC.getBoolean("AltAttackableNpcs", true);
ALT_GAME_VIEWNPC = NPC.getBoolean("AltGameViewNpc", false);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
SHOW_NPC_LVL = NPC.getBoolean("ShowNpcLevel", false);
SHOW_NPC_AGGRESSION = NPC.getBoolean("ShowNpcAggression", false);
SHOW_CREST_WITHOUT_QUEST = NPC.getBoolean("ShowCrestWithoutQuest", false);
@ -2049,6 +2053,12 @@ public class Config
DEFAULT_CORPSE_TIME = NPC.getInt("DefaultCorpseTime", 7);
SPOILED_CORPSE_EXTEND_TIME = NPC.getInt("SpoiledCorpseExtendTime", 10);
CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY = NPC.getInt("CorpseConsumeSkillAllowedTimeBeforeDecay", 2000);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
AGGRO_DISTANCE_CHECK_ENABLED = NPC.getBoolean("AggroDistanceCheckEnabled", true);
AGGRO_DISTANCE_CHECK_RANGE = NPC.getInt("AggroDistanceCheckRange", 1500);
AGGRO_DISTANCE_CHECK_RAIDS = NPC.getBoolean("AggroDistanceCheckRaids", false);
AGGRO_DISTANCE_CHECK_INSTANCES = NPC.getBoolean("AggroDistanceCheckInstances", false);
AGGRO_DISTANCE_CHECK_RESTORE_LIFE = NPC.getBoolean("AggroDistanceCheckRestoreLife", true);
GUARD_ATTACK_AGGRO_MOB = NPC.getBoolean("GuardAttackAggroMob", false);
RAID_HP_REGEN_MULTIPLIER = NPC.getDouble("RaidHpRegenMultiplier", 100) / 100;
RAID_MP_REGEN_MULTIPLIER = NPC.getDouble("RaidMpRegenMultiplier", 100) / 100;

View File

@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.Spawn;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Attackable;
@ -629,12 +630,63 @@ public class AttackableAI extends CreatureAI
protected void thinkAttack()
{
final Attackable npc = getActiveChar();
if ((npc == null) || npc.isCastingNow())
{
return;
}
if (Config.AGGRO_DISTANCE_CHECK_ENABLED && npc.isMonster() && !npc.isWalker())
{
final Spawn spawn = npc.getSpawn();
if ((spawn != null) && (npc.calculateDistance3D(spawn.getLocation()) > Config.AGGRO_DISTANCE_CHECK_RANGE))
{
if ((Config.AGGRO_DISTANCE_CHECK_RAIDS || !npc.isRaid()) && (Config.AGGRO_DISTANCE_CHECK_INSTANCES || !npc.isInInstance()))
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
npc.setCurrentHp(npc.getMaxHp());
npc.setCurrentMp(npc.getMaxMp());
}
npc.abortAttack();
npc.clearAggroList();
npc.getAttackByList().clear();
if (npc.hasAI())
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
npc.teleToLocation(spawn.getLocation(), true);
}
// Minions should return as well.
if (((MonsterInstance) _actor).hasMinions())
{
for (MonsterInstance minion : ((MonsterInstance) _actor).getMinionList().getSpawnedMinions())
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
minion.setCurrentHp(minion.getMaxHp());
minion.setCurrentMp(minion.getMaxMp());
}
minion.abortAttack();
minion.clearAggroList();
minion.getAttackByList().clear();
if (minion.hasAI())
{
minion.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
minion.teleToLocation(spawn.getLocation(), true);
}
}
}
return;
}
}
}
Creature target = npc.getMostHated();
if (getTarget() != target)
{

View File

@ -28,11 +28,6 @@ AltAttackableNpcs = True
# Default: False
AltGameViewNpc = False
# Maximum distance mobs can randomly go from spawn point.
# DEFAULT NEEDS TO BE VERIFIED, MUST BE CHANGED HERE AND IN CONFIG.JAVA IF NOT CORRECT
# Default: 300
MaxDriftRange = 300
# Default: False
ShowNpcLevel = False
@ -90,6 +85,31 @@ SpoiledCorpseExtendTime = 10
# Default: 2000
CorpseConsumeSkillAllowedTimeBeforeDecay = 2000
# Maximum distance monsters can randomly move from spawn.
# Default: 300
MaxDriftRange = 300
# Enable monster aggro distance check.
# When enabled monsters will lose aggro if pulled far away from spawn.
# Default: False
AggroDistanceCheckEnabled = False
# Maximum distance monsters can be pulled away from spawn.
# Default: 1500
AggroDistanceCheckRange = 1500
# Use maximum aggro distance check for raids.
# Default: False
AggroDistanceCheckRaids = False
# Use maximum aggro distance check in instances.
# Default: False
AggroDistanceCheckInstances = False
# Restore monster HP and MP when aggro is reset by distance.
# Default: True
AggroDistanceCheckRestoreLife = True
# ---------------------------------------------------------------------------
# Guards

View File

@ -610,7 +610,6 @@ public class Config
public static boolean ALT_MOB_AGRO_IN_PEACEZONE;
public static boolean ALT_ATTACKABLE_NPCS;
public static boolean ALT_GAME_VIEWNPC;
public static int MAX_DRIFT_RANGE;
public static boolean SHOW_NPC_LVL;
public static boolean SHOW_NPC_AGGRESSION;
public static boolean SHOW_CREST_WITHOUT_QUEST;
@ -624,6 +623,12 @@ public class Config
public static int DEFAULT_CORPSE_TIME;
public static int SPOILED_CORPSE_EXTEND_TIME;
public static int CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY;
public static int MAX_DRIFT_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_ENABLED;
public static int AGGRO_DISTANCE_CHECK_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_RAIDS;
public static boolean AGGRO_DISTANCE_CHECK_INSTANCES;
public static boolean AGGRO_DISTANCE_CHECK_RESTORE_LIFE;
public static boolean GUARD_ATTACK_AGGRO_MOB;
public static double RAID_HP_REGEN_MULTIPLIER;
public static double RAID_MP_REGEN_MULTIPLIER;
@ -2046,7 +2051,6 @@ public class Config
ALT_MOB_AGRO_IN_PEACEZONE = NPC.getBoolean("AltMobAgroInPeaceZone", true);
ALT_ATTACKABLE_NPCS = NPC.getBoolean("AltAttackableNpcs", true);
ALT_GAME_VIEWNPC = NPC.getBoolean("AltGameViewNpc", false);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
SHOW_NPC_LVL = NPC.getBoolean("ShowNpcLevel", false);
SHOW_NPC_AGGRESSION = NPC.getBoolean("ShowNpcAggression", false);
SHOW_CREST_WITHOUT_QUEST = NPC.getBoolean("ShowCrestWithoutQuest", false);
@ -2060,6 +2064,12 @@ public class Config
DEFAULT_CORPSE_TIME = NPC.getInt("DefaultCorpseTime", 7);
SPOILED_CORPSE_EXTEND_TIME = NPC.getInt("SpoiledCorpseExtendTime", 10);
CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY = NPC.getInt("CorpseConsumeSkillAllowedTimeBeforeDecay", 2000);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
AGGRO_DISTANCE_CHECK_ENABLED = NPC.getBoolean("AggroDistanceCheckEnabled", true);
AGGRO_DISTANCE_CHECK_RANGE = NPC.getInt("AggroDistanceCheckRange", 1500);
AGGRO_DISTANCE_CHECK_RAIDS = NPC.getBoolean("AggroDistanceCheckRaids", false);
AGGRO_DISTANCE_CHECK_INSTANCES = NPC.getBoolean("AggroDistanceCheckInstances", false);
AGGRO_DISTANCE_CHECK_RESTORE_LIFE = NPC.getBoolean("AggroDistanceCheckRestoreLife", true);
GUARD_ATTACK_AGGRO_MOB = NPC.getBoolean("GuardAttackAggroMob", false);
RAID_HP_REGEN_MULTIPLIER = NPC.getDouble("RaidHpRegenMultiplier", 100) / 100;
RAID_MP_REGEN_MULTIPLIER = NPC.getDouble("RaidMpRegenMultiplier", 100) / 100;

View File

@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.Spawn;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Attackable;
@ -629,12 +630,63 @@ public class AttackableAI extends CreatureAI
protected void thinkAttack()
{
final Attackable npc = getActiveChar();
if ((npc == null) || npc.isCastingNow())
{
return;
}
if (Config.AGGRO_DISTANCE_CHECK_ENABLED && npc.isMonster() && !npc.isWalker())
{
final Spawn spawn = npc.getSpawn();
if ((spawn != null) && (npc.calculateDistance3D(spawn.getLocation()) > Config.AGGRO_DISTANCE_CHECK_RANGE))
{
if ((Config.AGGRO_DISTANCE_CHECK_RAIDS || !npc.isRaid()) && (Config.AGGRO_DISTANCE_CHECK_INSTANCES || !npc.isInInstance()))
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
npc.setCurrentHp(npc.getMaxHp());
npc.setCurrentMp(npc.getMaxMp());
}
npc.abortAttack();
npc.clearAggroList();
npc.getAttackByList().clear();
if (npc.hasAI())
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
npc.teleToLocation(spawn.getLocation(), true);
}
// Minions should return as well.
if (((MonsterInstance) _actor).hasMinions())
{
for (MonsterInstance minion : ((MonsterInstance) _actor).getMinionList().getSpawnedMinions())
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
minion.setCurrentHp(minion.getMaxHp());
minion.setCurrentMp(minion.getMaxMp());
}
minion.abortAttack();
minion.clearAggroList();
minion.getAttackByList().clear();
if (minion.hasAI())
{
minion.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
minion.teleToLocation(spawn.getLocation(), true);
}
}
}
return;
}
}
}
Creature target = npc.getMostHated();
if (getTarget() != target)
{

View File

@ -28,11 +28,6 @@ AltAttackableNpcs = True
# Default: False
AltGameViewNpc = False
# Maximum distance mobs can randomly go from spawn point.
# DEFAULT NEEDS TO BE VERIFIED, MUST BE CHANGED HERE AND IN CONFIG.JAVA IF NOT CORRECT
# Default: 300
MaxDriftRange = 300
# Default: False
ShowNpcLevel = False
@ -90,6 +85,31 @@ SpoiledCorpseExtendTime = 10
# Default: 2000
CorpseConsumeSkillAllowedTimeBeforeDecay = 2000
# Maximum distance monsters can randomly move from spawn.
# Default: 300
MaxDriftRange = 300
# Enable monster aggro distance check.
# When enabled monsters will lose aggro if pulled far away from spawn.
# Default: False
AggroDistanceCheckEnabled = False
# Maximum distance monsters can be pulled away from spawn.
# Default: 1500
AggroDistanceCheckRange = 1500
# Use maximum aggro distance check for raids.
# Default: False
AggroDistanceCheckRaids = False
# Use maximum aggro distance check in instances.
# Default: False
AggroDistanceCheckInstances = False
# Restore monster HP and MP when aggro is reset by distance.
# Default: True
AggroDistanceCheckRestoreLife = True
# ---------------------------------------------------------------------------
# Guards

View File

@ -619,7 +619,6 @@ public class Config
public static boolean ALT_MOB_AGRO_IN_PEACEZONE;
public static boolean ALT_ATTACKABLE_NPCS;
public static boolean ALT_GAME_VIEWNPC;
public static int MAX_DRIFT_RANGE;
public static boolean SHOW_NPC_LVL;
public static boolean SHOW_NPC_AGGRESSION;
public static boolean SHOW_CREST_WITHOUT_QUEST;
@ -633,6 +632,12 @@ public class Config
public static int DEFAULT_CORPSE_TIME;
public static int SPOILED_CORPSE_EXTEND_TIME;
public static int CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY;
public static int MAX_DRIFT_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_ENABLED;
public static int AGGRO_DISTANCE_CHECK_RANGE;
public static boolean AGGRO_DISTANCE_CHECK_RAIDS;
public static boolean AGGRO_DISTANCE_CHECK_INSTANCES;
public static boolean AGGRO_DISTANCE_CHECK_RESTORE_LIFE;
public static boolean GUARD_ATTACK_AGGRO_MOB;
public static double RAID_HP_REGEN_MULTIPLIER;
public static double RAID_MP_REGEN_MULTIPLIER;
@ -2049,7 +2054,6 @@ public class Config
ALT_MOB_AGRO_IN_PEACEZONE = NPC.getBoolean("AltMobAgroInPeaceZone", true);
ALT_ATTACKABLE_NPCS = NPC.getBoolean("AltAttackableNpcs", true);
ALT_GAME_VIEWNPC = NPC.getBoolean("AltGameViewNpc", false);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
SHOW_NPC_LVL = NPC.getBoolean("ShowNpcLevel", false);
SHOW_NPC_AGGRESSION = NPC.getBoolean("ShowNpcAggression", false);
SHOW_CREST_WITHOUT_QUEST = NPC.getBoolean("ShowCrestWithoutQuest", false);
@ -2063,6 +2067,12 @@ public class Config
DEFAULT_CORPSE_TIME = NPC.getInt("DefaultCorpseTime", 7);
SPOILED_CORPSE_EXTEND_TIME = NPC.getInt("SpoiledCorpseExtendTime", 10);
CORPSE_CONSUME_SKILL_ALLOWED_TIME_BEFORE_DECAY = NPC.getInt("CorpseConsumeSkillAllowedTimeBeforeDecay", 2000);
MAX_DRIFT_RANGE = NPC.getInt("MaxDriftRange", 300);
AGGRO_DISTANCE_CHECK_ENABLED = NPC.getBoolean("AggroDistanceCheckEnabled", true);
AGGRO_DISTANCE_CHECK_RANGE = NPC.getInt("AggroDistanceCheckRange", 1500);
AGGRO_DISTANCE_CHECK_RAIDS = NPC.getBoolean("AggroDistanceCheckRaids", false);
AGGRO_DISTANCE_CHECK_INSTANCES = NPC.getBoolean("AggroDistanceCheckInstances", false);
AGGRO_DISTANCE_CHECK_RESTORE_LIFE = NPC.getBoolean("AggroDistanceCheckRestoreLife", true);
GUARD_ATTACK_AGGRO_MOB = NPC.getBoolean("GuardAttackAggroMob", false);
RAID_HP_REGEN_MULTIPLIER = NPC.getDouble("RaidHpRegenMultiplier", 100) / 100;
RAID_MP_REGEN_MULTIPLIER = NPC.getDouble("RaidMpRegenMultiplier", 100) / 100;

View File

@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
import org.l2jmobius.gameserver.model.AggroInfo;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.Spawn;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Attackable;
@ -629,12 +630,63 @@ public class AttackableAI extends CreatureAI
protected void thinkAttack()
{
final Attackable npc = getActiveChar();
if ((npc == null) || npc.isCastingNow())
{
return;
}
if (Config.AGGRO_DISTANCE_CHECK_ENABLED && npc.isMonster() && !npc.isWalker())
{
final Spawn spawn = npc.getSpawn();
if ((spawn != null) && (npc.calculateDistance3D(spawn.getLocation()) > Config.AGGRO_DISTANCE_CHECK_RANGE))
{
if ((Config.AGGRO_DISTANCE_CHECK_RAIDS || !npc.isRaid()) && (Config.AGGRO_DISTANCE_CHECK_INSTANCES || !npc.isInInstance()))
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
npc.setCurrentHp(npc.getMaxHp());
npc.setCurrentMp(npc.getMaxMp());
}
npc.abortAttack();
npc.clearAggroList();
npc.getAttackByList().clear();
if (npc.hasAI())
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
npc.teleToLocation(spawn.getLocation(), true);
}
// Minions should return as well.
if (((MonsterInstance) _actor).hasMinions())
{
for (MonsterInstance minion : ((MonsterInstance) _actor).getMinionList().getSpawnedMinions())
{
if (Config.AGGRO_DISTANCE_CHECK_RESTORE_LIFE)
{
minion.setCurrentHp(minion.getMaxHp());
minion.setCurrentMp(minion.getMaxMp());
}
minion.abortAttack();
minion.clearAggroList();
minion.getAttackByList().clear();
if (minion.hasAI())
{
minion.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, spawn.getLocation());
}
else
{
minion.teleToLocation(spawn.getLocation(), true);
}
}
}
return;
}
}
}
Creature target = npc.getMostHated();
if (getTarget() != target)
{