Prevent thinking in non active regions.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
@@ -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()
|
||||
{
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user