From d12b97d3cbddb8bd86ac848426b1cc533d0369bc Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Mon, 22 Jul 2019 14:56:54 +0000 Subject: [PATCH] Use geodata to correct spawn z value. --- .../org/l2jmobius/gameserver/model/Spawn.java | 6 ++ .../org/l2jmobius/gameserver/model/Spawn.java | 6 ++ .../org/l2jmobius/gameserver/model/Spawn.java | 6 ++ .../org/l2jmobius/gameserver/model/Spawn.java | 6 ++ .../org/l2jmobius/gameserver/model/Spawn.java | 6 ++ .../org/l2jmobius/gameserver/model/Spawn.java | 6 ++ .../org/l2jmobius/gameserver/model/Spawn.java | 6 ++ .../gameserver/model/spawn/Spawn.java | 82 +++++++++++-------- .../org/l2jmobius/gameserver/model/Spawn.java | 6 ++ .../org/l2jmobius/gameserver/model/Spawn.java | 6 ++ .../org/l2jmobius/gameserver/model/Spawn.java | 6 ++ .../org/l2jmobius/gameserver/model/Spawn.java | 6 ++ .../org/l2jmobius/gameserver/model/Spawn.java | 6 ++ .../org/l2jmobius/gameserver/model/Spawn.java | 6 ++ 14 files changed, 124 insertions(+), 36 deletions(-) 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 8a211064a9..e31dbe597e 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 @@ -398,6 +398,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); + } + // Set is not random walk default value npc.setRandomWalking(_randomWalk); 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 8a211064a9..e31dbe597e 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 @@ -398,6 +398,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); + } + // Set is not random walk default value npc.setRandomWalking(_randomWalk); 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 8a211064a9..e31dbe597e 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 @@ -398,6 +398,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); + } + // Set is not random walk default value npc.setRandomWalking(_randomWalk); 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 8a211064a9..e31dbe597e 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 @@ -398,6 +398,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); + } + // Set is not random walk default value npc.setRandomWalking(_randomWalk); 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 8a211064a9..e31dbe597e 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 @@ -398,6 +398,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); + } + // Set is not random walk default value npc.setRandomWalking(_randomWalk); 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 8a211064a9..e31dbe597e 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 @@ -398,6 +398,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); + } + // Set is not random walk default value npc.setRandomWalking(_randomWalk); 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 8a211064a9..e31dbe597e 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 @@ -398,6 +398,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); + } + // Set is not random walk default value npc.setRandomWalking(_randomWalk); 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 8441ede67b..943f20efce 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 @@ -23,6 +23,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.model.WorldObject; import org.l2jmobius.gameserver.model.actor.instance.NpcInstance; @@ -497,44 +498,53 @@ public class Spawn newlocz = _locZ; } - if (npc != null) + // if (npc != null) + // { + + // Do not correct z of flying NPCs. + if (!npc.isFlying()) { - npc.stopAllEffects(); - - // Set the HP and MP of the NpcInstance to the max - npc.setCurrentHpMp(npc.getMaxHp(), npc.getMaxMp()); - - // Set the heading of the NpcInstance (random heading if not defined) - if (_heading == -1) - { - npc.setHeading(Rnd.get(61794)); - } - else - { - npc.setHeading(_heading); - } - - // Reset decay info - npc.setDecayed(false); - - // Link the NpcInstance to this Spawn - npc.setSpawn(this); - - // Init other values of the NpcInstance (ex : from its CreatureTemplate for INT, STR, DEX...) and add it in the world as a visible object - npc.spawnMe(newlocx, newlocy, newlocz); - - notifyNpcSpawned(npc); - - _lastSpawn = npc; - - for (Quest quest : npc.getTemplate().getEventQuests(Quest.QuestEventType.ON_SPAWN)) - { - quest.notifySpawn(npc); - } - - // Increase the current number of NpcInstance managed by this Spawn - _currentCount++; + newlocz = GeoEngine.getInstance().getHeight(newlocx, newlocy, newlocz); } + + npc.stopAllEffects(); + + // Set the HP and MP of the NpcInstance to the max + npc.setCurrentHpMp(npc.getMaxHp(), npc.getMaxMp()); + + // Set the heading of the NpcInstance (random heading if not defined) + if (_heading == -1) + { + npc.setHeading(Rnd.get(61794)); + } + else + { + npc.setHeading(_heading); + } + + // Reset decay info + npc.setDecayed(false); + + // Link the NpcInstance to this Spawn + npc.setSpawn(this); + + // Init other values of the NpcInstance (ex : from its CreatureTemplate for INT, STR, DEX...) and add it in the world as a visible object + npc.spawnMe(newlocx, newlocy, newlocz); + + notifyNpcSpawned(npc); + + _lastSpawn = npc; + + for (Quest quest : npc.getTemplate().getEventQuests(Quest.QuestEventType.ON_SPAWN)) + { + quest.notifySpawn(npc); + } + + // Increase the current number of NpcInstance managed by this Spawn + _currentCount++; + + // } + return npc; } 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 e776b886bf..cd38484fbf 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 @@ -392,6 +392,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); + } + npc.stopAllEffects(); npc.setIsDead(false); 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 8a211064a9..e31dbe597e 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 @@ -398,6 +398,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); + } + // Set is not random walk default value npc.setRandomWalking(_randomWalk); 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 8a211064a9..e31dbe597e 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 @@ -398,6 +398,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); + } + // Set is not random walk default value npc.setRandomWalking(_randomWalk); 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 8a211064a9..e31dbe597e 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 @@ -398,6 +398,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); + } + // Set is not random walk default value npc.setRandomWalking(_randomWalk); 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 8a211064a9..e31dbe597e 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 @@ -398,6 +398,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); + } + // Set is not random walk default value npc.setRandomWalking(_randomWalk); 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 8a211064a9..e31dbe597e 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 @@ -398,6 +398,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); + } + // Set is not random walk default value npc.setRandomWalking(_randomWalk);