From ecee43306c83db8b119fc0210b8c662e4ae19f44 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Sun, 10 Sep 2017 13:00:26 +0000 Subject: [PATCH] Fixed GranBossManager stopping when boss NPC template not found. --- .../instancemanager/GrandBossManager.java | 38 +++++++++++-------- .../instancemanager/GrandBossManager.java | 38 +++++++++++-------- .../instancemanager/GrandBossManager.java | 38 +++++++++++-------- .../instancemanager/GrandBossManager.java | 38 +++++++++++-------- 4 files changed, 88 insertions(+), 64 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java index e7c0bad9c5..c06464b525 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java @@ -66,26 +66,32 @@ public final class GrandBossManager implements IStorable Statement s = con.createStatement(); ResultSet rs = s.executeQuery("SELECT * from grandboss_data ORDER BY boss_id")) { + // Read all info from DB, and store it for AI to read and decide what to do faster than accessing DB in real time while (rs.next()) { - // Read all info from DB, and store it for AI to read and decide what to do - // faster than accessing DB in real time - final StatsSet info = new StatsSet(); final int bossId = rs.getInt("boss_id"); - info.set("loc_x", rs.getInt("loc_x")); - info.set("loc_y", rs.getInt("loc_y")); - info.set("loc_z", rs.getInt("loc_z")); - info.set("heading", rs.getInt("heading")); - info.set("respawn_time", rs.getLong("respawn_time")); - info.set("currentHP", rs.getDouble("currentHP")); - info.set("currentMP", rs.getDouble("currentMP")); - final int status = rs.getInt("status"); - _bossStatus.put(bossId, status); - _storedInfo.put(bossId, info); - _log.info(getClass().getSimpleName() + ": " + NpcData.getInstance().getTemplate(bossId).getName() + "(" + bossId + ") status is " + status); - if (status > 0) + if (NpcData.getInstance().getTemplate(bossId) != null) { - _log.info(getClass().getSimpleName() + ": Next spawn date of " + NpcData.getInstance().getTemplate(bossId).getName() + " is " + new Date(info.getLong("respawn_time"))); + final StatsSet info = new StatsSet(); + info.set("loc_x", rs.getInt("loc_x")); + info.set("loc_y", rs.getInt("loc_y")); + info.set("loc_z", rs.getInt("loc_z")); + info.set("heading", rs.getInt("heading")); + info.set("respawn_time", rs.getLong("respawn_time")); + info.set("currentHP", rs.getDouble("currentHP")); + info.set("currentMP", rs.getDouble("currentMP")); + final int status = rs.getInt("status"); + _bossStatus.put(bossId, status); + _storedInfo.put(bossId, info); + _log.info(getClass().getSimpleName() + ": " + NpcData.getInstance().getTemplate(bossId).getName() + "(" + bossId + ") status is " + status); + if (status > 0) + { + _log.info(getClass().getSimpleName() + ": Next spawn date of " + NpcData.getInstance().getTemplate(bossId).getName() + " is " + new Date(info.getLong("respawn_time"))); + } + } + else + { + _log.warning(getClass().getSimpleName() + ": Could not find GrandBoss NPC template for " + bossId); } } _log.info(getClass().getSimpleName() + ": Loaded " + _storedInfo.size() + " Instances."); diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java index e7c0bad9c5..c06464b525 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java @@ -66,26 +66,32 @@ public final class GrandBossManager implements IStorable Statement s = con.createStatement(); ResultSet rs = s.executeQuery("SELECT * from grandboss_data ORDER BY boss_id")) { + // Read all info from DB, and store it for AI to read and decide what to do faster than accessing DB in real time while (rs.next()) { - // Read all info from DB, and store it for AI to read and decide what to do - // faster than accessing DB in real time - final StatsSet info = new StatsSet(); final int bossId = rs.getInt("boss_id"); - info.set("loc_x", rs.getInt("loc_x")); - info.set("loc_y", rs.getInt("loc_y")); - info.set("loc_z", rs.getInt("loc_z")); - info.set("heading", rs.getInt("heading")); - info.set("respawn_time", rs.getLong("respawn_time")); - info.set("currentHP", rs.getDouble("currentHP")); - info.set("currentMP", rs.getDouble("currentMP")); - final int status = rs.getInt("status"); - _bossStatus.put(bossId, status); - _storedInfo.put(bossId, info); - _log.info(getClass().getSimpleName() + ": " + NpcData.getInstance().getTemplate(bossId).getName() + "(" + bossId + ") status is " + status); - if (status > 0) + if (NpcData.getInstance().getTemplate(bossId) != null) { - _log.info(getClass().getSimpleName() + ": Next spawn date of " + NpcData.getInstance().getTemplate(bossId).getName() + " is " + new Date(info.getLong("respawn_time"))); + final StatsSet info = new StatsSet(); + info.set("loc_x", rs.getInt("loc_x")); + info.set("loc_y", rs.getInt("loc_y")); + info.set("loc_z", rs.getInt("loc_z")); + info.set("heading", rs.getInt("heading")); + info.set("respawn_time", rs.getLong("respawn_time")); + info.set("currentHP", rs.getDouble("currentHP")); + info.set("currentMP", rs.getDouble("currentMP")); + final int status = rs.getInt("status"); + _bossStatus.put(bossId, status); + _storedInfo.put(bossId, info); + _log.info(getClass().getSimpleName() + ": " + NpcData.getInstance().getTemplate(bossId).getName() + "(" + bossId + ") status is " + status); + if (status > 0) + { + _log.info(getClass().getSimpleName() + ": Next spawn date of " + NpcData.getInstance().getTemplate(bossId).getName() + " is " + new Date(info.getLong("respawn_time"))); + } + } + else + { + _log.warning(getClass().getSimpleName() + ": Could not find GrandBoss NPC template for " + bossId); } } _log.info(getClass().getSimpleName() + ": Loaded " + _storedInfo.size() + " Instances."); diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java index e7c0bad9c5..c06464b525 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java @@ -66,26 +66,32 @@ public final class GrandBossManager implements IStorable Statement s = con.createStatement(); ResultSet rs = s.executeQuery("SELECT * from grandboss_data ORDER BY boss_id")) { + // Read all info from DB, and store it for AI to read and decide what to do faster than accessing DB in real time while (rs.next()) { - // Read all info from DB, and store it for AI to read and decide what to do - // faster than accessing DB in real time - final StatsSet info = new StatsSet(); final int bossId = rs.getInt("boss_id"); - info.set("loc_x", rs.getInt("loc_x")); - info.set("loc_y", rs.getInt("loc_y")); - info.set("loc_z", rs.getInt("loc_z")); - info.set("heading", rs.getInt("heading")); - info.set("respawn_time", rs.getLong("respawn_time")); - info.set("currentHP", rs.getDouble("currentHP")); - info.set("currentMP", rs.getDouble("currentMP")); - final int status = rs.getInt("status"); - _bossStatus.put(bossId, status); - _storedInfo.put(bossId, info); - _log.info(getClass().getSimpleName() + ": " + NpcData.getInstance().getTemplate(bossId).getName() + "(" + bossId + ") status is " + status); - if (status > 0) + if (NpcData.getInstance().getTemplate(bossId) != null) { - _log.info(getClass().getSimpleName() + ": Next spawn date of " + NpcData.getInstance().getTemplate(bossId).getName() + " is " + new Date(info.getLong("respawn_time"))); + final StatsSet info = new StatsSet(); + info.set("loc_x", rs.getInt("loc_x")); + info.set("loc_y", rs.getInt("loc_y")); + info.set("loc_z", rs.getInt("loc_z")); + info.set("heading", rs.getInt("heading")); + info.set("respawn_time", rs.getLong("respawn_time")); + info.set("currentHP", rs.getDouble("currentHP")); + info.set("currentMP", rs.getDouble("currentMP")); + final int status = rs.getInt("status"); + _bossStatus.put(bossId, status); + _storedInfo.put(bossId, info); + _log.info(getClass().getSimpleName() + ": " + NpcData.getInstance().getTemplate(bossId).getName() + "(" + bossId + ") status is " + status); + if (status > 0) + { + _log.info(getClass().getSimpleName() + ": Next spawn date of " + NpcData.getInstance().getTemplate(bossId).getName() + " is " + new Date(info.getLong("respawn_time"))); + } + } + else + { + _log.warning(getClass().getSimpleName() + ": Could not find GrandBoss NPC template for " + bossId); } } _log.info(getClass().getSimpleName() + ": Loaded " + _storedInfo.size() + " Instances."); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java index e7c0bad9c5..c06464b525 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java @@ -66,26 +66,32 @@ public final class GrandBossManager implements IStorable Statement s = con.createStatement(); ResultSet rs = s.executeQuery("SELECT * from grandboss_data ORDER BY boss_id")) { + // Read all info from DB, and store it for AI to read and decide what to do faster than accessing DB in real time while (rs.next()) { - // Read all info from DB, and store it for AI to read and decide what to do - // faster than accessing DB in real time - final StatsSet info = new StatsSet(); final int bossId = rs.getInt("boss_id"); - info.set("loc_x", rs.getInt("loc_x")); - info.set("loc_y", rs.getInt("loc_y")); - info.set("loc_z", rs.getInt("loc_z")); - info.set("heading", rs.getInt("heading")); - info.set("respawn_time", rs.getLong("respawn_time")); - info.set("currentHP", rs.getDouble("currentHP")); - info.set("currentMP", rs.getDouble("currentMP")); - final int status = rs.getInt("status"); - _bossStatus.put(bossId, status); - _storedInfo.put(bossId, info); - _log.info(getClass().getSimpleName() + ": " + NpcData.getInstance().getTemplate(bossId).getName() + "(" + bossId + ") status is " + status); - if (status > 0) + if (NpcData.getInstance().getTemplate(bossId) != null) { - _log.info(getClass().getSimpleName() + ": Next spawn date of " + NpcData.getInstance().getTemplate(bossId).getName() + " is " + new Date(info.getLong("respawn_time"))); + final StatsSet info = new StatsSet(); + info.set("loc_x", rs.getInt("loc_x")); + info.set("loc_y", rs.getInt("loc_y")); + info.set("loc_z", rs.getInt("loc_z")); + info.set("heading", rs.getInt("heading")); + info.set("respawn_time", rs.getLong("respawn_time")); + info.set("currentHP", rs.getDouble("currentHP")); + info.set("currentMP", rs.getDouble("currentMP")); + final int status = rs.getInt("status"); + _bossStatus.put(bossId, status); + _storedInfo.put(bossId, info); + _log.info(getClass().getSimpleName() + ": " + NpcData.getInstance().getTemplate(bossId).getName() + "(" + bossId + ") status is " + status); + if (status > 0) + { + _log.info(getClass().getSimpleName() + ": Next spawn date of " + NpcData.getInstance().getTemplate(bossId).getName() + " is " + new Date(info.getLong("respawn_time"))); + } + } + else + { + _log.warning(getClass().getSimpleName() + ": Could not find GrandBoss NPC template for " + bossId); } } _log.info(getClass().getSimpleName() + ": Loaded " + _storedInfo.size() + " Instances.");