Remove player bot scripts
This commit is contained in:
@@ -1,78 +0,0 @@
|
|||||||
package rs09.game.ai.general.scriptrepository
|
|
||||||
|
|
||||||
import core.game.world.map.Location
|
|
||||||
import org.rs09.consts.Items
|
|
||||||
import rs09.game.ai.general.ScriptAPI
|
|
||||||
|
|
||||||
@PlayerCompatible
|
|
||||||
@ScriptName("Chicken Killer")
|
|
||||||
@ScriptDescription("Kills chickens and loots feathers. Start in any chicken area.")
|
|
||||||
@ScriptIdentifier("chicken_killer")
|
|
||||||
class ChickenKiller : Script(){
|
|
||||||
var state = State.INIT
|
|
||||||
var chickenCounter = 0
|
|
||||||
var overlay: ScriptAPI.BottingOverlay?= null
|
|
||||||
var startLocation = Location(0,0,0)
|
|
||||||
var timer = 3
|
|
||||||
var lootFeathers = false
|
|
||||||
|
|
||||||
override fun tick() {
|
|
||||||
when(state){
|
|
||||||
|
|
||||||
State.INIT -> {
|
|
||||||
overlay = scriptAPI.getOverlay()
|
|
||||||
overlay!!.init()
|
|
||||||
overlay!!.setTitle("Chickens")
|
|
||||||
overlay!!.setTaskLabel("Chickens KO'd:")
|
|
||||||
overlay!!.setAmount(0)
|
|
||||||
state = State.CONFIG
|
|
||||||
bot.dialogueInterpreter.sendOptions("Loot Feathers?","Yes","No")
|
|
||||||
bot.dialogueInterpreter.addAction{player,button ->
|
|
||||||
lootFeathers = button == 2
|
|
||||||
state = State.KILLING
|
|
||||||
}
|
|
||||||
startLocation = bot.location
|
|
||||||
}
|
|
||||||
|
|
||||||
State.KILLING -> {
|
|
||||||
val chicken = scriptAPI.getNearestNode("Chicken")
|
|
||||||
if(chicken == null){
|
|
||||||
scriptAPI.randomWalkTo(startLocation,3)
|
|
||||||
} else {
|
|
||||||
scriptAPI.attackNpcInRadius(bot,"Chicken",10)
|
|
||||||
if(lootFeathers) {
|
|
||||||
state = State.IDLE
|
|
||||||
timer = 4
|
|
||||||
}
|
|
||||||
chickenCounter++
|
|
||||||
overlay!!.setAmount(chickenCounter)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
State.IDLE -> {
|
|
||||||
if(timer-- <= 0){
|
|
||||||
state = State.LOOTING
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
State.LOOTING -> {
|
|
||||||
scriptAPI.takeNearestGroundItem(Items.FEATHER_314)
|
|
||||||
state = State.KILLING
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun newInstance(): Script {
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
enum class State {
|
|
||||||
IDLE,
|
|
||||||
INIT,
|
|
||||||
KILLING,
|
|
||||||
LOOTING,
|
|
||||||
RETURN,
|
|
||||||
CONFIG
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,160 +0,0 @@
|
|||||||
package rs09.game.ai.general.scriptrepository
|
|
||||||
|
|
||||||
import core.game.interaction.DestinationFlag
|
|
||||||
import core.game.interaction.MovementPulse
|
|
||||||
import core.game.node.Node
|
|
||||||
import core.game.node.entity.skill.Skills
|
|
||||||
import core.game.node.item.Item
|
|
||||||
import core.game.world.map.zone.ZoneBorders
|
|
||||||
import org.rs09.consts.Items
|
|
||||||
import rs09.game.ai.general.ScriptAPI
|
|
||||||
import rs09.game.ai.skillingbot.SkillingBotAssembler
|
|
||||||
import rs09.game.interaction.InteractionListener
|
|
||||||
import rs09.game.interaction.InteractionListeners
|
|
||||||
|
|
||||||
@PlayerCompatible
|
|
||||||
@ScriptName("Falador Coal Miner")
|
|
||||||
@ScriptDescription("Start in Falador East Bank with a pick equipped","or in your inventory.")
|
|
||||||
@ScriptIdentifier("fally_coal")
|
|
||||||
class CoalMiner() : Script() {
|
|
||||||
var state = State.INIT
|
|
||||||
var ladderSwitch = false
|
|
||||||
|
|
||||||
val bottomLadder = ZoneBorders(3016,9736,3024,9742)
|
|
||||||
val topLadder = ZoneBorders(3016,3336,3022,3342)
|
|
||||||
val mine = ZoneBorders(3027,9733,3054,9743)
|
|
||||||
val bank = ZoneBorders(3009,3355,3018,3358)
|
|
||||||
var overlay: ScriptAPI.BottingOverlay? = null
|
|
||||||
var coalAmount = 0
|
|
||||||
|
|
||||||
override fun tick() {
|
|
||||||
when(state){
|
|
||||||
|
|
||||||
State.INIT -> {
|
|
||||||
overlay = scriptAPI.getOverlay()
|
|
||||||
ladderSwitch = true
|
|
||||||
overlay!!.init()
|
|
||||||
overlay!!.setTitle("Mining")
|
|
||||||
overlay!!.setTaskLabel("Coal Mined:")
|
|
||||||
overlay!!.setAmount(0)
|
|
||||||
|
|
||||||
if (mine.insideBorder(bot)){
|
|
||||||
ladderSwitch = false
|
|
||||||
state = State.MINING
|
|
||||||
} else {
|
|
||||||
state = State.TO_MINE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
State.MINING -> {
|
|
||||||
if(bot.inventory.freeSlots() == 0){
|
|
||||||
state = State.TO_BANK
|
|
||||||
}
|
|
||||||
if(!mine.insideBorder(bot)){
|
|
||||||
scriptAPI.walkTo(mine.randomLoc)
|
|
||||||
} else {
|
|
||||||
val rock = scriptAPI.getNearestNode("rocks",true)
|
|
||||||
rock?.let { InteractionListeners.run(rock.id, InteractionListener.OBJECT,"mine",bot,rock) }
|
|
||||||
}
|
|
||||||
overlay!!.setAmount(bot.inventory.getAmount(Items.COAL_453) + coalAmount)
|
|
||||||
}
|
|
||||||
|
|
||||||
State.TO_BANK -> {
|
|
||||||
if(bank.insideBorder(bot)){
|
|
||||||
val bank = scriptAPI.getNearestNode("bank booth",true)
|
|
||||||
if(bank != null) {
|
|
||||||
bot.pulseManager.run(object : BankingPulse(this, bank){
|
|
||||||
override fun pulse(): Boolean {
|
|
||||||
state = State.BANKING
|
|
||||||
return super.pulse()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if(!ladderSwitch) {
|
|
||||||
val ladder = scriptAPI.getNearestNode(30941, true)
|
|
||||||
ladder ?: scriptAPI.walkTo(bottomLadder.randomLoc).also { return }
|
|
||||||
ladder?.interaction?.handle(bot, ladder.interaction[0]).also { ladderSwitch = true }
|
|
||||||
} else {
|
|
||||||
if (!bank.insideBorder(bot)) scriptAPI.walkTo(bank.randomLoc).also { return }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
State.BANKING -> {
|
|
||||||
coalAmount += bot.inventory.getAmount(Items.COAL_453)
|
|
||||||
scriptAPI.bankItem(Items.COAL_453)
|
|
||||||
state = State.TO_MINE
|
|
||||||
}
|
|
||||||
|
|
||||||
State.TO_MINE -> {
|
|
||||||
if(ladderSwitch){
|
|
||||||
if(!topLadder.insideBorder(bot.location)){
|
|
||||||
scriptAPI.walkTo(topLadder.randomLoc)
|
|
||||||
} else {
|
|
||||||
val ladder = scriptAPI.getNearestNode("Ladder",true)
|
|
||||||
if(ladder != null){
|
|
||||||
ladder.interaction.handle(bot,ladder.interaction[0])
|
|
||||||
ladderSwitch = false
|
|
||||||
} else {
|
|
||||||
scriptAPI.walkTo(topLadder.randomLoc)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(!mine.insideBorder(bot)){
|
|
||||||
scriptAPI.walkTo(mine.randomLoc)
|
|
||||||
} else {
|
|
||||||
state = State.MINING
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
State.TO_GE -> {
|
|
||||||
scriptAPI.teleportToGE()
|
|
||||||
state = State.SELLING
|
|
||||||
}
|
|
||||||
|
|
||||||
State.SELLING -> {
|
|
||||||
scriptAPI.sellOnGE(Items.COAL_453)
|
|
||||||
state = State.GO_BACK
|
|
||||||
}
|
|
||||||
|
|
||||||
State.GO_BACK -> {
|
|
||||||
scriptAPI.teleport(bank.randomLoc)
|
|
||||||
state = State.TO_MINE
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
open class BankingPulse(val script: Script, val bank: Node) : MovementPulse(script.bot,bank, DestinationFlag.OBJECT){
|
|
||||||
override fun pulse(): Boolean {
|
|
||||||
script.bot.faceLocation(bank.location)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun newInstance(): Script {
|
|
||||||
val script = CoalMiner()
|
|
||||||
script.bot = SkillingBotAssembler().produce(SkillingBotAssembler.Wealth.POOR,bot.startLocation)
|
|
||||||
return script
|
|
||||||
}
|
|
||||||
|
|
||||||
enum class State {
|
|
||||||
MINING,
|
|
||||||
TO_MINE,
|
|
||||||
TO_BANK,
|
|
||||||
BANKING,
|
|
||||||
TO_GE,
|
|
||||||
SELLING,
|
|
||||||
GO_BACK,
|
|
||||||
INIT
|
|
||||||
}
|
|
||||||
|
|
||||||
init {
|
|
||||||
equipment.add(Item(Items.IRON_PICKAXE_1267))
|
|
||||||
skills.put(Skills.MINING,75)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
package rs09.game.ai.general.scriptrepository
|
|
||||||
|
|
||||||
import core.game.component.Component
|
|
||||||
import core.game.interaction.DestinationFlag
|
|
||||||
import core.game.interaction.MovementPulse
|
|
||||||
import core.game.node.entity.skill.Skills
|
|
||||||
import core.game.node.item.Item
|
|
||||||
import core.game.world.map.zone.ZoneBorders
|
|
||||||
import org.rs09.consts.Items
|
|
||||||
import rs09.game.interaction.InteractionListener
|
|
||||||
import rs09.game.interaction.InteractionListeners
|
|
||||||
import rs09.tools.stringtools.colorize
|
|
||||||
|
|
||||||
@PlayerCompatible
|
|
||||||
@ScriptName("Draynor Willows")
|
|
||||||
@ScriptDescription("Start in Draynor with an axe equipped or in inventory.")
|
|
||||||
@ScriptIdentifier("draynor_trees")
|
|
||||||
class DraynorWillows : Script(){
|
|
||||||
val willowZone = ZoneBorders(3084, 3225,3091, 3239)
|
|
||||||
|
|
||||||
|
|
||||||
val bankZone = ZoneBorders(3092, 3240,3094, 3246)
|
|
||||||
var state = State.INIT
|
|
||||||
var logCount = 0
|
|
||||||
|
|
||||||
override fun tick() {
|
|
||||||
when(state){
|
|
||||||
State.INIT -> {
|
|
||||||
if(true){
|
|
||||||
bot.interfaceManager.openOverlay(Component(195))
|
|
||||||
bot.packetDispatch.sendString("Woodcutting",195,7)
|
|
||||||
bot.packetDispatch.sendString(colorize("%BLogs Chopped:"),195,8)
|
|
||||||
bot.packetDispatch.sendString(colorize("%B0"),195,9)
|
|
||||||
bot.packetDispatch.sendInterfaceConfig(195,5,true)
|
|
||||||
}
|
|
||||||
state = State.CHOPPING
|
|
||||||
}
|
|
||||||
|
|
||||||
State.CHOPPING -> {
|
|
||||||
if (!willowZone.insideBorder(bot))
|
|
||||||
scriptAPI.walkTo(willowZone.randomLoc)
|
|
||||||
else {
|
|
||||||
val willowtree = scriptAPI.getNearestNode("willow", true)
|
|
||||||
willowtree?.let { InteractionListeners.run(willowtree.id,
|
|
||||||
InteractionListener.OBJECT,"chop",bot,willowtree) }
|
|
||||||
if (bot.inventory.isFull)
|
|
||||||
state = State.BANKING
|
|
||||||
}
|
|
||||||
|
|
||||||
bot.packetDispatch.sendString(colorize("%B${logCount + bot.inventory.getAmount(Items.WILLOW_LOGS_1519)}"), 195, 9)
|
|
||||||
}
|
|
||||||
|
|
||||||
State.BANKING -> {
|
|
||||||
if(!bankZone.insideBorder(bot))
|
|
||||||
scriptAPI.walkTo(bankZone.randomLoc)
|
|
||||||
else{
|
|
||||||
val bank = scriptAPI.getNearestNode("Bank Booth",true)
|
|
||||||
if(bank != null){
|
|
||||||
bot.pulseManager.run(object : MovementPulse(bot,bank, DestinationFlag.OBJECT){
|
|
||||||
override fun pulse(): Boolean {
|
|
||||||
val logs = bot.inventory.getAmount(Item(Items.WILLOW_LOGS_1519))
|
|
||||||
logCount += logs
|
|
||||||
bot.inventory.remove(Item(Items.WILLOW_LOGS_1519,logs))
|
|
||||||
bot.bank.add(Item(Items.WILLOW_LOGS_1519,logs))
|
|
||||||
state = State.CHOPPING
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
init {
|
|
||||||
inventory.add(Item(Items.ADAMANT_AXE_1357))
|
|
||||||
skills[Skills.WOODCUTTING] = 35
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun newInstance(): Script {
|
|
||||||
val script = DraynorWillows()
|
|
||||||
return script
|
|
||||||
}
|
|
||||||
|
|
||||||
enum class State {
|
|
||||||
CHOPPING,
|
|
||||||
BANKING,
|
|
||||||
INIT
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,197 +0,0 @@
|
|||||||
package rs09.game.ai.general.scriptrepository
|
|
||||||
|
|
||||||
import core.game.interaction.DestinationFlag
|
|
||||||
import core.game.interaction.MovementPulse
|
|
||||||
import core.game.node.entity.skill.Skills
|
|
||||||
import core.game.node.item.Item
|
|
||||||
import core.game.system.task.Pulse
|
|
||||||
import core.game.world.map.Location
|
|
||||||
import core.game.world.map.path.Pathfinder
|
|
||||||
import core.game.world.update.flag.context.Animation
|
|
||||||
import core.game.world.update.flag.context.Graphics
|
|
||||||
import core.tools.RandomFunction
|
|
||||||
import org.rs09.consts.Items
|
|
||||||
import rs09.game.ai.AIPlayer
|
|
||||||
import rs09.game.ai.general.ScriptAPI
|
|
||||||
import rs09.game.interaction.InteractionListener
|
|
||||||
import rs09.game.interaction.InteractionListeners
|
|
||||||
import rs09.game.world.GameWorld
|
|
||||||
import kotlin.random.Random
|
|
||||||
|
|
||||||
@PlayerCompatible
|
|
||||||
@ScriptName("Catherby Lobs")
|
|
||||||
@ScriptDescription("Start in Catherby bank with a lobster pot in your inventory.")
|
|
||||||
@ScriptIdentifier("cath_lobs")
|
|
||||||
class LobsterCatcher : Script() {
|
|
||||||
private val ANIMATION = Animation(714)
|
|
||||||
val offers = HashMap<Int, Int>()
|
|
||||||
val limit = 2000
|
|
||||||
var myCounter = 0
|
|
||||||
/**
|
|
||||||
* Represents the graphics to use.
|
|
||||||
*/
|
|
||||||
private val GRAPHICS = Graphics(308, 100, 50)
|
|
||||||
internal enum class Sets(val equipment: List<Item>) {
|
|
||||||
SET_1(listOf(Item(2643), Item(9470), Item(10756), Item(10394), Item(88), Item(9793))),
|
|
||||||
SET_2(listOf(Item(2643), Item(6585), Item(10750), Item(10394), Item(88), Item(9793))),
|
|
||||||
SET_3(listOf(Item(9472), Item(9470), Item(10750), Item(10394), Item(88), Item(9786))),
|
|
||||||
SET_4(listOf(Item(2639), Item(6585), Item(10752), Item(10394), Item(88), Item(9786))),
|
|
||||||
SET_5(listOf(Item(2639), Item(9470), Item(10750), Item(10394), Item(88), Item(9784))),
|
|
||||||
SET_6(listOf(Item(2639), Item(6585), Item(10750), Item(10394), Item(88), Item(9784)));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private var bots = 0
|
|
||||||
private var lobstopper = false
|
|
||||||
var overlay: ScriptAPI.BottingOverlay?= null
|
|
||||||
var fishCounter = 0
|
|
||||||
|
|
||||||
private var state = State.INIT
|
|
||||||
private var tick = 0
|
|
||||||
override fun tick() {
|
|
||||||
when(state){
|
|
||||||
|
|
||||||
State.INIT -> {
|
|
||||||
overlay = scriptAPI.getOverlay()
|
|
||||||
overlay!!.init()
|
|
||||||
overlay!!.setTitle("Fishing")
|
|
||||||
overlay!!.setTaskLabel("Lobs Caught:")
|
|
||||||
overlay!!.setAmount(0)
|
|
||||||
state = State.FIND_SPOT
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
State.BANKING -> {
|
|
||||||
fishCounter += bot.inventory.getAmount(Items.RAW_LOBSTER_377)
|
|
||||||
scriptAPI.bankItem(Items.RAW_LOBSTER_377)
|
|
||||||
state = State.IDLE
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
State.FISHING -> {
|
|
||||||
val spot = scriptAPI.getNearestNode(333, false)
|
|
||||||
if(spot == null){
|
|
||||||
state = State.IDLE
|
|
||||||
} else {
|
|
||||||
InteractionListeners.run(spot.id,InteractionListener.NPC,"cage",bot,spot)
|
|
||||||
}
|
|
||||||
if(bot.inventory.isFull){
|
|
||||||
state = State.FIND_BANK
|
|
||||||
}
|
|
||||||
overlay!!.setAmount(fishCounter + bot.inventory.getAmount(Items.RAW_LOBSTER_377))
|
|
||||||
}
|
|
||||||
|
|
||||||
State.IDLE -> {
|
|
||||||
if (Random.nextBoolean()){
|
|
||||||
state = State.FIND_SPOT
|
|
||||||
}
|
|
||||||
else if(myCounter++ >= RandomFunction.random(1,25)){
|
|
||||||
state = State.FIND_SPOT
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
State.FIND_SPOT -> {
|
|
||||||
val spot = scriptAPI.getNearestNode(333, false)
|
|
||||||
if (spot != null) {
|
|
||||||
bot.walkingQueue.reset()
|
|
||||||
state = State.FISHING
|
|
||||||
} else {
|
|
||||||
if (bot.location.x < 2837) {
|
|
||||||
Pathfinder.find(bot, Location.create(2837, 3435, 0)).walk(bot)
|
|
||||||
} else {
|
|
||||||
Pathfinder.find(bot, Location.create(2854, 3427, 0)).walk(bot)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
State.FIND_BANK -> {
|
|
||||||
val bank = scriptAPI.getNearestGameObject(bot.location, 2213)
|
|
||||||
class BankingPulse : MovementPulse(bot, bank, DestinationFlag.OBJECT) {
|
|
||||||
override fun pulse(): Boolean {
|
|
||||||
bot.faceLocation(bank!!.location)
|
|
||||||
state = State.BANKING
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(bank != null){
|
|
||||||
bot.pulseManager.run(BankingPulse())
|
|
||||||
} else {
|
|
||||||
if (bot.location.x > 2837) {
|
|
||||||
Pathfinder.find(bot, Location.create(2837, 3435, 0)).walk(bot)
|
|
||||||
} else if (bot.location.x > 2821) {
|
|
||||||
Pathfinder.find(bot, Location.create(2821, 3435, 0)).walk(bot)
|
|
||||||
} else if (bot.location.x > 2809){
|
|
||||||
Pathfinder.find(bot,Location.create(2809, 3436, 0)).walk(bot)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
State.TELEPORT_GE -> {
|
|
||||||
scriptAPI.teleportToGE()
|
|
||||||
state = State.SELL_GE
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
State.SELL_GE -> {
|
|
||||||
scriptAPI.sellOnGE(Items.RAW_LOBSTER_377)
|
|
||||||
state = State.TELE_CATH
|
|
||||||
}
|
|
||||||
|
|
||||||
State.TELE_CATH -> {
|
|
||||||
if(tick++ == 10) {
|
|
||||||
bot.lock()
|
|
||||||
bot.visualize(ANIMATION, GRAPHICS)
|
|
||||||
bot.impactHandler.disabledTicks = 4
|
|
||||||
val location = Location.create(2819, 3437, 0)
|
|
||||||
GameWorld.Pulser.submit(object : Pulse(4, bot) {
|
|
||||||
override fun pulse(): Boolean {
|
|
||||||
bot.unlock()
|
|
||||||
bot.properties.teleportLocation = location
|
|
||||||
bot.animator.reset()
|
|
||||||
state = State.IDLE
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
init {
|
|
||||||
val setUp = RandomFunction.random(Sets.values().size)
|
|
||||||
equipment.addAll(Sets.values()[setUp].equipment)
|
|
||||||
inventory.add(Item(301))
|
|
||||||
skills[Skills.FISHING] = 40
|
|
||||||
}
|
|
||||||
|
|
||||||
enum class State{
|
|
||||||
FISHING,
|
|
||||||
BANKING,
|
|
||||||
FIND_BANK,
|
|
||||||
FIND_SPOT,
|
|
||||||
TELEPORT_GE,
|
|
||||||
SELL_GE,
|
|
||||||
TELE_CATH,
|
|
||||||
IDLE,
|
|
||||||
INIT
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun newInstance(): Script {
|
|
||||||
if (!lobstopper && bots <= 0) {
|
|
||||||
val script = LobsterCatcher()
|
|
||||||
script.bot = AIPlayer(bot.startLocation)
|
|
||||||
script.state = State.FIND_SPOT
|
|
||||||
bots = 1
|
|
||||||
return script
|
|
||||||
}else if (tick++ == 6000 && lobstopper) {
|
|
||||||
tick = 0
|
|
||||||
lobstopper = false
|
|
||||||
}
|
|
||||||
return newInstance()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package rs09.game.ai.general.scriptrepository
|
|
||||||
|
|
||||||
import io.github.classgraph.ClassGraph
|
|
||||||
|
|
||||||
object PlayerScripts {
|
|
||||||
class PlayerScript(val identifier: String, val description: Array<String>, val name: String, val clazz: Class<*>)
|
|
||||||
val identifierMap = HashMap<String,PlayerScript>()
|
|
||||||
|
|
||||||
|
|
||||||
fun init(){
|
|
||||||
val result = ClassGraph().enableAnnotationInfo().acceptPackages("rs09.game.ai.general.scriptrepository").scan()
|
|
||||||
result.getClassesWithAnnotation("rs09.game.ai.general.scriptrepository.PlayerCompatible").forEach { res ->
|
|
||||||
val description = res.getAnnotationInfo("rs09.game.ai.general.scriptrepository.ScriptDescription").parameterValues[0].value as Array<String>
|
|
||||||
val identifier = res.getAnnotationInfo("rs09.game.ai.general.scriptrepository.ScriptIdentifier").parameterValues[0].value.toString()
|
|
||||||
val name = res.getAnnotationInfo("rs09.game.ai.general.scriptrepository.ScriptName").parameterValues[0].value.toString()
|
|
||||||
identifierMap[identifier] = PlayerScript(identifier,description,name,res.loadClass())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
package rs09.game.ai.general.scriptrepository
|
|
||||||
|
|
||||||
import core.game.interaction.DestinationFlag
|
|
||||||
import core.game.interaction.MovementPulse
|
|
||||||
import core.game.node.entity.skill.Skills
|
|
||||||
import core.game.node.item.Item
|
|
||||||
import core.game.world.map.Location
|
|
||||||
import core.game.world.map.zone.ZoneBorders
|
|
||||||
import core.tools.RandomFunction
|
|
||||||
import org.rs09.consts.Items
|
|
||||||
import rs09.game.ai.general.ScriptAPI
|
|
||||||
import rs09.game.ai.skillingbot.SkillingBotAssembler
|
|
||||||
import rs09.game.interaction.InteractionListener
|
|
||||||
import rs09.game.interaction.InteractionListeners
|
|
||||||
|
|
||||||
@PlayerCompatible
|
|
||||||
@ScriptName("Seers Magics")
|
|
||||||
@ScriptDescription("Start in Seers Bank with an axe equipped or in your inventory.")
|
|
||||||
@ScriptIdentifier("seers_magics")
|
|
||||||
class SeersMagicTrees : Script(){
|
|
||||||
var state = State.INIT
|
|
||||||
var stage = 0
|
|
||||||
val bankZone = ZoneBorders(2722,3490,2727,3493)
|
|
||||||
val magicsZone = ZoneBorders(2700, 3396,2704, 3399)
|
|
||||||
var overlay: ScriptAPI.BottingOverlay? = null
|
|
||||||
var logCounter = 0
|
|
||||||
|
|
||||||
override fun tick() {
|
|
||||||
when(state){
|
|
||||||
|
|
||||||
State.INIT -> {
|
|
||||||
overlay = scriptAPI.getOverlay()
|
|
||||||
overlay!!.init()
|
|
||||||
overlay!!.setTitle("Woodcutting")
|
|
||||||
overlay!!.setTaskLabel("Logs cut:")
|
|
||||||
overlay!!.setAmount(0)
|
|
||||||
state = State.RETURN_TO_TREES
|
|
||||||
}
|
|
||||||
|
|
||||||
State.CHOPPING -> {
|
|
||||||
val tree = scriptAPI.getNearestNode(1306,true)
|
|
||||||
tree?.let { InteractionListeners.run(tree.id, InteractionListener.OBJECT,"chop",bot,tree) }
|
|
||||||
if(bot.inventory.isFull){
|
|
||||||
state = State.FIND_BANK
|
|
||||||
}
|
|
||||||
overlay!!.setAmount(logCounter + bot.inventory.getAmount(Items.MAGIC_LOGS_1513))
|
|
||||||
}
|
|
||||||
|
|
||||||
State.FIND_BANK -> {
|
|
||||||
if(!bankZone.insideBorder(bot)){
|
|
||||||
scriptAPI.walkTo(bankZone.randomLoc)
|
|
||||||
} else {
|
|
||||||
state = State.BANKING
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
State.BANKING -> {
|
|
||||||
val bank = scriptAPI.getNearestNode(25808,true)
|
|
||||||
if(bank != null)
|
|
||||||
bot.pulseManager.run(object: MovementPulse(bot,bank, DestinationFlag.OBJECT){
|
|
||||||
override fun pulse(): Boolean {
|
|
||||||
bot.faceLocation(bank.location)
|
|
||||||
logCounter += bot.inventory.getAmount(Items.MAGIC_LOGS_1513)
|
|
||||||
scriptAPI.bankItem(Items.MAGIC_LOGS_1513)
|
|
||||||
state = State.RETURN_TO_TREES
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
State.RETURN_TO_TREES -> {
|
|
||||||
if(!magicsZone.insideBorder(bot)){
|
|
||||||
scriptAPI.walkTo(magicsZone.randomLoc)
|
|
||||||
} else {
|
|
||||||
state = State.CHOPPING
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
State.TELE_GE -> {
|
|
||||||
state = State.SELL_GE
|
|
||||||
scriptAPI.teleportToGE()
|
|
||||||
}
|
|
||||||
|
|
||||||
State.SELL_GE -> {
|
|
||||||
state = State.TELE_SEERS
|
|
||||||
scriptAPI.sellOnGE(Items.MAGIC_LOGS_1513)
|
|
||||||
}
|
|
||||||
|
|
||||||
State.TELE_SEERS -> {
|
|
||||||
state = State.RETURN_TO_TREES
|
|
||||||
scriptAPI.teleport(Location.create(2756, 3478, 0))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
init {
|
|
||||||
inventory.add(Item(Items.RUNE_AXE_1359))
|
|
||||||
skills[Skills.WOODCUTTING] = RandomFunction.random(75,99)
|
|
||||||
}
|
|
||||||
|
|
||||||
enum class State {
|
|
||||||
CHOPPING,
|
|
||||||
FIND_BANK,
|
|
||||||
BANKING,
|
|
||||||
RETURN_TO_TREES,
|
|
||||||
TELE_GE,
|
|
||||||
SELL_GE,
|
|
||||||
TELE_SEERS,
|
|
||||||
INIT
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun newInstance(): Script {
|
|
||||||
val script = SeersMagicTrees()
|
|
||||||
script.bot = SkillingBotAssembler().produce(SkillingBotAssembler.Wealth.AVERAGE,bot.startLocation)
|
|
||||||
return script
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -20,8 +20,6 @@ import core.plugin.Plugin
|
|||||||
import core.tools.RandomFunction
|
import core.tools.RandomFunction
|
||||||
import rs09.game.ai.AIPBuilder
|
import rs09.game.ai.AIPBuilder
|
||||||
import rs09.game.ai.AIPlayer
|
import rs09.game.ai.AIPlayer
|
||||||
import rs09.game.ai.general.GeneralBotCreator
|
|
||||||
import rs09.game.ai.general.scriptrepository.LobsterCatcher
|
|
||||||
import rs09.game.ai.pvmbots.PvMBotsBuilder
|
import rs09.game.ai.pvmbots.PvMBotsBuilder
|
||||||
import rs09.game.ai.pvp.PVPAIPActions
|
import rs09.game.ai.pvp.PVPAIPActions
|
||||||
import rs09.game.ai.pvp.PVPAIPBuilderUtils
|
import rs09.game.ai.pvp.PVPAIPBuilderUtils
|
||||||
@@ -309,7 +307,6 @@ class AIPCommandPlugin : CommandPlugin() {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
//"manthiev" -> GeneralBotCreator(player.location, ManThiever())
|
//"manthiev" -> GeneralBotCreator(player.location, ManThiever())
|
||||||
"fish" -> GeneralBotCreator(Location.create(2805, 3435, 0), LobsterCatcher())
|
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,71 +0,0 @@
|
|||||||
package rs09.game.system.command.sets
|
|
||||||
|
|
||||||
import core.game.component.Component
|
|
||||||
import core.plugin.Initializable
|
|
||||||
import org.rs09.consts.Components
|
|
||||||
import rs09.game.ai.general.GeneralBotCreator
|
|
||||||
import rs09.game.ai.general.scriptrepository.PlayerScripts
|
|
||||||
import rs09.game.ai.general.scriptrepository.Script
|
|
||||||
import rs09.game.system.command.Command
|
|
||||||
import rs09.game.world.GameWorld
|
|
||||||
import rs09.tools.stringtools.colorize
|
|
||||||
|
|
||||||
@Initializable
|
|
||||||
class BottingCommandSet : CommandSet(Command.Privilege.STANDARD) {
|
|
||||||
override fun defineCommands() {
|
|
||||||
define("scripts"){player, _ ->
|
|
||||||
if(GameWorld.settings?.enabled_botting != true){
|
|
||||||
player.sendChat("I just tried to do something silly!")
|
|
||||||
return@define
|
|
||||||
}
|
|
||||||
if(!player.getAttribute("botting:warning_shown",false)){
|
|
||||||
player.dialogueInterpreter.sendDialogue(colorize("%RWARNING: Running a bot script will permanently remove you"),colorize("%Rfrom the highscores."))
|
|
||||||
player.dialogueInterpreter.addAction { player, buttonId -> player.setAttribute("/save:botting:warning_shown",true) }
|
|
||||||
return@define
|
|
||||||
}
|
|
||||||
for (i in 0..310) {
|
|
||||||
player.packetDispatch.sendString("", 275, i)
|
|
||||||
}
|
|
||||||
var lineid = 11
|
|
||||||
player.packetDispatch.sendString("Bot Scripts",275,2)
|
|
||||||
for(script in PlayerScripts.identifierMap.values) {
|
|
||||||
player.packetDispatch.sendString("<bold>${script.name}</bold>", 275, lineid++)
|
|
||||||
script.description.forEach { line ->
|
|
||||||
player.packetDispatch.sendString(line,275,lineid++)
|
|
||||||
}
|
|
||||||
player.packetDispatch.sendString("<img=3> ::script ${script.identifier}",275,lineid++)
|
|
||||||
player.packetDispatch.sendString("<str> </str>",275,lineid++)
|
|
||||||
}
|
|
||||||
player.interfaceManager.open(Component(Components.QUESTJOURNAL_SCROLL_275))
|
|
||||||
}
|
|
||||||
define("script"){player,args ->
|
|
||||||
if(GameWorld.settings?.enabled_botting != true){
|
|
||||||
player.sendChat("I just tried to do something very silly!")
|
|
||||||
return@define
|
|
||||||
}
|
|
||||||
if(!player.getAttribute("botting:warning_shown",false)){
|
|
||||||
player.dialogueInterpreter.sendDialogue(colorize("%RWARNING: Running a bot script will permanently remove you from the highscores."))
|
|
||||||
player.dialogueInterpreter.addAction { player, buttonId -> player.setAttribute("/save:botting:warning_shown",true) }
|
|
||||||
return@define
|
|
||||||
}
|
|
||||||
if(args.size < 2){
|
|
||||||
reject(player,"Usage: ::script identifier")
|
|
||||||
}
|
|
||||||
val identifier = args[1]
|
|
||||||
val script = PlayerScripts.identifierMap[identifier]
|
|
||||||
if(script == null){
|
|
||||||
reject(player,"Invalid script identifier")
|
|
||||||
}
|
|
||||||
player.interfaceManager.close()
|
|
||||||
GeneralBotCreator(script!!.clazz.newInstance() as Script,player,true)
|
|
||||||
player.sendMessage(colorize("%RStarting script..."))
|
|
||||||
player.sendMessage(colorize("%RTo stop the script, do ::stopscript or log out."))
|
|
||||||
|
|
||||||
}
|
|
||||||
define("stopscript"){player,args ->
|
|
||||||
val pulse: GeneralBotCreator.BotScriptPulse? = player.getAttribute("botting:script",null)
|
|
||||||
pulse?.stop()
|
|
||||||
player.interfaceManager.closeOverlay()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -15,7 +15,6 @@ import core.game.world.map.RegionManager
|
|||||||
import core.plugin.CorePluginTypes.StartupPlugin
|
import core.plugin.CorePluginTypes.StartupPlugin
|
||||||
import core.tools.RandomFunction
|
import core.tools.RandomFunction
|
||||||
import core.tools.mysql.DatabaseManager
|
import core.tools.mysql.DatabaseManager
|
||||||
import rs09.game.ai.general.scriptrepository.PlayerScripts
|
|
||||||
import rs09.ServerConstants
|
import rs09.ServerConstants
|
||||||
import rs09.game.node.entity.state.newsys.StateRepository
|
import rs09.game.node.entity.state.newsys.StateRepository
|
||||||
import rs09.game.system.SystemLogger
|
import rs09.game.system.SystemLogger
|
||||||
@@ -152,7 +151,6 @@ object GameWorld {
|
|||||||
}
|
}
|
||||||
ObjectDefinition.getDefinitions().values.forEach(Consumer { obj: ObjectDefinition -> obj.examine })
|
ObjectDefinition.getDefinitions().values.forEach(Consumer { obj: ObjectDefinition -> obj.examine })
|
||||||
System.gc()
|
System.gc()
|
||||||
PlayerScripts.init()
|
|
||||||
StateRepository.init()
|
StateRepository.init()
|
||||||
SystemLogger.initTradeLogger()
|
SystemLogger.initTradeLogger()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,11 +41,9 @@ object ImmerseWorld {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun immerseSeersAndCatherby(){
|
fun immerseSeersAndCatherby(){
|
||||||
GeneralBotCreator(SeersMagicTrees(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.AVERAGE, Location.create(2702, 3397, 0)))
|
|
||||||
GeneralBotCreator(SeersFlax(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.POOR, Location.create(2738, 3444, 0)))
|
GeneralBotCreator(SeersFlax(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.POOR, Location.create(2738, 3444, 0)))
|
||||||
GeneralBotCreator(FletchingBankstander(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.AVERAGE, Location.create(2722, 3493, 0)))
|
GeneralBotCreator(FletchingBankstander(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.AVERAGE, Location.create(2722, 3493, 0)))
|
||||||
GeneralBotCreator(GlassBlowingBankstander(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.AVERAGE, Location.create(2807, 3441, 0)))
|
GeneralBotCreator(GlassBlowingBankstander(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.AVERAGE, Location.create(2807, 3441, 0)))
|
||||||
GeneralBotCreator(Location.create(2805, 3435, 0), LobsterCatcher())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun immerseLumbridgeDraynor(){
|
fun immerseLumbridgeDraynor(){
|
||||||
@@ -55,9 +53,6 @@ object ImmerseWorld {
|
|||||||
GeneralBotCreator(ManThiever(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.POOR,Location.create(3235, 3213, 0)))
|
GeneralBotCreator(ManThiever(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.POOR,Location.create(3235, 3213, 0)))
|
||||||
GeneralBotCreator(FarmerThiever(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.POOR,Location.create(3094,3243,0)))
|
GeneralBotCreator(FarmerThiever(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.POOR,Location.create(3094,3243,0)))
|
||||||
GeneralBotCreator(FarmerThiever(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.POOR,Location.create(3094,3243,0)))
|
GeneralBotCreator(FarmerThiever(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.POOR,Location.create(3094,3243,0)))
|
||||||
GeneralBotCreator(DraynorWillows(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.values().random(),Location.create(3094, 3245, 0)))
|
|
||||||
GeneralBotCreator(DraynorWillows(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.values().random(),Location.create(3094, 3245, 0)))
|
|
||||||
GeneralBotCreator(DraynorWillows(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.values().random(),Location.create(3094, 3245, 0)))
|
|
||||||
GeneralBotCreator(DraynorFisher(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.POOR,Location.create(3095, 3246, 0)))
|
GeneralBotCreator(DraynorFisher(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.POOR,Location.create(3095, 3246, 0)))
|
||||||
GeneralBotCreator(DraynorFisher(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.POOR,Location.create(3095, 3246, 0)))
|
GeneralBotCreator(DraynorFisher(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.POOR,Location.create(3095, 3246, 0)))
|
||||||
GeneralBotCreator(DraynorFisher(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.POOR,Location.create(3095, 3246, 0)))
|
GeneralBotCreator(DraynorFisher(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.POOR,Location.create(3095, 3246, 0)))
|
||||||
@@ -83,10 +78,6 @@ object ImmerseWorld {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun immerseFalador(){
|
|
||||||
GeneralBotCreator(CoalMiner(), skillingBotAssembler.produce(SkillingBotAssembler.Wealth.POOR,Location.create(3037, 9737, 0)))
|
|
||||||
}
|
|
||||||
|
|
||||||
fun immerseSlayer(){
|
fun immerseSlayer(){
|
||||||
GeneralBotCreator(GenericSlayerBot(), assembler.produce(CombatBotAssembler.Type.MELEE,CombatBotAssembler.Tier.HIGH,Location.create(2673, 3635, 0)))
|
GeneralBotCreator(GenericSlayerBot(), assembler.produce(CombatBotAssembler.Type.MELEE,CombatBotAssembler.Tier.HIGH,Location.create(2673, 3635, 0)))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user