Merge remote-tracking branch 'runelite/master' into 1508-merge
This commit is contained in:
@@ -86,4 +86,14 @@ public interface ItemPricesConfig extends Config
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showWhileAlching",
|
||||
name = "Show prices while alching",
|
||||
description = "Show the price overlay while using High Alchemy",
|
||||
position = 6
|
||||
)
|
||||
default boolean showWhileAlching()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ class ItemPricesOverlay extends Overlay
|
||||
private static final int INVENTORY_ITEM_WIDGETID = WidgetInfo.INVENTORY.getPackedId();
|
||||
private static final int BANK_INVENTORY_ITEM_WIDGETID = WidgetInfo.BANK_INVENTORY_ITEMS_CONTAINER.getPackedId();
|
||||
private static final int BANK_ITEM_WIDGETID = WidgetInfo.BANK_ITEM_CONTAINER.getPackedId();
|
||||
private static final int EXPLORERS_RING_ITEM_WIDGETID = WidgetInfo.EXPLORERS_RING_ALCH_INVENTORY.getPackedId();
|
||||
|
||||
private final Client client;
|
||||
private final ItemPricesPlugin plugin;
|
||||
@@ -97,7 +98,7 @@ class ItemPricesOverlay extends Overlay
|
||||
switch (action)
|
||||
{
|
||||
case ITEM_USE_ON_WIDGET:
|
||||
if (!menuEntry.getTarget().contains("High Level Alchemy") || !plugin.isShowAlchProfit())
|
||||
if (!plugin.isShowWhileAlching() || !menuEntry.getOption().equals("Cast") || !menuEntry.getTarget().contains("High Level Alchemy"))
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -111,6 +112,11 @@ class ItemPricesOverlay extends Overlay
|
||||
// Item tooltip values
|
||||
switch (groupId)
|
||||
{
|
||||
case WidgetID.EXPLORERS_RING_ALCH_GROUP_ID:
|
||||
if (!plugin.isShowWhileAlching())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
case WidgetID.INVENTORY_GROUP_ID:
|
||||
if (plugin.isHideInventory())
|
||||
{
|
||||
@@ -144,7 +150,7 @@ class ItemPricesOverlay extends Overlay
|
||||
ItemContainer container = null;
|
||||
|
||||
// Inventory item
|
||||
if (widgetId == INVENTORY_ITEM_WIDGETID || widgetId == BANK_INVENTORY_ITEM_WIDGETID)
|
||||
if (widgetId == INVENTORY_ITEM_WIDGETID || widgetId == BANK_INVENTORY_ITEM_WIDGETID || widgetId == EXPLORERS_RING_ITEM_WIDGETID)
|
||||
{
|
||||
container = client.getItemContainer(InventoryID.INVENTORY);
|
||||
}
|
||||
|
||||
@@ -67,6 +67,8 @@ public class ItemPricesPlugin extends Plugin
|
||||
private boolean hideInventory;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showAlchProfit;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showWhileAlching;
|
||||
|
||||
@Provides
|
||||
ItemPricesConfig getConfig(ConfigManager configManager)
|
||||
@@ -107,5 +109,6 @@ public class ItemPricesPlugin extends Plugin
|
||||
this.showEA = config.showEA();
|
||||
this.hideInventory = config.hideInventory();
|
||||
this.showAlchProfit = config.showAlchProfit();
|
||||
this.showWhileAlching = config.showWhileAlching();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,6 +298,9 @@ public class RuneliteColorPicker extends JDialog
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e)
|
||||
{
|
||||
// force update hex color because focus lost events fire after window closing
|
||||
updateHex();
|
||||
|
||||
if (onClose != null)
|
||||
{
|
||||
onClose.accept(selectedColor);
|
||||
|
||||
@@ -239,6 +239,14 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
|
||||
final net.runelite.api.Point mouseCanvasPosition = client.getMouseCanvasPosition();
|
||||
final Point mouse = new Point(mouseCanvasPosition.getX(), mouseCanvasPosition.getY());
|
||||
|
||||
// Save graphics2d properties so we can restore them later
|
||||
final AffineTransform transform = graphics.getTransform();
|
||||
final Stroke stroke = graphics.getStroke();
|
||||
final Composite composite = graphics.getComposite();
|
||||
final Paint paint = graphics.getPaint();
|
||||
final RenderingHints renderingHints = graphics.getRenderingHints();
|
||||
final Color background = graphics.getBackground();
|
||||
|
||||
for (Overlay overlay : overlays)
|
||||
{
|
||||
OverlayPosition overlayPosition = overlay.getPosition();
|
||||
@@ -303,26 +311,33 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
|
||||
}
|
||||
|
||||
safeRender(client, overlay, layer, graphics, location);
|
||||
|
||||
final Rectangle bounds = overlay.getBounds();
|
||||
|
||||
if (bounds.isEmpty())
|
||||
if (!bounds.isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (inOverlayDraggingMode)
|
||||
{
|
||||
final Color previous = graphics.getColor();
|
||||
graphics.setColor(movedOverlay == overlay ? MOVING_OVERLAY_ACTIVE_COLOR : MOVING_OVERLAY_COLOR);
|
||||
graphics.draw(bounds);
|
||||
graphics.setColor(previous);
|
||||
}
|
||||
|
||||
if (inOverlayDraggingMode)
|
||||
{
|
||||
final Color previous = graphics.getColor();
|
||||
graphics.setColor(movedOverlay == overlay ? MOVING_OVERLAY_ACTIVE_COLOR : MOVING_OVERLAY_COLOR);
|
||||
graphics.draw(bounds);
|
||||
graphics.setColor(previous);
|
||||
}
|
||||
|
||||
if (menuEntries == null && !client.isMenuOpen() && bounds.contains(mouse))
|
||||
{
|
||||
menuEntries = createRightClickMenuEntries(overlay);
|
||||
if (menuEntries == null && !client.isMenuOpen() && bounds.contains(mouse))
|
||||
{
|
||||
menuEntries = createRightClickMenuEntries(overlay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Restore graphics2d properties
|
||||
graphics.setTransform(transform);
|
||||
graphics.setStroke(stroke);
|
||||
graphics.setComposite(composite);
|
||||
graphics.setPaint(paint);
|
||||
graphics.setRenderingHints(renderingHints);
|
||||
graphics.setBackground(background);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -503,15 +518,6 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
|
||||
graphics.setFont(this.interfaceFont);
|
||||
}
|
||||
|
||||
// Save graphics2d properties so we can restore them later
|
||||
final AffineTransform transform = graphics.getTransform();
|
||||
final Stroke stroke = graphics.getStroke();
|
||||
final Composite composite = graphics.getComposite();
|
||||
final Paint paint = graphics.getPaint();
|
||||
final Color color = graphics.getColor();
|
||||
final RenderingHints renderingHints = graphics.getRenderingHints();
|
||||
final Color background = graphics.getBackground();
|
||||
|
||||
graphics.translate(point.x, point.y);
|
||||
|
||||
final Dimension overlayDimension;
|
||||
@@ -524,17 +530,6 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
|
||||
log.warn("Error during overlay rendering", ex);
|
||||
return;
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Restore graphics2d properties
|
||||
graphics.setTransform(transform);
|
||||
graphics.setStroke(stroke);
|
||||
graphics.setComposite(composite);
|
||||
graphics.setPaint(paint);
|
||||
graphics.setColor(color);
|
||||
graphics.setRenderingHints(renderingHints);
|
||||
graphics.setBackground(background);
|
||||
}
|
||||
|
||||
final Dimension dimension = MoreObjects.firstNonNull(overlayDimension, new Dimension());
|
||||
overlay.setBounds(new Rectangle(point, dimension));
|
||||
|
||||
Reference in New Issue
Block a user