Fixed ring of forging lasting too long
Implemented ring of forging "operate" to check remaining charges
This commit is contained in:
@@ -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.
|
* @param player the player.
|
||||||
* @return {@code True} if success.
|
* @return {@code True} if success.
|
||||||
@@ -190,7 +190,9 @@ public class SmeltingPulse extends SkillPulse<Item> {
|
|||||||
if (charges <= 0) {
|
if (charges <= 0) {
|
||||||
if (removeItem(player, Items.RING_OF_FORGING_2568, Container.EQUIPMENT)) {
|
if (removeItem(player, Items.RING_OF_FORGING_2568, Container.EQUIPMENT)) {
|
||||||
charges = 140;
|
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 {
|
} else {
|
||||||
log(this.getClass(), Log.ERR, "Failed to delete empty ring of forging for player " + player.getName());
|
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
|
return false; //unfair but prevents exploit if the impossible happens
|
||||||
|
|||||||
Reference in New Issue
Block a user