mlm plugin: add option to recolor the icon on the vein being mined
This commit is contained in:
@@ -131,4 +131,15 @@ public interface MotherlodeConfig extends Config
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showTargetVein",
|
||||
name = "Show vein currently being mined",
|
||||
description = "Highlights the vein currently being mined"
|
||||
)
|
||||
default boolean showTargetVein()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -182,6 +182,7 @@ public class MotherlodePlugin extends Plugin
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean isMining;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private WorldPoint targetVeinLocation = null;
|
||||
private boolean playerHasReachedTargetVein;
|
||||
private int lastAnimation = AnimationID.IDLE;
|
||||
|
||||
@@ -40,11 +40,13 @@ import net.runelite.api.Point;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.api.WallObject;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.client.game.SkillIconManager;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
|
||||
class MotherlodeRocksOverlay extends Overlay
|
||||
{
|
||||
@@ -55,6 +57,9 @@ class MotherlodeRocksOverlay extends Overlay
|
||||
private final MotherlodeConfig config;
|
||||
|
||||
private final BufferedImage miningIcon;
|
||||
private final BufferedImage targetMiningIcon;
|
||||
private static final Color miningIconOldColor = new Color(117, 123, 124);
|
||||
private static final Color miningIconNewColor = new Color(0, 150, 0);
|
||||
|
||||
@Inject
|
||||
MotherlodeRocksOverlay(Client client, MotherlodePlugin plugin, MotherlodeConfig config, SkillIconManager iconManager)
|
||||
@@ -66,6 +71,7 @@ class MotherlodeRocksOverlay extends Overlay
|
||||
this.config = config;
|
||||
|
||||
miningIcon = iconManager.getSkillImage(Skill.MINING);
|
||||
targetMiningIcon = ImageUtil.recolorImage(miningIcon, miningIconNewColor, Color -> Color.getRGB() == miningIconOldColor.getRGB());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,7 +92,6 @@ class MotherlodeRocksOverlay extends Overlay
|
||||
private void renderTiles(Graphics2D graphics, Player local)
|
||||
{
|
||||
LocalPoint localLocation = local.getLocalLocation();
|
||||
|
||||
if (config.showVeins())
|
||||
{
|
||||
for (WallObject vein : plugin.getVeins())
|
||||
@@ -97,7 +102,16 @@ class MotherlodeRocksOverlay extends Overlay
|
||||
// Only draw veins on the same level
|
||||
if (plugin.isUpstairs(localLocation) == plugin.isUpstairs(vein.getLocalLocation()))
|
||||
{
|
||||
renderVein(graphics, vein);
|
||||
if (WorldPoint.fromLocal(client, location).equals(plugin.getTargetVeinLocation())
|
||||
&& plugin.isMining()
|
||||
&& config.showTargetVein())
|
||||
{
|
||||
renderVein(graphics, vein, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
renderVein(graphics, vein, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -114,17 +128,20 @@ class MotherlodeRocksOverlay extends Overlay
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void renderVein(Graphics2D graphics, WallObject vein)
|
||||
private void renderVein(Graphics2D graphics, WallObject vein, Boolean shouldRecolor)
|
||||
{
|
||||
Point canvasLoc = Perspective.getCanvasImageLocation(client, vein.getLocalLocation(), miningIcon, 150);
|
||||
|
||||
if (canvasLoc != null)
|
||||
if (canvasLoc != null && !shouldRecolor)
|
||||
{
|
||||
graphics.drawImage(miningIcon, canvasLoc.getX(), canvasLoc.getY(), null);
|
||||
}
|
||||
else if (canvasLoc != null)
|
||||
{
|
||||
graphics.drawImage(targetMiningIcon, canvasLoc.getX(), canvasLoc.getY(), null);
|
||||
}
|
||||
}
|
||||
|
||||
private void renderRock(Graphics2D graphics, GameObject rock)
|
||||
|
||||
Reference in New Issue
Block a user