a100affda2
Unified kotlin and java into just src/main Unified the rs09 and core packages Took all content out of the core package, and placed it into the new content package Reorganised all source code relating to content to be easier to find and explore
67 lines
2.2 KiB
Kotlin
67 lines
2.2 KiB
Kotlin
package content.global.bots
|
|
|
|
import core.game.interaction.DestinationFlag
|
|
import core.game.interaction.MovementPulse
|
|
import core.game.node.item.Item
|
|
import core.game.world.map.Location
|
|
import core.game.world.map.zone.ZoneBorders
|
|
import org.rs09.consts.Items
|
|
import core.game.bots.SkillingBotAssembler
|
|
import core.game.bots.Script
|
|
|
|
class DraynorFisher : Script() {
|
|
val fishingZone = ZoneBorders(3085, 3223,3089, 3233)
|
|
val bankZone = ZoneBorders(3092, 3240,3094, 3246)
|
|
|
|
|
|
var state = State.FISHING
|
|
override fun tick() {
|
|
when(state){
|
|
State.FISHING -> {
|
|
if(!fishingZone.insideBorder(bot))
|
|
scriptAPI.walkTo(fishingZone.randomLoc)
|
|
else {
|
|
val spot = scriptAPI.getNearestNode(316,false)
|
|
spot?.interaction?.handle(bot,spot.interaction[0]) ?: scriptAPI.walkTo(fishingZone.randomLoc)
|
|
if(bot.inventory.getMaximumAdd(Item(4151)) < 5)
|
|
state = State.BANKING
|
|
}
|
|
}
|
|
|
|
State.BANKING -> {
|
|
if(!bankZone.insideBorder(bot))
|
|
scriptAPI.walkTo(bankZone.randomLoc)
|
|
else {
|
|
val bank = scriptAPI.getNearestNode("Bank booth")
|
|
if (bank != null){
|
|
bot.pulseManager.run(object : MovementPulse(bot,bank, DestinationFlag.OBJECT){
|
|
override fun pulse(): Boolean {
|
|
bot.inventory.clear()
|
|
state = State.FISHING
|
|
bot.inventory.add(Item(Items.SMALL_FISHING_NET_303))
|
|
return true
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
override fun newInstance(): Script {
|
|
val script = DraynorFisher()
|
|
script.bot = SkillingBotAssembler().produce(SkillingBotAssembler.Wealth.POOR, Location.create(3094, 3242, 0))
|
|
return script
|
|
}
|
|
|
|
init {
|
|
inventory.add(Item(Items.SMALL_FISHING_NET_303))
|
|
}
|
|
|
|
enum class State {
|
|
FISHING,
|
|
BANKING
|
|
}
|
|
} |