Audded autolooting of coins and tokkul if wearing ring of wealth

This commit is contained in:
randy 2024-11-13 20:51:24 -07:00
parent 964c95b572
commit 251934d3a9

View file

@ -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.