Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.runelite.client.plugins.microbot.huey;
package net.runelite.client.plugins.microbot.HueycoatlPrayer;

import net.runelite.client.config.*;

Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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",
Expand All @@ -31,21 +35,24 @@
)
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;

private Rs2PrayerEnum currentPrayer = null;
private int lastSwitchTick = -1;

/** Huey projectiles still in flight toward the player (identity-based). */
private final Set<Projectile> incomingHueyProjectiles =
Collections.newSetFromMap(new IdentityHashMap<>());

@Provides
HueyPrayerConfig provideConfig(net.runelite.client.config.ConfigManager configManager)
{
Expand All @@ -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:
Expand Down