diff --git a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/DraynorWillows.kt b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/DraynorWillows.kt index 0f3faafd8..f5273b543 100644 --- a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/DraynorWillows.kt +++ b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/DraynorWillows.kt @@ -1,5 +1,4 @@ package rs09.game.ai.general.scriptrepository - import core.game.component.Component import core.game.interaction.DestinationFlag 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.world.map.zone.ZoneBorders import org.rs09.consts.Items -import rs09.game.interaction.InteractionListener import rs09.game.interaction.IntType import rs09.game.interaction.InteractionListeners import rs09.tools.stringtools.colorize @@ -18,9 +16,7 @@ import rs09.tools.stringtools.colorize @ScriptIdentifier("draynor_trees") class DraynorWillows : Script(){ val willowZone = ZoneBorders(3084, 3225,3091, 3239) - - - val bankZone = ZoneBorders(3092, 3240,3094, 3246) + val bankZone = ZoneBorders(3092, 3245,3092, 3242) var state = State.INIT var logCount = 0 diff --git a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/FarmerThiever.kt b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/FarmerThiever.kt index 0dbdfd9c9..aeea0a4b0 100644 --- a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/FarmerThiever.kt +++ b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/FarmerThiever.kt @@ -1,30 +1,71 @@ package rs09.game.ai.general.scriptrepository - import core.game.world.map.zone.ZoneBorders import rs09.game.ai.skillingbot.SkillingBotAssembler 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() { 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() { - if(!pickpocketZone.insideBorder(bot)) - scriptAPI.walkTo(pickpocketZone.randomLoc) - else{ - val farmer = scriptAPI.getNearestNode(2234,false) - farmer?.interaction?.handle(bot,farmer.interaction[2]) ?: scriptAPI.walkTo(pickpocketZone.randomLoc) + when(state) { + 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 { val script = FarmerThiever() script.bot = SkillingBotAssembler().produce(SkillingBotAssembler.Wealth.POOR,bot.startLocation) return script } + enum class State { + BANKING, + PICKPOCKETING + } init { + inventory.add(Item(food,foodAmount)) skills[Skills.THIEVING] = 80 + skills[Skills.HITPOINTS] = 10 } + + } \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/thieving/ThievingListeners.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/thieving/ThievingListeners.kt index e84815efc..41d2e8f9b 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/thieving/ThievingListeners.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/thieving/ThievingListeners.kt @@ -11,7 +11,6 @@ import core.tools.RandomFunction import org.rs09.consts.Items import rs09.game.interaction.InteractionListener import rs09.game.interaction.IntType -import rs09.game.system.SystemLogger import rs09.tools.secondsToTicks class ThievingListeners : InteractionListener { @@ -25,7 +24,6 @@ class ThievingListeners : InteractionListener { on(IntType.NPC,"pickpocket","pick-pocket"){player, node -> val pickpocketData = Pickpockets.forID(node.id) ?: return@on false var successMod = 0 - SystemLogger.logInfo(this::class.java, pickpocketData.table.toString()) if(player.inCombat()){ player.sendMessage("You can't pickpocket while in combat.")