Merge branch 'master' into tooltip-right-click-option-toggle
This commit is contained in:
@@ -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);
|
||||
|
||||
/**
|
||||
|
||||
@@ -379,7 +379,7 @@ public class Perspective
|
||||
@Nullable String text,
|
||||
int zOffset)
|
||||
{
|
||||
if (text == null || "".equals(text))
|
||||
if (text == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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),
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Tomas Slusny <slusnucky@gmail.com>
|
||||
* Copyright (c) 2019, Jordan Atwood <nightfirecat@protonmail.com>
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Jordan Atwood <nightfirecat@protonmail.com>
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user