RuneSets generated loaded at bootstrap.
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
package engine.db.handlers;
|
||||
|
||||
import engine.gameManager.NPCManager;
|
||||
import engine.objects.EquipmentSetEntry;
|
||||
import engine.objects.ItemBase;
|
||||
import org.pmw.tinylog.Logger;
|
||||
@@ -149,4 +150,45 @@ public class dbItemBaseHandler extends dbHandlerBase {
|
||||
}
|
||||
return equipmentSets;
|
||||
}
|
||||
|
||||
public HashMap<Integer, ArrayList<Integer>> LOAD_RUNES_FOR_NPC_AND_MOBS() {
|
||||
|
||||
HashMap<Integer, ArrayList<Integer>> runeSets = new HashMap<>();
|
||||
int runeSetID;
|
||||
int runeBaseID;
|
||||
int recordsRead = 0;
|
||||
|
||||
prepareCallable("SELECT * FROM static_npc_runeSet");
|
||||
|
||||
try {
|
||||
ResultSet rs = executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
|
||||
recordsRead++;
|
||||
|
||||
runeSetID = rs.getInt("runeSet");
|
||||
runeBaseID = rs.getInt("runeBase");
|
||||
|
||||
if (runeSets.get(runeSetID) == null){
|
||||
ArrayList<Integer> runeList = new ArrayList<>();
|
||||
runeList.add(runeBaseID);
|
||||
runeSets.put(runeSetID, runeList);
|
||||
}
|
||||
else{
|
||||
ArrayList<Integer>runeList = runeSets.get(runeSetID);
|
||||
runeList.add(runeSetID);
|
||||
runeSets.put(runeSetID, runeList);
|
||||
}
|
||||
}
|
||||
|
||||
Logger.info("read: " + recordsRead + " cached: " + runeSets.size());
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error( e.toString());
|
||||
} finally {
|
||||
closeCallable();
|
||||
}
|
||||
return runeSets;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,15 @@ import java.util.HashMap;
|
||||
|
||||
public enum NPCManager {
|
||||
NPC_MANAGER;
|
||||
public static HashMap<Integer, ArrayList<EquipmentSetEntry>> EquipmentSetMap = new HashMap<>();
|
||||
public static HashMap<Integer, ArrayList<EquipmentSetEntry>> _equipmentSetMap = new HashMap<>();
|
||||
public static HashMap<Integer, ArrayList<Integer>> _runeSetMap = new HashMap<>();
|
||||
|
||||
|
||||
public static void LoadAllEquipmentSets() {
|
||||
EquipmentSetMap = DbManager.ItemBaseQueries.LOAD_EQUIPMENT_FOR_NPC_AND_MOBS();
|
||||
_equipmentSetMap = DbManager.ItemBaseQueries.LOAD_EQUIPMENT_FOR_NPC_AND_MOBS();
|
||||
}
|
||||
|
||||
public static void LoadAllRuneSets() {
|
||||
_runeSetMap = DbManager.ItemBaseQueries.LOAD_RUNES_FOR_NPC_AND_MOBS();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ public class MobBase extends AbstractGameObject {
|
||||
if (equipmentSetID == 0)
|
||||
return equip;
|
||||
|
||||
equipList = NPCManager.EquipmentSetMap.get(equipmentSetID);
|
||||
equipList = NPCManager._equipmentSetMap.get(equipmentSetID);
|
||||
|
||||
if (equipList == null)
|
||||
return equip;
|
||||
|
||||
@@ -1681,7 +1681,7 @@ public class NPC extends AbstractCharacter {
|
||||
|
||||
public static boolean UpdateEquipSetID(NPC npc, int equipSetID){
|
||||
|
||||
if (!NPCManager.EquipmentSetMap.containsKey(equipSetID))
|
||||
if (!NPCManager._equipmentSetMap.containsKey(equipSetID))
|
||||
return false;
|
||||
|
||||
if (!DbManager.NPCQueries.UPDATE_EQUIPSET(npc, equipSetID))
|
||||
|
||||
@@ -287,6 +287,9 @@ public class WorldServer {
|
||||
Logger.info("Loading NPC and Mob Equipment Sets");
|
||||
NPCManager.LoadAllEquipmentSets();
|
||||
|
||||
Logger.info("Loading NPC and Mob Rune Sets");
|
||||
NPCManager.LoadAllRuneSets();
|
||||
|
||||
Logger.info("Loading Gold Loot for Mobbases");
|
||||
MobbaseGoldEntry.LoadMobbaseGold();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user