Browse Source

Equip lookups now use bootymap

master
MagicBot 2 years ago
parent
commit
de3818aef6
  1. 43
      src/engine/db/handlers/dbItemBaseHandler.java
  2. 5
      src/engine/gameManager/NPCManager.java
  3. 2
      src/engine/objects/MobBase.java
  4. 2
      src/engine/objects/NPC.java
  5. 3
      src/engine/server/world/WorldServer.java

43
src/engine/db/handlers/dbItemBaseHandler.java

@ -107,49 +107,6 @@ public class dbItemBaseHandler extends dbHandlerBase { @@ -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
src/engine/gameManager/NPCManager.java

@ -18,14 +18,9 @@ import java.util.HashMap; @@ -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();
}

2
src/engine/objects/MobBase.java

@ -152,7 +152,7 @@ public class MobBase extends AbstractGameObject { @@ -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;

2
src/engine/objects/NPC.java

@ -1645,7 +1645,7 @@ public class NPC extends AbstractCharacter { @@ -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
src/engine/server/world/WorldServer.java

@ -282,9 +282,6 @@ public class WorldServer { @@ -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();

Loading…
Cancel
Save