devtools
This commit is contained in:
@@ -165,11 +165,11 @@ public interface Actor extends Renderable, Locatable
|
|||||||
* @return the graphic of the actor
|
* @return the graphic of the actor
|
||||||
* @see GraphicID
|
* @see GraphicID
|
||||||
*/
|
*/
|
||||||
int getSpotAnimation();
|
int getGraphic();
|
||||||
|
|
||||||
void setSpotAnimation(int graphic);
|
void setGraphic(int graphic);
|
||||||
|
|
||||||
void setSpotAnimationFrame(int spotAnimFrame);
|
void setSpotAnimFrame(int spotAnimFrame);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the canvas area of the current tile the actor is standing on.
|
* Gets the canvas area of the current tile the actor is standing on.
|
||||||
|
|||||||
@@ -837,7 +837,7 @@ public interface Client extends GameShell
|
|||||||
* Gets the varbit composition for a given varbit id
|
* Gets the varbit composition for a given varbit id
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
VarbitDefinition getVarbitDefinition(int id);
|
VarbitComposition getVarbitDefinition(int id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the widget flags table.
|
* Gets the widget flags table.
|
||||||
@@ -2080,4 +2080,10 @@ public interface Client extends GameShell
|
|||||||
void setOutdatedScript(String outdatedScript);
|
void setOutdatedScript(String outdatedScript);
|
||||||
|
|
||||||
List<String> getOutdatedScripts();
|
List<String> getOutdatedScripts();
|
||||||
|
|
||||||
|
void queueChangedVarp(int varp);
|
||||||
|
|
||||||
|
VarbitComposition getVarbit(Integer id);
|
||||||
|
|
||||||
|
Widget getWidget(int param1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ package net.runelite.api;
|
|||||||
* <p>
|
* <p>
|
||||||
* These values are intended for use with the local players equipment
|
* These values are intended for use with the local players equipment
|
||||||
* {@link ItemContainer} corresponding. For obtaining information about equipment
|
* {@link ItemContainer} corresponding. For obtaining information about equipment
|
||||||
* in the {@link PlayerAppearance}, use {@link net.runelite.api.kit.KitType}.
|
* in the {@link PlayerComposition}, use {@link net.runelite.api.kit.KitType}.
|
||||||
*
|
*
|
||||||
* @see Client#getItemContainer(InventoryID)
|
* @see Client#getItemContainer(InventoryID)
|
||||||
* @see InventoryID#EQUIPMENT
|
* @see InventoryID#EQUIPMENT
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ package net.runelite.api;
|
|||||||
/**
|
/**
|
||||||
* Represents a pile of items held by a tile.
|
* Represents a pile of items held by a tile.
|
||||||
*/
|
*/
|
||||||
public interface TileItemPile extends TileObject
|
public interface ItemLayer extends TileObject
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Gets the height of the layer.
|
* Gets the height of the layer.
|
||||||
@@ -43,7 +43,7 @@ public interface Player extends Actor
|
|||||||
* @return the composition
|
* @return the composition
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
PlayerAppearance getPlayerAppearance();
|
PlayerComposition getPlayerComposition();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the polygons that make up the players model.
|
* Gets the polygons that make up the players model.
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import net.runelite.api.kit.KitType;
|
|||||||
/**
|
/**
|
||||||
* Represents the template of a player.
|
* Represents the template of a player.
|
||||||
*/
|
*/
|
||||||
public interface PlayerAppearance
|
public interface PlayerComposition
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Checks if the player is female.
|
* Checks if the player is female.
|
||||||
@@ -50,7 +50,7 @@ public interface Tile extends TileObject
|
|||||||
*
|
*
|
||||||
* @return the item
|
* @return the item
|
||||||
*/
|
*/
|
||||||
TileItemPile getItemLayer();
|
ItemLayer getItemLayer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the object on the ground layer of the tile.
|
* Gets the object on the ground layer of the tile.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
package net.runelite.api;
|
package net.runelite.api;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an item inside an {@link TileItemPile}.
|
* Represents an item inside an {@link ItemLayer}.
|
||||||
*/
|
*/
|
||||||
public interface TileItem extends Renderable
|
public interface TileItem extends Renderable
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.api;
|
package net.runelite.api;
|
||||||
|
|
||||||
public interface VarbitDefinition
|
public interface VarbitComposition
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The varp index for this varbit
|
* The varp index for this varbit
|
||||||
@@ -2,9 +2,10 @@ package net.runelite.api.events;
|
|||||||
|
|
||||||
import lombok.Value;
|
import lombok.Value;
|
||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
|
import net.runelite.api.PlayerComposition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This will fire whenever the {@link net.runelite.api.PlayerAppearance} hash changes.
|
* This will fire whenever the {@link PlayerComposition} hash changes.
|
||||||
*/
|
*/
|
||||||
@Value
|
@Value
|
||||||
public class PlayerChanged implements Event
|
public class PlayerChanged implements Event
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import net.runelite.api.Actor;
|
|||||||
* An event where the graphic of an {@link Actor} has changed.
|
* An event where the graphic of an {@link Actor} has changed.
|
||||||
* <p>
|
* <p>
|
||||||
* The graphic the player has changed to can be obtained using
|
* The graphic the player has changed to can be obtained using
|
||||||
* {@link Actor#getSpotAnimation()}.
|
* {@link Actor#getGraphic()}.
|
||||||
* <p>
|
* <p>
|
||||||
* Examples of when this event may trigger include:
|
* Examples of when this event may trigger include:
|
||||||
* <ul>
|
* <ul>
|
||||||
|
|||||||
@@ -1020,4 +1020,9 @@ public interface Widget
|
|||||||
boolean isWidgetItemDragged(int index);
|
boolean isWidgetItemDragged(int index);
|
||||||
|
|
||||||
Point getWidgetItemDragOffsets();
|
Point getWidgetItemDragOffsets();
|
||||||
|
|
||||||
|
static boolean getDragParent(Widget widget)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException("Implement");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Matthew Steglinski <https://github.com/sainttx>
|
||||||
|
* 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.Dimension;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayPanel;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
|
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||||
|
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||||
|
|
||||||
|
public class CameraOverlay extends OverlayPanel
|
||||||
|
{
|
||||||
|
private final Client client;
|
||||||
|
private final DevToolsPlugin plugin;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
CameraOverlay(Client client, DevToolsPlugin plugin)
|
||||||
|
{
|
||||||
|
this.client = client;
|
||||||
|
this.plugin = plugin;
|
||||||
|
setPosition(OverlayPosition.TOP_LEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dimension render(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
if (!plugin.getCameraPosition().isActive())
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
panelComponent.getChildren().add(TitleComponent.builder()
|
||||||
|
.text("Camera")
|
||||||
|
.build());
|
||||||
|
|
||||||
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
|
.left("X")
|
||||||
|
.right("" + client.getCameraX())
|
||||||
|
.build());
|
||||||
|
|
||||||
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
|
.left("Y")
|
||||||
|
.right("" + client.getCameraY())
|
||||||
|
.build());
|
||||||
|
|
||||||
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
|
.left("Z")
|
||||||
|
.right("" + client.getCameraZ())
|
||||||
|
.build());
|
||||||
|
|
||||||
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
|
.left("Pitch")
|
||||||
|
.right("" + client.getCameraPitch())
|
||||||
|
.build());
|
||||||
|
|
||||||
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
|
.left("Yaw")
|
||||||
|
.right("" + client.getCameraYaw())
|
||||||
|
.build());
|
||||||
|
|
||||||
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
|
.left("Scale")
|
||||||
|
.right("" + client.getScale())
|
||||||
|
.build());
|
||||||
|
|
||||||
|
return super.render(graphics);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Tomas Slusny <slusnucky@gmail.com>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.runelite.client.plugins.devtools;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
class DevToolsButton extends JButton
|
||||||
|
{
|
||||||
|
@Getter
|
||||||
|
private boolean active;
|
||||||
|
|
||||||
|
DevToolsButton(String title)
|
||||||
|
{
|
||||||
|
super(title);
|
||||||
|
addActionListener((ev) -> setActive(!active));
|
||||||
|
this.setToolTipText(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setActive(boolean active)
|
||||||
|
{
|
||||||
|
this.active = active;
|
||||||
|
|
||||||
|
if (active)
|
||||||
|
{
|
||||||
|
setBackground(Color.GREEN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setBackground(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Abex
|
||||||
|
* 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 net.runelite.client.config.Config;
|
||||||
|
import net.runelite.client.config.ConfigGroup;
|
||||||
|
import net.runelite.client.config.ConfigItem;
|
||||||
|
|
||||||
|
@ConfigGroup("devtools")
|
||||||
|
public interface DevToolsConfig extends Config
|
||||||
|
{
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "inspectorAlwaysOnTop",
|
||||||
|
name = "",
|
||||||
|
description = "",
|
||||||
|
hidden = true
|
||||||
|
)
|
||||||
|
default boolean inspectorAlwaysOnTop()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "inspectorAlwaysOnTop",
|
||||||
|
name = "",
|
||||||
|
description = ""
|
||||||
|
)
|
||||||
|
void inspectorAlwaysOnTop(boolean value);
|
||||||
|
}
|
||||||
@@ -0,0 +1,468 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Kronos <https://github.com/KronosDesign>
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* 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.Font;
|
||||||
|
import java.awt.FontMetrics;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Polygon;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.Shape;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.Constants;
|
||||||
|
import net.runelite.api.DecorativeObject;
|
||||||
|
import net.runelite.api.GameObject;
|
||||||
|
import net.runelite.api.GraphicsObject;
|
||||||
|
import net.runelite.api.TileItem;
|
||||||
|
import net.runelite.api.GroundObject;
|
||||||
|
import net.runelite.api.ItemLayer;
|
||||||
|
import net.runelite.api.NPC;
|
||||||
|
import net.runelite.api.NPCComposition;
|
||||||
|
import net.runelite.api.Node;
|
||||||
|
import net.runelite.api.Perspective;
|
||||||
|
import net.runelite.api.Player;
|
||||||
|
import net.runelite.api.Point;
|
||||||
|
import net.runelite.api.Projectile;
|
||||||
|
import net.runelite.api.Scene;
|
||||||
|
import net.runelite.api.Tile;
|
||||||
|
import net.runelite.api.WallObject;
|
||||||
|
import net.runelite.api.coords.LocalPoint;
|
||||||
|
import net.runelite.api.widgets.Widget;
|
||||||
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
|
import net.runelite.api.widgets.WidgetItem;
|
||||||
|
import net.runelite.client.ui.FontManager;
|
||||||
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||||
|
import net.runelite.client.ui.overlay.tooltip.Tooltip;
|
||||||
|
import net.runelite.client.ui.overlay.tooltip.TooltipManager;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
class DevToolsOverlay extends Overlay
|
||||||
|
{
|
||||||
|
private static final Font FONT = FontManager.getRunescapeFont().deriveFont(Font.BOLD, 16);
|
||||||
|
private static final Color RED = new Color(221, 44, 0);
|
||||||
|
private static final Color GREEN = new Color(0, 200, 83);
|
||||||
|
private static final Color ORANGE = new Color(255, 109, 0);
|
||||||
|
private static final Color YELLOW = new Color(255, 214, 0);
|
||||||
|
private static final Color CYAN = new Color(0, 184, 212);
|
||||||
|
private static final Color BLUE = new Color(41, 98, 255);
|
||||||
|
private static final Color DEEP_PURPLE = new Color(98, 0, 234);
|
||||||
|
private static final Color PURPLE = new Color(170, 0, 255);
|
||||||
|
private static final Color GRAY = new Color(158, 158, 158);
|
||||||
|
|
||||||
|
private static final int MAX_DISTANCE = 2400;
|
||||||
|
|
||||||
|
private final Client client;
|
||||||
|
private final DevToolsPlugin plugin;
|
||||||
|
private final TooltipManager toolTipManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private DevToolsOverlay(Client client, DevToolsPlugin plugin, TooltipManager toolTipManager)
|
||||||
|
{
|
||||||
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
|
setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||||
|
setPriority(OverlayPriority.HIGHEST);
|
||||||
|
this.client = client;
|
||||||
|
this.plugin = plugin;
|
||||||
|
this.toolTipManager = toolTipManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dimension render(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
graphics.setFont(FONT);
|
||||||
|
|
||||||
|
if (plugin.getPlayers().isActive())
|
||||||
|
{
|
||||||
|
renderPlayers(graphics);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plugin.getNpcs().isActive())
|
||||||
|
{
|
||||||
|
renderNpcs(graphics);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plugin.getGroundItems().isActive() || plugin.getGroundObjects().isActive() || plugin.getGameObjects().isActive() || plugin.getWalls().isActive() || plugin.getDecorations().isActive() || plugin.getTileLocation().isActive() || plugin.getMovementFlags().isActive())
|
||||||
|
{
|
||||||
|
renderTileObjects(graphics);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plugin.getInventory().isActive())
|
||||||
|
{
|
||||||
|
renderInventory(graphics);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plugin.getProjectiles().isActive())
|
||||||
|
{
|
||||||
|
renderProjectiles(graphics);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plugin.getGraphicsObjects().isActive())
|
||||||
|
{
|
||||||
|
renderGraphicsObjects(graphics);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderPlayers(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
List<Player> players = client.getPlayers();
|
||||||
|
Player local = client.getLocalPlayer();
|
||||||
|
|
||||||
|
for (Player p : players)
|
||||||
|
{
|
||||||
|
if (p != local)
|
||||||
|
{
|
||||||
|
String text = p.getName() + " (A: " + p.getAnimation() + ") (P: " + p.getPoseAnimation() + ") (G: " + p.getGraphic() + ")";
|
||||||
|
OverlayUtil.renderActorOverlay(graphics, p, text, BLUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String text = local.getName() + " (A: " + local.getAnimation() + ") (P: " + local.getPoseAnimation() + ") (G: " + local.getGraphic() + ")";
|
||||||
|
OverlayUtil.renderActorOverlay(graphics, local, text, CYAN);
|
||||||
|
renderPlayerWireframe(graphics, local, CYAN);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderNpcs(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
List<NPC> npcs = client.getNpcs();
|
||||||
|
for (NPC npc : npcs)
|
||||||
|
{
|
||||||
|
NPCComposition composition = npc.getComposition();
|
||||||
|
Color color = composition.getCombatLevel() > 1 ? YELLOW : ORANGE;
|
||||||
|
if (composition.getConfigs() != null)
|
||||||
|
{
|
||||||
|
NPCComposition transformedComposition = composition.transform();
|
||||||
|
if (transformedComposition == null)
|
||||||
|
{
|
||||||
|
color = GRAY;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
composition = transformedComposition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String text = composition.getName() + " (ID:" + composition.getId() + ")" +
|
||||||
|
" (A: " + npc.getAnimation() + ") (P: " + npc.getPoseAnimation() + ") (G: " + npc.getGraphic() + ")";
|
||||||
|
OverlayUtil.renderActorOverlay(graphics, npc, text, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderTileObjects(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
Scene scene = client.getScene();
|
||||||
|
Tile[][][] tiles = scene.getTiles();
|
||||||
|
|
||||||
|
int z = client.getPlane();
|
||||||
|
|
||||||
|
for (int x = 0; x < Constants.SCENE_SIZE; ++x)
|
||||||
|
{
|
||||||
|
for (int y = 0; y < Constants.SCENE_SIZE; ++y)
|
||||||
|
{
|
||||||
|
Tile tile = tiles[z][x][y];
|
||||||
|
|
||||||
|
if (tile == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player player = client.getLocalPlayer();
|
||||||
|
if (player == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plugin.getGroundItems().isActive())
|
||||||
|
{
|
||||||
|
renderGroundItems(graphics, tile, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plugin.getGroundObjects().isActive())
|
||||||
|
{
|
||||||
|
renderGroundObject(graphics, tile, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plugin.getGameObjects().isActive())
|
||||||
|
{
|
||||||
|
renderGameObjects(graphics, tile, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plugin.getWalls().isActive())
|
||||||
|
{
|
||||||
|
renderWallObject(graphics, tile, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plugin.getDecorations().isActive())
|
||||||
|
{
|
||||||
|
renderDecorObject(graphics, tile, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plugin.getTileLocation().isActive())
|
||||||
|
{
|
||||||
|
renderTileTooltip(graphics, tile);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plugin.getMovementFlags().isActive())
|
||||||
|
{
|
||||||
|
renderMovementInfo(graphics, tile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderTileTooltip(Graphics2D graphics, Tile tile)
|
||||||
|
{
|
||||||
|
Polygon poly = Perspective.getCanvasTilePoly(client, tile.getLocalLocation());
|
||||||
|
if (poly != null && poly.contains(client.getMouseCanvasPosition().getX(), client.getMouseCanvasPosition().getY()))
|
||||||
|
{
|
||||||
|
toolTipManager.add(new Tooltip("World Location: " + tile.getWorldLocation().getX() + ", " + tile.getWorldLocation().getY() + ", " + client.getPlane()));
|
||||||
|
OverlayUtil.renderPolygon(graphics, poly, GREEN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderMovementInfo(Graphics2D graphics, Tile tile)
|
||||||
|
{
|
||||||
|
Polygon poly = Perspective.getCanvasTilePoly(client, tile.getLocalLocation());
|
||||||
|
|
||||||
|
if (poly == null || !poly.contains(client.getMouseCanvasPosition().getX(), client.getMouseCanvasPosition().getY()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (client.getCollisionMaps() != null)
|
||||||
|
{
|
||||||
|
int[][] flags = client.getCollisionMaps()[client.getPlane()].getFlags();
|
||||||
|
int data = flags[tile.getSceneLocation().getX()][tile.getSceneLocation().getY()];
|
||||||
|
|
||||||
|
Set<MovementFlag> movementFlags = MovementFlag.getSetFlags(data);
|
||||||
|
|
||||||
|
if (movementFlags.isEmpty())
|
||||||
|
{
|
||||||
|
toolTipManager.add(new Tooltip("No movement flags"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
movementFlags.forEach(flag -> toolTipManager.add(new Tooltip(flag.toString())));
|
||||||
|
}
|
||||||
|
|
||||||
|
OverlayUtil.renderPolygon(graphics, poly, GREEN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderGroundItems(Graphics2D graphics, Tile tile, Player player)
|
||||||
|
{
|
||||||
|
ItemLayer itemLayer = tile.getItemLayer();
|
||||||
|
if (itemLayer != null)
|
||||||
|
{
|
||||||
|
if (player.getLocalLocation().distanceTo(itemLayer.getLocalLocation()) <= MAX_DISTANCE)
|
||||||
|
{
|
||||||
|
Node current = itemLayer.getBottom();
|
||||||
|
while (current instanceof TileItem)
|
||||||
|
{
|
||||||
|
TileItem item = (TileItem) current;
|
||||||
|
OverlayUtil.renderTileOverlay(graphics, itemLayer, "ID: " + item.getId() + " Qty:" + item.getQuantity(), RED);
|
||||||
|
current = current.getNext();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderGameObjects(Graphics2D graphics, Tile tile, Player player)
|
||||||
|
{
|
||||||
|
GameObject[] gameObjects = tile.getGameObjects();
|
||||||
|
if (gameObjects != null)
|
||||||
|
{
|
||||||
|
for (GameObject gameObject : gameObjects)
|
||||||
|
{
|
||||||
|
if (gameObject != null)
|
||||||
|
{
|
||||||
|
if (player.getLocalLocation().distanceTo(gameObject.getLocalLocation()) <= MAX_DISTANCE)
|
||||||
|
{
|
||||||
|
OverlayUtil.renderTileOverlay(graphics, gameObject, "ID: " + gameObject.getId(), GREEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw a polygon around the convex hull
|
||||||
|
// of the model vertices
|
||||||
|
Shape p = gameObject.getConvexHull();
|
||||||
|
if (p != null)
|
||||||
|
{
|
||||||
|
graphics.draw(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderGroundObject(Graphics2D graphics, Tile tile, Player player)
|
||||||
|
{
|
||||||
|
GroundObject groundObject = tile.getGroundObject();
|
||||||
|
if (groundObject != null)
|
||||||
|
{
|
||||||
|
if (player.getLocalLocation().distanceTo(groundObject.getLocalLocation()) <= MAX_DISTANCE)
|
||||||
|
{
|
||||||
|
OverlayUtil.renderTileOverlay(graphics, groundObject, "ID: " + groundObject.getId(), PURPLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderWallObject(Graphics2D graphics, Tile tile, Player player)
|
||||||
|
{
|
||||||
|
WallObject wallObject = tile.getWallObject();
|
||||||
|
if (wallObject != null)
|
||||||
|
{
|
||||||
|
if (player.getLocalLocation().distanceTo(wallObject.getLocalLocation()) <= MAX_DISTANCE)
|
||||||
|
{
|
||||||
|
OverlayUtil.renderTileOverlay(graphics, wallObject, "ID: " + wallObject.getId(), GRAY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderDecorObject(Graphics2D graphics, Tile tile, Player player)
|
||||||
|
{
|
||||||
|
DecorativeObject decorObject = tile.getDecorativeObject();
|
||||||
|
if (decorObject != null)
|
||||||
|
{
|
||||||
|
if (player.getLocalLocation().distanceTo(decorObject.getLocalLocation()) <= MAX_DISTANCE)
|
||||||
|
{
|
||||||
|
OverlayUtil.renderTileOverlay(graphics, decorObject, "ID: " + decorObject.getId(), DEEP_PURPLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
Shape p = decorObject.getConvexHull();
|
||||||
|
if (p != null)
|
||||||
|
{
|
||||||
|
graphics.draw(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
p = decorObject.getConvexHull2();
|
||||||
|
if (p != null)
|
||||||
|
{
|
||||||
|
graphics.draw(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderInventory(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
Widget inventoryWidget = client.getWidget(WidgetInfo.INVENTORY);
|
||||||
|
if (inventoryWidget == null || inventoryWidget.isHidden())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (WidgetItem item : inventoryWidget.getWidgetItems())
|
||||||
|
{
|
||||||
|
Rectangle slotBounds = item.getCanvasBounds();
|
||||||
|
|
||||||
|
String idText = "" + item.getId();
|
||||||
|
FontMetrics fm = graphics.getFontMetrics();
|
||||||
|
Rectangle2D textBounds = fm.getStringBounds(idText, graphics);
|
||||||
|
|
||||||
|
int textX = (int) (slotBounds.getX() + (slotBounds.getWidth() / 2) - (textBounds.getWidth() / 2));
|
||||||
|
int textY = (int) (slotBounds.getY() + (slotBounds.getHeight() / 2) + (textBounds.getHeight() / 2));
|
||||||
|
|
||||||
|
graphics.setColor(new Color(255, 255, 255, 65));
|
||||||
|
graphics.fill(slotBounds);
|
||||||
|
|
||||||
|
graphics.setColor(Color.BLACK);
|
||||||
|
graphics.drawString(idText, textX + 1, textY + 1);
|
||||||
|
graphics.setColor(YELLOW);
|
||||||
|
graphics.drawString(idText, textX, textY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderProjectiles(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
List<Projectile> projectiles = client.getProjectiles();
|
||||||
|
|
||||||
|
for (Projectile projectile : projectiles)
|
||||||
|
{
|
||||||
|
int projectileId = projectile.getId();
|
||||||
|
String text = "(ID: " + projectileId + ")";
|
||||||
|
int x = (int) projectile.getX();
|
||||||
|
int y = (int) projectile.getY();
|
||||||
|
LocalPoint projectilePoint = new LocalPoint(x, y);
|
||||||
|
Point textLocation = Perspective.getCanvasTextLocation(client, graphics, projectilePoint, text, 0);
|
||||||
|
if (textLocation != null)
|
||||||
|
{
|
||||||
|
OverlayUtil.renderTextLocation(graphics, textLocation, text, Color.RED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderGraphicsObjects(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
List<GraphicsObject> graphicsObjects = client.getGraphicsObjects();
|
||||||
|
|
||||||
|
for (GraphicsObject graphicsObject : graphicsObjects)
|
||||||
|
{
|
||||||
|
LocalPoint lp = graphicsObject.getLocation();
|
||||||
|
Polygon poly = Perspective.getCanvasTilePoly(client, lp);
|
||||||
|
|
||||||
|
if (poly != null)
|
||||||
|
{
|
||||||
|
OverlayUtil.renderPolygon(graphics, poly, Color.MAGENTA);
|
||||||
|
}
|
||||||
|
|
||||||
|
String infoString = "(ID: " + graphicsObject.getId() + ")";
|
||||||
|
Point textLocation = Perspective.getCanvasTextLocation(
|
||||||
|
client, graphics, lp, infoString, 0);
|
||||||
|
if (textLocation != null)
|
||||||
|
{
|
||||||
|
OverlayUtil.renderTextLocation(graphics, textLocation, infoString, Color.WHITE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderPlayerWireframe(Graphics2D graphics, Player player, Color color)
|
||||||
|
{
|
||||||
|
Polygon[] polys = player.getPolygons();
|
||||||
|
|
||||||
|
if (polys == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
graphics.setColor(color);
|
||||||
|
|
||||||
|
for (Polygon p : polys)
|
||||||
|
{
|
||||||
|
graphics.drawPolygon(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,210 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Kronos <https://github.com/KronosDesign>
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* 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.GridLayout;
|
||||||
|
import java.awt.TrayIcon;
|
||||||
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.MenuAction;
|
||||||
|
import net.runelite.client.Notifier;
|
||||||
|
import net.runelite.client.ui.ColorScheme;
|
||||||
|
import net.runelite.client.ui.PluginPanel;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayMenuEntry;
|
||||||
|
import net.runelite.client.ui.overlay.infobox.Counter;
|
||||||
|
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
|
|
||||||
|
class DevToolsPanel extends PluginPanel
|
||||||
|
{
|
||||||
|
private final Client client;
|
||||||
|
private final Notifier notifier;
|
||||||
|
private final DevToolsPlugin plugin;
|
||||||
|
|
||||||
|
private final WidgetInspector widgetInspector;
|
||||||
|
private final VarInspector varInspector;
|
||||||
|
private final ScriptInspector scriptInspector;
|
||||||
|
private final InventoryInspector inventoryInspector;
|
||||||
|
private final InfoBoxManager infoBoxManager;
|
||||||
|
private final ScheduledExecutorService scheduledExecutorService;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private DevToolsPanel(
|
||||||
|
Client client,
|
||||||
|
DevToolsPlugin plugin,
|
||||||
|
WidgetInspector widgetInspector,
|
||||||
|
VarInspector varInspector,
|
||||||
|
ScriptInspector scriptInspector,
|
||||||
|
InventoryInspector inventoryInspector,
|
||||||
|
Notifier notifier,
|
||||||
|
InfoBoxManager infoBoxManager,
|
||||||
|
ScheduledExecutorService scheduledExecutorService)
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
this.client = client;
|
||||||
|
this.plugin = plugin;
|
||||||
|
this.widgetInspector = widgetInspector;
|
||||||
|
this.varInspector = varInspector;
|
||||||
|
this.inventoryInspector = inventoryInspector;
|
||||||
|
this.scriptInspector = scriptInspector;
|
||||||
|
this.notifier = notifier;
|
||||||
|
this.infoBoxManager = infoBoxManager;
|
||||||
|
this.scheduledExecutorService = scheduledExecutorService;
|
||||||
|
|
||||||
|
setBackground(ColorScheme.DARK_GRAY_COLOR);
|
||||||
|
|
||||||
|
add(createOptionsPanel());
|
||||||
|
}
|
||||||
|
|
||||||
|
private JPanel createOptionsPanel()
|
||||||
|
{
|
||||||
|
final JPanel container = new JPanel();
|
||||||
|
container.setBackground(ColorScheme.DARK_GRAY_COLOR);
|
||||||
|
container.setLayout(new GridLayout(0, 2, 3, 3));
|
||||||
|
|
||||||
|
container.add(plugin.getPlayers());
|
||||||
|
container.add(plugin.getNpcs());
|
||||||
|
|
||||||
|
container.add(plugin.getGroundItems());
|
||||||
|
container.add(plugin.getGroundObjects());
|
||||||
|
container.add(plugin.getGameObjects());
|
||||||
|
container.add(plugin.getGraphicsObjects());
|
||||||
|
container.add(plugin.getWalls());
|
||||||
|
container.add(plugin.getDecorations());
|
||||||
|
|
||||||
|
container.add(plugin.getInventory());
|
||||||
|
container.add(plugin.getProjectiles());
|
||||||
|
|
||||||
|
container.add(plugin.getLocation());
|
||||||
|
container.add(plugin.getWorldMapLocation());
|
||||||
|
container.add(plugin.getTileLocation());
|
||||||
|
container.add(plugin.getCameraPosition());
|
||||||
|
|
||||||
|
container.add(plugin.getChunkBorders());
|
||||||
|
container.add(plugin.getMapSquares());
|
||||||
|
|
||||||
|
container.add(plugin.getLineOfSight());
|
||||||
|
container.add(plugin.getValidMovement());
|
||||||
|
container.add(plugin.getMovementFlags());
|
||||||
|
container.add(plugin.getInteracting());
|
||||||
|
container.add(plugin.getExamine());
|
||||||
|
|
||||||
|
container.add(plugin.getDetachedCamera());
|
||||||
|
plugin.getDetachedCamera().addActionListener((ev) ->
|
||||||
|
{
|
||||||
|
client.setOculusOrbState(!plugin.getDetachedCamera().isActive() ? 1 : 0);
|
||||||
|
client.setOculusOrbNormalSpeed(!plugin.getDetachedCamera().isActive() ? 36 : 12);
|
||||||
|
});
|
||||||
|
|
||||||
|
container.add(plugin.getWidgetInspector());
|
||||||
|
plugin.getWidgetInspector().addActionListener((ev) ->
|
||||||
|
{
|
||||||
|
if (plugin.getWidgetInspector().isActive())
|
||||||
|
{
|
||||||
|
widgetInspector.close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
widgetInspector.open();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
container.add(plugin.getVarInspector());
|
||||||
|
plugin.getVarInspector().addActionListener((ev) ->
|
||||||
|
{
|
||||||
|
if (plugin.getVarInspector().isActive())
|
||||||
|
{
|
||||||
|
varInspector.close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
varInspector.open();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
container.add(plugin.getSoundEffects());
|
||||||
|
|
||||||
|
final JButton notificationBtn = new JButton("Notification");
|
||||||
|
notificationBtn.addActionListener(e ->
|
||||||
|
{
|
||||||
|
scheduledExecutorService.schedule(() -> notifier.notify("Wow!", TrayIcon.MessageType.ERROR), 3, TimeUnit.SECONDS);
|
||||||
|
});
|
||||||
|
container.add(notificationBtn);
|
||||||
|
|
||||||
|
container.add(plugin.getScriptInspector());
|
||||||
|
plugin.getScriptInspector().addActionListener((ev) ->
|
||||||
|
{
|
||||||
|
if (plugin.getScriptInspector().isActive())
|
||||||
|
{
|
||||||
|
scriptInspector.close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
scriptInspector.open();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
final JButton newInfoboxBtn = new JButton("Infobox");
|
||||||
|
newInfoboxBtn.addActionListener(e ->
|
||||||
|
{
|
||||||
|
Counter counter = new Counter(ImageUtil.getResourceStreamFromClass(getClass(), "devtools_icon.png"), plugin, 42)
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
// Give the infobox a unique name to test infobox splitting
|
||||||
|
return "devtools-" + hashCode();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
counter.getMenuEntries().add(new OverlayMenuEntry(MenuAction.RUNELITE_INFOBOX, "Test", "DevTools"));
|
||||||
|
infoBoxManager.addInfoBox(counter);
|
||||||
|
});
|
||||||
|
container.add(newInfoboxBtn);
|
||||||
|
|
||||||
|
final JButton clearInfoboxBtn = new JButton("Clear Infobox");
|
||||||
|
clearInfoboxBtn.addActionListener(e -> infoBoxManager.removeIf(i -> true));
|
||||||
|
container.add(clearInfoboxBtn);
|
||||||
|
|
||||||
|
container.add(plugin.getInventoryInspector());
|
||||||
|
plugin.getInventoryInspector().addActionListener((ev) ->
|
||||||
|
{
|
||||||
|
if (plugin.getInventoryInspector().isActive())
|
||||||
|
{
|
||||||
|
inventoryInspector.close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
inventoryInspector.open();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return container;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,470 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Kronos <https://github.com/KronosDesign>
|
||||||
|
* 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 ch.qos.logback.classic.Level;
|
||||||
|
import ch.qos.logback.classic.Logger;
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import com.google.common.primitives.Ints;
|
||||||
|
import com.google.inject.Provides;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import static java.lang.Math.min;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import lombok.Getter;
|
||||||
|
import net.runelite.api.ChatMessageType;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.Experience;
|
||||||
|
import net.runelite.api.MenuAction;
|
||||||
|
import net.runelite.api.MenuEntry;
|
||||||
|
import net.runelite.api.NPC;
|
||||||
|
import net.runelite.api.Player;
|
||||||
|
import net.runelite.api.Skill;
|
||||||
|
import net.runelite.api.VarbitComposition;
|
||||||
|
import net.runelite.api.coords.WorldPoint;
|
||||||
|
import net.runelite.api.events.CommandExecuted;
|
||||||
|
import net.runelite.api.events.MenuEntryAdded;
|
||||||
|
import net.runelite.api.events.StatChanged;
|
||||||
|
import net.runelite.api.events.VarbitChanged;
|
||||||
|
import net.runelite.api.kit.KitType;
|
||||||
|
import net.runelite.client.chat.ChatMessageBuilder;
|
||||||
|
import net.runelite.client.chat.ChatMessageManager;
|
||||||
|
import net.runelite.client.chat.QueuedMessage;
|
||||||
|
import net.runelite.client.config.ConfigManager;
|
||||||
|
import net.runelite.client.eventbus.EventBus;
|
||||||
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
|
import net.runelite.client.plugins.Plugin;
|
||||||
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
|
import net.runelite.client.ui.ClientToolbar;
|
||||||
|
import net.runelite.client.ui.JagexColors;
|
||||||
|
import net.runelite.client.ui.NavigationButton;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
|
import net.runelite.client.util.ColorUtil;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@PluginDescriptor(
|
||||||
|
name = "Developer Tools",
|
||||||
|
tags = {"panel"},
|
||||||
|
developerPlugin = true
|
||||||
|
)
|
||||||
|
@Getter
|
||||||
|
public class DevToolsPlugin extends Plugin
|
||||||
|
{
|
||||||
|
private static final List<MenuAction> EXAMINE_MENU_ACTIONS = ImmutableList.of(MenuAction.EXAMINE_ITEM,
|
||||||
|
MenuAction.EXAMINE_ITEM_GROUND, MenuAction.EXAMINE_NPC, MenuAction.EXAMINE_OBJECT);
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Client client;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ClientToolbar clientToolbar;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private OverlayManager overlayManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private DevToolsOverlay overlay;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private LocationOverlay locationOverlay;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private SceneOverlay sceneOverlay;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private CameraOverlay cameraOverlay;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private WorldMapLocationOverlay worldMapLocationOverlay;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private WorldMapRegionOverlay mapRegionOverlay;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private SoundEffectOverlay soundEffectOverlay;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private EventBus eventBus;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ConfigManager configManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ChatMessageManager chatMessageManager;
|
||||||
|
|
||||||
|
private DevToolsButton players;
|
||||||
|
private DevToolsButton npcs;
|
||||||
|
private DevToolsButton groundItems;
|
||||||
|
private DevToolsButton groundObjects;
|
||||||
|
private DevToolsButton gameObjects;
|
||||||
|
private DevToolsButton graphicsObjects;
|
||||||
|
private DevToolsButton walls;
|
||||||
|
private DevToolsButton decorations;
|
||||||
|
private DevToolsButton inventory;
|
||||||
|
private DevToolsButton projectiles;
|
||||||
|
private DevToolsButton location;
|
||||||
|
private DevToolsButton chunkBorders;
|
||||||
|
private DevToolsButton mapSquares;
|
||||||
|
private DevToolsButton validMovement;
|
||||||
|
private DevToolsButton movementFlags;
|
||||||
|
private DevToolsButton lineOfSight;
|
||||||
|
private DevToolsButton cameraPosition;
|
||||||
|
private DevToolsButton worldMapLocation;
|
||||||
|
private DevToolsButton tileLocation;
|
||||||
|
private DevToolsButton interacting;
|
||||||
|
private DevToolsButton examine;
|
||||||
|
private DevToolsButton detachedCamera;
|
||||||
|
private DevToolsButton widgetInspector;
|
||||||
|
private DevToolsButton varInspector;
|
||||||
|
private DevToolsButton soundEffects;
|
||||||
|
private DevToolsButton scriptInspector;
|
||||||
|
private DevToolsButton inventoryInspector;
|
||||||
|
private NavigationButton navButton;
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
DevToolsConfig provideConfig(ConfigManager configManager)
|
||||||
|
{
|
||||||
|
return configManager.getConfig(DevToolsConfig.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void startUp() throws Exception
|
||||||
|
{
|
||||||
|
players = new DevToolsButton("Players");
|
||||||
|
npcs = new DevToolsButton("NPCs");
|
||||||
|
|
||||||
|
groundItems = new DevToolsButton("Ground Items");
|
||||||
|
groundObjects = new DevToolsButton("Ground Objects");
|
||||||
|
gameObjects = new DevToolsButton("Game Objects");
|
||||||
|
graphicsObjects = new DevToolsButton("Graphics Objects");
|
||||||
|
walls = new DevToolsButton("Walls");
|
||||||
|
decorations = new DevToolsButton("Decorations");
|
||||||
|
|
||||||
|
inventory = new DevToolsButton("Inventory");
|
||||||
|
projectiles = new DevToolsButton("Projectiles");
|
||||||
|
|
||||||
|
location = new DevToolsButton("Location");
|
||||||
|
worldMapLocation = new DevToolsButton("World Map Location");
|
||||||
|
tileLocation = new DevToolsButton("Tile Location");
|
||||||
|
cameraPosition = new DevToolsButton("Camera Position");
|
||||||
|
|
||||||
|
chunkBorders = new DevToolsButton("Chunk Borders");
|
||||||
|
mapSquares = new DevToolsButton("Map Squares");
|
||||||
|
|
||||||
|
lineOfSight = new DevToolsButton("Line Of Sight");
|
||||||
|
validMovement = new DevToolsButton("Valid Movement");
|
||||||
|
movementFlags = new DevToolsButton("Movement Flags");
|
||||||
|
interacting = new DevToolsButton("Interacting");
|
||||||
|
examine = new DevToolsButton("Examine");
|
||||||
|
|
||||||
|
detachedCamera = new DevToolsButton("Detached Camera");
|
||||||
|
widgetInspector = new DevToolsButton("Widget Inspector");
|
||||||
|
varInspector = new DevToolsButton("Var Inspector");
|
||||||
|
soundEffects = new DevToolsButton("Sound Effects");
|
||||||
|
scriptInspector = new DevToolsButton("Script Inspector");
|
||||||
|
inventoryInspector = new DevToolsButton("Inventory Inspector");
|
||||||
|
|
||||||
|
overlayManager.add(overlay);
|
||||||
|
overlayManager.add(locationOverlay);
|
||||||
|
overlayManager.add(sceneOverlay);
|
||||||
|
overlayManager.add(cameraOverlay);
|
||||||
|
overlayManager.add(worldMapLocationOverlay);
|
||||||
|
overlayManager.add(mapRegionOverlay);
|
||||||
|
overlayManager.add(soundEffectOverlay);
|
||||||
|
|
||||||
|
final DevToolsPanel panel = injector.getInstance(DevToolsPanel.class);
|
||||||
|
|
||||||
|
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "devtools_icon.png");
|
||||||
|
|
||||||
|
navButton = NavigationButton.builder()
|
||||||
|
.tooltip("Developer Tools")
|
||||||
|
.icon(icon)
|
||||||
|
.priority(1)
|
||||||
|
.panel(panel)
|
||||||
|
.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);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onCommandExecuted(CommandExecuted commandExecuted)
|
||||||
|
{
|
||||||
|
String[] args = commandExecuted.getArguments();
|
||||||
|
|
||||||
|
switch (commandExecuted.getCommand())
|
||||||
|
{
|
||||||
|
case "logger":
|
||||||
|
{
|
||||||
|
final Logger logger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
|
||||||
|
String message;
|
||||||
|
Level currentLoggerLevel = logger.getLevel();
|
||||||
|
|
||||||
|
if (args.length < 1)
|
||||||
|
{
|
||||||
|
message = "Logger level is currently set to " + currentLoggerLevel;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Level newLoggerLevel = Level.toLevel(args[0], currentLoggerLevel);
|
||||||
|
logger.setLevel(newLoggerLevel);
|
||||||
|
message = "Logger level has been set to " + newLoggerLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", message, null);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "getvarp":
|
||||||
|
{
|
||||||
|
int varp = Integer.parseInt(args[0]);
|
||||||
|
int[] varps = client.getVarps();
|
||||||
|
int value = varps[varp];
|
||||||
|
client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "VarPlayer " + varp + ": " + value, null);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "setvarp":
|
||||||
|
{
|
||||||
|
int varp = Integer.parseInt(args[0]);
|
||||||
|
int value = Integer.parseInt(args[1]);
|
||||||
|
int[] varps = client.getVarps();
|
||||||
|
varps[varp] = value;
|
||||||
|
client.queueChangedVarp(varp);
|
||||||
|
client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Set VarPlayer " + varp + " to " + value, null);
|
||||||
|
VarbitChanged varbitChanged = new VarbitChanged();
|
||||||
|
varbitChanged.setIndex(varp);
|
||||||
|
eventBus.post(varbitChanged); // fake event
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "getvarb":
|
||||||
|
{
|
||||||
|
int varbit = Integer.parseInt(args[0]);
|
||||||
|
int value = client.getVarbitValue(client.getVarps(), varbit);
|
||||||
|
client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Varbit " + varbit + ": " + value, null);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "setvarb":
|
||||||
|
{
|
||||||
|
int varbit = Integer.parseInt(args[0]);
|
||||||
|
int value = Integer.parseInt(args[1]);
|
||||||
|
client.setVarbitValue(client.getVarps(), varbit, value);
|
||||||
|
VarbitComposition varbitComposition = client.getVarbit(varbit);
|
||||||
|
client.queueChangedVarp(varbitComposition.getIndex());
|
||||||
|
client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", "Set varbit " + varbit + " to " + value, null);
|
||||||
|
eventBus.post(new VarbitChanged()); // fake event
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "addxp":
|
||||||
|
{
|
||||||
|
Skill skill = Skill.valueOf(args[0].toUpperCase());
|
||||||
|
int xp = Integer.parseInt(args[1]);
|
||||||
|
|
||||||
|
int totalXp = client.getSkillExperience(skill) + xp;
|
||||||
|
int level = min(Experience.getLevelForXp(totalXp), 99);
|
||||||
|
|
||||||
|
client.getBoostedSkillLevels()[skill.ordinal()] = level;
|
||||||
|
client.getRealSkillLevels()[skill.ordinal()] = level;
|
||||||
|
client.getSkillExperiences()[skill.ordinal()] = totalXp;
|
||||||
|
|
||||||
|
client.queueChangedSkill(skill);
|
||||||
|
|
||||||
|
StatChanged statChanged = new StatChanged(
|
||||||
|
skill,
|
||||||
|
totalXp,
|
||||||
|
level,
|
||||||
|
level
|
||||||
|
);
|
||||||
|
eventBus.post(statChanged);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "setstat":
|
||||||
|
{
|
||||||
|
Skill skill = Skill.valueOf(args[0].toUpperCase());
|
||||||
|
int level = Integer.parseInt(args[1]);
|
||||||
|
|
||||||
|
level = Ints.constrainToRange(level, 1, Experience.MAX_REAL_LEVEL);
|
||||||
|
int xp = Experience.getXpForLevel(level);
|
||||||
|
|
||||||
|
client.getBoostedSkillLevels()[skill.ordinal()] = level;
|
||||||
|
client.getRealSkillLevels()[skill.ordinal()] = level;
|
||||||
|
client.getSkillExperiences()[skill.ordinal()] = xp;
|
||||||
|
|
||||||
|
client.queueChangedSkill(skill);
|
||||||
|
|
||||||
|
StatChanged statChanged = new StatChanged(
|
||||||
|
skill,
|
||||||
|
xp,
|
||||||
|
level,
|
||||||
|
level
|
||||||
|
);
|
||||||
|
eventBus.post(statChanged);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "anim":
|
||||||
|
{
|
||||||
|
int id = Integer.parseInt(args[0]);
|
||||||
|
Player localPlayer = client.getLocalPlayer();
|
||||||
|
localPlayer.setAnimation(id);
|
||||||
|
localPlayer.setActionFrame(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "gfx":
|
||||||
|
{
|
||||||
|
int id = Integer.parseInt(args[0]);
|
||||||
|
Player localPlayer = client.getLocalPlayer();
|
||||||
|
localPlayer.setGraphic(id);
|
||||||
|
localPlayer.setSpotAnimFrame(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "transform":
|
||||||
|
{
|
||||||
|
int id = Integer.parseInt(args[0]);
|
||||||
|
Player player = client.getLocalPlayer();
|
||||||
|
player.getPlayerComposition().setTransformedNpcId(id);
|
||||||
|
player.setIdlePoseAnimation(-1);
|
||||||
|
player.setPoseAnimation(-1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "cape":
|
||||||
|
{
|
||||||
|
int id = Integer.parseInt(args[0]);
|
||||||
|
Player player = client.getLocalPlayer();
|
||||||
|
player.getPlayerComposition().getEquipmentIds()[KitType.CAPE.getIndex()] = id + 512;
|
||||||
|
player.getPlayerComposition().setHash();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "sound":
|
||||||
|
{
|
||||||
|
int id = Integer.parseInt(args[0]);
|
||||||
|
client.playSoundEffect(id);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "msg":
|
||||||
|
{
|
||||||
|
client.addChatMessage(ChatMessageType.GAMEMESSAGE, "", String.join(" ", args), "");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "setconf":
|
||||||
|
{
|
||||||
|
// setconf group.key name = value
|
||||||
|
String group = args[0];
|
||||||
|
String key = args[1], value = "";
|
||||||
|
for (int i = 2; i < args.length; ++i)
|
||||||
|
{
|
||||||
|
if (args[i].equals("="))
|
||||||
|
{
|
||||||
|
value = String.join(" ", Arrays.copyOfRange(args, i + 1, args.length));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
key += " " + args[i];
|
||||||
|
}
|
||||||
|
String current = configManager.getConfiguration(group, key);
|
||||||
|
final String message;
|
||||||
|
if (value.isEmpty())
|
||||||
|
{
|
||||||
|
configManager.unsetConfiguration(group, key);
|
||||||
|
message = String.format("Unset configuration %s.%s (was: %s)", group, key, current);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
configManager.setConfiguration(group, key, value);
|
||||||
|
message = String.format("Set configuration %s.%s to %s (was: %s)", group, key, value, current);
|
||||||
|
}
|
||||||
|
chatMessageManager.queue(QueuedMessage.builder()
|
||||||
|
.type(ChatMessageType.GAMEMESSAGE)
|
||||||
|
.runeLiteFormattedMessage(new ChatMessageBuilder().append(message).build())
|
||||||
|
.build());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "getconf":
|
||||||
|
{
|
||||||
|
String group = args[0], key = String.join(" ", Arrays.copyOfRange(args, 1, args.length));
|
||||||
|
String value = configManager.getConfiguration(group, key);
|
||||||
|
final String message = String.format("%s.%s = %s", group, key, value);
|
||||||
|
chatMessageManager.queue(QueuedMessage.builder()
|
||||||
|
.type(ChatMessageType.GAMEMESSAGE)
|
||||||
|
.runeLiteFormattedMessage(new ChatMessageBuilder().append(message).build())
|
||||||
|
.build());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onMenuEntryAdded(MenuEntryAdded event)
|
||||||
|
{
|
||||||
|
if (!examine.isActive())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuAction action = MenuAction.of(event.getType());
|
||||||
|
|
||||||
|
if (EXAMINE_MENU_ACTIONS.contains(action))
|
||||||
|
{
|
||||||
|
MenuEntry[] entries = client.getMenuEntries();
|
||||||
|
MenuEntry entry = entries[entries.length - 1];
|
||||||
|
|
||||||
|
final int identifier = event.getIdentifier();
|
||||||
|
String info = "ID: ";
|
||||||
|
|
||||||
|
if (action == MenuAction.EXAMINE_NPC)
|
||||||
|
{
|
||||||
|
NPC npc = client.getCachedNPCs()[identifier];
|
||||||
|
info += npc.getId();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
info += identifier;
|
||||||
|
|
||||||
|
if (action == MenuAction.EXAMINE_OBJECT)
|
||||||
|
{
|
||||||
|
WorldPoint point = WorldPoint.fromScene(client, entry.getParam0(), entry.getParam1(), client.getPlane());
|
||||||
|
info += " X: " + point.getX() + " Y: " + point.getY();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
entry.setTarget(entry.getTarget() + " " + ColorUtil.prependColorTag("(" + info + ")", JagexColors.MENU_TARGET));
|
||||||
|
client.setMenuEntries(entries);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,224 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, TheStonedTurtle <https://github.com/TheStonedTurtle>
|
||||||
|
* 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.GridLayout;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.event.ComponentAdapter;
|
||||||
|
import java.awt.event.ComponentEvent;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import javax.swing.BoxLayout;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.Scrollable;
|
||||||
|
import javax.swing.SwingConstants;
|
||||||
|
import javax.swing.border.EmptyBorder;
|
||||||
|
import net.runelite.api.Constants;
|
||||||
|
import net.runelite.api.Item;
|
||||||
|
import net.runelite.client.game.ItemManager;
|
||||||
|
import net.runelite.client.ui.ColorScheme;
|
||||||
|
import net.runelite.client.ui.FontManager;
|
||||||
|
|
||||||
|
class InventoryDeltaPanel extends JPanel implements Scrollable
|
||||||
|
{
|
||||||
|
private static final DecimalFormat COMMA_FORMAT = new DecimalFormat("#,###");
|
||||||
|
private static final Dimension ITEM_SIZE = new Dimension(Constants.ITEM_SPRITE_WIDTH + 4, Constants.ITEM_SPRITE_HEIGHT);
|
||||||
|
|
||||||
|
private final ItemManager itemManager;
|
||||||
|
private final JPanel addedGrid = new JPanel();
|
||||||
|
private final JPanel removedGrid = new JPanel();
|
||||||
|
private final JPanel currentGrid = new JPanel();
|
||||||
|
|
||||||
|
InventoryDeltaPanel(final ItemManager itemManager)
|
||||||
|
{
|
||||||
|
this.itemManager = itemManager;
|
||||||
|
|
||||||
|
setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
|
||||||
|
|
||||||
|
final EmptyBorder border = new EmptyBorder(2, 2, 2, 2);
|
||||||
|
setBorder(border);
|
||||||
|
addedGrid.setBorder(border);
|
||||||
|
removedGrid.setBorder(border);
|
||||||
|
currentGrid.setBorder(border);
|
||||||
|
|
||||||
|
final GridLayout layout = new GridLayout(0, 1, 1, 1);
|
||||||
|
addedGrid.setLayout(layout);
|
||||||
|
removedGrid.setLayout(layout);
|
||||||
|
currentGrid.setLayout(layout);
|
||||||
|
|
||||||
|
// Listen for resize events
|
||||||
|
addComponentListener(new ComponentAdapter()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void componentResized(final ComponentEvent componentEvent)
|
||||||
|
{
|
||||||
|
// Account for container and slot padding
|
||||||
|
final int cols = Math.max((getWidth() - 4) / (ITEM_SIZE.width + 1), 1);
|
||||||
|
final GridLayout layout = new GridLayout(0, cols, 1, 1);
|
||||||
|
addedGrid.setLayout(layout);
|
||||||
|
removedGrid.setLayout(layout);
|
||||||
|
currentGrid.setLayout(layout);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void clear()
|
||||||
|
{
|
||||||
|
addedGrid.removeAll();
|
||||||
|
removedGrid.removeAll();
|
||||||
|
currentGrid.removeAll();
|
||||||
|
removeAll();
|
||||||
|
revalidate();
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
void displayItems(final InventoryItem[] items, @Nullable final InventoryItem[] added, @Nullable final InventoryItem[] removed)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
|
||||||
|
if (added != null && added.length > 0)
|
||||||
|
{
|
||||||
|
final JLabel label = new JLabel("Items Added:", JLabel.CENTER);
|
||||||
|
label.setAlignmentX(JLabel.CENTER_ALIGNMENT);
|
||||||
|
add(label);
|
||||||
|
add(addedGrid);
|
||||||
|
|
||||||
|
for (final InventoryItem item : added)
|
||||||
|
{
|
||||||
|
addItemToPanel(item, addedGrid).setBackground(new Color(0, 100, 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (removed != null && removed.length > 0)
|
||||||
|
{
|
||||||
|
final JLabel label = new JLabel("Items Removed:", JLabel.CENTER);
|
||||||
|
label.setAlignmentX(JLabel.CENTER_ALIGNMENT);
|
||||||
|
add(label);
|
||||||
|
add(removedGrid);
|
||||||
|
|
||||||
|
for (final InventoryItem item : removed)
|
||||||
|
{
|
||||||
|
addItemToPanel(item, removedGrid).setBackground(new Color(120, 0, 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final JLabel label = new JLabel("Items in Inventory:", JLabel.CENTER);
|
||||||
|
label.setAlignmentX(JLabel.CENTER_ALIGNMENT);
|
||||||
|
add(label);
|
||||||
|
add(currentGrid);
|
||||||
|
|
||||||
|
for (final InventoryItem item : items)
|
||||||
|
{
|
||||||
|
final JLabel gridItem = addItemToPanel(item, currentGrid);
|
||||||
|
// Add hover effect
|
||||||
|
gridItem.addMouseListener(new MouseAdapter()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void mouseEntered(MouseEvent e)
|
||||||
|
{
|
||||||
|
final JLabel label = (JLabel) e.getSource();
|
||||||
|
label.setBackground(ColorScheme.DARKER_GRAY_HOVER_COLOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseExited(MouseEvent e)
|
||||||
|
{
|
||||||
|
final JLabel label = (JLabel) e.getSource();
|
||||||
|
label.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
gridItem.setToolTipText("<html>Name: " + item.getName()
|
||||||
|
+ "<br/>Item ID: " + item.getItem().getId()
|
||||||
|
+ "<br/>Quantity: " + COMMA_FORMAT.format(item.getItem().getQuantity())
|
||||||
|
+ "<br/>Slot: " + item.getSlot()
|
||||||
|
+ "</html>");
|
||||||
|
}
|
||||||
|
|
||||||
|
revalidate();
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
private JLabel addItemToPanel(final InventoryItem inventoryItem, final JPanel panel)
|
||||||
|
{
|
||||||
|
final JLabel gridItem = new JLabel();
|
||||||
|
gridItem.setOpaque(true);
|
||||||
|
gridItem.setPreferredSize(ITEM_SIZE);
|
||||||
|
gridItem.setVerticalAlignment(SwingConstants.CENTER);
|
||||||
|
gridItem.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
|
gridItem.setFont(FontManager.getRunescapeSmallFont());
|
||||||
|
|
||||||
|
final Item item = inventoryItem.getItem();
|
||||||
|
if (item.getId() == -1)
|
||||||
|
{
|
||||||
|
gridItem.setText("EMPTY");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
itemManager.getImage(item.getId(), item.getQuantity(), item.getQuantity() > 1).addTo(gridItem);
|
||||||
|
gridItem.setToolTipText("<html>Name: " + inventoryItem.getName()
|
||||||
|
+ "<br/>Item ID: " + item.getId()
|
||||||
|
+ "<br/>Quantity: " + COMMA_FORMAT.format(item.getQuantity())
|
||||||
|
+ "</html>");
|
||||||
|
}
|
||||||
|
|
||||||
|
panel.add(gridItem);
|
||||||
|
return gridItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dimension getPreferredScrollableViewportSize()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
|
||||||
|
{
|
||||||
|
return 1 + (orientation == SwingConstants.VERTICAL ? ITEM_SIZE.height : ITEM_SIZE.width);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
|
||||||
|
{
|
||||||
|
return 1 + (orientation == SwingConstants.VERTICAL ? ITEM_SIZE.height : ITEM_SIZE.width);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getScrollableTracksViewportWidth()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getScrollableTracksViewportHeight()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,361 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, TheStonedTurtle <https://github.com/TheStonedTurtle>
|
||||||
|
* 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.BorderLayout;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.event.AdjustmentEvent;
|
||||||
|
import java.awt.event.AdjustmentListener;
|
||||||
|
import java.awt.event.WindowAdapter;
|
||||||
|
import java.awt.event.WindowEvent;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JScrollBar;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.JSplitPane;
|
||||||
|
import javax.swing.JTree;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
import javax.swing.border.EmptyBorder;
|
||||||
|
import javax.swing.tree.DefaultMutableTreeNode;
|
||||||
|
import javax.swing.tree.DefaultTreeModel;
|
||||||
|
import javax.swing.tree.TreeNode;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.InventoryID;
|
||||||
|
import net.runelite.api.Item;
|
||||||
|
import net.runelite.api.ItemComposition;
|
||||||
|
import net.runelite.api.events.ItemContainerChanged;
|
||||||
|
import net.runelite.client.callback.ClientThread;
|
||||||
|
import net.runelite.client.eventbus.EventBus;
|
||||||
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
|
import net.runelite.client.game.ItemManager;
|
||||||
|
import net.runelite.client.ui.ClientUI;
|
||||||
|
import net.runelite.client.ui.ColorScheme;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Singleton
|
||||||
|
class InventoryInspector extends JFrame
|
||||||
|
{
|
||||||
|
private static final int MAX_LOG_ENTRIES = 25;
|
||||||
|
|
||||||
|
private final Client client;
|
||||||
|
private final EventBus eventBus;
|
||||||
|
private final ItemManager itemManager;
|
||||||
|
|
||||||
|
private final Map<Integer, InventoryTreeNode> nodeMap = new HashMap<>();
|
||||||
|
private final Map<Integer, InventoryLog> logMap = new HashMap<>();
|
||||||
|
private final DefaultMutableTreeNode trackerRootNode = new DefaultMutableTreeNode();
|
||||||
|
private final JTree tree = new JTree(trackerRootNode);
|
||||||
|
private final InventoryDeltaPanel deltaPanel;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
InventoryInspector(Client client, EventBus eventBus, DevToolsPlugin plugin, ItemManager itemManager, ClientThread clientThread)
|
||||||
|
{
|
||||||
|
this.client = client;
|
||||||
|
this.eventBus = eventBus;
|
||||||
|
this.itemManager = itemManager;
|
||||||
|
|
||||||
|
this.deltaPanel = new InventoryDeltaPanel(itemManager);
|
||||||
|
|
||||||
|
setLayout(new BorderLayout());
|
||||||
|
setTitle("RuneLite Inventory Inspector");
|
||||||
|
setIconImage(ClientUI.ICON);
|
||||||
|
|
||||||
|
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||||
|
// Reset highlight on close
|
||||||
|
addWindowListener(new WindowAdapter()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void windowClosing(WindowEvent e)
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
plugin.getInventoryInspector().setActive(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
tree.setBorder(new EmptyBorder(2, 2, 2, 2));
|
||||||
|
tree.setRootVisible(false);
|
||||||
|
tree.setShowsRootHandles(true);
|
||||||
|
tree.addTreeSelectionListener(e ->
|
||||||
|
{
|
||||||
|
if (e.getNewLeadSelectionPath() == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Object node = e.getNewLeadSelectionPath().getLastPathComponent();
|
||||||
|
if (node instanceof InventoryLogNode)
|
||||||
|
{
|
||||||
|
clientThread.invoke(() -> displayItemSnapshot((InventoryLogNode) node));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tree.setModel(new DefaultTreeModel(trackerRootNode));
|
||||||
|
|
||||||
|
final JPanel leftSide = new JPanel();
|
||||||
|
leftSide.setLayout(new BorderLayout());
|
||||||
|
|
||||||
|
final JScrollPane trackerScroller = new JScrollPane(tree);
|
||||||
|
trackerScroller.setPreferredSize(new Dimension(200, 400));
|
||||||
|
|
||||||
|
final JScrollBar vertical = trackerScroller.getVerticalScrollBar();
|
||||||
|
vertical.addAdjustmentListener(new AdjustmentListener()
|
||||||
|
{
|
||||||
|
int lastMaximum = actualMax();
|
||||||
|
|
||||||
|
private int actualMax()
|
||||||
|
{
|
||||||
|
return vertical.getMaximum() - vertical.getModel().getExtent();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void adjustmentValueChanged(AdjustmentEvent e)
|
||||||
|
{
|
||||||
|
if (vertical.getValue() >= lastMaximum)
|
||||||
|
{
|
||||||
|
vertical.setValue(actualMax());
|
||||||
|
}
|
||||||
|
lastMaximum = actualMax();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
leftSide.add(trackerScroller, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
final JButton refreshBtn = new JButton("Refresh");
|
||||||
|
refreshBtn.setFocusable(false);
|
||||||
|
refreshBtn.addActionListener(e -> refreshTracker());
|
||||||
|
|
||||||
|
final JButton clearBtn = new JButton("Clear");
|
||||||
|
clearBtn.setFocusable(false);
|
||||||
|
clearBtn.addActionListener(e -> clearTracker());
|
||||||
|
|
||||||
|
final JPanel bottomRow = new JPanel();
|
||||||
|
bottomRow.add(refreshBtn);
|
||||||
|
bottomRow.add(clearBtn);
|
||||||
|
|
||||||
|
leftSide.add(bottomRow, BorderLayout.SOUTH);
|
||||||
|
|
||||||
|
final JScrollPane gridScroller = new JScrollPane(deltaPanel);
|
||||||
|
gridScroller.getViewport().setBackground(ColorScheme.DARK_GRAY_COLOR);
|
||||||
|
gridScroller.setPreferredSize(new Dimension(200, 400));
|
||||||
|
|
||||||
|
final JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftSide, gridScroller);
|
||||||
|
add(split, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
pack();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void open()
|
||||||
|
{
|
||||||
|
eventBus.register(this);
|
||||||
|
setVisible(true);
|
||||||
|
toFront();
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void close()
|
||||||
|
{
|
||||||
|
eventBus.unregister(this);
|
||||||
|
clearTracker();
|
||||||
|
setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onItemContainerChanged(ItemContainerChanged event)
|
||||||
|
{
|
||||||
|
final int id = event.getContainerId();
|
||||||
|
final InventoryLog log = new InventoryLog(id, getNameForInventoryID(id), event.getItemContainer().getItems(), client.getTickCount());
|
||||||
|
|
||||||
|
// Delay updates until refresh button is pressed
|
||||||
|
logMap.put(id, log);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addLog(final InventoryLog invLog)
|
||||||
|
{
|
||||||
|
final InventoryTreeNode node = nodeMap.computeIfAbsent(invLog.getContainerId(), (k) -> new InventoryTreeNode(invLog.getContainerId(), invLog.getContainerName()));
|
||||||
|
node.add(new InventoryLogNode(invLog));
|
||||||
|
|
||||||
|
// Cull very old stuff
|
||||||
|
while (node.getChildCount() > MAX_LOG_ENTRIES)
|
||||||
|
{
|
||||||
|
node.remove(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clearTracker()
|
||||||
|
{
|
||||||
|
logMap.clear();
|
||||||
|
nodeMap.clear();
|
||||||
|
deltaPanel.clear();
|
||||||
|
trackerRootNode.removeAllChildren();
|
||||||
|
tree.setModel(new DefaultTreeModel(trackerRootNode));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshTracker()
|
||||||
|
{
|
||||||
|
deltaPanel.clear();
|
||||||
|
|
||||||
|
if (logMap.size() > 0)
|
||||||
|
{
|
||||||
|
logMap.values().forEach(this::addLog);
|
||||||
|
logMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
SwingUtilities.invokeLater(() ->
|
||||||
|
{
|
||||||
|
trackerRootNode.removeAllChildren();
|
||||||
|
nodeMap.values().forEach(trackerRootNode::add);
|
||||||
|
tree.setModel(new DefaultTreeModel(trackerRootNode));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void displayItemSnapshot(final InventoryLogNode logNode)
|
||||||
|
{
|
||||||
|
final InventoryTreeNode treeNode = nodeMap.get(logNode.getLog().getContainerId());
|
||||||
|
if (treeNode == null)
|
||||||
|
{
|
||||||
|
log.warn("Clicked on a JTree node that doesn't map anywhere: {}", logNode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Item[] curItems = logNode.getLog().getItems();
|
||||||
|
final InventoryItem[] curInventory = convertToInventoryItems(curItems);
|
||||||
|
|
||||||
|
InventoryItem[][] deltas = null;
|
||||||
|
// Compare against previous snapshot
|
||||||
|
if (treeNode.getIndex(logNode) > 0)
|
||||||
|
{
|
||||||
|
final TreeNode prevNode = treeNode.getChildBefore(logNode);
|
||||||
|
if (prevNode instanceof InventoryLogNode)
|
||||||
|
{
|
||||||
|
final InventoryLogNode prevLogNode = (InventoryLogNode) prevNode;
|
||||||
|
deltas = compareItemSnapshots(prevLogNode.getLog().getItems(), curItems);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final InventoryItem[] added = deltas == null ? null : deltas[0];
|
||||||
|
final InventoryItem[] removed = deltas == null ? null : deltas[1];
|
||||||
|
|
||||||
|
SwingUtilities.invokeLater(() -> deltaPanel.displayItems(curInventory, added, removed));
|
||||||
|
}
|
||||||
|
|
||||||
|
private InventoryItem[] convertToInventoryItems(final Item[] items)
|
||||||
|
{
|
||||||
|
final InventoryItem[] out = new InventoryItem[items.length];
|
||||||
|
for (int i = 0; i < items.length; i++)
|
||||||
|
{
|
||||||
|
final Item item = items[i];
|
||||||
|
final ItemComposition c = itemManager.getItemComposition(item.getId());
|
||||||
|
out[i] = new InventoryItem(i, item, c.getName(), c.isStackable());
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares the current inventory to the old one returning the InventoryItems that were added and removed.
|
||||||
|
* @param previous old snapshot
|
||||||
|
* @param current new snapshot
|
||||||
|
* @return The first InventoryItem[] contains the items that were added and the second contains the items that were removed
|
||||||
|
*/
|
||||||
|
private InventoryItem[][] compareItemSnapshots(final Item[] previous, final Item[] current)
|
||||||
|
{
|
||||||
|
final Map<Integer, Integer> qtyMap = new HashMap<>();
|
||||||
|
|
||||||
|
// ItemContainers shouldn't become smaller over time, but just in case
|
||||||
|
final int maxSlots = Math.max(previous.length, current.length);
|
||||||
|
for (int i = 0; i < maxSlots; i++)
|
||||||
|
{
|
||||||
|
final Item prev = previous.length > i ? previous[i] : null;
|
||||||
|
final Item cur = current.length > i ? current[i] : null;
|
||||||
|
|
||||||
|
if (prev != null)
|
||||||
|
{
|
||||||
|
qtyMap.merge(prev.getId(), -1 * prev.getQuantity(), Integer::sum);
|
||||||
|
}
|
||||||
|
if (cur != null)
|
||||||
|
{
|
||||||
|
qtyMap.merge(cur.getId(), cur.getQuantity(), Integer::sum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Map<Boolean, List<InventoryItem>> result = qtyMap.entrySet().stream()
|
||||||
|
.filter(e -> e.getValue() != 0)
|
||||||
|
.flatMap(e ->
|
||||||
|
{
|
||||||
|
final int id = e.getKey();
|
||||||
|
final int qty = e.getValue();
|
||||||
|
final ItemComposition c = itemManager.getItemComposition(e.getKey());
|
||||||
|
|
||||||
|
InventoryItem[] items = {
|
||||||
|
new InventoryItem(-1, new Item(id, qty), c.getName(), c.isStackable())
|
||||||
|
};
|
||||||
|
if (!c.isStackable() && (qty > 1 || qty < -1))
|
||||||
|
{
|
||||||
|
items = new InventoryItem[Math.abs(qty)];
|
||||||
|
for (int i = 0; i < Math.abs(qty); i++)
|
||||||
|
{
|
||||||
|
final Item item = new Item(id, Integer.signum(qty));
|
||||||
|
items[i] = new InventoryItem(-1, item, c.getName(), c.isStackable());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Arrays.stream(items);
|
||||||
|
})
|
||||||
|
.collect(Collectors.partitioningBy(item -> item.getItem().getQuantity() > 0));
|
||||||
|
|
||||||
|
final InventoryItem[] added = result.get(true).toArray(new InventoryItem[0]);
|
||||||
|
final InventoryItem[] removed = result.get(false).stream()
|
||||||
|
// Make quantities positive now that its been sorted.
|
||||||
|
.peek(i -> i.setItem(new Item(i.getItem().getId(), -i.getItem().getQuantity())))
|
||||||
|
.toArray(InventoryItem[]::new);
|
||||||
|
|
||||||
|
return new InventoryItem[][]{
|
||||||
|
added, removed
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private static String getNameForInventoryID(final int id)
|
||||||
|
{
|
||||||
|
for (final InventoryID inv : InventoryID.values())
|
||||||
|
{
|
||||||
|
if (inv.getId() == id)
|
||||||
|
{
|
||||||
|
return inv.name();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, TheStonedTurtle <https://github.com/TheStonedTurtle>
|
||||||
|
* 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 lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import net.runelite.api.Item;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
class InventoryItem
|
||||||
|
{
|
||||||
|
private final int slot;
|
||||||
|
private Item item;
|
||||||
|
private final String name;
|
||||||
|
private final boolean stackable;
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, TheStonedTurtle <https://github.com/TheStonedTurtle>
|
||||||
|
* 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 javax.annotation.Nullable;
|
||||||
|
import lombok.Value;
|
||||||
|
import net.runelite.api.Item;
|
||||||
|
|
||||||
|
@Value
|
||||||
|
class InventoryLog
|
||||||
|
{
|
||||||
|
int containerId;
|
||||||
|
@Nullable
|
||||||
|
String containerName;
|
||||||
|
Item[] items;
|
||||||
|
int tick;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, TheStonedTurtle <https://github.com/TheStonedTurtle>
|
||||||
|
* 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 javax.swing.tree.DefaultMutableTreeNode;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
class InventoryLogNode extends DefaultMutableTreeNode
|
||||||
|
{
|
||||||
|
private final InventoryLog log;
|
||||||
|
|
||||||
|
InventoryLogNode(final InventoryLog log)
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.log = log;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return "Tick: " + log.getTick();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, TheStonedTurtle <https://github.com/TheStonedTurtle>
|
||||||
|
* 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 javax.annotation.Nullable;
|
||||||
|
import javax.swing.tree.DefaultMutableTreeNode;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
class InventoryTreeNode extends DefaultMutableTreeNode
|
||||||
|
{
|
||||||
|
final int id;
|
||||||
|
@Nullable
|
||||||
|
final String name;
|
||||||
|
|
||||||
|
InventoryTreeNode(final int id, @Nullable final String name)
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return id + (name == null ? "" : " - " + name);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Seth <https://github.com/sethtroll>
|
||||||
|
* 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 static net.runelite.api.Constants.CHUNK_SIZE;
|
||||||
|
import net.runelite.api.coords.LocalPoint;
|
||||||
|
import net.runelite.api.coords.WorldPoint;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayPanel;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
|
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||||
|
|
||||||
|
public class LocationOverlay extends OverlayPanel
|
||||||
|
{
|
||||||
|
private final Client client;
|
||||||
|
private final DevToolsPlugin plugin;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
LocationOverlay(Client client, DevToolsPlugin plugin)
|
||||||
|
{
|
||||||
|
this.client = client;
|
||||||
|
this.plugin = plugin;
|
||||||
|
setPosition(OverlayPosition.TOP_LEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dimension render(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
if (!plugin.getLocation().isActive())
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
WorldPoint localWorld = client.getLocalPlayer().getWorldLocation();
|
||||||
|
LocalPoint localPoint = client.getLocalPlayer().getLocalLocation();
|
||||||
|
|
||||||
|
int regionID = localWorld.getRegionID();
|
||||||
|
|
||||||
|
if (client.isInInstancedRegion())
|
||||||
|
{
|
||||||
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
|
.left("Instance")
|
||||||
|
.build());
|
||||||
|
|
||||||
|
int[][][] instanceTemplateChunks = client.getInstanceTemplateChunks();
|
||||||
|
int z = client.getPlane();
|
||||||
|
int chunkData = instanceTemplateChunks[z][localPoint.getSceneX() / CHUNK_SIZE][localPoint.getSceneY() / CHUNK_SIZE];
|
||||||
|
|
||||||
|
int rotation = chunkData >> 1 & 0x3;
|
||||||
|
int chunkY = (chunkData >> 3 & 0x7FF) * CHUNK_SIZE;
|
||||||
|
int chunkX = (chunkData >> 14 & 0x3FF) * CHUNK_SIZE;
|
||||||
|
|
||||||
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
|
.left("Chunk " + localPoint.getSceneX() / CHUNK_SIZE + "," + localPoint.getSceneY() / CHUNK_SIZE)
|
||||||
|
.right(rotation + " " + chunkX + " " + chunkY)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
|
.left("Base")
|
||||||
|
.right(client.getBaseX() + ", " + client.getBaseY())
|
||||||
|
.build());
|
||||||
|
|
||||||
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
|
.left("Local")
|
||||||
|
.right(localPoint.getX() + ", " + localPoint.getY())
|
||||||
|
.build());
|
||||||
|
|
||||||
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
|
.left("Scene")
|
||||||
|
.right(localPoint.getSceneX() + ", " + localPoint.getSceneY())
|
||||||
|
.build());
|
||||||
|
|
||||||
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
|
.left("Tile")
|
||||||
|
.right(localWorld.getX() + ", " + localWorld.getY() + ", " + client.getPlane())
|
||||||
|
.build());
|
||||||
|
|
||||||
|
for (int i = 0; i < client.getMapRegions().length; i++)
|
||||||
|
{
|
||||||
|
int region = client.getMapRegions()[i];
|
||||||
|
|
||||||
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
|
.left((i == 0) ? "Map regions" : " ")
|
||||||
|
.right(String.valueOf(region))
|
||||||
|
.rightColor((region == regionID) ? Color.GREEN : Color.WHITE)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.render(graphics);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, Pratted <https://github.com/Pratted>
|
||||||
|
* 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 lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import net.runelite.api.CollisionDataFlag;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An enum that binds a name to each movement flag.
|
||||||
|
*
|
||||||
|
* @see CollisionDataFlag
|
||||||
|
*/
|
||||||
|
@AllArgsConstructor
|
||||||
|
enum MovementFlag
|
||||||
|
{
|
||||||
|
BLOCK_MOVEMENT_NORTH_WEST(CollisionDataFlag.BLOCK_MOVEMENT_NORTH_WEST),
|
||||||
|
BLOCK_MOVEMENT_NORTH(CollisionDataFlag.BLOCK_MOVEMENT_NORTH),
|
||||||
|
BLOCK_MOVEMENT_NORTH_EAST(CollisionDataFlag.BLOCK_MOVEMENT_NORTH_EAST),
|
||||||
|
BLOCK_MOVEMENT_EAST(CollisionDataFlag.BLOCK_MOVEMENT_EAST),
|
||||||
|
BLOCK_MOVEMENT_SOUTH_EAST(CollisionDataFlag.BLOCK_MOVEMENT_SOUTH_EAST),
|
||||||
|
BLOCK_MOVEMENT_SOUTH(CollisionDataFlag.BLOCK_MOVEMENT_SOUTH),
|
||||||
|
BLOCK_MOVEMENT_SOUTH_WEST(CollisionDataFlag.BLOCK_MOVEMENT_SOUTH_WEST),
|
||||||
|
BLOCK_MOVEMENT_WEST(CollisionDataFlag.BLOCK_MOVEMENT_WEST),
|
||||||
|
|
||||||
|
BLOCK_MOVEMENT_OBJECT(CollisionDataFlag.BLOCK_MOVEMENT_OBJECT),
|
||||||
|
BLOCK_MOVEMENT_FLOOR_DECORATION(CollisionDataFlag.BLOCK_MOVEMENT_FLOOR_DECORATION),
|
||||||
|
BLOCK_MOVEMENT_FLOOR(CollisionDataFlag.BLOCK_MOVEMENT_FLOOR),
|
||||||
|
BLOCK_MOVEMENT_FULL(CollisionDataFlag.BLOCK_MOVEMENT_FULL);
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private int flag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param collisionData The tile collision flags.
|
||||||
|
* @return The set of {@link MovementFlag}s that have been set.
|
||||||
|
*/
|
||||||
|
public static Set<MovementFlag> getSetFlags(int collisionData)
|
||||||
|
{
|
||||||
|
return Arrays.stream(values())
|
||||||
|
.filter(movementFlag -> (movementFlag.flag & collisionData) != 0)
|
||||||
|
.collect(Collectors.toSet());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,406 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Woox <https://github.com/wooxsolo>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.runelite.client.plugins.devtools;
|
||||||
|
|
||||||
|
import java.awt.BasicStroke;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Polygon;
|
||||||
|
import java.awt.geom.AffineTransform;
|
||||||
|
import java.awt.geom.GeneralPath;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import net.runelite.api.Actor;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.NPC;
|
||||||
|
import net.runelite.api.Perspective;
|
||||||
|
import net.runelite.api.Player;
|
||||||
|
import net.runelite.api.Point;
|
||||||
|
import net.runelite.api.coords.LocalPoint;
|
||||||
|
import net.runelite.api.coords.WorldArea;
|
||||||
|
import net.runelite.api.coords.WorldPoint;
|
||||||
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||||
|
|
||||||
|
public class SceneOverlay extends Overlay
|
||||||
|
{
|
||||||
|
private static final Color MAP_SQUARE_COLOR = Color.GREEN;
|
||||||
|
private static final Color CHUNK_BORDER_COLOR = Color.BLUE;
|
||||||
|
private static final Color LOCAL_VALID_MOVEMENT_COLOR = new Color(141, 220, 26);
|
||||||
|
private static final Color VALID_MOVEMENT_COLOR = new Color(73, 122, 18);
|
||||||
|
private static final Color LINE_OF_SIGHT_COLOR = new Color(204, 42, 219);
|
||||||
|
private static final Color INTERACTING_COLOR = Color.CYAN;
|
||||||
|
|
||||||
|
private static final int LOCAL_TILE_SIZE = Perspective.LOCAL_TILE_SIZE;
|
||||||
|
private static final int CHUNK_SIZE = 8;
|
||||||
|
private static final int MAP_SQUARE_SIZE = CHUNK_SIZE * CHUNK_SIZE; // 64
|
||||||
|
private static final int CULL_CHUNK_BORDERS_RANGE = 16;
|
||||||
|
private static final int STROKE_WIDTH = 4;
|
||||||
|
private static final int CULL_LINE_OF_SIGHT_RANGE = 10;
|
||||||
|
private static final int INTERACTING_SHIFT = -16;
|
||||||
|
|
||||||
|
private static final Polygon ARROW_HEAD = new Polygon(
|
||||||
|
new int[]{0, -3, 3},
|
||||||
|
new int[]{0, -5, -5},
|
||||||
|
3
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
private final Client client;
|
||||||
|
private final DevToolsPlugin plugin;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public SceneOverlay(Client client, DevToolsPlugin plugin)
|
||||||
|
{
|
||||||
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
|
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||||
|
this.client = client;
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dimension render(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
if (plugin.getChunkBorders().isActive())
|
||||||
|
{
|
||||||
|
renderChunkBorders(graphics);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plugin.getMapSquares().isActive())
|
||||||
|
{
|
||||||
|
renderMapSquares(graphics);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plugin.getLineOfSight().isActive())
|
||||||
|
{
|
||||||
|
renderLineOfSight(graphics);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plugin.getValidMovement().isActive())
|
||||||
|
{
|
||||||
|
renderValidMovement(graphics);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plugin.getInteracting().isActive())
|
||||||
|
{
|
||||||
|
renderInteracting(graphics);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderChunkBorders(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
WorldPoint wp = client.getLocalPlayer().getWorldLocation();
|
||||||
|
int startX = (wp.getX() - CULL_CHUNK_BORDERS_RANGE + CHUNK_SIZE - 1) / CHUNK_SIZE * CHUNK_SIZE;
|
||||||
|
int startY = (wp.getY() - CULL_CHUNK_BORDERS_RANGE + CHUNK_SIZE - 1) / CHUNK_SIZE * CHUNK_SIZE;
|
||||||
|
int endX = (wp.getX() + CULL_CHUNK_BORDERS_RANGE) / CHUNK_SIZE * CHUNK_SIZE;
|
||||||
|
int endY = (wp.getY() + CULL_CHUNK_BORDERS_RANGE) / CHUNK_SIZE * CHUNK_SIZE;
|
||||||
|
|
||||||
|
graphics.setStroke(new BasicStroke(STROKE_WIDTH));
|
||||||
|
graphics.setColor(CHUNK_BORDER_COLOR);
|
||||||
|
|
||||||
|
GeneralPath path = new GeneralPath();
|
||||||
|
for (int x = startX; x <= endX; x += CHUNK_SIZE)
|
||||||
|
{
|
||||||
|
LocalPoint lp1 = LocalPoint.fromWorld(client, x, wp.getY() - CULL_CHUNK_BORDERS_RANGE);
|
||||||
|
LocalPoint lp2 = LocalPoint.fromWorld(client, x, wp.getY() + CULL_CHUNK_BORDERS_RANGE);
|
||||||
|
|
||||||
|
boolean first = true;
|
||||||
|
for (int y = lp1.getY(); y <= lp2.getY(); y += LOCAL_TILE_SIZE)
|
||||||
|
{
|
||||||
|
Point p = Perspective.localToCanvas(client,
|
||||||
|
new LocalPoint(lp1.getX() - LOCAL_TILE_SIZE / 2, y - LOCAL_TILE_SIZE / 2),
|
||||||
|
client.getPlane());
|
||||||
|
if (p != null)
|
||||||
|
{
|
||||||
|
if (first)
|
||||||
|
{
|
||||||
|
path.moveTo(p.getX(), p.getY());
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
path.lineTo(p.getX(), p.getY());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int y = startY; y <= endY; y += CHUNK_SIZE)
|
||||||
|
{
|
||||||
|
LocalPoint lp1 = LocalPoint.fromWorld(client, wp.getX() - CULL_CHUNK_BORDERS_RANGE, y);
|
||||||
|
LocalPoint lp2 = LocalPoint.fromWorld(client, wp.getX() + CULL_CHUNK_BORDERS_RANGE, y);
|
||||||
|
|
||||||
|
boolean first = true;
|
||||||
|
for (int x = lp1.getX(); x <= lp2.getX(); x += LOCAL_TILE_SIZE)
|
||||||
|
{
|
||||||
|
Point p = Perspective.localToCanvas(client,
|
||||||
|
new LocalPoint(x - LOCAL_TILE_SIZE / 2, lp1.getY() - LOCAL_TILE_SIZE / 2),
|
||||||
|
client.getPlane());
|
||||||
|
if (p != null)
|
||||||
|
{
|
||||||
|
if (first)
|
||||||
|
{
|
||||||
|
path.moveTo(p.getX(), p.getY());
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
path.lineTo(p.getX(), p.getY());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
graphics.draw(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderMapSquares(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
WorldPoint wp = client.getLocalPlayer().getWorldLocation();
|
||||||
|
int startX = (wp.getX() - CULL_CHUNK_BORDERS_RANGE + MAP_SQUARE_SIZE - 1) / MAP_SQUARE_SIZE * MAP_SQUARE_SIZE;
|
||||||
|
int startY = (wp.getY() - CULL_CHUNK_BORDERS_RANGE + MAP_SQUARE_SIZE - 1) / MAP_SQUARE_SIZE * MAP_SQUARE_SIZE;
|
||||||
|
int endX = (wp.getX() + CULL_CHUNK_BORDERS_RANGE) / MAP_SQUARE_SIZE * MAP_SQUARE_SIZE;
|
||||||
|
int endY = (wp.getY() + CULL_CHUNK_BORDERS_RANGE) / MAP_SQUARE_SIZE * MAP_SQUARE_SIZE;
|
||||||
|
|
||||||
|
graphics.setStroke(new BasicStroke(STROKE_WIDTH));
|
||||||
|
graphics.setColor(MAP_SQUARE_COLOR);
|
||||||
|
|
||||||
|
GeneralPath path = new GeneralPath();
|
||||||
|
for (int x = startX; x <= endX; x += MAP_SQUARE_SIZE)
|
||||||
|
{
|
||||||
|
LocalPoint lp1 = LocalPoint.fromWorld(client, x, wp.getY() - CULL_CHUNK_BORDERS_RANGE);
|
||||||
|
LocalPoint lp2 = LocalPoint.fromWorld(client, x, wp.getY() + CULL_CHUNK_BORDERS_RANGE);
|
||||||
|
|
||||||
|
boolean first = true;
|
||||||
|
for (int y = lp1.getY(); y <= lp2.getY(); y += LOCAL_TILE_SIZE)
|
||||||
|
{
|
||||||
|
Point p = Perspective.localToCanvas(client,
|
||||||
|
new LocalPoint(lp1.getX() - LOCAL_TILE_SIZE / 2, y - LOCAL_TILE_SIZE / 2),
|
||||||
|
client.getPlane());
|
||||||
|
if (p != null)
|
||||||
|
{
|
||||||
|
if (first)
|
||||||
|
{
|
||||||
|
path.moveTo(p.getX(), p.getY());
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
path.lineTo(p.getX(), p.getY());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int y = startY; y <= endY; y += MAP_SQUARE_SIZE)
|
||||||
|
{
|
||||||
|
LocalPoint lp1 = LocalPoint.fromWorld(client, wp.getX() - CULL_CHUNK_BORDERS_RANGE, y);
|
||||||
|
LocalPoint lp2 = LocalPoint.fromWorld(client, wp.getX() + CULL_CHUNK_BORDERS_RANGE, y);
|
||||||
|
|
||||||
|
boolean first = true;
|
||||||
|
for (int x = lp1.getX(); x <= lp2.getX(); x += LOCAL_TILE_SIZE)
|
||||||
|
{
|
||||||
|
Point p = Perspective.localToCanvas(client,
|
||||||
|
new LocalPoint(x - LOCAL_TILE_SIZE / 2, lp1.getY() - LOCAL_TILE_SIZE / 2),
|
||||||
|
client.getPlane());
|
||||||
|
if (p != null)
|
||||||
|
{
|
||||||
|
if (first)
|
||||||
|
{
|
||||||
|
path.moveTo(p.getX(), p.getY());
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
path.lineTo(p.getX(), p.getY());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
graphics.draw(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderTileIfValidForMovement(Graphics2D graphics, Actor actor, int dx, int dy)
|
||||||
|
{
|
||||||
|
WorldArea area = actor.getWorldArea();
|
||||||
|
if (area == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (area.canTravelInDirection(client, dx, dy))
|
||||||
|
{
|
||||||
|
LocalPoint lp = actor.getLocalLocation();
|
||||||
|
if (lp == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
lp = new LocalPoint(
|
||||||
|
lp.getX() + dx * Perspective.LOCAL_TILE_SIZE + dx * Perspective.LOCAL_TILE_SIZE * (area.getWidth() - 1) / 2,
|
||||||
|
lp.getY() + dy * Perspective.LOCAL_TILE_SIZE + dy * Perspective.LOCAL_TILE_SIZE * (area.getHeight() - 1) / 2);
|
||||||
|
|
||||||
|
Polygon poly = Perspective.getCanvasTilePoly(client, lp);
|
||||||
|
if (poly == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (actor == client.getLocalPlayer())
|
||||||
|
{
|
||||||
|
OverlayUtil.renderPolygon(graphics, poly, LOCAL_VALID_MOVEMENT_COLOR);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OverlayUtil.renderPolygon(graphics, poly, VALID_MOVEMENT_COLOR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderValidMovement(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
Player player = client.getLocalPlayer();
|
||||||
|
List<NPC> npcs = client.getNpcs();
|
||||||
|
for (NPC npc : npcs)
|
||||||
|
{
|
||||||
|
if (player.getInteracting() != npc && npc.getInteracting() != player)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (int dx = -1; dx <= 1; dx++)
|
||||||
|
{
|
||||||
|
for (int dy = -1; dy <= 1; dy++)
|
||||||
|
{
|
||||||
|
if (dx == 0 && dy == 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
renderTileIfValidForMovement(graphics, npc, dx, dy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int dx = -1; dx <= 1; dx++)
|
||||||
|
{
|
||||||
|
for (int dy = -1; dy <= 1; dy++)
|
||||||
|
{
|
||||||
|
if (dx == 0 && dy == 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
renderTileIfValidForMovement(graphics, player, dx, dy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderTileIfHasLineOfSight(Graphics2D graphics, WorldArea start, int targetX, int targetY)
|
||||||
|
{
|
||||||
|
WorldPoint targetLocation = new WorldPoint(targetX, targetY, start.getPlane());
|
||||||
|
|
||||||
|
// Running the line of sight algorithm 100 times per frame doesn't
|
||||||
|
// seem to use much CPU time, however rendering 100 tiles does
|
||||||
|
if (start.hasLineOfSightTo(client, targetLocation))
|
||||||
|
{
|
||||||
|
LocalPoint lp = LocalPoint.fromWorld(client, targetLocation);
|
||||||
|
if (lp == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Polygon poly = Perspective.getCanvasTilePoly(client, lp);
|
||||||
|
if (poly == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
OverlayUtil.renderPolygon(graphics, poly, LINE_OF_SIGHT_COLOR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderLineOfSight(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
WorldArea area = client.getLocalPlayer().getWorldArea();
|
||||||
|
for (int x = area.getX() - CULL_LINE_OF_SIGHT_RANGE; x <= area.getX() + CULL_LINE_OF_SIGHT_RANGE; x++)
|
||||||
|
{
|
||||||
|
for (int y = area.getY() - CULL_LINE_OF_SIGHT_RANGE; y <= area.getY() + CULL_LINE_OF_SIGHT_RANGE; y++)
|
||||||
|
{
|
||||||
|
if (x == area.getX() && y == area.getY())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
renderTileIfHasLineOfSight(graphics, area, x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderInteracting(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
Stream.concat(
|
||||||
|
client.getPlayers().stream(),
|
||||||
|
client.getNpcs().stream()
|
||||||
|
).forEach(fa ->
|
||||||
|
{
|
||||||
|
Actor ta = fa.getInteracting();
|
||||||
|
if (ta == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LocalPoint fl = fa.getLocalLocation();
|
||||||
|
Point fs = Perspective.localToCanvas(client, fl, client.getPlane(), fa.getLogicalHeight() / 2);
|
||||||
|
if (fs == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int fsx = fs.getX();
|
||||||
|
int fsy = fs.getY() - INTERACTING_SHIFT;
|
||||||
|
|
||||||
|
LocalPoint tl = ta.getLocalLocation();
|
||||||
|
Point ts = Perspective.localToCanvas(client, tl, client.getPlane(), ta.getLogicalHeight() / 2);
|
||||||
|
if (ts == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int tsx = ts.getX();
|
||||||
|
int tsy = ts.getY() - INTERACTING_SHIFT;
|
||||||
|
|
||||||
|
graphics.setColor(INTERACTING_COLOR);
|
||||||
|
graphics.drawLine(fsx, fsy, tsx, tsy);
|
||||||
|
|
||||||
|
AffineTransform t = new AffineTransform();
|
||||||
|
t.translate(tsx, tsy);
|
||||||
|
t.rotate(tsx - fsx, tsy - fsy);
|
||||||
|
t.rotate(Math.PI / -2);
|
||||||
|
AffineTransform ot = graphics.getTransform();
|
||||||
|
graphics.setTransform(t);
|
||||||
|
graphics.fill(ARROW_HEAD);
|
||||||
|
graphics.setTransform(ot);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,494 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, Trevor <https://github.com/Trevor159>
|
||||||
|
* 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 com.google.common.collect.Lists;
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.FlowLayout;
|
||||||
|
import java.awt.event.AdjustmentEvent;
|
||||||
|
import java.awt.event.AdjustmentListener;
|
||||||
|
import java.awt.event.WindowAdapter;
|
||||||
|
import java.awt.event.WindowEvent;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.swing.BorderFactory;
|
||||||
|
import javax.swing.DefaultListModel;
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JFormattedTextField;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JList;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JScrollBar;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.JSpinner;
|
||||||
|
import javax.swing.JTree;
|
||||||
|
import javax.swing.ListSelectionModel;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
import javax.swing.border.CompoundBorder;
|
||||||
|
import javax.swing.tree.DefaultMutableTreeNode;
|
||||||
|
import javax.swing.tree.DefaultTreeModel;
|
||||||
|
import javax.swing.tree.TreePath;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.events.ScriptPostFired;
|
||||||
|
import net.runelite.api.events.ScriptPreFired;
|
||||||
|
import net.runelite.api.widgets.Widget;
|
||||||
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
|
import static net.runelite.api.widgets.WidgetInfo.TO_CHILD;
|
||||||
|
import static net.runelite.api.widgets.WidgetInfo.TO_GROUP;
|
||||||
|
import net.runelite.client.config.ConfigManager;
|
||||||
|
import net.runelite.client.eventbus.EventBus;
|
||||||
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
|
import net.runelite.client.ui.ClientUI;
|
||||||
|
import net.runelite.client.ui.ColorScheme;
|
||||||
|
import net.runelite.client.ui.DynamicGridLayout;
|
||||||
|
import net.runelite.client.ui.FontManager;
|
||||||
|
import net.runelite.client.util.Text;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class ScriptInspector extends JFrame
|
||||||
|
{
|
||||||
|
// These scripts are the only ones that fire every client tick regardless of location.
|
||||||
|
private final static String DEFAULT_BLACKLIST = "3174,1004";
|
||||||
|
private final static int MAX_LOG_ENTRIES = 10000;
|
||||||
|
|
||||||
|
private final Client client;
|
||||||
|
private final EventBus eventBus;
|
||||||
|
private final ConfigManager configManager;
|
||||||
|
|
||||||
|
private final JPanel tracker = new JPanel();
|
||||||
|
private ScriptTreeNode currentNode;
|
||||||
|
private int lastTick;
|
||||||
|
private Set<Integer> blacklist;
|
||||||
|
private Set<Integer> highlights;
|
||||||
|
private final JList jList;
|
||||||
|
private final DefaultListModel listModel;
|
||||||
|
private ListState state = ListState.BLACKLIST;
|
||||||
|
|
||||||
|
private enum ListState
|
||||||
|
{
|
||||||
|
BLACKLIST,
|
||||||
|
HIGHLIGHT
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
private class ScriptTreeNode extends DefaultMutableTreeNode
|
||||||
|
{
|
||||||
|
private final int scriptId;
|
||||||
|
private Widget source;
|
||||||
|
private int duplicateNumber = 1;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
String output = Integer.toString(scriptId);
|
||||||
|
|
||||||
|
if (duplicateNumber != 1)
|
||||||
|
{
|
||||||
|
output += " (" + duplicateNumber + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (source != null)
|
||||||
|
{
|
||||||
|
int id = source.getId();
|
||||||
|
output += " - " + TO_GROUP(id) + "." + TO_CHILD(id);
|
||||||
|
|
||||||
|
if (source.getIndex() != -1)
|
||||||
|
{
|
||||||
|
output += "[" + source.getIndex() + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
WidgetInfo info = WidgetInspector.getWidgetInfo(id);
|
||||||
|
if (info != null)
|
||||||
|
{
|
||||||
|
output += " " + info.name();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
ScriptInspector(Client client, EventBus eventBus, DevToolsPlugin plugin, ConfigManager configManager)
|
||||||
|
{
|
||||||
|
this.eventBus = eventBus;
|
||||||
|
this.client = client;
|
||||||
|
this.configManager = configManager;
|
||||||
|
|
||||||
|
setTitle("RuneLite Script Inspector");
|
||||||
|
setIconImage(ClientUI.ICON);
|
||||||
|
|
||||||
|
setLayout(new BorderLayout());
|
||||||
|
|
||||||
|
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||||
|
addWindowListener(new WindowAdapter()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void windowClosing(WindowEvent e)
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
plugin.getScriptInspector().setActive(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
tracker.setLayout(new DynamicGridLayout(0, 1, 0, 3));
|
||||||
|
|
||||||
|
final JPanel leftSide = new JPanel();
|
||||||
|
leftSide.setLayout(new BorderLayout());
|
||||||
|
|
||||||
|
final JPanel trackerWrapper = new JPanel();
|
||||||
|
trackerWrapper.setLayout(new BorderLayout());
|
||||||
|
trackerWrapper.add(tracker, BorderLayout.NORTH);
|
||||||
|
|
||||||
|
final JScrollPane trackerScroller = new JScrollPane(trackerWrapper);
|
||||||
|
trackerScroller.setPreferredSize(new Dimension(400, 400));
|
||||||
|
|
||||||
|
final JScrollBar vertical = trackerScroller.getVerticalScrollBar();
|
||||||
|
vertical.addAdjustmentListener(new AdjustmentListener()
|
||||||
|
{
|
||||||
|
int lastMaximum = actualMax();
|
||||||
|
|
||||||
|
private int actualMax()
|
||||||
|
{
|
||||||
|
return vertical.getMaximum() - vertical.getModel().getExtent();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void adjustmentValueChanged(AdjustmentEvent e)
|
||||||
|
{
|
||||||
|
if (vertical.getValue() >= lastMaximum)
|
||||||
|
{
|
||||||
|
vertical.setValue(actualMax());
|
||||||
|
}
|
||||||
|
lastMaximum = actualMax();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
leftSide.add(trackerScroller, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
final JPanel bottomLeftRow = new JPanel();
|
||||||
|
final JButton clearBtn = new JButton("Clear");
|
||||||
|
clearBtn.addActionListener(e ->
|
||||||
|
{
|
||||||
|
tracker.removeAll();
|
||||||
|
tracker.revalidate();
|
||||||
|
});
|
||||||
|
|
||||||
|
bottomLeftRow.add(clearBtn);
|
||||||
|
leftSide.add(bottomLeftRow, BorderLayout.SOUTH);
|
||||||
|
add(leftSide, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
String blacklistConfig = configManager.getConfiguration("devtools", "blacklist");
|
||||||
|
|
||||||
|
if (blacklistConfig == null)
|
||||||
|
{
|
||||||
|
blacklistConfig = DEFAULT_BLACKLIST;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
blacklist = new HashSet<>(Lists.transform(Text.fromCSV(blacklistConfig), Integer::parseInt));
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e)
|
||||||
|
{
|
||||||
|
blacklist = new HashSet<>(Lists.transform(Text.fromCSV(DEFAULT_BLACKLIST), Integer::parseInt));
|
||||||
|
}
|
||||||
|
|
||||||
|
String highlightsConfig = configManager.getConfiguration("devtools", "highlights");
|
||||||
|
|
||||||
|
if (highlightsConfig == null)
|
||||||
|
{
|
||||||
|
highlightsConfig = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
highlights = new HashSet<>(Lists.transform(Text.fromCSV(highlightsConfig), Integer::parseInt));
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e)
|
||||||
|
{
|
||||||
|
blacklist = new HashSet<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
final JPanel rightSide = new JPanel();
|
||||||
|
rightSide.setLayout(new BorderLayout());
|
||||||
|
|
||||||
|
listModel = new DefaultListModel();
|
||||||
|
changeState(ListState.BLACKLIST);
|
||||||
|
jList = new JList(listModel);
|
||||||
|
jList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||||
|
JScrollPane listScrollPane = new JScrollPane(jList);
|
||||||
|
|
||||||
|
final JButton blacklistButton = new JButton("Blacklist");
|
||||||
|
blacklistButton.addActionListener(e -> changeState(ListState.BLACKLIST));
|
||||||
|
|
||||||
|
final JButton highlightsButton = new JButton("Highlights");
|
||||||
|
highlightsButton.addActionListener(e -> changeState(ListState.HIGHLIGHT));
|
||||||
|
|
||||||
|
final JPanel topLeftRow = new JPanel();
|
||||||
|
topLeftRow.setLayout(new FlowLayout());
|
||||||
|
topLeftRow.add(blacklistButton);
|
||||||
|
topLeftRow.add(highlightsButton);
|
||||||
|
|
||||||
|
rightSide.add(topLeftRow, BorderLayout.NORTH);
|
||||||
|
rightSide.add(listScrollPane, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
final JSpinner jSpinner = new JSpinner();
|
||||||
|
Component mySpinnerEditor = jSpinner.getEditor();
|
||||||
|
JFormattedTextField textField = ((JSpinner.DefaultEditor) mySpinnerEditor).getTextField();
|
||||||
|
textField.setColumns(5);
|
||||||
|
|
||||||
|
final JButton addButton = new JButton("Add");
|
||||||
|
addButton.addActionListener(e -> addToSet(jSpinner));
|
||||||
|
|
||||||
|
final JButton removeButton = new JButton("Remove");
|
||||||
|
removeButton.addActionListener(e -> removeSelectedFromSet());
|
||||||
|
|
||||||
|
final JPanel bottomButtonRow = new JPanel();
|
||||||
|
bottomButtonRow.setLayout(new FlowLayout());
|
||||||
|
bottomButtonRow.add(addButton);
|
||||||
|
bottomButtonRow.add(jSpinner);
|
||||||
|
bottomButtonRow.add(removeButton);
|
||||||
|
|
||||||
|
rightSide.add(bottomButtonRow, BorderLayout.SOUTH);
|
||||||
|
|
||||||
|
add(rightSide, BorderLayout.EAST);
|
||||||
|
|
||||||
|
pack();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onScriptPreFired(ScriptPreFired event)
|
||||||
|
{
|
||||||
|
ScriptTreeNode newNode = new ScriptTreeNode(event.getScriptId());
|
||||||
|
if (event.getScriptEvent() != null)
|
||||||
|
{
|
||||||
|
newNode.setSource(event.getScriptEvent().getSource());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentNode == null)
|
||||||
|
{
|
||||||
|
currentNode = newNode;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int count = 0;
|
||||||
|
Enumeration children = currentNode.children();
|
||||||
|
if (children != null)
|
||||||
|
{
|
||||||
|
while (children.hasMoreElements())
|
||||||
|
{
|
||||||
|
ScriptTreeNode child = (ScriptTreeNode) children.nextElement();
|
||||||
|
|
||||||
|
if (child.getScriptId() == event.getScriptId())
|
||||||
|
{
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
newNode.setDuplicateNumber(count + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
currentNode.add(newNode);
|
||||||
|
currentNode = newNode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onScriptPostFired(ScriptPostFired event)
|
||||||
|
{
|
||||||
|
if (currentNode == null || currentNode.getScriptId() != event.getScriptId())
|
||||||
|
{
|
||||||
|
log.warn("a script was post-fired that was never pre-fired. Script id: " + event.getScriptId());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentNode.getParent() != null)
|
||||||
|
{
|
||||||
|
currentNode = (ScriptTreeNode) currentNode.getParent();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
addScriptLog(currentNode);
|
||||||
|
currentNode = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void open()
|
||||||
|
{
|
||||||
|
eventBus.register(this);
|
||||||
|
setVisible(true);
|
||||||
|
toFront();
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void close()
|
||||||
|
{
|
||||||
|
configManager.setConfiguration("devtools", "highlights",
|
||||||
|
Text.toCSV(Lists.transform(new ArrayList<>(highlights), String::valueOf)));
|
||||||
|
configManager.setConfiguration("devtools", "blacklist",
|
||||||
|
Text.toCSV(Lists.transform(new ArrayList<>(blacklist), String::valueOf)));
|
||||||
|
currentNode = null;
|
||||||
|
eventBus.unregister(this);
|
||||||
|
setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addScriptLog(ScriptTreeNode treeNode)
|
||||||
|
{
|
||||||
|
if (blacklist.contains(treeNode.getScriptId()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int tick = client.getTickCount();
|
||||||
|
SwingUtilities.invokeLater(() ->
|
||||||
|
{
|
||||||
|
if (tick != lastTick)
|
||||||
|
{
|
||||||
|
lastTick = tick;
|
||||||
|
JLabel header = new JLabel("Tick " + tick);
|
||||||
|
header.setFont(FontManager.getRunescapeSmallFont());
|
||||||
|
header.setBorder(new CompoundBorder(
|
||||||
|
BorderFactory.createMatteBorder(0, 0, 1, 0, ColorScheme.LIGHT_GRAY_COLOR),
|
||||||
|
BorderFactory.createEmptyBorder(3, 6, 0, 0)
|
||||||
|
));
|
||||||
|
tracker.add(header);
|
||||||
|
}
|
||||||
|
DefaultTreeModel treeModel = new DefaultTreeModel(treeNode);
|
||||||
|
JTree tree = new JTree(treeModel);
|
||||||
|
tree.setRootVisible(true);
|
||||||
|
tree.setShowsRootHandles(true);
|
||||||
|
tree.collapsePath(new TreePath(treeNode));
|
||||||
|
|
||||||
|
ScriptTreeNode highlightNode = findHighlightPathNode(treeNode);
|
||||||
|
|
||||||
|
if (highlightNode != null)
|
||||||
|
{
|
||||||
|
tree.setExpandsSelectedPaths(true);
|
||||||
|
tree.setSelectionPath(new TreePath(treeModel.getPathToRoot(highlightNode)));
|
||||||
|
}
|
||||||
|
|
||||||
|
tracker.add(tree);
|
||||||
|
|
||||||
|
// Cull very old stuff
|
||||||
|
while (tracker.getComponentCount() > MAX_LOG_ENTRIES)
|
||||||
|
{
|
||||||
|
tracker.remove(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
tracker.revalidate();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void changeState(ListState state)
|
||||||
|
{
|
||||||
|
this.state = state;
|
||||||
|
refreshList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addToSet(JSpinner spinner)
|
||||||
|
{
|
||||||
|
int script = (Integer) spinner.getValue();
|
||||||
|
Set<Integer> set = getSet();
|
||||||
|
set.add(script);
|
||||||
|
refreshList();
|
||||||
|
spinner.setValue(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeSelectedFromSet()
|
||||||
|
{
|
||||||
|
int index = jList.getSelectedIndex();
|
||||||
|
|
||||||
|
if (index == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int script = (Integer) listModel.get(index);
|
||||||
|
getSet().remove(script);
|
||||||
|
refreshList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshList()
|
||||||
|
{
|
||||||
|
listModel.clear();
|
||||||
|
Set<Integer> set = getSet();
|
||||||
|
|
||||||
|
for (Integer i : set)
|
||||||
|
{
|
||||||
|
listModel.addElement(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Set<Integer> getSet()
|
||||||
|
{
|
||||||
|
Set<Integer> set;
|
||||||
|
|
||||||
|
if (state == ListState.BLACKLIST)
|
||||||
|
{
|
||||||
|
set = blacklist;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
set = highlights;
|
||||||
|
}
|
||||||
|
|
||||||
|
return set;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ScriptTreeNode findHighlightPathNode(ScriptTreeNode node)
|
||||||
|
{
|
||||||
|
if (highlights.contains(node.getScriptId()))
|
||||||
|
{
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
Enumeration children = node.children();
|
||||||
|
if (children != null)
|
||||||
|
{
|
||||||
|
while (children.hasMoreElements())
|
||||||
|
{
|
||||||
|
ScriptTreeNode child = (ScriptTreeNode) children.nextElement();
|
||||||
|
|
||||||
|
ScriptTreeNode find = findHighlightPathNode(child);
|
||||||
|
|
||||||
|
if (find != null)
|
||||||
|
{
|
||||||
|
return find;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
/*
|
||||||
|
* 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.OverlayPanel;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
|
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||||
|
|
||||||
|
class SoundEffectOverlay extends OverlayPanel
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
SoundEffectOverlay(Client client, DevToolsPlugin plugin)
|
||||||
|
{
|
||||||
|
this.client = client;
|
||||||
|
this.plugin = plugin;
|
||||||
|
panelComponent.getChildren().add(LineComponent.builder()
|
||||||
|
.left("Sound Effects")
|
||||||
|
.leftColor(Color.CYAN)
|
||||||
|
.build());
|
||||||
|
setClearChildren(false);
|
||||||
|
setPosition(OverlayPosition.TOP_LEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dimension render(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
if (!plugin.getSoundEffects().isActive())
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.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() +
|
||||||
|
" - S: " + (event.getSource() != null ? event.getSource().getName() : "<none>") +
|
||||||
|
" - 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,377 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Abex
|
||||||
|
* 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 com.google.common.collect.HashMultimap;
|
||||||
|
import com.google.common.collect.Multimap;
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.FlowLayout;
|
||||||
|
import java.awt.event.AdjustmentEvent;
|
||||||
|
import java.awt.event.AdjustmentListener;
|
||||||
|
import java.awt.event.WindowAdapter;
|
||||||
|
import java.awt.event.WindowEvent;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import javax.swing.BorderFactory;
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JCheckBox;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JScrollBar;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
import javax.swing.border.CompoundBorder;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.IndexDataBase;
|
||||||
|
import net.runelite.api.VarClientInt;
|
||||||
|
import net.runelite.api.VarClientStr;
|
||||||
|
import net.runelite.api.VarPlayer;
|
||||||
|
import net.runelite.api.VarbitComposition;
|
||||||
|
import net.runelite.api.Varbits;
|
||||||
|
import net.runelite.api.events.VarClientIntChanged;
|
||||||
|
import net.runelite.api.events.VarClientStrChanged;
|
||||||
|
import net.runelite.api.events.VarbitChanged;
|
||||||
|
import net.runelite.client.callback.ClientThread;
|
||||||
|
import net.runelite.client.eventbus.EventBus;
|
||||||
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
|
import net.runelite.client.ui.ClientUI;
|
||||||
|
import net.runelite.client.ui.ColorScheme;
|
||||||
|
import net.runelite.client.ui.DynamicGridLayout;
|
||||||
|
import net.runelite.client.ui.FontManager;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
class VarInspector extends JFrame
|
||||||
|
{
|
||||||
|
@Getter
|
||||||
|
private enum VarType
|
||||||
|
{
|
||||||
|
VARBIT("Varbit"),
|
||||||
|
VARP("VarPlayer"),
|
||||||
|
VARCINT("VarClientInt"),
|
||||||
|
VARCSTR("VarClientStr");
|
||||||
|
|
||||||
|
private final String name;
|
||||||
|
private final JCheckBox checkBox;
|
||||||
|
|
||||||
|
VarType(String name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
checkBox = new JCheckBox(name, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private final static int MAX_LOG_ENTRIES = 10_000;
|
||||||
|
private static final int VARBITS_ARCHIVE_ID = 14;
|
||||||
|
|
||||||
|
private final Client client;
|
||||||
|
private final ClientThread clientThread;
|
||||||
|
private final EventBus eventBus;
|
||||||
|
|
||||||
|
private final JPanel tracker = new JPanel();
|
||||||
|
|
||||||
|
private int lastTick = 0;
|
||||||
|
|
||||||
|
private int[] oldVarps = null;
|
||||||
|
private int[] oldVarps2 = null;
|
||||||
|
|
||||||
|
private Multimap<Integer, Integer> varbits;
|
||||||
|
private Map<Integer, Object> varcs = null;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
VarInspector(Client client, ClientThread clientThread, EventBus eventBus, DevToolsPlugin plugin)
|
||||||
|
{
|
||||||
|
this.client = client;
|
||||||
|
this.clientThread = clientThread;
|
||||||
|
this.eventBus = eventBus;
|
||||||
|
|
||||||
|
setTitle("RuneLite Var Inspector");
|
||||||
|
setIconImage(ClientUI.ICON);
|
||||||
|
|
||||||
|
setLayout(new BorderLayout());
|
||||||
|
|
||||||
|
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||||
|
addWindowListener(new WindowAdapter()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void windowClosing(WindowEvent e)
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
plugin.getVarInspector().setActive(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
tracker.setLayout(new DynamicGridLayout(0, 1, 0, 3));
|
||||||
|
|
||||||
|
final JPanel trackerWrapper = new JPanel();
|
||||||
|
trackerWrapper.setLayout(new BorderLayout());
|
||||||
|
trackerWrapper.add(tracker, BorderLayout.NORTH);
|
||||||
|
|
||||||
|
final JScrollPane trackerScroller = new JScrollPane(trackerWrapper);
|
||||||
|
trackerScroller.setPreferredSize(new Dimension(400, 400));
|
||||||
|
|
||||||
|
final JScrollBar vertical = trackerScroller.getVerticalScrollBar();
|
||||||
|
vertical.addAdjustmentListener(new AdjustmentListener()
|
||||||
|
{
|
||||||
|
int lastMaximum = actualMax();
|
||||||
|
|
||||||
|
private int actualMax()
|
||||||
|
{
|
||||||
|
return vertical.getMaximum() - vertical.getModel().getExtent();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void adjustmentValueChanged(AdjustmentEvent e)
|
||||||
|
{
|
||||||
|
if (vertical.getValue() >= lastMaximum)
|
||||||
|
{
|
||||||
|
vertical.setValue(actualMax());
|
||||||
|
}
|
||||||
|
lastMaximum = actualMax();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
add(trackerScroller, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
final JPanel trackerOpts = new JPanel();
|
||||||
|
trackerOpts.setLayout(new FlowLayout());
|
||||||
|
for (VarType cb : VarType.values())
|
||||||
|
{
|
||||||
|
trackerOpts.add(cb.getCheckBox());
|
||||||
|
}
|
||||||
|
|
||||||
|
final JButton clearBtn = new JButton("Clear");
|
||||||
|
clearBtn.addActionListener(e ->
|
||||||
|
{
|
||||||
|
tracker.removeAll();
|
||||||
|
tracker.revalidate();
|
||||||
|
});
|
||||||
|
trackerOpts.add(clearBtn);
|
||||||
|
|
||||||
|
add(trackerOpts, BorderLayout.SOUTH);
|
||||||
|
|
||||||
|
pack();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addVarLog(VarType type, String name, int old, int neew)
|
||||||
|
{
|
||||||
|
addVarLog(type, name, Integer.toString(old), Integer.toString(neew));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addVarLog(VarType type, String name, String old, String neew)
|
||||||
|
{
|
||||||
|
if (!type.getCheckBox().isSelected())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int tick = client.getTickCount();
|
||||||
|
SwingUtilities.invokeLater(() ->
|
||||||
|
{
|
||||||
|
if (tick != lastTick)
|
||||||
|
{
|
||||||
|
lastTick = tick;
|
||||||
|
JLabel header = new JLabel("Tick " + tick);
|
||||||
|
header.setFont(FontManager.getRunescapeSmallFont());
|
||||||
|
header.setBorder(new CompoundBorder(
|
||||||
|
BorderFactory.createMatteBorder(0, 0, 1, 0, ColorScheme.LIGHT_GRAY_COLOR),
|
||||||
|
BorderFactory.createEmptyBorder(3, 6, 0, 0)
|
||||||
|
));
|
||||||
|
tracker.add(header);
|
||||||
|
}
|
||||||
|
tracker.add(new JLabel(String.format("%s %s changed: %s -> %s", type.getName(), name, old, neew)));
|
||||||
|
|
||||||
|
// Cull very old stuff
|
||||||
|
while (tracker.getComponentCount() > MAX_LOG_ENTRIES)
|
||||||
|
{
|
||||||
|
tracker.remove(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
tracker.revalidate();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onVarbitChanged(VarbitChanged varbitChanged)
|
||||||
|
{
|
||||||
|
int index = varbitChanged.getIndex();
|
||||||
|
int[] varps = client.getVarps();
|
||||||
|
|
||||||
|
// Check varbits
|
||||||
|
for (int i : varbits.get(index))
|
||||||
|
{
|
||||||
|
int old = client.getVarbitValue(oldVarps, i);
|
||||||
|
int neew = client.getVarbitValue(varps, i);
|
||||||
|
if (old != neew)
|
||||||
|
{
|
||||||
|
// Set the varbit so it doesn't show in the varp changes
|
||||||
|
// However, some varbits share common bits, so we only do it in oldVarps2
|
||||||
|
// Example: 4101 collides with 4104-4129
|
||||||
|
client.setVarbitValue(oldVarps2, i, neew);
|
||||||
|
|
||||||
|
String name = Integer.toString(i);
|
||||||
|
for (Varbits varbit : Varbits.values())
|
||||||
|
{
|
||||||
|
if (varbit.getId() == i)
|
||||||
|
{
|
||||||
|
name = String.format("%s(%d)", varbit.name(), i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
addVarLog(VarType.VARBIT, name, old, neew);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check varps
|
||||||
|
int old = oldVarps2[index];
|
||||||
|
int neew = varps[index];
|
||||||
|
if (old != neew)
|
||||||
|
{
|
||||||
|
String name = Integer.toString(index);
|
||||||
|
for (VarPlayer varp : VarPlayer.values())
|
||||||
|
{
|
||||||
|
if (varp.getId() == index)
|
||||||
|
{
|
||||||
|
name = String.format("%s(%d)", varp.name(), index);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
addVarLog(VarType.VARP, name, old, neew);
|
||||||
|
}
|
||||||
|
|
||||||
|
System.arraycopy(client.getVarps(), 0, oldVarps, 0, oldVarps.length);
|
||||||
|
System.arraycopy(client.getVarps(), 0, oldVarps2, 0, oldVarps2.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onVarClientIntChanged(VarClientIntChanged e)
|
||||||
|
{
|
||||||
|
int idx = e.getIndex();
|
||||||
|
int neew = (Integer) client.getVarcMap().getOrDefault(idx, 0);
|
||||||
|
int old = (Integer) varcs.getOrDefault(idx, 0);
|
||||||
|
varcs.put(idx, neew);
|
||||||
|
|
||||||
|
if (old != neew)
|
||||||
|
{
|
||||||
|
String name = String.format("%d", idx);
|
||||||
|
for (VarClientInt varc : VarClientInt.values())
|
||||||
|
{
|
||||||
|
if (varc.getIndex() == idx)
|
||||||
|
{
|
||||||
|
name = String.format("%s(%d)", varc.name(), idx);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
addVarLog(VarType.VARCINT, name, old, neew);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onVarClientStrChanged(VarClientStrChanged e)
|
||||||
|
{
|
||||||
|
int idx = e.getIndex();
|
||||||
|
String neew = (String) client.getVarcMap().getOrDefault(idx, "");
|
||||||
|
String old = (String) varcs.getOrDefault(idx, "");
|
||||||
|
varcs.put(idx, neew);
|
||||||
|
|
||||||
|
if (!Objects.equals(old, neew))
|
||||||
|
{
|
||||||
|
String name = String.format("%d", idx);
|
||||||
|
for (VarClientStr varc : VarClientStr.values())
|
||||||
|
{
|
||||||
|
if (varc.getIndex() == idx)
|
||||||
|
{
|
||||||
|
name = String.format("%s(%d)", varc.name(), idx);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (old != null)
|
||||||
|
{
|
||||||
|
old = "\"" + old + "\"";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
old = "null";
|
||||||
|
}
|
||||||
|
if (neew != null)
|
||||||
|
{
|
||||||
|
neew = "\"" + neew + "\"";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
neew = "null";
|
||||||
|
}
|
||||||
|
addVarLog(VarType.VARCSTR, name, old, neew);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void open()
|
||||||
|
{
|
||||||
|
if (oldVarps == null)
|
||||||
|
{
|
||||||
|
oldVarps = new int[client.getVarps().length];
|
||||||
|
oldVarps2 = new int[client.getVarps().length];
|
||||||
|
}
|
||||||
|
|
||||||
|
System.arraycopy(client.getVarps(), 0, oldVarps, 0, oldVarps.length);
|
||||||
|
System.arraycopy(client.getVarps(), 0, oldVarps2, 0, oldVarps2.length);
|
||||||
|
varcs = new HashMap<>(client.getVarcMap());
|
||||||
|
varbits = HashMultimap.create();
|
||||||
|
|
||||||
|
clientThread.invoke(() ->
|
||||||
|
{
|
||||||
|
// Build varp index -> varbit id map
|
||||||
|
IndexDataBase indexVarbits = client.getIndexConfig();
|
||||||
|
final int[] varbitIds = indexVarbits.getFileIds(VARBITS_ARCHIVE_ID);
|
||||||
|
for (int id : varbitIds)
|
||||||
|
{
|
||||||
|
VarbitComposition varbit = client.getVarbit(id);
|
||||||
|
if (varbit != null)
|
||||||
|
{
|
||||||
|
varbits.put(varbit.getIndex(), id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
eventBus.register(this);
|
||||||
|
setVisible(true);
|
||||||
|
toFront();
|
||||||
|
repaint();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void close()
|
||||||
|
{
|
||||||
|
tracker.removeAll();
|
||||||
|
eventBus.unregister(this);
|
||||||
|
setVisible(false);
|
||||||
|
varcs = null;
|
||||||
|
varbits = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Abex
|
||||||
|
* 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.util.function.BiConsumer;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.runelite.api.widgets.Widget;
|
||||||
|
import org.slf4j.helpers.MessageFormatter;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class WidgetField<T>
|
||||||
|
{
|
||||||
|
@Getter
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
private final Function<Widget, T> getter;
|
||||||
|
|
||||||
|
private final BiConsumer<Widget, T> setter;
|
||||||
|
|
||||||
|
private final Class<T> type;
|
||||||
|
|
||||||
|
WidgetField(String name, Function<Widget, T> getter)
|
||||||
|
{
|
||||||
|
this(name, getter, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
WidgetField(String name, Function<Widget, T> getter, BiConsumer<Widget, T> setter, Class<T> type)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
this.getter = getter;
|
||||||
|
this.setter = setter;
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object getValue(Widget widget)
|
||||||
|
{
|
||||||
|
Object value = getter.apply(widget);
|
||||||
|
// These types are handled by the JTable automatically
|
||||||
|
if (value instanceof Boolean || value instanceof Number || value instanceof String)
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
if (value instanceof Widget)
|
||||||
|
{
|
||||||
|
return WidgetInspector.getWidgetIdentifier((Widget) value);
|
||||||
|
}
|
||||||
|
return MessageFormatter.format("{}", value).getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setValue(Widget widget, Object inValue)
|
||||||
|
{
|
||||||
|
Object value = null;
|
||||||
|
if ("null".equals(inValue))
|
||||||
|
{
|
||||||
|
value = null;
|
||||||
|
}
|
||||||
|
if (type.isAssignableFrom(inValue.getClass()))
|
||||||
|
{
|
||||||
|
value = inValue;
|
||||||
|
}
|
||||||
|
else if (type == Boolean.class)
|
||||||
|
{
|
||||||
|
value = Boolean.valueOf((String) inValue);
|
||||||
|
}
|
||||||
|
else if (type == Integer.class)
|
||||||
|
{
|
||||||
|
value = Integer.valueOf((String) inValue);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log.warn("Type {} is not supported for editing", type);
|
||||||
|
}
|
||||||
|
setter.accept(widget, (T) value);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isSettable()
|
||||||
|
{
|
||||||
|
return setter != null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,200 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Abex
|
||||||
|
* 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 com.google.common.collect.ImmutableMap;
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
import javax.swing.table.AbstractTableModel;
|
||||||
|
import net.runelite.api.widgets.Widget;
|
||||||
|
import net.runelite.client.callback.ClientThread;
|
||||||
|
|
||||||
|
public class WidgetInfoTableModel extends AbstractTableModel
|
||||||
|
{
|
||||||
|
@Inject
|
||||||
|
private ClientThread clientThread;
|
||||||
|
|
||||||
|
private static final int COL_FIELD = 0;
|
||||||
|
private static final int COL_VALUE = 1;
|
||||||
|
|
||||||
|
private static final List<WidgetField> fields = populateWidgetFields();
|
||||||
|
|
||||||
|
private Widget widget = null;
|
||||||
|
private Map<WidgetField, Object> values = null;
|
||||||
|
|
||||||
|
public void setWidget(Widget w)
|
||||||
|
{
|
||||||
|
clientThread.invoke(() ->
|
||||||
|
{
|
||||||
|
Map<WidgetField, Object> newValues = w == null ? null : fields.stream().collect(ImmutableMap.toImmutableMap(
|
||||||
|
Function.identity(),
|
||||||
|
i -> i.getValue(w)
|
||||||
|
));
|
||||||
|
SwingUtilities.invokeLater(() ->
|
||||||
|
{
|
||||||
|
widget = w;
|
||||||
|
values = newValues;
|
||||||
|
fireTableStructureChanged();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getColumnName(int col)
|
||||||
|
{
|
||||||
|
switch (col)
|
||||||
|
{
|
||||||
|
case COL_FIELD:
|
||||||
|
return "Field";
|
||||||
|
case COL_VALUE:
|
||||||
|
return "Value";
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getColumnCount()
|
||||||
|
{
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRowCount()
|
||||||
|
{
|
||||||
|
if (values == null)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return values.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getValueAt(int rowIndex, int columnIndex)
|
||||||
|
{
|
||||||
|
WidgetField<?> field = fields.get(rowIndex);
|
||||||
|
switch (columnIndex)
|
||||||
|
{
|
||||||
|
case COL_FIELD:
|
||||||
|
return field.getName();
|
||||||
|
case COL_VALUE:
|
||||||
|
return values.get(field);
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCellEditable(int rowIndex, int columnIndex)
|
||||||
|
{
|
||||||
|
if (columnIndex == COL_VALUE)
|
||||||
|
{
|
||||||
|
WidgetField<?> field = fields.get(rowIndex);
|
||||||
|
return field.isSettable();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setValueAt(Object value, int rowIndex, int columnIndex)
|
||||||
|
{
|
||||||
|
WidgetField<?> field = fields.get(rowIndex);
|
||||||
|
clientThread.invoke(() ->
|
||||||
|
{
|
||||||
|
field.setValue(widget, value);
|
||||||
|
setWidget(widget);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<WidgetField> populateWidgetFields()
|
||||||
|
{
|
||||||
|
List<WidgetField> out = new ArrayList<>();
|
||||||
|
|
||||||
|
out.add(new WidgetField<>("Id", Widget::getId));
|
||||||
|
out.add(new WidgetField<>("Type", Widget::getType, Widget::setType, Integer.class));
|
||||||
|
out.add(new WidgetField<>("ContentType", Widget::getContentType, Widget::setContentType, Integer.class));
|
||||||
|
out.add(new WidgetField<>("ParentId", Widget::getParentId));
|
||||||
|
out.add(new WidgetField<>("SelfHidden", Widget::isSelfHidden, Widget::setHidden, Boolean.class));
|
||||||
|
out.add(new WidgetField<>("Hidden", Widget::isHidden));
|
||||||
|
out.add(new WidgetField<>("Text", Widget::getText, Widget::setText, String.class));
|
||||||
|
out.add(new WidgetField<>("TextColor",
|
||||||
|
w -> Integer.toString(w.getTextColor(), 16),
|
||||||
|
(w, str) -> w.setTextColor(Integer.parseInt(str, 16)),
|
||||||
|
String.class
|
||||||
|
));
|
||||||
|
out.add(new WidgetField<>("Opacity", Widget::getOpacity, Widget::setOpacity, Integer.class));
|
||||||
|
out.add(new WidgetField<>("FontId", Widget::getFontId, Widget::setFontId, Integer.class));
|
||||||
|
out.add(new WidgetField<>("TextShadowed", Widget::getTextShadowed, Widget::setTextShadowed, Boolean.class));
|
||||||
|
out.add(new WidgetField<>("Name", w -> w.getName().trim(), Widget::setName, String.class));
|
||||||
|
out.add(new WidgetField<>("ItemId", Widget::getItemId, Widget::setItemId, Integer.class));
|
||||||
|
out.add(new WidgetField<>("ItemQuantity", Widget::getItemQuantity, Widget::setItemQuantity, Integer.class));
|
||||||
|
out.add(new WidgetField<>("ItemQuantityMode", Widget::getItemQuantityMode, Widget::setItemQuantityMode, Integer.class));
|
||||||
|
out.add(new WidgetField<>("ModelId", Widget::getModelId, Widget::setModelId, Integer.class));
|
||||||
|
out.add(new WidgetField<>("ModelType", Widget::getModelType, Widget::setModelType, Integer.class));
|
||||||
|
out.add(new WidgetField<>("AnimationId", Widget::getAnimationId, Widget::setAnimationId, Integer.class));
|
||||||
|
out.add(new WidgetField<>("RotationX", Widget::getRotationX, Widget::setRotationX, Integer.class));
|
||||||
|
out.add(new WidgetField<>("RotationY", Widget::getRotationY, Widget::setRotationY, Integer.class));
|
||||||
|
out.add(new WidgetField<>("RotationZ", Widget::getRotationZ, Widget::setRotationZ, Integer.class));
|
||||||
|
out.add(new WidgetField<>("ModelZoom", Widget::getModelZoom, Widget::setModelZoom, Integer.class));
|
||||||
|
out.add(new WidgetField<>("SpriteId", Widget::getSpriteId, Widget::setSpriteId, Integer.class));
|
||||||
|
out.add(new WidgetField<>("SpriteTiling", Widget::getSpriteTiling, Widget::setSpriteTiling, Boolean.class));
|
||||||
|
out.add(new WidgetField<>("BorderType", Widget::getBorderType, Widget::setBorderType, Integer.class));
|
||||||
|
out.add(new WidgetField<>("IsIf3", Widget::isIf3));
|
||||||
|
out.add(new WidgetField<>("HasListener", Widget::hasListener, Widget::setHasListener, Boolean.class));
|
||||||
|
out.add(new WidgetField<>("Filled", Widget::isFilled, Widget::setFilled, Boolean.class));
|
||||||
|
out.add(new WidgetField<>("OriginalX", Widget::getOriginalX, Widget::setOriginalX, Integer.class));
|
||||||
|
out.add(new WidgetField<>("OriginalY", Widget::getOriginalY, Widget::setOriginalY, Integer.class));
|
||||||
|
out.add(new WidgetField<>("OriginalWidth", Widget::getOriginalWidth, Widget::setOriginalWidth, Integer.class));
|
||||||
|
out.add(new WidgetField<>("OriginalHeight", Widget::getOriginalHeight, Widget::setOriginalHeight, Integer.class));
|
||||||
|
out.add(new WidgetField<>("XPositionMode", Widget::getXPositionMode, Widget::setXPositionMode, Integer.class));
|
||||||
|
out.add(new WidgetField<>("YPositionMode", Widget::getYPositionMode, Widget::setYPositionMode, Integer.class));
|
||||||
|
out.add(new WidgetField<>("WidthMode", Widget::getWidthMode, Widget::setWidthMode, Integer.class));
|
||||||
|
out.add(new WidgetField<>("HeightMode", Widget::getHeightMode, Widget::setHeightMode, Integer.class));
|
||||||
|
out.add(new WidgetField<>("XTextAlignment", Widget::getXTextAlignment, Widget::setXTextAlignment, Integer.class));
|
||||||
|
out.add(new WidgetField<>("YTextAlignment", Widget::getYTextAlignment, Widget::setYTextAlignment, Integer.class));
|
||||||
|
out.add(new WidgetField<>("RelativeX", Widget::getRelativeX, Widget::setRelativeX, Integer.class));
|
||||||
|
out.add(new WidgetField<>("RelativeY", Widget::getRelativeY, Widget::setRelativeY, Integer.class));
|
||||||
|
out.add(new WidgetField<>("Width", Widget::getWidth, Widget::setWidth, Integer.class));
|
||||||
|
out.add(new WidgetField<>("Height", Widget::getHeight, Widget::setHeight, Integer.class));
|
||||||
|
out.add(new WidgetField<>("CanvasLocation", Widget::getCanvasLocation));
|
||||||
|
out.add(new WidgetField<>("Bounds", Widget::getBounds));
|
||||||
|
out.add(new WidgetField<>("ScrollX", Widget::getScrollX, Widget::setScrollX, Integer.class));
|
||||||
|
out.add(new WidgetField<>("ScrollY", Widget::getScrollY, Widget::setScrollY, Integer.class));
|
||||||
|
out.add(new WidgetField<>("ScrollWidth", Widget::getScrollWidth, Widget::setScrollWidth, Integer.class));
|
||||||
|
out.add(new WidgetField<>("ScrollHeight", Widget::getScrollHeight, Widget::setScrollHeight, Integer.class));
|
||||||
|
out.add(new WidgetField<>("DragDeadZone", Widget::getDragDeadZone, Widget::setDragDeadZone, Integer.class));
|
||||||
|
out.add(new WidgetField<>("DragDeadTime", Widget::getDragDeadTime, Widget::setDragDeadTime, Integer.class));
|
||||||
|
out.add(new WidgetField<>("NoClickThrough", Widget::getNoClickThrough, Widget::setNoClickThrough, Boolean.class));
|
||||||
|
out.add(new WidgetField<>("NoScrollThrough", Widget::getNoScrollThrough, Widget::setNoScrollThrough, Boolean.class));
|
||||||
|
out.add(new WidgetField<>("TargetVerb", Widget::getTargetVerb, Widget::setTargetVerb, String.class));
|
||||||
|
out.add(new WidgetField<>("DragParent", Widget::getDragParent));
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,602 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Abex
|
||||||
|
* Copyright (c) 2017, Kronos <https://github.com/KronosDesign>
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* 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 com.google.inject.Inject;
|
||||||
|
import com.google.inject.Provider;
|
||||||
|
import com.google.inject.Singleton;
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.event.WindowAdapter;
|
||||||
|
import java.awt.event.WindowEvent;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Stack;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JCheckBox;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.JSplitPane;
|
||||||
|
import javax.swing.JTable;
|
||||||
|
import javax.swing.JTree;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
import javax.swing.tree.DefaultMutableTreeNode;
|
||||||
|
import javax.swing.tree.DefaultTreeModel;
|
||||||
|
import javax.swing.tree.TreePath;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.MenuAction;
|
||||||
|
import net.runelite.api.MenuEntry;
|
||||||
|
import net.runelite.api.SpriteID;
|
||||||
|
import static net.runelite.api.widgets.WidgetInfo.TO_CHILD;
|
||||||
|
import static net.runelite.api.widgets.WidgetInfo.TO_GROUP;
|
||||||
|
import net.runelite.client.events.ConfigChanged;
|
||||||
|
import net.runelite.api.events.MenuEntryAdded;
|
||||||
|
import net.runelite.api.events.MenuOptionClicked;
|
||||||
|
import net.runelite.api.widgets.JavaScriptCallback;
|
||||||
|
import net.runelite.api.widgets.Widget;
|
||||||
|
import net.runelite.api.widgets.WidgetConfig;
|
||||||
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
|
import net.runelite.api.widgets.WidgetItem;
|
||||||
|
import net.runelite.api.widgets.WidgetType;
|
||||||
|
import net.runelite.client.callback.ClientThread;
|
||||||
|
import net.runelite.client.eventbus.EventBus;
|
||||||
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
|
import net.runelite.client.ui.ClientUI;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
|
import net.runelite.client.util.ColorUtil;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Singleton
|
||||||
|
class WidgetInspector extends JFrame
|
||||||
|
{
|
||||||
|
private static final Map<Integer, WidgetInfo> widgetIdMap = new HashMap<>();
|
||||||
|
|
||||||
|
static final Color SELECTED_WIDGET_COLOR = Color.CYAN;
|
||||||
|
private static final float SELECTED_WIDGET_HUE;
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
float[] hsb = new float[3];
|
||||||
|
Color.RGBtoHSB(SELECTED_WIDGET_COLOR.getRed(), SELECTED_WIDGET_COLOR.getGreen(), SELECTED_WIDGET_COLOR.getBlue(), hsb);
|
||||||
|
SELECTED_WIDGET_HUE = hsb[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Client client;
|
||||||
|
private final ClientThread clientThread;
|
||||||
|
private final DevToolsConfig config;
|
||||||
|
private final Provider<WidgetInspectorOverlay> overlay;
|
||||||
|
private final OverlayManager overlayManager;
|
||||||
|
|
||||||
|
private final JTree widgetTree;
|
||||||
|
private final WidgetInfoTableModel infoTableModel;
|
||||||
|
private final JCheckBox alwaysOnTop;
|
||||||
|
private final JCheckBox hideHidden;
|
||||||
|
|
||||||
|
private DefaultMutableTreeNode root;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private Widget selectedWidget;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private int selectedItem;
|
||||||
|
|
||||||
|
private Widget picker = null;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private boolean pickerSelected = false;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private WidgetInspector(
|
||||||
|
Client client,
|
||||||
|
ClientThread clientThread,
|
||||||
|
WidgetInfoTableModel infoTableModel,
|
||||||
|
DevToolsConfig config,
|
||||||
|
DevToolsPlugin plugin,
|
||||||
|
EventBus eventBus,
|
||||||
|
Provider<WidgetInspectorOverlay> overlay,
|
||||||
|
OverlayManager overlayManager)
|
||||||
|
{
|
||||||
|
this.client = client;
|
||||||
|
this.clientThread = clientThread;
|
||||||
|
this.infoTableModel = infoTableModel;
|
||||||
|
this.config = config;
|
||||||
|
this.overlay = overlay;
|
||||||
|
this.overlayManager = overlayManager;
|
||||||
|
|
||||||
|
eventBus.register(this);
|
||||||
|
|
||||||
|
setTitle("RuneLite Widget Inspector");
|
||||||
|
setIconImage(ClientUI.ICON);
|
||||||
|
|
||||||
|
// Reset highlight on close
|
||||||
|
addWindowListener(new WindowAdapter()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void windowClosing(WindowEvent e)
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
plugin.getWidgetInspector().setActive(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
setLayout(new BorderLayout());
|
||||||
|
|
||||||
|
widgetTree = new JTree(new DefaultMutableTreeNode());
|
||||||
|
widgetTree.setRootVisible(false);
|
||||||
|
widgetTree.setShowsRootHandles(true);
|
||||||
|
widgetTree.getSelectionModel().addTreeSelectionListener(e ->
|
||||||
|
{
|
||||||
|
Object selected = widgetTree.getLastSelectedPathComponent();
|
||||||
|
if (selected instanceof WidgetTreeNode)
|
||||||
|
{
|
||||||
|
WidgetTreeNode node = (WidgetTreeNode) selected;
|
||||||
|
Widget widget = node.getWidget();
|
||||||
|
setSelectedWidget(widget, -1, false);
|
||||||
|
}
|
||||||
|
else if (selected instanceof WidgetItemNode)
|
||||||
|
{
|
||||||
|
WidgetItemNode node = (WidgetItemNode) selected;
|
||||||
|
setSelectedWidget(node.getWidgetItem().getWidget(), node.getWidgetItem().getIndex(), false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
final JScrollPane treeScrollPane = new JScrollPane(widgetTree);
|
||||||
|
treeScrollPane.setPreferredSize(new Dimension(200, 400));
|
||||||
|
|
||||||
|
|
||||||
|
final JTable widgetInfo = new JTable(infoTableModel);
|
||||||
|
|
||||||
|
final JScrollPane infoScrollPane = new JScrollPane(widgetInfo);
|
||||||
|
infoScrollPane.setPreferredSize(new Dimension(400, 400));
|
||||||
|
|
||||||
|
|
||||||
|
final JPanel bottomPanel = new JPanel();
|
||||||
|
add(bottomPanel, BorderLayout.SOUTH);
|
||||||
|
|
||||||
|
final JButton refreshWidgetsBtn = new JButton("Refresh");
|
||||||
|
refreshWidgetsBtn.addActionListener(e -> refreshWidgets());
|
||||||
|
bottomPanel.add(refreshWidgetsBtn);
|
||||||
|
|
||||||
|
alwaysOnTop = new JCheckBox("Always on top");
|
||||||
|
alwaysOnTop.addItemListener(ev -> config.inspectorAlwaysOnTop(alwaysOnTop.isSelected()));
|
||||||
|
onConfigChanged(null);
|
||||||
|
bottomPanel.add(alwaysOnTop);
|
||||||
|
|
||||||
|
hideHidden = new JCheckBox("Hide hidden");
|
||||||
|
hideHidden.setSelected(true);
|
||||||
|
hideHidden.addItemListener(ev -> refreshWidgets());
|
||||||
|
bottomPanel.add(hideHidden);
|
||||||
|
|
||||||
|
final JButton revalidateWidget = new JButton("Revalidate");
|
||||||
|
revalidateWidget.addActionListener(ev -> clientThread.invokeLater(() ->
|
||||||
|
{
|
||||||
|
if (selectedWidget == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
selectedWidget.revalidate();
|
||||||
|
}));
|
||||||
|
bottomPanel.add(revalidateWidget);
|
||||||
|
|
||||||
|
final JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, treeScrollPane, infoScrollPane);
|
||||||
|
add(split, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
pack();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
private void onConfigChanged(ConfigChanged ev)
|
||||||
|
{
|
||||||
|
boolean onTop = config.inspectorAlwaysOnTop();
|
||||||
|
setAlwaysOnTop(onTop);
|
||||||
|
alwaysOnTop.setSelected(onTop);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshWidgets()
|
||||||
|
{
|
||||||
|
clientThread.invokeLater(() ->
|
||||||
|
{
|
||||||
|
Widget[] rootWidgets = client.getWidgetRoots();
|
||||||
|
root = new DefaultMutableTreeNode();
|
||||||
|
|
||||||
|
Widget wasSelectedWidget = selectedWidget;
|
||||||
|
int wasSelectedItem = selectedItem;
|
||||||
|
|
||||||
|
selectedWidget = null;
|
||||||
|
selectedItem = -1;
|
||||||
|
|
||||||
|
for (Widget widget : rootWidgets)
|
||||||
|
{
|
||||||
|
DefaultMutableTreeNode childNode = addWidget("R", widget);
|
||||||
|
if (childNode != null)
|
||||||
|
{
|
||||||
|
root.add(childNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SwingUtilities.invokeLater(() ->
|
||||||
|
{
|
||||||
|
widgetTree.setModel(new DefaultTreeModel(root));
|
||||||
|
setSelectedWidget(wasSelectedWidget, wasSelectedItem, true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private DefaultMutableTreeNode addWidget(String type, Widget widget)
|
||||||
|
{
|
||||||
|
if (widget == null || (hideHidden.isSelected() && widget.isHidden()))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
DefaultMutableTreeNode node = new WidgetTreeNode(type, widget);
|
||||||
|
|
||||||
|
Widget[] childComponents = widget.getDynamicChildren();
|
||||||
|
if (childComponents != null)
|
||||||
|
{
|
||||||
|
for (Widget component : childComponents)
|
||||||
|
{
|
||||||
|
DefaultMutableTreeNode childNode = addWidget("D", component);
|
||||||
|
if (childNode != null)
|
||||||
|
{
|
||||||
|
node.add(childNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
childComponents = widget.getStaticChildren();
|
||||||
|
if (childComponents != null)
|
||||||
|
{
|
||||||
|
for (Widget component : childComponents)
|
||||||
|
{
|
||||||
|
DefaultMutableTreeNode childNode = addWidget("S", component);
|
||||||
|
if (childNode != null)
|
||||||
|
{
|
||||||
|
node.add(childNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
childComponents = widget.getNestedChildren();
|
||||||
|
if (childComponents != null)
|
||||||
|
{
|
||||||
|
for (Widget component : childComponents)
|
||||||
|
{
|
||||||
|
DefaultMutableTreeNode childNode = addWidget("N", component);
|
||||||
|
if (childNode != null)
|
||||||
|
{
|
||||||
|
node.add(childNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Collection<WidgetItem> items = widget.getWidgetItems();
|
||||||
|
if (items != null)
|
||||||
|
{
|
||||||
|
for (WidgetItem item : items)
|
||||||
|
{
|
||||||
|
if (item == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
node.add(new WidgetItemNode(item));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setSelectedWidget(Widget widget, int item, boolean updateTree)
|
||||||
|
{
|
||||||
|
infoTableModel.setWidget(widget);
|
||||||
|
|
||||||
|
if (this.selectedWidget == widget && this.selectedItem == item)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.selectedWidget = widget;
|
||||||
|
this.selectedItem = item;
|
||||||
|
|
||||||
|
if (root == null || !updateTree)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
clientThread.invoke(() ->
|
||||||
|
{
|
||||||
|
Stack<Widget> treePath = new Stack<>();
|
||||||
|
for (Widget w = widget; w != null; w = w.getParent())
|
||||||
|
{
|
||||||
|
treePath.push(w);
|
||||||
|
}
|
||||||
|
|
||||||
|
DefaultMutableTreeNode node = root;
|
||||||
|
deeper:
|
||||||
|
while (!treePath.empty())
|
||||||
|
{
|
||||||
|
Widget w = treePath.pop();
|
||||||
|
for (Enumeration<?> it = node.children(); it.hasMoreElements(); )
|
||||||
|
{
|
||||||
|
WidgetTreeNode inner = (WidgetTreeNode) it.nextElement();
|
||||||
|
if (inner.getWidget().getId() == w.getId() && inner.getWidget().getIndex() == w.getIndex())
|
||||||
|
{
|
||||||
|
node = inner;
|
||||||
|
continue deeper;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (selectedItem != -1)
|
||||||
|
{
|
||||||
|
for (Enumeration<?> it = node.children(); it.hasMoreElements(); )
|
||||||
|
{
|
||||||
|
Object wiw = it.nextElement();
|
||||||
|
if (wiw instanceof WidgetItemNode)
|
||||||
|
{
|
||||||
|
WidgetItemNode inner = (WidgetItemNode) wiw;
|
||||||
|
if (inner.getWidgetItem().getIndex() == selectedItem)
|
||||||
|
{
|
||||||
|
node = inner;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final DefaultMutableTreeNode fnode = node;
|
||||||
|
SwingUtilities.invokeLater(() ->
|
||||||
|
{
|
||||||
|
widgetTree.getSelectionModel().clearSelection();
|
||||||
|
widgetTree.getSelectionModel().addSelectionPath(new TreePath(fnode.getPath()));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
static WidgetInfo getWidgetInfo(int packedId)
|
||||||
|
{
|
||||||
|
if (widgetIdMap.isEmpty())
|
||||||
|
{
|
||||||
|
//Initialize map here so it doesn't create the index
|
||||||
|
//until it's actually needed.
|
||||||
|
WidgetInfo[] widgets = WidgetInfo.values();
|
||||||
|
for (WidgetInfo w : widgets)
|
||||||
|
{
|
||||||
|
widgetIdMap.put(w.getPackedId(), w);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return widgetIdMap.get(packedId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void open()
|
||||||
|
{
|
||||||
|
setVisible(true);
|
||||||
|
toFront();
|
||||||
|
repaint();
|
||||||
|
overlayManager.add(this.overlay.get());
|
||||||
|
clientThread.invokeLater(this::addPickerWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void close()
|
||||||
|
{
|
||||||
|
overlayManager.remove(this.overlay.get());
|
||||||
|
clientThread.invokeLater(this::removePickerWidget);
|
||||||
|
setSelectedWidget(null, -1, false);
|
||||||
|
setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removePickerWidget()
|
||||||
|
{
|
||||||
|
if (picker == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget parent = picker.getParent();
|
||||||
|
if (parent == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget[] children = parent.getChildren();
|
||||||
|
if (children == null || children.length <= picker.getIndex() || children[picker.getIndex()] != picker)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
children[picker.getIndex()] = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addPickerWidget()
|
||||||
|
{
|
||||||
|
removePickerWidget();
|
||||||
|
|
||||||
|
int x = 10, y = 2;
|
||||||
|
Widget parent = client.getWidget(WidgetInfo.MINIMAP_ORBS);
|
||||||
|
if (parent == null)
|
||||||
|
{
|
||||||
|
Widget[] roots = client.getWidgetRoots();
|
||||||
|
|
||||||
|
parent = Stream.of(roots)
|
||||||
|
.filter(w -> w.getType() == WidgetType.LAYER && w.getContentType() == 0 && !w.isSelfHidden())
|
||||||
|
.sorted(Comparator.comparing((Widget w) -> w.getRelativeX() + w.getRelativeY())
|
||||||
|
.reversed()
|
||||||
|
.thenComparing(Widget::getId)
|
||||||
|
.reversed())
|
||||||
|
.findFirst().get();
|
||||||
|
x = 4;
|
||||||
|
y = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
picker = parent.createChild(-1, WidgetType.GRAPHIC);
|
||||||
|
|
||||||
|
log.info("Picker is {}.{} [{}]", WidgetInfo.TO_GROUP(picker.getId()), WidgetInfo.TO_CHILD(picker.getId()), picker.getIndex());
|
||||||
|
|
||||||
|
picker.setSpriteId(SpriteID.MOBILE_FINGER_ON_INTERFACE);
|
||||||
|
picker.setOriginalWidth(15);
|
||||||
|
picker.setOriginalHeight(17);
|
||||||
|
picker.setOriginalX(x);
|
||||||
|
picker.setOriginalY(y);
|
||||||
|
picker.revalidate();
|
||||||
|
picker.setTargetVerb("Select");
|
||||||
|
picker.setName("Pick");
|
||||||
|
picker.setClickMask(WidgetConfig.USE_WIDGET | WidgetConfig.USE_ITEM);
|
||||||
|
picker.setNoClickThrough(true);
|
||||||
|
picker.setOnTargetEnterListener((JavaScriptCallback) ev ->
|
||||||
|
{
|
||||||
|
pickerSelected = true;
|
||||||
|
picker.setOpacity(30);
|
||||||
|
client.setAllWidgetsAreOpTargetable(true);
|
||||||
|
});
|
||||||
|
picker.setOnTargetLeaveListener((JavaScriptCallback) ev -> onPickerDeselect());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onPickerDeselect()
|
||||||
|
{
|
||||||
|
client.setAllWidgetsAreOpTargetable(false);
|
||||||
|
picker.setOpacity(0);
|
||||||
|
pickerSelected = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
private void onMenuOptionClicked(MenuOptionClicked ev)
|
||||||
|
{
|
||||||
|
if (!pickerSelected)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
onPickerDeselect();
|
||||||
|
client.setSpellSelected(false);
|
||||||
|
ev.consume();
|
||||||
|
|
||||||
|
Object target = getWidgetOrWidgetItemForMenuOption(ev.getMenuAction().getId(), ev.getActionParam(), ev.getWidgetId());
|
||||||
|
if (target == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (target instanceof WidgetItem)
|
||||||
|
{
|
||||||
|
WidgetItem iw = (WidgetItem) target;
|
||||||
|
setSelectedWidget(iw.getWidget(), iw.getIndex(), true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setSelectedWidget((Widget) target, -1, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
private void onMenuEntryAdded(MenuEntryAdded event)
|
||||||
|
{
|
||||||
|
if (!pickerSelected)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuEntry[] menuEntries = client.getMenuEntries();
|
||||||
|
|
||||||
|
for (int i = 0; i < menuEntries.length; i++)
|
||||||
|
{
|
||||||
|
MenuEntry entry = menuEntries[i];
|
||||||
|
if (entry.getType() != MenuAction.ITEM_USE_ON_WIDGET.getId()
|
||||||
|
&& entry.getType() != MenuAction.SPELL_CAST_ON_WIDGET.getId())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String name = WidgetInfo.TO_GROUP(entry.getParam1()) + "." + WidgetInfo.TO_CHILD(entry.getParam1());
|
||||||
|
|
||||||
|
if (entry.getParam0() != -1)
|
||||||
|
{
|
||||||
|
name += " [" + entry.getParam0() + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
Color color = colorForWidget(i, menuEntries.length);
|
||||||
|
|
||||||
|
entry.setTarget(ColorUtil.wrapWithColorTag(name, color));
|
||||||
|
}
|
||||||
|
|
||||||
|
client.setMenuEntries(menuEntries);
|
||||||
|
}
|
||||||
|
|
||||||
|
Color colorForWidget(int index, int length)
|
||||||
|
{
|
||||||
|
float h = SELECTED_WIDGET_HUE + .1f + (.8f / length) * index;
|
||||||
|
|
||||||
|
return Color.getHSBColor(h, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Object getWidgetOrWidgetItemForMenuOption(int type, int param0, int param1)
|
||||||
|
{
|
||||||
|
if (type == MenuAction.SPELL_CAST_ON_WIDGET.getId())
|
||||||
|
{
|
||||||
|
Widget w = client.getWidget(param1);
|
||||||
|
if (param0 != -1)
|
||||||
|
{
|
||||||
|
w = w.getChild(param0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
else if (type == MenuAction.ITEM_USE_ON_WIDGET.getId())
|
||||||
|
{
|
||||||
|
Widget w = client.getWidget(param1);
|
||||||
|
return w.getWidgetItem(param0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getWidgetIdentifier(Widget widget)
|
||||||
|
{
|
||||||
|
int id = widget.getId();
|
||||||
|
String str = TO_GROUP(id) + "." + TO_CHILD(id);
|
||||||
|
|
||||||
|
if (widget.getIndex() != -1)
|
||||||
|
{
|
||||||
|
str += "[" + widget.getIndex() + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
WidgetInfo info = WidgetInspector.getWidgetInfo(id);
|
||||||
|
if (info != null)
|
||||||
|
{
|
||||||
|
str += " " + info.name();
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Abex
|
||||||
|
* Copyright (c) 2017, Kronos <https://github.com/KronosDesign>
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* 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.FontMetrics;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.MenuEntry;
|
||||||
|
import net.runelite.api.widgets.Widget;
|
||||||
|
import net.runelite.api.widgets.WidgetItem;
|
||||||
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||||
|
|
||||||
|
@Singleton
|
||||||
|
public class WidgetInspectorOverlay extends Overlay
|
||||||
|
{
|
||||||
|
private final Client client;
|
||||||
|
private final WidgetInspector inspector;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public WidgetInspectorOverlay(
|
||||||
|
Client client,
|
||||||
|
WidgetInspector inspector
|
||||||
|
)
|
||||||
|
{
|
||||||
|
this.client = client;
|
||||||
|
this.inspector = inspector;
|
||||||
|
|
||||||
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
|
setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||||
|
setPriority(OverlayPriority.HIGHEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dimension render(Graphics2D g)
|
||||||
|
{
|
||||||
|
Widget w = inspector.getSelectedWidget();
|
||||||
|
if (w != null)
|
||||||
|
{
|
||||||
|
Object wiw = w;
|
||||||
|
if (inspector.getSelectedItem() != -1)
|
||||||
|
{
|
||||||
|
wiw = w.getWidgetItem(inspector.getSelectedItem());
|
||||||
|
}
|
||||||
|
|
||||||
|
renderWiw(g, wiw, WidgetInspector.SELECTED_WIDGET_COLOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inspector.isPickerSelected())
|
||||||
|
{
|
||||||
|
boolean menuOpen = client.isMenuOpen();
|
||||||
|
|
||||||
|
MenuEntry[] entries = client.getMenuEntries();
|
||||||
|
for (int i = menuOpen ? 0 : entries.length - 1; i < entries.length; i++)
|
||||||
|
{
|
||||||
|
MenuEntry e = entries[i];
|
||||||
|
|
||||||
|
Object wiw = inspector.getWidgetOrWidgetItemForMenuOption(e.getType(), e.getParam0(), e.getParam1());
|
||||||
|
if (wiw == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Color color = inspector.colorForWidget(i, entries.length);
|
||||||
|
renderWiw(g, wiw, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderWiw(Graphics2D g, Object wiw, Color color)
|
||||||
|
{
|
||||||
|
g.setColor(color);
|
||||||
|
|
||||||
|
if (wiw instanceof WidgetItem)
|
||||||
|
{
|
||||||
|
WidgetItem wi = (WidgetItem) wiw;
|
||||||
|
Rectangle bounds = wi.getCanvasBounds();
|
||||||
|
g.draw(bounds);
|
||||||
|
|
||||||
|
String text = wi.getId() + "";
|
||||||
|
FontMetrics fm = g.getFontMetrics();
|
||||||
|
Rectangle2D textBounds = fm.getStringBounds(text, g);
|
||||||
|
|
||||||
|
int textX = (int) (bounds.getX() + (bounds.getWidth() / 2) - (textBounds.getWidth() / 2));
|
||||||
|
int textY = (int) (bounds.getY() + (bounds.getHeight() / 2) + (textBounds.getHeight() / 2));
|
||||||
|
|
||||||
|
g.setColor(Color.BLACK);
|
||||||
|
g.drawString(text, textX + 1, textY + 1);
|
||||||
|
g.setColor(Color.ORANGE);
|
||||||
|
g.drawString(text, textX, textY);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Widget w = (Widget) wiw;
|
||||||
|
g.draw(w.getBounds());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* 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 javax.swing.tree.DefaultMutableTreeNode;
|
||||||
|
import net.runelite.api.widgets.WidgetItem;
|
||||||
|
|
||||||
|
class WidgetItemNode extends DefaultMutableTreeNode
|
||||||
|
{
|
||||||
|
private final WidgetItem widgetItem;
|
||||||
|
|
||||||
|
public WidgetItemNode(WidgetItem widgetItem)
|
||||||
|
{
|
||||||
|
super(widgetItem);
|
||||||
|
this.widgetItem = widgetItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WidgetItem getWidgetItem()
|
||||||
|
{
|
||||||
|
return widgetItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return "I " + widgetItem.getIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* 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 javax.swing.tree.DefaultMutableTreeNode;
|
||||||
|
import net.runelite.api.widgets.Widget;
|
||||||
|
|
||||||
|
class WidgetTreeNode extends DefaultMutableTreeNode
|
||||||
|
{
|
||||||
|
private final String type;
|
||||||
|
|
||||||
|
public WidgetTreeNode(String type, Widget widget)
|
||||||
|
{
|
||||||
|
super(widget);
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Widget getWidget()
|
||||||
|
{
|
||||||
|
return (Widget) getUserObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return type + " " + WidgetInspector.getWidgetIdentifier(getWidget());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Morgan Lewis <https://github.com/MESLewis>
|
||||||
|
* 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.FontMetrics;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.Point;
|
||||||
|
import net.runelite.api.RenderOverview;
|
||||||
|
import net.runelite.api.coords.WorldPoint;
|
||||||
|
import net.runelite.api.widgets.Widget;
|
||||||
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||||
|
import net.runelite.client.ui.overlay.worldmap.WorldMapOverlay;
|
||||||
|
|
||||||
|
public class WorldMapLocationOverlay extends Overlay
|
||||||
|
{
|
||||||
|
private final Client client;
|
||||||
|
private final WorldMapOverlay worldMapOverlay;
|
||||||
|
private final DevToolsPlugin plugin;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private WorldMapLocationOverlay(Client client, WorldMapOverlay worldMapOverlay, DevToolsPlugin plugin)
|
||||||
|
{
|
||||||
|
this.client = client;
|
||||||
|
this.worldMapOverlay = worldMapOverlay;
|
||||||
|
this.plugin = plugin;
|
||||||
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
|
setPriority(OverlayPriority.HIGHEST);
|
||||||
|
setLayer(OverlayLayer.ABOVE_MAP);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dimension render(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
if (!plugin.getWorldMapLocation().isActive())
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
RenderOverview ro = client.getRenderOverview();
|
||||||
|
Widget worldMapWidget = client.getWidget(WidgetInfo.WORLD_MAP_VIEW);
|
||||||
|
|
||||||
|
if (ro == null || worldMapWidget == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle worldMapRectangle = worldMapWidget.getBounds();
|
||||||
|
|
||||||
|
graphics.setClip(worldMapRectangle);
|
||||||
|
graphics.setColor(Color.CYAN);
|
||||||
|
|
||||||
|
WorldPoint mapCenterPoint = new WorldPoint(ro.getWorldMapPosition().getX(), ro.getWorldMapPosition().getY(), 0);
|
||||||
|
Point middle = worldMapOverlay.mapWorldPointToGraphicsPoint(mapCenterPoint);
|
||||||
|
|
||||||
|
if (middle == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
graphics.drawLine(middle.getX(), worldMapRectangle.y, middle.getX(), worldMapRectangle.y + worldMapRectangle.height);
|
||||||
|
graphics.drawLine(worldMapRectangle.x, middle.getY(), worldMapRectangle.x + worldMapRectangle.width, middle.getY());
|
||||||
|
|
||||||
|
String output = "Center: " + mapCenterPoint.getX() + ", " + mapCenterPoint.getY();
|
||||||
|
graphics.setColor(Color.white);
|
||||||
|
FontMetrics fm = graphics.getFontMetrics();
|
||||||
|
int height = fm.getHeight();
|
||||||
|
int width = fm.stringWidth(output);
|
||||||
|
graphics.fillRect((int)worldMapRectangle.getX(), (int)worldMapRectangle.getY() + worldMapRectangle.height - height, (int)worldMapRectangle.getX() + width, (int)worldMapRectangle.getY() + worldMapRectangle.height);
|
||||||
|
|
||||||
|
graphics.setColor(Color.BLACK);
|
||||||
|
graphics.drawString(output, (int) worldMapRectangle.getX(), (int) worldMapRectangle.getY() + worldMapRectangle.height);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,131 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Alex Kolpa <https://github.com/AlexKolpa>
|
||||||
|
* 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.FontMetrics;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.Point;
|
||||||
|
import net.runelite.api.RenderOverview;
|
||||||
|
import net.runelite.api.widgets.Widget;
|
||||||
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||||
|
|
||||||
|
class WorldMapRegionOverlay extends Overlay
|
||||||
|
{
|
||||||
|
private static final Color WHITE_TRANSLUCENT = new Color(255, 255, 255, 127);
|
||||||
|
private static final int LABEL_PADDING = 4;
|
||||||
|
private static final int REGION_SIZE = 1 << 6;
|
||||||
|
// Bitmask to return first coordinate in region
|
||||||
|
private static final int REGION_TRUNCATE = ~((1 << 6) - 1);
|
||||||
|
private final Client client;
|
||||||
|
private final DevToolsPlugin plugin;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private WorldMapRegionOverlay(Client client, DevToolsPlugin plugin)
|
||||||
|
{
|
||||||
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
|
setPriority(OverlayPriority.HIGH);
|
||||||
|
setLayer(OverlayLayer.ABOVE_MAP);
|
||||||
|
this.client = client;
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dimension render(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
if (!plugin.getWorldMapLocation().isActive())
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
drawRegionOverlay(graphics);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawRegionOverlay(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
RenderOverview ro = client.getRenderOverview();
|
||||||
|
Widget map = client.getWidget(WidgetInfo.WORLD_MAP_VIEW);
|
||||||
|
Float pixelsPerTile = ro.getWorldMapZoom();
|
||||||
|
|
||||||
|
if (map == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle worldMapRect = map.getBounds();
|
||||||
|
graphics.setClip(worldMapRect);
|
||||||
|
|
||||||
|
int widthInTiles = (int) Math.ceil(worldMapRect.getWidth() / pixelsPerTile);
|
||||||
|
int heightInTiles = (int) Math.ceil(worldMapRect.getHeight() / pixelsPerTile);
|
||||||
|
|
||||||
|
Point worldMapPosition = ro.getWorldMapPosition();
|
||||||
|
|
||||||
|
// Offset in tiles from anchor sides
|
||||||
|
int yTileMin = worldMapPosition.getY() - heightInTiles / 2;
|
||||||
|
int xRegionMin = (worldMapPosition.getX() - widthInTiles / 2) & REGION_TRUNCATE;
|
||||||
|
int xRegionMax = ((worldMapPosition.getX() + widthInTiles / 2) & REGION_TRUNCATE) + REGION_SIZE;
|
||||||
|
int yRegionMin = (yTileMin & REGION_TRUNCATE);
|
||||||
|
int yRegionMax = ((worldMapPosition.getY() + heightInTiles / 2) & REGION_TRUNCATE) + REGION_SIZE;
|
||||||
|
int regionPixelSize = (int) Math.ceil(REGION_SIZE * pixelsPerTile);
|
||||||
|
|
||||||
|
for (int x = xRegionMin; x < xRegionMax; x += REGION_SIZE)
|
||||||
|
{
|
||||||
|
for (int y = yRegionMin; y < yRegionMax; y += REGION_SIZE)
|
||||||
|
{
|
||||||
|
graphics.setColor(WHITE_TRANSLUCENT);
|
||||||
|
|
||||||
|
int yTileOffset = -(yTileMin - y);
|
||||||
|
int xTileOffset = x + widthInTiles / 2 - worldMapPosition.getX();
|
||||||
|
|
||||||
|
int xPos = ((int) (xTileOffset * pixelsPerTile)) + (int) worldMapRect.getX();
|
||||||
|
int yPos = (worldMapRect.height - (int) (yTileOffset * pixelsPerTile)) + (int) worldMapRect.getY();
|
||||||
|
// Offset y-position by a single region to correct for drawRect starting from the top
|
||||||
|
yPos -= regionPixelSize;
|
||||||
|
|
||||||
|
graphics.drawRect(xPos, yPos, regionPixelSize, regionPixelSize);
|
||||||
|
|
||||||
|
int regionId = ((x >> 6) << 8) | (y >> 6);
|
||||||
|
String regionText = String.valueOf(regionId);
|
||||||
|
FontMetrics fm = graphics.getFontMetrics();
|
||||||
|
Rectangle2D textBounds = fm.getStringBounds(regionText, graphics);
|
||||||
|
int labelWidth = (int) textBounds.getWidth() + 2 * LABEL_PADDING;
|
||||||
|
int labelHeight = (int) textBounds.getHeight() + 2 * LABEL_PADDING;
|
||||||
|
graphics.fillRect(xPos, yPos, labelWidth, labelHeight);
|
||||||
|
graphics.setColor(Color.BLACK);
|
||||||
|
graphics.drawString(regionText, xPos + LABEL_PADDING, yPos + (int) textBounds.getHeight() + LABEL_PADDING);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,10 +5,10 @@ import net.runelite.api.Renderable;
|
|||||||
import net.runelite.api.Model;
|
import net.runelite.api.Model;
|
||||||
import net.runelite.api.mixins.Inject;
|
import net.runelite.api.mixins.Inject;
|
||||||
import net.runelite.api.mixins.Mixin;
|
import net.runelite.api.mixins.Mixin;
|
||||||
import net.runelite.rs.api.RSTileItemPile;
|
import net.runelite.rs.api.RSItemLayer;
|
||||||
|
|
||||||
@Mixin(RSTileItemPile.class)
|
@Mixin(RSItemLayer.class)
|
||||||
public abstract class RSTileItemPileMixin implements RSTileItemPile
|
public abstract class RSItemLayerMixin implements RSItemLayer
|
||||||
{
|
{
|
||||||
@Inject
|
@Inject
|
||||||
private int itemLayerPlane;
|
private int itemLayerPlane;
|
||||||
@@ -134,7 +134,7 @@ public abstract class RSNPCMixin implements RSNPC
|
|||||||
// without having to change method calls
|
// without having to change method calls
|
||||||
setActionFrame(Integer.MIN_VALUE | getActionFrameCycle() << 16 | actionFrame);
|
setActionFrame(Integer.MIN_VALUE | getActionFrameCycle() << 16 | actionFrame);
|
||||||
setPoseFrame(Integer.MIN_VALUE | getPoseFrameCycle() << 16 | poseFrame);
|
setPoseFrame(Integer.MIN_VALUE | getPoseFrameCycle() << 16 | poseFrame);
|
||||||
setSpotAnimationFrame(Integer.MIN_VALUE | getSpotAnimationFrameCycle() << 16 | spotAnimFrame);
|
setSpotAnimFrame(Integer.MIN_VALUE | getSpotAnimationFrameCycle() << 16 | spotAnimFrame);
|
||||||
return copy$getModel();
|
return copy$getModel();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
@@ -142,7 +142,7 @@ public abstract class RSNPCMixin implements RSNPC
|
|||||||
// reset frames
|
// reset frames
|
||||||
setActionFrame(actionFrame);
|
setActionFrame(actionFrame);
|
||||||
setPoseFrame(poseFrame);
|
setPoseFrame(poseFrame);
|
||||||
setSpotAnimationFrame(spotAnimFrame);
|
setSpotAnimFrame(spotAnimFrame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ package net.runelite.mixins;
|
|||||||
import net.runelite.api.kit.KitType;
|
import net.runelite.api.kit.KitType;
|
||||||
import net.runelite.api.mixins.Inject;
|
import net.runelite.api.mixins.Inject;
|
||||||
import net.runelite.api.mixins.Mixin;
|
import net.runelite.api.mixins.Mixin;
|
||||||
import net.runelite.rs.api.RSPlayerAppearance;
|
import net.runelite.rs.api.RSPlayerComposition;
|
||||||
|
|
||||||
@Mixin(RSPlayerAppearance.class)
|
@Mixin(RSPlayerComposition.class)
|
||||||
public abstract class RSPlayerAppearanceMixin implements RSPlayerAppearance
|
public abstract class RSPlayerCompositionMixin implements RSPlayerComposition
|
||||||
{
|
{
|
||||||
@Inject
|
@Inject
|
||||||
@Override
|
@Override
|
||||||
@@ -263,7 +263,7 @@ public abstract class RSPlayerMixin implements RSPlayer
|
|||||||
// without having to change method calls
|
// without having to change method calls
|
||||||
setActionFrame(Integer.MIN_VALUE | getActionFrameCycle() << 16 | actionFrame);
|
setActionFrame(Integer.MIN_VALUE | getActionFrameCycle() << 16 | actionFrame);
|
||||||
setPoseFrame(Integer.MIN_VALUE | getPoseFrameCycle() << 16 | poseFrame);
|
setPoseFrame(Integer.MIN_VALUE | getPoseFrameCycle() << 16 | poseFrame);
|
||||||
setSpotAnimationFrame(Integer.MIN_VALUE | getSpotAnimationFrameCycle() << 16 | spotAnimFrame);
|
setSpotAnimFrame(Integer.MIN_VALUE | getSpotAnimationFrameCycle() << 16 | spotAnimFrame);
|
||||||
return copy$getModel();
|
return copy$getModel();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
@@ -271,7 +271,7 @@ public abstract class RSPlayerMixin implements RSPlayer
|
|||||||
// reset frames
|
// reset frames
|
||||||
setActionFrame(actionFrame);
|
setActionFrame(actionFrame);
|
||||||
setPoseFrame(poseFrame);
|
setPoseFrame(poseFrame);
|
||||||
setSpotAnimationFrame(spotAnimFrame);
|
setSpotAnimFrame(spotAnimFrame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,11 +293,11 @@ public abstract class RSPlayerMixin implements RSPlayer
|
|||||||
@SuppressWarnings("InfiniteRecursion")
|
@SuppressWarnings("InfiniteRecursion")
|
||||||
public void copy$read(RSBuffer buffer)
|
public void copy$read(RSBuffer buffer)
|
||||||
{
|
{
|
||||||
final long appearanceHash = getPlayerAppearance() == null ? 0 : getPlayerAppearance().getHash();
|
final long appearanceHash = getPlayerComposition() == null ? 0 : getPlayerComposition().getHash();
|
||||||
|
|
||||||
this.copy$read(buffer);
|
this.copy$read(buffer);
|
||||||
|
|
||||||
if (client.isComparingAppearance() && getPlayerAppearance().getHash() != appearanceHash)
|
if (client.isComparingAppearance() && getPlayerComposition().getHash() != appearanceHash)
|
||||||
{
|
{
|
||||||
client.getCallbacks().post(new PlayerChanged(this));
|
client.getCallbacks().post(new PlayerChanged(this));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ import net.runelite.rs.api.RSNodeDeque;
|
|||||||
import net.runelite.rs.api.RSScene;
|
import net.runelite.rs.api.RSScene;
|
||||||
import net.runelite.rs.api.RSTile;
|
import net.runelite.rs.api.RSTile;
|
||||||
import net.runelite.rs.api.RSTileItem;
|
import net.runelite.rs.api.RSTileItem;
|
||||||
import net.runelite.rs.api.RSTileItemPile;
|
import net.runelite.rs.api.RSItemLayer;
|
||||||
import net.runelite.rs.api.RSSceneTileModel;
|
import net.runelite.rs.api.RSSceneTileModel;
|
||||||
import net.runelite.rs.api.RSWallDecoration;
|
import net.runelite.rs.api.RSWallDecoration;
|
||||||
|
|
||||||
@@ -435,7 +435,7 @@ public abstract class RSSceneMixin implements RSScene
|
|||||||
Tile tile = getTiles()[plane][x][y];
|
Tile tile = getTiles()[plane][x][y];
|
||||||
if (tile != null)
|
if (tile != null)
|
||||||
{
|
{
|
||||||
RSTileItemPile itemLayer = (RSTileItemPile) tile.getItemLayer();
|
RSItemLayer itemLayer = (RSItemLayer) tile.getItemLayer();
|
||||||
if (itemLayer != null)
|
if (itemLayer != null)
|
||||||
{
|
{
|
||||||
itemLayer.setPlane(plane);
|
itemLayer.setPlane(plane);
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import net.runelite.api.Constants;
|
|||||||
import net.runelite.api.DecorativeObject;
|
import net.runelite.api.DecorativeObject;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
import net.runelite.api.GroundObject;
|
import net.runelite.api.GroundObject;
|
||||||
import net.runelite.api.TileItemPile;
|
import net.runelite.api.ItemLayer;
|
||||||
import net.runelite.api.Node;
|
import net.runelite.api.Node;
|
||||||
import net.runelite.api.Point;
|
import net.runelite.api.Point;
|
||||||
import net.runelite.api.Tile;
|
import net.runelite.api.Tile;
|
||||||
@@ -64,7 +64,7 @@ import net.runelite.rs.api.RSClient;
|
|||||||
import net.runelite.rs.api.RSRenderable;
|
import net.runelite.rs.api.RSRenderable;
|
||||||
import net.runelite.rs.api.RSGameObject;
|
import net.runelite.rs.api.RSGameObject;
|
||||||
import net.runelite.rs.api.RSGraphicsObject;
|
import net.runelite.rs.api.RSGraphicsObject;
|
||||||
import net.runelite.rs.api.RSTileItemPile;
|
import net.runelite.rs.api.RSItemLayer;
|
||||||
import net.runelite.rs.api.RSNode;
|
import net.runelite.rs.api.RSNode;
|
||||||
import net.runelite.rs.api.RSNodeDeque;
|
import net.runelite.rs.api.RSNodeDeque;
|
||||||
import net.runelite.rs.api.RSProjectile;
|
import net.runelite.rs.api.RSProjectile;
|
||||||
@@ -237,7 +237,7 @@ public abstract class RSTileMixin implements RSTile
|
|||||||
@Override
|
@Override
|
||||||
public List<TileItem> getGroundItems()
|
public List<TileItem> getGroundItems()
|
||||||
{
|
{
|
||||||
TileItemPile layer = this.getItemLayer();
|
ItemLayer layer = this.getItemLayer();
|
||||||
if (layer == null)
|
if (layer == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@@ -459,7 +459,7 @@ public abstract class RSTileMixin implements RSTile
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@FieldHook("tileItemPile")
|
@FieldHook("itemLayer")
|
||||||
@Inject
|
@Inject
|
||||||
public void itemLayerChanged(int idx)
|
public void itemLayerChanged(int idx)
|
||||||
{
|
{
|
||||||
@@ -500,7 +500,7 @@ public abstract class RSTileMixin implements RSTile
|
|||||||
client.setLastItemDespawn(null);
|
client.setLastItemDespawn(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
RSTileItemPile itemLayer = (RSTileItemPile) getItemLayer();
|
RSItemLayer itemLayer = (RSItemLayer) getItemLayer();
|
||||||
if (itemLayer == null)
|
if (itemLayer == null)
|
||||||
{
|
{
|
||||||
if (lastUnlink != null)
|
if (lastUnlink != null)
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ import net.runelite.rs.api.RSBoundaryObject;
|
|||||||
import net.runelite.rs.api.RSClient;
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSFloorDecoration;
|
import net.runelite.rs.api.RSFloorDecoration;
|
||||||
import net.runelite.rs.api.RSGameObject;
|
import net.runelite.rs.api.RSGameObject;
|
||||||
import net.runelite.rs.api.RSTileItemPile;
|
import net.runelite.rs.api.RSItemLayer;
|
||||||
import net.runelite.rs.api.RSWallDecoration;
|
import net.runelite.rs.api.RSWallDecoration;
|
||||||
|
|
||||||
@Mixins({
|
@Mixins({
|
||||||
@Mixin(RSWallDecoration.class),
|
@Mixin(RSWallDecoration.class),
|
||||||
@Mixin(RSGameObject.class),
|
@Mixin(RSGameObject.class),
|
||||||
@Mixin(RSFloorDecoration.class),
|
@Mixin(RSFloorDecoration.class),
|
||||||
@Mixin(RSTileItemPile.class),
|
@Mixin(RSItemLayer.class),
|
||||||
@Mixin(RSBoundaryObject.class)
|
@Mixin(RSBoundaryObject.class)
|
||||||
})
|
})
|
||||||
public abstract class RSTileObjectMixin implements TileObject
|
public abstract class RSTileObjectMixin implements TileObject
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ import net.runelite.rs.api.RSClient;
|
|||||||
import net.runelite.rs.api.RSModel;
|
import net.runelite.rs.api.RSModel;
|
||||||
import net.runelite.rs.api.RSNode;
|
import net.runelite.rs.api.RSNode;
|
||||||
import net.runelite.rs.api.RSNodeHashTable;
|
import net.runelite.rs.api.RSNodeHashTable;
|
||||||
import net.runelite.rs.api.RSPlayerAppearance;
|
import net.runelite.rs.api.RSPlayerComposition;
|
||||||
import net.runelite.rs.api.RSSequenceDefinition;
|
import net.runelite.rs.api.RSSequenceDefinition;
|
||||||
import net.runelite.rs.api.RSWidget;
|
import net.runelite.rs.api.RSWidget;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
@@ -592,7 +592,7 @@ public abstract class RSWidgetMixin implements RSWidget
|
|||||||
@Copy("getModel")
|
@Copy("getModel")
|
||||||
@Replace("getModel")
|
@Replace("getModel")
|
||||||
@SuppressWarnings("InfiniteRecursion")
|
@SuppressWarnings("InfiniteRecursion")
|
||||||
public RSModel copy$getModel(RSSequenceDefinition sequence, int frame, boolean alternate, RSPlayerAppearance playerComposition)
|
public RSModel copy$getModel(RSSequenceDefinition sequence, int frame, boolean alternate, RSPlayerComposition playerComposition)
|
||||||
{
|
{
|
||||||
if (frame != -1 && client.isInterpolateWidgetAnimations())
|
if (frame != -1 && client.isInterpolateWidgetAnimations())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import net.runelite.api.mixins.Inject;
|
|||||||
import net.runelite.api.mixins.Mixin;
|
import net.runelite.api.mixins.Mixin;
|
||||||
import net.runelite.api.mixins.Shadow;
|
import net.runelite.api.mixins.Shadow;
|
||||||
import net.runelite.rs.api.RSClient;
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSVarbitDefinition;
|
import net.runelite.rs.api.RSVarbitComposition;
|
||||||
|
|
||||||
@Mixin(RSClient.class)
|
@Mixin(RSClient.class)
|
||||||
public abstract class VarbitMixin implements RSClient
|
public abstract class VarbitMixin implements RSClient
|
||||||
@@ -21,7 +21,7 @@ public abstract class VarbitMixin implements RSClient
|
|||||||
private static RSClient client;
|
private static RSClient client;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private Cache<Integer, RSVarbitDefinition> varbitCache = CacheBuilder.newBuilder()
|
private Cache<Integer, RSVarbitComposition> varbitCache = CacheBuilder.newBuilder()
|
||||||
.maximumSize(128)
|
.maximumSize(128)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -55,17 +55,17 @@ public abstract class VarbitMixin implements RSClient
|
|||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Override
|
@Override
|
||||||
public RSVarbitDefinition getVarbitDefinition(int id)
|
public RSVarbitComposition getVarbitDefinition(int id)
|
||||||
{
|
{
|
||||||
assert isClientThread();
|
assert isClientThread();
|
||||||
|
|
||||||
RSVarbitDefinition varbit;
|
RSVarbitComposition varbit;
|
||||||
varbit = varbitCache.getIfPresent(id);
|
varbit = varbitCache.getIfPresent(id);
|
||||||
if (varbit != null)
|
if (varbit != null)
|
||||||
{
|
{
|
||||||
return varbit;
|
return varbit;
|
||||||
}
|
}
|
||||||
varbit = (RSVarbitDefinition) getVarbitCache().get(id);
|
varbit = (RSVarbitComposition) getVarbitCache().get(id);
|
||||||
if (varbit != null && !(varbit.getIndex() == 0 && varbit.getMostSignificantBit() == 0 && varbit.getLeastSignificantBit() == 0))
|
if (varbit != null && !(varbit.getIndex() == 0 && varbit.getMostSignificantBit() == 0 && varbit.getLeastSignificantBit() == 0))
|
||||||
{
|
{
|
||||||
return varbit;
|
return varbit;
|
||||||
@@ -87,7 +87,7 @@ public abstract class VarbitMixin implements RSClient
|
|||||||
{
|
{
|
||||||
assert client.isClientThread();
|
assert client.isClientThread();
|
||||||
|
|
||||||
RSVarbitDefinition v = getVarbitDefinition(varbitId);
|
RSVarbitComposition v = getVarbitDefinition(varbitId);
|
||||||
if (v == null)
|
if (v == null)
|
||||||
{
|
{
|
||||||
throw new IndexOutOfBoundsException(String.format("Varbit %d does not exist!", varbitId)); // oob for "backwards compatibility lol"
|
throw new IndexOutOfBoundsException(String.format("Varbit %d does not exist!", varbitId)); // oob for "backwards compatibility lol"
|
||||||
@@ -104,7 +104,7 @@ public abstract class VarbitMixin implements RSClient
|
|||||||
@Override
|
@Override
|
||||||
public void setVarbitValue(int[] varps, int varbitId, int value)
|
public void setVarbitValue(int[] varps, int varbitId, int value)
|
||||||
{
|
{
|
||||||
RSVarbitDefinition v = getVarbitDefinition(varbitId);
|
RSVarbitComposition v = getVarbitDefinition(varbitId);
|
||||||
if (v == null)
|
if (v == null)
|
||||||
{
|
{
|
||||||
throw new IndexOutOfBoundsException(String.format("Varbit %d does not exist!", varbitId)); // oob for "backwards compatibility lol"
|
throw new IndexOutOfBoundsException(String.format("Varbit %d does not exist!", varbitId)); // oob for "backwards compatibility lol"
|
||||||
|
|||||||
@@ -84,18 +84,18 @@ public interface RSActor extends RSRenderable, Actor
|
|||||||
|
|
||||||
@Import("spotAnimation")
|
@Import("spotAnimation")
|
||||||
@Override
|
@Override
|
||||||
int getSpotAnimation();
|
int getGraphic();
|
||||||
|
|
||||||
@Import("spotAnimation")
|
@Import("spotAnimation")
|
||||||
@Override
|
@Override
|
||||||
void setSpotAnimation(int id);
|
void setGraphic(int id);
|
||||||
|
|
||||||
@Import("spotAnimationFrame")
|
@Import("spotAnimationFrame")
|
||||||
int getSpotAnimationFrame();
|
int getSpotAnimationFrame();
|
||||||
|
|
||||||
@Import("spotAnimationFrame")
|
@Import("spotAnimationFrame")
|
||||||
@Override
|
@Override
|
||||||
void setSpotAnimationFrame(int id);
|
void setSpotAnimFrame(int id);
|
||||||
|
|
||||||
@Import("spotAnimationFrameCycle")
|
@Import("spotAnimationFrameCycle")
|
||||||
int getSpotAnimationFrameCycle();
|
int getSpotAnimationFrameCycle();
|
||||||
|
|||||||
@@ -1274,7 +1274,7 @@ public interface RSClient extends RSGameShell, Client
|
|||||||
RSBuffer newBuffer(byte[] bytes);
|
RSBuffer newBuffer(byte[] bytes);
|
||||||
|
|
||||||
@Construct
|
@Construct
|
||||||
RSVarbitDefinition newVarbitDefinition();
|
RSVarbitComposition newVarbitDefinition();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Import("followerIndex")
|
@Import("followerIndex")
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package net.runelite.rs.api;
|
package net.runelite.rs.api;
|
||||||
|
|
||||||
import net.runelite.api.TileItemPile;
|
import net.runelite.api.ItemLayer;
|
||||||
import net.runelite.mapping.Import;
|
import net.runelite.mapping.Import;
|
||||||
|
|
||||||
public interface RSTileItemPile extends TileItemPile
|
public interface RSItemLayer extends ItemLayer
|
||||||
{
|
{
|
||||||
@Import("x")
|
@Import("x")
|
||||||
int getX();
|
int getX();
|
||||||
@@ -37,7 +37,7 @@ public interface RSPlayer extends RSActor, Player
|
|||||||
|
|
||||||
@Import("appearance")
|
@Import("appearance")
|
||||||
@Override
|
@Override
|
||||||
RSPlayerAppearance getPlayerAppearance();
|
RSPlayerComposition getPlayerComposition();
|
||||||
|
|
||||||
@Import("combatLevel")
|
@Import("combatLevel")
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package net.runelite.rs.api;
|
package net.runelite.rs.api;
|
||||||
|
|
||||||
import net.runelite.api.PlayerAppearance;
|
import net.runelite.api.PlayerComposition;
|
||||||
import net.runelite.mapping.Import;
|
import net.runelite.mapping.Import;
|
||||||
|
|
||||||
public interface RSPlayerAppearance extends PlayerAppearance
|
public interface RSPlayerComposition extends PlayerComposition
|
||||||
{
|
{
|
||||||
@Import("isFemale")
|
@Import("isFemale")
|
||||||
boolean isFemale();
|
boolean isFemale();
|
||||||
@@ -3,7 +3,7 @@ package net.runelite.rs.api;
|
|||||||
import net.runelite.api.DecorativeObject;
|
import net.runelite.api.DecorativeObject;
|
||||||
import net.runelite.api.GameObject;
|
import net.runelite.api.GameObject;
|
||||||
import net.runelite.api.GroundObject;
|
import net.runelite.api.GroundObject;
|
||||||
import net.runelite.api.TileItemPile;
|
import net.runelite.api.ItemLayer;
|
||||||
import net.runelite.api.SceneTileModel;
|
import net.runelite.api.SceneTileModel;
|
||||||
import net.runelite.api.SceneTilePaint;
|
import net.runelite.api.SceneTilePaint;
|
||||||
import net.runelite.api.Tile;
|
import net.runelite.api.Tile;
|
||||||
@@ -16,9 +16,9 @@ public interface RSTile extends Tile
|
|||||||
@Override
|
@Override
|
||||||
GameObject[] getGameObjects();
|
GameObject[] getGameObjects();
|
||||||
|
|
||||||
@Import("tileItemPile")
|
@Import("itemLayer")
|
||||||
@Override
|
@Override
|
||||||
TileItemPile getItemLayer();
|
ItemLayer getItemLayer();
|
||||||
|
|
||||||
@Import("wallDecoration")
|
@Import("wallDecoration")
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package net.runelite.rs.api;
|
package net.runelite.rs.api;
|
||||||
|
|
||||||
import net.runelite.api.VarbitDefinition;
|
import net.runelite.api.VarbitComposition;
|
||||||
import net.runelite.mapping.Import;
|
import net.runelite.mapping.Import;
|
||||||
|
|
||||||
public interface RSVarbitDefinition extends VarbitDefinition, RSDualNode
|
public interface RSVarbitComposition extends VarbitComposition, RSDualNode
|
||||||
{
|
{
|
||||||
@Import("baseVar")
|
@Import("baseVar")
|
||||||
int getIndex();
|
int getIndex();
|
||||||
@@ -183,7 +183,7 @@ public class ApproximateRouteStrategy extends RouteStrategy {
|
|||||||
return 1; // L: 2120
|
return 1; // L: 2120
|
||||||
} else if (var0 == ScriptOpcodes.CLAN_ISSELF) {
|
} else if (var0 == ScriptOpcodes.CLAN_ISSELF) {
|
||||||
var3 = Interpreter.Interpreter_intStack[--VarcInt.Interpreter_intStackSize]; // L: 2123
|
var3 = Interpreter.Interpreter_intStack[--VarcInt.Interpreter_intStackSize]; // L: 2123
|
||||||
if (WorldMapArea.clanChat != null && var3 < WorldMapArea.clanChat.getSize() && WorldMapArea.clanChat.get(var3).getUsername().equals(PlayerAppearance.localPlayer.username)) { // L: 2124
|
if (WorldMapArea.clanChat != null && var3 < WorldMapArea.clanChat.getSize() && WorldMapArea.clanChat.get(var3).getUsername().equals(PlayerComposition.localPlayer.username)) { // L: 2124
|
||||||
Interpreter.Interpreter_intStack[++VarcInt.Interpreter_intStackSize - 1] = 1; // L: 2125
|
Interpreter.Interpreter_intStack[++VarcInt.Interpreter_intStackSize - 1] = 1; // L: 2125
|
||||||
} else {
|
} else {
|
||||||
Interpreter.Interpreter_intStack[++VarcInt.Interpreter_intStackSize - 1] = 0; // L: 2127
|
Interpreter.Interpreter_intStack[++VarcInt.Interpreter_intStackSize - 1] = 0; // L: 2127
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public class ArchiveDiskActionHandler implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception var13) { // L: 114
|
} catch (Exception var13) { // L: 114
|
||||||
PlayerAppearance.RunException_sendStackTrace((String)null, var13); // L: 115
|
PlayerComposition.RunException_sendStackTrace((String)null, var13); // L: 115
|
||||||
}
|
}
|
||||||
} // L: 117
|
} // L: 117
|
||||||
|
|
||||||
|
|||||||
@@ -394,7 +394,7 @@ public enum AttackOption implements Enumerated {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var24.append("").append(var7); // L: 376
|
var24.append("").append(var7); // L: 376
|
||||||
PlayerAppearance.RunException_sendStackTrace(var24.toString(), var27); // L: 377
|
PlayerComposition.RunException_sendStackTrace(var24.toString(), var27); // L: 377
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (Interpreter.field1104) { // L: 381
|
if (Interpreter.field1104) { // L: 381
|
||||||
@@ -438,7 +438,7 @@ public enum AttackOption implements Enumerated {
|
|||||||
garbageValue = "1150447373"
|
garbageValue = "1150447373"
|
||||||
)
|
)
|
||||||
static void method2138() {
|
static void method2138() {
|
||||||
if (PlayerAppearance.localPlayer.x >> 7 == Client.destinationX && PlayerAppearance.localPlayer.y >> 7 == Client.destinationY) { // L: 4702
|
if (PlayerComposition.localPlayer.x >> 7 == Client.destinationX && PlayerComposition.localPlayer.y >> 7 == Client.destinationY) { // L: 4702
|
||||||
Client.destinationX = 0; // L: 4703
|
Client.destinationX = 0; // L: 4703
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public final class BZip2Decompressor {
|
|||||||
int var3 = var0.su_rNToGo; // L: 41
|
int var3 = var0.su_rNToGo; // L: 41
|
||||||
int var4 = var0.nblocks_used; // L: 42
|
int var4 = var0.nblocks_used; // L: 42
|
||||||
int var5 = var0.su_ch2; // L: 43
|
int var5 = var0.su_ch2; // L: 43
|
||||||
int[] var6 = TileItemPile.BZip2Decompressor_block; // L: 44
|
int[] var6 = ItemLayer.BZip2Decompressor_block; // L: 44
|
||||||
int var7 = var0.field3779; // L: 45
|
int var7 = var0.field3779; // L: 45
|
||||||
byte[] var8 = var0.outputArray; // L: 46
|
byte[] var8 = var0.outputArray; // L: 46
|
||||||
int var9 = var0.next_out; // L: 47
|
int var9 = var0.next_out; // L: 47
|
||||||
@@ -157,7 +157,7 @@ public final class BZip2Decompressor {
|
|||||||
var0.su_rNToGo = var3; // L: 137
|
var0.su_rNToGo = var3; // L: 137
|
||||||
var0.nblocks_used = var4; // L: 138
|
var0.nblocks_used = var4; // L: 138
|
||||||
var0.su_ch2 = var5; // L: 139
|
var0.su_ch2 = var5; // L: 139
|
||||||
TileItemPile.BZip2Decompressor_block = var6; // L: 140
|
ItemLayer.BZip2Decompressor_block = var6; // L: 140
|
||||||
var0.field3779 = var7; // L: 141
|
var0.field3779 = var7; // L: 141
|
||||||
var0.outputArray = var8; // L: 142
|
var0.outputArray = var8; // L: 142
|
||||||
var0.next_out = var9; // L: 143
|
var0.next_out = var9; // L: 143
|
||||||
@@ -193,8 +193,8 @@ public final class BZip2Decompressor {
|
|||||||
int[] var24 = null; // L: 171
|
int[] var24 = null; // L: 171
|
||||||
int[] var25 = null; // L: 172
|
int[] var25 = null; // L: 172
|
||||||
var0.blockSize100k = -1205153797; // L: 173
|
var0.blockSize100k = -1205153797; // L: 173
|
||||||
if (TileItemPile.BZip2Decompressor_block == null) { // L: 174
|
if (ItemLayer.BZip2Decompressor_block == null) { // L: 174
|
||||||
TileItemPile.BZip2Decompressor_block = new int[var0.blockSize100k * 1124970976];
|
ItemLayer.BZip2Decompressor_block = new int[var0.blockSize100k * 1124970976];
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean var26 = true; // L: 175
|
boolean var26 = true; // L: 175
|
||||||
@@ -430,7 +430,7 @@ public final class BZip2Decompressor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var10002 = var0.unzftab[var0.seqToUnseq[var1 & 255] & 255]++; // L: 396
|
var10002 = var0.unzftab[var0.seqToUnseq[var1 & 255] & 255]++; // L: 396
|
||||||
TileItemPile.BZip2Decompressor_block[var47] = var0.seqToUnseq[var1 & 255] & 255; // L: 397
|
ItemLayer.BZip2Decompressor_block[var47] = var0.seqToUnseq[var1 & 255] & 255; // L: 397
|
||||||
++var47; // L: 398
|
++var47; // L: 398
|
||||||
if (var45 == 0) { // L: 399
|
if (var45 == 0) { // L: 399
|
||||||
++var43; // L: 400
|
++var43; // L: 400
|
||||||
@@ -489,7 +489,7 @@ public final class BZip2Decompressor {
|
|||||||
var10000 = var0.unzftab; // L: 332
|
var10000 = var0.unzftab; // L: 332
|
||||||
|
|
||||||
for (var10000[var1 & 255] += var48; var48 > 0; --var48) { // L: 333 336
|
for (var10000[var1 & 255] += var48; var48 > 0; --var48) { // L: 333 336
|
||||||
TileItemPile.BZip2Decompressor_block[var47] = var1 & 255; // L: 334
|
ItemLayer.BZip2Decompressor_block[var47] = var1 & 255; // L: 334
|
||||||
++var47; // L: 335
|
++var47; // L: 335
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -509,16 +509,16 @@ public final class BZip2Decompressor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (var36 = 0; var36 < var47; ++var36) { // L: 426
|
for (var36 = 0; var36 < var47; ++var36) { // L: 426
|
||||||
var1 = (byte)(TileItemPile.BZip2Decompressor_block[var36] & 255); // L: 427
|
var1 = (byte)(ItemLayer.BZip2Decompressor_block[var36] & 255); // L: 427
|
||||||
var10000 = TileItemPile.BZip2Decompressor_block; // L: 428
|
var10000 = ItemLayer.BZip2Decompressor_block; // L: 428
|
||||||
int var10001 = var0.cftab[var1 & 255];
|
int var10001 = var0.cftab[var1 & 255];
|
||||||
var10000[var10001] |= var36 << 8;
|
var10000[var10001] |= var36 << 8;
|
||||||
var10002 = var0.cftab[var1 & 255]++; // L: 429
|
var10002 = var0.cftab[var1 & 255]++; // L: 429
|
||||||
}
|
}
|
||||||
|
|
||||||
var0.field3779 = TileItemPile.BZip2Decompressor_block[var0.originalPointer] >> 8; // L: 431
|
var0.field3779 = ItemLayer.BZip2Decompressor_block[var0.originalPointer] >> 8; // L: 431
|
||||||
var0.nblocks_used = 0; // L: 432
|
var0.nblocks_used = 0; // L: 432
|
||||||
var0.field3779 = TileItemPile.BZip2Decompressor_block[var0.field3779]; // L: 433
|
var0.field3779 = ItemLayer.BZip2Decompressor_block[var0.field3779]; // L: 433
|
||||||
var0.su_ch2 = (byte)(var0.field3779 & 255); // L: 434
|
var0.su_ch2 = (byte)(var0.field3779 & 255); // L: 434
|
||||||
var0.field3779 >>= 8; // L: 436
|
var0.field3779 >>= 8; // L: 436
|
||||||
++var0.nblocks_used; // L: 437
|
++var0.nblocks_used; // L: 437
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ public final class Canvas extends java.awt.Canvas {
|
|||||||
FriendLoginUpdate.pcmPlayer1 = UserComparator6.method3526(GameShell.taskHandler, 1, 2048); // L: 1829
|
FriendLoginUpdate.pcmPlayer1 = UserComparator6.method3526(GameShell.taskHandler, 1, 2048); // L: 1829
|
||||||
WorldMapManager.pcmStreamMixer = new PcmStreamMixer(); // L: 1830
|
WorldMapManager.pcmStreamMixer = new PcmStreamMixer(); // L: 1830
|
||||||
FriendLoginUpdate.pcmPlayer1.setStream(WorldMapManager.pcmStreamMixer); // L: 1831
|
FriendLoginUpdate.pcmPlayer1.setStream(WorldMapManager.pcmStreamMixer); // L: 1831
|
||||||
TileItemPile.decimator = new Decimator(22050, PcmPlayer.field1443); // L: 1832
|
ItemLayer.decimator = new Decimator(22050, PcmPlayer.field1443); // L: 1832
|
||||||
Login.Login_loadingText = "Prepared sound engine"; // L: 1833
|
Login.Login_loadingText = "Prepared sound engine"; // L: 1833
|
||||||
Login.Login_loadingPercent = 35; // L: 1834
|
Login.Login_loadingPercent = 35; // L: 1834
|
||||||
Client.titleLoadingStage = 50; // L: 1835
|
Client.titleLoadingStage = 50; // L: 1835
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ public final class Client extends GameShell implements Usernamed {
|
|||||||
descriptor = "Lhh;"
|
descriptor = "Lhh;"
|
||||||
)
|
)
|
||||||
@Export("playerAppearance")
|
@Export("playerAppearance")
|
||||||
static PlayerAppearance playerAppearance;
|
static PlayerComposition playerComposition;
|
||||||
@ObfuscatedName("sk")
|
@ObfuscatedName("sk")
|
||||||
@ObfuscatedGetter(
|
@ObfuscatedGetter(
|
||||||
intValue = -1302699221
|
intValue = -1302699221
|
||||||
@@ -1544,7 +1544,7 @@ public final class Client extends GameShell implements Usernamed {
|
|||||||
viewportWidth = 0; // L: 626
|
viewportWidth = 0; // L: 626
|
||||||
viewportHeight = 0; // L: 627
|
viewportHeight = 0; // L: 627
|
||||||
viewportZoom = 0; // L: 628
|
viewportZoom = 0; // L: 628
|
||||||
playerAppearance = new PlayerAppearance(); // L: 630
|
playerComposition = new PlayerComposition(); // L: 630
|
||||||
field813 = -1; // L: 631
|
field813 = -1; // L: 631
|
||||||
field911 = -1; // L: 632
|
field911 = -1; // L: 632
|
||||||
platformInfoProvider = new DesktopPlatformInfoProvider(); // L: 634
|
platformInfoProvider = new DesktopPlatformInfoProvider(); // L: 634
|
||||||
@@ -1600,9 +1600,9 @@ public final class Client extends GameShell implements Usernamed {
|
|||||||
class278.port1 = gameBuild == 0 ? 43594 : worldId + 40000; // L: 870
|
class278.port1 = gameBuild == 0 ? 43594 : worldId + 40000; // L: 870
|
||||||
Players.port2 = gameBuild == 0 ? 443 : worldId + 50000; // L: 871
|
Players.port2 = gameBuild == 0 ? 443 : worldId + 50000; // L: 871
|
||||||
ArchiveDiskAction.port3 = class278.port1; // L: 872
|
ArchiveDiskAction.port3 = class278.port1; // L: 872
|
||||||
PlayerAppearance.field2551 = class224.field2569; // L: 873
|
PlayerComposition.field2551 = class224.field2569; // L: 873
|
||||||
WorldMapScaleHandler.field366 = class224.field2565; // L: 874
|
WorldMapScaleHandler.field366 = class224.field2565; // L: 874
|
||||||
PlayerAppearance.field2557 = class224.field2566; // L: 875
|
PlayerComposition.field2557 = class224.field2566; // L: 875
|
||||||
WorldMapCacheName.field331 = class224.field2567; // L: 876
|
WorldMapCacheName.field331 = class224.field2567; // L: 876
|
||||||
GrandExchangeOfferAgeComparator.urlRequester = new UrlRequester(); // L: 877
|
GrandExchangeOfferAgeComparator.urlRequester = new UrlRequester(); // L: 877
|
||||||
this.setUpKeyboard(); // L: 878
|
this.setUpKeyboard(); // L: 878
|
||||||
@@ -2064,7 +2064,7 @@ public final class Client extends GameShell implements Usernamed {
|
|||||||
GrandExchangeOfferWorldComparator.field52 = null; // L: 1238
|
GrandExchangeOfferWorldComparator.field52 = null; // L: 1238
|
||||||
Tiles.field511 = null; // L: 1239
|
Tiles.field511 = null; // L: 1239
|
||||||
class92.field1173 = null; // L: 1240
|
class92.field1173 = null; // L: 1240
|
||||||
VarbitDefinition.Tiles_hue = null; // L: 1241
|
VarbitComposition.Tiles_hue = null; // L: 1241
|
||||||
ArchiveDiskActionHandler.Tiles_saturation = null; // L: 1242
|
ArchiveDiskActionHandler.Tiles_saturation = null; // L: 1242
|
||||||
class92.Tiles_lightness = null; // L: 1243
|
class92.Tiles_lightness = null; // L: 1243
|
||||||
UserComparator7.Tiles_hueMultiplier = null; // L: 1244
|
UserComparator7.Tiles_hueMultiplier = null; // L: 1244
|
||||||
@@ -2222,7 +2222,7 @@ public final class Client extends GameShell implements Usernamed {
|
|||||||
JagexCache.JagexCache_dat2File.close(); // L: 1335
|
JagexCache.JagexCache_dat2File.close(); // L: 1335
|
||||||
|
|
||||||
for (int var4 = 0; var4 < MusicPatchPcmStream.idxCount; ++var4) { // L: 1336
|
for (int var4 = 0; var4 < MusicPatchPcmStream.idxCount; ++var4) { // L: 1336
|
||||||
PlayerAppearance.JagexCache_idxFiles[var4].close();
|
PlayerComposition.JagexCache_idxFiles[var4].close();
|
||||||
}
|
}
|
||||||
|
|
||||||
JagexCache.JagexCache_idx255File.close(); // L: 1337
|
JagexCache.JagexCache_idx255File.close(); // L: 1337
|
||||||
@@ -2325,33 +2325,33 @@ public final class Client extends GameShell implements Usernamed {
|
|||||||
ObjectSound.field1077 = WorldMapScaleHandler.field365.toLowerCase(); // L: 770
|
ObjectSound.field1077 = WorldMapScaleHandler.field365.toLowerCase(); // L: 770
|
||||||
|
|
||||||
try {
|
try {
|
||||||
TileItemPile.userHomeDirectory = System.getProperty("user.home"); // L: 772
|
ItemLayer.userHomeDirectory = System.getProperty("user.home"); // L: 772
|
||||||
if (TileItemPile.userHomeDirectory != null) { // L: 773
|
if (ItemLayer.userHomeDirectory != null) { // L: 773
|
||||||
TileItemPile.userHomeDirectory = TileItemPile.userHomeDirectory + "/";
|
ItemLayer.userHomeDirectory = ItemLayer.userHomeDirectory + "/";
|
||||||
}
|
}
|
||||||
} catch (Exception var17) { // L: 775
|
} catch (Exception var17) { // L: 775
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (ObjectSound.field1077.startsWith("win")) { // L: 777
|
if (ObjectSound.field1077.startsWith("win")) { // L: 777
|
||||||
if (TileItemPile.userHomeDirectory == null) { // L: 778
|
if (ItemLayer.userHomeDirectory == null) { // L: 778
|
||||||
TileItemPile.userHomeDirectory = System.getenv("USERPROFILE");
|
ItemLayer.userHomeDirectory = System.getenv("USERPROFILE");
|
||||||
}
|
}
|
||||||
} else if (TileItemPile.userHomeDirectory == null) { // L: 781
|
} else if (ItemLayer.userHomeDirectory == null) { // L: 781
|
||||||
TileItemPile.userHomeDirectory = System.getenv("HOME");
|
ItemLayer.userHomeDirectory = System.getenv("HOME");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TileItemPile.userHomeDirectory != null) { // L: 783
|
if (ItemLayer.userHomeDirectory != null) { // L: 783
|
||||||
TileItemPile.userHomeDirectory = TileItemPile.userHomeDirectory + "/";
|
ItemLayer.userHomeDirectory = ItemLayer.userHomeDirectory + "/";
|
||||||
}
|
}
|
||||||
} catch (Exception var16) { // L: 785
|
} catch (Exception var16) { // L: 785
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TileItemPile.userHomeDirectory == null) { // L: 786
|
if (ItemLayer.userHomeDirectory == null) { // L: 786
|
||||||
TileItemPile.userHomeDirectory = "~/";
|
ItemLayer.userHomeDirectory = "~/";
|
||||||
}
|
}
|
||||||
|
|
||||||
GraphicsObject.field1117 = new String[]{"c:/rscache/", "/rscache/", "c:/windows/", "c:/winnt/", "c:/", TileItemPile.userHomeDirectory, "/tmp/", ""}; // L: 787
|
GraphicsObject.field1117 = new String[]{"c:/rscache/", "/rscache/", "c:/windows/", "c:/winnt/", "c:/", ItemLayer.userHomeDirectory, "/tmp/", ""}; // L: 787
|
||||||
DynamicObject.field1318 = new String[]{".jagex_cache_" + JagexCache.cacheGamebuild, ".file_store_" + JagexCache.cacheGamebuild}; // L: 788
|
DynamicObject.field1318 = new String[]{".jagex_cache_" + JagexCache.cacheGamebuild, ".file_store_" + JagexCache.cacheGamebuild}; // L: 788
|
||||||
|
|
||||||
label144:
|
label144:
|
||||||
@@ -2407,13 +2407,13 @@ public final class Client extends GameShell implements Usernamed {
|
|||||||
WorldMapData_0.method237(); // L: 828
|
WorldMapData_0.method237(); // L: 828
|
||||||
JagexCache.JagexCache_dat2File = new BufferedFile(new AccessFile(ModelData0.getFile("main_file_cache.dat2"), "rw", 1048576000L), 5200, 0); // L: 829
|
JagexCache.JagexCache_dat2File = new BufferedFile(new AccessFile(ModelData0.getFile("main_file_cache.dat2"), "rw", 1048576000L), 5200, 0); // L: 829
|
||||||
JagexCache.JagexCache_idx255File = new BufferedFile(new AccessFile(ModelData0.getFile("main_file_cache.idx255"), "rw", 1048576L), 6000, 0); // L: 830
|
JagexCache.JagexCache_idx255File = new BufferedFile(new AccessFile(ModelData0.getFile("main_file_cache.idx255"), "rw", 1048576L), 6000, 0); // L: 830
|
||||||
PlayerAppearance.JagexCache_idxFiles = new BufferedFile[MusicPatchPcmStream.idxCount]; // L: 831
|
PlayerComposition.JagexCache_idxFiles = new BufferedFile[MusicPatchPcmStream.idxCount]; // L: 831
|
||||||
|
|
||||||
for (int var14 = 0; var14 < MusicPatchPcmStream.idxCount; ++var14) { // L: 832
|
for (int var14 = 0; var14 < MusicPatchPcmStream.idxCount; ++var14) { // L: 832
|
||||||
PlayerAppearance.JagexCache_idxFiles[var14] = new BufferedFile(new AccessFile(ModelData0.getFile("main_file_cache.idx" + var14), "rw", 1048576L), 6000, 0); // L: 833
|
PlayerComposition.JagexCache_idxFiles[var14] = new BufferedFile(new AccessFile(ModelData0.getFile("main_file_cache.idx" + var14), "rw", 1048576L), 6000, 0); // L: 833
|
||||||
}
|
}
|
||||||
} catch (Exception var19) { // L: 837
|
} catch (Exception var19) { // L: 837
|
||||||
PlayerAppearance.RunException_sendStackTrace((String)null, var19); // L: 838
|
PlayerComposition.RunException_sendStackTrace((String)null, var19); // L: 838
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldMapIcon_0.client = this; // L: 840
|
WorldMapIcon_0.client = this; // L: 840
|
||||||
@@ -3641,16 +3641,16 @@ public final class Client extends GameShell implements Usernamed {
|
|||||||
|
|
||||||
boolean var31 = staffModLevel >= 2; // L: 3235
|
boolean var31 = staffModLevel >= 2; // L: 3235
|
||||||
if (var31 && KeyHandler.KeyHandler_pressedKeys[82] && KeyHandler.KeyHandler_pressedKeys[81] && mouseWheelRotation != 0) { // L: 3237
|
if (var31 && KeyHandler.KeyHandler_pressedKeys[82] && KeyHandler.KeyHandler_pressedKeys[81] && mouseWheelRotation != 0) { // L: 3237
|
||||||
var4 = PlayerAppearance.localPlayer.plane - mouseWheelRotation; // L: 3238
|
var4 = PlayerComposition.localPlayer.plane - mouseWheelRotation; // L: 3238
|
||||||
if (var4 < 0) { // L: 3239
|
if (var4 < 0) { // L: 3239
|
||||||
var4 = 0;
|
var4 = 0;
|
||||||
} else if (var4 > 3) { // L: 3240
|
} else if (var4 > 3) { // L: 3240
|
||||||
var4 = 3;
|
var4 = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (var4 != PlayerAppearance.localPlayer.plane) { // L: 3241
|
if (var4 != PlayerComposition.localPlayer.plane) { // L: 3241
|
||||||
var5 = PlayerAppearance.localPlayer.pathX[0] + NetFileRequest.baseX; // L: 3242
|
var5 = PlayerComposition.localPlayer.pathX[0] + NetFileRequest.baseX; // L: 3242
|
||||||
var6 = PlayerAppearance.localPlayer.pathY[0] + class41.baseY; // L: 3243
|
var6 = PlayerComposition.localPlayer.pathY[0] + class41.baseY; // L: 3243
|
||||||
PacketBufferNode var27 = ItemContainer.getPacketBufferNode(ClientPacket.field2269, packetWriter.isaacCipher); // L: 3246
|
PacketBufferNode var27 = ItemContainer.getPacketBufferNode(ClientPacket.field2269, packetWriter.isaacCipher); // L: 3246
|
||||||
var27.packetBuffer.method5578(var5); // L: 3247
|
var27.packetBuffer.method5578(var5); // L: 3247
|
||||||
var27.packetBuffer.method5587(0); // L: 3248
|
var27.packetBuffer.method5587(0); // L: 3248
|
||||||
@@ -3685,7 +3685,7 @@ public final class Client extends GameShell implements Usernamed {
|
|||||||
if (var41 == null) { // L: 3284
|
if (var41 == null) { // L: 3284
|
||||||
this.menu(); // L: 3294
|
this.menu(); // L: 3294
|
||||||
if (WorldMapRectangle.worldMap != null) { // L: 3296
|
if (WorldMapRectangle.worldMap != null) { // L: 3296
|
||||||
WorldMapRectangle.worldMap.method6370(GameObject.Client_plane, (PlayerAppearance.localPlayer.x >> 7) + NetFileRequest.baseX, (PlayerAppearance.localPlayer.y >> 7) + class41.baseY, false); // L: 3297
|
WorldMapRectangle.worldMap.method6370(GameObject.Client_plane, (PlayerComposition.localPlayer.x >> 7) + NetFileRequest.baseX, (PlayerComposition.localPlayer.y >> 7) + class41.baseY, false); // L: 3297
|
||||||
WorldMapRectangle.worldMap.loadCache(); // L: 3298
|
WorldMapRectangle.worldMap.loadCache(); // L: 3298
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3808,8 +3808,8 @@ public final class Client extends GameShell implements Usernamed {
|
|||||||
|
|
||||||
int var28;
|
int var28;
|
||||||
if (oculusOrbState == 0) { // L: 3405
|
if (oculusOrbState == 0) { // L: 3405
|
||||||
var4 = PlayerAppearance.localPlayer.x; // L: 3406
|
var4 = PlayerComposition.localPlayer.x; // L: 3406
|
||||||
var5 = PlayerAppearance.localPlayer.y; // L: 3407
|
var5 = PlayerComposition.localPlayer.y; // L: 3407
|
||||||
if (SecureRandomFuture.oculusOrbFocalPointX - var4 < -500 || SecureRandomFuture.oculusOrbFocalPointX - var4 > 500 || Decimator.oculusOrbFocalPointY - var5 < -500 || Decimator.oculusOrbFocalPointY - var5 > 500) { // L: 3408
|
if (SecureRandomFuture.oculusOrbFocalPointX - var4 < -500 || SecureRandomFuture.oculusOrbFocalPointX - var4 > 500 || Decimator.oculusOrbFocalPointY - var5 < -500 || Decimator.oculusOrbFocalPointY - var5 > 500) { // L: 3408
|
||||||
SecureRandomFuture.oculusOrbFocalPointX = var4; // L: 3409
|
SecureRandomFuture.oculusOrbFocalPointX = var4; // L: 3409
|
||||||
Decimator.oculusOrbFocalPointY = var5; // L: 3410
|
Decimator.oculusOrbFocalPointY = var5; // L: 3410
|
||||||
@@ -3858,19 +3858,19 @@ public final class Client extends GameShell implements Usernamed {
|
|||||||
field918 += (var10 - field918) / 80; // L: 3432
|
field918 += (var10 - field918) / 80; // L: 3432
|
||||||
}
|
}
|
||||||
|
|
||||||
PacketWriter.field1341 = SecureRandomFuture.getTileHeight(PlayerAppearance.localPlayer.x, PlayerAppearance.localPlayer.y, GameObject.Client_plane) - camFollowHeight; // L: 3433
|
PacketWriter.field1341 = SecureRandomFuture.getTileHeight(PlayerComposition.localPlayer.x, PlayerComposition.localPlayer.y, GameObject.Client_plane) - camFollowHeight; // L: 3433
|
||||||
} else if (oculusOrbState == 1) { // L: 3435
|
} else if (oculusOrbState == 1) { // L: 3435
|
||||||
if (field649 && PlayerAppearance.localPlayer != null) { // L: 3437
|
if (field649 && PlayerComposition.localPlayer != null) { // L: 3437
|
||||||
var4 = PlayerAppearance.localPlayer.pathX[0]; // L: 3438
|
var4 = PlayerComposition.localPlayer.pathX[0]; // L: 3438
|
||||||
var5 = PlayerAppearance.localPlayer.pathY[0]; // L: 3439
|
var5 = PlayerComposition.localPlayer.pathY[0]; // L: 3439
|
||||||
if (var4 >= 0 && var5 >= 0 && var4 < 104 && var5 < 104) { // L: 3440
|
if (var4 >= 0 && var5 >= 0 && var4 < 104 && var5 < 104) { // L: 3440
|
||||||
SecureRandomFuture.oculusOrbFocalPointX = PlayerAppearance.localPlayer.x; // L: 3441
|
SecureRandomFuture.oculusOrbFocalPointX = PlayerComposition.localPlayer.x; // L: 3441
|
||||||
var6 = SecureRandomFuture.getTileHeight(PlayerAppearance.localPlayer.x, PlayerAppearance.localPlayer.y, GameObject.Client_plane) - camFollowHeight; // L: 3442
|
var6 = SecureRandomFuture.getTileHeight(PlayerComposition.localPlayer.x, PlayerComposition.localPlayer.y, GameObject.Client_plane) - camFollowHeight; // L: 3442
|
||||||
if (var6 < PacketWriter.field1341) { // L: 3443
|
if (var6 < PacketWriter.field1341) { // L: 3443
|
||||||
PacketWriter.field1341 = var6;
|
PacketWriter.field1341 = var6;
|
||||||
}
|
}
|
||||||
|
|
||||||
Decimator.oculusOrbFocalPointY = PlayerAppearance.localPlayer.y; // L: 3444
|
Decimator.oculusOrbFocalPointY = PlayerComposition.localPlayer.y; // L: 3444
|
||||||
field649 = false; // L: 3445
|
field649 = false; // L: 3445
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4278,7 +4278,7 @@ public final class Client extends GameShell implements Usernamed {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FriendsList.method5222(GameObject.Client_plane, PlayerAppearance.localPlayer.x, PlayerAppearance.localPlayer.y, field850); // L: 4280
|
FriendsList.method5222(GameObject.Client_plane, PlayerComposition.localPlayer.x, PlayerComposition.localPlayer.y, field850); // L: 4280
|
||||||
field850 = 0; // L: 4281
|
field850 = 0; // L: 4281
|
||||||
} // L: 4282
|
} // L: 4282
|
||||||
|
|
||||||
@@ -4503,7 +4503,7 @@ public final class Client extends GameShell implements Usernamed {
|
|||||||
var16 = var3.readInt(); // L: 5768
|
var16 = var3.readInt(); // L: 5768
|
||||||
var51 = CollisionMap.getWidget(var16); // L: 5769
|
var51 = CollisionMap.getWidget(var16); // L: 5769
|
||||||
var51.modelType = 3; // L: 5770
|
var51.modelType = 3; // L: 5770
|
||||||
var51.modelId = PlayerAppearance.localPlayer.appearance.getChatHeadId(); // L: 5771
|
var51.modelId = PlayerComposition.localPlayer.appearance.getChatHeadId(); // L: 5771
|
||||||
CollisionMap.invalidateWidget(var51); // L: 5772
|
CollisionMap.invalidateWidget(var51); // L: 5772
|
||||||
var1.serverPacket = null; // L: 5773
|
var1.serverPacket = null; // L: 5773
|
||||||
return true; // L: 5774
|
return true; // L: 5774
|
||||||
@@ -5637,18 +5637,18 @@ public final class Client extends GameShell implements Usernamed {
|
|||||||
return true; // L: 6629
|
return true; // L: 6629
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerAppearance.RunException_sendStackTrace("" + (var1.serverPacket != null ? var1.serverPacket.id * 1148115103 * -61586593 : -1) + "," + (var1.field1336 != null ? var1.field1336.id * 1148115103 * -61586593 : -1) + "," + (var1.field1337 != null ? var1.field1337.id * 1148115103 * -61586593 : -1) + "," + var1.serverPacketLength, (Throwable)null); // L: 6631
|
PlayerComposition.RunException_sendStackTrace("" + (var1.serverPacket != null ? var1.serverPacket.id * 1148115103 * -61586593 : -1) + "," + (var1.field1336 != null ? var1.field1336.id * 1148115103 * -61586593 : -1) + "," + (var1.field1337 != null ? var1.field1337.id * 1148115103 * -61586593 : -1) + "," + var1.serverPacketLength, (Throwable)null); // L: 6631
|
||||||
WorldMapRectangle.logOut(); // L: 6632
|
WorldMapRectangle.logOut(); // L: 6632
|
||||||
} catch (IOException var35) { // L: 6634
|
} catch (IOException var35) { // L: 6634
|
||||||
LoginScreenAnimation.method1903(); // L: 6635
|
LoginScreenAnimation.method1903(); // L: 6635
|
||||||
} catch (Exception var36) {
|
} catch (Exception var36) {
|
||||||
var17 = "" + (var1.serverPacket != null ? var1.serverPacket.id * 1148115103 * -61586593 : -1) + "," + (var1.field1336 != null ? var1.field1336.id * 1148115103 * -61586593 : -1) + "," + (var1.field1337 != null ? var1.field1337.id * 1148115103 * -61586593 : -1) + "," + var1.serverPacketLength + "," + (PlayerAppearance.localPlayer.pathX[0] + NetFileRequest.baseX) + "," + (PlayerAppearance.localPlayer.pathY[0] + class41.baseY) + ","; // L: 6638
|
var17 = "" + (var1.serverPacket != null ? var1.serverPacket.id * 1148115103 * -61586593 : -1) + "," + (var1.field1336 != null ? var1.field1336.id * 1148115103 * -61586593 : -1) + "," + (var1.field1337 != null ? var1.field1337.id * 1148115103 * -61586593 : -1) + "," + var1.serverPacketLength + "," + (PlayerComposition.localPlayer.pathX[0] + NetFileRequest.baseX) + "," + (PlayerComposition.localPlayer.pathY[0] + class41.baseY) + ","; // L: 6638
|
||||||
|
|
||||||
for (var18 = 0; var18 < var1.serverPacketLength && var18 < 50; ++var18) { // L: 6639
|
for (var18 = 0; var18 < var1.serverPacketLength && var18 < 50; ++var18) { // L: 6639
|
||||||
var17 = var17 + var3.array[var18] + ",";
|
var17 = var17 + var3.array[var18] + ",";
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerAppearance.RunException_sendStackTrace(var17, var36); // L: 6640
|
PlayerComposition.RunException_sendStackTrace(var17, var36); // L: 6640
|
||||||
WorldMapRectangle.logOut(); // L: 6641
|
WorldMapRectangle.logOut(); // L: 6641
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5943,7 +5943,7 @@ public final class Client extends GameShell implements Usernamed {
|
|||||||
)
|
)
|
||||||
@Export("username")
|
@Export("username")
|
||||||
public Username username() {
|
public Username username() {
|
||||||
return PlayerAppearance.localPlayer != null ? PlayerAppearance.localPlayer.username : null; // L: 11178
|
return PlayerComposition.localPlayer != null ? PlayerComposition.localPlayer.username : null; // L: 11178
|
||||||
}
|
}
|
||||||
|
|
||||||
@ObfuscatedName("x")
|
@ObfuscatedName("x")
|
||||||
|
|||||||
@@ -111,18 +111,18 @@ public class Coord {
|
|||||||
)
|
)
|
||||||
@Export("getVarbit")
|
@Export("getVarbit")
|
||||||
public static int getVarbit(int var0) {
|
public static int getVarbit(int var0) {
|
||||||
VarbitDefinition var2 = (VarbitDefinition)VarbitDefinition.VarbitDefinition_cached.get((long)var0); // L: 26
|
VarbitComposition var2 = (VarbitComposition) VarbitComposition.VarbitDefinition_cached.get((long)var0); // L: 26
|
||||||
VarbitDefinition var1;
|
VarbitComposition var1;
|
||||||
if (var2 != null) { // L: 27
|
if (var2 != null) { // L: 27
|
||||||
var1 = var2; // L: 28
|
var1 = var2; // L: 28
|
||||||
} else {
|
} else {
|
||||||
byte[] var3 = VarbitDefinition.VarbitDefinition_archive.takeFile(14, var0); // L: 31
|
byte[] var3 = VarbitComposition.VarbitDefinition_archive.takeFile(14, var0); // L: 31
|
||||||
var2 = new VarbitDefinition(); // L: 32
|
var2 = new VarbitComposition(); // L: 32
|
||||||
if (var3 != null) { // L: 33
|
if (var3 != null) { // L: 33
|
||||||
var2.decode(new Buffer(var3));
|
var2.decode(new Buffer(var3));
|
||||||
}
|
}
|
||||||
|
|
||||||
VarbitDefinition.VarbitDefinition_cached.put(var2, (long)var0); // L: 34
|
VarbitComposition.VarbitDefinition_cached.put(var2, (long)var0); // L: 34
|
||||||
var1 = var2; // L: 35
|
var1 = var2; // L: 35
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class DefaultsGroup {
|
|||||||
Client.players[var0] = null;
|
Client.players[var0] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerAppearance.localPlayer = null; // L: 2774
|
PlayerComposition.localPlayer = null; // L: 2774
|
||||||
|
|
||||||
for (var0 = 0; var0 < Client.npcs.length; ++var0) { // L: 2775
|
for (var0 = 0; var0 < Client.npcs.length; ++var0) { // L: 2775
|
||||||
NPC var1 = Client.npcs[var0]; // L: 2776
|
NPC var1 = Client.npcs[var0]; // L: 2776
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class DirectByteArrayCopier extends AbstractByteArrayCopier {
|
|||||||
GrandExchangeOfferWorldComparator.field52 = new int[4][105][105]; // L: 53
|
GrandExchangeOfferWorldComparator.field52 = new int[4][105][105]; // L: 53
|
||||||
Tiles.field511 = new byte[4][105][105]; // L: 54
|
Tiles.field511 = new byte[4][105][105]; // L: 54
|
||||||
class92.field1173 = new int[105][105]; // L: 55
|
class92.field1173 = new int[105][105]; // L: 55
|
||||||
VarbitDefinition.Tiles_hue = new int[104]; // L: 56
|
VarbitComposition.Tiles_hue = new int[104]; // L: 56
|
||||||
ArchiveDiskActionHandler.Tiles_saturation = new int[104]; // L: 57
|
ArchiveDiskActionHandler.Tiles_saturation = new int[104]; // L: 57
|
||||||
class92.Tiles_lightness = new int[104]; // L: 58
|
class92.Tiles_lightness = new int[104]; // L: 58
|
||||||
UserComparator7.Tiles_hueMultiplier = new int[104]; // L: 59
|
UserComparator7.Tiles_hueMultiplier = new int[104]; // L: 59
|
||||||
@@ -83,16 +83,16 @@ public class DirectByteArrayCopier extends AbstractByteArrayCopier {
|
|||||||
Rasterizer2D.Rasterizer2D_setClip(var1, var2, var4.width + var1, var2 + var4.height); // L: 10874
|
Rasterizer2D.Rasterizer2D_setClip(var1, var2, var4.width + var1, var2 + var4.height); // L: 10874
|
||||||
if (Client.minimapState != 2 && Client.minimapState != 5) { // L: 10875
|
if (Client.minimapState != 2 && Client.minimapState != 5) { // L: 10875
|
||||||
int var5 = Client.camAngleY & 2047; // L: 10876
|
int var5 = Client.camAngleY & 2047; // L: 10876
|
||||||
int var6 = PlayerAppearance.localPlayer.x / 32 + 48; // L: 10877
|
int var6 = PlayerComposition.localPlayer.x / 32 + 48; // L: 10877
|
||||||
int var7 = 464 - PlayerAppearance.localPlayer.y / 32; // L: 10878
|
int var7 = 464 - PlayerComposition.localPlayer.y / 32; // L: 10878
|
||||||
class25.sceneMinimapSprite.drawRotatedMaskedCenteredAround(var1, var2, var4.width, var4.height, var6, var7, var5, 256, var4.xStarts, var4.xWidths); // L: 10879
|
class25.sceneMinimapSprite.drawRotatedMaskedCenteredAround(var1, var2, var4.width, var4.height, var6, var7, var5, 256, var4.xStarts, var4.xWidths); // L: 10879
|
||||||
|
|
||||||
int var8;
|
int var8;
|
||||||
int var10;
|
int var10;
|
||||||
int var17;
|
int var17;
|
||||||
for (var8 = 0; var8 < Client.mapIconCount; ++var8) { // L: 10880
|
for (var8 = 0; var8 < Client.mapIconCount; ++var8) { // L: 10880
|
||||||
var17 = Client.mapIconXs[var8] * 4 + 2 - PlayerAppearance.localPlayer.x / 32; // L: 10881
|
var17 = Client.mapIconXs[var8] * 4 + 2 - PlayerComposition.localPlayer.x / 32; // L: 10881
|
||||||
var10 = Client.mapIconYs[var8] * 4 + 2 - PlayerAppearance.localPlayer.y / 32; // L: 10882
|
var10 = Client.mapIconYs[var8] * 4 + 2 - PlayerComposition.localPlayer.y / 32; // L: 10882
|
||||||
class25.drawSpriteOnMinimap(var1, var2, var17, var10, Client.mapIcons[var8], var4); // L: 10883
|
class25.drawSpriteOnMinimap(var1, var2, var17, var10, Client.mapIcons[var8], var4); // L: 10883
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,8 +102,8 @@ public class DirectByteArrayCopier extends AbstractByteArrayCopier {
|
|||||||
for (var17 = 0; var17 < 104; ++var17) { // L: 10886
|
for (var17 = 0; var17 < 104; ++var17) { // L: 10886
|
||||||
NodeDeque var15 = Client.groundItems[GameObject.Client_plane][var8][var17]; // L: 10887
|
NodeDeque var15 = Client.groundItems[GameObject.Client_plane][var8][var17]; // L: 10887
|
||||||
if (var15 != null) { // L: 10888
|
if (var15 != null) { // L: 10888
|
||||||
var11 = var8 * 4 + 2 - PlayerAppearance.localPlayer.x / 32; // L: 10889
|
var11 = var8 * 4 + 2 - PlayerComposition.localPlayer.x / 32; // L: 10889
|
||||||
var12 = var17 * 4 + 2 - PlayerAppearance.localPlayer.y / 32; // L: 10890
|
var12 = var17 * 4 + 2 - PlayerComposition.localPlayer.y / 32; // L: 10890
|
||||||
class25.drawSpriteOnMinimap(var1, var2, var11, var12, Actor.mapDotSprites[0], var4); // L: 10891
|
class25.drawSpriteOnMinimap(var1, var2, var11, var12, Actor.mapDotSprites[0], var4); // L: 10891
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -118,8 +118,8 @@ public class DirectByteArrayCopier extends AbstractByteArrayCopier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (var19 != null && var19.drawMapDot && var19.isInteractable) { // L: 10900
|
if (var19 != null && var19.drawMapDot && var19.isInteractable) { // L: 10900
|
||||||
var11 = var9.x / 32 - PlayerAppearance.localPlayer.x / 32; // L: 10901
|
var11 = var9.x / 32 - PlayerComposition.localPlayer.x / 32; // L: 10901
|
||||||
var12 = var9.y / 32 - PlayerAppearance.localPlayer.y / 32; // L: 10902
|
var12 = var9.y / 32 - PlayerComposition.localPlayer.y / 32; // L: 10902
|
||||||
class25.drawSpriteOnMinimap(var1, var2, var11, var12, Actor.mapDotSprites[1], var4); // L: 10903
|
class25.drawSpriteOnMinimap(var1, var2, var11, var12, Actor.mapDotSprites[1], var4); // L: 10903
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -130,11 +130,11 @@ public class DirectByteArrayCopier extends AbstractByteArrayCopier {
|
|||||||
|
|
||||||
for (var10 = 0; var10 < var8; ++var10) { // L: 10909
|
for (var10 = 0; var10 < var8; ++var10) { // L: 10909
|
||||||
Player var16 = Client.players[var18[var10]]; // L: 10910
|
Player var16 = Client.players[var18[var10]]; // L: 10910
|
||||||
if (var16 != null && var16.isVisible() && !var16.isHidden && var16 != PlayerAppearance.localPlayer) { // L: 10911
|
if (var16 != null && var16.isVisible() && !var16.isHidden && var16 != PlayerComposition.localPlayer) { // L: 10911
|
||||||
var12 = var16.x / 32 - PlayerAppearance.localPlayer.x / 32; // L: 10912
|
var12 = var16.x / 32 - PlayerComposition.localPlayer.x / 32; // L: 10912
|
||||||
int var13 = var16.y / 32 - PlayerAppearance.localPlayer.y / 32; // L: 10913
|
int var13 = var16.y / 32 - PlayerComposition.localPlayer.y / 32; // L: 10913
|
||||||
boolean var14 = false; // L: 10914
|
boolean var14 = false; // L: 10914
|
||||||
if (PlayerAppearance.localPlayer.team != 0 && var16.team != 0 && var16.team == PlayerAppearance.localPlayer.team) { // L: 10915
|
if (PlayerComposition.localPlayer.team != 0 && var16.team != 0 && var16.team == PlayerComposition.localPlayer.team) { // L: 10915
|
||||||
var14 = true;
|
var14 = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,35 +154,35 @@ public class DirectByteArrayCopier extends AbstractByteArrayCopier {
|
|||||||
if (Client.hintArrowType == 1 && Client.hintArrowNpcIndex >= 0 && Client.hintArrowNpcIndex < Client.npcs.length) { // L: 10923
|
if (Client.hintArrowType == 1 && Client.hintArrowNpcIndex >= 0 && Client.hintArrowNpcIndex < Client.npcs.length) { // L: 10923
|
||||||
NPC var20 = Client.npcs[Client.hintArrowNpcIndex]; // L: 10924
|
NPC var20 = Client.npcs[Client.hintArrowNpcIndex]; // L: 10924
|
||||||
if (var20 != null) { // L: 10925
|
if (var20 != null) { // L: 10925
|
||||||
var11 = var20.x / 32 - PlayerAppearance.localPlayer.x / 32; // L: 10926
|
var11 = var20.x / 32 - PlayerComposition.localPlayer.x / 32; // L: 10926
|
||||||
var12 = var20.y / 32 - PlayerAppearance.localPlayer.y / 32; // L: 10927
|
var12 = var20.y / 32 - PlayerComposition.localPlayer.y / 32; // L: 10927
|
||||||
AbstractWorldMapData.worldToMinimap(var1, var2, var11, var12, GrandExchangeOfferUnitPriceComparator.mapMarkerSpritePixels[1], var4); // L: 10928
|
AbstractWorldMapData.worldToMinimap(var1, var2, var11, var12, GrandExchangeOfferUnitPriceComparator.mapMarkerSpritePixels[1], var4); // L: 10928
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Client.hintArrowType == 2) { // L: 10931
|
if (Client.hintArrowType == 2) { // L: 10931
|
||||||
var10 = Client.hintArrowX * 4 - NetFileRequest.baseX * 4 + 2 - PlayerAppearance.localPlayer.x / 32; // L: 10932
|
var10 = Client.hintArrowX * 4 - NetFileRequest.baseX * 4 + 2 - PlayerComposition.localPlayer.x / 32; // L: 10932
|
||||||
var11 = Client.hintArrowY * 4 - class41.baseY * 4 + 2 - PlayerAppearance.localPlayer.y / 32; // L: 10933
|
var11 = Client.hintArrowY * 4 - class41.baseY * 4 + 2 - PlayerComposition.localPlayer.y / 32; // L: 10933
|
||||||
AbstractWorldMapData.worldToMinimap(var1, var2, var10, var11, GrandExchangeOfferUnitPriceComparator.mapMarkerSpritePixels[1], var4); // L: 10934
|
AbstractWorldMapData.worldToMinimap(var1, var2, var10, var11, GrandExchangeOfferUnitPriceComparator.mapMarkerSpritePixels[1], var4); // L: 10934
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Client.hintArrowType == 10 && Client.hintArrowPlayerIndex >= 0 && Client.hintArrowPlayerIndex < Client.players.length) { // L: 10936
|
if (Client.hintArrowType == 10 && Client.hintArrowPlayerIndex >= 0 && Client.hintArrowPlayerIndex < Client.players.length) { // L: 10936
|
||||||
Player var21 = Client.players[Client.hintArrowPlayerIndex]; // L: 10937
|
Player var21 = Client.players[Client.hintArrowPlayerIndex]; // L: 10937
|
||||||
if (var21 != null) { // L: 10938
|
if (var21 != null) { // L: 10938
|
||||||
var11 = var21.x / 32 - PlayerAppearance.localPlayer.x / 32; // L: 10939
|
var11 = var21.x / 32 - PlayerComposition.localPlayer.x / 32; // L: 10939
|
||||||
var12 = var21.y / 32 - PlayerAppearance.localPlayer.y / 32; // L: 10940
|
var12 = var21.y / 32 - PlayerComposition.localPlayer.y / 32; // L: 10940
|
||||||
AbstractWorldMapData.worldToMinimap(var1, var2, var11, var12, GrandExchangeOfferUnitPriceComparator.mapMarkerSpritePixels[1], var4); // L: 10941
|
AbstractWorldMapData.worldToMinimap(var1, var2, var11, var12, GrandExchangeOfferUnitPriceComparator.mapMarkerSpritePixels[1], var4); // L: 10941
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Client.destinationX != 0) { // L: 10945
|
if (Client.destinationX != 0) { // L: 10945
|
||||||
var10 = Client.destinationX * 4 + 2 - PlayerAppearance.localPlayer.x / 32; // L: 10946
|
var10 = Client.destinationX * 4 + 2 - PlayerComposition.localPlayer.x / 32; // L: 10946
|
||||||
var11 = Client.destinationY * 4 + 2 - PlayerAppearance.localPlayer.y / 32; // L: 10947
|
var11 = Client.destinationY * 4 + 2 - PlayerComposition.localPlayer.y / 32; // L: 10947
|
||||||
class25.drawSpriteOnMinimap(var1, var2, var10, var11, GrandExchangeOfferUnitPriceComparator.mapMarkerSpritePixels[0], var4); // L: 10948
|
class25.drawSpriteOnMinimap(var1, var2, var10, var11, GrandExchangeOfferUnitPriceComparator.mapMarkerSpritePixels[0], var4); // L: 10948
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PlayerAppearance.localPlayer.isHidden) { // L: 10950
|
if (!PlayerComposition.localPlayer.isHidden) { // L: 10950
|
||||||
Rasterizer2D.Rasterizer2D_fillRectangle(var4.width / 2 + var1 - 1, var4.height / 2 + var2 - 1, 3, 3, 16777215);
|
Rasterizer2D.Rasterizer2D_fillRectangle(var4.width / 2 + var1 - 1, var4.height / 2 + var2 - 1, 3, 3, 16777215);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public class FaceNormal {
|
|||||||
} else if (var0 < 3400) { // L: 414
|
} else if (var0 < 3400) { // L: 414
|
||||||
return Language.method3709(var0, var1, var2);
|
return Language.method3709(var0, var1, var2);
|
||||||
} else if (var0 < 3500) { // L: 415
|
} else if (var0 < 3500) { // L: 415
|
||||||
return TileItemPile.method2850(var0, var1, var2);
|
return ItemLayer.method2850(var0, var1, var2);
|
||||||
} else if (var0 < 3700) { // L: 416
|
} else if (var0 < 3700) { // L: 416
|
||||||
return ApproximateRouteStrategy.method1302(var0, var1, var2);
|
return ApproximateRouteStrategy.method1302(var0, var1, var2);
|
||||||
} else if (var0 < 4000) { // L: 417
|
} else if (var0 < 4000) { // L: 417
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public final class FloorDecoration {
|
|||||||
|
|
||||||
for (int var6 = 0; var6 < var2; ++var6) { // L: 8292
|
for (int var6 = 0; var6 < var2; ++var6) { // L: 8292
|
||||||
Player var7 = Client.players[var3[var6]]; // L: 8293
|
Player var7 = Client.players[var3[var6]]; // L: 8293
|
||||||
if (var7 != null && var7 != PlayerAppearance.localPlayer && var7.username != null && var7.username.equals(var5)) { // L: 8294
|
if (var7 != null && var7 != PlayerComposition.localPlayer && var7.username != null && var7.username.equals(var5)) { // L: 8294
|
||||||
PacketBufferNode var8;
|
PacketBufferNode var8;
|
||||||
if (var0 == 1) { // L: 8295
|
if (var0 == 1) { // L: 8295
|
||||||
var8 = ItemContainer.getPacketBufferNode(ClientPacket.field2260, Client.packetWriter.isaacCipher); // L: 8297
|
var8 = ItemContainer.getPacketBufferNode(ClientPacket.field2260, Client.packetWriter.isaacCipher); // L: 8297
|
||||||
@@ -124,14 +124,14 @@ public final class FloorDecoration {
|
|||||||
)
|
)
|
||||||
@Export("addPlayerToMenu")
|
@Export("addPlayerToMenu")
|
||||||
static final void addPlayerToMenu(Player var0, int var1, int var2, int var3) {
|
static final void addPlayerToMenu(Player var0, int var1, int var2, int var3) {
|
||||||
if (PlayerAppearance.localPlayer != var0) { // L: 8826
|
if (PlayerComposition.localPlayer != var0) { // L: 8826
|
||||||
if (Client.menuOptionsCount < 400) { // L: 8827
|
if (Client.menuOptionsCount < 400) { // L: 8827
|
||||||
String var4;
|
String var4;
|
||||||
int var7;
|
int var7;
|
||||||
if (var0.skillLevel == 0) { // L: 8829
|
if (var0.skillLevel == 0) { // L: 8829
|
||||||
String var5 = var0.actions[0] + var0.username + var0.actions[1]; // L: 8830
|
String var5 = var0.actions[0] + var0.username + var0.actions[1]; // L: 8830
|
||||||
var7 = var0.combatLevel; // L: 8832
|
var7 = var0.combatLevel; // L: 8832
|
||||||
int var8 = PlayerAppearance.localPlayer.combatLevel; // L: 8833
|
int var8 = PlayerComposition.localPlayer.combatLevel; // L: 8833
|
||||||
int var9 = var8 - var7; // L: 8835
|
int var9 = var8 - var7; // L: 8835
|
||||||
String var6;
|
String var6;
|
||||||
if (var9 < -9) { // L: 8836
|
if (var9 < -9) { // L: 8836
|
||||||
@@ -175,12 +175,12 @@ public final class FloorDecoration {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Client.playerAttackOption == AttackOption.AttackOption_alwaysRightClick || AttackOption.AttackOption_dependsOnCombatLevels == Client.playerAttackOption && var0.combatLevel > PlayerAppearance.localPlayer.combatLevel) { // L: 8889
|
if (Client.playerAttackOption == AttackOption.AttackOption_alwaysRightClick || AttackOption.AttackOption_dependsOnCombatLevels == Client.playerAttackOption && var0.combatLevel > PlayerComposition.localPlayer.combatLevel) { // L: 8889
|
||||||
var11 = 2000; // L: 8890
|
var11 = 2000; // L: 8890
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PlayerAppearance.localPlayer.team != 0 && var0.team != 0) { // L: 8892
|
if (PlayerComposition.localPlayer.team != 0 && var0.team != 0) { // L: 8892
|
||||||
if (var0.team == PlayerAppearance.localPlayer.team) { // L: 8893
|
if (var0.team == PlayerComposition.localPlayer.team) { // L: 8893
|
||||||
var11 = 2000;
|
var11 = 2000;
|
||||||
} else {
|
} else {
|
||||||
var11 = 0; // L: 8894
|
var11 = 0; // L: 8894
|
||||||
|
|||||||
@@ -586,18 +586,18 @@ public class FontName {
|
|||||||
}
|
}
|
||||||
} else if (var10.modelType == 5) { // L: 9263
|
} else if (var10.modelType == 5) { // L: 9263
|
||||||
if (var10.modelId == 0) { // L: 9264
|
if (var10.modelId == 0) { // L: 9264
|
||||||
var41 = Client.playerAppearance.getModel((SequenceDefinition)null, -1, (SequenceDefinition)null, -1);
|
var41 = Client.playerComposition.getModel((SequenceDefinition)null, -1, (SequenceDefinition)null, -1);
|
||||||
} else {
|
} else {
|
||||||
var41 = PlayerAppearance.localPlayer.getModel(); // L: 9265
|
var41 = PlayerComposition.localPlayer.getModel(); // L: 9265
|
||||||
}
|
}
|
||||||
} else if (var20 == -1) { // L: 9267
|
} else if (var20 == -1) { // L: 9267
|
||||||
var41 = var10.getModel((SequenceDefinition)null, -1, var36, PlayerAppearance.localPlayer.appearance); // L: 9268
|
var41 = var10.getModel((SequenceDefinition)null, -1, var36, PlayerComposition.localPlayer.appearance); // L: 9268
|
||||||
if (var41 == null && Widget.field2603) { // L: 9269
|
if (var41 == null && Widget.field2603) { // L: 9269
|
||||||
CollisionMap.invalidateWidget(var10);
|
CollisionMap.invalidateWidget(var10);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SequenceDefinition var47 = ParamDefinition.SequenceDefinition_get(var20); // L: 9272
|
SequenceDefinition var47 = ParamDefinition.SequenceDefinition_get(var20); // L: 9272
|
||||||
var41 = var10.getModel(var47, var10.modelFrame, var36, PlayerAppearance.localPlayer.appearance); // L: 9273
|
var41 = var10.getModel(var47, var10.modelFrame, var36, PlayerComposition.localPlayer.appearance); // L: 9273
|
||||||
if (var41 == null && Widget.field2603) { // L: 9274
|
if (var41 == null && Widget.field2603) { // L: 9274
|
||||||
CollisionMap.invalidateWidget(var10);
|
CollisionMap.invalidateWidget(var10);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ public class Frames extends DualNode {
|
|||||||
if (var0 != ScriptOpcodes.CC_CALLONRESIZE && var0 != ScriptOpcodes.IF_CALLONRESIZE) { // L: 1145
|
if (var0 != ScriptOpcodes.CC_CALLONRESIZE && var0 != ScriptOpcodes.IF_CALLONRESIZE) { // L: 1145
|
||||||
int var4;
|
int var4;
|
||||||
if (var0 == 1928) { // L: 1162
|
if (var0 == 1928) { // L: 1162
|
||||||
var6 = var2 ? PlayerAppearance.field2561 : VarcInt.field3264; // L: 1163
|
var6 = var2 ? PlayerComposition.field2561 : VarcInt.field3264; // L: 1163
|
||||||
var4 = Interpreter.Interpreter_intStack[--VarcInt.Interpreter_intStackSize]; // L: 1164
|
var4 = Interpreter.Interpreter_intStack[--VarcInt.Interpreter_intStackSize]; // L: 1164
|
||||||
if (var4 >= 1 && var4 <= 10) { // L: 1165
|
if (var4 >= 1 && var4 <= 10) { // L: 1165
|
||||||
class3.widgetDefaultMenuAction(var4, var6.id, var6.childIndex, var6.itemId, ""); // L: 1168
|
class3.widgetDefaultMenuAction(var4, var6.id, var6.childIndex, var6.itemId, ""); // L: 1168
|
||||||
@@ -124,7 +124,7 @@ public class Frames extends DualNode {
|
|||||||
if (var0 >= 2000) { // L: 1150
|
if (var0 >= 2000) { // L: 1150
|
||||||
var6 = CollisionMap.getWidget(Interpreter.Interpreter_intStack[--VarcInt.Interpreter_intStackSize]); // L: 1151
|
var6 = CollisionMap.getWidget(Interpreter.Interpreter_intStack[--VarcInt.Interpreter_intStackSize]); // L: 1151
|
||||||
} else {
|
} else {
|
||||||
var6 = var2 ? PlayerAppearance.field2561 : VarcInt.field3264; // L: 1153
|
var6 = var2 ? PlayerComposition.field2561 : VarcInt.field3264; // L: 1153
|
||||||
}
|
}
|
||||||
|
|
||||||
if (var6.onResize == null) { // L: 1154
|
if (var6.onResize == null) { // L: 1154
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ public class FriendSystem {
|
|||||||
final boolean isFriended(Username var1, boolean var2) {
|
final boolean isFriended(Username var1, boolean var2) {
|
||||||
if (var1 == null) { // L: 71
|
if (var1 == null) { // L: 71
|
||||||
return false;
|
return false;
|
||||||
} else if (var1.equals(PlayerAppearance.localPlayer.username)) { // L: 72
|
} else if (var1.equals(PlayerComposition.localPlayer.username)) { // L: 72
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return this.friendsList.isFriended(var1, var2); // L: 73
|
return this.friendsList.isFriended(var1, var2); // L: 73
|
||||||
@@ -168,7 +168,7 @@ public class FriendSystem {
|
|||||||
if (var2.hasCleanName()) { // L: 86
|
if (var2.hasCleanName()) { // L: 86
|
||||||
if (this.friendsListIsFull()) { // L: 87
|
if (this.friendsListIsFull()) { // L: 87
|
||||||
Calendar.method3985(); // L: 88
|
Calendar.method3985(); // L: 88
|
||||||
} else if (PlayerAppearance.localPlayer.username.equals(var2)) { // L: 91
|
} else if (PlayerComposition.localPlayer.username.equals(var2)) { // L: 91
|
||||||
ServerPacket.method3668(); // L: 92
|
ServerPacket.method3668(); // L: 92
|
||||||
} else if (this.isFriended(var2, false)) { // L: 95
|
} else if (this.isFriended(var2, false)) { // L: 95
|
||||||
class219.method4003(var1); // L: 96
|
class219.method4003(var1); // L: 96
|
||||||
@@ -212,7 +212,7 @@ public class FriendSystem {
|
|||||||
var10000 = null; // L: 153
|
var10000 = null; // L: 153
|
||||||
var3 = "Your ignore list is full. Max of 100 for free users, and 400 for members";
|
var3 = "Your ignore list is full. Max of 100 for free users, and 400 for members";
|
||||||
class234.addGameMessage(30, "", var3); // L: 155
|
class234.addGameMessage(30, "", var3); // L: 155
|
||||||
} else if (PlayerAppearance.localPlayer.username.equals(var2)) { // L: 160
|
} else if (PlayerComposition.localPlayer.username.equals(var2)) { // L: 160
|
||||||
var10000 = null; // L: 162
|
var10000 = null; // L: 162
|
||||||
var3 = "You can't add yourself to your own ignore list";
|
var3 = "You can't add yourself to your own ignore list";
|
||||||
class234.addGameMessage(30, "", var3); // L: 164
|
class234.addGameMessage(30, "", var3); // L: 164
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ public class FriendsList extends UserList {
|
|||||||
if (var4.soundEffectId >= 0) { // L: 75
|
if (var4.soundEffectId >= 0) { // L: 75
|
||||||
SoundEffect var7 = SoundEffect.readSoundEffect(class227.archive4, var4.soundEffectId, 0); // L: 76
|
SoundEffect var7 = SoundEffect.readSoundEffect(class227.archive4, var4.soundEffectId, 0); // L: 76
|
||||||
if (var7 != null) { // L: 77
|
if (var7 != null) { // L: 77
|
||||||
RawSound var8 = var7.toRawSound().resample(TileItemPile.decimator); // L: 78
|
RawSound var8 = var7.toRawSound().resample(ItemLayer.decimator); // L: 78
|
||||||
RawPcmStream var9 = RawPcmStream.createRawPcmStream(var8, 100, var6); // L: 79
|
RawPcmStream var9 = RawPcmStream.createRawPcmStream(var8, 100, var6); // L: 79
|
||||||
var9.setNumLoops(-1); // L: 80
|
var9.setNumLoops(-1); // L: 80
|
||||||
WorldMapManager.pcmStreamMixer.addSubStream(var9); // L: 81
|
WorldMapManager.pcmStreamMixer.addSubStream(var9); // L: 81
|
||||||
@@ -207,7 +207,7 @@ public class FriendsList extends UserList {
|
|||||||
int var11 = (int)(Math.random() * (double)var4.soundEffectIds.length); // L: 89
|
int var11 = (int)(Math.random() * (double)var4.soundEffectIds.length); // L: 89
|
||||||
SoundEffect var12 = SoundEffect.readSoundEffect(class227.archive4, var4.soundEffectIds[var11], 0); // L: 90
|
SoundEffect var12 = SoundEffect.readSoundEffect(class227.archive4, var4.soundEffectIds[var11], 0); // L: 90
|
||||||
if (var12 != null) { // L: 91
|
if (var12 != null) { // L: 91
|
||||||
RawSound var13 = var12.toRawSound().resample(TileItemPile.decimator); // L: 92
|
RawSound var13 = var12.toRawSound().resample(ItemLayer.decimator); // L: 92
|
||||||
RawPcmStream var10 = RawPcmStream.createRawPcmStream(var13, 100, var6); // L: 93
|
RawPcmStream var10 = RawPcmStream.createRawPcmStream(var13, 100, var6); // L: 93
|
||||||
var10.setNumLoops(0); // L: 94
|
var10.setNumLoops(0); // L: 94
|
||||||
WorldMapManager.pcmStreamMixer.addSubStream(var10); // L: 95
|
WorldMapManager.pcmStreamMixer.addSubStream(var10); // L: 95
|
||||||
|
|||||||
@@ -472,7 +472,7 @@ public abstract class GameShell extends Applet implements Runnable, FocusListene
|
|||||||
|
|
||||||
taskHandler.newThreadTask(this, 1); // L: 235
|
taskHandler.newThreadTask(this, 1); // L: 235
|
||||||
} catch (Exception var5) { // L: 237
|
} catch (Exception var5) { // L: 237
|
||||||
PlayerAppearance.RunException_sendStackTrace((String)null, var5); // L: 238
|
PlayerComposition.RunException_sendStackTrace((String)null, var5); // L: 238
|
||||||
this.error("crash"); // L: 239
|
this.error("crash"); // L: 239
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -960,7 +960,7 @@ public abstract class GameShell extends Applet implements Runnable, FocusListene
|
|||||||
this.post(this.canvas); // L: 332
|
this.post(this.canvas); // L: 332
|
||||||
}
|
}
|
||||||
} catch (Exception var7) { // L: 335
|
} catch (Exception var7) { // L: 335
|
||||||
PlayerAppearance.RunException_sendStackTrace((String)null, var7); // L: 336
|
PlayerComposition.RunException_sendStackTrace((String)null, var7); // L: 336
|
||||||
this.error("crash"); // L: 337
|
this.error("crash"); // L: 337
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ final class GrandExchangeOfferAgeComparator implements Comparator {
|
|||||||
Interpreter.Interpreter_stringStackSize -= 2; // L: 2668
|
Interpreter.Interpreter_stringStackSize -= 2; // L: 2668
|
||||||
var3 = Interpreter.Interpreter_stringStack[Interpreter.Interpreter_stringStackSize]; // L: 2669
|
var3 = Interpreter.Interpreter_stringStack[Interpreter.Interpreter_stringStackSize]; // L: 2669
|
||||||
var4 = Interpreter.Interpreter_stringStack[Interpreter.Interpreter_stringStackSize + 1]; // L: 2670
|
var4 = Interpreter.Interpreter_stringStack[Interpreter.Interpreter_stringStackSize + 1]; // L: 2670
|
||||||
if (PlayerAppearance.localPlayer.appearance != null && PlayerAppearance.localPlayer.appearance.isFemale) { // L: 2671
|
if (PlayerComposition.localPlayer.appearance != null && PlayerComposition.localPlayer.appearance.isFemale) { // L: 2671
|
||||||
Interpreter.Interpreter_stringStack[++Interpreter.Interpreter_stringStackSize - 1] = var4;
|
Interpreter.Interpreter_stringStack[++Interpreter.Interpreter_stringStackSize - 1] = var4;
|
||||||
} else {
|
} else {
|
||||||
Interpreter.Interpreter_stringStack[++Interpreter.Interpreter_stringStackSize - 1] = var3; // L: 2672
|
Interpreter.Interpreter_stringStack[++Interpreter.Interpreter_stringStackSize - 1] = var3; // L: 2672
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ final class GrandExchangeOfferUnitPriceComparator implements Comparator {
|
|||||||
garbageValue = "-613147121"
|
garbageValue = "-613147121"
|
||||||
)
|
)
|
||||||
static int method200(int var0, Script var1, boolean var2) {
|
static int method200(int var0, Script var1, boolean var2) {
|
||||||
Widget var3 = var2 ? PlayerAppearance.field2561 : VarcInt.field3264; // L: 1041
|
Widget var3 = var2 ? PlayerComposition.field2561 : VarcInt.field3264; // L: 1041
|
||||||
if (var0 == ScriptOpcodes.CC_GETSCROLLX) { // L: 1042
|
if (var0 == ScriptOpcodes.CC_GETSCROLLX) { // L: 1042
|
||||||
Interpreter.Interpreter_intStack[++VarcInt.Interpreter_intStackSize - 1] = var3.scrollX; // L: 1043
|
Interpreter.Interpreter_intStack[++VarcInt.Interpreter_intStackSize - 1] = var3.scrollX; // L: 1043
|
||||||
return 1; // L: 1044
|
return 1; // L: 1044
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ public class HealthBarDefinition extends DualNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (var6 == 8) { // L: 9634
|
if (var6 == 8) { // L: 9634
|
||||||
var7 = PlayerAppearance.localPlayer.combatLevel;
|
var7 = PlayerComposition.localPlayer.combatLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (var6 == 9) { // L: 9635
|
if (var6 == 9) { // L: 9635
|
||||||
@@ -400,11 +400,11 @@ public class HealthBarDefinition extends DualNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (var6 == 18) { // L: 9668
|
if (var6 == 18) { // L: 9668
|
||||||
var7 = (PlayerAppearance.localPlayer.x >> 7) + NetFileRequest.baseX;
|
var7 = (PlayerComposition.localPlayer.x >> 7) + NetFileRequest.baseX;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (var6 == 19) { // L: 9669
|
if (var6 == 19) { // L: 9669
|
||||||
var7 = (PlayerAppearance.localPlayer.y >> 7) + class41.baseY;
|
var7 = (PlayerComposition.localPlayer.y >> 7) + class41.baseY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (var6 == 20) { // L: 9670
|
if (var6 == 20) { // L: 9670
|
||||||
|
|||||||
@@ -104,26 +104,26 @@ public class HealthBarUpdate extends Node {
|
|||||||
if (var1 >= 300 && var1 <= 313) { // L: 10848
|
if (var1 >= 300 && var1 <= 313) { // L: 10848
|
||||||
var2 = (var1 - 300) / 2; // L: 10849
|
var2 = (var1 - 300) / 2; // L: 10849
|
||||||
var3 = var1 & 1; // L: 10850
|
var3 = var1 & 1; // L: 10850
|
||||||
Client.playerAppearance.changeAppearance(var2, var3 == 1); // L: 10851
|
Client.playerComposition.changeAppearance(var2, var3 == 1); // L: 10851
|
||||||
}
|
}
|
||||||
|
|
||||||
if (var1 >= 314 && var1 <= 323) { // L: 10853
|
if (var1 >= 314 && var1 <= 323) { // L: 10853
|
||||||
var2 = (var1 - 314) / 2; // L: 10854
|
var2 = (var1 - 314) / 2; // L: 10854
|
||||||
var3 = var1 & 1; // L: 10855
|
var3 = var1 & 1; // L: 10855
|
||||||
Client.playerAppearance.method4043(var2, var3 == 1); // L: 10856
|
Client.playerComposition.method4043(var2, var3 == 1); // L: 10856
|
||||||
}
|
}
|
||||||
|
|
||||||
if (var1 == 324) {
|
if (var1 == 324) {
|
||||||
Client.playerAppearance.changeSex(false); // L: 10858
|
Client.playerComposition.changeSex(false); // L: 10858
|
||||||
}
|
}
|
||||||
|
|
||||||
if (var1 == 325) { // L: 10859
|
if (var1 == 325) { // L: 10859
|
||||||
Client.playerAppearance.changeSex(true);
|
Client.playerComposition.changeSex(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (var1 == 326) { // L: 10860
|
if (var1 == 326) { // L: 10860
|
||||||
PacketBufferNode var4 = ItemContainer.getPacketBufferNode(ClientPacket.field2239, Client.packetWriter.isaacCipher); // L: 10862
|
PacketBufferNode var4 = ItemContainer.getPacketBufferNode(ClientPacket.field2239, Client.packetWriter.isaacCipher); // L: 10862
|
||||||
Client.playerAppearance.write(var4.packetBuffer); // L: 10863
|
Client.playerComposition.write(var4.packetBuffer); // L: 10863
|
||||||
Client.packetWriter.addNode(var4); // L: 10864
|
Client.packetWriter.addNode(var4); // L: 10864
|
||||||
return true; // L: 10865
|
return true; // L: 10865
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -6,8 +6,9 @@ import net.runelite.mapping.ObfuscatedSignature;
|
|||||||
import net.runelite.rs.ScriptOpcodes;
|
import net.runelite.rs.ScriptOpcodes;
|
||||||
|
|
||||||
@ObfuscatedName("dz")
|
@ObfuscatedName("dz")
|
||||||
@Implements("TileItemPile")
|
@Implements("ItemLayer")
|
||||||
public final class TileItemPile {
|
public final class ItemLayer
|
||||||
|
{
|
||||||
@ObfuscatedName("qq")
|
@ObfuscatedName("qq")
|
||||||
@ObfuscatedSignature(
|
@ObfuscatedSignature(
|
||||||
descriptor = "Ldn;"
|
descriptor = "Ldn;"
|
||||||
@@ -69,7 +70,7 @@ public final class TileItemPile {
|
|||||||
@Export("height")
|
@Export("height")
|
||||||
int height;
|
int height;
|
||||||
|
|
||||||
TileItemPile() {
|
ItemLayer() {
|
||||||
} // L: 13
|
} // L: 13
|
||||||
|
|
||||||
@ObfuscatedName("ag")
|
@ObfuscatedName("ag")
|
||||||
@@ -250,18 +250,18 @@ public class KitDefinition extends DualNode {
|
|||||||
garbageValue = "-1929348115"
|
garbageValue = "-1929348115"
|
||||||
)
|
)
|
||||||
public static void method4491(int var0, int var1) {
|
public static void method4491(int var0, int var1) {
|
||||||
VarbitDefinition var3 = (VarbitDefinition)VarbitDefinition.VarbitDefinition_cached.get((long)var0); // L: 48
|
VarbitComposition var3 = (VarbitComposition) VarbitComposition.VarbitDefinition_cached.get((long)var0); // L: 48
|
||||||
VarbitDefinition var2;
|
VarbitComposition var2;
|
||||||
if (var3 != null) { // L: 49
|
if (var3 != null) { // L: 49
|
||||||
var2 = var3; // L: 50
|
var2 = var3; // L: 50
|
||||||
} else {
|
} else {
|
||||||
byte[] var4 = VarbitDefinition.VarbitDefinition_archive.takeFile(14, var0); // L: 53
|
byte[] var4 = VarbitComposition.VarbitDefinition_archive.takeFile(14, var0); // L: 53
|
||||||
var3 = new VarbitDefinition(); // L: 54
|
var3 = new VarbitComposition(); // L: 54
|
||||||
if (var4 != null) { // L: 55
|
if (var4 != null) { // L: 55
|
||||||
var3.decode(new Buffer(var4));
|
var3.decode(new Buffer(var4));
|
||||||
}
|
}
|
||||||
|
|
||||||
VarbitDefinition.VarbitDefinition_cached.put(var3, (long)var0); // L: 56
|
VarbitComposition.VarbitDefinition_cached.put(var3, (long)var0); // L: 56
|
||||||
var2 = var3; // L: 57
|
var2 = var3; // L: 57
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -216,8 +216,8 @@ public class Language implements Enumerated {
|
|||||||
int var5;
|
int var5;
|
||||||
if (var0 == ScriptOpcodes.COORD) { // L: 1826
|
if (var0 == ScriptOpcodes.COORD) { // L: 1826
|
||||||
var3 = GameObject.Client_plane; // L: 1827
|
var3 = GameObject.Client_plane; // L: 1827
|
||||||
var4 = (PlayerAppearance.localPlayer.x >> 7) + NetFileRequest.baseX; // L: 1828
|
var4 = (PlayerComposition.localPlayer.x >> 7) + NetFileRequest.baseX; // L: 1828
|
||||||
var5 = (PlayerAppearance.localPlayer.y >> 7) + class41.baseY; // L: 1829
|
var5 = (PlayerComposition.localPlayer.y >> 7) + class41.baseY; // L: 1829
|
||||||
Interpreter.Interpreter_intStack[++VarcInt.Interpreter_intStackSize - 1] = (var4 << 14) + var5 + (var3 << 28); // L: 1830
|
Interpreter.Interpreter_intStack[++VarcInt.Interpreter_intStackSize - 1] = (var4 << 14) + var5 + (var3 << 28); // L: 1830
|
||||||
return 1; // L: 1831
|
return 1; // L: 1831
|
||||||
} else if (var0 == ScriptOpcodes.COORDX) { // L: 1833
|
} else if (var0 == ScriptOpcodes.COORDX) { // L: 1833
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ public class LoginPacket implements class190 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (var11 = 0; var11 < 104; ++var11) { // L: 540
|
for (var11 = 0; var11 < 104; ++var11) { // L: 540
|
||||||
VarbitDefinition.Tiles_hue[var11] = 0; // L: 541
|
VarbitComposition.Tiles_hue[var11] = 0; // L: 541
|
||||||
ArchiveDiskActionHandler.Tiles_saturation[var11] = 0; // L: 542
|
ArchiveDiskActionHandler.Tiles_saturation[var11] = 0; // L: 542
|
||||||
class92.Tiles_lightness[var11] = 0; // L: 543
|
class92.Tiles_lightness[var11] = 0; // L: 543
|
||||||
UserComparator7.Tiles_hueMultiplier[var11] = 0; // L: 544
|
UserComparator7.Tiles_hueMultiplier[var11] = 0; // L: 544
|
||||||
@@ -197,7 +197,7 @@ public class LoginPacket implements class190 {
|
|||||||
var14 = Tiles.field514[var2][var13][var12] & 255; // L: 551
|
var14 = Tiles.field514[var2][var13][var12] & 255; // L: 551
|
||||||
if (var14 > 0) { // L: 552
|
if (var14 > 0) { // L: 552
|
||||||
FloorUnderlayDefinition var44 = WorldMapElement.method4405(var14 - 1); // L: 553
|
FloorUnderlayDefinition var44 = WorldMapElement.method4405(var14 - 1); // L: 553
|
||||||
var10000 = VarbitDefinition.Tiles_hue; // L: 554
|
var10000 = VarbitComposition.Tiles_hue; // L: 554
|
||||||
var10000[var12] += var44.hue;
|
var10000[var12] += var44.hue;
|
||||||
var10000 = ArchiveDiskActionHandler.Tiles_saturation; // L: 555
|
var10000 = ArchiveDiskActionHandler.Tiles_saturation; // L: 555
|
||||||
var10000[var12] += var44.saturation;
|
var10000[var12] += var44.saturation;
|
||||||
@@ -214,7 +214,7 @@ public class LoginPacket implements class190 {
|
|||||||
var15 = Tiles.field514[var2][var14][var12] & 255; // L: 563
|
var15 = Tiles.field514[var2][var14][var12] & 255; // L: 563
|
||||||
if (var15 > 0) { // L: 564
|
if (var15 > 0) { // L: 564
|
||||||
FloorUnderlayDefinition var45 = WorldMapElement.method4405(var15 - 1); // L: 565
|
FloorUnderlayDefinition var45 = WorldMapElement.method4405(var15 - 1); // L: 565
|
||||||
var10000 = VarbitDefinition.Tiles_hue; // L: 566
|
var10000 = VarbitComposition.Tiles_hue; // L: 566
|
||||||
var10000[var12] -= var45.hue;
|
var10000[var12] -= var45.hue;
|
||||||
var10000 = ArchiveDiskActionHandler.Tiles_saturation; // L: 567
|
var10000 = ArchiveDiskActionHandler.Tiles_saturation; // L: 567
|
||||||
var10000[var12] -= var45.saturation;
|
var10000[var12] -= var45.saturation;
|
||||||
@@ -237,7 +237,7 @@ public class LoginPacket implements class190 {
|
|||||||
for (var17 = -5; var17 < 109; ++var17) { // L: 580
|
for (var17 = -5; var17 < 109; ++var17) { // L: 580
|
||||||
var18 = var17 + 5; // L: 581
|
var18 = var17 + 5; // L: 581
|
||||||
if (var18 >= 0 && var18 < 104) { // L: 582
|
if (var18 >= 0 && var18 < 104) { // L: 582
|
||||||
var12 += VarbitDefinition.Tiles_hue[var18]; // L: 583
|
var12 += VarbitComposition.Tiles_hue[var18]; // L: 583
|
||||||
var13 += ArchiveDiskActionHandler.Tiles_saturation[var18]; // L: 584
|
var13 += ArchiveDiskActionHandler.Tiles_saturation[var18]; // L: 584
|
||||||
var14 += class92.Tiles_lightness[var18]; // L: 585
|
var14 += class92.Tiles_lightness[var18]; // L: 585
|
||||||
var15 += UserComparator7.Tiles_hueMultiplier[var18]; // L: 586
|
var15 += UserComparator7.Tiles_hueMultiplier[var18]; // L: 586
|
||||||
@@ -246,7 +246,7 @@ public class LoginPacket implements class190 {
|
|||||||
|
|
||||||
var19 = var17 - 5; // L: 589
|
var19 = var17 - 5; // L: 589
|
||||||
if (var19 >= 0 && var19 < 104) { // L: 590
|
if (var19 >= 0 && var19 < 104) { // L: 590
|
||||||
var12 -= VarbitDefinition.Tiles_hue[var19]; // L: 591
|
var12 -= VarbitComposition.Tiles_hue[var19]; // L: 591
|
||||||
var13 -= ArchiveDiskActionHandler.Tiles_saturation[var19]; // L: 592
|
var13 -= ArchiveDiskActionHandler.Tiles_saturation[var19]; // L: 592
|
||||||
var14 -= class92.Tiles_lightness[var19]; // L: 593
|
var14 -= class92.Tiles_lightness[var19]; // L: 593
|
||||||
var15 -= UserComparator7.Tiles_hueMultiplier[var19]; // L: 594
|
var15 -= UserComparator7.Tiles_hueMultiplier[var19]; // L: 594
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class Messages {
|
|||||||
garbageValue = "-729014462"
|
garbageValue = "-729014462"
|
||||||
)
|
)
|
||||||
static int method2283(int var0, Script var1, boolean var2) {
|
static int method2283(int var0, Script var1, boolean var2) {
|
||||||
Widget var3 = var2 ? PlayerAppearance.field2561 : VarcInt.field3264; // L: 1012
|
Widget var3 = var2 ? PlayerComposition.field2561 : VarcInt.field3264; // L: 1012
|
||||||
if (var0 == ScriptOpcodes.CC_GETX) { // L: 1013
|
if (var0 == ScriptOpcodes.CC_GETX) { // L: 1013
|
||||||
Interpreter.Interpreter_intStack[++VarcInt.Interpreter_intStackSize - 1] = var3.x; // L: 1014
|
Interpreter.Interpreter_intStack[++VarcInt.Interpreter_intStackSize - 1] = var3.x; // L: 1014
|
||||||
return 1; // L: 1015
|
return 1; // L: 1015
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ public enum ModeWhere implements Enumerated {
|
|||||||
var0 -= 1000; // L: 948
|
var0 -= 1000; // L: 948
|
||||||
var3 = CollisionMap.getWidget(Interpreter.Interpreter_intStack[--VarcInt.Interpreter_intStackSize]); // L: 949
|
var3 = CollisionMap.getWidget(Interpreter.Interpreter_intStack[--VarcInt.Interpreter_intStackSize]); // L: 949
|
||||||
} else {
|
} else {
|
||||||
var3 = var2 ? PlayerAppearance.field2561 : VarcInt.field3264; // L: 951
|
var3 = var2 ? PlayerComposition.field2561 : VarcInt.field3264; // L: 951
|
||||||
}
|
}
|
||||||
|
|
||||||
String var4 = Interpreter.Interpreter_stringStack[--Interpreter.Interpreter_stringStackSize]; // L: 952
|
String var4 = Interpreter.Interpreter_stringStack[--Interpreter.Interpreter_stringStackSize]; // L: 952
|
||||||
@@ -301,7 +301,7 @@ public enum ModeWhere implements Enumerated {
|
|||||||
var4.idleSequence = var4.definition.idleSequence; // L: 7303
|
var4.idleSequence = var4.definition.idleSequence; // L: 7303
|
||||||
var4.turnLeftSequence = var4.definition.turnLeftSequence; // L: 7304
|
var4.turnLeftSequence = var4.definition.turnLeftSequence; // L: 7304
|
||||||
var4.turnRightSequence = var4.definition.turnRightSequence; // L: 7305
|
var4.turnRightSequence = var4.definition.turnRightSequence; // L: 7305
|
||||||
var4.method2106(PlayerAppearance.localPlayer.pathX[0] + var6, PlayerAppearance.localPlayer.pathY[0] + var9, var8 == 1); // L: 7306
|
var4.method2106(PlayerComposition.localPlayer.pathX[0] + var6, PlayerComposition.localPlayer.pathY[0] + var9, var8 == 1); // L: 7306
|
||||||
continue; // L: 7307
|
continue; // L: 7307
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ public final class NetSocket extends AbstractSocket implements Runnable {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (Exception var12) { // L: 154
|
} catch (Exception var12) { // L: 154
|
||||||
PlayerAppearance.RunException_sendStackTrace((String)null, var12); // L: 155
|
PlayerComposition.RunException_sendStackTrace((String)null, var12); // L: 155
|
||||||
}
|
}
|
||||||
|
|
||||||
} // L: 157
|
} // L: 157
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public final class Player extends Actor {
|
|||||||
descriptor = "Lhh;"
|
descriptor = "Lhh;"
|
||||||
)
|
)
|
||||||
@Export("appearance")
|
@Export("appearance")
|
||||||
PlayerAppearance appearance;
|
PlayerComposition appearance;
|
||||||
@ObfuscatedName("x")
|
@ObfuscatedName("x")
|
||||||
@ObfuscatedGetter(
|
@ObfuscatedGetter(
|
||||||
intValue = -1265111393
|
intValue = -1265111393
|
||||||
@@ -278,7 +278,7 @@ public final class Player extends Actor {
|
|||||||
this.username = new Username(var1.readStringCp1252NullTerminated(), GrandExchangeOfferUnitPriceComparator.loginType); // L: 99
|
this.username = new Username(var1.readStringCp1252NullTerminated(), GrandExchangeOfferUnitPriceComparator.loginType); // L: 99
|
||||||
this.clearIsFriend(); // L: 100
|
this.clearIsFriend(); // L: 100
|
||||||
this.clearIsInClanChat(); // L: 101
|
this.clearIsInClanChat(); // L: 101
|
||||||
if (this == PlayerAppearance.localPlayer) { // L: 102
|
if (this == PlayerComposition.localPlayer) { // L: 102
|
||||||
RunException.localPlayerName = this.username.getName();
|
RunException.localPlayerName = this.username.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,7 +290,7 @@ public final class Player extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.appearance == null) { // L: 107
|
if (this.appearance == null) { // L: 107
|
||||||
this.appearance = new PlayerAppearance();
|
this.appearance = new PlayerComposition();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.appearance.update(var4, var9, var2 == 1, var3); // L: 108
|
this.appearance.update(var4, var9, var2 == 1, var3); // L: 108
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ import net.runelite.mapping.ObfuscatedSignature;
|
|||||||
|
|
||||||
@ObfuscatedName("hh")
|
@ObfuscatedName("hh")
|
||||||
@Implements("PlayerAppearance")
|
@Implements("PlayerAppearance")
|
||||||
public class PlayerAppearance {
|
public class PlayerComposition
|
||||||
|
{
|
||||||
@ObfuscatedName("n")
|
@ObfuscatedName("n")
|
||||||
public static short[] field2551;
|
public static short[] field2551;
|
||||||
@ObfuscatedName("l")
|
@ObfuscatedName("l")
|
||||||
@@ -207,7 +207,7 @@ public class Players {
|
|||||||
Client.meslayerContinueWidget = null; // L: 2736
|
Client.meslayerContinueWidget = null; // L: 2736
|
||||||
Client.menuOptionsCount = 0; // L: 2738
|
Client.menuOptionsCount = 0; // L: 2738
|
||||||
Client.isMenuOpen = false; // L: 2739
|
Client.isMenuOpen = false; // L: 2739
|
||||||
Client.playerAppearance.update((int[])null, new int[]{0, 0, 0, 0, 0}, false, -1); // L: 2741
|
Client.playerComposition.update((int[])null, new int[]{0, 0, 0, 0, 0}, false, -1); // L: 2741
|
||||||
|
|
||||||
for (var0 = 0; var0 < 8; ++var0) { // L: 2742
|
for (var0 = 0; var0 < 8; ++var0) { // L: 2742
|
||||||
Client.playerMenuActions[var0] = null; // L: 2743
|
Client.playerMenuActions[var0] = null; // L: 2743
|
||||||
|
|||||||
@@ -381,7 +381,7 @@ public class Scene {
|
|||||||
)
|
)
|
||||||
@Export("newGroundItemPile")
|
@Export("newGroundItemPile")
|
||||||
public void newGroundItemPile(int var1, int var2, int var3, int var4, Renderable var5, long var6, Renderable var8, Renderable var9) {
|
public void newGroundItemPile(int var1, int var2, int var3, int var4, Renderable var5, long var6, Renderable var8, Renderable var9) {
|
||||||
TileItemPile var10 = new TileItemPile(); // L: 202
|
ItemLayer var10 = new ItemLayer(); // L: 202
|
||||||
var10.first = var5; // L: 203
|
var10.first = var5; // L: 203
|
||||||
var10.x = var2 * 128 + 64; // L: 204
|
var10.x = var2 * 128 + 64; // L: 204
|
||||||
var10.y = var3 * 128 + 64; // L: 205
|
var10.y = var3 * 128 + 64; // L: 205
|
||||||
@@ -408,7 +408,7 @@ public class Scene {
|
|||||||
this.tiles[var1][var2][var3] = new Tile(var1, var2, var3); // L: 222
|
this.tiles[var1][var2][var3] = new Tile(var1, var2, var3); // L: 222
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tiles[var1][var2][var3].tileItemPile = var10; // L: 223
|
this.tiles[var1][var2][var3].itemLayer = var10; // L: 223
|
||||||
} // L: 224
|
} // L: 224
|
||||||
|
|
||||||
@ObfuscatedName("l")
|
@ObfuscatedName("l")
|
||||||
@@ -713,7 +713,7 @@ public class Scene {
|
|||||||
public void removeGroundItemPile(int var1, int var2, int var3) {
|
public void removeGroundItemPile(int var1, int var2, int var3) {
|
||||||
Tile var4 = this.tiles[var1][var2][var3]; // L: 407
|
Tile var4 = this.tiles[var1][var2][var3]; // L: 407
|
||||||
if (var4 != null) {
|
if (var4 != null) {
|
||||||
var4.tileItemPile = null; // L: 409
|
var4.itemLayer = null; // L: 409
|
||||||
}
|
}
|
||||||
} // L: 408 410
|
} // L: 408 410
|
||||||
|
|
||||||
@@ -1467,7 +1467,7 @@ public class Scene {
|
|||||||
var22.renderable.draw(0, Scene_cameraPitchSine, Scene_cameraPitchCosine, Scene_cameraYawSine, Scene_cameraYawCosine, var22.x - Scene_cameraX, var22.tileHeight - Scene_cameraY, var22.y - Scene_cameraZ, var22.tag);
|
var22.renderable.draw(0, Scene_cameraPitchSine, Scene_cameraPitchCosine, Scene_cameraYawSine, Scene_cameraYawCosine, var22.x - Scene_cameraX, var22.tileHeight - Scene_cameraY, var22.y - Scene_cameraZ, var22.tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
TileItemPile var23 = var3.tileItemPile; // L: 994
|
ItemLayer var23 = var3.itemLayer; // L: 994
|
||||||
if (var23 != null && var23.height == 0) { // L: 995
|
if (var23 != null && var23.height == 0) { // L: 995
|
||||||
if (var23.second != null) { // L: 996
|
if (var23.second != null) { // L: 996
|
||||||
var23.second.draw(0, Scene_cameraPitchSine, Scene_cameraPitchCosine, Scene_cameraYawSine, Scene_cameraYawCosine, var23.x - Scene_cameraX, var23.tileHeight - Scene_cameraY, var23.y - Scene_cameraZ, var23.tag);
|
var23.second.draw(0, Scene_cameraPitchSine, Scene_cameraPitchCosine, Scene_cameraYawSine, Scene_cameraYawCosine, var23.x - Scene_cameraX, var23.tileHeight - Scene_cameraY, var23.y - Scene_cameraZ, var23.tag);
|
||||||
@@ -1685,7 +1685,7 @@ public class Scene {
|
|||||||
|
|
||||||
var3.drawSecondary = false; // L: 1130
|
var3.drawSecondary = false; // L: 1130
|
||||||
--tileUpdateCount; // L: 1131
|
--tileUpdateCount; // L: 1131
|
||||||
TileItemPile var32 = var3.tileItemPile; // L: 1132
|
ItemLayer var32 = var3.itemLayer; // L: 1132
|
||||||
if (var32 != null && var32.height != 0) { // L: 1133
|
if (var32 != null && var32.height != 0) { // L: 1133
|
||||||
if (var32.second != null) { // L: 1134
|
if (var32.second != null) { // L: 1134
|
||||||
var32.second.draw(0, Scene_cameraPitchSine, Scene_cameraPitchCosine, Scene_cameraYawSine, Scene_cameraYawCosine, var32.x - Scene_cameraX, var32.tileHeight - Scene_cameraY - var32.height, var32.y - Scene_cameraZ, var32.tag);
|
var32.second.draw(0, Scene_cameraPitchSine, Scene_cameraPitchCosine, Scene_cameraYawSine, Scene_cameraYawCosine, var32.x - Scene_cameraX, var32.tileHeight - Scene_cameraY - var32.height, var32.y - Scene_cameraZ, var32.tag);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class ScriptFrame {
|
|||||||
var4 = CollisionMap.getWidget(Interpreter.Interpreter_intStack[--VarcInt.Interpreter_intStackSize]); // L: 778
|
var4 = CollisionMap.getWidget(Interpreter.Interpreter_intStack[--VarcInt.Interpreter_intStackSize]); // L: 778
|
||||||
var3 = false; // L: 779
|
var3 = false; // L: 779
|
||||||
} else {
|
} else {
|
||||||
var4 = var2 ? PlayerAppearance.field2561 : VarcInt.field3264; // L: 781
|
var4 = var2 ? PlayerComposition.field2561 : VarcInt.field3264; // L: 781
|
||||||
}
|
}
|
||||||
|
|
||||||
int var11;
|
int var11;
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ public class SecureRandomFuture {
|
|||||||
var6 = -var4.targetIndex - 1; // L: 4326
|
var6 = -var4.targetIndex - 1; // L: 4326
|
||||||
Player var36;
|
Player var36;
|
||||||
if (var6 == Client.localPlayerIndex) { // L: 4327
|
if (var6 == Client.localPlayerIndex) { // L: 4327
|
||||||
var36 = PlayerAppearance.localPlayer;
|
var36 = PlayerComposition.localPlayer;
|
||||||
} else {
|
} else {
|
||||||
var36 = Client.players[var6]; // L: 4328
|
var36 = Client.players[var6]; // L: 4328
|
||||||
}
|
}
|
||||||
@@ -196,8 +196,8 @@ public class SecureRandomFuture {
|
|||||||
class69.cameraZ = var8 - var14; // L: 4377
|
class69.cameraZ = var8 - var14; // L: 4377
|
||||||
Skeleton.cameraPitch = var28; // L: 4378
|
Skeleton.cameraPitch = var28; // L: 4378
|
||||||
AbstractArchive.cameraYaw = var5; // L: 4379
|
AbstractArchive.cameraYaw = var5; // L: 4379
|
||||||
if (Client.oculusOrbState == 1 && Client.staffModLevel >= 2 && Client.cycle % 50 == 0 && (oculusOrbFocalPointX >> 7 != PlayerAppearance.localPlayer.x >> 7 || Decimator.oculusOrbFocalPointY >> 7 != PlayerAppearance.localPlayer.y >> 7)) { // L: 4380 4381
|
if (Client.oculusOrbState == 1 && Client.staffModLevel >= 2 && Client.cycle % 50 == 0 && (oculusOrbFocalPointX >> 7 != PlayerComposition.localPlayer.x >> 7 || Decimator.oculusOrbFocalPointY >> 7 != PlayerComposition.localPlayer.y >> 7)) { // L: 4380 4381
|
||||||
var15 = PlayerAppearance.localPlayer.plane; // L: 4382
|
var15 = PlayerComposition.localPlayer.plane; // L: 4382
|
||||||
var16 = (oculusOrbFocalPointX >> 7) + NetFileRequest.baseX; // L: 4383
|
var16 = (oculusOrbFocalPointX >> 7) + NetFileRequest.baseX; // L: 4383
|
||||||
var17 = (Decimator.oculusOrbFocalPointY >> 7) + class41.baseY; // L: 4384
|
var17 = (Decimator.oculusOrbFocalPointY >> 7) + class41.baseY; // L: 4384
|
||||||
PacketBufferNode var18 = ItemContainer.getPacketBufferNode(ClientPacket.field2269, Client.packetWriter.isaacCipher); // L: 4387
|
PacketBufferNode var18 = ItemContainer.getPacketBufferNode(ClientPacket.field2269, Client.packetWriter.isaacCipher); // L: 4387
|
||||||
@@ -220,8 +220,8 @@ public class SecureRandomFuture {
|
|||||||
var7 = oculusOrbFocalPointX >> 7; // L: 4411
|
var7 = oculusOrbFocalPointX >> 7; // L: 4411
|
||||||
var8 = Decimator.oculusOrbFocalPointY >> 7; // L: 4412
|
var8 = Decimator.oculusOrbFocalPointY >> 7; // L: 4412
|
||||||
} else {
|
} else {
|
||||||
var7 = PlayerAppearance.localPlayer.x >> 7; // L: 4415
|
var7 = PlayerComposition.localPlayer.x >> 7; // L: 4415
|
||||||
var8 = PlayerAppearance.localPlayer.y >> 7; // L: 4416
|
var8 = PlayerComposition.localPlayer.y >> 7; // L: 4416
|
||||||
}
|
}
|
||||||
|
|
||||||
var9 = Player.cameraX >> 7; // L: 4418
|
var9 = Player.cameraX >> 7; // L: 4418
|
||||||
@@ -313,8 +313,8 @@ public class SecureRandomFuture {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PlayerAppearance.localPlayer.x >= 0 && PlayerAppearance.localPlayer.y >= 0 && PlayerAppearance.localPlayer.x < 13312 && PlayerAppearance.localPlayer.y < 13312) { // L: 4468
|
if (PlayerComposition.localPlayer.x >= 0 && PlayerComposition.localPlayer.y >= 0 && PlayerComposition.localPlayer.x < 13312 && PlayerComposition.localPlayer.y < 13312) { // L: 4468
|
||||||
if ((Tiles.Tiles_renderFlags[GameObject.Client_plane][PlayerAppearance.localPlayer.x >> 7][PlayerAppearance.localPlayer.y >> 7] & 4) != 0) { // L: 4472
|
if ((Tiles.Tiles_renderFlags[GameObject.Client_plane][PlayerComposition.localPlayer.x >> 7][PlayerComposition.localPlayer.y >> 7] & 4) != 0) { // L: 4472
|
||||||
var6 = GameObject.Client_plane;
|
var6 = GameObject.Client_plane;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -409,7 +409,7 @@ public class SecureRandomFuture {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (var32 == PlayerAppearance.localPlayer) { // L: 4537
|
if (var32 == PlayerComposition.localPlayer) { // L: 4537
|
||||||
var15 = var30; // L: 4538
|
var15 = var30; // L: 4538
|
||||||
continue; // L: 4539
|
continue; // L: 4539
|
||||||
}
|
}
|
||||||
@@ -421,7 +421,7 @@ public class SecureRandomFuture {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Client.renderSelf && var15 != -1) { // L: 4545
|
if (Client.renderSelf && var15 != -1) { // L: 4545
|
||||||
AbstractWorldMapIcon.drawActor2d(PlayerAppearance.localPlayer, var15, var0, var1, var2, var3); // L: 4546
|
AbstractWorldMapIcon.drawActor2d(PlayerComposition.localPlayer, var15, var0, var1, var2, var3); // L: 4546
|
||||||
}
|
}
|
||||||
|
|
||||||
if (var34) { // L: 4548
|
if (var34) { // L: 4548
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class SoundSystem implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception var4) { // L: 17
|
} catch (Exception var4) { // L: 17
|
||||||
PlayerAppearance.RunException_sendStackTrace((String)null, var4); // L: 18
|
PlayerComposition.RunException_sendStackTrace((String)null, var4); // L: 18
|
||||||
}
|
}
|
||||||
|
|
||||||
} // L: 20
|
} // L: 20
|
||||||
|
|||||||
@@ -65,8 +65,8 @@ public final class Tile extends Node {
|
|||||||
@ObfuscatedSignature(
|
@ObfuscatedSignature(
|
||||||
descriptor = "Ldz;"
|
descriptor = "Ldz;"
|
||||||
)
|
)
|
||||||
@Export("tileItemPile")
|
@Export("itemLayer")
|
||||||
TileItemPile tileItemPile;
|
ItemLayer itemLayer;
|
||||||
@ObfuscatedName("u")
|
@ObfuscatedName("u")
|
||||||
@ObfuscatedGetter(
|
@ObfuscatedGetter(
|
||||||
intValue = 418075799
|
intValue = 418075799
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ public final class TileItem extends Renderable
|
|||||||
int var8;
|
int var8;
|
||||||
if (var0.combatLevel != 0) { // L: 8725
|
if (var0.combatLevel != 0) { // L: 8725
|
||||||
var7 = var0.combatLevel; // L: 8728
|
var7 = var0.combatLevel; // L: 8728
|
||||||
var8 = PlayerAppearance.localPlayer.combatLevel; // L: 8729
|
var8 = PlayerComposition.localPlayer.combatLevel; // L: 8729
|
||||||
int var9 = var8 - var7; // L: 8731
|
int var9 = var8 - var7; // L: 8731
|
||||||
String var6;
|
String var6;
|
||||||
if (var9 < -9) { // L: 8732
|
if (var9 < -9) { // L: 8732
|
||||||
@@ -253,7 +253,7 @@ public final class TileItem extends Renderable
|
|||||||
if (var11[var7] != null && var11[var7].equalsIgnoreCase("Attack")) { // L: 8801
|
if (var11[var7] != null && var11[var7].equalsIgnoreCase("Attack")) { // L: 8801
|
||||||
short var12 = 0; // L: 8802
|
short var12 = 0; // L: 8802
|
||||||
if (AttackOption.AttackOption_hidden != Client.npcAttackOption) { // L: 8803
|
if (AttackOption.AttackOption_hidden != Client.npcAttackOption) { // L: 8803
|
||||||
if (Client.npcAttackOption == AttackOption.AttackOption_alwaysRightClick || AttackOption.AttackOption_dependsOnCombatLevels == Client.npcAttackOption && var0.combatLevel > PlayerAppearance.localPlayer.combatLevel) { // L: 8804
|
if (Client.npcAttackOption == AttackOption.AttackOption_alwaysRightClick || AttackOption.AttackOption_dependsOnCombatLevels == Client.npcAttackOption && var0.combatLevel > PlayerComposition.localPlayer.combatLevel) { // L: 8804
|
||||||
var12 = 2000; // L: 8805
|
var12 = 2000; // L: 8805
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ public class UrlRequester implements Runnable {
|
|||||||
|
|
||||||
}
|
}
|
||||||
} catch (Exception var17) {
|
} catch (Exception var17) {
|
||||||
PlayerAppearance.RunException_sendStackTrace((String)null, var17);
|
PlayerComposition.RunException_sendStackTrace((String)null, var17);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ public class UserComparator4 implements Comparator {
|
|||||||
var9 = var1.method5572(); // L: 6657
|
var9 = var1.method5572(); // L: 6657
|
||||||
if (var4 >= 0 && var5 >= 0 && var4 < 104 && var5 < 104) { // L: 6658
|
if (var4 >= 0 && var5 >= 0 && var4 < 104 && var5 < 104) { // L: 6658
|
||||||
var10 = var7 + 1; // L: 6659
|
var10 = var7 + 1; // L: 6659
|
||||||
if (PlayerAppearance.localPlayer.pathX[0] >= var4 - var10 && PlayerAppearance.localPlayer.pathX[0] <= var10 + var4 && PlayerAppearance.localPlayer.pathY[0] >= var5 - var10 && PlayerAppearance.localPlayer.pathY[0] <= var5 + var10 && Timer.clientPreferences.areaSoundEffectsVolume != 0 && var8 > 0 && Client.soundEffectCount < 50) { // L: 6660 6661
|
if (PlayerComposition.localPlayer.pathX[0] >= var4 - var10 && PlayerComposition.localPlayer.pathX[0] <= var10 + var4 && PlayerComposition.localPlayer.pathY[0] >= var5 - var10 && PlayerComposition.localPlayer.pathY[0] <= var5 + var10 && Timer.clientPreferences.areaSoundEffectsVolume != 0 && var8 > 0 && Client.soundEffectCount < 50) { // L: 6660 6661
|
||||||
Client.soundEffectIds[Client.soundEffectCount] = var2; // L: 6662
|
Client.soundEffectIds[Client.soundEffectCount] = var2; // L: 6662
|
||||||
Client.queuedSoundEffectLoops[Client.soundEffectCount] = var8; // L: 6663
|
Client.queuedSoundEffectLoops[Client.soundEffectCount] = var8; // L: 6663
|
||||||
Client.queuedSoundEffectDelays[Client.soundEffectCount] = var9; // L: 6664
|
Client.queuedSoundEffectDelays[Client.soundEffectCount] = var9; // L: 6664
|
||||||
@@ -324,7 +324,7 @@ public class UserComparator4 implements Comparator {
|
|||||||
byte var16 = var1.readByte(); // L: 6850
|
byte var16 = var1.readByte(); // L: 6850
|
||||||
Player var17;
|
Player var17;
|
||||||
if (var13 == Client.localPlayerIndex) { // L: 6852
|
if (var13 == Client.localPlayerIndex) { // L: 6852
|
||||||
var17 = PlayerAppearance.localPlayer;
|
var17 = PlayerComposition.localPlayer;
|
||||||
} else {
|
} else {
|
||||||
var17 = Client.players[var13]; // L: 6853
|
var17 = Client.players[var13]; // L: 6853
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,8 +171,8 @@ public class UserComparator5 extends AbstractUserComparator {
|
|||||||
int var8 = Rasterizer3D.Rasterizer3D_cosine[var6]; // L: 3795
|
int var8 = Rasterizer3D.Rasterizer3D_cosine[var6]; // L: 3795
|
||||||
int var9 = var4 * var8 + var7 * var5 >> 11; // L: 3796
|
int var9 = var4 * var8 + var7 * var5 >> 11; // L: 3796
|
||||||
int var10 = var8 * var5 - var7 * var4 >> 11; // L: 3797
|
int var10 = var8 * var5 - var7 * var4 >> 11; // L: 3797
|
||||||
int var11 = var9 + PlayerAppearance.localPlayer.x >> 7; // L: 3798
|
int var11 = var9 + PlayerComposition.localPlayer.x >> 7; // L: 3798
|
||||||
int var12 = PlayerAppearance.localPlayer.y - var10 >> 7; // L: 3799
|
int var12 = PlayerComposition.localPlayer.y - var10 >> 7; // L: 3799
|
||||||
PacketBufferNode var13 = ItemContainer.getPacketBufferNode(ClientPacket.field2272, Client.packetWriter.isaacCipher); // L: 3801
|
PacketBufferNode var13 = ItemContainer.getPacketBufferNode(ClientPacket.field2272, Client.packetWriter.isaacCipher); // L: 3801
|
||||||
var13.packetBuffer.writeByte(18); // L: 3802
|
var13.packetBuffer.writeByte(18); // L: 3802
|
||||||
var13.packetBuffer.method5739(var11 + NetFileRequest.baseX); // L: 3803
|
var13.packetBuffer.method5739(var11 + NetFileRequest.baseX); // L: 3803
|
||||||
@@ -185,8 +185,8 @@ public class UserComparator5 extends AbstractUserComparator {
|
|||||||
var13.packetBuffer.writeByte(0); // L: 3810
|
var13.packetBuffer.writeByte(0); // L: 3810
|
||||||
var13.packetBuffer.writeByte(0); // L: 3811
|
var13.packetBuffer.writeByte(0); // L: 3811
|
||||||
var13.packetBuffer.writeByte(89); // L: 3812
|
var13.packetBuffer.writeByte(89); // L: 3812
|
||||||
var13.packetBuffer.writeShort(PlayerAppearance.localPlayer.x); // L: 3813
|
var13.packetBuffer.writeShort(PlayerComposition.localPlayer.x); // L: 3813
|
||||||
var13.packetBuffer.writeShort(PlayerAppearance.localPlayer.y); // L: 3814
|
var13.packetBuffer.writeShort(PlayerComposition.localPlayer.y); // L: 3814
|
||||||
var13.packetBuffer.writeByte(63); // L: 3815
|
var13.packetBuffer.writeByte(63); // L: 3815
|
||||||
Client.packetWriter.addNode(var13); // L: 3816
|
Client.packetWriter.addNode(var13); // L: 3816
|
||||||
Client.destinationX = var11; // L: 3817
|
Client.destinationX = var11; // L: 3817
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class UserComparator9 extends AbstractUserComparator {
|
|||||||
var0 -= 1000; // L: 735
|
var0 -= 1000; // L: 735
|
||||||
var3 = CollisionMap.getWidget(Interpreter.Interpreter_intStack[--VarcInt.Interpreter_intStackSize]); // L: 736
|
var3 = CollisionMap.getWidget(Interpreter.Interpreter_intStack[--VarcInt.Interpreter_intStackSize]); // L: 736
|
||||||
} else {
|
} else {
|
||||||
var3 = var2 ? PlayerAppearance.field2561 : VarcInt.field3264; // L: 738
|
var3 = var2 ? PlayerComposition.field2561 : VarcInt.field3264; // L: 738
|
||||||
}
|
}
|
||||||
|
|
||||||
CollisionMap.invalidateWidget(var3); // L: 739
|
CollisionMap.invalidateWidget(var3); // L: 739
|
||||||
@@ -75,7 +75,7 @@ public class UserComparator9 extends AbstractUserComparator {
|
|||||||
return 1; // L: 763
|
return 1; // L: 763
|
||||||
} else if (var0 == ScriptOpcodes.CC_SETPLAYERHEAD_SELF) { // L: 765
|
} else if (var0 == ScriptOpcodes.CC_SETPLAYERHEAD_SELF) { // L: 765
|
||||||
var3.modelType = 3; // L: 766
|
var3.modelType = 3; // L: 766
|
||||||
var3.modelId = PlayerAppearance.localPlayer.appearance.getChatHeadId(); // L: 767
|
var3.modelId = PlayerComposition.localPlayer.appearance.getChatHeadId(); // L: 767
|
||||||
return 1; // L: 768
|
return 1; // L: 768
|
||||||
} else {
|
} else {
|
||||||
return 2; // L: 770
|
return 2; // L: 770
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class Username implements Comparable {
|
|||||||
)
|
)
|
||||||
public Username(String var1, LoginType var2) {
|
public Username(String var1, LoginType var2) {
|
||||||
this.name = var1; // L: 11
|
this.name = var1; // L: 11
|
||||||
this.cleanName = VarbitDefinition.method4525(var1, var2); // L: 12
|
this.cleanName = VarbitComposition.method4525(var1, var2); // L: 12
|
||||||
} // L: 13
|
} // L: 13
|
||||||
|
|
||||||
@ObfuscatedName("h")
|
@ObfuscatedName("h")
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import net.runelite.mapping.ObfuscatedName;
|
|||||||
import net.runelite.mapping.ObfuscatedSignature;
|
import net.runelite.mapping.ObfuscatedSignature;
|
||||||
|
|
||||||
@ObfuscatedName("iv")
|
@ObfuscatedName("iv")
|
||||||
@Implements("VarbitDefinition")
|
@Implements("VarbitComposition")
|
||||||
public class VarbitDefinition extends DualNode {
|
public class VarbitComposition extends DualNode {
|
||||||
@ObfuscatedName("h")
|
@ObfuscatedName("h")
|
||||||
@ObfuscatedSignature(
|
@ObfuscatedSignature(
|
||||||
descriptor = "Lib;"
|
descriptor = "Lib;"
|
||||||
@@ -1363,7 +1363,7 @@ public class Widget extends Node {
|
|||||||
garbageValue = "-2117213889"
|
garbageValue = "-2117213889"
|
||||||
)
|
)
|
||||||
@Export("getModel")
|
@Export("getModel")
|
||||||
public Model getModel(SequenceDefinition var1, int var2, boolean var3, PlayerAppearance var4) {
|
public Model getModel(SequenceDefinition var1, int var2, boolean var3, PlayerComposition var4) {
|
||||||
field2603 = false; // L: 578
|
field2603 = false; // L: 578
|
||||||
int var5;
|
int var5;
|
||||||
int var6;
|
int var6;
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ public class WorldMapCacheName {
|
|||||||
static Archive newArchive(int var0, boolean var1, boolean var2, boolean var3) {
|
static Archive newArchive(int var0, boolean var1, boolean var2, boolean var3) {
|
||||||
ArchiveDisk var4 = null; // L: 2195
|
ArchiveDisk var4 = null; // L: 2195
|
||||||
if (JagexCache.JagexCache_dat2File != null) { // L: 2196
|
if (JagexCache.JagexCache_dat2File != null) { // L: 2196
|
||||||
var4 = new ArchiveDisk(var0, JagexCache.JagexCache_dat2File, PlayerAppearance.JagexCache_idxFiles[var0], 1000000);
|
var4 = new ArchiveDisk(var0, JagexCache.JagexCache_dat2File, PlayerComposition.JagexCache_idxFiles[var0], 1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Archive(var4, class7.masterDisk, var0, var1, var2, var3); // L: 2197
|
return new Archive(var4, class7.masterDisk, var0, var1, var2, var3); // L: 2197
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ public class WorldMapData_0 extends AbstractWorldMapData {
|
|||||||
)
|
)
|
||||||
public static void method237() {
|
public static void method237() {
|
||||||
try {
|
try {
|
||||||
File var0 = new File(TileItemPile.userHomeDirectory, "random.dat"); // L: 212
|
File var0 = new File(ItemLayer.userHomeDirectory, "random.dat"); // L: 212
|
||||||
int var2;
|
int var2;
|
||||||
if (var0.exists()) { // L: 213
|
if (var0.exists()) { // L: 213
|
||||||
JagexCache.JagexCache_randomDat = new BufferedFile(new AccessFile(var0, "rw", 25L), 24, 0); // L: 214
|
JagexCache.JagexCache_randomDat = new BufferedFile(new AccessFile(var0, "rw", 25L), 24, 0); // L: 214
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ public class WorldMapData_1 extends AbstractWorldMapData {
|
|||||||
var4 = Interpreter.Interpreter_intStack[--VarcInt.Interpreter_intStackSize]; // L: 553
|
var4 = Interpreter.Interpreter_intStack[--VarcInt.Interpreter_intStackSize]; // L: 553
|
||||||
var3 = CollisionMap.getWidget(var4); // L: 554
|
var3 = CollisionMap.getWidget(var4); // L: 554
|
||||||
} else {
|
} else {
|
||||||
var3 = var2 ? PlayerAppearance.field2561 : VarcInt.field3264; // L: 556
|
var3 = var2 ? PlayerComposition.field2561 : VarcInt.field3264; // L: 556
|
||||||
}
|
}
|
||||||
|
|
||||||
if (var0 == ScriptOpcodes.CC_SETSCROLLPOS) { // L: 557
|
if (var0 == ScriptOpcodes.CC_SETSCROLLPOS) { // L: 557
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user