Zulrah sounds, needs testing

This commit is contained in:
James Munson
2019-06-12 03:28:33 -07:00
parent 0024bdca52
commit a285697eb6
6 changed files with 46 additions and 10 deletions

View File

@@ -28,7 +28,7 @@ public class SoundManager
this.runeliteConfig = runeLiteConfig;
}
public void playSound(final Sound sound) throws UnsupportedAudioFileException, IOException, LineUnavailableException
public void playSound(final Sound sound)
{
new Thread(new Runnable()
{

View File

@@ -44,4 +44,14 @@ public interface ZulrahConfig extends Config
{
return true;
}
@ConfigItem(
keyName = "sounds",
name = "Sounds Enabled",
description = "Configures whether client sounds are enabled for zulrah"
)
default boolean sounds()
{
return true;
}
}

View File

@@ -38,6 +38,8 @@ import net.runelite.api.events.NpcDespawned;
import net.runelite.api.events.NpcSpawned;
import net.runelite.client.config.ConfigManager;
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.PluginDescriptor;
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.ZulrahPatternC;
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.ZulrahType;
import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
@@ -79,6 +83,9 @@ public class ZulrahPlugin extends Plugin
@Inject
private OverlayManager overlayManager;
@Inject
private SoundManager soundManager;
@Inject
private ZulrahCurrentPhaseOverlay currentPhaseOverlay;
@@ -108,6 +115,8 @@ public class ZulrahPlugin extends Plugin
private ZulrahInstance instance;
private ZulrahPhase phase;
@Override
protected void startUp() throws Exception
{
@@ -126,6 +135,7 @@ public class ZulrahPlugin extends Plugin
overlayManager.remove(zulrahOverlay);
zulrah = null;
instance = null;
phase = null;
}
@Subscribe
@@ -153,6 +163,22 @@ public class ZulrahPlugin extends Plugin
}
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)
{
instance.setPhase(currentPhase);

View File

@@ -74,4 +74,4 @@ public abstract class ZulrahPattern
{
return index >= pattern.size();
}
}
}

View File

@@ -53,4 +53,4 @@ public class ZulrahPatternC extends ZulrahPattern
{
return "Pattern C";
}
}
}

View File

@@ -69,12 +69,12 @@ public class ZulrahPhase
public String toString()
{
return "ZulrahPhase{" +
"zulrahLocation=" + zulrahLocation +
", type=" + type +
", jad=" + jad +
", standLocation=" + standLocation +
", prayer=" + prayer +
'}';
"zulrahLocation=" + zulrahLocation +
", type=" + type +
", jad=" + jad +
", standLocation=" + standLocation +
", prayer=" + prayer +
'}';
}
// world location
@@ -184,4 +184,4 @@ public class ZulrahPhase
}
return RANGE_COLOR;
}
}
}