From 853e565ace6a6efbf973e184ceab280b3eadbd63 Mon Sep 17 00:00:00 2001 From: Kyleeld <48519776+Kyleeld@users.noreply.github.com> Date: Wed, 15 May 2019 01:57:06 +0100 Subject: [PATCH] Various Plugin Additions / Fixes(#249) * updates high alch profit highlighter moveable multi combat widget pvp prayer rework individual prayer rework --- .../net/runelite/api/widgets/WidgetID.java | 2 + .../net/runelite/api/widgets/WidgetInfo.java | 4 + .../freezetimers/FreezeTimersOverlay.java | 16 + .../HidePrayersINDIVIDUALConfig.java | 396 +++++++++++++++++ .../HidePrayersINDIVIDUALPlugin.java | 420 ++++++++++++++++++ .../hideprayers/PVM/HidePrayersPVMPlugin.java | 5 + .../hideprayers/PVP/CombatPrayers.java | 59 +++ .../hideprayers/PVP/HidePrayersPVPConfig.java | 226 +--------- .../hideprayers/PVP/HidePrayersPVPPlugin.java | 348 +++++++++------ .../highalchemy/HighAlchemyConfig.java | 99 +++++ .../highalchemy/HighAlchemyOverlay.java | 133 ++++++ .../highalchemy/HighAlchemyPlugin.java | 128 ++++++ .../client/ui/overlay/WidgetOverlay.java | 2 + 13 files changed, 1483 insertions(+), 355 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/INDIVIDUAL/HidePrayersINDIVIDUALConfig.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/INDIVIDUAL/HidePrayersINDIVIDUALPlugin.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/PVP/CombatPrayers.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/highalchemy/HighAlchemyConfig.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/highalchemy/HighAlchemyOverlay.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/highalchemy/HighAlchemyPlugin.java diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index dc461ef773..effa4e462f 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -352,6 +352,7 @@ public class WidgetID { static final int MINIMAP = 3; static final int MINIMAP_DRAW_AREA = 8; + static final int MULTICOMBAT_INDICATOR = 20; static final int CLAN_CHAT_TAB = 31; static final int FRIENDS_TAB = 33; static final int IGNORES_TAB = 32; @@ -389,6 +390,7 @@ public class WidgetID static class ResizableViewport { static final int ITEMS_KEPT_ON_DEATH = 13; + static final int MULTICOMBAT_INDICATOR = 16; static final int CLAN_CHAT_TAB = 35; static final int FRIENDS_TAB = 37; static final int IGNORES_TAB = 36; diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java index dfc8b7bf50..51c771c0c5 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java @@ -665,6 +665,10 @@ public enum WidgetInfo SKOTIZO_CONTAINER(WidgetID.SKOTIZO_GROUP_ID, WidgetID.Skotizo.CONTAINER), + MULTICOMBAT_FIXED(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.MULTICOMBAT_INDICATOR), + MULTICOMBAT_RESIZEABLE(WidgetID.RESIZABLE_VIEWPORT_BOTTOM_LINE_GROUP_ID, WidgetID.ResizableViewport.MULTICOMBAT_INDICATOR), + + FULLSCREEN_MAP_ROOT(WidgetID.FULLSCREEN_MAP_GROUP_ID, WidgetID.FullScreenMap.ROOT), QUESTLIST_BOX(WidgetID.QUESTLIST_GROUP_ID, WidgetID.QuestList.BOX), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FreezeTimersOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FreezeTimersOverlay.java index c0252b19bf..5054c12b98 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FreezeTimersOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/freezetimers/FreezeTimersOverlay.java @@ -113,6 +113,10 @@ public class FreezeTimersOverlay extends Overlay private boolean drawTBOverlay(Graphics2D g, Actor actor, int overlaysDrawn) { long currentTick = System.currentTimeMillis(); + if (!config.TB()) + { + return false; + } if (timers.getTimerEnd(actor, TimerType.TELEBLOCK) <= currentTick) { return false; @@ -135,6 +139,10 @@ public class FreezeTimersOverlay extends Overlay { renderTextLocation(g, " | " + text, 11, Font.BOLD, Color.CYAN, FixedPoint); } + if (timers.getTimerEnd(actor, TimerType.VENG) >= currentTick) + { + renderTextLocation(g, " | " + text, 11, Font.BOLD, Color.CYAN, FixedPoint); + } } else { @@ -146,6 +154,10 @@ public class FreezeTimersOverlay extends Overlay private boolean drawVengOverlay(Graphics2D g, Actor actor, int overlaysDrawn) { long currentTick = System.currentTimeMillis(); + if (!config.Veng()) + { + return false; + } if (timers.getTimerEnd(actor, TimerType.VENG) <= currentTick) { return false; @@ -167,6 +179,10 @@ public class FreezeTimersOverlay extends Overlay { renderTextLocation(g, text + " | ", 11, Font.BOLD, Color.RED, FixedPoint); } + if (timers.getTimerEnd(actor, TimerType.TELEBLOCK) >= currentTick) + { + renderTextLocation(g, text + " | ", 11, Font.BOLD, Color.RED, FixedPoint); + } } else { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/INDIVIDUAL/HidePrayersINDIVIDUALConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/INDIVIDUAL/HidePrayersINDIVIDUALConfig.java new file mode 100644 index 0000000000..a93d794548 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/INDIVIDUAL/HidePrayersINDIVIDUALConfig.java @@ -0,0 +1,396 @@ +/* + * Copyright (c) 2018, https://runelitepl.us + * Copyright (c) 2019, Kyle + * Copyright (c) 2018, Raiever + * 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.hideprayers.INDIVIDUAL; + +import net.runelite.client.config.Config; +import net.runelite.client.config.ConfigGroup; +import net.runelite.client.config.ConfigItem; + +@ConfigGroup("hideprayersINDIVIDUAL") +public interface HidePrayersINDIVIDUALConfig extends Config +{ + @ConfigItem + ( + position = 0, + keyName = "pk prayers", + name = "Hide Prayers", + description = "Hide/Show Prayers." + ) + default boolean showINDIVIDUALPrayers() + { + return false; + } + + @ConfigItem + ( + position = 1, + keyName = "thickskin", + name = "Hide Thick Skin", + description = "Hide/Show Thick Skin" + ) + default boolean HideTHICK_SKIN() + { + return false; + } + + @ConfigItem + ( + position = 2, + keyName = "burstofstrength", + name = "Hide Burst of Strength", + description = "Hide/Show Burst of Strength" + ) + default boolean HideBURST_OF_STRENGTH() + { + return false; + } + + @ConfigItem + ( + position = 3, + keyName = "clarityofthought", + name = "Hide Clarity of Thought", + description = "Hide/Show Clarity of Thought" + ) + default boolean HideCLARITY_OF_THOUGHT() + { + return false; + } + + @ConfigItem + ( + position = 4, + keyName = "sharpeye", + name = "Hide Sharp Eye", + description = "Hide/Show Sharp Eye" + ) + default boolean HideSHARP_EYE() + { + return false; + } + + @ConfigItem + ( + position = 5, + keyName = "mysticwill", + name = "Hide Mystic Will", + description = "Hide/Show Mystic Will" + ) + default boolean HideMYSTIC_WILL() + { + return false; + } + + @ConfigItem + ( + position = 6, + keyName = "rockskin", + name = "Hide Rock Skin", + description = "Hide/Show Rock Skin" + ) + default boolean HideROCK_SKIN() + { + return false; + } + + @ConfigItem + ( + position = 7, + keyName = "superhumanstrength", + name = "Hide Super Human Strength", + description = "Hide/Show Super Human Strength" + ) + default boolean HideSUPERHUMAN_STRENGTH() + { + return false; + } + + @ConfigItem + ( + position = 8, + keyName = "improvedreflexes", + name = "Hide Improved_Reflexes", + description = "Hide/Show Improved_Reflexes" + ) + default boolean HideIMPROVED_REFLEXES() + { + return false; + } + + @ConfigItem + ( + position = 9, + keyName = "rapidrestore", + name = "Hide Rapid Restore", + description = "Hide/Show Rapid Restore" + ) + default boolean HideRapidRestore() + { + return false; + } + + @ConfigItem + ( + position = 10, + keyName = "rapidheal", + name = "Hide Rapid Heal", + description = "Hide/Show Rapid Heal" + ) + default boolean HideRapidHeal() + { + return false; + } + @ConfigItem + ( + position = 11, + keyName = "protectitem", + name = "Hide Protect Item", + description = "Hide/Show Protect Item" + ) + default boolean HideProtectItem() + { + return false; + } + + @ConfigItem + ( + position = 12, + keyName = "hawkeye", + name = "Hide Hawk Eye", + description = "Hide/Show Hawk Eye" + ) + default boolean HideHAWK_EYE() + { + return false; + } + + @ConfigItem + ( + position = 13, + keyName = "mysticlore", + name = "Hide Mystic Lore", + description = "Hide/Show Mystic Lore" + ) + default boolean HideMYSTIC_LORE() + { + return false; + } + + + @ConfigItem + ( + position = 14, + keyName = "steelskin", + name = "Hide Steel Skin", + description = "Hide/Show Steel skin" + ) + default boolean HideSteelSkin() + { + return false; + } + + @ConfigItem + ( + position = 15, + keyName = "ultimatestrength", + name = "Hide Ultimate Strength", + description = "Hide/Show Ultimate strength" + ) + default boolean HideUltimateStrength() + { + return false; + } + + @ConfigItem + ( + position = 16, + keyName = "incrediblereflex", + name = "Hide Incredible Reflex", + description = "Hide/Show Incredible Reflex" + ) + default boolean HideIncredibleReflex() + { + return false; + } + + @ConfigItem + ( + position = 17, + keyName = "PTFMagic", + name = "Hide Protect From Magic", + description = "Hide/Show Protect From Magic" + ) + default boolean HidePTFMagic() + { + return false; + } + + @ConfigItem + ( + position = 18, + keyName = "PTFRange", + name = "Hide Protect From Range", + description = "Hide/Show Protect from Range" + ) + default boolean HidePTFRange() + { + return false; + } + + @ConfigItem + ( + position = 19, + keyName = "PTFMelee", + name = "Hide Protect From Melee", + description = "Hide/Show Protect From Melee" + ) + default boolean HidePTFMelee() + { + return false; + } + + @ConfigItem + ( + position = 20, + keyName = "eagle", + name = "Hide Eagle Eye", + description = "Hide/Show Eagle Eye" + ) + default boolean HideEagle() + { + return false; + } + + @ConfigItem + ( + position = 19, + keyName = "mystic", + name = "Hide Mystic Might", + description = "Hide/Show Mystic Might" + ) + default boolean HideMystic() + { + return false; + } + + @ConfigItem + ( + position = 21, + keyName = "Retribution", + name = "Hide Retribution", + description = "Hide/Show Retribution" + ) + default boolean HideRETRIBUTION() + { + return false; + } + + @ConfigItem + ( + position = 22, + keyName = "redemption", + name = "Hide Redemption", + description = "Hide/Show Redemption" + ) + default boolean HideRedemption() + { + return false; + } + + @ConfigItem + ( + position = 23, + keyName = "smite", + name = "Hide Smite", + description = "Hide/Show Smite" + ) + default boolean HideSmite() + { + return false; + } + + @ConfigItem + ( + position = 24, + keyName = "preserve", + name = "Hide Preserve", + description = "Hide/Show Preserve" + ) + default boolean HidePreserve() + { + return false; + } + + @ConfigItem + ( + position = 25, + keyName = "Chivalry", + name = "Hide Chivalry", + description = "Hide/Show Chivalry" + ) + default boolean HideChivalry() + { + return false; + } + + @ConfigItem + ( + position = 26, + keyName = "Piety", + name = "Hide Piety", + description = "Hide/Show Piety" + ) + default boolean HidePiety() + { + return false; + } + + @ConfigItem + ( + position = 27, + keyName = "Rigour", + name = "Hide Rigour", + description = "Hide/Show Rigour" + ) + default boolean HideRigour() + { + return false; + } + + @ConfigItem + ( + position = 28, + keyName = "Augury", + name = "Hide Augury", + description = "Hide/Show Augury" + ) + default boolean HideAugury() + { + return false; + } +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/INDIVIDUAL/HidePrayersINDIVIDUALPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/INDIVIDUAL/HidePrayersINDIVIDUALPlugin.java new file mode 100644 index 0000000000..84ff040b04 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/INDIVIDUAL/HidePrayersINDIVIDUALPlugin.java @@ -0,0 +1,420 @@ +/* + * Copyright (c) 2018, https://runelitepl.us + * Copyright (c) 2019, Kyle + * Copyright (c) 2018, Raiever + * 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.hideprayers.INDIVIDUAL; + +import com.google.common.collect.ImmutableList; +import com.google.inject.Provides; +import net.runelite.api.*; +import net.runelite.api.events.ConfigChanged; +import net.runelite.api.events.GameStateChanged; +import net.runelite.api.events.WidgetLoaded; +import net.runelite.api.widgets.Widget; +import net.runelite.api.widgets.WidgetID; +import net.runelite.api.widgets.WidgetInfo; +import net.runelite.client.config.ConfigManager; +import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.plugins.Plugin; +import net.runelite.client.plugins.PluginDescriptor; +import net.runelite.client.plugins.PluginManager; +import net.runelite.client.plugins.PluginType; +import net.runelite.client.plugins.hideprayers.util.PrayerTabStates; +import javax.inject.Inject; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +@PluginDescriptor + ( + name = "Show/Hide INDIVIDUAL Prayers", + description = "Hides specific Prayers in the Prayer tab individually.", + enabledByDefault = false, + type = PluginType.UTILITY + ) + +public class HidePrayersINDIVIDUALPlugin extends Plugin +{ + private static final int PRAYER_COUNT = Prayer.values().length; + + private static final List PRAYER_WIDGET_INFO_LIST = ImmutableList.of + ( + WidgetInfo.PRAYER_THICK_SKIN, //0 + WidgetInfo.PRAYER_BURST_OF_STRENGTH, //1 + WidgetInfo.PRAYER_CLARITY_OF_THOUGHT, //2 + WidgetInfo.PRAYER_SHARP_EYE, //3 + WidgetInfo.PRAYER_MYSTIC_WILL, //4 + WidgetInfo.PRAYER_ROCK_SKIN, //5 + WidgetInfo.PRAYER_SUPERHUMAN_STRENGTH, //6 + WidgetInfo.PRAYER_IMPROVED_REFLEXES, //7 + WidgetInfo.PRAYER_RAPID_RESTORE, //8 + WidgetInfo.PRAYER_RAPID_HEAL, //9 + WidgetInfo.PRAYER_PROTECT_ITEM, //10 + WidgetInfo.PRAYER_HAWK_EYE, //11 + WidgetInfo.PRAYER_MYSTIC_LORE, //12 + WidgetInfo.PRAYER_STEEL_SKIN, //13 + WidgetInfo.PRAYER_ULTIMATE_STRENGTH, //14 + WidgetInfo.PRAYER_INCREDIBLE_REFLEXES, //15 + WidgetInfo.PRAYER_PROTECT_FROM_MAGIC, //16 + WidgetInfo.PRAYER_PROTECT_FROM_MISSILES, //17 + WidgetInfo.PRAYER_PROTECT_FROM_MELEE, //18 + WidgetInfo.PRAYER_EAGLE_EYE, //19 + WidgetInfo.PRAYER_MYSTIC_MIGHT, //20 + WidgetInfo.PRAYER_RETRIBUTION, //21 + WidgetInfo.PRAYER_REDEMPTION, //22 + WidgetInfo.PRAYER_SMITE, //23 + WidgetInfo.PRAYER_PRESERVE, //24 + WidgetInfo.PRAYER_CHIVALRY, //25 + WidgetInfo.PRAYER_PIETY, //26 + WidgetInfo.PRAYER_RIGOUR, //27 + WidgetInfo.PRAYER_AUGURY //28 + ); + + @Inject + private Client client; + + @Inject + private HidePrayersINDIVIDUALConfig config; + + @Inject + private ConfigManager configManager; + + @Provides + HidePrayersINDIVIDUALConfig provideConfig(ConfigManager configManager) + { + return configManager.getConfig(HidePrayersINDIVIDUALConfig.class); + } + + @Override + protected void startUp() throws Exception + { + hidePrayers(); + configManager.setConfiguration("runelite", "hideprayerspvmplugin", false); + configManager.setConfiguration("runelite", "hideprayerspvpplugin", false); + } + + @Override + protected void shutDown() throws Exception + { + restorePrayers(); + } + + @Subscribe + public void onGameStateChanged(GameStateChanged event) + { + if (event.getGameState() == GameState.LOGGED_IN) + { + hidePrayers(); + } + } + + @Subscribe + public void onConfigChanged(ConfigChanged event) + { + if (event.getGroup().equals("hideprayersINDIVIDUAL")) + { + hidePrayers(); + } + } + + @Subscribe + public void onWidgetLoaded(WidgetLoaded event) + { + if (event.getGroupId() == WidgetID.PRAYER_GROUP_ID || event.getGroupId() == WidgetID.QUICK_PRAYERS_GROUP_ID) + { + hidePrayers(); + } + } + + private PrayerTabStates getPrayerTabState() + { + HashTable componentTable = client.getComponentTable(); + for (WidgetNode widgetNode : componentTable.getNodes()) + { + if (widgetNode.getId() == WidgetID.PRAYER_GROUP_ID) + { + return PrayerTabStates.PRAYERS; + } else if (widgetNode.getId() == WidgetID.QUICK_PRAYERS_GROUP_ID) + { + return PrayerTabStates.QUICK_PRAYERS; + } + } + return PrayerTabStates.NONE; + } + + private void restorePrayers() + { + if (client.getGameState() != GameState.LOGGED_IN) + return; + + PrayerTabStates prayerTabState = getPrayerTabState(); + + if (prayerTabState == PrayerTabStates.PRAYERS) { + List prayerWidgets = PRAYER_WIDGET_INFO_LIST.stream().map(client::getWidget) + .filter(Objects::nonNull).collect(Collectors.toList()); + + if (prayerWidgets.size() != PRAYER_WIDGET_INFO_LIST.size()) + return; + + for (int index = 0; index < PRAYER_COUNT; index++) + prayerWidgets.get(Prayer.values()[index].ordinal()).setHidden(false); + } + } + + private void hidePrayers() + { + if (client.getGameState() != GameState.LOGGED_IN) + return; + + PrayerTabStates prayerTabState = getPrayerTabState(); + + if (prayerTabState == PrayerTabStates.PRAYERS) + { + List prayerWidgets = PRAYER_WIDGET_INFO_LIST.stream().map(client::getWidget) + .filter(Objects::nonNull).collect(Collectors.toList()); + + if (prayerWidgets.size() != PRAYER_WIDGET_INFO_LIST.size()) + return; + + for (int index = 0; index < PRAYER_COUNT; index++) + { + Prayer prayer = Prayer.values()[index]; + Widget prayerWidget = prayerWidgets.get(prayer.ordinal()); + + if (!config.showINDIVIDUALPrayers() + && !config.HideTHICK_SKIN() + && !config.HideBURST_OF_STRENGTH() + && !config.HideCLARITY_OF_THOUGHT() + && !config.HideSHARP_EYE() + && !config.HideMYSTIC_WILL() + && !config.HideROCK_SKIN() + && !config.HideSUPERHUMAN_STRENGTH() + && !config.HideIMPROVED_REFLEXES() + && !config.HideRapidRestore() + && !config.HideRapidHeal() + && !config.HideProtectItem() + && !config.HideHAWK_EYE() + && !config.HideMYSTIC_LORE() + && !config.HideSteelSkin() + && !config.HideUltimateStrength() + && !config.HideIncredibleReflex() + && !config.HidePTFMagic() + && !config.HidePTFRange() + && !config.HidePTFMelee() + && !config.HideEagle() + && !config.HideMystic() + && !config.HideRETRIBUTION() + && !config.HideRedemption() + && !config.HideSmite() + && !config.HidePreserve() + && !config.HideChivalry() + && !config.HidePiety() + && !config.HideRigour() + && !config.HideAugury()) + prayerWidget.setHidden(false); + + if (config.showINDIVIDUALPrayers()) + { + prayerWidget.setHidden(true); + prayerWidgets.get(Prayer.values()[0].ordinal()).setHidden(false); // Thick Skin + prayerWidgets.get(Prayer.values()[1].ordinal()).setHidden(false); // Burst of Strength + prayerWidgets.get(Prayer.values()[2].ordinal()).setHidden(false); // Clarity of Thought + prayerWidgets.get(Prayer.values()[3].ordinal()).setHidden(false); // Sharp Eye + prayerWidgets.get(Prayer.values()[4].ordinal()).setHidden(false); // Mystic Will + prayerWidgets.get(Prayer.values()[5].ordinal()).setHidden(false); // Rock Skin + prayerWidgets.get(Prayer.values()[6].ordinal()).setHidden(false); // Super Human Strength + prayerWidgets.get(Prayer.values()[7].ordinal()).setHidden(false); // Improved Reflexed + prayerWidgets.get(Prayer.values()[8].ordinal()).setHidden(false); // Rapid Restore + prayerWidgets.get(Prayer.values()[9].ordinal()).setHidden(false); // Rapid Heal + prayerWidgets.get(Prayer.values()[10].ordinal()).setHidden(false); // Protect Item + prayerWidgets.get(Prayer.values()[11].ordinal()).setHidden(false); // Hawk Eye + prayerWidgets.get(Prayer.values()[12].ordinal()).setHidden(false); // Mystic Lore + prayerWidgets.get(Prayer.values()[13].ordinal()).setHidden(false); // Steel Skin + prayerWidgets.get(Prayer.values()[14].ordinal()).setHidden(false); // Ultimate Strength + prayerWidgets.get(Prayer.values()[15].ordinal()).setHidden(false); // Incredible Reflexes + prayerWidgets.get(Prayer.values()[16].ordinal()).setHidden(false); // Protect from Magic + prayerWidgets.get(Prayer.values()[17].ordinal()).setHidden(false); // Protect from Range + prayerWidgets.get(Prayer.values()[18].ordinal()).setHidden(false); // Protect from Melee + prayerWidgets.get(Prayer.values()[19].ordinal()).setHidden(false); // Eagle Eye + prayerWidgets.get(Prayer.values()[20].ordinal()).setHidden(false); // Mystic Might + prayerWidgets.get(Prayer.values()[21].ordinal()).setHidden(false); // Retribution + prayerWidgets.get(Prayer.values()[22].ordinal()).setHidden(false); // Redemption + prayerWidgets.get(Prayer.values()[23].ordinal()).setHidden(false); // Smite + prayerWidgets.get(Prayer.values()[24].ordinal()).setHidden(false); // Preserve + prayerWidgets.get(Prayer.values()[25].ordinal()).setHidden(false); // Chivalry + prayerWidgets.get(Prayer.values()[26].ordinal()).setHidden(false); // Piety + prayerWidgets.get(Prayer.values()[27].ordinal()).setHidden(false); // Rigour + prayerWidgets.get(Prayer.values()[28].ordinal()).setHidden(false); // Augury + + if (config.HideTHICK_SKIN()) + { + prayerWidgets.get(Prayer.values()[0].ordinal()).setHidden(true); // Thick Skin + } + + if (config.HideBURST_OF_STRENGTH()) + { + prayerWidgets.get(Prayer.values()[1].ordinal()).setHidden(true); // Burst of Strength + } + + if (config.HideCLARITY_OF_THOUGHT()) + { + prayerWidgets.get(Prayer.values()[2].ordinal()).setHidden(true); // Clarity of Thought + } + + if (config.HideSHARP_EYE()) + { + prayerWidgets.get(Prayer.values()[3].ordinal()).setHidden(true); // Thick Skin + } + + if (config.HideMYSTIC_WILL()) + { + prayerWidgets.get(Prayer.values()[4].ordinal()).setHidden(true); // Mystic Will + } + + if (config.HideROCK_SKIN()) + { + prayerWidgets.get(Prayer.values()[5].ordinal()).setHidden(true); // Rock Skin + } + + if (config.HideSUPERHUMAN_STRENGTH()) + { + prayerWidgets.get(Prayer.values()[6].ordinal()).setHidden(true); // Super Human Strength + } + + if (config.HideIMPROVED_REFLEXES()) + { + prayerWidgets.get(Prayer.values()[7].ordinal()).setHidden(true); // Improved_Reflexes + } + + if (config.HideRapidRestore()) + { + prayerWidgets.get(Prayer.values()[8].ordinal()).setHidden(true); // Rapid Restore + } + + if (config.HideRapidHeal()) + { + prayerWidgets.get(Prayer.values()[9].ordinal()).setHidden(true); // Rapid Heal + } + + if (config.HideProtectItem()) + { + prayerWidgets.get(Prayer.values()[10].ordinal()).setHidden(true); // Protect Item + } + + if (config.HideHAWK_EYE()) + { + prayerWidgets.get(Prayer.values()[11].ordinal()).setHidden(true); // Hawk Eye + } + + if (config.HideProtectItem()) + { + prayerWidgets.get(Prayer.values()[12].ordinal()).setHidden(true); // Mystic Lore + } + + if (config.HideSteelSkin()) + { + prayerWidgets.get(Prayer.values()[13].ordinal()).setHidden(true); // Steel Skin + } + + if (config.HideUltimateStrength()) + { + prayerWidgets.get(Prayer.values()[14].ordinal()).setHidden(true); // Ultimate Strength + } + + if (config.HideIncredibleReflex()) + { + prayerWidgets.get(Prayer.values()[15].ordinal()).setHidden(true); // Incredible Reflexes + } + + if (config.HidePTFMagic()) + { + prayerWidgets.get(Prayer.values()[16].ordinal()).setHidden(true); // Protect from Magic + } + + if (config.HidePTFRange()) + { + prayerWidgets.get(Prayer.values()[17].ordinal()).setHidden(true); // Protect from Range + } + + if (config.HidePTFMelee()) + { + prayerWidgets.get(Prayer.values()[18].ordinal()).setHidden(true); // Protect from Melee + } + + if (config.HideEagle()) + { + prayerWidgets.get(Prayer.values()[19].ordinal()).setHidden(true); // eagle eye + } + + if (config.HideMystic()) + { + prayerWidgets.get(Prayer.values()[20].ordinal()).setHidden(true); // Mystic Might + } + + if (config.HideRETRIBUTION()) + { + prayerWidgets.get(Prayer.values()[21].ordinal()).setHidden(true); // Retribution + } + + if (config.HideRedemption()) + { + prayerWidgets.get(Prayer.values()[22].ordinal()).setHidden(true); // Redemption + } + + if (config.HideSmite()) + { + prayerWidgets.get(Prayer.values()[23].ordinal()).setHidden(true); // Smite + } + + if (config.HidePreserve()) + { + prayerWidgets.get(Prayer.values()[24].ordinal()).setHidden(true); // Preserve + } + + if (config.HideChivalry()) + { + prayerWidgets.get(Prayer.values()[25].ordinal()).setHidden(true); // Chivalry + } + + if (config.HidePiety()) + { + prayerWidgets.get(Prayer.values()[26].ordinal()).setHidden(true); // Piety + } + + if (config.HideRigour()) + { + prayerWidgets.get(Prayer.values()[27].ordinal()).setHidden(true); // Rigour + } + + if (config.HideAugury()) + { + prayerWidgets.get(Prayer.values()[28].ordinal()).setHidden(true); // Augury + } + } + } + } + } +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/PVM/HidePrayersPVMPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/PVM/HidePrayersPVMPlugin.java index a65383e5b5..49f7fd0a1b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/PVM/HidePrayersPVMPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/PVM/HidePrayersPVMPlugin.java @@ -98,6 +98,9 @@ public class HidePrayersPVMPlugin extends Plugin @Inject private HidePrayersPVMConfig config; + @Inject + private ConfigManager configManager; + @Provides HidePrayersPVMConfig provideConfig(ConfigManager configManager) { @@ -108,6 +111,8 @@ public class HidePrayersPVMPlugin extends Plugin protected void startUp() throws Exception { hidePrayers(); + configManager.setConfiguration("runelite", "hideprayerspvmplugin", false); + configManager.setConfiguration("runelite", "hideprayerspvpplugin", false); } @Override diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/PVP/CombatPrayers.java b/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/PVP/CombatPrayers.java new file mode 100644 index 0000000000..208c0e22b4 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/PVP/CombatPrayers.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2018, Lotto + * Copyright (c) 2018, Raqes + * 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 HOLDER 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.hideprayers.PVP; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum CombatPrayers +{ + DISABLED("Disabled"), + PRAY1("1 prayer build"), + PRAY13("13 prayer build"), + PRAY16("16 prayer build"), + PRAY25("25 prayer build"), + PRAY31("31 prayer build"), + PRAY43("43 prayer build"), + PRAY44("44 prayer build"), + PRAY45("45 prayer build"), + PRAY52("52 prayer build"), + PRAY55("55 prayer build"), + PRAY60("60 prayer build"), + PRAY70("70 prayer build"), + PRAY74("74 prayer build"), + PRAY77("77 prayer build"); + + private String name; + + @Override + public String toString() + { + return getName(); + } +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/PVP/HidePrayersPVPConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/PVP/HidePrayersPVPConfig.java index e74709351b..078870726a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/PVP/HidePrayersPVPConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/PVP/HidePrayersPVPConfig.java @@ -37,227 +37,9 @@ public interface HidePrayersPVPConfig extends Config @ConfigItem ( position = 0, - keyName = "pk prayers", - name = "Hide Non-PK Prayers", - description = "Hide/Show PK Prayers." + keyName = "CombatPrayers", + name = "Combat Prayers", + description = "Shows prayers based on prayer build" ) - default boolean showPVPPrayers() - { - return false; - } - - @ConfigItem - ( - position = 1, - keyName = "rapid restore", - name = "Hide Rapid Restore", - description = "Hide/Show Rapid Restore" - ) - default boolean HideRapidRestore() - { - return false; - } - - @ConfigItem - ( - position = 2, - keyName = "rapid heal", - name = "Hide Rapid Heal", - description = "Hide/Show Rapid Heal" - ) - default boolean HideRapidHeal() - { - return false; - } - @ConfigItem - ( - position = 3, - keyName = "protectitem", - name = "Hide Protect Item", - description = "Hide/Show Protect Item" - ) - default boolean HideProtectItem() - { - return false; - } - - @ConfigItem - ( - position = 4, - keyName = "steelskin", - name = "Hide Steel Skin", - description = "Hide/Show Steel skin" - ) - default boolean HideSteelSkin() - { - return false; - } - - @ConfigItem - ( - position = 5, - keyName = "ultimatestrength", - name = "Hide Ultimate Strength", - description = "Hide/Show Ultimate strength" - ) - default boolean HideUltimateStrength() - { - return false; - } - - @ConfigItem - ( - position = 6, - keyName = "incrediblereflex", - name = "Hide Incredible Reflex", - description = "Hide/Show Incredible Reflex" - ) - default boolean HideIncredibleReflex() - { - return false; - } - - @ConfigItem - ( - position = 7, - keyName = "PTFMagic", - name = "Hide Protect From Magic", - description = "Hide/Show Protect From Magic" - ) - default boolean HidePTFMagic() - { - return false; - } - - @ConfigItem - ( - position = 8, - keyName = "PTFRange", - name = "Hide Protect From Range", - description = "Hide/Show Protect from Range" - ) - default boolean HidePTFRange() - { - return false; - } - - @ConfigItem - ( - position = 9, - keyName = "PTFMelee", - name = "Hide Protect From Melee", - description = "Hide/Show Protect From Melee" - ) - default boolean HidePTFMelee() - { - return false; - } - - @ConfigItem - ( - position = 10, - keyName = "eagle", - name = "Hide Eagle Eye", - description = "Hide/Show Eagle Eye" - ) - default boolean HideEagle() - { - return false; - } - - @ConfigItem - ( - position = 11, - keyName = "mystic", - name = "Hide Mystic Might", - description = "Hide/Show Mystic Might" - ) - default boolean HideMystic() - { - return false; - } - - @ConfigItem - ( - position = 12, - keyName = "redemption", - name = "Hide Redemption", - description = "Hide/Show Redemption" - ) - default boolean HideRedemption() - { - return false; - } - - @ConfigItem - ( - position = 13, - keyName = "smite", - name = "Hide Smite", - description = "Hide/Show Smite" - ) - default boolean HideSmite() - { - return false; - } - - @ConfigItem - ( - position = 14, - keyName = "preserve", - name = "Hide Preserve", - description = "Hide/Show Preserve" - ) - default boolean HidePreserve() - { - return false; - } - - @ConfigItem - ( - position = 15, - keyName = "Chivalry", - name = "Hide Chivalry", - description = "Hide/Show Chivalry" - ) - default boolean HideChivalry() - { - return false; - } - - @ConfigItem - ( - position = 16, - keyName = "Piety", - name = "Hide Piety", - description = "Hide/Show Piety" - ) - default boolean HidePiety() - { - return false; - } - - @ConfigItem - ( - position = 17, - keyName = "Rigour", - name = "Hide Rigour", - description = "Hide/Show Rigour" - ) - default boolean HideRigour() - { - return false; - } - - @ConfigItem - ( - position = 18, - keyName = "Augury", - name = "Hide Augury", - description = "Hide/Show Augury" - ) - default boolean HideAugury() - { - return false; - } + default CombatPrayers CombatPrayers() {return CombatPrayers.DISABLED;} } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/PVP/HidePrayersPVPPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/PVP/HidePrayersPVPPlugin.java index 1820d3aa58..1bfd4238d7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/PVP/HidePrayersPVPPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/hideprayers/PVP/HidePrayersPVPPlugin.java @@ -24,7 +24,7 @@ * (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.hideprayers.PVP; import com.google.common.collect.ImmutableList; @@ -98,6 +98,9 @@ public class HidePrayersPVPPlugin extends Plugin @Inject private HidePrayersPVPConfig config; + @Inject + private ConfigManager configManager; + @Provides HidePrayersPVPConfig provideConfig(ConfigManager configManager) { @@ -105,28 +108,30 @@ public class HidePrayersPVPPlugin extends Plugin } @Override - protected void startUp() throws Exception + protected void startUp() throws Exception { hidePrayers(); + configManager.setConfiguration("runelite", "hideprayerspvmplugin", false); + configManager.setConfiguration("runelite", "hideprayersindividualplugin", false); } @Override - protected void shutDown() throws Exception + protected void shutDown() throws Exception { restorePrayers(); } @Subscribe - public void onGameStateChanged(GameStateChanged event) + public void onGameStateChanged(GameStateChanged event) { - if (event.getGameState() == GameState.LOGGED_IN) + if (event.getGameState() == GameState.LOGGED_IN) { hidePrayers(); } } @Subscribe - public void onConfigChanged(ConfigChanged event) + public void onConfigChanged(ConfigChanged event) { if (event.getGroup().equals("hideprayersPVP")) { @@ -135,9 +140,9 @@ public class HidePrayersPVPPlugin extends Plugin } @Subscribe - public void onWidgetLoaded(WidgetLoaded event) + public void onWidgetLoaded(WidgetLoaded event) { - if (event.getGroupId() == WidgetID.PRAYER_GROUP_ID || event.getGroupId() == WidgetID.QUICK_PRAYERS_GROUP_ID) + if (event.getGroupId() == WidgetID.PRAYER_GROUP_ID || event.getGroupId() == WidgetID.QUICK_PRAYERS_GROUP_ID) { hidePrayers(); } @@ -151,7 +156,8 @@ public class HidePrayersPVPPlugin extends Plugin if (widgetNode.getId() == WidgetID.PRAYER_GROUP_ID) { return PrayerTabStates.PRAYERS; - } else if (widgetNode.getId() == WidgetID.QUICK_PRAYERS_GROUP_ID) + } + else if (widgetNode.getId() == WidgetID.QUICK_PRAYERS_GROUP_ID) { return PrayerTabStates.QUICK_PRAYERS; } @@ -166,7 +172,8 @@ public class HidePrayersPVPPlugin extends Plugin PrayerTabStates prayerTabState = getPrayerTabState(); - if (prayerTabState == PrayerTabStates.PRAYERS) { + if (prayerTabState == PrayerTabStates.PRAYERS) + { List prayerWidgets = PRAYER_WIDGET_INFO_LIST.stream().map(client::getWidget) .filter(Objects::nonNull).collect(Collectors.toList()); @@ -193,143 +200,218 @@ public class HidePrayersPVPPlugin extends Plugin if (prayerWidgets.size() != PRAYER_WIDGET_INFO_LIST.size()) return; - for (int index = 0; index < PRAYER_COUNT; index++) + for (int index = 0; index < PRAYER_COUNT; index++) { Prayer prayer = Prayer.values()[index]; Widget prayerWidget = prayerWidgets.get(prayer.ordinal()); - if (!config.showPVPPrayers() - && !config.HideRapidRestore() - && !config.HideRapidHeal() - && !config.HideProtectItem() - && !config.HideSteelSkin() - && !config.HideUltimateStrength() - && !config.HideIncredibleReflex() - && !config.HidePTFMagic() - && !config.HidePTFRange() - && !config.HidePTFMelee() - && !config.HideEagle() - && !config.HideMystic() - && !config.HideRedemption() - && !config.HideSmite() - && !config.HidePreserve() - && !config.HideChivalry() - && !config.HidePiety() - && !config.HideRigour() - && !config.HideAugury()) + if (config.CombatPrayers() == CombatPrayers.DISABLED) prayerWidget.setHidden(false); - if (config.showPVPPrayers()) + if (config.CombatPrayers() == CombatPrayers.PRAY1) { prayerWidget.setHidden(true); - prayerWidgets.get(Prayer.values()[8].ordinal()).setHidden(false);// Rapid Restore - prayerWidgets.get(Prayer.values()[9].ordinal()).setHidden(false);// Rapid Heal - prayerWidgets.get(Prayer.values()[10].ordinal()).setHidden(false);// Protect Item - prayerWidgets.get(Prayer.values()[13].ordinal()).setHidden(false);// Steel Skin - prayerWidgets.get(Prayer.values()[14].ordinal()).setHidden(false);// Ultimate Strength - prayerWidgets.get(Prayer.values()[15].ordinal()).setHidden(false);// Incredible Reflexes - prayerWidgets.get(Prayer.values()[16].ordinal()).setHidden(false);// Protect from Magic - prayerWidgets.get(Prayer.values()[17].ordinal()).setHidden(false);// Protect from Range - prayerWidgets.get(Prayer.values()[18].ordinal()).setHidden(false);// Protect from Melee - prayerWidgets.get(Prayer.values()[19].ordinal()).setHidden(false);// Eagle Eye - prayerWidgets.get(Prayer.values()[20].ordinal()).setHidden(false);// Mystic Might - prayerWidgets.get(Prayer.values()[22].ordinal()).setHidden(false);// Redemption - prayerWidgets.get(Prayer.values()[23].ordinal()).setHidden(false);// Smite - prayerWidgets.get(Prayer.values()[24].ordinal()).setHidden(false);// Preserve - prayerWidgets.get(Prayer.values()[25].ordinal()).setHidden(false);// Chivalry - prayerWidgets.get(Prayer.values()[26].ordinal()).setHidden(false);// Piety - prayerWidgets.get(Prayer.values()[27].ordinal()).setHidden(false);// Rigour - prayerWidgets.get(Prayer.values()[28].ordinal()).setHidden(false);// Augury + prayerWidgets.get(Prayer.values()[0].ordinal()).setHidden(false); // Thick Skin + } + + if (config.CombatPrayers() == CombatPrayers.PRAY13) + { + prayerWidget.setHidden(true); + prayerWidgets.get(Prayer.values()[0].ordinal()).setHidden(false); // Thick Skin + prayerWidgets.get(Prayer.values()[3].ordinal()).setHidden(false); // Sharp Eye + prayerWidgets.get(Prayer.values()[4].ordinal()).setHidden(false); // Mystic Will + prayerWidgets.get(Prayer.values()[5].ordinal()).setHidden(false); // Rock Skin + prayerWidgets.get(Prayer.values()[6].ordinal()).setHidden(false); // Super Human Strength + } + + if (config.CombatPrayers() == CombatPrayers.PRAY16) + { + prayerWidget.setHidden(true); + prayerWidgets.get(Prayer.values()[3].ordinal()).setHidden(false); // Sharp Eye + prayerWidgets.get(Prayer.values()[4].ordinal()).setHidden(false); // Mystic Will + prayerWidgets.get(Prayer.values()[5].ordinal()).setHidden(false); // Rock Skin + prayerWidgets.get(Prayer.values()[6].ordinal()).setHidden(false); // Super Human Strength + prayerWidgets.get(Prayer.values()[7].ordinal()).setHidden(false); // Improved Reflexed + } - if (config.HideRapidRestore()) - { - prayerWidgets.get(Prayer.values()[8].ordinal()).setHidden(true);// Rapid Restore - } - if (config.HideRapidHeal()) - { - prayerWidgets.get(Prayer.values()[9].ordinal()).setHidden(true);// Rapid Heal - } + if (config.CombatPrayers() == CombatPrayers.PRAY25) + { + prayerWidget.setHidden(true); + prayerWidgets.get(Prayer.values()[3].ordinal()).setHidden(false); // Sharp Eye + prayerWidgets.get(Prayer.values()[4].ordinal()).setHidden(false); // Mystic Will + prayerWidgets.get(Prayer.values()[5].ordinal()).setHidden(false); // Rock Skin + prayerWidgets.get(Prayer.values()[6].ordinal()).setHidden(false); // Super Human Strength + prayerWidgets.get(Prayer.values()[7].ordinal()).setHidden(false); // Improved Reflexed + prayerWidgets.get(Prayer.values()[8].ordinal()).setHidden(false); // Rapid Restore + prayerWidgets.get(Prayer.values()[9].ordinal()).setHidden(false); // Rapid Heal + prayerWidgets.get(Prayer.values()[10].ordinal()).setHidden(false); // Protect Item + } + + if (config.CombatPrayers() == CombatPrayers.PRAY31) + { + prayerWidget.setHidden(true); + prayerWidgets.get(Prayer.values()[7].ordinal()).setHidden(false); // Improved Reflexed + prayerWidgets.get(Prayer.values()[8].ordinal()).setHidden(false); // Rapid Restore + prayerWidgets.get(Prayer.values()[9].ordinal()).setHidden(false); // Rapid Heal + prayerWidgets.get(Prayer.values()[10].ordinal()).setHidden(false); // Protect Item + prayerWidgets.get(Prayer.values()[11].ordinal()).setHidden(false); // Hawk Eye + prayerWidgets.get(Prayer.values()[12].ordinal()).setHidden(false); // Mystic Lore + prayerWidgets.get(Prayer.values()[13].ordinal()).setHidden(false); // Steel Skin + prayerWidgets.get(Prayer.values()[14].ordinal()).setHidden(false); // Ultimate Strength + } - if (config.HideProtectItem()) - { - prayerWidgets.get(Prayer.values()[10].ordinal()).setHidden(true);// Protect Item - } + if (config.CombatPrayers() == CombatPrayers.PRAY43) + { + prayerWidget.setHidden(true); + prayerWidgets.get(Prayer.values()[8].ordinal()).setHidden(false); // Rapid Restore + prayerWidgets.get(Prayer.values()[9].ordinal()).setHidden(false); // Rapid Heal + prayerWidgets.get(Prayer.values()[10].ordinal()).setHidden(false); // Protect Item + prayerWidgets.get(Prayer.values()[11].ordinal()).setHidden(false); // Hawk Eye + prayerWidgets.get(Prayer.values()[12].ordinal()).setHidden(false); // Mystic Lore + prayerWidgets.get(Prayer.values()[13].ordinal()).setHidden(false); // Steel Skin + prayerWidgets.get(Prayer.values()[14].ordinal()).setHidden(false); // Ultimate Strength + prayerWidgets.get(Prayer.values()[15].ordinal()).setHidden(false); // Incredible Reflexes + prayerWidgets.get(Prayer.values()[16].ordinal()).setHidden(false); // Protect from Magic + prayerWidgets.get(Prayer.values()[17].ordinal()).setHidden(false); // Protect from Range + prayerWidgets.get(Prayer.values()[18].ordinal()).setHidden(false); // Protect from Melee + } + + if (config.CombatPrayers() == CombatPrayers.PRAY44) + { + prayerWidget.setHidden(true); + prayerWidgets.get(Prayer.values()[8].ordinal()).setHidden(false); // Rapid Restore + prayerWidgets.get(Prayer.values()[9].ordinal()).setHidden(false); // Rapid Heal + prayerWidgets.get(Prayer.values()[10].ordinal()).setHidden(false); // Protect Item + prayerWidgets.get(Prayer.values()[12].ordinal()).setHidden(false); // Mystic Lore + prayerWidgets.get(Prayer.values()[13].ordinal()).setHidden(false); // Steel Skin + prayerWidgets.get(Prayer.values()[14].ordinal()).setHidden(false); // Ultimate Strength + prayerWidgets.get(Prayer.values()[15].ordinal()).setHidden(false); // Incredible Reflexes + prayerWidgets.get(Prayer.values()[16].ordinal()).setHidden(false); // Protect from Magic + prayerWidgets.get(Prayer.values()[17].ordinal()).setHidden(false); // Protect from Range + prayerWidgets.get(Prayer.values()[18].ordinal()).setHidden(false); // Protect from Melee + prayerWidgets.get(Prayer.values()[19].ordinal()).setHidden(false); // Eagle Eye + } + + if (config.CombatPrayers() == CombatPrayers.PRAY45) + { + prayerWidget.setHidden(true); + prayerWidgets.get(Prayer.values()[8].ordinal()).setHidden(false); // Rapid Restore + prayerWidgets.get(Prayer.values()[9].ordinal()).setHidden(false); // Rapid Heal + prayerWidgets.get(Prayer.values()[10].ordinal()).setHidden(false); // Protect Item + prayerWidgets.get(Prayer.values()[13].ordinal()).setHidden(false); // Steel Skin + prayerWidgets.get(Prayer.values()[14].ordinal()).setHidden(false); // Ultimate Strength + prayerWidgets.get(Prayer.values()[15].ordinal()).setHidden(false); // Incredible Reflexes + prayerWidgets.get(Prayer.values()[16].ordinal()).setHidden(false); // Protect from Magic + prayerWidgets.get(Prayer.values()[17].ordinal()).setHidden(false); // Protect from Range + prayerWidgets.get(Prayer.values()[18].ordinal()).setHidden(false); // Protect from Melee + prayerWidgets.get(Prayer.values()[19].ordinal()).setHidden(false); // Eagle Eye + prayerWidgets.get(Prayer.values()[20].ordinal()).setHidden(false); // Mystic Might + } + + if (config.CombatPrayers() == CombatPrayers.PRAY52) + { + prayerWidget.setHidden(true); + prayerWidgets.get(Prayer.values()[8].ordinal()).setHidden(false); // Rapid Restore + prayerWidgets.get(Prayer.values()[9].ordinal()).setHidden(false); // Rapid Heal + prayerWidgets.get(Prayer.values()[10].ordinal()).setHidden(false); // Protect Item + prayerWidgets.get(Prayer.values()[13].ordinal()).setHidden(false); // Steel Skin + prayerWidgets.get(Prayer.values()[14].ordinal()).setHidden(false); // Ultimate Strength + prayerWidgets.get(Prayer.values()[15].ordinal()).setHidden(false); // Incredible Reflexes + prayerWidgets.get(Prayer.values()[16].ordinal()).setHidden(false); // Protect from Magic + prayerWidgets.get(Prayer.values()[17].ordinal()).setHidden(false); // Protect from Range + prayerWidgets.get(Prayer.values()[18].ordinal()).setHidden(false); // Protect from Melee + prayerWidgets.get(Prayer.values()[19].ordinal()).setHidden(false); // Eagle Eye + prayerWidgets.get(Prayer.values()[20].ordinal()).setHidden(false); // Mystic Might + prayerWidgets.get(Prayer.values()[22].ordinal()).setHidden(false); // Redemption + prayerWidgets.get(Prayer.values()[23].ordinal()).setHidden(false); // Smite + } - if (config.HideSteelSkin()) - { - prayerWidgets.get(Prayer.values()[13].ordinal()).setHidden(true);// Steel Skin - } + if (config.CombatPrayers() == CombatPrayers.PRAY55) + { + prayerWidget.setHidden(true); + prayerWidgets.get(Prayer.values()[8].ordinal()).setHidden(false); // Rapid Restore + prayerWidgets.get(Prayer.values()[9].ordinal()).setHidden(false); // Rapid Heal + prayerWidgets.get(Prayer.values()[10].ordinal()).setHidden(false); // Protect Item + prayerWidgets.get(Prayer.values()[13].ordinal()).setHidden(false); // Steel Skin + prayerWidgets.get(Prayer.values()[14].ordinal()).setHidden(false); // Ultimate Strength + prayerWidgets.get(Prayer.values()[15].ordinal()).setHidden(false); // Incredible Reflexes + prayerWidgets.get(Prayer.values()[16].ordinal()).setHidden(false); // Protect from Magic + prayerWidgets.get(Prayer.values()[17].ordinal()).setHidden(false); // Protect from Range + prayerWidgets.get(Prayer.values()[18].ordinal()).setHidden(false); // Protect from Melee + prayerWidgets.get(Prayer.values()[19].ordinal()).setHidden(false); // Eagle Eye + prayerWidgets.get(Prayer.values()[20].ordinal()).setHidden(false); // Mystic Might + prayerWidgets.get(Prayer.values()[22].ordinal()).setHidden(false); // Redemption + prayerWidgets.get(Prayer.values()[23].ordinal()).setHidden(false); // Smite + prayerWidgets.get(Prayer.values()[24].ordinal()).setHidden(false); // Preserve + } - if (config.HideUltimateStrength()) - { - prayerWidgets.get(Prayer.values()[14].ordinal()).setHidden(true);// Ultimate Strength - } + if (config.CombatPrayers() == CombatPrayers.PRAY60) + { + prayerWidget.setHidden(true); + prayerWidgets.get(Prayer.values()[8].ordinal()).setHidden(false); // Rapid Restore + prayerWidgets.get(Prayer.values()[9].ordinal()).setHidden(false); // Rapid Heal + prayerWidgets.get(Prayer.values()[10].ordinal()).setHidden(false); // Protect Item + prayerWidgets.get(Prayer.values()[16].ordinal()).setHidden(false); // Protect from Magic + prayerWidgets.get(Prayer.values()[17].ordinal()).setHidden(false); // Protect from Range + prayerWidgets.get(Prayer.values()[18].ordinal()).setHidden(false); // Protect from Melee + prayerWidgets.get(Prayer.values()[19].ordinal()).setHidden(false); // Eagle Eye + prayerWidgets.get(Prayer.values()[20].ordinal()).setHidden(false); // Mystic Might + prayerWidgets.get(Prayer.values()[22].ordinal()).setHidden(false); // Redemption + prayerWidgets.get(Prayer.values()[23].ordinal()).setHidden(false); // Smite + prayerWidgets.get(Prayer.values()[24].ordinal()).setHidden(false); // Preserve + prayerWidgets.get(Prayer.values()[25].ordinal()).setHidden(false); // Chivalry + } + + if (config.CombatPrayers() == CombatPrayers.PRAY70) + { + prayerWidget.setHidden(true); + prayerWidgets.get(Prayer.values()[8].ordinal()).setHidden(false); // Rapid Restore + prayerWidgets.get(Prayer.values()[9].ordinal()).setHidden(false); // Rapid Heal + prayerWidgets.get(Prayer.values()[10].ordinal()).setHidden(false); // Protect Item + prayerWidgets.get(Prayer.values()[16].ordinal()).setHidden(false); // Protect from Magic + prayerWidgets.get(Prayer.values()[17].ordinal()).setHidden(false); // Protect from Range + prayerWidgets.get(Prayer.values()[18].ordinal()).setHidden(false); // Protect from Melee + prayerWidgets.get(Prayer.values()[19].ordinal()).setHidden(false); // Eagle Eye + prayerWidgets.get(Prayer.values()[20].ordinal()).setHidden(false); // Mystic Might + prayerWidgets.get(Prayer.values()[22].ordinal()).setHidden(false); // Redemption + prayerWidgets.get(Prayer.values()[23].ordinal()).setHidden(false); // Smite + prayerWidgets.get(Prayer.values()[24].ordinal()).setHidden(false); // Preserve + prayerWidgets.get(Prayer.values()[26].ordinal()).setHidden(false); // Piety + } - if (config.HideIncredibleReflex()) - { - prayerWidgets.get(Prayer.values()[15].ordinal()).setHidden(true);// Incredible Reflexes - } - - if (config.HidePTFMagic()) - { - prayerWidgets.get(Prayer.values()[16].ordinal()).setHidden(true);// Protect from Magic - } - - if (config.HidePTFRange()) - { - prayerWidgets.get(Prayer.values()[17].ordinal()).setHidden(true);// Protect from Range - } - - if (config.HidePTFMelee()) - { - prayerWidgets.get(Prayer.values()[18].ordinal()).setHidden(true);// Protect from Melee - } - - if (config.HideEagle()) - { - prayerWidgets.get(Prayer.values()[19].ordinal()).setHidden(true);// eagle eye - } - - if (config.HideMystic()) - { - prayerWidgets.get(Prayer.values()[20].ordinal()).setHidden(true);// Mystic Might - } - - if (config.HideRedemption()) - { - prayerWidgets.get(Prayer.values()[22].ordinal()).setHidden(true);// Redemption - } - - if (config.HideSmite()) - { - prayerWidgets.get(Prayer.values()[23].ordinal()).setHidden(true);// Smite - } - - if (config.HidePreserve()) - { - prayerWidgets.get(Prayer.values()[24].ordinal()).setHidden(true);// Preserve - } - - if (config.HideChivalry()) - { - prayerWidgets.get(Prayer.values()[25].ordinal()).setHidden(true);// Chivalry - } - - if (config.HidePiety()) - { - prayerWidgets.get(Prayer.values()[26].ordinal()).setHidden(true);// Piety - } - - if (config.HideRigour()) - { - prayerWidgets.get(Prayer.values()[27].ordinal()).setHidden(true);// Rigour - } - - if (config.HideAugury()) - { - prayerWidgets.get(Prayer.values()[28].ordinal()).setHidden(true);// Augury - } + if (config.CombatPrayers() == CombatPrayers.PRAY74) + { + prayerWidget.setHidden(true); + prayerWidgets.get(Prayer.values()[8].ordinal()).setHidden(false); // Rapid Restore + prayerWidgets.get(Prayer.values()[9].ordinal()).setHidden(false); // Rapid Heal + prayerWidgets.get(Prayer.values()[10].ordinal()).setHidden(false); // Protect Item + prayerWidgets.get(Prayer.values()[16].ordinal()).setHidden(false); // Protect from Magic + prayerWidgets.get(Prayer.values()[17].ordinal()).setHidden(false); // Protect from Range + prayerWidgets.get(Prayer.values()[18].ordinal()).setHidden(false); // Protect from Melee + prayerWidgets.get(Prayer.values()[20].ordinal()).setHidden(false); // Mystic Might + prayerWidgets.get(Prayer.values()[22].ordinal()).setHidden(false); // Redemption + prayerWidgets.get(Prayer.values()[23].ordinal()).setHidden(false); // Smite + prayerWidgets.get(Prayer.values()[24].ordinal()).setHidden(false); // Preserve + prayerWidgets.get(Prayer.values()[26].ordinal()).setHidden(false); // Piety + prayerWidgets.get(Prayer.values()[27].ordinal()).setHidden(false); // Rigour + } + + if (config.CombatPrayers() == CombatPrayers.PRAY77) + { + prayerWidget.setHidden(true); + prayerWidgets.get(Prayer.values()[8].ordinal()).setHidden(false); // Rapid Restore + prayerWidgets.get(Prayer.values()[9].ordinal()).setHidden(false); // Rapid Heal + prayerWidgets.get(Prayer.values()[10].ordinal()).setHidden(false); // Protect Item + prayerWidgets.get(Prayer.values()[16].ordinal()).setHidden(false); // Protect from Magic + prayerWidgets.get(Prayer.values()[17].ordinal()).setHidden(false); // Protect from Range + prayerWidgets.get(Prayer.values()[18].ordinal()).setHidden(false); // Protect from Melee + prayerWidgets.get(Prayer.values()[22].ordinal()).setHidden(false); // Redemption + prayerWidgets.get(Prayer.values()[23].ordinal()).setHidden(false); // Smite + prayerWidgets.get(Prayer.values()[24].ordinal()).setHidden(false); // Preserve + prayerWidgets.get(Prayer.values()[26].ordinal()).setHidden(false); // Piety + prayerWidgets.get(Prayer.values()[27].ordinal()).setHidden(false); // Rigour + prayerWidgets.get(Prayer.values()[28].ordinal()).setHidden(false); // Augury } } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/highalchemy/HighAlchemyConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/highalchemy/HighAlchemyConfig.java new file mode 100644 index 0000000000..4b90360112 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/highalchemy/HighAlchemyConfig.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2019 Ahmad Issa + * Copyright (c) 2019 Owain + * Copyright (c) 2019 Kyle + * 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.highalchemy; + +import java.awt.Color; +import net.runelite.client.config.Config; +import net.runelite.client.config.ConfigGroup; +import net.runelite.client.config.ConfigItem; +import net.runelite.client.config.Range; + +@ConfigGroup("highalchemy") +public interface HighAlchemyConfig extends Config +{ + int lowerLimit = Integer.MIN_VALUE; + + @ConfigItem( + keyName = "showBank", + name = "Highlight Bank Items", + description = "Show highlight on bank items.", + position = 0 + ) + default boolean showBank() + { + return false; + } + + @ConfigItem( + keyName = "showInventory", + name = "Highlight Inventory Items", + description = "Show highlight on inventory items.", + position = 1 + ) + default boolean showInventory() + { + return false; + } + + @ConfigItem( + keyName = "getHighlightColor", + name = "Highlight Color", + description = "Choose the color of the highlight.", + position = 2 + ) + default Color getHighlightColor() + { + return Color.WHITE; + } + + @Range( + min = lowerLimit + ) + @ConfigItem( + keyName = "minProfit", + name = "Profit Target", + description = "Minimal desired profit from casting High Alchemy", + position = 3 + ) + default int minProfit() + { + return 1; + } + + @ConfigItem( + keyName = "usingFireRunes", + name = "Using Fire Runes", + description = "Change the equation to include the price of fire runes.", + position = 4 + ) + default boolean usingFireRunes() + { + return false; + } + +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/highalchemy/HighAlchemyOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/highalchemy/HighAlchemyOverlay.java new file mode 100644 index 0000000000..dfaf0be2e6 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/highalchemy/HighAlchemyOverlay.java @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2019 Ahmad Issa + * Copyright (c) 2019 Owain + * Copyright (c) 2019 Kyle + * Copyright (c) 2019, Lucas + * 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.highalchemy; + +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.image.BufferedImage; +import java.util.HashSet; +import java.util.Set; +import javax.inject.Inject; +import net.runelite.api.ItemComposition; +import net.runelite.api.ItemID; +import net.runelite.api.widgets.Widget; +import static net.runelite.api.widgets.WidgetInfo.TO_GROUP; +import net.runelite.api.widgets.WidgetItem; +import net.runelite.client.game.ItemManager; +import net.runelite.client.ui.overlay.WidgetItemOverlay; + +public class HighAlchemyOverlay extends WidgetItemOverlay +{ + private final ItemManager itemManager; + private final HighAlchemyConfig config; + private final HighAlchemyPlugin plugin; + private final int alchPrice; + private final int alchPriceNoStaff; + private static final float HIGH_ALCHEMY_CONSTANT = 0.6f; + + @Inject + public HighAlchemyOverlay(ItemManager itemManager, HighAlchemyPlugin plugin, HighAlchemyConfig config) + { + this.itemManager = itemManager; + this.config = config; + this.plugin = plugin; + + int natPrice = itemManager.getItemPrice(ItemID.NATURE_RUNE); + this.alchPrice = natPrice; + this.alchPriceNoStaff = natPrice + 5 * itemManager.getItemPrice(ItemID.FIRE_RUNE); + + showOnBank(); + showOnInventory(); + } + + @Override + public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem itemWidget) + { + Widget widget = itemWidget.getWidget(); + int interfaceGroup = TO_GROUP(widget.getId()); + + if (!plugin.getInterfaceGroups().contains(interfaceGroup)) + { + return; + } + + final int id = getNotedId(itemId); + final int gePrice = getGEPrice(id); + final int haPrice = getHAPrice(id); + final int materialCost = config.usingFireRunes() ? alchPriceNoStaff : alchPrice; + final int desiredProfit = config.minProfit(); + final int haProfit = getHAProfit(haPrice, gePrice, materialCost); + + if (gePrice > 0 && haPrice > 0 && haProfit >= desiredProfit) + { + final Color color = config.getHighlightColor(); + + if (color != null) + { + Rectangle bounds = itemWidget.getCanvasBounds(); + final BufferedImage outline = itemManager.getItemOutline(itemId, itemWidget.getQuantity(), color); + graphics.drawImage(outline, (int) bounds.getX() + 1, (int) bounds.getY() + 1, null); + } + } + } + + private int getGEPrice(int id) + { + return itemManager.getItemPrice(id); + } + + private int getHAPrice(int id) + { + if (id == ItemID.COINS_995) + { + return 0; + } + ItemComposition itemComp = itemManager.getItemComposition(id); + float haValue = itemComp.getPrice() * HIGH_ALCHEMY_CONSTANT; + return Math.round(haValue); + } + + private int getHAProfit(int haPrice, int gePrice, int alchCost) + { + return haPrice - gePrice - alchCost; + } + + // Checks if item is noted, if not returns id + private int getNotedId(int id) + { + int noteID = id; + ItemComposition itemComposition = itemManager.getItemComposition(noteID); + if (itemComposition.getNote() != -1) + { + noteID = itemComposition.getLinkedNoteId(); + } + return noteID; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/highalchemy/HighAlchemyPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/highalchemy/HighAlchemyPlugin.java new file mode 100644 index 0000000000..af43bb3f77 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/highalchemy/HighAlchemyPlugin.java @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2019 Ahmad Issa + * Copyright (c) 2019 Owain + * Copyright (c) 2019 Kyle + * 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.highalchemy; + +import com.google.inject.Provides; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; +import javax.inject.Inject; +import lombok.AccessLevel; +import lombok.Getter; +import net.runelite.api.events.ConfigChanged; +import static net.runelite.api.widgets.WidgetID.BANK_GROUP_ID; +import static net.runelite.api.widgets.WidgetID.BANK_INVENTORY_GROUP_ID; +import static net.runelite.api.widgets.WidgetID.DEPOSIT_BOX_GROUP_ID; +import static net.runelite.api.widgets.WidgetID.EQUIPMENT_INVENTORY_GROUP_ID; +import static net.runelite.api.widgets.WidgetID.GRAND_EXCHANGE_INVENTORY_GROUP_ID; +import static net.runelite.api.widgets.WidgetID.GUIDE_PRICES_INVENTORY_GROUP_ID; +import static net.runelite.api.widgets.WidgetID.INVENTORY_GROUP_ID; +import static net.runelite.api.widgets.WidgetID.SHOP_INVENTORY_GROUP_ID; +import net.runelite.client.config.ConfigManager; +import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.plugins.Plugin; +import net.runelite.client.plugins.PluginDescriptor; +import net.runelite.client.plugins.PluginType; +import net.runelite.client.ui.overlay.OverlayManager; + +@PluginDescriptor( + name = "High Alchemy", + description = "*Highlights items that yield a profit from casting High Alchemy.", + tags = {"bank", "inventory", "overlay", "high", "alchemy", "grand", "exchange", "tooltips"}, + type = PluginType.UTILITY, + enabledByDefault = false +) +public class HighAlchemyPlugin extends Plugin +{ + private static final String CONFIG_GROUP = "highalchemy"; + + @Getter(AccessLevel.PACKAGE) + private final Set interfaceGroups = new HashSet<>(); + + @Inject + private HighAlchemyConfig config; + + @Inject + private OverlayManager overlayManager; + + @Inject + private HighAlchemyOverlay overlay; + + @Provides + HighAlchemyConfig getConfig(ConfigManager configManager) + { + return configManager.getConfig(HighAlchemyConfig.class); + } + + @Override + protected void startUp() throws Exception + { + buildGroupList(); + overlayManager.add(overlay); + } + + @Override + protected void shutDown() throws Exception + { + overlayManager.remove(overlay); + } + + @Subscribe + public void onConfigChanged(ConfigChanged event) + { + if (event.getGroup().equals(CONFIG_GROUP)) + { + buildGroupList(); + } + } + + private void buildGroupList() + { + interfaceGroups.clear(); + + if (config.showBank()) + { + interfaceGroups.add(BANK_GROUP_ID); + } + + if (config.showInventory()) + { + Arrays.stream( + new int[] { + DEPOSIT_BOX_GROUP_ID, + BANK_INVENTORY_GROUP_ID, + SHOP_INVENTORY_GROUP_ID, + GRAND_EXCHANGE_INVENTORY_GROUP_ID, + GUIDE_PRICES_INVENTORY_GROUP_ID, + EQUIPMENT_INVENTORY_GROUP_ID, + INVENTORY_GROUP_ID + } + ).forEach(interfaceGroups::add); + } + } +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java index efc4262c41..00f894bf58 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java @@ -54,6 +54,8 @@ public class WidgetOverlay extends Overlay .put(WidgetInfo.PVP_KILLDEATH_COUNTER, OverlayPosition.TOP_LEFT) .put(WidgetInfo.SKOTIZO_CONTAINER, OverlayPosition.TOP_LEFT) .put(WidgetInfo.KOUREND_FAVOUR_OVERLAY, OverlayPosition.TOP_CENTER) + .put(WidgetInfo.MULTICOMBAT_FIXED, OverlayPosition.BOTTOM_RIGHT) + .put(WidgetInfo.MULTICOMBAT_RESIZEABLE, OverlayPosition.CANVAS_TOP_RIGHT) .put(WidgetInfo.PYRAMID_PLUNDER_DATA, OverlayPosition.TOP_CENTER) .build();