From ce69024d31216746020ef50149ea64b8dc81736c Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Thu, 8 Mar 2018 13:13:38 +0100 Subject: [PATCH] Remove special attack orb plugin Because special attack orb has been added to OSRS in latest update, this plugin is no longer needed. The functionality that shows next change will need to be readded in future. Signed-off-by: Tomas Slusny --- .../plugins/specorb/SpecOrbOverlay.java | 196 ------------------ .../client/plugins/specorb/SpecOrbPlugin.java | 60 ------ 2 files changed, 256 deletions(-) delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/specorb/SpecOrbOverlay.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/specorb/SpecOrbPlugin.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/specorb/SpecOrbOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/specorb/SpecOrbOverlay.java deleted file mode 100644 index f316727807..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/specorb/SpecOrbOverlay.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Copyright (c) 2017, 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.specorb; - -import com.google.inject.Singleton; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import java.io.IOException; -import javax.imageio.ImageIO; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.Point; -import net.runelite.api.Setting; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.VarbitChanged; -import net.runelite.api.widgets.Widget; -import net.runelite.api.widgets.WidgetInfo; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayLayer; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.components.MinimapOrb; - -@Singleton -public class SpecOrbOverlay extends Overlay -{ - private static final int RECHARGE_TIME_TICKS = 51; - - private static final int SPEC_ORB_X_FIXED = 34; - private static final int SPEC_ORB_Y_FIXED = 26; - private static final int PRAYER_ORB_Y_FIXED = 73; - private static final int RUN_ORB_X_FIXED = 12; - private static final int RUN_ORB_Y_FIXED = 108; - - private static final int SPEC_ORB_X_RESIZABLE = 29; - private static final int SPEC_ORB_Y_RESIZABLE = 28; - private static final int PRAYER_ORB_Y_RESIZABLE = 71; - private static final int RUN_ORB_X_RESIZABLE = 12; - private static final int RUN_ORB_Y_RESIZABLE = 103; - - private static final Color SPECIAL_ORB_BACKGROUND_COLOR = new Color(51, 102, 255); - - private final Client client; - private final MinimapOrb orb; - private int lastSpecialPercent = 0; - private int tickCounter = 0; - - @Inject - public SpecOrbOverlay(Client client) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.ABOVE_WIDGETS); - this.client = client; - try - { - BufferedImage icon; - synchronized (ImageIO.class) - { - icon = ImageIO.read(getClass().getResourceAsStream("special_orb_icon.png")); - } - orb = new MinimapOrb(SPECIAL_ORB_BACKGROUND_COLOR, SPECIAL_ORB_BACKGROUND_COLOR, icon); - } - catch (IOException e) - { - throw new RuntimeException(e); - } - } - - @Override - public Dimension render(Graphics2D graphics, java.awt.Point point) - { - Widget prayerOrb = client.getWidget(WidgetInfo.MINIMAP_PRAYER_ORB); - if (prayerOrb == null) - { - return null; - } - - Widget runOrb = client.getWidget(WidgetInfo.MINIMAP_RUN_ORB); - if (runOrb == null) - { - return null; - } - - if (client.isResized()) - { - if (prayerOrb.getRelativeY() != PRAYER_ORB_Y_FIXED) - { - prayerOrb.setRelativeY(PRAYER_ORB_Y_FIXED); - } - - if (runOrb.getRelativeX() != RUN_ORB_X_FIXED) - { - runOrb.setRelativeX(RUN_ORB_X_FIXED); - } - - if (runOrb.getRelativeY() != RUN_ORB_Y_FIXED) - { - runOrb.setRelativeY(RUN_ORB_Y_FIXED); - } - } - else - { - if (prayerOrb.getRelativeY() != PRAYER_ORB_Y_RESIZABLE) - { - prayerOrb.setRelativeY(PRAYER_ORB_Y_RESIZABLE); - } - - if (runOrb.getRelativeX() != RUN_ORB_X_RESIZABLE) - { - runOrb.setRelativeX(RUN_ORB_X_RESIZABLE); - } - - if (runOrb.getRelativeY() != RUN_ORB_Y_RESIZABLE) - { - runOrb.setRelativeY(RUN_ORB_Y_RESIZABLE); - } - } - - graphics.setColor(SPECIAL_ORB_BACKGROUND_COLOR); - - orb.setEnabled(client.getSetting(Setting.SPECIAL_ATTACK_ENABLED) == 1); - - // draw relative to run orb - Point runOrbPoint = runOrb.getCanvasLocation(); - java.awt.Point specOrbPoint = new java.awt.Point(runOrbPoint.getX() + (client.isResized() ? SPEC_ORB_X_RESIZABLE : SPEC_ORB_X_FIXED), - runOrbPoint.getY() + (client.isResized() ? SPEC_ORB_Y_RESIZABLE : SPEC_ORB_Y_FIXED)); - - double specialPercent = client.getSetting(Setting.SPECIAL_ATTACK_PERCENT) / 1000.0; - orb.setPercentFilled(specialPercent); - orb.setAmount((int) (specialPercent * 100)); - orb.setRechargePercentFilled(tickCounter / (double) RECHARGE_TIME_TICKS); - - orb.render(graphics, specOrbPoint); - - return null; - } - - public void onVarbitChanged(VarbitChanged event) - { - int specialPercent = client.getSetting(Setting.SPECIAL_ATTACK_PERCENT); - if (lastSpecialPercent != specialPercent) - { - int diff = specialPercent - lastSpecialPercent; - lastSpecialPercent = specialPercent; - onSpecialChange(diff); - } - } - - private void onSpecialChange(int diff) - { - // If we went from 500-600 for example - if (diff > 0) - { - // Reset the tick counter as we just recharged - tickCounter = 0; - } - } - - public void onTick(GameTick event) - { - // 1000 = 100%, 500 = 50%, 0 = 0% - int specialPercent = client.getSetting(Setting.SPECIAL_ATTACK_PERCENT); - // The recharge doesn't tick when at 100% - if (specialPercent == 1000) - { - tickCounter = 0; - } - else - { - tickCounter++; - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/specorb/SpecOrbPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/specorb/SpecOrbPlugin.java deleted file mode 100644 index 693e6c5de1..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/specorb/SpecOrbPlugin.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2017, 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.specorb; - -import com.google.common.eventbus.Subscribe; -import javax.inject.Inject; -import net.runelite.api.events.GameTick; -import net.runelite.api.events.VarbitChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.ui.overlay.Overlay; - -@PluginDescriptor( - name = "Special Attack Orb" -) -public class SpecOrbPlugin extends Plugin -{ - @Inject - private SpecOrbOverlay overlay; - - @Override - public Overlay getOverlay() - { - return overlay; - } - - @Subscribe - public void onVarbitChanged(VarbitChanged event) - { - overlay.onVarbitChanged(event); - } - - @Subscribe - public void onTick(GameTick event) - { - overlay.onTick(event); - } -}