From 902f2f4765b136e6bf6dada8cd65e97178738594 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Thu, 12 Apr 2018 12:03:05 +0200 Subject: [PATCH] Remove pyramid plunder plugin As the interface was changed in the http://services.runescape.com/m=news/quality-of-life-improvements?oldschool=1 OSRS update, this plugin is no longer necessary. Signed-off-by: Tomas Slusny --- .../pyramidplunder/PyramidPlunderOverlay.java | 101 ------------------ .../pyramidplunder/PyramidPlunderPlugin.java | 51 --------- .../plugins/pyramidplunder/PyramidTimer.java | 77 ------------- 3 files changed, 229 deletions(-) delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderOverlay.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderPlugin.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidTimer.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderOverlay.java deleted file mode 100644 index 15495f0ef7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderOverlay.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2018, NotFoxtrot - * 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.pyramidplunder; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.Varbits; -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.OverlayPosition; -import net.runelite.client.ui.overlay.components.PanelComponent; - -public class PyramidPlunderOverlay extends Overlay -{ - private final Client client; - private final PanelComponent panelComponent = new PanelComponent(); - - private PyramidTimer timer; - - @Inject - PyramidPlunderOverlay(Client client) - { - setPosition(OverlayPosition.TOP_LEFT); - this.client = client; - } - - @Override - public Dimension render(Graphics2D graphics) - { - Widget pyramidPlunderInfo = client.getWidget(WidgetInfo.PYRAMID_PLUNDER_DATA); - - if (pyramidPlunderInfo == null) - { - timer = null; - return null; - } - - panelComponent.getLines().clear(); - - pyramidPlunderInfo.setHidden(true); - - if (timer == null) - { - startTimer(); - } - - panelComponent.getLines().add(new PanelComponent.Line( - "Time left: ", Color.WHITE, timer.getText(), timer.getTextColor() - )); - - panelComponent.getLines().add(new PanelComponent.Line( - "Room: ", String.valueOf(client.getSetting(Varbits.PYRAMID_PLUNDER_ROOM)) + "/8" - )); - - return panelComponent.render(graphics); - } - - public void showWidget() - { - Widget pyramidPlunderInfo = client.getWidget(WidgetInfo.PYRAMID_PLUNDER_DATA); - - if (pyramidPlunderInfo != null) - { - pyramidPlunderInfo.setHidden(false); - } - } - - private void startTimer() - { - int plunderingTime = client.getSetting(Varbits.PYRAMID_PLUNDER_TIMER); - int timeLeft = (int) ((505 - plunderingTime) * 0.6); - - timer = new PyramidTimer(timeLeft); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderPlugin.java deleted file mode 100644 index fe8040105c..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidPlunderPlugin.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2018, NotFoxtrot - * 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.pyramidplunder; - -import javax.inject.Inject; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.ui.overlay.Overlay; - -@PluginDescriptor( - name = "Pyramid Plunder" -) -public class PyramidPlunderPlugin extends Plugin -{ - @Inject - private PyramidPlunderOverlay overlay; - - @Override - public Overlay getOverlay() - { - return overlay; - } - - @Override - protected void shutDown() throws Exception - { - overlay.showWidget(); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidTimer.java b/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidTimer.java deleted file mode 100644 index f212befab2..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pyramidplunder/PyramidTimer.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2018, NotFoxtrot - * 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.pyramidplunder; - -import com.google.common.base.Preconditions; -import java.awt.Color; -import java.time.Duration; -import java.time.Instant; -import java.time.temporal.ChronoUnit; - -class PyramidTimer -{ - private final Instant endTime; - - PyramidTimer(long period) - { - Preconditions.checkArgument(period > 0, "negative period!"); - - endTime = Instant.now().plus(period, ChronoUnit.SECONDS); - } - - public String getText() - { - if (isFinished()) - { - return "0:00"; - } - - Duration timeLeft = Duration.between(Instant.now(), endTime); - - int totalSeconds = (int) timeLeft.get(ChronoUnit.SECONDS); - - int minutes = (totalSeconds % 3600) / 60; - int seconds = totalSeconds % 60; - - return String.format("%d:%02d", minutes, seconds); - } - - public Color getTextColor() - { - Duration timeLeft = Duration.between(Instant.now(), endTime); - - if (timeLeft.getSeconds() < 30) - { - return Color.RED.brighter(); - } - - return Color.WHITE; - } - - private boolean isFinished() - { - return Instant.now().isAfter(endTime); - } -}