Dropped L2Spawn lastSpawnPoints.
This commit is contained in:
parent
68a7ef1c65
commit
dedec95e21
@ -119,7 +119,7 @@ public class L2NpcActionShift implements IActionShiftHandler
|
||||
if (((L2Npc) target).getSpawn().isTerritoryBased())
|
||||
{
|
||||
html.replace("%spawntype%", "Random");
|
||||
final Location spawnLoc = ((L2Npc) target).getSpawn().getLocation(target);
|
||||
final Location spawnLoc = ((L2Npc) target).getSpawn().getLocation();
|
||||
html.replace("%spawn%", spawnLoc.getX() + " " + spawnLoc.getY() + " " + spawnLoc.getZ());
|
||||
}
|
||||
else
|
||||
@ -127,8 +127,8 @@ public class L2NpcActionShift implements IActionShiftHandler
|
||||
html.replace("%spawntype%", "Fixed");
|
||||
html.replace("%spawn%", ((L2Npc) target).getSpawn().getX() + " " + ((L2Npc) target).getSpawn().getY() + " " + ((L2Npc) target).getSpawn().getZ());
|
||||
}
|
||||
html.replace("%loc2d%", String.valueOf((int) target.calculateDistance(((L2Npc) target).getSpawn().getLocation(target), false, false)));
|
||||
html.replace("%loc3d%", String.valueOf((int) target.calculateDistance(((L2Npc) target).getSpawn().getLocation(target), true, false)));
|
||||
html.replace("%loc2d%", String.valueOf((int) target.calculateDistance(((L2Npc) target).getSpawn().getLocation(), false, false)));
|
||||
html.replace("%loc3d%", String.valueOf((int) target.calculateDistance(((L2Npc) target).getSpawn().getLocation(), true, false)));
|
||||
if (((L2Npc) target).getSpawn().getRespawnMinDelay() == 0)
|
||||
{
|
||||
html.replace("%resp%", "None");
|
||||
|
@ -351,7 +351,7 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
{
|
||||
intention = AI_INTENTION_ACTIVE;
|
||||
}
|
||||
else if ((npc.getSpawn() != null) && !npc.isInsideRadius(npc.getSpawn().getLocation(npc), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE, true, false))
|
||||
else if ((npc.getSpawn() != null) && !npc.isInsideRadius(npc.getSpawn().getLocation(), Config.MAX_DRIFT_RANGE + Config.MAX_DRIFT_RANGE, true, false))
|
||||
{
|
||||
intention = AI_INTENTION_ACTIVE;
|
||||
}
|
||||
@ -721,9 +721,9 @@ public class L2AttackableAI extends L2CharacterAI
|
||||
}
|
||||
}
|
||||
|
||||
x1 = npc.getSpawn().getX(npc);
|
||||
y1 = npc.getSpawn().getY(npc);
|
||||
z1 = npc.getSpawn().getZ(npc);
|
||||
x1 = npc.getSpawn().getX();
|
||||
y1 = npc.getSpawn().getY();
|
||||
z1 = npc.getSpawn().getZ();
|
||||
|
||||
if (!npc.isInsideRadius(x1, y1, 0, range, false, false))
|
||||
{
|
||||
|
@ -19,8 +19,6 @@ package com.l2jmobius.gameserver.model;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.Deque;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedDeque;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.logging.Level;
|
||||
@ -80,7 +78,6 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
|
||||
private boolean _doRespawn = true;
|
||||
private static List<SpawnListener> _spawnListeners = new CopyOnWriteArrayList<>();
|
||||
private final Deque<L2Npc> _spawnedNpcs = new ConcurrentLinkedDeque<>();
|
||||
private Map<Integer, Location> _lastSpawnPoints;
|
||||
private boolean _isNoRndWalk = false; // Is no random walk
|
||||
private int _spawnTemplateId = 0;
|
||||
|
||||
@ -193,26 +190,15 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
|
||||
return _location;
|
||||
}
|
||||
|
||||
public Location getLocation(L2Object obj)
|
||||
{
|
||||
return ((_lastSpawnPoints == null) || (obj == null) || !_lastSpawnPoints.containsKey(obj.getObjectId())) ? _location : _lastSpawnPoints.get(obj.getObjectId());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the X position of the spawn point.
|
||||
*/
|
||||
@Override
|
||||
public int getX()
|
||||
{
|
||||
return _location.getX();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param obj object to check
|
||||
* @return the X position of the last spawn point of given NPC.
|
||||
*/
|
||||
public int getX(L2Object obj)
|
||||
{
|
||||
return getLocation(obj).getX();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the X position of the spawn point.
|
||||
* @param x the x coordinate
|
||||
@ -223,21 +209,15 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
|
||||
_location.setX(x);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the Y position of the spawn point.
|
||||
*/
|
||||
@Override
|
||||
public int getY()
|
||||
{
|
||||
return _location.getY();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param obj object to check
|
||||
* @return the Y position of the last spawn point of given NPC.
|
||||
*/
|
||||
public int getY(L2Object obj)
|
||||
{
|
||||
return getLocation(obj).getY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Y position of the spawn point.
|
||||
* @param y the y coordinate
|
||||
@ -248,21 +228,15 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
|
||||
_location.setY(y);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the Z position of the spawn point.
|
||||
*/
|
||||
@Override
|
||||
public int getZ()
|
||||
{
|
||||
return _location.getZ();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param obj object to check
|
||||
* @return the Z position of the last spawn point of given NPC.
|
||||
*/
|
||||
public int getZ(L2Object obj)
|
||||
{
|
||||
return getLocation(obj).getZ();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Z position of the spawn point.
|
||||
* @param z the z coordinate
|
||||
@ -410,12 +384,6 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
|
||||
// Remove this NPC from list of spawned
|
||||
_spawnedNpcs.remove(oldNpc);
|
||||
|
||||
// Remove spawn point for old NPC
|
||||
if (_lastSpawnPoints != null)
|
||||
{
|
||||
_lastSpawnPoints.remove(oldNpc.getObjectId());
|
||||
}
|
||||
|
||||
// Check if respawn is possible to prevent multiple respawning caused by lag
|
||||
if (_doRespawn && ((_scheduledCount + _currentCount) < _maximumCount))
|
||||
{
|
||||
@ -638,10 +606,6 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
|
||||
notifyNpcSpawned(npc);
|
||||
|
||||
_spawnedNpcs.add(npc);
|
||||
if (_lastSpawnPoints != null)
|
||||
{
|
||||
_lastSpawnPoints.put(npc.getObjectId(), new Location(newlocx, newlocy, newlocz));
|
||||
}
|
||||
|
||||
// Increase the current number of L2NpcInstance managed by this L2Spawn
|
||||
_currentCount++;
|
||||
@ -719,7 +683,6 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
|
||||
public void setSpawnTerritory(NpcSpawnTerritory territory)
|
||||
{
|
||||
_spawnTerritory = territory;
|
||||
_lastSpawnPoints = new ConcurrentHashMap<>();
|
||||
}
|
||||
|
||||
public NpcSpawnTerritory getSpawnTerritory()
|
||||
|
@ -1665,7 +1665,7 @@ public class L2Attackable extends L2Npc
|
||||
|
||||
if (hasAI() && (getSpawn() != null))
|
||||
{
|
||||
getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, getSpawn().getLocation(this));
|
||||
getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, getSpawn().getLocation());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1742,7 +1742,7 @@ public class L2Npc extends L2Character
|
||||
*/
|
||||
public boolean staysInSpawnLoc()
|
||||
{
|
||||
return ((getSpawn() != null) && (getSpawn().getX(this) == getX()) && (getSpawn().getY(this) == getY()));
|
||||
return ((getSpawn() != null) && (getSpawn().getX() == getX()) && (getSpawn().getY() == getY()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user