diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java index e0dda73564..7be9fb179b 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionshifthandlers/L2NpcActionShift.java @@ -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"); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index 1e29f09cf0..0febb6f4df 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -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)) { diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Spawn.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Spawn.java index 2286bd1f44..4aa3e56e91 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Spawn.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Spawn.java @@ -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 _spawnListeners = new CopyOnWriteArrayList<>(); private final Deque _spawnedNpcs = new ConcurrentLinkedDeque<>(); - private Map _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() diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Attackable.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Attackable.java index 262015a7fa..b379851c47 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Attackable.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Attackable.java @@ -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()); } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Npc.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Npc.java index 73cc8490af..5bdbf743c1 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Npc.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Npc.java @@ -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())); } /**