Elemental Battlestaves can optionally be crafted with a Dramen staff instead of a Battlestaff

This commit is contained in:
randy 2025-03-17 10:42:24 -06:00
parent d02b16d970
commit a5eb1ea929

View file

@ -10,11 +10,11 @@ import kotlin.math.min
class BattlestaffListener : InteractionListener {
private val battlestaff = Items.BATTLESTAFF_1391
private val battlestaff = intArrayOf(Items.BATTLESTAFF_1391, Items.DRAMEN_STAFF_772)
val orbs = BattlestaffProduct.values().map { it.requiredOrbItemId }.toIntArray()
override fun defineListeners() {
onUseWith(IntType.ITEM, orbs, battlestaff) { player, used, with ->
onUseWith(IntType.ITEM, orbs, *battlestaff) { player, used, with ->
val product = BattlestaffProduct.productMap[used.id] ?: return@onUseWith true
if (!hasLevelDyn(player, Skills.CRAFTING, product.minimumLevel)) {
@ -25,7 +25,7 @@ class BattlestaffListener : InteractionListener {
// Avoids sending dialogue if only one can be created
if (amountInInventory(player, used.id) == 1 || amountInInventory(player, with.id) == 1) {
if (removeItem(player, product.requiredOrbItemId) && removeItem(player, Items.BATTLESTAFF_1391)) {
if (removeItem(player, product.requiredOrbItemId) && removeItem(player, with.id)) {
addItem(player, product.producedItemId, product.amountProduced)
rewardXP(player, Skills.CRAFTING, product.experience)
}
@ -44,7 +44,7 @@ class BattlestaffListener : InteractionListener {
runTask(player, 2, amount) {
if (amount < 1) return@runTask
if (removeItem(player, product.requiredOrbItemId) && removeItem(player, Items.BATTLESTAFF_1391)) {
if (removeItem(player, product.requiredOrbItemId) && removeItem(player, with.id)) {
addItem(player, product.producedItemId, product.amountProduced)
rewardXP(player, Skills.CRAFTING, product.experience)
}