Fixed ring of forging lasting too long

Implemented ring of forging "operate" to check remaining charges
This commit is contained in:
Beck
2026-04-04 13:11:24 +00:00
committed by Ryan
parent 2269baac8a
commit d642c23a2c
2 changed files with 26 additions and 2 deletions
@@ -0,0 +1,22 @@
package content.global.handlers.item
import core.api.getAttribute
import core.api.sendMessage
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import org.rs09.consts.Items
class RingForgingOperateListener: InteractionListener {
override fun defineListeners() {
on(Items.RING_OF_FORGING_2568, IntType.ITEM, "operate") { player, node ->
//Attribute set at SmeltingPulse.java
val charges = getAttribute(player, "ringOfForgingCharges", 140)
sendMessage(player, "You can smelt $charges more iron ore before the ring disintegrates.")
return@on true
}
}
}
@@ -178,7 +178,7 @@ public class SmeltingPulse extends SkillPulse<Item> {
}
/**
* Checks if the forging is a succes.
* Checks if the forging is a success.
*
* @param player the player.
* @return {@code True} if success.
@@ -190,7 +190,9 @@ public class SmeltingPulse extends SkillPulse<Item> {
if (charges <= 0) {
if (removeItem(player, Items.RING_OF_FORGING_2568, Container.EQUIPMENT)) {
charges = 140;
sendMessage(player, "Your ring of forging uses up its last charge and disintegrates.");
sendMessage(player, "Your Ring of forging uses up its last charge and disintegrates.");
// stop the smelting queue
stop();
} else {
log(this.getClass(), Log.ERR, "Failed to delete empty ring of forging for player " + player.getName());
return false; //unfair but prevents exploit if the impossible happens