diff --git a/src/engine/gameManager/LootManager.java b/src/engine/gameManager/LootManager.java index 0760b057..eb0a52c2 100644 --- a/src/engine/gameManager/LootManager.java +++ b/src/engine/gameManager/LootManager.java @@ -112,9 +112,22 @@ public enum LootManager { case "LOOT": if (ThreadLocalRandom.current().nextInt(1, 100 + 1) < (bse.dropChance * dropRate)) GenerateLootDrop(mob, bse.genTable); //generate normal loot drop - if(ThreadLocalRandom.current().nextInt(1, 20000) < mob.level) { - if (_genTables.containsKey(bse.genTable + 1) && ThreadLocalRandom.current().nextInt(1, 100 + 1) < (bse.dropChance * dropRate)) { - GenerateLootDrop(mob, bse.genTable + 1); //generate loot drop from hotzone table + if(ThreadLocalRandom.current().nextInt(1, 20000) == 10000) { + if (_genTables.containsKey(bse.genTable + 1)) { + int roll = ThreadLocalRandom.current().nextInt(1,101); + MobLoot extraLoot = null; + if(roll >= 1 && roll <= 47){ + extraLoot = rollForContract(bse.genTable + 1, mob); + } + if(roll >= 48 && roll <= 94){ + extraLoot = rollForRune(bse.genTable + 1, mob); + } + if(roll >= 95){ + extraLoot = rollForGlass(mob); + } + if(extraLoot != null){ + mob.getCharItemManager().addItemToInventory(extraLoot); + } } } break; @@ -453,4 +466,66 @@ public enum LootManager { itemMan.addItemToInventory(playerWinnings); itemMan.updateInventory(); } + + public static MobLoot rollForContract(int table, Mob mob){ + GenTableEntry selectedRow = GenTableEntry.rollTable(table, 95, 1.0f); + if (selectedRow == null) + return null; + + int itemTableId = selectedRow.itemTableID; + + if (_itemTables.containsKey(itemTableId) == false) + return null; + ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, ThreadLocalRandom.current().nextInt(1,321)); + if (tableRow == null) + return null; + + int itemUUID = tableRow.cacheID; + + if (itemUUID == 0) + return null; + + MobLoot outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false); + if(outItem != null) + return outItem; + return null; + } + public static MobLoot rollForRune(int table, Mob mob){ + GenTableEntry selectedRow = GenTableEntry.rollTable(table, 95, 1.0f); + if (selectedRow == null) + return null; + + int itemTableId = selectedRow.itemTableID; + + if (_itemTables.containsKey(itemTableId) == false) + return null; + ItemTableEntry tableRow = ItemTableEntry.rollTable(itemTableId, ThreadLocalRandom.current().nextInt(1,321)); + if (tableRow == null) + return null; + + int itemUUID = tableRow.cacheID; + + if (itemUUID == 0) + return null; + + MobLoot outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false); + if(outItem != null) + return outItem; + return null; + } + public static MobLoot rollForGlass( Mob mob){ + ItemTableEntry tableRow = ItemTableEntry.rollTable(126, ThreadLocalRandom.current().nextInt(1,321)); + if (tableRow == null) + return null; + + int itemUUID = tableRow.cacheID; + + if (itemUUID == 0) + return null; + + MobLoot outItem = new MobLoot(mob, ItemBase.getItemBase(itemUUID), false); + if(outItem != null) + return outItem; + return null; + } }