Skip to content

Commit

Permalink
prayer: add deadeye and mystic vigour
Browse files Browse the repository at this point in the history
Co-authored-by: Macweese <[email protected]>
  • Loading branch information
Adam- and Macweese committed Feb 9, 2025
1 parent 890419a commit 836c150
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 7 deletions.
2 changes: 2 additions & 0 deletions runelite-api/src/main/java/net/runelite/api/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,9 @@ public interface Client extends OAuthApi, GameEngine
*
* @param prayer the prayer
* @return true if the prayer is active, false otherwise
* @deprecated this method does not properly handle deadeye/eagle eye or mystic vigour/might
*/
@Deprecated
boolean isPrayerActive(Prayer prayer);

/**
Expand Down
8 changes: 8 additions & 0 deletions runelite-api/src/main/java/net/runelite/api/Prayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ public enum Prayer
* Chivalry (Level 60, Defence/Strength/Attack).
*/
CHIVALRY(Varbits.PRAYER_CHIVALRY),
/**
* Deadeye (Level 62, Ranging/Damage/Defence).
*/
DEADEYE(Varbits.PRAYER_DEADEYE),
/**
* Mystic Vigour (Level 63, Magic/Magic Def./Defence).
*/
MYSTIC_VIGOUR(Varbits.PRAYER_MYSTIC_VIGOUR),
/**
* Piety (Level 70, Defence/Strength/Attack).
*/
Expand Down
6 changes: 4 additions & 2 deletions runelite-api/src/main/java/net/runelite/api/SpriteID.java
Original file line number Diff line number Diff line change
Expand Up @@ -1341,10 +1341,12 @@ public final class SpriteID
/* Unmapped: 1419 */
public static final int PRAYER_RIGOUR = 1420;
public static final int PRAYER_AUGURY = 1421;
/* Unmapped: 1422, 1423 */
public static final int PRAYER_DEADEYE = 1422;
public static final int PRAYER_MYSTIC_VIGOUR = 1423;
public static final int PRAYER_RIGOUR_DISABLED = 1424;
public static final int PRAYER_AUGURY_DISABLED = 1425;
/* Unmapped: 1426, 1427 */
public static final int PRAYER_DEADEYE_DISABLED = 1426;
public static final int PRAYER_MYSTIC_VIGOUR_DISABLED = 1427;
public static final int UNKNOWN_BLACK_ANTICLOCKWISE_ARROW_SHADOWED = 1428;
public static final int UNKNOWN_BLACK_ANTICLOCKWISE_ARROW = 1429;
public static final int YELLOW_CLICK_ANIMATION_1_1430 = 1430;
Expand Down
4 changes: 4 additions & 0 deletions runelite-api/src/main/java/net/runelite/api/Varbits.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ public final class Varbits
public static final int PRAYER_PRESERVE = 5466;
public static final int PRAYER_RIGOUR = 5464;
public static final int PRAYER_AUGURY = 5465;
public static final int PRAYER_DEADEYE = 16090;
public static final int PRAYER_MYSTIC_VIGOUR = 16091;

/**
* Ruinous Powers
Expand Down Expand Up @@ -994,4 +996,6 @@ public final class Varbits
* @see <a href="https://oldschool.runescape.wiki/w/Gravestone_(Jarvis)">Gravestone (Jarvis) - OSRS Wiki</a>
*/
public static final int JARVIS_GRAVESTONE = 6008;

public static final int IN_LMS = 5314;
}
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,9 @@ public void onGameTick(GameTick tick)

