From d031f1be012e83eeac6c697b7b18c3c6cf166151 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Fri, 27 Dec 2024 20:24:12 -0600 Subject: [PATCH] audit command for drop rates --- src/engine/gameManager/LootManager.java | 63 +++++++++++++------------ 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/src/engine/gameManager/LootManager.java b/src/engine/gameManager/LootManager.java index 11e11f8e..2a3389e5 100644 --- a/src/engine/gameManager/LootManager.java +++ b/src/engine/gameManager/LootManager.java @@ -127,38 +127,43 @@ public enum LootManager { float dropRate; if (!mob.getSafeZone()) { - int baseBound = 100000; - int levelPenalty = (int) (Math.max(0, Math.abs(50 - mob.level)) * 0.01 * 100000); - int totalRange = baseBound + levelPenalty; + boolean allow = false; if(mob.level >= 50){ - totalRange = baseBound; + //totalRange = baseBound; + allow = true; + }else{ + if((50 - mob.level) < ThreadLocalRandom.current().nextInt(0,101)){ + allow = true; + } } - // Roll within the adjusted range - int specialCaseRoll = ThreadLocalRandom.current().nextInt(1, totalRange + 1); - - // Special Case Contract Drop - if (specialCaseRoll <= 400) { // 0.4% of the range - SpecialCaseResourceDrop(mob, entries); - } else if (specialCaseRoll <= 800) { // Next 0.4% of the range - SpecialCaseContractDrop(mob, entries); - } else if (specialCaseRoll <= 1200) { // Next 0.4% of the range - SpecialCaseRuneDrop(mob, entries); - } else if (specialCaseRoll <= 1210) { // Next 0.01% of the range - int glassID = rollRandomItem(126); - ItemBase glassItem = ItemBase.getItemBase(glassID); - if (glassItem != null) { - MobLoot toAddGlass = new MobLoot(mob, glassItem, false); - if (toAddGlass != null) - mob.getCharItemManager().addItemToInventory(toAddGlass); - } - } else if (specialCaseRoll <= 1220) { // Next 0.01% of the range - int guardContractID = racial_guard_uuids.get(new java.util.Random().nextInt(racial_guard_uuids.size())); - ItemBase guardContract = ItemBase.getItemBase(guardContractID); - if (guardContract != null) { - MobLoot toAddContract = new MobLoot(mob, guardContract, false); - if (toAddContract != null) - mob.getCharItemManager().addItemToInventory(toAddContract); + if(allow) { + // Roll within the adjusted range + int specialCaseRoll = ThreadLocalRandom.current().nextInt(1, 100000 + 1); + + // Special Case Contract Drop + if (specialCaseRoll <= 400) { // 0.4% of the range + SpecialCaseResourceDrop(mob, entries); + } else if (specialCaseRoll <= 800) { // Next 0.4% of the range + SpecialCaseContractDrop(mob, entries); + } else if (specialCaseRoll <= 1200) { // Next 0.4% of the range + SpecialCaseRuneDrop(mob, entries); + } else if (specialCaseRoll <= 1210) { // Next 0.01% of the range + int glassID = rollRandomItem(126); + ItemBase glassItem = ItemBase.getItemBase(glassID); + if (glassItem != null) { + MobLoot toAddGlass = new MobLoot(mob, glassItem, false); + if (toAddGlass != null) + mob.getCharItemManager().addItemToInventory(toAddGlass); + } + } else if (specialCaseRoll <= 1220) { // Next 0.01% of the range + int guardContractID = racial_guard_uuids.get(new java.util.Random().nextInt(racial_guard_uuids.size())); + ItemBase guardContract = ItemBase.getItemBase(guardContractID); + if (guardContract != null) { + MobLoot toAddContract = new MobLoot(mob, guardContract, false); + if (toAddContract != null) + mob.getCharItemManager().addItemToInventory(toAddContract); + } } } }