Merge remote-tracking branch 'orig/master' into b

# Conflicts:
#	runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPanel.java
#	runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsPlugin.java
#	runelite-client/src/main/java/net/runelite/client/plugins/metronome/MetronomePlugin.java
#	runescape-api/src/main/java/net/runelite/rs/api/RSClient.java
This commit is contained in:
Lucas
2019-06-26 21:52:59 +02:00
26 changed files with 674 additions and 106 deletions

View File

@@ -432,7 +432,10 @@ public class ConfigManager
String current = getConfiguration(group.value(), item.keyName());
String valueString = objectToString(defaultValue);
if (Objects.equals(current, valueString))
// null and the empty string are treated identically in sendConfig and treated as an unset
// If a config value defaults to "" and the current value is null, it will cause an extra
// unset to be sent, so treat them as equal
if (Objects.equals(current, valueString) || (Strings.isNullOrEmpty(current) && Strings.isNullOrEmpty(valueString)))
{
continue; // already set to the default value
}

View File

@@ -325,7 +325,7 @@ public enum AgilityShortcut
TROLLHEIM_MEDIUM_CLIFF_SCRAMBLE_NORTH(43, "Rocks", new WorldPoint(2886, 3684, 0), ROCKS_3803, ROCKS_3804, ROCKS_16522),
TROLLHEIM_MEDIUM_CLIFF_SCRAMBLE_SOUTH(43, "Rocks", new WorldPoint(2876, 3666, 0), ROCKS_3803, ROCKS_3804, ROCKS_16522),
TROLLHEIM_ADVANCED_CLIFF_SCRAMBLE(44, "Rocks", new WorldPoint(2907, 3686, 0), ROCKS_16523, ROCKS_3748),
KOUREND_RIVER_STEPPING_STONES(45, "Stepping Stones", new WorldPoint(1721, 3509, 0), STEPPING_STONE_29728),
KOUREND_RIVER_STEPPING_STONES(45, "Stepping Stones", new WorldPoint(1720, 3551, 0), STEPPING_STONE_29728),
TIRANNWN_LOG_BALANCE(45, "Log Balance", null, LOG_BALANCE_3933, LOG_BALANCE_3931, LOG_BALANCE_3930, LOG_BALANCE_3929, LOG_BALANCE_3932),
COSMIC_ALTAR_MEDIUM_WALKWAY(46, "Narrow Walkway", new WorldPoint(2399, 4403, 0), JUTTING_WALL_17002),
DEEP_WILDERNESS_DUNGEON_CREVICE_NORTH(46, "Narrow Crevice", new WorldPoint(3047, 10335, 0), CREVICE_19043),

View File

@@ -30,6 +30,7 @@ import java.awt.Graphics2D;
import java.awt.Polygon;
import java.util.Set;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import lombok.Getter;
import net.runelite.api.Client;
import net.runelite.api.EquipmentInventorySlot;
@@ -214,6 +215,7 @@ public class EmoteClue extends ClueScroll implements TextClueScroll, LocationClu
}
private final String text;
@Nullable
private final STASHUnit stashUnit;
private final WorldPoint location;
private final Emote firstEmote;
@@ -256,15 +258,19 @@ public class EmoteClue extends ClueScroll implements TextClueScroll, LocationClu
if (itemRequirements.length > 0)
{
Client client = plugin.getClient();
client.runScript(ScriptID.WATSON_STASH_UNIT_CHECK, stashUnit.getObjectId(), 0, 0, 0);
int[] intStack = client.getIntStack();
boolean stashUnitBuilt = intStack[0] == 1;
panelComponent.getChildren().add(LineComponent.builder()
.left("STASH Unit:")
.right(stashUnitBuilt ? UNICODE_CHECK_MARK : UNICODE_BALLOT_X)
.rightColor(stashUnitBuilt ? Color.GREEN : Color.RED)
.build());
if (stashUnit != null)
{
client.runScript(ScriptID.WATSON_STASH_UNIT_CHECK, stashUnit.getObjectId(), 0, 0, 0);
int[] intStack = client.getIntStack();
boolean stashUnitBuilt = intStack[0] == 1;
panelComponent.getChildren().add(LineComponent.builder()
.left("STASH Unit:")
.right(stashUnitBuilt ? UNICODE_CHECK_MARK : UNICODE_BALLOT_X)
.rightColor(stashUnitBuilt ? Color.GREEN : Color.RED)
.build());
}
panelComponent.getChildren().add(LineComponent.builder().left("Equip:").build());
@@ -312,18 +318,21 @@ public class EmoteClue extends ClueScroll implements TextClueScroll, LocationClu
OverlayUtil.renderTileOverlay(plugin.getClient(), graphics, localPoint, plugin.getEmoteImage(), Color.ORANGE);
}
final WorldPoint[] worldPoints = stashUnit.getWorldPoints();
for (final WorldPoint worldPoint : worldPoints)
if (stashUnit != null)
{
final LocalPoint stashUnitLocalPoint = LocalPoint.fromWorld(plugin.getClient(), worldPoint);
final WorldPoint[] worldPoints = stashUnit.getWorldPoints();
if (stashUnitLocalPoint != null)
for (final WorldPoint worldPoint : worldPoints)
{
final Polygon poly = Perspective.getCanvasTilePoly(plugin.getClient(), stashUnitLocalPoint);
if (poly != null)
final LocalPoint stashUnitLocalPoint = LocalPoint.fromWorld(plugin.getClient(), worldPoint);
if (stashUnitLocalPoint != null)
{
OverlayUtil.renderPolygon(graphics, poly, Color.RED);
final Polygon poly = Perspective.getCanvasTilePoly(plugin.getClient(), stashUnitLocalPoint);
if (poly != null)
{
OverlayUtil.renderPolygon(graphics, poly, Color.RED);
}
}
}
}

