mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-21 09:02:07 -07:00
Add Belladonna
Fixed fruit trees
This commit is contained in:
parent
8fbb252b8e
commit
bdca845ab3
7 changed files with 35 additions and 10 deletions
|
|
@ -61,7 +61,10 @@ enum class FarmingPatch(val varpIndex: Int, val varpOffset: Int, val type: Patch
|
|||
//Spirit Tree
|
||||
ETCETERIA_SPIRIT_TREE(507,8,PatchType.SPIRIT_TREE),
|
||||
PORT_SARIM_SPIRIT_TREE(507,0,PatchType.SPIRIT_TREE),
|
||||
KARAMJA_SPIRIT_TREE(507,16,PatchType.SPIRIT_TREE);
|
||||
KARAMJA_SPIRIT_TREE(507,16,PatchType.SPIRIT_TREE),
|
||||
|
||||
//Other
|
||||
DRAYNOR_BELLADONNA(512, 16, PatchType.BELLADONNA);
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package rs09.game.node.entity.skill.farming
|
||||
|
||||
import api.ContentAPI
|
||||
import core.cache.def.impl.SceneryDefinition
|
||||
import core.game.interaction.OptionHandler
|
||||
import core.game.node.Node
|
||||
|
|
@ -23,6 +24,7 @@ class FruitAndBerryPicker : OptionHandler() {
|
|||
SceneryDefinition.setOptionHandler("pick-papaya",this)
|
||||
SceneryDefinition.setOptionHandler("pick-leaf",this)
|
||||
SceneryDefinition.setOptionHandler("pick-from",this)
|
||||
SceneryDefinition.setOptionHandler("pick-fruit",this)
|
||||
return this
|
||||
}
|
||||
|
||||
|
|
@ -58,7 +60,7 @@ class FruitAndBerryPicker : OptionHandler() {
|
|||
player.pulseManager.run(object : Pulse(animation.duration){
|
||||
override fun pulse(): Boolean {
|
||||
player.animator.animate(animation)
|
||||
player.inventory.add(reward)
|
||||
ContentAPI.addItemOrDrop(player,reward.id,reward.amount)
|
||||
player.skills.addExperience(Skills.FARMING,plantable.harvestXP)
|
||||
patch.setCurrentState(patch.getCurrentState() - 1)
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,10 @@ class HealthChecker : OptionHandler(){
|
|||
return true
|
||||
}
|
||||
|
||||
if(!patch.isCheckHealth) return true
|
||||
|
||||
player.skills.addExperience(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)
|
||||
|
|
@ -42,7 +45,7 @@ class HealthChecker : OptionHandler(){
|
|||
patch.nextGrowth = TimeUnit.MINUTES.toMillis(45)
|
||||
}
|
||||
|
||||
patch.isCheckHealth = false
|
||||
patch.update()
|
||||
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ class Patch(val player: Player, val patch: FarmingPatch, var plantable: Plantabl
|
|||
PatchType.BUSH -> player.varpManager.get(patch.varpIndex).setVarbit(patch.varpOffset,250 + (plantable!!.ordinal - Plantable.REDBERRY_SEED.ordinal))
|
||||
else -> SystemLogger.logWarn("Invalid setting of isCheckHealth for patch type: " + patch.type.name)
|
||||
}
|
||||
isCheckHealth = false
|
||||
} else {
|
||||
when(patch.type){
|
||||
PatchType.ALLOTMENT,PatchType.FLOWER,PatchType.HOPS -> {
|
||||
|
|
@ -63,6 +62,7 @@ class Patch(val player: Player, val patch: FarmingPatch, var plantable: Plantabl
|
|||
PatchType.BUSH -> {
|
||||
if(isDead) player.varpManager.get(patch.varpIndex).setVarbit(patch.varpOffset,getBushDeathValue())
|
||||
else if(isDiseased && !isDead) player.varpManager.get(patch.varpIndex).setVarbit(patch.varpOffset,getBushDiseaseValue())
|
||||
else player.varpManager.get(patch.varpIndex).setVarbit(patch.varpOffset, plantable?.value ?: 0 + currentGrowthStage)
|
||||
}
|
||||
PatchType.TREE -> {
|
||||
if(isDead) player.varpManager.get(patch.varpIndex).setVarbit(patch.varpOffset + 7,1)
|
||||
|
|
@ -72,6 +72,11 @@ class Patch(val player: Player, val patch: FarmingPatch, var plantable: Plantabl
|
|||
if(isDead) player.varpManager.get(patch.varpIndex).setVarbit(patch.varpOffset,getFruitTreeDeathValue())
|
||||
else if(isDiseased && !isDead) player.varpManager.get(patch.varpIndex).setVarbit(patch.varpOffset, getFruitTreeDiseaseValue())
|
||||
}
|
||||
PatchType.BELLADONNA -> {
|
||||
if(isDead) player.varpManager.get(patch.varpIndex).setVarbit(patch.varpOffset, getBelladonnaDeathValue())
|
||||
else if(isDiseased && !isDead) player.varpManager.get(patch.varpIndex).setVarbit(patch.varpOffset, getBelladonnaDiseaseValue())
|
||||
else player.varpManager.get(patch.varpIndex).setVarbit(patch.varpOffset, (plantable?.value ?: 0) + currentGrowthStage)
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
|
@ -110,11 +115,19 @@ class Patch(val player: Player, val patch: FarmingPatch, var plantable: Plantabl
|
|||
}
|
||||
|
||||
private fun getFruitTreeDiseaseValue(): Int {
|
||||
return (plantable?.value ?: 0) + currentGrowthStage + 13
|
||||
return (plantable?.value ?: 0) + currentGrowthStage + 12
|
||||
}
|
||||
|
||||
private fun getFruitTreeDeathValue(): Int {
|
||||
return (plantable?.value ?: 0) + currentGrowthStage + 19
|
||||
return (plantable?.value ?: 0) + currentGrowthStage + 18
|
||||
}
|
||||
|
||||
private fun getBelladonnaDiseaseValue(): Int {
|
||||
return (plantable?.value ?: 0) + currentGrowthStage + 4
|
||||
}
|
||||
|
||||
private fun getBelladonnaDeathValue(): Int {
|
||||
return (plantable?.value ?: 0) + currentGrowthStage + 7
|
||||
}
|
||||
|
||||
private fun grow(){
|
||||
|
|
@ -154,7 +167,7 @@ class Patch(val player: Player, val patch: FarmingPatch, var plantable: Plantabl
|
|||
}
|
||||
}
|
||||
|
||||
if(plantable?.stages ?: 0 > currentGrowthStage){
|
||||
if(plantable?.stages ?: 0 > currentGrowthStage && !isGrown()){
|
||||
currentGrowthStage++
|
||||
setCurrentState(getCurrentState() + 1)
|
||||
isWatered = false
|
||||
|
|
|
|||
|
|
@ -8,5 +8,6 @@ enum class PatchType(val stageGrowthTime: Int) {
|
|||
BUSH(20),
|
||||
FLOWER(5),
|
||||
HERB(20),
|
||||
SPIRIT_TREE(293)
|
||||
SPIRIT_TREE(293),
|
||||
BELLADONNA(80)
|
||||
}
|
||||
|
|
@ -73,7 +73,10 @@ enum class Plantable(val itemID: Int, val value: Int, val stages: Int, val plant
|
|||
CADANTINE_SEED(5301,82,4,106.5,120.0,0.0,67,PatchType.HERB,Items.GRIMY_CADANTINE_215),
|
||||
LANTADYME_SEED(5302,89,4,134.5,151.5,0.0,73,PatchType.HERB,Items.GRIMY_LANTADYME_2485),
|
||||
DWARF_WEED_SEED(5303,96,4,170.5,192.0,0.0,79,PatchType.HERB,Items.GRIMY_DWARF_WEED_217),
|
||||
TORSTOL_SEED(5304,103,4,199.5,224.5,0.0,85,PatchType.HERB,Items.GRIMY_TORSTOL_219)
|
||||
TORSTOL_SEED(5304,103,4,199.5,224.5,0.0,85,PatchType.HERB,Items.GRIMY_TORSTOL_219),
|
||||
|
||||
//Other
|
||||
BELLADONNA_SEED(5281, 4, 4, 91.0, 128.0, 0.0, 63, PatchType.BELLADONNA, Items.CAVE_NIGHTSHADE_2398)
|
||||
;
|
||||
|
||||
constructor(itemID: Int, value: Int, stages: Int, plantingXP: Double, harvestXP: Double, checkHealthXP: Double, requiredLevel: Int, applicablePatch: PatchType, harvestItem: Int, protectionFlower: Plantable)
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ class FarmingState(player: Player? = null) : State(player) {
|
|||
}
|
||||
}
|
||||
|
||||
if((savedState - (patch?.plantable?.value ?: 0)) > patch.plantable?.value ?: 0 + patch.currentGrowthStage){
|
||||
if((savedState - (patch?.plantable?.value ?: 0)) > patch.currentGrowthStage){
|
||||
patch.setCurrentState(savedState)
|
||||
} else {
|
||||
patch.setCurrentState((patch.plantable?.value ?: 0) + patch.currentGrowthStage)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue