From 1633c93aa1a51cb170023c9edb5f4b1fc41ac7b3 Mon Sep 17 00:00:00 2001 From: MackBryan Date: Tue, 4 Sep 2018 16:44:54 -0700 Subject: [PATCH 1/8] Added hotkey setting in raidsconfig --- .../runelite/client/plugins/raids/RaidsConfig.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java index 18dd050f81..048546f1da 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java @@ -27,6 +27,7 @@ package net.runelite.client.plugins.raids; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; +import net.runelite.client.config.Keybind; @ConfigGroup("raids") public interface RaidsConfig extends Config @@ -151,4 +152,16 @@ public interface RaidsConfig extends Config { return ""; } + + @ConfigItem( + keyName = "hotkey", + name = "Disable/Enable scout overlay hotkey", + description = "When you press this key the scout overlay will be hidden/displayed.", + position = 11 + ) + default Keybind hotkey() + { + return Keybind.NOT_SET; + } + } From 8cf4b06079b3952d0a46f3cbb55bc799f79aca68 Mon Sep 17 00:00:00 2001 From: MackBryan Date: Tue, 4 Sep 2018 17:24:32 -0700 Subject: [PATCH 2/8] Added getter for scoutOverlayShown var in RaidsOverlay --- .../java/net/runelite/client/plugins/raids/RaidsOverlay.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java index 682cacab69..c5236662a4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java @@ -29,6 +29,7 @@ import java.awt.Dimension; import java.awt.Graphics2D; import javax.inject.Inject; import lombok.Setter; +import lombok.Getter; import net.runelite.client.plugins.raids.solver.Room; import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayPosition; @@ -43,7 +44,7 @@ public class RaidsOverlay extends Overlay private RaidsConfig config; private final PanelComponent panelComponent = new PanelComponent(); - @Setter + @Getter @Setter private boolean scoutOverlayShown = false; @Inject From 942f0887c59b289cd433f5d97ed0688985d1386a Mon Sep 17 00:00:00 2001 From: MackBryan Date: Tue, 4 Sep 2018 18:08:04 -0700 Subject: [PATCH 3/8] Cleaned up config and description --- .../client/plugins/raids/RaidsConfig.java | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java index 048546f1da..380fefd320 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java @@ -87,8 +87,19 @@ public interface RaidsConfig extends Config return false; } + @ConfigItem( + keyName = "hotkey", + name = "Scout overlay hotkey", + description = "When pressed the scout overlay will be toggled. Must enable show scout overlay in raid", + position = 5 + ) + default Keybind hotkey() + { + return Keybind.NOT_SET; + } + @ConfigItem( - position = 5, + position = 6, keyName = "whitelistedRooms", name = "Whitelisted rooms", description = "Display whitelisted rooms in green on the overlay. Separate with comma (full name)" @@ -99,7 +110,7 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 6, + position = 7, keyName = "blacklistedRooms", name = "Blacklisted rooms", description = "Display blacklisted rooms in red on the overlay. Separate with comma (full name)" @@ -110,7 +121,7 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 7, + position = 8, keyName = "enableRotationWhitelist", name = "Enable rotation whitelist", description = "Enable the rotation whitelist" @@ -121,7 +132,7 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 8, + position = 9, keyName = "whitelistedRotations", name = "Whitelisted rotations", description = "Warn when boss rotation doesn't match a whitelisted one. Add rotations like [tekton, muttadile, guardians]" @@ -132,7 +143,7 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 9, + position = 10, keyName = "enableLayoutWhitelist", name = "Enable layout whitelist", description = "Enable the layout whitelist" @@ -143,7 +154,7 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 10, + position = 11, keyName = "whitelistedLayouts", name = "Whitelisted layouts", description = "Warn when layout doesn't match a whitelisted one. Add layouts like CFSCPPCSCF separated with comma" @@ -152,16 +163,4 @@ public interface RaidsConfig extends Config { return ""; } - - @ConfigItem( - keyName = "hotkey", - name = "Disable/Enable scout overlay hotkey", - description = "When you press this key the scout overlay will be hidden/displayed.", - position = 11 - ) - default Keybind hotkey() - { - return Keybind.NOT_SET; - } - } From d18cabb9725e3ff3ba7cdfad0322887a14439b22 Mon Sep 17 00:00:00 2001 From: MackBryan Date: Tue, 4 Sep 2018 18:14:05 -0700 Subject: [PATCH 4/8] Implemented hotkey functionality for disabling/enabling the scout overlay. --- .../client/plugins/raids/RaidsPlugin.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java index 1a96b63d8a..6724c644dc 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java @@ -59,6 +59,7 @@ import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.QueuedMessage; import net.runelite.client.config.ConfigManager; import net.runelite.client.game.SpriteManager; +import net.runelite.client.input.KeyManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.raids.solver.Layout; @@ -66,6 +67,7 @@ import net.runelite.client.plugins.raids.solver.LayoutSolver; import net.runelite.client.plugins.raids.solver.RotationSolver; import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.infobox.InfoBoxManager; +import net.runelite.client.util.HotkeyListener; import net.runelite.client.util.Text; @PluginDescriptor( @@ -109,6 +111,9 @@ public class RaidsPlugin extends Plugin @Inject private LayoutSolver layoutSolver; + @Inject + private KeyManager keyManager; + @Inject private SpriteManager spriteManager; @@ -130,6 +135,8 @@ public class RaidsPlugin extends Plugin @Getter private boolean inRaidChambers; + private boolean raidStarted; + private RaidsTimer timer; @Provides @@ -149,6 +156,7 @@ public class RaidsPlugin extends Plugin { overlayManager.add(overlay); overlayManager.add(pointsOverlay); + keyManager.registerKeyListener(hotkeyListener); updateLists(); checkRaidPresence(true); } @@ -159,7 +167,9 @@ public class RaidsPlugin extends Plugin overlayManager.remove(overlay); overlayManager.remove(pointsOverlay); infoBoxManager.removeInfoBox(timer); + keyManager.unregisterKeyListener(hotkeyListener); inRaidChambers = false; + raidStarted = false; raid = null; timer = null; } @@ -215,6 +225,7 @@ public class RaidsPlugin extends Plugin { timer = new RaidsTimer(spriteManager.getSprite(TAB_QUESTS_BROWN_RAIDING_PARTY, 0), this, Instant.now()); infoBoxManager.addInfoBox(timer); + raidStarted = true; } if (timer != null && message.contains(LEVEL_COMPLETE_MESSAGE)) @@ -309,6 +320,7 @@ public class RaidsPlugin extends Plugin if (client.getVar(VarPlayer.IN_RAID_PARTY) == -1 && (!inRaidChambers || !config.scoutOverlayInRaid())) { overlay.setScoutOverlayShown(false); + raidStarted = false; } } @@ -599,4 +611,24 @@ public class RaidsPlugin extends Plugin return room; } + + private final HotkeyListener hotkeyListener = new HotkeyListener(() -> config.hotkey()) + { + @Override + public void hotkeyPressed() + { + if(config.scoutOverlayInRaid() && raidStarted) + { + if(overlay.isScoutOverlayShown()) + { + overlay.setScoutOverlayShown(false); + } + else + { + overlay.setScoutOverlayShown(true); + } + } + } + }; + } From 41d1ee7c51cc1d44aa733467791c029a3acd0b9a Mon Sep 17 00:00:00 2001 From: MackBryan Date: Tue, 4 Sep 2018 18:56:06 -0700 Subject: [PATCH 5/8] Test ci --- .../java/net/runelite/client/plugins/raids/RaidsConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java index 380fefd320..39fcc1311e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java @@ -89,7 +89,7 @@ public interface RaidsConfig extends Config @ConfigItem( keyName = "hotkey", - name = "Scout overlay hotkey", + name = "Toggle scout overlay", description = "When pressed the scout overlay will be toggled. Must enable show scout overlay in raid", position = 5 ) From eccab3b535263a6938c34de26682161fe53b64d3 Mon Sep 17 00:00:00 2001 From: MackBryan Date: Tue, 4 Sep 2018 19:03:56 -0700 Subject: [PATCH 6/8] Checkstyle fix --- .../client/plugins/raids/RaidsConfig.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java index 39fcc1311e..41eb01e893 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java @@ -87,16 +87,15 @@ public interface RaidsConfig extends Config return false; } - @ConfigItem( - keyName = "hotkey", - name = "Toggle scout overlay", - description = "When pressed the scout overlay will be toggled. Must enable show scout overlay in raid", - position = 5 - ) - default Keybind hotkey() - { - return Keybind.NOT_SET; - } + @ConfigItem( + keyName = "hotkey", name = "Toggle scout overlay", + description = "When pressed the scout overlay will be toggled. Must enable show scout overlay in raid", + position = 5 + ) + default Keybind hotkey() + { + return Keybind.NOT_SET; + } @ConfigItem( position = 6, From 578881a03a50940822fa0a423c4d7a6ef8bfe3dc Mon Sep 17 00:00:00 2001 From: MackBryan Date: Tue, 4 Sep 2018 19:04:47 -0700 Subject: [PATCH 7/8] Checkstyle fix --- .../java/net/runelite/client/plugins/raids/RaidsPlugin.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java index 6724c644dc..2cc16a4ca0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java @@ -617,9 +617,9 @@ public class RaidsPlugin extends Plugin @Override public void hotkeyPressed() { - if(config.scoutOverlayInRaid() && raidStarted) + if (config.scoutOverlayInRaid() && raidStarted) { - if(overlay.isScoutOverlayShown()) + if (overlay.isScoutOverlayShown()) { overlay.setScoutOverlayShown(false); } From b2d7cbbe44cec5bdd6f6fba95123d105f951e128 Mon Sep 17 00:00:00 2001 From: MackBryan Date: Tue, 4 Sep 2018 19:13:23 -0700 Subject: [PATCH 8/8] Checkstyle fix --- .../java/net/runelite/client/plugins/raids/RaidsPlugin.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java index 2cc16a4ca0..768f193db8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java @@ -135,7 +135,7 @@ public class RaidsPlugin extends Plugin @Getter private boolean inRaidChambers; - private boolean raidStarted; + private boolean raidStarted; private RaidsTimer timer; @@ -320,7 +320,7 @@ public class RaidsPlugin extends Plugin if (client.getVar(VarPlayer.IN_RAID_PARTY) == -1 && (!inRaidChambers || !config.scoutOverlayInRaid())) { overlay.setScoutOverlayShown(false); - raidStarted = false; + raidStarted = false; } }