IdManager rework.
This commit is contained in:
@@ -81,7 +81,6 @@ import org.l2jmobius.gameserver.handler.ItemHandler;
|
||||
import org.l2jmobius.gameserver.handler.SkillHandler;
|
||||
import org.l2jmobius.gameserver.handler.UserCommandHandler;
|
||||
import org.l2jmobius.gameserver.handler.VoicedCommandHandler;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.AuctionManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.CastleManorManager;
|
||||
@@ -99,6 +98,7 @@ import org.l2jmobius.gameserver.instancemanager.FortSiegeManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.FourSepulchersManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.MercTicketManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.PetitionManager;
|
||||
@@ -177,9 +177,9 @@ public class GameServer
|
||||
ThreadPool.scheduleAtFixedRate(DeadlockDetector.getInstance(), Config.DEADLOCKCHECK_INTIAL_TIME, Config.DEADLOCKCHECK_DELAY_TIME);
|
||||
}
|
||||
|
||||
Util.printSection("IdFactory");
|
||||
IdFactory.init();
|
||||
if (!IdFactory.hasInitialized())
|
||||
Util.printSection("IdManager");
|
||||
IdManager.getInstance();
|
||||
if (!IdManager.hasInitialized())
|
||||
{
|
||||
LOGGER.severe("IdFactory: Could not read object IDs from database. Please check your configuration.");
|
||||
throw new Exception("Could not initialize the ID factory!");
|
||||
@@ -404,7 +404,7 @@ public class GameServer
|
||||
|
||||
Util.printSection("Game Server");
|
||||
|
||||
LOGGER.info("IdFactory: Free ObjectID's remaining: " + IdFactory.size());
|
||||
LOGGER.info("IdFactory: Free ObjectID's remaining: " + IdManager.size());
|
||||
|
||||
if (Config.ALLOW_WEDDING)
|
||||
{
|
||||
|
@@ -31,7 +31,7 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.datatables.sql.ClanTable;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
|
||||
/**
|
||||
@@ -135,7 +135,7 @@ public class CrestCache
|
||||
|
||||
LOGGER.info("Found old crest file \"" + file.getName() + "\" for clanId " + clanId);
|
||||
|
||||
final int newId = IdFactory.getNextId();
|
||||
final int newId = IdManager.getInstance().getNextId();
|
||||
final Clan clan = ClanTable.getInstance().getClan(clanId);
|
||||
if (clan != null)
|
||||
{
|
||||
|
@@ -32,7 +32,7 @@ import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.datatables.sql.PetDataTable;
|
||||
import org.l2jmobius.gameserver.engines.DocumentEngine;
|
||||
import org.l2jmobius.gameserver.engines.ItemDataHolder;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.Attackable;
|
||||
@@ -178,7 +178,7 @@ public class ItemTable
|
||||
public ItemInstance createItem(String process, int itemId, int count, PlayerInstance actor, WorldObject reference)
|
||||
{
|
||||
// Create and Init the ItemInstance corresponding to the Item Identifier
|
||||
final ItemInstance item = new ItemInstance(IdFactory.getNextId(), itemId);
|
||||
final ItemInstance item = new ItemInstance(IdManager.getInstance().getNextId(), itemId);
|
||||
|
||||
// create loot schedule also if autoloot is enabled
|
||||
if (process.equalsIgnoreCase("loot")/* && !Config.AUTO_LOOT */)
|
||||
@@ -293,7 +293,7 @@ public class ItemTable
|
||||
item.setLastChange(ItemInstance.REMOVED);
|
||||
|
||||
World.getInstance().removeObject(item);
|
||||
IdFactory.releaseId(item.getObjectId());
|
||||
IdManager.getInstance().releaseId(item.getObjectId());
|
||||
|
||||
// if it's a pet control item, delete the pet as well
|
||||
if (PetDataTable.isPetItem(item.getItemId()))
|
||||
|
@@ -29,9 +29,9 @@ import java.util.regex.PatternSyntaxException;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.FortSiegeManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
@@ -189,7 +189,7 @@ public class ClanTable
|
||||
return null;
|
||||
}
|
||||
|
||||
final Clan clan = new Clan(IdFactory.getNextId(), clanName);
|
||||
final Clan clan = new Clan(IdManager.getInstance().getNextId(), clanName);
|
||||
final ClanMember leader = new ClanMember(clan, player.getName(), player.getLevel(), player.getClassId().getId(), player.getObjectId(), player.getPledgeType(), player.getPowerGrade(), player.getTitle());
|
||||
|
||||
clan.setLeader(leader);
|
||||
@@ -323,7 +323,7 @@ public class ClanTable
|
||||
final int clanLvl = clan.getLevel();
|
||||
|
||||
_clans.remove(clanId);
|
||||
IdFactory.releaseId(clanId);
|
||||
IdManager.getInstance().releaseId(clanId);
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection())
|
||||
{
|
||||
|
@@ -29,7 +29,7 @@ import org.w3c.dom.Node;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.BoatInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.templates.CreatureTemplate;
|
||||
@@ -122,7 +122,7 @@ public class BoatData implements IXmlReader
|
||||
npcDat.set("baseMDef", 100);
|
||||
|
||||
final CreatureTemplate template = new CreatureTemplate(npcDat);
|
||||
final BoatInstance boat = new BoatInstance(IdFactory.getNextId(), template);
|
||||
final BoatInstance boat = new BoatInstance(IdManager.getInstance().getNextId(), template);
|
||||
boat.getPosition().setHeading(set.getInt("heading"));
|
||||
boat.setXYZ(set.getInt("spawnX"), set.getInt("spawnY"), set.getInt("spawnZ"));
|
||||
boat.setPathA(set.getInt("pathIdA"), set.getInt("ticketA"), set.getInt("xTeleNoTicketA"), set.getInt("yTeleNoTicketA"), set.getInt("zTeleNoTicketA"), set.getString("announcerA"), set.getString("message10A"), set.getString("message5A"), set.getString("message1A"), set.getString("message0A"), set.getString("messageBeginA"), paths.get(set.getInt("pathIdA")));
|
||||
|
@@ -27,8 +27,8 @@ import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.ClanHallManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.DoorInstance;
|
||||
@@ -176,7 +176,7 @@ public class DoorData implements IXmlReader
|
||||
npcDat.set("baseMDef", mDef);
|
||||
|
||||
final CreatureTemplate template = new CreatureTemplate(npcDat);
|
||||
final DoorInstance door = new DoorInstance(IdFactory.getNextId(), template, id, name, unlockable);
|
||||
final DoorInstance door = new DoorInstance(IdManager.getInstance().getNextId(), template, id, name, unlockable);
|
||||
door.setRange(xMin, yMin, zMin, xMax, yMax, zMax);
|
||||
try
|
||||
{
|
||||
|
@@ -26,7 +26,7 @@ import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import org.l2jmobius.commons.util.IXmlReader;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.StaticObjectInstance;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.StaticObject;
|
||||
@@ -74,7 +74,7 @@ public class StaticObjectData implements IXmlReader
|
||||
}
|
||||
|
||||
// Create and spawn the StaticObject instance.
|
||||
final StaticObjectInstance obj = new StaticObjectInstance(IdFactory.getNextId());
|
||||
final StaticObjectInstance obj = new StaticObjectInstance(IdManager.getInstance().getNextId());
|
||||
obj.setType(set.getInt("type"));
|
||||
obj.setStaticObjectId(set.getInt("id"));
|
||||
obj.setXYZ(set.getInt("x"), set.getInt("y"), set.getInt("z"));
|
||||
|
@@ -21,7 +21,7 @@ import java.util.StringTokenizer;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
@@ -205,8 +205,8 @@ public class AdminFightCalculator implements IAdminCommandHandler
|
||||
final StringTokenizer st = new StringTokenizer(trimmedParams);
|
||||
mid1 = Integer.parseInt(st.nextToken());
|
||||
mid2 = Integer.parseInt(st.nextToken());
|
||||
npc1 = new MonsterInstance(IdFactory.getNextId(), NpcTable.getInstance().getTemplate(mid1));
|
||||
npc2 = new MonsterInstance(IdFactory.getNextId(), NpcTable.getInstance().getTemplate(mid2));
|
||||
npc1 = new MonsterInstance(IdManager.getInstance().getNextId(), NpcTable.getInstance().getTemplate(mid1));
|
||||
npc2 = new MonsterInstance(IdManager.getInstance().getNextId(), NpcTable.getInstance().getTemplate(mid2));
|
||||
}
|
||||
|
||||
int miss1 = 0;
|
||||
|
@@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.handler.itemhandlers;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.handler.IItemHandler;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.Playable;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
@@ -72,7 +72,7 @@ public class ChristmasTree implements IItemHandler
|
||||
try
|
||||
{
|
||||
final Spawn spawn = new Spawn(template1);
|
||||
spawn.setId(IdFactory.getNextId());
|
||||
spawn.setId(IdManager.getInstance().getNextId());
|
||||
spawn.setX(target.getX());
|
||||
spawn.setY(target.getY());
|
||||
spawn.setZ(target.getZ());
|
||||
|
@@ -18,7 +18,7 @@ package org.l2jmobius.gameserver.handler.itemhandlers;
|
||||
|
||||
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.handler.IItemHandler;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Playable;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.GourdInstance;
|
||||
@@ -64,7 +64,7 @@ public class JackpotSeed implements IItemHandler
|
||||
try
|
||||
{
|
||||
final Spawn spawn = new Spawn(template1);
|
||||
spawn.setId(IdFactory.getNextId());
|
||||
spawn.setId(IdManager.getInstance().getNextId());
|
||||
spawn.setX(player.getX());
|
||||
spawn.setY(player.getY());
|
||||
spawn.setZ(player.getZ());
|
||||
|
@@ -22,7 +22,7 @@ import org.l2jmobius.gameserver.datatables.SkillTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.datatables.xml.SummonItemData;
|
||||
import org.l2jmobius.gameserver.handler.IItemHandler;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.Skill;
|
||||
import org.l2jmobius.gameserver.model.SummonItem;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
@@ -145,7 +145,7 @@ public class SummonItems implements IItemHandler
|
||||
try
|
||||
{
|
||||
final Spawn spawn = new Spawn(npcTemplate);
|
||||
spawn.setId(IdFactory.getNextId());
|
||||
spawn.setId(IdManager.getInstance().getNextId());
|
||||
spawn.setX(player.getX());
|
||||
spawn.setY(player.getY());
|
||||
spawn.setZ(player.getZ());
|
||||
|
@@ -18,10 +18,10 @@ package org.l2jmobius.gameserver.handler.skillhandlers;
|
||||
|
||||
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.handler.ISkillHandler;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.FortSiegeManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
|
||||
import org.l2jmobius.gameserver.model.Skill;
|
||||
import org.l2jmobius.gameserver.model.Skill.SkillType;
|
||||
@@ -79,7 +79,7 @@ public class SiegeFlag implements ISkillHandler
|
||||
try
|
||||
{
|
||||
// Spawn a new flag
|
||||
final SiegeFlagInstance flag = new SiegeFlagInstance(player, IdFactory.getNextId(), NpcTable.getInstance().getTemplate(35062));
|
||||
final SiegeFlagInstance flag = new SiegeFlagInstance(player, IdManager.getInstance().getNextId(), NpcTable.getInstance().getTemplate(35062));
|
||||
if (skill.isAdvancedFlag())
|
||||
{
|
||||
flag.setAdvanceFlag(true);
|
||||
|
@@ -27,7 +27,6 @@ import org.l2jmobius.gameserver.datatables.ItemTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.SpawnTable;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.Attackable;
|
||||
@@ -467,7 +466,7 @@ public class ChristmasManager
|
||||
{
|
||||
final NpcTemplate template1 = NpcTable.getInstance().getTemplate(id);
|
||||
final Spawn spawn = new Spawn(template1);
|
||||
spawn.setId(IdFactory.getNextId());
|
||||
spawn.setId(IdManager.getInstance().getNextId());
|
||||
|
||||
spawn.setX(x);
|
||||
spawn.setY(y);
|
||||
|
@@ -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.idfactory;
|
||||
package org.l2jmobius.gameserver.instancemanager;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
@@ -32,35 +32,12 @@ import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.util.PrimeFinder;
|
||||
|
||||
/**
|
||||
* @author Mobius (reworked from L2J version)
|
||||
* @author Mobius (reworked from L2J IdFactory)
|
||||
*/
|
||||
public abstract class IdFactory
|
||||
public class IdManager
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(IdFactory.class.getName());
|
||||
private static final Logger LOGGER = Logger.getLogger(IdManager.class.getName());
|
||||
|
||||
protected static final String[] ID_CHECKS =
|
||||
{
|
||||
"SELECT owner_id FROM items WHERE object_id >= ? AND object_id < ?",
|
||||
"SELECT object_id FROM items WHERE object_id >= ? AND object_id < ?",
|
||||
"SELECT char_id FROM character_quests WHERE char_id >= ? AND char_id < ?",
|
||||
"SELECT char_id FROM character_friends WHERE char_id >= ? AND char_id < ?",
|
||||
"SELECT char_id FROM character_friends WHERE friend_id >= ? AND friend_id < ?",
|
||||
"SELECT char_obj_id FROM character_hennas WHERE char_obj_id >= ? AND char_obj_id < ?",
|
||||
"SELECT char_id FROM character_recipebook WHERE char_id >= ? AND char_id < ?",
|
||||
"SELECT char_obj_id FROM character_shortcuts WHERE char_obj_id >= ? AND char_obj_id < ?",
|
||||
"SELECT char_obj_id FROM character_macroses WHERE char_obj_id >= ? AND char_obj_id < ?",
|
||||
"SELECT char_obj_id FROM character_skills WHERE char_obj_id >= ? AND char_obj_id < ?",
|
||||
"SELECT char_obj_id FROM character_skills_save WHERE char_obj_id >= ? AND char_obj_id < ?",
|
||||
"SELECT char_obj_id FROM character_subclasses WHERE char_obj_id >= ? AND char_obj_id < ?",
|
||||
"SELECT obj_Id FROM characters WHERE obj_Id >= ? AND obj_Id < ?",
|
||||
"SELECT clanid FROM characters WHERE clanid >= ? AND clanid < ?",
|
||||
"SELECT clan_id FROM clan_data WHERE clan_id >= ? AND clan_id < ?",
|
||||
"SELECT clan_id FROM siege_clans WHERE clan_id >= ? AND clan_id < ?",
|
||||
"SELECT ally_id FROM clan_data WHERE ally_id >= ? AND ally_id < ?",
|
||||
"SELECT leader_id FROM clan_data WHERE leader_id >= ? AND leader_id < ?",
|
||||
"SELECT item_obj_id FROM pets WHERE item_obj_id >= ? AND item_obj_id < ?",
|
||||
"SELECT object_id FROM itemsonground WHERE object_id >= ? AND object_id < ?"
|
||||
};
|
||||
//@formatter:off
|
||||
private static final String[][] ID_EXTRACTS =
|
||||
{
|
||||
@@ -70,20 +47,22 @@ public abstract class IdFactory
|
||||
{"itemsonground","object_id"}
|
||||
};
|
||||
//@formatter:on
|
||||
|
||||
private static final String[] TIMESTAMPS_CLEAN =
|
||||
{
|
||||
"DELETE FROM character_skills_save WHERE restore_type = 1 AND systime <= ?"
|
||||
};
|
||||
public static final int FIRST_OID = 0x10000000;
|
||||
public static final int LAST_OID = 0x7FFFFFFF;
|
||||
public static final int FREE_OBJECT_ID_SIZE = LAST_OID - FIRST_OID;
|
||||
|
||||
private static final int FIRST_OID = 0x10000000;
|
||||
private static final int LAST_OID = 0x7FFFFFFF;
|
||||
private static final int FREE_OBJECT_ID_SIZE = LAST_OID - FIRST_OID;
|
||||
|
||||
private static BitSet _freeIds;
|
||||
private static AtomicInteger _freeIdCount;
|
||||
private static AtomicInteger _nextFreeId;
|
||||
private static boolean _initialized;
|
||||
|
||||
public static void init()
|
||||
public IdManager()
|
||||
{
|
||||
// Update characters online status.
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
@@ -94,7 +73,7 @@ public abstract class IdFactory
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("IdFactory: Could not update characters online status: " + e);
|
||||
LOGGER.warning("IdManager: Could not update characters online status: " + e);
|
||||
}
|
||||
|
||||
// Cleanup database.
|
||||
@@ -146,11 +125,11 @@ public abstract class IdFactory
|
||||
cleanCount += statement.executeUpdate("DELETE FROM items WHERE items.owner_id NOT IN (SELECT obj_Id FROM characters) AND items.owner_id NOT IN (SELECT clan_id FROM clan_data);");
|
||||
statement.executeUpdate("UPDATE characters SET clanid=0 WHERE characters.clanid NOT IN (SELECT clan_id FROM clan_data);");
|
||||
|
||||
LOGGER.info("IdFactory: Cleaned " + cleanCount + " elements from database in " + ((System.currentTimeMillis() - cleanupStart) / 1000) + " seconds.");
|
||||
LOGGER.info("IdManager: Cleaned " + cleanCount + " elements from database in " + ((System.currentTimeMillis() - cleanupStart) / 1000) + " seconds.");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("IdFactory: Could not clean up database: " + e);
|
||||
LOGGER.warning("IdManager: Could not clean up database: " + e);
|
||||
}
|
||||
|
||||
// Cleanup timestamps.
|
||||
@@ -165,11 +144,11 @@ public abstract class IdFactory
|
||||
cleanCount += statement.executeUpdate();
|
||||
}
|
||||
}
|
||||
LOGGER.info("IdFactory: Cleaned " + cleanCount + " expired timestamps from database.");
|
||||
LOGGER.info("IdManager: Cleaned " + cleanCount + " expired timestamps from database.");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LOGGER.warning("IdFactory: Could not clean expired timestamps from database. " + e);
|
||||
LOGGER.warning("IdManager: Could not clean expired timestamps from database. " + e);
|
||||
}
|
||||
|
||||
// Initialize.
|
||||
@@ -206,7 +185,7 @@ public abstract class IdFactory
|
||||
final int objectId = usedObjectId - FIRST_OID;
|
||||
if (objectId < 0)
|
||||
{
|
||||
LOGGER.warning("IdFactory: Object ID " + usedObjectId + " in DB is less than minimum ID of " + FIRST_OID);
|
||||
LOGGER.warning("IdManager: Object ID " + usedObjectId + " in DB is less than minimum ID of " + FIRST_OID);
|
||||
continue;
|
||||
}
|
||||
_freeIds.set(usedObjectId - FIRST_OID);
|
||||
@@ -219,7 +198,7 @@ public abstract class IdFactory
|
||||
catch (Exception e)
|
||||
{
|
||||
_initialized = false;
|
||||
LOGGER.severe("IdFactory: Could not be initialized properly: " + e.getMessage());
|
||||
LOGGER.severe("IdManager: Could not be initialized properly: " + e.getMessage());
|
||||
}
|
||||
|
||||
// Schedule increase capacity task.
|
||||
@@ -234,10 +213,10 @@ public abstract class IdFactory
|
||||
}
|
||||
}, 30000, 30000);
|
||||
|
||||
LOGGER.info("IdFactory: " + _freeIds.size() + " id's available.");
|
||||
LOGGER.info("IdManager: " + _freeIds.size() + " id's available.");
|
||||
}
|
||||
|
||||
public synchronized static void releaseId(int objectId)
|
||||
public void releaseId(int objectId)
|
||||
{
|
||||
synchronized (_nextFreeId)
|
||||
{
|
||||
@@ -248,12 +227,12 @@ public abstract class IdFactory
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.warning("IdFactory: Release objectID " + objectId + " failed (< " + FIRST_OID + ")");
|
||||
LOGGER.warning("IdManager: Release objectID " + objectId + " failed (< " + FIRST_OID + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized static int getNextId()
|
||||
public int getNextId()
|
||||
{
|
||||
synchronized (_nextFreeId)
|
||||
{
|
||||
@@ -266,7 +245,7 @@ public abstract class IdFactory
|
||||
{
|
||||
if (_freeIds.size() >= FREE_OBJECT_ID_SIZE)
|
||||
{
|
||||
throw new NullPointerException("IdFactory: Ran out of valid ids.");
|
||||
throw new NullPointerException("IdManager: Ran out of valid ids.");
|
||||
}
|
||||
increaseBitSetCapacity();
|
||||
}
|
||||
@@ -276,14 +255,14 @@ public abstract class IdFactory
|
||||
}
|
||||
}
|
||||
|
||||
private static void increaseBitSetCapacity()
|
||||
private void increaseBitSetCapacity()
|
||||
{
|
||||
final BitSet newBitSet = new BitSet(PrimeFinder.nextPrime((usedIdCount() * 11) / 10));
|
||||
newBitSet.or(_freeIds);
|
||||
_freeIds = newBitSet;
|
||||
}
|
||||
|
||||
private static int usedIdCount()
|
||||
private int usedIdCount()
|
||||
{
|
||||
return _freeIdCount.get() - FIRST_OID;
|
||||
}
|
||||
@@ -297,4 +276,14 @@ public abstract class IdFactory
|
||||
{
|
||||
return _initialized;
|
||||
}
|
||||
|
||||
public static IdManager getInstance()
|
||||
{
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final IdManager INSTANCE = new IdManager();
|
||||
}
|
||||
}
|
@@ -27,7 +27,6 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.handler.AutoChatHandler;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.SiegeGuardInstance;
|
||||
@@ -714,7 +713,7 @@ public class MercTicketManager
|
||||
{
|
||||
itemId = ITEM_IDS[i];
|
||||
// create the ticket in the gameworld
|
||||
final ItemInstance dropticket = new ItemInstance(IdFactory.getNextId(), itemId);
|
||||
final ItemInstance dropticket = new ItemInstance(IdManager.getInstance().getNextId(), itemId);
|
||||
dropticket.setLocation(ItemInstance.ItemLocation.VOID);
|
||||
dropticket.dropMe(null, x, y, z);
|
||||
dropticket.setDropTime(0); // avoids it from beeing removed by the auto item destroyer
|
||||
@@ -761,9 +760,9 @@ public class MercTicketManager
|
||||
|
||||
int count = 0;
|
||||
ItemInstance ticket;
|
||||
for (int i = 0; i < _droppedTickets.size(); i++)
|
||||
for (ItemInstance _droppedTicket : _droppedTickets)
|
||||
{
|
||||
ticket = _droppedTickets.get(i);
|
||||
ticket = _droppedTicket;
|
||||
if ((ticket != null) && (ticket.getItemId() == itemId))
|
||||
{
|
||||
count++;
|
||||
@@ -794,9 +793,9 @@ public class MercTicketManager
|
||||
|
||||
int count = 0;
|
||||
ItemInstance ticket;
|
||||
for (int i = 0; i < _droppedTickets.size(); i++)
|
||||
for (ItemInstance _droppedTicket : _droppedTickets)
|
||||
{
|
||||
ticket = _droppedTickets.get(i);
|
||||
ticket = _droppedTicket;
|
||||
if ((ticket != null) && (getTicketCastleId(ticket.getItemId()) == castleId))
|
||||
{
|
||||
count++;
|
||||
@@ -837,7 +836,7 @@ public class MercTicketManager
|
||||
castle.getSiege().getSiegeGuardManager().hireMerc(x, y, z, heading, NPC_IDS[i]);
|
||||
|
||||
// create the ticket in the gameworld
|
||||
final ItemInstance dropticket = new ItemInstance(IdFactory.getNextId(), itemId);
|
||||
final ItemInstance dropticket = new ItemInstance(IdManager.getInstance().getNextId(), itemId);
|
||||
dropticket.setLocation(ItemInstance.ItemLocation.INVENTORY);
|
||||
dropticket.dropMe(null, x, y, z);
|
||||
dropticket.setDropTime(0); // avoids it from beeing removed by the auto item destroyer
|
||||
@@ -856,7 +855,7 @@ public class MercTicketManager
|
||||
final NpcTemplate template = NpcTable.getInstance().getTemplate(npcId);
|
||||
if (template != null)
|
||||
{
|
||||
final SiegeGuardInstance npc = new SiegeGuardInstance(IdFactory.getNextId(), template);
|
||||
final SiegeGuardInstance npc = new SiegeGuardInstance(IdManager.getInstance().getNextId(), template);
|
||||
npc.setCurrentHpMp(npc.getMaxHp(), npc.getMaxMp());
|
||||
npc.setDecayed(false);
|
||||
npc.spawnMe(x, y, (z + 20));
|
||||
|
@@ -27,7 +27,6 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.datatables.xml.AdminData;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
@@ -88,7 +87,7 @@ public class PetitionManager
|
||||
|
||||
public Petition(PlayerInstance petitioner, String petitionText, int petitionType)
|
||||
{
|
||||
_id = IdFactory.getNextId();
|
||||
_id = IdManager.getInstance().getNextId();
|
||||
if ((petitionType - 1) >= PetitionType.values().length)
|
||||
{
|
||||
LOGGER.warning("PetitionManager:Petition : invalid petition type (received type was +1) : " + petitionType);
|
||||
|
@@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.model;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.MercTicketManager;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
@@ -193,8 +193,8 @@ public abstract class WorldObject
|
||||
public void refreshId()
|
||||
{
|
||||
World.getInstance().removeObject(this);
|
||||
IdFactory.releaseId(getObjectId());
|
||||
_objectId = IdFactory.getNextId();
|
||||
IdManager.getInstance().releaseId(getObjectId());
|
||||
_objectId = IdManager.getInstance().getNextId();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -18,7 +18,7 @@ package org.l2jmobius.gameserver.model.actor.instance;
|
||||
|
||||
import org.l2jmobius.gameserver.datatables.xml.FenceData;
|
||||
import org.l2jmobius.gameserver.enums.FenceState;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.DeleteObject;
|
||||
@@ -42,7 +42,7 @@ public class FenceInstance extends WorldObject
|
||||
|
||||
public FenceInstance(int x, int y, String name, int width, int length, int height, FenceState state)
|
||||
{
|
||||
super(IdFactory.getNextId());
|
||||
super(IdManager.getInstance().getNextId());
|
||||
|
||||
_xMin = x - (width / 2);
|
||||
_xMax = x + (width / 2);
|
||||
@@ -57,7 +57,7 @@ public class FenceInstance extends WorldObject
|
||||
_heightFences = new int[height - 1];
|
||||
for (int i = 0; i < _heightFences.length; i++)
|
||||
{
|
||||
_heightFences[i] = IdFactory.getNextId();
|
||||
_heightFences[i] = IdManager.getInstance().getNextId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -35,10 +35,10 @@ import org.l2jmobius.gameserver.datatables.sql.SpawnTable;
|
||||
import org.l2jmobius.gameserver.datatables.xml.MultisellData;
|
||||
import org.l2jmobius.gameserver.datatables.xml.ZoneData;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.CastleManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.DimensionalRiftManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.FortManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.QuestManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.RaidBossSpawnManager;
|
||||
import org.l2jmobius.gameserver.model.DropCategory;
|
||||
@@ -2012,7 +2012,7 @@ public class NpcInstance extends Creature
|
||||
sm.addItemName(4442);
|
||||
player.sendPacket(sm);
|
||||
|
||||
final ItemInstance item = new ItemInstance(IdFactory.getNextId(), 4442);
|
||||
final ItemInstance item = new ItemInstance(IdManager.getInstance().getNextId(), 4442);
|
||||
item.setCount(1);
|
||||
item.setCustomType1(lotonumber);
|
||||
item.setEnchantLevel(enchant);
|
||||
|
@@ -27,8 +27,8 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.datatables.sql.PetDataTable;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.ItemsOnGroundManager;
|
||||
import org.l2jmobius.gameserver.model.PetData;
|
||||
import org.l2jmobius.gameserver.model.Skill;
|
||||
@@ -829,11 +829,11 @@ public class PetInstance extends Summon
|
||||
{
|
||||
if (template.getType().equalsIgnoreCase("BabyPet"))
|
||||
{
|
||||
pet = new BabyPetInstance(IdFactory.getNextId(), template, owner, control);
|
||||
pet = new BabyPetInstance(IdManager.getInstance().getNextId(), template, owner, control);
|
||||
}
|
||||
else
|
||||
{
|
||||
pet = new PetInstance(IdFactory.getNextId(), template, owner, control);
|
||||
pet = new PetInstance(IdManager.getInstance().getNextId(), template, owner, control);
|
||||
}
|
||||
|
||||
final PreparedStatement statement = con.prepareStatement("SELECT item_obj_id, name, level, curHp, curMp, exp, sp, karma, pkkills, fed FROM pets WHERE item_obj_id=?");
|
||||
|
@@ -21,7 +21,7 @@ import java.util.Locale;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.StringUtil;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
|
||||
import org.l2jmobius.gameserver.model.entity.event.MonsterRace;
|
||||
import org.l2jmobius.gameserver.model.entity.event.MonsterRace.HistoryInfo;
|
||||
@@ -160,7 +160,7 @@ public class RaceManagerInstance extends FolkInstance
|
||||
|
||||
player.setRace(0, 0);
|
||||
player.setRace(1, 0);
|
||||
ItemInstance item = new ItemInstance(IdFactory.getNextId(), 4443);
|
||||
ItemInstance item = new ItemInstance(IdManager.getInstance().getNextId(), 4443);
|
||||
item.setCount(1);
|
||||
item.setEnchantLevel(MonsterRace.getInstance().getRaceNumber());
|
||||
item.setCustomType1(ticket);
|
||||
|
@@ -27,9 +27,9 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.datatables.sql.ClanTable;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.AuctionManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.ClanHallManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
@@ -396,7 +396,7 @@ public class Auction
|
||||
else
|
||||
{
|
||||
statement = con.prepareStatement("INSERT INTO auction_bid (id, auctionId, bidderId, bidderName, maxBid, clan_name, time_bid) VALUES (?, ?, ?, ?, ?, ?, ?)");
|
||||
statement.setInt(1, IdFactory.getNextId());
|
||||
statement.setInt(1, IdManager.getInstance().getNextId());
|
||||
statement.setInt(2, _id);
|
||||
statement.setInt(3, bidder.getClanId());
|
||||
statement.setString(4, bidder.getName());
|
||||
|
@@ -23,7 +23,7 @@ import java.util.Calendar;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
/**
|
||||
@@ -90,7 +90,7 @@ public class Wedding
|
||||
try (Connection con = DatabaseFactory.getConnection())
|
||||
{
|
||||
PreparedStatement statement;
|
||||
_Id = IdFactory.getNextId();
|
||||
_Id = IdManager.getInstance().getNextId();
|
||||
statement = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)");
|
||||
statement.setInt(1, _Id);
|
||||
statement.setInt(2, _player1Id);
|
||||
|
@@ -35,7 +35,7 @@ import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
|
||||
import org.l2jmobius.gameserver.model.zone.type.DerbyTrackZone;
|
||||
@@ -327,7 +327,7 @@ public class MonsterRace
|
||||
{
|
||||
final NpcTemplate template = NpcTable.getInstance().getTemplate(_npcTemplates.get(i));
|
||||
_constructor = Class.forName("org.l2jmobius.gameserver.model.actor.instance." + template.getType() + "Instance").getConstructors()[0];
|
||||
final int objectId = IdFactory.getNextId();
|
||||
final int objectId = IdManager.getInstance().getNextId();
|
||||
_monsters[i] = (NpcInstance) _constructor.newInstance(objectId, template);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@@ -29,10 +29,10 @@ import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.datatables.sql.ClanTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.enums.TeleportWhereType;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.FortSiegeGuardManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.FortSiegeManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.FortSiegeManager.SiegeSpawn;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.MercTicketManager;
|
||||
import org.l2jmobius.gameserver.model.SiegeClan;
|
||||
import org.l2jmobius.gameserver.model.SiegeClan.SiegeClanType;
|
||||
@@ -1299,7 +1299,7 @@ public class FortSiege
|
||||
for (SiegeSpawn _sp : FortSiegeManager.getInstance().getCommanderSpawnList(id))
|
||||
{
|
||||
CommanderInstance commander;
|
||||
commander = new CommanderInstance(IdFactory.getNextId(), NpcTable.getInstance().getTemplate(_sp.getNpcId()));
|
||||
commander = new CommanderInstance(IdManager.getInstance().getNextId(), NpcTable.getInstance().getTemplate(_sp.getNpcId()));
|
||||
commander.setCurrentHpMp(commander.getMaxHp(), commander.getMaxMp());
|
||||
commander.setHeading(_sp.getLocation().getHeading());
|
||||
commander.spawnMe(_sp.getLocation().getX(), _sp.getLocation().getY(), _sp.getLocation().getZ() + 50);
|
||||
@@ -1321,7 +1321,7 @@ public class FortSiege
|
||||
for (SiegeSpawn _sp : FortSiegeManager.getInstance().getFlagList(id))
|
||||
{
|
||||
ArtefactInstance combatflag;
|
||||
combatflag = new ArtefactInstance(IdFactory.getNextId(), NpcTable.getInstance().getTemplate(_sp.getNpcId()));
|
||||
combatflag = new ArtefactInstance(IdManager.getInstance().getNextId(), NpcTable.getInstance().getTemplate(_sp.getNpcId()));
|
||||
combatflag.setCurrentHpMp(combatflag.getMaxHp(), combatflag.getMaxMp());
|
||||
combatflag.setHeading(_sp.getLocation().getHeading());
|
||||
combatflag.spawnMe(_sp.getLocation().getX(), _sp.getLocation().getY(), _sp.getLocation().getZ() + 10);
|
||||
|
@@ -31,7 +31,7 @@ import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.datatables.sql.ClanTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.enums.TeleportWhereType;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.MercTicketManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.SiegeGuardManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.SiegeManager;
|
||||
@@ -1518,7 +1518,7 @@ public class Siege
|
||||
for (SiegeSpawn _sp : SiegeManager.getInstance().getArtefactSpawnList(id))
|
||||
{
|
||||
ArtefactInstance art;
|
||||
art = new ArtefactInstance(IdFactory.getNextId(), NpcTable.getInstance().getTemplate(_sp.getNpcId()));
|
||||
art = new ArtefactInstance(IdManager.getInstance().getNextId(), NpcTable.getInstance().getTemplate(_sp.getNpcId()));
|
||||
art.setCurrentHpMp(art.getMaxHp(), art.getMaxMp());
|
||||
art.setHeading(_sp.getLocation().getHeading());
|
||||
art.spawnMe(_sp.getLocation().getX(), _sp.getLocation().getY(), _sp.getLocation().getZ() + 50);
|
||||
@@ -1544,7 +1544,7 @@ public class Siege
|
||||
|
||||
final NpcTemplate template = NpcTable.getInstance().getTemplate(_sp.getNpcId());
|
||||
template.getStatSet().set("baseHpMax", _sp.getHp());
|
||||
ct = new ControlTowerInstance(IdFactory.getNextId(), template);
|
||||
ct = new ControlTowerInstance(IdManager.getInstance().getNextId(), template);
|
||||
ct.setCurrentHpMp(ct.getMaxHp(), ct.getMaxMp());
|
||||
ct.spawnMe(_sp.getLocation().getX(), _sp.getLocation().getY(), _sp.getLocation().getZ() + 20);
|
||||
_controlTowerCount++;
|
||||
|
@@ -29,8 +29,8 @@ import org.l2jmobius.gameserver.datatables.sql.ClanTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.datatables.xml.DoorData;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.ClanHallManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.DecoInstance;
|
||||
@@ -274,7 +274,7 @@ public class BanditStrongholdSiege extends ClanHallSiege
|
||||
continue;
|
||||
}
|
||||
template = NpcTable.getInstance().getTemplate(35427 + mobCounter);
|
||||
final MonsterInstance questMob = new MonsterInstance(IdFactory.getNextId(), template);
|
||||
final MonsterInstance questMob = new MonsterInstance(IdManager.getInstance().getNextId(), template);
|
||||
questMob.setHeading(100);
|
||||
questMob.getStatus().setCurrentHpMp(questMob.getMaxHp(), questMob.getMaxMp());
|
||||
if (mobCounter == 1)
|
||||
@@ -321,7 +321,7 @@ public class BanditStrongholdSiege extends ClanHallSiege
|
||||
{
|
||||
template = NpcTable.getInstance().getTemplate(35422 + flagCounter);
|
||||
}
|
||||
final DecoInstance flag = new DecoInstance(IdFactory.getNextId(), template);
|
||||
final DecoInstance flag = new DecoInstance(IdManager.getInstance().getNextId(), template);
|
||||
flag.setTitle(clan.getName());
|
||||
flag.setHeading(100);
|
||||
flag.getStatus().setCurrentHpMp(flag.getMaxHp(), flag.getMaxMp());
|
||||
|
@@ -29,8 +29,8 @@ import org.l2jmobius.gameserver.datatables.sql.ClanTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.datatables.xml.DoorData;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.ClanHallManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.DecoInstance;
|
||||
@@ -263,7 +263,7 @@ public class WildBeastFarmSiege extends ClanHallSiege
|
||||
NpcTemplate template;
|
||||
final Clan clan = ClanTable.getInstance().getClanByName(clanName);
|
||||
template = NpcTable.getInstance().getTemplate(35617 + mobCounter);
|
||||
final MonsterInstance questMob = new MonsterInstance(IdFactory.getNextId(), template);
|
||||
final MonsterInstance questMob = new MonsterInstance(IdManager.getInstance().getNextId(), template);
|
||||
questMob.setHeading(100);
|
||||
questMob.getStatus().setCurrentHpMp(questMob.getMaxHp(), questMob.getMaxMp());
|
||||
if (mobCounter == 1)
|
||||
@@ -310,7 +310,7 @@ public class WildBeastFarmSiege extends ClanHallSiege
|
||||
{
|
||||
template = NpcTable.getInstance().getTemplate(35422 + flagCounter);
|
||||
}
|
||||
final DecoInstance flag = new DecoInstance(IdFactory.getNextId(), template);
|
||||
final DecoInstance flag = new DecoInstance(IdManager.getInstance().getNextId(), template);
|
||||
flag.setTitle(clan.getName());
|
||||
flag.setHeading(100);
|
||||
flag.getStatus().setCurrentHpMp(flag.getMaxHp(), flag.getMaxMp());
|
||||
|
@@ -21,7 +21,7 @@ import java.util.List;
|
||||
|
||||
import org.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.Effect;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Skill;
|
||||
@@ -72,7 +72,7 @@ public class EffectSignetMDam extends Effect
|
||||
return;
|
||||
}
|
||||
|
||||
final EffectPointInstance effectPoint = new EffectPointInstance(IdFactory.getNextId(), template, getEffector());
|
||||
final EffectPointInstance effectPoint = new EffectPointInstance(IdManager.getInstance().getNextId(), template, getEffector());
|
||||
effectPoint.getStatus().setCurrentHp(effectPoint.getMaxHp());
|
||||
effectPoint.getStatus().setCurrentMp(effectPoint.getMaxMp());
|
||||
|
||||
|
@@ -17,7 +17,7 @@
|
||||
package org.l2jmobius.gameserver.model.skills.handlers;
|
||||
|
||||
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.Skill;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
@@ -49,7 +49,7 @@ public class SkillSignet extends Skill
|
||||
}
|
||||
|
||||
final NpcTemplate template = NpcTable.getInstance().getTemplate(_effectNpcId);
|
||||
final EffectPointInstance effectPoint = new EffectPointInstance(IdFactory.getNextId(), template, caster);
|
||||
final EffectPointInstance effectPoint = new EffectPointInstance(IdManager.getInstance().getNextId(), template, caster);
|
||||
effectPoint.getStatus().setCurrentHp(effectPoint.getMaxHp());
|
||||
effectPoint.getStatus().setCurrentMp(effectPoint.getMaxMp());
|
||||
World.getInstance().storeObject(effectPoint);
|
||||
|
@@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.model.skills.handlers;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.datatables.xml.ExperienceData;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.Skill;
|
||||
import org.l2jmobius.gameserver.model.StatSet;
|
||||
import org.l2jmobius.gameserver.model.World;
|
||||
@@ -206,11 +206,11 @@ public class SkillSummon extends Skill
|
||||
}
|
||||
if (summonTemplate.getType().equalsIgnoreCase("SiegeSummon"))
|
||||
{
|
||||
summon = new SiegeSummonInstance(IdFactory.getNextId(), summonTemplate, activeChar, this);
|
||||
summon = new SiegeSummonInstance(IdManager.getInstance().getNextId(), summonTemplate, activeChar, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
summon = new SummonInstance(IdFactory.getNextId(), summonTemplate, activeChar, this);
|
||||
summon = new SummonInstance(IdManager.getInstance().getNextId(), summonTemplate, activeChar, this);
|
||||
}
|
||||
|
||||
summon.setName(summonTemplate.getName());
|
||||
|
@@ -34,7 +34,7 @@ import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.SpawnTable;
|
||||
import org.l2jmobius.gameserver.datatables.xml.MapRegionData;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
|
||||
@@ -140,7 +140,7 @@ public class AutoSpawn
|
||||
}
|
||||
}
|
||||
|
||||
final int newId = IdFactory.getNextId();
|
||||
final int newId = IdManager.getInstance().getNextId();
|
||||
newSpawn._objectId = newId;
|
||||
|
||||
synchronized (_registeredSpawns)
|
||||
|
@@ -20,7 +20,7 @@ import java.lang.reflect.Constructor;
|
||||
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.datatables.sql.TerritoryTable;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
|
||||
|
||||
@@ -53,7 +53,7 @@ public class GroupSpawn extends Spawn
|
||||
|
||||
final Object[] parameters =
|
||||
{
|
||||
IdFactory.getNextId(),
|
||||
IdManager.getInstance().getNextId(),
|
||||
_template
|
||||
};
|
||||
final Object tmp = _constructor.newInstance(parameters);
|
||||
|
@@ -24,7 +24,7 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.datatables.sql.TerritoryTable;
|
||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
|
||||
@@ -384,7 +384,7 @@ public class Spawn
|
||||
// Get NpcInstance Init parameters and its generate an Identifier
|
||||
final Object[] parameters =
|
||||
{
|
||||
IdFactory.getNextId(),
|
||||
IdManager.getInstance().getNextId(),
|
||||
_template
|
||||
};
|
||||
|
||||
|
@@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.model.zone;
|
||||
import java.awt.geom.Line2D;
|
||||
|
||||
import org.l2jmobius.gameserver.datatables.xml.ZoneData;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
|
||||
/**
|
||||
@@ -92,7 +92,7 @@ public abstract class ZoneForm
|
||||
|
||||
protected static final void dropDebugItem(int id, int x, int y, int z)
|
||||
{
|
||||
final ItemInstance item = new ItemInstance(IdFactory.getNextId(), 57);
|
||||
final ItemInstance item = new ItemInstance(IdManager.getInstance().getNextId(), 57);
|
||||
item.setCount(id);
|
||||
item.spawnMe(x, y, z + 5);
|
||||
ZoneData.getInstance().addDebugItem(item);
|
||||
|
@@ -28,7 +28,7 @@ import org.l2jmobius.gameserver.datatables.sql.CharNameTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.SkillTreeTable;
|
||||
import org.l2jmobius.gameserver.datatables.xml.ExperienceData;
|
||||
import org.l2jmobius.gameserver.datatables.xml.PlayerTemplateData;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.instancemanager.QuestManager;
|
||||
import org.l2jmobius.gameserver.model.ShortCut;
|
||||
import org.l2jmobius.gameserver.model.SkillLearn;
|
||||
@@ -122,7 +122,7 @@ public class CharacterCreate extends GameClientPacket
|
||||
return;
|
||||
}
|
||||
|
||||
final int objectId = IdFactory.getNextId();
|
||||
final int objectId = IdManager.getInstance().getNextId();
|
||||
newChar = PlayerInstance.create(objectId, template, getClient().getAccountName(), _name, _hairStyle, _hairColor, _face, _sex != 0);
|
||||
newChar.setCurrentHp(newChar.getMaxHp()); // L2Off like
|
||||
// newChar.setCurrentCp(template.baseCpMax);
|
||||
|
@@ -23,7 +23,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.cache.CrestCache;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
@@ -98,7 +98,7 @@ public class RequestExSetPledgeCrestLarge extends GameClientPacket
|
||||
}
|
||||
|
||||
final CrestCache crestCache = CrestCache.getInstance();
|
||||
final int newId = IdFactory.getNextId();
|
||||
final int newId = IdManager.getInstance().getNextId();
|
||||
if (!crestCache.savePledgeCrestLarge(newId, _data))
|
||||
{
|
||||
LOGGER.warning("Error loading large crest of clan:" + clan.getName());
|
||||
|
@@ -24,7 +24,7 @@ import java.util.logging.Logger;
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.cache.CrestCache;
|
||||
import org.l2jmobius.gameserver.datatables.sql.ClanTable;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
|
||||
@@ -78,7 +78,7 @@ public class RequestSetAllyCrest extends GameClientPacket
|
||||
}
|
||||
|
||||
final CrestCache crestCache = CrestCache.getInstance();
|
||||
final int newId = IdFactory.getNextId();
|
||||
final int newId = IdManager.getInstance().getNextId();
|
||||
if (!crestCache.saveAllyCrest(newId, _data))
|
||||
{
|
||||
LOGGER.warning("Error loading crest of ally:" + leaderclan.getAllyName());
|
||||
|
@@ -23,7 +23,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.cache.CrestCache;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.clan.Clan;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
@@ -105,7 +105,7 @@ public class RequestSetPledgeCrest extends GameClientPacket
|
||||
}
|
||||
|
||||
final CrestCache crestCache = CrestCache.getInstance();
|
||||
final int newId = IdFactory.getNextId();
|
||||
final int newId = IdManager.getInstance().getNextId();
|
||||
if (clan.hasCrest())
|
||||
{
|
||||
crestCache.removePledgeCrest(newId);
|
||||
|
@@ -27,7 +27,7 @@ import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import org.l2jmobius.gameserver.instancemanager.IdManager;
|
||||
import org.l2jmobius.gameserver.model.MinionData;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.MinionInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
|
||||
@@ -198,7 +198,7 @@ public class MinionList
|
||||
* <li>Set the Minion HP, MP and Heading</li>
|
||||
* <li>Set the Minion leader to this RaidBoss</li>
|
||||
* <li>Init the position of the Minion and add it in the world as a visible object</li><br>
|
||||
* @param minionid The I2NpcTemplate Identifier of the Minion to spawn
|
||||
* @param minionid The NpcTemplate Identifier of the Minion to spawn
|
||||
*/
|
||||
public void spawnSingleMinion(int minionid)
|
||||
{
|
||||
@@ -206,7 +206,7 @@ public class MinionList
|
||||
final NpcTemplate minionTemplate = NpcTable.getInstance().getTemplate(minionid);
|
||||
|
||||
// Create and Init the Minion and generate its Identifier
|
||||
final MinionInstance monster = new MinionInstance(IdFactory.getNextId(), minionTemplate);
|
||||
final MinionInstance monster = new MinionInstance(IdManager.getInstance().getNextId(), minionTemplate);
|
||||
|
||||
// Set the Minion HP, MP and Heading
|
||||
monster.setCurrentHpMp(monster.getMaxHp(), monster.getMaxMp());
|
||||
|
Reference in New Issue
Block a user