This commit is contained in:
James Munson
2019-06-14 23:04:11 -07:00
parent 58c37c0b79
commit 94ee8e276a
3 changed files with 27 additions and 87 deletions

View File

@@ -38,20 +38,23 @@ import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition; import net.runelite.client.ui.overlay.OverlayPosition;
import net.runelite.client.ui.overlay.OverlayPriority; import net.runelite.client.ui.overlay.OverlayPriority;
import net.runelite.client.ui.overlay.OverlayUtil; import net.runelite.client.ui.overlay.OverlayUtil;
import net.runelite.client.ui.overlay.components.TextComponent;
class GrotesqueGuardiansOverlay extends Overlay class GrotesqueGuardiansOverlay extends Overlay
{ {
private static final int GROTESQUE_GUARDIANS_REGION_ID = 6727; private static final int GROTESQUE_GUARDIANS_REGION_ID = 6727;
private final Client client; private final Client client;
private final GrotesqueGuardiansPlugin plugin;
private static final int GROTESQUE_GUARDIANS_LIGHTNING_START = 1416; private static final int GROTESQUE_GUARDIANS_LIGHTNING_START = 1416;
private static final int GROTESQUE_GUARDIANS_LIGHTNING_END = 1431; private static final int GROTESQUE_GUARDIANS_LIGHTNING_END = 1431;
private static final int GROTESQUE_GUARDIANS_FALLING_ROCKS = 1436; private static final int GROTESQUE_GUARDIANS_FALLING_ROCKS = 1436;
private static final int GROTESQUE_GUARDIANS_STONE_ORB = 160; private static final int GROTESQUE_GUARDIANS_STONE_ORB = 160;
@Inject @Inject
private GrotesqueGuardiansOverlay(Client client) private GrotesqueGuardiansOverlay(Client client, GrotesqueGuardiansPlugin plugin)
{ {
this.client = client; this.client = client;
this.plugin = plugin;
setPosition(OverlayPosition.DYNAMIC); setPosition(OverlayPosition.DYNAMIC);
setLayer(OverlayLayer.ABOVE_SCENE); setLayer(OverlayLayer.ABOVE_SCENE);
setPriority(OverlayPriority.LOW); setPriority(OverlayPriority.LOW);
@@ -94,6 +97,24 @@ class GrotesqueGuardiansOverlay extends Overlay
{ {
OverlayUtil.renderPolygon(graphics, poly, color); 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; return null;
} }

View File

@@ -36,11 +36,13 @@ import net.runelite.api.NPC;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import net.runelite.api.Client; import net.runelite.api.Client;
import static net.runelite.api.NpcID.DUSK_7888;
@PluginDescriptor( @PluginDescriptor(
name = "Grotesque Guardians", name = "Grotesque Guardians",
description = "Show various helpful utitiles during the Grotesque Gaurdians (Gargoyles) fight", 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, type = PluginType.PVM,
enabledByDefault = false enabledByDefault = false
) )
@@ -54,8 +56,6 @@ public class GrotesqueGuardiansPlugin extends Plugin
private OverlayManager overlayManager; private OverlayManager overlayManager;
@Inject @Inject
private GrotesqueGuardiansPrayerOverlay prayerOverlay; private GrotesqueGuardiansPrayerOverlay prayerOverlay;
@Inject
private GrotesqueGuardiansTextOverlay textOverlay;
@Nullable @Nullable
private DuskAttack prayAgainst; private DuskAttack prayAgainst;
@Nullable @Nullable
@@ -77,7 +77,6 @@ public class GrotesqueGuardiansPlugin extends Plugin
{ {
overlayManager.add(overlay); overlayManager.add(overlay);
overlayManager.add(prayerOverlay); overlayManager.add(prayerOverlay);
overlayManager.add(textOverlay);
dusk = null; dusk = null;
prayAgainst = null; prayAgainst = null;
} }
@@ -86,7 +85,6 @@ public class GrotesqueGuardiansPlugin extends Plugin
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
overlayManager.remove(overlay); overlayManager.remove(overlay);
overlayManager.remove(textOverlay);
overlayManager.remove(prayerOverlay); overlayManager.remove(prayerOverlay);
dusk = null; dusk = null;
prayAgainst = null; prayAgainst = null;
@@ -100,7 +98,7 @@ public class GrotesqueGuardiansPlugin extends Plugin
{ {
regions.add(intValue); regions.add(intValue);
} }
if (regions.contains(6727)) if (regions.contains(GARGOYLES_REGION))
{ {
dusk = null; dusk = null;
inGargs = true; inGargs = true;
@@ -113,7 +111,7 @@ public class GrotesqueGuardiansPlugin extends Plugin
} }
if (inGargs && dusk != null) if (inGargs && dusk != null)
{ {
if (dusk.getId() == 7888) if (dusk.getId() == DUSK_7888)
{ {
if (dusk.getAnimation() == DuskAttack.MELEE.getAnimation()) if (dusk.getAnimation() == DuskAttack.MELEE.getAnimation())
{ {

View File

@@ -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;
}
}