Accurate Tick Timers for Aoe Warnings (#667)

* Udate Aoe Warnings to include Tick Timings.

* Remove Debug Output

* Remove Tick Timers for certain projectiles, as they would be useless.
This commit is contained in:
Ganom
2019-06-20 06:31:01 -04:00
committed by Kyleeld
parent 1e18bc9c65
commit 11883a9d01
4 changed files with 244 additions and 97 deletions

View File

@@ -28,40 +28,17 @@
package net.runelite.client.plugins.aoewarnings; package net.runelite.client.plugins.aoewarnings;
import java.time.Instant; import java.time.Instant;
import lombok.AllArgsConstructor;
import lombok.Getter;
import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.LocalPoint;
@Getter
@AllArgsConstructor
class AoeProjectile class AoeProjectile
{ {
private final Instant startTime; private final Instant startTime;
private final LocalPoint targetPoint; private final LocalPoint targetPoint;
private final AoeProjectileInfo aoeProjectileInfo; private final AoeProjectileInfo aoeProjectileInfo;
private final int projectileLifetime; private final int projectileLifetime;
private final int finalTick;
AoeProjectile(Instant startTime, LocalPoint targetPoint, AoeProjectileInfo aoeProjectileInfo, int projectileLifetime) }
{
this.startTime = startTime;
this.targetPoint = targetPoint;
this.aoeProjectileInfo = aoeProjectileInfo;
this.projectileLifetime = projectileLifetime;
}
Instant getStartTime()
{
return startTime;
}
LocalPoint getTargetPoint()
{
return targetPoint;
}
AoeProjectileInfo getAoeProjectileInfo()
{
return aoeProjectileInfo;
}
int getProjectileLifetime()
{
return projectileLifetime;
}
}

View File

@@ -27,14 +27,36 @@
package net.runelite.client.plugins.aoewarnings; package net.runelite.client.plugins.aoewarnings;
import java.awt.Color; 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.Config;
import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem; import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Range;
import net.runelite.client.config.Stub; import net.runelite.client.config.Stub;
@ConfigGroup("aoe") @ConfigGroup("aoe")
public interface AoeWarningConfig extends Config public interface AoeWarningConfig 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( @ConfigItem(
keyName = "aoeNotifyAll", keyName = "aoeNotifyAll",
name = "Notify for all AoE warnings", name = "Notify for all AoE warnings",
@@ -105,11 +127,82 @@ public interface AoeWarningConfig extends Config
return true; return true;
} }
@ConfigItem(
keyName = "tickTimers",
name = "Tick Timers",
description = "Configures whether or not AoE Projectile Warnings has tick timers overlaid as well.",
parent = "overlayStub",
position = 6
)
default boolean tickTimers()
{
return true;
}
@ConfigItem(
position = 7,
keyName = "text",
name = "Text",
description = "",
hidden = true,
unhide = "tickTimers"
)
default Stub text()
{
return new Stub();
}
@ConfigItem(
position = 8,
keyName = "fontStyle",
name = "Font Style",
description = "Bold/Italics/Plain",
parent = "text",
hidden = true,
unhide = "tickTimers"
)
default FontStyle fontStyle()
{
return FontStyle.BOLD;
}
@Range(
min = 20,
max = 40
)
@ConfigItem(
position = 9,
keyName = "textSize",
name = "Text Size",
description = "Text Size for Timers.",
parent = "text",
hidden = true,
unhide = "tickTimers"
)
default int textSize()
{
return 32;
}
@ConfigItem(
position = 10,
keyName = "shadows",
name = "Shadows",
description = "Adds Shadows to text.",
parent = "text",
hidden = true,
unhide = "tickTimers"
)
default boolean shadows()
{
return true;
}
@ConfigItem( @ConfigItem(
keyName = "npcStub", keyName = "npcStub",
name = "NPC's", name = "NPC's",
description = "", description = "",
position = 6 position = 11
) )
default Stub npcStub() default Stub npcStub()
{ {
@@ -120,7 +213,7 @@ public interface AoeWarningConfig extends Config
keyName = "lizardmanaoeStub", keyName = "lizardmanaoeStub",
name = "Lizardman Shamans", name = "Lizardman Shamans",
description = "", description = "",
position = 7, position = 12,
parent = "npcStub" parent = "npcStub"
) )
default Stub lizardmanaoeStub() default Stub lizardmanaoeStub()
@@ -133,7 +226,7 @@ public interface AoeWarningConfig extends Config
name = "Lizardman Shamans", name = "Lizardman Shamans",
description = "Configures whether or not AoE Projectile Warnings for Lizardman Shamans is displayed", description = "Configures whether or not AoE Projectile Warnings for Lizardman Shamans is displayed",
parent = "lizardmanaoeStub", parent = "lizardmanaoeStub",
position = 8 position = 13
) )
default boolean isShamansEnabled() default boolean isShamansEnabled()
{ {
@@ -145,7 +238,7 @@ public interface AoeWarningConfig extends Config
name = "Lizardman Shamans Notify", name = "Lizardman Shamans Notify",
description = "Configures whether or not AoE Projectile Warnings for Lizardman Shamans should trigger a notification", description = "Configures whether or not AoE Projectile Warnings for Lizardman Shamans should trigger a notification",
parent = "lizardmanaoeStub", parent = "lizardmanaoeStub",
position = 9, position = 14,
hide = "aoeNotifyAll" hide = "aoeNotifyAll"
) )
default boolean isShamansNotifyEnabled() default boolean isShamansNotifyEnabled()
@@ -157,7 +250,7 @@ public interface AoeWarningConfig extends Config
keyName = "archaeologistaoeStub", keyName = "archaeologistaoeStub",
name = "Crazy Archaeologist", name = "Crazy Archaeologist",
description = "", description = "",
position = 10, position = 15,
parent = "npcStub" parent = "npcStub"
) )
default Stub archaeologistaoeStub() default Stub archaeologistaoeStub()
@@ -170,7 +263,7 @@ public interface AoeWarningConfig extends Config
name = "Crazy Archaeologist", name = "Crazy Archaeologist",
description = "Configures whether or not AoE Projectile Warnings for Archaeologist is displayed", description = "Configures whether or not AoE Projectile Warnings for Archaeologist is displayed",
parent = "archaeologistaoeStub", parent = "archaeologistaoeStub",
position = 11 position = 16
) )
default boolean isArchaeologistEnabled() default boolean isArchaeologistEnabled()
{ {
@@ -182,7 +275,7 @@ public interface AoeWarningConfig extends Config
name = "Crazy Archaeologist Notify", name = "Crazy Archaeologist Notify",
description = "Configures whether or not AoE Projectile Warnings for Crazy Archaeologist should trigger a notification", description = "Configures whether or not AoE Projectile Warnings for Crazy Archaeologist should trigger a notification",
parent = "archaeologistaoeStub", parent = "archaeologistaoeStub",
position = 12, position = 17,
hide = "aoeNotifyAll" hide = "aoeNotifyAll"
) )
default boolean isArchaeologistNotifyEnabled() default boolean isArchaeologistNotifyEnabled()
@@ -194,7 +287,7 @@ public interface AoeWarningConfig extends Config
keyName = "icedemonStub", keyName = "icedemonStub",
name = "Ice Demon", name = "Ice Demon",
description = "", description = "",
position = 13, position = 18,
parent = "npcStub" parent = "npcStub"
) )
default Stub icedemonStub() default Stub icedemonStub()
@@ -207,7 +300,7 @@ public interface AoeWarningConfig extends Config
name = "Ice Demon", name = "Ice Demon",
description = "Configures whether or not AoE Projectile Warnings for Ice Demon is displayed", description = "Configures whether or not AoE Projectile Warnings for Ice Demon is displayed",
parent = "icedemonStub", parent = "icedemonStub",
position = 14 position = 19
) )
default boolean isIceDemonEnabled() default boolean isIceDemonEnabled()
{ {
@@ -219,7 +312,7 @@ public interface AoeWarningConfig extends Config
name = "Ice Demon Notify", name = "Ice Demon Notify",
description = "Configures whether or not AoE Projectile Warnings for Ice Demon should trigger a notification", description = "Configures whether or not AoE Projectile Warnings for Ice Demon should trigger a notification",
parent = "icedemonStub", parent = "icedemonStub",
position = 15, position = 20,
hide = "aoeNotifyAll" hide = "aoeNotifyAll"
) )
default boolean isIceDemonNotifyEnabled() default boolean isIceDemonNotifyEnabled()
@@ -231,7 +324,7 @@ public interface AoeWarningConfig extends Config
keyName = "vasaStub", keyName = "vasaStub",
name = "Vasa", name = "Vasa",
description = "", description = "",
position = 16, position = 21,
parent = "npcStub" parent = "npcStub"
) )
default Stub vasaStub() default Stub vasaStub()
@@ -244,7 +337,7 @@ public interface AoeWarningConfig extends Config
name = "Vasa", name = "Vasa",
description = "Configures whether or not AoE Projectile Warnings for Vasa is displayed", description = "Configures whether or not AoE Projectile Warnings for Vasa is displayed",
parent = "vasaStub", parent = "vasaStub",
position = 17 position = 22
) )
default boolean isVasaEnabled() default boolean isVasaEnabled()
{ {
@@ -256,7 +349,7 @@ public interface AoeWarningConfig extends Config
name = "Vasa Notify", name = "Vasa Notify",
description = "Configures whether or not AoE Projectile Warnings for Vasa should trigger a notification", description = "Configures whether or not AoE Projectile Warnings for Vasa should trigger a notification",
parent = "vasaStub", parent = "vasaStub",
position = 18, position = 23,
hide = "aoeNotifyAll" hide = "aoeNotifyAll"
) )
default boolean isVasaNotifyEnabled() default boolean isVasaNotifyEnabled()
@@ -268,7 +361,7 @@ public interface AoeWarningConfig extends Config
keyName = "tektonStub", keyName = "tektonStub",
name = "Tekton", name = "Tekton",
description = "", description = "",
position = 19, position = 24,
parent = "npcStub" parent = "npcStub"
) )
default Stub tektonStub() default Stub tektonStub()
@@ -281,7 +374,7 @@ public interface AoeWarningConfig extends Config
name = "Tekton", name = "Tekton",
description = "Configures whether or not AoE Projectile Warnings for Tekton is displayed", description = "Configures whether or not AoE Projectile Warnings for Tekton is displayed",
parent = "tektonStub", parent = "tektonStub",
position = 20 position = 25
) )
default boolean isTektonEnabled() default boolean isTektonEnabled()
{ {
@@ -293,7 +386,7 @@ public interface AoeWarningConfig extends Config
name = "Tekton Notify", name = "Tekton Notify",
description = "Configures whether or not AoE Projectile Warnings for Tekton should trigger a notification", description = "Configures whether or not AoE Projectile Warnings for Tekton should trigger a notification",
parent = "tektonStub", parent = "tektonStub",
position = 21, position = 26,
hide = "aoeNotifyAll" hide = "aoeNotifyAll"
) )
default boolean isTektonNotifyEnabled() default boolean isTektonNotifyEnabled()
@@ -305,7 +398,7 @@ public interface AoeWarningConfig extends Config
keyName = "vorkathStub", keyName = "vorkathStub",
name = "Vorkath", name = "Vorkath",
description = "", description = "",
position = 22, position = 27,
parent = "npcStub" parent = "npcStub"
) )
default Stub vorkathStub() default Stub vorkathStub()
@@ -318,7 +411,7 @@ public interface AoeWarningConfig extends Config
name = "Vorkath", name = "Vorkath",
description = "Configures whether or not AoE Projectile Warnings for Vorkath are displayed", description = "Configures whether or not AoE Projectile Warnings for Vorkath are displayed",
parent = "vorkathStub", parent = "vorkathStub",
position = 23 position = 28
) )
default boolean isVorkathEnabled() default boolean isVorkathEnabled()
{ {
@@ -330,7 +423,7 @@ public interface AoeWarningConfig extends Config
name = "Vorkath Notify", name = "Vorkath Notify",
description = "Configures whether or not AoE Projectile Warnings for Vorkath should trigger a notification", description = "Configures whether or not AoE Projectile Warnings for Vorkath should trigger a notification",
parent = "vorkathStub", parent = "vorkathStub",
position = 24, position = 29,
hide = "aoeNotifyAll" hide = "aoeNotifyAll"
) )
default boolean isVorkathNotifyEnabled() default boolean isVorkathNotifyEnabled()
@@ -342,7 +435,7 @@ public interface AoeWarningConfig extends Config
keyName = "galvekStub", keyName = "galvekStub",
name = "Galvek", name = "Galvek",
description = "", description = "",
position = 25, position = 30,
parent = "npcStub" parent = "npcStub"
) )
default Stub galvekStub() default Stub galvekStub()
@@ -355,7 +448,7 @@ public interface AoeWarningConfig extends Config
name = "Galvek", name = "Galvek",
description = "Configures whether or not AoE Projectile Warnings for Galvek are displayed", description = "Configures whether or not AoE Projectile Warnings for Galvek are displayed",
parent = "galvekStub", parent = "galvekStub",
position = 26 position = 31
) )
default boolean isGalvekEnabled() default boolean isGalvekEnabled()
{ {
@@ -367,7 +460,7 @@ public interface AoeWarningConfig extends Config
name = "Galvek Notify", name = "Galvek Notify",
description = "Configures whether or not AoE Projectile Warnings for Galvek should trigger a notification", description = "Configures whether or not AoE Projectile Warnings for Galvek should trigger a notification",
parent = "galvekStub", parent = "galvekStub",
position = 27, position = 32,
hide = "aoeNotifyAll" hide = "aoeNotifyAll"
) )
default boolean isGalvekNotifyEnabled() default boolean isGalvekNotifyEnabled()
@@ -379,7 +472,7 @@ public interface AoeWarningConfig extends Config
keyName = "gargbossStub", keyName = "gargbossStub",
name = "Gargoyle Boss", name = "Gargoyle Boss",
description = "", description = "",
position = 28, position = 33,
parent = "npcStub" parent = "npcStub"
) )
default Stub gargbossStub() default Stub gargbossStub()
@@ -392,7 +485,7 @@ public interface AoeWarningConfig extends Config
name = "Gargoyle Boss", name = "Gargoyle Boss",
description = "Configs whether or not AoE Projectile Warnings for Dawn/Dusk are displayed", description = "Configs whether or not AoE Projectile Warnings for Dawn/Dusk are displayed",
parent = "gargbossStub", parent = "gargbossStub",
position = 29 position = 34
) )
default boolean isGargBossEnabled() default boolean isGargBossEnabled()
{ {
@@ -404,7 +497,7 @@ public interface AoeWarningConfig extends Config
name = "Gargoyle Boss Notify", name = "Gargoyle Boss Notify",
description = "Configures whether or not AoE Projectile Warnings for Gargoyle Bosses should trigger a notification", description = "Configures whether or not AoE Projectile Warnings for Gargoyle Bosses should trigger a notification",
parent = "gargbossStub", parent = "gargbossStub",
position = 30, position = 35,
hide = "aoeNotifyAll" hide = "aoeNotifyAll"
) )
default boolean isGargBossNotifyEnabled() default boolean isGargBossNotifyEnabled()
@@ -416,7 +509,7 @@ public interface AoeWarningConfig extends Config
keyName = "vetionStub", keyName = "vetionStub",
name = "Vet'ion", name = "Vet'ion",
description = "", description = "",
position = 31, position = 36,
parent = "npcStub" parent = "npcStub"
) )
default Stub vetionStub() default Stub vetionStub()
@@ -429,7 +522,7 @@ public interface AoeWarningConfig extends Config
name = "Vet'ion", name = "Vet'ion",
description = "Configures whether or not AoE Projectile Warnings for Vet'ion are displayed", description = "Configures whether or not AoE Projectile Warnings for Vet'ion are displayed",
parent = "vetionStub", parent = "vetionStub",
position = 32 position = 37
) )
default boolean isVetionEnabled() default boolean isVetionEnabled()
{ {
@@ -441,7 +534,7 @@ public interface AoeWarningConfig extends Config
name = "Vet'ion Notify", name = "Vet'ion Notify",
description = "Configures whether or not AoE Projectile Warnings for Vet'ion should trigger a notification", description = "Configures whether or not AoE Projectile Warnings for Vet'ion should trigger a notification",
parent = "vetionStub", parent = "vetionStub",
position = 33, position = 38,
hide = "aoeNotifyAll" hide = "aoeNotifyAll"
) )
default boolean isVetionNotifyEnabled() default boolean isVetionNotifyEnabled()
@@ -453,7 +546,7 @@ public interface AoeWarningConfig extends Config
keyName = "chaosfanaticStub", keyName = "chaosfanaticStub",
name = "Chaos Fanatic", name = "Chaos Fanatic",
description = "", description = "",
position = 34, position = 39,
parent = "npcStub" parent = "npcStub"
) )
default Stub chaosfanaticStub() default Stub chaosfanaticStub()
@@ -466,7 +559,7 @@ public interface AoeWarningConfig extends Config
name = "Chaos Fanatic", name = "Chaos Fanatic",
description = "Configures whether or not AoE Projectile Warnings for Chaos Fanatic are displayed", description = "Configures whether or not AoE Projectile Warnings for Chaos Fanatic are displayed",
parent = "chaosfanaticStub", parent = "chaosfanaticStub",
position = 35 position = 40
) )
default boolean isChaosFanaticEnabled() default boolean isChaosFanaticEnabled()
{ {
@@ -478,7 +571,7 @@ public interface AoeWarningConfig extends Config
name = "Chaos Fanatic Notify", name = "Chaos Fanatic Notify",
description = "Configures whether or not AoE Projectile Warnings for Chaos Fanatic should trigger a notification", description = "Configures whether or not AoE Projectile Warnings for Chaos Fanatic should trigger a notification",
parent = "chaosfanaticStub", parent = "chaosfanaticStub",
position = 36, position = 41,
hide = "aoeNotifyAll" hide = "aoeNotifyAll"
) )
default boolean isChaosFanaticNotifyEnabled() default boolean isChaosFanaticNotifyEnabled()
@@ -490,7 +583,7 @@ public interface AoeWarningConfig extends Config
keyName = "olmStub", keyName = "olmStub",
name = "Olm", name = "Olm",
description = "", description = "",
position = 37, position = 42,
parent = "npcStub" parent = "npcStub"
) )
default Stub olmStub() default Stub olmStub()
@@ -503,7 +596,7 @@ public interface AoeWarningConfig extends Config
name = "Olm", name = "Olm",
description = "Configures whether or not AoE Projectile Warnings for The Great Olm are displayed", description = "Configures whether or not AoE Projectile Warnings for The Great Olm are displayed",
parent = "olmStub", parent = "olmStub",
position = 38 position = 43
) )
default boolean isOlmEnabled() default boolean isOlmEnabled()
{ {
@@ -515,7 +608,7 @@ public interface AoeWarningConfig extends Config
name = "Olm Notify", name = "Olm Notify",
description = "Configures whether or not AoE Projectile Warnings for Olm should trigger a notification", description = "Configures whether or not AoE Projectile Warnings for Olm should trigger a notification",
parent = "olmStub", parent = "olmStub",
position = 39, position = 44,
hide = "aoeNotifyAll" hide = "aoeNotifyAll"
) )
default boolean isOlmNotifyEnabled() default boolean isOlmNotifyEnabled()
@@ -527,7 +620,7 @@ public interface AoeWarningConfig extends Config
keyName = "olmBombStub", keyName = "olmBombStub",
name = "Bombs", name = "Bombs",
description = "", description = "",
position = 40, position = 45,
parent = "olmStub" parent = "olmStub"
) )
default Stub olmBombsStub() default Stub olmBombsStub()
@@ -540,7 +633,7 @@ public interface AoeWarningConfig extends Config
name = "Olm Bombs", name = "Olm Bombs",
description = "Display a timer and colour-coded AoE for Olm's crystal-phase bombs.", description = "Display a timer and colour-coded AoE for Olm's crystal-phase bombs.",
parent = "olmBombStub", parent = "olmBombStub",
position = 41 position = 46
) )
default boolean bombDisplay() default boolean bombDisplay()
{ {
@@ -552,7 +645,7 @@ public interface AoeWarningConfig extends Config
name = "Olm Bombs Notify", name = "Olm Bombs Notify",
description = "Configures whether or not AoE Projectile Warnings for Olm Bombs should trigger a notification", description = "Configures whether or not AoE Projectile Warnings for Olm Bombs should trigger a notification",
parent = "olmBombStub", parent = "olmBombStub",
position = 42, position = 47,
hide = "aoeNotifyAll" hide = "aoeNotifyAll"
) )
default boolean bombDisplayNotifyEnabled() default boolean bombDisplayNotifyEnabled()
@@ -564,7 +657,7 @@ public interface AoeWarningConfig extends Config
keyName = "olmlightningStub", keyName = "olmlightningStub",
name = "Lightning Trails", name = "Lightning Trails",
description = "", description = "",
position = 43, position = 48,
parent = "olmStub" parent = "olmStub"
) )
default Stub olmlightningStub() default Stub olmlightningStub()
@@ -577,7 +670,7 @@ public interface AoeWarningConfig extends Config
name = "Olm Lightning Trails", name = "Olm Lightning Trails",
description = "Show Lightning Trails", description = "Show Lightning Trails",
parent = "olmlightningStub", parent = "olmlightningStub",
position = 44 position = 49
) )
default boolean LightningTrail() default boolean LightningTrail()
{ {
@@ -589,7 +682,7 @@ public interface AoeWarningConfig extends Config
name = "Olm Lightning Trails Notify", name = "Olm Lightning Trails Notify",
description = "Configures whether or not AoE Projectile Warnings for Olm Lightning Trails should trigger a notification", description = "Configures whether or not AoE Projectile Warnings for Olm Lightning Trails should trigger a notification",
parent = "olmlightningStub", parent = "olmlightningStub",
position = 45, position = 50,
hide = "aoeNotifyAll" hide = "aoeNotifyAll"
) )
default boolean LightningTrailNotifyEnabled() default boolean LightningTrailNotifyEnabled()
@@ -601,7 +694,7 @@ public interface AoeWarningConfig extends Config
keyName = "corpStub", keyName = "corpStub",
name = "Corporeal Beast", name = "Corporeal Beast",
description = "", description = "",
position = 46, position = 51,
parent = "npcStub" parent = "npcStub"
) )
default Stub corpStub() default Stub corpStub()
@@ -614,7 +707,7 @@ public interface AoeWarningConfig extends Config
name = "Corporeal Beast", name = "Corporeal Beast",
description = "Configures whether or not AoE Projectile Warnings for the Corporeal Beast are displayed", description = "Configures whether or not AoE Projectile Warnings for the Corporeal Beast are displayed",
parent = "corpStub", parent = "corpStub",
position = 47 position = 52
) )
default boolean isCorpEnabled() default boolean isCorpEnabled()
{ {
@@ -626,7 +719,7 @@ public interface AoeWarningConfig extends Config
name = "Corporeal Beast Notify", name = "Corporeal Beast Notify",
description = "Configures whether or not AoE Projectile Warnings for Corporeal Beast should trigger a notification", description = "Configures whether or not AoE Projectile Warnings for Corporeal Beast should trigger a notification",
parent = "corpStub", parent = "corpStub",
position = 48, position = 53,
hide = "aoeNotifyAll" hide = "aoeNotifyAll"
) )
default boolean isCorpNotifyEnabled() default boolean isCorpNotifyEnabled()
@@ -638,7 +731,7 @@ public interface AoeWarningConfig extends Config
keyName = "wintertodtStub", keyName = "wintertodtStub",
name = "Wintertodt", name = "Wintertodt",
description = "", description = "",
position = 49, position = 54,
parent = "npcStub" parent = "npcStub"
) )
default Stub wintertodtStub() default Stub wintertodtStub()
@@ -651,7 +744,7 @@ public interface AoeWarningConfig extends Config
name = "Wintertodt Snow Fall", name = "Wintertodt Snow Fall",
description = "Configures whether or not AOE Projectile Warnings for the Wintertodt snow fall are displayed", description = "Configures whether or not AOE Projectile Warnings for the Wintertodt snow fall are displayed",
parent = "wintertodtStub", parent = "wintertodtStub",
position = 50 position = 55
) )
default boolean isWintertodtEnabled() default boolean isWintertodtEnabled()
{ {
@@ -663,7 +756,7 @@ public interface AoeWarningConfig extends Config
name = "Wintertodt Snow Fall Notify", name = "Wintertodt Snow Fall Notify",
description = "Configures whether or not AoE Projectile Warnings for Wintertodt Snow Fall Notify should trigger a notification", description = "Configures whether or not AoE Projectile Warnings for Wintertodt Snow Fall Notify should trigger a notification",
parent = "wintertodtStub", parent = "wintertodtStub",
position = 51, position = 56,
hide = "aoeNotifyAll" hide = "aoeNotifyAll"
) )
default boolean isWintertodtNotifyEnabled() default boolean isWintertodtNotifyEnabled()
@@ -675,7 +768,7 @@ public interface AoeWarningConfig extends Config
keyName = "xarpusStub", keyName = "xarpusStub",
name = "Xarpus", name = "Xarpus",
description = "", description = "",
position = 52, position = 57,
parent = "npcStub" parent = "npcStub"
) )
default Stub xarpusStub() default Stub xarpusStub()
@@ -688,7 +781,7 @@ public interface AoeWarningConfig extends Config
name = "Xarpus", name = "Xarpus",
description = "Configures whether or not AOE Projectile Warnings for Xarpus are displayed", description = "Configures whether or not AOE Projectile Warnings for Xarpus are displayed",
parent = "xarpusStub", parent = "xarpusStub",
position = 53 position = 58
) )
default boolean isXarpusEnabled() default boolean isXarpusEnabled()
{ {
@@ -700,7 +793,7 @@ public interface AoeWarningConfig extends Config
name = "Xarpus Notify", name = "Xarpus Notify",
description = "Configures whether or not AoE Projectile Warnings for Xarpus should trigger a notification", description = "Configures whether or not AoE Projectile Warnings for Xarpus should trigger a notification",
parent = "xarpusStub", parent = "xarpusStub",
position = 54, position = 59,
hide = "aoeNotifyAll" hide = "aoeNotifyAll"
) )
default boolean isXarpusNotifyEnabled() default boolean isXarpusNotifyEnabled()
@@ -712,7 +805,7 @@ public interface AoeWarningConfig extends Config
keyName = "addyDragsStub", keyName = "addyDragsStub",
name = "Addy Drags", name = "Addy Drags",
description = "", description = "",
position = 55, position = 60,
parent = "npcStub" parent = "npcStub"
) )
default Stub addyDragsStub() default Stub addyDragsStub()
@@ -725,7 +818,7 @@ public interface AoeWarningConfig extends Config
name = "Addy Drags", name = "Addy Drags",
description = "Show Bad Areas", description = "Show Bad Areas",
parent = "addyDragsStub", parent = "addyDragsStub",
position = 56 position = 61
) )
default boolean addyDrags() default boolean addyDrags()
{ {
@@ -737,7 +830,7 @@ public interface AoeWarningConfig extends Config
name = "Addy Drags Notify", name = "Addy Drags Notify",
description = "Configures whether or not AoE Projectile Warnings for Addy Dragons should trigger a notification", description = "Configures whether or not AoE Projectile Warnings for Addy Dragons should trigger a notification",
parent = "addyDragsStub", parent = "addyDragsStub",
position = 57, position = 62,
hide = "aoeNotifyAll" hide = "aoeNotifyAll"
) )
default boolean addyDragsNotifyEnabled() default boolean addyDragsNotifyEnabled()
@@ -749,7 +842,7 @@ public interface AoeWarningConfig extends Config
keyName = "drakeStub", keyName = "drakeStub",
name = "Drakes", name = "Drakes",
description = "", description = "",
position = 58, position = 63,
parent = "npcStub" parent = "npcStub"
) )
default Stub drakeStub() default Stub drakeStub()
@@ -762,7 +855,7 @@ public interface AoeWarningConfig extends Config
name = "Drakes Breath", name = "Drakes Breath",
description = "Configures if Drakes Breath tile markers are displayed", description = "Configures if Drakes Breath tile markers are displayed",
parent = "drakeStub", parent = "drakeStub",
position = 59 position = 64
) )
default boolean isDrakeEnabled() default boolean isDrakeEnabled()
{ {
@@ -774,7 +867,7 @@ public interface AoeWarningConfig extends Config
name = "Drakes Breath Notify", name = "Drakes Breath Notify",
description = "Configures whether or not AoE Projectile Warnings for Drakes Breath should trigger a notification", description = "Configures whether or not AoE Projectile Warnings for Drakes Breath should trigger a notification",
parent = "drakeStub", parent = "drakeStub",
position = 60, position = 65,
hide = "aoeNotifyAll" hide = "aoeNotifyAll"
) )
default boolean isDrakeNotifyEnabled() default boolean isDrakeNotifyEnabled()
@@ -786,7 +879,7 @@ public interface AoeWarningConfig extends Config
keyName = "cerberusStub", keyName = "cerberusStub",
name = "Cerberus", name = "Cerberus",
description = "", description = "",
position = 61, position = 66,
parent = "npcStub" parent = "npcStub"
) )
default Stub cerberusStub() default Stub cerberusStub()
@@ -799,7 +892,7 @@ public interface AoeWarningConfig extends Config
name = "Cerberus Fire", name = "Cerberus Fire",
description = "Configures if Cerberus fire tile markers are displayed", description = "Configures if Cerberus fire tile markers are displayed",
parent = "cerberusStub", parent = "cerberusStub",
position = 62 position = 67
) )
default boolean isCerbFireEnabled() default boolean isCerbFireEnabled()
{ {
@@ -811,7 +904,7 @@ public interface AoeWarningConfig extends Config
name = "Cerberus Fire Notify", name = "Cerberus Fire Notify",
description = "Configures whether or not AoE Projectile Warnings for Cerberus his fire should trigger a notification", description = "Configures whether or not AoE Projectile Warnings for Cerberus his fire should trigger a notification",
parent = "cerberusStub", parent = "cerberusStub",
position = 63, position = 68,
hide = "aoeNotifyAll" hide = "aoeNotifyAll"
) )
default boolean isCerbFireNotifyEnabled() default boolean isCerbFireNotifyEnabled()
@@ -823,7 +916,7 @@ public interface AoeWarningConfig extends Config
keyName = "demonicGorillaStub", keyName = "demonicGorillaStub",
name = "Demonic Gorilla", name = "Demonic Gorilla",
description = "", description = "",
position = 64, position = 69,
parent = "npcStub" parent = "npcStub"
) )
default Stub demonicGorillaStub() default Stub demonicGorillaStub()
@@ -836,7 +929,7 @@ public interface AoeWarningConfig extends Config
name = "Demonic Gorilla", name = "Demonic Gorilla",
description = "Configures if Demonic Gorilla boulder tile markers are displayed", description = "Configures if Demonic Gorilla boulder tile markers are displayed",
parent = "demonicGorillaStub", parent = "demonicGorillaStub",
position = 65 position = 70
) )
default boolean isDemonicGorillaEnabled() default boolean isDemonicGorillaEnabled()
{ {
@@ -848,7 +941,7 @@ public interface AoeWarningConfig extends Config
name = "Demonic Gorilla Notify", name = "Demonic Gorilla Notify",
description = "Configures whether or not AoE Projectile Warnings for Demonic Gorilla boulders should trigger a notification", description = "Configures whether or not AoE Projectile Warnings for Demonic Gorilla boulders should trigger a notification",
parent = "demonicGorillaStub", parent = "demonicGorillaStub",
position = 66, position = 71,
hide = "aoeNotifyAll" hide = "aoeNotifyAll"
) )
default boolean isDemonicGorillaNotifyEnabled() default boolean isDemonicGorillaNotifyEnabled()

