This commit is contained in:
therealunull
2020-12-14 15:49:52 -05:00
parent c2f3a662f2
commit 04041491fc
15 changed files with 1829 additions and 40 deletions

View File

@@ -739,15 +739,6 @@ public interface Client extends GameShell
*/
String getVar(VarClientStr varClientStr);
/**
* Gets the value of a given VarPlayer.
*
* @param varpId the VarPlayer id
* @return the value
*/
@VisibleForExternalPlugins
int getVarpValue(int varpId);
/**
* Gets the value of a given Varbit.
*
@@ -813,16 +804,6 @@ public interface Client extends GameShell
*/
int getVarpValue(int[] varps, int varpId);
/**
* Sets the value of a given VarPlayer.
*
* @param varps passed varps
* @param varpId the VarpPlayer id
* @param value the value
* @see VarPlayer#id
*/
void setVarpValue(int[] varps, int varpId, int value);
/**
* Sets the value of a given variable.
*
@@ -2087,7 +2068,6 @@ public interface Client extends GameShell
//TODO: Implement
VarbitComposition getVarbit(Integer id);
//TODO: Implement
Widget getWidget(int param1);
//TODO: Implement

View File

@@ -19,7 +19,7 @@ import net.runelite.api.Actor;
* @see net.runelite.api.GraphicID
*/
@Data
public class SpotAnimationChanged implements Event
public class GraphicChanged implements Event
{
/**
* The actor that has had their graphic changed.

View File

@@ -26,6 +26,7 @@ package net.runelite.api.events;
import lombok.Value;
import net.runelite.api.NPC;
import net.runelite.api.NPCComposition;
/**
* Fires after the composition of an {@link NPC} changes.
@@ -37,4 +38,10 @@ public class NpcChanged implements Event
* The NPC of which the composition changed.
*/
NPC npc;
/**
* The old composition of the NPC
*/
NPCComposition old;
}

View File

