Player script fixes, and bankAll scriptAPI function added
Fixed the bank window exploit in the coal miner, Draynor willows, lobster catcher, Seers magic, shark catcher, and Varrock essence scripts. Made it so that the coal miner script banks its entire inventory instead of just the coal ore, this way it should no longer get stuck if its inventory is full of mithril ore and uncut gems. Fixed the Draynor willows and Seers magic trees scripts so that the bot actually chops down the trees instead of just standing next to them. Added a bankAll function to the scriptAPI, the coal miner script is dependent on this change
This commit is contained in:
@@ -550,6 +550,28 @@ class ScriptAPI(private val bot: Player) {
|
|||||||
bot.pulseManager.run(BankingPulse())
|
bot.pulseManager.run(BankingPulse())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Takes every item out of the bots inventory and places it into the bank.
|
||||||
|
* @param none
|
||||||
|
* @author cfunnyman joe
|
||||||
|
*/
|
||||||
|
fun bankAll(){
|
||||||
|
class BankingPulse() : Pulse(20){
|
||||||
|
override fun pulse(): Boolean {
|
||||||
|
for(item in bot.inventory.toArray()){
|
||||||
|
var itemAmount = bot.inventory.getAmount(item)
|
||||||
|
|
||||||
|
bot.inventory.remove(item)
|
||||||
|
bot.bank.add(item)
|
||||||
|
bot.bank.refresh()
|
||||||
|
bot.inventory.refresh()
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bot.pulseManager.run(BankingPulse())
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function that makes the bot eat the food item in their inventory if their HP is below 2/3.
|
* Function that makes the bot eat the food item in their inventory if their HP is below 2/3.
|
||||||
* @author Ceikry
|
* @author Ceikry
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
package rs09.game.ai.general.scriptrepository
|
package rs09.game.ai.general.scriptrepository
|
||||||
|
|
||||||
|
<<<<<<< refs/remotes/2009scape/master
|
||||||
|
=======
|
||||||
|
|
||||||
|
>>>>>>> Player script fixes, and bankAll scriptAPI function added
|
||||||
import core.game.interaction.DestinationFlag
|
import core.game.interaction.DestinationFlag
|
||||||
import core.game.interaction.MovementPulse
|
import core.game.interaction.MovementPulse
|
||||||
import core.game.node.Node
|
import core.game.node.Node
|
||||||
@@ -11,21 +15,38 @@ import rs09.game.ai.general.ScriptAPI
|
|||||||
import rs09.game.ai.skillingbot.SkillingBotAssembler
|
import rs09.game.ai.skillingbot.SkillingBotAssembler
|
||||||
import rs09.game.interaction.InteractionListener
|
import rs09.game.interaction.InteractionListener
|
||||||
import rs09.game.interaction.InteractionListeners
|
import rs09.game.interaction.InteractionListeners
|
||||||
|
<<<<<<< refs/remotes/2009scape/master
|
||||||
|
=======
|
||||||
|
import api.ContentAPI
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
|
import kotlinx.coroutines.runBlocking
|
||||||
|
import java.util.logging.Handler
|
||||||
|
>>>>>>> Player script fixes, and bankAll scriptAPI function added
|
||||||
|
|
||||||
@PlayerCompatible
|
@PlayerCompatible
|
||||||
@ScriptName("Falador Coal Miner")
|
@ScriptName("Falador Coal Miner")
|
||||||
@ScriptDescription("Start in Falador East Bank with a pick equipped","or in your inventory.")
|
@ScriptDescription("Start in Falador East Bank with a pick equipped","or in your inventory.")
|
||||||
@ScriptIdentifier("fally_coal")
|
@ScriptIdentifier("fally_coal")
|
||||||
|
<<<<<<< refs/remotes/2009scape/master
|
||||||
class CoalMiner() : Script() {
|
class CoalMiner() : Script() {
|
||||||
var state = State.INIT
|
var state = State.INIT
|
||||||
var ladderSwitch = false
|
var ladderSwitch = false
|
||||||
|
|
||||||
|
=======
|
||||||
|
class CoalMiner : Script() {
|
||||||
|
var state = State.INIT
|
||||||
|
var ladderSwitch = false
|
||||||
|
>>>>>>> Player script fixes, and bankAll scriptAPI function added
|
||||||
val bottomLadder = ZoneBorders(3016,9736,3024,9742)
|
val bottomLadder = ZoneBorders(3016,9736,3024,9742)
|
||||||
val topLadder = ZoneBorders(3016,3336,3022,3342)
|
val topLadder = ZoneBorders(3016,3336,3022,3342)
|
||||||
val mine = ZoneBorders(3027,9733,3054,9743)
|
val mine = ZoneBorders(3027,9733,3054,9743)
|
||||||
val bank = ZoneBorders(3009,3355,3018,3358)
|
val bank = ZoneBorders(3009,3355,3018,3358)
|
||||||
var overlay: ScriptAPI.BottingOverlay? = null
|
var overlay: ScriptAPI.BottingOverlay? = null
|
||||||
|
<<<<<<< refs/remotes/2009scape/master
|
||||||
var coalAmount = 0
|
var coalAmount = 0
|
||||||
|
=======
|
||||||
|
var coalAmount = 0
|
||||||
|
>>>>>>> Player script fixes, and bankAll scriptAPI function added
|
||||||
|
|
||||||
override fun tick() {
|
override fun tick() {
|
||||||
when(state){
|
when(state){
|
||||||
@@ -47,6 +68,10 @@ class CoalMiner() : Script() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
State.MINING -> {
|
State.MINING -> {
|
||||||
|
<<<<<<< refs/remotes/2009scape/master
|
||||||
|
=======
|
||||||
|
bot.interfaceManager.close()
|
||||||
|
>>>>>>> Player script fixes, and bankAll scriptAPI function added
|
||||||
if(bot.inventory.freeSlots() == 0){
|
if(bot.inventory.freeSlots() == 0){
|
||||||
state = State.TO_BANK
|
state = State.TO_BANK
|
||||||
}
|
}
|
||||||
@@ -56,7 +81,11 @@ class CoalMiner() : Script() {
|
|||||||
val rock = scriptAPI.getNearestNode("rocks",true)
|
val rock = scriptAPI.getNearestNode("rocks",true)
|
||||||
rock?.let { InteractionListeners.run(rock.id, InteractionListener.OBJECT,"mine",bot,rock) }
|
rock?.let { InteractionListeners.run(rock.id, InteractionListener.OBJECT,"mine",bot,rock) }
|
||||||
}
|
}
|
||||||
|
<<<<<<< refs/remotes/2009scape/master
|
||||||
overlay!!.setAmount(bot.inventory.getAmount(Items.COAL_453) + coalAmount)
|
overlay!!.setAmount(bot.inventory.getAmount(Items.COAL_453) + coalAmount)
|
||||||
|
=======
|
||||||
|
overlay!!.setAmount(ContentAPI.amountInInventory(bot, Items.COAL_453) + coalAmount)
|
||||||
|
>>>>>>> Player script fixes, and bankAll scriptAPI function added
|
||||||
}
|
}
|
||||||
|
|
||||||
State.TO_BANK -> {
|
State.TO_BANK -> {
|
||||||
@@ -83,13 +112,22 @@ class CoalMiner() : Script() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
State.BANKING -> {
|
State.BANKING -> {
|
||||||
|
<<<<<<< refs/remotes/2009scape/master
|
||||||
coalAmount += bot.inventory.getAmount(Items.COAL_453)
|
coalAmount += bot.inventory.getAmount(Items.COAL_453)
|
||||||
scriptAPI.bankItem(Items.COAL_453)
|
scriptAPI.bankItem(Items.COAL_453)
|
||||||
|
=======
|
||||||
|
coalAmount += bot.inventory.getAmount(Items.COAL_453)
|
||||||
|
scriptAPI.bankAll()
|
||||||
|
>>>>>>> Player script fixes, and bankAll scriptAPI function added
|
||||||
state = State.TO_MINE
|
state = State.TO_MINE
|
||||||
}
|
}
|
||||||
|
|
||||||
State.TO_MINE -> {
|
State.TO_MINE -> {
|
||||||
if(ladderSwitch){
|
if(ladderSwitch){
|
||||||
|
<<<<<<< refs/remotes/2009scape/master
|
||||||
|
=======
|
||||||
|
bot.interfaceManager.close()
|
||||||
|
>>>>>>> Player script fixes, and bankAll scriptAPI function added
|
||||||
if(!topLadder.insideBorder(bot.location)){
|
if(!topLadder.insideBorder(bot.location)){
|
||||||
scriptAPI.walkTo(topLadder.randomLoc)
|
scriptAPI.walkTo(topLadder.randomLoc)
|
||||||
} else {
|
} else {
|
||||||
@@ -124,7 +162,10 @@ class CoalMiner() : Script() {
|
|||||||
scriptAPI.teleport(bank.randomLoc)
|
scriptAPI.teleport(bank.randomLoc)
|
||||||
state = State.TO_MINE
|
state = State.TO_MINE
|
||||||
}
|
}
|
||||||
|
<<<<<<< refs/remotes/2009scape/master
|
||||||
|
|
||||||
|
=======
|
||||||
|
>>>>>>> Player script fixes, and bankAll scriptAPI function added
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,5 +197,8 @@ class CoalMiner() : Script() {
|
|||||||
equipment.add(Item(Items.IRON_PICKAXE_1267))
|
equipment.add(Item(Items.IRON_PICKAXE_1267))
|
||||||
skills.put(Skills.MINING,75)
|
skills.put(Skills.MINING,75)
|
||||||
}
|
}
|
||||||
|
<<<<<<< refs/remotes/2009scape/master
|
||||||
|
|
||||||
|
=======
|
||||||
|
>>>>>>> Player script fixes, and bankAll scriptAPI function added
|
||||||
}
|
}
|
||||||
@@ -41,8 +41,14 @@ class DraynorWillows : Script(){
|
|||||||
scriptAPI.walkTo(willowZone.randomLoc)
|
scriptAPI.walkTo(willowZone.randomLoc)
|
||||||
else {
|
else {
|
||||||
val willowtree = scriptAPI.getNearestNode("willow", true)
|
val willowtree = scriptAPI.getNearestNode("willow", true)
|
||||||
|
<<<<<<< refs/remotes/2009scape/master
|
||||||
willowtree?.let { InteractionListeners.run(willowtree.id,
|
willowtree?.let { InteractionListeners.run(willowtree.id,
|
||||||
InteractionListener.OBJECT,"chop",bot,willowtree) }
|
InteractionListener.OBJECT,"chop",bot,willowtree) }
|
||||||
|
=======
|
||||||
|
bot.interfaceManager.close()
|
||||||
|
willowtree?.let { InteractionListeners.run(willowtree.id,
|
||||||
|
InteractionListener.OBJECT,"Chop down",bot,willowtree) }
|
||||||
|
>>>>>>> Player script fixes, and bankAll scriptAPI function added
|
||||||
if (bot.inventory.isFull)
|
if (bot.inventory.isFull)
|
||||||
state = State.BANKING
|
state = State.BANKING
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,6 +69,10 @@ class LobsterCatcher : Script() {
|
|||||||
|
|
||||||
|
|
||||||
State.FISHING -> {
|
State.FISHING -> {
|
||||||
|
<<<<<<< refs/remotes/2009scape/master
|
||||||
|
=======
|
||||||
|
bot.interfaceManager.close()
|
||||||
|
>>>>>>> Player script fixes, and bankAll scriptAPI function added
|
||||||
val spot = scriptAPI.getNearestNode(333, false)
|
val spot = scriptAPI.getNearestNode(333, false)
|
||||||
if(spot == null){
|
if(spot == null){
|
||||||
state = State.IDLE
|
state = State.IDLE
|
||||||
@@ -163,10 +167,17 @@ class LobsterCatcher : Script() {
|
|||||||
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
<<<<<<< refs/remotes/2009scape/master
|
||||||
val setUp = RandomFunction.random(Sets.values().size)
|
val setUp = RandomFunction.random(Sets.values().size)
|
||||||
equipment.addAll(Sets.values()[setUp].equipment)
|
equipment.addAll(Sets.values()[setUp].equipment)
|
||||||
inventory.add(Item(301))
|
inventory.add(Item(301))
|
||||||
skills[Skills.FISHING] = 40
|
skills[Skills.FISHING] = 40
|
||||||
|
=======
|
||||||
|
val setUp = RandomFunction.random(Sets.values().size)
|
||||||
|
equipment.addAll(Sets.values()[setUp].equipment)
|
||||||
|
inventory.add(Item(301))
|
||||||
|
skills[Skills.FISHING] = 40
|
||||||
|
>>>>>>> Player script fixes, and bankAll scriptAPI function added
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class State{
|
enum class State{
|
||||||
|
|||||||
@@ -39,7 +39,12 @@ class SeersMagicTrees : Script(){
|
|||||||
|
|
||||||
State.CHOPPING -> {
|
State.CHOPPING -> {
|
||||||
val tree = scriptAPI.getNearestNode(1306,true)
|
val tree = scriptAPI.getNearestNode(1306,true)
|
||||||
|
<<<<<<< refs/remotes/2009scape/master
|
||||||
tree?.let { InteractionListeners.run(tree.id, InteractionListener.OBJECT,"chop",bot,tree) }
|
tree?.let { InteractionListeners.run(tree.id, InteractionListener.OBJECT,"chop",bot,tree) }
|
||||||
|
=======
|
||||||
|
bot.interfaceManager.close()
|
||||||
|
tree?.let { InteractionListeners.run(tree.id, InteractionListener.OBJECT,"Chop down",bot,tree) }
|
||||||
|
>>>>>>> Player script fixes, and bankAll scriptAPI function added
|
||||||
if(bot.inventory.isFull){
|
if(bot.inventory.isFull){
|
||||||
state = State.FIND_BANK
|
state = State.FIND_BANK
|
||||||
}
|
}
|
||||||
@@ -69,6 +74,10 @@ class SeersMagicTrees : Script(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
State.RETURN_TO_TREES -> {
|
State.RETURN_TO_TREES -> {
|
||||||
|
<<<<<<< refs/remotes/2009scape/master
|
||||||
|
=======
|
||||||
|
bot.interfaceManager.close()
|
||||||
|
>>>>>>> Player script fixes, and bankAll scriptAPI function added
|
||||||
if(!magicsZone.insideBorder(bot)){
|
if(!magicsZone.insideBorder(bot)){
|
||||||
scriptAPI.walkTo(magicsZone.randomLoc)
|
scriptAPI.walkTo(magicsZone.randomLoc)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ class SharkCatcher : Script() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
State.FISHING -> {
|
State.FISHING -> {
|
||||||
|
bot.interfaceManager.close()
|
||||||
if (Random.nextBoolean()) {
|
if (Random.nextBoolean()) {
|
||||||
tick = 0
|
tick = 0
|
||||||
val spot = scriptAPI.getNearestNode(334, false)
|
val spot = scriptAPI.getNearestNode(334, false)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class VarrockEssenceMiner : Script(){
|
|||||||
|
|
||||||
when(state){
|
when(state){
|
||||||
State.TO_ESSENCE -> {
|
State.TO_ESSENCE -> {
|
||||||
|
bot.interfaceManager.close()
|
||||||
if(!auburyZone.insideBorder(bot))
|
if(!auburyZone.insideBorder(bot))
|
||||||
scriptAPI.walkTo(auburyZone.randomLoc)
|
scriptAPI.walkTo(auburyZone.randomLoc)
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user