kourendlibrary: add option to hide Varlamore Envoy

Co-authored-by: Shawn Shadrix <shshadri@ncsu.edu>
This commit is contained in:
Hydrox6
2019-11-27 13:19:45 +00:00
parent 67f7927b3e
commit 0527abce81
4 changed files with 40 additions and 2 deletions

View File

@@ -53,6 +53,16 @@ public interface KourendLibraryConfig extends Config
return true;
}
@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."
)
default boolean hideVarlamoreEnvoy()
{
return false;
}
@ConfigItem(
keyName = "showTutorialOverlay",
name = "Show tutorial overlay",

View File

@@ -125,6 +125,12 @@ class KourendLibraryOverlay extends Overlay
book = possible.iterator().next();
bookIsKnown = true;
}
if (book == Book.VARLAMORE_ENVOY && config.hideVarlamoreEnvoy())
{
continue;
}
Color color = bookIsKnown ? (book == library.getCustomerBook() ? Color.GREEN : Color.ORANGE) : Color.WHITE;
// Render the poly on the floor

View File

@@ -54,8 +54,8 @@ class KourendLibraryPanel extends PluginPanel
private static final ImageIcon RESET_ICON;
private static final ImageIcon RESET_CLICK_ICON;
@Inject
private Library library;
private final KourendLibraryConfig config;
private final Library library;
private final HashMap<Book, BookPanel> bookPanels = new HashMap<>();
@@ -66,6 +66,15 @@ class KourendLibraryPanel extends PluginPanel
RESET_CLICK_ICON = new ImageIcon(ImageUtil.alphaOffset(resetIcon, -100));
}
@Inject
KourendLibraryPanel(KourendLibraryConfig config, Library library)
{
super();
this.config = config;
this.library = library;
}
void init()
{
setLayout(new BorderLayout(0, 5));
@@ -80,6 +89,7 @@ class KourendLibraryPanel extends PluginPanel
c.gridy = 0;
Stream.of(Book.values())
.filter(b -> !b.isDarkManuscript())
.filter(b -> !config.hideVarlamoreEnvoy() || b != Book.VARLAMORE_ENVOY)
.sorted(Comparator.comparing(Book::getShortName))
.forEach(b ->
{
@@ -156,4 +166,11 @@ class KourendLibraryPanel extends PluginPanel
}
});
}
void reload()
{
bookPanels.clear();
removeAll();
init();
}
}

View File

@@ -158,6 +158,11 @@ public class KourendLibraryPlugin extends Plugin
return;
}
if (ev.getKey().equals("hideVarlamoreEnvoy"))
{
panel.reload();
}
SwingUtilities.invokeLater(() ->
{
if (!config.hideButton())