Revert "devtools: remove inventory tool"
This reverts commit 8b3f129c1e.
This commit is contained in:
@@ -28,9 +28,12 @@ package net.runelite.client.plugins.devtools;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
|
import java.awt.FontMetrics;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Polygon;
|
import java.awt.Polygon;
|
||||||
|
import java.awt.Rectangle;
|
||||||
import java.awt.Shape;
|
import java.awt.Shape;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -56,6 +59,9 @@ import net.runelite.api.TileItem;
|
|||||||
import net.runelite.api.TileObject;
|
import net.runelite.api.TileObject;
|
||||||
import net.runelite.api.coords.LocalPoint;
|
import net.runelite.api.coords.LocalPoint;
|
||||||
import net.runelite.api.coords.WorldPoint;
|
import net.runelite.api.coords.WorldPoint;
|
||||||
|
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.FontManager;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
@@ -116,6 +122,11 @@ class DevToolsOverlay extends Overlay
|
|||||||
renderTileObjects(graphics);
|
renderTileObjects(graphics);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (plugin.getInventory().isActive())
|
||||||
|
{
|
||||||
|
renderInventory(graphics);
|
||||||
|
}
|
||||||
|
|
||||||
if (plugin.getProjectiles().isActive())
|
if (plugin.getProjectiles().isActive())
|
||||||
{
|
{
|
||||||
renderProjectiles(graphics);
|
renderProjectiles(graphics);
|
||||||
@@ -401,6 +412,35 @@ class DevToolsOverlay extends Overlay
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
private void renderProjectiles(Graphics2D graphics)
|
||||||
{
|
{
|
||||||
for (Projectile projectile : client.getProjectiles())
|
for (Projectile projectile : client.getProjectiles())
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ class DevToolsPanel extends PluginPanel
|
|||||||
container.add(plugin.getWalls());
|
container.add(plugin.getWalls());
|
||||||
container.add(plugin.getDecorations());
|
container.add(plugin.getDecorations());
|
||||||
|
|
||||||
|
container.add(plugin.getInventory());
|
||||||
container.add(plugin.getProjectiles());
|
container.add(plugin.getProjectiles());
|
||||||
|
|
||||||
container.add(plugin.getLocation());
|
container.add(plugin.getLocation());
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ public class DevToolsPlugin extends Plugin
|
|||||||
private DevToolsButton graphicsObjects;
|
private DevToolsButton graphicsObjects;
|
||||||
private DevToolsButton walls;
|
private DevToolsButton walls;
|
||||||
private DevToolsButton decorations;
|
private DevToolsButton decorations;
|
||||||
|
private DevToolsButton inventory;
|
||||||
private DevToolsButton projectiles;
|
private DevToolsButton projectiles;
|
||||||
private DevToolsButton location;
|
private DevToolsButton location;
|
||||||
private DevToolsButton chunkBorders;
|
private DevToolsButton chunkBorders;
|
||||||
@@ -167,6 +168,7 @@ public class DevToolsPlugin extends Plugin
|
|||||||
walls = new DevToolsButton("Walls");
|
walls = new DevToolsButton("Walls");
|
||||||
decorations = new DevToolsButton("Decorations");
|
decorations = new DevToolsButton("Decorations");
|
||||||
|
|
||||||
|
inventory = new DevToolsButton("Inventory");
|
||||||
projectiles = new DevToolsButton("Projectiles");
|
projectiles = new DevToolsButton("Projectiles");
|
||||||
|
|
||||||
location = new DevToolsButton("Location");
|
location = new DevToolsButton("Location");
|
||||||
|
|||||||
Reference in New Issue
Block a user