From efe7784a3f7401ebc72e36109fa8bb3080d70201 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Mon, 7 Aug 2023 08:22:37 -0400 Subject: [PATCH] _itemTableEntry created. Class init cleaned up. --- src/engine/gameManager/LootManager.java | 22 ++++++------------- src/engine/loot/ItemTableEntry.java | 28 ++++++++++++++++++++++++ src/engine/server/world/WorldServer.java | 2 -- 3 files changed, 35 insertions(+), 17 deletions(-) create mode 100644 src/engine/loot/ItemTableEntry.java diff --git a/src/engine/gameManager/LootManager.java b/src/engine/gameManager/LootManager.java index 730eb269..918ccb29 100644 --- a/src/engine/gameManager/LootManager.java +++ b/src/engine/gameManager/LootManager.java @@ -30,12 +30,13 @@ public enum LootManager { // Newer tables public static HashMap> _genTables = new HashMap<>(); + public static HashMap> _itemTable = new HashMap<>(); //new tables - public static final HashMap generalItemTables = new HashMap<>(); - public static final HashMap itemTables = new HashMap<>(); - public static final HashMap modTypeTables = new HashMap<>(); - public static final HashMap modTables = new HashMap<>(); + public static final HashMap generalItemTables = null; + public static final HashMap itemTables = null; + public static final HashMap modTypeTables = null; + public static final HashMap modTables = null; // Drop Rates @@ -52,6 +53,8 @@ public enum LootManager { // Load loot tables from database. + _genTables = DbManager.LootQueries.LOAD_GEN_ITEM_TABLES(); + DbManager.LootQueries.LOAD_ALL_GENTABLES(); DbManager.LootQueries.LOAD_ALL_ITEMTABLES(); DbManager.LootQueries.LOAD_ALL_MODTYPES(); @@ -440,15 +443,4 @@ public enum LootManager { } } - //call this on server startup to populate the tables - public static void populateLootTables() { - - _genTables = DbManager.LootQueries.LOAD_GEN_ITEM_TABLES(); - - DbManager.LootQueries.populateGenTables(); - DbManager.LootQueries.populateItemTables(); - DbManager.LootQueries.populateModTables(); - DbManager.LootQueries.populateModTypeTables(); - - } } \ No newline at end of file diff --git a/src/engine/loot/ItemTableEntry.java b/src/engine/loot/ItemTableEntry.java new file mode 100644 index 00000000..ef652842 --- /dev/null +++ b/src/engine/loot/ItemTableEntry.java @@ -0,0 +1,28 @@ +// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ . +// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌· +// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀ +// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌ +// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀ +// Magicbane Emulator Project © 2013 - 2022 +// www.magicbane.com + +package engine.loot; + +import java.sql.ResultSet; +import java.sql.SQLException; + +public class ItemTableEntry { + public int minRoll; + public int maxRoll; + public int cacheID; + public int minSpawn; + public int maxSpawn; + + public ItemTableEntry(ResultSet rs) throws SQLException { + this.minRoll = rs.getInt("minRoll"); + this.maxRoll = rs.getInt("maxRoll"); + this.cacheID = rs.getInt("itemBaseUUID"); + this.minSpawn = rs.getInt("minSpawn"); + this.maxSpawn = rs.getInt("maxSpawn"); + } +} diff --git a/src/engine/server/world/WorldServer.java b/src/engine/server/world/WorldServer.java index 15e1da65..9ac027e6 100644 --- a/src/engine/server/world/WorldServer.java +++ b/src/engine/server/world/WorldServer.java @@ -340,8 +340,6 @@ public class WorldServer { Logger.info("Initializing Loot Manager"); LootManager.init(); - //load old loot system (still needed for rolling for now) - LootManager.populateLootTables(); RuneBaseAttribute.LoadAllAttributes(); RuneBase.LoadAllRuneBases(); BaseClass.LoadAllBaseClasses();