// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . // ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· // ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ // ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ // ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ // Magicbane Emulator Project © 2013 - 2022 // www.magicbane.com package engine.db.handlers; import engine.gameManager.DbManager; import engine.gameManager.PowersManager; import engine.mbEnums; import engine.objects.Mob; import engine.powers.EffectsBase; import org.pmw.tinylog.Logger; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.HashSet; public class dbPowerHandler extends dbHandlerBase { public dbPowerHandler() { this.localClass = Mob.class; this.localObjectType = mbEnums.GameObjectType.valueOf(this.localClass.getSimpleName()); } public static void addAllSourceTypes() { try (Connection connection = DbManager.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_power_sourcetype")) { ResultSet rs = preparedStatement.executeQuery(); String IDString, source; while (rs.next()) { IDString = rs.getString("IDString"); int token = DbManager.hasher.SBStringHash(IDString); source = rs.getString("source").replace("-", "").trim(); mbEnums.EffectSourceType effectSourceType = mbEnums.EffectSourceType.GetEffectSourceType(source); if (EffectsBase.effectSourceTypeMap.containsKey(token) == false) EffectsBase.effectSourceTypeMap.put(token, new HashSet<>()); EffectsBase.effectSourceTypeMap.get(token).add(effectSourceType); } } catch (Exception e) { Logger.error(e); } } public static void addAllAnimationOverrides() { try (Connection connection = DbManager.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_power_animation_override")) { ResultSet rs = preparedStatement.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); } } catch (Exception e) { Logger.error(e); } } }