Whale watchers: pneck break warning sound (#1399)
Whale watchers: pneck break warning sound
This commit is contained in:
@@ -18,7 +18,8 @@ public enum Sound
|
|||||||
LOW_PRAYER(14, "net/runelite/client/game/sounds/lowprayer.wav"),
|
LOW_PRAYER(14, "net/runelite/client/game/sounds/lowprayer.wav"),
|
||||||
OUT_OF_COMBAT(15, "net/runelite/client/game/sounds/outofcombat.wav"),
|
OUT_OF_COMBAT(15, "net/runelite/client/game/sounds/outofcombat.wav"),
|
||||||
RESTORED_SPECIAL_ATTACK(16, "net/runelite/client/game/sounds/restorespec.wav"),
|
RESTORED_SPECIAL_ATTACK(16, "net/runelite/client/game/sounds/restorespec.wav"),
|
||||||
IDLE(17, "net/runelite/client/game/sounds/idle.wav");
|
IDLE(17, "net/runelite/client/game/sounds/idle.wav"),
|
||||||
|
BREAK(18, "net/runelite/client/game/sounds/break.wav");
|
||||||
|
|
||||||
private final String filePath;
|
private final String filePath;
|
||||||
private final int id;
|
private final int id;
|
||||||
|
|||||||
@@ -51,4 +51,15 @@ public interface WhaleWatchersConfig extends Config
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
position = 5,
|
||||||
|
keyName = "pneckBreak",
|
||||||
|
name = "Phoenix Necklace Break Sound",
|
||||||
|
description = "play a sound notification when your phoenix necklace breaks"
|
||||||
|
)
|
||||||
|
default boolean pneckBreak()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import javax.inject.Inject;
|
|||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import net.runelite.api.ChatMessageType;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.InventoryID;
|
import net.runelite.api.InventoryID;
|
||||||
import net.runelite.api.ItemID;
|
import net.runelite.api.ItemID;
|
||||||
@@ -29,6 +30,7 @@ import net.runelite.api.VarPlayer;
|
|||||||
import net.runelite.api.Varbits;
|
import net.runelite.api.Varbits;
|
||||||
import net.runelite.api.WorldType;
|
import net.runelite.api.WorldType;
|
||||||
import static net.runelite.api.WorldType.isPvpWorld;
|
import static net.runelite.api.WorldType.isPvpWorld;
|
||||||
|
import net.runelite.api.events.ChatMessage;
|
||||||
import net.runelite.api.events.ConfigChanged;
|
import net.runelite.api.events.ConfigChanged;
|
||||||
import net.runelite.api.events.GameTick;
|
import net.runelite.api.events.GameTick;
|
||||||
import net.runelite.api.events.HitsplatApplied;
|
import net.runelite.api.events.HitsplatApplied;
|
||||||
@@ -39,6 +41,8 @@ import net.runelite.api.kit.KitType;
|
|||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.eventbus.EventBus;
|
import net.runelite.client.eventbus.EventBus;
|
||||||
import net.runelite.client.events.OverlayMenuClicked;
|
import net.runelite.client.events.OverlayMenuClicked;
|
||||||
|
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.plugins.PluginType;
|
import net.runelite.client.plugins.PluginType;
|
||||||
@@ -48,20 +52,19 @@ import org.apache.commons.lang3.ObjectUtils;
|
|||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Whale Watchers",
|
name = "Whale Watchers",
|
||||||
description = "A Plugin to save help whales in the wild",
|
description = "A Plugin to save help whales in the wild",
|
||||||
tags = {"whale watchers", "whale", "protect item", "warning", "pklite"},
|
tags = {"whale watchers", "whale", "protect item", "warning", "pklite", "pneck"},
|
||||||
type = PluginType.PVP,
|
type = PluginType.PVP,
|
||||||
enabledByDefault = false
|
enabledByDefault = false
|
||||||
)
|
)
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class WhaleWatchersPlugin extends Plugin
|
public class WhaleWatchersPlugin extends Plugin
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final String CONFIG_GROUP_NAME = "WhaleWatchers";
|
|
||||||
|
|
||||||
boolean protectItemOverlay = false;
|
boolean protectItemOverlay = false;
|
||||||
int damageDone = 0;
|
int damageDone = 0;
|
||||||
int damageTaken = 0;
|
int damageTaken = 0;
|
||||||
boolean inCombat = false;
|
boolean inCombat = false;
|
||||||
|
private static final String BROKEN_PNECK_MESSAGE = "Your phoenix necklace heals you, but is destroyed in the process.";
|
||||||
@Inject
|
@Inject
|
||||||
private Client client;
|
private Client client;
|
||||||
@Inject
|
@Inject
|
||||||
@@ -77,19 +80,21 @@ public class WhaleWatchersPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private OverlayManager overlayManager;
|
private OverlayManager overlayManager;
|
||||||
@Inject
|
@Inject
|
||||||
|
private SoundManager soundManager;
|
||||||
|
@Inject
|
||||||
private EventBus eventBus;
|
private EventBus eventBus;
|
||||||
private int tickCountdown = 0;
|
private int tickCountdown = 0;
|
||||||
@Getter(AccessLevel.PACKAGE)
|
@Getter(AccessLevel.PACKAGE)
|
||||||
private boolean displaySmiteOverlay;
|
private boolean displaySmiteOverlay;
|
||||||
@Getter(AccessLevel.PACKAGE)
|
@Getter(AccessLevel.PACKAGE)
|
||||||
private boolean displayGloryOverlay;
|
private boolean displayGloryOverlay;
|
||||||
|
|
||||||
@Getter(AccessLevel.PACKAGE)
|
@Getter(AccessLevel.PACKAGE)
|
||||||
private boolean protectItemWarning;
|
private boolean protectItemWarning;
|
||||||
@Getter(AccessLevel.PACKAGE)
|
@Getter(AccessLevel.PACKAGE)
|
||||||
private boolean showDamageCounter;
|
private boolean showDamageCounter;
|
||||||
private boolean smiteableWarning;
|
private boolean smiteableWarning;
|
||||||
private boolean gloryWarning;
|
private boolean gloryWarning;
|
||||||
|
private boolean pneckBreak;
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
WhaleWatchersConfig getConfig(ConfigManager configManager)
|
WhaleWatchersConfig getConfig(ConfigManager configManager)
|
||||||
@@ -137,11 +142,12 @@ public class WhaleWatchersPlugin extends Plugin
|
|||||||
eventBus.subscribe(MenuOptionClicked.class, this, this::onMenuOptionClicked);
|
eventBus.subscribe(MenuOptionClicked.class, this, this::onMenuOptionClicked);
|
||||||
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
|
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
|
||||||
eventBus.subscribe(GameTick.class, this, this::onGameTick);
|
eventBus.subscribe(GameTick.class, this, this::onGameTick);
|
||||||
|
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onConfigChanged(ConfigChanged event)
|
private void onConfigChanged(ConfigChanged event)
|
||||||
{
|
{
|
||||||
if (!event.getGroup().equals(CONFIG_GROUP_NAME))
|
if (!event.getGroup().equals("WhaleWatchers"))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -162,6 +168,14 @@ public class WhaleWatchersPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onChatMessage(ChatMessage event)
|
||||||
|
{
|
||||||
|
if (this.pneckBreak && event.getType() == ChatMessageType.GAMEMESSAGE && event.getMessage().equals(BROKEN_PNECK_MESSAGE))
|
||||||
|
{
|
||||||
|
soundManager.playSound(Sound.BREAK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void onHitsplatApplied(HitsplatApplied event)
|
private void onHitsplatApplied(HitsplatApplied event)
|
||||||
{
|
{
|
||||||
if (this.showDamageCounter)
|
if (this.showDamageCounter)
|
||||||
@@ -306,6 +320,6 @@ public class WhaleWatchersPlugin extends Plugin
|
|||||||
this.showDamageCounter = config.showDamageCounter();
|
this.showDamageCounter = config.showDamageCounter();
|
||||||
this.smiteableWarning = config.smiteableWarning();
|
this.smiteableWarning = config.smiteableWarning();
|
||||||
this.gloryWarning = config.gloryWarning();
|
this.gloryWarning = config.gloryWarning();
|
||||||
|
this.pneckBreak = config.pneckBreak();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Binary file not shown.
Reference in New Issue
Block a user