dex reductions
This commit is contained in:
@@ -22,6 +22,7 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
public class dbItemBaseHandler extends dbHandlerBase {
|
public class dbItemBaseHandler extends dbHandlerBase {
|
||||||
|
|
||||||
|
public static final HashMap<Integer,Float> dexReductions = new HashMap<>();
|
||||||
public dbItemBaseHandler() {
|
public dbItemBaseHandler() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -46,20 +47,10 @@ public class dbItemBaseHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void LOAD_DEX_REDUCTION(ItemBase itemBase) {
|
public void LOAD_DEX_REDUCTION(ItemBase itemBase) {
|
||||||
|
if(dexReductions.containsKey(itemBase.getUUID())){
|
||||||
try (Connection connection = DbManager.getConnection();
|
itemBase.dexReduction = dexReductions.get(itemBase.getUUID());
|
||||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_dexpenalty` WHERE `ID` = ?")) {
|
}else{
|
||||||
|
itemBase.dexReduction = 0.0f;
|
||||||
preparedStatement.setInt(1, itemBase.getUUID());
|
|
||||||
ResultSet rs = preparedStatement.executeQuery();
|
|
||||||
|
|
||||||
// Check if a result was found
|
|
||||||
if (rs.next()) {
|
|
||||||
itemBase.dexReduction = rs.getFloat("item_bulk_factor");
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (SQLException e) {
|
|
||||||
Logger.error(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,6 +103,21 @@ public class dbItemBaseHandler extends dbHandlerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Logger.info("read: " + recordsRead + " cached: " + ItemBase.getUUIDCache().size());
|
Logger.info("read: " + recordsRead + " cached: " + ItemBase.getUUIDCache().size());
|
||||||
|
try (Connection connection = DbManager.getConnection();
|
||||||
|
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_dexpenalty`")) {
|
||||||
|
|
||||||
|
ResultSet rs = preparedStatement.executeQuery();
|
||||||
|
|
||||||
|
// Check if a result was found
|
||||||
|
if (rs.next()) {
|
||||||
|
int ID = rs.getInt("ID");
|
||||||
|
float factor = rs.getInt("item_bulk_factor");
|
||||||
|
dexReductions.put(ID,factor);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (SQLException e) {
|
||||||
|
Logger.error(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<Integer, ArrayList<Integer>> LOAD_RUNES_FOR_NPC_AND_MOBS() {
|
public HashMap<Integer, ArrayList<Integer>> LOAD_RUNES_FOR_NPC_AND_MOBS() {
|
||||||
|
|||||||
Reference in New Issue
Block a user