kourendlibrary: hide Varlamore Envoy outside of the Depths of Despair

This commit is contained in:
Trey
2020-10-06 07:00:53 +02:00
committed by Max Weber
parent cfa6942678
commit 204b79ae17
4 changed files with 18 additions and 9 deletions

View File

@@ -54,11 +54,11 @@ public interface KourendLibraryConfig extends Config
}
@ConfigItem(
keyName = "hideVarlamoreEnvoy",
name = "Hide Varlamore Envoy",
description = "Whether to hide Varlamore Envoy, as it is only required in the Depths of Despair quest, and is never asked for."
keyName = "alwaysShowVarlamoreEnvoy",
name = "Show Varlamore Envoy",
description = "Varlamore Envoy is only needed during the Depths of Despair, and is never asked for"
)
default boolean hideVarlamoreEnvoy()
default boolean alwaysShowVarlamoreEnvoy()
{
return false;
}

View File

@@ -127,7 +127,7 @@ class KourendLibraryOverlay extends Overlay
bookIsKnown = true;
}
if ((book == Book.VARLAMORE_ENVOY && config.hideVarlamoreEnvoy())
if ((book == Book.VARLAMORE_ENVOY && !plugin.showVarlamoreEnvoy())
|| (book != null && book.isDarkManuscript() && config.hideDarkManuscript()))
{
continue;

View File

@@ -53,7 +53,6 @@ class KourendLibraryPanel extends PluginPanel
private static final ImageIcon RESET_HOVER_ICON;
private final KourendLibraryPlugin plugin;
private final KourendLibraryConfig config;
private final Library library;
private final HashMap<Book, BookPanel> bookPanels = new HashMap<>();
@@ -66,12 +65,11 @@ class KourendLibraryPanel extends PluginPanel
}
@Inject
KourendLibraryPanel(KourendLibraryPlugin plugin, KourendLibraryConfig config, Library library)
KourendLibraryPanel(KourendLibraryPlugin plugin, Library library)
{
super();
this.plugin = plugin;
this.config = config;
this.library = library;
}
@@ -89,7 +87,7 @@ class KourendLibraryPanel extends PluginPanel
c.gridy = 0;
Stream.of(Book.values())
.filter(b -> !b.isDarkManuscript())
.filter(b -> !config.hideVarlamoreEnvoy() || b != Book.VARLAMORE_ENVOY)
.filter(b -> b != Book.VARLAMORE_ENVOY || plugin.showVarlamoreEnvoy())
.sorted(Comparator.comparing(Book::getShortName))
.forEach(b ->
{

View File

@@ -59,6 +59,8 @@ import net.runelite.api.events.ItemContainerChanged;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.Quest;
import net.runelite.api.QuestState;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.ItemManager;
@@ -113,6 +115,7 @@ public class KourendLibraryPlugin extends Plugin
private WorldPoint lastBookcaseClick = null;
private WorldPoint lastBookcaseAnimatedOn = null;
private EnumSet<Book> playerBooks = null;
private QuestState depthsOfDespairState = QuestState.FINISHED;
@Getter(AccessLevel.PACKAGE)
private final Set<NPC> npcsToMark = new HashSet<>();
@@ -262,6 +265,7 @@ public class KourendLibraryPlugin extends Plugin
{
if (inRegion)
{
panel.reload();
clientToolbar.addNavigation(navButton);
}
else
@@ -277,6 +281,8 @@ public class KourendLibraryPlugin extends Plugin
return;
}
depthsOfDespairState = Quest.THE_DEPTHS_OF_DESPAIR.getState(client);
if (lastBookcaseAnimatedOn != null)
{
Widget find = client.getWidget(WidgetInfo.DIALOG_SPRITE_SPRITE);
@@ -412,6 +418,11 @@ public class KourendLibraryPlugin extends Plugin
}
}
boolean showVarlamoreEnvoy()
{
return config.alwaysShowVarlamoreEnvoy() || depthsOfDespairState == QuestState.IN_PROGRESS;
}
static boolean isLibraryCustomer(int npcId)
{
return npcId == NpcID.VILLIA || npcId == NpcID.PROFESSOR_GRACKLEBONE || npcId == NpcID.SAM_7049;