forked from MagicBane/Server
Equip lookups now use bootymap
This commit is contained in:
@@ -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() {
|
public HashMap<Integer, ArrayList<Integer>> LOAD_RUNES_FOR_NPC_AND_MOBS() {
|
||||||
|
|
||||||
HashMap<Integer, ArrayList<Integer>> runeSets = new HashMap<>();
|
HashMap<Integer, ArrayList<Integer>> runeSets = new HashMap<>();
|
||||||
|
|||||||
@@ -18,14 +18,9 @@ import java.util.HashMap;
|
|||||||
public enum NPCManager {
|
public enum NPCManager {
|
||||||
|
|
||||||
NPC_MANAGER;
|
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<Integer>> _runeSetMap = new HashMap<>();
|
||||||
public static HashMap<Integer, ArrayList<BootySetEntry>> _bootySetMap = 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() {
|
public static void LoadAllRuneSets() {
|
||||||
_runeSetMap = DbManager.ItemBaseQueries.LOAD_RUNES_FOR_NPC_AND_MOBS();
|
_runeSetMap = DbManager.ItemBaseQueries.LOAD_RUNES_FOR_NPC_AND_MOBS();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ public class MobBase extends AbstractGameObject {
|
|||||||
if (equipmentSetID == 0)
|
if (equipmentSetID == 0)
|
||||||
return equip;
|
return equip;
|
||||||
|
|
||||||
equipList = NPCManager._equipmentSetMap.get(equipmentSetID);
|
equipList = NPCManager._bootySetMap.get(equipmentSetID);
|
||||||
|
|
||||||
if (equipList == null)
|
if (equipList == null)
|
||||||
return equip;
|
return equip;
|
||||||
|
|||||||
@@ -1645,7 +1645,7 @@ public class NPC extends AbstractCharacter {
|
|||||||
|
|
||||||
public static boolean UpdateEquipSetID(NPC npc, int equipSetID){
|
public static boolean UpdateEquipSetID(NPC npc, int equipSetID){
|
||||||
|
|
||||||
if (!NPCManager._equipmentSetMap.containsKey(equipSetID))
|
if (!NPCManager._bootySetMap.containsKey(equipSetID))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!DbManager.NPCQueries.UPDATE_EQUIPSET(npc, equipSetID))
|
if (!DbManager.NPCQueries.UPDATE_EQUIPSET(npc, equipSetID))
|
||||||
|
|||||||
@@ -282,9 +282,6 @@ public class WorldServer {
|
|||||||
Logger.info("Loading PromotionClasses");
|
Logger.info("Loading PromotionClasses");
|
||||||
DbManager.PromotionQueries.GET_ALL_PROMOTIONS();
|
DbManager.PromotionQueries.GET_ALL_PROMOTIONS();
|
||||||
|
|
||||||
Logger.info("Loading NPC and Mob Equipment Sets");
|
|
||||||
NPCManager.LoadAllEquipmentSets();
|
|
||||||
|
|
||||||
Logger.info("Loading NPC and Mob Rune Sets");
|
Logger.info("Loading NPC and Mob Rune Sets");
|
||||||
NPCManager.LoadAllRuneSets();
|
NPCManager.LoadAllRuneSets();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user