Merge pull request #3685 from Rman887/boost-notification
Add notification when skill boosts get low
This commit is contained in:
@@ -78,4 +78,15 @@ public interface BoostsConfig extends Config
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "boostThreshold",
|
||||||
|
name = "Boost Amount Threshold",
|
||||||
|
description = "The amount of levels boosted to send a notification at. A value of 0 will disable notification.",
|
||||||
|
position = 5
|
||||||
|
)
|
||||||
|
default int boostThreshold()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import net.runelite.api.Client;
|
|||||||
import net.runelite.api.Skill;
|
import net.runelite.api.Skill;
|
||||||
import net.runelite.api.events.BoostedLevelChanged;
|
import net.runelite.api.events.BoostedLevelChanged;
|
||||||
import net.runelite.api.events.ConfigChanged;
|
import net.runelite.api.events.ConfigChanged;
|
||||||
|
import net.runelite.client.Notifier;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.game.SkillIconManager;
|
import net.runelite.client.game.SkillIconManager;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
@@ -68,6 +69,9 @@ public class BoostsPlugin extends Plugin
|
|||||||
@Getter
|
@Getter
|
||||||
private Instant lastChange;
|
private Instant lastChange;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Notifier notifier;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private Client client;
|
private Client client;
|
||||||
|
|
||||||
@@ -155,7 +159,7 @@ public class BoostsPlugin extends Plugin
|
|||||||
int last = lastSkillLevels[skillIdx];
|
int last = lastSkillLevels[skillIdx];
|
||||||
int cur = client.getBoostedSkillLevel(skill);
|
int cur = client.getBoostedSkillLevel(skill);
|
||||||
|
|
||||||
// Check if stat goes +1 or -2
|
// Check if stat goes +1 or -1
|
||||||
if (cur == last + 1 || cur == last - 1)
|
if (cur == last + 1 || cur == last - 1)
|
||||||
{
|
{
|
||||||
log.debug("Skill {} healed", skill);
|
log.debug("Skill {} healed", skill);
|
||||||
@@ -163,6 +167,18 @@ public class BoostsPlugin extends Plugin
|
|||||||
addStatChangeIndicator();
|
addStatChangeIndicator();
|
||||||
}
|
}
|
||||||
lastSkillLevels[skillIdx] = cur;
|
lastSkillLevels[skillIdx] = cur;
|
||||||
|
|
||||||
|
int boostThreshold = config.boostThreshold();
|
||||||
|
if (boostThreshold != 0)
|
||||||
|
{
|
||||||
|
int real = client.getRealSkillLevel(skill);
|
||||||
|
int lastBoost = last - real;
|
||||||
|
int boost = cur - real;
|
||||||
|
if (boost <= boostThreshold && boostThreshold < lastBoost)
|
||||||
|
{
|
||||||
|
notifier.notify(skill.getName() + " level is getting low!");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateShownSkills(boolean showSkillingSkills)
|
private void updateShownSkills(boolean showSkillingSkills)
|
||||||
|
|||||||
Reference in New Issue
Block a user