From c2a6aafed886c5854ae9ace35eb3cf0048b9e8df Mon Sep 17 00:00:00 2001 From: Avi Weinstock Date: Wed, 22 Sep 2021 18:19:48 -0400 Subject: [PATCH] Farming fixes: - Compost and supercompost now properly affect minimum herb yield. - Troll stronghold herb patch is now disease-free. - Mushroom patch west of Canifis now allows growing bittercap mushrooms. - White lillies now grant protection to allotments. --- .../node/entity/skill/farming/FarmingPatch.kt | 4 +++- .../rs09/game/node/entity/skill/farming/Patch.kt | 15 ++++++++++++--- .../game/node/entity/skill/farming/PatchType.kt | 3 ++- .../game/node/entity/skill/farming/Plantable.kt | 3 ++- .../entity/skill/farming/UseWithPatchHandler.kt | 4 ++-- 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/FarmingPatch.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/FarmingPatch.kt index 74bcb6c47..35844271a 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/FarmingPatch.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/FarmingPatch.kt @@ -65,9 +65,11 @@ enum class FarmingPatch(val varpIndex: Int, val varpOffset: Int, val type: Patch //Other DRAYNOR_BELLADONNA(512, 16, PatchType.BELLADONNA), + CANIFIS_MUSHROOM(512, 8, PatchType.MUSHROOM), ALKHARID_CACTUS(512, 0, PatchType.CACTUS), EVIL_TURNIP(1171, 7, PatchType.EVIL_TURNIP); + companion object { @JvmField val patches = FarmingPatch.values().map { (it.varpIndex shl it.varpOffset) to it }.toMap() @@ -93,4 +95,4 @@ enum class FarmingPatch(val varpIndex: Int, val varpOffset: Int, val type: Patch } else state.getPatch(this) } -} \ No newline at end of file +} diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/Patch.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/Patch.kt index 070e38617..a213820b9 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/Patch.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/Patch.kt @@ -2,6 +2,7 @@ package rs09.game.node.entity.skill.farming import core.game.node.entity.player.Player import core.tools.RandomFunction +import org.rs09.consts.Items import rs09.game.system.SystemLogger import java.util.concurrent.TimeUnit import kotlin.math.ceil @@ -16,11 +17,16 @@ class Patch(val player: Player, val patch: FarmingPatch, var plantable: Plantabl var cropLives = 3 fun setNewHarvestAmount() { + val compostMod = if(compost == CompostType.SUPER) 2 else 1 harvestAmt = when (plantable) { Plantable.LIMPWURT_SEED, Plantable.WOAD_SEED -> 3 + Plantable.MUSHROOM_SPORE -> 6 else -> 1 } - cropLives = 3 + if(plantable != null && plantable?.applicablePatch != PatchType.FLOWER) { + harvestAmt += compostMod + } + cropLives = 3 + compostMod } fun rollLivesDecrement(farmingLevel: Int, magicSecateurs: Boolean){ @@ -290,9 +296,12 @@ class Patch(val player: Player, val patch: FarmingPatch, var plantable: Plantabl FarmingPatch.ARDOUGNE_ALLOTMENT_S,FarmingPatch.ARDOUGNE_ALLOTMENT_N -> FarmingPatch.ARDOUGNE_FLOWER_C FarmingPatch.CATHERBY_ALLOTMENT_S,FarmingPatch.CATHERBY_ALLOTMENT_N -> FarmingPatch.CATHERBY_FLOWER_C FarmingPatch.PORT_PHAS_ALLOTMENT_SE,FarmingPatch.PORT_PHAS_ALLOTMENT_NW -> FarmingPatch.PORT_PHAS_FLOWER_C + FarmingPatch.TROLL_STRONGHOLD_HERB -> return true else -> return false }.getPatchFor(player) - return (fpatch.plantable != null && fpatch.plantable == plantable?.protectionFlower && fpatch.isGrown()) + return (fpatch.plantable != null && + (fpatch.plantable == plantable?.protectionFlower || fpatch.plantable == Plantable.forItemID(Items.WHITE_LILY_SEED_14589)) + && fpatch.isGrown()) } -} \ No newline at end of file +} diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/PatchType.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/PatchType.kt index 7de600039..753de795e 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/PatchType.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/PatchType.kt @@ -9,7 +9,8 @@ enum class PatchType(val stageGrowthTime: Int) { FLOWER(5), HERB(20), SPIRIT_TREE(293), + MUSHROOM(30), BELLADONNA(80), CACTUS(60), EVIL_TURNIP(5) -} \ No newline at end of file +} diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/Plantable.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/Plantable.kt index 8921590d3..4aa16095b 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/Plantable.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/Plantable.kt @@ -78,6 +78,7 @@ enum class Plantable(val itemID: Int, val value: Int, val stages: Int, val plant //Other BELLADONNA_SEED(5281, 4, 4, 91.0, 128.0, 0.0, 63, PatchType.BELLADONNA, Items.CAVE_NIGHTSHADE_2398), + MUSHROOM_SPORE(Items.MUSHROOM_SPORE_5282, 6, 7, 61.5, 57.7, 0.0, 53, PatchType.MUSHROOM, Items.MUSHROOM_6004), CACTUS_SEED(Items.CACTUS_SEED_5280, 8, 7, 66.5, 25.0, 374.0, 55, PatchType.CACTUS, Items.CACTUS_SPINE_6016), EVIL_TURNIP_SEED(Items.EVIL_TURNIP_SEED_12148, 4, 1, 41.0, 46.0, 0.0, 42, PatchType.EVIL_TURNIP, Items.EVIL_TURNIP_12134) ; @@ -98,4 +99,4 @@ enum class Plantable(val itemID: Int, val value: Int, val stages: Int, val plant return forItemID(item.id) } } -} \ No newline at end of file +} diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/UseWithPatchHandler.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/UseWithPatchHandler.kt index 22d160a93..ae45353ca 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/UseWithPatchHandler.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/UseWithPatchHandler.kt @@ -125,7 +125,7 @@ object UseWithPatchHandler{ if(player.inventory.remove(event.usedItem,false)){ p.compost = if(usedItem.id == Items.SUPERCOMPOST_6034) CompostType.SUPER else CompostType.NORMAL if(p.compost == CompostType.SUPER) ContentAPI.rewardXP(player, Skills.FARMING, 26.0) else ContentAPI.rewardXP(player, Skills.FARMING, 18.5) - if(p.plantable != null){ + if(p.plantable != null && p.plantable?.applicablePatch != PatchType.FLOWER) { p.harvestAmt += if(p.compost == CompostType.NORMAL) 1 else if(p.compost == CompostType.SUPER) 2 else 0 } p.cropLives += if(p.compost == CompostType.SUPER) 2 else 1 @@ -212,4 +212,4 @@ object UseWithPatchHandler{ if(this == Items.WATERING_CAN1_5333) return Items.WATERING_CAN_5331 else return this - 1 } -} \ No newline at end of file +}