Merge branch 'farming-fixes' into 'master'
Farming fixes: See merge request 2009scape/2009scape!268
This commit is contained in:
@@ -65,9 +65,11 @@ enum class FarmingPatch(val varpIndex: Int, val varpOffset: Int, val type: Patch
|
|||||||
|
|
||||||
//Other
|
//Other
|
||||||
DRAYNOR_BELLADONNA(512, 16, PatchType.BELLADONNA),
|
DRAYNOR_BELLADONNA(512, 16, PatchType.BELLADONNA),
|
||||||
|
CANIFIS_MUSHROOM(512, 8, PatchType.MUSHROOM),
|
||||||
ALKHARID_CACTUS(512, 0, PatchType.CACTUS),
|
ALKHARID_CACTUS(512, 0, PatchType.CACTUS),
|
||||||
EVIL_TURNIP(1171, 7, PatchType.EVIL_TURNIP);
|
EVIL_TURNIP(1171, 7, PatchType.EVIL_TURNIP);
|
||||||
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@JvmField
|
@JvmField
|
||||||
val patches = FarmingPatch.values().map { (it.varpIndex shl it.varpOffset) to it }.toMap()
|
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
|
} else
|
||||||
state.getPatch(this)
|
state.getPatch(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package rs09.game.node.entity.skill.farming
|
|||||||
|
|
||||||
import core.game.node.entity.player.Player
|
import core.game.node.entity.player.Player
|
||||||
import core.tools.RandomFunction
|
import core.tools.RandomFunction
|
||||||
|
import org.rs09.consts.Items
|
||||||
import rs09.game.system.SystemLogger
|
import rs09.game.system.SystemLogger
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import kotlin.math.ceil
|
import kotlin.math.ceil
|
||||||
@@ -16,11 +17,16 @@ class Patch(val player: Player, val patch: FarmingPatch, var plantable: Plantabl
|
|||||||
var cropLives = 3
|
var cropLives = 3
|
||||||
|
|
||||||
fun setNewHarvestAmount() {
|
fun setNewHarvestAmount() {
|
||||||
|
val compostMod = if(compost == CompostType.SUPER) 2 else 1
|
||||||
harvestAmt = when (plantable) {
|
harvestAmt = when (plantable) {
|
||||||
Plantable.LIMPWURT_SEED, Plantable.WOAD_SEED -> 3
|
Plantable.LIMPWURT_SEED, Plantable.WOAD_SEED -> 3
|
||||||
|
Plantable.MUSHROOM_SPORE -> 6
|
||||||
else -> 1
|
else -> 1
|
||||||
}
|
}
|
||||||
cropLives = 3
|
if(plantable != null && plantable?.applicablePatch != PatchType.FLOWER) {
|
||||||
|
harvestAmt += compostMod
|
||||||
|
}
|
||||||
|
cropLives = 3 + compostMod
|
||||||
}
|
}
|
||||||
|
|
||||||
fun rollLivesDecrement(farmingLevel: Int, magicSecateurs: Boolean){
|
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.ARDOUGNE_ALLOTMENT_S,FarmingPatch.ARDOUGNE_ALLOTMENT_N -> FarmingPatch.ARDOUGNE_FLOWER_C
|
||||||
FarmingPatch.CATHERBY_ALLOTMENT_S,FarmingPatch.CATHERBY_ALLOTMENT_N -> FarmingPatch.CATHERBY_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.PORT_PHAS_ALLOTMENT_SE,FarmingPatch.PORT_PHAS_ALLOTMENT_NW -> FarmingPatch.PORT_PHAS_FLOWER_C
|
||||||
|
FarmingPatch.TROLL_STRONGHOLD_HERB -> return true
|
||||||
else -> return false
|
else -> return false
|
||||||
}.getPatchFor(player)
|
}.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())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ enum class PatchType(val stageGrowthTime: Int) {
|
|||||||
FLOWER(5),
|
FLOWER(5),
|
||||||
HERB(20),
|
HERB(20),
|
||||||
SPIRIT_TREE(293),
|
SPIRIT_TREE(293),
|
||||||
|
MUSHROOM(30),
|
||||||
BELLADONNA(80),
|
BELLADONNA(80),
|
||||||
CACTUS(60),
|
CACTUS(60),
|
||||||
EVIL_TURNIP(5)
|
EVIL_TURNIP(5)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ enum class Plantable(val itemID: Int, val value: Int, val stages: Int, val plant
|
|||||||
|
|
||||||
//Other
|
//Other
|
||||||
BELLADONNA_SEED(5281, 4, 4, 91.0, 128.0, 0.0, 63, PatchType.BELLADONNA, Items.CAVE_NIGHTSHADE_2398),
|
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),
|
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)
|
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)
|
return forItemID(item.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ object UseWithPatchHandler{
|
|||||||
if(player.inventory.remove(event.usedItem,false)){
|
if(player.inventory.remove(event.usedItem,false)){
|
||||||
p.compost = if(usedItem.id == Items.SUPERCOMPOST_6034) CompostType.SUPER else CompostType.NORMAL
|
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.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.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
|
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
|
if(this == Items.WATERING_CAN1_5333) return Items.WATERING_CAN_5331
|
||||||
else return this - 1
|
else return this - 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user