Merge pull request #587 from Lucwousin/asasakkaskakskakaskamkskanmsa
Fix and cleanup zulrah plugin
This commit is contained in:
@@ -44,7 +44,7 @@ public class AnnotationIntegrityChecker
|
|||||||
|
|
||||||
public static final java.lang.Class<?> CLIENT_CLASS = RSClient.class;
|
public static final java.lang.Class<?> CLIENT_CLASS = RSClient.class;
|
||||||
|
|
||||||
public static final String API_PACKAGE_BASE = "rs.api.RS";
|
public static final String API_PACKAGE_BASE = "net.runelite.rs.api.RS";
|
||||||
|
|
||||||
private final ClassGroup one;
|
private final ClassGroup one;
|
||||||
private final ClassGroup two;
|
private final ClassGroup two;
|
||||||
|
|||||||
@@ -28,9 +28,6 @@ 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;
|
||||||
@@ -59,8 +56,6 @@ 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.",
|
||||||
@@ -68,7 +63,6 @@ import net.runelite.client.ui.overlay.OverlayManager;
|
|||||||
type = PluginType.PVM,
|
type = PluginType.PVM,
|
||||||
enabledByDefault = false
|
enabledByDefault = false
|
||||||
)
|
)
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class ZulrahPlugin extends Plugin
|
public class ZulrahPlugin extends Plugin
|
||||||
{
|
{
|
||||||
@@ -81,9 +75,6 @@ public class ZulrahPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private ZulrahConfig config;
|
private ZulrahConfig config;
|
||||||
|
|
||||||
@Inject
|
|
||||||
private ZulrahOverlay overlay;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private OverlayManager overlayManager;
|
private OverlayManager overlayManager;
|
||||||
|
|
||||||
@@ -102,25 +93,22 @@ public class ZulrahPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private ZulrahOverlay zulrahOverlay;
|
private ZulrahOverlay zulrahOverlay;
|
||||||
|
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
ZulrahConfig getConfig(ConfigManager configManager)
|
ZulrahConfig getConfig(ConfigManager configManager)
|
||||||
{
|
{
|
||||||
return configManager.getConfig(ZulrahConfig.class);
|
return configManager.getConfig(ZulrahConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final ZulrahPattern[] patterns = new ZulrahPattern[]
|
private static final ZulrahPattern[] patterns = new ZulrahPattern[]
|
||||||
{
|
{
|
||||||
new ZulrahPatternA(),
|
new ZulrahPatternA(),
|
||||||
new ZulrahPatternB(),
|
new ZulrahPatternB(),
|
||||||
new ZulrahPatternC(),
|
new ZulrahPatternC(),
|
||||||
new ZulrahPatternD()
|
new ZulrahPatternD()
|
||||||
};
|
};
|
||||||
|
|
||||||
private ZulrahInstance instance;
|
private ZulrahInstance instance;
|
||||||
|
|
||||||
private ZulrahPhase phase;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void startUp() throws Exception
|
protected void startUp() throws Exception
|
||||||
{
|
{
|
||||||
@@ -139,7 +127,6 @@ public class ZulrahPlugin extends Plugin
|
|||||||
overlayManager.remove(zulrahOverlay);
|
overlayManager.remove(zulrahOverlay);
|
||||||
zulrah = null;
|
zulrah = null;
|
||||||
instance = null;
|
instance = null;
|
||||||
phase = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -167,21 +154,6 @@ 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)
|
||||||
{
|
{
|
||||||
@@ -196,6 +168,21 @@ 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)
|
||||||
{
|
{
|
||||||
@@ -229,34 +216,22 @@ public class ZulrahPlugin extends Plugin
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onNpcSpawned(NpcSpawned event)
|
public void onNpcSpawned(NpcSpawned event)
|
||||||
{
|
{
|
||||||
try
|
NPC npc = event.getNpc();
|
||||||
|
if (npc != null && npc.getName() != null &&
|
||||||
|
npc.getName().toLowerCase().contains("zulrah"))
|
||||||
{
|
{
|
||||||
NPC npc = event.getNpc();
|
zulrah = npc;
|
||||||
if (npc != null && npc.getName().toLowerCase().contains("zulrah"))
|
|
||||||
{
|
|
||||||
zulrah = npc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onNpcDespawned(NpcDespawned event)
|
public void onNpcDespawned(NpcDespawned event)
|
||||||
{
|
{
|
||||||
try
|
NPC npc = event.getNpc();
|
||||||
|
if (npc != null && npc.getName() != null &&
|
||||||
|
npc.getName().toLowerCase().contains("zulrah"))
|
||||||
{
|
{
|
||||||
NPC npc = event.getNpc();
|
zulrah = null;
|
||||||
if (npc != null && npc.getName().toLowerCase().contains("zulrah"))
|
|
||||||
{
|
|
||||||
zulrah = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user