Allow making and pouring of builders tea

This commit is contained in:
gregf36665 2024-12-20 22:32:47 +00:00 committed by Syndromeramo
parent 7c553fbcad
commit 006dedec4b

View file

@ -5,6 +5,8 @@ import core.api.getDynLevel
import core.api.removeItem import core.api.removeItem
import core.api.sendDialogue import core.api.sendDialogue
import core.game.interaction.InteractionListener import core.game.interaction.InteractionListener
import core.game.node.Node
import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills import core.game.node.entity.skill.Skills
import org.rs09.consts.Items import org.rs09.consts.Items
@ -42,6 +44,40 @@ class TeaInteraction : InteractionListener {
Items.NETTLE_TEA_4240 to Items.CUP_OF_TEA_4246 Items.NETTLE_TEA_4240 to Items.CUP_OF_TEA_4246
) )
private val emptyTeaPot = intArrayOf(
Items.TEAPOT_7702,
Items.TEAPOT_7714,
Items.TEAPOT_7726
)
private val leafTeaPot = intArrayOf(
Items.TEAPOT_WITH_LEAVES_7700,
Items.TEAPOT_WITH_LEAVES_7712,
Items.TEAPOT_WITH_LEAVES_7724
)
private val t1teapot = intArrayOf(
Items.POT_OF_TEA_4_7692,
Items.POT_OF_TEA_3_7694,
Items.POT_OF_TEA_2_7696,
Items.POT_OF_TEA_1_7698,
)
private val t2teapot = intArrayOf(
Items.POT_OF_TEA_4_7704,
Items.POT_OF_TEA_3_7706,
Items.POT_OF_TEA_2_7708,
Items.POT_OF_TEA_1_7710,
)
private val t3teapot = intArrayOf(
Items.POT_OF_TEA_4_7716,
Items.POT_OF_TEA_3_7718,
Items.POT_OF_TEA_2_7720,
Items.POT_OF_TEA_1_7722,
)
override fun defineListeners() { override fun defineListeners() {
onUseWith(ITEM, teaMilkMap.keys.toIntArray(), Items.BUCKET_OF_MILK_1927){ player, used, with -> onUseWith(ITEM, teaMilkMap.keys.toIntArray(), Items.BUCKET_OF_MILK_1927){ player, used, with ->
if (removeItem(player, used) && removeItem(player, with)){ if (removeItem(player, used) && removeItem(player, with)){
@ -79,6 +115,39 @@ class TeaInteraction : InteractionListener {
} }
return@onUseWith true return@onUseWith true
} }
onUseWith(ITEM, emptyTeaPot, Items.TEA_LEAVES_7738) { player, used, with ->
if (removeItem(player, used) && removeItem(player, with)){
addItem(player, used.id - 2)
}
return@onUseWith true
} }
onUseWith(ITEM, leafTeaPot, Items.HOT_KETTLE_7691) { player, used, with ->
if (removeItem(player, used) && removeItem(player, with)){
addItem(player, Items.KETTLE_7688)
addItem(player, used.id - 8)
}
return@onUseWith true
}
onUseWith(ITEM, t1teapot, Items.EMPTY_CUP_7728) { player, used, with ->
return@onUseWith fillBuildersTea(player, used, with)
}
}
private fun fillBuildersTea(player: Player, used: Node, with: Node) : Boolean {
if (removeItem(player, used) && removeItem(player, with)){
// Thanks tea pot with tea leaves
if (used.id + 4 in emptyTeaPot){
addItem(player, used.id + 4)
}
else{
addItem(player, used.id + 2)
}
addItem(player, with.id + 2)
return true
}
return false
}
} }