Remove the dead static_npc_mob_resists loader
AbstractCharacter.getResists fell back to Resists.getResists(0), but the table has no ID 0, so the fallback always returned null. It now returns the field directly. Removes dbResistHandler, the cache, the ResultSet constructor and the empty setMobResists stub. No value change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6561d585b9
commit
f07d7f3fe9
4 files changed
-101
No files matched your search
@@ -1257,8 +1257,6 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
||||
}
|
||||
|
||||
public final Resists getResists() {
|
||||
if (this.resists == null)
|
||||
return Resists.getResists(0);
|
||||
return this.resists;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,15 +10,12 @@
|
||||
package engine.objects;
|
||||
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.gameManager.DbManager;
|
||||
import engine.mbEnums;
|
||||
import engine.mbEnums.ModType;
|
||||
import engine.mbEnums.SourceType;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
@@ -26,7 +23,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class Resists {
|
||||
|
||||
private static ConcurrentHashMap<Integer, Resists> mobResists = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
private ConcurrentHashMap<mbEnums.DamageType, Float> resists = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
private ConcurrentHashMap<mbEnums.DamageType, Boolean> immuneTo = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||
private mbEnums.DamageType protection;
|
||||
@@ -79,26 +75,6 @@ public class Resists {
|
||||
setGenericResists();
|
||||
}
|
||||
|
||||
/**
|
||||
* Database Constructor
|
||||
*/
|
||||
public Resists(ResultSet rs) throws SQLException {
|
||||
this.immuneToAll = false;
|
||||
this.resists.put(mbEnums.DamageType.SLASHING, rs.getFloat("slash"));
|
||||
this.resists.put(mbEnums.DamageType.CRUSHING, rs.getFloat("crush"));
|
||||
this.resists.put(mbEnums.DamageType.PIERCING, rs.getFloat("pierce"));
|
||||
this.resists.put(mbEnums.DamageType.MAGIC, rs.getFloat("magic"));
|
||||
this.resists.put(mbEnums.DamageType.BLEEDING, rs.getFloat("bleed"));
|
||||
this.resists.put(mbEnums.DamageType.POISON, rs.getFloat("poison"));
|
||||
this.resists.put(mbEnums.DamageType.MENTAL, rs.getFloat("mental"));
|
||||
this.resists.put(mbEnums.DamageType.HOLY, rs.getFloat("holy"));
|
||||
this.resists.put(mbEnums.DamageType.UNHOLY, rs.getFloat("unholy"));
|
||||
this.resists.put(mbEnums.DamageType.LIGHTNING, rs.getFloat("lightning"));
|
||||
this.resists.put(mbEnums.DamageType.FIRE, rs.getFloat("fire"));
|
||||
this.resists.put(mbEnums.DamageType.COLD, rs.getFloat("cold"));
|
||||
this.resists.put(mbEnums.DamageType.HEALING, 0f);
|
||||
}
|
||||
|
||||
//Handle Fortitudes
|
||||
private static float handleFortitude(AbstractCharacter target, mbEnums.DamageType type, float damage) {
|
||||
if (target == null || !(target.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)))
|
||||
@@ -175,25 +151,6 @@ public class Resists {
|
||||
return phys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get mob resists from db if there, otherwise set defaults
|
||||
*/
|
||||
public static Resists getResists(int resistID) {
|
||||
//check cache first
|
||||
if (mobResists.containsKey(resistID))
|
||||
return new Resists(mobResists.get(resistID));
|
||||
|
||||
//get from database
|
||||
Resists resists = DbManager.ResistQueries.GET_RESISTS_FOR_MOB(resistID);
|
||||
if (resists != null) {
|
||||
mobResists.put(resistID, resists);
|
||||
return new Resists(resists);
|
||||
}
|
||||
|
||||
//failed, may want to debug this
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create generic resists for buildings
|
||||
*/
|
||||
@@ -314,14 +271,6 @@ public class Resists {
|
||||
this.immuneToAll = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* set resists from mobbase
|
||||
*/
|
||||
public void setMobResists(int resistID) {
|
||||
//TODO add this in later
|
||||
//calls `static_npc_mob_resists` table WHERE `ID`='resistID'
|
||||
}
|
||||
|
||||
/**
|
||||
* get Damage after resist
|
||||
* Expects heals as negative damage and damage as positive damage for fortitudes.
|
||||
|
||||
Reference in new issue
Block a user