From f23b97021216dc1e2b01558f09f90c2a46c61b90 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 25 Jan 2018 11:44:38 -0500 Subject: [PATCH] runelite-client: remove AoE warning plugin It has been deemed to be against the game rules, and removal requested by Jagex. --- .../plugins/aoewarnings/AoeProjectile.java | 57 ------ .../aoewarnings/AoeProjectileInfo.java | 149 -------------- .../plugins/aoewarnings/AoeWarningConfig.java | 187 ------------------ .../aoewarnings/AoeWarningOverlay.java | 124 ------------ .../plugins/aoewarnings/AoeWarningPlugin.java | 155 --------------- 5 files changed, 672 deletions(-) delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeProjectile.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeProjectileInfo.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningConfig.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningOverlay.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningPlugin.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeProjectile.java b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeProjectile.java deleted file mode 100644 index c65d2b6b42..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeProjectile.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * 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.aoewarnings; - -import java.time.Instant; -import net.runelite.api.Point; - -public class AoeProjectile -{ - private final Instant startTime; - private final Point targetPoint; - private final AoeProjectileInfo aoeProjectileInfo; - - public AoeProjectile(Instant startTime, Point targetPoint, AoeProjectileInfo aoeProjectileInfo) - { - this.startTime = startTime; - this.targetPoint = targetPoint; - this.aoeProjectileInfo = aoeProjectileInfo; - } - - public Instant getStartTime() - { - return startTime; - } - - public Point getTargetPoint() - { - return targetPoint; - } - - public AoeProjectileInfo getAoeProjectileInfo() - { - return aoeProjectileInfo; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeProjectileInfo.java b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeProjectileInfo.java deleted file mode 100644 index 697e98efe3..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeProjectileInfo.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * 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.aoewarnings; - -import java.time.Duration; -import java.util.HashMap; -import java.util.Map; -import net.runelite.api.ProjectileID; - -public enum AoeProjectileInfo -{ - LIZARDMAN_SHAMAN_AOE(ProjectileID.LIZARDMAN_SHAMAN_AOE, 3000, 3), - CRAZY_ARCHAEOLOGIST_AOE(ProjectileID.CRAZY_ARCHAEOLOGIST_AOE, 3000, 3), - ICE_DEMON_RANGED_AOE(ProjectileID.ICE_DEMON_RANGED_AOE, 3000, 3), - /** - * When you don't have pray range on ice demon does an ice barrage - */ - ICE_DEMON_ICE_BARRAGE_AOE(ProjectileID.ICE_DEMON_ICE_BARRAGE_AOE, 3000, 3), - /** - * The AOE when vasa first starts - */ - VASA_AWAKEN_AOE(ProjectileID.VASA_AWAKEN_AOE, 4500, 3), - VASA_RANGED_AOE(ProjectileID.VASA_RANGED_AOE, 3000, 3), - TEKTON_METEOR_AOE(ProjectileID.TEKTON_METEOR_AOE, 4000, 3), - - /** - * The AOEs of Vorkath - */ - VORKATH_BOMB(ProjectileID.VORKATH_BOMB_AOE, 2400, 3), - VORKATH_POISON_POOL(ProjectileID.VORKATH_POISON_POOL_AOE, 1800, 1), - VORKATH_SPAWN(ProjectileID.VORKATH_SPAWN_AOE, 3000, 1), //extra tick because hard to see otherwise - VORKATH_TICK_FIRE(ProjectileID.VORKATH_TICK_FIRE_AOE, 600, 1), - - /** - * the AOEs of Galvek - */ - GALVEK_MINE(ProjectileID.GALVEK_MINE, 3600, 3), - GALVEK_BOMB(ProjectileID.GALVEK_BOMB, 2400, 3), - - DAWN_FREEZE(ProjectileID.DAWN_FREEZE, 3000, 3), - DUSK_CEILING(ProjectileID.DUSK_CEILING, 3000, 3), - - /** - * the AOE of Vet'ion - */ - VETION_LIGHTNING(ProjectileID.VETION_LIGHTNING, 3000, 1), - - /** - * the AOE of Chaos Fanatic - */ - CHAOS_FANATIC(ProjectileID.CHAOS_FANATIC_AOE, 3000, 1), - - /** - * the AOE of the Corporeal Beast - */ - - CORPOREAL_BEAST(ProjectileID.CORPOREAL_BEAST_AOE, 3000, 1), - CORPOREAL_BEAST_DARK_CORE(ProjectileID.CORPOREAL_BEAST_DARK_CORE_AOE, 3000, 3), - - /** - * the AOEs of The Great Olm - * missing ids and length, please help - */ - OLM_FALLING_CRYSTAL(ProjectileID.OLM_FALLING_CRYSTAL_AOE, 2400, 3), - OLM_BURNING(ProjectileID.OLM_BURNING_AOE, 2400, 3), - - /** - * the AOE of the Wintertodt snow that falls - */ - WINTERTODT_SNOW_FALL(ProjectileID.WINTERTODT_SNOW_FALL_AOE, 4000, 3); - - - /** - * The id of the projectile to trigger this AoE warning - */ - private final int id; - - /** - * How long the indicator should last for this AoE warning This might - * need to be a bit longer than the projectile actually takes to land as - * there is a fade effect on the warning - */ - private final Duration lifeTime; - - /** - * The size of the splash radius of the AoE warning Ex. Lizardman shaman - * AoE is a 3x3, so aoeSize = 3 - */ - private final int aoeSize; - - private static final Map map = new HashMap<>(); - - static - { - for (AoeProjectileInfo aoe : values()) - { - map.put(aoe.id, aoe); - } - } - - AoeProjectileInfo(int id, int lifeTimeMillis, int aoeSize) - { - this.id = id; - this.lifeTime = Duration.ofMillis(lifeTimeMillis); - this.aoeSize = aoeSize; - } - - public Duration getLifeTime() - { - return lifeTime; - } - - public int getId() - { - return id; - } - - public int getAoeSize() - { - return aoeSize; - } - - public static AoeProjectileInfo getById(int id) - { - return map.get(id); - } -} 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 deleted file mode 100644 index 8861c47581..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningConfig.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * 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.aoewarnings; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup( - keyName = "aoewarning", - name = "AoE Projectile Warnings", - description = "Configuration for the AoE Projectile Warnings plugin" -) -public interface AoeWarningConfig extends Config -{ - @ConfigItem( - keyName = "enabled", - name = "AoE Warnings Enabled", - description = "Configures whether or not AoE Projectile Warnings plugin is displayed" - ) - default boolean enabled() - { - return true; - } - - @ConfigItem( - keyName = "lizardmanaoe", - name = "Lizardman Shamans", - description = "Configures whether or not AoE Projectile Warnings for Lizardman Shamans is displayed" - ) - default boolean isShamansEnabled() - { - return true; - } - - @ConfigItem( - keyName = "archaeologistaoe", - name = "Crazy Archaeologist", - description = "Configures whether or not AoE Projectile Warnings for Archaeologist is displayed" - ) - default boolean isArchaeologistEnabled() - { - return true; - } - - @ConfigItem( - keyName = "icedemon", - name = "Ice Demon", - description = "Configures whether or not AoE Projectile Warnings for Ice Demon is displayed" - ) - default boolean isIceDemonEnabled() - { - return true; - } - - @ConfigItem( - keyName = "vasa", - name = "Vasa", - description = "Configures whether or not AoE Projectile Warnings for Vasa is displayed" - ) - default boolean isVasaEnabled() - { - return true; - } - - @ConfigItem( - keyName = "tekton", - name = "Tekton", - description = "Configures whether or not AoE Projectile Warnings for Tekton is displayed" - ) - default boolean isTektonEnabled() - { - return true; - } - - @ConfigItem( - keyName = "vorkath", - name = "Vorkath", - description = "Configures whether or not AoE Projectile Warnings for Vorkath are displayed" - ) - default boolean isVorkathEnabled() - { - return true; - } - - @ConfigItem( - keyName = "galvek", - name = "Galvek", - description = "Configures whether or not AoE Projectile Warnings for Galvek are displayed" - ) - default boolean isGalvekEnabled() - { - return true; - } - - @ConfigItem( - keyName = "gargboss", - name = "Gargoyle Boss", - description = "Configs whether or not AoE Projectile Warnings for Dawn/Dusk are displayed" - ) - default boolean isGargBossEnabled() - { - return true; - } - - @ConfigItem( - keyName = "vetion", - name = "Vet'ion", - description = "Configures whether or not AoE Projectile Warnings for Vet'ion are displayed" - ) - default boolean isVetionEnabled() - { - return true; - } - - @ConfigItem( - keyName = "chaosfanatic", - name = "Chaos Fanatic", - description = "Configures whether or not AoE Projectile Warnings for Chaos Fanatic are displayed" - ) - default boolean isChaosFanaticEnabled() - { - return true; - } - - @ConfigItem( - keyName = "olm", - name = "Great Olm", - description = "Configures whether or not AoE Projectile Warnings for The Great Olm are displayed" - ) - default boolean isOlmEnabled() - { - return true; - } - - @ConfigItem( - keyName = "corp", - name = "Corporeal Beast", - description = "Configures whether or not AoE Projectile Warnings for the Corporeal Beast are displayed" - ) - default boolean isCorpEnabled() - { - return true; - } - - @ConfigItem( - keyName = "wintertodt", - name = "Wintertodt Snow Fall", - description = "Configures whether or not AOE Projectile Warnings for the Wintertodt snow fall are displayed" - ) - default boolean isWintertodtEnabled() - { - return true; - } - - @ConfigItem( - keyName = "outline", - name = "Display Outline", - description = "Configures whether or not AoE Projectile Warnings have an outline" - ) - default boolean isOutlineEnabled() - { - return true; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningOverlay.java deleted file mode 100644 index 9102df9c91..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningOverlay.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * 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.aoewarnings; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Point; -import java.awt.Polygon; -import java.time.Instant; -import java.util.Iterator; -import java.util.Map; -import javax.annotation.Nullable; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -import net.runelite.api.Projectile; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayLayer; -import net.runelite.client.ui.overlay.OverlayPosition; - -public class AoeWarningOverlay extends Overlay -{ - private static final int FILL_START_ALPHA = 25; - private static final int OUTLINE_START_ALPHA = 255; - - private final Client client; - private final AoeWarningPlugin plugin; - private final AoeWarningConfig config; - - @Inject - public AoeWarningOverlay(@Nullable Client client, AoeWarningPlugin plugin, AoeWarningConfig config) - { - setPosition(OverlayPosition.DYNAMIC); - setLayer(OverlayLayer.UNDER_WIDGETS); - this.client = client; - this.plugin = plugin; - this.config = config; - } - - @Override - public Dimension render(Graphics2D graphics, Point parent) - { - if (!config.enabled()) - { - return null; - } - - Instant now = Instant.now(); - Map projectiles = plugin.getProjectiles(); - for (Iterator it = projectiles.values().iterator(); it.hasNext();) - { - AoeProjectile aoeProjectile = it.next(); - - if (now.isAfter(aoeProjectile.getStartTime().plus(aoeProjectile.getAoeProjectileInfo().getLifeTime()))) - { - it.remove(); - continue; - } - - Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, aoeProjectile.getTargetPoint(), aoeProjectile.getAoeProjectileInfo().getAoeSize()); - if (tilePoly == null) - { - continue; - } - - // how far through the projectiles lifetime between 0-1. - double progress = (System.currentTimeMillis() - aoeProjectile.getStartTime().toEpochMilli()) / (double) aoeProjectile.getAoeProjectileInfo().getLifeTime().toMillis(); - - int fillAlpha = (int) ((1 - progress) * FILL_START_ALPHA);//alpha drop off over lifetime - int outlineAlpha = (int) ((1 - progress) * OUTLINE_START_ALPHA); - - if (fillAlpha < 0) - { - fillAlpha = 0; - } - if (outlineAlpha < 0) - { - outlineAlpha = 0; - } - - if (fillAlpha > 255) - { - fillAlpha = 255; - } - if (outlineAlpha > 255) - { - outlineAlpha = 255;//Make sure we don't pass in an invalid alpha - } - - if (config.isOutlineEnabled()) - { - graphics.setColor(new Color(255, 0, 0, outlineAlpha)); - graphics.drawPolygon(tilePoly); - } - - graphics.setColor(new Color(255, 0, 0, fillAlpha)); - graphics.fillPolygon(tilePoly); - } - return null; - } -} 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 deleted file mode 100644 index 21f15d2c78..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningPlugin.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright (c) 2017, Adam - * 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.aoewarnings; - -import com.google.common.eventbus.Subscribe; -import com.google.inject.Binder; -import com.google.inject.Provides; -import java.time.Instant; -import java.util.HashMap; -import java.util.Map; -import javax.inject.Inject; -import net.runelite.api.Point; -import net.runelite.api.Projectile; -import net.runelite.client.config.ConfigManager; -import net.runelite.api.events.ProjectileMoved; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.ui.overlay.Overlay; - -@PluginDescriptor( - name = "AoE projectile warning plugin" -) -public class AoeWarningPlugin extends Plugin -{ - @Inject - AoeWarningOverlay overlay; - - @Inject - AoeWarningConfig config; - - private final Map projectiles = new HashMap<>(); - - @Override - public void configure(Binder binder) - { - binder.bind(AoeWarningOverlay.class); - } - - @Provides - AoeWarningConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(AoeWarningConfig.class); - } - - @Override - public Overlay getOverlay() - { - return overlay; - } - - public Map getProjectiles() - { - return projectiles; - } - - /** - * Called when a projectile is set to move towards a point. For - * projectiles that target the ground, like AoE projectiles from - * Lizardman Shamans, this is only called once - * - * @param event Projectile moved event - */ - @Subscribe - public void onProjectileMoved(ProjectileMoved event) - { - Projectile projectile = event.getProjectile(); - - // AoE projectiles do not target anything - if (projectile.getInteracting() != null) - { - return; - } - - int projectileId = projectile.getId(); - AoeProjectileInfo aoeProjectileInfo = AoeProjectileInfo.getById(projectileId); - if (aoeProjectileInfo != null && isConfigEnabledForProjectileId(projectileId)) - { - Point targetPoint = event.getPosition(); - AoeProjectile aoeProjectile = new AoeProjectile(Instant.now(), targetPoint, aoeProjectileInfo); - projectiles.put(projectile, aoeProjectile); - } - } - - private boolean isConfigEnabledForProjectileId(int projectileId) - { - AoeProjectileInfo projectileInfo = AoeProjectileInfo.getById(projectileId); - if (projectileInfo == null) - { - return false; - } - - switch (projectileInfo) - { - case LIZARDMAN_SHAMAN_AOE: - return config.isShamansEnabled(); - case CRAZY_ARCHAEOLOGIST_AOE: - return config.isArchaeologistEnabled(); - case ICE_DEMON_RANGED_AOE: - case ICE_DEMON_ICE_BARRAGE_AOE: - return config.isIceDemonEnabled(); - case VASA_AWAKEN_AOE: - case VASA_RANGED_AOE: - return config.isVasaEnabled(); - case TEKTON_METEOR_AOE: - return config.isTektonEnabled(); - case VORKATH_BOMB: - case VORKATH_POISON_POOL: - case VORKATH_SPAWN: - case VORKATH_TICK_FIRE: - return config.isVorkathEnabled(); - case VETION_LIGHTNING: - return config.isVetionEnabled(); - case CHAOS_FANATIC: - return config.isChaosFanaticEnabled(); - case GALVEK_BOMB: - case GALVEK_MINE: - return config.isGalvekEnabled(); - case DAWN_FREEZE: - case DUSK_CEILING: - return config.isGargBossEnabled(); - case OLM_FALLING_CRYSTAL: - case OLM_BURNING: - return config.isOlmEnabled(); - case CORPOREAL_BEAST: - case CORPOREAL_BEAST_DARK_CORE: - return config.isCorpEnabled(); - case WINTERTODT_SNOW_FALL: - return config.isWintertodtEnabled(); - } - - return false; - } -}