Respawn rework and various changes.
This commit is contained in:
@ -761,9 +761,11 @@ public class L2CharacterAI extends AbstractAI
|
||||
// Stop an AI Follow Task
|
||||
stopFollow();
|
||||
}
|
||||
|
||||
// Stop any intention that has target we want to forget.
|
||||
setIntention(AI_INTENTION_ACTIVE);
|
||||
if (getIntention() != AI_INTENTION_MOVE_TO)
|
||||
{
|
||||
setIntention(AI_INTENTION_ACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the targeted object was the actor
|
||||
|
@ -235,7 +235,7 @@ public class ItemTable
|
||||
}
|
||||
|
||||
// Add the L2ItemInstance object to _allObjects of L2world
|
||||
L2World.getInstance().storeObject(item);
|
||||
L2World.getInstance().addObject(item);
|
||||
|
||||
// Set Item parameters
|
||||
if (item.isStackable() && (count > 1))
|
||||
|
@ -103,7 +103,7 @@ public final class ItemsOnGroundManager implements Runnable
|
||||
while (rs.next())
|
||||
{
|
||||
item = new L2ItemInstance(rs.getInt(1), rs.getInt(2));
|
||||
L2World.getInstance().storeObject(item);
|
||||
L2World.getInstance().addObject(item);
|
||||
// this check and..
|
||||
if (item.isStackable() && (rs.getInt(3) > 1))
|
||||
{
|
||||
|
@ -80,7 +80,7 @@ public final class SiegeGuardManager
|
||||
final L2ItemInstance dropticket = new L2ItemInstance(holder.getItemId());
|
||||
dropticket.setItemLocation(ItemLocation.VOID);
|
||||
dropticket.dropMe(null, x, y, z);
|
||||
L2World.getInstance().storeObject(dropticket);
|
||||
L2World.getInstance().addObject(dropticket);
|
||||
_droppedTickets.add(dropticket);
|
||||
}
|
||||
}
|
||||
@ -180,7 +180,7 @@ public final class SiegeGuardManager
|
||||
final L2ItemInstance dropticket = new L2ItemInstance(itemId);
|
||||
dropticket.setItemLocation(ItemLocation.VOID);
|
||||
dropticket.dropMe(null, player.getX(), player.getY(), player.getZ());
|
||||
L2World.getInstance().storeObject(dropticket);
|
||||
L2World.getInstance().addObject(dropticket);
|
||||
_droppedTickets.add(dropticket);
|
||||
}
|
||||
}
|
||||
|
@ -760,7 +760,15 @@ public final class ZoneManager implements IGameXmlReader
|
||||
|
||||
public ZoneRegion getRegion(int x, int y)
|
||||
{
|
||||
return _zoneRegions[(x >> SHIFT_BY) + OFFSET_X][(y >> SHIFT_BY) + OFFSET_Y];
|
||||
try
|
||||
{
|
||||
return _zoneRegions[(x >> SHIFT_BY) + OFFSET_X][(y >> SHIFT_BY) + OFFSET_Y];
|
||||
}
|
||||
catch (ArrayIndexOutOfBoundsException e)
|
||||
{
|
||||
// LOGGER.warning(getClass().getSimpleName() + ": Incorrect zone region X: " + ((x >> SHIFT_BY) + OFFSET_X) + " Y: " + ((y >> SHIFT_BY) + OFFSET_Y) + " for coordinates x: " + x + " y: " + y);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public ZoneRegion getRegion(ILocational point)
|
||||
|
@ -196,7 +196,6 @@ public class CursedWeapon implements INamable
|
||||
else if (_item != null)
|
||||
{
|
||||
_item.decayMe();
|
||||
L2World.getInstance().removeObject(_item);
|
||||
_log.info(_name + " item has been removed from World.");
|
||||
}
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
|
||||
setWorldRegion(L2World.getInstance().getRegion(getLocation()));
|
||||
|
||||
// Add the L2Object spawn in the _allobjects of L2World
|
||||
L2World.getInstance().storeObject(this);
|
||||
L2World.getInstance().addObject(this);
|
||||
|
||||
// Add the L2Object spawn to _visibleObjects and if necessary to _allplayers of its L2WorldRegion
|
||||
getWorldRegion().addVisibleObject(this);
|
||||
@ -519,19 +519,6 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
|
||||
|
||||
}
|
||||
|
||||
protected void badCoords()
|
||||
{
|
||||
if (isCharacter())
|
||||
{
|
||||
decayMe();
|
||||
}
|
||||
else if (isPlayer())
|
||||
{
|
||||
((L2Character) this).teleToLocation(new Location(0, 0, 0), false);
|
||||
((L2Character) this).sendMessage("Error with your coords, Please ask a GM for help!");
|
||||
}
|
||||
}
|
||||
|
||||
public final void setXYZInvisible(int x, int y, int z)
|
||||
{
|
||||
if (x > L2World.MAP_MAX_X)
|
||||
@ -691,28 +678,21 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
|
||||
setY(newY);
|
||||
setZ(newZ);
|
||||
|
||||
try
|
||||
if (_isSpawned)
|
||||
{
|
||||
if (_isSpawned)
|
||||
final L2WorldRegion oldRegion = getWorldRegion();
|
||||
final L2WorldRegion newRegion = L2World.getInstance().getRegion(this);
|
||||
if (newRegion != oldRegion)
|
||||
{
|
||||
final L2WorldRegion oldRegion = getWorldRegion();
|
||||
final L2WorldRegion newRegion = L2World.getInstance().getRegion(this);
|
||||
if (newRegion != oldRegion)
|
||||
if (oldRegion != null)
|
||||
{
|
||||
if (oldRegion != null)
|
||||
{
|
||||
oldRegion.removeVisibleObject(this);
|
||||
}
|
||||
newRegion.addVisibleObject(this);
|
||||
L2World.getInstance().switchRegion(this, newRegion);
|
||||
setWorldRegion(newRegion);
|
||||
oldRegion.removeVisibleObject(this);
|
||||
}
|
||||
newRegion.addVisibleObject(this);
|
||||
L2World.getInstance().switchRegion(this, newRegion);
|
||||
setWorldRegion(newRegion);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
badCoords();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,7 +31,6 @@ import com.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2NpcInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
|
||||
import com.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import com.l2jmobius.gameserver.model.interfaces.IIdentifiable;
|
||||
import com.l2jmobius.gameserver.model.interfaces.ILocational;
|
||||
import com.l2jmobius.gameserver.model.interfaces.INamable;
|
||||
@ -81,11 +80,8 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
|
||||
/** The task launching the function doSpawn() */
|
||||
class SpawnTask implements Runnable
|
||||
{
|
||||
private final L2Npc _oldNpc;
|
||||
|
||||
public SpawnTask(L2Npc pOldNpc)
|
||||
public SpawnTask()
|
||||
{
|
||||
_oldNpc = pOldNpc;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -93,8 +89,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
|
||||
{
|
||||
try
|
||||
{
|
||||
// doSpawn();
|
||||
respawnNpc(_oldNpc);
|
||||
doSpawn();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -401,8 +396,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
|
||||
_scheduledCount++;
|
||||
|
||||
// Create a new SpawnTask to launch after the respawn Delay
|
||||
// ClientScheduler.getInstance().scheduleLow(new SpawnTask(npcId), _respawnDelay);
|
||||
ThreadPoolManager.schedule(new SpawnTask(oldNpc), hasRespawnRandom() ? Rnd.get(_respawnMinDelay, _respawnMaxDelay) : _respawnMinDelay);
|
||||
ThreadPoolManager.schedule(new SpawnTask(), hasRespawnRandom() ? Rnd.get(_respawnMinDelay, _respawnMaxDelay) : _respawnMinDelay);
|
||||
}
|
||||
}
|
||||
|
||||
@ -489,7 +483,6 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
|
||||
if (_template.isType("L2Pet") || _template.isType("L2Decoy") || _template.isType("L2Trap"))
|
||||
{
|
||||
_currentCount++;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -558,7 +551,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
|
||||
}
|
||||
|
||||
// DO NOT CORRECT SPAWN Z IN GENERAL - Prevent NPC spawns on top of buildings
|
||||
// don't correct z of flying npc's
|
||||
// don't correct z of flying NPCs
|
||||
// if (!npc.isFlying())
|
||||
// {
|
||||
// newlocz = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
|
||||
@ -669,25 +662,6 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
|
||||
return _spawnedNpcs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param oldNpc
|
||||
*/
|
||||
public void respawnNpc(L2Npc oldNpc)
|
||||
{
|
||||
if (_doRespawn)
|
||||
{
|
||||
oldNpc.refreshID();
|
||||
initializeNpcInstance(oldNpc);
|
||||
|
||||
// Register NPC back to instance world
|
||||
final Instance instance = oldNpc.getInstanceWorld();
|
||||
if (instance != null)
|
||||
{
|
||||
instance.addNpc(oldNpc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public L2NpcTemplate getTemplate()
|
||||
{
|
||||
return _template;
|
||||
|
@ -27,6 +27,7 @@ import java.util.function.Predicate;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.util.CommonUtil;
|
||||
import com.l2jmobius.gameserver.ai.CtrlEvent;
|
||||
import com.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import com.l2jmobius.gameserver.ai.L2CharacterAI;
|
||||
@ -43,7 +44,7 @@ import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
public final class L2World
|
||||
{
|
||||
private static final Logger _log = Logger.getLogger(L2World.class.getName());
|
||||
private static final Logger LOGGER = Logger.getLogger(L2World.class.getName());
|
||||
/** Gracia border Flying objects not allowed to the east of it. */
|
||||
public static final int GRACIA_MAX_X = -166168;
|
||||
public static final int GRACIA_MAX_Z = 6105;
|
||||
@ -90,8 +91,6 @@ public final class L2World
|
||||
private static final Map<Integer, L2PcInstance> _allEvilPlayers = new ConcurrentHashMap<>();
|
||||
/** Map containing all visible objects. */
|
||||
private final Map<Integer, L2Object> _allObjects = new ConcurrentHashMap<>();
|
||||
/** Map used for debug. */
|
||||
// private final Map<Integer, String> _allObjectsDebug = new ConcurrentHashMap<>();
|
||||
/** Map with the pets instances and their owner ID. */
|
||||
private final Map<Integer, L2PetInstance> _petsInstance = new ConcurrentHashMap<>();
|
||||
|
||||
@ -114,7 +113,7 @@ public final class L2World
|
||||
}
|
||||
}
|
||||
|
||||
_log.info(getClass().getSimpleName() + ": (" + REGIONS_X + " by " + REGIONS_Y + " by " + REGIONS_Z + ") World Region Grid set up.");
|
||||
LOGGER.info(getClass().getSimpleName() + ": (" + REGIONS_X + " by " + REGIONS_Y + " by " + REGIONS_Z + ") World Region Grid set up.");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -126,20 +125,33 @@ public final class L2World
|
||||
* </ul>
|
||||
* @param object
|
||||
*/
|
||||
public void storeObject(L2Object object)
|
||||
public void addObject(L2Object object)
|
||||
{
|
||||
if (_allObjects.containsKey(object.getObjectId()))
|
||||
if (_allObjects.putIfAbsent(object.getObjectId(), object) != null)
|
||||
{
|
||||
// _log.warning(getClass().getSimpleName() + ": Current object: " + object + " already exist in OID map!");
|
||||
// _log.warning(CommonUtil.getTraceString(Thread.currentThread().getStackTrace()));
|
||||
// _log.warning(getClass().getSimpleName() + ": Previous object: " + _allObjects.get(object.getObjectId()) + " already exist in OID map!");
|
||||
// _log.warning(_allObjectsDebug.get(object.getObjectId()));
|
||||
// _log.warning("---------------------- End ---------------------");
|
||||
return;
|
||||
LOGGER.warning(getClass().getSimpleName() + ": Object " + object + " already exists in the world. Stack Trace: " + CommonUtil.getTraceString(Thread.currentThread().getStackTrace()));
|
||||
}
|
||||
|
||||
_allObjects.put(object.getObjectId(), object);
|
||||
// _allObjectsDebug.put(object.getObjectId(), CommonUtil.getTraceString(Thread.currentThread().getStackTrace()));
|
||||
if (object.isPlayer())
|
||||
{
|
||||
final L2PcInstance newPlayer = (L2PcInstance) object;
|
||||
if (newPlayer.isTeleporting()) // TODO: drop when we stop removing player from the world while teleporting.
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final L2PcInstance existingPlayer = _allPlayers.putIfAbsent(object.getObjectId(), newPlayer);
|
||||
if (existingPlayer != null)
|
||||
{
|
||||
existingPlayer.logout();
|
||||
newPlayer.logout();
|
||||
LOGGER.warning(getClass().getSimpleName() + ": Duplicate character!? Disconnected both characters (" + newPlayer.getName() + ")");
|
||||
}
|
||||
else if (Config.FACTION_SYSTEM_ENABLED)
|
||||
{
|
||||
addFactionPlayerToWorld(existingPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -155,7 +167,27 @@ public final class L2World
|
||||
public void removeObject(L2Object object)
|
||||
{
|
||||
_allObjects.remove(object.getObjectId());
|
||||
// _allObjectsDebug.remove(object.getObjectId());
|
||||
if (object.isPlayer())
|
||||
{
|
||||
final L2PcInstance player = (L2PcInstance) object;
|
||||
if (player.isTeleporting()) // TODO: drop when we stop removing player from the world while teleportingq.
|
||||
{
|
||||
return;
|
||||
}
|
||||
_allPlayers.remove(object.getObjectId());
|
||||
|
||||
if (Config.FACTION_SYSTEM_ENABLED)
|
||||
{
|
||||
if (player.isGood())
|
||||
{
|
||||
_allGoodPlayers.remove(player.getObjectId());
|
||||
}
|
||||
else if (player.isEvil())
|
||||
{
|
||||
_allEvilPlayers.remove(player.getObjectId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -248,15 +280,6 @@ public final class L2World
|
||||
_petsInstance.remove(ownerId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the given pet instance.
|
||||
* @param pet the pet to remove
|
||||
*/
|
||||
public void removePet(L2PetInstance pet)
|
||||
{
|
||||
_petsInstance.remove(pet.getOwner().getObjectId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a L2Object in the world. <B><U> Concept</U> :</B> L2Object (including PlayerInstance) are identified in <B>_visibleObjects</B> of his current WorldRegion and in <B>_knownObjects</B> of other surrounding L2Characters <BR>
|
||||
* PlayerInstance are identified in <B>_allPlayers</B> of L2World, in <B>_allPlayers</B> of his current WorldRegion and in <B>_knownPlayer</B> of other surrounding L2Characters <B><U> Actions</U> :</B>
|
||||
@ -275,24 +298,6 @@ public final class L2World
|
||||
*/
|
||||
public void addVisibleObject(L2Object object, L2WorldRegion newRegion)
|
||||
{
|
||||
// TODO: this code should be obsoleted by protection in putObject func...
|
||||
if (object.isPlayer())
|
||||
{
|
||||
final L2PcInstance player = object.getActingPlayer();
|
||||
if (!player.isTeleporting())
|
||||
{
|
||||
final L2PcInstance old = getPlayer(player.getObjectId());
|
||||
if (old != null)
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": Duplicate character!? Closing both characters (" + player.getName() + ")");
|
||||
player.logout();
|
||||
old.logout();
|
||||
return;
|
||||
}
|
||||
addPlayerToWorld(player);
|
||||
}
|
||||
}
|
||||
|
||||
if (!newRegion.isActive())
|
||||
{
|
||||
return;
|
||||
@ -352,41 +357,6 @@ public final class L2World
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the player to the world.
|
||||
* @param player the player to add
|
||||
*/
|
||||
public void addPlayerToWorld(L2PcInstance player)
|
||||
{
|
||||
_allPlayers.put(player.getObjectId(), player);
|
||||
|
||||
if (Config.FACTION_SYSTEM_ENABLED)
|
||||
{
|
||||
addFactionPlayerToWorld(player);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the player from the world.
|
||||
* @param player the player to remove
|
||||
*/
|
||||
public void removeFromAllPlayers(L2PcInstance player)
|
||||
{
|
||||
_allPlayers.remove(player.getObjectId());
|
||||
|
||||
if (Config.FACTION_SYSTEM_ENABLED)
|
||||
{
|
||||
if (player.isGood())
|
||||
{
|
||||
_allGoodPlayers.remove(player.getObjectId());
|
||||
}
|
||||
else if (player.isEvil())
|
||||
{
|
||||
_allEvilPlayers.remove(player.getObjectId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void addFactionPlayerToWorld(L2PcInstance player)
|
||||
{
|
||||
if (player.isGood())
|
||||
@ -476,15 +446,6 @@ public final class L2World
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
if (object.isPlayer())
|
||||
{
|
||||
final L2PcInstance player = object.getActingPlayer();
|
||||
if (!player.isTeleporting())
|
||||
{
|
||||
removeFromAllPlayers(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -804,7 +765,7 @@ public final class L2World
|
||||
*/
|
||||
public void deleteVisibleNpcSpawns()
|
||||
{
|
||||
_log.info(getClass().getSimpleName() + ": Deleting all visible NPC's.");
|
||||
LOGGER.info(getClass().getSimpleName() + ": Deleting all visible NPCs.");
|
||||
for (int x = 0; x <= REGIONS_X; x++)
|
||||
{
|
||||
for (int y = 0; y <= REGIONS_Y; y++)
|
||||
@ -815,7 +776,7 @@ public final class L2World
|
||||
}
|
||||
}
|
||||
}
|
||||
_log.info(getClass().getSimpleName() + ": All visible NPC's deleted.");
|
||||
LOGGER.info(getClass().getSimpleName() + ": All visible NPCs deleted.");
|
||||
}
|
||||
|
||||
public void incrementParty()
|
||||
|
@ -16,7 +16,6 @@
|
||||
*/
|
||||
package com.l2jmobius.gameserver.model;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@ -33,7 +32,7 @@ import com.l2jmobius.gameserver.model.actor.L2Vehicle;
|
||||
|
||||
public final class L2WorldRegion
|
||||
{
|
||||
private static final Logger _log = Logger.getLogger(L2WorldRegion.class.getName());
|
||||
private static final Logger LOGGER = Logger.getLogger(L2WorldRegion.class.getName());
|
||||
|
||||
/** Map containing visible objects in this world region. */
|
||||
private volatile Map<Integer, L2Object> _visibleObjects;
|
||||
@ -66,33 +65,14 @@ public final class L2WorldRegion
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (_isActivating)
|
||||
forEachSurroundingRegion(w ->
|
||||
{
|
||||
// for each neighbor, if it's not active, activate.
|
||||
forEachSurroundingRegion(w ->
|
||||
if (_isActivating || w.areNeighborsEmpty())
|
||||
{
|
||||
w.setActive(true);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
if (areNeighborsEmpty())
|
||||
{
|
||||
setActive(false);
|
||||
w.setActive(_isActivating);
|
||||
}
|
||||
|
||||
// check and deactivate
|
||||
forEachSurroundingRegion(w ->
|
||||
{
|
||||
if (w.areNeighborsEmpty())
|
||||
{
|
||||
w.setActive(false);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,8 +86,7 @@ public final class L2WorldRegion
|
||||
int c = 0;
|
||||
if (!isOn)
|
||||
{
|
||||
final Collection<L2Object> vObj = _visibleObjects.values();
|
||||
for (L2Object o : vObj)
|
||||
for (L2Object o : _visibleObjects.values())
|
||||
{
|
||||
if (o instanceof L2Attackable)
|
||||
{
|
||||
@ -138,14 +117,11 @@ public final class L2WorldRegion
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
||||
_log.finer(c + " mobs were turned off");
|
||||
LOGGER.finer(c + " mobs were turned off");
|
||||
}
|
||||
else
|
||||
{
|
||||
final Collection<L2Object> vObj = _visibleObjects.values();
|
||||
|
||||
for (L2Object o : vObj)
|
||||
for (L2Object o : _visibleObjects.values())
|
||||
{
|
||||
if (o instanceof L2Attackable)
|
||||
{
|
||||
@ -158,9 +134,7 @@ public final class L2WorldRegion
|
||||
((L2Npc) o).startRandomAnimationTask();
|
||||
}
|
||||
}
|
||||
|
||||
_log.finer(c + " mobs were turned on");
|
||||
|
||||
LOGGER.finer(c + " mobs were turned on");
|
||||
}
|
||||
|
||||
}
|
||||
@ -172,10 +146,7 @@ public final class L2WorldRegion
|
||||
|
||||
public boolean areNeighborsEmpty()
|
||||
{
|
||||
return forEachSurroundingRegion(w ->
|
||||
{
|
||||
return !(w.isActive() && w.getVisibleObjects().values().stream().anyMatch(L2Object::isPlayable));
|
||||
});
|
||||
return forEachSurroundingRegion(w -> !(w.isActive() && w.getVisibleObjects().values().stream().anyMatch(L2Object::isPlayable)));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -194,7 +165,7 @@ public final class L2WorldRegion
|
||||
// turn the AI on or off to match the region's activation.
|
||||
switchAI(value);
|
||||
|
||||
_log.finer((value ? "Starting" : "Stoping") + " Grid " + getName());
|
||||
LOGGER.finer((value ? "Starting" : "Stopping") + " Grid " + this);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -308,11 +279,6 @@ public final class L2WorldRegion
|
||||
return _visibleObjects != null ? _visibleObjects : Collections.emptyMap();
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return "(" + _regionX + ", " + _regionY + ", " + _regionZ + ")";
|
||||
}
|
||||
|
||||
/**
|
||||
* Deleted all spawns in the world.
|
||||
*/
|
||||
@ -323,10 +289,8 @@ public final class L2WorldRegion
|
||||
return;
|
||||
}
|
||||
|
||||
_log.finer("Deleting all visible NPC's in Region: " + getName());
|
||||
|
||||
final Collection<L2Object> vNPC = _visibleObjects.values();
|
||||
for (L2Object obj : vNPC)
|
||||
LOGGER.info("Deleting all visible NPCs in Region: " + this);
|
||||
for (L2Object obj : _visibleObjects.values())
|
||||
{
|
||||
if (obj instanceof L2Npc)
|
||||
{
|
||||
@ -338,10 +302,10 @@ public final class L2WorldRegion
|
||||
spawn.stopRespawn();
|
||||
SpawnTable.getInstance().deleteSpawn(spawn, false);
|
||||
}
|
||||
_log.finest("Removed NPC " + target.getObjectId());
|
||||
LOGGER.finest("Removed NPC " + target.getObjectId());
|
||||
}
|
||||
}
|
||||
_log.info("All visible NPC's deleted in Region: " + getName());
|
||||
LOGGER.info("All visible NPCs deleted in Region: " + this);
|
||||
}
|
||||
|
||||
public boolean forEachSurroundingRegion(Predicate<L2WorldRegion> p)
|
||||
@ -385,4 +349,10 @@ public final class L2WorldRegion
|
||||
{
|
||||
return (region != null) && (getRegionX() >= (region.getRegionX() - 1)) && (getRegionX() <= (region.getRegionX() + 1)) && (getRegionY() >= (region.getRegionY() - 1)) && (getRegionY() <= (region.getRegionY() + 1)) && (getRegionZ() >= (region.getRegionZ() - 1)) && (getRegionZ() <= (region.getRegionZ() + 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "(" + _regionX + ", " + _regionY + ", " + _regionZ + ")";
|
||||
}
|
||||
}
|
||||
|
@ -5110,19 +5110,12 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
|
||||
@Override
|
||||
public final void setXYZ(int newX, int newY, int newZ)
|
||||
{
|
||||
try
|
||||
final ZoneRegion oldZoneRegion = ZoneManager.getInstance().getRegion(this);
|
||||
final ZoneRegion newZoneRegion = ZoneManager.getInstance().getRegion(newX, newY);
|
||||
if (oldZoneRegion != newZoneRegion)
|
||||
{
|
||||
final ZoneRegion oldZoneRegion = ZoneManager.getInstance().getRegion(this);
|
||||
final ZoneRegion newZoneRegion = ZoneManager.getInstance().getRegion(newX, newY);
|
||||
if (oldZoneRegion != newZoneRegion)
|
||||
{
|
||||
oldZoneRegion.removeFromZones(this);
|
||||
newZoneRegion.revalidateZones(this);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
badCoords();
|
||||
oldZoneRegion.removeFromZones(this);
|
||||
newZoneRegion.revalidateZones(this);
|
||||
}
|
||||
|
||||
super.setXYZ(newX, newY, newZ);
|
||||
|
@ -1199,8 +1199,6 @@ public class L2Npc extends L2Character
|
||||
|
||||
ZoneManager.getInstance().getRegion(this).removeFromZones(this);
|
||||
|
||||
// Remove L2Object object from _allObjects of L2World
|
||||
L2World.getInstance().removeObject(this);
|
||||
return super.deleteMe();
|
||||
}
|
||||
|
||||
@ -1497,7 +1495,7 @@ public class L2Npc extends L2Character
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an "event" to all NPC's within given radius
|
||||
* Send an "event" to all NPCs within given radius
|
||||
* @param eventName - name of event
|
||||
* @param radius - radius to send event
|
||||
* @param reference - L2Object to pass, if needed
|
||||
|
@ -420,9 +420,6 @@ public abstract class L2Vehicle extends L2Character
|
||||
|
||||
oldZoneRegion.removeFromZones(this);
|
||||
|
||||
// Remove L2Object object from _allObjects of World
|
||||
L2World.getInstance().removeObject(this);
|
||||
|
||||
return super.deleteMe();
|
||||
}
|
||||
|
||||
|
@ -11093,10 +11093,6 @@ public final class L2PcInstance extends L2Playable
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerMentorStatus(this, false), this);
|
||||
}
|
||||
|
||||
// Remove L2Object object from _allObjects of L2World
|
||||
L2World.getInstance().removeObject(this);
|
||||
L2World.getInstance().removeFromAllPlayers(this); // force remove in case of crash during teleport
|
||||
|
||||
try
|
||||
{
|
||||
notifyFriends(L2FriendStatus.MODE_OFFLINE);
|
||||
@ -12304,10 +12300,6 @@ public final class L2PcInstance extends L2Playable
|
||||
|
||||
public void stopMovie()
|
||||
{
|
||||
setIsTeleporting(true, false); // avoid to get player removed from L2World
|
||||
decayMe();
|
||||
spawnMe(getX(), getY(), getZ());
|
||||
setIsTeleporting(false, false);
|
||||
sendPacket(new ExStopScenePlayer(getMovieHolder().getMovie()));
|
||||
setMovieHolder(null);
|
||||
}
|
||||
|
@ -780,8 +780,6 @@ public class L2PetInstance extends L2Summon
|
||||
|
||||
owner.sendInventoryUpdate(iu);
|
||||
owner.broadcastUserInfo();
|
||||
|
||||
L2World.getInstance().removeObject(removedItem);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -33,7 +33,6 @@ import com.l2jmobius.gameserver.enums.Team;
|
||||
import com.l2jmobius.gameserver.instancemanager.HandysBlockCheckerManager;
|
||||
import com.l2jmobius.gameserver.model.ArenaParticipantsHolder;
|
||||
import com.l2jmobius.gameserver.model.L2Spawn;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Summon;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2BlockInstance;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
@ -613,7 +612,6 @@ public final class BlockCheckerEngine
|
||||
}
|
||||
|
||||
item.decayMe();
|
||||
L2World.getInstance().removeObject(item);
|
||||
}
|
||||
_drops.clear();
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.interfaces.ILocational;
|
||||
|
||||
/**
|
||||
* Holds depending between NPC's spawn point and route
|
||||
* Holds depending between NPCs spawn point and route
|
||||
* @author GKR
|
||||
*/
|
||||
public final class NpcRoutesHolder
|
||||
|
@ -80,7 +80,7 @@ public final class AuctionItem
|
||||
public final L2ItemInstance createNewItemInstance()
|
||||
{
|
||||
final L2ItemInstance item = new L2ItemInstance(IdFactory.getInstance().getNextId(), _itemId);
|
||||
L2World.getInstance().storeObject(item);
|
||||
L2World.getInstance().addObject(item);
|
||||
item.setCount(_itemCount);
|
||||
item.setEnchantLevel(item.getItem().getDefaultEnchantLevel());
|
||||
return item;
|
||||
|
@ -1804,7 +1804,7 @@ public abstract class Inventory extends ItemContainer
|
||||
}
|
||||
}
|
||||
|
||||
L2World.getInstance().storeObject(item);
|
||||
L2World.getInstance().addObject(item);
|
||||
|
||||
// If stackable item is found in inventory just add to current quantity
|
||||
if (item.isStackable() && (getItemByItemId(item.getId()) != null))
|
||||
|
@ -525,8 +525,9 @@ public abstract class ItemContainer
|
||||
|
||||
item.updateDatabase();
|
||||
refreshWeight();
|
||||
|
||||
item.deleteMe();
|
||||
}
|
||||
item.deleteMe();
|
||||
}
|
||||
return item;
|
||||
}
|
||||
@ -682,7 +683,7 @@ public abstract class ItemContainer
|
||||
while (rs.next())
|
||||
{
|
||||
final L2ItemInstance item = new L2ItemInstance(rs);
|
||||
L2World.getInstance().storeObject(item);
|
||||
L2World.getInstance().addObject(item);
|
||||
|
||||
final L2PcInstance owner = getOwner() != null ? getOwner().getActingPlayer() : null;
|
||||
|
||||
|
@ -123,7 +123,7 @@ public class Mail extends ItemContainer
|
||||
while (inv.next())
|
||||
{
|
||||
final L2ItemInstance item = new L2ItemInstance(inv);
|
||||
L2World.getInstance().storeObject(item);
|
||||
L2World.getInstance().addObject(item);
|
||||
|
||||
// If stackable item is found just add to current quantity
|
||||
if (item.isStackable() && (getItemByItemId(item.getId()) != null))
|
||||
|
@ -1419,9 +1419,6 @@ public final class L2ItemInstance extends L2Object
|
||||
{
|
||||
player.getWarehouse().destroyItem("L2ItemInstance", this, player, null);
|
||||
}
|
||||
|
||||
// delete from world
|
||||
L2World.getInstance().removeObject(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1846,8 +1843,6 @@ public final class L2ItemInstance extends L2Object
|
||||
player.getWarehouse().destroyItem("L2ItemInstance", this, player, null);
|
||||
}
|
||||
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_EXPIRED).addItemName(getId()));
|
||||
// delete from world
|
||||
L2World.getInstance().removeObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ import com.l2jmobius.gameserver.util.Broadcast;
|
||||
|
||||
/**
|
||||
* Parent class for long time events.<br>
|
||||
* Maintains config reading, spawn of NPC's, adding of event's drop.
|
||||
* Maintains config reading, spawn of NPCs, adding of event's drop.
|
||||
* @author GKR
|
||||
*/
|
||||
public class LongTimeEvent extends Quest
|
||||
@ -58,7 +58,7 @@ public class LongTimeEvent extends Quest
|
||||
protected DateRange _eventPeriod = null;
|
||||
protected DateRange _dropPeriod;
|
||||
|
||||
// NPC's to spawm and their spawn points
|
||||
// NPCs to spawm and their spawn points
|
||||
protected final List<NpcSpawn> _spawnList = new ArrayList<>();
|
||||
|
||||
// Drop data for event
|
||||
@ -265,7 +265,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
|
||||
/**
|
||||
* Maintenance event start - adds global drop, spawns event NPC's, shows start announcement.
|
||||
* Maintenance event start - adds global drop, spawns event NPCs, shows start announcement.
|
||||
*/
|
||||
protected void startEvent()
|
||||
{
|
||||
|
@ -261,7 +261,7 @@ public final class CharacterCreate implements IClientIncomingPacket
|
||||
|
||||
private void initNewChar(L2GameClient client, L2PcInstance newChar)
|
||||
{
|
||||
L2World.getInstance().storeObject(newChar);
|
||||
L2World.getInstance().addObject(newChar);
|
||||
|
||||
if (Config.STARTING_ADENA > 0)
|
||||
{
|
||||
|
@ -24,7 +24,6 @@ import com.l2jmobius.commons.util.Rnd;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.ItemCrystallizationData;
|
||||
import com.l2jmobius.gameserver.enums.PrivateStoreType;
|
||||
import com.l2jmobius.gameserver.enums.Race;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.holders.ItemChanceHolder;
|
||||
import com.l2jmobius.gameserver.model.itemcontainer.PcInventory;
|
||||
@ -262,8 +261,6 @@ public final class RequestCrystallizeItem implements IClientIncomingPacket
|
||||
|
||||
activeChar.broadcastUserInfo();
|
||||
|
||||
L2World.getInstance().removeObject(removedItem);
|
||||
|
||||
activeChar.setInCrystallize(false);
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.PetDataTable;
|
||||
import com.l2jmobius.gameserver.model.L2PetData;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Npc;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Summon;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
@ -139,7 +138,6 @@ public final class Evolve
|
||||
|
||||
player.sendPacket(new MagicSkillUse(npc, 2046, 1, 1000, 600000));
|
||||
player.sendPacket(SystemMessageId.SUMMONING_YOUR_PET);
|
||||
// L2World.getInstance().storeObject(petSummon);
|
||||
petSummon.spawnMe(oldX, oldY, oldZ);
|
||||
petSummon.startFeed();
|
||||
item.setEnchantLevel(petSummon.getLevel());
|
||||
@ -227,7 +225,6 @@ public final class Evolve
|
||||
|
||||
player.sendPacket(new MagicSkillUse(npc, 2046, 1, 1000, 600000));
|
||||
player.sendPacket(SystemMessageId.SUMMONING_YOUR_PET);
|
||||
// L2World.getInstance().storeObject(petSummon);
|
||||
petSummon.spawnMe(player.getX(), player.getY(), player.getZ());
|
||||
petSummon.startFeed();
|
||||
addedItem.setEnchantLevel(petSummon.getLevel());
|
||||
@ -239,9 +236,6 @@ public final class Evolve
|
||||
|
||||
player.broadcastUserInfo();
|
||||
|
||||
final L2World world = L2World.getInstance();
|
||||
world.removeObject(removedItem);
|
||||
|
||||
ThreadPoolManager.schedule(new EvolveFinalizer(player, petSummon), 900);
|
||||
|
||||
if (petSummon.getCurrentFed() <= 0)
|
||||
|
Reference in New Issue
Block a user