From de3818aef6919e6923f28d7937aff54f6c1a8fd4 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Fri, 14 Apr 2023 18:19:43 -0400 Subject: [PATCH] Equip lookups now use bootymap --- src/engine/db/handlers/dbItemBaseHandler.java | 43 ------------------- src/engine/gameManager/NPCManager.java | 5 --- src/engine/objects/MobBase.java | 2 +- src/engine/objects/NPC.java | 2 +- src/engine/server/world/WorldServer.java | 3 -- 5 files changed, 2 insertions(+), 53 deletions(-) diff --git a/src/engine/db/handlers/dbItemBaseHandler.java b/src/engine/db/handlers/dbItemBaseHandler.java index 0bb90bcb..0b6911d6 100644 --- a/src/engine/db/handlers/dbItemBaseHandler.java +++ b/src/engine/db/handlers/dbItemBaseHandler.java @@ -107,49 +107,6 @@ public class dbItemBaseHandler extends dbHandlerBase { } } - public HashMap> LOAD_EQUIPMENT_FOR_NPC_AND_MOBS() { - - HashMap> equipmentSets; - BootySetEntry equipmentSetEntry; - int equipSetID; - - equipmentSets = new HashMap<>(); - int recordsRead = 0; - - prepareCallable("SELECT * FROM static_npc_bootySet WHERE bootyType='EQUIP'"); - - try { - ResultSet rs = executeQuery(); - - while (rs.next()) { - - recordsRead++; - - equipSetID = rs.getInt("bootySet"); - equipmentSetEntry = new BootySetEntry(rs); - - if (equipmentSets.get(equipSetID) == null){ - ArrayList equipList = new ArrayList<>(); - equipList.add(equipmentSetEntry); - equipmentSets.put(equipSetID, equipList); - } - else{ - ArrayListequipList = equipmentSets.get(equipSetID); - equipList.add(equipmentSetEntry); - equipmentSets.put(equipSetID, equipList); - } - } - - Logger.info("read: " + recordsRead + " cached: " + equipmentSets.size()); - - } catch (SQLException e) { - Logger.error( e.toString()); - } finally { - closeCallable(); - } - return equipmentSets; - } - public HashMap> LOAD_RUNES_FOR_NPC_AND_MOBS() { HashMap> runeSets = new HashMap<>(); diff --git a/src/engine/gameManager/NPCManager.java b/src/engine/gameManager/NPCManager.java index b537a458..b3bef55f 100644 --- a/src/engine/gameManager/NPCManager.java +++ b/src/engine/gameManager/NPCManager.java @@ -18,14 +18,9 @@ import java.util.HashMap; public enum NPCManager { NPC_MANAGER; - public static HashMap> _equipmentSetMap = new HashMap<>(); public static HashMap> _runeSetMap = new HashMap<>(); public static HashMap> _bootySetMap = new HashMap<>(); - public static void LoadAllEquipmentSets() { - _equipmentSetMap = DbManager.ItemBaseQueries.LOAD_EQUIPMENT_FOR_NPC_AND_MOBS(); - } - public static void LoadAllRuneSets() { _runeSetMap = DbManager.ItemBaseQueries.LOAD_RUNES_FOR_NPC_AND_MOBS(); } diff --git a/src/engine/objects/MobBase.java b/src/engine/objects/MobBase.java index e8c02e4f..1a905cd0 100644 --- a/src/engine/objects/MobBase.java +++ b/src/engine/objects/MobBase.java @@ -152,7 +152,7 @@ public class MobBase extends AbstractGameObject { if (equipmentSetID == 0) return equip; - equipList = NPCManager._equipmentSetMap.get(equipmentSetID); + equipList = NPCManager._bootySetMap.get(equipmentSetID); if (equipList == null) return equip; diff --git a/src/engine/objects/NPC.java b/src/engine/objects/NPC.java index c4b9203e..e4690947 100644 --- a/src/engine/objects/NPC.java +++ b/src/engine/objects/NPC.java @@ -1645,7 +1645,7 @@ public class NPC extends AbstractCharacter { public static boolean UpdateEquipSetID(NPC npc, int equipSetID){ - if (!NPCManager._equipmentSetMap.containsKey(equipSetID)) + if (!NPCManager._bootySetMap.containsKey(equipSetID)) return false; if (!DbManager.NPCQueries.UPDATE_EQUIPSET(npc, equipSetID)) diff --git a/src/engine/server/world/WorldServer.java b/src/engine/server/world/WorldServer.java index 28bc0a2c..af4224a2 100644 --- a/src/engine/server/world/WorldServer.java +++ b/src/engine/server/world/WorldServer.java @@ -282,9 +282,6 @@ public class WorldServer { Logger.info("Loading PromotionClasses"); DbManager.PromotionQueries.GET_ALL_PROMOTIONS(); - Logger.info("Loading NPC and Mob Equipment Sets"); - NPCManager.LoadAllEquipmentSets(); - Logger.info("Loading NPC and Mob Rune Sets"); NPCManager.LoadAllRuneSets();