Merge pull request #196 from runelite-extended/aoe
AoE Warnings now uses CycleCount -farhan1666
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Modified by farhan1666
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
@@ -24,21 +27,22 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.aoewarnings;
|
||||
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
|
||||
import java.time.Instant;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
|
||||
public class AoeProjectile
|
||||
{
|
||||
private final Instant startTime;
|
||||
private final LocalPoint targetPoint;
|
||||
private final AoeProjectileInfo aoeProjectileInfo;
|
||||
private final int projectileLifetime;
|
||||
|
||||
public AoeProjectile(Instant startTime, LocalPoint targetPoint, AoeProjectileInfo aoeProjectileInfo)
|
||||
public AoeProjectile(Instant startTime, LocalPoint targetPoint, AoeProjectileInfo aoeProjectileInfo, int projectileLifetime)
|
||||
{
|
||||
this.startTime = startTime;
|
||||
this.targetPoint = targetPoint;
|
||||
this.aoeProjectileInfo = aoeProjectileInfo;
|
||||
this.projectileLifetime = projectileLifetime;
|
||||
}
|
||||
|
||||
public Instant getStartTime()
|
||||
@@ -55,4 +59,9 @@ public class AoeProjectile
|
||||
{
|
||||
return aoeProjectileInfo;
|
||||
}
|
||||
|
||||
public int getProjectileLifetime()
|
||||
{
|
||||
return projectileLifetime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
* Copyright (c) 2018, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Modified by farhan1666
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
@@ -24,91 +27,91 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.aoewarnings;
|
||||
|
||||
import net.runelite.api.ProjectileID;
|
||||
|
||||
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),
|
||||
LIZARDMAN_SHAMAN_AOE(ProjectileID.LIZARDMAN_SHAMAN_AOE, 5),
|
||||
CRAZY_ARCHAEOLOGIST_AOE(ProjectileID.CRAZY_ARCHAEOLOGIST_AOE, 3),
|
||||
ICE_DEMON_RANGED_AOE(ProjectileID.ICE_DEMON_RANGED_AOE, 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),
|
||||
ICE_DEMON_ICE_BARRAGE_AOE(ProjectileID.ICE_DEMON_ICE_BARRAGE_AOE, 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),
|
||||
VASA_AWAKEN_AOE(ProjectileID.VASA_AWAKEN_AOE, 3),
|
||||
VASA_RANGED_AOE(ProjectileID.VASA_RANGED_AOE, 3),
|
||||
TEKTON_METEOR_AOE(ProjectileID.TEKTON_METEOR_AOE, 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),
|
||||
VORKATH_BOMB(ProjectileID.VORKATH_BOMB_AOE, 3),
|
||||
VORKATH_POISON_POOL(ProjectileID.VORKATH_POISON_POOL_AOE, 1),
|
||||
VORKATH_SPAWN(ProjectileID.VORKATH_SPAWN_AOE, 1), //extra tick because hard to see otherwise
|
||||
VORKATH_TICK_FIRE(ProjectileID.VORKATH_TICK_FIRE_AOE, 1),
|
||||
|
||||
/**
|
||||
* the AOEs of Galvek
|
||||
*/
|
||||
GALVEK_MINE(ProjectileID.GALVEK_MINE, 3600, 3),
|
||||
GALVEK_BOMB(ProjectileID.GALVEK_BOMB, 2400, 3),
|
||||
GALVEK_MINE(ProjectileID.GALVEK_MINE, 3),
|
||||
GALVEK_BOMB(ProjectileID.GALVEK_BOMB, 3),
|
||||
|
||||
DAWN_FREEZE(ProjectileID.DAWN_FREEZE, 3000, 3),
|
||||
DUSK_CEILING(ProjectileID.DUSK_CEILING, 3000, 3),
|
||||
DAWN_FREEZE(ProjectileID.DAWN_FREEZE, 3),
|
||||
DUSK_CEILING(ProjectileID.DUSK_CEILING, 3),
|
||||
|
||||
/**
|
||||
* the AOE of Vet'ion
|
||||
*/
|
||||
VETION_LIGHTNING(ProjectileID.VETION_LIGHTNING, 3000, 1),
|
||||
VETION_LIGHTNING(ProjectileID.VETION_LIGHTNING, 1),
|
||||
|
||||
/**
|
||||
* the AOE of Chaos Fanatic
|
||||
*/
|
||||
CHAOS_FANATIC(ProjectileID.CHAOS_FANATIC_AOE, 3000, 1),
|
||||
CHAOS_FANATIC(ProjectileID.CHAOS_FANATIC_AOE, 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),
|
||||
CORPOREAL_BEAST(ProjectileID.CORPOREAL_BEAST_AOE, 1),
|
||||
CORPOREAL_BEAST_DARK_CORE(ProjectileID.CORPOREAL_BEAST_DARK_CORE_AOE, 3),
|
||||
|
||||
/**
|
||||
* the AOEs of The Great Olm
|
||||
*/
|
||||
OLM_FALLING_CRYSTAL(ProjectileID.OLM_FALLING_CRYSTAL, 3000, 3),
|
||||
OLM_BURNING(ProjectileID.OLM_BURNING, 2400, 1),
|
||||
OLM_FALLING_CRYSTAL_TRAIL(ProjectileID.OLM_FALLING_CRYSTAL_TRAIL, 2400, 1),
|
||||
OLM_ACID_TRAIL(ProjectileID.OLM_ACID_TRAIL, 2400, 1),
|
||||
OLM_FIRE_LINE(ProjectileID.OLM_FIRE_LINE, 2400, 1),
|
||||
OLM_FALLING_CRYSTAL(ProjectileID.OLM_FALLING_CRYSTAL, 3),
|
||||
OLM_BURNING(ProjectileID.OLM_BURNING, 1),
|
||||
OLM_FALLING_CRYSTAL_TRAIL(ProjectileID.OLM_FALLING_CRYSTAL_TRAIL, 1),
|
||||
OLM_ACID_TRAIL(ProjectileID.OLM_ACID_TRAIL, 1),
|
||||
OLM_FIRE_LINE(ProjectileID.OLM_FIRE_LINE, 1),
|
||||
|
||||
/**
|
||||
* the AOE of the Wintertodt snow that falls
|
||||
*/
|
||||
WINTERTODT_SNOW_FALL(ProjectileID.WINTERTODT_SNOW_FALL_AOE, 4000, 3),
|
||||
WINTERTODT_SNOW_FALL(ProjectileID.WINTERTODT_SNOW_FALL_AOE, 3),
|
||||
|
||||
/**
|
||||
* AOE of Xarpus throwing poison
|
||||
*/
|
||||
XARPUS_POISON_AOE(ProjectileID.XARPUS_ACID, 4000, 3),
|
||||
XARPUS_POISON_AOE(ProjectileID.XARPUS_ACID, 1),
|
||||
|
||||
/**
|
||||
* Aoe of Addy Drags
|
||||
*/
|
||||
ADDY_DRAG_POISON(ProjectileID.ADDY_DRAG_POISON, 2400, 1),
|
||||
ADDY_DRAG_POISON(ProjectileID.ADDY_DRAG_POISON, 1),
|
||||
|
||||
/**
|
||||
* the Breath of the Drake
|
||||
*/
|
||||
|
||||
DRAKE_BREATH(ProjectileID.DRAKE_BREATH, 2800, 1);
|
||||
DRAKE_BREATH(ProjectileID.DRAKE_BREATH, 1);
|
||||
|
||||
private static final Map<Integer, AoeProjectileInfo> map = new HashMap<>();
|
||||
|
||||
@@ -129,17 +132,11 @@ public enum AoeProjectileInfo
|
||||
* 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;
|
||||
|
||||
AoeProjectileInfo(int id, int lifeTimeMillis, int aoeSize)
|
||||
AoeProjectileInfo(int id, int aoeSize)
|
||||
{
|
||||
this.id = id;
|
||||
this.lifeTime = Duration.ofMillis(lifeTimeMillis);
|
||||
this.aoeSize = aoeSize;
|
||||
}
|
||||
|
||||
@@ -148,11 +145,6 @@ public enum AoeProjectileInfo
|
||||
return map.get(id);
|
||||
}
|
||||
|
||||
public Duration getLifeTime()
|
||||
{
|
||||
return lifeTime;
|
||||
}
|
||||
|
||||
public int getId()
|
||||
{
|
||||
return id;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
* Copyright (c) 2018, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Modified by farhan1666
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
@@ -259,4 +261,14 @@ public interface AoeWarningConfig extends Config
|
||||
default boolean isDrakeEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "delay",
|
||||
name = "Fade delay",
|
||||
description = "Configures the amount of time in milliseconds that the warning lingers for after the projectile has touched the ground"
|
||||
)
|
||||
default int delay()
|
||||
{
|
||||
return 300;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Modified by farhan1666
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
@@ -24,6 +27,17 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.aoewarnings;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import java.time.Duration;
|
||||
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;
|
||||
@@ -33,13 +47,6 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import java.awt.*;
|
||||
import java.time.Instant;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
public class AoeWarningOverlay extends Overlay
|
||||
{
|
||||
private static final int FILL_START_ALPHA = 25;
|
||||
@@ -85,7 +92,7 @@ public class AoeWarningOverlay extends Overlay
|
||||
{
|
||||
AoeProjectile aoeProjectile = it.next();
|
||||
|
||||
if (now.isAfter(aoeProjectile.getStartTime().plus(aoeProjectile.getAoeProjectileInfo().getLifeTime())))
|
||||
if (now.isAfter(aoeProjectile.getStartTime().plus(Duration.ofMillis(aoeProjectile.getProjectileLifetime()))))
|
||||
{
|
||||
it.remove();
|
||||
continue;
|
||||
@@ -98,7 +105,7 @@ public class AoeWarningOverlay extends Overlay
|
||||
}
|
||||
|
||||
// how far through the projectiles lifetime between 0-1.
|
||||
double progress = (System.currentTimeMillis() - aoeProjectile.getStartTime().toEpochMilli()) / (double) aoeProjectile.getAoeProjectileInfo().getLifeTime().toMillis();
|
||||
double progress = (System.currentTimeMillis() - aoeProjectile.getStartTime().toEpochMilli()) / (double) aoeProjectile.getProjectileLifetime();
|
||||
|
||||
int fillAlpha, outlineAlpha;
|
||||
if (config.isFadeEnabled())
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
* Copyright (c) 2018, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Modified by farhan1666
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
@@ -26,13 +28,30 @@ 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.*;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameObject;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.GraphicsObject;
|
||||
import net.runelite.api.ObjectID;
|
||||
import net.runelite.api.Projectile;
|
||||
import net.runelite.api.Tile;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.*;
|
||||
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.ProjectileMoved;
|
||||
import net.runelite.client.Notifier;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
@@ -41,10 +60,6 @@ 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.*;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "AoE Warnings",
|
||||
description = "Shows the final destination for AoE Attack projectiles",
|
||||
@@ -116,11 +131,12 @@ public class AoeWarningPlugin extends Plugin
|
||||
Projectile projectile = event.getProjectile();
|
||||
|
||||
int projectileId = projectile.getId();
|
||||
int projectileLifetime = config.delay() + (projectile.getRemainingCycles() * 20);
|
||||
AoeProjectileInfo aoeProjectileInfo = AoeProjectileInfo.getById(projectileId);
|
||||
if (aoeProjectileInfo != null && isConfigEnabledForProjectileId(projectileId))
|
||||
{
|
||||
LocalPoint targetPoint = event.getPosition();
|
||||
AoeProjectile aoeProjectile = new AoeProjectile(Instant.now(), targetPoint, aoeProjectileInfo);
|
||||
AoeProjectile aoeProjectile = new AoeProjectile(Instant.now(), targetPoint, aoeProjectileInfo, projectileLifetime);
|
||||
projectiles.put(projectile, aoeProjectile);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user