slayer plugin: use npchiglight for task highlights
This commit is contained in:
@@ -28,7 +28,6 @@ import com.google.common.reflect.ClassPath;
|
||||
import com.google.common.reflect.ClassPath.ClassInfo;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Module;
|
||||
import com.google.inject.grapher.graphviz.GraphvizGrapher;
|
||||
import com.google.inject.grapher.graphviz.GraphvizModule;
|
||||
import com.google.inject.testing.fieldbinder.Bind;
|
||||
@@ -39,10 +38,8 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import net.runelite.api.Client;
|
||||
@@ -153,24 +150,28 @@ public class PluginManagerTest
|
||||
@Test
|
||||
public void dumpGraph() throws Exception
|
||||
{
|
||||
List<Module> modules = new ArrayList<>();
|
||||
modules.add(new GraphvizModule());
|
||||
modules.add(new RuneLiteModule(mock(OkHttpClient.class), () -> null, true, false,
|
||||
RuneLite.DEFAULT_SESSION_FILE,
|
||||
RuneLite.DEFAULT_CONFIG_FILE));
|
||||
|
||||
PluginManager pluginManager = new PluginManager(true, false, null, null, null, null);
|
||||
pluginManager.loadCorePlugins();
|
||||
modules.addAll(pluginManager.getPlugins());
|
||||
|
||||
File file = folder.newFile();
|
||||
try (PrintWriter out = new PrintWriter(file, "UTF-8"))
|
||||
Injector graphvizInjector = Guice.createInjector(new GraphvizModule());
|
||||
GraphvizGrapher graphvizGrapher = graphvizInjector.getInstance(GraphvizGrapher.class);
|
||||
|
||||
File dotFolder = folder.newFolder();
|
||||
try (PrintWriter out = new PrintWriter(new File(dotFolder, "runelite.dot"), "UTF-8"))
|
||||
{
|
||||
Injector injector = Guice.createInjector(modules);
|
||||
GraphvizGrapher grapher = injector.getInstance(GraphvizGrapher.class);
|
||||
grapher.setOut(out);
|
||||
grapher.setRankdir("TB");
|
||||
grapher.graph(injector);
|
||||
graphvizGrapher.setOut(out);
|
||||
graphvizGrapher.setRankdir("TB");
|
||||
graphvizGrapher.graph(RuneLite.getInjector());
|
||||
}
|
||||
|
||||
for (Plugin p : pluginManager.getPlugins())
|
||||
{
|
||||
try (PrintWriter out = new PrintWriter(new File(dotFolder, p.getName() + ".dot"), "UTF-8"))
|
||||
{
|
||||
graphvizGrapher.setOut(out);
|
||||
graphvizGrapher.setRankdir("TB");
|
||||
graphvizGrapher.graph(p.getInjector());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ public class NpcIndicatorsPluginTest
|
||||
when(npcIndicatorsConfig.getNpcToHighlight()).thenReturn("goblin");
|
||||
when(npcIndicatorsConfig.deadNpcMenuColor()).thenReturn(Color.RED);
|
||||
|
||||
npcIndicatorsPlugin.rebuildAllNpcs();
|
||||
npcIndicatorsPlugin.rebuild();
|
||||
|
||||
NPC npc = mock(NPC.class);
|
||||
when(npc.getName()).thenReturn("Goblin");
|
||||
@@ -124,7 +124,7 @@ public class NpcIndicatorsPluginTest
|
||||
when(npcIndicatorsConfig.highlightMenuNames()).thenReturn(true);
|
||||
when(npcIndicatorsConfig.getHighlightColor()).thenReturn(Color.BLUE);
|
||||
|
||||
npcIndicatorsPlugin.rebuildAllNpcs();
|
||||
npcIndicatorsPlugin.rebuild();
|
||||
|
||||
NPC npc = mock(NPC.class);
|
||||
when(npc.getName()).thenReturn("Goblin");
|
||||
@@ -146,7 +146,7 @@ public class NpcIndicatorsPluginTest
|
||||
{
|
||||
when(npcIndicatorsConfig.getNpcToHighlight()).thenReturn("Joseph");
|
||||
|
||||
npcIndicatorsPlugin.rebuildAllNpcs();
|
||||
npcIndicatorsPlugin.rebuild();
|
||||
|
||||
NPC npc = mock(NPC.class);
|
||||
when(npc.getName()).thenReturn("Joseph");
|
||||
@@ -165,7 +165,7 @@ public class NpcIndicatorsPluginTest
|
||||
{
|
||||
when(npcIndicatorsConfig.getNpcToHighlight()).thenReturn("Werewolf");
|
||||
|
||||
npcIndicatorsPlugin.rebuildAllNpcs();
|
||||
npcIndicatorsPlugin.rebuild();
|
||||
|
||||
NPC npc = mock(NPC.class);
|
||||
when(npc.getName()).thenReturn("Joseph");
|
||||
|
||||
@@ -31,6 +31,7 @@ import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import static net.runelite.api.ChatMessageType.GAMEMESSAGE;
|
||||
import net.runelite.api.Client;
|
||||
@@ -55,6 +56,7 @@ import net.runelite.client.chat.ChatCommandManager;
|
||||
import net.runelite.client.chat.ChatMessageManager;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.plugins.npchighlight.NpcIndicatorsService;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
import net.runelite.http.api.chat.ChatClient;
|
||||
@@ -168,6 +170,14 @@ public class SlayerPluginTest
|
||||
@Bind
|
||||
ChatClient chatClient;
|
||||
|
||||
@Bind
|
||||
@Named("developerMode")
|
||||
boolean developerMode;
|
||||
|
||||
@Mock
|
||||
@Bind
|
||||
NpcIndicatorsService npcIndicatorsService;
|
||||
|
||||
@Inject
|
||||
SlayerPlugin slayerPlugin;
|
||||
|
||||
@@ -871,14 +881,13 @@ public class SlayerPluginTest
|
||||
slayerPlugin.onStatChanged(statChanged);
|
||||
|
||||
NPCComposition npcComposition = mock(NPCComposition.class);
|
||||
when(npcComposition.getName()).thenReturn("Suqah");
|
||||
when(npcComposition.getActions()).thenReturn(new String[]{"Attack"});
|
||||
|
||||
NPC npc1 = mock(NPC.class);
|
||||
when(npc1.getName()).thenReturn("Suqah");
|
||||
when(npc1.getTransformedComposition()).thenReturn(npcComposition);
|
||||
|
||||
NPC npc2 = mock(NPC.class);
|
||||
when(npc2.getName()).thenReturn("Suqah");
|
||||
when(npc2.getTransformedComposition()).thenReturn(npcComposition);
|
||||
|
||||
when(client.getNpcs()).thenReturn(Arrays.asList(npc1, npc2));
|
||||
|
||||
Reference in New Issue
Block a user