From 251934d3a9efa9027ad41782ce74714e045d3bb7 Mon Sep 17 00:00:00 2001 From: randy Date: Wed, 13 Nov 2024 20:51:24 -0700 Subject: [PATCH] Audded autolooting of coins and tokkul if wearing ring of wealth --- .../node/entity/npc/drop/NPCDropTables.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Server/src/main/core/game/node/entity/npc/drop/NPCDropTables.java b/Server/src/main/core/game/node/entity/npc/drop/NPCDropTables.java index 7421228f7..2ce42e98c 100644 --- a/Server/src/main/core/game/node/entity/npc/drop/NPCDropTables.java +++ b/Server/src/main/core/game/node/entity/npc/drop/NPCDropTables.java @@ -104,6 +104,9 @@ public final class NPCDropTables { if (handleBoneCrusher(player, item)) { return; } + if (handleCurrency(player, item)) { + return; + } if (item.hasItemPlugin() && player != null) { if (!item.getPlugin().createDrop(item, player, npc, l)) { return; @@ -260,6 +263,25 @@ public final class NPCDropTables { player.getSkills().addExperience(Skills.PRAYER, item.getAmount() * bone.getExperience()); return true; } + + /** + * Snowscape custom: Automatically loot coins and tokkul if wearing a ring of wealth. + * @param player The player + * @param item The item + * @return true if successfully added items to player. + */ + private boolean handleCurrency(Player player, Item item) { + if (item.getId() == 995 || item.getId() == 6529) { + Item ring = player.getEquipment().get(12); + if (ring != null && ring.getId() >= 14638 && ring.getId() <=14646) { + if (player.getInventory().add(item)) { + player.sendMessage("Your Ring collected " + item.getAmount() + " " + item.getName() + "."); + return true; + } + } + } + return false; + } /** * Gets the ratio for stabilizing NPC combat difficulty & drop rates.