From 17b4232d80cbdd1c29a0dcfb3f84a3fa4f848dda Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Fri, 6 Sep 2024 20:14:27 -0500 Subject: [PATCH] better roll chance for high level vendors --- src/engine/gameManager/LootManager.java | 7 ++--- src/engine/objects/ItemFactory.java | 41 +++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 7 deletions(-) diff --git a/src/engine/gameManager/LootManager.java b/src/engine/gameManager/LootManager.java index 01bf271e..7d93f62d 100644 --- a/src/engine/gameManager/LootManager.java +++ b/src/engine/gameManager/LootManager.java @@ -381,7 +381,7 @@ public enum LootManager { if(mob.getObjectType().ordinal() == 52) { prefixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1); } else{ - prefixTableRoll = TableRoll(mob.level, inHotzone); + prefixTableRoll = TableRoll(mob.level * 2, inHotzone); } ModTableEntry prefixMod = ModTableEntry.rollTable(prefixTable.modTableID, prefixTableRoll); @@ -413,7 +413,7 @@ public enum LootManager { if(mob.getObjectType().ordinal() == 52) { suffixTableRoll = ThreadLocalRandom.current().nextInt(1,320 + 1); } else{ - suffixTableRoll = TableRoll(mob.level, inHotzone); + suffixTableRoll = TableRoll(mob.level * 2, inHotzone); } ModTableEntry suffixMod = ModTableEntry.rollTable(suffixTable.modTableID, suffixTableRoll); @@ -430,9 +430,6 @@ public enum LootManager { public static int TableRoll(int mobLevel, Boolean inHotzone) { - if (mobLevel > 65) - mobLevel = 65; - int max = (int) (4.882 * mobLevel + 127.0); if (max > 319) diff --git a/src/engine/objects/ItemFactory.java b/src/engine/objects/ItemFactory.java index 34b06cb0..a6f67186 100644 --- a/src/engine/objects/ItemFactory.java +++ b/src/engine/objects/ItemFactory.java @@ -707,7 +707,7 @@ public class ItemFactory { if (rollPrefix < 80) { - int randomPrefix = LootManager.TableRoll(vendor.getLevel(), false); + int randomPrefix = TableRoll(vendor.getLevel()); prefixEntry = ModTableEntry.rollTable(prefixTypeTable.modTableID, randomPrefix); if (prefixEntry != null) @@ -722,7 +722,7 @@ public class ItemFactory { if (rollSuffix < 80 || prefixEntry == null) { - int randomSuffix = LootManager.TableRoll(vendor.getLevel(), false); + int randomSuffix = TableRoll(vendor.getLevel()); suffixEntry = ModTableEntry.rollTable(suffixTypeTable.modTableID, randomSuffix); if (suffixEntry != null) @@ -774,6 +774,43 @@ public class ItemFactory { return toRoll; } + public static int TableRoll(int vendorLevel) { + // Calculate min and max based on mobLevel + int min = 60; + int max = 120; + switch(vendorLevel){ + case 20: + min = 70; + max = 140; + break; + case 30: + min = 80; + max = 160; + break; + case 40: + min = 90; + max = 180; + break; + case 50: + min = 100; + max = 200; + break; + case 60: + min = 175; + max = 260; + break; + case 70: + min = 220; + max = 320; + break; + } + + int roll = ThreadLocalRandom.current().nextInt(min, max + 1); + + return roll; + } + + public static MobLoot produceRandomRoll(NPC npc, PlayerCharacter pc, String prefixString, String suffixString, int itemID) { boolean useWarehouse = false;