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,21 +1,20 @@
package content.global.skill.farming
import core.api.log
import core.api.*
import core.cache.def.impl.SceneryDefinition
import core.game.interaction.OptionHandler
import core.game.node.Node
import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills
import core.tools.SystemLogger
import core.plugin.Initializable
import core.plugin.Plugin
import core.tools.Log
import java.util.concurrent.TimeUnit
@Initializable
class HealthChecker : OptionHandler(){
class HealthChecker : OptionHandler() {
override fun newInstance(arg: Any?): Plugin<Any> {
SceneryDefinition.setOptionHandler("check-health",this)
SceneryDefinition.setOptionHandler("check-health", this)
return this
}
@@ -27,24 +26,27 @@ class HealthChecker : OptionHandler(){
val patch = fPatch.getPatchFor(player)
val type = patch.patch.type
if(type != PatchType.BUSH && type != PatchType.FRUIT_TREE && type != PatchType.TREE && type != PatchType.CACTUS){
player.sendMessage("This shouldn't be happening. Please report this.")
if (type != PatchType.BUSH_PATCH && type != PatchType.FRUIT_TREE_PATCH && type != PatchType.TREE_PATCH && type != PatchType.CACTUS_PATCH) {
sendMessage(player, "This shouldn't be happening. Please report this.")
return true
}
if(!patch.isCheckHealth) return true
if (!patch.isCheckHealth) return true
player.skills.addExperience(Skills.FARMING,patch.plantable?.checkHealthXP ?: 0.0)
rewardXP(player, Skills.FARMING, patch.plantable?.checkHealthXP ?: 0.0)
patch.isCheckHealth = false
when(type){
PatchType.TREE -> patch.setCurrentState(patch.getCurrentState() + 1)
PatchType.FRUIT_TREE -> patch.setCurrentState(patch.getCurrentState() - 14)
PatchType.BUSH -> patch.setCurrentState(patch.plantable!!.value + patch.plantable!!.stages + 4)
PatchType.CACTUS -> patch.setCurrentState(patch.plantable!!.value + patch.plantable!!.stages + 3)
else -> log(this::class.java, Log.ERR, "Unreachable patch type from when(type) switch in HealthChecker.kt line 36")
when (type) {
PatchType.TREE_PATCH -> patch.setCurrentState(patch.getCurrentState() + 1)
PatchType.FRUIT_TREE_PATCH -> patch.setCurrentState(patch.getCurrentState() - 14)
PatchType.BUSH_PATCH -> {
sendMessage(player, "You examine the bush for signs of disease and find that it's in perfect health.")
patch.setCurrentState(patch.plantable!!.value + patch.plantable!!.stages + 4)
}
PatchType.CACTUS_PATCH -> patch.setCurrentState(patch.plantable!!.value + patch.plantable!!.stages + 3)
else -> log(this::class.java, Log.ERR, "Unreachable patch type from when(type) switch in HealthChecker.kt")
}
if(type == PatchType.FRUIT_TREE){
if (type == PatchType.FRUIT_TREE_PATCH) {
patch.nextGrowth = TimeUnit.MINUTES.toMillis(45)
}