From 66f0c127906f6398f6ea845fe44a78c1bdd225de Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 13 Mar 2023 19:19:03 -0400 Subject: [PATCH] Reworked the loading of Mobile powers at bootstrap. --- src/engine/gameManager/PowersManager.java | 34 +++++++++++++---------- src/engine/server/world/WorldServer.java | 3 ++ 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/engine/gameManager/PowersManager.java b/src/engine/gameManager/PowersManager.java index 97ccfd3c..5b08f06d 100644 --- a/src/engine/gameManager/PowersManager.java +++ b/src/engine/gameManager/PowersManager.java @@ -54,7 +54,7 @@ public enum PowersManager { public static HashMap modifiersByToken = new HashMap<>(); public static HashMap AnimationOverrides = new HashMap<>(); private static JobScheduler js; - public static HashMap> AllMobPowers; + public static HashMap> AllMobPowers = new HashMap<>(); public static void initPowersManager(boolean fullPowersLoad) { @@ -64,9 +64,7 @@ public enum PowersManager { PowersManager.InitializeLoginPowers(); PowersManager.js = JobScheduler.getInstance(); - //Load Static Mob Powers List - Logger.info("Loading All Mob Powers..."); - PowersManager.GatherMobPowers(); + } private PowersManager() { @@ -2787,18 +2785,24 @@ SourceType sourceType = SourceType.GetSourceType(pb.getCategory()); } } } - public static void GatherMobPowers(){ - AllMobPowers = new HashMap>(); - for(Mob mob : DbManager.MobQueries.GET_ALL_MOBS()){ - if(DbManager.MobBaseQueries.LOAD_STATIC_POWERS(mob.getMobBaseID()).isEmpty() == true){ - continue; - } - else { - HashMap mobPowers = DbManager.MobBaseQueries.LOAD_STATIC_POWERS(mob.getMobBaseID()); - AllMobPowers.put(mob.getMobBaseID(), mobPowers); + public static void LoadAllMobPowers(){ + + int count = 0; + + for(AbstractGameObject mobBaseAgo : DbManager.getList(GameObjectType.MobBase)){ + + int mobBaseID = ((MobBase) mobBaseAgo).getLoadID(); + + HashMap powersList = DbManager.MobBaseQueries.LOAD_STATIC_POWERS(mobBaseID); + + if (powersList.isEmpty()) + continue;; + + AllMobPowers.put(mobBaseID, powersList); + count ++; } - } - Logger.info("Static Mob Powers HashMap Loaded Successfully..."); + + Logger.info("Powers loaded for " + count + " Mobbases/"); } } diff --git a/src/engine/server/world/WorldServer.java b/src/engine/server/world/WorldServer.java index 12b6f357..f72be058 100644 --- a/src/engine/server/world/WorldServer.java +++ b/src/engine/server/world/WorldServer.java @@ -290,6 +290,9 @@ public class WorldServer { Logger.info("Loading Gold Loot for Mobbases"); MobbaseGoldEntry.LoadMobbaseGold(); + Logger.info("Loading All Mob Powers..."); + PowersManager.LoadAllMobPowers(); + Logger.info("Loading fidelity mob runes."); DbManager.MobQueries.LOAD_RUNES_FOR_FIDELITY_MOBS();