From 371d0773202fa248a36f55f664c15cf4ca4ffc30 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 12 May 2024 16:38:32 -0500 Subject: [PATCH] mob resist issue --- src/engine/db/handlers/dbMobBaseHandler.java | 12 ++++-------- src/engine/objects/MobBase.java | 2 ++ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/engine/db/handlers/dbMobBaseHandler.java b/src/engine/db/handlers/dbMobBaseHandler.java index 3594d3c7..b4a82804 100644 --- a/src/engine/db/handlers/dbMobBaseHandler.java +++ b/src/engine/db/handlers/dbMobBaseHandler.java @@ -21,6 +21,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; +import java.util.HashMap; public class dbMobBaseHandler extends dbHandlerBase { @@ -113,7 +114,7 @@ public class dbMobBaseHandler extends dbHandlerBase { } public void LOAD_ALL_MOBBASE_RACES() { - + MobBase.mobbase_race_types = new HashMap<>(); try (Connection connection = DbManager.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_mobbase_race`;")) { @@ -121,13 +122,8 @@ public class dbMobBaseHandler extends dbHandlerBase { while (rs.next()) { int id = rs.getInt("loadID"); - MobBase mobbase = MobBase.getMobBase(id); - if(mobbase != null){ - try { - mobbase.raceType = rs.getString("raceType"); - }catch(Exception e){ - - } + if(MobBase.mobbase_race_types.containsKey(id) == false){ + MobBase.mobbase_race_types.put(id,rs.getString("raceType")); } } diff --git a/src/engine/objects/MobBase.java b/src/engine/objects/MobBase.java index e465b268..52dab18d 100644 --- a/src/engine/objects/MobBase.java +++ b/src/engine/objects/MobBase.java @@ -55,6 +55,8 @@ public class MobBase extends AbstractGameObject { private float runCombat = 0; public String raceType = "All"; + public static HashMap mobbase_race_types; + /** * ResultSet Constructor */