Browse Source

Modified GenTable.rollTable() interface to support drop rates natively.

master
MagicBot 1 year ago
parent
commit
7a5dde7100
  1. 10
      src/engine/gameManager/LootManager.java
  2. 2
      src/engine/loot/GenTableEntry.java

10
src/engine/gameManager/LootManager.java

@ -150,7 +150,7 @@ public enum LootManager {
int genRoll = ThreadLocalRandom.current().nextInt(1,100 + 1); int genRoll = ThreadLocalRandom.current().nextInt(1,100 + 1);
GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll); GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll, 1.0f);
if (selectedRow == null) if (selectedRow == null)
return null; return null;
@ -207,7 +207,7 @@ public enum LootManager {
private static MobLoot GeneratePrefix(AbstractCharacter mob, MobLoot inItem, int genTableID, int genRoll, Boolean inHotzone) { private static MobLoot GeneratePrefix(AbstractCharacter mob, MobLoot inItem, int genTableID, int genRoll, Boolean inHotzone) {
GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll); GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll, 1.0f);
if (selectedRow == null) if (selectedRow == null)
return inItem; return inItem;
@ -239,7 +239,7 @@ public enum LootManager {
private static MobLoot GenerateSuffix(AbstractCharacter mob, MobLoot inItem, int genTableID, int genRoll, Boolean inHotzone) { private static MobLoot GenerateSuffix(AbstractCharacter mob, MobLoot inItem, int genTableID, int genRoll, Boolean inHotzone) {
GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll); GenTableEntry selectedRow = GenTableEntry.rollTable(genTableID, genRoll, 1.0f);
if (selectedRow == null) if (selectedRow == null)
return inItem; return inItem;
@ -402,8 +402,8 @@ public enum LootManager {
//roll 1-100 for the gen table selection //roll 1-100 for the gen table selection
int genRoll = ThreadLocalRandom.current().nextInt(1,100 + 1); int genRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1);
GenTableEntry selectedRow = GenTableEntry.rollTable(tableID, genRoll); GenTableEntry selectedRow = GenTableEntry.rollTable(tableID, genRoll, LootManager.NORMAL_DROP_RATE);
if(selectedRow == null) if(selectedRow == null)
return; return;

2
src/engine/loot/GenTableEntry.java

@ -29,7 +29,7 @@ public class GenTableEntry {
this.sModTable = rs.getInt("sModTableID"); this.sModTable = rs.getInt("sModTableID");
} }
public static GenTableEntry rollTable(int genTable, int roll) { public static GenTableEntry rollTable(int genTable, int roll, float dropRate) {
GenTableEntry genTableEntry = null; GenTableEntry genTableEntry = null;
List<GenTableEntry> genTableEntryList; List<GenTableEntry> genTableEntryList;

Loading…
Cancel
Save