Addition of the Chronos class.
This commit is contained in:
@@ -24,6 +24,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.SkillTable;
|
||||
@@ -243,7 +244,7 @@ public class Antharas extends Quest
|
||||
{
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(ANTHARASOLDID);
|
||||
final Long respawnTime = info.getLong("respawn_time");
|
||||
if ((status == DEAD) && (respawnTime <= System.currentTimeMillis()))
|
||||
if ((status == DEAD) && (respawnTime <= Chronos.currentTimeMillis()))
|
||||
{
|
||||
// the time has already expired while the server was offline. Immediately spawn antharas in his cave.
|
||||
// also, the status needs to be changed to DORMANT
|
||||
@@ -261,13 +262,13 @@ public class Antharas extends Quest
|
||||
_antharas = (GrandBossInstance) addSpawn(ANTHARASOLDID, loc_x, loc_y, loc_z, heading, false, 0);
|
||||
GrandBossManager.getInstance().addBoss(_antharas);
|
||||
_antharas.setCurrentHpMp(hp, mp);
|
||||
_LastAction = System.currentTimeMillis();
|
||||
_LastAction = Chronos.currentTimeMillis();
|
||||
// Start repeating timer to check for inactivity
|
||||
_activityCheckTask = ThreadPool.scheduleAtFixedRate(new CheckActivity(), 60000, 60000);
|
||||
}
|
||||
else if (status == DEAD)
|
||||
{
|
||||
ThreadPool.schedule(new UnlockAntharas(ANTHARASOLDID), respawnTime - System.currentTimeMillis());
|
||||
ThreadPool.schedule(new UnlockAntharas(ANTHARASOLDID), respawnTime - Chronos.currentTimeMillis());
|
||||
}
|
||||
else if (status == DORMANT)
|
||||
{
|
||||
@@ -311,7 +312,7 @@ public class Antharas extends Quest
|
||||
_antharas = (GrandBossInstance) addSpawn(antharasId, loc_x, loc_y, loc_z, heading, false, 0);
|
||||
GrandBossManager.getInstance().addBoss(_antharas);
|
||||
_antharas.setCurrentHpMp(hp, mp);
|
||||
_LastAction = System.currentTimeMillis();
|
||||
_LastAction = Chronos.currentTimeMillis();
|
||||
// Start repeating timer to check for inactivity
|
||||
_activityCheckTask = ThreadPool.scheduleAtFixedRate(new CheckActivity(), 60000, 60000);
|
||||
}
|
||||
@@ -319,7 +320,7 @@ public class Antharas extends Quest
|
||||
{
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(antharasId);
|
||||
final Long respawnTime = info.getLong("respawn_time");
|
||||
if (respawnTime <= System.currentTimeMillis())
|
||||
if (respawnTime <= Chronos.currentTimeMillis())
|
||||
{
|
||||
// the time has already expired while the server was offline. Immediately spawn antharas in his cave.
|
||||
// also, the status needs to be changed to DORMANT
|
||||
@@ -328,7 +329,7 @@ public class Antharas extends Quest
|
||||
}
|
||||
else
|
||||
{
|
||||
ThreadPool.schedule(new UnlockAntharas(antharasId), respawnTime - System.currentTimeMillis());
|
||||
ThreadPool.schedule(new UnlockAntharas(antharasId), respawnTime - Chronos.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -457,7 +458,7 @@ public class Antharas extends Quest
|
||||
_antharas.setImmobilized(true);
|
||||
GrandBossManager.getInstance().setBossStatus(ANTHARASOLDID, DORMANT);
|
||||
GrandBossManager.getInstance().setBossStatus(npcId, FIGHTING);
|
||||
_LastAction = System.currentTimeMillis();
|
||||
_LastAction = Chronos.currentTimeMillis();
|
||||
// Start repeating timer to check for inactivity
|
||||
_activityCheckTask = ThreadPool.scheduleAtFixedRate(new CheckActivity(), 60000, 60000);
|
||||
// Setting 1st time of minions spawn task.
|
||||
@@ -747,7 +748,7 @@ public class Antharas extends Quest
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
final Long temp = (System.currentTimeMillis() - _LastAction);
|
||||
final Long temp = (Chronos.currentTimeMillis() - _LastAction);
|
||||
if (temp > (Config.ANTHARAS_DESPAWN_TIME * 60000))
|
||||
{
|
||||
GrandBossManager.getInstance().setBossStatus(_antharas.getNpcId(), DORMANT);
|
||||
@@ -918,7 +919,7 @@ public class Antharas extends Quest
|
||||
{
|
||||
if ((npc.getNpcId() == 29019) || (npc.getNpcId() == 29066) || (npc.getNpcId() == 29067) || (npc.getNpcId() == 29068))
|
||||
{
|
||||
_LastAction = System.currentTimeMillis();
|
||||
_LastAction = Chronos.currentTimeMillis();
|
||||
if (!FWA_OLDANTHARAS && (_mobsSpawnTask == null))
|
||||
{
|
||||
startMinionSpawns(npc.getNpcId());
|
||||
@@ -963,7 +964,7 @@ public class Antharas extends Quest
|
||||
ThreadPool.schedule(new UnlockAntharas(npc.getNpcId()), respawnTime);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(npc.getNpcId());
|
||||
info.set("respawn_time", (System.currentTimeMillis() + respawnTime));
|
||||
info.set("respawn_time", (Chronos.currentTimeMillis() + respawnTime));
|
||||
GrandBossManager.getInstance().setStatSet(npc.getNpcId(), info);
|
||||
}
|
||||
else if (npc.getNpcId() == 29069)
|
||||
|
@@ -27,6 +27,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.data.Announcements;
|
||||
import org.l2jmobius.gameserver.data.SkillTable;
|
||||
@@ -114,7 +115,7 @@ public class Baium extends Quest
|
||||
if (status == DEAD)
|
||||
{
|
||||
// load the unlock date and time for baium from DB
|
||||
final long temp = (info.getLong("respawn_time") - System.currentTimeMillis());
|
||||
final long temp = (info.getLong("respawn_time") - Chronos.currentTimeMillis());
|
||||
if (temp > 0)
|
||||
{
|
||||
// the unlock time has not yet expired. Mark Baium as currently locked (dead). Setup a timer
|
||||
@@ -201,7 +202,7 @@ public class Baium extends Quest
|
||||
npc.broadcastPacket(new SocialAction(npc.getObjectId(), 1));
|
||||
npc.broadcastPacket(new Earthquake(npc.getX(), npc.getY(), npc.getZ(), 40, 5));
|
||||
// start monitoring baium's inactivity
|
||||
_lastAttackVsBaiumTime = System.currentTimeMillis();
|
||||
_lastAttackVsBaiumTime = Chronos.currentTimeMillis();
|
||||
startQuestTimer("baium_despawn", 60000, npc, null, true);
|
||||
if (player != null)
|
||||
{
|
||||
@@ -250,7 +251,7 @@ public class Baium extends Quest
|
||||
{
|
||||
_zone = GrandBossManager.getInstance().getZone(113100, 14500, 10077);
|
||||
}
|
||||
if ((_lastAttackVsBaiumTime + (Config.BAIUM_SLEEP * 1000)) < System.currentTimeMillis())
|
||||
if ((_lastAttackVsBaiumTime + (Config.BAIUM_SLEEP * 1000)) < Chronos.currentTimeMillis())
|
||||
{
|
||||
npc.deleteMe(); // despawn the live-baium
|
||||
for (NpcInstance minion : _minions)
|
||||
@@ -267,7 +268,7 @@ public class Baium extends Quest
|
||||
_zone.oustAllPlayers();
|
||||
cancelQuestTimer("baium_despawn", npc, null);
|
||||
}
|
||||
else if (((_lastAttackVsBaiumTime + 300000) < System.currentTimeMillis()) && (npc.getCurrentHp() < ((npc.getMaxHp() * 3) / 4.0)))
|
||||
else if (((_lastAttackVsBaiumTime + 300000) < Chronos.currentTimeMillis()) && (npc.getCurrentHp() < ((npc.getMaxHp() * 3) / 4.0)))
|
||||
{
|
||||
npc.setTarget(npc);
|
||||
npc.doCast(SkillTable.getInstance().getSkill(4135, 1));
|
||||
@@ -402,7 +403,7 @@ public class Baium extends Quest
|
||||
}
|
||||
}
|
||||
// update a variable with the last action against baium
|
||||
_lastAttackVsBaiumTime = System.currentTimeMillis();
|
||||
_lastAttackVsBaiumTime = Chronos.currentTimeMillis();
|
||||
callSkillAI(npc);
|
||||
}
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
@@ -421,7 +422,7 @@ public class Baium extends Quest
|
||||
startQuestTimer("baium_unlock", respawnTime, null, null);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(LIVE_BAIUM);
|
||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
info.set("respawn_time", Chronos.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(LIVE_BAIUM, info);
|
||||
for (NpcInstance minion : _minions)
|
||||
{
|
||||
|
@@ -23,6 +23,7 @@ import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.data.Announcements;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
@@ -105,7 +106,7 @@ public class Core extends Quest
|
||||
if (GrandBossManager.getInstance().getBossStatus(CORE) == DEAD)
|
||||
{
|
||||
// Load the unlock date and time for Core from DB.
|
||||
final long temp = info.getLong("respawn_time") - System.currentTimeMillis();
|
||||
final long temp = info.getLong("respawn_time") - Chronos.currentTimeMillis();
|
||||
// If Core is locked until a certain time, mark it so and start the unlock timer the unlock time has not yet expired.
|
||||
if (temp > 0)
|
||||
{
|
||||
@@ -237,7 +238,7 @@ public class Core extends Quest
|
||||
startQuestTimer("core_unlock", respawnTime, null, null);
|
||||
// Also save the respawn time so that the info is maintained past reboots.
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(CORE);
|
||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
info.set("respawn_time", Chronos.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(CORE, info);
|
||||
startQuestTimer("despawn_minions", 20000, null, null);
|
||||
cancelQuestTimers("spawn_minion");
|
||||
|
@@ -17,6 +17,7 @@
|
||||
package ai.bosses;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.Announcements;
|
||||
@@ -65,7 +66,7 @@ public class Orfen extends Quest
|
||||
{
|
||||
case DEAD:
|
||||
{
|
||||
final long temp = info.getLong("respawn_time") - System.currentTimeMillis();
|
||||
final long temp = info.getLong("respawn_time") - Chronos.currentTimeMillis();
|
||||
if (temp > 0)
|
||||
{
|
||||
startQuestTimer("ORFEN_SPAWN", temp, null, null);
|
||||
@@ -241,7 +242,7 @@ public class Orfen extends Quest
|
||||
startQuestTimer("ORFEN_SPAWN", respawnTime, null, null);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(ORFEN);
|
||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
info.set("respawn_time", Chronos.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(ORFEN, info);
|
||||
}
|
||||
return super.onKill(npc, killer, isPet);
|
||||
|
@@ -20,6 +20,7 @@ import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.Announcements;
|
||||
@@ -98,7 +99,7 @@ public class QueenAnt extends Quest
|
||||
{
|
||||
case DEAD:
|
||||
{
|
||||
final long temp = info.getLong("respawn_time") - System.currentTimeMillis();
|
||||
final long temp = info.getLong("respawn_time") - Chronos.currentTimeMillis();
|
||||
if (temp > 0)
|
||||
{
|
||||
startQuestTimer("QUEEN_SPAWN", temp, null, null);
|
||||
@@ -376,7 +377,7 @@ public class QueenAnt extends Quest
|
||||
// cancelQuestTimer("CHECK_QA_ZONE", npc, null);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(QUEEN);
|
||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
info.set("respawn_time", Chronos.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(QUEEN, info);
|
||||
startQuestTimer("DESPAWN_MINIONS", 10000, null, null);
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@ import java.util.List;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.SkillTable;
|
||||
@@ -89,14 +90,14 @@ public class Valakas extends Quest
|
||||
i_ai3 = 0;
|
||||
i_ai4 = 0;
|
||||
i_quest0 = 0;
|
||||
lastAttackTime = System.currentTimeMillis();
|
||||
lastAttackTime = Chronos.currentTimeMillis();
|
||||
_Zone = GrandBossManager.getInstance().getZone(212852, -114842, -1632);
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(VALAKAS);
|
||||
final Integer status = GrandBossManager.getInstance().getBossStatus(VALAKAS);
|
||||
if (status == DEAD)
|
||||
{
|
||||
// load the unlock date and time for valakas from DB
|
||||
final long temp = (info.getLong("respawn_time") - System.currentTimeMillis());
|
||||
final long temp = (info.getLong("respawn_time") - Chronos.currentTimeMillis());
|
||||
// if valakas is locked until a certain time, mark it so and start the unlock timer
|
||||
// the unlock time has not yet expired. Mark valakas as currently locked. Setup a timer
|
||||
// to fire at the correct time (calculate the time between now and the unlock time,
|
||||
@@ -172,7 +173,7 @@ public class Valakas extends Quest
|
||||
}
|
||||
|
||||
final Integer status = GrandBossManager.getInstance().getBossStatus(VALAKAS);
|
||||
temp = (System.currentTimeMillis() - lastAttackTime);
|
||||
temp = (Chronos.currentTimeMillis() - lastAttackTime);
|
||||
if ((status == FIGHTING) && (temp > (Config.VALAKAS_DESPAWN_TIME * 60000))) // 15 mins by default
|
||||
{
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
@@ -335,7 +336,7 @@ public class Valakas extends Quest
|
||||
final GrandBossInstance valakas = (GrandBossInstance) addSpawn(VALAKAS, loc_x, loc_y, loc_z, heading, false, 0);
|
||||
GrandBossManager.getInstance().addBoss(valakas);
|
||||
|
||||
lastAttackTime = System.currentTimeMillis();
|
||||
lastAttackTime = Chronos.currentTimeMillis();
|
||||
ThreadPool.schedule(() ->
|
||||
{
|
||||
try
|
||||
@@ -368,7 +369,7 @@ public class Valakas extends Quest
|
||||
{
|
||||
return null;
|
||||
}
|
||||
lastAttackTime = System.currentTimeMillis();
|
||||
lastAttackTime = Chronos.currentTimeMillis();
|
||||
/*
|
||||
* if (!Config.ALLOW_DIRECT_TP_TO_BOSS_ROOM && GrandBossManager.getInstance().getBossStatus(VALAKAS) != FIGHTING && !npc.getSpawn().isCustomBossInstance()) { attacker.teleToLocation(150037, -57255, -2976); }
|
||||
*/
|
||||
@@ -595,7 +596,7 @@ public class Valakas extends Quest
|
||||
startQuestTimer("valakas_unlock", respawnTime, null, null);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(VALAKAS);
|
||||
info.set("respawn_time", (System.currentTimeMillis() + respawnTime));
|
||||
info.set("respawn_time", (Chronos.currentTimeMillis() + respawnTime));
|
||||
GrandBossManager.getInstance().setStatSet(VALAKAS, info);
|
||||
return super.onKill(npc, killer, isPet);
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
@@ -168,7 +169,7 @@ public class Zaken extends Quest
|
||||
if (status == DEAD)
|
||||
{
|
||||
// load the unlock date and time for zaken from DB
|
||||
final long temp = info.getLong("respawn_time") - System.currentTimeMillis();
|
||||
final long temp = info.getLong("respawn_time") - Chronos.currentTimeMillis();
|
||||
// if zaken is locked until a certain time, mark it so and start the unlock timer
|
||||
// the unlock time has not yet expired.
|
||||
if (temp > 0)
|
||||
@@ -847,7 +848,7 @@ public class Zaken extends Quest
|
||||
cancelQuestTimer("1003", npc, null);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(ZAKEN);
|
||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
info.set("respawn_time", Chronos.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(ZAKEN, info);
|
||||
}
|
||||
else if (status == ALIVE)
|
||||
|
Reference in New Issue
Block a user