Browse Source

_itemTableEntry created.

Class init cleaned up.
master
MagicBot 1 year ago
parent
commit
efe7784a3f
  1. 22
      src/engine/gameManager/LootManager.java
  2. 28
      src/engine/loot/ItemTableEntry.java
  3. 2
      src/engine/server/world/WorldServer.java

22
src/engine/gameManager/LootManager.java

@ -30,12 +30,13 @@ public enum LootManager {
// Newer tables // Newer tables
public static HashMap<Integer, ArrayList<GenTableEntry>> _genTables = new HashMap<>(); public static HashMap<Integer, ArrayList<GenTableEntry>> _genTables = new HashMap<>();
public static HashMap<Integer, ArrayList<ItemTableEntry>> _itemTable = new HashMap<>();
//new tables //new tables
public static final HashMap<Integer, GenTable> generalItemTables = new HashMap<>(); public static final HashMap<Integer, GenTable> generalItemTables = null;
public static final HashMap<Integer, ItemTable> itemTables = new HashMap<>(); public static final HashMap<Integer, ItemTable> itemTables = null;
public static final HashMap<Integer, ModTypeTable> modTypeTables = new HashMap<>(); public static final HashMap<Integer, ModTypeTable> modTypeTables = null;
public static final HashMap<Integer, ModTable> modTables = new HashMap<>(); public static final HashMap<Integer, ModTable> modTables = null;
// Drop Rates // Drop Rates
@ -52,6 +53,8 @@ public enum LootManager {
// Load loot tables from database. // Load loot tables from database.
_genTables = DbManager.LootQueries.LOAD_GEN_ITEM_TABLES();
DbManager.LootQueries.LOAD_ALL_GENTABLES(); DbManager.LootQueries.LOAD_ALL_GENTABLES();
DbManager.LootQueries.LOAD_ALL_ITEMTABLES(); DbManager.LootQueries.LOAD_ALL_ITEMTABLES();
DbManager.LootQueries.LOAD_ALL_MODTYPES(); 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();
}
} }

28
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");
}
}

2
src/engine/server/world/WorldServer.java

@ -340,8 +340,6 @@ public class WorldServer {
Logger.info("Initializing Loot Manager"); Logger.info("Initializing Loot Manager");
LootManager.init(); LootManager.init();
//load old loot system (still needed for rolling for now)
LootManager.populateLootTables();
RuneBaseAttribute.LoadAllAttributes(); RuneBaseAttribute.LoadAllAttributes();
RuneBase.LoadAllRuneBases(); RuneBase.LoadAllRuneBases();
BaseClass.LoadAllBaseClasses(); BaseClass.LoadAllBaseClasses();

Loading…
Cancel
Save