From 90d6911d41f4dd92908e772e809d4c1c6b90f386 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 15 Jun 2024 19:26:49 -0500 Subject: [PATCH] loot manager for glass runes and contracts --- src/engine/gameManager/LootManager.java | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/engine/gameManager/LootManager.java b/src/engine/gameManager/LootManager.java index 14e07d85..da107603 100644 --- a/src/engine/gameManager/LootManager.java +++ b/src/engine/gameManager/LootManager.java @@ -502,20 +502,11 @@ public enum LootManager { } public static ItemBase rollRandomItem(int itemTable, int min){ - ItemTableEntry itemTableEntry = null; - List itemTableEntryList; - - itemTableEntryList = LootManager._itemTables.get(itemTable); - int maxRoll = 320; - - int roll = ThreadLocalRandom.current().nextInt(min,maxRoll + 1); - for (ItemTableEntry iteration : itemTableEntryList) - if (roll >= iteration.minRoll && roll <= iteration.maxRoll) - itemTableEntry = iteration; - - if(itemTableEntry != null && itemTableEntry.cacheID != 0) { - return ItemBase.getItemBase(itemTableEntry.cacheID); - } else{ + int roll = ThreadLocalRandom.current().nextInt(min,321); + ItemTableEntry ite = ItemTableEntry.rollTable(itemTable, roll); + if(ite != null) { + return ItemBase.getItemBase(ite.cacheID); + }else{ return null; } }