diff --git a/src/engine/loot/LootManager.java b/src/engine/loot/LootManager.java index 6cb2e12b..3c08a4e3 100644 --- a/src/engine/loot/LootManager.java +++ b/src/engine/loot/LootManager.java @@ -52,14 +52,29 @@ public class LootManager { multiplier = Float.parseFloat(ConfigManager.MB_HOTZONE_DROP_RATE.getValue()); } //iterate the booty sets - for(BootySetEntry bse : NPCManager._bootySetMap.get(mob.getMobBase().bootySet)) { - //check if chance roll is good - if (ThreadLocalRandom.current().nextInt(100) <= (bse.dropChance * multiplier)) { - //early exit, failed to hit minimum chance roll - continue; + RunBootySet(NPCManager._bootySetMap.get(mob.getMobBase().bootySet),mob,multiplier,inHotzone); + RunBootySet(NPCManager._bootySetMap.get(mob.bootySet),mob,multiplier,inHotzone); + //lastly, check mobs inventory for godly or disc runes to send a server announcement + for (Item it : mob.getInventory()) { + ItemBase ib = it.getItemBase(); + if (ib.isDiscRune() || ib.getName().toLowerCase().contains("of the gods")) { + ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + ib.getName() + ". Are you tough enough to take it?"); + chatMsg.setMessageType(10); + chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID()); + DispatchMessage.dispatchMsgToAll(chatMsg); } + } + } + private static void RunBootySet(ArrayList entries, Mob mob, float multiplier, boolean inHotzone){ + + for(BootySetEntry bse : entries) { + //check if chance roll is good switch(bse.bootyType){ case "GOLD": + if (ThreadLocalRandom.current().nextInt(100) <= (bse.dropChance * multiplier)) { + //early exit, failed to hit minimum chance roll + break; + } //determine and add gold to mob inventory int gold = new Random().nextInt(bse.highGold - bse.lowGold) + bse.lowGold; if (gold > 0) { @@ -68,6 +83,10 @@ public class LootManager { } break; case "LOOT": + if (ThreadLocalRandom.current().nextInt(100) <= (bse.dropChance * multiplier)) { + //early exit, failed to hit minimum chance roll + break; + } //iterate the booty tables and add items to mob inventory Item toAdd = getGenTableItem(bse.lootTable, mob); if(toAdd != null) { @@ -88,16 +107,6 @@ public class LootManager { break; } } - //lastly, check mobs inventory for godly or disc runes to send a server announcement - for (Item it : mob.getInventory()) { - ItemBase ib = it.getItemBase(); - if (ib.isDiscRune() || ib.getName().toLowerCase().contains("of the gods")) { - ChatSystemMsg chatMsg = new ChatSystemMsg(null, mob.getName() + " in " + mob.getParentZone().getName() + " has found the " + ib.getName() + ". Are you tough enough to take it?"); - chatMsg.setMessageType(10); - chatMsg.setChannel(Enum.ChatChannelType.SYSTEM.getChannelID()); - DispatchMessage.dispatchMsgToAll(chatMsg); - } - } } public static Item getGenTableItem(int genTableID, Mob mob){ if(genTableID == 0 ||mob == null){ diff --git a/src/engine/objects/LootTable.java b/src/engine/objects/LootTable.java index 047b2b25..7c12f698 100644 --- a/src/engine/objects/LootTable.java +++ b/src/engine/objects/LootTable.java @@ -320,10 +320,10 @@ public class LootTable { ArrayList bootySetList; ArrayList mobLootList = new ArrayList<>(); - if (mob.bootySetID == 0) + if (mob.bootySet == 0) return mobLootList; - bootySetList = NPCManager._bootySetMap.get(mob.bootySetID); + bootySetList = NPCManager._bootySetMap.get(mob.bootySet); for (BootySetEntry bootyEntry : bootySetList) if (ThreadLocalRandom.current().nextInt(100) < bootyEntry.dropChance) { diff --git a/src/engine/objects/Mob.java b/src/engine/objects/Mob.java index ded7c562..1dc0d3fe 100644 --- a/src/engine/objects/Mob.java +++ b/src/engine/objects/Mob.java @@ -106,7 +106,7 @@ public class Mob extends AbstractIntelligenceAgent { private boolean lootSync = false; public int equipmentSetID = 0; public int runeSetID = 0; - public int bootySetID = 0; + public int bootySet = 0; /** * No Id Constructor @@ -286,7 +286,7 @@ public class Mob extends AbstractIntelligenceAgent { this.equipmentSetID = rs.getInt("equipmentSet"); this.runeSetID = rs.getInt("runeSet"); - this.bootySetID = rs.getInt("bootySet"); + this.bootySet = rs.getInt("bootySet"); if (this.contract != null) this.equipmentSetID = this.contract.getEquipmentSet();