MES: various updates

Removed left click destination due to jagex adding this.

removed charter option as it was unused and covered under swap travel.

amended swapabyssteleport to actually be used.
This commit is contained in:
xKylee
2019-12-05 22:31:07 +00:00
parent eba140c8a5
commit 796b2dc422
6 changed files with 5 additions and 913 deletions

View File

@@ -34,7 +34,6 @@ import net.runelite.client.config.ConfigSection;
import net.runelite.client.config.Keybind;
import net.runelite.client.plugins.menuentryswapper.util.ArdougneCloakMode;
import net.runelite.client.plugins.menuentryswapper.util.BurningAmuletMode;
import net.runelite.client.plugins.menuentryswapper.util.CharterOption;
import net.runelite.client.plugins.menuentryswapper.util.CombatBraceletMode;
import net.runelite.client.plugins.menuentryswapper.util.ConstructionCapeMode;
import net.runelite.client.plugins.menuentryswapper.util.ConstructionMode;
@@ -826,18 +825,6 @@ public interface MenuEntrySwapperConfig extends Config
return false;
}
@ConfigItem(
keyName = "charterOption",
name = "Trader Crew",
description = "Configure whether you want Charter or Trade to be the first option of Trader Crewmembers.",
position = 27,
section = "miscellaneousSection"
)
default CharterOption charterOption()
{
return CharterOption.TRADE;
}
//------------------------------------------------------------//
// Shop / Stores
//------------------------------------------------------------//
@@ -1319,17 +1306,6 @@ public interface MenuEntrySwapperConfig extends Config
// Teleportation
//------------------------------------------------------------//
@ConfigItem(
keyName = "lastJewel",
name = "Last Destination for Jewellery Box",
description = "Adds a \"Last-destination\" menu option when Jewellery Boxes are right clicked",
section = "teleportationSection"
)
default boolean lastJewel()
{
return true;
}
@ConfigItem(
keyName = "swapFairyRing",
name = "Fairy Ring",
@@ -1951,23 +1927,4 @@ public interface MenuEntrySwapperConfig extends Config
{
return "cure other, energy transfer, heal other, vengeance other";
}
@ConfigItem(
keyName = "lastDes",
name = "",
description = "Last jewellery box destination (option)",
hidden = true
)
default String lastDes()
{
return "";
}
@ConfigItem(
keyName = "lastDes",
name = "",
description = "Last jewellery box destination (option)",
hidden = true
)
void lastDes(String des);
}

View File

