From c94689764d0026cca7cacd2abeb365a9480def08 Mon Sep 17 00:00:00 2001 From: Tyler Bochard Date: Fri, 19 Apr 2019 19:44:16 -0400 Subject: [PATCH] Gazivodag master (#10) * Transform objects now use an interface * Plugins can now accept colors (not my code) * mixins: renderWidgetLayer: skip hidden widgets * World Map: Identify Both Shield of Arrav Quest Start Points (#8442) Closes #8437 * widgetitem: associate Widget with WidgetItem * widgetitem overlay: allow configuring which interfaces to overlay Update overlays to behave consistent with how they behaved before removal of query api, with the exception of adding the rune pouch overlay to the bank. * Update .gitignore * Revert "Adding external plugin support (#4)" This reverts commit bfe1482 * Update QuestStartLocation.java * Revert "Plugins update (#7)" This reverts commit 216f7d9 * Adding external plugin support (#4) * Adding archetype * Update RuneLiteConfig.java * Update Plugin.java * Update PluginManager.java * Adding pluginwatcher & classloader * Update RuneLite.java * Update pom.xml * Update settings.xml * Update pom.xml * Update pom.xml * Removing old example plugin * Fixing the fix of the fix for plugin archetype. (cherry picked from commit bfe14827051d084c4b4e250906b5c28e6b7d321f) * Plugins can now accept colors (not my code) (cherry picked from commit 8e094f738686140104202c6c5aac8b5eb7e47a38) * Update MenuEntrySwapperConfig.java --- .gitignore | 6 +- .../net/runelite/api/widgets/WidgetItem.java | 48 +- .../client/plugins/config/ConfigPanel.java | 54 +- .../client/plugins/config/PluginListItem.java | 26 +- .../inventorytags/InventoryTagsOverlay.java | 2 + .../itemcharges/ItemChargeOverlay.java | 2 + .../MenuEntrySwapperConfig.java | 569 +++++++++--------- .../plugins/runepouch/RunepouchOverlay.java | 2 + .../client/plugins/slayer/SlayerOverlay.java | 2 + .../plugins/worldmap/QuestStartLocation.java | 5 +- .../client/ui/overlay/WidgetItemOverlay.java | 58 +- .../net/runelite/mixins/RSClientMixin.java | 4 +- .../net/runelite/mixins/RSWidgetMixin.java | 2 +- 13 files changed, 415 insertions(+), 365 deletions(-) diff --git a/.gitignore b/.gitignore index a4f1ba7d02..177b1d7858 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,8 @@ project.properties .idea/ .project .settings/ -.classpath \ No newline at end of file +.classpath +runelite-client/src/main/resources/META-INF/MANIFEST.MF +git +classes/artifacts/client_jar/run.bat +classes/artifacts/client_jar/client.jar diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetItem.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetItem.java index 51f63ad40f..c39e961f81 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetItem.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetItem.java @@ -26,6 +26,7 @@ package net.runelite.api.widgets; import java.awt.Rectangle; import lombok.AllArgsConstructor; +import lombok.Getter; import lombok.ToString; import net.runelite.api.Point; @@ -34,55 +35,34 @@ import net.runelite.api.Point; */ @AllArgsConstructor @ToString +@Getter public class WidgetItem { - private final int id; - private final int quantity; - private final int index; - private final Rectangle canvasBounds; - /** - * Gets the ID of the item represented. + * The ID of the item represented. * - * @return the items ID * @see net.runelite.api.ItemID */ - public int getId() - { - return id; - } - + private final int id; /** - * Gets the quantity of the represented item. - * - * @return the items quantity + * The quantity of the represented item. */ - public int getQuantity() - { - return quantity; - } - + private final int quantity; /** - * Gets the index position of this WidgetItem inside its parents + * The index position of this WidgetItem inside its parents * WidgetItem array. * - * @return the index in the parent widget * @see Widget#getWidgetItems() */ - public int getIndex() - { - return index; - } - + private final int index; /** - * Gets the area where the widget is drawn on the canvas. - * - * @return the occupied area of the widget + * The area where the widget is drawn on the canvas. */ - public Rectangle getCanvasBounds() - { - return canvasBounds; - } + private final Rectangle canvasBounds; + /** + * The widget which contains this item. + */ + private final Widget widget; /** * Gets the upper-left coordinate of where the widget is being drawn diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java index b71d5e8b0e..6f5712f4a8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java @@ -130,7 +130,7 @@ public class ConfigPanel extends PluginPanel } ConfigPanel(PluginManager pluginManager, ConfigManager configManager, ScheduledExecutorService executorService, - RuneLiteConfig runeLiteConfig, ChatColorConfig chatColorConfig) + RuneLiteConfig runeLiteConfig, ChatColorConfig chatColorConfig) { super(false); this.pluginManager = pluginManager; @@ -195,28 +195,28 @@ public class ConfigPanel extends PluginPanel // populate pluginList with all non-hidden plugins pluginManager.getPlugins().stream() - .filter(plugin -> !plugin.getClass().getAnnotation(PluginDescriptor.class).hidden()) - .forEach(plugin -> - { - final PluginDescriptor descriptor = plugin.getClass().getAnnotation(PluginDescriptor.class); - final Config config = pluginManager.getPluginConfigProxy(plugin); - final ConfigDescriptor configDescriptor = config == null ? null : configManager.getConfigDescriptor(config); + .filter(plugin -> !plugin.getClass().getAnnotation(PluginDescriptor.class).hidden()) + .forEach(plugin -> + { + final PluginDescriptor descriptor = plugin.getClass().getAnnotation(PluginDescriptor.class); + final Config config = pluginManager.getPluginConfigProxy(plugin); + final ConfigDescriptor configDescriptor = config == null ? null : configManager.getConfigDescriptor(config); - final PluginListItem listItem = new PluginListItem(this, plugin, descriptor, config, configDescriptor); - listItem.setPinned(pinnedPlugins.contains(listItem.getName())); - pluginList.add(listItem); - }); + final PluginListItem listItem = new PluginListItem(this, plugin, descriptor, config, configDescriptor); + listItem.setPinned(pinnedPlugins.contains(listItem.getName())); + pluginList.add(listItem); + }); // add special entries for core client configurations final PluginListItem runeLite = new PluginListItem(this, runeLiteConfig, - configManager.getConfigDescriptor(runeLiteConfig), - RUNELITE_PLUGIN, "RuneLite client settings", "client"); + configManager.getConfigDescriptor(runeLiteConfig), + RUNELITE_PLUGIN, "RuneLite client settings", "client"); runeLite.setPinned(pinnedPlugins.contains(RUNELITE_PLUGIN)); pluginList.add(runeLite); final PluginListItem chatColor = new PluginListItem(this, chatColorConfig, - configManager.getConfigDescriptor(chatColorConfig), - CHAT_COLOR_PLUGIN, "Recolor chat text", "colour", "messages"); + configManager.getConfigDescriptor(chatColorConfig), + CHAT_COLOR_PLUGIN, "Recolor chat text", "colour", "messages"); chatColor.setPinned(pinnedPlugins.contains(CHAT_COLOR_PLUGIN)); pluginList.add(chatColor); @@ -421,7 +421,7 @@ public class ConfigPanel extends PluginPanel public void mouseClicked(MouseEvent e) { RuneliteColorPicker colorPicker = new RuneliteColorPicker(SwingUtilities.windowForComponent(ConfigPanel.this), - colorPickerBtn.getBackground(), cid.getItem().name(), cid.getAlpha() == null); + colorPickerBtn.getBackground(), cid.getItem().name(), cid.getAlpha() == null); colorPicker.setLocation(getLocationOnScreen()); colorPicker.setOnColorChange(c -> { @@ -467,7 +467,7 @@ public class ConfigPanel extends PluginPanel heightSpinnerTextField.setColumns(4); ChangeListener listener = e -> - configManager.setConfiguration(cd.getGroup().value(), cid.getItem().keyName(), widthSpinner.getValue() + "x" + heightSpinner.getValue()); + configManager.setConfiguration(cd.getGroup().value(), cid.getItem().keyName(), widthSpinner.getValue() + "x" + heightSpinner.getValue()); widthSpinner.addChangeListener(listener); heightSpinner.addChangeListener(listener); @@ -512,8 +512,8 @@ public class ConfigPanel extends PluginPanel if (cid.getType() == Keybind.class || cid.getType() == ModifierlessKeybind.class) { Keybind startingValue = configManager.getConfiguration(cd.getGroup().value(), - cid.getItem().keyName(), - (Class) cid.getType()); + cid.getItem().keyName(), + (Class) cid.getType()); HotkeyButton button = new HotkeyButton(startingValue, cid.getType() == ModifierlessKeybind.class); @@ -536,8 +536,8 @@ public class ConfigPanel extends PluginPanel resetButton.addActionListener((e) -> { final int result = JOptionPane.showOptionDialog(resetButton, "Are you sure you want to reset this plugin's configuration?", - "Are you sure?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, - null, new String[]{"Yes", "No"}, "No"); + "Are you sure?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, + null, new String[]{"Yes", "No"}, "No"); if (result == JOptionPane.YES_OPTION) { @@ -564,8 +564,8 @@ public class ConfigPanel extends PluginPanel if (!Strings.isNullOrEmpty(configItem.warning())) { final int result = JOptionPane.showOptionDialog(component, configItem.warning(), - "Are you sure?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, - null, new String[]{"Yes", "No"}, "No"); + "Are you sure?", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, + null, new String[]{"Yes", "No"}, "No"); if (result != JOptionPane.YES_OPTION) { @@ -659,9 +659,9 @@ public class ConfigPanel extends PluginPanel void savePinnedPlugins() { final String value = pluginList.stream() - .filter(PluginListItem::isPinned) - .map(PluginListItem::getName) - .collect(Collectors.joining(",")); + .filter(PluginListItem::isPinned) + .map(PluginListItem::getName) + .collect(Collectors.joining(",")); configManager.setConfiguration(RUNELITE_GROUP_NAME, PINNED_PLUGINS_CONFIG_KEY, value); } @@ -704,4 +704,4 @@ public class ConfigPanel extends PluginPanel } } -} \ No newline at end of file +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginListItem.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginListItem.java index 64b97a6ab8..c6a23544c7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginListItem.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginListItem.java @@ -99,17 +99,17 @@ class PluginListItem extends JPanel ON_STAR = new ImageIcon(onStar); CONFIG_ICON_HOVER = new ImageIcon(ImageUtil.grayscaleOffset(configIcon, -100)); BufferedImage offSwitcherImage = ImageUtil.flipImage( - ImageUtil.grayscaleOffset( - ImageUtil.grayscaleImage(onSwitcher), - 0.61f - ), - true, - false + ImageUtil.grayscaleOffset( + ImageUtil.grayscaleImage(onSwitcher), + 0.61f + ), + true, + false ); OFF_SWITCHER = new ImageIcon(offSwitcherImage); BufferedImage offStar = ImageUtil.grayscaleOffset( - ImageUtil.grayscaleImage(onStar), - 0.77f + ImageUtil.grayscaleImage(onStar), + 0.77f ); OFF_STAR = new ImageIcon(offStar); } @@ -121,23 +121,23 @@ class PluginListItem extends JPanel * if there is no configuration associated with the plugin. */ PluginListItem(ConfigPanel configPanel, Plugin plugin, PluginDescriptor descriptor, - @Nullable Config config, @Nullable ConfigDescriptor configDescriptor) + @Nullable Config config, @Nullable ConfigDescriptor configDescriptor) { this(configPanel, plugin, config, configDescriptor, - descriptor.name(), descriptor.description(), descriptor.tags()); + descriptor.name(), descriptor.description(), descriptor.tags()); } /** * Creates a new {@code PluginListItem} for a core configuration. */ PluginListItem(ConfigPanel configPanel, Config config, ConfigDescriptor configDescriptor, - String name, String description, String... tags) + String name, String description, String... tags) { this(configPanel, null, config, configDescriptor, name, description, tags); } private PluginListItem(ConfigPanel configPanel, @Nullable Plugin plugin, @Nullable Config config, - @Nullable ConfigDescriptor configDescriptor, String name, String description, String... tags) + @Nullable ConfigDescriptor configDescriptor, String name, String description, String... tags) { this.configPanel = configPanel; this.plugin = plugin; @@ -260,7 +260,7 @@ class PluginListItem extends JPanel for (String term : searchTerms) { if (keywords.stream().noneMatch((t) -> t.contains(term) || - DISTANCE.apply(t, term) > 0.9)) + DISTANCE.apply(t, term) > 0.9)) { return false; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorytags/InventoryTagsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorytags/InventoryTagsOverlay.java index 99798156ad..14fe723a71 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorytags/InventoryTagsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/inventorytags/InventoryTagsOverlay.java @@ -43,6 +43,8 @@ public class InventoryTagsOverlay extends WidgetItemOverlay { this.itemManager = itemManager; this.plugin = plugin; + showOnEquipment(); + showOnInventory(); } @Override diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeOverlay.java index a37570aa22..5082ab2ccd 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeOverlay.java @@ -51,6 +51,8 @@ class ItemChargeOverlay extends WidgetItemOverlay { this.itemChargePlugin = itemChargePlugin; this.config = config; + showOnInventory(); + showOnEquipment(); } @Override diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java index 23ab63df16..36185d8aed 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java @@ -1,284 +1,285 @@ -/* - * Copyright (c) 2018, 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.menuentryswapper; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("menuentryswapper") -public interface MenuEntrySwapperConfig extends Config -{ - @ConfigItem( - position = -2, - keyName = "shiftClickCustomization", - name = "Customizable shift-click", - description = "Allows customization of shift-clicks on items" - ) - default boolean shiftClickCustomization() - { - return true; - } - - @ConfigItem( - keyName = "swapAdmire", - name = "Admire", - description = "Swap Admire with Teleport, Spellbook and Perks (max cape) for mounted skill capes." - ) - default boolean swapAdmire() - { - return true; - } - - @ConfigItem( - keyName = "swapAssignment", - name = "Assignment", - description = "Swap Talk-to with Assignment for Slayer Masters. This will take priority over swapping Trade." - ) - default boolean swapAssignment() - { - return true; - } - - @ConfigItem( - keyName = "swapBanker", - name = "Bank", - description = "Swap Talk-to with Bank on Bank NPC
Example: Banker" - ) - default boolean swapBank() - { - return true; - } - - @ConfigItem( - keyName = "swapBirdhouseEmpty", - name = "Birdhouse", - description = "Swap Interact with Empty for birdhouses on Fossil Island" - ) - default boolean swapBirdhouseEmpty() - { - return true; - } - - @ConfigItem( - keyName = "swapBones", - name = "Bury", - description = "Swap Bury with Use on Bones" - ) - default boolean swapBones() - { - return false; - } - - @ConfigItem( - keyName = "swapContract", - name = "Contract", - description = "Swap Talk-to with Contract on Guildmaster Jane" - ) - default boolean swapContract() - { - return true; - } - - @ConfigItem( - keyName = "swapChase", - name = "Chase", - description = "Allows to left click your cat to chase" - ) - default boolean swapChase() - { - return true; - } - - @ConfigItem( - keyName = "claimSlime", - name = "Claim Slime", - description = "Swap Talk-to with Claim Slime from Morytania diaries" - ) - default boolean claimSlime() - { - return true; - } - - @ConfigItem( - keyName = "swapDarkMage", - name = "Repairs", - description = "Swap Talk-to with Repairs for Dark Mage" - ) - default boolean swapDarkMage() - { - return true; - } - - @ConfigItem( - keyName = "swapDecant", - name = "Decant", - description = "Swap Talk-to with Decant for Bob Barter and Murky Matt at the Grand Exchange." - ) - default boolean swapDecant() - { - return false; - } - - @ConfigItem( - keyName = "swapExchange", - name = "Exchange", - description = "Swap Talk-to with Exchange on NPC
Example: Grand Exchange Clerk, Tool Leprechaun, Void Knight" - ) - default boolean swapExchange() - { - return true; - } - - @ConfigItem( - keyName = "swapFairyRing", - name = "Fairy ring", - description = "Swap Zanaris with Last-destination or Configure on Fairy rings" - ) - default FairyRingMode swapFairyRing() - { - return FairyRingMode.LAST_DESTINATION; - } - - @ConfigItem( - keyName = "swapHarpoon", - name = "Harpoon", - description = "Swap Cage, Big Net with Harpoon on Fishing spot" - ) - default boolean swapHarpoon() - { - return false; - } - - @ConfigItem( - keyName = "swapHomePortal", - name = "Home", - description = "Swap Enter with Home or Build or Friend's house on Portal" - ) - default HouseMode swapHomePortal() - { - return HouseMode.HOME; - } - - @ConfigItem( - keyName = "swapPickpocket", - name = "Pickpocket on H.A.M.", - description = "Swap Talk-to with Pickpocket on H.A.M members" - ) - default boolean swapPickpocket() - { - return true; - } - - @ConfigItem( - keyName = "swapPay", - name = "Pay", - description = "Swap Talk-to with Pay on NPC
Example: Elstan, Heskel, Fayeth" - ) - default boolean swapPay() - { - return true; - } - - @ConfigItem( - keyName = "swapPrivate", - name = "Private", - description = "Swap Shared with Private on the Chambers of Xeric storage units." - ) - default boolean swapPrivate() - { - return false; - } - - @ConfigItem( - keyName = "swapPick", - name = "Pick", - description = "Swap Pick with Pick-lots of the Gourd tree in the Chambers of Xeric" - ) - default boolean swapPick() - { - return false; - } - - @ConfigItem( - keyName = "swapQuick", - name = "Quick Pass/Open/Start/Travel", - description = "Swap Pass with Quick-Pass, Open with Quick-Open, Ring with Quick-Start and Talk-to with Quick-Travel" - ) - default boolean swapQuick() - { - return true; - } - - @ConfigItem( - keyName = "swapBoxTrap", - name = "Reset", - description = "Swap Check with Reset on box trap" - ) - default boolean swapBoxTrap() - { - return true; - } - - @ConfigItem( - keyName = "swapTeleportItem", - name = "Teleport item", - description = "Swap Wear, Wield with Rub, Teleport on teleport item
Example: Amulet of glory, Explorer's ring, Chronicle" - ) - default boolean swapTeleportItem() - { - return false; - } - - @ConfigItem( - keyName = "swapAbyssTeleport", - name = "Teleport to Abyss", - description = "Swap Talk-to with Teleport for the Mage of Zamorak" - ) - default boolean swapAbyssTeleport() - { - return true; - } - - @ConfigItem( - keyName = "swapTrade", - name = "Trade", - description = "Swap Talk-to with Trade on NPC
Example: Shop keeper, Shop assistant" - ) - default boolean swapTrade() - { - return true; - } - - @ConfigItem( - keyName = "swapTravel", - name = "Travel", - description = "Swap Talk-to with Travel, Take-boat, Pay-fare, Charter on NPC
Example: Squire, Monk of Entrana, Customs officer, Trader Crewmember" - ) - default boolean swapTravel() - { - return true; - } -} + +/* + * Copyright (c) 2018, 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.menuentryswapper; + +import net.runelite.client.config.Config; +import net.runelite.client.config.ConfigGroup; +import net.runelite.client.config.ConfigItem; + +@ConfigGroup("menuentryswapper") +public interface MenuEntrySwapperConfig extends Config +{ + @ConfigItem( + position = -2, + keyName = "shiftClickCustomization", + name = "Customizable shift-click", + description = "Allows customization of shift-clicks on items" + ) + default boolean shiftClickCustomization() + { + return true; + } + + @ConfigItem( + keyName = "swapAdmire", + name = "Admire", + description = "Swap Admire with Teleport, Spellbook and Perks (max cape) for mounted skill capes." + ) + default boolean swapAdmire() + { + return true; + } + + @ConfigItem( + keyName = "swapAssignment", + name = "Assignment", + description = "Swap Talk-to with Assignment for Slayer Masters. This will take priority over swapping Trade." + ) + default boolean swapAssignment() + { + return true; + } + + @ConfigItem( + keyName = "swapBanker", + name = "Bank", + description = "Swap Talk-to with Bank on Bank NPC
Example: Banker" + ) + default boolean swapBank() + { + return true; + } + + @ConfigItem( + keyName = "swapBirdhouseEmpty", + name = "Birdhouse", + description = "Swap Interact with Empty for birdhouses on Fossil Island" + ) + default boolean swapBirdhouseEmpty() + { + return true; + } + + @ConfigItem( + keyName = "swapBones", + name = "Bury", + description = "Swap Bury with Use on Bones" + ) + default boolean swapBones() + { + return false; + } + + @ConfigItem( + keyName = "swapContract", + name = "Contract", + description = "Swap Talk-to with Contract on Guildmaster Jane" + ) + default boolean swapContract() + { + return true; + } + + @ConfigItem( + keyName = "swapChase", + name = "Chase", + description = "Allows to left click your cat to chase" + ) + default boolean swapChase() + { + return true; + } + + @ConfigItem( + keyName = "claimSlime", + name = "Claim Slime", + description = "Swap Talk-to with Claim Slime from Morytania diaries" + ) + default boolean claimSlime() + { + return true; + } + + @ConfigItem( + keyName = "swapDarkMage", + name = "Repairs", + description = "Swap Talk-to with Repairs for Dark Mage" + ) + default boolean swapDarkMage() + { + return true; + } + + @ConfigItem( + keyName = "swapDecant", + name = "Decant", + description = "Swap Talk-to with Decant for Bob Barter and Murky Matt at the Grand Exchange." + ) + default boolean swapDecant() + { + return false; + } + + @ConfigItem( + keyName = "swapExchange", + name = "Exchange", + description = "Swap Talk-to with Exchange on NPC
Example: Grand Exchange Clerk, Tool Leprechaun, Void Knight" + ) + default boolean swapExchange() + { + return true; + } + + @ConfigItem( + keyName = "swapFairyRing", + name = "Fairy ring", + description = "Swap Zanaris with Last-destination or Configure on Fairy rings" + ) + default FairyRingMode swapFairyRing() + { + return FairyRingMode.LAST_DESTINATION; + } + + @ConfigItem( + keyName = "swapHarpoon", + name = "Harpoon", + description = "Swap Cage, Big Net with Harpoon on Fishing spot" + ) + default boolean swapHarpoon() + { + return false; + } + + @ConfigItem( + keyName = "swapHomePortal", + name = "Home", + description = "Swap Enter with Home or Build or Friend's house on Portal" + ) + default HouseMode swapHomePortal() + { + return HouseMode.HOME; + } + + @ConfigItem( + keyName = "swapPickpocket", + name = "Pickpocket on H.A.M.", + description = "Swap Talk-to with Pickpocket on H.A.M members" + ) + default boolean swapPickpocket() + { + return true; + } + + @ConfigItem( + keyName = "swapPay", + name = "Pay", + description = "Swap Talk-to with Pay on NPC
Example: Elstan, Heskel, Fayeth" + ) + default boolean swapPay() + { + return true; + } + + @ConfigItem( + keyName = "swapPrivate", + name = "Private", + description = "Swap Shared with Private on the Chambers of Xeric storage units." + ) + default boolean swapPrivate() + { + return false; + } + + @ConfigItem( + keyName = "swapPick", + name = "Pick", + description = "Swap Pick with Pick-lots of the Gourd tree in the Chambers of Xeric" + ) + default boolean swapPick() + { + return false; + } + + @ConfigItem( + keyName = "swapQuick", + name = "Quick Pass/Open/Start/Travel", + description = "Swap Pass with Quick-Pass, Open with Quick-Open, Ring with Quick-Start and Talk-to with Quick-Travel" + ) + default boolean swapQuick() + { + return true; + } + + @ConfigItem( + keyName = "swapBoxTrap", + name = "Reset", + description = "Swap Check with Reset on box trap" + ) + default boolean swapBoxTrap() + { + return true; + } + + @ConfigItem( + keyName = "swapTeleportItem", + name = "Teleport item", + description = "Swap Wear, Wield with Rub, Teleport on teleport item
Example: Amulet of glory, Explorer's ring, Chronicle" + ) + default boolean swapTeleportItem() + { + return false; + } + + @ConfigItem( + keyName = "swapAbyssTeleport", + name = "Teleport to Abyss", + description = "Swap Talk-to with Teleport for the Mage of Zamorak" + ) + default boolean swapAbyssTeleport() + { + return true; + } + + @ConfigItem( + keyName = "swapTrade", + name = "Trade", + description = "Swap Talk-to with Trade on NPC
Example: Shop keeper, Shop assistant" + ) + default boolean swapTrade() + { + return true; + } + + @ConfigItem( + keyName = "swapTravel", + name = "Travel", + description = "Swap Talk-to with Travel, Take-boat, Pay-fare, Charter on NPC
Example: Squire, Monk of Entrana, Customs officer, Trader Crewmember" + ) + default boolean swapTravel() + { + return true; + } +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/RunepouchOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/RunepouchOverlay.java index 17486efe0d..a7e2fd86d7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/RunepouchOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/runepouch/RunepouchOverlay.java @@ -69,6 +69,8 @@ public class RunepouchOverlay extends WidgetItemOverlay this.tooltipManager = tooltipManager; this.client = client; this.config = config; + showOnInventory(); + showOnBank(); } @Override diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerOverlay.java index e8c49b20a0..97a191d608 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerOverlay.java @@ -87,6 +87,8 @@ class SlayerOverlay extends WidgetItemOverlay { this.plugin = plugin; this.config = config; + showOnInventory(); + showOnEquipment(); } @Override diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java index c1d9e9fb88..afd2bba6a4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java @@ -46,7 +46,10 @@ enum QuestStartLocation THE_RESTLESS_GHOST("The Restless Ghost", new WorldPoint(3240, 3210, 0)), RUNE_MYSTERIES("Rune Mysteries", new WorldPoint(3210, 3220, 0)), SHEEP_SHEARER("Sheep Shearer", new WorldPoint(3190, 3272, 0)), - SHIELD_OF_ARRAV("Shield of Arrav", new WorldPoint(3208, 3495, 0)), + + SHIELD_OF_ARRAV_PHOENIX_GANG("Shield of Arrav (Phoenix Gang)", new WorldPoint(3208, 3495, 0)), + SHIELD_OF_ARRAV_BLACK_ARM_GANG("Shield of Arrav (Black Arm Gang)", new WorldPoint(3208, 3392, 0)), + VAMPIRE_SLAYER("Vampire Slayer", new WorldPoint(3096, 3266, 0)), WITCHS_POTION("Witch's Potion", new WorldPoint(2967, 3203, 0)), X_MARKS_THE_SPOT("X Marks the Spot", new WorldPoint(3227, 3242, 0)), diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetItemOverlay.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetItemOverlay.java index 0eaae6e50b..9cf6f39217 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetItemOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetItemOverlay.java @@ -26,15 +26,33 @@ package net.runelite.client.ui.overlay; import java.awt.Dimension; import java.awt.Graphics2D; +import java.util.Arrays; +import java.util.HashSet; import java.util.List; +import java.util.Set; import lombok.AccessLevel; import lombok.Setter; +import net.runelite.api.widgets.Widget; +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_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 static net.runelite.api.widgets.WidgetInfo.TO_GROUP; import net.runelite.api.widgets.WidgetItem; public abstract class WidgetItemOverlay extends Overlay { @Setter(AccessLevel.PACKAGE) private OverlayManager overlayManager; + /** + * Interfaces to draw overlay over. + */ + private final Set interfaceGroups = new HashSet<>(); protected WidgetItemOverlay() { @@ -49,13 +67,49 @@ public abstract class WidgetItemOverlay extends Overlay public Dimension render(Graphics2D graphics) { final List itemWidgets = overlayManager.getItemWidgets(); - for (WidgetItem widget : itemWidgets) + for (WidgetItem widgetItem : itemWidgets) { - renderItemOverlay(graphics, widget.getId(), widget); + Widget widget = widgetItem.getWidget(); + int interfaceGroup = TO_GROUP(widget.getId()); + + // Don't draw if this widget isn't one of the allowed + if (!interfaceGroups.contains(interfaceGroup)) + { + continue; + } + + renderItemOverlay(graphics, widgetItem.getId(), widgetItem); } return null; } + protected void showOnInventory() + { + showOnInterfaces( + 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); + } + + protected void showOnBank() + { + showOnInterfaces(BANK_GROUP_ID); + } + + protected void showOnEquipment() + { + showOnInterfaces(EQUIPMENT_GROUP_ID); + } + + protected void showOnInterfaces(int... ids) + { + Arrays.stream(ids).forEach(interfaceGroups::add); + } + // Don't allow setting position, priority, or layer @Override diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java index 56b9190ead..7c934a265d 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java @@ -1335,7 +1335,7 @@ public abstract class RSClientMixin implements RSClient for (Widget rlWidget : widgets) { RSWidget widget = (RSWidget) rlWidget; - if (widget == null || widget.getRSParentId() != parentId) + if (widget == null || widget.getRSParentId() != parentId || widget.isSelfHidden()) { continue; } @@ -1355,7 +1355,7 @@ public abstract class RSClientMixin implements RSClient { if (renderX >= minX && renderX <= maxX && renderY >= minY && renderY <= maxY) { - WidgetItem widgetItem = new WidgetItem(widget.getItemId(), widget.getItemQuantity(), -1, widget.getBounds()); + WidgetItem widgetItem = new WidgetItem(widget.getItemId(), widget.getItemQuantity(), -1, widget.getBounds(), widget); callbacks.drawItem(widget.getItemId(), widgetItem); } } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSWidgetMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSWidgetMixin.java index 4130ce5930..1b4bda7fc6 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSWidgetMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSWidgetMixin.java @@ -300,7 +300,7 @@ public abstract class RSWidgetMixin implements RSWidget int itemY = widgetCanvasLocation.getY() + ((ITEM_SLOT_SIZE + yPitch) * row); Rectangle bounds = new Rectangle(itemX - 1, itemY - 1, ITEM_SLOT_SIZE, ITEM_SLOT_SIZE); - return new WidgetItem(itemId - 1, itemQuantity, index, bounds); + return new WidgetItem(itemId - 1, itemQuantity, index, bounds, this); } @Inject