mob resist issue
This commit is contained in:
@@ -23,7 +23,25 @@ public class dbResistHandler extends dbHandlerBase {
|
|||||||
public dbResistHandler() {
|
public dbResistHandler() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public void LOAD_RESISTS_FOR_MOBS() {
|
||||||
|
|
||||||
|
Resists resists = null;
|
||||||
|
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_mob_resists`;")) {
|
||||||
|
|
||||||
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
|
while(rs.next()){
|
||||||
|
resists = new Resists(rs);
|
||||||
|
if(!Resists.mobResists.containsKey(rs.getInt("ID")))
|
||||||
|
Resists.mobResists.put(rs.getInt("ID"),resists);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
public Resists GET_RESISTS_FOR_MOB(int resistID) {
|
public Resists GET_RESISTS_FOR_MOB(int resistID) {
|
||||||
|
|
||||||
Resists resists = null;
|
Resists resists = null;
|
||||||
|
|||||||
@@ -685,6 +685,9 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final void setResists(final Resists value) {
|
public final void setResists(final Resists value) {
|
||||||
|
if(this.getObjectType().equals(GameObjectType.Mob))
|
||||||
|
return;
|
||||||
|
|
||||||
this.resists = value;
|
this.resists = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import java.util.LinkedHashMap;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||||
|
|
||||||
|
import static engine.gameManager.NPCManager._runeSetMap;
|
||||||
import static engine.net.client.msg.ErrorPopupMsg.sendErrorPopup;
|
import static engine.net.client.msg.ErrorPopupMsg.sendErrorPopup;
|
||||||
|
|
||||||
public class Mob extends AbstractIntelligenceAgent {
|
public class Mob extends AbstractIntelligenceAgent {
|
||||||
@@ -161,14 +162,62 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
|
|
||||||
this.agentType = AIAgentType.MOBILE;
|
this.agentType = AIAgentType.MOBILE;
|
||||||
|
|
||||||
this.setResists(Resists.getResists(rs.getInt("mob_spawnType")));
|
//this.setResists(Resists.getResists(rs.getInt("mob_spawnType")));
|
||||||
|
|
||||||
|
setResistsForMob(this);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.error(e + " " + this.dbID);
|
Logger.error(e + " " + this.dbID);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setResistsForMob(Mob mob){
|
||||||
|
mob.resists = new Resists("Generic");
|
||||||
|
Zone MacroParent = null;
|
||||||
|
for(Zone zone : ZoneManager.getAllZonesIn(mob.loc)){
|
||||||
|
if(zone.isMacroZone() == false)
|
||||||
|
continue;
|
||||||
|
switch(zone.getName()){
|
||||||
|
//ice generics
|
||||||
|
case "Ymur's Crown":
|
||||||
|
case "Kralgaar Holm":
|
||||||
|
case "Ecklund Wilds":
|
||||||
|
case "Aurrochs Skrae":
|
||||||
|
mob.resists = Resists.getResists(28);
|
||||||
|
break;
|
||||||
|
//Desert Generics
|
||||||
|
case "Leth'khalivar Desert":
|
||||||
|
case "Kharsoom":
|
||||||
|
case "Vale of Nar Addad":
|
||||||
|
case "The Blood Sands":
|
||||||
|
mob.resists = Resists.getResists(2);
|
||||||
|
break;
|
||||||
|
//Swamp Generics
|
||||||
|
case "Thollok Marsh":
|
||||||
|
case "The Black Bog":
|
||||||
|
case "Sevaath Mere":
|
||||||
|
mob.resists = Resists.getResists(10);
|
||||||
|
break;
|
||||||
|
//Oblivion Generics
|
||||||
|
case "Plain of Ashes":
|
||||||
|
case "Bone Marches":
|
||||||
|
case "The Doomplain":
|
||||||
|
case "Greensward Pyre":
|
||||||
|
mob.resists = Resists.getResists(4);
|
||||||
|
break;
|
||||||
|
//Maelstrom Generics
|
||||||
|
case "Pandemonium":
|
||||||
|
case "Western Battleground":
|
||||||
|
mob.resists = Resists.getResists(32);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(mob.getNameOverride().length() > 1){
|
||||||
|
mob.resists = Resists.getResists(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void serializeMobForClientMsgOtherPlayer(Mob mob, ByteBufferWriter writer) throws SerializationException {
|
public static void serializeMobForClientMsgOtherPlayer(Mob mob, ByteBufferWriter writer) throws SerializationException {
|
||||||
Mob.serializeForClientMsgOtherPlayer(mob, writer);
|
Mob.serializeForClientMsgOtherPlayer(mob, writer);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
|
|
||||||
public class Resists {
|
public class Resists {
|
||||||
|
|
||||||
private static ConcurrentHashMap<Integer, Resists> mobResists = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
public static ConcurrentHashMap<Integer, Resists> mobResists = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||||
private ConcurrentHashMap<DamageType, Float> resists = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
private ConcurrentHashMap<DamageType, Float> resists = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||||
private ConcurrentHashMap<DamageType, Boolean> immuneTo = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
private ConcurrentHashMap<DamageType, Boolean> immuneTo = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||||
private DamageType protection;
|
private DamageType protection;
|
||||||
|
|||||||
@@ -375,6 +375,10 @@ public class WorldServer {
|
|||||||
BaseClass.LoadAllBaseClasses();
|
BaseClass.LoadAllBaseClasses();
|
||||||
Race.loadAllRaces();
|
Race.loadAllRaces();
|
||||||
RuneBaseEffect.LoadRuneBaseEffects();
|
RuneBaseEffect.LoadRuneBaseEffects();
|
||||||
|
|
||||||
|
Logger.info("Loading MobBases.");
|
||||||
|
DbManager.ResistQueries.LOAD_RESISTS_FOR_MOBS();
|
||||||
|
|
||||||
Logger.info("Loading MobBases.");
|
Logger.info("Loading MobBases.");
|
||||||
DbManager.MobBaseQueries.GET_ALL_MOBBASES();
|
DbManager.MobBaseQueries.GET_ALL_MOBBASES();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user