From bbdf76a0b64c4a7dbcd36747d09806bbb088600e Mon Sep 17 00:00:00 2001 From: Alexsuperfly Date: Tue, 26 Nov 2019 20:20:43 -0500 Subject: [PATCH] Raids: Add clan chat and world to scouting overlay --- .../client/plugins/raids/RaidsConfig.java | 23 ++++++++++++----- .../client/plugins/raids/RaidsOverlay.java | 25 +++++++++++++++++++ 2 files changed, 42 insertions(+), 6 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 9d6fd5d8c3..24e4794ffa 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 @@ -88,6 +88,17 @@ public interface RaidsConfig extends Config @ConfigItem( position = 5, + keyName = "ccDisplay", + name = "CC and World in scout overlay", + description = "Display current Clan Chat and World in scouting overlay" + ) + default boolean ccDisplay() + { + return false; + } + + @ConfigItem( + position = 6, keyName = "whitelistedRooms", name = "Whitelisted rooms", description = "Display whitelisted rooms in green on the overlay. Separate with comma (full name)" @@ -98,7 +109,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)" @@ -109,7 +120,7 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 7, + position = 8, keyName = "enableRotationWhitelist", name = "Enable rotation whitelist", description = "Enable the rotation whitelist" @@ -120,7 +131,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, muttadiles, guardians - each rotation on its own line" @@ -131,7 +142,7 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 9, + position = 10, keyName = "enableLayoutWhitelist", name = "Enable layout whitelist", description = "Enable the layout whitelist" @@ -142,7 +153,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" @@ -153,7 +164,7 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 11, + position = 12, keyName = "layoutMessage", name = "Send raid layout message when entering raid", description = "Sends game message with raid layout on entering new raid" 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 d9fd379f5c..ea45cad829 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 @@ -26,9 +26,11 @@ package net.runelite.client.plugins.raids; import java.awt.Color; import java.awt.Dimension; +import java.awt.FontMetrics; import java.awt.Graphics2D; import javax.inject.Inject; import lombok.Setter; +import net.runelite.api.ClanMemberManager; import net.runelite.api.Client; import static net.runelite.api.MenuAction.RUNELITE_OVERLAY; import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG; @@ -38,6 +40,7 @@ import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE; import net.runelite.client.ui.overlay.OverlayMenuEntry; import net.runelite.client.ui.overlay.OverlayPosition; import net.runelite.client.ui.overlay.OverlayPriority; +import net.runelite.client.ui.overlay.components.ComponentConstants; import net.runelite.client.ui.overlay.components.LineComponent; import net.runelite.client.ui.overlay.components.PanelComponent; import net.runelite.client.ui.overlay.components.TitleComponent; @@ -101,6 +104,28 @@ public class RaidsOverlay extends Overlay .color(color) .build()); + if (config.ccDisplay()) + { + color = Color.RED; + ClanMemberManager clanMemberManager = client.getClanMemberManager(); + FontMetrics metrics = graphics.getFontMetrics(); + String worldString = "W" + client.getWorld(); + String clanOwner = "Join a CC"; + if (clanMemberManager != null) + { + clanOwner = clanMemberManager.getClanOwner(); + color = Color.ORANGE; + } + + panelComponent.setPreferredSize(new Dimension(Math.max(ComponentConstants.STANDARD_WIDTH, metrics.stringWidth(worldString) + metrics.stringWidth(clanOwner) + 14), 0)); + panelComponent.getChildren().add(LineComponent.builder() + .left(worldString) + .right(clanOwner) + .leftColor(Color.ORANGE) + .rightColor(color) + .build()); + } + for (Room layoutRoom : plugin.getRaid().getLayout().getRooms()) { int position = layoutRoom.getPosition();