Equip lookups now use bootymap

This commit is contained in:
2023-04-14 18:19:43 -04:00
parent 5d0166a29a
commit de3818aef6
5 changed files with 2 additions and 53 deletions
@@ -107,49 +107,6 @@ public class dbItemBaseHandler extends dbHandlerBase {
}
}
public HashMap<Integer, ArrayList<BootySetEntry>> LOAD_EQUIPMENT_FOR_NPC_AND_MOBS() {
HashMap<Integer, ArrayList<BootySetEntry>> 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<BootySetEntry> equipList = new ArrayList<>();
equipList.add(equipmentSetEntry);
equipmentSets.put(equipSetID, equipList);
}
else{
ArrayList<BootySetEntry>equipList = 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<Integer, ArrayList<Integer>> LOAD_RUNES_FOR_NPC_AND_MOBS() {
HashMap<Integer, ArrayList<Integer>> runeSets = new HashMap<>();
-5
View File
@@ -18,14 +18,9 @@ import java.util.HashMap;
public enum NPCManager {
NPC_MANAGER;
public static HashMap<Integer, ArrayList<BootySetEntry>> _equipmentSetMap = new HashMap<>();
public static HashMap<Integer, ArrayList<Integer>> _runeSetMap = new HashMap<>();
public static HashMap<Integer, ArrayList<BootySetEntry>> _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();
}
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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))
-3
View File
@@ -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();