View File

@@ -79,7 +79,7 @@ public class FaloTheBardClue extends ClueScroll implements TextClueScroll, NpcCl
{
private static final List<FaloTheBardClue> CLUES = ImmutableList.of(
new FaloTheBardClue("A blood red weapon, a strong curved sword, found on the island of primate lords.", item(DRAGON_SCIMITAR)),
new FaloTheBardClue("A book that preaches of some great figure, lending strength, might, and vigour.", any("Any god book (must be complete)", item(HOLY_BOOK), item(BOOK_OF_BALANCE), item(UNHOLY_BOOK), item(BOOK_OF_LAW), item(BOOK_OF_WAR), item(BOOK_OF_DARKNESS))),
new FaloTheBardClue("A book that preaches of some great figure, lending strength, might and vigour.", any("Any god book (must be complete)", item(HOLY_BOOK), item(BOOK_OF_BALANCE), item(UNHOLY_BOOK), item(BOOK_OF_LAW), item(BOOK_OF_WAR), item(BOOK_OF_DARKNESS))),
new FaloTheBardClue("A bow of elven craft was made, it shimmers bright, but will soon fade.", any("Crystal Bow", range(NEW_CRYSTAL_BOW, CRYSTAL_BOW_110), range(NEW_CRYSTAL_BOW_I, CRYSTAL_BOW_110_I))),
new FaloTheBardClue("A fiery axe of great inferno, when you use it, you'll wonder where the logs go.", item(INFERNAL_AXE)),
new FaloTheBardClue("A mark used to increase one's grace, found atop a seer's place.", item(MARK_OF_GRACE)),
@@ -88,7 +88,7 @@ public class FaloTheBardClue extends ClueScroll implements TextClueScroll, NpcCl
// The wiki doesn't specify whether the trimmed dragon defender will work so I've assumed that it doesn't
new FaloTheBardClue("A sword held in the other hand, red its colour, Cyclops strength you must withstand.", item(DRAGON_DEFENDER)),
new FaloTheBardClue("A token used to kill mythical beasts, in hopes of a blade or just for an xp feast.", item(WARRIOR_GUILD_TOKEN)),
new FaloTheBardClue("Green is my favorite, mature ale I do love, this takes your herblore above.", item(GREENMANS_ALEM)),
new FaloTheBardClue("Green is my favourite, mature ale I do love, this takes your herblore above.", item(GREENMANS_ALEM)),
new FaloTheBardClue("It can hold down a boat or crush a goat, this object, you see, is quite heavy.", item(BARRELCHEST_ANCHOR)),
new FaloTheBardClue("It comes from the ground, underneath the snowy plain. Trolls aplenty, with what looks like a mane.", item(BASALT)),
new FaloTheBardClue("No attack to wield, only strength is required, made of obsidian, but with no room for a shield.", item(TZHAARKETOM)),

View File

@@ -172,7 +172,8 @@ public class CookingPlugin extends Plugin
session.increaseCookAmount();
}
else if (message.startsWith("You accidentally burn"))
else if (message.startsWith("You accidentally burn")
|| message.startsWith("You accidentally spoil"))
{
if (session == null)
{

View File

@@ -133,6 +133,8 @@ class DevToolsPanel extends PluginPanel
}
});
container.add(plugin.getSoundEffects());
return container;
}
}

View File

