From 575469a3cc401df32888ae055385a9fc79d5fa8a Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 12 Jun 2022 10:03:45 -0400 Subject: [PATCH 1/5] timers: fix showMinigameTeleports check --- .../client/plugins/timers/TimersPlugin.java | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java index 34713ea754..b053601ee3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java @@ -29,7 +29,6 @@ package net.runelite.client.plugins.timers; import com.google.inject.Provides; import java.time.Duration; import java.time.Instant; -import java.time.temporal.ChronoUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.inject.Inject; @@ -146,8 +145,6 @@ public class TimersPlugin extends Plugin private int lastPoisonVarp; private int lastPvpVarb; private int lastCorruptionVarb; - private int lastHomeTeleport; - private int lastMinigameTeleport; private int lastStaminaEffect; private int lastImbuedHeartVarb; private boolean imbuedHeartTimerActive; @@ -202,8 +199,6 @@ public class TimersPlugin extends Plugin staminaTimer = null; imbuedHeartTimerActive = false; lastImbuedHeartVarb = 0; - lastHomeTeleport = 0; - lastMinigameTeleport = 0; lastStaminaEffect = 0; } @@ -217,8 +212,6 @@ public class TimersPlugin extends Plugin int pvpVarb = client.getVarbitValue(Varbits.PVP_SPEC_ORB); int corruptionCooldownVarb = client.getVarbitValue(Varbits.CORRUPTION_COOLDOWN); int imbuedHeartCooldownVarb = client.getVarbitValue(Varbits.IMBUED_HEART_COOLDOWN); - int homeTeleportVarp = client.getVar(VarPlayer.LAST_HOME_TELEPORT); - int minigameTeleportVarp = client.getVar(VarPlayer.LAST_MINIGAME_TELEPORT); int staminaEffectActive = client.getVarbitValue(Varbits.RUN_SLOWED_DEPLETION_ACTIVE); int staminaPotionEffectVarb = client.getVarbitValue(Varbits.STAMINA_EFFECT); int enduranceRingEffectVarb = client.getVarbitValue(Varbits.RING_OF_ENDURANCE_EFFECT); @@ -331,16 +324,14 @@ public class TimersPlugin extends Plugin lastImbuedHeartVarb = imbuedHeartCooldownVarb; } - if (lastHomeTeleport != homeTeleportVarp) + if (event.getIndex() == VarPlayer.LAST_HOME_TELEPORT.getId() && config.showHomeMinigameTeleports()) { checkTeleport(VarPlayer.LAST_HOME_TELEPORT); - lastHomeTeleport = homeTeleportVarp; } - if (lastMinigameTeleport != minigameTeleportVarp) + if (event.getIndex() == VarPlayer.LAST_MINIGAME_TELEPORT.getId() && config.showHomeMinigameTeleports()) { checkTeleport(VarPlayer.LAST_MINIGAME_TELEPORT); - lastMinigameTeleport = minigameTeleportVarp; } // staminaEffectActive is checked to match https://github.com/Joshua-F/cs2-scripts/blob/741271f0c3395048c1bad4af7881a13734516adf/scripts/%5Bproc%2Cbuff_bar_get_value%5D.cs2#L25 @@ -913,7 +904,7 @@ public class TimersPlugin extends Plugin int lastTeleport = client.getVar(varPlayer); long lastTeleportSeconds = (long) lastTeleport * 60; - Instant teleportExpireInstant = Instant.ofEpochSecond(lastTeleportSeconds).plus(teleport.getDuration().getSeconds(), ChronoUnit.SECONDS); + Instant teleportExpireInstant = Instant.ofEpochSecond(lastTeleportSeconds).plus(teleport.getDuration()); Duration remainingTime = Duration.between(Instant.now(), teleportExpireInstant); if (remainingTime.getSeconds() > 0) From fcacf4deeb9050d39922d03b599719e69209a5a8 Mon Sep 17 00:00:00 2001 From: LlemonDuck Date: Fri, 10 Jun 2022 22:50:25 -0400 Subject: [PATCH 2/5] slayer: expose slayer task data in service Co-authored-by: OSRS-Athan <67913155+osrs-athan@users.noreply.github.com> --- .../client/plugins/slayer/SlayerPlugin.java | 7 ++ .../plugins/slayer/SlayerPluginService.java | 49 +++++++++++++ .../slayer/SlayerPluginServiceImpl.java | 72 +++++++++++++++++++ 3 files changed, 128 insertions(+) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPluginService.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPluginServiceImpl.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java index f47c9b9483..43a945d96e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java @@ -26,6 +26,7 @@ package net.runelite.client.plugins.slayer; import com.google.common.annotations.VisibleForTesting; +import com.google.inject.Binder; import com.google.inject.Provides; import java.awt.Color; import java.awt.image.BufferedImage; @@ -222,6 +223,12 @@ public class SlayerPlugin extends Plugin return null; }; + @Override + public void configure(Binder binder) + { + binder.bind(SlayerPluginService.class).to(SlayerPluginServiceImpl.class); + } + @Override protected void startUp() throws Exception { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPluginService.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPluginService.java new file mode 100644 index 0000000000..814542a7fb --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPluginService.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2022, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.slayer; + +import java.util.List; +import javax.annotation.Nullable; +import net.runelite.api.NPC; + +public interface SlayerPluginService +{ + /** + * Get targets for current slayer task + * + * @return pattern list of target npc + */ + List getTargets(); + + @Nullable + String getTask(); + + @Nullable + String getTaskLocation(); + + int getInitialAmount(); + + int getRemainingAmount(); +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPluginServiceImpl.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPluginServiceImpl.java new file mode 100644 index 0000000000..9fd7efa46a --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPluginServiceImpl.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2022, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.plugins.slayer; + +import java.util.List; +import javax.inject.Inject; +import javax.inject.Singleton; +import net.runelite.api.NPC; + +@Singleton +class SlayerPluginServiceImpl implements SlayerPluginService +{ + private final SlayerPlugin plugin; + + @Inject + private SlayerPluginServiceImpl(final SlayerPlugin plugin) + { + this.plugin = plugin; + } + + @Override + public List getTargets() + { + return plugin.getTargets(); + } + + @Override + public String getTask() + { + return plugin.getTaskName(); + } + + @Override + public String getTaskLocation() + { + return plugin.getTaskLocation(); + } + + @Override + public int getInitialAmount() + { + return plugin.getInitialAmount(); + } + + @Override + public int getRemainingAmount() + { + return plugin.getAmount(); + } +} \ No newline at end of file From c669f6462bf9a9bca82befdeb6bc58915b9ed6c4 Mon Sep 17 00:00:00 2001 From: LlemonDuck Date: Fri, 10 Jun 2022 22:51:12 -0400 Subject: [PATCH 3/5] npcaggro: show for current slayer task option Co-authored-by: OSRS-Athan <67913155+osrs-athan@users.noreply.github.com> --- .../npcunaggroarea/NpcAggroAreaConfig.java | 11 +++++++++++ .../npcunaggroarea/NpcAggroAreaPlugin.java | 17 +++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaConfig.java index 1532d075c8..7d895f27bc 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaConfig.java @@ -128,4 +128,15 @@ public interface NpcAggroAreaConfig extends Config { return false; } + + @ConfigItem( + keyName = "showOnSlayerTask", + name = "Show on slayer task", + description = "Enable for current slayer task NPCs", + position = 9 + ) + default boolean showOnSlayerTask() + { + return false; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaPlugin.java index 359d306e7b..dc2aadd5be 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/npcunaggroarea/NpcAggroAreaPlugin.java @@ -57,7 +57,10 @@ import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.game.ItemManager; import net.runelite.client.plugins.Plugin; +import net.runelite.client.plugins.PluginDependency; import net.runelite.client.plugins.PluginDescriptor; +import net.runelite.client.plugins.slayer.SlayerPlugin; +import net.runelite.client.plugins.slayer.SlayerPluginService; import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.infobox.InfoBoxManager; import net.runelite.client.util.WildcardMatcher; @@ -68,6 +71,7 @@ import net.runelite.client.util.WildcardMatcher; tags = {"highlight", "lines", "unaggro", "aggro", "aggressive", "npcs", "area", "slayer"}, enabledByDefault = false ) +@PluginDependency(SlayerPlugin.class) public class NpcAggroAreaPlugin extends Plugin { /* @@ -114,6 +118,9 @@ public class NpcAggroAreaPlugin extends Plugin @Inject private Notifier notifier; + @Inject + private SlayerPluginService slayerPluginService; + @Getter private final WorldPoint[] safeCenters = new WorldPoint[2]; @@ -270,6 +277,15 @@ public class NpcAggroAreaPlugin extends Plugin return false; } + if (config.showOnSlayerTask()) + { + List targets = slayerPluginService.getTargets(); + if (targets.contains(npc)) + { + return true; + } + } + for (String pattern : npcNamePatterns) { if (WildcardMatcher.matches(pattern, npcName)) @@ -381,6 +397,7 @@ public class NpcAggroAreaPlugin extends Plugin switch (key) { case "npcUnaggroAlwaysActive": + case "showOnSlayerTask": recheckActive(); break; case "npcUnaggroCollisionDetection": From a6d122ac97eb36f5d3ec2fd321e699248fa45b61 Mon Sep 17 00:00:00 2001 From: MasonPMGit Date: Sun, 12 Jun 2022 21:45:26 -0500 Subject: [PATCH 4/5] item charges: add bracelet of clay --- .../plugins/itemcharges/ItemChargeConfig.java | 25 +++++++++++++ .../plugins/itemcharges/ItemChargePlugin.java | 36 +++++++++++++++++++ .../plugins/itemcharges/ItemChargeType.java | 3 +- .../plugins/itemcharges/ItemWithConfig.java | 3 +- .../itemcharges/ItemChargePluginTest.java | 34 ++++++++++++++++++ 5 files changed, 99 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java index eb0350e0ad..db554050ef 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java @@ -47,6 +47,7 @@ public interface ItemChargeConfig extends Config String KEY_EXPLORERS_RING = "explorerRing"; String KEY_RING_OF_FORGING = "ringOfForging"; String KEY_BLOOD_ESSENCE = "bloodEssence"; + String KEY_BRACELET_OF_CLAY = "braceletOfClay"; @ConfigSection( name = "Charge Settings", @@ -428,4 +429,28 @@ public interface ItemChargeConfig extends Config { return true; } + + @ConfigItem( + keyName = "showBraceletOfClayCharges", + name = "Bracelet of Clay Charges", + description = "Show Bracelet of Clay item charges", + position = 31, + section = chargesSection + ) + default boolean showBraceletOfClayCharges() + { + return true; + } + + @ConfigItem( + keyName = "braceletOfClayNotification", + name = "Bracelet of Clay Notification", + description = "Send a notification when a Bracelet of Clay breaks", + position = 32, + section = notificationSection + ) + default boolean braceletOfClayNotification() + { + return true; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java index 89ec2dff05..7505d586bb 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java @@ -137,6 +137,11 @@ public class ItemChargePlugin extends Plugin "You manage to extract power from the Blood Essence and craft (\\d{1,3}) extra runes?\\." ); private static final String BLOOD_ESSENCE_ACTIVATE_TEXT = "You activate the blood essence."; + private static final String BRACELET_OF_CLAY_USE_TEXT = "You manage to mine some clay."; + private static final String BRACELET_OF_CLAY_BREAK_TEXT = "Your bracelet of clay crumbles to dust."; + private static final Pattern BRACELET_OF_CLAY_CHECK_PATTERN = Pattern.compile( + "You can mine (\\d{1,2}) more pieces? of soft clay before your bracelet crumbles to dust\\." + ); private static final int MAX_DODGY_CHARGES = 10; private static final int MAX_BINDING_CHARGES = 16; @@ -146,6 +151,7 @@ public class ItemChargePlugin extends Plugin private static final int MAX_AMULET_OF_BOUNTY_CHARGES = 10; private static final int MAX_SLAYER_BRACELET_CHARGES = 30; private static final int MAX_BLOOD_ESSENCE_CHARGES = 1000; + private static final int MAX_BRACELET_OF_CLAY_CHARGES = 28; private int lastExplorerRingCharge = -1; @@ -237,6 +243,7 @@ public class ItemChargePlugin extends Plugin Matcher expeditiousCheckMatcher = EXPEDITIOUS_BRACELET_CHECK_PATTERN.matcher(message); Matcher bloodEssenceCheckMatcher = BLOOD_ESSENCE_CHECK_PATTERN.matcher(message); Matcher bloodEssenceExtractMatcher = BLOOD_ESSENCE_EXTRACT_PATTERN.matcher(message); + Matcher braceletOfClayCheckMatcher = BRACELET_OF_CLAY_CHECK_PATTERN.matcher(message); if (config.recoilNotification() && message.contains(RING_OF_RECOIL_BREAK_MESSAGE)) { @@ -439,6 +446,29 @@ public class ItemChargePlugin extends Plugin { updateBloodEssenceCharges(MAX_BLOOD_ESSENCE_CHARGES); } + else if (braceletOfClayCheckMatcher.find()) + { + updateBraceletOfClayCharges(Integer.parseInt(braceletOfClayCheckMatcher.group(1))); + } + else if (message.equals(BRACELET_OF_CLAY_USE_TEXT)) + { + final ItemContainer equipment = client.getItemContainer(InventoryID.EQUIPMENT); + + // Determine if the player mined with a Bracelet of Clay equipped. + if (equipment != null && equipment.contains(ItemID.BRACELET_OF_CLAY)) + { + int charges = Ints.constrainToRange(getItemCharges(ItemChargeConfig.KEY_BRACELET_OF_CLAY) - 1, 0, MAX_BRACELET_OF_CLAY_CHARGES); + updateBraceletOfClayCharges(charges); + } + } + else if (message.equals(BRACELET_OF_CLAY_BREAK_TEXT)) + { + if (config.braceletOfClayNotification()) + { + notifier.notify("Your bracelet of clay has crumbled to dust"); + } + updateBraceletOfClayCharges(MAX_BRACELET_OF_CLAY_CHARGES); + } } } @@ -572,6 +602,12 @@ public class ItemChargePlugin extends Plugin updateInfoboxes(); } + private void updateBraceletOfClayCharges(final int value) + { + setItemCharges(ItemChargeConfig.KEY_BRACELET_OF_CLAY, value); + updateInfoboxes(); + } + private void checkDestroyWidget() { final int currentTick = client.getTickCount(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeType.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeType.java index 3178fa9953..1d4548a368 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeType.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeType.java @@ -52,7 +52,8 @@ enum ItemChargeType RING_OF_FORGING(ItemChargeConfig::showRingOfForgingCount), POTION(ItemChargeConfig::showPotionDoseCount), GUTHIX_REST(ItemChargeConfig::showGuthixRestDoses), - BLOOD_ESSENCE(ItemChargeConfig::showBloodEssenceCharges); + BLOOD_ESSENCE(ItemChargeConfig::showBloodEssenceCharges), + BRACELET_OF_CLAY(ItemChargeConfig::showBraceletOfClayCharges); private final Predicate enabled; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemWithConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemWithConfig.java index 581410c1f9..bdafd8e62d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemWithConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemWithConfig.java @@ -47,7 +47,8 @@ enum ItemWithConfig BRACELET_OF_SLAUGHTER(ItemID.BRACELET_OF_SLAUGHTER, ItemChargeConfig.KEY_BRACELET_OF_SLAUGHTER, ItemChargeType.BRACELET_OF_SLAUGHTER), EXPEDITIOUS_BRACELET(ItemID.EXPEDITIOUS_BRACELET, ItemChargeConfig.KEY_EXPEDITIOUS_BRACELET, ItemChargeType.EXPEDITIOUS_BRACELET), CHRONICLE(ItemID.CHRONICLE, ItemChargeConfig.KEY_CHRONICLE, ItemChargeType.TELEPORT), - BLOOD_ESSENCE(ItemID.BLOOD_ESSENCE_ACTIVE, ItemChargeConfig.KEY_BLOOD_ESSENCE, ItemChargeType.BLOOD_ESSENCE); + BLOOD_ESSENCE(ItemID.BLOOD_ESSENCE_ACTIVE, ItemChargeConfig.KEY_BLOOD_ESSENCE, ItemChargeType.BLOOD_ESSENCE), + BRACELET_OF_CLAY(ItemID.BRACELET_OF_CLAY, ItemChargeConfig.KEY_BRACELET_OF_CLAY, ItemChargeType.BRACELET_OF_CLAY); private final int itemId; private final String configKey; diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/itemcharges/ItemChargePluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/itemcharges/ItemChargePluginTest.java index 464ec09bad..f111286e44 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/itemcharges/ItemChargePluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/itemcharges/ItemChargePluginTest.java @@ -96,6 +96,9 @@ public class ItemChargePluginTest private static final String ACTIVATE_BLOOD_ESSENCE = "You activate the blood essence."; private static final String EXTRACT_BLOOD_ESSENCE = "You manage to extract power from the Blood Essence and craft 67 extra runes."; private static final String CHECK_BLOOD_ESSENCE = "Your blood essence has 56 charges remaining"; + private static final String CHECK_BRACELET_OF_CLAY = "You can mine 13 more pieces of soft clay before your bracelet crumbles to dust."; + private static final String USED_BRACELET_OF_CLAY = "You manage to mine some clay."; + private static final String BREAK_BRACELET_OF_CLAY = "Your bracelet of clay crumbles to dust."; @Mock @Bind @@ -450,4 +453,35 @@ public class ItemChargePluginTest itemChargePlugin.onChatMessage(chatMessage); verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_BLOOD_ESSENCE, 56); } + + @Test + public void testBraceletOfClayCheck() + { + ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHECK_BRACELET_OF_CLAY, "", 0); + itemChargePlugin.onChatMessage(chatMessage); + verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_BRACELET_OF_CLAY, 13); + } + + @Test + public void testBraceletOfClayUsed() + { + when(configManager.getRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_BRACELET_OF_CLAY, Integer.class)).thenReturn(25); + // Create equipment inventory with bracelet of clay + ItemContainer equipmentItemContainer = mock(ItemContainer.class); + when(client.getItemContainer(InventoryID.EQUIPMENT)).thenReturn(equipmentItemContainer); + when(equipmentItemContainer.contains(ItemID.BRACELET_OF_CLAY)).thenReturn(true); + when(equipmentItemContainer.getItems()).thenReturn(new Item[0]); + // Run message + ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", USED_BRACELET_OF_CLAY, "", 0); + itemChargePlugin.onChatMessage(chatMessage); + verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_BRACELET_OF_CLAY, 24); + } + + @Test + public void testBraceletOfClayBreak() + { + ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BREAK_BRACELET_OF_CLAY, "", 0); + itemChargePlugin.onChatMessage(chatMessage); + verify(configManager).setRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_BRACELET_OF_CLAY, 28); + } } \ No newline at end of file From 0980331e1b4a0c0b923359225406b8b12a6db5a3 Mon Sep 17 00:00:00 2001 From: MasonPMGit Date: Mon, 13 Jun 2022 20:04:37 -0500 Subject: [PATCH 5/5] clues: Allow Daeyalt essence for runecrafting skill challenges --- .../client/plugins/cluescrolls/clues/SkillChallengeClue.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/SkillChallengeClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/SkillChallengeClue.java index 01c34a68c6..8c145c6c7f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/SkillChallengeClue.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/SkillChallengeClue.java @@ -145,7 +145,7 @@ public class SkillChallengeClue extends ClueScroll implements NpcClueScroll, Nam any("Water Rune x15", xOfItem(ItemID.WATER_RUNE, 15), xOfItem(ItemID.MIST_RUNE, 15), xOfItem(ItemID.MUD_RUNE, 15), xOfItem(ItemID.STEAM_RUNE, 15), item(ItemID.STAFF_OF_WATER), item(ItemID.WATER_BATTLESTAFF), item(ItemID.MYSTIC_WATER_STAFF), item(ItemID.MUD_BATTLESTAFF), item(ItemID.MYSTIC_MUD_STAFF), item(ItemID.MIST_BATTLESTAFF), item(ItemID.MYSTIC_MIST_STAFF), item(ItemID.STEAM_BATTLESTAFF), item(ItemID.MYSTIC_STEAM_STAFF), item(ItemID.STEAM_BATTLESTAFF_12795), item(ItemID.MYSTIC_STEAM_STAFF_12796), item(ItemID.KODAI_WAND), item(ItemID.TOME_OF_WATER)), any("Earth Rune x15", xOfItem(ItemID.EARTH_RUNE, 15), xOfItem(ItemID.DUST_RUNE, 15), xOfItem(ItemID.MUD_RUNE, 15), xOfItem(ItemID.LAVA_RUNE, 15), item(ItemID.STAFF_OF_EARTH), item(ItemID.EARTH_BATTLESTAFF), item(ItemID.MYSTIC_EARTH_STAFF), item(ItemID.MUD_BATTLESTAFF), item(ItemID.MYSTIC_MUD_STAFF), item(ItemID.DUST_BATTLESTAFF), item(ItemID.MYSTIC_DUST_STAFF), item(ItemID.LAVA_BATTLESTAFF), item(ItemID.MYSTIC_LAVA_STAFF), item(ItemID.LAVA_BATTLESTAFF_21198), item(ItemID.MYSTIC_LAVA_STAFF_21200)), any("Unenchanted Dragonstone Jewellery", item(ItemID.DRAGONSTONE_RING), item(ItemID.DRAGON_NECKLACE), item(ItemID.DRAGONSTONE_BRACELET), item(ItemID.DRAGONSTONE_AMULET))), - new SkillChallengeClue("Craft a nature rune.", item(ItemID.PURE_ESSENCE)), + new SkillChallengeClue("Craft a nature rune.", any("Pure essence or Daeyalt essence", item(ItemID.PURE_ESSENCE), item(ItemID.DAEYALT_ESSENCE))), new SkillChallengeClue("Catch a mottled eel with aerial fishing in Lake Molch.", any("Fish chunks or King worms", item(ItemID.FISH_CHUNKS), item(ItemID.KING_WORM)), emptySlot("No Gloves", EquipmentInventorySlot.GLOVES), any("No Weapon", emptySlot("", EquipmentInventorySlot.WEAPON), item(ItemID.CORMORANTS_GLOVE), item(ItemID.CORMORANTS_GLOVE_22817)), emptySlot("No Shield", EquipmentInventorySlot.SHIELD)), new SkillChallengeClue("Score a goal in skullball.", true, any("Ring of Charos", item(ItemID.RING_OF_CHAROS), item(ItemID.RING_OF_CHAROSA))), new SkillChallengeClue("Complete a lap of Ape atoll agility course.", true, any("Ninja Monkey Greegree", item(ItemID.NINJA_MONKEY_GREEGREE), item(ItemID.NINJA_MONKEY_GREEGREE_4025), item(ItemID.KRUK_MONKEY_GREEGREE))), @@ -198,7 +198,7 @@ public class SkillChallengeClue extends ClueScroll implements NpcClueScroll, Nam new SkillChallengeClue("Fix a magical lamp in Dorgesh-Kaan.", new String[] { "Broken lamp" }, new int[] { 10834, 10835 }, item(ItemID.LIGHT_ORB)), new SkillChallengeClue("Burn a yew log.", item(ItemID.YEW_LOGS), item(ItemID.TINDERBOX)), new SkillChallengeClue("Cook a swordfish", "cook a swordfish", item(ItemID.RAW_SWORDFISH)), - new SkillChallengeClue("Craft multiple cosmic runes from a single essence.", item(ItemID.PURE_ESSENCE)), + new SkillChallengeClue("Craft multiple cosmic runes from a single essence.", any("Pure essence or Daeyalt essence", item(ItemID.PURE_ESSENCE), item(ItemID.DAEYALT_ESSENCE))), new SkillChallengeClue("Plant a watermelon seed.", item(ItemID.RAKE), item(ItemID.SEED_DIBBER), xOfItem(ItemID.WATERMELON_SEED, 3)), new SkillChallengeClue("Activate the Chivalry prayer."), new SkillChallengeClue("Hand in a Tier 2 or higher set of Shayzien supply armour. (Requires 11 lovakite bars)", "take the lovakengj armourers a boxed set of shayzien supply armour at tier 2 or above.", any("Shayzien Supply Set (Tier 2 or higher)", item(ItemID.SHAYZIEN_SUPPLY_SET_2), item(ItemID.SHAYZIEN_SUPPLY_SET_3), item(ItemID.SHAYZIEN_SUPPLY_SET_4), item(ItemID.SHAYZIEN_SUPPLY_SET_5))),