motherlode: Add option to show collected ore/gem icons
This commit is contained in:
@@ -123,4 +123,14 @@ public interface MotherlodeConfig extends Config
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showLootIcons",
|
||||
name = "Show ore icons",
|
||||
description = "Display collected ores and gems as item images instead of text"
|
||||
)
|
||||
default boolean showLootIcons()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,11 +29,15 @@ import java.awt.Graphics2D;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.ItemID;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
import net.runelite.client.ui.overlay.OverlayMenuEntry;
|
||||
import net.runelite.client.ui.overlay.OverlayPanel;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.components.ComponentOrientation;
|
||||
import net.runelite.client.ui.overlay.components.ImageComponent;
|
||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||
|
||||
@@ -42,15 +46,17 @@ public class MotherlodeGemOverlay extends OverlayPanel
|
||||
private final MotherlodePlugin plugin;
|
||||
private final MotherlodeSession motherlodeSession;
|
||||
private final MotherlodeConfig config;
|
||||
private final ItemManager itemManager;
|
||||
|
||||
@Inject
|
||||
MotherlodeGemOverlay(MotherlodePlugin plugin, MotherlodeSession motherlodeSession, MotherlodeConfig config)
|
||||
MotherlodeGemOverlay(MotherlodePlugin plugin, MotherlodeSession motherlodeSession, MotherlodeConfig config, ItemManager itemManager)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.TOP_LEFT);
|
||||
this.plugin = plugin;
|
||||
this.motherlodeSession = motherlodeSession;
|
||||
this.config = config;
|
||||
this.itemManager = itemManager;
|
||||
getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Gem overlay"));
|
||||
}
|
||||
|
||||
@@ -77,38 +83,61 @@ public class MotherlodeGemOverlay extends OverlayPanel
|
||||
int emeraldsFound = session.getEmeraldsFound();
|
||||
int sapphiresFound = session.getSapphiresFound();
|
||||
|
||||
panelComponent.getChildren().add(TitleComponent.builder().text("Gems found").build());
|
||||
|
||||
if (diamondsFound > 0)
|
||||
if (config.showLootIcons())
|
||||
{
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Diamonds:")
|
||||
.right(Integer.toString(diamondsFound))
|
||||
.build());
|
||||
panelComponent.setOrientation(ComponentOrientation.HORIZONTAL);
|
||||
if (diamondsFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(new ImageComponent(itemManager.getImage(ItemID.UNCUT_DIAMOND, diamondsFound, true)));
|
||||
}
|
||||
if (rubiesFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(new ImageComponent(itemManager.getImage(ItemID.UNCUT_RUBY, rubiesFound, true)));
|
||||
}
|
||||
if (emeraldsFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(new ImageComponent(itemManager.getImage(ItemID.UNCUT_EMERALD, emeraldsFound, true)));
|
||||
}
|
||||
if (sapphiresFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(new ImageComponent(itemManager.getImage(ItemID.UNCUT_SAPPHIRE, sapphiresFound, true)));
|
||||
}
|
||||
}
|
||||
|
||||
if (rubiesFound > 0)
|
||||
else
|
||||
{
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Rubies:")
|
||||
.right(Integer.toString(rubiesFound))
|
||||
.build());
|
||||
}
|
||||
panelComponent.setOrientation(ComponentOrientation.VERTICAL);
|
||||
panelComponent.getChildren().add(TitleComponent.builder().text("Gems found").build());
|
||||
if (diamondsFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Diamonds:")
|
||||
.right(Integer.toString(diamondsFound))
|
||||
.build());
|
||||
}
|
||||
|
||||
if (emeraldsFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Emeralds:")
|
||||
.right(Integer.toString(emeraldsFound))
|
||||
.build());
|
||||
}
|
||||
if (rubiesFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Rubies:")
|
||||
.right(Integer.toString(rubiesFound))
|
||||
.build());
|
||||
}
|
||||
|
||||
if (sapphiresFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Sapphires:")
|
||||
.right(Integer.toString(sapphiresFound))
|
||||
.build());
|
||||
if (emeraldsFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Emeralds:")
|
||||
.right(Integer.toString(emeraldsFound))
|
||||
.build());
|
||||
}
|
||||
|
||||
if (sapphiresFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Sapphires:")
|
||||
.right(Integer.toString(sapphiresFound))
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
return super.render(graphics);
|
||||
|
||||
@@ -27,8 +27,12 @@ package net.runelite.client.plugins.motherlode;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.ui.overlay.OverlayPanel;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.components.ComponentOrientation;
|
||||
import net.runelite.client.ui.overlay.components.ImageComponent;
|
||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||
|
||||
@@ -37,14 +41,16 @@ public class MotherlodeOreOverlay extends OverlayPanel
|
||||
private final MotherlodePlugin plugin;
|
||||
private final MotherlodeSession motherlodeSession;
|
||||
private final MotherlodeConfig config;
|
||||
private final ItemManager itemManager;
|
||||
|
||||
@Inject
|
||||
MotherlodeOreOverlay(MotherlodePlugin plugin, MotherlodeSession motherlodeSession, MotherlodeConfig config)
|
||||
MotherlodeOreOverlay(MotherlodePlugin plugin, MotherlodeSession motherlodeSession, MotherlodeConfig config, ItemManager itemManager)
|
||||
{
|
||||
setPosition(OverlayPosition.TOP_LEFT);
|
||||
this.plugin = plugin;
|
||||
this.motherlodeSession = motherlodeSession;
|
||||
this.config = config;
|
||||
this.itemManager = itemManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -71,56 +77,82 @@ public class MotherlodeOreOverlay extends OverlayPanel
|
||||
return null;
|
||||
}
|
||||
|
||||
panelComponent.getChildren().add(TitleComponent.builder().text("Ores found").build());
|
||||
|
||||
if (nuggetsFound > 0)
|
||||
if (config.showLootIcons())
|
||||
{
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Nuggets:")
|
||||
.right(Integer.toString(nuggetsFound))
|
||||
.build());
|
||||
panelComponent.setOrientation(ComponentOrientation.HORIZONTAL);
|
||||
if (nuggetsFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(new ImageComponent(itemManager.getImage(ItemID.GOLDEN_NUGGET, nuggetsFound, true)));
|
||||
}
|
||||
if (coalFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(new ImageComponent(itemManager.getImage(ItemID.COAL, coalFound, true)));
|
||||
}
|
||||
if (goldFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(new ImageComponent(itemManager.getImage(ItemID.GOLD_ORE, goldFound, true)));
|
||||
}
|
||||
if (mithrilFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(new ImageComponent(itemManager.getImage(ItemID.MITHRIL_ORE, mithrilFound, true)));
|
||||
}
|
||||
if (adamantiteFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(new ImageComponent(itemManager.getImage(ItemID.ADAMANTITE_ORE, adamantiteFound, true)));
|
||||
}
|
||||
if (runiteFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(new ImageComponent(itemManager.getImage(ItemID.RUNITE_ORE, runiteFound, true)));
|
||||
}
|
||||
}
|
||||
|
||||
if (coalFound > 0)
|
||||
else
|
||||
{
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Coal:")
|
||||
.right(Integer.toString(coalFound))
|
||||
.build());
|
||||
}
|
||||
|
||||
if (goldFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Gold:")
|
||||
.right(Integer.toString(goldFound))
|
||||
.build());
|
||||
}
|
||||
|
||||
if (mithrilFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Mithril:")
|
||||
.right(Integer.toString(mithrilFound))
|
||||
.build());
|
||||
}
|
||||
|
||||
if (adamantiteFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Adamantite:")
|
||||
.right(Integer.toString(adamantiteFound))
|
||||
.build());
|
||||
}
|
||||
|
||||
if (runiteFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Runite:")
|
||||
.right(Integer.toString(runiteFound))
|
||||
.build());
|
||||
panelComponent.setOrientation(ComponentOrientation.VERTICAL);
|
||||
panelComponent.getChildren().add(TitleComponent.builder().text("Ores found").build());
|
||||
if (nuggetsFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Nuggets:")
|
||||
.right(Integer.toString(nuggetsFound))
|
||||
.build());
|
||||
}
|
||||
if (coalFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Coal:")
|
||||
.right(Integer.toString(coalFound))
|
||||
.build());
|
||||
}
|
||||
if (goldFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Gold:")
|
||||
.right(Integer.toString(goldFound))
|
||||
.build());
|
||||
}
|
||||
if (mithrilFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Mithril:")
|
||||
.right(Integer.toString(mithrilFound))
|
||||
.build());
|
||||
}
|
||||
if (adamantiteFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Adamantite:")
|
||||
.right(Integer.toString(adamantiteFound))
|
||||
.build());
|
||||
}
|
||||
if (runiteFound > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Runite:")
|
||||
.right(Integer.toString(runiteFound))
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
return super.render(graphics);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user