menu entry swapper: add house teleport swap

This used to use the shift-click teleport spells option, but now that
there are 4 different teleport spells, a dedicated swap config is best.

Co-authored-by: Adam <Adam@sigterm.info>
This commit is contained in:
EliasLahham
2022-04-03 14:35:41 -04:00
committed by Adam
parent 1c99cce336
commit 1f5ca21546
2 changed files with 42 additions and 4 deletions

View File

@@ -24,6 +24,7 @@
*/ */
package net.runelite.client.plugins.menuentryswapper; package net.runelite.client.plugins.menuentryswapper;
import lombok.RequiredArgsConstructor;
import net.runelite.client.config.Config; import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem; import net.runelite.client.config.ConfigItem;
@@ -612,10 +613,38 @@ public interface MenuEntrySwapperConfig extends Config
return true; return true;
} }
@RequiredArgsConstructor
enum HouseTeleportMode
{
CAST("Cast"),
OUTSIDE("Outside"),
GROUP_CHOOSE("Group: Choose"),
GROUP_PREVIOUS("Group: Previous");
private final String name;
@Override
public String toString()
{
return name;
}
}
@ConfigItem(
keyName = "swapHouseTeleportSpell",
name = "House teleport",
description = "Swap house teleport spell to a different destination on shift",
section = uiSection
)
default HouseTeleportMode swapHouseTeleportSpell()
{
return HouseTeleportMode.OUTSIDE;
}
@ConfigItem( @ConfigItem(
keyName = "swapTeleportSpell", keyName = "swapTeleportSpell",
name = "Shift-click teleport spells", name = "Shift-click teleport spells",
description = "Swap teleport spells that have a second destination on shift", description = "Swap teleport spells that have a second destination, except for teleport to house, on shift",
section = uiSection section = uiSection
) )
default boolean swapTeleportSpell() default boolean swapTeleportSpell()
@@ -659,8 +688,7 @@ public interface MenuEntrySwapperConfig extends Config
@ConfigItem( @ConfigItem(
keyName = "swapGEAbort", keyName = "swapGEAbort",
name = "GE Abort", name = "GE Abort",
description = "Swap abort offer on Grand Exchange offers when shift-clicking" description = "Swap abort offer on Grand Exchange offers when shift-clicking",
,
section = uiSection section = uiSection
) )
default boolean swapGEAbort() default boolean swapGEAbort()

View File

@@ -423,7 +423,11 @@ public class MenuEntrySwapperPlugin extends Plugin
swapTeleport("varrock teleport", "grand exchange"); swapTeleport("varrock teleport", "grand exchange");
swapTeleport("camelot teleport", "seers'"); swapTeleport("camelot teleport", "seers'");
swapTeleport("watchtower teleport", "yanille"); swapTeleport("watchtower teleport", "yanille");
swapTeleport("teleport to house", "outside");
swapHouseTeleport("cast", () -> shiftModifier() && config.swapHouseTeleportSpell() == MenuEntrySwapperConfig.HouseTeleportMode.CAST);
swapHouseTeleport("outside", () -> shiftModifier() && config.swapHouseTeleportSpell() == MenuEntrySwapperConfig.HouseTeleportMode.OUTSIDE);
swapHouseTeleport("group: choose", () -> shiftModifier() && config.swapHouseTeleportSpell() == MenuEntrySwapperConfig.HouseTeleportMode.GROUP_CHOOSE);
swapHouseTeleport("group: previous", () -> shiftModifier() && config.swapHouseTeleportSpell() == MenuEntrySwapperConfig.HouseTeleportMode.GROUP_PREVIOUS);
swap("eat", "guzzle", config::swapRockCake); swap("eat", "guzzle", config::swapRockCake);
@@ -459,6 +463,12 @@ public class MenuEntrySwapperPlugin extends Plugin
swap(swappedOption, option, "cast", () -> shiftModifier() && config.swapTeleportSpell()); swap(swappedOption, option, "cast", () -> shiftModifier() && config.swapTeleportSpell());
} }
private void swapHouseTeleport(String swappedOption, Supplier<Boolean> enabled)
{
swap("cast", "teleport to house", swappedOption, enabled);
swap("outside", "teleport to house", swappedOption, enabled);
}
@Subscribe @Subscribe
public void onConfigChanged(ConfigChanged event) public void onConfigChanged(ConfigChanged event)
{ {