From dd1fb6536ae8790194279998c64d4b352071ebf5 Mon Sep 17 00:00:00 2001 From: Ganom Date: Thu, 30 May 2019 02:29:58 -0400 Subject: [PATCH] Big Cox Update 2 (#441) * Big Cox Update 2 * Fix cripple timer to use config text size. * Rename regex --- .../java/net/runelite/api/AnimationID.java | 11 + .../client/plugins/coxhelper/CoxConfig.java | 224 ++++++- .../client/plugins/coxhelper/CoxOverlay.java | 33 +- .../client/plugins/coxhelper/CoxPlugin.java | 600 +++++++++++------- .../client/plugins/coxhelper/FontStyle.java | 46 ++ .../coxhelper/OlmCrippleTimerOverlay.java | 6 +- .../coxhelper/OlmPrayAgainstOverlay.java | 6 +- .../client/plugins/coxhelper/PrayAgainst.java | 14 +- .../plugins/coxhelper/TimersOverlay.java | 78 ++- .../plugins/coxhelper/VanguardsHighlight.java | 97 +++ .../plugins/coxhelper/VanguardsOverlay.java | 90 +++ .../plugins/vanguards/VanguardOverlay.java | 116 ---- .../plugins/vanguards/VanguardPlugin.java | 69 -- 13 files changed, 935 insertions(+), 455 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/FontStyle.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/VanguardsHighlight.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/VanguardsOverlay.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/vanguards/VanguardOverlay.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/vanguards/VanguardPlugin.java diff --git a/runelite-api/src/main/java/net/runelite/api/AnimationID.java b/runelite-api/src/main/java/net/runelite/api/AnimationID.java index 5e3448cc7a..5c5bfbffbd 100644 --- a/runelite-api/src/main/java/net/runelite/api/AnimationID.java +++ b/runelite-api/src/main/java/net/runelite/api/AnimationID.java @@ -219,6 +219,17 @@ public final class AnimationID public static final int HIGH_LEVEL_MAGIC_ATTACK = 1167; public static final int BLOWPIPE_ATTACK = 5061; + // Tekton + public static final int TEKTON_ANVIL = 7475; + public static final int TEKTON_AUTO1 = 7482; + public static final int TEKTON_AUTO2 = 7483; + public static final int TEKTON_AUTO3 = 7484; + public static final int TEKTON_FAST_AUTO1 = 7478; + public static final int TEKTON_FAST_AUTO2 = 7488; + public static final int TEKTON_ENRAGE_AUTO1 = 7492; + public static final int TEKTON_ENRAGE_AUTO2 = 7493; + public static final int TEKTON_ENRAGE_AUTO3 = 7494; + // Hydra public static final int HYDRA_POISON_1 = 8234; public static final int HYDRA_RANGED_1 = 8235; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxConfig.java index 3389d09f22..241e3b13f1 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxConfig.java @@ -25,9 +25,11 @@ package net.runelite.client.plugins.coxhelper; +import java.awt.Color; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; +import net.runelite.client.config.Range; import net.runelite.client.config.Stub; @ConfigGroup("Cox") @@ -35,10 +37,10 @@ import net.runelite.client.config.Stub; public interface CoxConfig extends Config { @ConfigItem( + position = 1, keyName = "muttadileStub", name = "Muttadile", - description = "", - position = 1 + description = "" ) default Stub muttadileStub() { @@ -48,7 +50,7 @@ public interface CoxConfig extends Config position = 2, keyName = "Muttadile", name = "Muttadile Marker", - description = "", + description = "Places an overlay around muttadiles showing their melee range.", parent = "muttadileStub" ) default boolean Muttadile() @@ -57,10 +59,10 @@ public interface CoxConfig extends Config } @ConfigItem( + position = 3, keyName = "tektonStub", name = "Tekton", - description = "", - position = 3 + description = "" ) default Stub tektonStub() { @@ -71,7 +73,7 @@ public interface CoxConfig extends Config position = 4, keyName = "Tekton", name = "Tekton Marker", - description = "", + description = "Places an overlay around Tekton showing his melee range.", parent = "tektonStub" ) default boolean Tekton() @@ -80,10 +82,22 @@ public interface CoxConfig extends Config } @ConfigItem( + position = 4, + keyName = "tektonTickCounter", + name = "Tekton Tick Counters", + description = "Counts down current phase timer, and attack ticks.", + parent = "tektonStub" + ) + default boolean tektonTickCounter() + { + return true; + } + + @ConfigItem( + position = 5, keyName = "guardiansStub", name = "Guardians", - description = "", - position = 5 + description = "" ) default Stub guardiansStub() { @@ -94,7 +108,7 @@ public interface CoxConfig extends Config position = 6, keyName = "Guardians", name = "Guardians timing", - description = "", + description = "Places an overlay near Guardians showing safespot.", parent = "guardiansStub" ) default boolean Guardians() @@ -103,10 +117,45 @@ public interface CoxConfig extends Config } @ConfigItem( + position = 7, + keyName = "vanguardsStub", + name = "Vanguards", + description = "" + ) + default Stub vanguardsStub() + { + return new Stub(); + } + + @ConfigItem( + position = 8, + keyName = "vangHighlight", + name = "Highlight Vanguards", + description = "Color is based on their attack style.", + parent = "vanguardsStub" + ) + default boolean vangHighlight() + { + return true; + } + + @ConfigItem( + position = 9, + keyName = "vangHealth", + name = "Show Vanguards Current HP", + description = "This will create an infobox with vanguards current hp.", + parent = "vanguardsStub" + ) + default boolean vangHealth() + { + return true; + } + + @ConfigItem( + position = 10, keyName = "olmStub", name = "Olm", - description = "", - position = 7 + description = "" ) default Stub olmStub() { @@ -114,7 +163,7 @@ public interface CoxConfig extends Config } @ConfigItem( - position = 8, + position = 11, keyName = "prayAgainstOlm", name = "Olm Show Prayer", description = "Shows what prayer to use during olm.", @@ -126,7 +175,7 @@ public interface CoxConfig extends Config } @ConfigItem( - position = 9, + position = 12, keyName = "timers", name = "Olm Show Burn/Acid Timers", description = "Shows tick timers for burns/acids.", @@ -138,7 +187,7 @@ public interface CoxConfig extends Config } @ConfigItem( - position = 10, + position = 13, keyName = "tpOverlay", name = "Olm Show Teleport Overlays", description = "Shows Overlays for targeted teleports.", @@ -150,7 +199,7 @@ public interface CoxConfig extends Config } @ConfigItem( - position = 6, + position = 14, keyName = "OlmTick", name = "Olm Tick Counter", description = "Show Tick Counter on Olm", @@ -161,4 +210,149 @@ public interface CoxConfig extends Config return true; } + @ConfigItem( + position = 15, + keyName = "colors", + name = "Colors", + description = "" + ) + default Stub colors() + { + return new Stub(); + } + + @ConfigItem( + position = 16, + keyName = "muttaColor", + name = "Muttadile Tile Color", + description = "Change hit area tile color for muttadiles", + parent = "colors", + hidden = true, + unhide = "Muttadile" + ) + default Color muttaColor() + { + return new Color(0, 255, 99); + } + + @ConfigItem( + position = 17, + keyName = "guardColor", + name = "Guardians Tile Color", + description = "Change safespot area tile color for Guardians", + parent = "colors", + hidden = true, + unhide = "Guardians" + ) + default Color guardColor() + { + return new Color(0, 255, 99); + } + + @ConfigItem( + position = 18, + keyName = "tektonColor", + name = "Tekton Tile Color", + description = "Change hit area tile color for Tekton", + parent = "colors", + hidden = true, + unhide = "Tekton" + ) + default Color tektonColor() + { + return new Color(193, 255, 245); + } + + @ConfigItem( + position = 19, + keyName = "burnColor", + name = "Burn Victim Color", + description = "Changes tile color for burn victim.", + parent = "colors", + hidden = true, + unhide = "timers" + ) + default Color burnColor() + { + return new Color(255, 100, 0); + } + + @ConfigItem( + position = 20, + keyName = "acidColor", + name = "Acid Victim Color", + description = "Changes tile color for acid victim.", + parent = "colors", + hidden = true, + unhide = "timers" + ) + default Color acidColor() + { + return new Color(69, 241, 44); + } + + @ConfigItem( + position = 21, + keyName = "tpColor", + name = "Teleport Target Color", + description = "Changes tile color for teleport target.", + parent = "colors", + hidden = true, + unhide = "tpOverlay" + ) + default Color tpColor() + { + return new Color(193, 255, 245); + } + + @ConfigItem( + position = 22, + keyName = "text", + name = "Text", + description = "" + ) + default Stub text() + { + return new Stub(); + } + + @ConfigItem( + position = 23, + keyName = "fontStyle", + name = "Font Style", + description = "Bold/Italics/Plain", + parent = "text" + ) + default FontStyle fontStyle() + { + return FontStyle.BOLD; + } + + @Range( + min = 9, + max = 20 + ) + @ConfigItem( + position = 24, + keyName = "textSize", + name = "Text Size", + description = "Text Size for Timers.", + parent = "text" + ) + default int textSize() + { + return 14; + } + + @ConfigItem( + position = 25, + keyName = "shadows", + name = "Shadows", + description = "Adds Shadows to text.", + parent = "text" + ) + default boolean shadows() + { + return true; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxOverlay.java index 3594bf07f1..59e0e944da 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxOverlay.java @@ -70,6 +70,18 @@ public class CoxOverlay extends Overlay @Override public Dimension render(Graphics2D graphics) { + for (WorldPoint point : plugin.getOlm_Heal()) + { + client.setHintArrow(point); + drawTile(graphics, point, config.tpColor(), 2, 150, 50); + } + + for (WorldPoint point : plugin.getOlm_TP()) + { + client.setHintArrow(point); + drawTile(graphics, point, config.tpColor(), 2, 150, 50); + } + if (plugin.isRunMutta()) { if (config.Muttadile()) @@ -86,7 +98,7 @@ public class CoxOverlay extends Overlay List meleeRangeMom = getHitSquares(boss.getWorldLocation(), size, 1, false); for (WorldPoint p : meleeRangeMom) { - drawTile(graphics, p, Color.RED, 2, 155, 10); + drawTile(graphics, p, config.muttaColor(), 0, 0, 50); } } if (baby != null) @@ -99,10 +111,9 @@ public class CoxOverlay extends Overlay List meleeRange = getHitSquares(baby.getWorldLocation(), size, 1, false); for (WorldPoint p : meleeRange) { - drawTile(graphics, p, Color.RED, 1, 155, 10); + drawTile(graphics, p, config.muttaColor(), 0, 0, 50); } } - } } @@ -125,7 +136,7 @@ public class CoxOverlay extends Overlay List meleeRange = getHitSquares(G1.getWorldLocation(), size, 1, true); for (WorldPoint p : meleeRange) { - drawTile(graphics, p, Color.GREEN, 1, 155, 10); + drawTile(graphics, p, config.guardColor(), 0, 0, 50); } } if (G2 != null) @@ -138,7 +149,7 @@ public class CoxOverlay extends Overlay List meleeRange = getHitSquares(G2.getWorldLocation(), size, 1, true); for (WorldPoint p : meleeRange) { - drawTile(graphics, p, Color.GREEN, 1, 155, 10); + drawTile(graphics, p, config.guardColor(), 0, 0, 50); } } } @@ -161,7 +172,7 @@ public class CoxOverlay extends Overlay List meleeRange = getHitSquares(boss.getWorldLocation(), size, 1, false); for (WorldPoint p : meleeRange) { - drawTile(graphics, p, Color.WHITE, 1, 155, 10); + drawTile(graphics, p, config.tektonColor(), 0, 0, 50); } } } @@ -214,15 +225,12 @@ public class CoxOverlay extends Overlay case -1: cycleStr = "??"; break; - - } final String combinedStr = cycleStr + ":" + tickStr; Point canvasPoint = boss.getCanvasTextLocation(graphics, combinedStr, 130); - renderTextLocation(graphics, combinedStr, 12, Font.BOLD, Color.WHITE, canvasPoint); + renderTextLocation(graphics, combinedStr, config.textSize(), config.fontStyle().getFont(), Color.WHITE, canvasPoint); } } - } return null; } @@ -285,7 +293,10 @@ public class CoxOverlay extends Overlay final Point canvasCenterPoint_shadow = new Point( canvasPoint.getX() + 1, canvasPoint.getY() + 1); - OverlayUtil.renderTextLocation(graphics, canvasCenterPoint_shadow, txtString, Color.BLACK); + if (config.shadows()) + { + OverlayUtil.renderTextLocation(graphics, canvasCenterPoint_shadow, txtString, Color.BLACK); + } OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, txtString, fontColor); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxPlugin.java index 2ac68910c3..990f898d1b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxPlugin.java @@ -1,7 +1,8 @@ /* * Copyright (c) 2019, xzact - * Copyright (c) 2019, gazivodag * Copyright (c) 2019, ganom + * Copyright (c) 2019, gazivodag + * Copyright (c) 2019, lyzrds * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,6 +39,7 @@ import lombok.Getter; import lombok.Setter; import lombok.extern.slf4j.Slf4j; import net.runelite.api.Actor; +import net.runelite.api.AnimationID; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; import net.runelite.api.GraphicID; @@ -49,6 +51,7 @@ 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.GraphicChanged; @@ -80,9 +83,10 @@ public class CoxPlugin extends Plugin 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("]*>(.*?)"); + private static final Pattern TP_REGEX = Pattern.compile("You have been paired with (.*)! The magical power will enact soon..."); private int sleepcount = 0; private boolean needOlm = false; + private GraphicsObject teleportObject; @Inject private Client client; @@ -108,6 +112,12 @@ public class CoxPlugin extends Plugin @Inject private OlmPrayAgainstOverlay prayAgainstOverlay; + @Inject + private VanguardsHighlight vanguardsHighlight; + + @Inject + private VanguardsOverlay vanguardsOverlay; + @Setter @Getter(AccessLevel.PACKAGE) protected PrayAgainst prayAgainstOlm; @@ -124,12 +134,24 @@ public class CoxPlugin extends Plugin @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; @@ -154,21 +176,15 @@ public class CoxPlugin extends Plugin @Getter(AccessLevel.PACKAGE) private NPC Momma_NPC; - @Getter(AccessLevel.PACKAGE) - private NPC meleeVanguard_NPC; - - @Getter(AccessLevel.PACKAGE) - private NPC mageVanguard_NPC; - - @Getter(AccessLevel.PACKAGE) - private NPC rangeVanguard_NPC; - @Getter(AccessLevel.PACKAGE) private List Olm_Crystals = new ArrayList<>(); @Getter(AccessLevel.PACKAGE) private List Olm_Heal = new ArrayList<>(); + @Getter(AccessLevel.PACKAGE) + private List Olm_TP = new ArrayList<>(); + @Getter(AccessLevel.PACKAGE) private List Olm_PSN = new ArrayList<>(); @@ -181,6 +197,15 @@ public class CoxPlugin extends Plugin @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; @@ -193,6 +218,15 @@ public class CoxPlugin extends Plugin @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; @@ -211,6 +245,9 @@ public class CoxPlugin extends Plugin @Getter(AccessLevel.PACKAGE) protected long lastPrayTime; + @Getter(AccessLevel.PACKAGE) + private float percent; + @Provides CoxConfig getConfig(ConfigManager configManager) { @@ -224,6 +261,8 @@ public class CoxPlugin extends Plugin overlayManager.add(olmCrippleTimerOverlay); overlayManager.add(prayAgainstOverlay); overlayManager.add(timersOverlay); + overlayManager.add(vanguardsHighlight); + overlayManager.add(vanguardsOverlay); } @Override @@ -233,92 +272,102 @@ public class CoxPlugin extends Plugin overlayManager.remove(olmCrippleTimerOverlay); overlayManager.remove(prayAgainstOverlay); overlayManager.remove(timersOverlay); + overlayManager.remove(vanguardsHighlight); + overlayManager.remove(vanguardsOverlay); HandCripple = false; + hand = null; acidTarget = null; teleportTarget = null; + Olm_TP.clear(); + prayAgainstOlm = null; burnTarget.clear(); timer = 45; burnTicks = 40; acidTicks = 25; - hand = null; + teleportTicks = 10; } + private boolean inRaid() + { + return client.getVar(Varbits.IN_RAID) == 1; + } @Subscribe public void onChatMessage(ChatMessage chatMessage) { - final Matcher tpMatcher = TP_REGEX.matcher(chatMessage.getMessage()); - String msg = chatMessage.getMessageNode().getValue(); - if (chatMessage.getType() == ChatMessageType.GAMEMESSAGE) + if (inRaid()) { - if (msg.toLowerCase().contains("The Great Olm rises with the power of".toLowerCase())) + if (chatMessage.getType() == ChatMessageType.GAMEMESSAGE) { - if (!runOlm) + Matcher tpMatcher = TP_REGEX.matcher(chatMessage.getMessage()); + if (tpMatcher.matches()) { - Olm_ActionCycle = -1; - Olm_TicksUntilAction = 4; - } - else - { - Olm_ActionCycle = -1; - Olm_TicksUntilAction = 3; - } - OlmPhase = 0; - runOlm = true; - needOlm = true; - Olm_NextSpec = -1; - } - - if (msg.toLowerCase().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.toLowerCase().contains("aggression")) - { - prayAgainstOlm = PrayAgainst.MELEE; - lastPrayTime = System.currentTimeMillis(); - } - if (msg.toLowerCase().contains("of magical power")) - { - prayAgainstOlm = PrayAgainst.MAGIC; - lastPrayTime = System.currentTimeMillis(); - } - if (msg.toLowerCase().contains("accuracy and dexterity")) - { - prayAgainstOlm = PrayAgainst.RANGED; - lastPrayTime = System.currentTimeMillis(); - } - if (msg.toLowerCase().startsWith("You have been paired with")) - { - if (!tpMatcher.matches()) - { - return; - } - for (Actor actor : client.getPlayers()) - { - if (actor.getName().equals((tpMatcher.group(1)))) + log.info("TP Matcher has found a match"); + for (Actor actor : client.getPlayers()) { - teleportTarget = actor; + if (actor.getName().equals(tpMatcher.group(1))) + { + log.info("Teleport Target Assigned"); + teleportTarget = actor; + } } } + String msg = chatMessage.getMessageNode().getValue().toLowerCase(); + if (msg.contains("the great olm rises with the power of")) + { + if (!runOlm) + { + Olm_ActionCycle = -1; + Olm_TicksUntilAction = 4; + } + else + { + Olm_ActionCycle = -1; + Olm_TicksUntilAction = 3; + } + OlmPhase = 0; + runOlm = true; + needOlm = true; + Olm_NextSpec = -1; + } + + 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(); + } } } } @@ -326,181 +375,193 @@ public class CoxPlugin extends Plugin @Subscribe public void onProjectileMoved(ProjectileMoved event) { - Projectile projectile = event.getProjectile(); - if (projectile.getId() == ProjectileID.OLM_MAGE_ATTACK) + if (inRaid()) { - prayAgainstOlm = PrayAgainst.MAGIC; - lastPrayTime = System.currentTimeMillis(); - } - if (projectile.getId() == ProjectileID.OLM_RANGE_ATTACK) - { - prayAgainstOlm = PrayAgainst.RANGED; - lastPrayTime = System.currentTimeMillis(); - } - if (projectile.getId() == ProjectileID.OLM_ACID_TRAIL) - { - /*acidTarget = projectile.getInteracting();*/ + Projectile projectile = event.getProjectile(); + if (projectile.getId() == ProjectileID.OLM_MAGE_ATTACK) + { + prayAgainstOlm = PrayAgainst.MAGIC; + lastPrayTime = System.currentTimeMillis(); + } + if (projectile.getId() == ProjectileID.OLM_RANGE_ATTACK) + { + prayAgainstOlm = PrayAgainst.RANGED; + lastPrayTime = System.currentTimeMillis(); + } + if (projectile.getId() == ProjectileID.OLM_ACID_TRAIL) + { + /*acidTarget = projectile.getInteracting();*/ + } } } @Subscribe public void onGraphicChanged(GraphicChanged graphicChanged) { - Actor actor = graphicChanged.getActor(); - - if (actor.getGraphic() == GraphicID.OLM_BURN) + if (inRaid()) { - burnTarget.add(actor); + Actor actor = graphicChanged.getActor(); + if (actor.getGraphic() == 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; + } } } @Subscribe public void onNpcSpawned(NpcSpawned npcSpawned) { - NPC npc = npcSpawned.getNpc(); - switch (npc.getId()) + if (inRaid()) { - case NpcID.TEKTON: - case NpcID.TEKTON_7541: - case NpcID.TEKTON_7542: - case NpcID.TEKTON_7545: - case NpcID.TEKTON_ENRAGED: - case NpcID.TEKTON_ENRAGED_7544: - runTekton = true; - Tekton_NPC = npc; - 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; - break; - case NpcID.GREAT_OLM_RIGHT_CLAW_7553: - case NpcID.GREAT_OLM_LEFT_CLAW: - hand = npc; - break; + NPC npc = npcSpawned.getNpc(); + switch (npc.getId()) + { + case NpcID.TEKTON: + case NpcID.TEKTON_7541: + case NpcID.TEKTON_7542: + case NpcID.TEKTON_7545: + case NpcID.TEKTON_ENRAGED: + case NpcID.TEKTON_ENRAGED_7544: + runTekton = true; + Tekton_NPC = 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; + break; + case NpcID.VANGUARD_7526: + case NpcID.VANGUARD_7527: + case NpcID.VANGUARD_7528: + case NpcID.VANGUARD_7529: + runVanguards = true; + break; + case NpcID.GREAT_OLM_LEFT_CLAW: + case NpcID.GREAT_OLM_LEFT_CLAW_7555: + hand = npc; + break; + } } } @Subscribe public void onNpcDespawned(NpcDespawned npcDespawned) { - NPC npc = npcDespawned.getNpc(); - switch (npc.getId()) + if (inRaid()) { - case NpcID.TEKTON: - case NpcID.TEKTON_7541: - case NpcID.TEKTON_7542: - case NpcID.TEKTON_7545: - case NpcID.TEKTON_ENRAGED: - case NpcID.TEKTON_ENRAGED_7544: - 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; - break; - case NpcID.GREAT_OLM_RIGHT_CLAW_7553: - case NpcID.GREAT_OLM_LEFT_CLAW: - HandCripple = false; - break; + NPC npc = npcDespawned.getNpc(); + switch (npc.getId()) + { + case NpcID.TEKTON: + case NpcID.TEKTON_7541: + case NpcID.TEKTON_7542: + 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; + break; + case NpcID.GREAT_OLM_RIGHT_CLAW_7553: + case NpcID.GREAT_OLM_RIGHT_CLAW: + HandCripple = false; + break; + } } - } @Subscribe public void onGameTick(GameTick event) { - if (acidTarget != null) - { - acidTicks--; - if (acidTicks <= 0) - { - acidTarget = null; - acidTicks = 25; - } - } - if (teleportTarget != null) - { - Player target = (Player) teleportTarget; - client.setHintArrow(target); - teleportTicks--; - if (teleportTicks <= 0) - { - client.clearHintArrow(); - teleportTarget = null; - teleportTicks = 10; - } - } - if (burnTarget.size() > 0) - { - burnTicks--; - if (burnTicks <= 0) - { - burnTarget.clear(); - burnTicks = 41; - } - } - - if (client.getVar(Varbits.IN_RAID) == 0) + if (!inRaid()) { runOlm = false; runGuard = false; runMutta = false; runTekton = false; + runVanguards = false; + enrageStage = false; needOlm = false; OlmPhase = 0; sleepcount = 0; Olm_Heal.clear(); + prayAgainstOlm = null; + return; } - if (HandCripple) - { - timer--; - if (timer <= 0) - { - HandCripple = false; - timer = 45; - } - } if (needOlm = true) { for (NPC monster : client.getNpcs()) @@ -514,6 +575,21 @@ public class CoxPlugin extends Plugin } } + if (runTekton) + { + if (Tekton_NPC.getId() == NpcID.TEKTON_ENRAGED || Tekton_NPC.getId() == NpcID.TEKTON_ENRAGED_7544) + { + enrageStage = true; + } + if (tektonTicks > 0) + { + tektonTicks--; + } + if (tektonAttacks > 0 && tektonAttackTicks > 0) + { + tektonAttackTicks--; + } + } if (runGuard) { @@ -533,7 +609,6 @@ public class CoxPlugin extends Plugin guardTick = 5; } } - } else { @@ -543,15 +618,87 @@ public class CoxPlugin extends Plugin { guardTick = 5; } - } + + if (runVanguards) + { + for (NPC npc : client.getNpcs()) + { + 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; + } + if (meleeVangHP <= 0 && mageVangHP <= 0 && rangeVangHP <= 0) + { + runVanguards = false; + } + } + } + if (runOlm) { Olm_Crystals.clear(); Olm_Heal.clear(); - + client.clearHintArrow(); sleepcount--; + if (teleportTarget != null) + { + 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) @@ -568,14 +715,11 @@ public class CoxPlugin extends Plugin { Olm_NextSpec = 3; } - } else { Olm_NextSpec--; } - - } else { @@ -585,7 +729,6 @@ public class CoxPlugin extends Plugin } Olm_TicksUntilAction = 4; } - } else { @@ -625,12 +768,23 @@ public class CoxPlugin extends Plugin sleepcount = 50; } } - - + if (o.getId() == 1359) + { + Olm_TP.add(WorldPoint.fromLocal(client, o.getLocation())); + } if (o.getId() == GRAPHICSOBJECT_ID_HEAL) { Olm_Heal.add(WorldPoint.fromLocal(client, o.getLocation())); } + if (!Olm_TP.isEmpty()) + { + teleportTicks--; + if (teleportTicks <= 0) + { + client.clearHintArrow(); + teleportTicks = 10; + } + } } } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/FontStyle.java b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/FontStyle.java new file mode 100644 index 0000000000..9b5c1a1ea7 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/FontStyle.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2019, 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(); + } +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/OlmCrippleTimerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/OlmCrippleTimerOverlay.java index 3b64258c29..465303027b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/OlmCrippleTimerOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/OlmCrippleTimerOverlay.java @@ -47,12 +47,14 @@ public class OlmCrippleTimerOverlay extends Overlay private final Client client; private final CoxPlugin plugin; + private final CoxConfig config; @Inject - private OlmCrippleTimerOverlay(Client client, CoxPlugin plugin) + 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); @@ -67,7 +69,7 @@ public class OlmCrippleTimerOverlay extends Overlay NPC olmHand = plugin.getHand(); final String tickStr = String.valueOf(tick); Point canvasPoint = olmHand.getCanvasTextLocation(graphics, tickStr, 50); - renderTextLocation(graphics, tickStr, 12, Font.BOLD, Color.GRAY, canvasPoint); + renderTextLocation(graphics, tickStr, config.textSize(), config.fontStyle().getFont(), Color.GRAY, canvasPoint); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/OlmPrayAgainstOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/OlmPrayAgainstOverlay.java index cab136d9da..04ba9d0247 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/OlmPrayAgainstOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/OlmPrayAgainstOverlay.java @@ -64,15 +64,15 @@ class OlmPrayAgainstOverlay extends Overlay public Dimension render(Graphics2D graphics2D) { + panelComponent.getChildren().clear(); + final PrayAgainst prayAgainst = plugin.getPrayAgainstOlm(); if (plugin.getPrayAgainstOlm() == null && !config.prayAgainstOlm()) { return null; } - panelComponent.getChildren().clear(); - - if (System.currentTimeMillis() < (plugin.getLastPrayTime() + 120000)) + if (System.currentTimeMillis() < (plugin.getLastPrayTime() + 120000) && plugin.getPrayAgainstOlm() != null) { InfoBoxComponent prayComponent = new InfoBoxComponent(); Image prayImg = scaleImg(getPrayerImage(plugin.prayAgainstOlm)); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/PrayAgainst.java b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/PrayAgainst.java index d35815e0c7..2b61b5010e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/PrayAgainst.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/PrayAgainst.java @@ -24,8 +24,12 @@ */ package net.runelite.client.plugins.coxhelper; +import lombok.AllArgsConstructor; +import lombok.Getter; import net.runelite.api.Prayer; +@AllArgsConstructor +@Getter public enum PrayAgainst { MELEE(Prayer.PROTECT_FROM_MELEE), @@ -33,14 +37,4 @@ public enum PrayAgainst RANGED(Prayer.PROTECT_FROM_MISSILES); private final Prayer prayer; - - PrayAgainst(Prayer prayer) - { - this.prayer = prayer; - } - - public Prayer getPrayer() - { - return prayer; - } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/TimersOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/TimersOverlay.java index f827615541..b47627dc86 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/TimersOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/TimersOverlay.java @@ -47,7 +47,6 @@ public class TimersOverlay extends Overlay private CoxPlugin plugin; private CoxConfig config; private Client client; - private Color tickcolor = new Color(255, 255, 255, 255); @Inject TimersOverlay(CoxPlugin plugin, CoxConfig config, Client client) @@ -63,15 +62,59 @@ public class TimersOverlay extends Overlay @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, new Color(255, 100, 0, 255), 2, 100, 10); + 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 || @@ -93,7 +136,7 @@ public class TimersOverlay extends Overlay tickcolor = new Color(255, 255, 255, 255); } Point canvasPoint = actor.getCanvasTextLocation(graphics, ticksLeftStr, 0); - renderTextLocation(graphics, ticksLeftStr, 14, Font.BOLD, tickcolor, canvasPoint); + renderTextLocation(graphics, ticksLeftStr, config.textSize(), config.fontStyle().getFont(), tickcolor, canvasPoint); } } } @@ -101,8 +144,9 @@ public class TimersOverlay extends Overlay if (plugin.getAcidTarget() != null) { Actor actor = plugin.getAcidTarget(); - renderNpcOverlay(graphics, actor, new Color(69, 241, 44, 255), 2, 100, 10); + 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) @@ -115,7 +159,7 @@ public class TimersOverlay extends Overlay } final String ticksLeftStr = String.valueOf(ticksLeft); Point canvasPoint = actor.getCanvasTextLocation(graphics, ticksLeftStr, 0); - renderTextLocation(graphics, ticksLeftStr, 14, Font.BOLD, tickcolor, canvasPoint); + renderTextLocation(graphics, ticksLeftStr, config.textSize(), config.fontStyle().getFont(), tickcolor, canvasPoint); } } } @@ -158,7 +202,29 @@ public class TimersOverlay extends Overlay final Point canvasCenterPoint_shadow = new Point( canvasPoint.getX() + 1, canvasPoint.getY() + 1); - OverlayUtil.renderTextLocation(graphics, canvasCenterPoint_shadow, txtString, Color.BLACK); + 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); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/VanguardsHighlight.java b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/VanguardsHighlight.java new file mode 100644 index 0000000000..0e02c9ddda --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/VanguardsHighlight.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2019, lyzrds + * Copyright (c) 2019, 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); + } + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/VanguardsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/VanguardsOverlay.java new file mode 100644 index 0000000000..3bbe48a469 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/VanguardsOverlay.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2019, lyzrds + * Copyright (c) 2019, 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.api.Client; +import net.runelite.client.ui.overlay.Overlay; +import net.runelite.client.ui.overlay.OverlayPosition; +import net.runelite.client.ui.overlay.components.LineComponent; +import net.runelite.client.ui.overlay.components.PanelComponent; +import net.runelite.client.ui.overlay.components.TitleComponent; + +public class VanguardsOverlay extends Overlay +{ + + private final Client client; + private final CoxPlugin plugin; + private final CoxConfig config; + private final PanelComponent panelComponent = new PanelComponent(); + + @Inject + VanguardsOverlay(Client client, CoxPlugin plugin, CoxConfig config) + { + super(plugin); + setPosition(OverlayPosition.DYNAMIC); + setPosition(OverlayPosition.DETACHED); + this.client = client; + 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()); + panelComponent.getChildren().add(LineComponent.builder() + .left("Range") + .right(Integer.toString(plugin.getRangeVangHP())) + .leftColor(Color.green) + .build()); + panelComponent.getChildren().add(LineComponent.builder() + .left("Mage") + .right(Integer.toString(plugin.getMageVangHP())) + .leftColor(Color.blue) + .build()); + panelComponent.getChildren().add(LineComponent.builder() + .left("Melee") + .right(Integer.toString(plugin.getMeleeVangHP())) + .leftColor(Color.red) + .build()); + return panelComponent.render(graphics); + } + } + return null; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/vanguards/VanguardOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/vanguards/VanguardOverlay.java deleted file mode 100644 index f3d9465ff3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/vanguards/VanguardOverlay.java +++ /dev/null @@ -1,116 +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.vanguards; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -import net.runelite.api.Actor; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.api.Player; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.components.LineComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; -import net.runelite.client.util.Text; - - -public class VanguardOverlay extends Overlay -{ - - private final PanelComponent panelComponent = new PanelComponent(); - - private static final int MAGE_VANGUARD_ID = 7529; - private static final int RANGE_VANGUARD_ID = 7528; - private static final int MELEE_VANGUARD_ID = 7527; - - String right_mage_str, right_range_str, right_melee_str = ""; - - @Inject - private Client client; - - - @Inject - public VanguardOverlay(VanguardPlugin plugin) - { - super(plugin);//? - - setPosition(OverlayPosition.ABOVE_CHATBOX_RIGHT); - } - - @Override - public Dimension render(Graphics2D graphics) - { - Player p = client.getLocalPlayer(); - Actor opponent = p.getInteracting(); - - if (opponent instanceof NPC) - { - int id = ((NPC) opponent).getId(); - - if (!Text.standardize(opponent.getName()).contains("vanguard")) - { - return null; - } - - if (id == MAGE_VANGUARD_ID) - { - float magePercent = (float) opponent.getHealthRatio() / opponent.getHealth() * 100; - int mageHp = (int) magePercent; - right_mage_str = Integer.toString(mageHp); - } - else if (id == RANGE_VANGUARD_ID) - { - float rangePercent = (float) opponent.getHealthRatio() / opponent.getHealth() * 100; - int rangeHp = (int) rangePercent; - right_range_str = Integer.toString(rangeHp); - } - else if (id == MELEE_VANGUARD_ID) - { - float meleePercent = (float) opponent.getHealthRatio() / opponent.getHealth() * 100; - int meleeHp = (int) meleePercent; - right_melee_str = Integer.toString(meleeHp); - } - } - - panelComponent.getChildren().clear(); - String overlayTitle = "Vanguard HP"; - - panelComponent.getChildren().add(TitleComponent.builder().text(overlayTitle).color(Color.RED).build()); - - panelComponent.setPreferredSize(new Dimension(graphics.getFontMetrics().stringWidth(overlayTitle) + 30, 0)); - - panelComponent.getChildren().add(LineComponent.builder().left("Mage:").right(right_mage_str).build()); - - panelComponent.getChildren().add(LineComponent.builder().left("Range:").right(right_range_str).build()); - - panelComponent.getChildren().add(LineComponent.builder().left("Melee:").right(right_melee_str).build()); - - return panelComponent.render(graphics); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/vanguards/VanguardPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/vanguards/VanguardPlugin.java deleted file mode 100644 index ec4cf9befc..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/vanguards/VanguardPlugin.java +++ /dev/null @@ -1,69 +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.vanguards; - -import javax.inject.Inject; -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; - -@PluginDescriptor( - name = "Vanguard HP Overlay", - description = "tracks HP of all three vanguards", - tags = {"overlay", "vangs", "cox"}, - enabledByDefault = false, - type = PluginType.PVM -) -public class VanguardPlugin extends Plugin -{ - private static final int MAGE_VANGUARD_ID = 7526; //i think - private static final int RANGE_VANGUARD_ID = 7527; - private static final int MELEE_VANGUARD_ID = 7528; - - - @Inject - private OverlayManager overlayManager; - - @Inject - private VanguardOverlay overlay; - - @Override - protected void startUp() throws Exception - { - overlayManager.add(overlay); - } - - @Override - protected void shutDown() throws Exception - { - overlayManager.remove(overlay); - overlay.right_mage_str = "-"; - overlay.right_range_str = "-"; - overlay.right_melee_str = "-"; - } - - -}