Fix and improve Sound Manager for Zulrah. (#643)
* Fix and improve Sound Manager for Zulrah. * Add Zulrahphase animation to api. * Re-Add Config Check
This commit is contained in:
@@ -178,6 +178,7 @@ public final class AnimationID
|
|||||||
public static final int BLACKJACK_KO = 838;
|
public static final int BLACKJACK_KO = 838;
|
||||||
public static final int VETION_EARTHQUAKE = 5507;
|
public static final int VETION_EARTHQUAKE = 5507;
|
||||||
public static final int ZULRAH_DEATH = 5804;
|
public static final int ZULRAH_DEATH = 5804;
|
||||||
|
public static final int ZULRAH_PHASE = 5072;
|
||||||
|
|
||||||
// Farming
|
// Farming
|
||||||
public static final int FARMING_HARVEST_FRUIT_TREE = 2280;
|
public static final int FARMING_HARVEST_FRUIT_TREE = 2280;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
* Copyright (c) 2017, Aria <aria@ar1as.space>
|
* Copyright (c) 2017, Aria <aria@ar1as.space>
|
||||||
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
|
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
|
||||||
|
* Copyright (c) 2019, Ganom <https://github.com/ganom>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -30,9 +31,13 @@ import com.google.inject.Provides;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.runelite.api.Actor;
|
||||||
|
import net.runelite.api.AnimationID;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
import net.runelite.api.NPC;
|
import net.runelite.api.NPC;
|
||||||
|
import net.runelite.api.Prayer;
|
||||||
|
import net.runelite.api.events.AnimationChanged;
|
||||||
import net.runelite.api.events.GameTick;
|
import net.runelite.api.events.GameTick;
|
||||||
import net.runelite.api.events.NpcDespawned;
|
import net.runelite.api.events.NpcDespawned;
|
||||||
import net.runelite.api.events.NpcSpawned;
|
import net.runelite.api.events.NpcSpawned;
|
||||||
@@ -53,7 +58,6 @@ 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.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(
|
||||||
@@ -66,32 +70,32 @@ import net.runelite.client.ui.overlay.OverlayManager;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class ZulrahPlugin extends Plugin
|
public class ZulrahPlugin extends Plugin
|
||||||
{
|
{
|
||||||
|
private static final ZulrahPattern[] patterns = new ZulrahPattern[]
|
||||||
|
{
|
||||||
|
new ZulrahPatternA(),
|
||||||
|
new ZulrahPatternB(),
|
||||||
|
new ZulrahPatternC(),
|
||||||
|
new ZulrahPatternD()
|
||||||
|
};
|
||||||
@Getter
|
@Getter
|
||||||
private NPC zulrah;
|
private NPC zulrah;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private Client client;
|
private Client client;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ZulrahConfig config;
|
private ZulrahConfig config;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private OverlayManager overlayManager;
|
private OverlayManager overlayManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private SoundManager soundManager;
|
private SoundManager soundManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ZulrahCurrentPhaseOverlay currentPhaseOverlay;
|
private ZulrahCurrentPhaseOverlay currentPhaseOverlay;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ZulrahNextPhaseOverlay nextPhaseOverlay;
|
private ZulrahNextPhaseOverlay nextPhaseOverlay;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ZulrahPrayerOverlay zulrahPrayerOverlay;
|
private ZulrahPrayerOverlay zulrahPrayerOverlay;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ZulrahOverlay zulrahOverlay;
|
private ZulrahOverlay zulrahOverlay;
|
||||||
|
private ZulrahInstance instance;
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
ZulrahConfig getConfig(ConfigManager configManager)
|
ZulrahConfig getConfig(ConfigManager configManager)
|
||||||
@@ -99,16 +103,6 @@ public class ZulrahPlugin extends Plugin
|
|||||||
return configManager.getConfig(ZulrahConfig.class);
|
return configManager.getConfig(ZulrahConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final ZulrahPattern[] patterns = new ZulrahPattern[]
|
|
||||||
{
|
|
||||||
new ZulrahPatternA(),
|
|
||||||
new ZulrahPatternB(),
|
|
||||||
new ZulrahPatternC(),
|
|
||||||
new ZulrahPatternD()
|
|
||||||
};
|
|
||||||
|
|
||||||
private ZulrahInstance instance;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void startUp() throws Exception
|
protected void startUp() throws Exception
|
||||||
{
|
{
|
||||||
@@ -168,22 +162,8 @@ public class ZulrahPlugin extends Plugin
|
|||||||
log.debug("Zulrah phase has moved from {} -> {}, stage: {}", previousPhase, currentPhase, instance.getStage());
|
log.debug("Zulrah phase has moved from {} -> {}, stage: {}", previousPhase, currentPhase, instance.getStage());
|
||||||
}
|
}
|
||||||
|
|
||||||
ZulrahType type = instance.getPhase().getType();
|
|
||||||
|
|
||||||
if (config.sounds())
|
|
||||||
{
|
|
||||||
if (type == ZulrahType.RANGE)
|
|
||||||
{
|
|
||||||
soundManager.playSound(Sound.PRAY_RANGED);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type == ZulrahType.MAGIC)
|
|
||||||
{
|
|
||||||
soundManager.playSound(Sound.PRAY_MAGIC);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ZulrahPattern pattern = instance.getPattern();
|
ZulrahPattern pattern = instance.getPattern();
|
||||||
|
|
||||||
if (pattern == null)
|
if (pattern == null)
|
||||||
{
|
{
|
||||||
int potential = 0;
|
int potential = 0;
|
||||||
@@ -213,6 +193,47 @@ public class ZulrahPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onAnimationChanged(AnimationChanged event)
|
||||||
|
{
|
||||||
|
if (instance == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZulrahPhase currentPhase = instance.getPhase();
|
||||||
|
|
||||||
|
if (currentPhase == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Actor actor = event.getActor();
|
||||||
|
if (config.sounds())
|
||||||
|
{
|
||||||
|
if (zulrah == actor)
|
||||||
|
{
|
||||||
|
if (zulrah.getAnimation() == AnimationID.ZULRAH_PHASE)
|
||||||
|
{
|
||||||
|
Prayer prayer = instance.getNextPhase().getPrayer();
|
||||||
|
|
||||||
|
if (prayer != null)
|
||||||
|
{
|
||||||
|
switch (prayer)
|
||||||
|
{
|
||||||
|
case PROTECT_FROM_MAGIC:
|
||||||
|
soundManager.playSound(Sound.PRAY_MAGIC);
|
||||||
|
break;
|
||||||
|
case PROTECT_FROM_MISSILES:
|
||||||
|
soundManager.playSound(Sound.PRAY_RANGED);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onNpcSpawned(NpcSpawned event)
|
public void onNpcSpawned(NpcSpawned event)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user