From 66f9a04d1b606b745366c762329ccf204c79969c Mon Sep 17 00:00:00 2001 From: Ganom Date: Sat, 4 May 2019 00:19:13 -0400 Subject: [PATCH] Reformat and Update to AoE Warnings --- .../plugins/aoewarnings/AoeWarningConfig.java | 168 ++++++++++-------- .../plugins/aoewarnings/AoeWarningPlugin.java | 37 ++-- 2 files changed, 108 insertions(+), 97 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningConfig.java index 8aa09b7e1a..22cbee9331 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningConfig.java @@ -28,26 +28,14 @@ import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; -import java.awt.*; - @ConfigGroup("aoe") public interface AoeWarningConfig extends Config { @ConfigItem( - keyName = "pluginType", - name = "Plugin Type", - description = "Sets the group of this plugin", - hidden = true - ) - default String pluginTyoe() - { - return "PVM"; - } - - @ConfigItem( - keyName = "enabled", - name = "AoE Warnings Enabled", - description = "Configures whether or not AoE Projectile Warnings plugin is displayed" + keyName = "enabled", + name = "AoE Warnings Enabled", + description = "Configures whether or not AoE Projectile Warnings plugin is displayed", + position = 1 ) default boolean enabled() { @@ -55,9 +43,32 @@ public interface AoeWarningConfig extends Config } @ConfigItem( - keyName = "lizardmanaoe", - name = "Lizardman Shamans", - description = "Configures whether or not AoE Projectile Warnings for Lizardman Shamans is displayed" + keyName = "outline", + name = "Display Outline", + description = "Configures whether or not AoE Projectile Warnings have an outline", + position = 2 + ) + default boolean isOutlineEnabled() + { + return true; + } + + @ConfigItem( + keyName = "fade", + name = "Fade Warnings", + description = "Configures whether or not AoE Projectile Warnings fade over time", + position = 3 + ) + default boolean isFadeEnabled() + { + return true; + } + + @ConfigItem( + keyName = "lizardmanaoe", + name = "Lizardman Shamans", + description = "Configures whether or not AoE Projectile Warnings for Lizardman Shamans is displayed", + position = 4 ) default boolean isShamansEnabled() { @@ -65,9 +76,10 @@ public interface AoeWarningConfig extends Config } @ConfigItem( - keyName = "archaeologistaoe", - name = "Crazy Archaeologist", - description = "Configures whether or not AoE Projectile Warnings for Archaeologist is displayed" + keyName = "archaeologistaoe", + name = "Crazy Archaeologist", + description = "Configures whether or not AoE Projectile Warnings for Archaeologist is displayed", + position = 4 ) default boolean isArchaeologistEnabled() { @@ -75,9 +87,10 @@ public interface AoeWarningConfig extends Config } @ConfigItem( - keyName = "icedemon", - name = "Ice Demon", - description = "Configures whether or not AoE Projectile Warnings for Ice Demon is displayed" + keyName = "icedemon", + name = "Ice Demon", + description = "Configures whether or not AoE Projectile Warnings for Ice Demon is displayed", + position = 4 ) default boolean isIceDemonEnabled() { @@ -85,9 +98,10 @@ public interface AoeWarningConfig extends Config } @ConfigItem( - keyName = "vasa", - name = "Vasa", - description = "Configures whether or not AoE Projectile Warnings for Vasa is displayed" + keyName = "vasa", + name = "Vasa", + description = "Configures whether or not AoE Projectile Warnings for Vasa is displayed", + position = 4 ) default boolean isVasaEnabled() { @@ -95,9 +109,10 @@ public interface AoeWarningConfig extends Config } @ConfigItem( - keyName = "tekton", - name = "Tekton", - description = "Configures whether or not AoE Projectile Warnings for Tekton is displayed" + keyName = "tekton", + name = "Tekton", + description = "Configures whether or not AoE Projectile Warnings for Tekton is displayed", + position = 4 ) default boolean isTektonEnabled() { @@ -105,9 +120,10 @@ public interface AoeWarningConfig extends Config } @ConfigItem( - keyName = "vorkath", - name = "Vorkath", - description = "Configures whether or not AoE Projectile Warnings for Vorkath are displayed" + keyName = "vorkath", + name = "Vorkath", + description = "Configures whether or not AoE Projectile Warnings for Vorkath are displayed", + position = 4 ) default boolean isVorkathEnabled() { @@ -115,9 +131,10 @@ public interface AoeWarningConfig extends Config } @ConfigItem( - keyName = "galvek", - name = "Galvek", - description = "Configures whether or not AoE Projectile Warnings for Galvek are displayed" + keyName = "galvek", + name = "Galvek", + description = "Configures whether or not AoE Projectile Warnings for Galvek are displayed", + position = 4 ) default boolean isGalvekEnabled() { @@ -125,9 +142,10 @@ public interface AoeWarningConfig extends Config } @ConfigItem( - keyName = "gargboss", - name = "Gargoyle Boss", - description = "Configs whether or not AoE Projectile Warnings for Dawn/Dusk are displayed" + keyName = "gargboss", + name = "Gargoyle Boss", + description = "Configs whether or not AoE Projectile Warnings for Dawn/Dusk are displayed", + position = 4 ) default boolean isGargBossEnabled() { @@ -135,9 +153,10 @@ public interface AoeWarningConfig extends Config } @ConfigItem( - keyName = "vetion", - name = "Vet'ion", - description = "Configures whether or not AoE Projectile Warnings for Vet'ion are displayed" + keyName = "vetion", + name = "Vet'ion", + description = "Configures whether or not AoE Projectile Warnings for Vet'ion are displayed", + position = 4 ) default boolean isVetionEnabled() { @@ -145,9 +164,10 @@ public interface AoeWarningConfig extends Config } @ConfigItem( - keyName = "chaosfanatic", - name = "Chaos Fanatic", - description = "Configures whether or not AoE Projectile Warnings for Chaos Fanatic are displayed" + keyName = "chaosfanatic", + name = "Chaos Fanatic", + description = "Configures whether or not AoE Projectile Warnings for Chaos Fanatic are displayed", + position = 4 ) default boolean isChaosFanaticEnabled() { @@ -155,9 +175,10 @@ public interface AoeWarningConfig extends Config } @ConfigItem( - keyName = "olm", - name = "Great Olm", - description = "Configures whether or not AoE Projectile Warnings for The Great Olm are displayed" + keyName = "olm", + name = "Olm", + description = "Configures whether or not AoE Projectile Warnings for The Great Olm are displayed", + position = 4 ) default boolean isOlmEnabled() { @@ -166,8 +187,9 @@ public interface AoeWarningConfig extends Config @ConfigItem( keyName = "bombDisplay", - name = "Display crystal phase bomb tracker", - description = "Display a timer and colour-coded AoE for Olm's crystal-phase bombs." + name = "Olm Bombs", + description = "Display a timer and colour-coded AoE for Olm's crystal-phase bombs.", + position = 4 ) default boolean bombDisplay() { @@ -175,9 +197,10 @@ public interface AoeWarningConfig extends Config } @ConfigItem( - keyName = "corp", - name = "Corporeal Beast", - description = "Configures whether or not AoE Projectile Warnings for the Corporeal Beast are displayed" + keyName = "corp", + name = "Corporeal Beast", + description = "Configures whether or not AoE Projectile Warnings for the Corporeal Beast are displayed", + position = 4 ) default boolean isCorpEnabled() { @@ -185,9 +208,10 @@ public interface AoeWarningConfig extends Config } @ConfigItem( - keyName = "wintertodt", - name = "Wintertodt Snow Fall", - description = "Configures whether or not AOE Projectile Warnings for the Wintertodt snow fall are displayed" + keyName = "wintertodt", + name = "Wintertodt Snow Fall", + description = "Configures whether or not AOE Projectile Warnings for the Wintertodt snow fall are displayed", + position = 4 ) default boolean isWintertodtEnabled() { @@ -195,26 +219,21 @@ public interface AoeWarningConfig extends Config } @ConfigItem( - keyName = "isXarpusEnabled", - name = "Xarpus", - description = "Configures whether or not AOE Projectile Warnings for Xarpus are displayed" + keyName = "isXarpusEnabled", + name = "Xarpus", + description = "Configures whether or not AOE Projectile Warnings for Xarpus are displayed", + position = 4 ) - default boolean isXarpusEnabled() { return true; } - - @ConfigItem( - keyName = "outline", - name = "Display Outline", - description = "Configures whether or not AoE Projectile Warnings have an outline" - ) - default boolean isOutlineEnabled() + default boolean isXarpusEnabled() { return true; } @ConfigItem( keyName = "lightning", - name = "Show Lightning Trails", - description = "Show Lightning Trails" + name = "Olm Lightning Trails", + description = "Show Lightning Trails", + position = 4 ) default boolean LightningTrail() { @@ -222,11 +241,12 @@ public interface AoeWarningConfig extends Config } @ConfigItem( - keyName = "fade", - name = "Fade Warnings", - description = "Configures whether or not AoE Projectile Warnings fade over time" + keyName = "addyDrags", + name = "Addy Drags", + description = "Show Bad Areas", + position = 4 ) - default boolean isFadeEnabled() + default boolean addyDrags() { return true; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningPlugin.java index 19f9053a42..a0a44bbafd 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningPlugin.java @@ -26,19 +26,22 @@ package net.runelite.client.plugins.aoewarnings; import com.google.inject.Provides; +import java.time.Instant; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; +import javax.inject.Inject; import lombok.AccessLevel; import lombok.Getter; import lombok.extern.slf4j.Slf4j; +import net.runelite.api.Client; import net.runelite.api.GameObject; import net.runelite.api.GameState; -import net.runelite.api.GraphicID; import net.runelite.api.GraphicsObject; import net.runelite.api.ObjectID; import net.runelite.api.Projectile; -import net.runelite.api.Client; import net.runelite.api.Tile; import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.WorldPoint; @@ -46,7 +49,6 @@ import net.runelite.api.events.GameObjectDespawned; import net.runelite.api.events.GameObjectSpawned; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameTick; -import net.runelite.api.events.GraphicsObjectCreated; import net.runelite.api.events.ProjectileMoved; import net.runelite.client.Notifier; import net.runelite.client.config.ConfigManager; @@ -56,43 +58,33 @@ import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginType; import net.runelite.client.ui.overlay.OverlayManager; -import javax.inject.Inject; -import java.time.Instant; -import java.util.HashMap; -import java.util.Map; -import java.util.logging.Logger; - @PluginDescriptor( name = "AoE Warnings", description = "Shows the final destination for AoE Attack projectiles", tags = {"bosses", "combat", "pve", "overlay"}, - type = PluginType.PVM + type = PluginType.PVM ) @Slf4j public class AoeWarningPlugin extends Plugin { + @Getter + private final Map bombs = new HashMap<>(); + private final Map projectiles = new HashMap<>(); + @Inject + public AoeWarningConfig config; @Inject private OverlayManager overlayManager; - @Inject private AoeWarningOverlay coreOverlay; - @Inject - public AoeWarningConfig config; - @Inject private BombOverlay bombOverlay; - @Inject private Client client; - @Inject private Notifier notifier; - - @Getter - private final Map bombs = new HashMap<>(); @Getter(AccessLevel.PACKAGE) private List LightningTrail = new ArrayList<>(); @Getter(AccessLevel.PACKAGE) @@ -100,16 +92,12 @@ public class AoeWarningPlugin extends Plugin @Getter(AccessLevel.PACKAGE) private List CrystalSpike = new ArrayList<>(); - @Provides AoeWarningConfig getConfig(ConfigManager configManager) { return configManager.getConfig(AoeWarningConfig.class); } - - private final Map projectiles = new HashMap<>(); - public Map getProjectiles() { return projectiles; @@ -130,6 +118,9 @@ public class AoeWarningPlugin extends Plugin { overlayManager.remove(coreOverlay); overlayManager.remove(bombOverlay); + LightningTrail.clear(); + AcidTrail.clear(); + CrystalSpike.clear(); } @Subscribe