From b36d10235b0c80d06387f4e0d58e04920c0741af Mon Sep 17 00:00:00 2001 From: Monsterxsync Date: Wed, 3 Oct 2018 19:06:24 +0100 Subject: [PATCH] Add default skill coloring to XP globe arcs Add skill coloring based on skill color to XP globe arcs. It is opt-out and to use custom colors this option needs to be disabled. Closes #2888 Closes #4591 Co-authored-by: psikoi --- .../plugins/xpglobes/XpGlobesConfig.java | 23 ++++++++++++++----- .../plugins/xpglobes/XpGlobesOverlay.java | 3 ++- .../client/plugins/xptracker/XpInfoBox.java | 3 ++- .../{plugins/xptracker => ui}/SkillColor.java | 12 ++++++++-- 4 files changed, 31 insertions(+), 10 deletions(-) rename runelite-client/src/main/java/net/runelite/client/{plugins/xptracker => ui}/SkillColor.java (89%) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesConfig.java index 84cbe21a84..960cc1b636 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesConfig.java @@ -54,11 +54,22 @@ public interface XpGlobesConfig extends Config return false; } + @ConfigItem( + keyName = "enableCustomArcColor", + name = "Enable custom arc color", + description = "Enables the custom coloring of the globe's arc instead of using the skill's default color.", + position = 2 + ) + default boolean enableCustomArcColor() + { + return false; + } + @ConfigItem( keyName = "Progress arc color", name = "Progress arc color", description = "Change the color of the progress arc in the xp orb", - position = 2 + position = 3 ) default Color progressArcColor() { @@ -69,7 +80,7 @@ public interface XpGlobesConfig extends Config keyName = "Progress orb outline color", name = "Progress orb outline color", description = "Change the color of the progress orb outline", - position = 3 + position = 4 ) default Color progressOrbOutLineColor() { @@ -80,7 +91,7 @@ public interface XpGlobesConfig extends Config keyName = "Progress orb background color", name = "Progress orb background color", description = "Change the color of the progress orb background", - position = 4 + position = 5 ) default Color progressOrbBackgroundColor() { @@ -91,7 +102,7 @@ public interface XpGlobesConfig extends Config keyName = "Progress arc width", name = "Progress arc width", description = "Change the stroke width of the progress arc", - position = 5 + position = 6 ) default int progressArcStrokeWidth() { @@ -102,7 +113,7 @@ public interface XpGlobesConfig extends Config keyName = "Orb size", name = "Size of orbs", description = "Change the size of the xp orbs", - position = 6 + position = 7 ) default int xpOrbSize() { @@ -113,7 +124,7 @@ public interface XpGlobesConfig extends Config keyName = "Orb duration", name = "Duration of orbs", description = "Change the duration the xp orbs are visible", - position = 7 + position = 8 ) default int xpOrbDuration() { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesOverlay.java index 097d1ab19f..004ec2b941 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xpglobes/XpGlobesOverlay.java @@ -42,6 +42,7 @@ import net.runelite.api.Experience; import net.runelite.api.Point; import net.runelite.client.game.SkillIconManager; import net.runelite.client.plugins.xptracker.XpTrackerService; +import net.runelite.client.ui.SkillColor; import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayPosition; import net.runelite.client.ui.overlay.components.LineComponent; @@ -124,7 +125,7 @@ public class XpGlobesOverlay extends Overlay config.xpOrbSize(), config.xpOrbSize(), PROGRESS_RADIUS_START, radiusCurrentXp, config.progressArcStrokeWidth(), - config.progressArcColor()); + config.enableCustomArcColor() ? config.progressArcColor() : SkillColor.find(skillToDraw.getSkill()).getColor()); graphics.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, renderHint); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java index 1fad3b45c7..cb638bccdf 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java @@ -46,6 +46,7 @@ import net.runelite.client.game.SkillIconManager; import net.runelite.client.ui.ColorScheme; import net.runelite.client.ui.DynamicGridLayout; import net.runelite.client.ui.FontManager; +import net.runelite.client.ui.SkillColor; import net.runelite.client.ui.components.ProgressBar; import net.runelite.client.util.ColorUtil; import net.runelite.client.util.LinkBrowser; @@ -152,7 +153,7 @@ class XpInfoBox extends JPanel progressBar.setMaximumValue(100); progressBar.setBackground(new Color(61, 56, 49)); - progressBar.setForeground(SkillColor.values()[skill.ordinal()].getColor()); + progressBar.setForeground(SkillColor.find(skill).getColor()); progressBar.setDimmedText("Paused"); progressWrapper.add(progressBar, BorderLayout.NORTH); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/SkillColor.java b/runelite-client/src/main/java/net/runelite/client/ui/SkillColor.java similarity index 89% rename from runelite-client/src/main/java/net/runelite/client/plugins/xptracker/SkillColor.java rename to runelite-client/src/main/java/net/runelite/client/ui/SkillColor.java index 9fc6e428b9..4ecd16d8ca 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/SkillColor.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/SkillColor.java @@ -22,12 +22,13 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package net.runelite.client.plugins.xptracker; +package net.runelite.client.ui; import java.awt.Color; import lombok.Getter; +import net.runelite.api.Skill; -enum SkillColor +public enum SkillColor { ATTACK(105, 32, 7), DEFENCE(98, 119, 190), @@ -61,4 +62,11 @@ enum SkillColor this.color = new Color(red, green, blue); } + /** + * Finds the corresponding SkillColor for a given Skill. + */ + public static SkillColor find(Skill skill) + { + return values()[skill.ordinal()]; + } } \ No newline at end of file