Zulrah sounds, needs testing
This commit is contained in:
@@ -28,7 +28,7 @@ public class SoundManager
|
|||||||
this.runeliteConfig = runeLiteConfig;
|
this.runeliteConfig = runeLiteConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void playSound(final Sound sound) throws UnsupportedAudioFileException, IOException, LineUnavailableException
|
public void playSound(final Sound sound)
|
||||||
{
|
{
|
||||||
new Thread(new Runnable()
|
new Thread(new Runnable()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,4 +44,14 @@ public interface ZulrahConfig extends Config
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "sounds",
|
||||||
|
name = "Sounds Enabled",
|
||||||
|
description = "Configures whether client sounds are enabled for zulrah"
|
||||||
|
)
|
||||||
|
default boolean sounds()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ import net.runelite.api.events.NpcDespawned;
|
|||||||
import net.runelite.api.events.NpcSpawned;
|
import net.runelite.api.events.NpcSpawned;
|
||||||
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.plugins.PluginType;
|
import net.runelite.client.plugins.PluginType;
|
||||||
@@ -50,7 +52,9 @@ import net.runelite.client.plugins.zulrah.patterns.ZulrahPatternA;
|
|||||||
import net.runelite.client.plugins.zulrah.patterns.ZulrahPatternB;
|
import net.runelite.client.plugins.zulrah.patterns.ZulrahPatternB;
|
||||||
import net.runelite.client.plugins.zulrah.patterns.ZulrahPatternC;
|
import net.runelite.client.plugins.zulrah.patterns.ZulrahPatternC;
|
||||||
import net.runelite.client.plugins.zulrah.patterns.ZulrahPatternD;
|
import net.runelite.client.plugins.zulrah.patterns.ZulrahPatternD;
|
||||||
|
import net.runelite.client.plugins.zulrah.phase.StandLocation;
|
||||||
import net.runelite.client.plugins.zulrah.phase.ZulrahPhase;
|
import net.runelite.client.plugins.zulrah.phase.ZulrahPhase;
|
||||||
|
import net.runelite.client.plugins.zulrah.phase.ZulrahType;
|
||||||
import net.runelite.client.ui.overlay.OverlayManager;
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
@@ -79,6 +83,9 @@ public class ZulrahPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private OverlayManager overlayManager;
|
private OverlayManager overlayManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private SoundManager soundManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ZulrahCurrentPhaseOverlay currentPhaseOverlay;
|
private ZulrahCurrentPhaseOverlay currentPhaseOverlay;
|
||||||
|
|
||||||
@@ -108,6 +115,8 @@ public class ZulrahPlugin extends Plugin
|
|||||||
|
|
||||||
private ZulrahInstance instance;
|
private ZulrahInstance instance;
|
||||||
|
|
||||||
|
private ZulrahPhase phase;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void startUp() throws Exception
|
protected void startUp() throws Exception
|
||||||
{
|
{
|
||||||
@@ -126,6 +135,7 @@ public class ZulrahPlugin extends Plugin
|
|||||||
overlayManager.remove(zulrahOverlay);
|
overlayManager.remove(zulrahOverlay);
|
||||||
zulrah = null;
|
zulrah = null;
|
||||||
instance = null;
|
instance = null;
|
||||||
|
phase = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -153,6 +163,22 @@ public class ZulrahPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
ZulrahPhase currentPhase = ZulrahPhase.valueOf(zulrah, instance.getStartLocation());
|
ZulrahPhase currentPhase = ZulrahPhase.valueOf(zulrah, instance.getStartLocation());
|
||||||
|
ZulrahType type = phase.getType();
|
||||||
|
|
||||||
|
|
||||||
|
if (config.sounds())
|
||||||
|
{
|
||||||
|
if (type == ZulrahType.RANGE)
|
||||||
|
{
|
||||||
|
soundManager.playSound(Sound.PRAY_RANGED);
|
||||||
|
}
|
||||||
|
if (type == ZulrahType.MAGIC)
|
||||||
|
{
|
||||||
|
soundManager.playSound(Sound.PRAY_MAGIC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (instance.getPhase() == null)
|
if (instance.getPhase() == null)
|
||||||
{
|
{
|
||||||
instance.setPhase(currentPhase);
|
instance.setPhase(currentPhase);
|
||||||
|
|||||||
@@ -74,4 +74,4 @@ public abstract class ZulrahPattern
|
|||||||
{
|
{
|
||||||
return index >= pattern.size();
|
return index >= pattern.size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -53,4 +53,4 @@ public class ZulrahPatternC extends ZulrahPattern
|
|||||||
{
|
{
|
||||||
return "Pattern C";
|
return "Pattern C";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,12 +69,12 @@ public class ZulrahPhase
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return "ZulrahPhase{" +
|
return "ZulrahPhase{" +
|
||||||
"zulrahLocation=" + zulrahLocation +
|
"zulrahLocation=" + zulrahLocation +
|
||||||
", type=" + type +
|
", type=" + type +
|
||||||
", jad=" + jad +
|
", jad=" + jad +
|
||||||
", standLocation=" + standLocation +
|
", standLocation=" + standLocation +
|
||||||
", prayer=" + prayer +
|
", prayer=" + prayer +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
// world location
|
// world location
|
||||||
@@ -184,4 +184,4 @@ public class ZulrahPhase
|
|||||||
}
|
}
|
||||||
return RANGE_COLOR;
|
return RANGE_COLOR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user