Implemented auto splitting of excessively long dialogue lines

Many new farming-related player messages added, and some existing messages updated
Raking animation updated
Herb picking animation updated
Digging up farming patch animation updated
Plant cure animation updated
A scarecrow can be retrieved from a flower patch by digging it up with a spade
Picking fruit/berries stops when running out of inventory space
The player can no longer dig up a tree they have planted before chopping it down
This commit is contained in:
zsrv
2024-02-14 11:33:13 +00:00
committed by Ryan
parent 38c50c465d
commit 1d12dd741f
23 changed files with 728 additions and 520 deletions
@@ -1,7 +1,6 @@
package content.global.skill.farming
import core.api.*
import core.game.node.item.Item
import core.game.system.task.Pulse
import core.game.world.update.flag.context.Animation
import org.rs09.consts.Items
@@ -25,58 +24,58 @@ class UseWithBinHandler : InteractionListener {
val used = usedNode.id
when(used){
Items.COMPOST_POTION1_6476,Items.COMPOST_POTION2_6474, Items.COMPOST_POTION3_6472,Items.COMPOST_POTION4_6470 -> {
if(!bin.isSuperCompost && bin.isFinished && !bin.isClosed){
player.animator.animate(compostPotionAnimation)
player.pulseManager.run(object : Pulse(compostPotionAnimation.duration){
when (used) {
Items.COMPOST_POTION1_6476, Items.COMPOST_POTION2_6474, Items.COMPOST_POTION3_6472, Items.COMPOST_POTION4_6470 -> {
if (!bin.isSuperCompost && bin.isFinished && !bin.isClosed) {
animate(player, compostPotionAnimation)
submitIndividualPulse(player, object : Pulse(compostPotionAnimation.duration) {
override fun pulse(): Boolean {
if(player.inventory.remove(usedNode.asItem())) {
if (removeItem(player, usedNode.asItem())) {
bin.convert()
player.inventory.add(Item(used.getNext()))
addItem(player, used.getNext())
}
return true
}
})
} else {
player.dialogueInterpreter.sendDialogue("You can only do this with an open bin of","finished regular compost.")
sendDialogue(player, "You can only do this with an open bin of finished regular compost.")
}
}
Items.BUCKET_1925 -> {
if(bin.isFinished && !bin.isClosed){
player.pulseManager.run(object : Pulse(scoopAnimation.duration){
if (bin.isFinished && !bin.isClosed) {
submitIndividualPulse(player, object : Pulse(scoopAnimation.duration) {
override fun pulse(): Boolean {
if(!player.inventory.containsItem(usedNode.asItem())) return true
player.animator.animate(scoopAnimation)
if (!player.inventory.containsItem(usedNode.asItem())) return true
animate(player, scoopAnimation)
val item = bin.takeItem()
if(item != null && player.inventory.remove(usedNode.asItem())){
if (item != null && removeItem(player, usedNode.asItem())) {
player.inventory.add(item)
}
return item == null || !player.inventory.containsItem(usedNode.asItem())
}
})
} else {
player.dialogueInterpreter.sendDialogue("You can only scoop an opened bin of finished compost.")
sendDialogue(player, "You can only scoop an opened bin of finished compost.")
}
}
else ->
if(bin.isFull()){
player.sendMessage("This compost bin is already full.")
if (bin.isFull()) {
sendMessage(player, "This compost bin is already full.")
return@onUseWith true
} else if (!bin.isFinished) {
player.pulseManager.run(object : Pulse(fillAnim.duration){
submitIndividualPulse(player, object : Pulse(fillAnim.duration) {
override fun pulse(): Boolean {
player.animator.animate(fillAnim)
if(player.inventory.remove(usedNode.asItem())){
animate(player, fillAnim)
if (removeItem(player, usedNode.asItem())) {
bin.addItem(usedNode.asItem())
}
return bin.isFull() || player.inventory.getAmount(usedNode.asItem()) == 0
}
})
} else {
sendMessage (player, "You should empty the remaining compost first.")
sendDialogue(player, "The compost bin must be empty of compost before you can put new items in it.")
}
}
return@onUseWith true
@@ -84,8 +83,8 @@ class UseWithBinHandler : InteractionListener {
}
fun loadNodes() {
for(p in Plantable.values()){
if(p.harvestItem != Items.SCARECROW_6059) {
for (p in Plantable.values()) {
if (p.harvestItem != Items.SCARECROW_6059) {
allowedNodes.add(p.harvestItem)
}
}
@@ -98,8 +97,8 @@ class UseWithBinHandler : InteractionListener {
allowedNodes.add(Items.BUCKET_1925)
}
private fun Int.getNext(): Int{
if(this != 6476) return this + 2
private fun Int.getNext(): Int {
if (this != 6476) return this + 2
else return Items.VIAL_229
}
}