@@ -100,6 +100,9 @@ public class DevToolsPlugin extends Plugin
@Inject
private WorldMapRegionOverlay mapRegionOverlay;
@Inject
private SoundEffectOverlay soundEffectOverlay;
@Inject
private EventBus eventBus;
@@ -127,6 +130,7 @@ public class DevToolsPlugin extends Plugin
private DevToolsButton detachedCamera;
private DevToolsButton widgetInspector;
private DevToolsButton varInspector;
private DevToolsButton soundEffects;
private DevToolsButton logMenuActions;
private NavigationButton navButton;
@@ -169,6 +173,7 @@ public class DevToolsPlugin extends Plugin
detachedCamera = new DevToolsButton("Detached Camera");
widgetInspector = new DevToolsButton("Widget Inspector");
varInspector = new DevToolsButton("Var Inspector");
soundEffects = new DevToolsButton("Sound Effects");
overlayManager.add(overlay);
overlayManager.add(locationOverlay);
@@ -176,6 +181,7 @@ public class DevToolsPlugin extends Plugin
overlayManager.add(cameraOverlay);
overlayManager.add(worldMapLocationOverlay);
overlayManager.add(mapRegionOverlay);
overlayManager.add(soundEffectOverlay);
logMenuActions = new DevToolsButton("Menu Actions");
@@ -191,17 +197,21 @@ public class DevToolsPlugin extends Plugin
.build();
clientToolbar.addNavigation(navButton);
eventBus.register(soundEffectOverlay);
}
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(soundEffectOverlay);
overlayManager.remove(overlay);
overlayManager.remove(locationOverlay);
overlayManager.remove(sceneOverlay);
overlayManager.remove(cameraOverlay);
overlayManager.remove(worldMapLocationOverlay);
overlayManager.remove(mapRegionOverlay);
overlayManager.remove(soundEffectOverlay);
clientToolbar.removeNavigation(navButton);
}
@@ -341,6 +351,12 @@ public class DevToolsPlugin extends Plugin
player.getPlayerAppearance().setHash();
break;
}
case "sound":
{
int id = Integer.parseInt(args[0]);
client.playSoundEffect(id);
break;
}
}
}

View File