@@ -0,0 +1,74 @@
/*
* Copyright (c) 2019, winterdaze
* 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.timers;
import lombok.Getter;
import net.runelite.client.ui.overlay.infobox.InfoBox;
import java.awt.image.BufferedImage;
import java.awt.Color;
import java.time.Duration;
import java.time.Instant;
import org.apache.commons.lang3.time.DurationFormatUtils;
@Getter
class ElapsedTimer extends InfoBox
{
private final Instant startTime;
private final Instant lastTime;
// Creates a timer that counts up if lastTime is null, or a paused timer if lastTime is defined
ElapsedTimer(BufferedImage image, TimersPlugin plugin, Instant startTime, Instant lastTime)
{
super(image, plugin);
this.startTime = startTime;
this.lastTime = lastTime;
}
@Override
public String getText()
{
if (startTime == null)
{
return null;
}
Duration time = Duration.between(startTime, lastTime == null ? Instant.now() : lastTime);
final String formatString = "mm:ss";
return DurationFormatUtils.formatDuration(time.toMillis(), formatString, true);
}
@Override
public Color getTextColor()
{
return Color.WHITE;
}
@Override
public String getTooltip()
{
Duration time = Duration.between(startTime, lastTime == null ? Instant.now() : lastTime);
return "Elapsed time: " + DurationFormatUtils.formatDuration(time.toMillis(), "HH:mm:ss", true);
}
}

View File

@@ -0,0 +1,56 @@
/*
* Copyright (c) 2018, Tyler <https://github.com/tylerthardy>
* 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.timers;
import java.awt.Color;
import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.api.SpriteID;
@Getter(AccessLevel.PACKAGE)
enum GameIndicator
{
VENGEANCE_ACTIVE(SpriteID.SPELL_VENGEANCE_OTHER, GameTimerImageType.SPRITE, "Vengeance active");
private final String description;
private String text;
private Color textColor;
private final int imageId;
private final GameTimerImageType imageType;
GameIndicator(int imageId, GameTimerImageType idType, String description, String text, Color textColor)
{
this.imageId = imageId;
this.imageType = idType;
this.description = description;
this.text = text;
this.textColor = textColor;
}
GameIndicator(int imageId, GameTimerImageType idType, String description)
{
this(imageId, idType, description, "", null);
}
}

View File

@@ -0,0 +1,119 @@
/*
* Copyright (c) 2017, Seth <Sethtroll3@gmail.com>
* Copyright (c) 2017, Adam <Adam@sigterm.info>
* Copyright (c) 2018, Jordan Atwood <jordan.atwood423@gmail.com>
* 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.timers;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalUnit;
import javax.annotation.Nullable;
import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.api.GraphicID;
import net.runelite.api.ItemID;
import net.runelite.api.SpriteID;
import static net.runelite.client.util.RSTimeUnit.GAME_TICKS;
@Getter(AccessLevel.PACKAGE)
enum GameTimer
{
STAMINA(ItemID.STAMINA_POTION4, GameTimerImageType.ITEM, "Stamina", true),
ANTIFIRE(ItemID.ANTIFIRE_POTION4, GameTimerImageType.ITEM, "Antifire", 6, ChronoUnit.MINUTES),
EXANTIFIRE(ItemID.EXTENDED_ANTIFIRE4, GameTimerImageType.ITEM, "Extended antifire", 12, ChronoUnit.MINUTES),
OVERLOAD(ItemID.OVERLOAD_4, GameTimerImageType.ITEM, "Overload", 5, ChronoUnit.MINUTES, true),
CANNON(ItemID.CANNON_BARRELS, GameTimerImageType.ITEM, "Cannon", 25, ChronoUnit.MINUTES),
MAGICIMBUE(SpriteID.SPELL_MAGIC_IMBUE, GameTimerImageType.SPRITE, "Magic imbue", 21, GAME_TICKS),
SUPERANTIFIRE(ItemID.SUPER_ANTIFIRE_POTION4, GameTimerImageType.ITEM, "Super antifire", 3, ChronoUnit.MINUTES),
BIND(SpriteID.SPELL_BIND, GameTimerImageType.SPRITE, "Bind", GraphicID.BIND, 8, GAME_TICKS, true),
SNARE(SpriteID.SPELL_SNARE, GameTimerImageType.SPRITE, "Snare", GraphicID.SNARE, 16, GAME_TICKS, true),
ENTANGLE(SpriteID.SPELL_ENTANGLE, GameTimerImageType.SPRITE, "Entangle", GraphicID.ENTANGLE, 24, GAME_TICKS, true),
ICERUSH(SpriteID.SPELL_ICE_RUSH, GameTimerImageType.SPRITE, "Ice rush", GraphicID.ICE_RUSH, 8, GAME_TICKS, true),
ICEBURST(SpriteID.SPELL_ICE_BURST, GameTimerImageType.SPRITE, "Ice burst", GraphicID.ICE_BURST, 16, GAME_TICKS, true),
ICEBLITZ(SpriteID.SPELL_ICE_BLITZ, GameTimerImageType.SPRITE, "Ice blitz", GraphicID.ICE_BLITZ, 24, GAME_TICKS, true),
ICEBARRAGE(SpriteID.SPELL_ICE_BARRAGE, GameTimerImageType.SPRITE, "Ice barrage", GraphicID.ICE_BARRAGE, 32, GAME_TICKS, true),
IMBUEDHEART(ItemID.IMBUED_HEART, GameTimerImageType.ITEM, "Imbued heart", GraphicID.IMBUED_HEART, 420, ChronoUnit.SECONDS, true),
VENGEANCE(SpriteID.SPELL_VENGEANCE, GameTimerImageType.SPRITE, "Vengeance", 30, ChronoUnit.SECONDS),
EXSUPERANTIFIRE(ItemID.EXTENDED_SUPER_ANTIFIRE4, GameTimerImageType.ITEM, "Extended Super AntiFire", 6, ChronoUnit.MINUTES),
OVERLOAD_RAID(ItemID.OVERLOAD_4_20996, GameTimerImageType.ITEM, "Overload", 5, ChronoUnit.MINUTES, true),
PRAYER_ENHANCE(ItemID.PRAYER_ENHANCE_4, GameTimerImageType.ITEM, "Prayer enhance", 290, ChronoUnit.SECONDS, true),
GOD_WARS_ALTAR(SpriteID.SKILL_PRAYER, GameTimerImageType.SPRITE, "God wars altar", 10, ChronoUnit.MINUTES),
CHARGE(SpriteID.SPELL_CHARGE, GameTimerImageType.SPRITE, "Charge", 6, ChronoUnit.MINUTES),
STAFF_OF_THE_DEAD(ItemID.STAFF_OF_THE_DEAD, GameTimerImageType.ITEM, "Staff of the Dead", 1, ChronoUnit.MINUTES),
ABYSSAL_SIRE_STUN(ItemID.ABYSSAL_ORPHAN, GameTimerImageType.ITEM, "Abyssal Sire Stun", 30, ChronoUnit.SECONDS, true),
HOME_TELEPORT(SpriteID.SPELL_LUMBRIDGE_HOME_TELEPORT, GameTimerImageType.SPRITE, "Home Teleport", 30, ChronoUnit.MINUTES),
MINIGAME_TELEPORT(SpriteID.TAB_QUESTS_RED_MINIGAMES, GameTimerImageType.SPRITE, "Minigame Teleport", 20, ChronoUnit.MINUTES),
DRAGON_FIRE_SHIELD(ItemID.DRAGONFIRE_SHIELD_11284, GameTimerImageType.ITEM, "Dragonfire Shield Special", 115, ChronoUnit.SECONDS),
DIVINE_SUPER_ATTACK(ItemID.DIVINE_SUPER_ATTACK_POTION4, GameTimerImageType.ITEM, "Divine Super Attack", 5, ChronoUnit.MINUTES),
DIVINE_SUPER_STRENGTH(ItemID.DIVINE_SUPER_STRENGTH_POTION4, GameTimerImageType.ITEM, "Divine Super Strength", 5, ChronoUnit.MINUTES),
DIVINE_SUPER_DEFENCE(ItemID.DIVINE_SUPER_DEFENCE_POTION4, GameTimerImageType.ITEM, "Divine Super Defence", 5, ChronoUnit.MINUTES),
DIVINE_SUPER_COMBAT(ItemID.DIVINE_SUPER_COMBAT_POTION4, GameTimerImageType.ITEM, "Divine Super Combat", 5, ChronoUnit.MINUTES),
DIVINE_RANGING(ItemID.DIVINE_RANGING_POTION4, GameTimerImageType.ITEM, "Divine Ranging", 5, ChronoUnit.MINUTES),
DIVINE_MAGIC(ItemID.DIVINE_MAGIC_POTION4, GameTimerImageType.ITEM, "Divine Magic", 5, ChronoUnit.MINUTES),
DIVINE_BASTION(ItemID.DIVINE_BASTION_POTION4, GameTimerImageType.ITEM, "Divine Bastion", 5, ChronoUnit.MINUTES),
DIVINE_BATTLEMAGE(ItemID.DIVINE_BATTLEMAGE_POTION4, GameTimerImageType.ITEM, "Divine Battlemage", 5, ChronoUnit.MINUTES),
ANTIPOISON(ItemID.ANTIPOISON4, GameTimerImageType.ITEM, "Antipoison", false),
ANTIVENOM(ItemID.ANTIVENOM4, GameTimerImageType.ITEM, "Anti-venom", false),
TELEBLOCK(SpriteID.SPELL_TELE_BLOCK, GameTimerImageType.SPRITE, "Teleblock", true);
@Nullable
private final Duration duration;
@Nullable
private final Integer graphicId;
private final String description;
private final boolean removedOnDeath;
private final int imageId;
private final GameTimerImageType imageType;
GameTimer(int imageId, GameTimerImageType idType, String description, Integer graphicId, long time, TemporalUnit unit, boolean removedOnDeath)
{
this.description = description;
this.graphicId = graphicId;
this.duration = Duration.of(time, unit);
this.imageId = imageId;
this.imageType = idType;
this.removedOnDeath = removedOnDeath;
}
GameTimer(int imageId, GameTimerImageType idType, String description, long time, TemporalUnit unit, boolean removeOnDeath)
{
this(imageId, idType, description, null, time, unit, removeOnDeath);
}
GameTimer(int imageId, GameTimerImageType idType, String description, long time, TemporalUnit unit)
{
this(imageId, idType, description, null, time, unit, false);
}
GameTimer(int imageId, GameTimerImageType idType, String description, boolean removedOnDeath)
{
this.duration = null;
this.graphicId = null;
this.description = description;
this.removedOnDeath = removedOnDeath;
this.imageId = imageId;
this.imageType = idType;
}
}

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2018, Jordan Atwood <jordan.atwood423@gmail.com>
* 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.timers;
enum GameTimerImageType
{
ITEM,
SPRITE
}

View File

@@ -0,0 +1,56 @@
/*
* Copyright (c) 2018, Tyler <https://github.com/tylerthardy>
* 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.timers;
import java.awt.Color;
import lombok.Getter;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.ui.overlay.infobox.InfoBox;
import net.runelite.client.ui.overlay.infobox.InfoBoxPriority;
public class IndicatorIndicator extends InfoBox
{
@Getter
private final GameIndicator indicator;
IndicatorIndicator(GameIndicator indicator, Plugin plugin)
{
super(null, plugin);
this.indicator = indicator;
setPriority(InfoBoxPriority.MED);
}
@Override
public String getText()
{
return indicator.getText();
}
@Override
public Color getTextColor()
{
return indicator.getTextColor();
}
}

View File

@@ -0,0 +1,67 @@
/*
* Copyright (c) 2018, Jordan Atwood <jordan.atwood423@gmail.com>
* 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.timers;
import com.google.common.collect.ImmutableList;
import java.util.Collection;
import javax.annotation.Nullable;
import net.runelite.api.widgets.WidgetInfo;
enum TeleportWidget
{
HOME_TELEPORT,
MINIGAME_TELEPORT,
TRAILBLAZER_AREA_TELEPORT,
;
private static final Collection HOME_TELEPORT_IDS = ImmutableList.of(
WidgetInfo.SPELL_LUMBRIDGE_HOME_TELEPORT.getId(),
WidgetInfo.SPELL_EDGEVILLE_HOME_TELEPORT.getId(),
WidgetInfo.SPELL_LUNAR_HOME_TELEPORT.getId(),
WidgetInfo.SPELL_ARCEUUS_HOME_TELEPORT.getId(),
WidgetInfo.SPELL_KOUREND_HOME_TELEPORT.getId()
);
private static final Collection MINIGAME_TELEPORT_IDS = ImmutableList.of(
WidgetInfo.MINIGAME_TELEPORT_BUTTON.getId()
);
@Nullable
static TeleportWidget of(int widgetId)
{
if (HOME_TELEPORT_IDS.contains(widgetId))
{
return HOME_TELEPORT;
}
else if (MINIGAME_TELEPORT_IDS.contains(widgetId))
{
return MINIGAME_TELEPORT;
}
else if (widgetId == WidgetInfo.TRAILBLAZER_AREA_TELEPORT.getId())
{
return TRAILBLAZER_AREA_TELEPORT;
}
return null;
}
}

View File

@@ -0,0 +1,54 @@
/*
* Copyright (c) 2017, 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.client.plugins.timers;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.ui.overlay.infobox.InfoBoxPriority;
import net.runelite.client.ui.overlay.infobox.Timer;
class TimerTimer extends Timer
{
private final GameTimer timer;
TimerTimer(GameTimer timer, Duration duration, Plugin plugin)
{
super(duration.toMillis(), ChronoUnit.MILLIS, null, plugin);
this.timer = timer;
setPriority(InfoBoxPriority.MED);
}
public GameTimer getTimer()
{
return timer;
}
@Override
public String getName()
{
return timer.name();
}
}

View File

@@ -0,0 +1,266 @@
/*
* Copyright (c) 2017, Seth <Sethtroll3@gmail.com>
* 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.timers;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import java.time.Instant;
@ConfigGroup(TimersConfig.GROUP)
public interface TimersConfig extends Config
{
String GROUP = "timers";
@ConfigItem(
keyName = "showHomeMinigameTeleports",
name = "Teleport cooldown timers",
description = "Configures whether timers for home and minigame teleport cooldowns are displayed"
)
default boolean showHomeMinigameTeleports()
{
return true;
}
@ConfigItem(
keyName = "showAntipoison",
name = "Antipoison/Venom timers",
description = "Configures whether timers for poison and venom protection are displayed"
)
default boolean showAntiPoison()
{
return true;
}
@ConfigItem(
keyName = "showAntiFire",
name = "Antifire timer",
description = "Configures whether antifire timer is displayed"
)
default boolean showAntiFire()
{
return true;
}
@ConfigItem(
keyName = "showStamina",
name = "Stamina timer",
description = "Configures whether stamina timer is displayed"
)
default boolean showStamina()
{
return true;
}
@ConfigItem(
keyName = "showOverload",
name = "Overload timer",
description = "Configures whether overload timer is displayed"
)
default boolean showOverload()
{
return true;
}
@ConfigItem(
keyName = "showPrayerEnhance",
name = "Prayer enhance timer",
description = "Configures whether prayer enhance timer is displayed"
)
default boolean showPrayerEnhance()
{
return true;
}
@ConfigItem(
keyName = "showDivine",
name = "Divine potion timer",
description = "Configures whether divine potion timer is displayed"
)
default boolean showDivine()
{
return true;
}
@ConfigItem(
keyName = "showCannon",
name = "Cannon timer",
description = "Configures whether cannon timer is displayed"
)
default boolean showCannon()
{
return true;
}
@ConfigItem(
keyName = "showMagicImbue",
name = "Magic imbue timer",
description = "Configures whether magic imbue timer is displayed"
)
default boolean showMagicImbue()
{
return true;
}
@ConfigItem(
keyName = "showCharge",
name = "Charge timer",
description = "Configures whether to show a timer for the Charge spell"
)
default boolean showCharge()
{
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 and vengeance other timer is displayed"
)
default boolean showVengeance()
{
return true;
}
@ConfigItem(
keyName = "showVengeanceActive",
name = "Vengeance active",
description = "Configures whether an indicator for vengeance being active is displayed"
)
default boolean showVengeanceActive()
{
return true;
}
@ConfigItem(
keyName = "showTeleblock",
name = "Teleblock timer",
description = "Configures whether teleblock timer is displayed"
)
default boolean showTeleblock()
{
return true;
}
@ConfigItem(
keyName = "showFreezes",
name = "Freeze timer",
description = "Configures whether freeze timer is displayed"
)
default boolean showFreezes()
{
return true;
}
@ConfigItem(
keyName = "showGodWarsAltar",
name = "God wars altar timer",
description = "Configures whether god wars altar timer is displayed"
)
default boolean showGodWarsAltar()
{
return true;
}
@ConfigItem(
keyName = "showTzhaarTimers",
name = "Fight Caves and Inferno timers",
description = "Display elapsed time in the Fight Caves and Inferno"
)
default boolean showTzhaarTimers()
{
return true;
}
@ConfigItem(
keyName = "tzhaarStartTime",
name = "",
description = "",
hidden = true
)
Instant tzhaarStartTime();
@ConfigItem(
keyName = "tzhaarStartTime",
name = "",
description = ""
)
void tzhaarStartTime(Instant tzhaarStartTime);
@ConfigItem(
keyName = "tzhaarLastTime",
name = "",
description = "",
hidden = true
)
Instant tzhaarLastTime();
@ConfigItem(
keyName = "tzhaarLastTime",
name = "",
description = ""
)
void tzhaarLastTime(Instant tzhaarLastTime);
@ConfigItem(
keyName = "showStaffOfTheDead",
name = "Staff of the Dead timer",
description = "Configures whether staff of the dead timer is displayed"
)
default boolean showStaffOfTheDead()
{
return true;
}
@ConfigItem(
keyName = "showAbyssalSireStun",
name = "Abyssal Sire stun timer",
description = "Configures whether Abyssal Sire stun timer is displayed"
)
default boolean showAbyssalSireStun()
{
return true;
}
@ConfigItem(
keyName = "showDfsSpecial",
name = "Dragonfire Shield special timer",
description = "Configures whether the special attack cooldown timer for the Dragonfire Shield is displayed"
)
default boolean showDFSSpecial()
{
return true;
}
}

View File

@@ -38,7 +38,7 @@ import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.ActorDeath;
import net.runelite.api.events.AnimationChanged;
import net.runelite.api.events.HitsplatApplied;
import net.runelite.api.events.SpotAnimationChanged;
import net.runelite.api.events.GraphicChanged;
import net.runelite.api.events.InteractingChanged;
import net.runelite.api.events.OverheadTextChanged;
import java.awt.Graphics2D;
@@ -197,9 +197,9 @@ public abstract class RSActorMixin implements RSActor
@Inject
public void spotAnimationChanged(int idx)
{
SpotAnimationChanged spotAnimationChanged = new SpotAnimationChanged();
spotAnimationChanged.setActor(this);
client.getCallbacks().post(spotAnimationChanged);
GraphicChanged graphicChanged = new GraphicChanged();
graphicChanged.setActor(this);
client.getCallbacks().post(graphicChanged);
}
@FieldHook("targetIndex")

View File

@@ -639,20 +639,6 @@ public abstract class RSClientMixin implements RSClient
return varps[varpId];
}
@Inject
@Override
public int getVarpValue(int varpId)
{
return getVarpValue(getVarps(), varpId);
}
@Inject
@Override
public void setVarpValue(int[] varps, int varpId, int value)
{
varps[varpId] = value;
}
@Inject
@Override
public boolean isPrayerActive(Prayer prayer)
@@ -1975,5 +1961,11 @@ public abstract class RSClientMixin implements RSClient
{
return this.outdatedScripts;
}
@Override
public Widget getWidget(int i)
{
return getWidget(i, i);
}
}

View File

@@ -111,7 +111,7 @@ public abstract class RSNPCMixin implements RSNPC
}
else if (this.getId() != -1)
{
client.getCallbacks().post(new NpcChanged(this));
client.getCallbacks().post(new NpcChanged(this, composition));
}
}