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.
This commit is contained in:
randy 2025-03-05 11:21:34 -07:00
parent 16da0ed93e
commit a411c7a5e2
2 changed files with 11 additions and 3 deletions

View file

@ -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[] {}));

View file

@ -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());