forked from 2009Scape/Server
Fixed an exploit related to farming
This commit is contained in:
parent
f48e853b15
commit
1347c70a71
2 changed files with 15 additions and 2 deletions
|
|
@ -16,6 +16,8 @@ import org.rs09.consts.Items
|
|||
@Initializable
|
||||
class CropHarvester : OptionHandler() {
|
||||
|
||||
val nonLives = arrayOf(PatchType.HERB, PatchType.CACTUS, PatchType.BELLADONNA, PatchType.HOPS, PatchType.ALLOTMENT,PatchType.EVIL_TURNIP)
|
||||
|
||||
val spadeAnim = Animation(830)
|
||||
|
||||
override fun newInstance(arg: Any?): Plugin<Any> {
|
||||
|
|
@ -67,8 +69,15 @@ class CropHarvester : OptionHandler() {
|
|||
delay = 2
|
||||
player.inventory.add(Item(plantable.harvestItem,1))
|
||||
player.skills.addExperience(Skills.FARMING,plantable.harvestXP)
|
||||
patch.rollLivesDecrement(ContentAPI.getDynLevel(player, Skills.FARMING), requiredItem == Items.MAGIC_SECATEURS_7409)
|
||||
return patch.cropLives <= 0
|
||||
if(patch.patch.type in nonLives){
|
||||
patch.harvestAmt--
|
||||
} else {
|
||||
patch.rollLivesDecrement(
|
||||
ContentAPI.getDynLevel(player, Skills.FARMING),
|
||||
requiredItem == Items.MAGIC_SECATEURS_7409
|
||||
)
|
||||
}
|
||||
return patch.cropLives <= 0 || patch.harvestAmt <= 0
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@ class Patch(val player: Player, val patch: FarmingPatch, var plantable: Plantabl
|
|||
var cropLives = 3
|
||||
|
||||
fun setNewHarvestAmount() {
|
||||
harvestAmt = when (plantable) {
|
||||
Plantable.LIMPWURT_SEED, Plantable.WOAD_SEED -> 3
|
||||
else -> 1
|
||||
}
|
||||
cropLives = 3
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue