Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion runelite-plugin.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
displayName=AttackTimer
author=ngraves95,Lexer747
build=standard
version=1.2.2
version=1.2.3
description=A plugin to countdown until your next attack
tags=pvm,timer,attack,combat,weapon
plugins=com.attacktimer.AttackTimerMetronomePlugin
18 changes: 6 additions & 12 deletions src/main/java/com/attacktimer/AttackTimerMetronomePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
import net.runelite.api.events.SoundEffectPlayed;
import net.runelite.api.events.StatChanged;
import net.runelite.api.events.VarbitChanged;
import net.runelite.api.gameval.ItemID;
import net.runelite.api.gameval.SpotanimID;
import net.runelite.api.gameval.VarPlayerID;
import net.runelite.api.gameval.VarbitID;
import net.runelite.client.config.ConfigManager;
Expand Down Expand Up @@ -144,20 +146,13 @@ public enum AttackState
private static final int ATTACK_DELAY_NONE = 0;
public static final int DEFAULT_SIZE_UNIT_PX = 25;

public static final int SALAMANDER_SET_ANIM_ID = 952; // Used by all 4 types of salamander https://oldschool.runescape.wiki/w/Salamander

private static final int TWINFLAME_STAFF_WEAPON_ID = 30634;
private static final int ECHO_VENATOR_BOW_WEAPON_ID = 30434;
private static final int VENATOR_BOW_WEAPON_ID = 27610;
private static final int BLACK_GEM_KERIS_ID = 30891; // https://oldschool.runescape.wiki/w/Keris_partisan_of_amascut

// Add other weapons here if in the Runelite dev shell this prints a different value to it's actual speed:
//
// var itemManager = inject(ItemManager.class);
// log.info("Speed {}", itemManager.getItemStats(<id_to_test>).getEquipment().getAspeed());
private static final Map<Integer, Integer> NON_STANDARD_ATTACK_SPEEDS =
new ImmutableMap.Builder<Integer, Integer>()
.put(BLACK_GEM_KERIS_ID, 4)
.put(ItemID.KERIS_PARTISAN_AMASCUT, 4) // https://oldschool.runescape.wiki/w/Keris_partisan_of_amascut
.build();

// These animations are the ones which exceed the duration of their attack cooldown
Expand All @@ -172,14 +167,14 @@ public enum AttackState

private static final Map<Integer, Integer> NON_STANDARD_MAGIC_WEAPON_SPEEDS =
new ImmutableMap.Builder<Integer, Integer>()
.put(TWINFLAME_STAFF_WEAPON_ID, 6)
.put(ItemID.TWINFLAME_STAFF, 6)
.build();

// Map of problematic itemIds to equivalent working ones.
// The Echo Venator Bow's ItemStats are returning null, so use the regular bow instead.
private static final Map<Integer, Integer> WEAPON_ID_MAPPING_WORKAROUNDS =
new ImmutableMap.Builder<Integer, Integer>()
.put(ECHO_VENATOR_BOW_WEAPON_ID, VENATOR_BOW_WEAPON_ID)
.put(ItemID.VENATOR_BOW_ORNAMENT, ItemID.VENATOR_BOW)
.build();


Expand All @@ -188,7 +183,6 @@ public enum AttackState
private final int DEFAULT_FOOD_ATTACK_DELAY_TICKS = 3;
private final int FAST_EAT_ATTACK_DELAY_TICKS = 2;

public static final int EQUIPPING_MONOTONIC = 384; // From empirical testing this clientint seems to always increase whenever the player equips an item
public static final Dimension DEFAULT_SIZE = new Dimension(DEFAULT_SIZE_UNIT_PX, DEFAULT_SIZE_UNIT_PX);


Expand Down Expand Up @@ -309,7 +303,7 @@ private ItemStats getWeaponStats(int weaponId)

private boolean getSalamanderAttack()
{
return client.getLocalPlayer().hasSpotAnim(SALAMANDER_SET_ANIM_ID);
return client.getLocalPlayer().hasSpotAnim(SpotanimID.FIREBREATH);
}

private void setAttackDelay()
Expand Down
39 changes: 20 additions & 19 deletions src/main/java/com/attacktimer/PoweredStaves.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.attacktimer;

