Added sound config settings to idle plugin
Added Over Special Energy Notification
This commit is contained in:
@@ -317,6 +317,7 @@
|
|||||||
<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
|
<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
|
||||||
<nonFilteredFileExtension>png</nonFilteredFileExtension>
|
<nonFilteredFileExtension>png</nonFilteredFileExtension>
|
||||||
<nonFilteredFileExtension>gif</nonFilteredFileExtension>
|
<nonFilteredFileExtension>gif</nonFilteredFileExtension>
|
||||||
|
<nonFilteredFileExtension>wav</nonFilteredFileExtension>
|
||||||
</nonFilteredFileExtensions>
|
</nonFilteredFileExtensions>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public class SoundManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void playSound(final Sound sound)
|
public void playSound(final Sound sound)
|
||||||
|
throws UnsupportedAudioFileException, IOException, LineUnavailableException
|
||||||
{
|
{
|
||||||
new Thread(new Runnable()
|
new Thread(new Runnable()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,10 +32,10 @@ import net.runelite.client.config.ConfigItem;
|
|||||||
public interface IdleNotifierConfig extends Config
|
public interface IdleNotifierConfig extends Config
|
||||||
{
|
{
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "animationidle",
|
keyName = "animationidle",
|
||||||
name = "Idle Animation Notifications",
|
name = "Idle Animation Notifications",
|
||||||
description = "Configures if idle animation notifications are enabled",
|
description = "Configures if idle animation notifications are enabled",
|
||||||
position = 1
|
position = 1
|
||||||
)
|
)
|
||||||
default boolean animationIdle()
|
default boolean animationIdle()
|
||||||
{
|
{
|
||||||
@@ -43,10 +43,20 @@ public interface IdleNotifierConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "interactionidle",
|
keyName = "animationidlesound",
|
||||||
name = "Idle Interaction Notifications",
|
name = "Idle Animation Sound",
|
||||||
description = "Configures if idle interaction notifications are enabled e.g. combat, fishing",
|
description = "Plays a custom sound accompanying Idle Animation notifications",
|
||||||
position = 2
|
position = 2
|
||||||
|
)
|
||||||
|
default boolean animationIdleSound() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "interactionidle",
|
||||||
|
name = "Idle Interaction Notifications",
|
||||||
|
description = "Configures if idle interaction notifications are enabled e.g. combat, fishing",
|
||||||
|
position = 3
|
||||||
)
|
)
|
||||||
default boolean interactionIdle()
|
default boolean interactionIdle()
|
||||||
{
|
{
|
||||||
@@ -54,10 +64,20 @@ public interface IdleNotifierConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "logoutidle",
|
keyName = "interactionidlesound",
|
||||||
name = "Idle Logout Notifications",
|
name = "Idle Interaction Sound",
|
||||||
description = "Configures if the idle logout notifications are enabled",
|
description = "Plays a custom sound accompanying Idle Interaction notifications",
|
||||||
position = 3
|
position = 4
|
||||||
|
)
|
||||||
|
default boolean interactionIdleSound() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "logoutidle",
|
||||||
|
name = "Idle Logout Notifications",
|
||||||
|
description = "Configures if the idle logout notifications are enabled",
|
||||||
|
position = 5
|
||||||
)
|
)
|
||||||
default boolean logoutIdle()
|
default boolean logoutIdle()
|
||||||
{
|
{
|
||||||
@@ -65,10 +85,20 @@ public interface IdleNotifierConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 4,
|
keyName = "outofcombatsound",
|
||||||
keyName = "skullNotification",
|
name = "Out of Combat Sound",
|
||||||
name = "Skull Notification",
|
description = "Plays a custom sound whenever you leave combat",
|
||||||
description = "Receive a notification when you skull."
|
position = 6
|
||||||
|
)
|
||||||
|
default boolean outOfCombatSound() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
position = 7,
|
||||||
|
keyName = "skullNotification",
|
||||||
|
name = "Skull Notification",
|
||||||
|
description = "Receive a notification when you skull."
|
||||||
)
|
)
|
||||||
default boolean showSkullNotification()
|
default boolean showSkullNotification()
|
||||||
{
|
{
|
||||||
@@ -76,10 +106,10 @@ public interface IdleNotifierConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 5,
|
position = 8,
|
||||||
keyName = "unskullNotification",
|
keyName = "unskullNotification",
|
||||||
name = "Unskull Notification",
|
name = "Unskull Notification",
|
||||||
description = "Receive a notification when you unskull."
|
description = "Receive a notification when you unskull."
|
||||||
)
|
)
|
||||||
default boolean showUnskullNotification()
|
default boolean showUnskullNotification()
|
||||||
{
|
{
|
||||||
@@ -87,10 +117,10 @@ public interface IdleNotifierConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "timeout",
|
keyName = "timeout",
|
||||||
name = "Idle Notification Delay (ms)",
|
name = "Idle Notification Delay (ms)",
|
||||||
description = "The notification delay after the player is idle",
|
description = "The notification delay after the player is idle",
|
||||||
position = 6
|
position = 9
|
||||||
)
|
)
|
||||||
default int getIdleNotificationDelay()
|
default int getIdleNotificationDelay()
|
||||||
{
|
{
|
||||||
@@ -98,10 +128,10 @@ public interface IdleNotifierConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "hitpoints",
|
keyName = "hitpoints",
|
||||||
name = "Hitpoints Notification Threshold",
|
name = "Hitpoints Notification Threshold",
|
||||||
description = "The amount of hitpoints to send a notification at. A value of 0 will disable notification.",
|
description = "The amount of hitpoints to send a notification at. A value of 0 will disable notification.",
|
||||||
position = 7
|
position = 10
|
||||||
)
|
)
|
||||||
default int getHitpointsThreshold()
|
default int getHitpointsThreshold()
|
||||||
{
|
{
|
||||||
@@ -109,10 +139,20 @@ public interface IdleNotifierConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "prayer",
|
keyName = "playHealthSound",
|
||||||
name = "Prayer Notification Threshold",
|
name = "Play sound for Low Health",
|
||||||
description = "The amount of prayer points to send a notification at. A value of 0 will disable notification.",
|
description = "Will play a sound for every Low Health notification sent",
|
||||||
position = 8
|
position = 12
|
||||||
|
)
|
||||||
|
default boolean getPlayHealthSound() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "prayer",
|
||||||
|
name = "Prayer Notification Threshold",
|
||||||
|
description = "The amount of prayer points to send a notification at. A value of 0 will disable notification.",
|
||||||
|
position = 12
|
||||||
)
|
)
|
||||||
default int getPrayerThreshold()
|
default int getPrayerThreshold()
|
||||||
{
|
{
|
||||||
@@ -120,10 +160,20 @@ public interface IdleNotifierConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "oxygen",
|
keyName = "playPrayerSound",
|
||||||
name = "Oxygen Notification Threshold",
|
name = "Play sound for Low Prayer",
|
||||||
position = 9,
|
description = "Will play a sound for every Low Prayer notification sent",
|
||||||
description = "The amount of remaining oxygen to send a notification at. A value of 0 will disable notification."
|
position = 13
|
||||||
|
)
|
||||||
|
default boolean getPlayPrayerSound() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "oxygen",
|
||||||
|
name = "Oxygen Notification Threshold",
|
||||||
|
position = 14,
|
||||||
|
description = "The amount of remaining oxygen to send a notification at. A value of 0 will disable notification."
|
||||||
)
|
)
|
||||||
default int getOxygenThreshold()
|
default int getOxygenThreshold()
|
||||||
{
|
{
|
||||||
@@ -131,10 +181,10 @@ public interface IdleNotifierConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "spec",
|
keyName = "spec",
|
||||||
name = "Special Attack Energy Notification Threshold",
|
name = "Special Attack Energy Notification Threshold",
|
||||||
position = 10,
|
position = 15,
|
||||||
description = "The amount of spec energy reached to send a notification at. A value of 0 will disable notification."
|
description = "The amount of spec energy reached to send a notification at. A value of 0 will disable notification."
|
||||||
)
|
)
|
||||||
default int getSpecEnergyThreshold()
|
default int getSpecEnergyThreshold()
|
||||||
{
|
{
|
||||||
@@ -142,12 +192,32 @@ public interface IdleNotifierConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "pkers",
|
keyName = "specSound",
|
||||||
name = "PKer Notifier",
|
name = "Special Attack Energy Sound",
|
||||||
position = 9,
|
description = "Plays a custom sound accompanying Special Attack energy notifications",
|
||||||
description = "Notifies if an attackable player based on your level range appears on screen.",
|
position = 16
|
||||||
group = "PvP",
|
)
|
||||||
warning = "This will not notify you if the player is in your cc or is online on your friends list."
|
default boolean getSpecSound() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "overspec",
|
||||||
|
name = "Over Special Energy Notification",
|
||||||
|
description = "Will repeat notifications for any value over the special energy threshold",
|
||||||
|
position = 17
|
||||||
|
)
|
||||||
|
default boolean getOverSpecEnergy() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "pkers",
|
||||||
|
name = "PKer Notifier",
|
||||||
|
position = 18,
|
||||||
|
description = "Notifies if an attackable player based on your level range appears on screen.",
|
||||||
|
group = "PvP",
|
||||||
|
warning = "This will not notify you if the player is in your cc or is online on your friends list."
|
||||||
)
|
)
|
||||||
default boolean notifyPkers()
|
default boolean notifyPkers()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,12 +27,18 @@ package net.runelite.client.plugins.idlenotifier;
|
|||||||
|
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import java.awt.TrayIcon;
|
import java.awt.TrayIcon;
|
||||||
|
import java.io.IOException;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
import javax.sound.sampled.LineUnavailableException;
|
||||||
|
import javax.sound.sampled.UnsupportedAudioFileException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import net.runelite.api.Actor;
|
import net.runelite.api.Actor;
|
||||||
import net.runelite.api.AnimationID;
|
import net.runelite.api.AnimationID;
|
||||||
import static net.runelite.api.AnimationID.COOKING_FIRE;
|
import static net.runelite.api.AnimationID.COOKING_FIRE;
|
||||||
@@ -145,6 +151,8 @@ import net.runelite.api.events.PlayerSpawned;
|
|||||||
import net.runelite.client.Notifier;
|
import net.runelite.client.Notifier;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
|
import net.runelite.client.game.Sound;
|
||||||
|
import net.runelite.client.game.SoundManager;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.util.PvPUtil;
|
import net.runelite.client.util.PvPUtil;
|
||||||
@@ -156,6 +164,8 @@ import net.runelite.client.util.PvPUtil;
|
|||||||
)
|
)
|
||||||
public class IdleNotifierPlugin extends Plugin
|
public class IdleNotifierPlugin extends Plugin
|
||||||
{
|
{
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(IdleNotifierPlugin.class);
|
||||||
|
|
||||||
// This must be more than 500 client ticks (10 seconds) before you get AFK kicked
|
// This must be more than 500 client ticks (10 seconds) before you get AFK kicked
|
||||||
private static final int LOGOUT_WARNING_MILLIS = (4 * 60 + 40) * 1000; // 4 minutes and 40 seconds
|
private static final int LOGOUT_WARNING_MILLIS = (4 * 60 + 40) * 1000; // 4 minutes and 40 seconds
|
||||||
private static final int COMBAT_WARNING_MILLIS = 19 * 60 * 1000; // 19 minutes
|
private static final int COMBAT_WARNING_MILLIS = 19 * 60 * 1000; // 19 minutes
|
||||||
@@ -173,6 +183,9 @@ public class IdleNotifierPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private Client client;
|
private Client client;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private SoundManager soundManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private IdleNotifierConfig config;
|
private IdleNotifierConfig config;
|
||||||
|
|
||||||
@@ -509,8 +522,19 @@ public class IdleNotifierPlugin extends Plugin
|
|||||||
if (config.animationIdle() && checkAnimationIdle(waitDuration, local))
|
if (config.animationIdle() && checkAnimationIdle(waitDuration, local))
|
||||||
{
|
{
|
||||||
notifier.notify("[" + local.getName() + "] is now idle!");
|
notifier.notify("[" + local.getName() + "] is now idle!");
|
||||||
|
if (this.config.animationIdleSound())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
this.soundManager.playSound(Sound.IDLE);
|
||||||
|
}
|
||||||
|
catch (UnsupportedAudioFileException | IOException | LineUnavailableException e)
|
||||||
|
{
|
||||||
|
logger.info("Failed to play Idle sound: {}", e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.interactionIdle() && checkInteractionIdle(waitDuration, local))
|
if (config.interactionIdle() && checkInteractionIdle(waitDuration, local))
|
||||||
{
|
{
|
||||||
if (lastInteractWasCombat)
|
if (lastInteractWasCombat)
|
||||||
@@ -557,8 +581,10 @@ public class IdleNotifierPlugin extends Plugin
|
|||||||
|
|
||||||
// Check if we have regenerated over the threshold, and that the
|
// Check if we have regenerated over the threshold, and that the
|
||||||
// regen was small enough.
|
// regen was small enough.
|
||||||
boolean notify = lastSpecEnergy < threshold && currentSpecEnergy >= threshold
|
boolean notify = lastSpecEnergy < threshold && currentSpecEnergy >= threshold && currentSpecEnergy - lastSpecEnergy <= 100;
|
||||||
&& currentSpecEnergy - lastSpecEnergy <= 100;
|
|
||||||
|
notify = (notify) || ((config.getOverSpecEnergy()) && (currentSpecEnergy >= threshold) && (currentSpecEnergy != lastSpecEnergy) && (currentSpecEnergy - lastSpecEnergy <= 100));
|
||||||
|
|
||||||
lastSpecEnergy = currentSpecEnergy;
|
lastSpecEnergy = currentSpecEnergy;
|
||||||
return notify;
|
return notify;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ package net.runelite.client.plugins.zulrah;
|
|||||||
|
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
import javax.sound.sampled.LineUnavailableException;
|
||||||
|
import javax.sound.sampled.UnsupportedAudioFileException;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
@@ -56,6 +59,8 @@ import net.runelite.client.plugins.zulrah.phase.ZulrahPhase;
|
|||||||
import net.runelite.client.plugins.zulrah.phase.ZulrahType;
|
import net.runelite.client.plugins.zulrah.phase.ZulrahType;
|
||||||
import net.runelite.client.ui.overlay.OverlayManager;
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Zulrah Helper",
|
name = "Zulrah Helper",
|
||||||
description = "Shows tiles on where to stand during the phases and what prayer to use.",
|
description = "Shows tiles on where to stand during the phases and what prayer to use.",
|
||||||
@@ -167,14 +172,29 @@ public class ZulrahPlugin extends Plugin
|
|||||||
|
|
||||||
if (config.sounds())
|
if (config.sounds())
|
||||||
{
|
{
|
||||||
if (type == ZulrahType.RANGE)
|
if (type == ZulrahType.RANGE) {
|
||||||
{
|
try
|
||||||
soundManager.playSound(Sound.PRAY_RANGED);
|
{
|
||||||
|
soundManager.playSound(Sound.PRAY_RANGED);
|
||||||
|
}
|
||||||
|
catch (UnsupportedAudioFileException | IOException | LineUnavailableException e)
|
||||||
|
{
|
||||||
|
log.info("Failed to play Idle sound: {}", e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (type == ZulrahType.MAGIC)
|
if (type == ZulrahType.MAGIC) {
|
||||||
{
|
try
|
||||||
soundManager.playSound(Sound.PRAY_MAGIC);
|
{
|
||||||
|
soundManager.playSound(Sound.PRAY_MAGIC);
|
||||||
|
}
|
||||||
|
catch (UnsupportedAudioFileException|IOException|LineUnavailableException e)
|
||||||
|
{
|
||||||
|
log.info("Failed to play Idle sound: {}", e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user