static_rune_race is read only for the race ids and the server-only heights; the hair/beard style, racebaseclass, baseclass and promotionrunereq queries are gone. GET_BASE_CLASS is cache-only, which also drops the obj_account cache-miss query. CSR/admin promotions 2901+ (no promotionrunereq rows) get an empty allowed list. No value changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
111 lines
3.7 KiB
Java
111 lines
3.7 KiB
Java
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
// 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<Integer> BEARD_COLORS_FOR_RACE(final int id) {
|
|
|
|
HashSet<Integer> 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<Integer> HAIR_COLORS_FOR_RACE(final int id) {
|
|
|
|
HashSet<Integer> 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<Integer> SKIN_COLOR_FOR_RACE(final int id) {
|
|
|
|
HashSet<Integer> 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<Integer, float[]> LOAD_RACE_HEIGHTS() {
|
|
|
|
HashMap<Integer, float[]> 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;
|
|
}
|
|
}
|