idle notifier: add spec regen notifier
Co-authored-by: Justin Kufro <kufroj@gmail.com>
This commit is contained in:
@@ -107,4 +107,15 @@ public interface IdleNotifierConfig extends Config
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "spec",
|
||||
name = "Special Attack Energy Notification Threshold",
|
||||
position = 8,
|
||||
description = "The amount of spec energy reached to send a notification at. A value of 0 will disable notification."
|
||||
)
|
||||
default int getSpecEnergyThreshold()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ import net.runelite.api.NPC;
|
||||
import net.runelite.api.NPCComposition;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.api.VarPlayer;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.events.AnimationChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
@@ -89,6 +90,7 @@ public class IdleNotifierPlugin extends Plugin
|
||||
private boolean notifyOxygen = true;
|
||||
private boolean notifyIdleLogout = true;
|
||||
private boolean notify6HourLogout = true;
|
||||
private int lastSpecEnergy = 1000;
|
||||
private int lastCombatCountdown = 0;
|
||||
private Instant sixHourWarningTime;
|
||||
private boolean ready;
|
||||
@@ -382,6 +384,30 @@ public class IdleNotifierPlugin extends Plugin
|
||||
{
|
||||
notifier.notify("[" + local.getName() + "] has low oxygen!");
|
||||
}
|
||||
|
||||
if (checkFullSpecEnergy())
|
||||
{
|
||||
notifier.notify("[" + local.getName() + "] has restored spec energy!");;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkFullSpecEnergy()
|
||||
{
|
||||
int currentSpecEnergy = client.getVar(VarPlayer.SPECIAL_ATTACK_PERCENT);
|
||||
|
||||
int threshold = config.getSpecEnergyThreshold() * 10;
|
||||
if (threshold == 0)
|
||||
{
|
||||
lastSpecEnergy = currentSpecEnergy;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if we have regenerated over the threshold, and that the
|
||||
// regen was small enough.
|
||||
boolean notify = lastSpecEnergy < threshold && currentSpecEnergy >= threshold
|
||||
&& currentSpecEnergy - lastSpecEnergy <= 100;
|
||||
lastSpecEnergy = currentSpecEnergy;
|
||||
return notify;
|
||||
}
|
||||
|
||||
private boolean checkLowOxygen()
|
||||
|
||||
Reference in New Issue
Block a user