Clean up Cox Helper (#668)
* Clean up Cox Helper * Small Fix-up * Add Graphics Objects to API
This commit is contained in:
@@ -26,6 +26,9 @@
|
||||
package net.runelite.client.plugins.coxhelper;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
@@ -36,6 +39,24 @@ import net.runelite.client.config.Stub;
|
||||
|
||||
public interface CoxConfig extends Config
|
||||
{
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum FontStyle
|
||||
{
|
||||
BOLD("Bold", Font.BOLD),
|
||||
ITALIC("Italic", Font.ITALIC),
|
||||
PLAIN("Plain", Font.PLAIN);
|
||||
|
||||
private String name;
|
||||
private int font;
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return getName();
|
||||
}
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "muttadileStub",
|
||||
@@ -48,12 +69,12 @@ public interface CoxConfig extends Config
|
||||
}
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "Muttadile",
|
||||
keyName = "muttadile",
|
||||
name = "Muttadile Marker",
|
||||
description = "Places an overlay around muttadiles showing their melee range.",
|
||||
parent = "muttadileStub"
|
||||
)
|
||||
default boolean Muttadile()
|
||||
default boolean muttadile()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -71,12 +92,12 @@ public interface CoxConfig extends Config
|
||||
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "Tekton",
|
||||
keyName = "tekton",
|
||||
name = "Tekton Marker",
|
||||
description = "Places an overlay around Tekton showing his melee range.",
|
||||
parent = "tektonStub"
|
||||
)
|
||||
default boolean Tekton()
|
||||
default boolean tekton()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -106,12 +127,24 @@ public interface CoxConfig extends Config
|
||||
|
||||
@ConfigItem(
|
||||
position = 6,
|
||||
keyName = "Guardians",
|
||||
name = "Guardians timing",
|
||||
keyName = "guardians",
|
||||
name = "Guardians Overlay",
|
||||
description = "Places an overlay near Guardians showing safespot.",
|
||||
parent = "guardiansStub"
|
||||
)
|
||||
default boolean Guardians()
|
||||
default boolean guardians()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 6,
|
||||
keyName = "guardinTickCounter",
|
||||
name = "Guardians Tick Timing",
|
||||
description = "Places an overlay on Guardians showing attack tick timers.",
|
||||
parent = "guardiansStub"
|
||||
)
|
||||
default boolean guardinTickCounter()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -200,12 +233,12 @@ public interface CoxConfig extends Config
|
||||
|
||||
@ConfigItem(
|
||||
position = 14,
|
||||
keyName = "OlmTick",
|
||||
keyName = "olmTick",
|
||||
name = "Olm Tick Counter",
|
||||
description = "Show Tick Counter on Olm",
|
||||
parent = "olmStub"
|
||||
)
|
||||
default boolean OlmTick()
|
||||
default boolean olmTick()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, gazivodag <https://github.com/gazivodag>
|
||||
* Copyright (c) 2019, lyzrds <https://discord.gg/5eb9Fe>
|
||||
* Copyright (c) 2019, ganom <https://github.com/Ganom>
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -33,70 +33,114 @@ import java.awt.Rectangle;
|
||||
import java.awt.image.BufferedImage;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.NpcID;
|
||||
import net.runelite.api.SpriteID;
|
||||
import net.runelite.client.game.SpriteManager;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.components.ComponentConstants;
|
||||
import net.runelite.client.ui.overlay.components.ComponentOrientation;
|
||||
import net.runelite.client.ui.overlay.components.InfoBoxComponent;
|
||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||
import net.runelite.client.ui.overlay.components.table.TableAlignment;
|
||||
import net.runelite.client.ui.overlay.components.table.TableComponent;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
|
||||
class OlmPrayAgainstOverlay extends Overlay
|
||||
public class CoxInfoBox extends Overlay
|
||||
{
|
||||
private static final Color NOT_ACTIVATED_BACKGROUND_COLOR = new Color(150, 0, 0, 150);
|
||||
private final CoxPlugin plugin;
|
||||
private final CoxConfig config;
|
||||
private final Client client;
|
||||
private final SpriteManager spriteManager;
|
||||
private final PanelComponent prayAgainstPanel = new PanelComponent();
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
|
||||
@Inject
|
||||
OlmPrayAgainstOverlay(CoxPlugin plugin, CoxConfig config, Client client, SpriteManager spriteManager)
|
||||
CoxInfoBox(CoxPlugin plugin, CoxConfig config, Client client, SpriteManager spriteManager)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
this.client = client;
|
||||
this.spriteManager = spriteManager;
|
||||
setPosition(OverlayPosition.BOTTOM_RIGHT);
|
||||
panelComponent.setOrientation(ComponentOrientation.VERTICAL);
|
||||
setPosition(OverlayPosition.DETACHED);
|
||||
}
|
||||
|
||||
public Dimension render(Graphics2D graphics2D)
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
panelComponent.getChildren().clear();
|
||||
|
||||
final PrayAgainst prayAgainst = plugin.getPrayAgainstOlm();
|
||||
if (plugin.getPrayAgainstOlm() == null && !config.prayAgainstOlm())
|
||||
if (plugin.inRaid())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
prayAgainstPanel.getChildren().clear();
|
||||
|
||||
if (System.currentTimeMillis() < (plugin.getLastPrayTime() + 120000) && plugin.getPrayAgainstOlm() != null)
|
||||
{
|
||||
InfoBoxComponent prayComponent = new InfoBoxComponent();
|
||||
Image prayImg = scaleImg(getPrayerImage(plugin.prayAgainstOlm));
|
||||
prayComponent.setImage(prayImg);
|
||||
prayComponent.setColor(Color.WHITE);
|
||||
prayComponent.setBackgroundColor(client.isPrayerActive(prayAgainst.getPrayer())
|
||||
? ComponentConstants.STANDARD_BACKGROUND_COLOR
|
||||
: NOT_ACTIVATED_BACKGROUND_COLOR);
|
||||
prayComponent.setPreferredSize(new Dimension(40, 40));
|
||||
panelComponent.getChildren().add(prayComponent);
|
||||
final PrayAgainst prayAgainst = plugin.getPrayAgainstOlm();
|
||||
|
||||
panelComponent.setPreferredSize(new Dimension(40, 40));
|
||||
panelComponent.setBorder(new Rectangle(0, 0, 0, 0));
|
||||
return panelComponent.render(graphics2D);
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.setPrayAgainstOlm(null);
|
||||
if (plugin.getPrayAgainstOlm() == null && !config.prayAgainstOlm())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() < (plugin.getLastPrayTime() + 120000) && plugin.getPrayAgainstOlm() != null)
|
||||
{
|
||||
InfoBoxComponent prayComponent = new InfoBoxComponent();
|
||||
Image prayImg = scaleImg(getPrayerImage(plugin.prayAgainstOlm));
|
||||
prayComponent.setImage(prayImg);
|
||||
prayComponent.setColor(Color.WHITE);
|
||||
prayComponent.setBackgroundColor(client.isPrayerActive(prayAgainst.getPrayer())
|
||||
? ComponentConstants.STANDARD_BACKGROUND_COLOR
|
||||
: NOT_ACTIVATED_BACKGROUND_COLOR);
|
||||
prayComponent.setPreferredSize(new Dimension(40, 40));
|
||||
prayAgainstPanel.getChildren().add(prayComponent);
|
||||
|
||||
prayAgainstPanel.setPreferredSize(new Dimension(40, 40));
|
||||
prayAgainstPanel.setBorder(new Rectangle(0, 0, 0, 0));
|
||||
return prayAgainstPanel.render(graphics);
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.setPrayAgainstOlm(null);
|
||||
}
|
||||
|
||||
if (config.vangHealth() && plugin.isRunVanguard())
|
||||
{
|
||||
panelComponent.getChildren().add(TitleComponent.builder()
|
||||
.text("Vanguards")
|
||||
.color(Color.pink)
|
||||
.build());
|
||||
|
||||
TableComponent tableComponent = new TableComponent();
|
||||
tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT);
|
||||
for (NPCContainer npcs : plugin.getNpcContainer().values())
|
||||
{
|
||||
float percent = (float) npcs.getNpc().getHealthRatio() / npcs.getNpc().getHealth() * 100;
|
||||
switch (npcs.getNpc().getId())
|
||||
{
|
||||
case NpcID.VANGUARD_7527:
|
||||
tableComponent.addRow(ColorUtil.prependColorTag("Melee", npcs.getAttackStyle().getColor()),
|
||||
Integer.toString((int) percent));
|
||||
break;
|
||||
case NpcID.VANGUARD_7528:
|
||||
tableComponent.addRow(ColorUtil.prependColorTag("Range", npcs.getAttackStyle().getColor()),
|
||||
Integer.toString((int) percent));
|
||||
break;
|
||||
case NpcID.VANGUARD_7529:
|
||||
tableComponent.addRow(ColorUtil.prependColorTag("Mage", npcs.getAttackStyle().getColor()),
|
||||
Integer.toString((int) percent));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
panelComponent.getChildren().add(tableComponent);
|
||||
|
||||
return panelComponent.render(graphics);
|
||||
}
|
||||
}
|
||||
if (client.getLocalPlayer().getWorldLocation().getRegionID() == 4919)
|
||||
{
|
||||
plugin.setPrayAgainstOlm(null);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -134,6 +178,4 @@ class OlmPrayAgainstOverlay extends Overlay
|
||||
g.dispose();
|
||||
return scaledImage;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -34,9 +34,11 @@ import java.awt.Polygon;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.NPCDefinition;
|
||||
import net.runelite.api.NpcID;
|
||||
import net.runelite.api.Perspective;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
@@ -51,8 +53,6 @@ import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
public class CoxOverlay extends Overlay
|
||||
{
|
||||
private final Client client;
|
||||
|
||||
|
||||
private final CoxPlugin plugin;
|
||||
private final CoxConfig config;
|
||||
|
||||
@@ -72,7 +72,6 @@ public class CoxOverlay extends Overlay
|
||||
{
|
||||
for (WorldPoint point : plugin.getOlm_Heal())
|
||||
{
|
||||
client.setHintArrow(point);
|
||||
drawTile(graphics, point, config.tpColor(), 2, 150, 50);
|
||||
}
|
||||
|
||||
@@ -82,156 +81,260 @@ public class CoxOverlay extends Overlay
|
||||
drawTile(graphics, point, config.tpColor(), 2, 150, 50);
|
||||
}
|
||||
|
||||
if (plugin.isRunMutta())
|
||||
if (plugin.inRaid())
|
||||
{
|
||||
if (config.Muttadile())
|
||||
for (NPCContainer npcs : plugin.getNpcContainer().values())
|
||||
{
|
||||
NPC boss = plugin.getMomma_NPC();
|
||||
NPC baby = plugin.getMutta_NPC();
|
||||
if (boss != null)
|
||||
Color color;
|
||||
List<WorldPoint> hitSquares;
|
||||
int ticksLeft;
|
||||
switch (npcs.getNpc().getId())
|
||||
{
|
||||
int size = 1;
|
||||
NPCDefinition composition = boss.getTransformedDefinition();
|
||||
{
|
||||
size = composition.getSize();
|
||||
}
|
||||
List<WorldPoint> meleeRangeMom = getHitSquares(boss.getWorldLocation(), size, 1, false);
|
||||
for (WorldPoint p : meleeRangeMom)
|
||||
{
|
||||
drawTile(graphics, p, config.muttaColor(), 0, 0, 50);
|
||||
}
|
||||
}
|
||||
if (baby != null)
|
||||
{
|
||||
int size = 1;
|
||||
NPCDefinition compositionbaby = baby.getTransformedDefinition();
|
||||
{
|
||||
size = compositionbaby.getSize();
|
||||
}
|
||||
List<WorldPoint> meleeRange = getHitSquares(baby.getWorldLocation(), size, 1, false);
|
||||
for (WorldPoint p : meleeRange)
|
||||
{
|
||||
drawTile(graphics, p, config.muttaColor(), 0, 0, 50);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.isRunGuard())
|
||||
{
|
||||
if (config.Guardians())
|
||||
{
|
||||
NPC G1 = plugin.getGuard1_NPC();
|
||||
NPC G2 = plugin.getGuard2_NPC();
|
||||
int tick = plugin.getGuardTick();
|
||||
if (tick == 5)
|
||||
{
|
||||
if (G1 != null)
|
||||
{
|
||||
int size = 1;
|
||||
NPCDefinition composition = G1.getTransformedDefinition();
|
||||
case NpcID.TEKTON:
|
||||
case NpcID.TEKTON_7541:
|
||||
case NpcID.TEKTON_7542:
|
||||
case NpcID.TEKTON_7545:
|
||||
case NpcID.TEKTON_ENRAGED:
|
||||
case NpcID.TEKTON_ENRAGED_7544:
|
||||
if (config.tekton())
|
||||
{
|
||||
size = composition.getSize();
|
||||
}
|
||||
List<WorldPoint> meleeRange = getHitSquares(G1.getWorldLocation(), size, 1, true);
|
||||
for (WorldPoint p : meleeRange)
|
||||
{
|
||||
drawTile(graphics, p, config.guardColor(), 0, 0, 50);
|
||||
}
|
||||
}
|
||||
if (G2 != null)
|
||||
{
|
||||
int size = 1;
|
||||
NPCDefinition composition = G2.getTransformedDefinition();
|
||||
{
|
||||
size = composition.getSize();
|
||||
}
|
||||
List<WorldPoint> meleeRange = getHitSquares(G2.getWorldLocation(), size, 1, true);
|
||||
for (WorldPoint p : meleeRange)
|
||||
{
|
||||
drawTile(graphics, p, config.guardColor(), 0, 0, 50);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (plugin.isRunTekton())
|
||||
{
|
||||
if (config.Tekton())
|
||||
{
|
||||
NPC boss = plugin.getTekton_NPC();
|
||||
if (boss != null)
|
||||
{
|
||||
int size = 1;
|
||||
NPCDefinition composition = boss.getTransformedDefinition();
|
||||
{
|
||||
size = composition.getSize();
|
||||
}
|
||||
List<WorldPoint> meleeRange = getHitSquares(boss.getWorldLocation(), size, 1, false);
|
||||
for (WorldPoint p : meleeRange)
|
||||
{
|
||||
drawTile(graphics, p, config.tektonColor(), 0, 0, 50);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.isRunOlm())
|
||||
{
|
||||
NPC boss = plugin.getOlm_NPC();
|
||||
|
||||
if (config.OlmTick())
|
||||
{
|
||||
if (boss != null)
|
||||
{
|
||||
int tick = plugin.getOlm_TicksUntilAction();
|
||||
int cycle = plugin.getOlm_ActionCycle();
|
||||
int spec = plugin.getOlm_NextSpec();
|
||||
final String tickStr = String.valueOf(tick);
|
||||
String cycleStr = "?";
|
||||
switch (cycle)
|
||||
{
|
||||
case 1:
|
||||
switch (spec)
|
||||
hitSquares = getHitSquares(npcs.getNpc().getWorldLocation(), npcs.getNpcSize(), 1, false);
|
||||
for (WorldPoint p : hitSquares)
|
||||
{
|
||||
case 1:
|
||||
cycleStr = "Portals";
|
||||
break;
|
||||
case 2:
|
||||
cycleStr = "lightning";
|
||||
break;
|
||||
case 3:
|
||||
cycleStr = "Crystals";
|
||||
break;
|
||||
case 4:
|
||||
cycleStr = "Heal";
|
||||
break;
|
||||
case -1:
|
||||
cycleStr = "??";
|
||||
break;
|
||||
drawTile(graphics, p, config.tektonColor(), 0, 0, 50);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
cycleStr = "Sauto";
|
||||
break;
|
||||
case 3:
|
||||
cycleStr = "Null";
|
||||
break;
|
||||
case 4:
|
||||
cycleStr = "Nauto";
|
||||
break;
|
||||
case -1:
|
||||
cycleStr = "??";
|
||||
break;
|
||||
if (config.tektonTickCounter())
|
||||
{
|
||||
ticksLeft = npcs.getTicksUntilAttack();
|
||||
int attackTicksleft = plugin.getTektonAttackTicks();
|
||||
if (ticksLeft > 0)
|
||||
{
|
||||
if (ticksLeft == 1)
|
||||
{
|
||||
color = npcs.getAttackStyle().getColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
color = Color.WHITE;
|
||||
}
|
||||
final String ticksLeftStr = String.valueOf(ticksLeft);
|
||||
Point canvasPoint = npcs.getNpc().getCanvasTextLocation(graphics, ticksLeftStr, 0);
|
||||
renderTextLocation(graphics, ticksLeftStr, config.textSize(), config.fontStyle().getFont(), color, canvasPoint);
|
||||
}
|
||||
}
|
||||
if (config.tektonTickCounter())
|
||||
{
|
||||
final int attackTicksleft = plugin.getTektonAttackTicks();
|
||||
String attacksLeftStr;
|
||||
Color attackcolor;
|
||||
if (attackTicksleft >= 0 && plugin.isTektonActive())
|
||||
{
|
||||
if (attackTicksleft <= 1)
|
||||
{
|
||||
attackcolor = new Color(255, 0, 0, 255);
|
||||
attacksLeftStr = "Phase Over";
|
||||
}
|
||||
else
|
||||
{
|
||||
attackcolor = new Color(255, 255, 255, 255);
|
||||
attacksLeftStr = String.valueOf(attackTicksleft);
|
||||
}
|
||||
|
||||
if (npcs.getNpc() != null)
|
||||
{
|
||||
Point canvasPoint = npcs.getNpc().getCanvasTextLocation(graphics, attacksLeftStr, 0);
|
||||
renderTextLocationAbove(graphics, attacksLeftStr, config.textSize(), config.fontStyle().getFont(), attackcolor, canvasPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NpcID.MUTTADILE:
|
||||
case NpcID.MUTTADILE_7562:
|
||||
case NpcID.MUTTADILE_7563:
|
||||
if (config.muttadile())
|
||||
{
|
||||
hitSquares = getHitSquares(npcs.getNpc().getWorldLocation(), npcs.getNpcSize(), 1, false);
|
||||
for (WorldPoint p : hitSquares)
|
||||
{
|
||||
drawTile(graphics, p, config.muttaColor(), 0, 0, 50);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NpcID.GUARDIAN:
|
||||
case NpcID.GUARDIAN_7570:
|
||||
case NpcID.GUARDIAN_7571:
|
||||
case NpcID.GUARDIAN_7572:
|
||||
if (config.guardians())
|
||||
{
|
||||
hitSquares = getHitSquares(npcs.getNpc().getWorldLocation(), npcs.getNpcSize(), 2, true);
|
||||
for (WorldPoint p : hitSquares)
|
||||
{
|
||||
drawTile(graphics, p, config.guardColor(), 0, 0, 50);
|
||||
}
|
||||
}
|
||||
if (config.guardinTickCounter())
|
||||
{
|
||||
ticksLeft = npcs.getTicksUntilAttack();
|
||||
if (ticksLeft > 0)
|
||||
{
|
||||
if (ticksLeft == 1)
|
||||
{
|
||||
color = npcs.getAttackStyle().getColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
color = Color.WHITE;
|
||||
}
|
||||
final String ticksLeftStr = String.valueOf(ticksLeft);
|
||||
Point canvasPoint = npcs.getNpc().getCanvasTextLocation(graphics, ticksLeftStr, 0);
|
||||
renderTextLocation(graphics, ticksLeftStr, config.textSize(), config.fontStyle().getFont(), color, canvasPoint);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NpcID.VANGUARD_7526:
|
||||
case NpcID.VANGUARD_7527:
|
||||
case NpcID.VANGUARD_7528:
|
||||
case NpcID.VANGUARD_7529:
|
||||
if (config.vangHighlight())
|
||||
{
|
||||
OverlayUtil.renderPolygon(graphics, npcs.getNpc().getConvexHull(), npcs.getAttackStyle().getColor());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.isHandCripple())
|
||||
{
|
||||
int tick = plugin.getTimer();
|
||||
NPC olmHand = plugin.getHand();
|
||||
final String tickStr = String.valueOf(tick);
|
||||
Point canvasPoint = olmHand.getCanvasTextLocation(graphics, tickStr, 50);
|
||||
renderTextLocation(graphics, tickStr, config.textSize(), config.fontStyle().getFont(), Color.GRAY, canvasPoint);
|
||||
}
|
||||
|
||||
if (config.timers())
|
||||
{
|
||||
if (plugin.getBurnTarget().size() > 0)
|
||||
{
|
||||
for (Actor actor : plugin.getBurnTarget())
|
||||
{
|
||||
final int ticksLeft = plugin.getBurnTicks();
|
||||
String ticksLeftStr = String.valueOf(ticksLeft);
|
||||
Color tickcolor = new Color(255, 255, 255, 255);
|
||||
if (ticksLeft >= 0)
|
||||
{
|
||||
if (ticksLeft == 34 ||
|
||||
ticksLeft == 33 ||
|
||||
ticksLeft == 26 ||
|
||||
ticksLeft == 25 ||
|
||||
ticksLeft == 18 ||
|
||||
ticksLeft == 17 ||
|
||||
ticksLeft == 10 ||
|
||||
ticksLeft == 9 ||
|
||||
ticksLeft == 2 ||
|
||||
ticksLeft == 1)
|
||||
{
|
||||
tickcolor = new Color(255, 0, 0, 255);
|
||||
ticksLeftStr = "GAP";
|
||||
}
|
||||
else
|
||||
{
|
||||
tickcolor = new Color(255, 255, 255, 255);
|
||||
}
|
||||
Point canvasPoint = actor.getCanvasTextLocation(graphics, ticksLeftStr, 0);
|
||||
renderTextLocation(graphics, ticksLeftStr, config.textSize(), config.fontStyle().getFont(), tickcolor, canvasPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.getAcidTarget() != null)
|
||||
{
|
||||
Actor actor = plugin.getAcidTarget();
|
||||
renderActorOverlay(graphics, actor, config.acidColor(), 2, 100, 10);
|
||||
final int ticksLeft = plugin.getAcidTicks();
|
||||
Color tickcolor = new Color(255, 255, 255, 255);
|
||||
if (ticksLeft > 0)
|
||||
{
|
||||
if (ticksLeft > 1)
|
||||
{
|
||||
tickcolor = new Color(69, 241, 44, 255);
|
||||
}
|
||||
else
|
||||
{
|
||||
tickcolor = new Color(255, 255, 255, 255);
|
||||
}
|
||||
final String ticksLeftStr = String.valueOf(ticksLeft);
|
||||
Point canvasPoint = actor.getCanvasTextLocation(graphics, ticksLeftStr, 0);
|
||||
renderTextLocation(graphics, ticksLeftStr, config.textSize(), config.fontStyle().getFont(), tickcolor, canvasPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (config.tpOverlay())
|
||||
{
|
||||
if (plugin.getTeleportTarget() != null)
|
||||
{
|
||||
renderActorOverlay(graphics, plugin.getTeleportTarget(), new Color(193, 255, 245, 255), 2, 100, 10);
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.isRunOlm())
|
||||
{
|
||||
NPC boss = plugin.getOlm_NPC();
|
||||
|
||||
if (config.olmTick())
|
||||
{
|
||||
if (boss != null)
|
||||
{
|
||||
int tick = plugin.getOlm_TicksUntilAction();
|
||||
int cycle = plugin.getOlm_ActionCycle();
|
||||
int spec = plugin.getOlm_NextSpec();
|
||||
final String tickStr = String.valueOf(tick);
|
||||
String cycleStr = "?";
|
||||
switch (cycle)
|
||||
{
|
||||
case 1:
|
||||
switch (spec)
|
||||
{
|
||||
case 1:
|
||||
cycleStr = "Portals";
|
||||
break;
|
||||
case 2:
|
||||
cycleStr = "lightning";
|
||||
break;
|
||||
case 3:
|
||||
cycleStr = "Crystals";
|
||||
break;
|
||||
case 4:
|
||||
cycleStr = "Heal";
|
||||
break;
|
||||
case -1:
|
||||
cycleStr = "??";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
cycleStr = "Sauto";
|
||||
break;
|
||||
case 3:
|
||||
cycleStr = "Null";
|
||||
break;
|
||||
case 4:
|
||||
cycleStr = "Nauto";
|
||||
break;
|
||||
case -1:
|
||||
cycleStr = "??";
|
||||
break;
|
||||
}
|
||||
final String combinedStr = cycleStr + ":" + tickStr;
|
||||
Point canvasPoint = boss.getCanvasTextLocation(graphics, combinedStr, 130);
|
||||
renderTextLocation(graphics, combinedStr, config.textSize(), config.fontStyle().getFont(), Color.WHITE, canvasPoint);
|
||||
}
|
||||
final String combinedStr = cycleStr + ":" + tickStr;
|
||||
Point canvasPoint = boss.getCanvasTextLocation(graphics, combinedStr, 130);
|
||||
renderTextLocation(graphics, combinedStr, config.textSize(), config.fontStyle().getFont(), Color.WHITE, canvasPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -282,6 +385,22 @@ public class CoxOverlay extends Overlay
|
||||
}
|
||||
}
|
||||
|
||||
private void renderActorOverlay(Graphics2D graphics, Actor actor, Color color, int outlineWidth, int outlineAlpha, int fillAlpha)
|
||||
{
|
||||
int size = 1;
|
||||
LocalPoint lp = actor.getLocalLocation();
|
||||
Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, lp, size);
|
||||
|
||||
if (tilePoly != null)
|
||||
{
|
||||
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), outlineAlpha));
|
||||
graphics.setStroke(new BasicStroke(outlineWidth));
|
||||
graphics.draw(tilePoly);
|
||||
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), fillAlpha));
|
||||
graphics.fill(tilePoly);
|
||||
}
|
||||
}
|
||||
|
||||
private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint)
|
||||
{
|
||||
graphics.setFont(new Font("Arial", fontStyle, fontSize));
|
||||
@@ -301,6 +420,25 @@ public class CoxOverlay extends Overlay
|
||||
}
|
||||
}
|
||||
|
||||
private void renderTextLocationAbove(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint)
|
||||
{
|
||||
graphics.setFont(new Font("Arial", fontStyle, fontSize));
|
||||
if (canvasPoint != null)
|
||||
{
|
||||
final Point canvasCenterPoint = new Point(
|
||||
canvasPoint.getX(),
|
||||
canvasPoint.getY() + 20);
|
||||
final Point canvasCenterPoint_shadow = new Point(
|
||||
canvasPoint.getX() + 1,
|
||||
canvasPoint.getY() + 21);
|
||||
if (config.shadows())
|
||||
{
|
||||
OverlayUtil.renderTextLocation(graphics, canvasCenterPoint_shadow, txtString, Color.BLACK);
|
||||
}
|
||||
OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, txtString, fontColor);
|
||||
}
|
||||
}
|
||||
|
||||
private List<WorldPoint> getHitSquares(WorldPoint npcLoc, int npcSize, int thickness, boolean includeUnder)
|
||||
{
|
||||
List<WorldPoint> little = new WorldArea(npcLoc, npcSize, npcSize).toWorldPointList();
|
||||
@@ -318,16 +456,4 @@ public class CoxOverlay extends Overlay
|
||||
}
|
||||
return big;
|
||||
}
|
||||
|
||||
private void renderPoly(Graphics2D graphics, Color color, Polygon polygon)
|
||||
{
|
||||
if (polygon != null)
|
||||
{
|
||||
graphics.setColor(color);
|
||||
graphics.setStroke(new BasicStroke(2));
|
||||
graphics.draw(polygon);
|
||||
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20));
|
||||
graphics.fill(polygon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,9 @@ package net.runelite.client.plugins.coxhelper;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.inject.Inject;
|
||||
@@ -51,13 +53,12 @@ import net.runelite.api.Projectile;
|
||||
import net.runelite.api.ProjectileID;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.AnimationChanged;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.SpotAnimationChanged;
|
||||
import net.runelite.api.events.NpcDespawned;
|
||||
import net.runelite.api.events.NpcSpawned;
|
||||
import net.runelite.api.events.ProjectileMoved;
|
||||
import net.runelite.api.events.SpotAnimationChanged;
|
||||
import net.runelite.client.chat.ChatMessageManager;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
@@ -65,6 +66,7 @@ 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.util.Text;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "CoX Helper",
|
||||
@@ -78,175 +80,79 @@ import net.runelite.client.ui.overlay.OverlayManager;
|
||||
@Singleton
|
||||
public class CoxPlugin extends Plugin
|
||||
{
|
||||
private static final int GAMEOBJECT_ID_PSN = 30032;
|
||||
private static final int GRAPHICSOBJECT_ID_CRYSTAL = 1447;
|
||||
private static final int GRAPHICSOBJECT_ID_HEAL = 1363;
|
||||
private static final int ANIMATION_ID_G1 = 430;
|
||||
private static final String OLM_HAND_CRIPPLE = "The Great Olm\'s left claw clenches to protect itself temporarily.";
|
||||
private static final Pattern TP_REGEX = Pattern.compile("You have been paired with <col=ff0000>(.*)</col>! The magical power will enact soon...");
|
||||
private int sleepcount = 0;
|
||||
private boolean needOlm = false;
|
||||
private GraphicsObject teleportObject;
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private ChatMessageManager chatMessageManager;
|
||||
|
||||
@Inject
|
||||
private CoxOverlay overlay;
|
||||
|
||||
@Inject
|
||||
private TimersOverlay timersOverlay;
|
||||
|
||||
@Inject
|
||||
private CoxConfig config;
|
||||
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
|
||||
@Inject
|
||||
private OlmCrippleTimerOverlay olmCrippleTimerOverlay;
|
||||
|
||||
@Inject
|
||||
private OlmPrayAgainstOverlay prayAgainstOverlay;
|
||||
|
||||
@Inject
|
||||
private VanguardsHighlight vanguardsHighlight;
|
||||
|
||||
@Inject
|
||||
private VanguardsOverlay vanguardsOverlay;
|
||||
|
||||
@Setter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
protected PrayAgainst prayAgainstOlm;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean runMutta;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean runTekton;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean runVanguards;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean runGuard = false;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean enrageStage = false;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean HandCripple;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean runOlm;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private NPC rangeVang;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private NPC mageVang;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private NPC meleeVang;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private NPC Guard1_NPC;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private NPC Guard2_NPC;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private NPC Tekton_NPC;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private NPC hand;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private NPC Olm_NPC;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private NPC OlmMelee_NPC;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private NPC Mutta_NPC;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private NPC Momma_NPC;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<WorldPoint> Olm_Crystals = new ArrayList<>();
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<WorldPoint> Olm_Heal = new ArrayList<>();
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<WorldPoint> Olm_TP = new ArrayList<>();
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<WorldPoint> Olm_PSN = new ArrayList<>();
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<Actor> burnTarget = new ArrayList<>();
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Actor teleportTarget;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Actor acidTarget;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int mageVangHP = -1;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int rangeVangHP = -1;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int meleeVangHP = -1;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int timer = 45;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int burnTicks = 41;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int acidTicks = 25;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int teleportTicks = 10;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int tektonTicks;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int tektonAttacks;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int tektonAttackTicks;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int guardTick = -1;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int OlmPhase = 0;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int Olm_TicksUntilAction = -1;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int Olm_ActionCycle = -1; //4:0 = auto 3:0 = null 2:0 = auto 1:0 = spec + actioncycle =4
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int Olm_NextSpec = -1; // 1= crystals 2=lightnig 3=portals 4= heal hand if p4
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
protected long lastPrayTime;
|
||||
|
||||
private int sleepcount = 0;
|
||||
private boolean needOlm = false;
|
||||
private GraphicsObject teleportObject;
|
||||
@Inject
|
||||
private Client client;
|
||||
@Inject
|
||||
private ChatMessageManager chatMessageManager;
|
||||
@Inject
|
||||
private CoxOverlay coxOverlay;
|
||||
@Inject
|
||||
private CoxInfoBox coxInfoBox;
|
||||
@Inject
|
||||
private CoxConfig config;
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean HandCripple;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean runOlm;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean runVanguard;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean tektonActive;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private NPC hand;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private NPC Olm_NPC;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private NPC OlmMelee_NPC;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<WorldPoint> Olm_Crystals = new ArrayList<>();
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<WorldPoint> Olm_Heal = new ArrayList<>();
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<WorldPoint> Olm_TP = new ArrayList<>();
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<WorldPoint> Olm_PSN = new ArrayList<>();
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<Actor> burnTarget = new ArrayList<>();
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Actor teleportTarget;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Actor acidTarget;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int timer = 45;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int burnTicks = 41;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int acidTicks = 25;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int teleportTicks = 10;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int tektonAttackTicks;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int OlmPhase = 0;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int Olm_TicksUntilAction = -1;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int Olm_ActionCycle = -1; //4:0 = auto 3:0 = null 2:0 = auto 1:0 = spec + actioncycle =4
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int Olm_NextSpec = -1; // 1= crystals 2=lightnig 3=portals 4= heal hand if p4
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private float percent;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Map<NPC, NPCContainer> npcContainer = new HashMap<>();
|
||||
|
||||
@Provides
|
||||
CoxConfig getConfig(ConfigManager configManager)
|
||||
@@ -257,23 +163,15 @@ public class CoxPlugin extends Plugin
|
||||
@Override
|
||||
protected void startUp()
|
||||
{
|
||||
overlayManager.add(overlay);
|
||||
overlayManager.add(olmCrippleTimerOverlay);
|
||||
overlayManager.add(prayAgainstOverlay);
|
||||
overlayManager.add(timersOverlay);
|
||||
overlayManager.add(vanguardsHighlight);
|
||||
overlayManager.add(vanguardsOverlay);
|
||||
overlayManager.add(coxOverlay);
|
||||
overlayManager.add(coxInfoBox);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown()
|
||||
{
|
||||
overlayManager.remove(overlay);
|
||||
overlayManager.remove(olmCrippleTimerOverlay);
|
||||
overlayManager.remove(prayAgainstOverlay);
|
||||
overlayManager.remove(timersOverlay);
|
||||
overlayManager.remove(vanguardsHighlight);
|
||||
overlayManager.remove(vanguardsOverlay);
|
||||
overlayManager.remove(coxOverlay);
|
||||
overlayManager.remove(coxInfoBox);
|
||||
HandCripple = false;
|
||||
hand = null;
|
||||
acidTarget = null;
|
||||
@@ -287,11 +185,6 @@ public class CoxPlugin extends Plugin
|
||||
teleportTicks = 10;
|
||||
}
|
||||
|
||||
private boolean inRaid()
|
||||
{
|
||||
return client.getVar(Varbits.IN_RAID) == 1;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onChatMessage(ChatMessage chatMessage)
|
||||
{
|
||||
@@ -312,61 +205,44 @@ public class CoxPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
}
|
||||
String msg = chatMessage.getMessageNode().getValue().toLowerCase();
|
||||
if (msg.contains("the great olm rises with the power of"))
|
||||
switch (Text.standardize(chatMessage.getMessageNode().getValue()))
|
||||
{
|
||||
if (!runOlm)
|
||||
{
|
||||
Olm_ActionCycle = -1;
|
||||
Olm_TicksUntilAction = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
Olm_ActionCycle = -1;
|
||||
Olm_TicksUntilAction = 3;
|
||||
}
|
||||
OlmPhase = 0;
|
||||
runOlm = true;
|
||||
needOlm = true;
|
||||
Olm_NextSpec = -1;
|
||||
}
|
||||
case "the great olm rises with the power of acid.":
|
||||
case "the great olm rises with the power of crystal.":
|
||||
case "the great olm rises with the power of flame.":
|
||||
case "the great olm is giving its all. this is its final stand.":
|
||||
if (!runOlm)
|
||||
{
|
||||
Olm_ActionCycle = -1;
|
||||
Olm_TicksUntilAction = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
Olm_ActionCycle = -1;
|
||||
Olm_TicksUntilAction = 3;
|
||||
}
|
||||
OlmPhase = 0;
|
||||
runOlm = true;
|
||||
needOlm = true;
|
||||
Olm_NextSpec = -1;
|
||||
break;
|
||||
case "the great olm's left claw clenches to protect itself temporarily.":
|
||||
HandCripple = true;
|
||||
timer = 45;
|
||||
break;
|
||||
case "the great olm fires a sphere of aggression your way. your prayers have been sapped.":
|
||||
prayAgainstOlm = PrayAgainst.MELEE;
|
||||
lastPrayTime = System.currentTimeMillis();
|
||||
break;
|
||||
case "the great olm fires a sphere of magical power your way. your prayers have been sapped.":
|
||||
prayAgainstOlm = PrayAgainst.MAGIC;
|
||||
lastPrayTime = System.currentTimeMillis();
|
||||
break;
|
||||
case "the great olm fires a sphere of accuracy and dexterity your way. your prayers have been sapped.":
|
||||
prayAgainstOlm = PrayAgainst.RANGED;
|
||||
lastPrayTime = System.currentTimeMillis();
|
||||
break;
|
||||
|
||||
if (msg.contains("the great olm is giving its all. this is its final stand"))
|
||||
{
|
||||
if (!runOlm)
|
||||
{
|
||||
Olm_ActionCycle = -1;
|
||||
Olm_TicksUntilAction = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
Olm_ActionCycle = -1;
|
||||
Olm_TicksUntilAction = 3;
|
||||
}
|
||||
OlmPhase = 1;
|
||||
runOlm = true;
|
||||
needOlm = true;
|
||||
Olm_NextSpec = -1;
|
||||
}
|
||||
if (msg.startsWith(OLM_HAND_CRIPPLE))
|
||||
{
|
||||
HandCripple = true;
|
||||
timer = 45;
|
||||
}
|
||||
if (msg.contains("aggression"))
|
||||
{
|
||||
prayAgainstOlm = PrayAgainst.MELEE;
|
||||
lastPrayTime = System.currentTimeMillis();
|
||||
}
|
||||
if (msg.contains("of magical power"))
|
||||
{
|
||||
prayAgainstOlm = PrayAgainst.MAGIC;
|
||||
lastPrayTime = System.currentTimeMillis();
|
||||
}
|
||||
if (msg.contains("accuracy and dexterity"))
|
||||
{
|
||||
prayAgainstOlm = PrayAgainst.RANGED;
|
||||
lastPrayTime = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -390,7 +266,7 @@ public class CoxPlugin extends Plugin
|
||||
}
|
||||
if (projectile.getId() == ProjectileID.OLM_ACID_TRAIL)
|
||||
{
|
||||
/*acidTarget = projectile.getInteracting();*/
|
||||
acidTarget = projectile.getInteracting();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -403,37 +279,10 @@ public class CoxPlugin extends Plugin
|
||||
Actor actor = graphicChanged.getActor();
|
||||
if (actor.getSpotAnimation() == GraphicID.OLM_BURN)
|
||||
{
|
||||
burnTarget.add(actor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onAnimationChanged(AnimationChanged event)
|
||||
{
|
||||
if (event.getActor() == Tekton_NPC)
|
||||
{
|
||||
switch (Tekton_NPC.getAnimation())
|
||||
{
|
||||
case AnimationID.TEKTON_AUTO1:
|
||||
case AnimationID.TEKTON_AUTO2:
|
||||
case AnimationID.TEKTON_AUTO3:
|
||||
case AnimationID.TEKTON_ENRAGE_AUTO1:
|
||||
case AnimationID.TEKTON_ENRAGE_AUTO2:
|
||||
case AnimationID.TEKTON_ENRAGE_AUTO3:
|
||||
tektonTicks = 4;
|
||||
tektonAttacks++;
|
||||
break;
|
||||
case AnimationID.TEKTON_FAST_AUTO1:
|
||||
case AnimationID.TEKTON_FAST_AUTO2:
|
||||
tektonTicks = 3;
|
||||
tektonAttacks++;
|
||||
break;
|
||||
case AnimationID.TEKTON_ANVIL:
|
||||
tektonTicks = 15;
|
||||
tektonAttacks = 0;
|
||||
tektonAttackTicks = 47;
|
||||
break;
|
||||
if (!burnTarget.contains(actor))
|
||||
{
|
||||
burnTarget.add(actor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -452,36 +301,23 @@ public class CoxPlugin extends Plugin
|
||||
case NpcID.TEKTON_7545:
|
||||
case NpcID.TEKTON_ENRAGED:
|
||||
case NpcID.TEKTON_ENRAGED_7544:
|
||||
runTekton = true;
|
||||
Tekton_NPC = npc;
|
||||
npcContainer.put(npc, new NPCContainer(npc));
|
||||
tektonAttackTicks = 27;
|
||||
break;
|
||||
case NpcID.MUTTADILE:
|
||||
Momma_NPC = npc;
|
||||
break;
|
||||
case NpcID.MUTTADILE_7562:
|
||||
runMutta = true;
|
||||
Mutta_NPC = npc;
|
||||
break;
|
||||
case NpcID.MUTTADILE_7563:
|
||||
runMutta = true;
|
||||
Momma_NPC = npc;
|
||||
break;
|
||||
case NpcID.GUARDIAN:
|
||||
Guard1_NPC = npc;
|
||||
guardTick = -1;
|
||||
runGuard = true;
|
||||
break;
|
||||
case NpcID.GUARDIAN_7570:
|
||||
Guard2_NPC = npc;
|
||||
guardTick = -1;
|
||||
runGuard = true;
|
||||
npcContainer.put(npc, new NPCContainer(npc));
|
||||
break;
|
||||
case NpcID.VANGUARD:
|
||||
case NpcID.VANGUARD_7526:
|
||||
case NpcID.VANGUARD_7527:
|
||||
case NpcID.VANGUARD_7528:
|
||||
case NpcID.VANGUARD_7529:
|
||||
runVanguards = true;
|
||||
runVanguard = true;
|
||||
npcContainer.put(npc, new NPCContainer(npc));
|
||||
break;
|
||||
case NpcID.GREAT_OLM_LEFT_CLAW:
|
||||
case NpcID.GREAT_OLM_LEFT_CLAW_7555:
|
||||
@@ -492,11 +328,11 @@ public class CoxPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onNpcDespawned(NpcDespawned npcDespawned)
|
||||
public void onNpcDespawned(NpcDespawned event)
|
||||
{
|
||||
if (inRaid())
|
||||
{
|
||||
NPC npc = npcDespawned.getNpc();
|
||||
NPC npc = event.getNpc();
|
||||
switch (npc.getId())
|
||||
{
|
||||
case NpcID.TEKTON:
|
||||
@@ -505,35 +341,28 @@ public class CoxPlugin extends Plugin
|
||||
case NpcID.TEKTON_7545:
|
||||
case NpcID.TEKTON_ENRAGED:
|
||||
case NpcID.TEKTON_ENRAGED_7544:
|
||||
enrageStage = false;
|
||||
runTekton = false;
|
||||
Tekton_NPC = null;
|
||||
break;
|
||||
case NpcID.MUTTADILE:
|
||||
Momma_NPC = null;
|
||||
break;
|
||||
case NpcID.MUTTADILE_7562:
|
||||
Mutta_NPC = null;
|
||||
break;
|
||||
case NpcID.MUTTADILE_7563:
|
||||
runMutta = false;
|
||||
Momma_NPC = null;
|
||||
break;
|
||||
case NpcID.GUARDIAN:
|
||||
Guard1_NPC = null;
|
||||
runGuard = false;
|
||||
Guard2_NPC = null;
|
||||
break;
|
||||
case NpcID.GUARDIAN_7570:
|
||||
Guard2_NPC = null;
|
||||
Guard1_NPC = null;
|
||||
runGuard = false;
|
||||
break;
|
||||
case NpcID.GUARDIAN_7571:
|
||||
case NpcID.GUARDIAN_7572:
|
||||
Guard1_NPC = null;
|
||||
Guard2_NPC = null;
|
||||
runGuard = false;
|
||||
if (npcContainer.remove(event.getNpc()) != null && !npcContainer.isEmpty())
|
||||
{
|
||||
npcContainer.remove(event.getNpc());
|
||||
}
|
||||
break;
|
||||
case NpcID.VANGUARD:
|
||||
case NpcID.VANGUARD_7526:
|
||||
case NpcID.VANGUARD_7527:
|
||||
case NpcID.VANGUARD_7528:
|
||||
case NpcID.VANGUARD_7529:
|
||||
if (npcContainer.remove(event.getNpc()) != null && !npcContainer.isEmpty())
|
||||
{
|
||||
npcContainer.remove(event.getNpc());
|
||||
}
|
||||
runVanguard = false;
|
||||
break;
|
||||
case NpcID.GREAT_OLM_RIGHT_CLAW_7553:
|
||||
case NpcID.GREAT_OLM_RIGHT_CLAW:
|
||||
@@ -548,21 +377,20 @@ public class CoxPlugin extends Plugin
|
||||
{
|
||||
if (!inRaid())
|
||||
{
|
||||
runOlm = false;
|
||||
runGuard = false;
|
||||
runMutta = false;
|
||||
runTekton = false;
|
||||
runVanguards = false;
|
||||
enrageStage = false;
|
||||
needOlm = false;
|
||||
OlmPhase = 0;
|
||||
sleepcount = 0;
|
||||
Olm_Heal.clear();
|
||||
burnTarget.clear();
|
||||
npcContainer.clear();
|
||||
Olm_NPC = null;
|
||||
hand = null;
|
||||
prayAgainstOlm = null;
|
||||
runOlm = false;
|
||||
return;
|
||||
}
|
||||
|
||||
npcHandler();
|
||||
|
||||
if (needOlm = true)
|
||||
{
|
||||
for (NPC monster : client.getNpcs())
|
||||
@@ -576,221 +404,231 @@ public class CoxPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
if (runTekton)
|
||||
if (teleportTarget != null)
|
||||
{
|
||||
runVanguards = false;
|
||||
if (Tekton_NPC.getId() == NpcID.TEKTON_ENRAGED || Tekton_NPC.getId() == NpcID.TEKTON_ENRAGED_7544)
|
||||
log.info(teleportTarget.getName());
|
||||
Player target = (Player) teleportTarget;
|
||||
client.setHintArrow(target);
|
||||
teleportTicks--;
|
||||
if (teleportTicks <= 0)
|
||||
{
|
||||
enrageStage = true;
|
||||
}
|
||||
if (tektonTicks > 0)
|
||||
{
|
||||
tektonTicks--;
|
||||
}
|
||||
if (tektonAttacks > 0 && tektonAttackTicks > 0)
|
||||
{
|
||||
tektonAttackTicks--;
|
||||
client.clearHintArrow();
|
||||
teleportTarget = null;
|
||||
teleportTicks = 10;
|
||||
}
|
||||
}
|
||||
|
||||
if (runGuard)
|
||||
if (acidTarget != null)
|
||||
{
|
||||
runVanguards = false;
|
||||
if (guardTick == -1)
|
||||
acidTicks--;
|
||||
if (acidTicks <= 0)
|
||||
{
|
||||
if (Guard1_NPC != null)
|
||||
{
|
||||
if (Guard1_NPC.getAnimation() == ANIMATION_ID_G1)
|
||||
{
|
||||
guardTick = 5;
|
||||
}
|
||||
}
|
||||
if (Guard2_NPC != null)
|
||||
{
|
||||
if (Guard2_NPC.getAnimation() == ANIMATION_ID_G1)
|
||||
{
|
||||
guardTick = 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
guardTick--;
|
||||
}
|
||||
if (guardTick == 0)
|
||||
{
|
||||
guardTick = 5;
|
||||
acidTarget = null;
|
||||
acidTicks = 25;
|
||||
}
|
||||
}
|
||||
|
||||
if (runVanguards)
|
||||
if (burnTarget.size() > 0)
|
||||
{
|
||||
for (NPC npc : client.getNpcs())
|
||||
burnTicks--;
|
||||
if (burnTicks <= 0)
|
||||
{
|
||||
switch (npc.getId())
|
||||
{
|
||||
case NpcID.VANGUARD_7529:
|
||||
percent = (float) npc.getHealthRatio() / npc.getHealth() * 100;
|
||||
mageVangHP = (int) percent;
|
||||
mageVang = npc;
|
||||
break;
|
||||
case NpcID.VANGUARD_7528:
|
||||
percent = (float) npc.getHealthRatio() / npc.getHealth() * 100;
|
||||
rangeVangHP = (int) percent;
|
||||
rangeVang = npc;
|
||||
break;
|
||||
case NpcID.VANGUARD_7527:
|
||||
percent = (float) npc.getHealthRatio() / npc.getHealth() * 100;
|
||||
meleeVangHP = (int) percent;
|
||||
meleeVang = npc;
|
||||
break;
|
||||
case NpcID.VANGUARD_7526:
|
||||
break;
|
||||
}
|
||||
burnTarget.clear();
|
||||
burnTicks = 41;
|
||||
}
|
||||
if (mageVangHP == 0 && meleeVangHP == 0 && rangeVangHP == 0)
|
||||
}
|
||||
|
||||
if (HandCripple)
|
||||
{
|
||||
timer--;
|
||||
if (timer <= 0)
|
||||
{
|
||||
runVanguards = false;
|
||||
HandCripple = false;
|
||||
timer = 45;
|
||||
}
|
||||
}
|
||||
|
||||
if (runOlm)
|
||||
{
|
||||
runVanguards = false;
|
||||
Olm_Crystals.clear();
|
||||
Olm_Heal.clear();
|
||||
Olm_TP.clear();
|
||||
client.clearHintArrow();
|
||||
sleepcount--;
|
||||
olmHandler();
|
||||
}
|
||||
}
|
||||
|
||||
if (teleportTarget != null)
|
||||
private void npcHandler()
|
||||
{
|
||||
for (NPCContainer npcs : getNpcContainer().values())
|
||||
{
|
||||
switch (npcs.getNpc().getId())
|
||||
{
|
||||
log.info(teleportTarget.getName());
|
||||
Player target = (Player) teleportTarget;
|
||||
client.setHintArrow(target);
|
||||
teleportTicks--;
|
||||
if (teleportTicks <= 0)
|
||||
{
|
||||
client.clearHintArrow();
|
||||
teleportTarget = null;
|
||||
teleportTicks = 10;
|
||||
}
|
||||
}
|
||||
if (acidTarget != null)
|
||||
{
|
||||
acidTicks--;
|
||||
if (acidTicks <= 0)
|
||||
{
|
||||
acidTarget = null;
|
||||
acidTicks = 25;
|
||||
}
|
||||
}
|
||||
if (burnTarget.size() > 0)
|
||||
{
|
||||
burnTicks--;
|
||||
if (burnTicks <= 0)
|
||||
{
|
||||
burnTarget.clear();
|
||||
burnTicks = 41;
|
||||
}
|
||||
}
|
||||
if (HandCripple)
|
||||
{
|
||||
timer--;
|
||||
if (timer <= 0)
|
||||
{
|
||||
HandCripple = false;
|
||||
timer = 45;
|
||||
}
|
||||
}
|
||||
|
||||
if (Olm_TicksUntilAction == 1)
|
||||
{
|
||||
if (Olm_ActionCycle == 1)
|
||||
{
|
||||
Olm_ActionCycle = 4;
|
||||
Olm_TicksUntilAction = 4;
|
||||
if (Olm_NextSpec == 1)
|
||||
case NpcID.TEKTON:
|
||||
case NpcID.TEKTON_7541:
|
||||
case NpcID.TEKTON_7542:
|
||||
case NpcID.TEKTON_7545:
|
||||
case NpcID.TEKTON_ENRAGED:
|
||||
case NpcID.TEKTON_ENRAGED_7544:
|
||||
npcs.setTicksUntilAttack(npcs.getTicksUntilAttack() - 1);
|
||||
npcs.setAttackStyle(NPCContainer.Attackstyle.MELEE);
|
||||
switch (npcs.getNpc().getAnimation())
|
||||
{
|
||||
if (OlmPhase == 1)
|
||||
{
|
||||
Olm_NextSpec = 4; // 4 = heal 3= cry 2 = lightn 1 = swap
|
||||
}
|
||||
else
|
||||
{
|
||||
Olm_NextSpec = 3;
|
||||
}
|
||||
case AnimationID.TEKTON_AUTO1:
|
||||
case AnimationID.TEKTON_AUTO2:
|
||||
case AnimationID.TEKTON_AUTO3:
|
||||
case AnimationID.TEKTON_ENRAGE_AUTO1:
|
||||
case AnimationID.TEKTON_ENRAGE_AUTO2:
|
||||
case AnimationID.TEKTON_ENRAGE_AUTO3:
|
||||
tektonActive = true;
|
||||
if (npcs.getTicksUntilAttack() < 1)
|
||||
{
|
||||
npcs.setTicksUntilAttack(4);
|
||||
}
|
||||
break;
|
||||
case AnimationID.TEKTON_FAST_AUTO1:
|
||||
case AnimationID.TEKTON_FAST_AUTO2:
|
||||
tektonActive = true;
|
||||
if (npcs.getTicksUntilAttack() < 1)
|
||||
{
|
||||
npcs.setTicksUntilAttack(3);
|
||||
}
|
||||
break;
|
||||
case AnimationID.TEKTON_ANVIL:
|
||||
tektonActive = false;
|
||||
tektonAttackTicks = 47;
|
||||
if (npcs.getTicksUntilAttack() < 1)
|
||||
{
|
||||
npcs.setTicksUntilAttack(15);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NpcID.GUARDIAN:
|
||||
case NpcID.GUARDIAN_7570:
|
||||
case NpcID.GUARDIAN_7571:
|
||||
case NpcID.GUARDIAN_7572:
|
||||
npcs.setTicksUntilAttack(npcs.getTicksUntilAttack() - 1);
|
||||
npcs.setAttackStyle(NPCContainer.Attackstyle.MELEE);
|
||||
if (npcs.getNpc().getAnimation() == ANIMATION_ID_G1 &&
|
||||
npcs.getTicksUntilAttack() < 1)
|
||||
{
|
||||
npcs.setTicksUntilAttack(5);
|
||||
}
|
||||
break;
|
||||
case NpcID.VANGUARD_7529:
|
||||
npcs.setAttackStyle(NPCContainer.Attackstyle.MAGE);
|
||||
break;
|
||||
case NpcID.VANGUARD_7528:
|
||||
npcs.setAttackStyle(NPCContainer.Attackstyle.RANGE);
|
||||
break;
|
||||
case NpcID.VANGUARD_7527:
|
||||
npcs.setAttackStyle(NPCContainer.Attackstyle.MELEE);
|
||||
break;
|
||||
case NpcID.VANGUARD_7526:
|
||||
npcs.setAttackStyle(NPCContainer.Attackstyle.UNKNOWN);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (tektonActive && tektonAttackTicks > 0)
|
||||
{
|
||||
tektonAttackTicks--;
|
||||
}
|
||||
}
|
||||
|
||||
private void olmHandler()
|
||||
{
|
||||
Olm_Crystals.clear();
|
||||
Olm_Heal.clear();
|
||||
Olm_TP.clear();
|
||||
client.clearHintArrow();
|
||||
sleepcount--;
|
||||
if (Olm_TicksUntilAction == 1)
|
||||
{
|
||||
if (Olm_ActionCycle == 1)
|
||||
{
|
||||
Olm_ActionCycle = 4;
|
||||
Olm_TicksUntilAction = 4;
|
||||
if (Olm_NextSpec == 1)
|
||||
{
|
||||
if (OlmPhase == 1)
|
||||
{
|
||||
Olm_NextSpec = 4; // 4 = heal 3= cry 2 = lightn 1 = swap
|
||||
}
|
||||
else
|
||||
{
|
||||
Olm_NextSpec--;
|
||||
Olm_NextSpec = 3;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Olm_ActionCycle != -1)
|
||||
{
|
||||
Olm_ActionCycle--;
|
||||
}
|
||||
Olm_TicksUntilAction = 4;
|
||||
Olm_NextSpec--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Olm_TicksUntilAction--;
|
||||
if (Olm_ActionCycle != -1)
|
||||
{
|
||||
Olm_ActionCycle--;
|
||||
}
|
||||
Olm_TicksUntilAction = 4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Olm_TicksUntilAction--;
|
||||
}
|
||||
|
||||
for (GraphicsObject o : client.getGraphicsObjects())
|
||||
for (GraphicsObject o : client.getGraphicsObjects())
|
||||
{
|
||||
if (o.getId() == GraphicID.OLM_CRYSTAL)
|
||||
{
|
||||
if (o.getId() == GRAPHICSOBJECT_ID_CRYSTAL)
|
||||
WorldPoint newloc;
|
||||
for (int x = -1; x <= 1; x++)
|
||||
{
|
||||
WorldPoint newloc;
|
||||
for (int x = -1; x <= 1; x++)
|
||||
for (int y = -1; y <= 1; y++)
|
||||
{
|
||||
for (int y = -1; y <= 1; y++)
|
||||
{
|
||||
newloc = WorldPoint.fromLocal(client, o.getLocation());
|
||||
newloc = newloc.dx(x);
|
||||
newloc = newloc.dy(y);
|
||||
Olm_Crystals.add(newloc);
|
||||
}
|
||||
newloc = WorldPoint.fromLocal(client, o.getLocation());
|
||||
newloc = newloc.dx(x);
|
||||
newloc = newloc.dy(y);
|
||||
Olm_Crystals.add(newloc);
|
||||
}
|
||||
}
|
||||
if (sleepcount <= 0)
|
||||
}
|
||||
if (sleepcount <= 0)
|
||||
{
|
||||
if (o.getId() == 1338)
|
||||
{
|
||||
if (o.getId() == 1338)
|
||||
{
|
||||
Olm_TicksUntilAction = 1;
|
||||
Olm_NextSpec = 2;
|
||||
Olm_ActionCycle = 4; //spec=1 null=3
|
||||
sleepcount = 5;
|
||||
}
|
||||
if (o.getId() == 1356)
|
||||
{
|
||||
Olm_TicksUntilAction = 4;
|
||||
Olm_NextSpec = 1;
|
||||
Olm_ActionCycle = 4; //spec=1 null=3
|
||||
sleepcount = 50;
|
||||
}
|
||||
Olm_TicksUntilAction = 1;
|
||||
Olm_NextSpec = 2;
|
||||
Olm_ActionCycle = 4; //spec=1 null=3
|
||||
sleepcount = 5;
|
||||
}
|
||||
if (o.getId() == 1359)
|
||||
if (o.getId() == 1356)
|
||||
{
|
||||
Olm_TP.add(WorldPoint.fromLocal(client, o.getLocation()));
|
||||
Olm_TicksUntilAction = 4;
|
||||
Olm_NextSpec = 1;
|
||||
Olm_ActionCycle = 4; //spec=1 null=3
|
||||
sleepcount = 50;
|
||||
}
|
||||
if (o.getId() == GRAPHICSOBJECT_ID_HEAL)
|
||||
}
|
||||
if (o.getId() == GraphicID.OLM_TELEPORT)
|
||||
{
|
||||
Olm_TP.add(WorldPoint.fromLocal(client, o.getLocation()));
|
||||
}
|
||||
if (o.getId() == GraphicID.OLM_HEAL)
|
||||
{
|
||||
Olm_Heal.add(WorldPoint.fromLocal(client, o.getLocation()));
|
||||
}
|
||||
if (!Olm_TP.isEmpty())
|
||||
{
|
||||
teleportTicks--;
|
||||
if (teleportTicks <= 0)
|
||||
{
|
||||
Olm_Heal.add(WorldPoint.fromLocal(client, o.getLocation()));
|
||||
}
|
||||
if (!Olm_TP.isEmpty())
|
||||
{
|
||||
teleportTicks--;
|
||||
if (teleportTicks <= 0)
|
||||
{
|
||||
client.clearHintArrow();
|
||||
teleportTicks = 10;
|
||||
}
|
||||
client.clearHintArrow();
|
||||
teleportTicks = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean inRaid()
|
||||
{
|
||||
return client.getVar(Varbits.IN_RAID) == 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019, ganom <https://github.com/Ganom>
|
||||
* 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.coxhelper;
|
||||
|
||||
import java.awt.Font;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum FontStyle
|
||||
{
|
||||
BOLD("Bold", Font.BOLD),
|
||||
ITALIC("Italic", Font.ITALIC),
|
||||
PLAIN("Plain", Font.PLAIN);
|
||||
|
||||
private String name;
|
||||
private int font;
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return getName();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Woox <https://github.com/wooxsolo>
|
||||
* Copyright (c) 2019, Ganom <https://github.com/Ganom>
|
||||
* 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.coxhelper;
|
||||
|
||||
import java.awt.Color;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.NPCDefinition;
|
||||
|
||||
class NPCContainer
|
||||
{
|
||||
|
||||
@Getter
|
||||
private NPC npc;
|
||||
|
||||
@Getter
|
||||
private int npcIndex;
|
||||
|
||||
@Getter
|
||||
private String npcName;
|
||||
|
||||
@Getter
|
||||
private int npcSize;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
private int ticksUntilAttack;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
private int intermissionPeriod;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
private int npcSpeed;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
private Actor npcInteracting;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
private Specials specials;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
private Attackstyle attackStyle;
|
||||
|
||||
|
||||
NPCContainer(NPC npc)
|
||||
{
|
||||
this.npc = npc;
|
||||
this.npcName = npc.getName();
|
||||
this.npcIndex = npc.getIndex();
|
||||
this.npcInteracting = npc.getInteracting();
|
||||
this.npcSpeed = 0;
|
||||
this.ticksUntilAttack = 0;
|
||||
this.intermissionPeriod = 0;
|
||||
this.attackStyle = Attackstyle.UNKNOWN;
|
||||
this.specials = Specials.UNKNOWN;
|
||||
final NPCDefinition composition = npc.getTransformedDefinition();
|
||||
|
||||
if (composition != null)
|
||||
{
|
||||
this.npcSize = composition.getSize();
|
||||
}
|
||||
}
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum Specials
|
||||
{
|
||||
PORTALS("Portals"),
|
||||
LIGHTNING("Lightning"),
|
||||
CRYSTALS("Crystals"),
|
||||
HEAL("Heal"),
|
||||
UNKNOWN("Unknown");
|
||||
|
||||
private String name = "";
|
||||
}
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum Attackstyle
|
||||
{
|
||||
MAGE("Mage", Color.CYAN),
|
||||
RANGE("Range", Color.GREEN),
|
||||
MELEE("Melee", Color.RED),
|
||||
UNKNOWN("Unknown", Color.WHITE);
|
||||
|
||||
private String name = "";
|
||||
private Color color;
|
||||
}
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, https://runelitepl.us
|
||||
* Copyright (c) 2019, ganom <https://github.com/Ganom>
|
||||
* 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.coxhelper;
|
||||
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.Point;
|
||||
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.OverlayUtil;
|
||||
|
||||
|
||||
public class OlmCrippleTimerOverlay extends Overlay
|
||||
{
|
||||
|
||||
|
||||
private final Client client;
|
||||
private final CoxPlugin plugin;
|
||||
private final CoxConfig config;
|
||||
|
||||
@Inject
|
||||
private OlmCrippleTimerOverlay(Client client, CoxPlugin plugin, CoxConfig config)
|
||||
{
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setPriority(OverlayPriority.HIGH);
|
||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (plugin.isHandCripple())
|
||||
{
|
||||
int tick = plugin.getTimer();
|
||||
NPC olmHand = plugin.getHand();
|
||||
final String tickStr = String.valueOf(tick);
|
||||
Point canvasPoint = olmHand.getCanvasTextLocation(graphics, tickStr, 50);
|
||||
renderTextLocation(graphics, tickStr, config.textSize(), config.fontStyle().getFont(), Color.GRAY, canvasPoint);
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint)
|
||||
{
|
||||
graphics.setFont(new Font("Arial", fontStyle, fontSize));
|
||||
if (canvasPoint != null)
|
||||
{
|
||||
final Point canvasCenterPoint = new Point(
|
||||
canvasPoint.getX(),
|
||||
canvasPoint.getY());
|
||||
final Point canvasCenterPoint_shadow = new Point(
|
||||
canvasPoint.getX() + 1,
|
||||
canvasPoint.getY() + 1);
|
||||
OverlayUtil.renderTextLocation(graphics, canvasCenterPoint_shadow, txtString, Color.BLACK);
|
||||
OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, txtString, fontColor);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,231 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019, ganom <https://github.com/Ganom>
|
||||
* 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.coxhelper;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Perspective;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
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.OverlayUtil;
|
||||
|
||||
public class TimersOverlay extends Overlay
|
||||
{
|
||||
|
||||
private CoxPlugin plugin;
|
||||
private CoxConfig config;
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
TimersOverlay(CoxPlugin plugin, CoxConfig config, Client client)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
this.client = client;
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setPriority(OverlayPriority.HIGHEST);
|
||||
setLayer(OverlayLayer.ALWAYS_ON_TOP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (config.tektonTickCounter())
|
||||
{
|
||||
Actor actor = plugin.getTekton_NPC();
|
||||
final int ticksLeft = plugin.getTektonTicks();
|
||||
final int attackTicksleft = plugin.getTektonAttackTicks();
|
||||
String attacksLeftStr;
|
||||
Color tickcolor;
|
||||
Color attackcolor;
|
||||
if (ticksLeft > 0)
|
||||
{
|
||||
if (ticksLeft == 1)
|
||||
{
|
||||
tickcolor = new Color(255, 0, 0, 255);
|
||||
}
|
||||
else
|
||||
{
|
||||
tickcolor = new Color(255, 255, 255, 255);
|
||||
}
|
||||
final String ticksLeftStr = String.valueOf(ticksLeft);
|
||||
Point canvasPoint = actor.getCanvasTextLocation(graphics, ticksLeftStr, 0);
|
||||
renderTextLocation(graphics, ticksLeftStr, config.textSize(), config.fontStyle().getFont(), tickcolor, canvasPoint);
|
||||
}
|
||||
if (attackTicksleft >= 0 && plugin.getTektonAttacks() > 0)
|
||||
{
|
||||
if (attackTicksleft <= 1)
|
||||
{
|
||||
attackcolor = new Color(255, 0, 0, 255);
|
||||
attacksLeftStr = "Phase Over";
|
||||
}
|
||||
else
|
||||
{
|
||||
attackcolor = new Color(255, 255, 255, 255);
|
||||
attacksLeftStr = String.valueOf(attackTicksleft);
|
||||
}
|
||||
|
||||
if (actor != null)
|
||||
{
|
||||
Point canvasPoint = actor.getCanvasTextLocation(graphics, attacksLeftStr, 0);
|
||||
renderTextLocationAbove(graphics, attacksLeftStr, config.textSize(), config.fontStyle().getFont(), attackcolor, canvasPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (config.timers())
|
||||
{
|
||||
if (plugin.getBurnTarget().size() > 0)
|
||||
{
|
||||
for (Actor actor : plugin.getBurnTarget())
|
||||
{
|
||||
renderNpcOverlay(graphics, actor, config.burnColor(), 2, 100, 10);
|
||||
final int ticksLeft = plugin.getBurnTicks();
|
||||
String ticksLeftStr = String.valueOf(ticksLeft);
|
||||
Color tickcolor = new Color(255, 255, 255, 255);
|
||||
if (ticksLeft >= 0)
|
||||
{
|
||||
if (ticksLeft == 34 ||
|
||||
ticksLeft == 33 ||
|
||||
ticksLeft == 26 ||
|
||||
ticksLeft == 25 ||
|
||||
ticksLeft == 18 ||
|
||||
ticksLeft == 17 ||
|
||||
ticksLeft == 10 ||
|
||||
ticksLeft == 9 ||
|
||||
ticksLeft == 2 ||
|
||||
ticksLeft == 1)
|
||||
{
|
||||
tickcolor = new Color(255, 0, 0, 255);
|
||||
ticksLeftStr = "GAP";
|
||||
}
|
||||
else
|
||||
{
|
||||
tickcolor = new Color(255, 255, 255, 255);
|
||||
}
|
||||
Point canvasPoint = actor.getCanvasTextLocation(graphics, ticksLeftStr, 0);
|
||||
renderTextLocation(graphics, ticksLeftStr, config.textSize(), config.fontStyle().getFont(), tickcolor, canvasPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.getAcidTarget() != null)
|
||||
{
|
||||
Actor actor = plugin.getAcidTarget();
|
||||
renderNpcOverlay(graphics, actor, config.acidColor(), 2, 100, 10);
|
||||
final int ticksLeft = plugin.getAcidTicks();
|
||||
Color tickcolor = new Color(255, 255, 255, 255);
|
||||
if (ticksLeft > 0)
|
||||
{
|
||||
if (ticksLeft > 1)
|
||||
{
|
||||
tickcolor = new Color(69, 241, 44, 255);
|
||||
}
|
||||
else
|
||||
{
|
||||
tickcolor = new Color(255, 255, 255, 255);
|
||||
}
|
||||
final String ticksLeftStr = String.valueOf(ticksLeft);
|
||||
Point canvasPoint = actor.getCanvasTextLocation(graphics, ticksLeftStr, 0);
|
||||
renderTextLocation(graphics, ticksLeftStr, config.textSize(), config.fontStyle().getFont(), tickcolor, canvasPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (config.tpOverlay())
|
||||
{
|
||||
if (plugin.getTeleportTarget() != null)
|
||||
{
|
||||
renderNpcOverlay(graphics, plugin.getTeleportTarget(), new Color(193, 255, 245, 255), 2, 100, 10);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void renderNpcOverlay(Graphics2D graphics, Actor actor, Color color, int outlineWidth, int outlineAlpha, int fillAlpha)
|
||||
{
|
||||
int size = 1;
|
||||
LocalPoint lp = actor.getLocalLocation();
|
||||
Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, lp, size);
|
||||
|
||||
if (tilePoly != null)
|
||||
{
|
||||
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), outlineAlpha));
|
||||
graphics.setStroke(new BasicStroke(outlineWidth));
|
||||
graphics.draw(tilePoly);
|
||||
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), fillAlpha));
|
||||
graphics.fill(tilePoly);
|
||||
}
|
||||
}
|
||||
|
||||
private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint)
|
||||
{
|
||||
graphics.setFont(new Font("Arial", fontStyle, fontSize));
|
||||
if (canvasPoint != null)
|
||||
{
|
||||
final Point canvasCenterPoint = new Point(
|
||||
canvasPoint.getX(),
|
||||
canvasPoint.getY());
|
||||
final Point canvasCenterPoint_shadow = new Point(
|
||||
canvasPoint.getX() + 1,
|
||||
canvasPoint.getY() + 1);
|
||||
if (config.shadows())
|
||||
{
|
||||
OverlayUtil.renderTextLocation(graphics, canvasCenterPoint_shadow, txtString, Color.BLACK);
|
||||
}
|
||||
OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, txtString, fontColor);
|
||||
}
|
||||
}
|
||||
|
||||
private void renderTextLocationAbove(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint)
|
||||
{
|
||||
graphics.setFont(new Font("Arial", fontStyle, fontSize));
|
||||
if (canvasPoint != null)
|
||||
{
|
||||
final Point canvasCenterPoint = new Point(
|
||||
canvasPoint.getX(),
|
||||
canvasPoint.getY() + 20);
|
||||
final Point canvasCenterPoint_shadow = new Point(
|
||||
canvasPoint.getX() + 1,
|
||||
canvasPoint.getY() + 21);
|
||||
if (config.shadows())
|
||||
{
|
||||
OverlayUtil.renderTextLocation(graphics, canvasCenterPoint_shadow, txtString, Color.BLACK);
|
||||
}
|
||||
OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, txtString, fontColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019, lyzrds <https://discord.gg/5eb9Fe>
|
||||
* Copyright (c) 2019, ganom <https://github.com/Ganom>
|
||||
* 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.coxhelper;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
|
||||
public class VanguardsHighlight extends Overlay
|
||||
{
|
||||
|
||||
private final Client client;
|
||||
private final CoxPlugin plugin;
|
||||
private final CoxConfig config;
|
||||
|
||||
@Inject
|
||||
VanguardsHighlight(Client client, CoxPlugin plugin, CoxConfig config)
|
||||
{
|
||||
super(plugin);
|
||||
setLayer(OverlayLayer.ABOVE_MAP);
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (plugin.isRunVanguards())
|
||||
{
|
||||
if (config.vangHighlight())
|
||||
{
|
||||
if (plugin.getRangeVang() != null)
|
||||
{
|
||||
renderNpcOverlay(graphics, plugin.getRangeVang(), "Range", Color.GREEN);
|
||||
}
|
||||
if (plugin.getMageVang() != null)
|
||||
{
|
||||
renderNpcOverlay(graphics, plugin.getMageVang(), "Mage", Color.BLUE);
|
||||
}
|
||||
if (plugin.getMeleeVang() != null)
|
||||
{
|
||||
renderNpcOverlay(graphics, plugin.getMeleeVang(), "Melee", Color.RED);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private void renderNpcOverlay(Graphics2D graphics, NPC actor, String name, Color color)
|
||||
{
|
||||
Polygon objectClickbox = actor.getConvexHull();
|
||||
renderPoly(graphics, color, objectClickbox);
|
||||
}
|
||||
|
||||
private void renderPoly(Graphics2D graphics, Color color, Polygon polygon)
|
||||
{
|
||||
if (polygon != null)
|
||||
{
|
||||
graphics.setColor(color);
|
||||
graphics.setStroke(new BasicStroke(2));
|
||||
graphics.draw(polygon);
|
||||
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20));
|
||||
graphics.fill(polygon);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019, lyzrds <https://discord.gg/5eb9Fe>
|
||||
* Copyright (c) 2019, ganom <https://github.com/Ganom>
|
||||
* 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.coxhelper;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||
import net.runelite.client.ui.overlay.components.table.TableAlignment;
|
||||
import net.runelite.client.ui.overlay.components.table.TableComponent;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
|
||||
public class VanguardsOverlay extends Overlay
|
||||
{
|
||||
|
||||
private final CoxPlugin plugin;
|
||||
private final CoxConfig config;
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
|
||||
@Inject
|
||||
VanguardsOverlay(CoxPlugin plugin, CoxConfig config)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setPosition(OverlayPosition.DETACHED);
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (plugin.isRunVanguards())
|
||||
{
|
||||
panelComponent.getChildren().clear();
|
||||
|
||||
if (config.vangHealth())
|
||||
{
|
||||
panelComponent.getChildren().add(TitleComponent.builder()
|
||||
.text("Vanguards")
|
||||
.color(Color.pink)
|
||||
.build());
|
||||
|
||||
TableComponent tableComponent = new TableComponent();
|
||||
tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT);
|
||||
|
||||
tableComponent.addRow(ColorUtil.prependColorTag("Range", Color.GREEN), Integer.toString(plugin.getRangeVangHP()));
|
||||
tableComponent.addRow(ColorUtil.prependColorTag("Mage", Color.BLUE), Integer.toString(plugin.getMageVangHP()));
|
||||
tableComponent.addRow(ColorUtil.prependColorTag("Melee", Color.RED), Integer.toString(plugin.getMeleeVangHP()));
|
||||
|
||||
panelComponent.getChildren().add(tableComponent);
|
||||
|
||||
return panelComponent.render(graphics);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user