Added recoil and explorers ring to itemcharges, disabled hide statusbar by default
This commit is contained in:
@@ -523,6 +523,14 @@ public enum Varbits
|
|||||||
*/
|
*/
|
||||||
QUEST_TAB(8168),
|
QUEST_TAB(8168),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Explorer ring
|
||||||
|
*/
|
||||||
|
EXPLORER_RING_ALCHTYPE(5398),
|
||||||
|
EXPLORER_RING_TELEPORTS(4552),
|
||||||
|
EXPLORER_RING_ALCHS(4554),
|
||||||
|
EXPLORER_RING_RUNENERGY(4553),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Temple Trekking
|
* Temple Trekking
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -388,4 +388,48 @@ public interface ItemChargeConfig extends Config
|
|||||||
{
|
{
|
||||||
return false;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -41,6 +41,7 @@ import net.runelite.client.ui.FontManager;
|
|||||||
import net.runelite.client.ui.overlay.WidgetItemOverlay;
|
import net.runelite.client.ui.overlay.WidgetItemOverlay;
|
||||||
import net.runelite.client.ui.overlay.components.TextComponent;
|
import net.runelite.client.ui.overlay.components.TextComponent;
|
||||||
|
|
||||||
|
|
||||||
class ItemChargeOverlay extends WidgetItemOverlay
|
class ItemChargeOverlay extends WidgetItemOverlay
|
||||||
{
|
{
|
||||||
private final ItemChargePlugin itemChargePlugin;
|
private final ItemChargePlugin itemChargePlugin;
|
||||||
@@ -150,6 +151,7 @@ class ItemChargeOverlay extends WidgetItemOverlay
|
|||||||
charges = chargeItem.getCharges();
|
charges = chargeItem.getCharges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
final Rectangle bounds = itemWidget.getCanvasBounds();
|
final Rectangle bounds = itemWidget.getCanvasBounds();
|
||||||
final TextComponent textComponent = new TextComponent();
|
final TextComponent textComponent = new TextComponent();
|
||||||
textComponent.setPosition(new
|
textComponent.setPosition(new
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ import net.runelite.client.ui.overlay.OverlayManager;
|
|||||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||||
import net.runelite.client.util.Text;
|
import net.runelite.client.util.Text;
|
||||||
|
|
||||||
|
import static net.runelite.api.ItemID.RING_OF_RECOIL;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Item Charges",
|
name = "Item Charges",
|
||||||
description = "Show number of item charges remaining",
|
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_EXPEDITIOUS_CHARGES = 30;
|
||||||
private static final int MAX_BINDING_CHARGES = 16;
|
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
|
@Inject
|
||||||
private Client client;
|
private Client client;
|
||||||
|
|
||||||
@@ -127,6 +150,12 @@ public class ItemChargePlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private ItemChargeOverlay overlay;
|
private ItemChargeOverlay overlay;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ItemRecoilOverlay recoilOverlay;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ItemExplorerRingOverlay eRingOverlay;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ItemManager itemManager;
|
private ItemManager itemManager;
|
||||||
|
|
||||||
@@ -152,12 +181,17 @@ public class ItemChargePlugin extends Plugin
|
|||||||
protected void startUp()
|
protected void startUp()
|
||||||
{
|
{
|
||||||
overlayManager.add(overlay);
|
overlayManager.add(overlay);
|
||||||
|
overlayManager.add(recoilOverlay);
|
||||||
|
overlayManager.add(eRingOverlay);
|
||||||
|
recoilRingImage = itemManager.getImage(RING_OF_RECOIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void shutDown() throws Exception
|
protected void shutDown() throws Exception
|
||||||
{
|
{
|
||||||
overlayManager.remove(overlay);
|
overlayManager.remove(overlay);
|
||||||
|
overlayManager.remove(recoilOverlay);
|
||||||
|
overlayManager.remove(eRingOverlay);
|
||||||
infoBoxManager.removeIf(ItemChargeInfobox.class::isInstance);
|
infoBoxManager.removeIf(ItemChargeInfobox.class::isInstance);
|
||||||
lastCheckTick = -1;
|
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 dialog1 = client.getWidget(WidgetInfo.DIALOG_SPRITE_TEXT);
|
||||||
Widget dialog2 = client.getWidget(WidgetInfo.DIALOG2_SPRITE_TEXT);
|
Widget dialog2 = client.getWidget(WidgetInfo.DIALOG2_SPRITE_TEXT);
|
||||||
|
|
||||||
|
|||||||
@@ -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 + "</br>");
|
||||||
|
|
||||||
|
// 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 + "</br>");
|
||||||
|
|
||||||
|
// 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 + "</br>");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -72,7 +72,7 @@ public interface StatusBarsConfig extends Config
|
|||||||
)
|
)
|
||||||
default boolean toggleRestorationBars()
|
default boolean toggleRestorationBars()
|
||||||
{
|
{
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
|
|||||||
Reference in New Issue
Block a user