/*
* Copyright (c) 2024, Lexer747 <https://github.com/Lexer747>
* Copyright (c) 2024-2026, Lexer747 <https://github.com/Lexer747>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -32,6 +32,7 @@
import java.util.Set;
import java.util.stream.Collectors;
import lombok.Getter;
import net.runelite.api.gameval.ItemID;
import org.apache.commons.lang3.StringUtils;

// https://oldschool.runescape.wiki/w/Powered_staff
Expand All @@ -42,11 +43,11 @@
// 5. This Enum is only to contain the staves which allow magic at 4 ticks.
public enum PoweredStaves
{
WEAPON_ACCURSED( Set.of(AnimationData.MAGIC_STANDARD_WAVE_STAFF, AnimationData.MAGIC_ACCURSED_SCEPTRE_SPEC), Projectiles(2337, 2339), 27665, 27666), // https://oldschool.runescape.wiki/w/Accursed_sceptre
WEAPON_BLUE_C_STAFF_A(AnimationData.MAGIC_STANDARD_WAVE_STAFF, Projectiles(1720), 23899), // https://oldschool.runescape.wiki/w/Crystal_staff_(attuned)
WEAPON_BLUE_C_STAFF_B(AnimationData.MAGIC_STANDARD_WAVE_STAFF, Projectiles(1720), 23898), // https://oldschool.runescape.wiki/w/Crystal_staff_(basic)
WEAPON_BLUE_C_STAFF_P(AnimationData.MAGIC_STANDARD_WAVE_STAFF, Projectiles(1720),23900), // https://oldschool.runescape.wiki/w/Crystal_staff_(perfected)
WEAPON_BONE_STAFF(AnimationData.MELEE_GENERIC_SLASH, Projectiles(2647), 28796, 28797), //https://oldschool.runescape.wiki/w/Bone_staff
WEAPON_ACCURSED(Set.of(AnimationData.MAGIC_STANDARD_WAVE_STAFF, AnimationData.MAGIC_ACCURSED_SCEPTRE_SPEC), Projectiles(2337, 2339), ItemID.WILD_CAVE_ACCURSED_CHARGED, 27666), // https://oldschool.runescape.wiki/w/Accursed_sceptre
WEAPON_BLUE_C_STAFF_A(AnimationData.MAGIC_STANDARD_WAVE_STAFF, Projectiles(1720), ItemID.GAUNTLET_MAGIC_T2), // https://oldschool.runescape.wiki/w/Crystal_staff_(attuned)
WEAPON_BLUE_C_STAFF_B(AnimationData.MAGIC_STANDARD_WAVE_STAFF, Projectiles(1720), ItemID.GAUNTLET_MAGIC_T1), // https://oldschool.runescape.wiki/w/Crystal_staff_(basic)
WEAPON_BLUE_C_STAFF_P(AnimationData.MAGIC_STANDARD_WAVE_STAFF, Projectiles(1720), ItemID.GAUNTLET_MAGIC_T3), // https://oldschool.runescape.wiki/w/Crystal_staff_(perfected)
WEAPON_BONE_STAFF(AnimationData.MELEE_GENERIC_SLASH, Projectiles(2647), ItemID.RAT_BONE_STAFF, 28797), //https://oldschool.runescape.wiki/w/Bone_staff
WEAPON_DAWNBRINGER(AnimationData.MAGIC_STANDARD_WAVE_STAFF, Projectiles(1544, 1547),22516), // https://oldschool.runescape.wiki/w/Dawnbringer
WEAPON_HARM(Set.of(
AnimationData.MAGIC_STANDARD_STRIKE_STAFF,
Expand All @@ -60,19 +61,19 @@ public enum PoweredStaves
133, 136, 139, 130, /* blasts */
159, 162, 165, 156, /* waves */
1456, 1459, 1462, 1465 /* surges */),
24423), // https://oldschool.runescape.wiki/w/Harmonised_nightmare_staff
WEAPON_RED_C_STAFF_A(AnimationData.MAGIC_STANDARD_WAVE_STAFF, Projectiles(1723), 23853), // https://oldschool.runescape.wiki/w/Corrupted_staff_(attuned)
WEAPON_RED_C_STAFF_B(AnimationData.MAGIC_STANDARD_WAVE_STAFF, Projectiles(1723), 23852), // https://oldschool.runescape.wiki/w/Corrupted_staff_(basic)
WEAPON_RED_C_STAFF_P(AnimationData.MAGIC_STANDARD_WAVE_STAFF, Projectiles(1723), 23854), // https://oldschool.runescape.wiki/w/Corrupted_staff_(perfected)
WEAPON_SANG(AnimationData.MAGIC_STANDARD_WAVE_STAFF, Projectiles(1539), 22323), // https://oldschool.runescape.wiki/w/Sanguinesti_staff#Charged
WEAPON_SANG_KIT(AnimationData.MAGIC_STANDARD_WAVE_STAFF, 25731), // https://oldschool.runescape.wiki/w/Holy_sanguinesti_staff#Charged
WEAPON_STARTER_STAFF(22335, 22336, 28557, 28558), // https://oldschool.runescape.wiki/w/Starter_staff TODO get the animation when DMM goes live
WEAPON_SWAMP(AnimationData.MAGIC_STANDARD_WAVE_STAFF, Projectiles(1040),12899), // https://oldschool.runescape.wiki/w/Trident_of_the_swamp#Charged
WEAPON_SWAMP_E(AnimationData.MAGIC_STANDARD_WAVE_STAFF, Projectiles(1252),22292), // https://oldschool.runescape.wiki/w/Trident_of_the_swamp_(e)#Charged
WEAPON_THAMMARON(AnimationData.MAGIC_STANDARD_WAVE_STAFF, Projectiles(2340),22555, 22556), //https://oldschool.runescape.wiki/w/Thammaron%27s_sceptre
WEAPON_TRIDENT(AnimationData.MAGIC_STANDARD_WAVE_STAFF, Projectiles(1252), 11907), // https://oldschool.runescape.wiki/w/Trident_of_the_seas#Partially_charged
WEAPON_TRIDENT_E(AnimationData.MAGIC_STANDARD_WAVE_STAFF, Projectiles(1252),22288), // https://oldschool.runescape.wiki/w/Trident_of_the_seas_(e)#Charged
WEAPON_WARPED_SCEPTRE(AnimationData.MAGIC_WARPED_SCEPTRE, 28585, 28586); // https://oldschool.runescape.wiki/w/Warped_sceptre
ItemID.NIGHTMARE_STAFF_HARMONISED), // https://oldschool.runescape.wiki/w/Harmonised_nightmare_staff
WEAPON_RED_C_STAFF_A(AnimationData.MAGIC_STANDARD_WAVE_STAFF, Projectiles(1723), ItemID.GAUNTLET_MAGIC_T2_HM), // https://oldschool.runescape.wiki/w/Corrupted_staff_(attuned)
WEAPON_RED_C_STAFF_B(AnimationData.MAGIC_STANDARD_WAVE_STAFF, Projectiles(1723), ItemID.GAUNTLET_MAGIC_T1_HM), // https://oldschool.runescape.wiki/w/Corrupted_staff_(basic)
WEAPON_RED_C_STAFF_P(AnimationData.MAGIC_STANDARD_WAVE_STAFF, Projectiles(1723), ItemID.GAUNTLET_MAGIC_T3_HM), // https://oldschool.runescape.wiki/w/Corrupted_staff_(perfected)
WEAPON_SANG(AnimationData.MAGIC_STANDARD_WAVE_STAFF, Projectiles(1539), ItemID.SANGUINESTI_STAFF), // https://oldschool.runescape.wiki/w/Sanguinesti_staff#Charged
WEAPON_SANG_KIT(AnimationData.MAGIC_STANDARD_WAVE_STAFF, ItemID.SANGUINESTI_STAFF_OR), // https://oldschool.runescape.wiki/w/Holy_sanguinesti_staff#Charged
WEAPON_STARTER_STAFF(ItemID.DEADMAN_STARTER_STAFF, 22336, ItemID.DEADMAN_APOCALYPSE_STAFF, 28558), // https://oldschool.runescape.wiki/w/Starter_staff TODO get the animation when DMM goes live
WEAPON_SWAMP(AnimationData.MAGIC_STANDARD_WAVE_STAFF, Projectiles(1040), ItemID.TOXIC_TOTS_CHARGED), // https://oldschool.runescape.wiki/w/Trident_of_the_swamp#Charged
WEAPON_SWAMP_E(AnimationData.MAGIC_STANDARD_WAVE_STAFF, Projectiles(1252), ItemID.TOXIC_TOTS_I_CHARGED), // https://oldschool.runescape.wiki/w/Trident_of_the_swamp_(e)#Charged
WEAPON_THAMMARON(AnimationData.MAGIC_STANDARD_WAVE_STAFF, Projectiles(2340), ItemID.WILD_CAVE_SCEPTRE_CHARGED, 22556), //https://oldschool.runescape.wiki/w/Thammaron%27s_sceptre
WEAPON_TRIDENT(AnimationData.MAGIC_STANDARD_WAVE_STAFF, Projectiles(1252), ItemID.TOTS_CHARGED, ItemID.TOTS), // https://oldschool.runescape.wiki/w/Trident_of_the_seas#Partially_charged
WEAPON_TRIDENT_E(AnimationData.MAGIC_STANDARD_WAVE_STAFF, Projectiles(1252), ItemID.TOTS_I_CHARGED), // https://oldschool.runescape.wiki/w/Trident_of_the_seas_(e)#Charged
WEAPON_WARPED_SCEPTRE(AnimationData.MAGIC_WARPED_SCEPTRE, ItemID.WARPED_SCEPTRE, 28586); // https://oldschool.runescape.wiki/w/Warped_sceptre

