// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . // ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· // ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ // ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ // ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ // Magicbane Emulator Project © 2013 - 2022 // www.magicbane.com package engine.db.handlers; import engine.gameManager.DbManager; import engine.objects.Resists; import org.pmw.tinylog.Logger; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; public class dbResistHandler extends dbHandlerBase { 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) { Resists resists = null; try (Connection connection = DbManager.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_npc_mob_resists` WHERE `ID` = ?;")) { preparedStatement.setInt(1, resistID); ResultSet rs = preparedStatement.executeQuery(); if (rs.next()) resists = new Resists(rs); } catch (SQLException e) { Logger.error(e); } return resists; } }