Skip to content

Commit

Permalink
kourendlibrary: Indicate books not in inventory
Browse files Browse the repository at this point in the history
This commit changes the Kourend library panel to show a different color
for books which are not the target based on whether they are in the
player's inventory or not. Previously, the target book would be shown in
green and all other books would be listed in white. Now, non-target
books in the player's inventory are shown in white and those the player
does not have are shown in orange.

Co-authored-by: Jordan Atwood <[email protected]>
  • Loading branch information
rfick and Nightfirecat committed Mar 19, 2020
1 parent 023860f commit 931cb7a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ void setLocation(String location)

void setIsTarget(boolean target)
{
location.setForeground(target ? Color.GREEN : Color.WHITE);
location.setForeground(target ? Color.GREEN : Color.ORANGE);
}

void setIsHeld(boolean held)
{
if (held)
{
location.setForeground(Color.WHITE);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class KourendLibraryPanel extends PluginPanel
private static final ImageIcon RESET_ICON;
private static final ImageIcon RESET_HOVER_ICON;

private final KourendLibraryPlugin plugin;
private final KourendLibraryConfig config;
private final Library library;

Expand All @@ -65,10 +66,11 @@ class KourendLibraryPanel extends PluginPanel
}

@Inject
KourendLibraryPanel(KourendLibraryConfig config, Library library)
KourendLibraryPanel(KourendLibraryPlugin plugin, KourendLibraryConfig config, Library library)
{
super();

this.plugin = plugin;
this.config = config;
this.library = library;
}
Expand Down Expand Up @@ -117,7 +119,11 @@ void update()
Book customerBook = library.getCustomerBook();
for (Map.Entry<Book, BookPanel> b : bookPanels.entrySet())
{
b.getValue().setIsTarget(customerBook == b.getKey());
final Book book = b.getKey();
final BookPanel panel = b.getValue();

panel.setIsTarget(customerBook == book);
panel.setIsHeld(plugin.doesPlayerContainBook(book));
}

HashMap<Book, HashSet<String>> bookLocations = new HashMap<>();
Expand Down

0 comments on commit 931cb7a

Please sign in to comment.