Added ability to actually make scarecrows now/Fixed a bug caused by the AbyssPlugin

This commit is contained in:
phil lips 2021-07-22 04:20:39 +00:00 committed by Ceikry
parent 0038846ffe
commit d12a1a5ed8
3 changed files with 56 additions and 1 deletions

View file

@ -0,0 +1,22 @@
package rs09.game.interaction.item.withitem
import api.Container
import api.ContentAPI
import org.rs09.consts.Items
import rs09.game.interaction.InteractionListener
class HaySackOnSpear : InteractionListener() {
val HAYSACK = Items.HAY_SACK_6057
val SPEAR = Items.BRONZE_SPEAR_1237
override fun defineListeners() {
onUseWith(ITEM, HAYSACK, SPEAR){ player, used, _ ->
if(ContentAPI.removeItem(player, used.asItem(), Container.INVENTORY)){
ContentAPI.addItem(player, Items.HAY_SACK_6058, 1)
ContentAPI.sendMessage(player, "You stab the hay sack with a bronze spear")
ContentAPI.removeItem(player, SPEAR, Container.INVENTORY)
}
return@onUseWith true
}
}
}

View file

@ -0,0 +1,27 @@
package rs09.game.interaction.item.withitem
import api.Container
import api.ContentAPI
import core.game.node.entity.skill.Skills
import org.rs09.consts.Items
import rs09.game.interaction.InteractionListener
class WatermelonOnSack : InteractionListener() {
val SACK = Items.HAY_SACK_6058
val WATERMELON = Items.WATERMELON_5982
override fun defineListeners() {
onUseWith(ITEM, SACK, WATERMELON){player, used, _ ->
if(ContentAPI.getStatLevel(player, Skills.FARMING) >= 23){
ContentAPI.removeItem(player,SACK, Container.INVENTORY)
ContentAPI.removeItem(player,WATERMELON,Container.INVENTORY)
ContentAPI.addItem(player, Items.SCARECROW_6059)
ContentAPI.rewardXP(player, Skills.FARMING, 25.0)
ContentAPI.sendMessage(player, "You stab the watermelon on top of the spear, finishing your scarecrow")
}else{
ContentAPI.sendMessage(player, "Your Farming level is not high enough to do this")
}
return@onUseWith true
}
}
}

View file

@ -26,9 +26,10 @@ import rs09.game.world.GameWorld
*/
class AbyssPlugin : InteractionListener() {
val OBSTACLE = AbbysalObstacle.values().filter { it != AbbysalObstacle.MINE && it != AbbysalObstacle.SQUEEZE }.map { it.option }.toTypedArray()
val OBSTACLE = AbbysalObstacle.values().filter { it != AbbysalObstacle.MINE && it != AbbysalObstacle.SQUEEZE && it != AbbysalObstacle.PASSAGE}.map { it.option }.toTypedArray()
val miningObstacle = 7158
val agilityObstacle = 7164
val passage = 7154
override fun defineListeners() {
definePlugin(AbyssalNPC())
@ -62,6 +63,11 @@ class AbyssPlugin : InteractionListener() {
obstacle!!.handle(player, node as Scenery)
return@on true
}
on(passage, SCENERY, "go-through",){ player, node ->
val obstacle = AbbysalObstacle.forObject(node as Scenery)
obstacle!!.handle(player, node as Scenery)
return@on true
}
}