From 569faf521d6a0e35a2755f26f901150dd1802e03 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Fri, 12 Aug 2022 23:03:47 +0000 Subject: [PATCH] Make use of original spawn location for deletion and info. --- .../actionshifthandlers/NpcActionShift.java | 3 +-- .../l2jmobius/gameserver/data/SpawnTable.java | 10 ++++++---- .../actionshifthandlers/NpcActionShift.java | 3 +-- .../l2jmobius/gameserver/data/SpawnTable.java | 10 ++++++---- .../actionshifthandlers/NpcActionShift.java | 3 +-- .../l2jmobius/gameserver/data/SpawnTable.java | 10 ++++++---- .../actionshifthandlers/NpcActionShift.java | 3 +-- .../l2jmobius/gameserver/data/SpawnTable.java | 10 ++++++---- .../actionshifthandlers/NpcActionShift.java | 3 +-- .../l2jmobius/gameserver/data/SpawnTable.java | 10 ++++++---- .../actionshifthandlers/NpcActionShift.java | 3 +-- .../l2jmobius/gameserver/data/SpawnTable.java | 10 ++++++---- .../actionshifthandlers/NpcActionShift.java | 3 +-- .../l2jmobius/gameserver/data/SpawnTable.java | 10 ++++++---- .../actionshifthandlers/NpcActionShift.java | 3 +-- .../l2jmobius/gameserver/data/SpawnTable.java | 10 ++++++---- .../actionshifthandlers/NpcActionShift.java | 3 +-- .../l2jmobius/gameserver/data/SpawnTable.java | 10 ++++++---- .../actionshifthandlers/NpcActionShift.java | 3 +-- .../l2jmobius/gameserver/data/SpawnTable.java | 10 ++++++---- .../actionshifthandlers/NpcActionShift.java | 3 +-- .../l2jmobius/gameserver/data/SpawnTable.java | 10 ++++++---- .../actionshifthandlers/NpcActionShift.java | 3 +-- .../l2jmobius/gameserver/data/SpawnTable.java | 10 ++++++---- .../actionshifthandlers/NpcActionShift.java | 3 ++- .../l2jmobius/gameserver/data/SpawnTable.java | 8 +++++--- .../org/l2jmobius/gameserver/model/Spawn.java | 17 ++++++++++++++--- .../actionshifthandlers/NpcActionShift.java | 3 ++- .../l2jmobius/gameserver/data/SpawnTable.java | 8 +++++--- .../org/l2jmobius/gameserver/model/Spawn.java | 17 ++++++++++++++--- .../actionshifthandlers/NpcActionShift.java | 3 ++- .../l2jmobius/gameserver/data/SpawnTable.java | 8 +++++--- .../org/l2jmobius/gameserver/model/Spawn.java | 17 ++++++++++++++--- .../actionshifthandlers/NpcActionShift.java | 3 +-- .../l2jmobius/gameserver/data/SpawnTable.java | 10 ++++++---- .../actionshifthandlers/NpcActionShift.java | 3 +-- .../l2jmobius/gameserver/data/SpawnTable.java | 10 ++++++---- .../actionshifthandlers/NpcActionShift.java | 3 +-- .../l2jmobius/gameserver/data/SpawnTable.java | 10 ++++++---- .../actionshifthandlers/NpcActionShift.java | 3 +-- .../l2jmobius/gameserver/data/SpawnTable.java | 10 ++++++---- .../actionshifthandlers/NpcActionShift.java | 3 +-- .../l2jmobius/gameserver/data/SpawnTable.java | 10 ++++++---- .../actionshifthandlers/NpcActionShift.java | 3 +-- .../l2jmobius/gameserver/data/SpawnTable.java | 10 ++++++---- .../actionshifthandlers/NpcActionShift.java | 3 +-- .../l2jmobius/gameserver/data/SpawnTable.java | 10 ++++++---- .../actionshifthandlers/NpcActionShift.java | 3 +-- .../l2jmobius/gameserver/data/SpawnTable.java | 10 ++++++---- .../actionshifthandlers/NpcActionShift.java | 3 +-- .../l2jmobius/gameserver/data/SpawnTable.java | 10 ++++++---- .../actionshifthandlers/NpcActionShift.java | 3 +-- .../l2jmobius/gameserver/data/SpawnTable.java | 10 ++++++---- .../actionshifthandlers/NpcActionShift.java | 3 +-- .../l2jmobius/gameserver/data/SpawnTable.java | 10 ++++++---- .../actionshifthandlers/NpcActionShift.java | 3 +-- .../l2jmobius/gameserver/data/SpawnTable.java | 10 ++++++---- .../actionshifthandlers/NpcActionShift.java | 3 +-- .../l2jmobius/gameserver/data/SpawnTable.java | 10 ++++++---- 59 files changed, 238 insertions(+), 171 deletions(-) diff --git a/L2J_Mobius_01.0_Ertheia/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_01.0_Ertheia/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 1ae0d55b23..e564b43119 100644 --- a/L2J_Mobius_01.0_Ertheia/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_01.0_Ertheia/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -128,8 +128,7 @@ public class NpcActionShift implements IActionShiftHandler } html.replace("%spawnai%", "" + template.getSpawnTemplate().getAI() + ""); } - - html.replace("%spawn%", npc.getSpawn().getX() + " " + npc.getSpawn().getY() + " " + npc.getSpawn().getZ()); + html.replace("%spawn%", (template != null ? template.getSpawnLocation().getX() : npc.getSpawn().getX()) + " " + (template != null ? template.getSpawnLocation().getY() : npc.getSpawn().getY()) + " " + (template != null ? template.getSpawnLocation().getZ() : npc.getSpawn().getZ())); if (npc.getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); diff --git a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/data/SpawnTable.java index 19f0db5b3e..986e4f1195 100644 --- a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -32,6 +32,7 @@ import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate; /** * Spawn data retriever. @@ -194,16 +195,17 @@ public class SpawnTable { final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; - final File spawnFile = spawn.getNpcSpawnTemplate() != null ? spawn.getNpcSpawnTemplate().getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); + final NpcSpawnTemplate npcSpawnTemplate = spawn.getNpcSpawnTemplate(); + final File spawnFile = npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try { final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getX() : spawn.getX()); + final String spawnY = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getY() : spawn.getY()); + final String spawnZ = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getZ() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_02.5_Underground/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_02.5_Underground/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 1ae0d55b23..e564b43119 100644 --- a/L2J_Mobius_02.5_Underground/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_02.5_Underground/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -128,8 +128,7 @@ public class NpcActionShift implements IActionShiftHandler } html.replace("%spawnai%", "" + template.getSpawnTemplate().getAI() + ""); } - - html.replace("%spawn%", npc.getSpawn().getX() + " " + npc.getSpawn().getY() + " " + npc.getSpawn().getZ()); + html.replace("%spawn%", (template != null ? template.getSpawnLocation().getX() : npc.getSpawn().getX()) + " " + (template != null ? template.getSpawnLocation().getY() : npc.getSpawn().getY()) + " " + (template != null ? template.getSpawnLocation().getZ() : npc.getSpawn().getZ())); if (npc.getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); diff --git a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/data/SpawnTable.java index 19f0db5b3e..986e4f1195 100644 --- a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -32,6 +32,7 @@ import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate; /** * Spawn data retriever. @@ -194,16 +195,17 @@ public class SpawnTable { final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; - final File spawnFile = spawn.getNpcSpawnTemplate() != null ? spawn.getNpcSpawnTemplate().getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); + final NpcSpawnTemplate npcSpawnTemplate = spawn.getNpcSpawnTemplate(); + final File spawnFile = npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try { final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getX() : spawn.getX()); + final String spawnY = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getY() : spawn.getY()); + final String spawnZ = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getZ() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_03.0_Helios/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_03.0_Helios/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 1ae0d55b23..e564b43119 100644 --- a/L2J_Mobius_03.0_Helios/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_03.0_Helios/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -128,8 +128,7 @@ public class NpcActionShift implements IActionShiftHandler } html.replace("%spawnai%", "" + template.getSpawnTemplate().getAI() + ""); } - - html.replace("%spawn%", npc.getSpawn().getX() + " " + npc.getSpawn().getY() + " " + npc.getSpawn().getZ()); + html.replace("%spawn%", (template != null ? template.getSpawnLocation().getX() : npc.getSpawn().getX()) + " " + (template != null ? template.getSpawnLocation().getY() : npc.getSpawn().getY()) + " " + (template != null ? template.getSpawnLocation().getZ() : npc.getSpawn().getZ())); if (npc.getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); diff --git a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/data/SpawnTable.java index 19f0db5b3e..986e4f1195 100644 --- a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -32,6 +32,7 @@ import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate; /** * Spawn data retriever. @@ -194,16 +195,17 @@ public class SpawnTable { final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; - final File spawnFile = spawn.getNpcSpawnTemplate() != null ? spawn.getNpcSpawnTemplate().getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); + final NpcSpawnTemplate npcSpawnTemplate = spawn.getNpcSpawnTemplate(); + final File spawnFile = npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try { final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getX() : spawn.getX()); + final String spawnY = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getY() : spawn.getY()); + final String spawnZ = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getZ() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_04.0_GrandCrusade/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_04.0_GrandCrusade/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 1ae0d55b23..e564b43119 100644 --- a/L2J_Mobius_04.0_GrandCrusade/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_04.0_GrandCrusade/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -128,8 +128,7 @@ public class NpcActionShift implements IActionShiftHandler } html.replace("%spawnai%", "" + template.getSpawnTemplate().getAI() + ""); } - - html.replace("%spawn%", npc.getSpawn().getX() + " " + npc.getSpawn().getY() + " " + npc.getSpawn().getZ()); + html.replace("%spawn%", (template != null ? template.getSpawnLocation().getX() : npc.getSpawn().getX()) + " " + (template != null ? template.getSpawnLocation().getY() : npc.getSpawn().getY()) + " " + (template != null ? template.getSpawnLocation().getZ() : npc.getSpawn().getZ())); if (npc.getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); diff --git a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/data/SpawnTable.java index 19f0db5b3e..986e4f1195 100644 --- a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -32,6 +32,7 @@ import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate; /** * Spawn data retriever. @@ -194,16 +195,17 @@ public class SpawnTable { final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; - final File spawnFile = spawn.getNpcSpawnTemplate() != null ? spawn.getNpcSpawnTemplate().getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); + final NpcSpawnTemplate npcSpawnTemplate = spawn.getNpcSpawnTemplate(); + final File spawnFile = npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try { final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getX() : spawn.getX()); + final String spawnY = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getY() : spawn.getY()); + final String spawnZ = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getZ() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_05.0_Salvation/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_05.0_Salvation/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 1ae0d55b23..e564b43119 100644 --- a/L2J_Mobius_05.0_Salvation/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_05.0_Salvation/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -128,8 +128,7 @@ public class NpcActionShift implements IActionShiftHandler } html.replace("%spawnai%", "" + template.getSpawnTemplate().getAI() + ""); } - - html.replace("%spawn%", npc.getSpawn().getX() + " " + npc.getSpawn().getY() + " " + npc.getSpawn().getZ()); + html.replace("%spawn%", (template != null ? template.getSpawnLocation().getX() : npc.getSpawn().getX()) + " " + (template != null ? template.getSpawnLocation().getY() : npc.getSpawn().getY()) + " " + (template != null ? template.getSpawnLocation().getZ() : npc.getSpawn().getZ())); if (npc.getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/data/SpawnTable.java index 19f0db5b3e..986e4f1195 100644 --- a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -32,6 +32,7 @@ import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate; /** * Spawn data retriever. @@ -194,16 +195,17 @@ public class SpawnTable { final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; - final File spawnFile = spawn.getNpcSpawnTemplate() != null ? spawn.getNpcSpawnTemplate().getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); + final NpcSpawnTemplate npcSpawnTemplate = spawn.getNpcSpawnTemplate(); + final File spawnFile = npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try { final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getX() : spawn.getX()); + final String spawnY = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getY() : spawn.getY()); + final String spawnZ = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getZ() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_05.5_EtinasFate/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_05.5_EtinasFate/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 1ae0d55b23..e564b43119 100644 --- a/L2J_Mobius_05.5_EtinasFate/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_05.5_EtinasFate/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -128,8 +128,7 @@ public class NpcActionShift implements IActionShiftHandler } html.replace("%spawnai%", "" + template.getSpawnTemplate().getAI() + ""); } - - html.replace("%spawn%", npc.getSpawn().getX() + " " + npc.getSpawn().getY() + " " + npc.getSpawn().getZ()); + html.replace("%spawn%", (template != null ? template.getSpawnLocation().getX() : npc.getSpawn().getX()) + " " + (template != null ? template.getSpawnLocation().getY() : npc.getSpawn().getY()) + " " + (template != null ? template.getSpawnLocation().getZ() : npc.getSpawn().getZ())); if (npc.getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/data/SpawnTable.java index 19f0db5b3e..986e4f1195 100644 --- a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -32,6 +32,7 @@ import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate; /** * Spawn data retriever. @@ -194,16 +195,17 @@ public class SpawnTable { final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; - final File spawnFile = spawn.getNpcSpawnTemplate() != null ? spawn.getNpcSpawnTemplate().getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); + final NpcSpawnTemplate npcSpawnTemplate = spawn.getNpcSpawnTemplate(); + final File spawnFile = npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try { final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getX() : spawn.getX()); + final String spawnY = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getY() : spawn.getY()); + final String spawnZ = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getZ() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_06.0_Fafurion/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_06.0_Fafurion/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 1ae0d55b23..e564b43119 100644 --- a/L2J_Mobius_06.0_Fafurion/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_06.0_Fafurion/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -128,8 +128,7 @@ public class NpcActionShift implements IActionShiftHandler } html.replace("%spawnai%", "" + template.getSpawnTemplate().getAI() + ""); } - - html.replace("%spawn%", npc.getSpawn().getX() + " " + npc.getSpawn().getY() + " " + npc.getSpawn().getZ()); + html.replace("%spawn%", (template != null ? template.getSpawnLocation().getX() : npc.getSpawn().getX()) + " " + (template != null ? template.getSpawnLocation().getY() : npc.getSpawn().getY()) + " " + (template != null ? template.getSpawnLocation().getZ() : npc.getSpawn().getZ())); if (npc.getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/data/SpawnTable.java index 19f0db5b3e..986e4f1195 100644 --- a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -32,6 +32,7 @@ import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate; /** * Spawn data retriever. @@ -194,16 +195,17 @@ public class SpawnTable { final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; - final File spawnFile = spawn.getNpcSpawnTemplate() != null ? spawn.getNpcSpawnTemplate().getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); + final NpcSpawnTemplate npcSpawnTemplate = spawn.getNpcSpawnTemplate(); + final File spawnFile = npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try { final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getX() : spawn.getX()); + final String spawnY = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getY() : spawn.getY()); + final String spawnZ = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getZ() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 1ae0d55b23..e564b43119 100644 --- a/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -128,8 +128,7 @@ public class NpcActionShift implements IActionShiftHandler } html.replace("%spawnai%", "" + template.getSpawnTemplate().getAI() + ""); } - - html.replace("%spawn%", npc.getSpawn().getX() + " " + npc.getSpawn().getY() + " " + npc.getSpawn().getZ()); + html.replace("%spawn%", (template != null ? template.getSpawnLocation().getX() : npc.getSpawn().getX()) + " " + (template != null ? template.getSpawnLocation().getY() : npc.getSpawn().getY()) + " " + (template != null ? template.getSpawnLocation().getZ() : npc.getSpawn().getZ())); if (npc.getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/data/SpawnTable.java index 19f0db5b3e..986e4f1195 100644 --- a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -32,6 +32,7 @@ import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate; /** * Spawn data retriever. @@ -194,16 +195,17 @@ public class SpawnTable { final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; - final File spawnFile = spawn.getNpcSpawnTemplate() != null ? spawn.getNpcSpawnTemplate().getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); + final NpcSpawnTemplate npcSpawnTemplate = spawn.getNpcSpawnTemplate(); + final File spawnFile = npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try { final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getX() : spawn.getX()); + final String spawnY = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getY() : spawn.getY()); + final String spawnZ = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getZ() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_08.2_Homunculus/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_08.2_Homunculus/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 1ae0d55b23..e564b43119 100644 --- a/L2J_Mobius_08.2_Homunculus/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_08.2_Homunculus/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -128,8 +128,7 @@ public class NpcActionShift implements IActionShiftHandler } html.replace("%spawnai%", "" + template.getSpawnTemplate().getAI() + ""); } - - html.replace("%spawn%", npc.getSpawn().getX() + " " + npc.getSpawn().getY() + " " + npc.getSpawn().getZ()); + html.replace("%spawn%", (template != null ? template.getSpawnLocation().getX() : npc.getSpawn().getX()) + " " + (template != null ? template.getSpawnLocation().getY() : npc.getSpawn().getY()) + " " + (template != null ? template.getSpawnLocation().getZ() : npc.getSpawn().getZ())); if (npc.getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); diff --git a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/data/SpawnTable.java index 19f0db5b3e..986e4f1195 100644 --- a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -32,6 +32,7 @@ import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate; /** * Spawn data retriever. @@ -194,16 +195,17 @@ public class SpawnTable { final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; - final File spawnFile = spawn.getNpcSpawnTemplate() != null ? spawn.getNpcSpawnTemplate().getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); + final NpcSpawnTemplate npcSpawnTemplate = spawn.getNpcSpawnTemplate(); + final File spawnFile = npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try { final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getX() : spawn.getX()); + final String spawnY = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getY() : spawn.getY()); + final String spawnZ = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getZ() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 1ae0d55b23..e564b43119 100644 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -128,8 +128,7 @@ public class NpcActionShift implements IActionShiftHandler } html.replace("%spawnai%", "" + template.getSpawnTemplate().getAI() + ""); } - - html.replace("%spawn%", npc.getSpawn().getX() + " " + npc.getSpawn().getY() + " " + npc.getSpawn().getZ()); + html.replace("%spawn%", (template != null ? template.getSpawnLocation().getX() : npc.getSpawn().getX()) + " " + (template != null ? template.getSpawnLocation().getY() : npc.getSpawn().getY()) + " " + (template != null ? template.getSpawnLocation().getZ() : npc.getSpawn().getZ())); if (npc.getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/data/SpawnTable.java index 19f0db5b3e..986e4f1195 100644 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -32,6 +32,7 @@ import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate; /** * Spawn data retriever. @@ -194,16 +195,17 @@ public class SpawnTable { final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; - final File spawnFile = spawn.getNpcSpawnTemplate() != null ? spawn.getNpcSpawnTemplate().getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); + final NpcSpawnTemplate npcSpawnTemplate = spawn.getNpcSpawnTemplate(); + final File spawnFile = npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try { final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getX() : spawn.getX()); + final String spawnY = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getY() : spawn.getY()); + final String spawnZ = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getZ() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_10.1_MasterClass/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_10.1_MasterClass/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 1ae0d55b23..e564b43119 100644 --- a/L2J_Mobius_10.1_MasterClass/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_10.1_MasterClass/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -128,8 +128,7 @@ public class NpcActionShift implements IActionShiftHandler } html.replace("%spawnai%", "" + template.getSpawnTemplate().getAI() + ""); } - - html.replace("%spawn%", npc.getSpawn().getX() + " " + npc.getSpawn().getY() + " " + npc.getSpawn().getZ()); + html.replace("%spawn%", (template != null ? template.getSpawnLocation().getX() : npc.getSpawn().getX()) + " " + (template != null ? template.getSpawnLocation().getY() : npc.getSpawn().getY()) + " " + (template != null ? template.getSpawnLocation().getZ() : npc.getSpawn().getZ())); if (npc.getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); diff --git a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/data/SpawnTable.java index 19f0db5b3e..986e4f1195 100644 --- a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -32,6 +32,7 @@ import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate; /** * Spawn data retriever. @@ -194,16 +195,17 @@ public class SpawnTable { final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; - final File spawnFile = spawn.getNpcSpawnTemplate() != null ? spawn.getNpcSpawnTemplate().getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); + final NpcSpawnTemplate npcSpawnTemplate = spawn.getNpcSpawnTemplate(); + final File spawnFile = npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try { final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getX() : spawn.getX()); + final String spawnY = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getY() : spawn.getY()); + final String spawnZ = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getZ() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 1ae0d55b23..e564b43119 100644 --- a/L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_10.2_MasterClass/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -128,8 +128,7 @@ public class NpcActionShift implements IActionShiftHandler } html.replace("%spawnai%", "" + template.getSpawnTemplate().getAI() + ""); } - - html.replace("%spawn%", npc.getSpawn().getX() + " " + npc.getSpawn().getY() + " " + npc.getSpawn().getZ()); + html.replace("%spawn%", (template != null ? template.getSpawnLocation().getX() : npc.getSpawn().getX()) + " " + (template != null ? template.getSpawnLocation().getY() : npc.getSpawn().getY()) + " " + (template != null ? template.getSpawnLocation().getZ() : npc.getSpawn().getZ())); if (npc.getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/data/SpawnTable.java index 19f0db5b3e..986e4f1195 100644 --- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -32,6 +32,7 @@ import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate; /** * Spawn data retriever. @@ -194,16 +195,17 @@ public class SpawnTable { final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; - final File spawnFile = spawn.getNpcSpawnTemplate() != null ? spawn.getNpcSpawnTemplate().getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); + final NpcSpawnTemplate npcSpawnTemplate = spawn.getNpcSpawnTemplate(); + final File spawnFile = npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try { final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getX() : spawn.getX()); + final String spawnY = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getY() : spawn.getY()); + final String spawnZ = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getZ() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_CT_0_Interlude/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_CT_0_Interlude/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 415e2091e3..76d224fb69 100644 --- a/L2J_Mobius_CT_0_Interlude/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_CT_0_Interlude/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -111,7 +111,8 @@ public class NpcActionShift implements IActionShiftHandler else { html.replace("%spawntype%", "Fixed"); - html.replace("%spawn%", ((Npc) target).getSpawn().getX() + " " + ((Npc) target).getSpawn().getY() + " " + ((Npc) target).getSpawn().getZ()); + final Location spawnLoc = ((Npc) target).getSpawn().getSpawnLocation() != null ? ((Npc) target).getSpawn().getSpawnLocation() : ((Npc) target).getSpawn(); + html.replace("%spawn%", spawnLoc.getX() + " " + spawnLoc.getY() + " " + spawnLoc.getZ()); } if (((Npc) target).getSpawn().getRespawnMinDelay() == 0) { diff --git a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/data/SpawnTable.java index e7cbe8423e..bcec58896d 100644 --- a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -42,6 +42,7 @@ import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.instancemanager.DayNightSpawnManager; import org.l2jmobius.gameserver.instancemanager.ZoneManager; +import org.l2jmobius.gameserver.model.Location; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.World; @@ -592,6 +593,7 @@ public class SpawnTable implements IXmlReader final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; final int npcSpawnTemplateId = spawn.getNpcSpawnTemplateId(); + final Location spawnLocation = spawn.getSpawnLocation(); final File spawnFile = npcSpawnTemplateId > 0 ? new File(_spawnTemplates.get(npcSpawnTemplateId)) : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try @@ -599,9 +601,9 @@ public class SpawnTable implements IXmlReader final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(spawnLocation != null ? spawnLocation.getX() : spawn.getX()); + final String spawnY = String.valueOf(spawnLocation != null ? spawnLocation.getY() : spawn.getY()); + final String spawnZ = String.valueOf(spawnLocation != null ? spawnLocation.getX() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/Spawn.java b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/Spawn.java index 93b6b1449a..1bc3bda1fa 100644 --- a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/Spawn.java +++ b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/gameserver/model/Spawn.java @@ -81,6 +81,7 @@ public class Spawn extends Location implements IIdentifiable, INamable private final Deque _spawnedNpcs = new ConcurrentLinkedDeque<>(); private boolean _randomWalk = false; // Is random walk private int _spawnTemplateId = 0; + private Location _spawnLocation = null; /** * Constructor of Spawn.
@@ -382,9 +383,14 @@ public class Spawn extends Location implements IIdentifiable, INamable else { // The Npc is spawned at the exact position (Lox, Locy, Locz) - newlocx = getX(); - newlocy = getY(); - newlocz = getZ(); + newlocx = _spawnLocation != null ? _spawnLocation.getX() : getX(); + newlocy = _spawnLocation != null ? _spawnLocation.getY() : getY(); + newlocz = _spawnLocation != null ? _spawnLocation.getZ() : getZ(); + + if (_spawnLocation == null) + { + _spawnLocation = new Location(newlocx, newlocy, newlocz); + } } // Check if npc is in water. @@ -618,6 +624,11 @@ public class Spawn extends Location implements IIdentifiable, INamable return _spawnTemplateId; } + public Location getSpawnLocation() + { + return _spawnLocation; + } + @Override public String toString() { diff --git a/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 732129f6f2..be6a689d4b 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -122,7 +122,8 @@ public class NpcActionShift implements IActionShiftHandler else { html.replace("%spawntype%", "Fixed"); - html.replace("%spawn%", ((Npc) target).getSpawn().getX() + " " + ((Npc) target).getSpawn().getY() + " " + ((Npc) target).getSpawn().getZ()); + final Location spawnLoc = ((Npc) target).getSpawn().getSpawnLocation() != null ? ((Npc) target).getSpawn().getSpawnLocation() : ((Npc) target).getSpawn(); + html.replace("%spawn%", spawnLoc.getX() + " " + spawnLoc.getY() + " " + spawnLoc.getZ()); } if (((Npc) target).getSpawn().getRespawnMinDelay() == 0) { diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/data/SpawnTable.java index e7cbe8423e..bcec58896d 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -42,6 +42,7 @@ import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.instancemanager.DayNightSpawnManager; import org.l2jmobius.gameserver.instancemanager.ZoneManager; +import org.l2jmobius.gameserver.model.Location; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.World; @@ -592,6 +593,7 @@ public class SpawnTable implements IXmlReader final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; final int npcSpawnTemplateId = spawn.getNpcSpawnTemplateId(); + final Location spawnLocation = spawn.getSpawnLocation(); final File spawnFile = npcSpawnTemplateId > 0 ? new File(_spawnTemplates.get(npcSpawnTemplateId)) : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try @@ -599,9 +601,9 @@ public class SpawnTable implements IXmlReader final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(spawnLocation != null ? spawnLocation.getX() : spawn.getX()); + final String spawnY = String.valueOf(spawnLocation != null ? spawnLocation.getY() : spawn.getY()); + final String spawnZ = String.valueOf(spawnLocation != null ? spawnLocation.getX() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/Spawn.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/Spawn.java index d530e37306..181f4a0db0 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/Spawn.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/Spawn.java @@ -81,6 +81,7 @@ public class Spawn extends Location implements IIdentifiable, INamable private final Deque _spawnedNpcs = new ConcurrentLinkedDeque<>(); private boolean _randomWalk = false; // Is random walk private int _spawnTemplateId = 0; + private Location _spawnLocation = null; /** * Constructor of Spawn.
@@ -382,9 +383,14 @@ public class Spawn extends Location implements IIdentifiable, INamable else { // The Npc is spawned at the exact position (Lox, Locy, Locz) - newlocx = getX(); - newlocy = getY(); - newlocz = getZ(); + newlocx = _spawnLocation != null ? _spawnLocation.getX() : getX(); + newlocy = _spawnLocation != null ? _spawnLocation.getY() : getY(); + newlocz = _spawnLocation != null ? _spawnLocation.getZ() : getZ(); + + if (_spawnLocation == null) + { + _spawnLocation = new Location(newlocx, newlocy, newlocz); + } } // Check if npc is in water. @@ -612,6 +618,11 @@ public class Spawn extends Location implements IIdentifiable, INamable return _spawnTemplateId; } + public Location getSpawnLocation() + { + return _spawnLocation; + } + @Override public String toString() { diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 732129f6f2..be6a689d4b 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -122,7 +122,8 @@ public class NpcActionShift implements IActionShiftHandler else { html.replace("%spawntype%", "Fixed"); - html.replace("%spawn%", ((Npc) target).getSpawn().getX() + " " + ((Npc) target).getSpawn().getY() + " " + ((Npc) target).getSpawn().getZ()); + final Location spawnLoc = ((Npc) target).getSpawn().getSpawnLocation() != null ? ((Npc) target).getSpawn().getSpawnLocation() : ((Npc) target).getSpawn(); + html.replace("%spawn%", spawnLoc.getX() + " " + spawnLoc.getY() + " " + spawnLoc.getZ()); } if (((Npc) target).getSpawn().getRespawnMinDelay() == 0) { diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/data/SpawnTable.java index e7cbe8423e..bcec58896d 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -42,6 +42,7 @@ import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.instancemanager.DayNightSpawnManager; import org.l2jmobius.gameserver.instancemanager.ZoneManager; +import org.l2jmobius.gameserver.model.Location; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.World; @@ -592,6 +593,7 @@ public class SpawnTable implements IXmlReader final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; final int npcSpawnTemplateId = spawn.getNpcSpawnTemplateId(); + final Location spawnLocation = spawn.getSpawnLocation(); final File spawnFile = npcSpawnTemplateId > 0 ? new File(_spawnTemplates.get(npcSpawnTemplateId)) : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try @@ -599,9 +601,9 @@ public class SpawnTable implements IXmlReader final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(spawnLocation != null ? spawnLocation.getX() : spawn.getX()); + final String spawnY = String.valueOf(spawnLocation != null ? spawnLocation.getY() : spawn.getY()); + final String spawnZ = String.valueOf(spawnLocation != null ? spawnLocation.getX() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file 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 93b6b1449a..1bc3bda1fa 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 @@ -81,6 +81,7 @@ public class Spawn extends Location implements IIdentifiable, INamable private final Deque _spawnedNpcs = new ConcurrentLinkedDeque<>(); private boolean _randomWalk = false; // Is random walk private int _spawnTemplateId = 0; + private Location _spawnLocation = null; /** * Constructor of Spawn.
@@ -382,9 +383,14 @@ public class Spawn extends Location implements IIdentifiable, INamable else { // The Npc is spawned at the exact position (Lox, Locy, Locz) - newlocx = getX(); - newlocy = getY(); - newlocz = getZ(); + newlocx = _spawnLocation != null ? _spawnLocation.getX() : getX(); + newlocy = _spawnLocation != null ? _spawnLocation.getY() : getY(); + newlocz = _spawnLocation != null ? _spawnLocation.getZ() : getZ(); + + if (_spawnLocation == null) + { + _spawnLocation = new Location(newlocx, newlocy, newlocz); + } } // Check if npc is in water. @@ -618,6 +624,11 @@ public class Spawn extends Location implements IIdentifiable, INamable return _spawnTemplateId; } + public Location getSpawnLocation() + { + return _spawnLocation; + } + @Override public String toString() { diff --git a/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 1ae0d55b23..e564b43119 100644 --- a/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_Classic_1.0/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -128,8 +128,7 @@ public class NpcActionShift implements IActionShiftHandler } html.replace("%spawnai%", "" + template.getSpawnTemplate().getAI() + ""); } - - html.replace("%spawn%", npc.getSpawn().getX() + " " + npc.getSpawn().getY() + " " + npc.getSpawn().getZ()); + html.replace("%spawn%", (template != null ? template.getSpawnLocation().getX() : npc.getSpawn().getX()) + " " + (template != null ? template.getSpawnLocation().getY() : npc.getSpawn().getY()) + " " + (template != null ? template.getSpawnLocation().getZ() : npc.getSpawn().getZ())); if (npc.getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); diff --git a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/data/SpawnTable.java index 19f0db5b3e..986e4f1195 100644 --- a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_Classic_1.0/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -32,6 +32,7 @@ import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate; /** * Spawn data retriever. @@ -194,16 +195,17 @@ public class SpawnTable { final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; - final File spawnFile = spawn.getNpcSpawnTemplate() != null ? spawn.getNpcSpawnTemplate().getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); + final NpcSpawnTemplate npcSpawnTemplate = spawn.getNpcSpawnTemplate(); + final File spawnFile = npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try { final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getX() : spawn.getX()); + final String spawnY = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getY() : spawn.getY()); + final String spawnZ = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getZ() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 1ae0d55b23..e564b43119 100644 --- a/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_Classic_1.5_AgeOfSplendor/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -128,8 +128,7 @@ public class NpcActionShift implements IActionShiftHandler } html.replace("%spawnai%", "" + template.getSpawnTemplate().getAI() + ""); } - - html.replace("%spawn%", npc.getSpawn().getX() + " " + npc.getSpawn().getY() + " " + npc.getSpawn().getZ()); + html.replace("%spawn%", (template != null ? template.getSpawnLocation().getX() : npc.getSpawn().getX()) + " " + (template != null ? template.getSpawnLocation().getY() : npc.getSpawn().getY()) + " " + (template != null ? template.getSpawnLocation().getZ() : npc.getSpawn().getZ())); if (npc.getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/data/SpawnTable.java index 19f0db5b3e..986e4f1195 100644 --- a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -32,6 +32,7 @@ import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate; /** * Spawn data retriever. @@ -194,16 +195,17 @@ public class SpawnTable { final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; - final File spawnFile = spawn.getNpcSpawnTemplate() != null ? spawn.getNpcSpawnTemplate().getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); + final NpcSpawnTemplate npcSpawnTemplate = spawn.getNpcSpawnTemplate(); + final File spawnFile = npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try { final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getX() : spawn.getX()); + final String spawnY = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getY() : spawn.getY()); + final String spawnZ = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getZ() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 1ae0d55b23..e564b43119 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -128,8 +128,7 @@ public class NpcActionShift implements IActionShiftHandler } html.replace("%spawnai%", "" + template.getSpawnTemplate().getAI() + ""); } - - html.replace("%spawn%", npc.getSpawn().getX() + " " + npc.getSpawn().getY() + " " + npc.getSpawn().getZ()); + html.replace("%spawn%", (template != null ? template.getSpawnLocation().getX() : npc.getSpawn().getX()) + " " + (template != null ? template.getSpawnLocation().getY() : npc.getSpawn().getY()) + " " + (template != null ? template.getSpawnLocation().getZ() : npc.getSpawn().getZ())); if (npc.getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/data/SpawnTable.java index 19f0db5b3e..986e4f1195 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -32,6 +32,7 @@ import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate; /** * Spawn data retriever. @@ -194,16 +195,17 @@ public class SpawnTable { final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; - final File spawnFile = spawn.getNpcSpawnTemplate() != null ? spawn.getNpcSpawnTemplate().getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); + final NpcSpawnTemplate npcSpawnTemplate = spawn.getNpcSpawnTemplate(); + final File spawnFile = npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try { final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getX() : spawn.getX()); + final String spawnY = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getY() : spawn.getY()); + final String spawnZ = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getZ() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 1ae0d55b23..e564b43119 100644 --- a/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_Classic_2.5_Zaken/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -128,8 +128,7 @@ public class NpcActionShift implements IActionShiftHandler } html.replace("%spawnai%", "" + template.getSpawnTemplate().getAI() + ""); } - - html.replace("%spawn%", npc.getSpawn().getX() + " " + npc.getSpawn().getY() + " " + npc.getSpawn().getZ()); + html.replace("%spawn%", (template != null ? template.getSpawnLocation().getX() : npc.getSpawn().getX()) + " " + (template != null ? template.getSpawnLocation().getY() : npc.getSpawn().getY()) + " " + (template != null ? template.getSpawnLocation().getZ() : npc.getSpawn().getZ())); if (npc.getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); diff --git a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/data/SpawnTable.java index 19f0db5b3e..986e4f1195 100644 --- a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -32,6 +32,7 @@ import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate; /** * Spawn data retriever. @@ -194,16 +195,17 @@ public class SpawnTable { final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; - final File spawnFile = spawn.getNpcSpawnTemplate() != null ? spawn.getNpcSpawnTemplate().getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); + final NpcSpawnTemplate npcSpawnTemplate = spawn.getNpcSpawnTemplate(); + final File spawnFile = npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try { final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getX() : spawn.getX()); + final String spawnY = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getY() : spawn.getY()); + final String spawnZ = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getZ() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 1ae0d55b23..e564b43119 100644 --- a/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_Classic_2.7_Antharas/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -128,8 +128,7 @@ public class NpcActionShift implements IActionShiftHandler } html.replace("%spawnai%", "" + template.getSpawnTemplate().getAI() + ""); } - - html.replace("%spawn%", npc.getSpawn().getX() + " " + npc.getSpawn().getY() + " " + npc.getSpawn().getZ()); + html.replace("%spawn%", (template != null ? template.getSpawnLocation().getX() : npc.getSpawn().getX()) + " " + (template != null ? template.getSpawnLocation().getY() : npc.getSpawn().getY()) + " " + (template != null ? template.getSpawnLocation().getZ() : npc.getSpawn().getZ())); if (npc.getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); diff --git a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/data/SpawnTable.java index 19f0db5b3e..986e4f1195 100644 --- a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -32,6 +32,7 @@ import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate; /** * Spawn data retriever. @@ -194,16 +195,17 @@ public class SpawnTable { final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; - final File spawnFile = spawn.getNpcSpawnTemplate() != null ? spawn.getNpcSpawnTemplate().getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); + final NpcSpawnTemplate npcSpawnTemplate = spawn.getNpcSpawnTemplate(); + final File spawnFile = npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try { final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getX() : spawn.getX()); + final String spawnY = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getY() : spawn.getY()); + final String spawnZ = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getZ() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 1ae0d55b23..e564b43119 100644 --- a/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_Classic_2.8_SevenSigns/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -128,8 +128,7 @@ public class NpcActionShift implements IActionShiftHandler } html.replace("%spawnai%", "" + template.getSpawnTemplate().getAI() + ""); } - - html.replace("%spawn%", npc.getSpawn().getX() + " " + npc.getSpawn().getY() + " " + npc.getSpawn().getZ()); + html.replace("%spawn%", (template != null ? template.getSpawnLocation().getX() : npc.getSpawn().getX()) + " " + (template != null ? template.getSpawnLocation().getY() : npc.getSpawn().getY()) + " " + (template != null ? template.getSpawnLocation().getZ() : npc.getSpawn().getZ())); if (npc.getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/data/SpawnTable.java index 19f0db5b3e..986e4f1195 100644 --- a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -32,6 +32,7 @@ import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate; /** * Spawn data retriever. @@ -194,16 +195,17 @@ public class SpawnTable { final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; - final File spawnFile = spawn.getNpcSpawnTemplate() != null ? spawn.getNpcSpawnTemplate().getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); + final NpcSpawnTemplate npcSpawnTemplate = spawn.getNpcSpawnTemplate(); + final File spawnFile = npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try { final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getX() : spawn.getX()); + final String spawnY = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getY() : spawn.getY()); + final String spawnZ = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getZ() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 1ae0d55b23..e564b43119 100644 --- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_Classic_2.9_SecretOfEmpire/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -128,8 +128,7 @@ public class NpcActionShift implements IActionShiftHandler } html.replace("%spawnai%", "" + template.getSpawnTemplate().getAI() + ""); } - - html.replace("%spawn%", npc.getSpawn().getX() + " " + npc.getSpawn().getY() + " " + npc.getSpawn().getZ()); + html.replace("%spawn%", (template != null ? template.getSpawnLocation().getX() : npc.getSpawn().getX()) + " " + (template != null ? template.getSpawnLocation().getY() : npc.getSpawn().getY()) + " " + (template != null ? template.getSpawnLocation().getZ() : npc.getSpawn().getZ())); if (npc.getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/data/SpawnTable.java index 19f0db5b3e..986e4f1195 100644 --- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -32,6 +32,7 @@ import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate; /** * Spawn data retriever. @@ -194,16 +195,17 @@ public class SpawnTable { final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; - final File spawnFile = spawn.getNpcSpawnTemplate() != null ? spawn.getNpcSpawnTemplate().getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); + final NpcSpawnTemplate npcSpawnTemplate = spawn.getNpcSpawnTemplate(); + final File spawnFile = npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try { final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getX() : spawn.getX()); + final String spawnY = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getY() : spawn.getY()); + final String spawnZ = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getZ() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 1ae0d55b23..e564b43119 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -128,8 +128,7 @@ public class NpcActionShift implements IActionShiftHandler } html.replace("%spawnai%", "" + template.getSpawnTemplate().getAI() + ""); } - - html.replace("%spawn%", npc.getSpawn().getX() + " " + npc.getSpawn().getY() + " " + npc.getSpawn().getZ()); + html.replace("%spawn%", (template != null ? template.getSpawnLocation().getX() : npc.getSpawn().getX()) + " " + (template != null ? template.getSpawnLocation().getY() : npc.getSpawn().getY()) + " " + (template != null ? template.getSpawnLocation().getZ() : npc.getSpawn().getZ())); if (npc.getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/data/SpawnTable.java index 19f0db5b3e..986e4f1195 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -32,6 +32,7 @@ import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate; /** * Spawn data retriever. @@ -194,16 +195,17 @@ public class SpawnTable { final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; - final File spawnFile = spawn.getNpcSpawnTemplate() != null ? spawn.getNpcSpawnTemplate().getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); + final NpcSpawnTemplate npcSpawnTemplate = spawn.getNpcSpawnTemplate(); + final File spawnFile = npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try { final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getX() : spawn.getX()); + final String spawnY = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getY() : spawn.getY()); + final String spawnZ = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getZ() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 1ae0d55b23..e564b43119 100644 --- a/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_Classic_Interlude/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -128,8 +128,7 @@ public class NpcActionShift implements IActionShiftHandler } html.replace("%spawnai%", "" + template.getSpawnTemplate().getAI() + ""); } - - html.replace("%spawn%", npc.getSpawn().getX() + " " + npc.getSpawn().getY() + " " + npc.getSpawn().getZ()); + html.replace("%spawn%", (template != null ? template.getSpawnLocation().getX() : npc.getSpawn().getX()) + " " + (template != null ? template.getSpawnLocation().getY() : npc.getSpawn().getY()) + " " + (template != null ? template.getSpawnLocation().getZ() : npc.getSpawn().getZ())); if (npc.getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/SpawnTable.java index 19f0db5b3e..986e4f1195 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -32,6 +32,7 @@ import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate; /** * Spawn data retriever. @@ -194,16 +195,17 @@ public class SpawnTable { final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; - final File spawnFile = spawn.getNpcSpawnTemplate() != null ? spawn.getNpcSpawnTemplate().getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); + final NpcSpawnTemplate npcSpawnTemplate = spawn.getNpcSpawnTemplate(); + final File spawnFile = npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try { final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getX() : spawn.getX()); + final String spawnY = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getY() : spawn.getY()); + final String spawnZ = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getZ() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 1ae0d55b23..e564b43119 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -128,8 +128,7 @@ public class NpcActionShift implements IActionShiftHandler } html.replace("%spawnai%", "" + template.getSpawnTemplate().getAI() + ""); } - - html.replace("%spawn%", npc.getSpawn().getX() + " " + npc.getSpawn().getY() + " " + npc.getSpawn().getZ()); + html.replace("%spawn%", (template != null ? template.getSpawnLocation().getX() : npc.getSpawn().getX()) + " " + (template != null ? template.getSpawnLocation().getY() : npc.getSpawn().getY()) + " " + (template != null ? template.getSpawnLocation().getZ() : npc.getSpawn().getZ())); if (npc.getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/SpawnTable.java index 19f0db5b3e..986e4f1195 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -32,6 +32,7 @@ import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate; /** * Spawn data retriever. @@ -194,16 +195,17 @@ public class SpawnTable { final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; - final File spawnFile = spawn.getNpcSpawnTemplate() != null ? spawn.getNpcSpawnTemplate().getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); + final NpcSpawnTemplate npcSpawnTemplate = spawn.getNpcSpawnTemplate(); + final File spawnFile = npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try { final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getX() : spawn.getX()); + final String spawnY = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getY() : spawn.getY()); + final String spawnZ = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getZ() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 1ae0d55b23..e564b43119 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -128,8 +128,7 @@ public class NpcActionShift implements IActionShiftHandler } html.replace("%spawnai%", "" + template.getSpawnTemplate().getAI() + ""); } - - html.replace("%spawn%", npc.getSpawn().getX() + " " + npc.getSpawn().getY() + " " + npc.getSpawn().getZ()); + html.replace("%spawn%", (template != null ? template.getSpawnLocation().getX() : npc.getSpawn().getX()) + " " + (template != null ? template.getSpawnLocation().getY() : npc.getSpawn().getY()) + " " + (template != null ? template.getSpawnLocation().getZ() : npc.getSpawn().getZ())); if (npc.getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/data/SpawnTable.java index 19f0db5b3e..986e4f1195 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -32,6 +32,7 @@ import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate; /** * Spawn data retriever. @@ -194,16 +195,17 @@ public class SpawnTable { final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; - final File spawnFile = spawn.getNpcSpawnTemplate() != null ? spawn.getNpcSpawnTemplate().getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); + final NpcSpawnTemplate npcSpawnTemplate = spawn.getNpcSpawnTemplate(); + final File spawnFile = npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try { final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getX() : spawn.getX()); + final String spawnY = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getY() : spawn.getY()); + final String spawnZ = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getZ() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_Essence_6.1_BattleChronicle/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 1ae0d55b23..e564b43119 100644 --- a/L2J_Mobius_Essence_6.1_BattleChronicle/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_Essence_6.1_BattleChronicle/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -128,8 +128,7 @@ public class NpcActionShift implements IActionShiftHandler } html.replace("%spawnai%", "" + template.getSpawnTemplate().getAI() + ""); } - - html.replace("%spawn%", npc.getSpawn().getX() + " " + npc.getSpawn().getY() + " " + npc.getSpawn().getZ()); + html.replace("%spawn%", (template != null ? template.getSpawnLocation().getX() : npc.getSpawn().getX()) + " " + (template != null ? template.getSpawnLocation().getY() : npc.getSpawn().getY()) + " " + (template != null ? template.getSpawnLocation().getZ() : npc.getSpawn().getZ())); if (npc.getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/data/SpawnTable.java index 19f0db5b3e..986e4f1195 100644 --- a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -32,6 +32,7 @@ import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate; /** * Spawn data retriever. @@ -194,16 +195,17 @@ public class SpawnTable { final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; - final File spawnFile = spawn.getNpcSpawnTemplate() != null ? spawn.getNpcSpawnTemplate().getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); + final NpcSpawnTemplate npcSpawnTemplate = spawn.getNpcSpawnTemplate(); + final File spawnFile = npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try { final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getX() : spawn.getX()); + final String spawnY = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getY() : spawn.getY()); + final String spawnZ = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getZ() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file diff --git a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java index 1ae0d55b23..e564b43119 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/actionshifthandlers/NpcActionShift.java @@ -128,8 +128,7 @@ public class NpcActionShift implements IActionShiftHandler } html.replace("%spawnai%", "" + template.getSpawnTemplate().getAI() + ""); } - - html.replace("%spawn%", npc.getSpawn().getX() + " " + npc.getSpawn().getY() + " " + npc.getSpawn().getZ()); + html.replace("%spawn%", (template != null ? template.getSpawnLocation().getX() : npc.getSpawn().getX()) + " " + (template != null ? template.getSpawnLocation().getY() : npc.getSpawn().getY()) + " " + (template != null ? template.getSpawnLocation().getZ() : npc.getSpawn().getZ())); if (npc.getSpawn().getRespawnMinDelay() == 0) { html.replace("%resp%", "None"); diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/data/SpawnTable.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/data/SpawnTable.java index 19f0db5b3e..986e4f1195 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/data/SpawnTable.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/data/SpawnTable.java @@ -32,6 +32,7 @@ import org.l2jmobius.Config; import org.l2jmobius.gameserver.data.xml.NpcData; import org.l2jmobius.gameserver.model.Spawn; import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate; /** * Spawn data retriever. @@ -194,16 +195,17 @@ public class SpawnTable { final int x = ((spawn.getX() - World.WORLD_X_MIN) >> 15) + World.TILE_X_MIN; final int y = ((spawn.getY() - World.WORLD_Y_MIN) >> 15) + World.TILE_Y_MIN; - final File spawnFile = spawn.getNpcSpawnTemplate() != null ? spawn.getNpcSpawnTemplate().getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); + final NpcSpawnTemplate npcSpawnTemplate = spawn.getNpcSpawnTemplate(); + final File spawnFile = npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnTemplate().getFile() : new File(OTHER_XML_FOLDER + "/" + x + "_" + y + ".xml"); final File tempFile = new File(spawnFile.getAbsolutePath().substring(Config.DATAPACK_ROOT.getAbsolutePath().length() + 1).replace('\\', '/') + ".tmp"); try { final BufferedReader reader = new BufferedReader(new FileReader(spawnFile)); final BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile)); final String spawnId = String.valueOf(spawn.getId()); - final String spawnX = String.valueOf(spawn.getX()); - final String spawnY = String.valueOf(spawn.getY()); - final String spawnZ = String.valueOf(spawn.getZ()); + final String spawnX = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getX() : spawn.getX()); + final String spawnY = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getY() : spawn.getY()); + final String spawnZ = String.valueOf(npcSpawnTemplate != null ? npcSpawnTemplate.getSpawnLocation().getZ() : spawn.getZ()); boolean found = false; // in XML you can have more than one spawn with same coords boolean isMultiLine = false; // in case spawn has more stats boolean lastLineFound = false; // used to check for empty file