From 5772de4cc28c37758e0508c782cc6b0fdb3225f6 Mon Sep 17 00:00:00 2001 From: James Munson Date: Fri, 14 Jun 2019 21:41:52 -0700 Subject: [PATCH 1/3] Updated Grotesque Guardians Plugin --- .../grotesqueguardians/DuskAttack.java | 53 ++++++++ .../GrotesqueGuardiansPlugin.java | 115 +++++++++++++++++- .../GrotesqueGuardiansPrayerOverlay.java | 98 +++++++++++++++ .../GrotesqueGuardiansTextOverlay.java | 80 ++++++++++++ 4 files changed, 344 insertions(+), 2 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/DuskAttack.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansPrayerOverlay.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansTextOverlay.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/DuskAttack.java b/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/DuskAttack.java new file mode 100644 index 0000000000..c8b6e89be3 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/DuskAttack.java @@ -0,0 +1,53 @@ +/* + * 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.grotesqueguardians; + +import net.runelite.api.Prayer; + +public enum DuskAttack +{ + MELEE(7800, Prayer.PROTECT_FROM_MELEE), + RANGE(7801, Prayer.PROTECT_FROM_MISSILES); + + private final int animation; + private final Prayer prayer; + + DuskAttack(int animation, Prayer prayer) + { + this.animation = animation; + this.prayer = prayer; + } + + public int getAnimation() + { + return animation; + } + + public Prayer getPrayer() + { + return prayer; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansPlugin.java index 507f6d75f6..3a6a033cfc 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansPlugin.java @@ -29,19 +29,45 @@ import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginType; import net.runelite.client.ui.overlay.OverlayManager; +import net.runelite.client.eventbus.Subscribe; +import java.util.ArrayList; +import net.runelite.api.events.GameTick; +import net.runelite.api.NPC; +import javax.annotation.Nullable; +import net.runelite.api.Client; + @PluginDescriptor( name = "Grotesque Guardians", - description = "Display tile indicators for the Grotesque Guardian special attacks", - tags = {"grotesque", "guardians", "gargoyle", "garg"}, + description = "Show various helpful utitiles during the Grotesque Gaurdians (Gargoyles) fight", + tags = { "bosses", "combat", "minigame", "overlay", "prayer", "pve", "pvm" }, type = PluginType.PVM, enabledByDefault = false ) public class GrotesqueGuardiansPlugin extends Plugin { + private static final int GARGOYLES_REGION = 6727; + @Inject + private Client client; @Inject private OverlayManager overlayManager; + @Inject + private GrotesqueGuardiansPrayerOverlay prayerOverlay; + @Inject + private GrotesqueGuardiansTextOverlay textOverlay; + @Nullable + private DuskAttack prayAgainst; + @Nullable + private NPC dusk; + private boolean inGargs; + private boolean needingToRun; + + public GrotesqueGuardiansPlugin() + { + inGargs = false; + needingToRun = false; + } @Inject private GrotesqueGuardiansOverlay overlay; @@ -50,11 +76,96 @@ public class GrotesqueGuardiansPlugin extends Plugin protected void startUp() throws Exception { overlayManager.add(overlay); + overlayManager.add(prayerOverlay); + overlayManager.add(textOverlay); + dusk = null; + prayAgainst = null; } @Override protected void shutDown() throws Exception { overlayManager.remove(overlay); + overlayManager.remove(textOverlay); + overlayManager.remove(prayerOverlay); + dusk = null; + prayAgainst = null; } + + @Subscribe + public void onGameTick(final GameTick event) + { + final ArrayList regions = new ArrayList(); + for (final int intValue : client.getMapRegions()) + { + regions.add(intValue); + } + if (regions.contains(6727)) + { + dusk = null; + inGargs = true; + for (final NPC npc : client.getNpcs()) + { + if (npc.getName() != null && npc.getName().contains("Dusk") && !npc.isDead()) + { + dusk = npc; + } + } + if (inGargs && dusk != null) + { + if (dusk.getId() == 7888) + { + if (dusk.getAnimation() == DuskAttack.MELEE.getAnimation()) + { + prayAgainst = DuskAttack.MELEE; + } + else if (dusk.getAnimation() == DuskAttack.RANGE.getAnimation()) + { + prayAgainst = DuskAttack.RANGE; + } + } + else + { + prayAgainst = null; + } + if (dusk.getAnimation() == 7802) + { + needingToRun = true; + } + else + { + needingToRun = false; + } + } + } + else + { + inGargs = false; + prayAgainst = null; + dusk = null; + } + } + + @Nullable + DuskAttack getPrayAgainst() + { + return prayAgainst; + } + + @Nullable + NPC getDusk() + { + return dusk; + } + + boolean isInGargs() + { + return inGargs; + } + + boolean isNeedingToRun() + { + return needingToRun; + } + } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansPrayerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansPrayerOverlay.java new file mode 100644 index 0000000000..595e8a83b7 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansPrayerOverlay.java @@ -0,0 +1,98 @@ +/* + * 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.grotesqueguardians; + +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.api.NPC; +import net.runelite.api.Perspective; +import net.runelite.api.coords.LocalPoint; +import net.runelite.client.game.SpriteManager; +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.OverlayPriority; +import net.runelite.client.ui.overlay.components.ComponentConstants; +import net.runelite.client.ui.overlay.components.ImageComponent; +import net.runelite.client.ui.overlay.components.PanelComponent; + +public class GrotesqueGuardiansPrayerOverlay extends Overlay +{ + private static final Color NOT_ACTIVATED_BACKGROUND_COLOR = new Color(150, 0, 0, 150); + private final Client client; + private final GrotesqueGuardiansPlugin plugin; + private final SpriteManager spriteManager; + private final PanelComponent imagePanelComponent = new PanelComponent(); + + @Inject + private GrotesqueGuardiansPrayerOverlay(Client client, GrotesqueGuardiansPlugin plugin, SpriteManager spriteManager) + { + setLayer(OverlayLayer.ABOVE_SCENE); + setPriority(OverlayPriority.HIGH); + setPosition(OverlayPosition.DYNAMIC); + this.client = client; + this.plugin = plugin; + this.spriteManager = spriteManager; + } + + public Dimension render(Graphics2D graphics) + { + imagePanelComponent.getChildren().clear(); + if ((plugin.isInGargs()) && (plugin.getPrayAgainst() != null) && (plugin.getDusk() != null)) + { + DuskAttack attack = plugin.getPrayAgainst(); + BufferedImage prayerImage = null; + prayerImage = getPrayerImage(attack); + imagePanelComponent.setBackgroundColor(client + .isPrayerActive(attack.getPrayer()) ? ComponentConstants.STANDARD_BACKGROUND_COLOR : NOT_ACTIVATED_BACKGROUND_COLOR); + + NPC dusk = plugin.getDusk(); + imagePanelComponent.getChildren().add(new ImageComponent(prayerImage)); + + + LocalPoint duskPoint = new LocalPoint(dusk.getLocalLocation().getX() + 128 * (dusk.getTransformedDefinition().getSize() - 1) / 2, dusk.getLocalLocation().getY() + 128 * (dusk.getTransformedDefinition().getSize() - 1) / 2); + net.runelite.api.Point duskLoc = Perspective.getCanvasImageLocation(client, duskPoint, prayerImage, 400); + if (duskLoc != null) + { + imagePanelComponent.setPreferredLocation(new java.awt.Point(duskLoc.getX(), duskLoc.getY())); + } + return imagePanelComponent.render(graphics); + } + return null; + } + + private BufferedImage getPrayerImage(DuskAttack attack) + { + int prayerSpriteID = attack == DuskAttack.MELEE ? 129 : 128; + + return spriteManager.getSprite(prayerSpriteID, 0); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansTextOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansTextOverlay.java new file mode 100644 index 0000000000..dbd3ae8bcd --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansTextOverlay.java @@ -0,0 +1,80 @@ +/* + * 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.grotesqueguardians; + +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.Perspective; +import net.runelite.api.coords.LocalPoint; +import net.runelite.client.game.SpriteManager; +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.OverlayPriority; +import net.runelite.client.ui.overlay.components.TextComponent; + +public class GrotesqueGuardiansTextOverlay extends Overlay +{ + private final Client client; + private final GrotesqueGuardiansPlugin plugin; + + @Inject + private GrotesqueGuardiansTextOverlay(Client client, GrotesqueGuardiansPlugin plugin, SpriteManager spriteManager) + { + setLayer(OverlayLayer.ABOVE_SCENE); + setPriority(OverlayPriority.HIGH); + setPosition(OverlayPosition.DYNAMIC); + this.client = client; + this.plugin = plugin; + } + + public Dimension render(Graphics2D graphics) + { + if ((plugin.isInGargs()) && (plugin.isNeedingToRun())) + { + if ((plugin.getDusk() != null) && (plugin.getDusk().getLocalLocation() != null)) + { + TextComponent textComponent = new TextComponent(); + LocalPoint duskPoint; + + duskPoint = new LocalPoint(plugin.getDusk().getLocalLocation().getX() + 128 * (plugin.getDusk().getTransformedDefinition().getSize() - 1) / 2, plugin.getDusk().getLocalLocation().getY() + 128 * (plugin.getDusk().getTransformedDefinition().getSize() - 1) / 2); + net.runelite.api.Point duskLoc = Perspective.getCanvasTextLocation(client, graphics, duskPoint, "RUN AWAY", 500); + if (duskLoc != null) + { + textComponent.setText("RUN AWAY"); + textComponent.setPosition(new java.awt.Point(duskLoc.getX(), duskLoc.getY())); + textComponent.setColor(Color.red); + textComponent.render(graphics); + } + } + } + return null; + } +} From 58c37c0b797b11a1fd50d563f359010bf12b596b Mon Sep 17 00:00:00 2001 From: James Munson Date: Fri, 14 Jun 2019 21:50:44 -0700 Subject: [PATCH 2/3] Update headers --- .../runelite/client/plugins/grotesqueguardians/DuskAttack.java | 1 - .../grotesqueguardians/GrotesqueGuardiansPrayerOverlay.java | 1 - .../grotesqueguardians/GrotesqueGuardiansTextOverlay.java | 1 - 3 files changed, 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/DuskAttack.java b/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/DuskAttack.java index c8b6e89be3..ece52fe62e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/DuskAttack.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/DuskAttack.java @@ -1,6 +1,5 @@ /* * 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 diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansPrayerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansPrayerOverlay.java index 595e8a83b7..c63c0845da 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansPrayerOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansPrayerOverlay.java @@ -1,6 +1,5 @@ /* * 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 diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansTextOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansTextOverlay.java index dbd3ae8bcd..baffa03f7f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansTextOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansTextOverlay.java @@ -1,6 +1,5 @@ /* * 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 From 94ee8e276a2e24d18cd7ff035d792e3e21c0e32b Mon Sep 17 00:00:00 2001 From: James Munson Date: Fri, 14 Jun 2019 23:04:11 -0700 Subject: [PATCH 3/3] Changes --- .../GrotesqueGuardiansOverlay.java | 23 +++++- .../GrotesqueGuardiansPlugin.java | 12 ++- .../GrotesqueGuardiansTextOverlay.java | 79 ------------------- 3 files changed, 27 insertions(+), 87 deletions(-) delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansTextOverlay.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansOverlay.java index 8f90c59363..0c02d79b92 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansOverlay.java @@ -38,20 +38,23 @@ import net.runelite.client.ui.overlay.OverlayLayer; import net.runelite.client.ui.overlay.OverlayPosition; import net.runelite.client.ui.overlay.OverlayPriority; import net.runelite.client.ui.overlay.OverlayUtil; +import net.runelite.client.ui.overlay.components.TextComponent; class GrotesqueGuardiansOverlay extends Overlay { private static final int GROTESQUE_GUARDIANS_REGION_ID = 6727; private final Client client; + private final GrotesqueGuardiansPlugin plugin; private static final int GROTESQUE_GUARDIANS_LIGHTNING_START = 1416; private static final int GROTESQUE_GUARDIANS_LIGHTNING_END = 1431; private static final int GROTESQUE_GUARDIANS_FALLING_ROCKS = 1436; private static final int GROTESQUE_GUARDIANS_STONE_ORB = 160; @Inject - private GrotesqueGuardiansOverlay(Client client) + private GrotesqueGuardiansOverlay(Client client, GrotesqueGuardiansPlugin plugin) { this.client = client; + this.plugin = plugin; setPosition(OverlayPosition.DYNAMIC); setLayer(OverlayLayer.ABOVE_SCENE); setPriority(OverlayPriority.LOW); @@ -94,6 +97,24 @@ class GrotesqueGuardiansOverlay extends Overlay { OverlayUtil.renderPolygon(graphics, poly, color); } + if ((plugin.isInGargs()) && (plugin.isNeedingToRun())) + { + if ((plugin.getDusk() != null) && (plugin.getDusk().getLocalLocation() != null)) + { + TextComponent textComponent = new TextComponent(); + LocalPoint duskPoint; + + duskPoint = new LocalPoint(plugin.getDusk().getLocalLocation().getX() + 128 * (plugin.getDusk().getTransformedDefinition().getSize() - 1) / 2, plugin.getDusk().getLocalLocation().getY() + 128 * (plugin.getDusk().getTransformedDefinition().getSize() - 1) / 2); + net.runelite.api.Point duskLoc = Perspective.getCanvasTextLocation(client, graphics, duskPoint, "RUN AWAY", 500); + if (duskLoc != null) + { + textComponent.setText("RUN AWAY"); + textComponent.setPosition(new java.awt.Point(duskLoc.getX(), duskLoc.getY())); + textComponent.setColor(Color.red); + textComponent.render(graphics); + } + } + } } return null; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansPlugin.java index 3a6a033cfc..77332e3c93 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansPlugin.java @@ -36,11 +36,13 @@ import net.runelite.api.NPC; import javax.annotation.Nullable; import net.runelite.api.Client; +import static net.runelite.api.NpcID.DUSK_7888; + @PluginDescriptor( name = "Grotesque Guardians", description = "Show various helpful utitiles during the Grotesque Gaurdians (Gargoyles) fight", - tags = { "bosses", "combat", "minigame", "overlay", "prayer", "pve", "pvm" }, + tags = { "bosses", "combat", "gargs", "overlay", "grotesque", "pve", "pvm" }, type = PluginType.PVM, enabledByDefault = false ) @@ -54,8 +56,6 @@ public class GrotesqueGuardiansPlugin extends Plugin private OverlayManager overlayManager; @Inject private GrotesqueGuardiansPrayerOverlay prayerOverlay; - @Inject - private GrotesqueGuardiansTextOverlay textOverlay; @Nullable private DuskAttack prayAgainst; @Nullable @@ -77,7 +77,6 @@ public class GrotesqueGuardiansPlugin extends Plugin { overlayManager.add(overlay); overlayManager.add(prayerOverlay); - overlayManager.add(textOverlay); dusk = null; prayAgainst = null; } @@ -86,7 +85,6 @@ public class GrotesqueGuardiansPlugin extends Plugin protected void shutDown() throws Exception { overlayManager.remove(overlay); - overlayManager.remove(textOverlay); overlayManager.remove(prayerOverlay); dusk = null; prayAgainst = null; @@ -100,7 +98,7 @@ public class GrotesqueGuardiansPlugin extends Plugin { regions.add(intValue); } - if (regions.contains(6727)) + if (regions.contains(GARGOYLES_REGION)) { dusk = null; inGargs = true; @@ -113,7 +111,7 @@ public class GrotesqueGuardiansPlugin extends Plugin } if (inGargs && dusk != null) { - if (dusk.getId() == 7888) + if (dusk.getId() == DUSK_7888) { if (dusk.getAnimation() == DuskAttack.MELEE.getAnimation()) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansTextOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansTextOverlay.java deleted file mode 100644 index baffa03f7f..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grotesqueguardians/GrotesqueGuardiansTextOverlay.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2018, https://runelitepl.us - * 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.grotesqueguardians; - -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.Perspective; -import net.runelite.api.coords.LocalPoint; -import net.runelite.client.game.SpriteManager; -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.OverlayPriority; -import net.runelite.client.ui.overlay.components.TextComponent; - -public class GrotesqueGuardiansTextOverlay extends Overlay -{ - private final Client client; - private final GrotesqueGuardiansPlugin plugin; - - @Inject - private GrotesqueGuardiansTextOverlay(Client client, GrotesqueGuardiansPlugin plugin, SpriteManager spriteManager) - { - setLayer(OverlayLayer.ABOVE_SCENE); - setPriority(OverlayPriority.HIGH); - setPosition(OverlayPosition.DYNAMIC); - this.client = client; - this.plugin = plugin; - } - - public Dimension render(Graphics2D graphics) - { - if ((plugin.isInGargs()) && (plugin.isNeedingToRun())) - { - if ((plugin.getDusk() != null) && (plugin.getDusk().getLocalLocation() != null)) - { - TextComponent textComponent = new TextComponent(); - LocalPoint duskPoint; - - duskPoint = new LocalPoint(plugin.getDusk().getLocalLocation().getX() + 128 * (plugin.getDusk().getTransformedDefinition().getSize() - 1) / 2, plugin.getDusk().getLocalLocation().getY() + 128 * (plugin.getDusk().getTransformedDefinition().getSize() - 1) / 2); - net.runelite.api.Point duskLoc = Perspective.getCanvasTextLocation(client, graphics, duskPoint, "RUN AWAY", 500); - if (duskLoc != null) - { - textComponent.setText("RUN AWAY"); - textComponent.setPosition(new java.awt.Point(duskLoc.getX(), duskLoc.getY())); - textComponent.setColor(Color.red); - textComponent.render(graphics); - } - } - } - return null; - } -}