menuentryswapper: Left Click options within Bank (#2198)

* MES: Left click bank actions (eat, wield, wear, drink)
This commit is contained in:
Kyle
2020-01-10 10:52:53 +00:00
committed by GitHub
parent 3e60d3a0a2
commit 4b28420e67
2 changed files with 126 additions and 29 deletions

View File

@@ -170,6 +170,17 @@ public interface MenuEntrySwapperConfig extends Config
return false;
}
@ConfigSection(
name = "Hotkey Swapping",
description = "",
position = 1,
keyName = "hotkeySwapping"
)
default boolean hotkeySwapping()
{
return false;
}
//------------------------------------------------------------//
// Banking
//------------------------------------------------------------//
@@ -464,17 +475,6 @@ public interface MenuEntrySwapperConfig extends Config
// Miscellaneous
//------------------------------------------------------------//
@ConfigItem(
keyName = "hotkeyMod",
name = "Hotkey for Swaps",
description = "Set this hotkey to do custom swaps on hotkeys.",
position = 0,
section = "miscellaneousSection"
)
default Keybind hotkeyMod()
{
return Keybind.SHIFT;
}
@ConfigItem(
keyName = "customSwaps",
@@ -492,23 +492,6 @@ public interface MenuEntrySwapperConfig extends Config
return "";
}
@ConfigItem(
keyName = "shiftCustomSwaps",
name = "Hotkey Swaps",
description = "Add custom swaps here that will only be activated when you press your hotkey." +
"<br>1 per line. Syntax: option,target:priority" +
"<br>Note that the higher your set the priority, the more it will overtake over swaps.",
position = 2,
section = "miscellaneousSection",
parse = true,
clazz = CustomSwapParse.class,
method = "parse"
)
default String shiftCustomSwaps()
{
return "";
}
@ConfigItem(
keyName = "prioEntry",
name = "Prioritize Entry",
@@ -1939,4 +1922,89 @@ public interface MenuEntrySwapperConfig extends Config
{
return "cure other, energy transfer, heal other, vengeance other";
}
//------------------------------------------------------------//
// HotKey menu swaps
//------------------------------------------------------------//
@ConfigItem(
keyName = "hotkeyMod",
name = "Hotkey for Swaps",
description = "Set this hotkey to do custom swaps on hotkeys.",
position = 0,
section = "hotkeySwapping"
)
default Keybind hotkeyMod()
{
return Keybind.SHIFT;
}
@ConfigItem(
keyName = "shiftCustomSwaps",
name = "Hotkey Swaps",
description = "Add custom swaps here that will only be activated when you press your hotkey." +
"<br>1 per line. Syntax: option,target:priority" +
"<br>Note that the higher your set the priority, the more it will overtake over swaps.",
position = 1,
section = "hotkeySwapping",
parse = true,
clazz = CustomSwapParse.class,
method = "parse"
)
default String shiftCustomSwaps()
{
return "";
}
@ConfigItem(
keyName = "bankWieldItem",
name = "Left Click 'Wield' In Bank Screen",
description = "Enables Hotkey Left Click 'Wield' In Bank When Pressing The Hotkey",
position = 2,
section = "hotkeySwapping"
)
default boolean bankWieldItem()
{
return false;
}
@ConfigItem(
keyName = "bankWearItem",
name = "Left Click 'Wear' In Bank Screen",
description = "Enables Hotkey Left Click 'Wear' In Bank When Pressing The Hotkey",
position = 3,
section = "hotkeySwapping"
)
default boolean bankWearItem()
{
return false;
}
@ConfigItem(
keyName = "bankEatItem",
name = "Left Click 'Eat' In Bank Screen",
description = "Enables Left Click 'Eat' In Bank When Pressing The Hotkey",
position = 4,
section = "hotkeySwapping"
)
default boolean bankEatItem()
{
return false;
}
@ConfigItem(
keyName = "bankDrinkItem",
name = "Left Click 'Drink' In Bank Screen",
description = "Enables Left Click 'Drink' In Bank When Pressing The Hotkey",
position = 5,
section = "hotkeySwapping"
)
default boolean bankDrinkItem()
{
return false;
}
}

View File

@@ -260,6 +260,10 @@ public class MenuEntrySwapperPlugin extends Plugin
private boolean swapBoxTrap;
private boolean swapChase;
private boolean swapClimbUpDown;
private boolean bankWieldItem;
private boolean bankWearItem;
private boolean bankEatItem;
private boolean bankDrinkItem;
private final HotkeyListener hotkey = new HotkeyListener(() -> this.hotkeyMod)
{
@Override
@@ -1464,6 +1468,23 @@ public class MenuEntrySwapperPlugin extends Plugin
{
loadCustomSwaps(this.configCustomShiftSwaps, customShiftSwaps);
if (this.bankWieldItem)
{
menuManager.addPriorityEntry(new BankComparableEntry("wield", "", false));
}
if (this.bankWearItem)
{
menuManager.addPriorityEntry(new BankComparableEntry("wear", "", false));
}
if (this.bankEatItem)
{
menuManager.addPriorityEntry(new BankComparableEntry("eat", "", false));
}
if (this.bankDrinkItem)
{
menuManager.addPriorityEntry(new BankComparableEntry("drink", "", false));
}
if (this.swapClimbUpDown)
{
menuManager.addPriorityEntry("climb-up").setPriority(100);
@@ -1480,6 +1501,10 @@ public class MenuEntrySwapperPlugin extends Plugin
private void removeHotkey(ClientTick event)
{
menuManager.removePriorityEntry("climb-up");
menuManager.removePriorityEntry(new BankComparableEntry("wield", "", false));
menuManager.removePriorityEntry(new BankComparableEntry("wear", "", false));
menuManager.removePriorityEntry(new BankComparableEntry("eat", "", false));
menuManager.removePriorityEntry(new BankComparableEntry("drink", "", false));
loadCustomSwaps("", customShiftSwaps);
eventBus.unregister(HOTKEY);
}
@@ -1711,6 +1736,10 @@ public class MenuEntrySwapperPlugin extends Plugin
this.swapHouseAd = config.swapHouseAd();
this.swapHouseAdMode = config.swapHouseAdMode();
this.swapJewelleryBox = config.swapJewelleryBox();
this.bankWieldItem = config.bankWieldItem();
this.bankWearItem = config.bankWearItem();
this.bankEatItem = config.bankEatItem();
this.bankDrinkItem = config.bankDrinkItem();
}
private void addBuySellEntries()
@@ -1965,4 +1994,4 @@ public class MenuEntrySwapperPlugin extends Plugin
removedObjects = null;
}
}
}
}