Add graphics objects to devtools
This commit is contained in:
@@ -39,6 +39,7 @@ import net.runelite.api.Actor;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.DecorativeObject;
|
||||
import net.runelite.api.GameObject;
|
||||
import net.runelite.api.GraphicsObject;
|
||||
import net.runelite.api.GroundObject;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemLayer;
|
||||
@@ -47,6 +48,7 @@ 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.Region;
|
||||
import net.runelite.api.Tile;
|
||||
@@ -124,6 +126,11 @@ public class DevToolsOverlay extends Overlay
|
||||
renderProjectiles(graphics);
|
||||
}
|
||||
|
||||
if (plugin.isToggleGraphicsObjects())
|
||||
{
|
||||
renderGraphicsObjects(graphics);
|
||||
}
|
||||
|
||||
renderWidgets(graphics);
|
||||
|
||||
return null;
|
||||
@@ -385,6 +392,30 @@ public class DevToolsOverlay extends Overlay
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void renderWidgets(Graphics2D graphics)
|
||||
{
|
||||
Widget widget = plugin.currentWidget;
|
||||
|
||||
@@ -196,6 +196,14 @@ public class DevToolsPanel extends PluginPanel
|
||||
});
|
||||
container.add(lineOfSightBtn);
|
||||
|
||||
final JButton graphicsObjectsBtn = new JButton("Graphics objects");
|
||||
graphicsObjectsBtn.addActionListener(e ->
|
||||
{
|
||||
highlightButton(graphicsObjectsBtn);
|
||||
plugin.toggleGraphicsObjects();
|
||||
});
|
||||
container.add(graphicsObjectsBtn);
|
||||
|
||||
return container;
|
||||
}
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ public class DevToolsPlugin extends Plugin
|
||||
private boolean toggleMapSquares;
|
||||
private boolean toggleValidMovement;
|
||||
private boolean toggleLineOfSight;
|
||||
private boolean toggleGraphicsObjects;
|
||||
|
||||
Widget currentWidget;
|
||||
int itemIndex = -1;
|
||||
@@ -301,6 +302,11 @@ public class DevToolsPlugin extends Plugin
|
||||
toggleLineOfSight = !toggleLineOfSight;
|
||||
}
|
||||
|
||||
void toggleGraphicsObjects()
|
||||
{
|
||||
toggleGraphicsObjects = !toggleGraphicsObjects;
|
||||
}
|
||||
|
||||
boolean isTogglePlayers()
|
||||
{
|
||||
return togglePlayers;
|
||||
@@ -370,4 +376,9 @@ public class DevToolsPlugin extends Plugin
|
||||
{
|
||||
return toggleLineOfSight;
|
||||
}
|
||||
|
||||
boolean isToggleGraphicsObjects()
|
||||
{
|
||||
return toggleGraphicsObjects;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user