@@ -62,16 +62,10 @@ import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.ClientTick;
import net.runelite.api.events.FocusChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.Menu;
import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.events.MenuOpened;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.events.ScriptCallbackEvent;
import net.runelite.api.events.VarbitChanged;
import net.runelite.api.util.Text;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetID;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.config.Keybind;
@@ -96,7 +90,6 @@ import net.runelite.client.plugins.menuentryswapper.comparables.ShopComparableEn
import net.runelite.client.plugins.menuentryswapper.comparables.WithdrawComparableEntry;
import net.runelite.client.plugins.menuentryswapper.util.ArdougneCloakMode;
import net.runelite.client.plugins.menuentryswapper.util.BurningAmuletMode;
import net.runelite.client.plugins.menuentryswapper.util.CharterOption;
import net.runelite.client.plugins.menuentryswapper.util.CombatBraceletMode;
import net.runelite.client.plugins.menuentryswapper.util.ConstructionCapeMode;
import net.runelite.client.plugins.menuentryswapper.util.ConstructionMode;
@@ -108,7 +101,6 @@ import net.runelite.client.plugins.menuentryswapper.util.GamesNecklaceMode;
import net.runelite.client.plugins.menuentryswapper.util.GloryMode;
import net.runelite.client.plugins.menuentryswapper.util.HouseAdvertisementMode;
import net.runelite.client.plugins.menuentryswapper.util.HouseMode;
import net.runelite.client.plugins.menuentryswapper.util.JewelleryBoxDestination;
import net.runelite.client.plugins.menuentryswapper.util.MaxCapeMode;
import net.runelite.client.plugins.menuentryswapper.util.NecklaceOfPassageMode;
import net.runelite.client.plugins.menuentryswapper.util.ObeliskMode;
@@ -123,7 +115,6 @@ import net.runelite.client.plugins.pvptools.PvpToolsConfig;
import net.runelite.client.plugins.pvptools.PvpToolsPlugin;
import net.runelite.client.util.HotkeyListener;
import static net.runelite.client.util.MenuUtil.swap;
import org.apache.commons.lang3.ArrayUtils;
@PluginDescriptor(
name = "Menu Entry Swapper",
@@ -140,10 +131,6 @@ public class MenuEntrySwapperPlugin extends Plugin
private static final Object CONTROL = new Object();
private static final Object HOTKEY_CHECK = new Object();
private static final Object CONTROL_CHECK = new Object();
private static final Object JEWEL_CLICKED = new Object();
private static final Object JEWEL_TELE = new Object();
private static final Object JEWEL_WIDGET = new Object();
private static final int PURO_PURO_REGION_ID = 10307;
private static final Set<MenuOpcode> NPC_MENU_TYPES = ImmutableSet.of(
MenuOpcode.NPC_FIRST_OPTION, MenuOpcode.NPC_SECOND_OPTION, MenuOpcode.NPC_THIRD_OPTION,
@@ -202,7 +189,6 @@ public class MenuEntrySwapperPlugin extends Plugin
private List<String> bankItemNames = new ArrayList<>();
private BurningAmuletMode getBurningAmuletMode;
private CharterOption charterOption;
private CombatBraceletMode getCombatBraceletMode;
private ArdougneCloakMode ardougneCloakMode;
private ConstructionCapeMode constructionCapeMode;
@@ -304,8 +290,6 @@ public class MenuEntrySwapperPlugin extends Plugin
private boolean swapTravel;
private boolean swapWildernessLever;
private JewelleryBoxDestination lastDes;
@Provides
MenuEntrySwapperConfig provideConfig(ConfigManager configManager)
{
@@ -315,13 +299,9 @@ public class MenuEntrySwapperPlugin extends Plugin
@Override
public void startUp()
{
this.lastDes = JewelleryBoxDestination.withOption(config.lastDes());
updateConfig();
if (config.lastJewel())
{
eventBus.subscribe(MenuOptionClicked.class, JEWEL_CLICKED, this::onMenuOptionClicked);
}
addSwaps();
loadConstructionItems();
loadCustomSwaps(config.customSwaps(), customSwaps);
@@ -414,16 +394,6 @@ public class MenuEntrySwapperPlugin extends Plugin
case "removedObjects":
updateRemovedObjects();
return;
case "lastJewel":
if (config.lastJewel())
{
eventBus.subscribe(MenuOptionClicked.class, JEWEL_CLICKED, this::onMenuOptionClicked);
}
else
{
eventBus.unregister(JEWEL_CLICKED);
}
return;
}
if (event.getKey().startsWith("swapSell") || event.getKey().startsWith("swapBuy") ||
@@ -551,21 +521,6 @@ public class MenuEntrySwapperPlugin extends Plugin
}
}
if (config.lastJewel() && option.equals("teleport") && entry.getTarget().contains("Jewellery Box") && lastDes != null)
{
final MenuEntry lastDesEntry = new MenuEntry();
lastDesEntry.setOpcode(MenuOpcode.PRIO_RUNELITE.getId());
lastDesEntry.setOption(lastDes.getOption());
lastDesEntry.setTarget(entry.getTarget());
lastDesEntry.setIdentifier(entry.getIdentifier());
lastDesEntry.setParam0(entry.getParam0());
lastDesEntry.setParam1(entry.getParam1());
menu_entries.add(lastDesEntry);
}
menu_entries.add(entry);
}
@@ -734,83 +689,6 @@ public class MenuEntrySwapperPlugin extends Plugin
}
}
private void onMenuOptionClicked(MenuOptionClicked entry)
{
if (entry.getOpcode() == MenuOpcode.WIDGET_DEFAULT.getId() &&
WidgetInfo.TO_GROUP(entry.getParam1()) == WidgetID.JEWELLERY_BOX_GROUP_ID)
{
if (entry.getOption().equals(lastDes == null ? null : lastDes.getOption()))
{
return;
}
JewelleryBoxDestination newDest = JewelleryBoxDestination.withOption(entry.getOption());
if (newDest == null)
{
return;
}
lastDes = newDest;
config.lastDes(lastDes.getOption());
}
else if (entry.getOption().equals("Teleport") && entry.getTarget().contains("Jewellery Box"))
{
eventBus.unregister(JEWEL_WIDGET);
}
else if (lastDes != null &&
entry.getOpcode() == MenuOpcode.PRIO_RUNELITE.getId() &&
entry.getOption().equals(lastDes.getOption()))
{
entry.setOption("Teleport");
entry.setOpcode(MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId());
eventBus.subscribe(ScriptCallbackEvent.class, JEWEL_WIDGET, this::onScriptCallback);
}
}
private void onScriptCallback(ScriptCallbackEvent event)
{
if (!event.getEventName().equals("jewelleryBoxDone"))
{
return;
}
eventBus.unregister(JEWEL_WIDGET);
// Use a event so we don't accidentally run another script before returning
// menu also is when jagex is probably expecting input like this so :)
eventBus.subscribe(Menu.class, JEWEL_TELE, this::teleportInputs);
}
private void teleportInputs(Menu menu)
{
final Widget parent = client.getWidget(lastDes.getParent());
if (parent == null)
{
return;
}
final Widget child = parent.getChild(lastDes.getChildIndex());
if (child == null)
{
return;
}
Object[] args = child.getOnOp();
if (args == null)
{
return;
}
// Replace opIndex with 1
args[ArrayUtils.indexOf(args, 0x80000004)] = 1;
client.runScript(args);
eventBus.unregister(JEWEL_TELE);
menu.dontRun();
}
private void loadCustomSwaps(String config, Map<AbstractComparableEntry, Integer> map)
{
final Map<AbstractComparableEntry, Integer> tmp = new HashMap<>();
@@ -1011,6 +889,10 @@ public class MenuEntrySwapperPlugin extends Plugin
menuManager.addPriorityEntry("Rellekka");
menuManager.addPriorityEntry("Follow", "Elkoy").setPriority(10);
menuManager.addPriorityEntry("Transport");
}
if (this.swapAbyssTeleport)
{
menuManager.addPriorityEntry("Teleport", "Mage of zamorak").setPriority(10);
}
@@ -1680,7 +1562,6 @@ public class MenuEntrySwapperPlugin extends Plugin
private void updateConfig()
{
this.charterOption = config.charterOption();
this.configCustomShiftSwaps = config.shiftCustomSwaps();
this.configCustomSwaps = config.customSwaps();
this.ardougneCloakMode = config.ardougneCloakMode();

View File

@@ -1,20 +0,0 @@
package net.runelite.client.plugins.menuentryswapper.util;
public enum CharterOption
{
TRADE("Trade"),
CHARTER("Charter");
private final String name;
CharterOption(String name)
{
this.name = name;
}
@Override
public String toString()
{
return name;
}
}

View File

@@ -1,88 +0,0 @@
/*
* Copyright (c) 2019, Lucas <https://github.com/lucwousin>
* 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.plugins.menuentryswapper.util;
import com.google.common.collect.ImmutableMap;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import net.runelite.api.widgets.WidgetInfo;
@RequiredArgsConstructor
@Getter
public enum JewelleryBoxDestination
{
DUEL_ARENA("Duel Arena", WidgetInfo.JEWELLERY_BOX_DUEL_RING, 5),
CASTLE_WARS("Castle Wars", WidgetInfo.JEWELLERY_BOX_DUEL_RING, 6),
CLAN_WARS("Clan Wars", WidgetInfo.JEWELLERY_BOX_DUEL_RING, 7),
BURTHORPE("Burthorpe", WidgetInfo.JEWELLERY_BOX_GAME_NECK, 5),
BARB_OUTPOST("Barbarian Outpost", WidgetInfo.JEWELLERY_BOX_GAME_NECK, 6),
CORP("Corporeal Beast", WidgetInfo.JEWELLERY_BOX_GAME_NECK, 7),
TEARS_OF_GUTHIX("Tears of Guthix", WidgetInfo.JEWELLERY_BOX_GAME_NECK, 8),
WINTERTODT("Wintertodt Camp", WidgetInfo.JEWELLERY_BOX_GAME_NECK, 9),
WARRIOR_GUILD("Warriors' Guild", WidgetInfo.JEWELLERY_BOX_COMB_BRAC, 5),
CHAMPION_GUILD("Champions' Guild", WidgetInfo.JEWELLERY_BOX_COMB_BRAC, 6),
MONASTERY("Monastery", WidgetInfo.JEWELLERY_BOX_COMB_BRAC, 7),
RANGING_GUILD("Ranging Guild", WidgetInfo.JEWELLERY_BOX_COMB_BRAC, 8),
FISHING_GUILD("Fishing Guild", WidgetInfo.JEWELLERY_BOX_SKIL_NECK, 5),
MINING_GUILD("Mining Guild", WidgetInfo.JEWELLERY_BOX_SKIL_NECK, 6),
CRAFTING_GUILD("Crafting Guild", WidgetInfo.JEWELLERY_BOX_SKIL_NECK, 7),
COOKING_GUILD("Cooking Guild", WidgetInfo.JEWELLERY_BOX_SKIL_NECK, 8),
WOODCUTTING_GUILD("Woodcutting Guild", WidgetInfo.JEWELLERY_BOX_SKIL_NECK, 9),
FARMING_GUILD("Farming Guild", WidgetInfo.JEWELLERY_BOX_SKIL_NECK, 10),
MISCELLANIA("Miscellania", WidgetInfo.JEWELLERY_BOX_RING_OFGP, 5),
GRAND_EXCHANGE("Grand Exchange", WidgetInfo.JEWELLERY_BOX_RING_OFGP, 6),
FALADOR_PARK("Falador Park", WidgetInfo.JEWELLERY_BOX_RING_OFGP, 7),
DONDAKAN("Dondakan's Rock", WidgetInfo.JEWELLERY_BOX_RING_OFGP, 8),
EDGEVILLE("Edgeville", WidgetInfo.JEWELLERY_BOX_AMUL_GLOR, 5),
KARAMJA("Karamja", WidgetInfo.JEWELLERY_BOX_AMUL_GLOR, 6),
DRAYNOR("Draynor Village", WidgetInfo.JEWELLERY_BOX_AMUL_GLOR, 7),
AL_KHARID("Al Kharid", WidgetInfo.JEWELLERY_BOX_AMUL_GLOR, 8);
final String option;
final WidgetInfo parent;
final int childIndex;
private static final ImmutableMap<String, JewelleryBoxDestination> map;
static
{
final ImmutableMap.Builder<String, JewelleryBoxDestination> builder = ImmutableMap.builderWithExpectedSize(values().length);
for (JewelleryBoxDestination val : values())
{
builder.put(val.option, val);
}
map = builder.build();
}
public static JewelleryBoxDestination withOption(String option)
{
return map.get(option);
}
}