From 863ed09e6640782749dba8f37c23aea2705e5e59 Mon Sep 17 00:00:00 2001 From: James Munson Date: Sat, 18 May 2019 00:22:43 -0700 Subject: [PATCH 1/3] Added recoil and explorers ring to itemcharges, disabled hide statusbar by default --- .../main/java/net/runelite/api/Varbits.java | 8 + .../plugins/itemcharges/ItemChargeConfig.java | 44 +++++ .../itemcharges/ItemChargeOverlay.java | 2 + .../plugins/itemcharges/ItemChargePlugin.java | 55 ++++++ .../itemcharges/ItemExplorerRingOverlay.java | 163 ++++++++++++++++++ .../ItemExplorerRingOverlayMode.java | 33 ++++ .../itemcharges/ItemRecoilOverlay.java | 72 ++++++++ .../plugins/statusbars/StatusBarsConfig.java | 2 +- 8 files changed, 378 insertions(+), 1 deletion(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemExplorerRingOverlay.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemExplorerRingOverlayMode.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemRecoilOverlay.java diff --git a/runelite-api/src/main/java/net/runelite/api/Varbits.java b/runelite-api/src/main/java/net/runelite/api/Varbits.java index dccdc89331..595803b711 100644 --- a/runelite-api/src/main/java/net/runelite/api/Varbits.java +++ b/runelite-api/src/main/java/net/runelite/api/Varbits.java @@ -523,6 +523,14 @@ public enum Varbits */ QUEST_TAB(8168), + /** + * Explorer ring + */ + EXPLORER_RING_ALCHTYPE(5398), + EXPLORER_RING_TELEPORTS(4552), + EXPLORER_RING_ALCHS(4554), + EXPLORER_RING_RUNENERGY(4553), + /** * Temple Trekking */ diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java index df98a3e738..55fa6ae449 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java @@ -388,4 +388,48 @@ public interface ItemChargeConfig extends Config { return false; } + + @ConfigItem( + keyName = "showrecoil", + name = "Show If Recoil is activated", + description = "Configures if Recoil is activated", + position = 22 + ) + default boolean showrecoil() + { + return false; + } + + @ConfigItem( + keyName = "showExplorer", + name = "Show Explorer's Ring Charges", + description = "Configures if Explorer's Ring charge is shown", + position = 23 + ) + default boolean showExplorer() + { + return false; + } + + @ConfigItem( + keyName = "fontcolor", + name = "Font Color For Explorer's Ring", + description = "Color of the font for the number of charges", + position = 24 + ) + default Color fontColor() + { + return Color.yellow; + } + + @ConfigItem( + keyName = "explorerRingOverlayMode", + name = "Explorer's Ring Display Mode", + description = "Configures where explorer ring overlay is displayed", + position = 25 + ) + default ItemExplorerRingOverlayMode explorerRingOverlayMode() + { + return ItemExplorerRingOverlayMode.BOTH; + } } \ No newline at end of file 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 5cdb7ae66e..d405225875 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 @@ -41,6 +41,7 @@ import net.runelite.client.ui.FontManager; import net.runelite.client.ui.overlay.WidgetItemOverlay; import net.runelite.client.ui.overlay.components.TextComponent; + class ItemChargeOverlay extends WidgetItemOverlay { private final ItemChargePlugin itemChargePlugin; @@ -150,6 +151,7 @@ class ItemChargeOverlay extends WidgetItemOverlay charges = chargeItem.getCharges(); } + final Rectangle bounds = itemWidget.getCanvasBounds(); final TextComponent textComponent = new TextComponent(); textComponent.setPosition(new diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java index 823a6678b6..03be0e56fd 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java @@ -57,6 +57,8 @@ import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.infobox.InfoBoxManager; import net.runelite.client.util.Text; +import static net.runelite.api.ItemID.RING_OF_RECOIL; + @PluginDescriptor( name = "Item Charges", description = "Show number of item charges remaining", @@ -118,6 +120,27 @@ public class ItemChargePlugin extends Plugin private static final int MAX_EXPEDITIOUS_CHARGES = 30; private static final int MAX_BINDING_CHARGES = 16; + public boolean isRingOfRecoilAvailable() + { + return ringOfRecoilAvailable; + } + + private boolean ringOfRecoilAvailable = false; + + boolean isRingOfRecoilEquipped() + { + return ringOfRecoilEquipped; + } + + private boolean ringOfRecoilEquipped = false; + private BufferedImage recoilRingImage; + + BufferedImage getRecoilRingImage() + { + return recoilRingImage; + } + + @Inject private Client client; @@ -127,6 +150,12 @@ public class ItemChargePlugin extends Plugin @Inject private ItemChargeOverlay overlay; + @Inject + private ItemRecoilOverlay recoilOverlay; + + @Inject + private ItemExplorerRingOverlay eRingOverlay; + @Inject private ItemManager itemManager; @@ -152,12 +181,17 @@ public class ItemChargePlugin extends Plugin protected void startUp() { overlayManager.add(overlay); + overlayManager.add(recoilOverlay); + overlayManager.add(eRingOverlay); + recoilRingImage = itemManager.getImage(RING_OF_RECOIL); } @Override protected void shutDown() throws Exception { overlayManager.remove(overlay); + overlayManager.remove(recoilOverlay); + overlayManager.remove(eRingOverlay); infoBoxManager.removeIf(ItemChargeInfobox.class::isInstance); lastCheckTick = -1; } @@ -382,6 +416,27 @@ public class ItemChargePlugin extends Plugin } } + ItemContainer equipment = client.getItemContainer(InventoryID.EQUIPMENT); + ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY); + ringOfRecoilAvailable = false; + ringOfRecoilEquipped = false; + + Item ring = equipment.getItems()[net.runelite.api.EquipmentInventorySlot.RING.getSlotIdx()]; + if (ring.getId() == RING_OF_RECOIL) + { + ringOfRecoilEquipped = true; + ringOfRecoilAvailable = true; + } + Item[] items = inventory.getItems(); + for (Item item : items) + { + if (item.getId() == RING_OF_RECOIL) + { + ringOfRecoilAvailable = true; + break; + } + } + Widget dialog1 = client.getWidget(WidgetInfo.DIALOG_SPRITE_TEXT); Widget dialog2 = client.getWidget(WidgetInfo.DIALOG2_SPRITE_TEXT); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemExplorerRingOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemExplorerRingOverlay.java new file mode 100644 index 0000000000..6c678c5eda --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemExplorerRingOverlay.java @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2018, https://runelitepl.us + * Copyright (c) 2018, https://github.com/runeliteplusplus + * 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.itemcharges; + +import javax.inject.Inject; +import net.runelite.api.Client; +import net.runelite.api.ItemID; +import net.runelite.api.Point; +import net.runelite.api.Varbits; +import net.runelite.api.widgets.WidgetItem; +import net.runelite.client.ui.FontManager; +import net.runelite.client.ui.overlay.WidgetItemOverlay; + +import java.awt.*; +import net.runelite.client.ui.overlay.tooltip.Tooltip; +import net.runelite.client.ui.overlay.tooltip.TooltipManager; + +public class ItemExplorerRingOverlay extends WidgetItemOverlay +{ + private static final Varbits TELEPORTS = Varbits.EXPLORER_RING_TELEPORTS; + private static final Varbits ALCHS = Varbits.EXPLORER_RING_ALCHS; + private static final Varbits RUNENERGY = Varbits.EXPLORER_RING_RUNENERGY; + private static final Varbits ALCHTYPE = Varbits.EXPLORER_RING_ALCHTYPE; + + private static final int MAX_ALCHS = 30; + private static final int MAX_TELEPORTS = 3; + private static final int[] MAX_RUNREPLENISH = { + 2, /* Explorer's ring 1 */ + 3, + 4, + 3 + }; + + private final Client client; + private final ItemChargeConfig config; + private final TooltipManager tooltipManager; + + @Inject + ItemExplorerRingOverlay(Client client, ItemChargeConfig config, TooltipManager tooltipManager) + { + this.client = client; + this.config = config; + this.tooltipManager = tooltipManager; + + showOnInventory(); + showOnEquipment(); + } + + @Override + public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem itemWidget) + { + if (config.showExplorer()) + { + if (itemId < ItemID.EXPLORERS_RING_1 || itemId > ItemID.EXPLORERS_RING_4) + return; + + graphics.setFont(FontManager.getRunescapeSmallFont()); + + Point location = itemWidget.getCanvasLocation(); + StringBuilder tooltipBuilder = new StringBuilder(); + + // Pen position tracking. + int penShadowX = location.getX() + 1; + int penX = location.getX(); + int penShadowY = location.getY(); + int penY = location.getY(); + + // Alchemy (level 4 ring is High Alc) + int alchAmount = MAX_ALCHS - client.getVar(ALCHS); + if (config.explorerRingOverlayMode() != ItemExplorerRingOverlayMode.MOUSE_HOVER) + { + String alchStr = "A: " + alchAmount; + + penShadowY += 1 + (graphics.getFontMetrics().getHeight() - 1); + graphics.setColor(Color.BLACK); + graphics.drawString(alchStr, penShadowX, + penShadowY); + + penY += (graphics.getFontMetrics().getHeight() - 1); + graphics.setColor(config.fontColor()); + graphics.drawString(alchStr, penX, + penY); + } + + tooltipBuilder.append("Alchs: " + alchAmount + "
"); + + // Run energy + int runAmount = MAX_RUNREPLENISH[itemId - ItemID.EXPLORERS_RING_1] - client.getVar(RUNENERGY); + + if (config.explorerRingOverlayMode() != ItemExplorerRingOverlayMode.MOUSE_HOVER) + { + String runStr = "R: " + runAmount; + + penShadowY += 1 + (graphics.getFontMetrics().getHeight() - 1); + graphics.setColor(Color.BLACK); + graphics.drawString(runStr, penShadowX, + penShadowY); + + penY += (graphics.getFontMetrics().getHeight() - 1); + graphics.setColor(config.fontColor()); + graphics.drawString(runStr, penX, + penY); + } + + tooltipBuilder.append("Run Replenish: " + runAmount + "
"); + + // Teleport charges (unique to level 2 ring). + if (itemId == ItemID.EXPLORERS_RING_2) + { + int teleAmount = MAX_TELEPORTS - client.getVar(TELEPORTS); + + if (config.explorerRingOverlayMode() != ItemExplorerRingOverlayMode.MOUSE_HOVER) + { + String teleStr = "T: " + teleAmount; + + penShadowY += 1 + (graphics.getFontMetrics().getHeight() - 1); + graphics.setColor(Color.BLACK); + graphics.drawString(teleStr, penShadowX + 1, + penShadowY); + + penY += (graphics.getFontMetrics().getHeight() - 1); + graphics.setColor(config.fontColor()); + graphics.drawString(teleStr, penX + 1, + penY); + } + + tooltipBuilder.append("Teleports: " + teleAmount + "
"); + } + + // Display tooltip + String finalTooltip = tooltipBuilder.toString(); + if (!finalTooltip.isEmpty() && + (config.explorerRingOverlayMode() != ItemExplorerRingOverlayMode.INVENTORY) && + itemWidget.getCanvasBounds().contains(client.getMouseCanvasPosition().getX(), client.getMouseCanvasPosition().getY())) + { + tooltipManager.add(new Tooltip(finalTooltip)); + } + } + } +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemExplorerRingOverlayMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemExplorerRingOverlayMode.java new file mode 100644 index 0000000000..7d0c5a05cc --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemExplorerRingOverlayMode.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2018, https://runelitepl.us + * Copyright (c) 2018, https://github.com/runeliteplusplus + * 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.itemcharges; + +public enum ItemExplorerRingOverlayMode +{ + INVENTORY, + MOUSE_HOVER, + BOTH +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemRecoilOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemRecoilOverlay.java new file mode 100644 index 0000000000..6828fbb646 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemRecoilOverlay.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2018, https://runelitepl.us + * Copyright (c) 2018, https://github.com/runeliteplusplus + * 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.itemcharges; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import javax.inject.Inject; +import net.runelite.api.Client; +import net.runelite.client.ui.overlay.Overlay; +import net.runelite.client.ui.overlay.OverlayPosition; +import net.runelite.client.ui.overlay.components.ImageComponent; +import net.runelite.client.ui.overlay.components.PanelComponent; + +class ItemRecoilOverlay extends Overlay +{ + private static final Color NOT_ACTIVATED_BACKGROUND_COLOR = new Color(150, 0, 0, 150); + private static final Color ACTIVATED_BACKGROUND_COLOR = new Color(0, 150, 0, 150); + private final ItemChargePlugin plugin; + private final ItemChargeConfig config; + private final PanelComponent imagePanelComponent = new PanelComponent(); + + @Inject + public ItemRecoilOverlay(Client client, ItemChargePlugin plugin, ItemChargeConfig config) + { + setPosition(OverlayPosition.TOP_LEFT); + this.plugin = plugin; + this.config = config; + } + + @Override + public Dimension render(Graphics2D graphics) + { + this.imagePanelComponent.getChildren().clear(); + if (config.showrecoil()) + { + if (plugin.isRingOfRecoilAvailable()) + { + BufferedImage recoilImage = plugin.getRecoilRingImage(); + imagePanelComponent.setBackgroundColor(plugin + .isRingOfRecoilEquipped() ? ACTIVATED_BACKGROUND_COLOR : NOT_ACTIVATED_BACKGROUND_COLOR); + imagePanelComponent.getChildren().add(new ImageComponent(recoilImage)); + return imagePanelComponent.render(graphics); + } + } + return null; + } +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsConfig.java index 58842332e2..573e561e2d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/statusbars/StatusBarsConfig.java @@ -72,7 +72,7 @@ public interface StatusBarsConfig extends Config ) default boolean toggleRestorationBars() { - return true; + return false; } @ConfigItem( From 26fd53aa8f95ec7a1b3f208a4df59566e1e291f6 Mon Sep 17 00:00:00 2001 From: James Munson Date: Sat, 18 May 2019 09:58:16 -0700 Subject: [PATCH 2/3] removed explorers ring --- .../plugins/itemcharges/ItemChargeConfig.java | 33 ---- .../plugins/itemcharges/ItemChargePlugin.java | 5 - .../itemcharges/ItemExplorerRingOverlay.java | 163 ------------------ .../ItemExplorerRingOverlayMode.java | 33 ---- 4 files changed, 234 deletions(-) delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemExplorerRingOverlay.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemExplorerRingOverlayMode.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java index 55fa6ae449..7bb41bfabf 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java @@ -399,37 +399,4 @@ public interface ItemChargeConfig extends Config { return false; } - - @ConfigItem( - keyName = "showExplorer", - name = "Show Explorer's Ring Charges", - description = "Configures if Explorer's Ring charge is shown", - position = 23 - ) - default boolean showExplorer() - { - return false; - } - - @ConfigItem( - keyName = "fontcolor", - name = "Font Color For Explorer's Ring", - description = "Color of the font for the number of charges", - position = 24 - ) - default Color fontColor() - { - return Color.yellow; - } - - @ConfigItem( - keyName = "explorerRingOverlayMode", - name = "Explorer's Ring Display Mode", - description = "Configures where explorer ring overlay is displayed", - position = 25 - ) - default ItemExplorerRingOverlayMode explorerRingOverlayMode() - { - return ItemExplorerRingOverlayMode.BOTH; - } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java index 03be0e56fd..94c5862bc2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java @@ -153,9 +153,6 @@ public class ItemChargePlugin extends Plugin @Inject private ItemRecoilOverlay recoilOverlay; - @Inject - private ItemExplorerRingOverlay eRingOverlay; - @Inject private ItemManager itemManager; @@ -182,7 +179,6 @@ public class ItemChargePlugin extends Plugin { overlayManager.add(overlay); overlayManager.add(recoilOverlay); - overlayManager.add(eRingOverlay); recoilRingImage = itemManager.getImage(RING_OF_RECOIL); } @@ -191,7 +187,6 @@ public class ItemChargePlugin extends Plugin { overlayManager.remove(overlay); overlayManager.remove(recoilOverlay); - overlayManager.remove(eRingOverlay); infoBoxManager.removeIf(ItemChargeInfobox.class::isInstance); lastCheckTick = -1; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemExplorerRingOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemExplorerRingOverlay.java deleted file mode 100644 index 6c678c5eda..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemExplorerRingOverlay.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2018, https://runelitepl.us - * Copyright (c) 2018, https://github.com/runeliteplusplus - * 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.itemcharges; - -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.ItemID; -import net.runelite.api.Point; -import net.runelite.api.Varbits; -import net.runelite.api.widgets.WidgetItem; -import net.runelite.client.ui.FontManager; -import net.runelite.client.ui.overlay.WidgetItemOverlay; - -import java.awt.*; -import net.runelite.client.ui.overlay.tooltip.Tooltip; -import net.runelite.client.ui.overlay.tooltip.TooltipManager; - -public class ItemExplorerRingOverlay extends WidgetItemOverlay -{ - private static final Varbits TELEPORTS = Varbits.EXPLORER_RING_TELEPORTS; - private static final Varbits ALCHS = Varbits.EXPLORER_RING_ALCHS; - private static final Varbits RUNENERGY = Varbits.EXPLORER_RING_RUNENERGY; - private static final Varbits ALCHTYPE = Varbits.EXPLORER_RING_ALCHTYPE; - - private static final int MAX_ALCHS = 30; - private static final int MAX_TELEPORTS = 3; - private static final int[] MAX_RUNREPLENISH = { - 2, /* Explorer's ring 1 */ - 3, - 4, - 3 - }; - - private final Client client; - private final ItemChargeConfig config; - private final TooltipManager tooltipManager; - - @Inject - ItemExplorerRingOverlay(Client client, ItemChargeConfig config, TooltipManager tooltipManager) - { - this.client = client; - this.config = config; - this.tooltipManager = tooltipManager; - - showOnInventory(); - showOnEquipment(); - } - - @Override - public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem itemWidget) - { - if (config.showExplorer()) - { - if (itemId < ItemID.EXPLORERS_RING_1 || itemId > ItemID.EXPLORERS_RING_4) - return; - - graphics.setFont(FontManager.getRunescapeSmallFont()); - - Point location = itemWidget.getCanvasLocation(); - StringBuilder tooltipBuilder = new StringBuilder(); - - // Pen position tracking. - int penShadowX = location.getX() + 1; - int penX = location.getX(); - int penShadowY = location.getY(); - int penY = location.getY(); - - // Alchemy (level 4 ring is High Alc) - int alchAmount = MAX_ALCHS - client.getVar(ALCHS); - if (config.explorerRingOverlayMode() != ItemExplorerRingOverlayMode.MOUSE_HOVER) - { - String alchStr = "A: " + alchAmount; - - penShadowY += 1 + (graphics.getFontMetrics().getHeight() - 1); - graphics.setColor(Color.BLACK); - graphics.drawString(alchStr, penShadowX, - penShadowY); - - penY += (graphics.getFontMetrics().getHeight() - 1); - graphics.setColor(config.fontColor()); - graphics.drawString(alchStr, penX, - penY); - } - - tooltipBuilder.append("Alchs: " + alchAmount + "
"); - - // Run energy - int runAmount = MAX_RUNREPLENISH[itemId - ItemID.EXPLORERS_RING_1] - client.getVar(RUNENERGY); - - if (config.explorerRingOverlayMode() != ItemExplorerRingOverlayMode.MOUSE_HOVER) - { - String runStr = "R: " + runAmount; - - penShadowY += 1 + (graphics.getFontMetrics().getHeight() - 1); - graphics.setColor(Color.BLACK); - graphics.drawString(runStr, penShadowX, - penShadowY); - - penY += (graphics.getFontMetrics().getHeight() - 1); - graphics.setColor(config.fontColor()); - graphics.drawString(runStr, penX, - penY); - } - - tooltipBuilder.append("Run Replenish: " + runAmount + "
"); - - // Teleport charges (unique to level 2 ring). - if (itemId == ItemID.EXPLORERS_RING_2) - { - int teleAmount = MAX_TELEPORTS - client.getVar(TELEPORTS); - - if (config.explorerRingOverlayMode() != ItemExplorerRingOverlayMode.MOUSE_HOVER) - { - String teleStr = "T: " + teleAmount; - - penShadowY += 1 + (graphics.getFontMetrics().getHeight() - 1); - graphics.setColor(Color.BLACK); - graphics.drawString(teleStr, penShadowX + 1, - penShadowY); - - penY += (graphics.getFontMetrics().getHeight() - 1); - graphics.setColor(config.fontColor()); - graphics.drawString(teleStr, penX + 1, - penY); - } - - tooltipBuilder.append("Teleports: " + teleAmount + "
"); - } - - // Display tooltip - String finalTooltip = tooltipBuilder.toString(); - if (!finalTooltip.isEmpty() && - (config.explorerRingOverlayMode() != ItemExplorerRingOverlayMode.INVENTORY) && - itemWidget.getCanvasBounds().contains(client.getMouseCanvasPosition().getX(), client.getMouseCanvasPosition().getY())) - { - tooltipManager.add(new Tooltip(finalTooltip)); - } - } - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemExplorerRingOverlayMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemExplorerRingOverlayMode.java deleted file mode 100644 index 7d0c5a05cc..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemExplorerRingOverlayMode.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2018, https://runelitepl.us - * Copyright (c) 2018, https://github.com/runeliteplusplus - * 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.itemcharges; - -public enum ItemExplorerRingOverlayMode -{ - INVENTORY, - MOUSE_HOVER, - BOTH -} \ No newline at end of file From 4023bd2e57e14631fc0dfaba7cfad7940bfdd41a Mon Sep 17 00:00:00 2001 From: James Munson Date: Sat, 18 May 2019 09:59:45 -0700 Subject: [PATCH 3/3] Fix --- .../runelite/client/plugins/itemcharges/ItemChargeOverlay.java | 2 -- 1 file changed, 2 deletions(-) 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 d405225875..5cdb7ae66e 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 @@ -41,7 +41,6 @@ import net.runelite.client.ui.FontManager; import net.runelite.client.ui.overlay.WidgetItemOverlay; import net.runelite.client.ui.overlay.components.TextComponent; - class ItemChargeOverlay extends WidgetItemOverlay { private final ItemChargePlugin itemChargePlugin; @@ -151,7 +150,6 @@ class ItemChargeOverlay extends WidgetItemOverlay charges = chargeItem.getCharges(); } - final Rectangle bounds = itemWidget.getCanvasBounds(); final TextComponent textComponent = new TextComponent(); textComponent.setPosition(new