timers plugin: add more timers
38
runelite-api/src/main/java/net/runelite/api/GraphicID.java
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Adam <Adam@sigterm.info>
|
||||
* 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.api;
|
||||
|
||||
public class GraphicID
|
||||
{
|
||||
public static final int ENTANGLE = 179;
|
||||
public static final int SNARE = 180;
|
||||
public static final int BIND = 181;
|
||||
public static final int ICE_RUSH = 361;
|
||||
public static final int ICE_BURST = 363;
|
||||
public static final int ICE_BLITZ = 367;
|
||||
public static final int ICE_BARRAGE = 369;
|
||||
public static final int VENGEANCE = 726;
|
||||
public static final int IMBUED_HEART = 1316;
|
||||
}
|
||||
@@ -31,7 +31,9 @@ import java.io.InputStream;
|
||||
import java.time.Duration;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import javax.imageio.ImageIO;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.GraphicID;
|
||||
|
||||
@Slf4j
|
||||
public enum GameTimer
|
||||
@@ -46,27 +48,39 @@ public enum GameTimer
|
||||
HALFTB("teleblock", 150, ChronoUnit.SECONDS),
|
||||
SUPERANTIVENOM("antivenom", 3, ChronoUnit.MINUTES),
|
||||
SUPERANTIFIRE("superantifire", 2, ChronoUnit.MINUTES),
|
||||
ANTIDOTEPLUSPLUS("antidoteplusplus", 12, ChronoUnit.MINUTES);
|
||||
ANTIDOTEPLUSPLUS("antidoteplusplus", 12, ChronoUnit.MINUTES),
|
||||
BIND("bind", GraphicID.BIND, 5, ChronoUnit.SECONDS),
|
||||
HALFBIND("bind", GraphicID.BIND, 2500, ChronoUnit.MILLIS),
|
||||
SNARE("snare", GraphicID.SNARE, 10, ChronoUnit.SECONDS),
|
||||
HALFSNARE("snare", GraphicID.SNARE, 5, ChronoUnit.SECONDS),
|
||||
ENTANGLE("entangle", GraphicID.ENTANGLE, 15, ChronoUnit.SECONDS),
|
||||
HALFENTANGLE("entangle", GraphicID.ENTANGLE, 7500, ChronoUnit.MILLIS),
|
||||
ICERUSH("icerush", GraphicID.ICE_RUSH, 5, ChronoUnit.SECONDS),
|
||||
ICEBURST("iceburst", GraphicID.ICE_BURST, 10, ChronoUnit.SECONDS),
|
||||
ICEBLITZ("iceblitz", GraphicID.ICE_BLITZ, 15, ChronoUnit.SECONDS),
|
||||
ICEBARRAGE("icebarrage", GraphicID.ICE_BARRAGE, 20, ChronoUnit.SECONDS),
|
||||
IMBUEDHEART("imbuedheart", GraphicID.IMBUED_HEART, 420, ChronoUnit.SECONDS),
|
||||
VENGEANCE("vengeance", GraphicID.VENGEANCE, 30, ChronoUnit.SECONDS);
|
||||
|
||||
@Getter
|
||||
private final String imageResource;
|
||||
@Getter
|
||||
private final Duration duration;
|
||||
@Getter
|
||||
private final Integer graphicId;
|
||||
|
||||
private BufferedImage image;
|
||||
|
||||
GameTimer(String imageResource, long time, ChronoUnit unit)
|
||||
GameTimer(String imageResource, Integer graphicId, long time, ChronoUnit unit)
|
||||
{
|
||||
this.imageResource = imageResource;
|
||||
this.graphicId = graphicId;
|
||||
this.duration = Duration.of(time, unit);
|
||||
}
|
||||
|
||||
public String getImageResource()
|
||||
GameTimer(String imageResource, long time, ChronoUnit unit)
|
||||
{
|
||||
return imageResource;
|
||||
}
|
||||
|
||||
public Duration getDuration()
|
||||
{
|
||||
return duration;
|
||||
this(imageResource, null, time, unit);
|
||||
}
|
||||
|
||||
public BufferedImage getImage()
|
||||
|
||||
@@ -144,4 +144,34 @@ public interface TimersConfig extends Config
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showImbuedHeart",
|
||||
name = "Imbued Heart timer",
|
||||
description = "Configures whether imbued heart timer is displayed"
|
||||
)
|
||||
default boolean showImbuedHeart()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showVengeance",
|
||||
name = "Vengeance timer",
|
||||
description = "Configures whether vengeance timer is displayed"
|
||||
)
|
||||
default boolean showVengeance()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showFreezes",
|
||||
name = "Freeze timer",
|
||||
description = "Configures whether freeze timer is displayed"
|
||||
)
|
||||
default boolean showFreezes()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,11 +35,27 @@ import static net.runelite.client.plugins.timers.GameTimer.OVERLOAD;
|
||||
import static net.runelite.client.plugins.timers.GameTimer.STAMINA;
|
||||
import static net.runelite.client.plugins.timers.GameTimer.SUPERANTIFIRE;
|
||||
import static net.runelite.client.plugins.timers.GameTimer.SUPERANTIVENOM;
|
||||
import static net.runelite.client.plugins.timers.GameTimer.BIND;
|
||||
import static net.runelite.client.plugins.timers.GameTimer.ENTANGLE;
|
||||
import static net.runelite.client.plugins.timers.GameTimer.HALFBIND;
|
||||
import static net.runelite.client.plugins.timers.GameTimer.HALFENTANGLE;
|
||||
import static net.runelite.client.plugins.timers.GameTimer.HALFSNARE;
|
||||
import static net.runelite.client.plugins.timers.GameTimer.ICEBARRAGE;
|
||||
import static net.runelite.client.plugins.timers.GameTimer.ICEBLITZ;
|
||||
import static net.runelite.client.plugins.timers.GameTimer.ICEBURST;
|
||||
import static net.runelite.client.plugins.timers.GameTimer.ICERUSH;
|
||||
import static net.runelite.client.plugins.timers.GameTimer.IMBUEDHEART;
|
||||
import static net.runelite.client.plugins.timers.GameTimer.SNARE;
|
||||
import static net.runelite.client.plugins.timers.GameTimer.VENGEANCE;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.google.inject.Provides;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.Prayer;
|
||||
import net.runelite.api.events.GraphicChanged;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
@@ -53,6 +69,9 @@ import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
)
|
||||
public class TimersPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
Client client;
|
||||
|
||||
@Inject
|
||||
TimersConfig config;
|
||||
|
||||
@@ -225,6 +244,91 @@ public class TimersPlugin extends Plugin
|
||||
{
|
||||
removeGameTimer(SUPERANTIFIRE);
|
||||
}
|
||||
|
||||
if (event.getMessage().equals("<col=ef1020>Your imbued heart has regained its magical power.</col>"))
|
||||
{
|
||||
removeGameTimer(IMBUEDHEART);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGraphicChanged(GraphicChanged event)
|
||||
{
|
||||
Actor actor = event.getActor();
|
||||
|
||||
if (actor != client.getLocalPlayer())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (actor.getGraphic() == IMBUEDHEART.getGraphicId() && config.showImbuedHeart())
|
||||
{
|
||||
createGameTimer(IMBUEDHEART);
|
||||
}
|
||||
|
||||
if (actor.getGraphic() == VENGEANCE.getGraphicId() && config.showVengeance())
|
||||
{
|
||||
createGameTimer(VENGEANCE);
|
||||
}
|
||||
|
||||
if (config.showFreezes())
|
||||
{
|
||||
if (actor.getGraphic() == BIND.getGraphicId())
|
||||
{
|
||||
if (client.isPrayerActive(Prayer.PROTECT_FROM_MAGIC))
|
||||
{
|
||||
createGameTimer(HALFBIND);
|
||||
}
|
||||
else
|
||||
{
|
||||
createGameTimer(BIND);
|
||||
}
|
||||
}
|
||||
|
||||
if (actor.getGraphic() == SNARE.getGraphicId())
|
||||
{
|
||||
if (client.isPrayerActive(Prayer.PROTECT_FROM_MAGIC))
|
||||
{
|
||||
createGameTimer(HALFSNARE);
|
||||
}
|
||||
else
|
||||
{
|
||||
createGameTimer(SNARE);
|
||||
}
|
||||
}
|
||||
|
||||
if (actor.getGraphic() == ENTANGLE.getGraphicId())
|
||||
{
|
||||
if (client.isPrayerActive(Prayer.PROTECT_FROM_MAGIC))
|
||||
{
|
||||
createGameTimer(HALFENTANGLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
createGameTimer(ENTANGLE);
|
||||
}
|
||||
}
|
||||
|
||||
if (actor.getGraphic() == ICERUSH.getGraphicId())
|
||||
{
|
||||
createGameTimer(ICERUSH);
|
||||
}
|
||||
|
||||
if (actor.getGraphic() == ICEBURST.getGraphicId())
|
||||
{
|
||||
createGameTimer(ICEBURST);
|
||||
}
|
||||
|
||||
if (actor.getGraphic() == ICEBLITZ.getGraphicId())
|
||||
{
|
||||
createGameTimer(ICEBLITZ);
|
||||
}
|
||||
|
||||
if (actor.getGraphic() == ICEBARRAGE.getGraphicId())
|
||||
{
|
||||
createGameTimer(ICEBARRAGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void createGameTimer(GameTimer timer)
|
||||
|
||||
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 196 B |
|
After Width: | Height: | Size: 199 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 187 B |
|
After Width: | Height: | Size: 631 B |
|
After Width: | Height: | Size: 297 B |
|
After Width: | Height: | Size: 527 B |