From a411c7a5e2f60a38e5e82c66f6cf65decd65a5c9 Mon Sep 17 00:00:00 2001 From: randy Date: Wed, 5 Mar 2025 11:21:34 -0700 Subject: [PATCH] Custom Silver Sickle bonecrusher functionality improvements The automatic bone burying function now works when the sickle is equipped or in the inventory, and also affects bones from hunter traps. --- .../main/content/global/skill/hunter/TrapSetting.java | 10 +++++++++- .../core/game/node/entity/npc/drop/NPCDropTables.java | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Server/src/main/content/global/skill/hunter/TrapSetting.java b/Server/src/main/content/global/skill/hunter/TrapSetting.java index 421a982bf..73a69dbd8 100644 --- a/Server/src/main/content/global/skill/hunter/TrapSetting.java +++ b/Server/src/main/content/global/skill/hunter/TrapSetting.java @@ -20,6 +20,8 @@ import org.rs09.consts.Sounds; import static core.api.ContentAPIKt.playAudio; +import core.game.node.entity.npc.drop.NPCDropTables; + /** * A setting for a trap type. * @author Vexia @@ -161,7 +163,13 @@ public class TrapSetting { return; } addTool(player, wrapper, type); - player.getInventory().add(wrapper.getItems().toArray(new Item[] {})); + // Snowscape modification: custom bonecrusher functionality extended to include hunter bones + //player.getInventory().add(wrapper.getItems().toArray(new Item[] {})); + for (Item item: wrapper.getItems().toArray(new Item[] {})) { + if (!NPCDropTables.handleBoneCrusher(player, item)) { + player.getInventory().add(item); + } + } } else { if (isObjectTrap() && !ground) { player.getInventory().add(wrapper.getItems().toArray(new Item[] {})); 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 3a71d14ca..216f15638 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 @@ -259,12 +259,12 @@ public final class NPCDropTables { * @param item The item * @return true if successfully added experience. */ - private boolean handleBoneCrusher(Player player, Item item) { + public static boolean handleBoneCrusher(Player player, Item item) { Bones bone = Bones.forId(item.getId()); if (bone == null) { return false; } - if (!player.getInventory().containsItem(new Item(2963, 1)) || !player.getAttribute("bonecrusher:enabled", false)) { + if (!inEquipmentOrInventory(player,2963, 1) || !player.getAttribute("bonecrusher:enabled", false)) { return false; } player.getSkills().addExperience(Skills.PRAYER, item.getAmount() * bone.getExperience());