From dd84156dfcee48566664e19bd31eb37632dcff93 Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Tue, 29 Jan 2019 16:24:05 -0800 Subject: [PATCH 01/11] perspective: Allow empty text for getCanvasTextLocation This is particularly useful for aligning text to a certain point such that it would not be centered on that point, such as left or right alignment. --- runelite-api/src/main/java/net/runelite/api/Perspective.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Perspective.java b/runelite-api/src/main/java/net/runelite/api/Perspective.java index 99116b7714..a0e2297ab9 100644 --- a/runelite-api/src/main/java/net/runelite/api/Perspective.java +++ b/runelite-api/src/main/java/net/runelite/api/Perspective.java @@ -379,7 +379,7 @@ public class Perspective @Nullable String text, int zOffset) { - if (text == null || "".equals(text)) + if (text == null) { return null; } From 201788847a8420086cbb7bc9e0467edb3fe4f6e2 Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Tue, 29 Jan 2019 16:23:22 -0800 Subject: [PATCH 02/11] actor: Mark getCanvasTextLocation as Nullable --- runelite-api/src/main/java/net/runelite/api/Actor.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/Actor.java b/runelite-api/src/main/java/net/runelite/api/Actor.java index ce72ceafcb..14763d51a1 100644 --- a/runelite-api/src/main/java/net/runelite/api/Actor.java +++ b/runelite-api/src/main/java/net/runelite/api/Actor.java @@ -27,6 +27,7 @@ package net.runelite.api; import java.awt.Graphics2D; import java.awt.Polygon; import java.awt.image.BufferedImage; +import javax.annotation.Nullable; import net.runelite.api.annotations.VisibleForDevtools; import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.WorldArea; @@ -175,6 +176,7 @@ public interface Actor extends Renderable * @param zOffset the z-axis offset * @return the text drawing location */ + @Nullable Point getCanvasTextLocation(Graphics2D graphics, String text, int zOffset); /** From eb7ebddec389866d72400f0984603a3ef4cd7c2e Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Tue, 29 Jan 2019 16:27:15 -0800 Subject: [PATCH 03/11] player indicators: Add name position configuration This allows players to select from a number of positions where they would like highlighted player's names to be drawn relative to the player's model. Closes runelite/runelite#878 --- .../PlayerIndicatorsConfig.java | 10 +- .../PlayerIndicatorsOverlay.java | 94 ++++++++++++++----- .../playerindicators/PlayerNameLocation.java | 45 +++++++++ 3 files changed, 119 insertions(+), 30 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerNameLocation.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsConfig.java index c40d4a9020..6b032bc8ee 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsConfig.java @@ -155,13 +155,13 @@ public interface PlayerIndicatorsConfig extends Config @ConfigItem( position = 11, - keyName = "drawOverheadPlayerNames", - name = "Draw names above players", - description = "Configures whether or not player names should be drawn above players" + keyName = "playerNamePosition", + name = "Name position", + description = "Configures the position of drawn player names, or if they should be disabled" ) - default boolean drawOverheadPlayerNames() + default PlayerNameLocation playerNamePosition() { - return true; + return PlayerNameLocation.ABOVE_HEAD; } @ConfigItem( diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsOverlay.java index 3795b89f1c..5373fc1eb4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsOverlay.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2018, Tomas Slusny + * Copyright (c) 2019, Jordan Atwood * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,10 +39,14 @@ import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayPosition; import net.runelite.client.ui.overlay.OverlayPriority; import net.runelite.client.ui.overlay.OverlayUtil; +import net.runelite.client.util.Text; @Singleton public class PlayerIndicatorsOverlay extends Overlay { + private static final int ACTOR_OVERHEAD_TEXT_MARGIN = 40; + private static final int ACTOR_HORIZONTAL_TEXT_MARGIN = 10; + private final PlayerIndicatorsService playerIndicatorsService; private final PlayerIndicatorsConfig config; private final ClanManager clanManager; @@ -66,39 +71,78 @@ public class PlayerIndicatorsOverlay extends Overlay private void renderPlayerOverlay(Graphics2D graphics, Player actor, Color color) { - if (!config.drawOverheadPlayerNames()) + final PlayerNameLocation drawPlayerNamesConfig = config.playerNamePosition(); + if (drawPlayerNamesConfig == PlayerNameLocation.DISABLED) { return; } - String name = actor.getName().replace('\u00A0', ' '); - int offset = actor.getLogicalHeight() + 40; - Point textLocation = actor.getCanvasTextLocation(graphics, name, offset); - - if (textLocation != null) + final int zOffset; + switch (drawPlayerNamesConfig) { - if (config.showClanRanks() && actor.isClanMember()) + case MODEL_CENTER: + case MODEL_RIGHT: + zOffset = actor.getLogicalHeight() / 2; + break; + default: + zOffset = actor.getLogicalHeight() + ACTOR_OVERHEAD_TEXT_MARGIN; + } + + final String name = Text.sanitize(actor.getName()); + Point textLocation = actor.getCanvasTextLocation(graphics, name, zOffset); + + if (drawPlayerNamesConfig == PlayerNameLocation.MODEL_RIGHT) + { + textLocation = actor.getCanvasTextLocation(graphics, "", zOffset); + + if (textLocation == null) { - ClanMemberRank rank = clanManager.getRank(name); - - if (rank != ClanMemberRank.UNRANKED) - { - BufferedImage clanchatImage = clanManager.getClanImage(rank); - - if (clanchatImage != null) - { - int width = clanchatImage.getWidth(); - int textHeight = graphics.getFontMetrics().getHeight() - graphics.getFontMetrics().getMaxDescent(); - Point imageLocation = new Point(textLocation.getX() - width / 2 - 1, textLocation.getY() - textHeight / 2 - clanchatImage.getHeight() / 2); - OverlayUtil.renderImageLocation(graphics, imageLocation, clanchatImage); - - // move text - textLocation = new Point(textLocation.getX() + width / 2, textLocation.getY()); - } - } + return; } - OverlayUtil.renderTextLocation(graphics, textLocation, name, color); + textLocation = new Point(textLocation.getX() + ACTOR_HORIZONTAL_TEXT_MARGIN, textLocation.getY()); } + + if (textLocation == null) + { + return; + } + + if (config.showClanRanks() && actor.isClanMember()) + { + final ClanMemberRank rank = clanManager.getRank(name); + + if (rank != ClanMemberRank.UNRANKED) + { + final BufferedImage clanchatImage = clanManager.getClanImage(rank); + + if (clanchatImage != null) + { + final int clanImageWidth = clanchatImage.getWidth(); + final int clanImageTextMargin; + final int clanImageNegativeMargin; + + if (drawPlayerNamesConfig == PlayerNameLocation.MODEL_RIGHT) + { + clanImageTextMargin = clanImageWidth; + clanImageNegativeMargin = 0; + } + else + { + clanImageTextMargin = clanImageWidth / 2; + clanImageNegativeMargin = clanImageWidth / 2; + } + + final int textHeight = graphics.getFontMetrics().getHeight() - graphics.getFontMetrics().getMaxDescent(); + final Point imageLocation = new Point(textLocation.getX() - clanImageNegativeMargin - 1, textLocation.getY() - textHeight / 2 - clanchatImage.getHeight() / 2); + OverlayUtil.renderImageLocation(graphics, imageLocation, clanchatImage); + + // move text + textLocation = new Point(textLocation.getX() + clanImageTextMargin, textLocation.getY()); + } + } + } + + OverlayUtil.renderTextLocation(graphics, textLocation, name, color); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerNameLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerNameLocation.java new file mode 100644 index 0000000000..14a4eff208 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerNameLocation.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2019, Jordan Atwood + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (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.playerindicators; + +import lombok.AllArgsConstructor; + +@AllArgsConstructor +public enum PlayerNameLocation +{ + + DISABLED("Disabled"), + ABOVE_HEAD("Above head"), + MODEL_CENTER("Center of model"), + MODEL_RIGHT("Right of model"); + + private final String name; + + @Override + public String toString() + { + return name; + } +} From b99c8d748083ebfbf8eecc7e399ce9a0d29d5aaf Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Sun, 10 Feb 2019 14:22:08 +0100 Subject: [PATCH 04/11] Clear Cerberus ghost on LOADING game state When leaving the are with cerberus ghosts player will not receive despawn events for them and so they will be stuck (they are just GCed later instead). This solves the issue and goes in line with rest of logic we have that relies on spawn/despawn events. Signed-off-by: Tomas Slusny --- .../net/runelite/client/plugins/cerberus/CerberusPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java index 2087e31844..322e8c38cd 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cerberus/CerberusPlugin.java @@ -75,7 +75,7 @@ public class CerberusPlugin extends Plugin @Subscribe public void onGameStateChanged(GameStateChanged event) { - if (event.getGameState() == GameState.LOGIN_SCREEN || event.getGameState() == GameState.HOPPING) + if (event.getGameState() == GameState.LOADING) { ghosts.clear(); } From fb6012dbfda3fe755a913de01222f627c1c2b380 Mon Sep 17 00:00:00 2001 From: Kalle Date: Sun, 10 Feb 2019 16:30:29 +0200 Subject: [PATCH 05/11] World Map: Fix Ape Atoll tree type --- .../net/runelite/client/plugins/worldmap/RareTreeLocation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java index 69eaedcddc..ca30b23271 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/RareTreeLocation.java @@ -38,7 +38,6 @@ enum RareTreeLocation TEAK("Teak tree", 35, // Ape Atoll new WorldPoint(2774, 2697, 0), - new WorldPoint(2716, 2710, 0), // Desert new WorldPoint(3510, 3073, 0), @@ -85,6 +84,7 @@ enum RareTreeLocation new WorldPoint(1237, 3770, 0), // Ape Atoll + new WorldPoint(2716, 2710, 0), new WorldPoint(2725, 2735, 0), // Mos Le'Harmless From 79feaad931833cc3ed086ab26a971bb4ef7cf3a7 Mon Sep 17 00:00:00 2001 From: Lucas Date: Mon, 11 Feb 2019 05:41:42 +0100 Subject: [PATCH 06/11] Add kebos swamp cryptic clue --- .../runelite/client/plugins/cluescrolls/clues/CrypticClue.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java index 200a223aa3..b4d5b46391 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java @@ -301,7 +301,8 @@ public class CrypticClue extends ClueScroll implements TextClueScroll, NpcClueSc new CrypticClue("Search the open crate found in a small farmhouse in Hosidius. Cabbages grow outside.", CRATE_27533, new WorldPoint(1687, 3628, 0), "The house is east of the Mess in Great Kourend."), new CrypticClue("Dig under Ithoi's cabin.", new WorldPoint(2529, 2838, 0), "Dig under Ithoi's cabin in the Corsair Cove."), new CrypticClue("Search the drawers, upstairs in the bank to the East of Varrock.", new WorldPoint(3250, 3420, 1), "Search the drawers upstairs in Varrock east bank"), - new CrypticClue("Speak to Hazelmere.", "Hazelmere", new WorldPoint(2677, 3088, 1), "Located upstairs in the house to the north of fairy ring CLS. Answer: 6859") + new CrypticClue("Speak to Hazelmere.", "Hazelmere", new WorldPoint(2677, 3088, 1), "Located upstairs in the house to the north of fairy ring CLS. Answer: 6859"), + new CrypticClue("The effects of this fire are magnified.", new WorldPoint(1179, 3626, 0), "Dig by the fire beside Ket'sal K'uk in the westernmost part of the Kebos Swamp. ") ); private String text; From a694ffc3ba56393be5ebdb9da9bd53ee4524a920 Mon Sep 17 00:00:00 2001 From: Lucas Date: Mon, 11 Feb 2019 06:49:03 +0100 Subject: [PATCH 07/11] Add hydra slayer helms to slayer plugin --- .../java/net/runelite/client/plugins/slayer/SlayerOverlay.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerOverlay.java index f0edfc1928..675381b1fb 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerOverlay.java @@ -73,6 +73,8 @@ class SlayerOverlay extends Overlay ItemID.RED_SLAYER_HELMET_I, ItemID.TURQUOISE_SLAYER_HELMET, ItemID.TURQUOISE_SLAYER_HELMET_I, + ItemID.HYDRA_SLAYER_HELMET, + ItemID.HYDRA_SLAYER_HELMET_I, ItemID.SLAYER_RING_ETERNAL, ItemID.ENCHANTED_GEM, ItemID.ETERNAL_GEM, From 3a5ac9f725d8ba152fa2f4d501a53f54ab18f3c1 Mon Sep 17 00:00:00 2001 From: Matthew Abel <32851341+Mabel5@users.noreply.github.com> Date: Mon, 11 Feb 2019 04:14:23 -0500 Subject: [PATCH 08/11] Hide auto retaliate from combat options (#7713) Closes #7686 --- .../java/net/runelite/api/widgets/WidgetID.java | 1 + .../java/net/runelite/api/widgets/WidgetInfo.java | 1 + .../plugins/attackstyles/AttackStylesConfig.java | 13 ++++++++++++- .../plugins/attackstyles/AttackStylesPlugin.java | 2 ++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index bb9d8b6000..9f07f9ba37 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -513,6 +513,7 @@ public class WidgetID static final int SPELL_BOX = 25; static final int SPELL_ICON = 27; static final int SPELL_TEXT = 28; + static final int AUTO_RETALIATE = 29; } static class VolcanicMine diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java index ef02681690..556dc57bf5 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java @@ -305,6 +305,7 @@ public enum WidgetInfo COMBAT_SPELL_BOX(WidgetID.COMBAT_GROUP_ID, WidgetID.Combat.SPELL_BOX), COMBAT_SPELL_ICON(WidgetID.COMBAT_GROUP_ID, WidgetID.Combat.SPELL_ICON), COMBAT_SPELL_TEXT(WidgetID.COMBAT_GROUP_ID, WidgetID.Combat.SPELL_TEXT), + COMBAT_AUTO_RETALIATE(WidgetID.COMBAT_GROUP_ID, WidgetID.Combat.AUTO_RETALIATE), DIALOG_OPTION(WidgetID.DIALOG_OPTION_GROUP_ID, 0), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStylesConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStylesConfig.java index 111fb9dc85..c3715481d1 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStylesConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStylesConfig.java @@ -97,11 +97,22 @@ public interface AttackStylesConfig extends Config return false; } + @ConfigItem( + keyName = "hideAutoRetaliate", + name = "Hide auto retaliate", + description = "Hide auto retaliate from the combat options tab", + position = 7 + ) + default boolean hideAutoRetaliate() + { + return false; + } + @ConfigItem( keyName = "removeWarnedStyles", name = "Remove warned styles", description = "Remove warned styles from the combat options tab", - position = 7 + position = 8 ) default boolean removeWarnedStyles() { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStylesPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStylesPlugin.java index 4b6de0ea1d..db7a9ed751 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStylesPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/attackstyles/AttackStylesPlugin.java @@ -126,6 +126,7 @@ public class AttackStylesPlugin extends Plugin overlayManager.remove(overlay); hideWarnedStyles(false); processWidgets(); + hideWidget(client.getWidget(WidgetInfo.COMBAT_AUTO_RETALIATE), false); } public AttackStyle getAttackStyle() @@ -174,6 +175,7 @@ public class AttackStylesPlugin extends Plugin hideWidget(client.getWidget(widgetKey), widgetsToHide.get(equippedWeaponType, widgetKey)); } } + hideWidget(client.getWidget(WidgetInfo.COMBAT_AUTO_RETALIATE), config.hideAutoRetaliate()); } @Subscribe From 3623efe9e5b6d3d7b490983ce1cb1afd5e2cc94b Mon Sep 17 00:00:00 2001 From: Andrew Fulton Date: Mon, 11 Feb 2019 03:18:00 -0600 Subject: [PATCH 09/11] client: flash only during LOGGED_IN game state (#7782) Fixes #7316 --- .../src/main/java/net/runelite/client/Notifier.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/Notifier.java b/runelite-client/src/main/java/net/runelite/client/Notifier.java index 491c397202..b48a2f6e71 100644 --- a/runelite-client/src/main/java/net/runelite/client/Notifier.java +++ b/runelite-client/src/main/java/net/runelite/client/Notifier.java @@ -154,13 +154,13 @@ public class Notifier public void processFlash(final Graphics2D graphics) { - if (flashStart == null) + if (flashStart == null || client.getGameCycle() % 40 >= 20) { return; } - - if (client.getGameCycle() % 40 >= 20) + else if (client.getGameState() != GameState.LOGGED_IN) { + flashStart = null; return; } From be8bdaeb7afe222d063ac063e25c4a8f0e567a20 Mon Sep 17 00:00:00 2001 From: Jakob Ankarhem Date: Mon, 11 Feb 2019 10:31:16 +0100 Subject: [PATCH 10/11] Remove dulling from progress bar positions (#7781) This makes the positions more visible. Closes #7170 --- .../main/java/net/runelite/client/ui/components/ProgressBar.java | 1 - 1 file changed, 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/ui/components/ProgressBar.java b/runelite-client/src/main/java/net/runelite/client/ui/components/ProgressBar.java index b5d335e9fb..a90d53eb87 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/components/ProgressBar.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/components/ProgressBar.java @@ -94,7 +94,6 @@ public class ProgressBar extends DimmableJPanel super.paint(g); g.setColor(getForeground()); g.fillRect(0, 0, topWidth, 16); - g.setColor(getForeground().darker()); for (final Double position : positions) { From fbeef873551821589ac6f96b030dc647326bdef4 Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Mon, 11 Feb 2019 09:33:10 +0000 Subject: [PATCH 11/11] Delay party instruction message if user is not logged in (#7696) Currently, if the user joins a party whilst on the login screen, they don't get the instructional message on how to leave the party --- .../client/plugins/party/PartyPlugin.java | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPlugin.java index 03110fe35c..73abcdb172 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPlugin.java @@ -128,6 +128,7 @@ public class PartyPlugin extends Plugin implements KeyListener private int lastHp, lastPray; private boolean hotkeyDown, doSync; + private boolean sendAlert; @Override public void configure(Binder binder) @@ -161,6 +162,7 @@ public class PartyPlugin extends Plugin implements KeyListener keyManager.unregisterKeyListener(this); hotkeyDown = false; doSync = false; + sendAlert = false; } @Provides @@ -284,6 +286,12 @@ public class PartyPlugin extends Plugin implements KeyListener @Subscribe public void onGameTick(final GameTick event) { + if (sendAlert && client.getGameState() == GameState.LOGGED_IN) + { + sendAlert = false; + sendInstructionMessage(); + } + if (doSync && !party.getMembers().isEmpty()) { // Request sync @@ -381,15 +389,7 @@ public class PartyPlugin extends Plugin implements KeyListener if (localMember != null && partyData.getMemberId().equals(localMember.getMemberId())) { - final String helpMessage = new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append("To leave party hold SHIFT and right click party stats overlay.") - .build(); - - chatMessageManager.queue(QueuedMessage.builder() - .type(ChatMessageType.GAME) - .runeLiteFormattedMessage(helpMessage) - .build()); + sendAlert = true; } } @@ -510,4 +510,17 @@ public class PartyPlugin extends Plugin implements KeyListener hotkeyDown = false; } } + + private void sendInstructionMessage() + { + final String helpMessage = new ChatMessageBuilder() + .append(ChatColorType.HIGHLIGHT) + .append("To leave party hold SHIFT and right click party stats overlay.") + .build(); + + chatMessageManager.queue(QueuedMessage.builder() + .type(ChatMessageType.GAME) + .runeLiteFormattedMessage(helpMessage) + .build()); + } }