@Getter
private final Set<Integer> ids;
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/com/attacktimer/VariableSpeed/BloodMoonSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@
import com.attacktimer.AnimationData;
import com.attacktimer.AttackProcedure;
import net.runelite.api.Client;
import net.runelite.api.gameval.SpotanimID;

public class BloodMoonSet implements IVariableSpeed
{
private static final int BLOOD_MOON_SET_ANIM_ID = 2792;

public int apply(final Client client, final AnimationData curAnimation, final AttackProcedure atkType,
final int damageDealt, final int lastSpecDelta, final int baseSpeed, final int curSpeed)
{
if (client.getLocalPlayer().hasSpotAnim(BLOOD_MOON_SET_ANIM_ID))
if (client.getLocalPlayer().hasSpotAnim(SpotanimID.SPECIAL_DUAL_MACUAHUITL_SPOTANIM))
{
return curSpeed - 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@

public class PurgingStaffSpec implements IVariableSpeed
{
private static final int PURGING_STAFF_ID = ItemID.PURGING_STAFF;

private Yama yama;
public NPC lastTarget;

Expand Down Expand Up @@ -72,7 +70,7 @@ public int apply(final Client client, final AnimationData curAnimation, final At
// not using the spec
return curSpeed;
}
if (Utils.getWeaponId(client) != PURGING_STAFF_ID)
if (Utils.getWeaponId(client) != ItemID.PURGING_STAFF)
{
// not using a purging staff
return curSpeed;
Expand Down
8 changes: 3 additions & 5 deletions src/main/java/com/attacktimer/VariableSpeed/Scurrius.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.attacktimer.VariableSpeed;

/*
* Copyright (c) 2024, Lexer747 <https://github.com/Lexer747>
* Copyright (c) 2024-2026, Lexer747 <https://github.com/Lexer747>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -30,6 +30,7 @@
import com.attacktimer.ClientUtils.Utils;
import net.runelite.api.Client;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.gameval.ItemID;

/**
* Scurrius: https://oldschool.runescape.wiki/w/Scurrius/Strategies#Strategies
Expand All @@ -39,9 +40,6 @@
*/
public class Scurrius implements IVariableSpeed
{
private static final int BONE_STAFF_ID = 28796;
private static final int BONE_MACE_ID = 28792;
private static final int BONE_BOW_ID = 28794;
private static final int GIANT_RAT = 7223;

private static final int SCURRIUS_REGION_ID = 13210;
Expand All @@ -54,7 +52,7 @@ public class Scurrius implements IVariableSpeed

private static boolean attackingGiantRatWithBoneWeapon(final int equipped, final int regionId, final int x, final int y, final int target)
{
final boolean correctWeapon = equipped == BONE_STAFF_ID || equipped == BONE_MACE_ID || equipped == BONE_BOW_ID;
final boolean correctWeapon = equipped == ItemID.RAT_BONE_STAFF || equipped == ItemID.RAT_BONE_MACE || equipped == ItemID.RAT_BONE_BOW;
final boolean correctCoords = x >= SCURRIUS_MIN_X && x <= SCURRIUS_MAX_X && y >= SCURRIUS_MIN_Y && y <= SCURRIUS_MAX_Y;
final boolean correctRegion = regionId == SCURRIUS_REGION_ID;
final boolean correctEnemy = target == GIANT_RAT;
Expand Down
11 changes: 4 additions & 7 deletions src/main/java/com/attacktimer/VariableSpeed/TormentedDemons.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
import net.runelite.api.Client;
import net.runelite.api.NPC;
import net.runelite.api.events.GameTick;
import net.runelite.api.gameval.NpcID;
import net.runelite.api.gameval.SpotanimID;

/**
* TormentedDemons is the variable speed implementation for the "punish" attack a player can do against a
Expand Down Expand Up @@ -122,14 +124,9 @@ public int apply(final Client client, final AnimationData curAnimation, final At
}
}

private static final int TORMENTED_DEMON_VULN_SPOT_ANIM = 2852;
private static final int TORMENTED_DEMON_ID = 13600;

private static final int TORMENTED_DEMON_2_ID = 13599;

private static boolean isTormentedDemon(int targetId)
{
return targetId == TORMENTED_DEMON_ID || targetId == TORMENTED_DEMON_2_ID;
return targetId == NpcID.TORMENTED_DEMON_1 || targetId == NpcID.TORMENTED_DEMON_2;
}

private Map<NPC, DemonData> tormentedDemons = new HashMap<NPC, DemonData>();
Expand All @@ -142,7 +139,7 @@ public void onGameTick(Client client, GameTick tick)
{
continue;
}
boolean isVulnerable = npc.hasSpotAnim(TORMENTED_DEMON_VULN_SPOT_ANIM);
boolean isVulnerable = npc.hasSpotAnim(SpotanimID.LUC2_UNDEAD_DEMON_EXPLOSION_FIRE_SPOT);
if (tormentedDemons.containsKey(npc))
{
DemonData d = tormentedDemons.get(npc);
Expand Down
Loading