rollTable() method added to loot classes.
This commit is contained in:
@@ -8,8 +8,11 @@
|
|||||||
|
|
||||||
package engine.loot;
|
package engine.loot;
|
||||||
|
|
||||||
|
import engine.gameManager.LootManager;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class GenTableEntry {
|
public class GenTableEntry {
|
||||||
public int minRoll;
|
public int minRoll;
|
||||||
@@ -25,4 +28,18 @@ public class GenTableEntry {
|
|||||||
this.pModTable = rs.getInt("pModTableID");
|
this.pModTable = rs.getInt("pModTableID");
|
||||||
this.sModTable = rs.getInt("sModTableID");
|
this.sModTable = rs.getInt("sModTableID");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static GenTableEntry rollTable(int genTable, int roll) {
|
||||||
|
|
||||||
|
GenTableEntry genTableEntry = null;
|
||||||
|
List<GenTableEntry> genTableEntryList;
|
||||||
|
|
||||||
|
genTableEntryList = LootManager._genTables.get(genTable);
|
||||||
|
|
||||||
|
for (GenTableEntry iteration : genTableEntryList)
|
||||||
|
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
|
||||||
|
genTableEntry = iteration;
|
||||||
|
|
||||||
|
return genTableEntry;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,11 @@
|
|||||||
|
|
||||||
package engine.loot;
|
package engine.loot;
|
||||||
|
|
||||||
|
import engine.gameManager.LootManager;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ItemTableEntry {
|
public class ItemTableEntry {
|
||||||
public int minRoll;
|
public int minRoll;
|
||||||
@@ -25,4 +28,18 @@ public class ItemTableEntry {
|
|||||||
this.minSpawn = rs.getInt("minSpawn");
|
this.minSpawn = rs.getInt("minSpawn");
|
||||||
this.maxSpawn = rs.getInt("maxSpawn");
|
this.maxSpawn = rs.getInt("maxSpawn");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ItemTableEntry rollTable(int itemTable, int roll) {
|
||||||
|
|
||||||
|
ItemTableEntry itemTableEntry = null;
|
||||||
|
List<ItemTableEntry> itemTableEntryList;
|
||||||
|
|
||||||
|
itemTableEntryList = LootManager._itemTables.get(itemTable);
|
||||||
|
|
||||||
|
for (ItemTableEntry iteration : itemTableEntryList)
|
||||||
|
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
|
||||||
|
itemTableEntry = iteration;
|
||||||
|
|
||||||
|
return itemTableEntry;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,11 @@
|
|||||||
|
|
||||||
package engine.loot;
|
package engine.loot;
|
||||||
|
|
||||||
|
import engine.gameManager.LootManager;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ModTableEntry {
|
public class ModTableEntry {
|
||||||
public int minRoll;
|
public int minRoll;
|
||||||
@@ -23,4 +26,18 @@ public class ModTableEntry {
|
|||||||
this.action = rs.getString("action");
|
this.action = rs.getString("action");
|
||||||
this.level = rs.getInt("level");
|
this.level = rs.getInt("level");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ModTableEntry rollTable(int modTablwe, int roll) {
|
||||||
|
|
||||||
|
ModTableEntry modTableEntry = null;
|
||||||
|
List<ModTableEntry> itemTableEntryList;
|
||||||
|
|
||||||
|
itemTableEntryList = LootManager._modTables.get(modTablwe);
|
||||||
|
|
||||||
|
for (ModTableEntry iteration : itemTableEntryList)
|
||||||
|
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
|
||||||
|
modTableEntry = iteration;
|
||||||
|
|
||||||
|
return modTableEntry;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,11 @@
|
|||||||
|
|
||||||
package engine.loot;
|
package engine.loot;
|
||||||
|
|
||||||
|
import engine.gameManager.LootManager;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ModTypeTableEntry {
|
public class ModTypeTableEntry {
|
||||||
public int minRoll;
|
public int minRoll;
|
||||||
@@ -21,4 +24,18 @@ public class ModTypeTableEntry {
|
|||||||
this.maxRoll = rs.getInt("maxRoll");
|
this.maxRoll = rs.getInt("maxRoll");
|
||||||
this.modTableID = rs.getInt("subTableID");
|
this.modTableID = rs.getInt("subTableID");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ModTypeTableEntry rollTable(int modTablwe, int roll) {
|
||||||
|
|
||||||
|
ModTypeTableEntry modTypeTableEntry = null;
|
||||||
|
List<ModTypeTableEntry> modTypeTableEntryList;
|
||||||
|
|
||||||
|
modTypeTableEntryList = LootManager._modTypeTables.get(modTablwe);
|
||||||
|
|
||||||
|
for (ModTypeTableEntry iteration : modTypeTableEntryList)
|
||||||
|
if (roll >= iteration.minRoll && roll <= iteration.maxRoll)
|
||||||
|
modTypeTableEntry = iteration;
|
||||||
|
|
||||||
|
return modTypeTableEntry;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,10 +15,7 @@ import java.util.HashMap;
|
|||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public class LootTable {
|
public class LootTable {
|
||||||
|
private static final ConcurrentHashMap<Integer, LootTable> modTables = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||||
private static final ConcurrentHashMap<Integer, LootTable> genTables = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
|
||||||
private static final ConcurrentHashMap<Integer, LootTable> itemTables = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
|
||||||
private static final ConcurrentHashMap<Integer, LootTable> modTables = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
|
||||||
private static final ConcurrentHashMap<Integer, LootTable> modTypeTables = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
private static final ConcurrentHashMap<Integer, LootTable> modTypeTables = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||||
private static final ConcurrentHashMap<Integer, Integer> statRuneChances = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
private static final ConcurrentHashMap<Integer, Integer> statRuneChances = new ConcurrentHashMap<>(MBServerStatics.CHM_INIT_CAP, MBServerStatics.CHM_LOAD, MBServerStatics.CHM_THREAD_LOW);
|
||||||
public static boolean initialized = false;
|
public static boolean initialized = false;
|
||||||
@@ -46,54 +43,6 @@ public class LootTable {
|
|||||||
this.lootTableID = lootTableID;
|
this.lootTableID = lootTableID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LootTable getGenTable(int UUID) {
|
|
||||||
|
|
||||||
if (genTables.containsKey(UUID))
|
|
||||||
return genTables.get(UUID);
|
|
||||||
|
|
||||||
LootTable lootGroup = new LootTable(UUID);
|
|
||||||
genTables.put(UUID, lootGroup);
|
|
||||||
return lootGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static LootTable getItemTable(int UUID) {
|
|
||||||
|
|
||||||
if (itemTables.containsKey(UUID))
|
|
||||||
return itemTables.get(UUID);
|
|
||||||
|
|
||||||
LootTable lootTable = new LootTable(UUID);
|
|
||||||
itemTables.put(UUID, lootTable);
|
|
||||||
|
|
||||||
return lootTable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the lootGroups
|
|
||||||
*/
|
|
||||||
public static ConcurrentHashMap<Integer, LootTable> getGenTables() {
|
|
||||||
return genTables;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the lootTables
|
|
||||||
*/
|
|
||||||
public static ConcurrentHashMap<Integer, LootTable> getItemTables() {
|
|
||||||
return itemTables;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the modTables
|
|
||||||
*/
|
|
||||||
public static ConcurrentHashMap<Integer, LootTable> getModTables() {
|
|
||||||
return modTables;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the modGroups
|
|
||||||
*/
|
|
||||||
public static ConcurrentHashMap<Integer, LootTable> getModTypeTables() {
|
|
||||||
return modTypeTables;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static LootTable getModTypeTable(int UUID) {
|
public static LootTable getModTypeTable(int UUID) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user