@@ -0,0 +1,145 @@
/*
* Copyright (c) 2018, WooxSolo <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.devtools;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.Player;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.events.AreaSoundEffectPlayed;
import net.runelite.api.events.SoundEffectPlayed;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayPosition;
import net.runelite.client.ui.overlay.components.LineComponent;
import net.runelite.client.ui.overlay.components.PanelComponent;
class SoundEffectOverlay extends Overlay
{
private final static int MAX_LINES = 16;
private final static Color COLOR_SOUND_EFFECT = Color.WHITE;
private final static Color COLOR_AREA_SOUND_EFFECT = Color.YELLOW;
private final static Color COLOR_SILENT_SOUND_EFFECT = Color.GRAY;
private final Client client;
private final DevToolsPlugin plugin;
private final PanelComponent panelComponent = new PanelComponent();
@Inject
SoundEffectOverlay(Client client, DevToolsPlugin plugin)
{
this.client = client;
this.plugin = plugin;
panelComponent.setPreferredSize(new Dimension(200, 0));
panelComponent.getChildren().add(LineComponent.builder()
.left("Sound Effects")
.leftColor(Color.CYAN)
.build());
setPosition(OverlayPosition.TOP_LEFT);
}
@Override
public Dimension render(Graphics2D graphics)
{
if (!plugin.getSoundEffects().isActive())
{
return null;
}
return panelComponent.render(graphics);
}
@Subscribe
public void onSoundEffectPlayed(SoundEffectPlayed event)
{
if (!plugin.getSoundEffects().isActive())
{
return;
}
String text =
"Id: " + event.getSoundId() +
" - D: " + event.getDelay();
panelComponent.getChildren().add(LineComponent.builder()
.left(text)
.leftColor(COLOR_SOUND_EFFECT)
.build());
checkMaxLines();
}
@Subscribe
public void onAreaSoundEffectPlayed(AreaSoundEffectPlayed event)
{
if (!plugin.getSoundEffects().isActive())
{
return;
}
Color textColor = COLOR_AREA_SOUND_EFFECT;
// Check if the player is within range to hear the sound
Player localPlayer = client.getLocalPlayer();
if (localPlayer != null)
{
LocalPoint lp = localPlayer.getLocalLocation();
if (lp != null)
{
int sceneX = lp.getSceneX();
int sceneY = lp.getSceneY();
int distance = Math.abs(sceneX - event.getSceneX()) + Math.abs(sceneY - event.getSceneY());
if (distance > event.getRange())
{
textColor = COLOR_SILENT_SOUND_EFFECT;
}
}
}
String text =
"Id: " + event.getSoundId() +
" - L: " + event.getSceneX() + "," + event.getSceneY() +
" - R: " + event.getRange() +
" - D: " + event.getDelay();
panelComponent.getChildren().add(LineComponent.builder()
.left(text)
.leftColor(textColor)
.build());
checkMaxLines();
}
private void checkMaxLines()
{
while (panelComponent.getChildren().size() > MAX_LINES)
{
panelComponent.getChildren().remove(1);
}
}
}

View File

@@ -82,6 +82,9 @@ import static net.runelite.api.NpcID.FISHING_SPOT_7733;
import static net.runelite.api.NpcID.FISHING_SPOT_7946;
import static net.runelite.api.NpcID.FISHING_SPOT_7947;
import static net.runelite.api.NpcID.FISHING_SPOT_8523;
import static net.runelite.api.NpcID.FISHING_SPOT_8525;
import static net.runelite.api.NpcID.FISHING_SPOT_8526;
import static net.runelite.api.NpcID.FISHING_SPOT_8527;
import static net.runelite.api.NpcID.ROD_FISHING_SPOT;
import static net.runelite.api.NpcID.ROD_FISHING_SPOT_1508;
import static net.runelite.api.NpcID.ROD_FISHING_SPOT_1509;
@@ -94,6 +97,7 @@ import static net.runelite.api.NpcID.ROD_FISHING_SPOT_7463;
import static net.runelite.api.NpcID.ROD_FISHING_SPOT_7464;
import static net.runelite.api.NpcID.ROD_FISHING_SPOT_7468;
import static net.runelite.api.NpcID.ROD_FISHING_SPOT_7676;
import static net.runelite.api.NpcID.ROD_FISHING_SPOT_8524;
@Getter
enum FishingSpot
@@ -115,7 +119,8 @@ enum FishingSpot
FISHING_SPOT_1511, FISHING_SPOT_1520, FISHING_SPOT_3915,
FISHING_SPOT_4476, FISHING_SPOT_4477, FISHING_SPOT_5233,
FISHING_SPOT_5234, FISHING_SPOT_5821, FISHING_SPOT_7200,
FISHING_SPOT_7461, FISHING_SPOT_7466
FISHING_SPOT_7461, FISHING_SPOT_7466, FISHING_SPOT_8525,
FISHING_SPOT_8526, FISHING_SPOT_8527
),
MONKFISH("Monkfish", ItemID.RAW_MONKFISH,
FISHING_SPOT_4316
@@ -124,7 +129,7 @@ enum FishingSpot
ROD_FISHING_SPOT, ROD_FISHING_SPOT_1508, ROD_FISHING_SPOT_1509,
ROD_FISHING_SPOT_1513, ROD_FISHING_SPOT_1515, ROD_FISHING_SPOT_1526,
ROD_FISHING_SPOT_1527, ROD_FISHING_SPOT_7463, ROD_FISHING_SPOT_7464,
ROD_FISHING_SPOT_7468
ROD_FISHING_SPOT_7468, ROD_FISHING_SPOT_8524
),
BARB_FISH("Sturgeon, Salmon, Trout", ItemID.LEAPING_STURGEON,
FISHING_SPOT_1542, FISHING_SPOT_7323

View File

@@ -27,6 +27,7 @@ package net.runelite.client.plugins.metronome;
import com.google.inject.Provides;
import javax.inject.Inject;
import net.runelite.api.SoundEffectVolume;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;
@@ -164,7 +165,7 @@ public class MetronomePlugin extends Plugin
{
if (tockClip == null)
{
client.playSoundEffect(SoundEffectID.GE_INCREMENT_PLOP);
client.playSoundEffect(SoundEffectID.GE_DECREMENT_PLOP, SoundEffectVolume.MEDIUM_HIGH);
}
else
{
@@ -180,7 +181,7 @@ public class MetronomePlugin extends Plugin
{
if (tickClip == null)
{
client.playSoundEffect(SoundEffectID.GE_DECREMENT_PLOP);
client.playSoundEffect(SoundEffectID.GE_DECREMENT_PLOP, SoundEffectVolume.MEDIUM_HIGH);
}
else
{

View File

@@ -194,7 +194,7 @@ public class NpcSceneOverlay extends Overlay
break;
}
if (config.drawNames())
if (config.drawNames() && actor.getName() != null)
{
String npcName = Text.removeTags(actor.getName());
Point textLocation = actor.getCanvasTextLocation(graphics, npcName, actor.getLogicalHeight() + 40);

View File

@@ -32,7 +32,6 @@ import java.util.Iterator;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.Perspective;
import net.runelite.api.Point;
import net.runelite.api.coords.LocalPoint;
import net.runelite.client.plugins.party.data.PartyTilePingData;
import net.runelite.client.ui.overlay.Overlay;
@@ -60,18 +59,6 @@ class PartyPingOverlay extends Overlay
return null;
}
// Update selected scene tile
if (!client.isMenuOpen())
{
Point p = client.getMouseCanvasPosition();
p = new Point(
p.getX() - client.getViewportXOffset(),
p.getY() - client.getViewportYOffset());
client.setCheckClick(true);
client.setMouseCanvasHoverPosition(p);
}
synchronized (plugin.getPendingTilePings())
{
final Iterator<PartyTilePingData> iterator = plugin.getPendingTilePings().iterator();