Add config options to customize colors

This commit is contained in:
Patrick
2023-08-15 00:34:20 +04:00
parent 63a3cb52b1
commit f7ab23f07c
3 changed files with 116 additions and 18 deletions

View File

@@ -1,9 +1,11 @@
package com.toofifty.easygiantsfoundry;
import java.awt.Color;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.ConfigSection;
import net.runelite.client.ui.ColorScheme;
@ConfigGroup(EasyGiantsFoundryConfig.GROUP)
public interface EasyGiantsFoundryConfig extends Config {
@@ -162,7 +164,7 @@ public interface EasyGiantsFoundryConfig extends Config {
@ConfigSection(
name = "Info Panel",
description = "Settings for the Info Panel overlay",
position = 1
position = 2
)
String infoPanelList = "infoPanelList";
@@ -232,4 +234,97 @@ public interface EasyGiantsFoundryConfig extends Config {
{
return false;
}
@ConfigSection(
name = "Colour",
description = "Colours",
position = 3
)
String colourList = "colourList";
@ConfigItem(
keyName = "mouldText",
name = "Mould Text",
description = "Colour for optimal mould text",
position = 0,
section = colourList
)
default Color mouldTextColour()
{
return new Color(0xdc10d);
}
@ConfigItem(
keyName = "generalColour",
name = "General",
description = "Colour for highlighting objects/npcs in general",
position = 1,
section = colourList
)
default Color generalHighlight()
{
return Color.CYAN;
}
@ConfigItem(
keyName = "lavaWaterColour",
name = "Lava/Waterfall",
description = "Colour for highlighting lava/waterfall",
position = 2,
section = colourList
)
default Color lavaWaterfallColour()
{
return ColorScheme.PROGRESS_COMPLETE_COLOR;
}
@ConfigItem(
keyName = "toolGood",
name = "Tool Good",
description = "Colour for highlighting current tool when they are usable",
position = 3,
section = colourList
)
default Color toolGood()
{
return ColorScheme.PROGRESS_COMPLETE_COLOR;
}
@ConfigItem(
keyName = "toolBad",
name = "Tool Bad",
description = "Colour for highlighting current tool when they are not usable",
position = 4,
section = colourList
)
default Color toolBad()
{
return ColorScheme.PROGRESS_ERROR_COLOR;
}
@ConfigItem(
keyName = "toolCaution",
name = "Tool Caution",
description = "Colour for highlighting current tool when they are about to be not usable",
position = 5,
section = colourList
)
default Color toolCaution()
{
return ColorScheme.PROGRESS_INPROGRESS_COLOR;
}
@ConfigItem(
keyName = "toolBonus",
name = "Tool Bonus",
description = "Colour for highlighting current tool when they have a bonus to click on",
position = 6,
section = colourList
)
default Color toolBonus()
{
return Color.CYAN;
}
}

View File

@@ -2,18 +2,19 @@ package com.toofifty.easygiantsfoundry;
import com.toofifty.easygiantsfoundry.enums.Heat;
import com.toofifty.easygiantsfoundry.enums.Stage;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Shape;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.GameObject;
import net.runelite.api.NPC;
import net.runelite.api.Point;
import net.runelite.api.widgets.Widget;
import net.runelite.client.ui.ColorScheme;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayPosition;
import javax.inject.Inject;
import java.awt.*;
public class FoundryOverlay3D extends Overlay {
private static final int HAND_IN_WIDGET = 49414221;
@@ -47,22 +48,22 @@ public class FoundryOverlay3D extends Overlay {
{
if (stage.getHeat() != heat)
{
return ColorScheme.PROGRESS_ERROR_COLOR;
return config.toolBad();
}
if (BonusWidget.isActive(client))
{
return Color.CYAN;
return config.toolBonus();
}
int actionsLeft = helper.getActionsLeftInStage();
int heatLeft = helper.getActionsForHeatLevel();
if (actionsLeft <= 1 || heatLeft <= 1)
{
return ColorScheme.PROGRESS_INPROGRESS_COLOR;
return config.toolCaution();
}
return ColorScheme.PROGRESS_COMPLETE_COLOR;
return config.toolGood();
}
private GameObject getStageObject(Stage stage)
@@ -153,7 +154,7 @@ public class FoundryOverlay3D extends Overlay {
if (shape != null)
{
Point mousePosition = client.getMouseCanvasPosition();
Color color = ColorScheme.PROGRESS_COMPLETE_COLOR;
Color color = config.lavaWaterfallColour();
if (shape.contains(mousePosition.getX(), mousePosition.getY()))
{
graphics.setColor(color.darker());
@@ -181,7 +182,7 @@ public class FoundryOverlay3D extends Overlay {
Shape shape = crucible.getConvexHull();
if (shape != null)
{
Color color = Color.CYAN;
Color color = config.generalHighlight();
graphics.setColor(color);
graphics.draw(shape);
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20));
@@ -201,7 +202,7 @@ public class FoundryOverlay3D extends Overlay {
Shape shape = mouldJig.getConvexHull();
if (shape != null)
{
Color color = Color.CYAN;
Color color = config.generalHighlight();
graphics.setColor(color);
graphics.draw(shape);
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20));
@@ -217,7 +218,7 @@ public class FoundryOverlay3D extends Overlay {
Shape shape = kovac.getConvexHull();
if (shape != null)
{
Color color = Color.CYAN;
Color color = config.generalHighlight();
graphics.setColor(color);
graphics.draw(shape);
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20));

View File

@@ -2,15 +2,14 @@ package com.toofifty.easygiantsfoundry;
import com.toofifty.easygiantsfoundry.enums.CommissionType;
import com.toofifty.easygiantsfoundry.enums.Mould;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.ScriptID;
import net.runelite.api.widgets.Widget;
import net.runelite.client.callback.ClientThread;
import javax.inject.Inject;
import java.util.LinkedHashMap;
import java.util.Map;
public class MouldHelper
{
static final int MOULD_LIST_PARENT = 47054857;
@@ -29,6 +28,9 @@ public class MouldHelper
@Inject
private ClientThread clientThread;
@Inject
private EasyGiantsFoundryConfig config;
public void selectBest(int scriptId)
{
Widget parent = client.getWidget(MOULD_LIST_PARENT);
@@ -52,7 +54,7 @@ public class MouldHelper
}
}
if (bestWidget != null) {
bestWidget.setTextColor(GREEN);
bestWidget.setTextColor(config.mouldTextColour().getRGB());
}
if (scriptId == DRAW_MOULD_LIST_SCRIPT || scriptId == REDRAW_MOULD_LIST_SCRIPT)