diff --git a/src/engine/loot/LootManager.java b/src/engine/loot/LootManager.java index b2de6c0a..6b733f60 100644 --- a/src/engine/loot/LootManager.java +++ b/src/engine/loot/LootManager.java @@ -81,37 +81,57 @@ public class LootManager { DropEquipment(mob,multiplier); return; } + Boolean hasRolledForGlass = false; for (BootySetEntry bse : entries) { switch (bse.bootyType) { case "GOLD": GenerateGoldDrop(mob,bse,multiplier); break; case "LOOT": - GenerateNormalLootDrop(mob,bse,multiplier); + GenerateNormalLootDrop(mob,bse,multiplier,inHotzone); if (inHotzone && mob.level < 80) { if (generalItemTables.containsKey(bse.lootTable + 1)) { GenerateHotzoneLootDrop(mob, bse, multiplier); + } else{ + //if hotzone equivalent table doesn't exist, roll for glass + RollForGlass(mob); + hasRolledForGlass = true; } } if(mob.level > 80){ RollForGlass(mob); } + RollLootTableForHotzone(mob, bse); break; case "ITEM": GenerateItemLootDrop(mob,bse,multiplier); break; } } - if(inHotzone){ + if(inHotzone && hasRolledForGlass == false){ RollForGlass(mob); } } - public static MobLoot getGenTableItem(int genTableID, Mob mob) { + public static void RollLootTableForHotzone(Mob mob, BootySetEntry bse){ + MobLoot toAdd = getGenTableItem(bse.lootTable, mob,true); + if (toAdd != null) { + if(toAdd.getPrefix() == null && toAdd.getSuffix() == null){ + toAdd.setIsID(true); + } + mob.getCharItemManager().addItemToInventory(toAdd); + } + } + public static MobLoot getGenTableItem(int genTableID, Mob mob, Boolean isHotzone) { if (genTableID == 0 || mob == null || generalItemTables.containsKey(genTableID) == false) { return null; } MobLoot outItem; - int genRoll = new Random().nextInt(100)+1; + int genRoll; + if(isHotzone){ + genRoll = ThreadLocalRandom.current().nextInt(32) + 77; + } else { + genRoll = new Random().nextInt(100) + 1; + } GenTableRow selectedRow = generalItemTables.get(genTableID).getRowForRange(genRoll); if (selectedRow == null) { return null; @@ -195,7 +215,7 @@ public class LootManager { mob.getCharItemManager().addItemToInventory(goldAmount); } } - public static void GenerateNormalLootDrop(Mob mob, BootySetEntry bse,float multiplier){ + public static void GenerateNormalLootDrop(Mob mob, BootySetEntry bse,float multiplier, Boolean inHotzone){ try{ int chanceRoll = ThreadLocalRandom.current().nextInt(100) + 1; if (chanceRoll > bse.dropChance * multiplier) { @@ -203,7 +223,7 @@ public class LootManager { return; } //iterate the booty tables and add items to mob inventory - MobLoot toAdd = getGenTableItem(bse.lootTable, mob); + MobLoot toAdd = getGenTableItem(bse.lootTable, mob,inHotzone); if (toAdd != null) { if(toAdd.getPrefix() == null && toAdd.getSuffix() == null){ toAdd.setIsID(true); @@ -218,12 +238,13 @@ public class LootManager { } public static void GenerateHotzoneLootDrop(Mob mob, BootySetEntry bse, float multiplier){ int lootTableID = bse.lootTable + 1; - int chanceRoll = ThreadLocalRandom.current().nextInt(100) + 1; - if (chanceRoll > bse.dropChance * multiplier) { - //early exit, failed to hit minimum chance roll - return; - } - MobLoot toAdd = getGenTableItem(lootTableID, mob); + //hotzone roll will ignore chance from inherited table + //int chanceRoll = ThreadLocalRandom.current().nextInt(100) + 1; + //if (chanceRoll > bse.dropChance * multiplier) { + // //early exit, failed to hit minimum chance roll + // return; + //} + MobLoot toAdd = getGenTableItem(lootTableID, mob, true); if (toAdd != null) { if (toAdd.getPrefix() != null && toAdd.getPrefix().isEmpty() == true && toAdd.getSuffix() != null && toAdd.getSuffix().isEmpty() == true) { toAdd.setIsID(true);