Changed notification booleans, disabled by default and trigger logic
This commit is contained in:
@@ -16,7 +16,7 @@ public interface EasyGiantsFoundryConfig extends Config {
|
|||||||
)
|
)
|
||||||
default boolean showGiantsFoundryStageNotifications()
|
default boolean showGiantsFoundryStageNotifications()
|
||||||
{
|
{
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
@@ -27,7 +27,7 @@ public interface EasyGiantsFoundryConfig extends Config {
|
|||||||
)
|
)
|
||||||
default boolean showGiantsFoundryHeatNotifications()
|
default boolean showGiantsFoundryHeatNotifications()
|
||||||
{
|
{
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import net.runelite.api.GameObject;
|
import net.runelite.api.GameObject;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
import net.runelite.api.InventoryID;
|
import net.runelite.api.InventoryID;
|
||||||
|
import net.runelite.api.Skill;
|
||||||
import net.runelite.api.events.*;
|
import net.runelite.api.events.*;
|
||||||
import net.runelite.client.Notifier;
|
import net.runelite.client.Notifier;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
@@ -40,9 +41,7 @@ public class EasyGiantsFoundryPlugin extends Plugin
|
|||||||
|
|
||||||
private Stage oldStage;
|
private Stage oldStage;
|
||||||
|
|
||||||
private boolean enableStageNotifications;
|
private int lastBoost;
|
||||||
|
|
||||||
private boolean enableHeatNotifications;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private EasyGiantsFoundryState state;
|
private EasyGiantsFoundryState state;
|
||||||
@@ -73,8 +72,6 @@ public class EasyGiantsFoundryPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
overlayManager.add(overlay2d);
|
overlayManager.add(overlay2d);
|
||||||
overlayManager.add(overlay3d);
|
overlayManager.add(overlay3d);
|
||||||
enableStageNotifications = config.showGiantsFoundryStageNotifications();
|
|
||||||
enableHeatNotifications = config.showGiantsFoundryHeatNotifications();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -127,17 +124,27 @@ public class EasyGiantsFoundryPlugin extends Plugin
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onStatChanged(StatChanged statChanged)
|
public void onStatChanged(StatChanged statChanged)
|
||||||
{
|
{
|
||||||
if (state.isEnabled() && state.getCurrentStage() != null)
|
final int currBoost = statChanged.getBoostedLevel();
|
||||||
|
// if the difference between current and last boost is != 0 then a stat boost (or drop) change occurred
|
||||||
|
if (!statChanged.getSkill().equals(Skill.SMITHING) ||
|
||||||
|
currBoost - lastBoost != 0 ||
|
||||||
|
!state.isEnabled() ||
|
||||||
|
state.getCurrentStage() == null)
|
||||||
{
|
{
|
||||||
if (enableStageNotifications && helper.getActionsLeftInStage() == 1 && (oldStage == null || oldStage != state.getCurrentStage()))
|
lastBoost = currBoost;
|
||||||
{
|
return;
|
||||||
notifier.notify("About to finish the current stage!");
|
}
|
||||||
oldStage = state.getCurrentStage();
|
|
||||||
}
|
if (config.showGiantsFoundryStageNotifications() &&
|
||||||
else if (enableHeatNotifications && helper.getActionsForHeatLevel() == 1)
|
helper.getActionsLeftInStage() == 1 &&
|
||||||
{
|
(oldStage == null || oldStage != state.getCurrentStage()))
|
||||||
notifier.notify("About to run out of heat!");
|
{
|
||||||
}
|
notifier.notify("About to finish the current stage!");
|
||||||
|
oldStage = state.getCurrentStage();
|
||||||
|
}
|
||||||
|
else if (config.showGiantsFoundryHeatNotifications() && helper.getActionsForHeatLevel() == 1)
|
||||||
|
{
|
||||||
|
notifier.notify("About to run out of heat!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,24 +220,6 @@ public class EasyGiantsFoundryPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
|
||||||
public void onConfigChanged(ConfigChanged event)
|
|
||||||
{
|
|
||||||
if (!event.getGroup().equals(EasyGiantsFoundryConfig.GROUP))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.showGiantsFoundryStageNotifications() != enableStageNotifications)
|
|
||||||
{
|
|
||||||
enableStageNotifications = config.showGiantsFoundryStageNotifications();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.showGiantsFoundryHeatNotifications() != enableHeatNotifications)
|
|
||||||
{
|
|
||||||
enableHeatNotifications = config.showGiantsFoundryHeatNotifications();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
EasyGiantsFoundryConfig provideConfig(ConfigManager configManager)
|
EasyGiantsFoundryConfig provideConfig(ConfigManager configManager)
|
||||||
|
|||||||
Reference in New Issue
Block a user