From 159c239908e844d9e22d2a32b67d450b6da5d0b2 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 13 Jun 2021 17:03:55 -0400 Subject: [PATCH] xp drops: add option to override standard client xp drop colors Co-authored-by: Zeusay --- .../plugins/experiencedrop/XpDropConfig.java | 17 ++++++++++++----- .../plugins/experiencedrop/XpDropPlugin.java | 18 ++++++++++++++---- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpDropConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpDropConfig.java index 568a656ae2..b3aaf7bc44 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpDropConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpDropConfig.java @@ -44,11 +44,19 @@ public interface XpDropConfig extends Config return false; } + @ConfigItem( + keyName = "standardColor", + name = "Standard Color", + description = "XP drop color when no prayer is active", + position = 1 + ) + Color standardColor(); + @ConfigItem( keyName = "meleePrayerColor", name = "Melee Prayer Color", description = "XP drop color when a melee prayer is active", - position = 1 + position = 2 ) default Color getMeleePrayerColor() { @@ -59,7 +67,7 @@ public interface XpDropConfig extends Config keyName = "rangePrayerColor", name = "Range Prayer Color", description = "XP drop color when a range prayer is active", - position = 2 + position = 3 ) default Color getRangePrayerColor() { @@ -70,7 +78,7 @@ public interface XpDropConfig extends Config keyName = "magePrayerColor", name = "Mage Prayer Color", description = "XP drop color when a mage prayer is active", - position = 3 + position = 4 ) default Color getMagePrayerColor() { @@ -81,12 +89,11 @@ public interface XpDropConfig extends Config keyName = "fakeXpDropDelay", name = "Fake Xp Drop delay", description = "Configures how many ticks should pass between fake XP drops, 0 to disable", - position = 4 + position = 5 ) @Units(Units.TICKS) default int fakeXpDropDelay() { return 0; } - } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpDropPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpDropPlugin.java index c3b9523f21..419c90b242 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpDropPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpDropPlugin.java @@ -25,6 +25,7 @@ package net.runelite.client.plugins.experiencedrop; import com.google.inject.Provides; +import java.awt.Color; import java.util.Arrays; import java.util.EnumMap; import java.util.Map; @@ -151,10 +152,19 @@ public class XpDropPlugin extends Plugin private void resetTextColor(Widget widget) { - EnumComposition colorEnum = client.getEnum(EnumID.XPDROP_COLORS); - int defaultColorId = client.getVar(Varbits.EXPERIENCE_DROP_COLOR); - int color = colorEnum.getIntValue(defaultColorId); - widget.setTextColor(color); + Color standardColor = config.standardColor(); + if (standardColor != null) + { + int color = standardColor.getRGB(); + widget.setTextColor(color); + } + else + { + EnumComposition colorEnum = client.getEnum(EnumID.XPDROP_COLORS); + int defaultColorId = client.getVar(Varbits.EXPERIENCE_DROP_COLOR); + int color = colorEnum.getIntValue(defaultColorId); + widget.setTextColor(color); + } } private void hideSkillIcons(Widget xpdrop)