diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/Spawn.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/Spawn.java
index 19dd421844..05966df2cb 100644
--- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/Spawn.java
+++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/Spawn.java
@@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.model.interfaces.INamable;
import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.taskmanager.RespawnTaskManager;
+import org.l2jmobius.gameserver.util.Util;
/**
* This class manages the spawn and respawn of a group of NpcInstance that are in the same are and have the same type.
@@ -401,7 +402,12 @@ public class Spawn extends Location implements IIdentifiable, INamable
// Do not correct z of flying NPCs.
if (!npc.isFlying())
{
- newlocz = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ final int geoZ = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ // Do not correct Z distances greater than 300.
+ if (Util.calculateDistance(newlocx, newlocy, newlocz, newlocx, newlocy, geoZ, true, false) < 300)
+ {
+ newlocz = geoZ;
+ }
}
// Set is not random walk default value
diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/Spawn.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/Spawn.java
index 19dd421844..05966df2cb 100644
--- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/Spawn.java
+++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/Spawn.java
@@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.model.interfaces.INamable;
import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.taskmanager.RespawnTaskManager;
+import org.l2jmobius.gameserver.util.Util;
/**
* This class manages the spawn and respawn of a group of NpcInstance that are in the same are and have the same type.
@@ -401,7 +402,12 @@ public class Spawn extends Location implements IIdentifiable, INamable
// Do not correct z of flying NPCs.
if (!npc.isFlying())
{
- newlocz = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ final int geoZ = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ // Do not correct Z distances greater than 300.
+ if (Util.calculateDistance(newlocx, newlocy, newlocz, newlocx, newlocy, geoZ, true, false) < 300)
+ {
+ newlocz = geoZ;
+ }
}
// Set is not random walk default value
diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/Spawn.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/Spawn.java
index 19dd421844..05966df2cb 100644
--- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/Spawn.java
+++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/Spawn.java
@@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.model.interfaces.INamable;
import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.taskmanager.RespawnTaskManager;
+import org.l2jmobius.gameserver.util.Util;
/**
* This class manages the spawn and respawn of a group of NpcInstance that are in the same are and have the same type.
@@ -401,7 +402,12 @@ public class Spawn extends Location implements IIdentifiable, INamable
// Do not correct z of flying NPCs.
if (!npc.isFlying())
{
- newlocz = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ final int geoZ = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ // Do not correct Z distances greater than 300.
+ if (Util.calculateDistance(newlocx, newlocy, newlocz, newlocx, newlocy, geoZ, true, false) < 300)
+ {
+ newlocz = geoZ;
+ }
}
// Set is not random walk default value
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/Spawn.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/Spawn.java
index 19dd421844..05966df2cb 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/Spawn.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/Spawn.java
@@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.model.interfaces.INamable;
import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.taskmanager.RespawnTaskManager;
+import org.l2jmobius.gameserver.util.Util;
/**
* This class manages the spawn and respawn of a group of NpcInstance that are in the same are and have the same type.
@@ -401,7 +402,12 @@ public class Spawn extends Location implements IIdentifiable, INamable
// Do not correct z of flying NPCs.
if (!npc.isFlying())
{
- newlocz = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ final int geoZ = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ // Do not correct Z distances greater than 300.
+ if (Util.calculateDistance(newlocx, newlocy, newlocz, newlocx, newlocy, geoZ, true, false) < 300)
+ {
+ newlocz = geoZ;
+ }
}
// Set is not random walk default value
diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/Spawn.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/Spawn.java
index 19dd421844..05966df2cb 100644
--- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/Spawn.java
+++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/Spawn.java
@@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.model.interfaces.INamable;
import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.taskmanager.RespawnTaskManager;
+import org.l2jmobius.gameserver.util.Util;
/**
* This class manages the spawn and respawn of a group of NpcInstance that are in the same are and have the same type.
@@ -401,7 +402,12 @@ public class Spawn extends Location implements IIdentifiable, INamable
// Do not correct z of flying NPCs.
if (!npc.isFlying())
{
- newlocz = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ final int geoZ = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ // Do not correct Z distances greater than 300.
+ if (Util.calculateDistance(newlocx, newlocy, newlocz, newlocx, newlocy, geoZ, true, false) < 300)
+ {
+ newlocz = geoZ;
+ }
}
// Set is not random walk default value
diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/Spawn.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/Spawn.java
index 19dd421844..05966df2cb 100644
--- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/Spawn.java
+++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/Spawn.java
@@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.model.interfaces.INamable;
import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.taskmanager.RespawnTaskManager;
+import org.l2jmobius.gameserver.util.Util;
/**
* This class manages the spawn and respawn of a group of NpcInstance that are in the same are and have the same type.
@@ -401,7 +402,12 @@ public class Spawn extends Location implements IIdentifiable, INamable
// Do not correct z of flying NPCs.
if (!npc.isFlying())
{
- newlocz = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ final int geoZ = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ // Do not correct Z distances greater than 300.
+ if (Util.calculateDistance(newlocx, newlocy, newlocz, newlocx, newlocy, geoZ, true, false) < 300)
+ {
+ newlocz = geoZ;
+ }
}
// Set is not random walk default value
diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/Spawn.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/Spawn.java
index 19dd421844..05966df2cb 100644
--- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/Spawn.java
+++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/Spawn.java
@@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.model.interfaces.INamable;
import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.taskmanager.RespawnTaskManager;
+import org.l2jmobius.gameserver.util.Util;
/**
* This class manages the spawn and respawn of a group of NpcInstance that are in the same are and have the same type.
@@ -401,7 +402,12 @@ public class Spawn extends Location implements IIdentifiable, INamable
// Do not correct z of flying NPCs.
if (!npc.isFlying())
{
- newlocz = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ final int geoZ = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ // Do not correct Z distances greater than 300.
+ if (Util.calculateDistance(newlocx, newlocy, newlocz, newlocx, newlocy, geoZ, true, false) < 300)
+ {
+ newlocz = geoZ;
+ }
}
// Set is not random walk default value
diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/spawn/Spawn.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/spawn/Spawn.java
index 5e2c39488e..09f99d03db 100644
--- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/spawn/Spawn.java
+++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/spawn/Spawn.java
@@ -30,6 +30,7 @@ import org.l2jmobius.gameserver.model.actor.instance.NpcInstance;
import org.l2jmobius.gameserver.model.quest.Quest;
import org.l2jmobius.gameserver.taskmanager.RespawnTaskManager;
import org.l2jmobius.gameserver.templates.creatures.NpcTemplate;
+import org.l2jmobius.gameserver.util.Util;
/**
* This class manages the spawn and respawn of a group of NpcInstance that are in the same are and have the same type. Concept :
@@ -504,7 +505,12 @@ public class Spawn
// Do not correct z of flying NPCs.
if (!npc.isFlying())
{
- newlocz = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ final int geoZ = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ // Do not correct Z distances greater than 300.
+ if (Util.calculateDistance(newlocx, newlocy, newlocz, newlocx, newlocy, geoZ, true) < 300)
+ {
+ newlocz = geoZ;
+ }
}
npc.stopAllEffects();
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/Spawn.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/Spawn.java
index 374a430f57..5612c22e8c 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/Spawn.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/Spawn.java
@@ -38,6 +38,7 @@ import org.l2jmobius.gameserver.model.interfaces.INamable;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.model.zone.type.NpcSpawnTerritory;
import org.l2jmobius.gameserver.taskmanager.RespawnTaskManager;
+import org.l2jmobius.gameserver.util.Util;
/**
* This class manages the spawn and respawn of a group of NpcInstance that are in the same are and have the same type.
@@ -395,7 +396,12 @@ public class Spawn extends Location implements IIdentifiable, INamable
// Do not correct z of flying NPCs.
if (!npc.isFlying())
{
- newlocz = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ final int geoZ = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ // Do not correct Z distances greater than 300.
+ if (Util.calculateDistance(newlocx, newlocy, newlocz, newlocx, newlocy, geoZ, true, false) < 300)
+ {
+ newlocz = geoZ;
+ }
}
npc.stopAllEffects();
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/Spawn.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/Spawn.java
index 19dd421844..05966df2cb 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/Spawn.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/Spawn.java
@@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.model.interfaces.INamable;
import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.taskmanager.RespawnTaskManager;
+import org.l2jmobius.gameserver.util.Util;
/**
* This class manages the spawn and respawn of a group of NpcInstance that are in the same are and have the same type.
@@ -401,7 +402,12 @@ public class Spawn extends Location implements IIdentifiable, INamable
// Do not correct z of flying NPCs.
if (!npc.isFlying())
{
- newlocz = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ final int geoZ = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ // Do not correct Z distances greater than 300.
+ if (Util.calculateDistance(newlocx, newlocy, newlocz, newlocx, newlocy, geoZ, true, false) < 300)
+ {
+ newlocz = geoZ;
+ }
}
// Set is not random walk default value
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/Spawn.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/Spawn.java
index 19dd421844..05966df2cb 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/Spawn.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/Spawn.java
@@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.model.interfaces.INamable;
import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.taskmanager.RespawnTaskManager;
+import org.l2jmobius.gameserver.util.Util;
/**
* This class manages the spawn and respawn of a group of NpcInstance that are in the same are and have the same type.
@@ -401,7 +402,12 @@ public class Spawn extends Location implements IIdentifiable, INamable
// Do not correct z of flying NPCs.
if (!npc.isFlying())
{
- newlocz = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ final int geoZ = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ // Do not correct Z distances greater than 300.
+ if (Util.calculateDistance(newlocx, newlocy, newlocz, newlocx, newlocy, geoZ, true, false) < 300)
+ {
+ newlocz = geoZ;
+ }
}
// Set is not random walk default value
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/Spawn.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/Spawn.java
index 19dd421844..05966df2cb 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/Spawn.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/Spawn.java
@@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.model.interfaces.INamable;
import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.taskmanager.RespawnTaskManager;
+import org.l2jmobius.gameserver.util.Util;
/**
* This class manages the spawn and respawn of a group of NpcInstance that are in the same are and have the same type.
@@ -401,7 +402,12 @@ public class Spawn extends Location implements IIdentifiable, INamable
// Do not correct z of flying NPCs.
if (!npc.isFlying())
{
- newlocz = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ final int geoZ = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ // Do not correct Z distances greater than 300.
+ if (Util.calculateDistance(newlocx, newlocy, newlocz, newlocx, newlocy, geoZ, true, false) < 300)
+ {
+ newlocz = geoZ;
+ }
}
// Set is not random walk default value
diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/Spawn.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/Spawn.java
index 19dd421844..05966df2cb 100644
--- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/Spawn.java
+++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/Spawn.java
@@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.model.interfaces.INamable;
import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.taskmanager.RespawnTaskManager;
+import org.l2jmobius.gameserver.util.Util;
/**
* This class manages the spawn and respawn of a group of NpcInstance that are in the same are and have the same type.
@@ -401,7 +402,12 @@ public class Spawn extends Location implements IIdentifiable, INamable
// Do not correct z of flying NPCs.
if (!npc.isFlying())
{
- newlocz = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ final int geoZ = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ // Do not correct Z distances greater than 300.
+ if (Util.calculateDistance(newlocx, newlocy, newlocz, newlocx, newlocy, geoZ, true, false) < 300)
+ {
+ newlocz = geoZ;
+ }
}
// Set is not random walk default value
diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/Spawn.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/Spawn.java
index 19dd421844..05966df2cb 100644
--- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/Spawn.java
+++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/Spawn.java
@@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.model.interfaces.INamable;
import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.taskmanager.RespawnTaskManager;
+import org.l2jmobius.gameserver.util.Util;
/**
* This class manages the spawn and respawn of a group of NpcInstance that are in the same are and have the same type.
@@ -401,7 +402,12 @@ public class Spawn extends Location implements IIdentifiable, INamable
// Do not correct z of flying NPCs.
if (!npc.isFlying())
{
- newlocz = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ final int geoZ = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ // Do not correct Z distances greater than 300.
+ if (Util.calculateDistance(newlocx, newlocy, newlocz, newlocx, newlocy, geoZ, true, false) < 300)
+ {
+ newlocz = geoZ;
+ }
}
// Set is not random walk default value
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/Spawn.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/Spawn.java
index 19dd421844..05966df2cb 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/Spawn.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/Spawn.java
@@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.model.interfaces.INamable;
import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.taskmanager.RespawnTaskManager;
+import org.l2jmobius.gameserver.util.Util;
/**
* This class manages the spawn and respawn of a group of NpcInstance that are in the same are and have the same type.
@@ -401,7 +402,12 @@ public class Spawn extends Location implements IIdentifiable, INamable
// Do not correct z of flying NPCs.
if (!npc.isFlying())
{
- newlocz = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ final int geoZ = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz);
+ // Do not correct Z distances greater than 300.
+ if (Util.calculateDistance(newlocx, newlocy, newlocz, newlocx, newlocy, geoZ, true, false) < 300)
+ {
+ newlocz = geoZ;
+ }
}
// Set is not random walk default value