From b35159b5b7ccc356f464476db60b72b2eebba65d Mon Sep 17 00:00:00 2001 From: randy Date: Mon, 28 Oct 2024 12:54:33 -0600 Subject: [PATCH] Implement pickpocketing auto-repeating if the player is wearing Gloves of Silence The player.lock function doesn't run if the player has gloves on, since it prevents triggering the pickpocket action immediately afterwards. To avoid pickpocketing every tick, we check the game ticks if the player has gloves and only perform the action every other tick. Testing indicates that manual pickpocketing can occur every 2 ticks, so the auto-repeat occurs at the same rate. If the player fails pickpocketing, the stun will prevent the auto-repeat from activating. --- .../global/skill/thieving/ThievingListeners.kt | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Server/src/main/content/global/skill/thieving/ThievingListeners.kt b/Server/src/main/content/global/skill/thieving/ThievingListeners.kt index d6123fcda..a236ca291 100644 --- a/Server/src/main/content/global/skill/thieving/ThievingListeners.kt +++ b/Server/src/main/content/global/skill/thieving/ThievingListeners.kt @@ -15,6 +15,9 @@ import core.game.node.entity.player.Player import core.game.node.item.Item import org.rs09.consts.Sounds +import core.game.interaction.InteractionListeners +import core.game.world.GameWorld + class ThievingListeners : InteractionListener { companion object { @@ -64,6 +67,10 @@ class ThievingListeners : InteractionListener { player.sendMessage("You don't have enough inventory space to do that.") return@on true } + + //Custom portion. If the player has gloves of silence, only proceed every other tick + val glovesOfSilence = player.equipment.contains(Items.GLOVES_OF_SILENCE_10075,1) + if (!glovesOfSilence || GameWorld.ticks % 2 == 0) { player.animator.animate(PICKPOCKET_ANIM) val lootTable = pickpocketRoll(player, pickpocketData.low, pickpocketData.high, pickpocketData.table) @@ -80,11 +87,17 @@ class ThievingListeners : InteractionListener { node.asNpc().face(null) } else { playAudio(player, Sounds.PICK_2581) - player.lock(2) + if (!glovesOfSilence) { + player.lock(2) + } lootTable.forEach { player.inventory.add(it) } player.skills.addExperience(Skills.THIEVING,pickpocketData.experience) } - + } + // if wearing gloves of silence, pickpocket again. + if (glovesOfSilence) { + InteractionListeners.run(node.id, IntType.NPC,"Pickpocket",player,node) + } return@on true } }