Gazivodag master (#10)
* Transform objects now use an interface * Plugins can now accept colors (not my code) * mixins: renderWidgetLayer: skip hidden widgets * World Map: Identify Both Shield of Arrav Quest Start Points (#8442) Closes #8437 * widgetitem: associate Widget with WidgetItem * widgetitem overlay: allow configuring which interfaces to overlay Update overlays to behave consistent with how they behaved before removal of query api, with the exception of adding the rune pouch overlay to the bank. * Update .gitignore * Revert "Adding external plugin support (#4)" This reverts commitbfe1482* Update QuestStartLocation.java * Revert "Plugins update (#7)" This reverts commit216f7d9* Adding external plugin support (#4) * Adding archetype * Update RuneLiteConfig.java * Update Plugin.java * Update PluginManager.java * Adding pluginwatcher & classloader * Update RuneLite.java * Update pom.xml * Update settings.xml * Update pom.xml * Update pom.xml * Removing old example plugin * Fixing the fix of the fix for plugin archetype. (cherry picked from commitbfe1482705) * Plugins can now accept colors (not my code) (cherry picked from commit8e094f7386) * Update MenuEntrySwapperConfig.java
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -8,3 +8,7 @@ project.properties
|
|||||||
.project
|
.project
|
||||||
.settings/
|
.settings/
|
||||||
.classpath
|
.classpath
|
||||||
|
runelite-client/src/main/resources/META-INF/MANIFEST.MF
|
||||||
|
git
|
||||||
|
classes/artifacts/client_jar/run.bat
|
||||||
|
classes/artifacts/client_jar/client.jar
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ package net.runelite.api.widgets;
|
|||||||
|
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import net.runelite.api.Point;
|
import net.runelite.api.Point;
|
||||||
|
|
||||||
@@ -34,55 +35,34 @@ import net.runelite.api.Point;
|
|||||||
*/
|
*/
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@ToString
|
@ToString
|
||||||
|
@Getter
|
||||||
public class WidgetItem
|
public class WidgetItem
|
||||||
{
|
{
|
||||||
private final int id;
|
|
||||||
private final int quantity;
|
|
||||||
private final int index;
|
|
||||||
private final Rectangle canvasBounds;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the ID of the item represented.
|
* The ID of the item represented.
|
||||||
*
|
*
|
||||||
* @return the items ID
|
|
||||||
* @see net.runelite.api.ItemID
|
* @see net.runelite.api.ItemID
|
||||||
*/
|
*/
|
||||||
public int getId()
|
private final int id;
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the quantity of the represented item.
|
* The quantity of the represented item.
|
||||||
*
|
|
||||||
* @return the items quantity
|
|
||||||
*/
|
*/
|
||||||
public int getQuantity()
|
private final int quantity;
|
||||||
{
|
|
||||||
return quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the index position of this WidgetItem inside its parents
|
* The index position of this WidgetItem inside its parents
|
||||||
* WidgetItem array.
|
* WidgetItem array.
|
||||||
*
|
*
|
||||||
* @return the index in the parent widget
|
|
||||||
* @see Widget#getWidgetItems()
|
* @see Widget#getWidgetItems()
|
||||||
*/
|
*/
|
||||||
public int getIndex()
|
private final int index;
|
||||||
{
|
|
||||||
return index;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the area where the widget is drawn on the canvas.
|
* The area where the widget is drawn on the canvas.
|
||||||
*
|
|
||||||
* @return the occupied area of the widget
|
|
||||||
*/
|
*/
|
||||||
public Rectangle getCanvasBounds()
|
private final Rectangle canvasBounds;
|
||||||
{
|
/**
|
||||||
return canvasBounds;
|
* The widget which contains this item.
|
||||||
}
|
*/
|
||||||
|
private final Widget widget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the upper-left coordinate of where the widget is being drawn
|
* Gets the upper-left coordinate of where the widget is being drawn
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ public class InventoryTagsOverlay extends WidgetItemOverlay
|
|||||||
{
|
{
|
||||||
this.itemManager = itemManager;
|
this.itemManager = itemManager;
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
showOnEquipment();
|
||||||
|
showOnInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ class ItemChargeOverlay extends WidgetItemOverlay
|
|||||||
{
|
{
|
||||||
this.itemChargePlugin = itemChargePlugin;
|
this.itemChargePlugin = itemChargePlugin;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
showOnInventory();
|
||||||
|
showOnEquipment();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018, Adam <Adam@sigterm.info>
|
* Copyright (c) 2018, Adam <Adam@sigterm.info>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -69,6 +69,8 @@ public class RunepouchOverlay extends WidgetItemOverlay
|
|||||||
this.tooltipManager = tooltipManager;
|
this.tooltipManager = tooltipManager;
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
showOnInventory();
|
||||||
|
showOnBank();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -87,6 +87,8 @@ class SlayerOverlay extends WidgetItemOverlay
|
|||||||
{
|
{
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
showOnInventory();
|
||||||
|
showOnEquipment();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -46,7 +46,10 @@ enum QuestStartLocation
|
|||||||
THE_RESTLESS_GHOST("The Restless Ghost", new WorldPoint(3240, 3210, 0)),
|
THE_RESTLESS_GHOST("The Restless Ghost", new WorldPoint(3240, 3210, 0)),
|
||||||
RUNE_MYSTERIES("Rune Mysteries", new WorldPoint(3210, 3220, 0)),
|
RUNE_MYSTERIES("Rune Mysteries", new WorldPoint(3210, 3220, 0)),
|
||||||
SHEEP_SHEARER("Sheep Shearer", new WorldPoint(3190, 3272, 0)),
|
SHEEP_SHEARER("Sheep Shearer", new WorldPoint(3190, 3272, 0)),
|
||||||
SHIELD_OF_ARRAV("Shield of Arrav", new WorldPoint(3208, 3495, 0)),
|
|
||||||
|
SHIELD_OF_ARRAV_PHOENIX_GANG("Shield of Arrav (Phoenix Gang)", new WorldPoint(3208, 3495, 0)),
|
||||||
|
SHIELD_OF_ARRAV_BLACK_ARM_GANG("Shield of Arrav (Black Arm Gang)", new WorldPoint(3208, 3392, 0)),
|
||||||
|
|
||||||
VAMPIRE_SLAYER("Vampire Slayer", new WorldPoint(3096, 3266, 0)),
|
VAMPIRE_SLAYER("Vampire Slayer", new WorldPoint(3096, 3266, 0)),
|
||||||
WITCHS_POTION("Witch's Potion", new WorldPoint(2967, 3203, 0)),
|
WITCHS_POTION("Witch's Potion", new WorldPoint(2967, 3203, 0)),
|
||||||
X_MARKS_THE_SPOT("X Marks the Spot", new WorldPoint(3227, 3242, 0)),
|
X_MARKS_THE_SPOT("X Marks the Spot", new WorldPoint(3227, 3242, 0)),
|
||||||
|
|||||||
@@ -26,15 +26,33 @@ package net.runelite.client.ui.overlay;
|
|||||||
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import net.runelite.api.widgets.Widget;
|
||||||
|
import static net.runelite.api.widgets.WidgetID.BANK_GROUP_ID;
|
||||||
|
import static net.runelite.api.widgets.WidgetID.BANK_INVENTORY_GROUP_ID;
|
||||||
|
import static net.runelite.api.widgets.WidgetID.DEPOSIT_BOX_GROUP_ID;
|
||||||
|
import static net.runelite.api.widgets.WidgetID.EQUIPMENT_GROUP_ID;
|
||||||
|
import static net.runelite.api.widgets.WidgetID.EQUIPMENT_INVENTORY_GROUP_ID;
|
||||||
|
import static net.runelite.api.widgets.WidgetID.GRAND_EXCHANGE_INVENTORY_GROUP_ID;
|
||||||
|
import static net.runelite.api.widgets.WidgetID.GUIDE_PRICES_INVENTORY_GROUP_ID;
|
||||||
|
import static net.runelite.api.widgets.WidgetID.INVENTORY_GROUP_ID;
|
||||||
|
import static net.runelite.api.widgets.WidgetID.SHOP_INVENTORY_GROUP_ID;
|
||||||
|
import static net.runelite.api.widgets.WidgetInfo.TO_GROUP;
|
||||||
import net.runelite.api.widgets.WidgetItem;
|
import net.runelite.api.widgets.WidgetItem;
|
||||||
|
|
||||||
public abstract class WidgetItemOverlay extends Overlay
|
public abstract class WidgetItemOverlay extends Overlay
|
||||||
{
|
{
|
||||||
@Setter(AccessLevel.PACKAGE)
|
@Setter(AccessLevel.PACKAGE)
|
||||||
private OverlayManager overlayManager;
|
private OverlayManager overlayManager;
|
||||||
|
/**
|
||||||
|
* Interfaces to draw overlay over.
|
||||||
|
*/
|
||||||
|
private final Set<Integer> interfaceGroups = new HashSet<>();
|
||||||
|
|
||||||
protected WidgetItemOverlay()
|
protected WidgetItemOverlay()
|
||||||
{
|
{
|
||||||
@@ -49,13 +67,49 @@ public abstract class WidgetItemOverlay extends Overlay
|
|||||||
public Dimension render(Graphics2D graphics)
|
public Dimension render(Graphics2D graphics)
|
||||||
{
|
{
|
||||||
final List<WidgetItem> itemWidgets = overlayManager.getItemWidgets();
|
final List<WidgetItem> itemWidgets = overlayManager.getItemWidgets();
|
||||||
for (WidgetItem widget : itemWidgets)
|
for (WidgetItem widgetItem : itemWidgets)
|
||||||
{
|
{
|
||||||
renderItemOverlay(graphics, widget.getId(), widget);
|
Widget widget = widgetItem.getWidget();
|
||||||
|
int interfaceGroup = TO_GROUP(widget.getId());
|
||||||
|
|
||||||
|
// Don't draw if this widget isn't one of the allowed
|
||||||
|
if (!interfaceGroups.contains(interfaceGroup))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
renderItemOverlay(graphics, widgetItem.getId(), widgetItem);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void showOnInventory()
|
||||||
|
{
|
||||||
|
showOnInterfaces(
|
||||||
|
DEPOSIT_BOX_GROUP_ID,
|
||||||
|
BANK_INVENTORY_GROUP_ID,
|
||||||
|
SHOP_INVENTORY_GROUP_ID,
|
||||||
|
GRAND_EXCHANGE_INVENTORY_GROUP_ID,
|
||||||
|
GUIDE_PRICES_INVENTORY_GROUP_ID,
|
||||||
|
EQUIPMENT_INVENTORY_GROUP_ID,
|
||||||
|
INVENTORY_GROUP_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showOnBank()
|
||||||
|
{
|
||||||
|
showOnInterfaces(BANK_GROUP_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showOnEquipment()
|
||||||
|
{
|
||||||
|
showOnInterfaces(EQUIPMENT_GROUP_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showOnInterfaces(int... ids)
|
||||||
|
{
|
||||||
|
Arrays.stream(ids).forEach(interfaceGroups::add);
|
||||||
|
}
|
||||||
|
|
||||||
// Don't allow setting position, priority, or layer
|
// Don't allow setting position, priority, or layer
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1335,7 +1335,7 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
for (Widget rlWidget : widgets)
|
for (Widget rlWidget : widgets)
|
||||||
{
|
{
|
||||||
RSWidget widget = (RSWidget) rlWidget;
|
RSWidget widget = (RSWidget) rlWidget;
|
||||||
if (widget == null || widget.getRSParentId() != parentId)
|
if (widget == null || widget.getRSParentId() != parentId || widget.isSelfHidden())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1355,7 +1355,7 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
{
|
{
|
||||||
if (renderX >= minX && renderX <= maxX && renderY >= minY && renderY <= maxY)
|
if (renderX >= minX && renderX <= maxX && renderY >= minY && renderY <= maxY)
|
||||||
{
|
{
|
||||||
WidgetItem widgetItem = new WidgetItem(widget.getItemId(), widget.getItemQuantity(), -1, widget.getBounds());
|
WidgetItem widgetItem = new WidgetItem(widget.getItemId(), widget.getItemQuantity(), -1, widget.getBounds(), widget);
|
||||||
callbacks.drawItem(widget.getItemId(), widgetItem);
|
callbacks.drawItem(widget.getItemId(), widgetItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -300,7 +300,7 @@ public abstract class RSWidgetMixin implements RSWidget
|
|||||||
int itemY = widgetCanvasLocation.getY() + ((ITEM_SLOT_SIZE + yPitch) * row);
|
int itemY = widgetCanvasLocation.getY() + ((ITEM_SLOT_SIZE + yPitch) * row);
|
||||||
|
|
||||||
Rectangle bounds = new Rectangle(itemX - 1, itemY - 1, ITEM_SLOT_SIZE, ITEM_SLOT_SIZE);
|
Rectangle bounds = new Rectangle(itemX - 1, itemY - 1, ITEM_SLOT_SIZE, ITEM_SLOT_SIZE);
|
||||||
return new WidgetItem(itemId - 1, itemQuantity, index, bounds);
|
return new WidgetItem(itemId - 1, itemQuantity, index, bounds, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|||||||
Reference in New Issue
Block a user