View File

@@ -30,8 +30,10 @@ package net.runelite.client.plugins.aoewarnings;
import java.awt.BasicStroke; import java.awt.BasicStroke;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Polygon; import java.awt.Polygon;
import java.awt.Rectangle;
import java.time.Duration; import java.time.Duration;
import java.time.Instant; import java.time.Instant;
import java.util.Iterator; import java.util.Iterator;
@@ -40,12 +42,14 @@ import javax.annotation.Nullable;
import javax.inject.Inject; import javax.inject.Inject;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.Perspective; import net.runelite.api.Perspective;
import net.runelite.api.Point;
import net.runelite.api.Projectile; import net.runelite.api.Projectile;
import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer; import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition; import net.runelite.client.ui.overlay.OverlayPosition;
import net.runelite.client.ui.overlay.OverlayUtil;
import static net.runelite.client.util.ColorUtil.setAlphaComponent; import static net.runelite.client.util.ColorUtil.setAlphaComponent;
public class AoeWarningOverlay extends Overlay public class AoeWarningOverlay extends Overlay
@@ -95,7 +99,7 @@ public class AoeWarningOverlay extends Overlay
for (Iterator<AoeProjectile> it = projectiles.values().iterator(); it.hasNext(); ) for (Iterator<AoeProjectile> it = projectiles.values().iterator(); it.hasNext(); )
{ {
AoeProjectile aoeProjectile = it.next(); AoeProjectile aoeProjectile = it.next();
Color color;
if (now.isAfter(aoeProjectile.getStartTime().plus(Duration.ofMillis(aoeProjectile.getProjectileLifetime())))) if (now.isAfter(aoeProjectile.getStartTime().plus(Duration.ofMillis(aoeProjectile.getProjectileLifetime()))))
{ {
it.remove(); it.remove();
@@ -111,6 +115,8 @@ public class AoeWarningOverlay extends Overlay
// how far through the projectiles lifetime between 0-1. // how far through the projectiles lifetime between 0-1.
double progress = (System.currentTimeMillis() - aoeProjectile.getStartTime().toEpochMilli()) / (double) aoeProjectile.getProjectileLifetime(); double progress = (System.currentTimeMillis() - aoeProjectile.getStartTime().toEpochMilli()) / (double) aoeProjectile.getProjectileLifetime();
int tickProgress = aoeProjectile.getFinalTick() - client.getTickCount();
int fillAlpha, outlineAlpha; int fillAlpha, outlineAlpha;
if (config.isFadeEnabled()) if (config.isFadeEnabled())
{ {
@@ -122,6 +128,14 @@ public class AoeWarningOverlay extends Overlay
fillAlpha = FILL_START_ALPHA; fillAlpha = FILL_START_ALPHA;
outlineAlpha = OUTLINE_START_ALPHA; outlineAlpha = OUTLINE_START_ALPHA;
} }
if (tickProgress == 0)
{
color = Color.RED;
}
else
{
color = Color.WHITE;
}
if (fillAlpha < 0) if (fillAlpha < 0)
{ {
@@ -138,7 +152,7 @@ public class AoeWarningOverlay extends Overlay
} }
if (outlineAlpha > 255) if (outlineAlpha > 255)
{ {
outlineAlpha = 255;//Make sure we don't pass in an invalid alpha outlineAlpha = 255;
} }
if (config.isOutlineEnabled()) if (config.isOutlineEnabled())
@@ -146,7 +160,13 @@ public class AoeWarningOverlay extends Overlay
graphics.setColor(new Color(setAlphaComponent(config.overlayColor().getRGB(), outlineAlpha), true)); graphics.setColor(new Color(setAlphaComponent(config.overlayColor().getRGB(), outlineAlpha), true));
graphics.drawPolygon(tilePoly); graphics.drawPolygon(tilePoly);
} }
if (config.tickTimers())
{
if (tickProgress >= 0)
{
renderTextLocation(graphics, Integer.toString(tickProgress), config.textSize(), config.fontStyle().getFont(), color, centerPoint(tilePoly.getBounds()));
}
}
graphics.setColor(new Color(setAlphaComponent(config.overlayColor().getRGB(), fillAlpha), true)); graphics.setColor(new Color(setAlphaComponent(config.overlayColor().getRGB(), fillAlpha), true));
graphics.fillPolygon(tilePoly); graphics.fillPolygon(tilePoly);
} }
@@ -171,11 +191,36 @@ public class AoeWarningOverlay extends Overlay
{ {
return; return;
} }
//OverlayUtil.renderPolygon(graphics, poly, color);
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), outlineAlpha)); graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), outlineAlpha));
graphics.setStroke(new BasicStroke(strokeWidth)); graphics.setStroke(new BasicStroke(strokeWidth));
graphics.draw(poly); graphics.draw(poly);
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), fillAlpha)); graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), fillAlpha));
graphics.fill(poly); graphics.fill(poly);
} }
}
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 Point centerPoint(Rectangle rect)
{
int x = (int) (rect.getX() + rect.getWidth() / 2);
int y = (int) (rect.getY() + rect.getHeight() / 2);
return new Point(x, y);
}
}

