Implemented the thieving skillcape

Removed inauthentic HAM robes pickpocket buff
This commit is contained in:
Oven Bread
2023-06-11 08:05:16 +00:00
committed by Ryan
parent 4bd97d002f
commit 7997fbb0b0
3 changed files with 19 additions and 33 deletions
@@ -76,6 +76,7 @@ enum class SkillcapePerks(val attribute: String, val effect: ((Player) -> Unit)?
} }
}), }),
HASTY_COOKING("cape_perks:hasty-cooking"), HASTY_COOKING("cape_perks:hasty-cooking"),
SMOOTH_HANDS("cape_perks:smooth-hands"),
NONE("cape_perks:none") NONE("cape_perks:none")
; ;
@@ -97,7 +98,7 @@ enum class SkillcapePerks(val attribute: String, val effect: ((Player) -> Unit)?
Skillcape.HITPOINTS -> DAMAGE_SPONG Skillcape.HITPOINTS -> DAMAGE_SPONG
Skillcape.AGILITY -> MARATHON_RUNNER Skillcape.AGILITY -> MARATHON_RUNNER
Skillcape.HERBLORE -> NONE Skillcape.HERBLORE -> NONE
Skillcape.THIEVING -> NONE Skillcape.THIEVING -> SMOOTH_HANDS
Skillcape.CRAFTING -> NONE Skillcape.CRAFTING -> NONE
Skillcape.FLETCHING -> NONE Skillcape.FLETCHING -> NONE
Skillcape.SLAYER -> TRICKS_OF_THE_TRADE Skillcape.SLAYER -> TRICKS_OF_THE_TRADE
@@ -1,5 +1,6 @@
package content.global.skill.thieving package content.global.skill.thieving
import content.global.skill.skillcapeperks.SkillcapePerks
import core.api.stun import core.api.stun
import core.game.node.entity.combat.ImpactHandler import core.game.node.entity.combat.ImpactHandler
import core.game.node.entity.impl.Animator import core.game.node.entity.impl.Animator
@@ -24,7 +25,7 @@ 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.0
if(player.inCombat()){ if(player.inCombat()){
player.sendMessage("You can't pickpocket while in combat.") player.sendMessage("You can't pickpocket while in combat.")
@@ -41,10 +42,9 @@ class ThievingListeners : InteractionListener {
return@on true return@on true
} }
if(pickpocketData == Pickpockets.FEMALE_HAM_MEMBER || pickpocketData == Pickpockets.MALE_HAM_MEMBER){ if(SkillcapePerks.isActive(SkillcapePerks.SMOOTH_HANDS, player)) {
successMod += getHAMItemCount(player) successMod += 25
} }
if (player.equipment.contains(Items.GLOVES_OF_SILENCE_10075,1)){ if (player.equipment.contains(Items.GLOVES_OF_SILENCE_10075,1)){
successMod += 3 successMod += 3
} }
@@ -74,24 +74,5 @@ class ThievingListeners : InteractionListener {
return@on true return@on true
} }
}
fun getHAMItemCount(player: Player): Int{
var counter = 0
for(item in player.equipment.toArray()){
item ?: continue
counter += when(item.id){
Items.HAM_LOGO_4306 -> 1
Items.HAM_ROBE_4300 -> 1
Items.HAM_HOOD_4302 -> 1
Items.HAM_CLOAK_4304 -> 1
Items.BOOTS_4310 -> 1
Items.GLOVES_4308 -> 1
else -> 0
} }
} }
return counter
}
}
@@ -1,5 +1,7 @@
package content.region.asgarnia.burthorpe.dialogue; package content.region.asgarnia.burthorpe.dialogue;
import core.api.Container;
import core.api.ContentAPIKt;
import core.cache.def.impl.NPCDefinition; import core.cache.def.impl.NPCDefinition;
import core.game.dialogue.DialoguePlugin; import core.game.dialogue.DialoguePlugin;
import core.game.dialogue.FacialExpression; import core.game.dialogue.FacialExpression;
@@ -12,6 +14,7 @@ import core.game.node.item.Item;
import core.plugin.Plugin; import core.plugin.Plugin;
import core.plugin.Initializable; import core.plugin.Initializable;
import core.plugin.ClassScanner; import core.plugin.ClassScanner;
import org.rs09.consts.Items;
/** /**
* Represents the dialogue used for martin thwait. * Represents the dialogue used for martin thwait.
@@ -141,17 +144,18 @@ public final class MartinThwaitDialogue extends DialoguePlugin {
stage = 34; stage = 34;
return true; return true;
} }
if (!player.getInventory().containsItem(COINS)) { if (!ContentAPIKt.inInventory(player, COINS.getId(), COINS.getAmount())) {
end(); player("Sorry, I don't seem to have enough coins", "with me at this time.");
return true;
}
if (!player.getInventory().remove(COINS)) {
player("Sorry, I don't seem to have enoug coins", "with me at this time.");
stage = 34; stage = 34;
return true; return true;
} }
player.getInventory().add(ITEMS[player.getSkills().getMasteredSkills() > 1 ? 1 : 0], ITEMS[2]); if (ContentAPIKt.removeItem(player, COINS, Container.INVENTORY)) {
ContentAPIKt.addItemOrDrop(player, ITEMS[player.getSkills().getMasteredSkills() > 1 ? 1 : 0].getId(),1);
ContentAPIKt.addItemOrDrop(player, ITEMS[2].getId(),1);
npc("There you go! Enjoy."); npc("There you go! Enjoy.");
} else {
player("Sorry, I don't seem to have enough coins", "with me at this time.");
}
stage = 34; stage = 34;
break; break;
case 34: case 34: