// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . // ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· // ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ // ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ // ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ // Magicbane Emulator Project © 2013 - 2026 // https://www.magicbane.com package engine.db.handlers; import engine.gameManager.DbManager; import org.pmw.tinylog.Logger; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.HashMap; import java.util.HashSet; public class dbRaceHandler extends dbHandlerBase { public dbRaceHandler() { } public HashSet BEARD_COLORS_FOR_RACE(final int id) { HashSet integerSet = new HashSet<>(); try (Connection connection = DbManager.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement("SELECT `color` FROM `static_rune_racebeardcolor` WHERE `RaceID` = ?")) { preparedStatement.setInt(1, id); ResultSet rs = preparedStatement.executeQuery(); while (rs.next()) integerSet.add(rs.getInt(1)); } catch (SQLException e) { Logger.error(e); } return integerSet; } public HashSet HAIR_COLORS_FOR_RACE(final int id) { HashSet integerSet = new HashSet<>(); try (Connection connection = DbManager.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement("SELECT `color` FROM `static_rune_racehaircolor` WHERE `RaceID` = ?")) { preparedStatement.setInt(1, id); ResultSet rs = preparedStatement.executeQuery(); while (rs.next()) integerSet.add(rs.getInt(1)); } catch (SQLException e) { Logger.error(e); } return integerSet; } public HashSet SKIN_COLOR_FOR_RACE(final int id) { HashSet integerSet = new HashSet<>(); try (Connection connection = DbManager.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement("SELECT `color` FROM `static_rune_raceskincolor` WHERE `RaceID` = ?")) { preparedStatement.setInt(1, id); ResultSet rs = preparedStatement.executeQuery(); while (rs.next()) integerSet.add(rs.getInt(1)); } catch (SQLException e) { Logger.error(e); } return integerSet; } // Rune id -> {minHeight, strHeightMod}; the rows also decide which race runes are player races public HashMap LOAD_RACE_HEIGHTS() { HashMap raceHeights = new HashMap<>(); try (Connection connection = DbManager.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_rune_race")) { ResultSet rs = preparedStatement.executeQuery(); while (rs.next()) raceHeights.put(rs.getInt("ID"), new float[]{rs.getFloat("minHeight"), rs.getFloat("strHeightMod")}); } catch (SQLException e) { Logger.error(e); } return raceHeights; } }