menu swapper: add swaps for buy and sell

This commit is contained in:
geheur
2020-05-21 11:03:28 -07:00
committed by GitHub
parent 63eab81d11
commit aae994cbf1
4 changed files with 114 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
/*
* Copyright (c) 2020, Sam <dasistkeinnamen@gmail.com>
* 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 BuyMode
{
OFF(null),
BUY_1("buy 1"),
BUY_5("buy 5"),
BUY_10("buy 10"),
BUY_50("buy 50");
private final String option;
}

View File

@@ -412,6 +412,26 @@ public interface MenuEntrySwapperConfig extends Config
return ShiftDepositMode.OFF;
}
@ConfigItem(
keyName = "shopBuy",
name = "Shop Buy Shift-Click",
description = "Swaps the Buy options with Value on items in shops when shift is held."
)
default BuyMode shopBuy()
{
return BuyMode.OFF;
}
@ConfigItem(
keyName = "shopSell",
name = "Shop Sell Shift-Click",
description = "Swaps the Sell options with Value on items in your inventory when selling to shops when shift is held."
)
default SellMode shopSell()
{
return SellMode.OFF;
}
@ConfigItem(
keyName = "swapEssenceMineTeleport",
name = "Essence Mine Teleport",

View File

@@ -733,6 +733,18 @@ public class MenuEntrySwapperPlugin extends Plugin
swap("barbarian guard", option, target, index);
swap("random", option, target, index);
}
else if (shiftModifier && option.equals("value"))
{
if (config.shopBuy() != null && config.shopBuy() != BuyMode.OFF)
{
swap(config.shopBuy().getOption(), option, target, index);
}
if (config.shopSell() != null && config.shopSell() != SellMode.OFF)
{
swap(config.shopSell().getOption(), option, target, index);
}
}
else if (config.shiftClickCustomization() && shiftModifier && !option.equals("use"))
{
Integer customOption = getSwapConfig(eventId);

View File

@@ -0,0 +1,41 @@
/*
* Copyright (c) 2020, Sam <dasistkeinnamen@gmail.com>
* 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 SellMode
{
OFF(null),
SELL_1("sell 1"),
SELL_5("sell 5"),
SELL_10("sell 10"),
SELL_50("sell 50");
private final String option;
}