for (PrayerType prayerType : PrayerType.values())
{
Prayer prayer = prayerType.getPrayer();
int ord = prayerType.ordinal();

if (client.isPrayerActive(prayer))
if (prayerType.isActive(client))
{
if (prayerType.isOverhead() && !config.prayerIndicatorOverheads())
{
Expand Down Expand Up @@ -360,7 +359,7 @@ private static int getDrainEffect(Client client)

for (PrayerType prayerType : PrayerType.values())
{
if (client.isPrayerActive(prayerType.getPrayer()))
if (prayerType.isActive(client))
{
drainEffect += prayerType.getDrainEffect();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@

import lombok.AllArgsConstructor;
import lombok.Getter;
import net.runelite.api.Client;
import net.runelite.api.Prayer;
import net.runelite.api.SpriteID;
import net.runelite.api.Varbits;

@AllArgsConstructor
@Getter
Expand All @@ -52,13 +54,47 @@ enum PrayerType
PROTECT_FROM_MAGIC("protect from magic", Prayer.PROTECT_FROM_MAGIC, "Protects against magic attacks", SpriteID.PRAYER_PROTECT_FROM_MAGIC, true, 12),
PROTECT_FROM_MISSILES("Protect from missiles", Prayer.PROTECT_FROM_MISSILES, "Protects against ranged attacks", SpriteID.PRAYER_PROTECT_FROM_MISSILES, true, 12),
PROTECT_FROM_MELEE("Protect from melee", Prayer.PROTECT_FROM_MELEE, "Protects against melee attacks", SpriteID.PRAYER_PROTECT_FROM_MELEE, true, 12),
EAGLE_EYE("Eagle Eye", Prayer.EAGLE_EYE, "+15% Ranged", SpriteID.PRAYER_EAGLE_EYE, false, 12),
MYSTIC_MIGHT("Mystic Might", Prayer.MYSTIC_MIGHT, "+15% Magical attack and defence", SpriteID.PRAYER_MYSTIC_MIGHT, false, 12),
EAGLE_EYE("Eagle Eye", Prayer.EAGLE_EYE, "+15% Ranged", SpriteID.PRAYER_EAGLE_EYE, false, 12)
{
@Override
boolean isEnabled(Client client)
{
return !DEADEYE.isEnabled(client);
}
},
MYSTIC_MIGHT("Mystic Might", Prayer.MYSTIC_MIGHT, "+15% Magical attack and defence", SpriteID.PRAYER_MYSTIC_MIGHT, false, 12)
{
@Override
boolean isEnabled(Client client)
{
return !MYSTIC_VIGOUR.isEnabled(client);
}
},
RETRIBUTION("Retribution", Prayer.RETRIBUTION, "Deals damage up to 25% of your Prayer level to nearby targets upon the user's death", SpriteID.PRAYER_RETRIBUTION, true, 3),
REDEMPTION("Redemption", Prayer.REDEMPTION, "Heals the player if they fall below 10% health", SpriteID.PRAYER_REDEMPTION, true, 6),
SMITE("Smite", Prayer.SMITE, "Removes 1 Prayer point from an enemy for every 4 damage inflicted on the enemy", SpriteID.PRAYER_SMITE, true, 18),
PRESERVE("Preserve", Prayer.PRESERVE, "Boosted stats last 50% longer", SpriteID.PRAYER_PRESERVE, false, 2),
CHIVALRY("Chivalry", Prayer.CHIVALRY, "+15% Attack, +18% Strength, +20% Defence", SpriteID.PRAYER_CHIVALRY, false, 24),
DEADEYE("Deadeye", Prayer.DEADEYE, "+18% Ranged attack, +18% Ranged strength, +5% Defence", SpriteID.PRAYER_DEADEYE, false, 12)
{
@Override
boolean isEnabled(Client client)
{
boolean inLms = client.getVarbitValue(Varbits.IN_LMS) != 0;
boolean deadeye = client.getVarbitValue(Varbits.PRAYER_DEADEYE_UNLOCKED) != 0;
return deadeye && !inLms;
}
},
MYSTIC_VIGOUR("Mystic Vigour", Prayer.MYSTIC_VIGOUR, "+18% Magical attack and defence, +3% Magic damage, +5% Defence", SpriteID.PRAYER_MYSTIC_VIGOUR, false, 12)
{
@Override
boolean isEnabled(Client client)
{
boolean inLms = client.getVarbitValue(Varbits.IN_LMS) != 0;
boolean vigour = client.getVarbitValue(Varbits.PRAYER_MYSTIC_VIGOUR_UNLOCKED) != 0;
return vigour && !inLms;
}
},
PIETY("Piety", Prayer.PIETY, "+20% Attack, +23% Strength, +25% Defence", SpriteID.PRAYER_PIETY, false, 24),
RIGOUR("Rigour", Prayer.RIGOUR, "+20% Ranged attack, +23% Ranged strength, +25% Defence", SpriteID.PRAYER_RIGOUR, false, 24),
AUGURY("Augury", Prayer.AUGURY, "+25% Magical attack and defence, +25% Defence", SpriteID.PRAYER_AUGURY, false, 24),
Expand Down Expand Up @@ -95,4 +131,14 @@ enum PrayerType
private final int spriteID;
private final boolean overhead;
private final int drainEffect;

boolean isEnabled(Client client)
{
return true;
}

boolean isActive(Client client)
{
return client.isPrayerActive(prayer) && isEnabled(client);
}
}

0 comments on commit 836c150

Please sign in to comment.