From 2e1e88325bb326a1dc73de6c1f5a02ea492c2700 Mon Sep 17 00:00:00 2001 From: Zoey76 <zoey_76@msn.com> Date: Tue, 30 Dec 2014 17:42:01 -0200 Subject: [PATCH] DataPack part for L2J/L2J_Server@39fdc7675cef35572a92050e27f810353eb83412 --- .../ai/npc/ForgeOfTheGods/TarBeetleSpawn.java | 7 ++--- .../ai/npc/NpcBuffers/NpcBuffersData.java | 9 ++++--- .../scripts/hellbound/HellboundPointData.java | 26 +++++++++---------- .../scripts/hellbound/HellboundSpawns.java | 17 ++++++------ 4 files changed, 31 insertions(+), 28 deletions(-) diff --git a/L2J_DataPack/dist/game/data/scripts/ai/npc/ForgeOfTheGods/TarBeetleSpawn.java b/L2J_DataPack/dist/game/data/scripts/ai/npc/ForgeOfTheGods/TarBeetleSpawn.java index c7700cfdd6..38939d4502 100644 --- a/L2J_DataPack/dist/game/data/scripts/ai/npc/ForgeOfTheGods/TarBeetleSpawn.java +++ b/L2J_DataPack/dist/game/data/scripts/ai/npc/ForgeOfTheGods/TarBeetleSpawn.java @@ -24,6 +24,7 @@ import java.util.concurrent.ScheduledFuture; import javolution.util.FastList; +import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; @@ -41,7 +42,7 @@ import com.l2jserver.util.Rnd; * Tar Beetle zone spawn * @author malyelfik */ -public class TarBeetleSpawn extends DocumentParser +public class TarBeetleSpawn implements DocumentParser { private final List<SpawnZone> zones = new ArrayList<>(); private ScheduledFuture<?> spawnTask; @@ -64,10 +65,10 @@ public class TarBeetleSpawn extends DocumentParser } @Override - protected void parseDocument() + public void parseDocument(Document doc) { int i = 0; - for (Node d = getCurrentDocument().getFirstChild(); d != null; d = d.getNextSibling()) + for (Node d = doc.getFirstChild(); d != null; d = d.getNextSibling()) { if (d.getNodeName().equals("list")) { diff --git a/L2J_DataPack/dist/game/data/scripts/ai/npc/NpcBuffers/NpcBuffersData.java b/L2J_DataPack/dist/game/data/scripts/ai/npc/NpcBuffers/NpcBuffersData.java index 3cd0b1d622..f7c5a0a215 100644 --- a/L2J_DataPack/dist/game/data/scripts/ai/npc/NpcBuffers/NpcBuffersData.java +++ b/L2J_DataPack/dist/game/data/scripts/ai/npc/NpcBuffers/NpcBuffersData.java @@ -24,6 +24,7 @@ import java.util.Map; import java.util.Set; import java.util.logging.Level; +import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; @@ -33,7 +34,7 @@ import com.l2jserver.gameserver.model.StatsSet; /** * @author UnAfraid */ -public class NpcBuffersData extends DocumentParser +public class NpcBuffersData implements DocumentParser { private final Map<Integer, NpcBufferData> _npcBuffers = new HashMap<>(); @@ -46,16 +47,16 @@ public class NpcBuffersData extends DocumentParser public void load() { parseDatapackFile("data/scripts/ai/npc/NpcBuffers/NpcBuffersData.xml"); - _log.log(Level.INFO, getClass().getSimpleName() + ": Loaded: " + _npcBuffers.size() + " buffers data."); + LOGGER.log(Level.INFO, getClass().getSimpleName() + ": Loaded: " + _npcBuffers.size() + " buffers data."); } @Override - protected void parseDocument() + public void parseDocument(Document doc) { StatsSet set; Node attr; NamedNodeMap attrs; - for (Node n = getCurrentDocument().getFirstChild(); n != null; n = n.getNextSibling()) + for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) { if ("list".equalsIgnoreCase(n.getNodeName())) { diff --git a/L2J_DataPack/dist/game/data/scripts/hellbound/HellboundPointData.java b/L2J_DataPack/dist/game/data/scripts/hellbound/HellboundPointData.java index cbfb25894b..0dd732cf11 100644 --- a/L2J_DataPack/dist/game/data/scripts/hellbound/HellboundPointData.java +++ b/L2J_DataPack/dist/game/data/scripts/hellbound/HellboundPointData.java @@ -21,6 +21,7 @@ package hellbound; import java.util.HashMap; import java.util.Map; +import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; @@ -30,7 +31,7 @@ import com.l2jserver.gameserver.engines.DocumentParser; * Point data parser. * @author Zoey76 */ -public final class HellboundPointData extends DocumentParser +public final class HellboundPointData implements DocumentParser { private final Map<Integer, int[]> _pointsInfo = new HashMap<>(); @@ -44,13 +45,13 @@ public final class HellboundPointData extends DocumentParser { _pointsInfo.clear(); parseDatapackFile("data/scripts/hellbound/hellboundTrustPoints.xml"); - _log.info(getClass().getSimpleName() + ": Loaded " + _pointsInfo.size() + " trust point reward data."); + LOGGER.info(getClass().getSimpleName() + ": Loaded " + _pointsInfo.size() + " trust point reward data."); } @Override - protected void parseDocument() + public void parseDocument(Document doc) { - for (Node n = getCurrentDocument().getFirstChild(); n != null; n = n.getNextSibling()) + for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling()) { if ("list".equals(n.getNodeName())) { @@ -74,36 +75,35 @@ public final class HellboundPointData extends DocumentParser Node att = attrs.getNamedItem("id"); if (att == null) { - _log.severe(getClass().getSimpleName() + ": Missing NPC ID, skipping record!"); + LOGGER.severe(getClass().getSimpleName() + ": Missing NPC ID, skipping record!"); return; } - int npcId = Integer.parseInt(att.getNodeValue()); - + final int npcId = Integer.parseInt(att.getNodeValue()); att = attrs.getNamedItem("points"); if (att == null) { - _log.severe("[Hellbound Trust Points Info] Missing reward point info for NPC ID " + npcId + ", skipping record"); + LOGGER.severe("[Hellbound Trust Points Info] Missing reward point info for NPC ID " + npcId + ", skipping record"); return; } - int points = Integer.parseInt(att.getNodeValue()); + final int points = Integer.parseInt(att.getNodeValue()); att = attrs.getNamedItem("minHellboundLvl"); if (att == null) { - _log.severe("[Hellbound Trust Points Info] Missing minHellboundLvl info for NPC ID " + npcId + ", skipping record"); + LOGGER.severe("[Hellbound Trust Points Info] Missing minHellboundLvl info for NPC ID " + npcId + ", skipping record"); return; } - int minHbLvl = Integer.parseInt(att.getNodeValue()); + final int minHbLvl = Integer.parseInt(att.getNodeValue()); att = attrs.getNamedItem("maxHellboundLvl"); if (att == null) { - _log.severe("[Hellbound Trust Points Info] Missing maxHellboundLvl info for NPC ID " + npcId + ", skipping record"); + LOGGER.severe("[Hellbound Trust Points Info] Missing maxHellboundLvl info for NPC ID " + npcId + ", skipping record"); return; } - int maxHbLvl = Integer.parseInt(att.getNodeValue()); + final int maxHbLvl = Integer.parseInt(att.getNodeValue()); att = attrs.getNamedItem("lowestTrustLimit"); final int lowestTrustLimit = (att == null) ? 0 : Integer.parseInt(att.getNodeValue()); diff --git a/L2J_DataPack/dist/game/data/scripts/hellbound/HellboundSpawns.java b/L2J_DataPack/dist/game/data/scripts/hellbound/HellboundSpawns.java index 8e5b66309b..ad8ce8dae8 100644 --- a/L2J_DataPack/dist/game/data/scripts/hellbound/HellboundSpawns.java +++ b/L2J_DataPack/dist/game/data/scripts/hellbound/HellboundSpawns.java @@ -23,6 +23,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; @@ -37,7 +38,7 @@ import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate; * Hellbound Spawns parser. * @author Zoey76 */ -public final class HellboundSpawns extends DocumentParser +public final class HellboundSpawns implements DocumentParser { private final List<L2Spawn> _spawns = new ArrayList<>(); private final Map<Integer, int[]> _spawnLevels = new HashMap<>(); @@ -53,13 +54,13 @@ public final class HellboundSpawns extends DocumentParser _spawns.clear(); _spawnLevels.clear(); parseDatapackFile("data/scripts/hellbound/hellboundSpawns.xml"); - _log.info(getClass().getSimpleName() + ": Loaded " + _spawns.size() + " Hellbound spawns."); + LOGGER.info(getClass().getSimpleName() + ": Loaded " + _spawns.size() + " Hellbound spawns."); } @Override - protected void parseDocument() + public void parseDocument(Document doc) { - for (Node node = getCurrentDocument().getFirstChild(); node != null; node = node.getNextSibling()) + for (Node node = doc.getFirstChild(); node != null; node = node.getNextSibling()) { if ("list".equals(node.getNodeName())) { @@ -82,7 +83,7 @@ public final class HellboundSpawns extends DocumentParser final Node id = npc.getAttributes().getNamedItem("id"); if (id == null) { - _log.severe(getClass().getSimpleName() + ": Missing NPC ID, skipping record!"); + LOGGER.severe(getClass().getSimpleName() + ": Missing NPC ID, skipping record!"); return; } @@ -90,7 +91,7 @@ public final class HellboundSpawns extends DocumentParser final L2NpcTemplate template = NpcData.getInstance().getTemplate(npcId); if (template == null) { - _log.warning(getClass().getSimpleName() + ": Missing NPC template for ID: " + npcId + "!"); + LOGGER.warning(getClass().getSimpleName() + ": Missing NPC template for ID: " + npcId + "!"); return; } @@ -132,7 +133,7 @@ public final class HellboundSpawns extends DocumentParser spawn.setAmount(1); if (loc == null) { - _log.warning("location is null"); + LOGGER.warning("Hellbound spawn location is null!"); } spawn.setLocation(loc); spawn.setRespawnDelay(delay, randomInterval); @@ -146,7 +147,7 @@ public final class HellboundSpawns extends DocumentParser } catch (SecurityException | ClassNotFoundException | NoSuchMethodException e) { - _log.warning(getClass().getSimpleName() + ": Couldn't load spawns: " + e.getMessage()); + LOGGER.warning(getClass().getSimpleName() + ": Couldn't load spawns: " + e.getMessage()); } } } -- GitLab