GameTimeController class is a task manager.
This commit is contained in:
@@ -23,10 +23,10 @@ import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
import ai.AbstractNpcAI;
|
||||
|
||||
@@ -160,7 +160,7 @@ public class Parade extends AbstractNpcAI
|
||||
|
||||
private long timeLeftMilli(int hh, int mm, int ss)
|
||||
{
|
||||
final int now = (GameTimeController.getInstance().getGameTicks() * 60) / 100;
|
||||
final int now = (GameTimeTaskManager.getInstance().getGameTicks() * 60) / 100;
|
||||
int dd = ((hh * 3600) + (mm * 60) + ss) - (now % 86400);
|
||||
if (dd < 0)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
@@ -29,6 +28,7 @@ import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.NpcStringId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.PlaySound;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
import ai.AbstractNpcAI;
|
||||
|
||||
@@ -285,7 +285,7 @@ public class TalentShow extends AbstractNpcAI
|
||||
|
||||
private void scheduleTimer()
|
||||
{
|
||||
final int gameTime = GameTimeController.getInstance().getGameTime();
|
||||
final int gameTime = GameTimeTaskManager.getInstance().getGameTime();
|
||||
final int hours = (gameTime / 60) % 24;
|
||||
final int minutes = gameTime % 60;
|
||||
int hourDiff;
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
*/
|
||||
package ai.areas.Hellbound.AI.NPC.Shadai;
|
||||
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
import ai.AbstractNpcAI;
|
||||
|
||||
@@ -47,12 +47,12 @@ public class Shadai extends AbstractNpcAI
|
||||
{
|
||||
Location coords = DAY_COORDS;
|
||||
boolean mustRevalidate = false;
|
||||
if ((npc.getX() != NIGHT_COORDS.getX()) && GameTimeController.getInstance().isNight())
|
||||
if ((npc.getX() != NIGHT_COORDS.getX()) && GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
coords = NIGHT_COORDS;
|
||||
mustRevalidate = true;
|
||||
}
|
||||
else if ((npc.getX() != DAY_COORDS.getX()) && !GameTimeController.getInstance().isNight())
|
||||
else if ((npc.getX() != DAY_COORDS.getX()) && !GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
mustRevalidate = true;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package ai.areas.SelMahumTrainingGrounds;
|
||||
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
@@ -28,6 +27,7 @@ import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.network.NpcStringId;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
import ai.AbstractNpcAI;
|
||||
|
||||
@@ -123,7 +123,7 @@ public class SelMahumSquad extends AbstractNpcAI
|
||||
startQuestTimer("fire", 30000 + getRandom(5000), npc, null);
|
||||
npc.setDisplayEffect(FIRE_EFFECT_NONE);
|
||||
|
||||
if (getRandom(GameTimeController.getInstance().isNight() ? 2 : 4) < 1)
|
||||
if (getRandom(GameTimeTaskManager.getInstance().isNight() ? 2 : 4) < 1)
|
||||
{
|
||||
npc.setDisplayEffect(FIRE_EFFECT_BURN); // fire burns
|
||||
npc.broadcastEvent("SCE_CAMPFIRE_START", 600, null);
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.data.sql.ClanTable;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
@@ -29,6 +28,7 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.model.siege.clanhalls.ClanHallSiegeEngine;
|
||||
import org.l2jmobius.gameserver.network.NpcStringId;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* Fortress of the Dead clan hall siege script.
|
||||
@@ -151,7 +151,7 @@ public class FortressOfTheDead extends ClanHallSiegeEngine
|
||||
public void startSiege()
|
||||
{
|
||||
// Siege must start at night
|
||||
final int hoursLeft = (GameTimeController.getInstance().getGameTime() / 60) % 24;
|
||||
final int hoursLeft = (GameTimeTaskManager.getInstance().getGameTime() / 60) % 24;
|
||||
if ((hoursLeft < 0) || (hoursLeft > 6))
|
||||
{
|
||||
cancelSiegeTask();
|
||||
|
||||
@@ -26,13 +26,13 @@ import java.util.concurrent.TimeUnit;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.GameServer;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.cache.HtmCache;
|
||||
import org.l2jmobius.gameserver.data.xml.AdminData;
|
||||
import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author St3eT
|
||||
@@ -58,8 +58,8 @@ public class AdminServerInfo implements IAdminCommandHandler
|
||||
html.replace("%os_name%", System.getProperty("os.name"));
|
||||
html.replace("%os_ver%", System.getProperty("os.version"));
|
||||
html.replace("%slots%", getPlayersCount("ALL") + "/" + Config.MAXIMUM_ONLINE_USERS);
|
||||
html.replace("%gameTime%", GameTimeController.getInstance().getGameHour() + ":" + GameTimeController.getInstance().getGameMinute());
|
||||
html.replace("%dayNight%", GameTimeController.getInstance().isNight() ? "Night" : "Day");
|
||||
html.replace("%gameTime%", GameTimeTaskManager.getInstance().getGameHour() + ":" + GameTimeTaskManager.getInstance().getGameMinute());
|
||||
html.replace("%dayNight%", GameTimeTaskManager.getInstance().isNight() ? "Night" : "Day");
|
||||
html.replace("%geodata%", Config.PATHFINDING ? "Enabled" : "Disabled");
|
||||
html.replace("%serverTime%", SDF.format(new Date(Chronos.currentTimeMillis())));
|
||||
html.replace("%serverUpTime%", getServerUpTime());
|
||||
|
||||
@@ -19,12 +19,12 @@ package handlers.admincommandhandlers;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.Shutdown;
|
||||
import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.util.BuilderUtil;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
@@ -99,7 +99,7 @@ public class AdminShutdown implements IAdminCommandHandler
|
||||
private void sendHtmlForm(PlayerInstance activeChar)
|
||||
{
|
||||
final NpcHtmlMessage adminReply = new NpcHtmlMessage();
|
||||
final int t = GameTimeController.getInstance().getGameTime();
|
||||
final int t = GameTimeTaskManager.getInstance().getGameTime();
|
||||
final int h = t / 60;
|
||||
final int m = t % 60;
|
||||
final SimpleDateFormat format = new SimpleDateFormat("h:mm a");
|
||||
|
||||
@@ -36,7 +36,6 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.gameserver.GameServer;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.LoginServerThread;
|
||||
import org.l2jmobius.gameserver.data.xml.AdminData;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
@@ -49,6 +48,7 @@ import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.AdminForgePacket;
|
||||
import org.l2jmobius.gameserver.network.telnet.ITelnetCommand;
|
||||
import org.l2jmobius.gameserver.taskmanager.DecayTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
@@ -354,7 +354,7 @@ public class Debug implements ITelnetCommand
|
||||
|
||||
private static String gameTime()
|
||||
{
|
||||
final int t = GameTimeController.getInstance().getGameTime();
|
||||
final int t = GameTimeTaskManager.getInstance().getGameTime();
|
||||
final int h = t / 60;
|
||||
final int m = t % 60;
|
||||
final SimpleDateFormat format = new SimpleDateFormat("H:mm");
|
||||
|
||||
@@ -21,11 +21,11 @@ import java.util.Date;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.handler.IUserCommandHandler;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* Time user command.
|
||||
@@ -47,7 +47,7 @@ public class Time implements IUserCommandHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
final int t = GameTimeController.getInstance().getGameTime();
|
||||
final int t = GameTimeTaskManager.getInstance().getGameTime();
|
||||
final String h = Integer.toString(((t / 60) % 24));
|
||||
String m;
|
||||
if ((t % 60) < 10)
|
||||
@@ -60,7 +60,7 @@ public class Time implements IUserCommandHandler
|
||||
}
|
||||
|
||||
SystemMessage sm;
|
||||
if (GameTimeController.getInstance().isNight())
|
||||
if (GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
sm = new SystemMessage(SystemMessageId.THE_CURRENT_TIME_IS_S1_S2_2);
|
||||
sm.addString(h);
|
||||
|
||||
@@ -18,7 +18,6 @@ package handlers.usercommandhandlers;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||
import org.l2jmobius.gameserver.enums.TeleportWhereType;
|
||||
@@ -30,6 +29,7 @@ import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SetupGauge;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.util.Broadcast;
|
||||
|
||||
/**
|
||||
@@ -75,7 +75,7 @@ public class Unstuck implements IUserCommandHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
player.forceIsCasting(GameTimeController.getInstance().getGameTicks() + (unstuckTimer / GameTimeController.MILLIS_IN_TICK));
|
||||
player.forceIsCasting(GameTimeTaskManager.getInstance().getGameTicks() + (unstuckTimer / GameTimeTaskManager.MILLIS_IN_TICK));
|
||||
|
||||
final Skill escape = SkillData.getInstance().getSkill(2099, 1); // 5 minutes escape
|
||||
final Skill gmEscape = SkillData.getInstance().getSkill(2100, 1); // 1 second escape
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||
import org.l2jmobius.gameserver.enums.PlayerAction;
|
||||
@@ -46,6 +45,7 @@ import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ConfirmDlg;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SetupGauge;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.util.Broadcast;
|
||||
|
||||
/**
|
||||
@@ -464,7 +464,7 @@ public class Wedding implements IVoicedCommandHandler
|
||||
final EscapeFinalizer ef = new EscapeFinalizer(activeChar, partner.getLocation(), partner.isIn7sDungeon());
|
||||
// continue execution later
|
||||
activeChar.setSkillCast(ThreadPool.schedule(ef, teleportTimer));
|
||||
activeChar.forceIsCasting(GameTimeController.getInstance().getGameTicks() + (teleportTimer / GameTimeController.MILLIS_IN_TICK));
|
||||
activeChar.forceIsCasting(GameTimeTaskManager.getInstance().getGameTicks() + (teleportTimer / GameTimeTaskManager.MILLIS_IN_TICK));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -153,6 +153,7 @@ import org.l2jmobius.gameserver.network.NpcStringId;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.telnet.TelnetServer;
|
||||
import org.l2jmobius.gameserver.scripting.ScriptEngineManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.ItemsAutoDestroyTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.TaskManager;
|
||||
import org.l2jmobius.gameserver.ui.Gui;
|
||||
@@ -223,8 +224,8 @@ public class GameServer
|
||||
TelnetServer.getInstance();
|
||||
|
||||
printSection("World");
|
||||
// start game time control early
|
||||
GameTimeController.init();
|
||||
// Start game time task manager early.
|
||||
GameTimeTaskManager.getInstance();
|
||||
InstanceManager.getInstance();
|
||||
World.getInstance();
|
||||
MapRegionManager.getInstance();
|
||||
|
||||
@@ -50,6 +50,7 @@ import org.l2jmobius.gameserver.network.serverpackets.RecipeShopItemInfo;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SetupGauge;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.StatusUpdate;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
public class RecipeController
|
||||
@@ -337,7 +338,7 @@ public class RecipeController
|
||||
// if still not empty, schedule another pass
|
||||
if (!_items.isEmpty())
|
||||
{
|
||||
_delay = (int) (Config.ALT_GAME_CREATION_SPEED * _player.getMReuseRate(_skill) * GameTimeController.TICKS_PER_SECOND * GameTimeController.MILLIS_IN_TICK);
|
||||
_delay = (int) (Config.ALT_GAME_CREATION_SPEED * _player.getMReuseRate(_skill) * GameTimeTaskManager.TICKS_PER_SECOND * GameTimeTaskManager.MILLIS_IN_TICK);
|
||||
|
||||
// FIXME: please fix this packet to show crafting animation (somebody)
|
||||
_player.broadcastPacket(new MagicSkillUse(_player, _skillId, _skillLevel, _delay, 0));
|
||||
|
||||
@@ -52,6 +52,7 @@ import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.loginserverpackets.game.ServerStatus;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.network.telnet.TelnetServer;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.util.Broadcast;
|
||||
|
||||
/**
|
||||
@@ -148,7 +149,7 @@ public class Shutdown extends Thread
|
||||
// ensure all services are stopped
|
||||
try
|
||||
{
|
||||
GameTimeController.getInstance().stopTimer();
|
||||
GameTimeTaskManager.getInstance().stopTimer();
|
||||
LOGGER.info("Game Time Controller: Timer stopped(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
||||
}
|
||||
catch (Throwable t)
|
||||
|
||||
@@ -20,7 +20,6 @@ import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_ATTACK;
|
||||
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_FOLLOW;
|
||||
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE;
|
||||
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.WorldRegion;
|
||||
@@ -39,6 +38,7 @@ import org.l2jmobius.gameserver.network.serverpackets.StopMove;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.StopRotation;
|
||||
import org.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.CreatureFollowTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* Mother class of all objects AI in the world.<br>
|
||||
@@ -506,13 +506,13 @@ public abstract class AbstractAI implements Ctrl
|
||||
{
|
||||
if (_clientMovingToPawnOffset == offset)
|
||||
{
|
||||
if (GameTimeController.getInstance().getGameTicks() < _moveToPawnTimeout)
|
||||
if (GameTimeTaskManager.getInstance().getGameTicks() < _moveToPawnTimeout)
|
||||
{
|
||||
return;
|
||||
}
|
||||
sendPacket = false;
|
||||
}
|
||||
else if (_actor.isOnGeodataPath() && (GameTimeController.getInstance().getGameTicks() < (_moveToPawnTimeout + 10)))
|
||||
else if (_actor.isOnGeodataPath() && (GameTimeTaskManager.getInstance().getGameTicks() < (_moveToPawnTimeout + 10)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -522,8 +522,8 @@ public abstract class AbstractAI implements Ctrl
|
||||
_clientMoving = true;
|
||||
_clientMovingToPawnOffset = offset;
|
||||
_target = pawn;
|
||||
_moveToPawnTimeout = GameTimeController.getInstance().getGameTicks();
|
||||
_moveToPawnTimeout += 1000 / GameTimeController.MILLIS_IN_TICK;
|
||||
_moveToPawnTimeout = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_moveToPawnTimeout += 1000 / GameTimeTaskManager.MILLIS_IN_TICK;
|
||||
|
||||
if (pawn == null)
|
||||
{
|
||||
|
||||
@@ -27,7 +27,6 @@ import java.util.concurrent.Future;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.data.xml.SkillData;
|
||||
import org.l2jmobius.gameserver.enums.AISkillScope;
|
||||
import org.l2jmobius.gameserver.enums.AIType;
|
||||
@@ -64,6 +63,7 @@ import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.model.skills.targets.TargetType;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import org.l2jmobius.gameserver.taskmanager.AttackableThinkTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
@@ -378,7 +378,7 @@ public class AttackableAI extends CreatureAI
|
||||
protected void onIntentionAttack(Creature target)
|
||||
{
|
||||
// Calculate the attack timeout
|
||||
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
|
||||
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeTaskManager.getInstance().getGameTicks();
|
||||
|
||||
// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event
|
||||
super.onIntentionAttack(target);
|
||||
@@ -817,7 +817,7 @@ public class AttackableAI extends CreatureAI
|
||||
return;
|
||||
}
|
||||
|
||||
if (_attackTimeout < GameTimeController.getInstance().getGameTicks())
|
||||
if (_attackTimeout < GameTimeTaskManager.getInstance().getGameTicks())
|
||||
{
|
||||
// Set the AI Intention to AI_INTENTION_ACTIVE
|
||||
setIntention(AI_INTENTION_ACTIVE);
|
||||
@@ -2300,7 +2300,7 @@ public class AttackableAI extends CreatureAI
|
||||
final Attackable me = getActiveChar();
|
||||
|
||||
// Calculate the attack timeout
|
||||
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
|
||||
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeTaskManager.getInstance().getGameTicks();
|
||||
|
||||
// Set the _globalAggro to 0 to permit attack even just after spawn
|
||||
if (_globalAggro < 0)
|
||||
|
||||
@@ -32,7 +32,6 @@ import java.util.List;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.instancemanager.WalkingManager;
|
||||
@@ -57,6 +56,7 @@ import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.AutoAttackStop;
|
||||
import org.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
@@ -308,9 +308,9 @@ public class CreatureAI extends AbstractAI
|
||||
return;
|
||||
}
|
||||
|
||||
if (_actor.getBowAttackEndTime() > GameTimeController.getInstance().getGameTicks())
|
||||
if (_actor.getBowAttackEndTime() > GameTimeTaskManager.getInstance().getGameTicks())
|
||||
{
|
||||
ThreadPool.schedule(new CastTask(_actor, skill, target), (_actor.getBowAttackEndTime() - GameTimeController.getInstance().getGameTicks()) * GameTimeController.MILLIS_IN_TICK);
|
||||
ThreadPool.schedule(new CastTask(_actor, skill, target), (_actor.getBowAttackEndTime() - GameTimeTaskManager.getInstance().getGameTicks()) * GameTimeTaskManager.MILLIS_IN_TICK);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.util.concurrent.Future;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
@@ -39,6 +38,7 @@ import org.l2jmobius.gameserver.model.actor.instance.FortCommanderInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.effects.EffectType;
|
||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
@@ -231,7 +231,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
||||
protected void onIntentionAttack(Creature target)
|
||||
{
|
||||
// Calculate the attack timeout
|
||||
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
|
||||
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeTaskManager.getInstance().getGameTicks();
|
||||
|
||||
// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event
|
||||
// if (_actor.getTarget() != null)
|
||||
@@ -321,15 +321,15 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
||||
*/
|
||||
private void thinkAttack()
|
||||
{
|
||||
if ((_attackTimeout < GameTimeController.getInstance().getGameTicks()) && _actor.isRunning())
|
||||
if ((_attackTimeout < GameTimeTaskManager.getInstance().getGameTicks()) && _actor.isRunning())
|
||||
{
|
||||
_actor.setWalking();
|
||||
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
|
||||
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeTaskManager.getInstance().getGameTicks();
|
||||
}
|
||||
|
||||
final Creature attackTarget = getAttackTarget();
|
||||
// Check if target is dead or if timeout is expired to stop this attack
|
||||
if ((attackTarget == null) || attackTarget.isAlikeDead() || (_attackTimeout < GameTimeController.getInstance().getGameTicks()))
|
||||
if ((attackTarget == null) || attackTarget.isAlikeDead() || (_attackTimeout < GameTimeTaskManager.getInstance().getGameTicks()))
|
||||
{
|
||||
// Stop hating this target after the attack timeout or if target is dead
|
||||
if (attackTarget != null)
|
||||
@@ -585,7 +585,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
||||
attackTarget = hated;
|
||||
}
|
||||
|
||||
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
|
||||
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeTaskManager.getInstance().getGameTicks();
|
||||
|
||||
// check for close combat skills && heal/buff skills
|
||||
if (!_actor.isMuted() && (Rnd.get(100) <= 5))
|
||||
@@ -681,7 +681,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
||||
protected void onEvtAttacked(Creature attacker)
|
||||
{
|
||||
// Calculate the attack timeout
|
||||
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
|
||||
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeTaskManager.getInstance().getGameTicks();
|
||||
|
||||
// Set the _globalAggro to 0 to permit attack even just after spawn
|
||||
if (_globalAggro < 0)
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.util.concurrent.Future;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
@@ -38,6 +37,7 @@ import org.l2jmobius.gameserver.model.actor.instance.DefenderInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.effects.EffectType;
|
||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
@@ -222,7 +222,7 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
|
||||
protected void onIntentionAttack(Creature target)
|
||||
{
|
||||
// Calculate the attack timeout
|
||||
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
|
||||
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeTaskManager.getInstance().getGameTicks();
|
||||
|
||||
// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event
|
||||
// if (_actor.getTarget() != null)
|
||||
@@ -309,18 +309,18 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
|
||||
*/
|
||||
private void thinkAttack()
|
||||
{
|
||||
if ((_attackTimeout < GameTimeController.getInstance().getGameTicks()) && _actor.isRunning())
|
||||
if ((_attackTimeout < GameTimeTaskManager.getInstance().getGameTicks()) && _actor.isRunning())
|
||||
{
|
||||
// Set the actor movement type to walk and send Server->Client packet ChangeMoveType to all others PlayerInstance
|
||||
_actor.setWalking();
|
||||
|
||||
// Calculate a new attack timeout
|
||||
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
|
||||
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeTaskManager.getInstance().getGameTicks();
|
||||
}
|
||||
|
||||
final Creature attackTarget = getAttackTarget();
|
||||
// Check if target is dead or if timeout is expired to stop this attack
|
||||
if ((attackTarget == null) || attackTarget.isAlikeDead() || (_attackTimeout < GameTimeController.getInstance().getGameTicks()))
|
||||
if ((attackTarget == null) || attackTarget.isAlikeDead() || (_attackTimeout < GameTimeTaskManager.getInstance().getGameTicks()))
|
||||
{
|
||||
// Stop hating this target after the attack timeout or if target is dead
|
||||
if (attackTarget != null)
|
||||
@@ -583,7 +583,7 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
|
||||
attackTarget = hated;
|
||||
}
|
||||
|
||||
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
|
||||
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeTaskManager.getInstance().getGameTicks();
|
||||
|
||||
// check for close combat skills && heal/buff skills
|
||||
if (!_actor.isMuted() && (Rnd.get(100) <= 5))
|
||||
@@ -682,7 +682,7 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
|
||||
protected void onEvtAttacked(Creature attacker)
|
||||
{
|
||||
// Calculate the attack timeout
|
||||
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
|
||||
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeTaskManager.getInstance().getGameTicks();
|
||||
|
||||
// Set the _globalAggro to 0 to permit attack even just after spawn
|
||||
if (_globalAggro < 0)
|
||||
|
||||
@@ -23,8 +23,8 @@ import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* This class load, holds and calculates the hit condition bonuses.
|
||||
@@ -123,7 +123,7 @@ public class HitConditionBonusData implements IXmlReader
|
||||
}
|
||||
|
||||
// Get weather bonus
|
||||
if (GameTimeController.getInstance().isNight())
|
||||
if (GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
mod += darkBonus;
|
||||
// else if () No rain support yet.
|
||||
|
||||
@@ -28,11 +28,11 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.enums.RaidBossStatus;
|
||||
import org.l2jmobius.gameserver.model.Spawn;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.RaidBossInstance;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* @author godson
|
||||
@@ -170,7 +170,7 @@ public class DayNightSpawnManager
|
||||
{
|
||||
try
|
||||
{
|
||||
changeMode(GameTimeController.getInstance().isNight() ? 1 : 0);
|
||||
changeMode(GameTimeTaskManager.getInstance().isNight() ? 1 : 0);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -259,7 +259,7 @@ public class DayNightSpawnManager
|
||||
return _bosses.get(spawnDat);
|
||||
}
|
||||
|
||||
if (GameTimeController.getInstance().isNight())
|
||||
if (GameTimeTaskManager.getInstance().isNight())
|
||||
{
|
||||
final RaidBossInstance raidboss = (RaidBossInstance) spawnDat.doSpawn();
|
||||
_bosses.put(spawnDat, raidboss);
|
||||
|
||||
@@ -30,7 +30,6 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.enums.PartyDistributionType;
|
||||
import org.l2jmobius.gameserver.instancemanager.DuelManager;
|
||||
@@ -59,6 +58,7 @@ import org.l2jmobius.gameserver.network.serverpackets.PartySmallWindowAll;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.PartySmallWindowDelete;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.PartySmallWindowDeleteAll;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
@@ -134,7 +134,7 @@ public class Party extends AbstractPlayerGroup
|
||||
public void setPendingInvitation(boolean value)
|
||||
{
|
||||
_pendingInvitation = value;
|
||||
_pendingInviteTimeout = GameTimeController.getInstance().getGameTicks() + (PlayerInstance.REQUEST_TIMEOUT * GameTimeController.TICKS_PER_SECOND);
|
||||
_pendingInviteTimeout = GameTimeTaskManager.getInstance().getGameTicks() + (PlayerInstance.REQUEST_TIMEOUT * GameTimeTaskManager.TICKS_PER_SECOND);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,7 +144,7 @@ public class Party extends AbstractPlayerGroup
|
||||
*/
|
||||
public boolean isInvitationRequestExpired()
|
||||
{
|
||||
return _pendingInviteTimeout <= GameTimeController.getInstance().getGameTicks();
|
||||
return _pendingInviteTimeout <= GameTimeTaskManager.getInstance().getGameTicks();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,7 +41,6 @@ import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
import org.l2jmobius.commons.util.EmptyQueue;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.ai.AttackableAI;
|
||||
import org.l2jmobius.gameserver.ai.CreatureAI;
|
||||
import org.l2jmobius.gameserver.ai.CreatureAI.IntentionCommand;
|
||||
@@ -157,6 +156,7 @@ import org.l2jmobius.gameserver.network.serverpackets.StopMove;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.TeleportToLocation;
|
||||
import org.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
@@ -835,7 +835,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
}
|
||||
|
||||
// Verify if the bow can be use
|
||||
if (_disableBowAttackEndTime <= GameTimeController.getInstance().getGameTicks())
|
||||
if (_disableBowAttackEndTime <= GameTimeTaskManager.getInstance().getGameTicks())
|
||||
{
|
||||
// Verify if PlayerInstance owns enough MP
|
||||
int mpConsume = weaponItem.getMpConsume();
|
||||
@@ -860,7 +860,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
}
|
||||
|
||||
// Set the period of bow no re-use
|
||||
_disableBowAttackEndTime = (5 * GameTimeController.TICKS_PER_SECOND) + GameTimeController.getInstance().getGameTicks();
|
||||
_disableBowAttackEndTime = (5 * GameTimeTaskManager.TICKS_PER_SECOND) + GameTimeTaskManager.getInstance().getGameTicks();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -872,7 +872,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
}
|
||||
else if (isNpc())
|
||||
{
|
||||
if (_disableBowAttackEndTime > GameTimeController.getInstance().getGameTicks())
|
||||
if (_disableBowAttackEndTime > GameTimeTaskManager.getInstance().getGameTicks())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -1213,7 +1213,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
ThreadPool.schedule(new HitTask(this, target, damage1, crit1, miss1, attack.hasSoulshot(), shld1), sAtk);
|
||||
|
||||
// Calculate and set the disable delay of the bow in function of the Attack Speed
|
||||
_disableBowAttackEndTime = ((sAtk + reuse) / GameTimeController.MILLIS_IN_TICK) + GameTimeController.getInstance().getGameTicks();
|
||||
_disableBowAttackEndTime = ((sAtk + reuse) / GameTimeTaskManager.MILLIS_IN_TICK) + GameTimeTaskManager.getInstance().getGameTicks();
|
||||
|
||||
// Add this hit to the Server-Client packet Attack
|
||||
attack.addHit(target, damage1, miss1, crit1, shld1);
|
||||
@@ -1283,7 +1283,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
ThreadPool.schedule(new HitTask(this, target, damage1, crit1, miss1, attack.hasSoulshot(), shld1), sAtk);
|
||||
|
||||
// Calculate and set the disable delay of the bow in function of the Attack Speed
|
||||
_disableBowAttackEndTime = ((sAtk + reuse) / GameTimeController.MILLIS_IN_TICK) + GameTimeController.getInstance().getGameTicks();
|
||||
_disableBowAttackEndTime = ((sAtk + reuse) / GameTimeTaskManager.MILLIS_IN_TICK) + GameTimeTaskManager.getInstance().getGameTicks();
|
||||
|
||||
// Add this hit to the Server-Client packet Attack
|
||||
attack.addHit(target, damage1, miss1, crit1, shld1);
|
||||
@@ -1779,7 +1779,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
|
||||
if (!simultaneously)
|
||||
{
|
||||
_castInterruptTime = -2 + GameTimeController.getInstance().getGameTicks() + (skillTime / GameTimeController.MILLIS_IN_TICK);
|
||||
_castInterruptTime = -2 + GameTimeTaskManager.getInstance().getGameTicks() + (skillTime / GameTimeTaskManager.MILLIS_IN_TICK);
|
||||
setLastSkillCast(skill);
|
||||
}
|
||||
else
|
||||
@@ -3863,7 +3863,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
*/
|
||||
public boolean canAbortCast()
|
||||
{
|
||||
return _castInterruptTime > GameTimeController.getInstance().getGameTicks();
|
||||
return _castInterruptTime > GameTimeTaskManager.getInstance().getGameTicks();
|
||||
}
|
||||
|
||||
public int getCastInterruptTime()
|
||||
@@ -3974,7 +3974,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
m._yAccurate = getY();
|
||||
}
|
||||
|
||||
final int gameTicks = GameTimeController.getInstance().getGameTicks();
|
||||
final int gameTicks = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
|
||||
// Check if the position has already been calculated
|
||||
if (m._moveTimestamp == gameTicks)
|
||||
@@ -4049,7 +4049,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
double distFraction = Double.MAX_VALUE;
|
||||
if (delta > 1)
|
||||
{
|
||||
final double distPassed = (_stat.getMoveSpeed() * (gameTicks - m._moveTimestamp)) / GameTimeController.TICKS_PER_SECOND;
|
||||
final double distPassed = (_stat.getMoveSpeed() * (gameTicks - m._moveTimestamp)) / GameTimeTaskManager.TICKS_PER_SECOND;
|
||||
distFraction = distPassed / delta;
|
||||
}
|
||||
|
||||
@@ -4463,7 +4463,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
|
||||
// Calculate the number of ticks between the current position and the destination
|
||||
// One tick added for rounding reasons
|
||||
final int ticksToMove = 1 + (int) ((GameTimeController.TICKS_PER_SECOND * distance) / speed);
|
||||
final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed);
|
||||
m._target = target;
|
||||
m._xDestination = x;
|
||||
m._yDestination = y;
|
||||
@@ -4477,17 +4477,17 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
setHeading(Util.calculateHeadingFrom(cos, sin));
|
||||
}
|
||||
|
||||
m._moveStartTime = GameTimeController.getInstance().getGameTicks();
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
|
||||
// Set the Creature _move object to MoveData object
|
||||
_move = m;
|
||||
|
||||
// Add the Creature to movingObjects of the GameTimeController
|
||||
// The GameTimeController manage objects movement
|
||||
GameTimeController.getInstance().registerMovingObject(this);
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Create a task to notify the AI that Creature arrives at a check point of the movement
|
||||
if ((ticksToMove * GameTimeController.MILLIS_IN_TICK) > 3000)
|
||||
if ((ticksToMove * GameTimeTaskManager.MILLIS_IN_TICK) > 3000)
|
||||
{
|
||||
ThreadPool.schedule(new NotifyAITask(this, CtrlEvent.EVT_ARRIVED_REVALIDATE), 2000);
|
||||
}
|
||||
@@ -4554,19 +4554,19 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
|
||||
|
||||
// Calculate the number of ticks between the current position and the destination
|
||||
// One tick added for rounding reasons
|
||||
final int ticksToMove = 1 + (int) ((GameTimeController.TICKS_PER_SECOND * distance) / speed);
|
||||
final int ticksToMove = 1 + (int) ((GameTimeTaskManager.TICKS_PER_SECOND * distance) / speed);
|
||||
m._heading = 0; // initial value for coordinate sync
|
||||
m._moveStartTime = GameTimeController.getInstance().getGameTicks();
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
|
||||
// Set the Creature _move object to MoveData object
|
||||
_move = m;
|
||||
|
||||
// Add the Creature to movingObjects of the GameTimeController
|
||||
// The GameTimeController manage objects movement
|
||||
GameTimeController.getInstance().registerMovingObject(this);
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
|
||||
// Create a task to notify the AI that Creature arrives at a check point of the movement
|
||||
if ((ticksToMove * GameTimeController.MILLIS_IN_TICK) > 3000)
|
||||
if ((ticksToMove * GameTimeTaskManager.MILLIS_IN_TICK) > 3000)
|
||||
{
|
||||
ThreadPool.schedule(new NotifyAITask(this, CtrlEvent.EVT_ARRIVED_REVALIDATE), 2000);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
import org.l2jmobius.gameserver.enums.TeleportWhereType;
|
||||
@@ -40,6 +39,7 @@ import org.l2jmobius.gameserver.model.zone.ZoneRegion;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
@@ -159,9 +159,9 @@ public abstract class Vehicle extends Creature
|
||||
setHeading(Util.calculateHeadingFrom(getX(), getY(), point.getX(), point.getY()));
|
||||
}
|
||||
|
||||
m._moveStartTime = GameTimeController.getInstance().getGameTicks();
|
||||
m._moveStartTime = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
_move = m;
|
||||
GameTimeController.getInstance().registerMovingObject(this);
|
||||
GameTimeTaskManager.getInstance().registerMovingObject(this);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,6 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.LoginServerThread;
|
||||
import org.l2jmobius.gameserver.RecipeController;
|
||||
import org.l2jmobius.gameserver.ai.CreatureAI;
|
||||
@@ -326,6 +325,7 @@ import org.l2jmobius.gameserver.network.serverpackets.TradeStart;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.UserInfo;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ValidateLocation;
|
||||
import org.l2jmobius.gameserver.taskmanager.AttackStanceTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.ItemsAutoDestroyTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.PlayerAutoSaveTaskManager;
|
||||
import org.l2jmobius.gameserver.taskmanager.PvpFlagTaskManager;
|
||||
@@ -3862,12 +3862,12 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public void setRecentFakeDeath(boolean protect)
|
||||
{
|
||||
_recentFakeDeathEndTime = protect ? GameTimeController.getInstance().getGameTicks() + (Config.PLAYER_FAKEDEATH_UP_PROTECTION * GameTimeController.TICKS_PER_SECOND) : 0;
|
||||
_recentFakeDeathEndTime = protect ? GameTimeTaskManager.getInstance().getGameTicks() + (Config.PLAYER_FAKEDEATH_UP_PROTECTION * GameTimeTaskManager.TICKS_PER_SECOND) : 0;
|
||||
}
|
||||
|
||||
public boolean isRecentFakeDeath()
|
||||
{
|
||||
return _recentFakeDeathEndTime > GameTimeController.getInstance().getGameTicks();
|
||||
return _recentFakeDeathEndTime > GameTimeTaskManager.getInstance().getGameTicks();
|
||||
}
|
||||
|
||||
public boolean isFakeDeath()
|
||||
@@ -5732,7 +5732,7 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public boolean isProcessingRequest()
|
||||
{
|
||||
return (getActiveRequester() != null) || (_requestExpireTime > GameTimeController.getInstance().getGameTicks());
|
||||
return (getActiveRequester() != null) || (_requestExpireTime > GameTimeTaskManager.getInstance().getGameTicks());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5740,7 +5740,7 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public boolean isProcessingTransaction()
|
||||
{
|
||||
return (getActiveRequester() != null) || (_activeTradeList != null) || (_requestExpireTime > GameTimeController.getInstance().getGameTicks());
|
||||
return (getActiveRequester() != null) || (_activeTradeList != null) || (_requestExpireTime > GameTimeTaskManager.getInstance().getGameTicks());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5749,7 +5749,7 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public void onTransactionRequest(PlayerInstance partner)
|
||||
{
|
||||
_requestExpireTime = GameTimeController.getInstance().getGameTicks() + (REQUEST_TIMEOUT * GameTimeController.TICKS_PER_SECOND);
|
||||
_requestExpireTime = GameTimeTaskManager.getInstance().getGameTicks() + (REQUEST_TIMEOUT * GameTimeTaskManager.TICKS_PER_SECOND);
|
||||
partner.setActiveRequester(this);
|
||||
}
|
||||
|
||||
@@ -5759,7 +5759,7 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public boolean isRequestExpired()
|
||||
{
|
||||
return _requestExpireTime <= GameTimeController.getInstance().getGameTicks();
|
||||
return _requestExpireTime <= GameTimeTaskManager.getInstance().getGameTicks();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -11506,7 +11506,7 @@ public class PlayerInstance extends Playable
|
||||
_fish = fish.get(Rnd.get(fish.size())).clone();
|
||||
fish.clear();
|
||||
sendPacket(SystemMessageId.YOU_CAST_YOUR_LINE_AND_START_TO_FISH);
|
||||
if (!GameTimeController.getInstance().isNight() && _lure.isNightLure())
|
||||
if (!GameTimeTaskManager.getInstance().isNight() && _lure.isNightLure())
|
||||
{
|
||||
_fish.setFishGroup(-1);
|
||||
}
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.conditions;
|
||||
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* The Class ConditionGameTime.
|
||||
@@ -60,7 +60,7 @@ public class ConditionGameTime extends Condition
|
||||
{
|
||||
case NIGHT:
|
||||
{
|
||||
return GameTimeController.getInstance().isNight() == _required;
|
||||
return GameTimeTaskManager.getInstance().isNight() == _required;
|
||||
}
|
||||
}
|
||||
return !_required;
|
||||
|
||||
@@ -33,7 +33,6 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.data.ItemTable;
|
||||
import org.l2jmobius.gameserver.data.xml.NpcData;
|
||||
@@ -132,6 +131,7 @@ import org.l2jmobius.gameserver.network.serverpackets.SpecialCamera;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.StatusUpdate;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.scripting.ManagedScript;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
import org.l2jmobius.gameserver.util.MinionList;
|
||||
|
||||
/**
|
||||
@@ -2753,11 +2753,11 @@ public abstract class AbstractScript extends ManagedScript
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the number of ticks from the {@link org.l2jmobius.gameserver.GameTimeController}.
|
||||
* @return the number of ticks from the {@link org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager}.
|
||||
*/
|
||||
public static int getGameTicks()
|
||||
{
|
||||
return GameTimeController.getInstance().getGameTicks();
|
||||
return GameTimeTaskManager.getInstance().getGameTicks();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.model.EffectList;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
@@ -34,6 +33,7 @@ import org.l2jmobius.gameserver.model.effects.EffectTickTask;
|
||||
import org.l2jmobius.gameserver.model.stats.Formulas;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* Buff Info.<br>
|
||||
@@ -75,7 +75,7 @@ public class BuffInfo
|
||||
_effected = effected;
|
||||
_skill = skill;
|
||||
_abnormalTime = Formulas.calcEffectAbnormalTime(effector, effected, skill);
|
||||
_periodStartTicks = GameTimeController.getInstance().getGameTicks();
|
||||
_periodStartTicks = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -158,7 +158,7 @@ public class BuffInfo
|
||||
*/
|
||||
public int getTime()
|
||||
{
|
||||
return _abnormalTime - ((GameTimeController.getInstance().getGameTicks() - _periodStartTicks) / GameTimeController.TICKS_PER_SECOND);
|
||||
return _abnormalTime - ((GameTimeTaskManager.getInstance().getGameTicks() - _periodStartTicks) / GameTimeTaskManager.TICKS_PER_SECOND);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
public class CharSelected implements IClientOutgoingPacket
|
||||
{
|
||||
@@ -69,7 +69,7 @@ public class CharSelected implements IClientOutgoingPacket
|
||||
packet.writeD(_player.getDEX());
|
||||
packet.writeD(_player.getWIT());
|
||||
|
||||
packet.writeD(GameTimeController.getInstance().getGameTime() % (24 * 60)); // "reset" on 24th hour
|
||||
packet.writeD(GameTimeTaskManager.getInstance().getGameTime() % (24 * 60)); // "reset" on 24th hour
|
||||
packet.writeD(0x00);
|
||||
|
||||
packet.writeD(_player.getClassId().getId());
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
public class ClientSetTime implements IClientOutgoingPacket
|
||||
{
|
||||
@@ -32,7 +32,7 @@ public class ClientSetTime implements IClientOutgoingPacket
|
||||
public boolean write(PacketWriter packet)
|
||||
{
|
||||
OutgoingPackets.CLIENT_SET_TIME.writeId(packet);
|
||||
packet.writeD(GameTimeController.getInstance().getGameTime()); // time in client minutes
|
||||
packet.writeD(GameTimeTaskManager.getInstance().getGameTime()); // time in client minutes
|
||||
packet.writeD(0x06); // constant to match the server time( this determines the speed of the client clock)
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver;
|
||||
package org.l2jmobius.gameserver.taskmanager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
@@ -29,12 +29,12 @@ import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.util.UnboundArrayList;
|
||||
|
||||
/**
|
||||
* Game Time controller class.
|
||||
* Game Time task manager class.
|
||||
* @author Forsaiken
|
||||
*/
|
||||
public class GameTimeController extends Thread
|
||||
public class GameTimeTaskManager extends Thread
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(GameTimeController.class.getName());
|
||||
private static final Logger LOGGER = Logger.getLogger(GameTimeTaskManager.class.getName());
|
||||
|
||||
public static final int TICKS_PER_SECOND = 10; // not able to change this without checking through code
|
||||
public static final int MILLIS_IN_TICK = 1000 / TICKS_PER_SECOND;
|
||||
@@ -43,14 +43,12 @@ public class GameTimeController extends Thread
|
||||
public static final int SECONDS_PER_IG_DAY = MILLIS_PER_IG_DAY / 1000;
|
||||
public static final int TICKS_PER_IG_DAY = SECONDS_PER_IG_DAY * TICKS_PER_SECOND;
|
||||
|
||||
private static GameTimeController _instance;
|
||||
|
||||
private static final UnboundArrayList<Creature> _movingObjects = new UnboundArrayList<>();
|
||||
private final long _referenceTime;
|
||||
|
||||
private GameTimeController()
|
||||
private GameTimeTaskManager()
|
||||
{
|
||||
super("GameTimeController");
|
||||
super("GameTimeTaskManager");
|
||||
super.setDaemon(true);
|
||||
super.setPriority(MAX_PRIORITY);
|
||||
|
||||
@@ -64,11 +62,6 @@ public class GameTimeController extends Thread
|
||||
super.start();
|
||||
}
|
||||
|
||||
public static void init()
|
||||
{
|
||||
_instance = new GameTimeController();
|
||||
}
|
||||
|
||||
public int getGameTime()
|
||||
{
|
||||
return (getGameTicks() % TICKS_PER_IG_DAY) / MILLIS_IN_TICK;
|
||||
@@ -210,8 +203,13 @@ public class GameTimeController extends Thread
|
||||
}
|
||||
}
|
||||
|
||||
public static GameTimeController getInstance()
|
||||
public static final GameTimeTaskManager getInstance()
|
||||
{
|
||||
return _instance;
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final GameTimeTaskManager INSTANCE = new GameTimeTaskManager();
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,6 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.GameTimeController;
|
||||
import org.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
||||
import org.l2jmobius.gameserver.model.PlayerCondOverride;
|
||||
import org.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
||||
@@ -31,6 +30,7 @@ import org.l2jmobius.gameserver.model.punishment.PunishmentType;
|
||||
import org.l2jmobius.gameserver.network.ConnectionState;
|
||||
import org.l2jmobius.gameserver.network.Disconnection;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.taskmanager.GameTimeTaskManager;
|
||||
|
||||
/**
|
||||
* Flood protector implementation.
|
||||
@@ -53,7 +53,7 @@ public class FloodProtectorAction
|
||||
/**
|
||||
* Next game tick when new request is allowed.
|
||||
*/
|
||||
private volatile int _nextGameTick = GameTimeController.getInstance().getGameTicks();
|
||||
private volatile int _nextGameTick = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
/**
|
||||
* Request counter.
|
||||
*/
|
||||
@@ -86,7 +86,7 @@ public class FloodProtectorAction
|
||||
*/
|
||||
public boolean tryPerformAction(String command)
|
||||
{
|
||||
final int curTick = GameTimeController.getInstance().getGameTicks();
|
||||
final int curTick = GameTimeTaskManager.getInstance().getGameTicks();
|
||||
if ((_client.getPlayer() != null) && _client.getPlayer().canOverrideCond(PlayerCondOverride.FLOOD_CONDITIONS))
|
||||
{
|
||||
return true;
|
||||
@@ -96,7 +96,7 @@ public class FloodProtectorAction
|
||||
{
|
||||
if (_config.LOG_FLOODING && !_logged && LOGGER.isLoggable(Level.WARNING))
|
||||
{
|
||||
log(" called command ", command, " ~", String.valueOf((_config.FLOOD_PROTECTION_INTERVAL - (_nextGameTick - curTick)) * GameTimeController.MILLIS_IN_TICK), " ms after previous command");
|
||||
log(" called command ", command, " ~", String.valueOf((_config.FLOOD_PROTECTION_INTERVAL - (_nextGameTick - curTick)) * GameTimeTaskManager.MILLIS_IN_TICK), " ms after previous command");
|
||||
_logged = true;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ public class FloodProtectorAction
|
||||
|
||||
if ((_count.get() > 0) && _config.LOG_FLOODING && LOGGER.isLoggable(Level.WARNING))
|
||||
{
|
||||
log(" issued ", String.valueOf(_count), " extra requests within ~", String.valueOf(_config.FLOOD_PROTECTION_INTERVAL * GameTimeController.MILLIS_IN_TICK), " ms");
|
||||
log(" issued ", String.valueOf(_count), " extra requests within ~", String.valueOf(_config.FLOOD_PROTECTION_INTERVAL * GameTimeTaskManager.MILLIS_IN_TICK), " ms");
|
||||
}
|
||||
|
||||
_nextGameTick = curTick + _config.FLOOD_PROTECTION_INTERVAL;
|
||||
|
||||
Reference in New Issue
Block a user