Merge remote-tracking branch 'runelite/master'

This commit is contained in:
Owain van Brakel
2021-12-09 16:30:14 +01:00
20 changed files with 646 additions and 1210 deletions

View File

@@ -1,160 +0,0 @@
/*
* Copyright (c) 2018, Woox <https://github.com/wooxsolo>
* 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.chatboxperformance;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.ScriptID;
import net.runelite.api.events.ScriptCallbackEvent;
import net.runelite.api.widgets.WidgetType;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.widgets.WidgetPositionMode;
import net.runelite.api.widgets.WidgetSizeMode;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@PluginDescriptor(
name = "Chatbox performance",
hidden = true
)
public class ChatboxPerformancePlugin extends Plugin
{
@Inject
private Client client;
@Inject
private ClientThread clientThread;
@Override
public void startUp()
{
if (client.getGameState() == GameState.LOGGED_IN)
{
clientThread.invokeLater(() -> client.runScript(ScriptID.MESSAGE_LAYER_CLOSE, 0, 0, 0));
}
}
@Override
public void shutDown()
{
if (client.getGameState() == GameState.LOGGED_IN)
{
clientThread.invokeLater(() -> client.runScript(ScriptID.MESSAGE_LAYER_CLOSE, 0, 0, 0));
}
}
@Subscribe
private void onScriptCallbackEvent(ScriptCallbackEvent ev)
{
if (!"chatboxBackgroundBuilt".equals(ev.getEventName()))
{
return;
}
fixDarkBackground();
fixWhiteLines(true);
fixWhiteLines(false);
}
private void fixDarkBackground()
{
int currOpacity = 256;
int prevY = 0;
Widget[] children = client.getWidget(WidgetInfo.CHATBOX_TRANSPARENT_BACKGROUND).getDynamicChildren();
Widget prev = null;
for (Widget w : children)
{
if (w.getType() != WidgetType.RECTANGLE)
{
continue;
}
if (prev != null)
{
int relY = w.getRelativeY();
prev.setHeightMode(WidgetSizeMode.ABSOLUTE);
prev.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP);
prev.setRelativeY(prevY);
prev.setOriginalY(prev.getRelativeY());
prev.setHeight(relY - prevY);
prev.setOriginalHeight(prev.getHeight());
prev.setOpacity(currOpacity);
}
prevY = w.getRelativeY();
currOpacity -= 3; // Rough number, can't get exactly the same as Jagex because of rounding
prev = w;
}
if (prev != null)
{
prev.setOpacity(currOpacity);
}
}
private void fixWhiteLines(boolean upperLine)
{
int currOpacity = 256;
int prevWidth = 0;
Widget[] children = client.getWidget(WidgetInfo.CHATBOX_TRANSPARENT_LINES).getDynamicChildren();
Widget prev = null;
for (Widget w : children)
{
if (w.getType() != WidgetType.RECTANGLE)
{
continue;
}
if ((w.getRelativeY() == 0 && !upperLine) ||
(w.getRelativeY() != 0 && upperLine))
{
continue;
}
if (prev != null)
{
int width = w.getWidth();
prev.setWidthMode(WidgetSizeMode.ABSOLUTE);
prev.setRelativeX(width);
prev.setOriginalX(width);
prev.setWidth(prevWidth - width);
prev.setOriginalWidth(prev.getWidth());
prev.setOpacity(currOpacity);
}
prevWidth = w.getWidth();
currOpacity -= upperLine ? 3 : 4; // Rough numbers, can't get exactly the same as Jagex because of rounding
prev = w;
}
if (prev != null)
{
prev.setOpacity(currOpacity);
}
}
}

View File

@@ -71,9 +71,11 @@ import net.runelite.client.ws.WSClient;
public class SpecialCounterPlugin extends Plugin
{
private static final Set<Integer> IGNORED_NPCS = ImmutableSet.of(
NpcID.DARK_ENERGY_CORE, NpcID.ZOMBIFIED_SPAWN, NpcID.ZOMBIFIED_SPAWN_8063,
NpcID.COMBAT_DUMMY, NpcID.UNDEAD_COMBAT_DUMMY,
NpcID.SKELETON_HELLHOUND_6613, NpcID.GREATER_SKELETON_HELLHOUND
NpcID.DARK_ENERGY_CORE, // corp
NpcID.ZOMBIFIED_SPAWN, NpcID.ZOMBIFIED_SPAWN_8063, // vorkath
NpcID.COMBAT_DUMMY, NpcID.UNDEAD_COMBAT_DUMMY, // poh
NpcID.SKELETON_HELLHOUND_6613, NpcID.GREATER_SKELETON_HELLHOUND, // vetion
NpcID.SPAWN, NpcID.SCION // abyssal sire
);
private static final Set<Integer> RESET_ON_LEAVE_INSTANCED_REGIONS = ImmutableSet.of(

View File

@@ -29,106 +29,176 @@ import net.runelite.client.config.Alpha;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.ConfigSection;
@ConfigGroup("tileindicators")
public interface TileIndicatorsConfig extends Config
{
@Alpha
@ConfigItem(
keyName = "highlightDestinationColor",
name = "Destination tile",
description = "Configures the highlight color of current destination",
@ConfigSection(
name = "Destination Tile",
description = "Destination tile configuration",
position = 0
)
String destinationTile = "destinationTile";
@ConfigSection(
name = "Hovered Tile",
description = "Hovered tile configuration",
position = 1
)
default Color highlightDestinationColor()
{
return Color.GRAY;
}
String hoveredTile = "hoveredTile";
@ConfigSection(
name = "Current Tile",
description = "Current tile configuration",
position = 2
)
String currentTile = "currentTile";
@ConfigItem(
keyName = "highlightDestinationTile",
name = "Highlight destination tile",
description = "Highlights tile player is walking to",
position = 2
position = 1,
section = destinationTile
)
default boolean highlightDestinationTile()
{
return true;
}
@Alpha
@ConfigItem(
keyName = "highlightDestinationColor",
name = "Highlight color",
description = "Configures the highlight color of current destination",
position = 2,
section = destinationTile
)
default Color highlightDestinationColor()
{
return Color.GRAY;
}
@Alpha
@ConfigItem(
keyName = "destinationTileFillColor",
name = "Fill color",
description = "Configures the fill color of destination tile",
position = 3,
section = destinationTile
)
default Color destinationTileFillColor()
{
return new Color(0, 0, 0, 50);
}
@ConfigItem(
keyName = "destinationTileBorderWidth",
name = "Destination border width",
name = "Border width",
description = "Width of the destination tile marker border",
position = 3
position = 4,
section = destinationTile
)
default double destinationTileBorderWidth()
{
return 2;
}
@Alpha
@ConfigItem(
keyName = "highlightHoveredColor",
name = "Hovered tile",
description = "Configures the highlight color of hovered tile",
position = 4
)
default Color highlightHoveredColor()
{
return new Color(0, 0, 0, 0);
}
@ConfigItem(
keyName = "highlightHoveredTile",
name = "Highlight hovered tile",
description = "Highlights tile player is hovering with mouse",
position = 5
position = 1,
section = hoveredTile
)
default boolean highlightHoveredTile()
{
return false;
}
@Alpha
@ConfigItem(
keyName = "highlightHoveredColor",
name = "Highlight color",
description = "Configures the highlight color of hovered tile",
position = 2,
section = hoveredTile
)
default Color highlightHoveredColor()
{
return new Color(0, 0, 0, 0);
}
@Alpha
@ConfigItem(
keyName = "hoveredTileFillColor",
name = "Fill color",
description = "Configures the fill color of hovered tile",
position = 3,
section = hoveredTile
)
default Color hoveredTileFillColor()
{
return new Color(0, 0, 0, 50);
}
@ConfigItem(
keyName = "hoveredTileBorderWidth",
name = "Hovered tile border width",
name = "Border width",
description = "Width of the hovered tile marker border",
position = 6
position = 4,
section = hoveredTile
)
default double hoveredTileBorderWidth()
{
return 2;
}
@Alpha
@ConfigItem(
keyName = "highlightCurrentColor",
name = "True tile",
description = "Configures the highlight color of current true tile",
position = 7
)
default Color highlightCurrentColor()
{
return Color.CYAN;
}
@ConfigItem(
keyName = "highlightCurrentTile",
name = "Highlight true tile",
description = "Highlights true tile player is on as seen by server",
position = 8
position = 1,
section = currentTile
)
default boolean highlightCurrentTile()
{
return false;
}
@Alpha
@ConfigItem(
keyName = "highlightCurrentColor",
name = "Highlight color",
description = "Configures the highlight color of current true tile",
position = 2,
section = currentTile
)
default Color highlightCurrentColor()
{
return Color.CYAN;
}
@Alpha
@ConfigItem(
keyName = "currentTileFillColor",
name = "Fill color",
description = "Configures the fill color of current true tile",
position = 3,
section = currentTile
)
default Color currentTileFillColor()
{
return new Color(0, 0, 0, 50);
}
@ConfigItem(
keyName = "currentTileBorderWidth",
name = "True tile border width",
name = "Border width",
description = "Width of the true tile marker border",
position = 9
position = 4,
section = currentTile
)
default double currentTileBorderWidth()
{

View File

@@ -63,13 +63,13 @@ public class TileIndicatorsOverlay extends Overlay
// If we have tile "selected" render it
if (client.getSelectedSceneTile() != null)
{
renderTile(graphics, client.getSelectedSceneTile().getLocalLocation(), config.highlightHoveredColor(), config.hoveredTileBorderWidth());
renderTile(graphics, client.getSelectedSceneTile().getLocalLocation(), config.highlightHoveredColor(), config.hoveredTileBorderWidth(), config.hoveredTileFillColor());
}
}
if (config.highlightDestinationTile())
{
renderTile(graphics, client.getLocalDestinationLocation(), config.highlightDestinationColor(), config.destinationTileBorderWidth());
renderTile(graphics, client.getLocalDestinationLocation(), config.highlightDestinationColor(), config.destinationTileBorderWidth(), config.destinationTileFillColor());
}
if (config.highlightCurrentTile())
@@ -86,13 +86,13 @@ public class TileIndicatorsOverlay extends Overlay
return null;
}
renderTile(graphics, playerPosLocal, config.highlightCurrentColor(), config.currentTileBorderWidth());
renderTile(graphics, playerPosLocal, config.highlightCurrentColor(), config.currentTileBorderWidth(), config.currentTileFillColor());
}
return null;
}
private void renderTile(final Graphics2D graphics, final LocalPoint dest, final Color color, final double borderWidth)
private void renderTile(final Graphics2D graphics, final LocalPoint dest, final Color color, final double borderWidth, final Color fillColor)
{
if (dest == null)
{
@@ -106,6 +106,6 @@ public class TileIndicatorsOverlay extends Overlay
return;
}
OverlayUtil.renderPolygon(graphics, poly, color, new BasicStroke((float) borderWidth));
OverlayUtil.renderPolygon(graphics, poly, color, fillColor, new BasicStroke((float) borderWidth));
}
}

View File

@@ -124,6 +124,7 @@ public class TimersPlugin extends Plugin
private static final String RESURRECT_THRALL_DISAPPEAR_MESSAGE_END = " thrall returns to the grave.</col>";
private static final String WARD_OF_ARCEUUS_MESSAGE = ">Your defence against Arceuus magic has been strengthened.</col>";
private static final String PICKPOCKET_FAILURE_MESSAGE = "You fail to pick the ";
private static final String DODGY_NECKLACE_PROTECTION_MESSAGE = "Your dodgy necklace protects you.";
private static final Pattern TELEBLOCK_PATTERN = Pattern.compile("A Tele Block spell has been cast on you(?: by .+)?\\. It will expire in (?<mins>\\d+) minutes?(?:, (?<secs>\\d+) seconds?)?\\.");
private static final Pattern DIVINE_POTION_PATTERN = Pattern.compile("You drink some of your divine (.+) potion\\.");
@@ -508,6 +509,11 @@ public class TimersPlugin extends Plugin
return;
}
if (message.contains(DODGY_NECKLACE_PROTECTION_MESSAGE))
{
removeGameTimer(PICKPOCKET_STUN);
}
if (message.contains(PICKPOCKET_FAILURE_MESSAGE) && config.showPickpocketStun() && message.contains("pocket"))
{
if (message.contains("hero") || message.contains("elf"))