From a7abe6c4c50ec6e16382062e1f560242238cb758 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 5 Aug 2023 10:28:32 -0400 Subject: [PATCH] Table refactor to conform with sb. --- src/engine/db/handlers/dbLootTableHandler.java | 12 ++++++------ src/engine/gameManager/LootManager.java | 2 +- src/engine/loot/GenTableRow.java | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/engine/db/handlers/dbLootTableHandler.java b/src/engine/db/handlers/dbLootTableHandler.java index 32a2114a..6ea5d74f 100644 --- a/src/engine/db/handlers/dbLootTableHandler.java +++ b/src/engine/db/handlers/dbLootTableHandler.java @@ -101,7 +101,7 @@ public class dbLootTableHandler extends dbHandlerBase { int recordsRead = 0; try (Connection connection = DbManager.getConnection(); - PreparedStatement preparedStatement = connection.prepareStatement("SELECT `modGroup`,`minRoll`,`maxRoll`,`subTableID` FROM `static_modgroups`")) { + PreparedStatement preparedStatement = connection.prepareStatement("SELECT `modGroup`,`minRoll`,`maxRoll`,`subTableID` FROM `static_modtypetables`")) { ResultSet rs = preparedStatement.executeQuery(); @@ -145,7 +145,7 @@ public class dbLootTableHandler extends dbHandlerBase { while (rs.next()) { GenTableRow row = new GenTableRow(rs); - LootManager.AddGenTableRow(rs.getInt("groupID"), row); + LootManager.AddGenTableRow(rs.getInt("gentable"), row); } } catch (SQLException e) { @@ -167,7 +167,7 @@ public class dbLootTableHandler extends dbHandlerBase { while (rs.next()) { recordsRead++; ItemTableRow row = new ItemTableRow(rs); - LootManager.AddItemTableRow(rs.getInt("lootTable"), row); + LootManager.AddItemTableRow(rs.getInt("itemTable"), row); } } catch (SQLException e) { @@ -177,18 +177,18 @@ public class dbLootTableHandler extends dbHandlerBase { Logger.info("read: " + recordsRead); } - public void LOAD_ALL_MODGROUPS() { + public void LOAD_ALL_MODTYPES() { int recordsRead = 0; try (Connection connection = DbManager.getConnection(); - PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_modgroups")) { + PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM static_modtypetables")) { ResultSet rs = preparedStatement.executeQuery(); while (rs.next()) { recordsRead++; ModTypeTableRow mttr = new ModTypeTableRow(rs); - LootManager.AddModTypeTableRow(rs.getInt("modGroup"), mttr); + LootManager.AddModTypeTableRow(rs.getInt("modType"), mttr); } } catch (SQLException e) { diff --git a/src/engine/gameManager/LootManager.java b/src/engine/gameManager/LootManager.java index c7b41c0a..1e846dcd 100644 --- a/src/engine/gameManager/LootManager.java +++ b/src/engine/gameManager/LootManager.java @@ -50,7 +50,7 @@ public enum LootManager { DbManager.LootQueries.LOAD_ALL_GENTABLES(); DbManager.LootQueries.LOAD_ALL_ITEMTABLES(); - DbManager.LootQueries.LOAD_ALL_MODGROUPS(); + DbManager.LootQueries.LOAD_ALL_MODTYPES(); DbManager.LootQueries.LOAD_ALL_MODTABLES(); // Cache drop rate values from Config manager. diff --git a/src/engine/loot/GenTableRow.java b/src/engine/loot/GenTableRow.java index e72a4cf3..4ce81a32 100644 --- a/src/engine/loot/GenTableRow.java +++ b/src/engine/loot/GenTableRow.java @@ -13,7 +13,7 @@ public class GenTableRow { public GenTableRow(ResultSet rs) throws SQLException { this.minRoll = rs.getInt("minRoll"); this.maxRoll = rs.getInt("maxRoll"); - this.itemTableID = rs.getInt("lootTableID"); + this.itemTableID = rs.getInt("itemTableID"); this.pModTable = rs.getInt("pModTableID"); this.sModTable = rs.getInt("sModTableID"); }