Browse Source

moved mob powers method to PowersManager

master
FatBoy-DOTC 2 years ago
parent
commit
83eb1a3370
  1. 13
      src/engine/gameManager/PowersManager.java
  2. 2
      src/engine/objects/Mob.java
  3. 15
      src/engine/server/world/WorldServer.java

13
src/engine/gameManager/PowersManager.java

@ -54,6 +54,7 @@ public enum PowersManager { @@ -54,6 +54,7 @@ public enum PowersManager {
public static HashMap<Integer, AbstractEffectModifier> modifiersByToken = new HashMap<>();
public static HashMap<String,Integer> AnimationOverrides = new HashMap<>();
private static JobScheduler js;
public static HashMap<Integer,HashMap<Integer,Integer>> AllMobPowers;
public static void initPowersManager(boolean fullPowersLoad) {
@ -2784,6 +2785,18 @@ SourceType sourceType = SourceType.GetSourceType(pb.getCategory()); @@ -2784,6 +2785,18 @@ SourceType sourceType = SourceType.GetSourceType(pb.getCategory());
}
}
}
public static void GatherMobPowers(){
for(Mob mob : DbManager.MobQueries.GET_ALL_MOBS()){
if(DbManager.MobBaseQueries.LOAD_STATIC_POWERS(mob.getMobBaseID()).isEmpty() == true){
continue;
}
else {
HashMap<Integer, Integer> mobPowers = DbManager.MobBaseQueries.LOAD_STATIC_POWERS(mob.getMobBaseID());
AllMobPowers.put(mob.getMobBaseID(), mobPowers);
}
}
Logger.info("Static Mob Powers HashMap Loaded Successfully...");
}
}

2
src/engine/objects/Mob.java

@ -2220,7 +2220,7 @@ public class Mob extends AbstractIntelligenceAgent { @@ -2220,7 +2220,7 @@ public class Mob extends AbstractIntelligenceAgent {
Logger.error( e.getMessage());
}
//mobPowers = DbManager.MobBaseQueries.LOAD_STATIC_POWERS(this.getMobBaseID());
mobPowers = (HashMap<Integer, Integer>) WorldServer.AllMobPowers.get(this.getMobBaseID()).entrySet();
mobPowers = (HashMap<Integer, Integer>) PowersManager.AllMobPowers.get(this.getMobBaseID()).entrySet();
if(this.isPlayerGuard() == true){
//load guards powers
ArrayList<MobBase> mobbases = DbManager.MobBaseQueries.GET_ALL_MOBBASES();

15
src/engine/server/world/WorldServer.java

@ -75,7 +75,6 @@ public class WorldServer { @@ -75,7 +75,6 @@ public class WorldServer {
// Member variable declaration
public static HashMap<Integer,HashMap<Integer,ArrayList<Integer>>> ZoneFidelityMobRunes = new HashMap<>();
public static HashMap<Integer,HashMap<Integer,Integer>> AllMobPowers;
public WorldServer() {
super();
}
@ -471,21 +470,9 @@ public class WorldServer { @@ -471,21 +470,9 @@ public class WorldServer {
System.gc();
Logger.info("Loading All Mob Powers...");
GatherMobPowers();
PowersManager.GatherMobPowers();
return true;
}
private void GatherMobPowers(){
for(Mob mob : DbManager.MobQueries.GET_ALL_MOBS()){
if(DbManager.MobBaseQueries.LOAD_STATIC_POWERS(mob.getMobBaseID()).isEmpty() == true){
continue;
}
else {
HashMap<Integer, Integer> mobPowers = DbManager.MobBaseQueries.LOAD_STATIC_POWERS(mob.getMobBaseID());
AllMobPowers.put(mob.getMobBaseID(), mobPowers);
}
}
Logger.info("Static Mob Powers HashMap Loaded Successfully...");
}
protected boolean initDatabaselayer() {
// Try starting a GOM <-> DB connection.

Loading…
Cancel
Save