mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-01 14:39:13 -06:00
Fixed ring of forging lasting too long
Implemented ring of forging "operate" to check remaining charges
This commit is contained in:
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.
|
* @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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue