Доброго времени суток!
вот лог ГС
собственно у меня подозрения на скрипты
скрипт Байлора:
скрипт сайлрен
сборка First-Team
вот лог ГС
Код:
[02.10.17 14:08:17:845] ERROR scripts.Scripts: Scripts: Failed running bosses.BaylorManager.onLoad()
java.lang.NullPointerException
at bosses.BaylorManager.init(BaylorManager.java:326)
at bosses.BaylorManager.onLoad(BaylorManager.java:483)
at l2ft.gameserver.scripts.Scripts.init(Scripts.java:139)
at l2ft.gameserver.GameServer.<init>(GameServer.java:182)
at l2ft.gameserver.GameServer.main(GameServer.java:342)
[02.10.17 14:08:18:001] ERROR scripts.Scripts: Scripts: Failed running bosses.SailrenManager.onLoad()
java.lang.NullPointerException
at bosses.SailrenManager.init(SailrenManager.java:256)
at bosses.SailrenManager.onLoad(SailrenManager.java:462)
at l2ft.gameserver.scripts.Scripts.init(Scripts.java:139)
at l2ft.gameserver.GameServer.<init>(GameServer.java:182)
at l2ft.gameserver.GameServer.main(GameServer.java:342)
скрипт Байлора:
Код:
package bosses;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ScheduledFuture;
import l2ft.commons.threading.RunnableImpl;
import l2ft.commons.util.Rnd;
import l2ft.gameserver.Config;
import l2ft.gameserver.ThreadPoolManager;
import l2ft.gameserver.data.xml.holder.NpcHolder;
import l2ft.gameserver.geodata.GeoEngine;
import l2ft.gameserver.instancemanager.ReflectionManager;
import l2ft.gameserver.listener.actor.OnDeathListener;
import l2ft.gameserver.listener.zone.OnZoneEnterLeaveListener;
import l2ft.gameserver.model.Creature;
import l2ft.gameserver.model.Player;
import l2ft.gameserver.model.Zone;
import l2ft.gameserver.model.entity.Reflection;
import l2ft.gameserver.model.instances.NpcInstance;
import l2ft.gameserver.network.l2.s2c.FlyToLocation;
import l2ft.gameserver.network.l2.s2c.FlyToLocation.FlyType;
import l2ft.gameserver.network.l2.s2c.SocialAction;
import l2ft.gameserver.scripts.Functions;
import l2ft.gameserver.scripts.ScriptFile;
import l2ft.gameserver.templates.npc.NpcTemplate;
import l2ft.gameserver.utils.Location;
import l2ft.gameserver.utils.Log;
import l2ft.gameserver.utils.PositionUtils;
import l2ft.gameserver.utils.ReflectionUtils;
public class BaylorManager extends Functions implements ScriptFile
{
public static NpcInstance spawn(Location loc, int npcId)
{
NpcTemplate template = NpcHolder.getInstance().getTemplate(npcId);
NpcInstance npc = template.getNewInstance();
npc.setSpawnedLoc(loc);
npc.setHeading(loc.h);
npc.setLoc(loc);
npc.setReflection(currentReflection);
npc.spawnMe();
return npc;
}
private static class ActivityTimeEnd extends RunnableImpl
{
@Override
public void runImpl() throws Exception
{
setIntervalEndTask();
}
}
private static class BaylorSpawn extends RunnableImpl
{
private final int _npcId;
private final Location _pos = new Location(153569, 142075, -12711, 44732);
public BaylorSpawn(int npcId)
{
_npcId = npcId;
}
@Override
public void runImpl() throws Exception
{
switch (_npcId)
{
case CrystalPrisonGuard:
Reflection ref = ReflectionManager.getInstance().get(currentReflection);
for (int doorId : doors)
ref.openDoor(doorId);
for (int i = 0; i < _crystalineLocation.length; i++)
{
_crystaline[i] = spawn(_crystalineLocation[i], CrystalPrisonGuard);
_crystaline[i].setRunning();
_crystaline[i].moveToLocation(_pos, 300, false);
ThreadPoolManager.getInstance().schedule(new Social(_crystaline[i], 2), 15000);
}
break;
case Baylor:
Dying = false;
_baylor = spawn(new Location(153569, 142075, -12732, 59864), Baylor);
_baylor.addListener(BaylorDeathListener.getInstance());
_state.setRespawnDate(getRespawnInterval() + FWBA_ACTIVITYTIMEOFMOBS);
_state.setState(EpicBossState.State.ALIVE);
_state.update();
if (_socialTask != null)
{
_socialTask.cancel(false);
_socialTask = null;
}
_socialTask = ThreadPoolManager.getInstance().schedule(new Social(_baylor, 1), 500);
if (_endSceneTask != null)
{
_endSceneTask.cancel(false);
_endSceneTask = null;
}
_endSceneTask = ThreadPoolManager.getInstance().schedule(new EndScene(), 23000);
if (_activityTimeEndTask != null)
{
_activityTimeEndTask.cancel(false);
_activityTimeEndTask = null;
}
_activityTimeEndTask = ThreadPoolManager.getInstance().schedule(new ActivityTimeEnd(), FWBA_ACTIVITYTIMEOFMOBS);
break;
}
}
}
// Interval end.
private static class IntervalEnd extends RunnableImpl
{
@Override
public void runImpl() throws Exception
{
_state.setState(EpicBossState.State.NOTSPAWN);
_state.update();
}
}
private static class Social extends RunnableImpl
{
private final int _action;
private final NpcInstance _npc;
public Social(NpcInstance npc, int actionId)
{
_npc = npc;
_action = actionId;
}
@Override
public void runImpl() throws Exception
{
_npc.broadcastPacket(new SocialAction(_npc.getObjectId(), _action));
}
}
private static class EndScene extends RunnableImpl
{
@Override
public void runImpl() throws Exception
{
for (Player player : getPlayersInside())
{
player.unblock();
if (_baylor != null)
{
double angle = PositionUtils.convertHeadingToDegree(_baylor.getHeading());
double radian = Math.toRadians(angle - 90);
int x1 = -(int) (Math.sin(radian) * 600);
int y1 = (int) (Math.cos(radian) * 600);
Location flyLoc = GeoEngine.moveCheck(player.getX(), player.getY(), player.getZ(), player.getX() + x1, player.getY() + y1, player.getGeoIndex());
player.setLoc(flyLoc);
player.broadcastPacket(new FlyToLocation(player, flyLoc, FlyType.THROW_HORIZONTAL));
}
}
for (NpcInstance npc : _crystaline)
{
if (npc != null)
npc.reduceCurrentHp(npc.getMaxHp() + 1, npc, null, true, true, false, false, false, false, false);
}
}
}
private static final int Baylor = 29099;
private static final int CrystalPrisonGuard = 29100;
private static final int Parme = 32271;
private static final int Oracle = 32273;
private static final Location _crystalineLocation[] = {
new Location(154404, 140596, -12711, 44732),
new Location(153574, 140402, -12711, 44732),
new Location(152105, 141230, -12711, 44732),
new Location(151877, 142095, -12711, 44732),
new Location(152109, 142920, -12711, 44732),
new Location(152730, 143555, -12711, 44732),
new Location(154439, 143538, -12711, 44732),
new Location(155246, 142068, -12711, 44732) };
private static final Location _baylorChestLocation[] = {
new Location(153763, 142075, -12741, 64792),
new Location(153701, 141942, -12741, 57739),
new Location(153573, 141894, -12741, 49471),
new Location(153445, 141945, -12741, 41113),
new Location(153381, 142076, -12741, 32767),
new Location(153441, 142211, -12741, 25730),
new Location(153573, 142260, -12741, 16185),
new Location(153706, 142212, -12741, 7579),
new Location(153571, 142860, -12741, 16716),
new Location(152783, 142077, -12741, 32176),
new Location(153571, 141274, -12741, 49072),
new Location(154365, 142073, -12741, 64149),
new Location(154192, 142697, -12741, 7894),
new Location(152924, 142677, -12741, 25072),
new Location(152907, 141428, -12741, 39590),
new Location(154243, 141411, -12741, 55500) };
private static final int[] doors = { 24220009, 24220011, 24220012, 24220014, 24220015, 24220016, 24220017, 24220019 };
// Instance of monsters
private static NpcInstance[] _crystaline = new NpcInstance[8];
private static NpcInstance _baylor;
// Tasks
private static ScheduledFuture<?> _intervalEndTask = null;
private static ScheduledFuture<?> _activityTimeEndTask = null;
private static ScheduledFuture<?> _socialTask = null;
private static ScheduledFuture<?> _endSceneTask = null;
// State of baylor's lair.
private static boolean _isAlreadyEnteredOtherParty = false;
private static EpicBossState _state;
private static Zone _zone;
private static final int FWBA_ACTIVITYTIMEOFMOBS = 120 * 60000;
private static final int FWBA_FIXINTERVALOFBAYLORSPAWN = Config.FIXINTERVALOFBAYLORSPAWN_HOUR * 60 * 60000;
private static final int FWBA_RANDOMINTERVALOFBAYLORSPAWN = Config.RANDOMINTERVALOFBAYLORSPAWN * 60 * 60000;
private static final boolean FWBA_ENABLESINGLEPLAYER = false;
private static boolean Dying = false;
private static int currentReflection;
// Whether it is permitted to enter the baylor's lair is confirmed.
public static int canIntoBaylorLair(Player pc)
{
if (pc.isGM())
return 0;
if (!FWBA_ENABLESINGLEPLAYER && !pc.isInParty())
return 4;
else if (_isAlreadyEnteredOtherParty)
return 2;
else if (_state.getState().equals(EpicBossState.State.NOTSPAWN))
return 0;
else if (_state.getState().equals(EpicBossState.State.ALIVE) || _state.getState().equals(EpicBossState.State.DEAD))
return 1;
else if (_state.getState().equals(EpicBossState.State.INTERVAL))
return 3;
else
return 0;
}
private synchronized static void checkAnnihilated()
{
if (isPlayersAnnihilated())
setIntervalEndTask();
}
// Teleporting player to baylor's lair.
public synchronized static void entryToBaylorLair(Player pc)
{
currentReflection = pc.getReflectionId();
_zone.setReflection(pc.getReflection());
// Synerge - When they enter baylor cave, reset the instance time to 30 minutes
if (pc.getReflection() != null)
pc.getReflection().startCollapseTimer(30 * 60 * 1000L);
ReflectionManager.getInstance().get(currentReflection).closeDoor(24220008);
ThreadPoolManager.getInstance().schedule(new BaylorSpawn(CrystalPrisonGuard), 20000);
ThreadPoolManager.getInstance().schedule(new BaylorSpawn(Baylor), 40000);
if (pc.getParty() == null)
{
pc.teleToLocation(153569 + Rnd.get(-80, 80), 142075 + Rnd.get(-80, 80), -12732);
pc.block();
}
else
{
List<Player> members = new ArrayList<Player>(); // list of member of teleport candidate.
for (Player mem : pc.getParty().getPartyMembers())
// teleporting it within alive and the range of recognition of the leader of the party.
if (!mem.isDead() && mem.isInRange(pc, 1500))
members.add(mem);
for (Player mem : members)
{
mem.teleToLocation(153569 + Rnd.get(-80, 80), 142075 + Rnd.get(-80, 80), -12732);
mem.block();
}
}
_isAlreadyEnteredOtherParty = true;
}
private static List<Player> getPlayersInside()
{
List<Player> result = new ArrayList<Player>();
for (Player player : getZone().getInsidePlayers())
result.add(player);
return result;
}
private static int getRespawnInterval()
{
return (int) (Config.ALT_RAID_RESPAWN_MULTIPLIER * (FWBA_FIXINTERVALOFBAYLORSPAWN + Rnd.get(0, FWBA_RANDOMINTERVALOFBAYLORSPAWN)));
}
public static Zone getZone()
{
return _zone;
}
private static void init()
{
_state = new EpicBossState(Baylor);
_zone = ReflectionUtils.getZone("[baylor_epic]");
_zone.addListener(BaylorZoneListener.getInstance());
_isAlreadyEnteredOtherParty = false;
Log.add("BaylorManager : State of Baylor is " + _state.getState() + ".", "bosses");
if (!_state.getState().equals(EpicBossState.State.NOTSPAWN))
setIntervalEndTask();
Date dt = new Date(_state.getRespawnDate());
Log.add("BaylorManager : Next spawn date of Baylor is " + dt + ".", "bosses");
Log.add("BaylorManager : Init BaylorManager.", "bosses");
}
private static boolean isPlayersAnnihilated()
{
for (Player pc : getPlayersInside())
if (!pc.isDead())
return false;
return true;
}
private static void onBaylorDie()
{
if (Dying)
return;
Dying = true;
_state.setRespawnDate(getRespawnInterval());
_state.setState(EpicBossState.State.INTERVAL);
_state.update();
Log.add("Baylor died", "bosses");
spawn(_baylorChestLocation[Rnd.get(_baylorChestLocation.length)], 29116);
spawn(new Location(153570, 142067, -9727, 55500), Parme);
spawn(new Location(153569, 142075, -12732, 55500), Oracle);
startCollapse();
}
private static class BaylorZoneListener implements OnZoneEnterLeaveListener
{
private static OnZoneEnterLeaveListener _instance = new BaylorZoneListener();
public static OnZoneEnterLeaveListener getInstance()
{
return _instance;
}
@Override
public void onZoneEnter(Zone zone, Creature actor)
{
if (actor.isPlayer())
actor.addListener(PlayerDeathListener.getInstance());
}
@Override
public void onZoneLeave(Zone zone, Creature actor)
{
if (actor.isPlayer())
actor.removeListener(PlayerDeathListener.getInstance());
}
}
private static class PlayerDeathListener implements OnDeathListener
{
private static OnDeathListener _instance = new PlayerDeathListener();
public static OnDeathListener getInstance()
{
return _instance;
}
@Override
public void onDeath(Creature actor, Creature killer)
{
checkAnnihilated();
}
}
private static class BaylorDeathListener implements OnDeathListener
{
private static OnDeathListener _instance = new BaylorDeathListener();
public static OnDeathListener getInstance()
{
return _instance;
}
@Override
public void onDeath(Creature actor, Creature killer)
{
onBaylorDie();
}
}
// Task of interval of baylor spawn.
private static void setIntervalEndTask()
{
setUnspawn();
if (_state.getState().equals(EpicBossState.State.ALIVE))
{
_state.setState(EpicBossState.State.NOTSPAWN);
_state.update();
return;
}
if (!_state.getState().equals(EpicBossState.State.INTERVAL))
{
_state.setRespawnDate(getRespawnInterval());
_state.setState(EpicBossState.State.INTERVAL);
_state.update();
}
_intervalEndTask = ThreadPoolManager.getInstance().schedule(new IntervalEnd(), _state.getInterval());
}
// Clean up Baylor's lair.
private static void setUnspawn()
{
if (!_isAlreadyEnteredOtherParty)
return;
_isAlreadyEnteredOtherParty = false;
startCollapse();
if (_baylor != null)
_baylor.deleteMe();
_baylor = null;
for (NpcInstance npc : _crystaline)
if (npc != null)
npc.deleteMe();
if (_intervalEndTask != null)
{
_intervalEndTask.cancel(false);
_intervalEndTask = null;
}
if (_activityTimeEndTask != null)
{
_activityTimeEndTask.cancel(false);
_activityTimeEndTask = null;
}
}
private static void startCollapse()
{
if (currentReflection > 0)
{
Reflection reflection = ReflectionManager.getInstance().get(currentReflection);
if (reflection != null)
reflection.startCollapseTimer(300000);
currentReflection = 0;
}
}
@Override
public void onLoad()
{
init();
}
@Override
public void onReload()
{
setUnspawn();
}
@Override
public void onShutdown()
{}
}
Код:
package bosses;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ScheduledFuture;
import l2ft.commons.threading.RunnableImpl;
import l2ft.commons.util.Rnd;
import l2ft.gameserver.Config;
import l2ft.gameserver.ThreadPoolManager;
import l2ft.gameserver.ai.DefaultAI;
import l2ft.gameserver.listener.actor.OnDeathListener;
import l2ft.gameserver.model.Creature;
import l2ft.gameserver.model.Player;
import l2ft.gameserver.model.Zone;
import l2ft.gameserver.model.actor.listener.CharListenerList;
import l2ft.gameserver.model.instances.NpcInstance;
import l2ft.gameserver.network.l2.s2c.SocialAction;
import l2ft.gameserver.scripts.Functions;
import l2ft.gameserver.scripts.ScriptFile;
import l2ft.gameserver.utils.Location;
import l2ft.gameserver.utils.Log;
import l2ft.gameserver.utils.ReflectionUtils;
import l2ft.gameserver.utils.TimeUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import bosses.EpicBossState.State;
public class SailrenManager extends Functions implements ScriptFile, OnDeathListener
{
private static final Logger _log = LoggerFactory.getLogger(SailrenManager.class);
private static class ActivityTimeEnd extends RunnableImpl
{
@Override
public void runImpl() throws Exception
{
sleep();
}
}
private static class CubeSpawn extends RunnableImpl
{
@Override
public void runImpl() throws Exception
{
_teleportCube = spawn(new Location(27734, -6838, -1982, 0), TeleportCubeId);
}
}
private static class IntervalEnd extends RunnableImpl
{
@Override
public void runImpl() throws Exception
{
_state.setState(EpicBossState.State.NOTSPAWN);
_state.update();
}
}
private static class Social extends RunnableImpl
{
private int _action;
private NpcInstance _npc;
public Social(NpcInstance npc, int actionId)
{
_npc = npc;
_action = actionId;
}
@Override
public void runImpl() throws Exception
{
_npc.broadcastPacket(new SocialAction(_npc.getObjectId(), _action));
}
}
private static class onAnnihilated extends RunnableImpl
{
@Override
public void runImpl() throws Exception
{
sleep();
}
}
// Do spawn Valakas.
private static class SailrenSpawn extends RunnableImpl
{
private int _npcId;
private final Location _pos = new Location(27628, -6109, -1982, 44732);
SailrenSpawn(int npcId)
{
_npcId = npcId;
}
@Override
public void runImpl() throws Exception
{
if(_socialTask != null)
{
_socialTask.cancel(false);
_socialTask = null;
}
switch(_npcId)
{
case Velociraptor:
_velociraptor = spawn(new Location(27852, -5536, -1983, 44732), Velociraptor);
((DefaultAI) _velociraptor.getAI()).addTaskMove(_pos, false);
if(_socialTask != null)
{
_socialTask.cancel(false);
_socialTask = null;
}
_socialTask = ThreadPoolManager.getInstance().schedule(new Social(_velociraptor, 2), 6000);
if(_activityTimeEndTask != null)
{
_activityTimeEndTask.cancel(false);
_activityTimeEndTask = null;
}
_activityTimeEndTask = ThreadPoolManager.getInstance().schedule(new ActivityTimeEnd(), FWS_ACTIVITYTIMEOFMOBS);
break;
case Pterosaur:
_pterosaur = spawn(new Location(27852, -5536, -1983, 44732), Pterosaur);
((DefaultAI) _pterosaur.getAI()).addTaskMove(_pos, false);
if(_socialTask != null)
{
_socialTask.cancel(false);
_socialTask = null;
}
_socialTask = ThreadPoolManager.getInstance().schedule(new Social(_pterosaur, 2), 6000);
if(_activityTimeEndTask != null)
{
_activityTimeEndTask.cancel(false);
_activityTimeEndTask = null;
}
_activityTimeEndTask = ThreadPoolManager.getInstance().schedule(new ActivityTimeEnd(), FWS_ACTIVITYTIMEOFMOBS);
break;
case Tyrannosaurus:
_tyranno = spawn(new Location(27852, -5536, -1983, 44732), Tyrannosaurus);
((DefaultAI) _tyranno.getAI()).addTaskMove(_pos, false);
if(_socialTask != null)
{
_socialTask.cancel(false);
_socialTask = null;
}
_socialTask = ThreadPoolManager.getInstance().schedule(new Social(_tyranno, 2), 6000);
if(_activityTimeEndTask != null)
{
_activityTimeEndTask.cancel(false);
_activityTimeEndTask = null;
}
_activityTimeEndTask = ThreadPoolManager.getInstance().schedule(new ActivityTimeEnd(), FWS_ACTIVITYTIMEOFMOBS);
break;
case Sailren:
_sailren = spawn(new Location(27810, -5655, -1983, 44732), Sailren);
_state.setRespawnDate(getRespawnInterval() + FWS_ACTIVITYTIMEOFMOBS);
_state.setState(EpicBossState.State.ALIVE);
_state.update();
_sailren.setRunning();
((DefaultAI) _sailren.getAI()).addTaskMove(_pos, false);
if(_socialTask != null)
{
_socialTask.cancel(false);
_socialTask = null;
}
_socialTask = ThreadPoolManager.getInstance().schedule(new Social(_sailren, 2), 6000);
if(_activityTimeEndTask != null)
{
_activityTimeEndTask.cancel(false);
_activityTimeEndTask = null;
}
_activityTimeEndTask = ThreadPoolManager.getInstance().schedule(new ActivityTimeEnd(), FWS_ACTIVITYTIMEOFMOBS);
break;
}
}
}
private static NpcInstance _velociraptor;
private static NpcInstance _pterosaur;
private static NpcInstance _tyranno;
private static NpcInstance _sailren;
private static NpcInstance _teleportCube;
// Tasks.
private static ScheduledFuture<?> _cubeSpawnTask = null;
private static ScheduledFuture<?> _monsterSpawnTask = null;
private static ScheduledFuture<?> _intervalEndTask = null;
private static ScheduledFuture<?> _socialTask = null;
private static ScheduledFuture<?> _activityTimeEndTask = null;
private static ScheduledFuture<?> _onAnnihilatedTask = null;
private static final int Sailren = 29065;
private static final int Velociraptor = 22198;
private static final int Pterosaur = 22199;
private static final int Tyrannosaurus = 22217;
private static final int TeleportCubeId = 31759;
private static EpicBossState _state;
private static Zone _zone;
private static Location _enter = new Location(27734, -6938, -1982);
private static final boolean FWS_ENABLESINGLEPLAYER = Boolean.TRUE;
private static final int FWS_ACTIVITYTIMEOFMOBS = 120 * 60000;
private static final int FWS_FIXINTERVALOFSAILRENSPAWN = Config.FIXINTERVALOFSAILRENSPAWN_HOUR * 60 * 60000;
private static final int FWS_RANDOMINTERVALOFSAILRENSPAWN = Config.RANDOMINTERVALOFSAILRENSPAWN * 60 * 60000;
private static final int FWS_INTERVALOFNEXTMONSTER = 60000;
private static boolean _isAlreadyEnteredOtherParty = false;
private static boolean Dying = false;
private static void banishForeigners()
{
for(Player player : getPlayersInside())
player.teleToClosestTown();
}
private synchronized static void checkAnnihilated()
{
if(_onAnnihilatedTask == null && isPlayersAnnihilated())
_onAnnihilatedTask = ThreadPoolManager.getInstance().schedule(new onAnnihilated(), 5000);
}
private static List<Player> getPlayersInside()
{
return getZone().getInsidePlayers();
}
private static int getRespawnInterval()
{
return (int) (Config.ALT_RAID_RESPAWN_MULTIPLIER * (FWS_FIXINTERVALOFSAILRENSPAWN + Rnd.get(0, FWS_RANDOMINTERVALOFSAILRENSPAWN)));
}
public static Zone getZone()
{
return _zone;
}
private void init()
{
CharListenerList.addGlobal(this);
_state = new EpicBossState(Sailren);
_zone = ReflectionUtils.getZone("[sailren_epic]");
_log.info("SailrenManager: State of Sailren is " + _state.getState() + ".");
if(!_state.getState().equals(EpicBossState.State.NOTSPAWN))
setIntervalEndTask();
_log.info("SailrenManager: Next spawn date of Sailren is " + TimeUtils.toSimpleFormat(_state.getRespawnDate()) + ".");
}
private static boolean isPlayersAnnihilated()
{
for(Player pc : getPlayersInside())
if(!pc.isDead())
return false;
return true;
}
@Override
public void onDeath(Creature self, Creature killer)
{
if(self.isPlayer() && _state != null && _state.getState() == State.ALIVE && _zone != null && _zone.checkIfInZone(self.getX(), self.getY()))
checkAnnihilated();
else if(self == _velociraptor)
{
if(_monsterSpawnTask != null)
_monsterSpawnTask.cancel(false);
_monsterSpawnTask = ThreadPoolManager.getInstance().schedule(new SailrenSpawn(Pterosaur), FWS_INTERVALOFNEXTMONSTER);
}
else if(self == _pterosaur)
{
if(_monsterSpawnTask != null)
_monsterSpawnTask.cancel(false);
_monsterSpawnTask = ThreadPoolManager.getInstance().schedule(new SailrenSpawn(Tyrannosaurus), FWS_INTERVALOFNEXTMONSTER);
}
else if(self == _tyranno)
{
if(_monsterSpawnTask != null)
_monsterSpawnTask.cancel(false);
_monsterSpawnTask = ThreadPoolManager.getInstance().schedule(new SailrenSpawn(Sailren), FWS_INTERVALOFNEXTMONSTER);
}
else if(self == _sailren)
onSailrenDie(killer);
}
private static void onSailrenDie(Creature killer)
{
if(Dying)
return;
Dying = true;
_state.setRespawnDate(getRespawnInterval());
_state.setState(EpicBossState.State.INTERVAL);
_state.update();
Log.add("Sailren died", "bosses");
_cubeSpawnTask = ThreadPoolManager.getInstance().schedule(new CubeSpawn(), 10000);
}
// Start interval.
private static void setIntervalEndTask()
{
setUnspawn();
if(_state.getState().equals(EpicBossState.State.ALIVE))
{
_state.setState(EpicBossState.State.NOTSPAWN);
_state.update();
return;
}
//init state of Sailren lair.
if(!_state.getState().equals(EpicBossState.State.INTERVAL))
{
_state.setRespawnDate(getRespawnInterval());
_state.setState(EpicBossState.State.INTERVAL);
_state.update();
}
_intervalEndTask = ThreadPoolManager.getInstance().schedule(new IntervalEnd(), _state.getInterval());
}
private static void setUnspawn()
{
banishForeigners();
if(_velociraptor != null)
{
if(_velociraptor.getSpawn() != null)
_velociraptor.getSpawn().stopRespawn();
_velociraptor.deleteMe();
_velociraptor = null;
}
if(_pterosaur != null)
{
if(_pterosaur.getSpawn() != null)
_pterosaur.getSpawn().stopRespawn();
_pterosaur.deleteMe();
_pterosaur = null;
}
if(_tyranno != null)
{
if(_tyranno.getSpawn() != null)
_tyranno.getSpawn().stopRespawn();
_tyranno.deleteMe();
_tyranno = null;
}
if(_sailren != null)
{
if(_sailren.getSpawn() != null)
_sailren.getSpawn().stopRespawn();
_sailren.deleteMe();
_sailren = null;
}
if(_teleportCube != null)
{
if(_teleportCube.getSpawn() != null)
_teleportCube.getSpawn().stopRespawn();
_teleportCube.deleteMe();
_teleportCube = null;
}
if(_cubeSpawnTask != null)
{
_cubeSpawnTask.cancel(false);
_cubeSpawnTask = null;
}
if(_monsterSpawnTask != null)
{
_monsterSpawnTask.cancel(false);
_monsterSpawnTask = null;
}
if(_intervalEndTask != null)
{
_intervalEndTask.cancel(false);
_intervalEndTask = null;
}
if(_socialTask != null)
{
_socialTask.cancel(false);
_socialTask = null;
}
if(_activityTimeEndTask != null)
{
_activityTimeEndTask.cancel(false);
_activityTimeEndTask = null;
}
if(_onAnnihilatedTask != null)
{
_onAnnihilatedTask.cancel(false);
_onAnnihilatedTask = null;
}
}
private static void sleep()
{
setUnspawn();
if(_state.getState().equals(EpicBossState.State.ALIVE))
{
_state.setState(EpicBossState.State.NOTSPAWN);
_state.update();
}
}
public synchronized static void setSailrenSpawnTask()
{
if(_monsterSpawnTask == null)
_monsterSpawnTask = ThreadPoolManager.getInstance().schedule(new SailrenSpawn(Velociraptor), FWS_INTERVALOFNEXTMONSTER);
}
public static boolean isEnableEnterToLair()
{
return _state.getState() == EpicBossState.State.NOTSPAWN;
}
public static int canIntoSailrenLair(Player pc)
{
if(!FWS_ENABLESINGLEPLAYER && pc.getParty() == null)
return 4;
else if(_isAlreadyEnteredOtherParty)
return 2;
else if(_state.getState().equals(EpicBossState.State.NOTSPAWN))
return 0;
else if(_state.getState().equals(EpicBossState.State.ALIVE) || _state.getState().equals(EpicBossState.State.DEAD))
return 1;
else if(_state.getState().equals(EpicBossState.State.INTERVAL))
return 3;
else
return 0;
}
public static void entryToSailrenLair(Player pc)
{
if(pc.getParty() == null)
pc.teleToLocation(Location.findPointToStay(_enter, 80, pc.getGeoIndex()));
else
{
List<Player> members = new ArrayList<Player>();
for(Player mem : pc.getParty().getPartyMembers())
if(mem != null && !mem.isDead() && mem.isInRange(pc, 1000))
members.add(mem);
for(Player mem : members)
mem.teleToLocation(Location.findPointToStay(_enter, 80, mem.getGeoIndex()));
}
_isAlreadyEnteredOtherParty = true;
}
@Override
public void onLoad()
{
init();
}
@Override
public void onReload()
{
sleep();
}
@Override
public void onShutdown()
{
}
}