From ad9a9006cf59b96f14b2e649bc0a952d2462350f Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Thu, 21 Mar 2019 12:49:10 +0000 Subject: [PATCH] Prevent thinking in non active regions. --- .../gameserver/ai/L2AttackableAI.java | 6 +++ .../actor/instance/L2GrandBossInstance.java | 7 --- .../actor/instance/L2MonsterInstance.java | 30 ------------ .../actor/instance/L2RaidBossInstance.java | 46 ------------------- .../gameserver/ai/L2AttackableAI.java | 6 +++ .../actor/instance/L2GrandBossInstance.java | 7 --- .../actor/instance/L2MonsterInstance.java | 30 ------------ .../actor/instance/L2RaidBossInstance.java | 46 ------------------- .../gameserver/ai/L2AttackableAI.java | 6 +++ .../actor/instance/L2GrandBossInstance.java | 7 --- .../actor/instance/L2MonsterInstance.java | 30 ------------ .../actor/instance/L2RaidBossInstance.java | 46 ------------------- .../gameserver/ai/L2AttackableAI.java | 6 +++ .../actor/instance/L2GrandBossInstance.java | 7 --- .../actor/instance/L2MonsterInstance.java | 30 ------------ .../actor/instance/L2RaidBossInstance.java | 46 ------------------- .../gameserver/ai/L2AttackableAI.java | 6 +++ .../actor/instance/L2GrandBossInstance.java | 7 --- .../actor/instance/L2MonsterInstance.java | 30 ------------ .../actor/instance/L2RaidBossInstance.java | 46 ------------------- .../gameserver/ai/L2AttackableAI.java | 6 +++ .../actor/instance/L2GrandBossInstance.java | 7 --- .../actor/instance/L2MonsterInstance.java | 30 ------------ .../actor/instance/L2RaidBossInstance.java | 46 ------------------- .../gameserver/ai/L2AttackableAI.java | 6 +++ .../actor/instance/L2GrandBossInstance.java | 7 --- .../actor/instance/L2MonsterInstance.java | 30 ------------ .../actor/instance/L2RaidBossInstance.java | 46 ------------------- .../gameserver/ai/L2AttackableAI.java | 6 +++ .../actor/instance/L2GrandBossInstance.java | 10 +--- .../actor/instance/L2MonsterInstance.java | 12 +---- .../actor/instance/L2RaidBossInstance.java | 9 +--- .../gameserver/ai/L2AttackableAI.java | 6 +++ .../actor/instance/L2GrandBossInstance.java | 7 --- .../actor/instance/L2MonsterInstance.java | 29 ------------ .../actor/instance/L2RaidBossInstance.java | 45 ------------------ .../gameserver/ai/L2AttackableAI.java | 6 +++ .../actor/instance/L2GrandBossInstance.java | 7 --- .../actor/instance/L2MonsterInstance.java | 30 ------------ .../actor/instance/L2RaidBossInstance.java | 46 ------------------- .../gameserver/ai/L2AttackableAI.java | 6 +++ .../actor/instance/L2GrandBossInstance.java | 7 --- .../actor/instance/L2MonsterInstance.java | 30 ------------ .../actor/instance/L2RaidBossInstance.java | 46 ------------------- .../gameserver/ai/L2AttackableAI.java | 6 +++ .../actor/instance/L2GrandBossInstance.java | 7 --- .../actor/instance/L2MonsterInstance.java | 30 ------------ .../actor/instance/L2RaidBossInstance.java | 46 ------------------- .../gameserver/ai/L2AttackableAI.java | 6 +++ .../actor/instance/L2GrandBossInstance.java | 7 --- .../actor/instance/L2MonsterInstance.java | 30 ------------ .../actor/instance/L2RaidBossInstance.java | 46 ------------------- 52 files changed, 81 insertions(+), 1022 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index 9b21af1ba1..5c853050cb 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -1174,6 +1174,12 @@ public class L2AttackableAI extends L2CharacterAI return; } + // Prevent thinking in non active regions. + if (!_actor.isInActiveRegion()) + { + return; + } + // Start thinking action _thinking = true; diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java index dd29ed0301..bf70890703 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; */ public final class L2GrandBossInstance extends L2MonsterInstance { - private static final int BOSS_MAINTENANCE_INTERVAL = 10000; private boolean _useRaidCurse = true; /** @@ -40,12 +39,6 @@ public final class L2GrandBossInstance extends L2MonsterInstance setLethalable(false); } - @Override - protected int getMaintenanceInterval() - { - return BOSS_MAINTENANCE_INTERVAL; - } - @Override public void onSpawn() { diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java index 135ab0aa11..67c1dc6db0 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java @@ -16,8 +16,6 @@ */ package com.l2jmobius.gameserver.model.actor.instance; -import java.util.concurrent.ScheduledFuture; - import com.l2jmobius.Config; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.model.actor.L2Attackable; @@ -43,10 +41,6 @@ public class L2MonsterInstance extends L2Attackable private L2MonsterInstance _master = null; private volatile MinionList _minionList = null; - protected ScheduledFuture _maintenanceTask = null; - - private static final int MONSTER_MAINTENANCE_INTERVAL = 1000; - /** * Constructor of L2MonsterInstance (use L2Character and L2NpcInstance constructor).
* Actions : @@ -115,8 +109,6 @@ public class L2MonsterInstance extends L2Attackable setIsRaidMinion(_master.isRaid()); _master.getMinionList().onMinionSpawn(this); } - - startMaintenanceTask(); } // dynamic script-based minions spawned here, after all preparations. @@ -134,15 +126,6 @@ public class L2MonsterInstance extends L2Attackable } } - protected int getMaintenanceInterval() - { - return MONSTER_MAINTENANCE_INTERVAL; - } - - protected void startMaintenanceTask() - { - } - @Override public boolean doDie(L2Character killer) { @@ -150,25 +133,12 @@ public class L2MonsterInstance extends L2Attackable { return false; } - - if (_maintenanceTask != null) - { - _maintenanceTask.cancel(false); // doesn't do it? - _maintenanceTask = null; - } - return true; } @Override public boolean deleteMe() { - if (_maintenanceTask != null) - { - _maintenanceTask.cancel(false); - _maintenanceTask = null; - } - if (hasMinions()) { getMinionList().onMasterDie(true); diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java index 8c7f0330ea..0b5cce7584 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java @@ -17,10 +17,7 @@ package com.l2jmobius.gameserver.model.actor.instance; import com.l2jmobius.Config; -import com.l2jmobius.commons.concurrent.ThreadPool; -import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.enums.InstanceType; -import com.l2jmobius.gameserver.model.L2Spawn; import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; import com.l2jmobius.gameserver.network.serverpackets.PlaySound; @@ -30,8 +27,6 @@ import com.l2jmobius.gameserver.network.serverpackets.PlaySound; */ public class L2RaidBossInstance extends L2MonsterInstance { - private static final int RAIDBOSS_MAINTENANCE_INTERVAL = 30000; // 30 sec - private boolean _useRaidCurse = true; /** @@ -60,47 +55,6 @@ public class L2RaidBossInstance extends L2MonsterInstance broadcastPacket(new PlaySound(1, getParameters().getString("RaidSpawnMusic", "Rm01_A"), 0, 0, 0, 0, 0)); } - @Override - protected int getMaintenanceInterval() - { - return RAIDBOSS_MAINTENANCE_INTERVAL; - } - - /** - * Spawn all minions at a regular interval Also if boss is too far from home location at the time of this check, teleport it home. - */ - @Override - protected void startMaintenanceTask() - { - _maintenanceTask = ThreadPool.scheduleAtFixedRate(() -> checkAndReturnToSpawn(), 60000, getMaintenanceInterval() + Rnd.get(5000)); - } - - protected void checkAndReturnToSpawn() - { - if (isDead() || isMovementDisabled() || !canReturnToSpawnPoint()) - { - return; - } - - final L2Spawn spawn = getSpawn(); - if (spawn == null) - { - return; - } - - final int spawnX = spawn.getX(); - final int spawnY = spawn.getY(); - final int spawnZ = spawn.getZ(); - - if (!isInCombat() && !isMovementDisabled()) - { - if (!isInsideRadius3D(spawnX, spawnY, spawnZ, Math.max(Config.MAX_DRIFT_RANGE, 200))) - { - teleToLocation(spawnX, spawnY, spawnZ); - } - } - } - @Override public int getVitalityPoints(int level, double exp, boolean isBoss) { diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index 9b21af1ba1..5c853050cb 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -1174,6 +1174,12 @@ public class L2AttackableAI extends L2CharacterAI return; } + // Prevent thinking in non active regions. + if (!_actor.isInActiveRegion()) + { + return; + } + // Start thinking action _thinking = true; diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java index dd29ed0301..bf70890703 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; */ public final class L2GrandBossInstance extends L2MonsterInstance { - private static final int BOSS_MAINTENANCE_INTERVAL = 10000; private boolean _useRaidCurse = true; /** @@ -40,12 +39,6 @@ public final class L2GrandBossInstance extends L2MonsterInstance setLethalable(false); } - @Override - protected int getMaintenanceInterval() - { - return BOSS_MAINTENANCE_INTERVAL; - } - @Override public void onSpawn() { diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java index 135ab0aa11..67c1dc6db0 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java @@ -16,8 +16,6 @@ */ package com.l2jmobius.gameserver.model.actor.instance; -import java.util.concurrent.ScheduledFuture; - import com.l2jmobius.Config; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.model.actor.L2Attackable; @@ -43,10 +41,6 @@ public class L2MonsterInstance extends L2Attackable private L2MonsterInstance _master = null; private volatile MinionList _minionList = null; - protected ScheduledFuture _maintenanceTask = null; - - private static final int MONSTER_MAINTENANCE_INTERVAL = 1000; - /** * Constructor of L2MonsterInstance (use L2Character and L2NpcInstance constructor).
* Actions : @@ -115,8 +109,6 @@ public class L2MonsterInstance extends L2Attackable setIsRaidMinion(_master.isRaid()); _master.getMinionList().onMinionSpawn(this); } - - startMaintenanceTask(); } // dynamic script-based minions spawned here, after all preparations. @@ -134,15 +126,6 @@ public class L2MonsterInstance extends L2Attackable } } - protected int getMaintenanceInterval() - { - return MONSTER_MAINTENANCE_INTERVAL; - } - - protected void startMaintenanceTask() - { - } - @Override public boolean doDie(L2Character killer) { @@ -150,25 +133,12 @@ public class L2MonsterInstance extends L2Attackable { return false; } - - if (_maintenanceTask != null) - { - _maintenanceTask.cancel(false); // doesn't do it? - _maintenanceTask = null; - } - return true; } @Override public boolean deleteMe() { - if (_maintenanceTask != null) - { - _maintenanceTask.cancel(false); - _maintenanceTask = null; - } - if (hasMinions()) { getMinionList().onMasterDie(true); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java index 8c7f0330ea..0b5cce7584 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java @@ -17,10 +17,7 @@ package com.l2jmobius.gameserver.model.actor.instance; import com.l2jmobius.Config; -import com.l2jmobius.commons.concurrent.ThreadPool; -import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.enums.InstanceType; -import com.l2jmobius.gameserver.model.L2Spawn; import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; import com.l2jmobius.gameserver.network.serverpackets.PlaySound; @@ -30,8 +27,6 @@ import com.l2jmobius.gameserver.network.serverpackets.PlaySound; */ public class L2RaidBossInstance extends L2MonsterInstance { - private static final int RAIDBOSS_MAINTENANCE_INTERVAL = 30000; // 30 sec - private boolean _useRaidCurse = true; /** @@ -60,47 +55,6 @@ public class L2RaidBossInstance extends L2MonsterInstance broadcastPacket(new PlaySound(1, getParameters().getString("RaidSpawnMusic", "Rm01_A"), 0, 0, 0, 0, 0)); } - @Override - protected int getMaintenanceInterval() - { - return RAIDBOSS_MAINTENANCE_INTERVAL; - } - - /** - * Spawn all minions at a regular interval Also if boss is too far from home location at the time of this check, teleport it home. - */ - @Override - protected void startMaintenanceTask() - { - _maintenanceTask = ThreadPool.scheduleAtFixedRate(() -> checkAndReturnToSpawn(), 60000, getMaintenanceInterval() + Rnd.get(5000)); - } - - protected void checkAndReturnToSpawn() - { - if (isDead() || isMovementDisabled() || !canReturnToSpawnPoint()) - { - return; - } - - final L2Spawn spawn = getSpawn(); - if (spawn == null) - { - return; - } - - final int spawnX = spawn.getX(); - final int spawnY = spawn.getY(); - final int spawnZ = spawn.getZ(); - - if (!isInCombat() && !isMovementDisabled()) - { - if (!isInsideRadius3D(spawnX, spawnY, spawnZ, Math.max(Config.MAX_DRIFT_RANGE, 200))) - { - teleToLocation(spawnX, spawnY, spawnZ); - } - } - } - @Override public int getVitalityPoints(int level, double exp, boolean isBoss) { diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index 9b21af1ba1..5c853050cb 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -1174,6 +1174,12 @@ public class L2AttackableAI extends L2CharacterAI return; } + // Prevent thinking in non active regions. + if (!_actor.isInActiveRegion()) + { + return; + } + // Start thinking action _thinking = true; diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java index dd29ed0301..bf70890703 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; */ public final class L2GrandBossInstance extends L2MonsterInstance { - private static final int BOSS_MAINTENANCE_INTERVAL = 10000; private boolean _useRaidCurse = true; /** @@ -40,12 +39,6 @@ public final class L2GrandBossInstance extends L2MonsterInstance setLethalable(false); } - @Override - protected int getMaintenanceInterval() - { - return BOSS_MAINTENANCE_INTERVAL; - } - @Override public void onSpawn() { diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java index 135ab0aa11..67c1dc6db0 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java @@ -16,8 +16,6 @@ */ package com.l2jmobius.gameserver.model.actor.instance; -import java.util.concurrent.ScheduledFuture; - import com.l2jmobius.Config; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.model.actor.L2Attackable; @@ -43,10 +41,6 @@ public class L2MonsterInstance extends L2Attackable private L2MonsterInstance _master = null; private volatile MinionList _minionList = null; - protected ScheduledFuture _maintenanceTask = null; - - private static final int MONSTER_MAINTENANCE_INTERVAL = 1000; - /** * Constructor of L2MonsterInstance (use L2Character and L2NpcInstance constructor).
* Actions : @@ -115,8 +109,6 @@ public class L2MonsterInstance extends L2Attackable setIsRaidMinion(_master.isRaid()); _master.getMinionList().onMinionSpawn(this); } - - startMaintenanceTask(); } // dynamic script-based minions spawned here, after all preparations. @@ -134,15 +126,6 @@ public class L2MonsterInstance extends L2Attackable } } - protected int getMaintenanceInterval() - { - return MONSTER_MAINTENANCE_INTERVAL; - } - - protected void startMaintenanceTask() - { - } - @Override public boolean doDie(L2Character killer) { @@ -150,25 +133,12 @@ public class L2MonsterInstance extends L2Attackable { return false; } - - if (_maintenanceTask != null) - { - _maintenanceTask.cancel(false); // doesn't do it? - _maintenanceTask = null; - } - return true; } @Override public boolean deleteMe() { - if (_maintenanceTask != null) - { - _maintenanceTask.cancel(false); - _maintenanceTask = null; - } - if (hasMinions()) { getMinionList().onMasterDie(true); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java index 8c7f0330ea..0b5cce7584 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java @@ -17,10 +17,7 @@ package com.l2jmobius.gameserver.model.actor.instance; import com.l2jmobius.Config; -import com.l2jmobius.commons.concurrent.ThreadPool; -import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.enums.InstanceType; -import com.l2jmobius.gameserver.model.L2Spawn; import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; import com.l2jmobius.gameserver.network.serverpackets.PlaySound; @@ -30,8 +27,6 @@ import com.l2jmobius.gameserver.network.serverpackets.PlaySound; */ public class L2RaidBossInstance extends L2MonsterInstance { - private static final int RAIDBOSS_MAINTENANCE_INTERVAL = 30000; // 30 sec - private boolean _useRaidCurse = true; /** @@ -60,47 +55,6 @@ public class L2RaidBossInstance extends L2MonsterInstance broadcastPacket(new PlaySound(1, getParameters().getString("RaidSpawnMusic", "Rm01_A"), 0, 0, 0, 0, 0)); } - @Override - protected int getMaintenanceInterval() - { - return RAIDBOSS_MAINTENANCE_INTERVAL; - } - - /** - * Spawn all minions at a regular interval Also if boss is too far from home location at the time of this check, teleport it home. - */ - @Override - protected void startMaintenanceTask() - { - _maintenanceTask = ThreadPool.scheduleAtFixedRate(() -> checkAndReturnToSpawn(), 60000, getMaintenanceInterval() + Rnd.get(5000)); - } - - protected void checkAndReturnToSpawn() - { - if (isDead() || isMovementDisabled() || !canReturnToSpawnPoint()) - { - return; - } - - final L2Spawn spawn = getSpawn(); - if (spawn == null) - { - return; - } - - final int spawnX = spawn.getX(); - final int spawnY = spawn.getY(); - final int spawnZ = spawn.getZ(); - - if (!isInCombat() && !isMovementDisabled()) - { - if (!isInsideRadius3D(spawnX, spawnY, spawnZ, Math.max(Config.MAX_DRIFT_RANGE, 200))) - { - teleToLocation(spawnX, spawnY, spawnZ); - } - } - } - @Override public int getVitalityPoints(int level, double exp, boolean isBoss) { diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index 9b21af1ba1..5c853050cb 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -1174,6 +1174,12 @@ public class L2AttackableAI extends L2CharacterAI return; } + // Prevent thinking in non active regions. + if (!_actor.isInActiveRegion()) + { + return; + } + // Start thinking action _thinking = true; diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java index dd29ed0301..bf70890703 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; */ public final class L2GrandBossInstance extends L2MonsterInstance { - private static final int BOSS_MAINTENANCE_INTERVAL = 10000; private boolean _useRaidCurse = true; /** @@ -40,12 +39,6 @@ public final class L2GrandBossInstance extends L2MonsterInstance setLethalable(false); } - @Override - protected int getMaintenanceInterval() - { - return BOSS_MAINTENANCE_INTERVAL; - } - @Override public void onSpawn() { diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java index 135ab0aa11..67c1dc6db0 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java @@ -16,8 +16,6 @@ */ package com.l2jmobius.gameserver.model.actor.instance; -import java.util.concurrent.ScheduledFuture; - import com.l2jmobius.Config; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.model.actor.L2Attackable; @@ -43,10 +41,6 @@ public class L2MonsterInstance extends L2Attackable private L2MonsterInstance _master = null; private volatile MinionList _minionList = null; - protected ScheduledFuture _maintenanceTask = null; - - private static final int MONSTER_MAINTENANCE_INTERVAL = 1000; - /** * Constructor of L2MonsterInstance (use L2Character and L2NpcInstance constructor).
* Actions : @@ -115,8 +109,6 @@ public class L2MonsterInstance extends L2Attackable setIsRaidMinion(_master.isRaid()); _master.getMinionList().onMinionSpawn(this); } - - startMaintenanceTask(); } // dynamic script-based minions spawned here, after all preparations. @@ -134,15 +126,6 @@ public class L2MonsterInstance extends L2Attackable } } - protected int getMaintenanceInterval() - { - return MONSTER_MAINTENANCE_INTERVAL; - } - - protected void startMaintenanceTask() - { - } - @Override public boolean doDie(L2Character killer) { @@ -150,25 +133,12 @@ public class L2MonsterInstance extends L2Attackable { return false; } - - if (_maintenanceTask != null) - { - _maintenanceTask.cancel(false); // doesn't do it? - _maintenanceTask = null; - } - return true; } @Override public boolean deleteMe() { - if (_maintenanceTask != null) - { - _maintenanceTask.cancel(false); - _maintenanceTask = null; - } - if (hasMinions()) { getMinionList().onMasterDie(true); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java index 8c7f0330ea..0b5cce7584 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java @@ -17,10 +17,7 @@ package com.l2jmobius.gameserver.model.actor.instance; import com.l2jmobius.Config; -import com.l2jmobius.commons.concurrent.ThreadPool; -import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.enums.InstanceType; -import com.l2jmobius.gameserver.model.L2Spawn; import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; import com.l2jmobius.gameserver.network.serverpackets.PlaySound; @@ -30,8 +27,6 @@ import com.l2jmobius.gameserver.network.serverpackets.PlaySound; */ public class L2RaidBossInstance extends L2MonsterInstance { - private static final int RAIDBOSS_MAINTENANCE_INTERVAL = 30000; // 30 sec - private boolean _useRaidCurse = true; /** @@ -60,47 +55,6 @@ public class L2RaidBossInstance extends L2MonsterInstance broadcastPacket(new PlaySound(1, getParameters().getString("RaidSpawnMusic", "Rm01_A"), 0, 0, 0, 0, 0)); } - @Override - protected int getMaintenanceInterval() - { - return RAIDBOSS_MAINTENANCE_INTERVAL; - } - - /** - * Spawn all minions at a regular interval Also if boss is too far from home location at the time of this check, teleport it home. - */ - @Override - protected void startMaintenanceTask() - { - _maintenanceTask = ThreadPool.scheduleAtFixedRate(() -> checkAndReturnToSpawn(), 60000, getMaintenanceInterval() + Rnd.get(5000)); - } - - protected void checkAndReturnToSpawn() - { - if (isDead() || isMovementDisabled() || !canReturnToSpawnPoint()) - { - return; - } - - final L2Spawn spawn = getSpawn(); - if (spawn == null) - { - return; - } - - final int spawnX = spawn.getX(); - final int spawnY = spawn.getY(); - final int spawnZ = spawn.getZ(); - - if (!isInCombat() && !isMovementDisabled()) - { - if (!isInsideRadius3D(spawnX, spawnY, spawnZ, Math.max(Config.MAX_DRIFT_RANGE, 200))) - { - teleToLocation(spawnX, spawnY, spawnZ); - } - } - } - @Override public int getVitalityPoints(int level, double exp, boolean isBoss) { diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index 9b21af1ba1..5c853050cb 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -1174,6 +1174,12 @@ public class L2AttackableAI extends L2CharacterAI return; } + // Prevent thinking in non active regions. + if (!_actor.isInActiveRegion()) + { + return; + } + // Start thinking action _thinking = true; diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java index dd29ed0301..bf70890703 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; */ public final class L2GrandBossInstance extends L2MonsterInstance { - private static final int BOSS_MAINTENANCE_INTERVAL = 10000; private boolean _useRaidCurse = true; /** @@ -40,12 +39,6 @@ public final class L2GrandBossInstance extends L2MonsterInstance setLethalable(false); } - @Override - protected int getMaintenanceInterval() - { - return BOSS_MAINTENANCE_INTERVAL; - } - @Override public void onSpawn() { diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java index 135ab0aa11..67c1dc6db0 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java @@ -16,8 +16,6 @@ */ package com.l2jmobius.gameserver.model.actor.instance; -import java.util.concurrent.ScheduledFuture; - import com.l2jmobius.Config; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.model.actor.L2Attackable; @@ -43,10 +41,6 @@ public class L2MonsterInstance extends L2Attackable private L2MonsterInstance _master = null; private volatile MinionList _minionList = null; - protected ScheduledFuture _maintenanceTask = null; - - private static final int MONSTER_MAINTENANCE_INTERVAL = 1000; - /** * Constructor of L2MonsterInstance (use L2Character and L2NpcInstance constructor).
* Actions : @@ -115,8 +109,6 @@ public class L2MonsterInstance extends L2Attackable setIsRaidMinion(_master.isRaid()); _master.getMinionList().onMinionSpawn(this); } - - startMaintenanceTask(); } // dynamic script-based minions spawned here, after all preparations. @@ -134,15 +126,6 @@ public class L2MonsterInstance extends L2Attackable } } - protected int getMaintenanceInterval() - { - return MONSTER_MAINTENANCE_INTERVAL; - } - - protected void startMaintenanceTask() - { - } - @Override public boolean doDie(L2Character killer) { @@ -150,25 +133,12 @@ public class L2MonsterInstance extends L2Attackable { return false; } - - if (_maintenanceTask != null) - { - _maintenanceTask.cancel(false); // doesn't do it? - _maintenanceTask = null; - } - return true; } @Override public boolean deleteMe() { - if (_maintenanceTask != null) - { - _maintenanceTask.cancel(false); - _maintenanceTask = null; - } - if (hasMinions()) { getMinionList().onMasterDie(true); diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java index 8c7f0330ea..0b5cce7584 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java @@ -17,10 +17,7 @@ package com.l2jmobius.gameserver.model.actor.instance; import com.l2jmobius.Config; -import com.l2jmobius.commons.concurrent.ThreadPool; -import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.enums.InstanceType; -import com.l2jmobius.gameserver.model.L2Spawn; import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; import com.l2jmobius.gameserver.network.serverpackets.PlaySound; @@ -30,8 +27,6 @@ import com.l2jmobius.gameserver.network.serverpackets.PlaySound; */ public class L2RaidBossInstance extends L2MonsterInstance { - private static final int RAIDBOSS_MAINTENANCE_INTERVAL = 30000; // 30 sec - private boolean _useRaidCurse = true; /** @@ -60,47 +55,6 @@ public class L2RaidBossInstance extends L2MonsterInstance broadcastPacket(new PlaySound(1, getParameters().getString("RaidSpawnMusic", "Rm01_A"), 0, 0, 0, 0, 0)); } - @Override - protected int getMaintenanceInterval() - { - return RAIDBOSS_MAINTENANCE_INTERVAL; - } - - /** - * Spawn all minions at a regular interval Also if boss is too far from home location at the time of this check, teleport it home. - */ - @Override - protected void startMaintenanceTask() - { - _maintenanceTask = ThreadPool.scheduleAtFixedRate(() -> checkAndReturnToSpawn(), 60000, getMaintenanceInterval() + Rnd.get(5000)); - } - - protected void checkAndReturnToSpawn() - { - if (isDead() || isMovementDisabled() || !canReturnToSpawnPoint()) - { - return; - } - - final L2Spawn spawn = getSpawn(); - if (spawn == null) - { - return; - } - - final int spawnX = spawn.getX(); - final int spawnY = spawn.getY(); - final int spawnZ = spawn.getZ(); - - if (!isInCombat() && !isMovementDisabled()) - { - if (!isInsideRadius3D(spawnX, spawnY, spawnZ, Math.max(Config.MAX_DRIFT_RANGE, 200))) - { - teleToLocation(spawnX, spawnY, spawnZ); - } - } - } - @Override public int getVitalityPoints(int level, double exp, boolean isBoss) { diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index 9b21af1ba1..5c853050cb 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -1174,6 +1174,12 @@ public class L2AttackableAI extends L2CharacterAI return; } + // Prevent thinking in non active regions. + if (!_actor.isInActiveRegion()) + { + return; + } + // Start thinking action _thinking = true; diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java index dd29ed0301..bf70890703 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; */ public final class L2GrandBossInstance extends L2MonsterInstance { - private static final int BOSS_MAINTENANCE_INTERVAL = 10000; private boolean _useRaidCurse = true; /** @@ -40,12 +39,6 @@ public final class L2GrandBossInstance extends L2MonsterInstance setLethalable(false); } - @Override - protected int getMaintenanceInterval() - { - return BOSS_MAINTENANCE_INTERVAL; - } - @Override public void onSpawn() { diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java index 135ab0aa11..67c1dc6db0 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java @@ -16,8 +16,6 @@ */ package com.l2jmobius.gameserver.model.actor.instance; -import java.util.concurrent.ScheduledFuture; - import com.l2jmobius.Config; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.model.actor.L2Attackable; @@ -43,10 +41,6 @@ public class L2MonsterInstance extends L2Attackable private L2MonsterInstance _master = null; private volatile MinionList _minionList = null; - protected ScheduledFuture _maintenanceTask = null; - - private static final int MONSTER_MAINTENANCE_INTERVAL = 1000; - /** * Constructor of L2MonsterInstance (use L2Character and L2NpcInstance constructor).
* Actions : @@ -115,8 +109,6 @@ public class L2MonsterInstance extends L2Attackable setIsRaidMinion(_master.isRaid()); _master.getMinionList().onMinionSpawn(this); } - - startMaintenanceTask(); } // dynamic script-based minions spawned here, after all preparations. @@ -134,15 +126,6 @@ public class L2MonsterInstance extends L2Attackable } } - protected int getMaintenanceInterval() - { - return MONSTER_MAINTENANCE_INTERVAL; - } - - protected void startMaintenanceTask() - { - } - @Override public boolean doDie(L2Character killer) { @@ -150,25 +133,12 @@ public class L2MonsterInstance extends L2Attackable { return false; } - - if (_maintenanceTask != null) - { - _maintenanceTask.cancel(false); // doesn't do it? - _maintenanceTask = null; - } - return true; } @Override public boolean deleteMe() { - if (_maintenanceTask != null) - { - _maintenanceTask.cancel(false); - _maintenanceTask = null; - } - if (hasMinions()) { getMinionList().onMasterDie(true); diff --git a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java index 8c7f0330ea..0b5cce7584 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java +++ b/L2J_Mobius_5.5_EtinasFate/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java @@ -17,10 +17,7 @@ package com.l2jmobius.gameserver.model.actor.instance; import com.l2jmobius.Config; -import com.l2jmobius.commons.concurrent.ThreadPool; -import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.enums.InstanceType; -import com.l2jmobius.gameserver.model.L2Spawn; import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; import com.l2jmobius.gameserver.network.serverpackets.PlaySound; @@ -30,8 +27,6 @@ import com.l2jmobius.gameserver.network.serverpackets.PlaySound; */ public class L2RaidBossInstance extends L2MonsterInstance { - private static final int RAIDBOSS_MAINTENANCE_INTERVAL = 30000; // 30 sec - private boolean _useRaidCurse = true; /** @@ -60,47 +55,6 @@ public class L2RaidBossInstance extends L2MonsterInstance broadcastPacket(new PlaySound(1, getParameters().getString("RaidSpawnMusic", "Rm01_A"), 0, 0, 0, 0, 0)); } - @Override - protected int getMaintenanceInterval() - { - return RAIDBOSS_MAINTENANCE_INTERVAL; - } - - /** - * Spawn all minions at a regular interval Also if boss is too far from home location at the time of this check, teleport it home. - */ - @Override - protected void startMaintenanceTask() - { - _maintenanceTask = ThreadPool.scheduleAtFixedRate(() -> checkAndReturnToSpawn(), 60000, getMaintenanceInterval() + Rnd.get(5000)); - } - - protected void checkAndReturnToSpawn() - { - if (isDead() || isMovementDisabled() || !canReturnToSpawnPoint()) - { - return; - } - - final L2Spawn spawn = getSpawn(); - if (spawn == null) - { - return; - } - - final int spawnX = spawn.getX(); - final int spawnY = spawn.getY(); - final int spawnZ = spawn.getZ(); - - if (!isInCombat() && !isMovementDisabled()) - { - if (!isInsideRadius3D(spawnX, spawnY, spawnZ, Math.max(Config.MAX_DRIFT_RANGE, 200))) - { - teleToLocation(spawnX, spawnY, spawnZ); - } - } - } - @Override public int getVitalityPoints(int level, double exp, boolean isBoss) { diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index 9b21af1ba1..5c853050cb 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -1174,6 +1174,12 @@ public class L2AttackableAI extends L2CharacterAI return; } + // Prevent thinking in non active regions. + if (!_actor.isInActiveRegion()) + { + return; + } + // Start thinking action _thinking = true; diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java index dd29ed0301..bf70890703 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; */ public final class L2GrandBossInstance extends L2MonsterInstance { - private static final int BOSS_MAINTENANCE_INTERVAL = 10000; private boolean _useRaidCurse = true; /** @@ -40,12 +39,6 @@ public final class L2GrandBossInstance extends L2MonsterInstance setLethalable(false); } - @Override - protected int getMaintenanceInterval() - { - return BOSS_MAINTENANCE_INTERVAL; - } - @Override public void onSpawn() { diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java index 135ab0aa11..67c1dc6db0 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java @@ -16,8 +16,6 @@ */ package com.l2jmobius.gameserver.model.actor.instance; -import java.util.concurrent.ScheduledFuture; - import com.l2jmobius.Config; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.model.actor.L2Attackable; @@ -43,10 +41,6 @@ public class L2MonsterInstance extends L2Attackable private L2MonsterInstance _master = null; private volatile MinionList _minionList = null; - protected ScheduledFuture _maintenanceTask = null; - - private static final int MONSTER_MAINTENANCE_INTERVAL = 1000; - /** * Constructor of L2MonsterInstance (use L2Character and L2NpcInstance constructor).
* Actions : @@ -115,8 +109,6 @@ public class L2MonsterInstance extends L2Attackable setIsRaidMinion(_master.isRaid()); _master.getMinionList().onMinionSpawn(this); } - - startMaintenanceTask(); } // dynamic script-based minions spawned here, after all preparations. @@ -134,15 +126,6 @@ public class L2MonsterInstance extends L2Attackable } } - protected int getMaintenanceInterval() - { - return MONSTER_MAINTENANCE_INTERVAL; - } - - protected void startMaintenanceTask() - { - } - @Override public boolean doDie(L2Character killer) { @@ -150,25 +133,12 @@ public class L2MonsterInstance extends L2Attackable { return false; } - - if (_maintenanceTask != null) - { - _maintenanceTask.cancel(false); // doesn't do it? - _maintenanceTask = null; - } - return true; } @Override public boolean deleteMe() { - if (_maintenanceTask != null) - { - _maintenanceTask.cancel(false); - _maintenanceTask = null; - } - if (hasMinions()) { getMinionList().onMasterDie(true); diff --git a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java index 8c7f0330ea..0b5cce7584 100644 --- a/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java +++ b/L2J_Mobius_6.0_Fafurion/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java @@ -17,10 +17,7 @@ package com.l2jmobius.gameserver.model.actor.instance; import com.l2jmobius.Config; -import com.l2jmobius.commons.concurrent.ThreadPool; -import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.enums.InstanceType; -import com.l2jmobius.gameserver.model.L2Spawn; import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; import com.l2jmobius.gameserver.network.serverpackets.PlaySound; @@ -30,8 +27,6 @@ import com.l2jmobius.gameserver.network.serverpackets.PlaySound; */ public class L2RaidBossInstance extends L2MonsterInstance { - private static final int RAIDBOSS_MAINTENANCE_INTERVAL = 30000; // 30 sec - private boolean _useRaidCurse = true; /** @@ -60,47 +55,6 @@ public class L2RaidBossInstance extends L2MonsterInstance broadcastPacket(new PlaySound(1, getParameters().getString("RaidSpawnMusic", "Rm01_A"), 0, 0, 0, 0, 0)); } - @Override - protected int getMaintenanceInterval() - { - return RAIDBOSS_MAINTENANCE_INTERVAL; - } - - /** - * Spawn all minions at a regular interval Also if boss is too far from home location at the time of this check, teleport it home. - */ - @Override - protected void startMaintenanceTask() - { - _maintenanceTask = ThreadPool.scheduleAtFixedRate(() -> checkAndReturnToSpawn(), 60000, getMaintenanceInterval() + Rnd.get(5000)); - } - - protected void checkAndReturnToSpawn() - { - if (isDead() || isMovementDisabled() || !canReturnToSpawnPoint()) - { - return; - } - - final L2Spawn spawn = getSpawn(); - if (spawn == null) - { - return; - } - - final int spawnX = spawn.getX(); - final int spawnY = spawn.getY(); - final int spawnZ = spawn.getZ(); - - if (!isInCombat() && !isMovementDisabled()) - { - if (!isInsideRadius3D(spawnX, spawnY, spawnZ, Math.max(Config.MAX_DRIFT_RANGE, 200))) - { - teleToLocation(spawnX, spawnY, spawnZ); - } - } - } - @Override public int getVitalityPoints(int level, double exp, boolean isBoss) { diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index 1790461924..cab91421e0 100644 --- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -339,6 +339,12 @@ public class L2AttackableAI extends L2CharacterAI @Override public void changeIntention(CtrlIntention intention, Object arg0, Object arg1) { + // Prevent thinking in non active regions. + if (!_actor.isInActiveRegion()) + { + return; + } + if ((intention == AI_INTENTION_IDLE) || (intention == AI_INTENTION_ACTIVE)) { // Check if actor is not dead diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java index 445ed72e8b..e1852a7d17 100644 --- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java +++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java @@ -34,8 +34,6 @@ import com.l2jmobius.gameserver.templates.chars.L2NpcTemplate; */ public final class L2GrandBossInstance extends L2MonsterInstance { - private static final int BOSS_MAINTENANCE_INTERVAL = 20000; - /** * Constructor for L2GrandBossInstance. This represent all grandbosses. * @param objectId ID of the instance @@ -46,12 +44,6 @@ public final class L2GrandBossInstance extends L2MonsterInstance super(objectId, template); } - @Override - protected int getMaintenanceInterval() - { - return BOSS_MAINTENANCE_INTERVAL; - } - @Override public boolean doDie(L2Character killer) { @@ -122,7 +114,7 @@ public final class L2GrandBossInstance extends L2MonsterInstance } _minionList.maintainMinions(); - }, 60000, getMaintenanceInterval()); + }, 60000, 20000); } @Override diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java index 5480c22ef4..21d61a03dc 100644 --- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java +++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java @@ -41,7 +41,6 @@ import com.l2jmobius.gameserver.util.MinionList; */ public class L2MonsterInstance extends L2Attackable { - private static final int MONSTER_MAINTENANCE_INTERVAL = 1000; protected final MinionList _minionList; protected ScheduledFuture _minionMaintainTask = null; @@ -151,21 +150,12 @@ public class L2MonsterInstance extends L2Attackable } } - /** - * Gets the maintenance interval. - * @return the maintenance interval - */ - protected int getMaintenanceInterval() - { - return MONSTER_MAINTENANCE_INTERVAL; - } - /** * Spawn all minions at a regular interval. */ protected void manageMinions() { - _minionMaintainTask = ThreadPool.schedule(() -> _minionList.spawnMinions(), getMaintenanceInterval()); + _minionMaintainTask = ThreadPool.schedule(() -> _minionList.spawnMinions(), 1000); } public void callMinions() diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java index f7d917dce4..27fe232702 100644 --- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java +++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java @@ -34,7 +34,6 @@ import com.l2jmobius.gameserver.templates.chars.L2NpcTemplate; */ public final class L2RaidBossInstance extends L2MonsterInstance { - private static final int RAIDBOSS_MAINTENANCE_INTERVAL = 20000; // 20 sec private RaidBossSpawnManager.StatusEnum _raidStatus; /** @@ -60,12 +59,6 @@ public final class L2RaidBossInstance extends L2MonsterInstance return true; } - @Override - protected int getMaintenanceInterval() - { - return RAIDBOSS_MAINTENANCE_INTERVAL; - } - @Override public boolean doDie(L2Character killer) { @@ -135,7 +128,7 @@ public final class L2RaidBossInstance extends L2MonsterInstance } _minionList.maintainMinions(); - }, 60000, getMaintenanceInterval()); + }, 60000, 20000); } /** diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index 7d0dcc2554..18878e2644 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -2262,6 +2262,12 @@ public class L2AttackableAI extends L2CharacterAI return; } + // Prevent thinking in non active regions. + if (!_actor.isInActiveRegion()) + { + return; + } + // Start thinking action _thinking = true; diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java index d3aeec4c44..1c3515fe6f 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java @@ -32,7 +32,6 @@ import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; */ public final class L2GrandBossInstance extends L2MonsterInstance { - private static final int BOSS_MAINTENANCE_INTERVAL = 10000; private boolean _useRaidCurse = true; /** @@ -47,12 +46,6 @@ public final class L2GrandBossInstance extends L2MonsterInstance setLethalable(false); } - @Override - protected int getMaintenanceInterval() - { - return BOSS_MAINTENANCE_INTERVAL; - } - @Override public void onSpawn() { diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java index ca54f2f108..e814484737 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java @@ -16,8 +16,6 @@ */ package com.l2jmobius.gameserver.model.actor.instance; -import java.util.concurrent.ScheduledFuture; - import com.l2jmobius.Config; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.model.L2Object; @@ -38,15 +36,11 @@ import com.l2jmobius.gameserver.util.MinionList; */ public class L2MonsterInstance extends L2Attackable { - private static final int MONSTER_MAINTENANCE_INTERVAL = 1000; - protected boolean _enableMinions = true; private L2MonsterInstance _master = null; private volatile MinionList _minionList = null; - protected ScheduledFuture _maintenanceTask = null; - /** * Creates a monster. * @param template the monster NPC template @@ -109,8 +103,6 @@ public class L2MonsterInstance extends L2Attackable setIsRaidMinion(_master.isRaid()); _master.getMinionList().onMinionSpawn(this); } - - startMaintenanceTask(); } // dynamic script-based minions spawned here, after all preparations. @@ -128,15 +120,6 @@ public class L2MonsterInstance extends L2Attackable } } - protected int getMaintenanceInterval() - { - return MONSTER_MAINTENANCE_INTERVAL; - } - - protected void startMaintenanceTask() - { - } - @Override public boolean doDie(L2Character killer) { @@ -145,24 +128,12 @@ public class L2MonsterInstance extends L2Attackable return false; } - if (_maintenanceTask != null) - { - _maintenanceTask.cancel(false); // doesn't do it? - _maintenanceTask = null; - } - return true; } @Override public boolean deleteMe() { - if (_maintenanceTask != null) - { - _maintenanceTask.cancel(false); - _maintenanceTask = null; - } - if (hasMinions()) { getMinionList().onMasterDie(true); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java index 56d09ef0e3..6b463129b5 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java @@ -17,12 +17,10 @@ package com.l2jmobius.gameserver.model.actor.instance; import com.l2jmobius.Config; -import com.l2jmobius.commons.concurrent.ThreadPool; import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.instancemanager.RaidBossPointsManager; import com.l2jmobius.gameserver.instancemanager.RaidBossSpawnManager; -import com.l2jmobius.gameserver.model.L2Spawn; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; import com.l2jmobius.gameserver.model.entity.Hero; @@ -35,8 +33,6 @@ import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; */ public class L2RaidBossInstance extends L2MonsterInstance { - private static final int RAIDBOSS_MAINTENANCE_INTERVAL = 30000; // 30 sec - private RaidBossSpawnManager.StatusEnum _raidStatus; private boolean _useRaidCurse = true; @@ -59,12 +55,6 @@ public class L2RaidBossInstance extends L2MonsterInstance super.onSpawn(); } - @Override - protected int getMaintenanceInterval() - { - return RAIDBOSS_MAINTENANCE_INTERVAL; - } - @Override public boolean doDie(L2Character killer) { @@ -102,41 +92,6 @@ public class L2RaidBossInstance extends L2MonsterInstance return true; } - /** - * Spawn all minions at a regular interval Also if boss is too far from home location at the time of this check, teleport it home. - */ - @Override - protected void startMaintenanceTask() - { - _maintenanceTask = ThreadPool.scheduleAtFixedRate(() -> checkAndReturnToSpawn(), 60000, getMaintenanceInterval() + Rnd.get(5000)); - } - - protected void checkAndReturnToSpawn() - { - if (isDead() || isMovementDisabled() || !canReturnToSpawnPoint()) - { - return; - } - - final L2Spawn spawn = getSpawn(); - if (spawn == null) - { - return; - } - - final int spawnX = spawn.getX(); - final int spawnY = spawn.getY(); - final int spawnZ = spawn.getZ(); - - if (!isInCombat() && !isMovementDisabled()) - { - if (!isInsideRadius3D(spawnX, spawnY, spawnZ, Math.max(Config.MAX_DRIFT_RANGE, 200))) - { - teleToLocation(spawnX, spawnY, spawnZ, false); - } - } - } - public void setRaidStatus(RaidBossSpawnManager.StatusEnum status) { _raidStatus = status; diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index 9b21af1ba1..5c853050cb 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -1174,6 +1174,12 @@ public class L2AttackableAI extends L2CharacterAI return; } + // Prevent thinking in non active regions. + if (!_actor.isInActiveRegion()) + { + return; + } + // Start thinking action _thinking = true; diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java index dd29ed0301..bf70890703 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; */ public final class L2GrandBossInstance extends L2MonsterInstance { - private static final int BOSS_MAINTENANCE_INTERVAL = 10000; private boolean _useRaidCurse = true; /** @@ -40,12 +39,6 @@ public final class L2GrandBossInstance extends L2MonsterInstance setLethalable(false); } - @Override - protected int getMaintenanceInterval() - { - return BOSS_MAINTENANCE_INTERVAL; - } - @Override public void onSpawn() { diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java index 135ab0aa11..67c1dc6db0 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java @@ -16,8 +16,6 @@ */ package com.l2jmobius.gameserver.model.actor.instance; -import java.util.concurrent.ScheduledFuture; - import com.l2jmobius.Config; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.model.actor.L2Attackable; @@ -43,10 +41,6 @@ public class L2MonsterInstance extends L2Attackable private L2MonsterInstance _master = null; private volatile MinionList _minionList = null; - protected ScheduledFuture _maintenanceTask = null; - - private static final int MONSTER_MAINTENANCE_INTERVAL = 1000; - /** * Constructor of L2MonsterInstance (use L2Character and L2NpcInstance constructor).
* Actions : @@ -115,8 +109,6 @@ public class L2MonsterInstance extends L2Attackable setIsRaidMinion(_master.isRaid()); _master.getMinionList().onMinionSpawn(this); } - - startMaintenanceTask(); } // dynamic script-based minions spawned here, after all preparations. @@ -134,15 +126,6 @@ public class L2MonsterInstance extends L2Attackable } } - protected int getMaintenanceInterval() - { - return MONSTER_MAINTENANCE_INTERVAL; - } - - protected void startMaintenanceTask() - { - } - @Override public boolean doDie(L2Character killer) { @@ -150,25 +133,12 @@ public class L2MonsterInstance extends L2Attackable { return false; } - - if (_maintenanceTask != null) - { - _maintenanceTask.cancel(false); // doesn't do it? - _maintenanceTask = null; - } - return true; } @Override public boolean deleteMe() { - if (_maintenanceTask != null) - { - _maintenanceTask.cancel(false); - _maintenanceTask = null; - } - if (hasMinions()) { getMinionList().onMasterDie(true); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java index 8c7f0330ea..0b5cce7584 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java @@ -17,10 +17,7 @@ package com.l2jmobius.gameserver.model.actor.instance; import com.l2jmobius.Config; -import com.l2jmobius.commons.concurrent.ThreadPool; -import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.enums.InstanceType; -import com.l2jmobius.gameserver.model.L2Spawn; import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; import com.l2jmobius.gameserver.network.serverpackets.PlaySound; @@ -30,8 +27,6 @@ import com.l2jmobius.gameserver.network.serverpackets.PlaySound; */ public class L2RaidBossInstance extends L2MonsterInstance { - private static final int RAIDBOSS_MAINTENANCE_INTERVAL = 30000; // 30 sec - private boolean _useRaidCurse = true; /** @@ -60,47 +55,6 @@ public class L2RaidBossInstance extends L2MonsterInstance broadcastPacket(new PlaySound(1, getParameters().getString("RaidSpawnMusic", "Rm01_A"), 0, 0, 0, 0, 0)); } - @Override - protected int getMaintenanceInterval() - { - return RAIDBOSS_MAINTENANCE_INTERVAL; - } - - /** - * Spawn all minions at a regular interval Also if boss is too far from home location at the time of this check, teleport it home. - */ - @Override - protected void startMaintenanceTask() - { - _maintenanceTask = ThreadPool.scheduleAtFixedRate(() -> checkAndReturnToSpawn(), 60000, getMaintenanceInterval() + Rnd.get(5000)); - } - - protected void checkAndReturnToSpawn() - { - if (isDead() || isMovementDisabled() || !canReturnToSpawnPoint()) - { - return; - } - - final L2Spawn spawn = getSpawn(); - if (spawn == null) - { - return; - } - - final int spawnX = spawn.getX(); - final int spawnY = spawn.getY(); - final int spawnZ = spawn.getZ(); - - if (!isInCombat() && !isMovementDisabled()) - { - if (!isInsideRadius3D(spawnX, spawnY, spawnZ, Math.max(Config.MAX_DRIFT_RANGE, 200))) - { - teleToLocation(spawnX, spawnY, spawnZ); - } - } - } - @Override public int getVitalityPoints(int level, double exp, boolean isBoss) { diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index 9b21af1ba1..5c853050cb 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -1174,6 +1174,12 @@ public class L2AttackableAI extends L2CharacterAI return; } + // Prevent thinking in non active regions. + if (!_actor.isInActiveRegion()) + { + return; + } + // Start thinking action _thinking = true; diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java index dd29ed0301..bf70890703 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; */ public final class L2GrandBossInstance extends L2MonsterInstance { - private static final int BOSS_MAINTENANCE_INTERVAL = 10000; private boolean _useRaidCurse = true; /** @@ -40,12 +39,6 @@ public final class L2GrandBossInstance extends L2MonsterInstance setLethalable(false); } - @Override - protected int getMaintenanceInterval() - { - return BOSS_MAINTENANCE_INTERVAL; - } - @Override public void onSpawn() { diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java index 135ab0aa11..67c1dc6db0 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java @@ -16,8 +16,6 @@ */ package com.l2jmobius.gameserver.model.actor.instance; -import java.util.concurrent.ScheduledFuture; - import com.l2jmobius.Config; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.model.actor.L2Attackable; @@ -43,10 +41,6 @@ public class L2MonsterInstance extends L2Attackable private L2MonsterInstance _master = null; private volatile MinionList _minionList = null; - protected ScheduledFuture _maintenanceTask = null; - - private static final int MONSTER_MAINTENANCE_INTERVAL = 1000; - /** * Constructor of L2MonsterInstance (use L2Character and L2NpcInstance constructor).
* Actions : @@ -115,8 +109,6 @@ public class L2MonsterInstance extends L2Attackable setIsRaidMinion(_master.isRaid()); _master.getMinionList().onMinionSpawn(this); } - - startMaintenanceTask(); } // dynamic script-based minions spawned here, after all preparations. @@ -134,15 +126,6 @@ public class L2MonsterInstance extends L2Attackable } } - protected int getMaintenanceInterval() - { - return MONSTER_MAINTENANCE_INTERVAL; - } - - protected void startMaintenanceTask() - { - } - @Override public boolean doDie(L2Character killer) { @@ -150,25 +133,12 @@ public class L2MonsterInstance extends L2Attackable { return false; } - - if (_maintenanceTask != null) - { - _maintenanceTask.cancel(false); // doesn't do it? - _maintenanceTask = null; - } - return true; } @Override public boolean deleteMe() { - if (_maintenanceTask != null) - { - _maintenanceTask.cancel(false); - _maintenanceTask = null; - } - if (hasMinions()) { getMinionList().onMasterDie(true); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java index 8c7f0330ea..0b5cce7584 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java @@ -17,10 +17,7 @@ package com.l2jmobius.gameserver.model.actor.instance; import com.l2jmobius.Config; -import com.l2jmobius.commons.concurrent.ThreadPool; -import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.enums.InstanceType; -import com.l2jmobius.gameserver.model.L2Spawn; import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; import com.l2jmobius.gameserver.network.serverpackets.PlaySound; @@ -30,8 +27,6 @@ import com.l2jmobius.gameserver.network.serverpackets.PlaySound; */ public class L2RaidBossInstance extends L2MonsterInstance { - private static final int RAIDBOSS_MAINTENANCE_INTERVAL = 30000; // 30 sec - private boolean _useRaidCurse = true; /** @@ -60,47 +55,6 @@ public class L2RaidBossInstance extends L2MonsterInstance broadcastPacket(new PlaySound(1, getParameters().getString("RaidSpawnMusic", "Rm01_A"), 0, 0, 0, 0, 0)); } - @Override - protected int getMaintenanceInterval() - { - return RAIDBOSS_MAINTENANCE_INTERVAL; - } - - /** - * Spawn all minions at a regular interval Also if boss is too far from home location at the time of this check, teleport it home. - */ - @Override - protected void startMaintenanceTask() - { - _maintenanceTask = ThreadPool.scheduleAtFixedRate(() -> checkAndReturnToSpawn(), 60000, getMaintenanceInterval() + Rnd.get(5000)); - } - - protected void checkAndReturnToSpawn() - { - if (isDead() || isMovementDisabled() || !canReturnToSpawnPoint()) - { - return; - } - - final L2Spawn spawn = getSpawn(); - if (spawn == null) - { - return; - } - - final int spawnX = spawn.getX(); - final int spawnY = spawn.getY(); - final int spawnZ = spawn.getZ(); - - if (!isInCombat() && !isMovementDisabled()) - { - if (!isInsideRadius3D(spawnX, spawnY, spawnZ, Math.max(Config.MAX_DRIFT_RANGE, 200))) - { - teleToLocation(spawnX, spawnY, spawnZ); - } - } - } - @Override public int getVitalityPoints(int level, double exp, boolean isBoss) { diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index 9b21af1ba1..5c853050cb 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -1174,6 +1174,12 @@ public class L2AttackableAI extends L2CharacterAI return; } + // Prevent thinking in non active regions. + if (!_actor.isInActiveRegion()) + { + return; + } + // Start thinking action _thinking = true; diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java index dd29ed0301..bf70890703 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; */ public final class L2GrandBossInstance extends L2MonsterInstance { - private static final int BOSS_MAINTENANCE_INTERVAL = 10000; private boolean _useRaidCurse = true; /** @@ -40,12 +39,6 @@ public final class L2GrandBossInstance extends L2MonsterInstance setLethalable(false); } - @Override - protected int getMaintenanceInterval() - { - return BOSS_MAINTENANCE_INTERVAL; - } - @Override public void onSpawn() { diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java index 135ab0aa11..67c1dc6db0 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java @@ -16,8 +16,6 @@ */ package com.l2jmobius.gameserver.model.actor.instance; -import java.util.concurrent.ScheduledFuture; - import com.l2jmobius.Config; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.model.actor.L2Attackable; @@ -43,10 +41,6 @@ public class L2MonsterInstance extends L2Attackable private L2MonsterInstance _master = null; private volatile MinionList _minionList = null; - protected ScheduledFuture _maintenanceTask = null; - - private static final int MONSTER_MAINTENANCE_INTERVAL = 1000; - /** * Constructor of L2MonsterInstance (use L2Character and L2NpcInstance constructor).
* Actions : @@ -115,8 +109,6 @@ public class L2MonsterInstance extends L2Attackable setIsRaidMinion(_master.isRaid()); _master.getMinionList().onMinionSpawn(this); } - - startMaintenanceTask(); } // dynamic script-based minions spawned here, after all preparations. @@ -134,15 +126,6 @@ public class L2MonsterInstance extends L2Attackable } } - protected int getMaintenanceInterval() - { - return MONSTER_MAINTENANCE_INTERVAL; - } - - protected void startMaintenanceTask() - { - } - @Override public boolean doDie(L2Character killer) { @@ -150,25 +133,12 @@ public class L2MonsterInstance extends L2Attackable { return false; } - - if (_maintenanceTask != null) - { - _maintenanceTask.cancel(false); // doesn't do it? - _maintenanceTask = null; - } - return true; } @Override public boolean deleteMe() { - if (_maintenanceTask != null) - { - _maintenanceTask.cancel(false); - _maintenanceTask = null; - } - if (hasMinions()) { getMinionList().onMasterDie(true); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java index 8c7f0330ea..0b5cce7584 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java @@ -17,10 +17,7 @@ package com.l2jmobius.gameserver.model.actor.instance; import com.l2jmobius.Config; -import com.l2jmobius.commons.concurrent.ThreadPool; -import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.enums.InstanceType; -import com.l2jmobius.gameserver.model.L2Spawn; import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; import com.l2jmobius.gameserver.network.serverpackets.PlaySound; @@ -30,8 +27,6 @@ import com.l2jmobius.gameserver.network.serverpackets.PlaySound; */ public class L2RaidBossInstance extends L2MonsterInstance { - private static final int RAIDBOSS_MAINTENANCE_INTERVAL = 30000; // 30 sec - private boolean _useRaidCurse = true; /** @@ -60,47 +55,6 @@ public class L2RaidBossInstance extends L2MonsterInstance broadcastPacket(new PlaySound(1, getParameters().getString("RaidSpawnMusic", "Rm01_A"), 0, 0, 0, 0, 0)); } - @Override - protected int getMaintenanceInterval() - { - return RAIDBOSS_MAINTENANCE_INTERVAL; - } - - /** - * Spawn all minions at a regular interval Also if boss is too far from home location at the time of this check, teleport it home. - */ - @Override - protected void startMaintenanceTask() - { - _maintenanceTask = ThreadPool.scheduleAtFixedRate(() -> checkAndReturnToSpawn(), 60000, getMaintenanceInterval() + Rnd.get(5000)); - } - - protected void checkAndReturnToSpawn() - { - if (isDead() || isMovementDisabled() || !canReturnToSpawnPoint()) - { - return; - } - - final L2Spawn spawn = getSpawn(); - if (spawn == null) - { - return; - } - - final int spawnX = spawn.getX(); - final int spawnY = spawn.getY(); - final int spawnZ = spawn.getZ(); - - if (!isInCombat() && !isMovementDisabled()) - { - if (!isInsideRadius3D(spawnX, spawnY, spawnZ, Math.max(Config.MAX_DRIFT_RANGE, 200))) - { - teleToLocation(spawnX, spawnY, spawnZ); - } - } - } - @Override public int getVitalityPoints(int level, double exp, boolean isBoss) { diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index 9b21af1ba1..5c853050cb 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -1174,6 +1174,12 @@ public class L2AttackableAI extends L2CharacterAI return; } + // Prevent thinking in non active regions. + if (!_actor.isInActiveRegion()) + { + return; + } + // Start thinking action _thinking = true; diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java index dd29ed0301..bf70890703 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/actor/instance/L2GrandBossInstance.java @@ -25,7 +25,6 @@ import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; */ public final class L2GrandBossInstance extends L2MonsterInstance { - private static final int BOSS_MAINTENANCE_INTERVAL = 10000; private boolean _useRaidCurse = true; /** @@ -40,12 +39,6 @@ public final class L2GrandBossInstance extends L2MonsterInstance setLethalable(false); } - @Override - protected int getMaintenanceInterval() - { - return BOSS_MAINTENANCE_INTERVAL; - } - @Override public void onSpawn() { diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java index 135ab0aa11..67c1dc6db0 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/actor/instance/L2MonsterInstance.java @@ -16,8 +16,6 @@ */ package com.l2jmobius.gameserver.model.actor.instance; -import java.util.concurrent.ScheduledFuture; - import com.l2jmobius.Config; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.model.actor.L2Attackable; @@ -43,10 +41,6 @@ public class L2MonsterInstance extends L2Attackable private L2MonsterInstance _master = null; private volatile MinionList _minionList = null; - protected ScheduledFuture _maintenanceTask = null; - - private static final int MONSTER_MAINTENANCE_INTERVAL = 1000; - /** * Constructor of L2MonsterInstance (use L2Character and L2NpcInstance constructor).
* Actions : @@ -115,8 +109,6 @@ public class L2MonsterInstance extends L2Attackable setIsRaidMinion(_master.isRaid()); _master.getMinionList().onMinionSpawn(this); } - - startMaintenanceTask(); } // dynamic script-based minions spawned here, after all preparations. @@ -134,15 +126,6 @@ public class L2MonsterInstance extends L2Attackable } } - protected int getMaintenanceInterval() - { - return MONSTER_MAINTENANCE_INTERVAL; - } - - protected void startMaintenanceTask() - { - } - @Override public boolean doDie(L2Character killer) { @@ -150,25 +133,12 @@ public class L2MonsterInstance extends L2Attackable { return false; } - - if (_maintenanceTask != null) - { - _maintenanceTask.cancel(false); // doesn't do it? - _maintenanceTask = null; - } - return true; } @Override public boolean deleteMe() { - if (_maintenanceTask != null) - { - _maintenanceTask.cancel(false); - _maintenanceTask = null; - } - if (hasMinions()) { getMinionList().onMasterDie(true); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java index 8c7f0330ea..0b5cce7584 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/com/l2jmobius/gameserver/model/actor/instance/L2RaidBossInstance.java @@ -17,10 +17,7 @@ package com.l2jmobius.gameserver.model.actor.instance; import com.l2jmobius.Config; -import com.l2jmobius.commons.concurrent.ThreadPool; -import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.enums.InstanceType; -import com.l2jmobius.gameserver.model.L2Spawn; import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate; import com.l2jmobius.gameserver.network.serverpackets.PlaySound; @@ -30,8 +27,6 @@ import com.l2jmobius.gameserver.network.serverpackets.PlaySound; */ public class L2RaidBossInstance extends L2MonsterInstance { - private static final int RAIDBOSS_MAINTENANCE_INTERVAL = 30000; // 30 sec - private boolean _useRaidCurse = true; /** @@ -60,47 +55,6 @@ public class L2RaidBossInstance extends L2MonsterInstance broadcastPacket(new PlaySound(1, getParameters().getString("RaidSpawnMusic", "Rm01_A"), 0, 0, 0, 0, 0)); } - @Override - protected int getMaintenanceInterval() - { - return RAIDBOSS_MAINTENANCE_INTERVAL; - } - - /** - * Spawn all minions at a regular interval Also if boss is too far from home location at the time of this check, teleport it home. - */ - @Override - protected void startMaintenanceTask() - { - _maintenanceTask = ThreadPool.scheduleAtFixedRate(() -> checkAndReturnToSpawn(), 60000, getMaintenanceInterval() + Rnd.get(5000)); - } - - protected void checkAndReturnToSpawn() - { - if (isDead() || isMovementDisabled() || !canReturnToSpawnPoint()) - { - return; - } - - final L2Spawn spawn = getSpawn(); - if (spawn == null) - { - return; - } - - final int spawnX = spawn.getX(); - final int spawnY = spawn.getY(); - final int spawnZ = spawn.getZ(); - - if (!isInCombat() && !isMovementDisabled()) - { - if (!isInsideRadius3D(spawnX, spawnY, spawnZ, Math.max(Config.MAX_DRIFT_RANGE, 200))) - { - teleToLocation(spawnX, spawnY, spawnZ); - } - } - } - @Override public int getVitalityPoints(int level, double exp, boolean isBoss) {