From 82a35b0a6822d3d21198b0b16fd49767addf4f52 Mon Sep 17 00:00:00 2001 From: Kyle <48519776+xKylee@users.noreply.github.com> Date: Thu, 19 Dec 2019 11:17:21 +0000 Subject: [PATCH] MES: add left click last destination (#2141) MES: add left click last destination --- .../MenuEntrySwapperConfig.java | 12 ++ .../MenuEntrySwapperPlugin.java | 118 ++++++++++-------- 2 files changed, 76 insertions(+), 54 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java index 86992086ae..d4facf43aa 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java @@ -1706,6 +1706,18 @@ public interface MenuEntrySwapperConfig extends Config return SlayerRingMode.CHECK; } + @ConfigItem( + keyName = "swapJewelleryBox", + name = "Jewellery Box", + description = "Swap Teleport Menu with previous destination on Jewellery Box", + position = 31, + section = "teleportationSection" + ) + default boolean swapJewelleryBox() + { + return false; + } + //------------------------------------------------------------// // Right Click Options //------------------------------------------------------------// diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java index 15740153ef..fc6fe5a19e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java @@ -34,6 +34,7 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; import com.google.inject.Provides; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -136,38 +137,44 @@ public class MenuEntrySwapperPlugin extends Plugin MenuOpcode.NPC_FIRST_OPTION, MenuOpcode.NPC_SECOND_OPTION, MenuOpcode.NPC_THIRD_OPTION, MenuOpcode.NPC_FOURTH_OPTION, MenuOpcode.NPC_FIFTH_OPTION, MenuOpcode.EXAMINE_NPC ); + private static final List jewelleryBox = Arrays.asList( + "duel arena", "castle wars", "clan wars", "burthorpe", "barbarian outpost", "corporeal beast", + "tears of guthix", "wintertodt camp", "warriors' guild", "champions' guild", "monastery", "ranging guild", + "fishing guild", "mining guild", "crafting guild", "cooking guild", "woodcutting guild", "farming guild", + "miscellania", "grand exchange", "falador park", "dondakan's rock", "edgeville", "karamja", + "draynor village", "al kharid" + ); + private static final Splitter NEWLINE_SPLITTER = Splitter .on("\n") .omitEmptyStrings() .trimResults(); - + private final Map customSwaps = new HashMap<>(); + private final Map customShiftSwaps = new HashMap<>(); + private final Map dePrioSwaps = new HashMap<>(); + // 1, 5, 10, 50 + private final AbstractComparableEntry[][] buyEntries = new AbstractComparableEntry[4][]; + private final AbstractComparableEntry[][] sellEntries = new AbstractComparableEntry[4][]; + // 1, 5, 10, X, All + private final AbstractComparableEntry[][] withdrawEntries = new AbstractComparableEntry[5][]; @Inject private Client client; - @Inject private ClientThread clientThread; - @Inject private MenuEntrySwapperConfig config; - @Inject private PluginManager pluginManager; - @Inject private MenuManager menuManager; - @Inject private KeyManager keyManager; - @Inject private EventBus eventBus; - @Inject private PvpToolsPlugin pvpTools; - @Inject private PvpToolsConfig pvpToolsConfig; - private boolean buildingMode; private boolean inTobRaid = false; private boolean inCoxRaid = false; @@ -175,16 +182,6 @@ public class MenuEntrySwapperPlugin extends Plugin private boolean hotkeyActive; @Setter(AccessLevel.PRIVATE) private boolean controlActive; - private final Map customSwaps = new HashMap<>(); - private final Map customShiftSwaps = new HashMap<>(); - private final Map dePrioSwaps = new HashMap<>(); - - // 1, 5, 10, 50 - private final AbstractComparableEntry[][] buyEntries = new AbstractComparableEntry[4][]; - private final AbstractComparableEntry[][] sellEntries = new AbstractComparableEntry[4][]; - // 1, 5, 10, X, All - private final AbstractComparableEntry[][] withdrawEntries = new AbstractComparableEntry[5][]; - private String[] removedObjects; private List bankItemNames = new ArrayList<>(); @@ -263,6 +260,38 @@ public class MenuEntrySwapperPlugin extends Plugin private boolean swapBoxTrap; private boolean swapChase; private boolean swapClimbUpDown; + private final HotkeyListener hotkey = new HotkeyListener(() -> this.hotkeyMod) + { + @Override + public void hotkeyPressed() + { + startHotkey(); + setHotkeyActive(true); + } + + @Override + public void hotkeyReleased() + { + stopHotkey(); + setHotkeyActive(false); + } + }; + private final HotkeyListener ctrlHotkey = new HotkeyListener(() -> Keybind.CTRL) + { + @Override + public void hotkeyPressed() + { + startControl(); + setControlActive(true); + } + + @Override + public void hotkeyReleased() + { + stopControl(); + setControlActive(false); + } + }; private boolean swapCoalBag; private boolean swapContract; private boolean swapEnchant; @@ -289,6 +318,7 @@ public class MenuEntrySwapperPlugin extends Plugin private boolean swapTrade; private boolean swapTravel; private boolean swapWildernessLever; + private boolean swapJewelleryBox; @Provides MenuEntrySwapperConfig provideConfig(ConfigManager configManager) @@ -1179,6 +1209,14 @@ public class MenuEntrySwapperPlugin extends Plugin { menuManager.addPriorityEntry(new GrimyHerbComparableEntry(this.swapGrimyHerbMode, client)); } + + if (this.swapJewelleryBox) + { + for (String jewellerybox : jewelleryBox) + { + menuManager.addPriorityEntry(jewellerybox); + } + } } private void removeSwaps() @@ -1301,6 +1339,10 @@ public class MenuEntrySwapperPlugin extends Plugin menuManager.removePriorityEntry(this.questCapeMode.toString(), "quest point cape"); menuManager.removePriorityEntry(this.swapHouseAdMode.getEntry()); menuManager.removeSwap("Bury", "bone", "Use"); + for (String jewellerybox : jewelleryBox) + { + menuManager.removePriorityEntry(jewellerybox); + } switch (this.swapFairyRingMode) { @@ -1369,6 +1411,7 @@ public class MenuEntrySwapperPlugin extends Plugin menuManager.removePriorityEntry("Friend's house"); break; } + } private boolean isPuroPuro() @@ -1663,6 +1706,7 @@ public class MenuEntrySwapperPlugin extends Plugin this.swapWildernessLever = config.swapWildernessLever(); this.swapHouseAd = config.swapHouseAd(); this.swapHouseAdMode = config.swapHouseAdMode(); + this.swapJewelleryBox = config.swapJewelleryBox(); } private void addBuySellEntries() @@ -1917,38 +1961,4 @@ public class MenuEntrySwapperPlugin extends Plugin removedObjects = null; } } - - private final HotkeyListener hotkey = new HotkeyListener(() -> this.hotkeyMod) - { - @Override - public void hotkeyPressed() - { - startHotkey(); - setHotkeyActive(true); - } - - @Override - public void hotkeyReleased() - { - stopHotkey(); - setHotkeyActive(false); - } - }; - - private final HotkeyListener ctrlHotkey = new HotkeyListener(() -> Keybind.CTRL) - { - @Override - public void hotkeyPressed() - { - startControl(); - setControlActive(true); - } - - @Override - public void hotkeyReleased() - { - stopControl(); - setControlActive(false); - } - }; }