View File

@@ -147,11 +147,18 @@ public class AoeWarningPlugin extends Plugin
int projectileId = projectile.getId(); int projectileId = projectile.getId();
int projectileLifetime = config.delay() + (projectile.getRemainingCycles() * 20); int projectileLifetime = config.delay() + (projectile.getRemainingCycles() * 20);
int ticksRemaining = projectile.getRemainingCycles() / 30;
if (!isTickTimersEnabledForProjectileID(projectileId))
{
ticksRemaining = 0;
}
int tickCycle = client.getTickCount() + ticksRemaining;
AoeProjectileInfo aoeProjectileInfo = AoeProjectileInfo.getById(projectileId); AoeProjectileInfo aoeProjectileInfo = AoeProjectileInfo.getById(projectileId);
if (aoeProjectileInfo != null && isConfigEnabledForProjectileId(projectileId, false)) if (aoeProjectileInfo != null
&& isConfigEnabledForProjectileId(projectileId, false))
{ {
LocalPoint targetPoint = event.getPosition(); LocalPoint targetPoint = event.getPosition();
AoeProjectile aoeProjectile = new AoeProjectile(Instant.now(), targetPoint, aoeProjectileInfo, projectileLifetime); AoeProjectile aoeProjectile = new AoeProjectile(Instant.now(), targetPoint, aoeProjectileInfo, projectileLifetime, tickCycle);
projectiles.put(projectile, aoeProjectile); projectiles.put(projectile, aoeProjectile);
if (config.aoeNotifyAll() || isConfigEnabledForProjectileId(projectileId, true)) if (config.aoeNotifyAll() || isConfigEnabledForProjectileId(projectileId, true))
@@ -294,6 +301,31 @@ public class AoeWarningPlugin extends Plugin
} }
} }
private boolean isTickTimersEnabledForProjectileID(int projectileId)
{
AoeProjectileInfo projectileInfo = AoeProjectileInfo.getById(projectileId);
if (projectileInfo == null)
{
return false;
}
switch (projectileInfo)
{
case VASA_RANGED_AOE:
case VORKATH_POISON_POOL:
case VORKATH_SPAWN:
case VORKATH_TICK_FIRE:
case OLM_BURNING:
case OLM_FALLING_CRYSTAL_TRAIL:
case OLM_ACID_TRAIL:
case OLM_FIRE_LINE:
return false;
}
return true;
}
private boolean isConfigEnabledForProjectileId(int projectileId, boolean notify) private boolean isConfigEnabledForProjectileId(int projectileId, boolean notify)
{ {
AoeProjectileInfo projectileInfo = AoeProjectileInfo.getById(projectileId); AoeProjectileInfo projectileInfo = AoeProjectileInfo.getById(projectileId);