From 7a5dde7100617de60b2869f4015c4fc202fa5534 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Wed, 16 Aug 2023 08:29:29 -0400 Subject: [PATCH] Modified GenTable.rollTable() interface to support drop rates natively. --- src/engine/gameManager/LootManager.java | 10 +++++----- src/engine/loot/GenTableEntry.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/engine/gameManager/LootManager.java b/src/engine/gameManager/LootManager.java index 172e7ba6..8c91c654 100644 --- a/src/engine/gameManager/LootManager.java +++ b/src/engine/gameManager/LootManager.java @@ -150,7 +150,7 @@ public enum LootManager { 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) return null; @@ -207,7 +207,7 @@ public enum LootManager { 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) return inItem; @@ -239,7 +239,7 @@ public enum LootManager { 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) return inItem; @@ -402,8 +402,8 @@ public enum LootManager { //roll 1-100 for the gen table selection - int genRoll = ThreadLocalRandom.current().nextInt(1,100 + 1); - GenTableEntry selectedRow = GenTableEntry.rollTable(tableID, genRoll); + int genRoll = ThreadLocalRandom.current().nextInt(1, 100 + 1); + GenTableEntry selectedRow = GenTableEntry.rollTable(tableID, genRoll, LootManager.NORMAL_DROP_RATE); if(selectedRow == null) return; diff --git a/src/engine/loot/GenTableEntry.java b/src/engine/loot/GenTableEntry.java index b7b3c625..3be47c50 100644 --- a/src/engine/loot/GenTableEntry.java +++ b/src/engine/loot/GenTableEntry.java @@ -29,7 +29,7 @@ public class GenTableEntry { 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; List genTableEntryList;