Fixed tree spirit random event not spawning for some players

This commit is contained in:
Coaltong
2022-06-23 23:17:29 +00:00
committed by Ryan
parent 385a04a5b9
commit 01c8072e9b
@@ -12,6 +12,7 @@ import org.rs09.consts.Items
import rs09.game.content.ame.RandomEventNPC
import rs09.game.content.global.WeightBasedTable
import rs09.game.content.global.WeightedItem
import kotlin.math.max
val ids = 438..443
@@ -20,7 +21,7 @@ class TreeSpiritRENPC(override var loot: WeightBasedTable? = null) : RandomEvent
override fun talkTo(npc: NPC) {}
override fun init() {
super.init()
val index = (player.properties.combatLevel / 20) - 1
val index = max(0,(player.properties.combatLevel / 20) - 1)
val id = ids.toList()[index]
this.transform(id)
this.attack(player)