Merge branch 'bugfix-mob-casting' into feature-fatePeddler

This commit is contained in:
2023-08-08 19:25:50 -05:00
18 changed files with 463 additions and 278 deletions
+2
View File
@@ -72,6 +72,8 @@ public enum DbManager {
public static final dbShrineHandler ShrineQueries = new dbShrineHandler();
public static final dbHeightMapHandler HeightMapQueries = new dbHeightMapHandler();
public static final dbRunegateHandler RunegateQueries = new dbRunegateHandler();
public static final dbPowerHandler PowerQueries = new dbPowerHandler();
private static final EnumMap<GameObjectType, ConcurrentHashMap<Integer, AbstractGameObject>> objectCache = new EnumMap<>(GameObjectType.class);
public static Hasher hasher;
private static HikariDataSource connectionPool = null;
+5 -4
View File
@@ -42,6 +42,7 @@ public enum LootManager {
public static float HOTZONE_DROP_RATE;
public static float HOTZONE_EXP_RATE;
public static float HOTZONE_GOLD_RATE;
public static HashMap<Integer, ArrayList<BootySetEntry>> _bootySetMap = new HashMap<>();
// Bootstrap routine to initialize the Loot Manager
@@ -73,11 +74,11 @@ public enum LootManager {
//iterate the booty sets
if (mob.getMobBase().bootySet != 0 && NPCManager._bootySetMap.containsKey(mob.getMobBase().bootySet) == true)
RunBootySet(NPCManager._bootySetMap.get(mob.getMobBase().bootySet), mob, inHotzone, fromDeath);
if (mob.getMobBase().bootySet != 0 && _bootySetMap.containsKey(mob.getMobBase().bootySet) == true)
RunBootySet(_bootySetMap.get(mob.getMobBase().bootySet), mob, inHotzone, fromDeath);
if (mob.bootySet != 0 && NPCManager._bootySetMap.containsKey(mob.bootySet) == true)
RunBootySet(NPCManager._bootySetMap.get(mob.bootySet), mob, inHotzone, fromDeath);
if (mob.bootySet != 0 && _bootySetMap.containsKey(mob.bootySet) == true)
RunBootySet(_bootySetMap.get(mob.bootySet), mob, inHotzone, fromDeath);
//lastly, check mobs inventory for godly or disc runes to send a server announcement
+2 -4
View File
@@ -2,7 +2,6 @@ package engine.gameManager;
import engine.Enum;
import engine.InterestManagement.WorldGrid;
import engine.loot.BootySetEntry;
import engine.net.Dispatch;
import engine.net.DispatchMessage;
import engine.net.client.msg.PetMsg;
@@ -18,14 +17,13 @@ public enum NPCManager {
NPC_MANAGER;
public static HashMap<Integer, ArrayList<Integer>> _runeSetMap = new HashMap<>();
public static HashMap<Integer, ArrayList<BootySetEntry>> _bootySetMap = new HashMap<>();
public static void LoadAllRuneSets() {
_runeSetMap = DbManager.ItemBaseQueries.LOAD_RUNES_FOR_NPC_AND_MOBS();
}
public static void LoadAllBootySets() {
_bootySetMap = DbManager.LootQueries.LOAD_BOOTY_TABLES();
LootManager._bootySetMap = DbManager.LootQueries.LOAD_BOOTY_TABLES();
}
public static void applyRuneSetEffects(Mob mob) {
@@ -108,7 +106,7 @@ public enum NPCManager {
public static void dismissNecroPet(Mob necroPet, boolean updateOwner) {
necroPet.combatTarget = null;
necroPet.setCombatTarget(null);
necroPet.hasLoot = false;
if (necroPet.parentZone != null)
+4 -83
View File
@@ -12,6 +12,7 @@ import engine.Enum.*;
import engine.InterestManagement.HeightMap;
import engine.InterestManagement.WorldGrid;
import engine.db.handlers.dbEffectsBaseHandler;
import engine.db.handlers.dbPowerHandler;
import engine.db.handlers.dbSkillReqHandler;
import engine.job.AbstractJob;
import engine.job.AbstractScheduleJob;
@@ -26,13 +27,11 @@ import engine.net.client.ClientConnection;
import engine.net.client.msg.*;
import engine.objects.*;
import engine.powers.*;
import engine.powers.effectmodifiers.AbstractEffectModifier;
import engine.powers.poweractions.AbstractPowerAction;
import engine.powers.poweractions.TrackPowerAction;
import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -53,9 +52,8 @@ public enum PowersManager {
public static HashMap<String, AbstractPowerAction> powerActionsByIDString = new HashMap<>();
public static HashMap<Integer, AbstractPowerAction> powerActionsByID = new HashMap<>();
public static HashMap<String, Integer> ActionTokenByIDString = new HashMap<>();
public static HashMap<Integer, AbstractEffectModifier> modifiersByToken = new HashMap<>();
public static HashMap<String, Integer> AnimationOverrides = new HashMap<>();
public static HashMap<Integer, HashMap<Integer, Integer>> AllMobPowers = new HashMap<>();
public static HashMap<Integer, ArrayList<MobPowerEntry>> AllMobPowers;
private static JobScheduler js;
private PowersManager() {
@@ -85,10 +83,6 @@ public enum PowersManager {
return PowersManager.effectsBaseByIDString.get(IDString);
}
public static AbstractPowerAction getPowerActionByID(Integer id) {
return PowersManager.powerActionsByID.get(id);
}
public static AbstractPowerAction getPowerActionByIDString(String IDString) {
return PowersManager.powerActionsByIDString.get(IDString);
}
@@ -128,8 +122,8 @@ public enum PowersManager {
dbEffectsBaseHandler.cacheAllEffectModifiers();
// Add Source Types to Effects
PowersManager.addAllSourceTypes();
PowersManager.addAllAnimationOverrides();
dbPowerHandler.addAllSourceTypes();
dbPowerHandler.addAllAnimationOverrides();
// Add PowerActions
AbstractPowerAction.getAllPowerActions(PowersManager.powerActionsByIDString, PowersManager.powerActionsByID, PowersManager.effectsBaseByIDString);
@@ -156,59 +150,6 @@ public enum PowersManager {
}
private static void addAllSourceTypes() {
PreparedStatementShared ps = null;
try {
ps = new PreparedStatementShared("SELECT * FROM static_power_sourcetype");
ResultSet rs = ps.executeQuery();
String IDString, source;
while (rs.next()) {
IDString = rs.getString("IDString");
int token = DbManager.hasher.SBStringHash(IDString);
source = rs.getString("source").replace("-", "").trim();
EffectSourceType effectSourceType = EffectSourceType.GetEffectSourceType(source);
if (EffectsBase.effectSourceTypeMap.containsKey(token) == false)
EffectsBase.effectSourceTypeMap.put(token, new HashSet<>());
EffectsBase.effectSourceTypeMap.get(token).add(effectSourceType);
}
rs.close();
} catch (Exception e) {
Logger.error(e);
} finally {
ps.release();
}
}
private static void addAllAnimationOverrides() {
PreparedStatementShared ps = null;
try {
ps = new PreparedStatementShared("SELECT * FROM static_power_animation_override");
ResultSet rs = ps.executeQuery();
String IDString;
int animation;
while (rs.next()) {
IDString = rs.getString("IDString");
EffectsBase eb = PowersManager.getEffectByIDString(IDString);
if (eb != null)
IDString = eb.getIDString();
animation = rs.getInt("animation");
PowersManager.AnimationOverrides.put(IDString, animation);
}
rs.close();
} catch (Exception e) {
Logger.error(e);
} finally {
ps.release();
}
}
public static EffectsBase setEffectToken(int ID, int token) {
for (EffectsBase eb : PowersManager.effectsBaseByIDString.values()) {
if (eb.getUUID() == ID) {
@@ -2778,26 +2719,6 @@ public enum PowersManager {
}
}
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("Powers loaded for " + count + " Mobbases/");
}
}