From 82d89be7b0fde897207a978b0c305eea542beeda Mon Sep 17 00:00:00 2001 From: Jonathan Thomas <95548936+JThomasDevs@users.noreply.github.com> Date: Sat, 18 Apr 2026 17:08:03 -0600 Subject: [PATCH] fix hueycoatl prayer, add config option to disable prayers after projectile impact --- .../HueycoatlPrayer/HueyPrayerConfig.java | 12 ++- .../HueycoatlPrayer/HueyPrayerOverlay.java | 2 +- .../HueycoatlPrayer/HueyPrayerPlugin.java | 77 ++++++++++++++++++- 3 files changed, 85 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/runelite/client/plugins/microbot/HueycoatlPrayer/HueyPrayerConfig.java b/src/main/java/net/runelite/client/plugins/microbot/HueycoatlPrayer/HueyPrayerConfig.java index d7fd97749a..ea38412d39 100644 --- a/src/main/java/net/runelite/client/plugins/microbot/HueycoatlPrayer/HueyPrayerConfig.java +++ b/src/main/java/net/runelite/client/plugins/microbot/HueycoatlPrayer/HueyPrayerConfig.java @@ -1,4 +1,4 @@ -package net.runelite.client.plugins.microbot.huey; +package net.runelite.client.plugins.microbot.HueycoatlPrayer; import net.runelite.client.config.*; @@ -15,6 +15,16 @@ default boolean enabled() return true; } + @ConfigItem( + keyName = "disableAfterImpact", + name = "Disable after impact", + description = "When enabled, turns off protection prayer after the projectile hits (saves prayer). When disabled, prayers stay on until the next attack switches them." + ) + default boolean disableAfterImpact() + { + return true; + } + @ConfigItem( keyName = "debug", name = "Debug Projectiles", diff --git a/src/main/java/net/runelite/client/plugins/microbot/HueycoatlPrayer/HueyPrayerOverlay.java b/src/main/java/net/runelite/client/plugins/microbot/HueycoatlPrayer/HueyPrayerOverlay.java index 4d52102761..8b56dab221 100644 --- a/src/main/java/net/runelite/client/plugins/microbot/HueycoatlPrayer/HueyPrayerOverlay.java +++ b/src/main/java/net/runelite/client/plugins/microbot/HueycoatlPrayer/HueyPrayerOverlay.java @@ -1,4 +1,4 @@ -package net.runelite.client.plugins.microbot.huey; +package net.runelite.client.plugins.microbot.HueycoatlPrayer; import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayPosition; diff --git a/src/main/java/net/runelite/client/plugins/microbot/HueycoatlPrayer/HueyPrayerPlugin.java b/src/main/java/net/runelite/client/plugins/microbot/HueycoatlPrayer/HueyPrayerPlugin.java index e2d626ef66..78a4ccfa89 100644 --- a/src/main/java/net/runelite/client/plugins/microbot/HueycoatlPrayer/HueyPrayerPlugin.java +++ b/src/main/java/net/runelite/client/plugins/microbot/HueycoatlPrayer/HueyPrayerPlugin.java @@ -1,4 +1,4 @@ -package net.runelite.client.plugins.microbot.huey; +package net.runelite.client.plugins.microbot.HueycoatlPrayer; import com.google.inject.Provides; import javax.inject.Inject; @@ -19,6 +19,10 @@ import net.runelite.client.plugins.microbot.Microbot; import net.runelite.client.plugins.microbot.PluginConstants; +import java.util.Collections; +import java.util.IdentityHashMap; +import java.util.Set; + @Slf4j @PluginDescriptor( name = PluginConstants.DEFAULT_PREFIX + "Huey Prayer", @@ -31,14 +35,13 @@ ) public class HueyPrayerPlugin extends Plugin { - static final String VERSION = "1.0.1"; + static final String VERSION = "1.0.4"; @Inject private Client client; @Inject private HueyPrayerConfig config; - // 🔴 YOU MUST FILL THESE USING DEBUG private static final int MAGIC_PROJECTILE_ID = 2975; private static final int RANGE_PROJECTILE_ID = 2972; private static final int MELEE_PROJECTILE_ID = 2969; @@ -46,6 +49,10 @@ public class HueyPrayerPlugin extends Plugin private Rs2PrayerEnum currentPrayer = null; private int lastSwitchTick = -1; + /** Huey projectiles still in flight toward the player (identity-based). */ + private final Set incomingHueyProjectiles = + Collections.newSetFromMap(new IdentityHashMap<>()); + @Provides HueyPrayerConfig provideConfig(net.runelite.client.config.ConfigManager configManager) { @@ -63,26 +70,88 @@ protected void shutDown() { Rs2Prayer.disableAllPrayers(); currentPrayer = null; + incomingHueyProjectiles.clear(); } @Subscribe public void onProjectileMoved(ProjectileMoved event) { - if (!config.enabled()) return; + if (!config.enabled()) + { + return; + } Projectile projectile = event.getProjectile(); + if (projectile == null) + { + return; + } // Only react to projectiles targeting YOU if (projectile.getInteracting() != client.getLocalPlayer()) + { return; + } int id = projectile.getId(); + boolean isHueyProjectile = false; + if (id == MAGIC_PROJECTILE_ID) + { + isHueyProjectile = true; + } + if (id == RANGE_PROJECTILE_ID) + { + isHueyProjectile = true; + } + if (id == MELEE_PROJECTILE_ID) + { + isHueyProjectile = true; + } + if (!isHueyProjectile) + { + return; + } + + if (!config.disableAfterImpact()) + { + if (!incomingHueyProjectiles.isEmpty()) + { + incomingHueyProjectiles.clear(); + } + } + + if (config.disableAfterImpact()) + { + if (incomingHueyProjectiles.contains(projectile)) + { + if (projectile.getRemainingCycles() <= 0) + { + incomingHueyProjectiles.remove(projectile); + if (incomingHueyProjectiles.isEmpty()) + { + Rs2Prayer.disableAllPrayers(); + currentPrayer = null; + } + } + return; + } + } + + if (projectile.getRemainingCycles() <= 0) + { + return; + } if (config.debug()) { Microbot.log("Projectile ID: " + id); } + if (config.disableAfterImpact()) + { + incomingHueyProjectiles.add(projectile); + } + switch (id) { case MAGIC_PROJECTILE_ID: