From 45eb0776d61dea0509dbe4e34fb0c4f7b74c12b6 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 2 Jun 2024 16:24:55 -0500 Subject: [PATCH] THIRD AFTER ROLLBACK: contract and rune and glass drop rates adjusted properly --- src/engine/gameManager/LootManager.java | 38 ++++++++++++------------- src/engine/objects/Mob.java | 7 +++++ 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/src/engine/gameManager/LootManager.java b/src/engine/gameManager/LootManager.java index b0cc259b..d467c448 100644 --- a/src/engine/gameManager/LootManager.java +++ b/src/engine/gameManager/LootManager.java @@ -122,20 +122,16 @@ public enum LootManager { case "LOOT": if (ThreadLocalRandom.current().nextInt(1, 100 + 1) < (bse.dropChance * dropRate)) GenerateLootDrop(mob, bse.genTable); //generate normal loot drop - if (mob.parentZone.getSafeZone() == 0 && hasExtraRolled == false && ThreadLocalRandom.current().nextInt(1, 5000) < 15 * dropRate) { - int roll = ThreadLocalRandom.current().nextInt(1, 101); - MobLoot extraLoot = null; - if (roll <= 50) { - extraLoot = rollForContract(bse.genTable, mob); - } - if (roll >= 51) { - extraLoot = rollForRune(bse.genTable, mob); - } - if (extraLoot != null) { - mob.getCharItemManager().addItemToInventory(extraLoot); - } - hasExtraRolled = true; - } + if(mob.contractCounter >= 250){ + MobLoot extraLoot = rollForContract(bse.genTable, mob); + if (extraLoot != null) + mob.getCharItemManager().addItemToInventory(extraLoot); + } + if(mob.runeCounter >= 250){ + MobLoot extraLoot = rollForRune(bse.genTable, mob); + if (extraLoot != null) + mob.getCharItemManager().addItemToInventory(extraLoot); + } break; case "ITEM": GenerateInventoryDrop(mob, bse); @@ -566,7 +562,7 @@ public enum LootManager { if (_itemTables.containsKey(itemTableId) == false) return null; - ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, ThreadLocalRandom.current().nextInt(1,321)); + ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, ThreadLocalRandom.current().nextInt(75,321)); if (tableRow == null) return null; @@ -576,8 +572,10 @@ public enum LootManager { return null; MobLoot outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false); - if(outItem != null) + if(outItem != null) { + mob.contractCounter = 0; return outItem; + } return null; } public static MobLoot rollForRune(int table, Mob mob){ @@ -593,7 +591,7 @@ public enum LootManager { if (_itemTables.containsKey(itemTableId) == false) return null; - ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, ThreadLocalRandom.current().nextInt(1,321)); + ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, ThreadLocalRandom.current().nextInt(75,321)); if (tableRow == null) return null; @@ -603,12 +601,14 @@ public enum LootManager { return null; MobLoot outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false); - if(outItem != null) + if(outItem != null) { + mob.runeCounter = 0; return outItem; + } return null; } public static MobLoot rollForGlass( Mob mob){ - ItemTableEntry tableRow = ItemTableEntry.rollTable(126, ThreadLocalRandom.current().nextInt(1,321)); + ItemTableEntry tableRow = ItemTableEntry.rollTable(126, ThreadLocalRandom.current().nextInt(220,321)); if (tableRow == null) return null; diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index 928c5e56..0371dff4 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -36,6 +36,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.locks.ReentrantReadWriteLock; import static engine.gameManager.NPCManager._runeSetMap; @@ -85,6 +86,9 @@ public class Mob extends AbstractIntelligenceAgent { public boolean dropper = false; + public int contractCounter = 0; + public int runeCounter = 0; + // New Mobile constructor. Fill in the blanks and then call // PERSIST. public Mob() { @@ -167,6 +171,9 @@ public class Mob extends AbstractIntelligenceAgent { //this.setResists(Resists.getResists(rs.getInt("mob_spawnType"))); setResistsForMob(this); + + this.contractCounter = ThreadLocalRandom.current().nextInt(250); + this.runeCounter = ThreadLocalRandom.current().nextInt(250); } catch (Exception e) { Logger.error(e + " " + this.dbID); }