Fixed Draynor bot theiving
Fixed Draynor willow bots getting stuck
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
package rs09.game.ai.general.scriptrepository
|
package rs09.game.ai.general.scriptrepository
|
||||||
|
|
||||||
import core.game.component.Component
|
import core.game.component.Component
|
||||||
import core.game.interaction.DestinationFlag
|
import core.game.interaction.DestinationFlag
|
||||||
import core.game.interaction.MovementPulse
|
import core.game.interaction.MovementPulse
|
||||||
@@ -7,7 +6,6 @@ import core.game.node.entity.skill.Skills
|
|||||||
import core.game.node.item.Item
|
import core.game.node.item.Item
|
||||||
import core.game.world.map.zone.ZoneBorders
|
import core.game.world.map.zone.ZoneBorders
|
||||||
import org.rs09.consts.Items
|
import org.rs09.consts.Items
|
||||||
import rs09.game.interaction.InteractionListener
|
|
||||||
import rs09.game.interaction.IntType
|
import rs09.game.interaction.IntType
|
||||||
import rs09.game.interaction.InteractionListeners
|
import rs09.game.interaction.InteractionListeners
|
||||||
import rs09.tools.stringtools.colorize
|
import rs09.tools.stringtools.colorize
|
||||||
@@ -18,9 +16,7 @@ import rs09.tools.stringtools.colorize
|
|||||||
@ScriptIdentifier("draynor_trees")
|
@ScriptIdentifier("draynor_trees")
|
||||||
class DraynorWillows : Script(){
|
class DraynorWillows : Script(){
|
||||||
val willowZone = ZoneBorders(3084, 3225,3091, 3239)
|
val willowZone = ZoneBorders(3084, 3225,3091, 3239)
|
||||||
|
val bankZone = ZoneBorders(3092, 3245,3092, 3242)
|
||||||
|
|
||||||
val bankZone = ZoneBorders(3092, 3240,3094, 3246)
|
|
||||||
var state = State.INIT
|
var state = State.INIT
|
||||||
var logCount = 0
|
var logCount = 0
|
||||||
|
|
||||||
|
|||||||
@@ -1,30 +1,71 @@
|
|||||||
package rs09.game.ai.general.scriptrepository
|
package rs09.game.ai.general.scriptrepository
|
||||||
|
|
||||||
import core.game.world.map.zone.ZoneBorders
|
import core.game.world.map.zone.ZoneBorders
|
||||||
import rs09.game.ai.skillingbot.SkillingBotAssembler
|
import rs09.game.ai.skillingbot.SkillingBotAssembler
|
||||||
import core.game.node.entity.skill.Skills
|
import core.game.node.entity.skill.Skills
|
||||||
|
import core.game.node.item.Item
|
||||||
|
import org.rs09.consts.Items
|
||||||
|
import org.rs09.consts.NPCs
|
||||||
|
import rs09.game.interaction.IntType
|
||||||
|
import rs09.game.interaction.InteractionListeners
|
||||||
|
|
||||||
class FarmerThiever : Script() {
|
class FarmerThiever : Script() {
|
||||||
val pickpocketZone = ZoneBorders(3074,3245,3086,3255)
|
val pickpocketZone = ZoneBorders(3074,3245,3086,3255)
|
||||||
|
val bankZone = ZoneBorders(3092, 3245,3092, 3242)
|
||||||
|
val food = Items.JUG_OF_WINE_1993
|
||||||
|
val foodAmount = 10
|
||||||
|
var state = State.PICKPOCKETING
|
||||||
|
|
||||||
|
|
||||||
override fun tick() {
|
override fun tick() {
|
||||||
if(!pickpocketZone.insideBorder(bot))
|
when(state) {
|
||||||
scriptAPI.walkTo(pickpocketZone.randomLoc)
|
|
||||||
else{
|
|
||||||
val farmer = scriptAPI.getNearestNode(2234,false)
|
|
||||||
farmer?.interaction?.handle(bot,farmer.interaction[2]) ?: scriptAPI.walkTo(pickpocketZone.randomLoc)
|
|
||||||
|
|
||||||
|
State.PICKPOCKETING -> {
|
||||||
|
if (!pickpocketZone.insideBorder(bot))
|
||||||
|
scriptAPI.walkTo(pickpocketZone.randomLoc)
|
||||||
|
if (bot.inventory.isFull)
|
||||||
|
state = State.BANKING
|
||||||
|
else {
|
||||||
|
val farmer = scriptAPI.getNearestNode(NPCs.MASTER_FARMER_2234, false)
|
||||||
|
bot.interfaceManager.close()
|
||||||
|
scriptAPI.eat(food)
|
||||||
|
if (farmer != null) {
|
||||||
|
InteractionListeners.run(farmer.id, IntType.NPC, "Pickpocket", bot, farmer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
State.BANKING -> {
|
||||||
|
val bank = scriptAPI.getNearestNode("Bank Booth",true)
|
||||||
|
bank ?: return
|
||||||
|
if (!bankZone.insideBorder(bot))
|
||||||
|
scriptAPI.walkTo(bankZone.randomLoc)
|
||||||
|
else {
|
||||||
|
bot.faceLocation(bank.location)
|
||||||
|
bot.inventory.clear()
|
||||||
|
bot.inventory.add(Item(food, foodAmount))
|
||||||
|
state = State.PICKPOCKETING
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
override fun newInstance(): Script {
|
override fun newInstance(): Script {
|
||||||
val script = FarmerThiever()
|
val script = FarmerThiever()
|
||||||
script.bot = SkillingBotAssembler().produce(SkillingBotAssembler.Wealth.POOR,bot.startLocation)
|
script.bot = SkillingBotAssembler().produce(SkillingBotAssembler.Wealth.POOR,bot.startLocation)
|
||||||
return script
|
return script
|
||||||
}
|
}
|
||||||
|
enum class State {
|
||||||
|
BANKING,
|
||||||
|
PICKPOCKETING
|
||||||
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
inventory.add(Item(food,foodAmount))
|
||||||
skills[Skills.THIEVING] = 80
|
skills[Skills.THIEVING] = 80
|
||||||
|
skills[Skills.HITPOINTS] = 10
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,6 @@ import core.tools.RandomFunction
|
|||||||
import org.rs09.consts.Items
|
import org.rs09.consts.Items
|
||||||
import rs09.game.interaction.InteractionListener
|
import rs09.game.interaction.InteractionListener
|
||||||
import rs09.game.interaction.IntType
|
import rs09.game.interaction.IntType
|
||||||
import rs09.game.system.SystemLogger
|
|
||||||
import rs09.tools.secondsToTicks
|
import rs09.tools.secondsToTicks
|
||||||
|
|
||||||
class ThievingListeners : InteractionListener {
|
class ThievingListeners : InteractionListener {
|
||||||
@@ -25,7 +24,6 @@ class ThievingListeners : InteractionListener {
|
|||||||
on(IntType.NPC,"pickpocket","pick-pocket"){player, node ->
|
on(IntType.NPC,"pickpocket","pick-pocket"){player, node ->
|
||||||
val pickpocketData = Pickpockets.forID(node.id) ?: return@on false
|
val pickpocketData = Pickpockets.forID(node.id) ?: return@on false
|
||||||
var successMod = 0
|
var successMod = 0
|
||||||
SystemLogger.logInfo(this::class.java, pickpocketData.table.toString())
|
|
||||||
|
|
||||||
if(player.inCombat()){
|
if(player.inCombat()){
|
||||||
player.sendMessage("You can't pickpocket while in combat.")
|
player.sendMessage("You can't pickpocket while in combat.")
|
||||||
|
|||||||
Reference in New Issue
Block a user