Prevent thinking in non active regions.

This commit is contained in:
MobiusDevelopment
2019-03-21 12:49:10 +00:00
parent 8b0e0c53f3
commit ad9a9006cf
52 changed files with 81 additions and 1022 deletions

View File

@@ -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;

View File

@@ -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()
{

View File

@@ -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).<br>
* <B><U> Actions</U> :</B>
@@ -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);

View File

@@ -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)
{