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;
|
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.Duration;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
import net.runelite.api.ItemID;
|
||||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
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 static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||||
import net.runelite.client.ui.overlay.OverlayMenuEntry;
|
import net.runelite.client.ui.overlay.OverlayMenuEntry;
|
||||||
import net.runelite.client.ui.overlay.OverlayPanel;
|
import net.runelite.client.ui.overlay.OverlayPanel;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
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.LineComponent;
|
||||||
import net.runelite.client.ui.overlay.components.TitleComponent;
|
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||||
|
|
||||||
@@ -42,15 +46,17 @@ public class MotherlodeGemOverlay extends OverlayPanel
|
|||||||
private final MotherlodePlugin plugin;
|
private final MotherlodePlugin plugin;
|
||||||
private final MotherlodeSession motherlodeSession;
|
private final MotherlodeSession motherlodeSession;
|
||||||
private final MotherlodeConfig config;
|
private final MotherlodeConfig config;
|
||||||
|
private final ItemManager itemManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
MotherlodeGemOverlay(MotherlodePlugin plugin, MotherlodeSession motherlodeSession, MotherlodeConfig config)
|
MotherlodeGemOverlay(MotherlodePlugin plugin, MotherlodeSession motherlodeSession, MotherlodeConfig config, ItemManager itemManager)
|
||||||
{
|
{
|
||||||
super(plugin);
|
super(plugin);
|
||||||
setPosition(OverlayPosition.TOP_LEFT);
|
setPosition(OverlayPosition.TOP_LEFT);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.motherlodeSession = motherlodeSession;
|
this.motherlodeSession = motherlodeSession;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
this.itemManager = itemManager;
|
||||||
getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Gem overlay"));
|
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 emeraldsFound = session.getEmeraldsFound();
|
||||||
int sapphiresFound = session.getSapphiresFound();
|
int sapphiresFound = session.getSapphiresFound();
|
||||||
|
|
||||||
panelComponent.getChildren().add(TitleComponent.builder().text("Gems found").build());
|
if (config.showLootIcons())
|
||||||
|
|
||||||
if (diamondsFound > 0)
|
|
||||||
{
|
{
|
||||||
panelComponent.getChildren().add(LineComponent.builder()
|
panelComponent.setOrientation(ComponentOrientation.HORIZONTAL);
|
||||||
.left("Diamonds:")
|
if (diamondsFound > 0)
|
||||||
.right(Integer.toString(diamondsFound))
|
{
|
||||||
.build());
|
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)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (rubiesFound > 0)
|
|
||||||
{
|
{
|
||||||
panelComponent.getChildren().add(LineComponent.builder()
|
panelComponent.setOrientation(ComponentOrientation.VERTICAL);
|
||||||
.left("Rubies:")
|
panelComponent.getChildren().add(TitleComponent.builder().text("Gems found").build());
|
||||||
.right(Integer.toString(rubiesFound))
|
if (diamondsFound > 0)
|
||||||
.build());
|
{
|
||||||
}
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
|
.left("Diamonds:")
|
||||||
|
.right(Integer.toString(diamondsFound))
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
if (emeraldsFound > 0)
|
if (rubiesFound > 0)
|
||||||
{
|
{
|
||||||
panelComponent.getChildren().add(LineComponent.builder()
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
.left("Emeralds:")
|
.left("Rubies:")
|
||||||
.right(Integer.toString(emeraldsFound))
|
.right(Integer.toString(rubiesFound))
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sapphiresFound > 0)
|
if (emeraldsFound > 0)
|
||||||
{
|
{
|
||||||
panelComponent.getChildren().add(LineComponent.builder()
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
.left("Sapphires:")
|
.left("Emeralds:")
|
||||||
.right(Integer.toString(sapphiresFound))
|
.right(Integer.toString(emeraldsFound))
|
||||||
.build());
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sapphiresFound > 0)
|
||||||
|
{
|
||||||
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
|
.left("Sapphires:")
|
||||||
|
.right(Integer.toString(sapphiresFound))
|
||||||
|
.build());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.render(graphics);
|
return super.render(graphics);
|
||||||
|
|||||||
@@ -27,8 +27,12 @@ package net.runelite.client.plugins.motherlode;
|
|||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import javax.inject.Inject;
|
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.OverlayPanel;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
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.LineComponent;
|
||||||
import net.runelite.client.ui.overlay.components.TitleComponent;
|
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||||
|
|
||||||
@@ -37,14 +41,16 @@ public class MotherlodeOreOverlay extends OverlayPanel
|
|||||||
private final MotherlodePlugin plugin;
|
private final MotherlodePlugin plugin;
|
||||||
private final MotherlodeSession motherlodeSession;
|
private final MotherlodeSession motherlodeSession;
|
||||||
private final MotherlodeConfig config;
|
private final MotherlodeConfig config;
|
||||||
|
private final ItemManager itemManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
MotherlodeOreOverlay(MotherlodePlugin plugin, MotherlodeSession motherlodeSession, MotherlodeConfig config)
|
MotherlodeOreOverlay(MotherlodePlugin plugin, MotherlodeSession motherlodeSession, MotherlodeConfig config, ItemManager itemManager)
|
||||||
{
|
{
|
||||||
setPosition(OverlayPosition.TOP_LEFT);
|
setPosition(OverlayPosition.TOP_LEFT);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.motherlodeSession = motherlodeSession;
|
this.motherlodeSession = motherlodeSession;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
this.itemManager = itemManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -71,54 +77,80 @@ public class MotherlodeOreOverlay extends OverlayPanel
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
panelComponent.getChildren().add(TitleComponent.builder().text("Ores found").build());
|
if (config.showLootIcons())
|
||||||
|
|
||||||
if (nuggetsFound > 0)
|
|
||||||
{
|
{
|
||||||
panelComponent.getChildren().add(LineComponent.builder()
|
panelComponent.setOrientation(ComponentOrientation.HORIZONTAL);
|
||||||
.left("Nuggets:")
|
if (nuggetsFound > 0)
|
||||||
.right(Integer.toString(nuggetsFound))
|
{
|
||||||
.build());
|
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)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (coalFound > 0)
|
|
||||||
{
|
{
|
||||||
panelComponent.getChildren().add(LineComponent.builder()
|
panelComponent.setOrientation(ComponentOrientation.VERTICAL);
|
||||||
.left("Coal:")
|
panelComponent.getChildren().add(TitleComponent.builder().text("Ores found").build());
|
||||||
.right(Integer.toString(coalFound))
|
if (nuggetsFound > 0)
|
||||||
.build());
|
{
|
||||||
}
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
|
.left("Nuggets:")
|
||||||
if (goldFound > 0)
|
.right(Integer.toString(nuggetsFound))
|
||||||
{
|
.build());
|
||||||
panelComponent.getChildren().add(LineComponent.builder()
|
}
|
||||||
.left("Gold:")
|
if (coalFound > 0)
|
||||||
.right(Integer.toString(goldFound))
|
{
|
||||||
.build());
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
}
|
.left("Coal:")
|
||||||
|
.right(Integer.toString(coalFound))
|
||||||
if (mithrilFound > 0)
|
.build());
|
||||||
{
|
}
|
||||||
panelComponent.getChildren().add(LineComponent.builder()
|
if (goldFound > 0)
|
||||||
.left("Mithril:")
|
{
|
||||||
.right(Integer.toString(mithrilFound))
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
.build());
|
.left("Gold:")
|
||||||
}
|
.right(Integer.toString(goldFound))
|
||||||
|
.build());
|
||||||
if (adamantiteFound > 0)
|
}
|
||||||
{
|
if (mithrilFound > 0)
|
||||||
panelComponent.getChildren().add(LineComponent.builder()
|
{
|
||||||
.left("Adamantite:")
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
.right(Integer.toString(adamantiteFound))
|
.left("Mithril:")
|
||||||
.build());
|
.right(Integer.toString(mithrilFound))
|
||||||
}
|
.build());
|
||||||
|
}
|
||||||
if (runiteFound > 0)
|
if (adamantiteFound > 0)
|
||||||
{
|
{
|
||||||
panelComponent.getChildren().add(LineComponent.builder()
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
.left("Runite:")
|
.left("Adamantite:")
|
||||||
.right(Integer.toString(runiteFound))
|
.right(Integer.toString(adamantiteFound))
|
||||||
.build());
|
.build());
|
||||||
|
}
|
||||||
|
if (runiteFound > 0)
|
||||||
|
{
|
||||||
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
|
.left("Runite:")
|
||||||
|
.right(Integer.toString(runiteFound))
|
||||||
|
.build());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.render(graphics);
|
return super.render(graphics);
|
||||||
|
|||||||
Reference in New Issue
Block a user