From 80e99f0263f8d4f812011c518a0541fc624e0a5f Mon Sep 17 00:00:00 2001 From: eric-weaver Date: Sun, 15 Sep 2019 17:18:10 -0400 Subject: [PATCH] menu entry swapper: add house advertisement board --- .../HouseAdvertisementMode.java | 45 +++++++++++++++++++ .../MenuEntrySwapperConfig.java | 14 +++++- .../MenuEntrySwapperPlugin.java | 12 +++++ 3 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/HouseAdvertisementMode.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/HouseAdvertisementMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/HouseAdvertisementMode.java new file mode 100644 index 0000000000..98860253bd --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/HouseAdvertisementMode.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2019, Adam + * 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; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum HouseAdvertisementMode +{ + VIEW("View"), + ADD_HOUSE("Add-House"), + VISIT_LAST("Visit-Last"); + + private final String name; + + @Override + public String toString() + { + return name; + } +} 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 b7decee5d0..e687522286 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 @@ -99,7 +99,7 @@ public interface MenuEntrySwapperConfig extends Config ) default boolean swapContract() { - return true; + return true; } @ConfigItem( @@ -122,7 +122,7 @@ public interface MenuEntrySwapperConfig extends Config return true; } - @ConfigItem( + @ConfigItem( keyName = "swapDarkMage", name = "Repairs", description = "Swap Talk-to with Repairs for Dark Mage" @@ -192,6 +192,16 @@ public interface MenuEntrySwapperConfig extends Config return HouseMode.HOME; } + @ConfigItem( + keyName = "swapHouseAdvertisement", + name = "House Advertisement", + description = "Swap View with Add-House or Visit-Last on House Advertisement board" + ) + default HouseAdvertisementMode swapHouseAdvertisement() + { + return HouseAdvertisementMode.VIEW; + } + @ConfigItem( keyName = "swapPickpocket", name = "Pickpocket", 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 74241613f2..d19b47455f 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 @@ -498,6 +498,18 @@ public class MenuEntrySwapperPlugin extends Plugin break; } } + else if (config.swapHouseAdvertisement() != HouseAdvertisementMode.VIEW && option.equals("view")) + { + switch (config.swapHouseAdvertisement()) + { + case ADD_HOUSE: + swap("add-house", option, target, index); + break; + case VISIT_LAST: + swap("visit-last", option, target, index); + break; + } + } else if (config.swapFairyRing() != FairyRingMode.OFF && config.swapFairyRing() != FairyRingMode.ZANARIS && (option.equals("zanaris") || option.equals("configure") || option.equals("tree"))) {