Merge pull request #7359 from Adam-/overlaymenu2
Add overlay menu support & configuration menus
This commit is contained in:
@@ -260,6 +260,14 @@ public enum MenuAction
|
||||
* Menu action injected by runelite for its menu items.
|
||||
*/
|
||||
RUNELITE(1500),
|
||||
/**
|
||||
* Menu action injected by runelite for overlay menu items.
|
||||
*/
|
||||
RUNELITE_OVERLAY(1501),
|
||||
/**
|
||||
* Menu action for configuring runelite overlays.
|
||||
*/
|
||||
RUNELITE_OVERLAY_CONFIG(1502),
|
||||
|
||||
FOLLOW(2046),
|
||||
TRADE(2047),
|
||||
|
||||
@@ -60,10 +60,4 @@ public class MenuEntry
|
||||
*/
|
||||
private int param1;
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "MenuEntry{" + "option=" + option + ", target=" + target + ", identifier=" + identifier + ", type=" + type + ", param0=" + param0 + ", param1=" + param1 + '}';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 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.events;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayMenuEntry;
|
||||
|
||||
/**
|
||||
* Event fired when an overlay menu entry is clicked.
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class OverlayMenuClicked
|
||||
{
|
||||
private OverlayMenuEntry entry;
|
||||
private Overlay overlay;
|
||||
}
|
||||
@@ -52,6 +52,7 @@ class AgilityOverlay extends Overlay
|
||||
@Inject
|
||||
private AgilityOverlay(Client client, AgilityPlugin plugin, AgilityConfig config)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||
this.client = client;
|
||||
|
||||
@@ -37,6 +37,7 @@ import net.runelite.api.Client;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemID;
|
||||
import static net.runelite.api.ItemID.AGILITY_ARENA_TICKET;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.api.Player;
|
||||
import static net.runelite.api.Skill.AGILITY;
|
||||
import net.runelite.api.Tile;
|
||||
@@ -67,6 +68,7 @@ import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
|
||||
@PluginDescriptor(
|
||||
@@ -126,11 +128,15 @@ public class AgilityPlugin extends Plugin
|
||||
{
|
||||
overlayManager.add(agilityOverlay);
|
||||
overlayManager.add(lapCounterOverlay);
|
||||
|
||||
overlayManager.addMenu(lapCounterOverlay, RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Agility overlay");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.removeMenu(lapCounterOverlay, OPTION_CONFIGURE);
|
||||
|
||||
overlayManager.remove(agilityOverlay);
|
||||
overlayManager.remove(lapCounterOverlay);
|
||||
marksOfGrace.clear();
|
||||
|
||||
@@ -42,6 +42,7 @@ class AttackStylesOverlay extends Overlay
|
||||
@Inject
|
||||
private AttackStylesOverlay(AttackStylesPlugin plugin, AttackStylesConfig config)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.ABOVE_CHATBOX_RIGHT);
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
|
||||
@@ -33,6 +33,7 @@ import java.util.Set;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.api.VarPlayer;
|
||||
import net.runelite.api.Varbits;
|
||||
@@ -54,6 +55,7 @@ import static net.runelite.client.plugins.attackstyles.AttackStyle.CASTING;
|
||||
import static net.runelite.client.plugins.attackstyles.AttackStyle.DEFENSIVE_CASTING;
|
||||
import static net.runelite.client.plugins.attackstyles.AttackStyle.OTHER;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Attack Styles",
|
||||
@@ -96,6 +98,8 @@ public class AttackStylesPlugin extends Plugin
|
||||
{
|
||||
overlayManager.add(overlay);
|
||||
|
||||
overlayManager.addMenu(overlay, RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Attack style overlay");
|
||||
|
||||
if (client.getGameState() == GameState.LOGGED_IN)
|
||||
{
|
||||
clientThread.invoke(this::start);
|
||||
@@ -123,6 +127,7 @@ public class AttackStylesPlugin extends Plugin
|
||||
@Override
|
||||
protected void shutDown()
|
||||
{
|
||||
overlayManager.removeMenu(overlay, OPTION_CONFIGURE);
|
||||
overlayManager.remove(overlay);
|
||||
hideWarnedStyles(false);
|
||||
processWidgets();
|
||||
|
||||
@@ -51,6 +51,7 @@ class BarbarianAssaultOverlay extends Overlay
|
||||
@Inject
|
||||
private BarbarianAssaultOverlay(Client client, BarbarianAssaultPlugin plugin, BarbarianAssaultConfig config)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||
this.client = client;
|
||||
|
||||
@@ -32,6 +32,7 @@ import javax.inject.Inject;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.ItemID;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.GameTick;
|
||||
@@ -51,6 +52,7 @@ import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
|
||||
@PluginDescriptor(
|
||||
@@ -99,11 +101,14 @@ public class BarbarianAssaultPlugin extends Plugin
|
||||
.deriveFont(Font.BOLD, 24);
|
||||
|
||||
clockImage = ImageUtil.getResourceStreamFromClass(getClass(), "clock.png");
|
||||
|
||||
overlayManager.addMenu(overlay, RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "B.A. overlay");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.removeMenu(overlay, OPTION_CONFIGURE);
|
||||
overlayManager.remove(overlay);
|
||||
gameTime = null;
|
||||
currentWave = START_WAVE;
|
||||
|
||||
@@ -44,8 +44,9 @@ public class BarrowsBrotherSlainOverlay extends Overlay
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
|
||||
@Inject
|
||||
private BarrowsBrotherSlainOverlay(Client client)
|
||||
private BarrowsBrotherSlainOverlay(BarrowsPlugin plugin, Client client)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.TOP_LEFT);
|
||||
setPriority(OverlayPriority.LOW);
|
||||
this.client = client;
|
||||
|
||||
@@ -38,6 +38,7 @@ import net.runelite.api.GameState;
|
||||
import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemContainer;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.api.NullObjectID;
|
||||
import net.runelite.api.ObjectID;
|
||||
import net.runelite.api.WallObject;
|
||||
@@ -60,6 +61,7 @@ import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
|
||||
@PluginDescriptor(
|
||||
@@ -119,11 +121,14 @@ public class BarrowsPlugin extends Plugin
|
||||
{
|
||||
overlayManager.add(barrowsOverlay);
|
||||
overlayManager.add(brotherOverlay);
|
||||
|
||||
overlayManager.addMenu(brotherOverlay, RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Barrows overlay");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown()
|
||||
{
|
||||
overlayManager.removeMenu(brotherOverlay, OPTION_CONFIGURE);
|
||||
overlayManager.remove(barrowsOverlay);
|
||||
overlayManager.remove(brotherOverlay);
|
||||
walls.clear();
|
||||
|
||||
@@ -46,6 +46,7 @@ class BlastFurnaceCofferOverlay extends Overlay
|
||||
@Inject
|
||||
private BlastFurnaceCofferOverlay(Client client, BlastFurnacePlugin plugin)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.TOP_LEFT);
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
|
||||
@@ -47,6 +47,7 @@ class BlastFurnaceOverlay extends Overlay
|
||||
@Inject
|
||||
BlastFurnaceOverlay(Client client, BlastFurnacePlugin plugin)
|
||||
{
|
||||
super(plugin);
|
||||
this.plugin = plugin;
|
||||
this.client = client;
|
||||
setPosition(OverlayPosition.TOP_LEFT);
|
||||
|
||||
@@ -30,6 +30,7 @@ import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.GameObject;
|
||||
import net.runelite.api.GameState;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import static net.runelite.api.NullObjectID.NULL_9092;
|
||||
import static net.runelite.api.ObjectID.CONVEYOR_BELT;
|
||||
import net.runelite.api.events.GameObjectDespawned;
|
||||
@@ -40,6 +41,7 @@ import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Blast Furnace",
|
||||
@@ -74,11 +76,15 @@ public class BlastFurnacePlugin extends Plugin
|
||||
overlayManager.add(overlay);
|
||||
overlayManager.add(cofferOverlay);
|
||||
overlayManager.add(clickBoxOverlay);
|
||||
overlayManager.addMenu(overlay, RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Blast furnace overlay");
|
||||
overlayManager.addMenu(cofferOverlay, RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Coffer overlay");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown()
|
||||
{
|
||||
overlayManager.removeMenu(overlay, OPTION_CONFIGURE);
|
||||
overlayManager.removeMenu(cofferOverlay, OPTION_CONFIGURE);
|
||||
overlayManager.remove(overlay);
|
||||
overlayManager.remove(cofferOverlay);
|
||||
overlayManager.remove(clickBoxOverlay);
|
||||
|
||||
@@ -47,8 +47,9 @@ class BlastMineOreCountOverlay extends Overlay
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
|
||||
@Inject
|
||||
private BlastMineOreCountOverlay(Client client, BlastMinePluginConfig config, ItemManager itemManager)
|
||||
private BlastMineOreCountOverlay(BlastMinePlugin plugin, Client client, BlastMinePluginConfig config, ItemManager itemManager)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.TOP_LEFT);
|
||||
this.client = client;
|
||||
this.config = config;
|
||||
|
||||
@@ -32,6 +32,7 @@ import lombok.Getter;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameObject;
|
||||
import net.runelite.api.GameState;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.GameObjectSpawned;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
@@ -43,6 +44,7 @@ import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Blast Mine",
|
||||
@@ -77,11 +79,13 @@ public class BlastMinePlugin extends Plugin
|
||||
{
|
||||
overlayManager.add(blastMineRockOverlay);
|
||||
overlayManager.add(blastMineOreCountOverlay);
|
||||
overlayManager.addMenu(blastMineOreCountOverlay, RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Blast mine overlay");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.removeMenu(blastMineOreCountOverlay, OPTION_CONFIGURE);
|
||||
overlayManager.remove(blastMineRockOverlay);
|
||||
overlayManager.remove(blastMineOreCountOverlay);
|
||||
final Widget blastMineWidget = client.getWidget(WidgetInfo.BLAST_MINE);
|
||||
|
||||
@@ -47,6 +47,7 @@ class BoostsOverlay extends Overlay
|
||||
@Inject
|
||||
private BoostsOverlay(Client client, BoostsConfig config, BoostsPlugin plugin)
|
||||
{
|
||||
super(plugin);
|
||||
this.plugin = plugin;
|
||||
this.client = client;
|
||||
this.config = config;
|
||||
|
||||
@@ -33,6 +33,7 @@ import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.Client;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.api.Prayer;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.api.events.BoostedLevelChanged;
|
||||
@@ -46,6 +47,7 @@ import net.runelite.client.game.SkillIconManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
|
||||
@@ -111,6 +113,8 @@ public class BoostsPlugin extends Plugin
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
overlayManager.add(boostsOverlay);
|
||||
overlayManager.addMenu(boostsOverlay, RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Boosts overlay");
|
||||
|
||||
updateShownSkills();
|
||||
updateBoostedStats();
|
||||
Arrays.fill(lastSkillLevels, -1);
|
||||
@@ -131,6 +135,7 @@ public class BoostsPlugin extends Plugin
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.removeMenu(boostsOverlay, OPTION_CONFIGURE);
|
||||
overlayManager.remove(boostsOverlay);
|
||||
infoBoxManager.removeIf(t -> t instanceof BoostIndicator || t instanceof StatChangeIndicator);
|
||||
preserveBeenActive = false;
|
||||
|
||||
@@ -44,6 +44,7 @@ public class CerberusOverlay extends Overlay
|
||||
@Inject
|
||||
CerberusOverlay(final CerberusPlugin plugin, final SkillIconManager iconManager)
|
||||
{
|
||||
super(plugin);
|
||||
this.plugin = plugin;
|
||||
this.iconManager = iconManager;
|
||||
setPosition(OverlayPosition.BOTTOM_RIGHT);
|
||||
|
||||
@@ -32,6 +32,7 @@ import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.GameState;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
@@ -41,6 +42,7 @@ import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Cerberus",
|
||||
@@ -63,11 +65,13 @@ public class CerberusPlugin extends Plugin
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
overlayManager.add(overlay);
|
||||
overlayManager.addMenu(overlay, RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Cerberus overlay");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.removeMenu(overlay, OPTION_CONFIGURE);
|
||||
overlayManager.remove(overlay);
|
||||
ghosts.clear();
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ public class ClueScrollOverlay extends Overlay
|
||||
@Inject
|
||||
public ClueScrollOverlay(ClueScrollPlugin plugin)
|
||||
{
|
||||
super(plugin);
|
||||
this.plugin = plugin;
|
||||
setPriority(OverlayPriority.LOW);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemComposition;
|
||||
import net.runelite.api.ItemID;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.ObjectComposition;
|
||||
import net.runelite.api.Scene;
|
||||
@@ -84,6 +85,7 @@ import net.runelite.client.plugins.cluescrolls.clues.ObjectClueScroll;
|
||||
import net.runelite.client.plugins.cluescrolls.clues.TextClueScroll;
|
||||
import net.runelite.client.plugins.cluescrolls.clues.ThreeStepCrypticClue;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
import net.runelite.client.ui.overlay.worldmap.WorldMapPointManager;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
import net.runelite.client.util.Text;
|
||||
@@ -161,11 +163,13 @@ public class ClueScrollPlugin extends Plugin
|
||||
overlayManager.add(clueScrollOverlay);
|
||||
overlayManager.add(clueScrollEmoteOverlay);
|
||||
overlayManager.add(clueScrollWorldOverlay);
|
||||
overlayManager.addMenu(clueScrollOverlay, RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Cluescroll overlay");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.removeMenu(clueScrollOverlay, OPTION_CONFIGURE);
|
||||
overlayManager.remove(clueScrollOverlay);
|
||||
overlayManager.remove(clueScrollEmoteOverlay);
|
||||
overlayManager.remove(clueScrollWorldOverlay);
|
||||
|
||||
@@ -656,6 +656,18 @@ public class ConfigPanel extends PluginPanel
|
||||
configManager.setConfiguration(RUNELITE_GROUP_NAME, PINNED_PLUGINS_CONFIG_KEY, value);
|
||||
}
|
||||
|
||||
void openConfigurationPanel(String configGroup)
|
||||
{
|
||||
for (PluginListItem pluginListItem : pluginList)
|
||||
{
|
||||
if (pluginListItem.getName().equals(configGroup))
|
||||
{
|
||||
openGroupConfigPanel(pluginListItem, pluginListItem.getConfig(), pluginListItem.getConfigDescriptor());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivate()
|
||||
{
|
||||
|
||||
@@ -28,16 +28,21 @@ import java.awt.image.BufferedImage;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import javax.inject.Inject;
|
||||
import javax.swing.SwingUtilities;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.client.config.ChatColorConfig;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.config.RuneLiteConfig;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.OverlayMenuClicked;
|
||||
import net.runelite.client.events.PluginChanged;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginManager;
|
||||
import net.runelite.client.ui.ClientToolbar;
|
||||
import net.runelite.client.ui.ClientUI;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayMenuEntry;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
|
||||
@PluginDescriptor(
|
||||
@@ -47,6 +52,9 @@ import net.runelite.client.util.ImageUtil;
|
||||
)
|
||||
public class ConfigPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
private ClientUI clientUI;
|
||||
|
||||
@Inject
|
||||
private ClientToolbar clientToolbar;
|
||||
|
||||
@@ -96,4 +104,30 @@ public class ConfigPlugin extends Plugin
|
||||
{
|
||||
SwingUtilities.invokeLater(configPanel::refreshPluginList);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onOverlayMenuClicked(OverlayMenuClicked overlayMenuClicked)
|
||||
{
|
||||
OverlayMenuEntry overlayMenuEntry = overlayMenuClicked.getEntry();
|
||||
if (overlayMenuEntry.getMenuAction() == MenuAction.RUNELITE_OVERLAY_CONFIG)
|
||||
{
|
||||
Overlay overlay = overlayMenuClicked.getOverlay();
|
||||
Plugin plugin = overlay.getPlugin();
|
||||
if (plugin == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Expand config panel for plugin
|
||||
PluginDescriptor descriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
|
||||
SwingUtilities.invokeLater(() ->
|
||||
{
|
||||
if (!navButton.isSelected())
|
||||
{
|
||||
navButton.getOnSelect().run();
|
||||
}
|
||||
configPanel.openConfigurationPanel(descriptor.name());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import javax.annotation.Nullable;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigDescriptor;
|
||||
@@ -63,6 +64,14 @@ class PluginListItem extends JPanel
|
||||
@Nullable
|
||||
private final Plugin plugin;
|
||||
|
||||
@Nullable
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final Config config;
|
||||
|
||||
@Nullable
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final ConfigDescriptor configDescriptor;
|
||||
|
||||
@Getter
|
||||
private final String name;
|
||||
|
||||
@@ -132,6 +141,8 @@ class PluginListItem extends JPanel
|
||||
{
|
||||
this.configPanel = configPanel;
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
this.configDescriptor = configDescriptor;
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
Collections.addAll(keywords, name.toLowerCase().split(" "));
|
||||
|
||||
@@ -57,6 +57,7 @@ class CookingOverlay extends Overlay
|
||||
@Inject
|
||||
private CookingOverlay(Client client, CookingPlugin plugin, CookingConfig config, XpTrackerService xpTrackerService)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.TOP_LEFT);
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
|
||||
@@ -32,6 +32,7 @@ import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import com.google.inject.Provides;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
@@ -41,6 +42,7 @@ import net.runelite.client.plugins.PluginDependency;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.xptracker.XpTrackerPlugin;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Cooking",
|
||||
@@ -73,11 +75,13 @@ public class CookingPlugin extends Plugin
|
||||
{
|
||||
session = null;
|
||||
overlayManager.add(overlay);
|
||||
overlayManager.addMenu(overlay, RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Cooking overlay");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.removeMenu(overlay, OPTION_CONFIGURE);
|
||||
overlayManager.remove(overlay);
|
||||
session = null;
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ class CorpDamageOverlay extends Overlay
|
||||
@Inject
|
||||
private CorpDamageOverlay(Client client, CorpPlugin corpPlugin, CorpConfig config)
|
||||
{
|
||||
super(corpPlugin);
|
||||
setPosition(OverlayPosition.TOP_LEFT);
|
||||
setLayer(OverlayLayer.UNDER_WIDGETS);
|
||||
setPriority(OverlayPriority.LOW);
|
||||
|
||||
@@ -37,6 +37,7 @@ import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.MenuAction;
|
||||
import static net.runelite.api.MenuAction.MENU_ACTION_DEPRIORITIZE_OFFSET;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.NpcID;
|
||||
@@ -56,6 +57,7 @@ import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Corporeal Beast",
|
||||
@@ -112,11 +114,13 @@ public class CorpPlugin extends Plugin
|
||||
{
|
||||
overlayManager.add(corpOverlay);
|
||||
overlayManager.add(coreOverlay);
|
||||
overlayManager.addMenu(corpOverlay, RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Corp overlay");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.removeMenu(corpOverlay, OPTION_CONFIGURE);
|
||||
overlayManager.remove(corpOverlay);
|
||||
overlayManager.remove(coreOverlay);
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ class FishingOverlay extends Overlay
|
||||
@Inject
|
||||
public FishingOverlay(Client client, FishingPlugin plugin, FishingConfig config, XpTrackerService xpTrackerService)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.TOP_LEFT);
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
|
||||
@@ -46,6 +46,7 @@ import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemContainer;
|
||||
import net.runelite.api.ItemID;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
@@ -64,6 +65,7 @@ import net.runelite.client.plugins.PluginDependency;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.xptracker.XpTrackerPlugin;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
import net.runelite.client.util.QueryRunner;
|
||||
|
||||
@PluginDescriptor(
|
||||
@@ -131,6 +133,7 @@ public class FishingPlugin extends Plugin
|
||||
overlayManager.add(overlay);
|
||||
overlayManager.add(spotOverlay);
|
||||
overlayManager.add(fishingSpotMinimapOverlay);
|
||||
overlayManager.addMenu(overlay, RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Fishing overlay");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -138,6 +141,7 @@ public class FishingPlugin extends Plugin
|
||||
{
|
||||
spotOverlay.setHidden(true);
|
||||
fishingSpotMinimapOverlay.setHidden(true);
|
||||
overlayManager.removeMenu(overlay, OPTION_CONFIGURE);
|
||||
overlayManager.remove(overlay);
|
||||
overlayManager.remove(spotOverlay);
|
||||
overlayManager.remove(fishingSpotMinimapOverlay);
|
||||
|
||||
@@ -52,8 +52,9 @@ class InventoryViewerOverlay extends Overlay
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
|
||||
@Inject
|
||||
private InventoryViewerOverlay(Client client, ItemManager itemManager)
|
||||
private InventoryViewerOverlay(InventoryViewerPlugin plugin, Client client, ItemManager itemManager)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.BOTTOM_RIGHT);
|
||||
panelComponent.setWrapping(4);
|
||||
panelComponent.setGap(new Point(6, 4));
|
||||
|
||||
@@ -24,10 +24,12 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.inventoryviewer;
|
||||
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Inventory Viewer",
|
||||
@@ -47,11 +49,13 @@ public class InventoryViewerPlugin extends Plugin
|
||||
public void startUp()
|
||||
{
|
||||
overlayManager.add(overlay);
|
||||
overlayManager.addMenu(overlay, RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Inventory viewer overlay");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutDown()
|
||||
{
|
||||
overlayManager.removeMenu(overlay, OPTION_CONFIGURE);
|
||||
overlayManager.remove(overlay);
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,7 @@ class MotherlodeOverlay extends Overlay
|
||||
@Inject
|
||||
MotherlodeOverlay(Client client, MotherlodePlugin plugin, MotherlodeConfig config)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.TOP_LEFT);
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
|
||||
@@ -44,6 +44,7 @@ import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemContainer;
|
||||
import net.runelite.api.ItemID;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import static net.runelite.api.ObjectID.ORE_VEIN_26661;
|
||||
import static net.runelite.api.ObjectID.ORE_VEIN_26662;
|
||||
import static net.runelite.api.ObjectID.ORE_VEIN_26663;
|
||||
@@ -72,6 +73,7 @@ import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.task.Schedule;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Motherlode Mine",
|
||||
@@ -149,6 +151,9 @@ public class MotherlodePlugin extends Plugin
|
||||
overlayManager.add(motherlodeGemOverlay);
|
||||
overlayManager.add(motherlodeSackOverlay);
|
||||
|
||||
overlayManager.addMenu(motherlodeGemOverlay, RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Gem overlay");
|
||||
overlayManager.addMenu(motherlodeSackOverlay, RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Sack overlay");
|
||||
|
||||
session = new MotherlodeSession();
|
||||
inMlm = checkInMlm();
|
||||
|
||||
@@ -161,6 +166,8 @@ public class MotherlodePlugin extends Plugin
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.removeMenu(motherlodeGemOverlay, OPTION_CONFIGURE);
|
||||
overlayManager.removeMenu(motherlodeSackOverlay, OPTION_CONFIGURE);
|
||||
overlayManager.remove(overlay);
|
||||
overlayManager.remove(rocksOverlay);
|
||||
overlayManager.remove(motherlodeGemOverlay);
|
||||
|
||||
@@ -52,6 +52,7 @@ class MotherlodeSackOverlay extends Overlay
|
||||
@Inject
|
||||
MotherlodeSackOverlay(Client client, MotherlodeConfig config, MotherlodePlugin plugin)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.TOP_LEFT);
|
||||
this.client = client;
|
||||
this.config = config;
|
||||
|
||||
@@ -60,6 +60,7 @@ class NightmareZoneOverlay extends Overlay
|
||||
InfoBoxManager infoBoxManager,
|
||||
ItemManager itemManager)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.TOP_LEFT);
|
||||
setPriority(OverlayPriority.LOW);
|
||||
this.client = client;
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.util.Arrays;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
@@ -39,6 +40,7 @@ import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
import net.runelite.client.util.Text;
|
||||
|
||||
@PluginDescriptor(
|
||||
@@ -73,12 +75,14 @@ public class NightmareZonePlugin extends Plugin
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
overlayManager.add(overlay);
|
||||
overlayManager.addMenu(overlay, RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "NMZ overlay");
|
||||
overlay.removeAbsorptionCounter();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.removeMenu(overlay, OPTION_CONFIGURE);
|
||||
overlayManager.remove(overlay);
|
||||
overlay.removeAbsorptionCounter();
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ class OpponentInfoOverlay extends Overlay
|
||||
HiscoreManager hiscoreManager,
|
||||
NPCManager npcManager)
|
||||
{
|
||||
super(opponentInfoPlugin);
|
||||
this.client = client;
|
||||
this.opponentInfoPlugin = opponentInfoPlugin;
|
||||
this.opponentInfoConfig = opponentInfoConfig;
|
||||
|
||||
@@ -35,6 +35,7 @@ import lombok.Getter;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.api.WorldType;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
@@ -44,6 +45,7 @@ import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
import net.runelite.http.api.hiscore.HiscoreEndpoint;
|
||||
|
||||
@PluginDescriptor(
|
||||
@@ -89,11 +91,15 @@ public class OpponentInfoPlugin extends Plugin
|
||||
{
|
||||
overlayManager.add(opponentInfoOverlay);
|
||||
overlayManager.add(playerComparisonOverlay);
|
||||
overlayManager.addMenu(opponentInfoOverlay, RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Opponent info overlay");
|
||||
overlayManager.addMenu(playerComparisonOverlay, RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Opponent info overlay");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.removeMenu(opponentInfoOverlay, OPTION_CONFIGURE);
|
||||
overlayManager.removeMenu(playerComparisonOverlay, OPTION_CONFIGURE);
|
||||
lastOpponent = null;
|
||||
lastTime = null;
|
||||
overlayManager.remove(opponentInfoOverlay);
|
||||
|
||||
@@ -83,6 +83,7 @@ class PlayerComparisonOverlay extends Overlay
|
||||
@Inject
|
||||
private PlayerComparisonOverlay(Client client, OpponentInfoPlugin opponentInfoPlugin, OpponentInfoConfig config, HiscoreManager hiscoreManager)
|
||||
{
|
||||
super(opponentInfoPlugin);
|
||||
this.client = client;
|
||||
this.opponentInfoPlugin = opponentInfoPlugin;
|
||||
this.config = config;
|
||||
|
||||
@@ -53,6 +53,7 @@ public class RaidsOverlay extends Overlay
|
||||
@Inject
|
||||
private RaidsOverlay(Client client, RaidsPlugin plugin, RaidsConfig config)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.TOP_LEFT);
|
||||
setPriority(OverlayPriority.LOW);
|
||||
this.client = client;
|
||||
|
||||
@@ -39,6 +39,7 @@ import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.InstanceTemplates;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.api.NullObjectID;
|
||||
import static net.runelite.api.Perspective.SCENE_SIZE;
|
||||
import net.runelite.api.Point;
|
||||
@@ -66,6 +67,7 @@ import net.runelite.client.plugins.raids.solver.Layout;
|
||||
import net.runelite.client.plugins.raids.solver.LayoutSolver;
|
||||
import net.runelite.client.plugins.raids.solver.RotationSolver;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
import net.runelite.client.util.Text;
|
||||
|
||||
@@ -153,6 +155,8 @@ public class RaidsPlugin extends Plugin
|
||||
{
|
||||
overlayManager.add(overlay);
|
||||
overlayManager.add(pointsOverlay);
|
||||
overlayManager.addMenu(overlay, RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Raids overlay");
|
||||
overlayManager.addMenu(pointsOverlay, RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Raids overlay");
|
||||
updateLists();
|
||||
clientThread.invokeLater(() -> checkRaidPresence(true));
|
||||
}
|
||||
@@ -162,6 +166,8 @@ public class RaidsPlugin extends Plugin
|
||||
{
|
||||
overlayManager.remove(overlay);
|
||||
overlayManager.remove(pointsOverlay);
|
||||
overlayManager.removeMenu(overlay, OPTION_CONFIGURE);
|
||||
overlayManager.removeMenu(pointsOverlay, OPTION_CONFIGURE);
|
||||
infoBoxManager.removeInfoBox(timer);
|
||||
inRaidChambers = false;
|
||||
raid = null;
|
||||
|
||||
@@ -46,6 +46,7 @@ public class TeamCapesOverlay extends Overlay
|
||||
@Inject
|
||||
private TeamCapesOverlay(TeamCapesPlugin plugin, TeamCapesConfig config, ItemManager manager)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.TOP_LEFT);
|
||||
setPriority(OverlayPriority.LOW);
|
||||
this.plugin = plugin;
|
||||
|
||||
@@ -35,12 +35,14 @@ import java.util.stream.Collectors;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.task.Schedule;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Team Capes",
|
||||
@@ -72,11 +74,13 @@ public class TeamCapesPlugin extends Plugin
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
overlayManager.add(overlay);
|
||||
overlayManager.addMenu(overlay, RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Teamcapes overlay");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.removeMenu(overlay, OPTION_CONFIGURE);
|
||||
overlayManager.remove(overlay);
|
||||
teams.clear();
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ class WintertodtOverlay extends Overlay
|
||||
@Inject
|
||||
private WintertodtOverlay(WintertodtPlugin plugin)
|
||||
{
|
||||
super(plugin);
|
||||
this.plugin = plugin;
|
||||
setPosition(OverlayPosition.BOTTOM_LEFT);
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemContainer;
|
||||
import static net.runelite.api.ItemID.BRUMA_KINDLING;
|
||||
import static net.runelite.api.ItemID.BRUMA_ROOT;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.api.MessageNode;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.events.AnimationChanged;
|
||||
@@ -67,6 +68,7 @@ import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
|
||||
@PluginDescriptor(
|
||||
@@ -128,11 +130,13 @@ public class WintertodtPlugin extends Plugin
|
||||
{
|
||||
reset();
|
||||
overlayManager.add(overlay);
|
||||
overlayManager.addMenu(overlay, RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Wintertodt overlay");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.removeMenu(overlay, OPTION_CONFIGURE);
|
||||
overlayManager.remove(overlay);
|
||||
reset();
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ class WoodcuttingOverlay extends Overlay
|
||||
@Inject
|
||||
private WoodcuttingOverlay(Client client, WoodcuttingPlugin plugin, WoodcuttingConfig config, XpTrackerService xpTrackerService)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.TOP_LEFT);
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
|
||||
@@ -35,6 +35,7 @@ import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameObject;
|
||||
import net.runelite.api.GameState;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.events.AnimationChanged;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
@@ -51,6 +52,7 @@ import net.runelite.client.plugins.PluginDependency;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.xptracker.XpTrackerPlugin;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Woodcutting",
|
||||
@@ -98,11 +100,15 @@ public class WoodcuttingPlugin extends Plugin
|
||||
{
|
||||
overlayManager.add(overlay);
|
||||
overlayManager.add(treesOverlay);
|
||||
|
||||
overlayManager.addMenu(overlay, RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Woodcutting overlay");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.removeMenu(overlay, OPTION_CONFIGURE);
|
||||
|
||||
overlayManager.remove(overlay);
|
||||
overlayManager.remove(treesOverlay);
|
||||
treeObjects.clear();
|
||||
|
||||
@@ -74,6 +74,7 @@ public class XpGlobesOverlay extends Overlay
|
||||
XpTrackerService xpTrackerService,
|
||||
SkillIconManager iconManager)
|
||||
{
|
||||
super(plugin);
|
||||
this.iconManager = iconManager;
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
|
||||
@@ -34,6 +34,7 @@ import javax.inject.Inject;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Experience;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.api.events.ExperienceChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
@@ -45,6 +46,7 @@ import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.xptracker.XpTrackerPlugin;
|
||||
import net.runelite.client.task.Schedule;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "XP Globes",
|
||||
@@ -84,11 +86,13 @@ public class XpGlobesPlugin extends Plugin
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
overlayManager.add(overlay);
|
||||
overlayManager.addMenu(overlay, RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "XP Globes overlay");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.removeMenu(overlay, OPTION_CONFIGURE);
|
||||
overlayManager.remove(overlay);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,14 +27,20 @@ package net.runelite.client.ui.overlay;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.ui.overlay.components.LayoutableRenderableEntity;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public abstract class Overlay implements LayoutableRenderableEntity
|
||||
{
|
||||
@Nullable
|
||||
private final Plugin plugin;
|
||||
private Point preferredLocation;
|
||||
private Dimension preferredSize;
|
||||
private OverlayPosition preferredPosition;
|
||||
@@ -42,6 +48,17 @@ public abstract class Overlay implements LayoutableRenderableEntity
|
||||
private OverlayPosition position = OverlayPosition.TOP_LEFT;
|
||||
private OverlayPriority priority = OverlayPriority.NONE;
|
||||
private OverlayLayer layer = OverlayLayer.UNDER_WIDGETS;
|
||||
private final List<OverlayMenuEntry> menuEntries = new ArrayList<>();
|
||||
|
||||
protected Overlay()
|
||||
{
|
||||
plugin = null;
|
||||
}
|
||||
|
||||
protected Overlay(Plugin plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overlay name, used for saving the overlay, needs to be unique
|
||||
|
||||
@@ -33,15 +33,20 @@ import java.util.Comparator;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Predicate;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.api.events.MenuOptionClicked;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.config.RuneLiteConfig;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.OverlayMenuClicked;
|
||||
import net.runelite.client.events.PluginChanged;
|
||||
|
||||
/**
|
||||
@@ -50,6 +55,8 @@ import net.runelite.client.events.PluginChanged;
|
||||
@Singleton
|
||||
public class OverlayManager
|
||||
{
|
||||
public static final String OPTION_CONFIGURE = "Configure";
|
||||
|
||||
private static final String OVERLAY_CONFIG_PREFERRED_LOCATION = "_preferredLocation";
|
||||
private static final String OVERLAY_CONFIG_PREFERRED_POSITION = "_preferredPosition";
|
||||
private static final String OVERLAY_CONFIG_PREFERRED_SIZE = "_preferredSize";
|
||||
@@ -93,11 +100,13 @@ public class OverlayManager
|
||||
private final Map<OverlayLayer, List<Overlay>> overlayLayers = new EnumMap<>(OverlayLayer.class);
|
||||
|
||||
private final ConfigManager configManager;
|
||||
private final EventBus eventBus;
|
||||
|
||||
@Inject
|
||||
private OverlayManager(final ConfigManager configManager)
|
||||
private OverlayManager(final ConfigManager configManager, final EventBus eventBus)
|
||||
{
|
||||
this.configManager = configManager;
|
||||
this.eventBus = eventBus;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -107,6 +116,56 @@ public class OverlayManager
|
||||
rebuildOverlayLayers();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onMenuOptionClicked(MenuOptionClicked event)
|
||||
{
|
||||
if (event.getMenuAction() != MenuAction.RUNELITE_OVERLAY)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.consume();
|
||||
|
||||
Optional<Overlay> optionalOverlay = overlays.stream().filter(o -> overlayId(o) == event.getId()).findAny();
|
||||
if (optionalOverlay.isPresent())
|
||||
{
|
||||
Overlay overlay = optionalOverlay.get();
|
||||
List<OverlayMenuEntry> menuEntries = overlay.getMenuEntries();
|
||||
Optional<OverlayMenuEntry> optionalOverlayMenuEntry = menuEntries.stream()
|
||||
.filter(me -> me.getOption().equals(event.getMenuOption()))
|
||||
.findAny();
|
||||
if (optionalOverlayMenuEntry.isPresent())
|
||||
{
|
||||
eventBus.post(new OverlayMenuClicked(optionalOverlayMenuEntry.get(), overlay));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int overlayId(Overlay overlay)
|
||||
{
|
||||
return overlays.indexOf(overlay);
|
||||
}
|
||||
|
||||
public void addMenu(Overlay overlay, MenuAction menuAction, String option, String target)
|
||||
{
|
||||
OverlayMenuEntry overlayMenuEntry = new OverlayMenuEntry(menuAction, option, target);
|
||||
List<OverlayMenuEntry> menuEntries = overlay.getMenuEntries();
|
||||
menuEntries.add(overlayMenuEntry);
|
||||
}
|
||||
|
||||
public void removeMenu(Overlay overlay, String option)
|
||||
{
|
||||
List<OverlayMenuEntry> menuEntries = overlay.getMenuEntries();
|
||||
for (OverlayMenuEntry overlayMenuEntry : menuEntries)
|
||||
{
|
||||
if (overlayMenuEntry.getOption().equals(option))
|
||||
{
|
||||
menuEntries.remove(overlayMenuEntry);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all of the overlays on a layer sorted by priority and position
|
||||
*
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 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.ui.overlay;
|
||||
|
||||
import lombok.Value;
|
||||
import net.runelite.api.MenuAction;
|
||||
|
||||
@Value
|
||||
public class OverlayMenuEntry
|
||||
{
|
||||
private MenuAction menuAction;
|
||||
private String option;
|
||||
private String target;
|
||||
}
|
||||
@@ -39,6 +39,9 @@ import javax.inject.Singleton;
|
||||
import javax.swing.SwingUtilities;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.events.ClientTick;
|
||||
import net.runelite.api.events.FocusChanged;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
@@ -48,6 +51,8 @@ import net.runelite.client.input.KeyListener;
|
||||
import net.runelite.client.input.KeyManager;
|
||||
import net.runelite.client.input.MouseAdapter;
|
||||
import net.runelite.client.input.MouseManager;
|
||||
import net.runelite.client.ui.JagexColors;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
|
||||
@Singleton
|
||||
public class OverlayRenderer extends MouseAdapter implements KeyListener
|
||||
@@ -69,6 +74,7 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
|
||||
private final Point mousePosition = new Point();
|
||||
private Overlay movedOverlay;
|
||||
private boolean inOverlayDraggingMode;
|
||||
private MenuEntry[] menuEntries;
|
||||
|
||||
// Overlay state validation
|
||||
private Rectangle viewportBounds;
|
||||
@@ -99,9 +105,35 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
|
||||
if (!event.isFocused())
|
||||
{
|
||||
inOverlayDraggingMode = false;
|
||||
menuEntries = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
protected void onClientTick(ClientTick t)
|
||||
{
|
||||
if (menuEntries == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (client.isMenuOpen())
|
||||
{
|
||||
menuEntries = null;
|
||||
return;
|
||||
}
|
||||
|
||||
MenuEntry[] clientMenuEntries = client.getMenuEntries();
|
||||
MenuEntry[] newEntries = new MenuEntry[clientMenuEntries.length + menuEntries.length];
|
||||
|
||||
newEntries[0] = clientMenuEntries[0]; // Keep cancel at 0
|
||||
System.arraycopy(menuEntries, 0, newEntries, 1, menuEntries.length); // Add overlay menu entries
|
||||
System.arraycopy(clientMenuEntries, 1, newEntries, menuEntries.length + 1, clientMenuEntries.length - 1); // Add remaining menu entries
|
||||
client.setMenuEntries(newEntries);
|
||||
|
||||
menuEntries = null;
|
||||
}
|
||||
|
||||
public void render(Graphics2D graphics, final OverlayLayer layer)
|
||||
{
|
||||
if (layer != OverlayLayer.ABOVE_MAP
|
||||
@@ -149,6 +181,10 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
|
||||
graphics.setColor(previous);
|
||||
}
|
||||
|
||||
// Get mouse position
|
||||
final net.runelite.api.Point mouseCanvasPosition = client.getMouseCanvasPosition();
|
||||
final Point mouse = new Point(mouseCanvasPosition.getX(), mouseCanvasPosition.getY());
|
||||
|
||||
for (Overlay overlay : overlays)
|
||||
{
|
||||
OverlayPosition overlayPosition = overlay.getPosition();
|
||||
@@ -227,6 +263,11 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
|
||||
graphics.draw(bounds);
|
||||
graphics.setColor(previous);
|
||||
}
|
||||
|
||||
if (menuEntries == null && !client.isMenuOpen() && bounds.contains(mouse))
|
||||
{
|
||||
menuEntries = createRightClickMenuEntries(overlay);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -494,4 +535,26 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
|
||||
new Rectangle(rightChatboxPoint, SNAP_CORNER_SIZE),
|
||||
new Rectangle(canvasTopRightPoint, SNAP_CORNER_SIZE));
|
||||
}
|
||||
|
||||
private MenuEntry[] createRightClickMenuEntries(Overlay overlay)
|
||||
{
|
||||
List<OverlayMenuEntry> menuEntries = overlay.getMenuEntries();
|
||||
final MenuEntry[] entries = new MenuEntry[menuEntries.size()];
|
||||
|
||||
// Add in reverse order so they display correctly in the right-click menu
|
||||
for (int i = menuEntries.size() - 1; i >= 0; --i)
|
||||
{
|
||||
OverlayMenuEntry overlayMenuEntry = menuEntries.get(i);
|
||||
|
||||
final MenuEntry entry = new MenuEntry();
|
||||
entry.setOption(overlayMenuEntry.getOption());
|
||||
entry.setTarget(ColorUtil.wrapWithColorTag(overlayMenuEntry.getTarget(), JagexColors.MENU_TARGET));
|
||||
entry.setType(MenuAction.RUNELITE_OVERLAY.getId());
|
||||
entry.setIdentifier(overlayManager.overlayId(overlay)); // overlay id
|
||||
|
||||
entries[i] = entry;
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user