Merge pull request #760 from Lucwousin/aassassssjsjjsjsjsjsjsjsjs

Merge from upstream
This commit is contained in:
Ganom
2019-06-26 16:35:45 -04:00
committed by GitHub
47 changed files with 776 additions and 229 deletions
@@ -249,13 +249,11 @@ public interface Client extends GameShell
/** /**
* Gets the canvas height * Gets the canvas height
* @return
*/ */
int getCanvasHeight(); int getCanvasHeight();
/** /**
* Gets the canvas width * Gets the canvas width
* @return
*/ */
int getCanvasWidth(); int getCanvasWidth();
@@ -413,23 +411,6 @@ public interface Client extends GameShell
*/ */
int getMouseCurrentButton(); int getMouseCurrentButton();
/**
* Schedules checking of current region tile for next frame, so ${@link Client#getSelectedSceneTile()} ()} will
* return actual value.
*
* @param checkClick when true next frame selected region tile will be updated
*/
void setCheckClick(boolean checkClick);
/**
* Sets current mouse hover position. This value is automatically updated only when right-clicking in game.
* Setting this value together with ${@link Client#setCheckClick(boolean)} will update ${@link Client#getSelectedSceneTile()} ()}
* for next frame.
*
* @param position current mouse hover position
*/
void setMouseCanvasHoverPosition(Point position);
/** /**
* Gets the currently selected tile (ie. last right clicked tile). * Gets the currently selected tile (ie. last right clicked tile).
* *
@@ -724,7 +705,7 @@ public interface Client extends GameShell
* @param varps passed varbits * @param varps passed varbits
* @param varbitId the variable ID * @param varbitId the variable ID
* @return the value * @return the value
* @see Varbits#id * @see Varbits
*/ */
int getVarbitValue(int[] varps, int varbitId); int getVarbitValue(int[] varps, int varbitId);
@@ -754,7 +735,7 @@ public interface Client extends GameShell
* @param varps passed varbits * @param varps passed varbits
* @param varbit the variable * @param varbit the variable
* @param value the value * @param value the value
* @see Varbits#id * @see Varbits
*/ */
void setVarbitValue(int[] varps, int varbit, int value); void setVarbitValue(int[] varps, int varbit, int value);
@@ -798,8 +779,6 @@ public interface Client extends GameShell
/** /**
* Get the total experience of the player * Get the total experience of the player
*
* @return
*/ */
long getOverallExperience(); long getOverallExperience();
@@ -977,6 +956,28 @@ public interface Client extends GameShell
*/ */
void playSoundEffect(int id, int x, int y, int range); void playSoundEffect(int id, int x, int y, int range);
/**
* Play a sound effect from some point in the world.
*
* @param id the ID of the sound to play. Any int is allowed, but see
* {@link SoundEffectID} for some common ones
* @param x the ground coordinate on the x axis
* @param y the ground coordinate on the y axis
* @param range the number of tiles away that the sound can be heard
* from
* @param delay the amount of frames before the sound starts playing
*/
void playSoundEffect(int id, int x, int y, int range, int delay);
/**
* Plays a sound effect, even if the player's sound effect volume is muted.
*
* @param id the ID of the sound effect - {@link SoundEffectID}
* @param volume the volume to play the sound effect at, see {@link SoundEffectVolume} for values used
* in the settings interface. if the sound effect volume is not muted, uses the set volume
*/
void playSoundEffect(int id, int volume);
/** /**
* Gets the clients graphic buffer provider. * Gets the clients graphic buffer provider.
* *
@@ -1078,15 +1079,11 @@ public interface Client extends GameShell
/** /**
* Gets the clan owner of the currently joined clan chat * Gets the clan owner of the currently joined clan chat
*
* @return
*/ */
String getClanOwner(); String getClanOwner();
/** /**
* Gets the clan chat name of the currently joined clan chat * Gets the clan chat name of the currently joined clan chat
*
* @return
*/ */
String getClanChatName(); String getClanChatName();
@@ -1099,22 +1096,16 @@ public interface Client extends GameShell
/** /**
* Gets the number of friends on the friends list. * Gets the number of friends on the friends list.
*
* @return
*/ */
int getFriendsCount(); int getFriendsCount();
/** /**
* Gets an array of players on the ignore list. * Gets an array of players on the ignore list.
*
* @return
*/ */
Ignore[] getIgnores(); Ignore[] getIgnores();
/** /**
* Gets the number of ignored players on the ignore list. * Gets the number of ignored players on the ignore list.
*
* @return
*/ */
int getIgnoreCount(); int getIgnoreCount();
@@ -1618,14 +1609,11 @@ public interface Client extends GameShell
/** /**
* Get the if1 widget whose item is being dragged * Get the if1 widget whose item is being dragged
*
* @return
*/ */
Widget getIf1DraggedWidget(); Widget getIf1DraggedWidget();
/** /**
* Get the item index of the item being dragged on an if1 widget * Get the item index of the item being dragged on an if1 widget
* @return
*/ */
int getIf1DraggedItemIndex(); int getIf1DraggedItemIndex();
@@ -0,0 +1,37 @@
/*
* Copyright (c) 2018, trimbe <github.com/trimbe>
* 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.api;
/**
* Volume values for each of the stops on the volume interface
*/
public final class SoundEffectVolume
{
public static final int MUTED = 0;
public static final int LOW = 32;
public static final int MEDIUM_LOW = 64;
public static final int MEDIUM_HIGH = 96;
public static final int HIGH = 127;
}
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018, SomeoneWithAnInternetConnection * Copyright (c) 2018, WooxSolo <https://github.com/WooxSolo>
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -22,43 +22,16 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package net.runelite.mixins; package net.runelite.api.events;
import net.runelite.api.mixins.Inject; import lombok.Data;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSSoundEffect;
@Mixin(RSClient.class) @Data
public abstract class PlaySoundEffectMixin implements RSClient public class AreaSoundEffectPlayed
{ {
private int soundId;
@Inject private int sceneX;
@Override private int sceneY;
public void playSoundEffect(int id) private int range;
{ private int delay;
playSoundEffect(id, 0, 0, 0);
}
@Inject
@Override
public void playSoundEffect(int id, int x, int y, int range)
{
int position = ((x & 255) << 16) + ((y & 255) << 8) + (range & 255);
int[] queuedSoundEffectIDs = getQueuedSoundEffectIDs();
int[] unknownSoundValues1 = getUnknownSoundValues1();
int[] queuedSoundEffectDelays = getQueuedSoundEffectDelays();
RSSoundEffect[] audioEffects = getAudioEffects();
int[] soundLocations = getSoundLocations();
int queuedSoundEffectCount = getQueuedSoundEffectCount();
queuedSoundEffectIDs[queuedSoundEffectCount] = id;
unknownSoundValues1[queuedSoundEffectCount] = 0;
queuedSoundEffectDelays[queuedSoundEffectCount] = 0;
audioEffects[queuedSoundEffectCount] = null;
soundLocations[queuedSoundEffectCount] = position;
setQueuedSoundEffectCount(queuedSoundEffectCount + 1);
}
} }
@@ -0,0 +1,34 @@
/*
* 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.api.events;
import lombok.Data;
@Data
public class SoundEffectPlayed
{
private int soundId;
private int delay;
}
@@ -45,7 +45,6 @@ import net.runelite.api.Client;
import net.runelite.api.Constants; import net.runelite.api.Constants;
import net.runelite.api.MainBufferProvider; import net.runelite.api.MainBufferProvider;
import net.runelite.api.NullItemID; import net.runelite.api.NullItemID;
import net.runelite.api.Point;
import net.runelite.api.RenderOverview; import net.runelite.api.RenderOverview;
import net.runelite.api.Renderable; import net.runelite.api.Renderable;
import net.runelite.api.WorldMapManager; import net.runelite.api.WorldMapManager;
@@ -375,9 +374,6 @@ public class Hooks implements Callbacks
/** /**
* Copy an image * Copy an image
*
* @param src
* @return
*/ */
private static Image copy(Image src) private static Image copy(Image src)
{ {
@@ -397,18 +393,6 @@ public class Hooks implements Callbacks
BufferedImage image = (BufferedImage) bufferProvider.getImage(); BufferedImage image = (BufferedImage) bufferProvider.getImage();
Graphics2D graphics2d = image.createGraphics(); Graphics2D graphics2d = image.createGraphics();
// 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);
}
try try
{ {
renderer.render(graphics2d, OverlayLayer.ABOVE_SCENE); renderer.render(graphics2d, OverlayLayer.ABOVE_SCENE);
@@ -432,7 +432,10 @@ public class ConfigManager
String current = getConfiguration(group.value(), item.keyName()); String current = getConfiguration(group.value(), item.keyName());
String valueString = objectToString(defaultValue); 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 continue; // already set to the default value
} }
@@ -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_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_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), 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), 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), 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), DEEP_WILDERNESS_DUNGEON_CREVICE_NORTH(46, "Narrow Crevice", new WorldPoint(3047, 10335, 0), CREVICE_19043),
@@ -30,6 +30,7 @@ import java.awt.Graphics2D;
import java.awt.Polygon; import java.awt.Polygon;
import java.util.Set; import java.util.Set;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import lombok.Getter; import lombok.Getter;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.EquipmentInventorySlot; import net.runelite.api.EquipmentInventorySlot;
@@ -214,6 +215,7 @@ public class EmoteClue extends ClueScroll implements TextClueScroll, LocationClu
} }
private final String text; private final String text;
@Nullable
private final STASHUnit stashUnit; private final STASHUnit stashUnit;
private final WorldPoint location; private final WorldPoint location;
private final Emote firstEmote; private final Emote firstEmote;
@@ -256,15 +258,19 @@ public class EmoteClue extends ClueScroll implements TextClueScroll, LocationClu
if (itemRequirements.length > 0) if (itemRequirements.length > 0)
{ {
Client client = plugin.getClient(); 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() if (stashUnit != null)
.left("STASH Unit:") {
.right(stashUnitBuilt ? UNICODE_CHECK_MARK : UNICODE_BALLOT_X) client.runScript(ScriptID.WATSON_STASH_UNIT_CHECK, stashUnit.getObjectId(), 0, 0, 0);
.rightColor(stashUnitBuilt ? Color.GREEN : Color.RED) int[] intStack = client.getIntStack();
.build()); 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()); 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); OverlayUtil.renderTileOverlay(plugin.getClient(), graphics, localPoint, plugin.getEmoteImage(), Color.ORANGE);
} }
final WorldPoint[] worldPoints = stashUnit.getWorldPoints(); if (stashUnit != null)
for (final WorldPoint worldPoint : worldPoints)
{ {
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); final LocalPoint stashUnitLocalPoint = LocalPoint.fromWorld(plugin.getClient(), worldPoint);
if (poly != null)
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);
}
} }
} }
} }
@@ -79,7 +79,7 @@ public class FaloTheBardClue extends ClueScroll implements TextClueScroll, NpcCl
{ {
private static final List<FaloTheBardClue> CLUES = ImmutableList.of( 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 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 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 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)), 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 // 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 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("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 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("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)), new FaloTheBardClue("No attack to wield, only strength is required, made of obsidian, but with no room for a shield.", item(TZHAARKETOM)),
@@ -172,7 +172,8 @@ public class CookingPlugin extends Plugin
session.increaseCookAmount(); session.increaseCookAmount();
} }
else if (message.startsWith("You accidentally burn")) else if (message.startsWith("You accidentally burn")
|| message.startsWith("You accidentally spoil"))
{ {
if (session == null) if (session == null)
{ {
@@ -133,6 +133,8 @@ class DevToolsPanel extends PluginPanel
} }
}); });
container.add(plugin.getSoundEffects());
return container; return container;
} }
} }
@@ -100,6 +100,9 @@ public class DevToolsPlugin extends Plugin
@Inject @Inject
private WorldMapRegionOverlay mapRegionOverlay; private WorldMapRegionOverlay mapRegionOverlay;
@Inject
private SoundEffectOverlay soundEffectOverlay;
@Inject @Inject
private EventBus eventBus; private EventBus eventBus;
@@ -128,6 +131,7 @@ public class DevToolsPlugin extends Plugin
private DevToolsButton widgetInspector; private DevToolsButton widgetInspector;
private DevToolsButton varInspector; private DevToolsButton varInspector;
private DevToolsButton logMenuActions; private DevToolsButton logMenuActions;
private DevToolsButton soundEffects;
private NavigationButton navButton; private NavigationButton navButton;
@Provides @Provides
@@ -154,30 +158,35 @@ public class DevToolsPlugin extends Plugin
location = new DevToolsButton("Location"); location = new DevToolsButton("Location");
worldMapLocation = new DevToolsButton("World Map Location"); worldMapLocation = new DevToolsButton("World Map Location");
tileLocation = new DevToolsButton("Tile Location"); tileLocation = new DevToolsButton("Tile Location");
cursorPos = new DevToolsButton("Cursor Position"); cursorPos = new DevToolsButton("Cursor Position");
cameraPosition = new DevToolsButton("Camera Position"); cameraPosition = new DevToolsButton("Camera Position");
chunkBorders = new DevToolsButton("Chunk Borders"); chunkBorders = new DevToolsButton("Chunk Borders");
mapSquares = new DevToolsButton("Map Squares");
mapSquares = new DevToolsButton("Map Squares");
lineOfSight = new DevToolsButton("Line Of Sight"); lineOfSight = new DevToolsButton("Line Of Sight");
validMovement = new DevToolsButton("Valid Movement"); validMovement = new DevToolsButton("Valid Movement");
interacting = new DevToolsButton("Interacting"); interacting = new DevToolsButton("Interacting");
examine = new DevToolsButton("Examine");
examine = new DevToolsButton("Examine");
detachedCamera = new DevToolsButton("Detached Camera"); detachedCamera = new DevToolsButton("Detached Camera");
widgetInspector = new DevToolsButton("Widget Inspector"); widgetInspector = new DevToolsButton("Widget Inspector");
varInspector = new DevToolsButton("Var Inspector"); varInspector = new DevToolsButton("Var Inspector");
soundEffects = new DevToolsButton("Sound Effects");
logMenuActions = new DevToolsButton("Menu Actions");
overlayManager.add(overlay); overlayManager.add(overlay);
overlayManager.add(locationOverlay); overlayManager.add(locationOverlay);
overlayManager.add(sceneOverlay); overlayManager.add(sceneOverlay);
overlayManager.add(cameraOverlay); overlayManager.add(cameraOverlay);
overlayManager.add(worldMapLocationOverlay); overlayManager.add(worldMapLocationOverlay);
overlayManager.add(mapRegionOverlay); overlayManager.add(mapRegionOverlay);
overlayManager.add(soundEffectOverlay);
logMenuActions = new DevToolsButton("Menu Actions");
final DevToolsPanel panel = injector.getInstance(DevToolsPanel.class); final DevToolsPanel panel = injector.getInstance(DevToolsPanel.class);
@@ -191,17 +200,21 @@ public class DevToolsPlugin extends Plugin
.build(); .build();
clientToolbar.addNavigation(navButton); clientToolbar.addNavigation(navButton);
eventBus.register(soundEffectOverlay);
} }
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(soundEffectOverlay);
overlayManager.remove(overlay); overlayManager.remove(overlay);
overlayManager.remove(locationOverlay); overlayManager.remove(locationOverlay);
overlayManager.remove(sceneOverlay); overlayManager.remove(sceneOverlay);
overlayManager.remove(cameraOverlay); overlayManager.remove(cameraOverlay);
overlayManager.remove(worldMapLocationOverlay); overlayManager.remove(worldMapLocationOverlay);
overlayManager.remove(mapRegionOverlay); overlayManager.remove(mapRegionOverlay);
overlayManager.remove(soundEffectOverlay);
clientToolbar.removeNavigation(navButton); clientToolbar.removeNavigation(navButton);
} }
@@ -341,6 +354,12 @@ public class DevToolsPlugin extends Plugin
player.getPlayerAppearance().setHash(); player.getPlayerAppearance().setHash();
break; break;
} }
case "sound":
{
int id = Integer.parseInt(args[0]);
client.playSoundEffect(id);
break;
}
} }
} }
@@ -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);
}
}
}
@@ -88,7 +88,6 @@ public class WidgetField<T>
} }
else else
{ {
setter.accept(widget, (T) value);
log.warn("Type {} is not supported for editing", type); log.warn("Type {} is not supported for editing", type);
} }
setter.accept(widget, (T) value); setter.accept(widget, (T) value);
@@ -47,7 +47,7 @@ class WorldMapRegionOverlay extends Overlay
private static final int LABEL_PADDING = 4; private static final int LABEL_PADDING = 4;
private static final int REGION_SIZE = 1 << 6; private static final int REGION_SIZE = 1 << 6;
// Bitmask to return first coordinate in region // Bitmask to return first coordinate in region
private static final int REGION_TRUNCATE = -(1 << 6); private static final int REGION_TRUNCATE = ~((1 << 6) - 1);
private final Client client; private final Client client;
private final DevToolsPlugin plugin; private final DevToolsPlugin plugin;
@@ -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_7946;
import static net.runelite.api.NpcID.FISHING_SPOT_7947; 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_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;
import static net.runelite.api.NpcID.ROD_FISHING_SPOT_1508; import static net.runelite.api.NpcID.ROD_FISHING_SPOT_1508;
import static net.runelite.api.NpcID.ROD_FISHING_SPOT_1509; 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_7464;
import static net.runelite.api.NpcID.ROD_FISHING_SPOT_7468; 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_7676;
import static net.runelite.api.NpcID.ROD_FISHING_SPOT_8524;
@Getter @Getter
enum FishingSpot enum FishingSpot
@@ -115,7 +119,8 @@ enum FishingSpot
FISHING_SPOT_1511, FISHING_SPOT_1520, FISHING_SPOT_3915, FISHING_SPOT_1511, FISHING_SPOT_1520, FISHING_SPOT_3915,
FISHING_SPOT_4476, FISHING_SPOT_4477, FISHING_SPOT_5233, FISHING_SPOT_4476, FISHING_SPOT_4477, FISHING_SPOT_5233,
FISHING_SPOT_5234, FISHING_SPOT_5821, FISHING_SPOT_7200, 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, MONKFISH("Monkfish", ItemID.RAW_MONKFISH,
FISHING_SPOT_4316 FISHING_SPOT_4316
@@ -124,7 +129,7 @@ enum FishingSpot
ROD_FISHING_SPOT, ROD_FISHING_SPOT_1508, ROD_FISHING_SPOT_1509, 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_1513, ROD_FISHING_SPOT_1515, ROD_FISHING_SPOT_1526,
ROD_FISHING_SPOT_1527, ROD_FISHING_SPOT_7463, ROD_FISHING_SPOT_7464, 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, BARB_FISH("Sturgeon, Salmon, Trout", ItemID.LEAPING_STURGEON,
FISHING_SPOT_1542, FISHING_SPOT_7323 FISHING_SPOT_1542, FISHING_SPOT_7323
@@ -27,6 +27,7 @@ package net.runelite.client.plugins.metronome;
import com.google.inject.Provides; import com.google.inject.Provides;
import javax.inject.Inject; import javax.inject.Inject;
import net.runelite.api.SoundEffectVolume;
import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem; import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip; import javax.sound.sampled.Clip;
@@ -164,7 +165,7 @@ public class MetronomePlugin extends Plugin
{ {
if (tockClip == null) if (tockClip == null)
{ {
client.playSoundEffect(SoundEffectID.GE_INCREMENT_PLOP); client.playSoundEffect(SoundEffectID.GE_DECREMENT_PLOP, SoundEffectVolume.MEDIUM_HIGH);
} }
else else
{ {
@@ -180,7 +181,7 @@ public class MetronomePlugin extends Plugin
{ {
if (tickClip == null) if (tickClip == null)
{ {
client.playSoundEffect(SoundEffectID.GE_DECREMENT_PLOP); client.playSoundEffect(SoundEffectID.GE_DECREMENT_PLOP, SoundEffectVolume.MEDIUM_HIGH);
} }
else else
{ {
@@ -194,7 +194,7 @@ public class NpcSceneOverlay extends Overlay
break; break;
} }
if (config.drawNames()) if (config.drawNames() && actor.getName() != null)
{ {
String npcName = Text.removeTags(actor.getName()); String npcName = Text.removeTags(actor.getName());
Point textLocation = actor.getCanvasTextLocation(graphics, npcName, actor.getLogicalHeight() + 40); Point textLocation = actor.getCanvasTextLocation(graphics, npcName, actor.getLogicalHeight() + 40);
@@ -32,7 +32,6 @@ import java.util.Iterator;
import javax.inject.Inject; import javax.inject.Inject;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.Perspective; import net.runelite.api.Perspective;
import net.runelite.api.Point;
import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.LocalPoint;
import net.runelite.client.plugins.party.data.PartyTilePingData; import net.runelite.client.plugins.party.data.PartyTilePingData;
import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.Overlay;
@@ -60,18 +59,6 @@ class PartyPingOverlay extends Overlay
return null; 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()) synchronized (plugin.getPendingTilePings())
{ {
final Iterator<PartyTilePingData> iterator = plugin.getPendingTilePings().iterator(); final Iterator<PartyTilePingData> iterator = plugin.getPendingTilePings().iterator();
@@ -310,14 +310,6 @@ public abstract class RSClientMixin implements RSClient
return AccountType.NORMAL; return AccountType.NORMAL;
} }
@Inject
@Override
public void setMouseCanvasHoverPosition(final Point position)
{
setMouseCanvasHoverPositionX(position.getX());
setMouseCanvasHoverPositionY(position.getY());
}
@Inject @Inject
@Override @Override
public Tile getSelectedSceneTile() public Tile getSelectedSceneTile()
@@ -83,6 +83,16 @@ public abstract class RSSceneMixin implements RSScene
} }
final boolean isGpu = client.isGpu(); final boolean isGpu = client.isGpu();
final boolean checkClick = client.isCheckClick();
if (!client.isMenuOpen())
{
// Force check click to update the selected tile
client.setCheckClick(true);
final int mouseX = client.getMouseX();
final int mouseY = client.getMouseY();
client.setMouseCanvasHoverPositionX(mouseX - client.getViewportXOffset());
client.setMouseCanvasHoverPositionY(mouseY - client.getViewportYOffset());
}
if (!isGpu) if (!isGpu)
{ {
@@ -287,6 +297,10 @@ public abstract class RSSceneMixin implements RSScene
if (client.getTileUpdateCount() == 0) if (client.getTileUpdateCount() == 0)
{ {
client.setCheckClick(false); client.setCheckClick(false);
if (!checkClick)
{
client.setViewportWalking(false);
}
client.getCallbacks().drawScene(); client.getCallbacks().drawScene();
return; return;
} }
@@ -354,6 +368,10 @@ public abstract class RSSceneMixin implements RSScene
if (client.getTileUpdateCount() == 0) if (client.getTileUpdateCount() == 0)
{ {
client.setCheckClick(false); client.setCheckClick(false);
if (!checkClick)
{
client.setViewportWalking(false);
}
client.getCallbacks().drawScene(); client.getCallbacks().drawScene();
return; return;
} }
@@ -363,6 +381,12 @@ public abstract class RSSceneMixin implements RSScene
} }
client.setCheckClick(false); client.setCheckClick(false);
if (!checkClick)
{
// If checkClick was false, then the selected tile wouldn't have existed next tick,
// so clear viewport walking in order to prevent it triggering a walk
client.setViewportWalking(false);
}
client.getCallbacks().drawScene(); client.getCallbacks().drawScene();
} }
@@ -0,0 +1,148 @@
/*
* Copyright (c) 2018, SomeoneWithAnInternetConnection
* 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.mixins;
import net.runelite.api.SoundEffectVolume;
import net.runelite.api.events.AreaSoundEffectPlayed;
import net.runelite.api.events.SoundEffectPlayed;
import net.runelite.api.mixins.FieldHook;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSRawPcmStream;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSRawSound;
import net.runelite.rs.api.RSSoundEffect;
import net.runelite.rs.api.RSPcmStream;
@Mixin(RSClient.class)
public abstract class SoundEffectMixin implements RSClient
{
@Shadow("client")
private static RSClient client;
@Inject
private static int lastSoundEffectCount;
@Inject
@Override
public void playSoundEffect(int id)
{
playSoundEffect(id, 0, 0, 0, 0);
}
@Inject
@Override
public void playSoundEffect(int id, int x, int y, int range)
{
playSoundEffect(id, x, y, range, 0);
}
@Inject
@Override
public void playSoundEffect(int id, int x, int y, int range, int delay)
{
int position = ((x & 255) << 16) + ((y & 255) << 8) + (range & 255);
int[] queuedSoundEffectIDs = getQueuedSoundEffectIDs();
int[] queuedSoundEffectLoops = getQueuedSoundEffectLoops();
int[] queuedSoundEffectDelays = getQueuedSoundEffectDelays();
RSSoundEffect[] audioEffects = getAudioEffects();
int[] soundLocations = getSoundLocations();
int queuedSoundEffectCount = getQueuedSoundEffectCount();
queuedSoundEffectIDs[queuedSoundEffectCount] = id;
queuedSoundEffectLoops[queuedSoundEffectCount] = 1;
queuedSoundEffectDelays[queuedSoundEffectCount] = delay;
audioEffects[queuedSoundEffectCount] = null;
soundLocations[queuedSoundEffectCount] = position;
setQueuedSoundEffectCount(queuedSoundEffectCount + 1);
}
@Inject
@Override
public void playSoundEffect(int id, int volume)
{
RSSoundEffect soundEffect = getTrack(getIndexCache4(), id, 0);
if (soundEffect == null)
{
return;
}
// If the current volume is not muted, use it instead
final int soundEffectVolume = getSoundEffectVolume();
if (soundEffectVolume != SoundEffectVolume.MUTED)
{
volume = soundEffectVolume;
}
RSRawSound rawAudioNode = soundEffect.toRawAudioNode().applyResampler(getSoundEffectResampler());
RSRawPcmStream rawPcmStream = createRawPcmStream(rawAudioNode, 100, volume);
rawPcmStream.setNumLoops(1);
getSoundEffectAudioQueue().addSubStream((RSPcmStream) rawPcmStream);
}
@FieldHook("soundEffectCount")
@Inject
public static void queuedSoundEffectCountChanged(int idx)
{
int soundCount = client.getQueuedSoundEffectCount();
if (soundCount == lastSoundEffectCount + 1)
{
int soundIndex = soundCount - 1;
int packedLocation = client.getSoundLocations()[soundIndex];
if (packedLocation == 0)
{
// Regular sound effect
SoundEffectPlayed event = new SoundEffectPlayed();
event.setSoundId(client.getQueuedSoundEffectIDs()[soundIndex]);
event.setDelay(client.getQueuedSoundEffectDelays()[soundIndex]);
client.getCallbacks().post(event);
}
else
{
// Area sound effect
int x = (packedLocation >> 16) & 0xFF;
int y = (packedLocation >> 8) & 0xFF;
int range = (packedLocation) & 0xFF;
AreaSoundEffectPlayed event = new AreaSoundEffectPlayed();
event.setSoundId(client.getQueuedSoundEffectIDs()[soundIndex]);
event.setSceneX(x);
event.setSceneY(y);
event.setRange(range);
event.setDelay(client.getQueuedSoundEffectDelays()[soundIndex]);
client.getCallbacks().post(event);
}
}
lastSoundEffectCount = soundCount;
}
}
@@ -147,7 +147,6 @@ public interface RSClient extends RSGameShell, Client
void setGameState(int gameState); void setGameState(int gameState);
@Import("checkClick") @Import("checkClick")
@Override
void setCheckClick(boolean checkClick); void setCheckClick(boolean checkClick);
@Import("Scene_selectedScreenX") @Import("Scene_selectedScreenX")
@@ -563,8 +562,8 @@ public interface RSClient extends RSGameShell, Client
@Import("soundLocations") @Import("soundLocations")
int[] getSoundLocations(); int[] getSoundLocations();
@Import("unknownSoundValues1") @Import("queuedSoundEffectLoops")
int[] getUnknownSoundValues1(); int[] getQueuedSoundEffectLoops();
@Import("queuedSoundEffectDelays") @Import("queuedSoundEffectDelays")
int[] getQueuedSoundEffectDelays(); int[] getQueuedSoundEffectDelays();
@@ -575,6 +574,9 @@ public interface RSClient extends RSGameShell, Client
@Import("soundEffectCount") @Import("soundEffectCount")
void setQueuedSoundEffectCount(int queuedSoundEffectCount); void setQueuedSoundEffectCount(int queuedSoundEffectCount);
@Import("queueSoundEffect")
void queueSoundEffect(int id, int numLoops, int delay);
@Import("rasterProvider") @Import("rasterProvider")
@Override @Override
RSAbstractRasterProvider getBufferProvider(); RSAbstractRasterProvider getBufferProvider();
@@ -1005,11 +1007,31 @@ public interface RSClient extends RSGameShell, Client
@Import("mouseRecorder") @Import("mouseRecorder")
RSMouseRecorder getMouseRecorder(); RSMouseRecorder getMouseRecorder();
@Import("selectedSpellName") @Import("selectedSpellName")
String getSelectedSpellName(); String getSelectedSpellName();
@Import("isSpellSelected") @Import("isSpellSelected")
boolean getIsSpellSelected(); boolean getIsSpellSelected();
@Import("readSoundEffect")
RSSoundEffect getTrack(RSAbstractIndexCache indexData, int id, int var0);
@Import("createRawPcmStream")
RSRawPcmStream createRawPcmStream(RSRawSound audioNode, int var0, int volume);
@Import("pcmStreamMixer")
RSPcmStreamMixer getSoundEffectAudioQueue();
@Import("indexCache4")
RSAbstractIndexCache getIndexCache4();
@Import("decimator")
RSDecimator getSoundEffectResampler();
@Import("soundEffectVolume")
int getSoundEffectVolume();
@Import("viewportWalking")
void setViewportWalking(boolean viewportWalking);
} }
@@ -0,0 +1,29 @@
/*
* Copyright (c) 2018, trimbe <github.com/trimbe>
* 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.rs.api;
public interface RSDecimator
{
}
@@ -0,0 +1,29 @@
/*
* Copyright (c) 2018, trimbe <github.com/trimbe>
* 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.rs.api;
public interface RSPcmStream
{
}
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2018, trimbe <github.com/trimbe>
* 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.rs.api;
import net.runelite.mapping.Import;
public interface RSPcmStreamMixer
{
@Import("addSubStream")
void addSubStream(RSPcmStream taskDataNode);
}
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2018, trimbe <github.com/trimbe>
* 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.rs.api;
import net.runelite.mapping.Import;
public interface RSRawPcmStream
{
@Import("setNumLoops")
void setNumLoops(int numLoops);
}
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2018, trimbe <github.com/trimbe>
* 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.rs.api;
import net.runelite.mapping.Import;
public interface RSRawSound
{
@Import("resample")
RSRawSound applyResampler(RSDecimator resampler);
}
@@ -1,5 +1,33 @@
/*
* Copyright (c) 2018, SomeoneWithAnInternetConnection
* 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.rs.api; package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface RSSoundEffect public interface RSSoundEffect
{ {
@Import("toRawSound")
RSRawSound toRawAudioNode();
} }
@@ -58,7 +58,6 @@ public final class Bzip2State {
@ObfuscatedGetter( @ObfuscatedGetter(
intValue = 1860254567 intValue = 1860254567
) )
@Export("surfaceOffsetY")
int __n; int __n;
@ObfuscatedName("i") @ObfuscatedName("i")
@Export("__i") @Export("__i")
+10 -10
View File
@@ -296,8 +296,8 @@ public final class Client extends GameShell implements Usernamed {
@Export("indexCacheLoaderIndex") @Export("indexCacheLoaderIndex")
static int indexCacheLoaderIndex; static int indexCacheLoaderIndex;
@ObfuscatedName("qn") @ObfuscatedName("qn")
@Export("unknownSoundValues1") @Export("queuedSoundEffectLoops")
static int[] unknownSoundValues1; static int[] queuedSoundEffectLoops;
@ObfuscatedName("qd") @ObfuscatedName("qd")
@Export("queuedSoundEffectDelays") @Export("queuedSoundEffectDelays")
static int[] queuedSoundEffectDelays; static int[] queuedSoundEffectDelays;
@@ -380,8 +380,8 @@ public final class Client extends GameShell implements Usernamed {
@ObfuscatedGetter( @ObfuscatedGetter(
intValue = -1352723865 intValue = -1352723865
) )
@Export("__client_qp") @Export("soundEffectVolume")
static int __client_qp; static int soundEffectVolume;
@ObfuscatedName("rm") @ObfuscatedName("rm")
@Export("__client_rm") @Export("__client_rm")
static short __client_rm; static short __client_rm;
@@ -1602,11 +1602,11 @@ public final class Client extends GameShell implements Usernamed {
__client_qf = 255; __client_qf = 255;
__client_qy = -1; __client_qy = -1;
__client_qq = false; __client_qq = false;
__client_qp = 127; soundEffectVolume = 127;
__client_qc = 127; __client_qc = 127;
soundEffectCount = 0; soundEffectCount = 0;
soundEffectIds = new int[50]; soundEffectIds = new int[50];
unknownSoundValues1 = new int[50]; queuedSoundEffectLoops = new int[50];
queuedSoundEffectDelays = new int[50]; queuedSoundEffectDelays = new int[50];
soundLocations = new int[50]; soundLocations = new int[50];
soundEffects = new SoundEffect[50]; soundEffects = new SoundEffect[50];
@@ -4803,8 +4803,8 @@ public final class Client extends GameShell implements Usernamed {
SoundEffect var16 = SoundEffect.readSoundEffect(class25.indexCache4, var15.soundEffectId, 0); SoundEffect var16 = SoundEffect.readSoundEffect(class25.indexCache4, var15.soundEffectId, 0);
if(var16 != null) { if(var16 != null) {
RawSound var17 = var16.toRawSound().resample(MilliClock.decimator); RawSound var17 = var16.toRawSound().resample(MilliClock.decimator);
RawPcmStream var18 = RawPcmStream.method2497(var17, 100, var7); RawPcmStream var18 = RawPcmStream.createRawPcmStream(var17, 100, var7);
var18.__x_181(-1); var18.setNumLoops(-1);
TaskHandler.pcmStreamMixer.addSubStream(var18); TaskHandler.pcmStreamMixer.addSubStream(var18);
var15.stream1 = var18; var15.stream1 = var18;
} }
@@ -4820,8 +4820,8 @@ public final class Client extends GameShell implements Usernamed {
SoundEffect var20 = SoundEffect.readSoundEffect(class25.indexCache4, var15.soundEffectIds[var8], 0); SoundEffect var20 = SoundEffect.readSoundEffect(class25.indexCache4, var15.soundEffectIds[var8], 0);
if(var20 != null) { if(var20 != null) {
RawSound var21 = var20.toRawSound().resample(MilliClock.decimator); RawSound var21 = var20.toRawSound().resample(MilliClock.decimator);
RawPcmStream var19 = RawPcmStream.method2497(var21, 100, var7); RawPcmStream var19 = RawPcmStream.createRawPcmStream(var21, 100, var7);
var19.__x_181(0); var19.setNumLoops(0);
TaskHandler.pcmStreamMixer.addSubStream(var19); TaskHandler.pcmStreamMixer.addSubStream(var19);
var15.stream2 = var19; var15.stream2 = var19;
var15.__n = var15.__x + (int)(Math.random() * (double)(var15.__d - var15.__x)); var15.__n = var15.__x + (int)(Math.random() * (double)(var15.__d - var15.__x));
@@ -53,7 +53,6 @@ public class HitSplatDefinition extends DualNode {
@ObfuscatedGetter( @ObfuscatedGetter(
intValue = -1151968735 intValue = -1151968735
) )
@Export("surfaceOffsetY")
public int __n; public int __n;
@ObfuscatedName("i") @ObfuscatedName("i")
@ObfuscatedGetter( @ObfuscatedGetter(
+2 -2
View File
@@ -48,9 +48,9 @@ public class Ignored extends User {
) )
@Export("queueSoundEffect") @Export("queueSoundEffect")
static void queueSoundEffect(int var0, int var1, int var2) { static void queueSoundEffect(int var0, int var1, int var2) {
if(Client.__client_qp != 0 && var1 != 0 && Client.soundEffectCount < 50) { if(Client.soundEffectVolume != 0 && var1 != 0 && Client.soundEffectCount < 50) {
Client.soundEffectIds[Client.soundEffectCount] = var0; Client.soundEffectIds[Client.soundEffectCount] = var0;
Client.unknownSoundValues1[Client.soundEffectCount] = var1; Client.queuedSoundEffectLoops[Client.soundEffectCount] = var1;
Client.queuedSoundEffectDelays[Client.soundEffectCount] = var2; Client.queuedSoundEffectDelays[Client.soundEffectCount] = var2;
Client.soundEffects[Client.soundEffectCount] = null; Client.soundEffects[Client.soundEffectCount] = null;
Client.soundLocations[Client.soundEffectCount] = 0; Client.soundLocations[Client.soundEffectCount] = 0;
@@ -480,23 +480,23 @@ public class IndexCache extends AbstractIndexCache {
if(var4 == 4) { if(var4 == 4) {
if(var2 == 0) { if(var2 == 0) {
Client.__client_qp = 127; Client.soundEffectVolume = 127;
} }
if(var2 == 1) { if(var2 == 1) {
Client.__client_qp = 96; Client.soundEffectVolume = 96;
} }
if(var2 == 2) { if(var2 == 2) {
Client.__client_qp = 64; Client.soundEffectVolume = 64;
} }
if(var2 == 3) { if(var2 == 3) {
Client.__client_qp = 32; Client.soundEffectVolume = 32;
} }
if(var2 == 4) { if(var2 == 4) {
Client.__client_qp = 0; Client.soundEffectVolume = 0;
} }
} }
@@ -50,7 +50,6 @@ public class MidiPcmStream extends PcmStream {
@Export("__k") @Export("__k")
int[] __k; int[] __k;
@ObfuscatedName("n") @ObfuscatedName("n")
@Export("surfaceOffsetY")
int[] __n; int[] __n;
@ObfuscatedName("y") @ObfuscatedName("y")
@Export("__y") @Export("__y")
@@ -435,7 +434,7 @@ public class MidiPcmStream extends PcmStream {
} }
if(var9.__q[var2] < 0) { if(var9.__q[var2] < 0) {
var6.stream.__x_181(-1); var6.stream.setNumLoops(-1);
} }
if(var6.__o >= 0) { if(var6.__o >= 0) {
@@ -89,7 +89,6 @@ public class MusicPatchNode extends Node {
@ObfuscatedGetter( @ObfuscatedGetter(
intValue = 476852577 intValue = 476852577
) )
@Export("surfaceOffsetY")
int __n; int __n;
@ObfuscatedName("i") @ObfuscatedName("i")
@ObfuscatedGetter( @ObfuscatedGetter(
@@ -78,7 +78,7 @@ public class MusicPatchPcmStream extends PcmStream {
} }
if(var1.patch.__q[var1.__u] < 0) { if(var1.patch.__q[var1.__u] < 0) {
var1.stream.__x_181(-1); var1.stream.setNumLoops(-1);
} }
var10.__v_192(var8); var10.__v_192(var8);
@@ -112,7 +112,7 @@ public class MusicPatchPcmStream extends PcmStream {
} }
if(var1.patch.__q[var1.__u] < 0) { if(var1.patch.__q[var1.__u] < 0) {
var1.stream.__x_181(-1); var1.stream.setNumLoops(-1);
} }
var2 = var1.__b / var3; var2 = var1.__b / var3;
@@ -86,7 +86,6 @@ public final class ObjectSound extends Node {
@ObfuscatedGetter( @ObfuscatedGetter(
intValue = -1041508847 intValue = -1041508847
) )
@Export("surfaceOffsetY")
int __n; int __n;
@ObfuscatedName("i") @ObfuscatedName("i")
@ObfuscatedSignature( @ObfuscatedSignature(
@@ -83,7 +83,6 @@ public final class Occluder {
@ObfuscatedGetter( @ObfuscatedGetter(
intValue = -407777817 intValue = -407777817
) )
@Export("surfaceOffsetY")
int __n; int __n;
@ObfuscatedName("i") @ObfuscatedName("i")
@ObfuscatedGetter( @ObfuscatedGetter(
@@ -87,7 +87,6 @@ public class PacketWriter {
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "Lge;" signature = "Lge;"
) )
@Export("surfaceOffsetY")
ServerPacket __n; ServerPacket __n;
@ObfuscatedName("i") @ObfuscatedName("i")
@ObfuscatedSignature( @ObfuscatedSignature(
@@ -28,8 +28,8 @@ public class RawPcmStream extends PcmStream {
@Export("__l") @Export("__l")
int __l; int __l;
@ObfuscatedName("e") @ObfuscatedName("e")
@Export("__e") @Export("numLoops")
int __e; int numLoops;
@ObfuscatedName("x") @ObfuscatedName("x")
@Export("start") @Export("start")
int start; int start;
@@ -40,7 +40,6 @@ public class RawPcmStream extends PcmStream {
@Export("__k") @Export("__k")
boolean __k; boolean __k;
@ObfuscatedName("n") @ObfuscatedName("n")
@Export("surfaceOffsetY")
int __n; int __n;
@ObfuscatedName("i") @ObfuscatedName("i")
@Export("__i") @Export("__i")
@@ -122,7 +121,7 @@ public class RawPcmStream extends PcmStream {
int var7 = var4.samples.length << 8; int var7 = var4.samples.length << 8;
int var8 = var6 - var5; int var8 = var6 - var5;
if(var8 <= 0) { if(var8 <= 0) {
this.__e = 0; this.numLoops = 0;
} }
int var9 = var2; int var9 = var2;
@@ -147,7 +146,7 @@ public class RawPcmStream extends PcmStream {
this.__m = var7 - 1; this.__m = var7 - 1;
} }
if(this.__e < 0) { if(this.numLoops < 0) {
if(this.__k) { if(this.__k) {
if(this.__f < 0) { if(this.__f < 0) {
var9 = this.__ap_203(var1, var2, var5, var3, var4.samples[this.start]); var9 = this.__ap_203(var1, var2, var5, var3, var4.samples[this.start]);
@@ -195,7 +194,7 @@ public class RawPcmStream extends PcmStream {
} }
} }
} else { } else {
if(this.__e > 0) { if(this.numLoops > 0) {
if(this.__k) { if(this.__k) {
label140: { label140: {
if(this.__f < 0) { if(this.__f < 0) {
@@ -206,7 +205,7 @@ public class RawPcmStream extends PcmStream {
this.__m = var5 + var5 - 1 - this.__m; this.__m = var5 + var5 - 1 - this.__m;
this.__f = -this.__f; this.__f = -this.__f;
if(--this.__e == 0) { if(--this.numLoops == 0) {
break label140; break label140;
} }
} }
@@ -219,7 +218,7 @@ public class RawPcmStream extends PcmStream {
this.__m = var6 + var6 - 1 - this.__m; this.__m = var6 + var6 - 1 - this.__m;
this.__f = -this.__f; this.__f = -this.__f;
if(--this.__e == 0) { if(--this.numLoops == 0) {
break; break;
} }
@@ -230,7 +229,7 @@ public class RawPcmStream extends PcmStream {
this.__m = var5 + var5 - 1 - this.__m; this.__m = var5 + var5 - 1 - this.__m;
this.__f = -this.__f; this.__f = -this.__f;
} while(--this.__e != 0); } while(--this.numLoops != 0);
} }
} else { } else {
int var10; int var10;
@@ -242,14 +241,14 @@ public class RawPcmStream extends PcmStream {
} }
var10 = (var6 - 1 - this.__m) / var8; var10 = (var6 - 1 - this.__m) / var8;
if(var10 >= this.__e) { if(var10 >= this.numLoops) {
this.__m += var8 * this.__e; this.__m += var8 * this.numLoops;
this.__e = 0; this.numLoops = 0;
break; break;
} }
this.__m += var8 * var10; this.__m += var8 * var10;
this.__e -= var10; this.numLoops -= var10;
} }
} else { } else {
while(true) { while(true) {
@@ -259,14 +258,14 @@ public class RawPcmStream extends PcmStream {
} }
var10 = (this.__m - var5) / var8; var10 = (this.__m - var5) / var8;
if(var10 >= this.__e) { if(var10 >= this.numLoops) {
this.__m -= var8 * this.__e; this.__m -= var8 * this.numLoops;
this.__e = 0; this.numLoops = 0;
break; break;
} }
this.__m -= var8 * var10; this.__m -= var8 * var10;
this.__e -= var10; this.numLoops -= var10;
} }
} }
} }
@@ -293,9 +292,9 @@ public class RawPcmStream extends PcmStream {
} }
@ObfuscatedName("x") @ObfuscatedName("x")
@Export("__x_181") @Export("setNumLoops")
public synchronized void __x_181(int var1) { public synchronized void setNumLoops(int var1) {
this.__e = var1; this.numLoops = var1;
} }
@ObfuscatedName("d") @ObfuscatedName("d")
@@ -327,7 +326,7 @@ public class RawPcmStream extends PcmStream {
int var5 = var2.samples.length << 8; int var5 = var2.samples.length << 8;
int var6 = var4 - var3; int var6 = var4 - var3;
if(var6 <= 0) { if(var6 <= 0) {
this.__e = 0; this.numLoops = 0;
} }
if(this.__m < 0) { if(this.__m < 0) {
@@ -351,7 +350,7 @@ public class RawPcmStream extends PcmStream {
} }
this.__m += this.__f * var1; this.__m += this.__f * var1;
if(this.__e < 0) { if(this.numLoops < 0) {
if(!this.__k) { if(!this.__k) {
if(this.__f < 0) { if(this.__f < 0) {
if(this.__m >= var3) { if(this.__m >= var3) {
@@ -390,7 +389,7 @@ public class RawPcmStream extends PcmStream {
} }
} else { } else {
if(this.__e > 0) { if(this.numLoops > 0) {
if(this.__k) { if(this.__k) {
label123: { label123: {
if(this.__f < 0) { if(this.__f < 0) {
@@ -400,7 +399,7 @@ public class RawPcmStream extends PcmStream {
this.__m = var3 + var3 - 1 - this.__m; this.__m = var3 + var3 - 1 - this.__m;
this.__f = -this.__f; this.__f = -this.__f;
if(--this.__e == 0) { if(--this.numLoops == 0) {
break label123; break label123;
} }
} }
@@ -412,7 +411,7 @@ public class RawPcmStream extends PcmStream {
this.__m = var4 + var4 - 1 - this.__m; this.__m = var4 + var4 - 1 - this.__m;
this.__f = -this.__f; this.__f = -this.__f;
if(--this.__e == 0) { if(--this.numLoops == 0) {
break; break;
} }
@@ -422,7 +421,7 @@ public class RawPcmStream extends PcmStream {
this.__m = var3 + var3 - 1 - this.__m; this.__m = var3 + var3 - 1 - this.__m;
this.__f = -this.__f; this.__f = -this.__f;
} while(--this.__e != 0); } while(--this.numLoops != 0);
} }
} else { } else {
int var7; int var7;
@@ -432,28 +431,28 @@ public class RawPcmStream extends PcmStream {
} }
var7 = (var4 - 1 - this.__m) / var6; var7 = (var4 - 1 - this.__m) / var6;
if(var7 < this.__e) { if(var7 < this.numLoops) {
this.__m += var6 * var7; this.__m += var6 * var7;
this.__e -= var7; this.numLoops -= var7;
return; return;
} }
this.__m += var6 * this.__e; this.__m += var6 * this.numLoops;
this.__e = 0; this.numLoops = 0;
} else { } else {
if(this.__m < var4) { if(this.__m < var4) {
return; return;
} }
var7 = (this.__m - var3) / var6; var7 = (this.__m - var3) / var6;
if(var7 < this.__e) { if(var7 < this.numLoops) {
this.__m -= var6 * var7; this.__m -= var6 * var7;
this.__e -= var7; this.numLoops -= var7;
return; return;
} }
this.__m -= var6 * this.__e; this.__m -= var6 * this.numLoops;
this.__e = 0; this.numLoops = 0;
} }
} }
} }
@@ -779,9 +778,9 @@ public class RawPcmStream extends PcmStream {
int __az_179() { int __az_179() {
int var1 = this.__u * 3 >> 6; int var1 = this.__u * 3 >> 6;
var1 = (var1 ^ var1 >> 31) + (var1 >>> 31); var1 = (var1 ^ var1 >> 31) + (var1 >>> 31);
if(this.__e == 0) { if(this.numLoops == 0) {
var1 -= var1 * this.__m / (((RawSound)super.sound).samples.length << 8); var1 -= var1 * this.__m / (((RawSound)super.sound).samples.length << 8);
} else if(this.__e >= 0) { } else if(this.numLoops >= 0) {
var1 -= var1 * this.start / ((RawSound)super.sound).samples.length; var1 -= var1 * this.start / ((RawSound)super.sound).samples.length;
} }
@@ -872,7 +871,8 @@ public class RawPcmStream extends PcmStream {
@ObfuscatedSignature( @ObfuscatedSignature(
signature = "(Lcx;II)Lds;" signature = "(Lcx;II)Lds;"
) )
public static RawPcmStream method2497(RawSound var0, int var1, int var2) { @Export("createRawPcmStream")
public static RawPcmStream createRawPcmStream(RawSound var0, int var1, int var2) {
return var0.samples != null && var0.samples.length != 0?new RawPcmStream(var0, (int)((long)var0.sampleRate * 256L * (long)var1 / (long)(class309.PcmPlayer_sampleRate * 100)), var2 << 6):null; return var0.samples != null && var0.samples.length != 0?new RawPcmStream(var0, (int)((long)var0.sampleRate * 256L * (long)var1 / (long)(class309.PcmPlayer_sampleRate * 100)), var2 << 6):null;
} }
+7 -7
View File
@@ -82,8 +82,8 @@ public class Scene {
@Export("Scene_selectedY") @Export("Scene_selectedY")
public static int Scene_selectedY; public static int Scene_selectedY;
@ObfuscatedName("ab") @ObfuscatedName("ab")
@Export("__em_ab") @Export("viewportWalking")
static boolean __em_ab; static boolean viewportWalking;
@ObfuscatedName("ad") @ObfuscatedName("ad")
@Export("Scene_planesCount") @Export("Scene_planesCount")
static int Scene_planesCount; static int Scene_planesCount;
@@ -207,7 +207,7 @@ public class Scene {
Scene_selectedScreenY = 0; Scene_selectedScreenY = 0;
Scene_selectedX = -1; Scene_selectedX = -1;
Scene_selectedY = -1; Scene_selectedY = -1;
__em_ab = false; viewportWalking = false;
Scene_planesCount = 4; Scene_planesCount = 4;
Scene_planeOccluderCounts = new int[Scene_planesCount]; Scene_planeOccluderCounts = new int[Scene_planesCount];
Scene_planeOccluders = new Occluder[Scene_planesCount][500]; Scene_planeOccluders = new Occluder[Scene_planesCount][500];
@@ -1066,7 +1066,7 @@ public class Scene {
public void menuOpen(int var1, int var2, int var3, boolean var4) { public void menuOpen(int var1, int var2, int var3, boolean var4) {
if(!method3187() || var4) { if(!method3187() || var4) {
checkClick = true; checkClick = true;
__em_ab = var4; viewportWalking = var4;
Scene_selectedPlane = var1; Scene_selectedPlane = var1;
Scene_selectedScreenX = var2; Scene_selectedScreenX = var2;
Scene_selectedScreenY = var3; Scene_selectedScreenY = var3;
@@ -1078,7 +1078,7 @@ public class Scene {
@ObfuscatedName("as") @ObfuscatedName("as")
@Export("__as_250") @Export("__as_250")
public void __as_250() { public void __as_250() {
__em_ab = true; viewportWalking = true;
} }
@ObfuscatedName("az") @ObfuscatedName("az")
@@ -2561,13 +2561,13 @@ public class Scene {
@ObfuscatedName("am") @ObfuscatedName("am")
public static boolean method3187() { public static boolean method3187() {
return __em_ab && Scene_selectedX != -1; return viewportWalking && Scene_selectedX != -1;
} }
@ObfuscatedName("an") @ObfuscatedName("an")
public static void method3103() { public static void method3103() {
Scene_selectedX = -1; Scene_selectedX = -1;
__em_ab = false; viewportWalking = false;
} }
@ObfuscatedName("ax") @ObfuscatedName("ax")
+1 -1
View File
@@ -124,7 +124,7 @@ public class Script extends DualNode {
int var6 = var4 >> 4 & 7; int var6 = var4 >> 4 & 7;
int var7 = var4 & 15; int var7 = var4 & 15;
Client.soundEffectIds[Client.soundEffectCount] = var5; Client.soundEffectIds[Client.soundEffectCount] = var5;
Client.unknownSoundValues1[Client.soundEffectCount] = var6; Client.queuedSoundEffectLoops[Client.soundEffectCount] = var6;
Client.queuedSoundEffectDelays[Client.soundEffectCount] = 0; Client.queuedSoundEffectDelays[Client.soundEffectCount] = 0;
Client.soundEffects[Client.soundEffectCount] = null; Client.soundEffects[Client.soundEffectCount] = null;
int var8 = (var2 - 64) / 128; int var8 = (var2 - 64) / 128;
@@ -10,13 +10,10 @@ import net.runelite.mapping.ObfuscatedSignature;
@Implements("WorldMapAreaData") @Implements("WorldMapAreaData")
public class WorldMapAreaData extends WorldMapArea { public class WorldMapAreaData extends WorldMapArea {
@ObfuscatedName("n") @ObfuscatedName("n")
@Export("surfaceOffsetY")
HashSet __n; HashSet __n;
@ObfuscatedName("i") @ObfuscatedName("i")
@Export("__i")
HashSet __i; HashSet __i;
@ObfuscatedName("a") @ObfuscatedName("a")
@Export("__a")
List __a; List __a;
@ObfuscatedName("ce") @ObfuscatedName("ce")
@@ -171,13 +171,13 @@ public class WorldMapIcon1 extends AbstractWorldMapIcon {
var2 = (var3 - var8) * Client.__client_qc / var3; var2 = (var3 - var8) * Client.__client_qc / var3;
} else { } else {
var2 = Client.__client_qp; var2 = Client.soundEffectVolume;
} }
if(var2 > 0) { if(var2 > 0) {
RawSound var10 = var9.toRawSound().resample(MilliClock.decimator); RawSound var10 = var9.toRawSound().resample(MilliClock.decimator);
RawPcmStream var11 = RawPcmStream.method2497(var10, 100, var2); RawPcmStream var11 = RawPcmStream.createRawPcmStream(var10, 100, var2);
var11.__x_181(Client.unknownSoundValues1[var0] - 1); var11.setNumLoops(Client.queuedSoundEffectLoops[var0] - 1);
TaskHandler.pcmStreamMixer.addSubStream(var11); TaskHandler.pcmStreamMixer.addSubStream(var11);
} }
@@ -189,7 +189,7 @@ public class WorldMapIcon1 extends AbstractWorldMapIcon {
for(int var1 = var0; var1 < Client.soundEffectCount; ++var1) { for(int var1 = var0; var1 < Client.soundEffectCount; ++var1) {
Client.soundEffectIds[var1] = Client.soundEffectIds[var1 + 1]; Client.soundEffectIds[var1] = Client.soundEffectIds[var1 + 1];
Client.soundEffects[var1] = Client.soundEffects[var1 + 1]; Client.soundEffects[var1] = Client.soundEffects[var1 + 1];
Client.unknownSoundValues1[var1] = Client.unknownSoundValues1[var1 + 1]; Client.queuedSoundEffectLoops[var1] = Client.queuedSoundEffectLoops[var1 + 1];
Client.queuedSoundEffectDelays[var1] = Client.queuedSoundEffectDelays[var1 + 1]; Client.queuedSoundEffectDelays[var1] = Client.queuedSoundEffectDelays[var1 + 1];
Client.soundLocations[var1] = Client.soundLocations[var1 + 1]; Client.soundLocations[var1] = Client.soundLocations[var1 + 1];
} }
@@ -92,7 +92,6 @@ public class WorldMapSection0 implements WorldMapSection {
@ObfuscatedGetter( @ObfuscatedGetter(
intValue = -1657956317 intValue = -1657956317
) )
@Export("surfaceOffsetY")
int __n; int __n;
@ObfuscatedName("i") @ObfuscatedName("i")
@ObfuscatedGetter( @ObfuscatedGetter(
+1 -1
View File
@@ -208,7 +208,7 @@ public class class16 {
var10 = var7 + 1; var10 = var7 + 1;
if(Canvas.localPlayer.pathX[0] >= var3 - var10 && Canvas.localPlayer.pathX[0] <= var10 + var3 && Canvas.localPlayer.pathY[0] >= var38 - var10 && Canvas.localPlayer.pathY[0] <= var10 + var38 && Client.__client_qc != 0 && var8 > 0 && Client.soundEffectCount < 50) { if(Canvas.localPlayer.pathX[0] >= var3 - var10 && Canvas.localPlayer.pathX[0] <= var10 + var3 && Canvas.localPlayer.pathY[0] >= var38 - var10 && Canvas.localPlayer.pathY[0] <= var10 + var38 && Client.__client_qc != 0 && var8 > 0 && Client.soundEffectCount < 50) {
Client.soundEffectIds[Client.soundEffectCount] = var9; Client.soundEffectIds[Client.soundEffectCount] = var9;
Client.unknownSoundValues1[Client.soundEffectCount] = var8; Client.queuedSoundEffectLoops[Client.soundEffectCount] = var8;
Client.queuedSoundEffectDelays[Client.soundEffectCount] = var5; Client.queuedSoundEffectDelays[Client.soundEffectCount] = var5;
Client.soundEffects[Client.soundEffectCount] = null; Client.soundEffects[Client.soundEffectCount] = null;
Client.soundLocations[Client.soundEffectCount] = var7 + (var38 << 8) + (var3 << 16); Client.soundLocations[Client.soundEffectCount] = var7 + (var38 << 8) + (var3 << 16);