File diff suppressed because it is too large
Load Diff
@@ -52,6 +52,7 @@ import static net.runelite.api.MenuAction.WALK;
|
|||||||
import net.runelite.api.MenuEntry;
|
import net.runelite.api.MenuEntry;
|
||||||
import net.runelite.api.NPC;
|
import net.runelite.api.NPC;
|
||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
|
import static net.runelite.api.Varbits.BUILDING_MODE;
|
||||||
import net.runelite.api.coords.WorldPoint;
|
import net.runelite.api.coords.WorldPoint;
|
||||||
import net.runelite.api.events.ConfigChanged;
|
import net.runelite.api.events.ConfigChanged;
|
||||||
import net.runelite.api.events.FocusChanged;
|
import net.runelite.api.events.FocusChanged;
|
||||||
@@ -60,10 +61,9 @@ import net.runelite.api.events.MenuEntryAdded;
|
|||||||
import net.runelite.api.events.MenuOpened;
|
import net.runelite.api.events.MenuOpened;
|
||||||
import net.runelite.api.events.MenuOptionClicked;
|
import net.runelite.api.events.MenuOptionClicked;
|
||||||
import net.runelite.api.events.PostItemComposition;
|
import net.runelite.api.events.PostItemComposition;
|
||||||
import net.runelite.api.events.WidgetMenuOptionClicked;
|
|
||||||
import net.runelite.api.events.VarbitChanged;
|
import net.runelite.api.events.VarbitChanged;
|
||||||
|
import net.runelite.api.events.WidgetMenuOptionClicked;
|
||||||
import net.runelite.api.widgets.WidgetInfo;
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
import static net.runelite.api.Varbits.BUILDING_MODE;
|
|
||||||
import net.runelite.client.callback.ClientThread;
|
import net.runelite.client.callback.ClientThread;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
@@ -73,24 +73,24 @@ import net.runelite.client.input.KeyManager;
|
|||||||
import net.runelite.client.menus.ComparableEntry;
|
import net.runelite.client.menus.ComparableEntry;
|
||||||
import net.runelite.client.menus.MenuManager;
|
import net.runelite.client.menus.MenuManager;
|
||||||
import net.runelite.client.menus.WidgetMenuOption;
|
import net.runelite.client.menus.WidgetMenuOption;
|
||||||
|
import net.runelite.client.plugins.Plugin;
|
||||||
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
|
import net.runelite.client.plugins.PluginType;
|
||||||
import net.runelite.client.plugins.menuentryswapper.util.FairyRingMode;
|
import net.runelite.client.plugins.menuentryswapper.util.FairyRingMode;
|
||||||
import net.runelite.client.plugins.menuentryswapper.util.HouseMode;
|
import net.runelite.client.plugins.menuentryswapper.util.HouseMode;
|
||||||
import net.runelite.client.plugins.menuentryswapper.util.ObeliskMode;
|
import net.runelite.client.plugins.menuentryswapper.util.ObeliskMode;
|
||||||
import net.runelite.client.plugins.menuentryswapper.util.OccultAltarMode;
|
import net.runelite.client.plugins.menuentryswapper.util.OccultAltarMode;
|
||||||
import net.runelite.client.plugins.Plugin;
|
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
|
||||||
import net.runelite.client.plugins.PluginType;
|
|
||||||
import static net.runelite.client.util.MenuUtil.swap;
|
import static net.runelite.client.util.MenuUtil.swap;
|
||||||
import net.runelite.client.util.MiscUtils;
|
import net.runelite.client.util.MiscUtils;
|
||||||
import net.runelite.client.util.Text;
|
import net.runelite.client.util.Text;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Menu Entry Swapper",
|
name = "Menu Entry Swapper",
|
||||||
description = "Change the default option that is displayed when hovering over objects",
|
description = "Change the default option that is displayed when hovering over objects",
|
||||||
tags = {"npcs", "inventory", "items", "objects"},
|
tags = {"npcs", "inventory", "items", "objects"},
|
||||||
type = PluginType.UTILITY,
|
type = PluginType.UTILITY,
|
||||||
enabledByDefault = false
|
enabledByDefault = false
|
||||||
)
|
)
|
||||||
public class MenuEntrySwapperPlugin extends Plugin
|
public class MenuEntrySwapperPlugin extends Plugin
|
||||||
{
|
{
|
||||||
@@ -108,35 +108,35 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
private boolean buildingMode;
|
private boolean buildingMode;
|
||||||
|
|
||||||
private static final WidgetMenuOption FIXED_INVENTORY_TAB_CONFIGURE = new WidgetMenuOption(CONFIGURE,
|
private static final WidgetMenuOption FIXED_INVENTORY_TAB_CONFIGURE = new WidgetMenuOption(CONFIGURE,
|
||||||
MENU_TARGET, WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB);
|
MENU_TARGET, WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB);
|
||||||
|
|
||||||
private static final WidgetMenuOption FIXED_INVENTORY_TAB_SAVE = new WidgetMenuOption(SAVE,
|
private static final WidgetMenuOption FIXED_INVENTORY_TAB_SAVE = new WidgetMenuOption(SAVE,
|
||||||
MENU_TARGET, WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB);
|
MENU_TARGET, WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB);
|
||||||
|
|
||||||
private static final WidgetMenuOption RESIZABLE_INVENTORY_TAB_CONFIGURE = new WidgetMenuOption(CONFIGURE,
|
private static final WidgetMenuOption RESIZABLE_INVENTORY_TAB_CONFIGURE = new WidgetMenuOption(CONFIGURE,
|
||||||
MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_INVENTORY_TAB);
|
MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_INVENTORY_TAB);
|
||||||
|
|
||||||
private static final WidgetMenuOption RESIZABLE_INVENTORY_TAB_SAVE = new WidgetMenuOption(SAVE,
|
private static final WidgetMenuOption RESIZABLE_INVENTORY_TAB_SAVE = new WidgetMenuOption(SAVE,
|
||||||
MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_INVENTORY_TAB);
|
MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_INVENTORY_TAB);
|
||||||
|
|
||||||
private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_CONFIGURE = new WidgetMenuOption(CONFIGURE,
|
private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_CONFIGURE = new WidgetMenuOption(CONFIGURE,
|
||||||
MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_TAB);
|
MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_TAB);
|
||||||
|
|
||||||
private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_SAVE = new WidgetMenuOption(SAVE,
|
private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_SAVE = new WidgetMenuOption(SAVE,
|
||||||
MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_TAB);
|
MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_TAB);
|
||||||
|
|
||||||
private static final Set<MenuAction> NPC_MENU_TYPES = ImmutableSet.of(
|
private static final Set<MenuAction> NPC_MENU_TYPES = ImmutableSet.of(
|
||||||
MenuAction.NPC_FIRST_OPTION,
|
MenuAction.NPC_FIRST_OPTION,
|
||||||
MenuAction.NPC_SECOND_OPTION,
|
MenuAction.NPC_SECOND_OPTION,
|
||||||
MenuAction.NPC_THIRD_OPTION,
|
MenuAction.NPC_THIRD_OPTION,
|
||||||
MenuAction.NPC_FOURTH_OPTION,
|
MenuAction.NPC_FOURTH_OPTION,
|
||||||
MenuAction.NPC_FIFTH_OPTION,
|
MenuAction.NPC_FIFTH_OPTION,
|
||||||
MenuAction.EXAMINE_NPC);
|
MenuAction.EXAMINE_NPC);
|
||||||
|
|
||||||
private static final Splitter NEWLINE_SPLITTER = Splitter
|
private static final Splitter NEWLINE_SPLITTER = Splitter
|
||||||
.on("\n")
|
.on("\n")
|
||||||
.omitEmptyStrings()
|
.omitEmptyStrings()
|
||||||
.trimResults();
|
.trimResults();
|
||||||
|
|
||||||
private final Map<ComparableEntry, ComparableEntry> customSwaps = new HashMap<>();
|
private final Map<ComparableEntry, ComparableEntry> customSwaps = new HashMap<>();
|
||||||
|
|
||||||
@@ -180,7 +180,8 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
public void startUp()
|
public void startUp()
|
||||||
{
|
{
|
||||||
addSwaps();
|
addSwaps();
|
||||||
loadConstructionIDs(config.getConstructionItems());
|
//todo re-enable when fixed.
|
||||||
|
/*loadConstructionIDs(config.getConstructionItems());*/
|
||||||
|
|
||||||
if (config.shiftClickCustomization())
|
if (config.shiftClickCustomization())
|
||||||
{
|
{
|
||||||
@@ -194,7 +195,8 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
public void shutDown()
|
public void shutDown()
|
||||||
{
|
{
|
||||||
disableCustomization();
|
disableCustomization();
|
||||||
loadConstructionIDs("");
|
//todo re-enable when fixed.
|
||||||
|
/*loadConstructionIDs("");*/
|
||||||
loadCustomSwaps(""); // Removes all custom swaps
|
loadCustomSwaps(""); // Removes all custom swaps
|
||||||
removeSwaps();
|
removeSwaps();
|
||||||
}
|
}
|
||||||
@@ -206,8 +208,9 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//todo re-enable when fixed.
|
||||||
|
|
||||||
loadConstructionIDs(config.getConstructionItems());
|
/*loadConstructionIDs(config.getConstructionItems());*/
|
||||||
removeSwaps();
|
removeSwaps();
|
||||||
addSwaps();
|
addSwaps();
|
||||||
|
|
||||||
@@ -287,8 +290,8 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
public void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event)
|
public void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event)
|
||||||
{
|
{
|
||||||
if (event.getWidget() == WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB
|
if (event.getWidget() == WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB
|
||||||
|| event.getWidget() == WidgetInfo.RESIZABLE_VIEWPORT_INVENTORY_TAB
|
|| event.getWidget() == WidgetInfo.RESIZABLE_VIEWPORT_INVENTORY_TAB
|
||||||
|| event.getWidget() == WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_TAB)
|
|| event.getWidget() == WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_TAB)
|
||||||
{
|
{
|
||||||
configuringShiftClick = event.getMenuOption().equals(CONFIGURE) && Text.removeTags(event.getMenuTarget()).equals(MENU_TARGET);
|
configuringShiftClick = event.getMenuOption().equals(CONFIGURE) && Text.removeTags(event.getMenuTarget()).equals(MENU_TARGET);
|
||||||
refreshShiftClickCustomizationMenus();
|
refreshShiftClickCustomizationMenus();
|
||||||
@@ -302,8 +305,9 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//todo re-enable when fixed.
|
||||||
|
|
||||||
loadConstructionIDs(config.getConstructionItems());
|
/*loadConstructionIDs(config.getConstructionItems());*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -779,8 +783,8 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hintArrowNpc != null
|
if (hintArrowNpc != null
|
||||||
&& hintArrowNpc.getIndex() == eventId
|
&& hintArrowNpc.getIndex() == eventId
|
||||||
&& NPC_MENU_TYPES.contains(MenuAction.of(event.getType())))
|
&& NPC_MENU_TYPES.contains(MenuAction.of(event.getType())))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1071,7 +1075,7 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (config.swapFairyRingMode() != FairyRingMode.OFF && config.swapFairyRingMode() != FairyRingMode.ZANARIS
|
else if (config.swapFairyRingMode() != FairyRingMode.OFF && config.swapFairyRingMode() != FairyRingMode.ZANARIS
|
||||||
&& (option.equals("zanaris") || option.equals("configure") || option.equals("tree")))
|
&& (option.equals("zanaris") || option.equals("configure") || option.equals("tree")))
|
||||||
{
|
{
|
||||||
if (config.swapFairyRingMode() == FairyRingMode.LAST_DESTINATION)
|
if (config.swapFairyRingMode() == FairyRingMode.LAST_DESTINATION)
|
||||||
{
|
{
|
||||||
@@ -1189,6 +1193,36 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
swap(client, "teleport menu", option, target, true);
|
swap(client, "teleport menu", option, target, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.getTempConstruction() && buildingMode)
|
||||||
|
{
|
||||||
|
if (event.getType() == WALK.getId())
|
||||||
|
{
|
||||||
|
MenuEntry[] menuEntries = client.getMenuEntries();
|
||||||
|
MenuEntry menuEntry = menuEntries[menuEntries.length - 1];
|
||||||
|
menuEntry.setType(MenuAction.WALK.getId() + MENU_ACTION_DEPRIORITIZE_OFFSET);
|
||||||
|
client.setMenuEntries(menuEntries);
|
||||||
|
}
|
||||||
|
|
||||||
|
swap(client, "Build", option, target);
|
||||||
|
|
||||||
|
MenuEntry[] entries = client.getMenuEntries();
|
||||||
|
for (int i = entries.length - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
for (String temp : config.getTempConstructionItems().split(","))
|
||||||
|
{
|
||||||
|
if (temp.equalsIgnoreCase(Text.removeTags(entries[i].getTarget())))
|
||||||
|
{
|
||||||
|
if (entries[i].getType() == 3 || entries[i].getType() == 1002)
|
||||||
|
{
|
||||||
|
entries = ArrayUtils.remove(entries, i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
client.setMenuEntries(entries);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -1409,11 +1443,12 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
return location.getRegionID() == PURO_PURO_REGION_ID;
|
return location.getRegionID() == PURO_PURO_REGION_ID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//todo re-enable when fixed.
|
||||||
|
|
||||||
private void loadConstructionIDs(String from)
|
/* private void loadConstructionIDs(String from)
|
||||||
{
|
{
|
||||||
if (client.getGameState() != GameState.LOGGED_IN
|
if (client.getGameState() != GameState.LOGGED_IN
|
||||||
|| Strings.isNullOrEmpty(from) && leftClickConstructionIDs.isEmpty())
|
|| Strings.isNullOrEmpty(from) && leftClickConstructionIDs.isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1430,8 +1465,8 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (config.getEasyConstruction() &&
|
if (config.getEasyConstruction() &&
|
||||||
!Strings.isNullOrEmpty(from) &&
|
!Strings.isNullOrEmpty(from) &&
|
||||||
buildingMode)
|
buildingMode)
|
||||||
{
|
{
|
||||||
for (String s : Text.fromCSV(from))
|
for (String s : Text.fromCSV(from))
|
||||||
{
|
{
|
||||||
@@ -1443,13 +1478,13 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (menuManager.toggleLeftClick("build", id, false)
|
if (menuManager.toggleLeftClick("build", id, false)
|
||||||
|| menuManager.toggleLeftClick("remove", id, false))
|
|| menuManager.toggleLeftClick("remove", id, false))
|
||||||
{
|
{
|
||||||
leftClickConstructionIDs.add(id);
|
leftClickConstructionIDs.add(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
void startShift()
|
void startShift()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user