menu swapper: add support for ge offer withdraw

Co-authored-by: Adam <Adam@sigterm.info>
This commit is contained in:
Rami-J
2019-12-15 20:29:04 -05:00
committed by Adam
parent 0e5eb27be6
commit 9cc321e143
3 changed files with 76 additions and 1 deletions

View File

@@ -0,0 +1,46 @@
/*
* Copyright (c) 2019, Rami <https://github.com/Rami-J>
* 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 GEItemCollectMode
{
DEFAULT("Default"),
ITEMS("Collect-items"),
NOTES("Collect-notes"),
BANK("Bank");
private final String name;
@Override
public String toString()
{
return name;
}
}

View File

@@ -361,4 +361,14 @@ public interface MenuEntrySwapperConfig extends Config
{
return false;
}
@ConfigItem(
keyName = "swapGEItemCollect",
name = "GE Item Collect",
description = "Swap Collect-notes, Collect-items, or Bank options from GE offer"
)
default GEItemCollectMode swapGEItemCollect()
{
return GEItemCollectMode.DEFAULT;
}
}

View File

@@ -1,6 +1,7 @@
/*
* Copyright (c) 2018, Adam <Adam@sigterm.info>
* Copyright (c) 2018, Kamiel
* Copyright (c) 2019, Rami <https://github.com/Rami-J>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -40,7 +41,6 @@ import net.runelite.api.MenuAction;
import net.runelite.api.MenuEntry;
import net.runelite.api.NPC;
import net.runelite.api.events.ClientTick;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.FocusChanged;
import net.runelite.api.events.MenuOpened;
import net.runelite.api.events.MenuOptionClicked;
@@ -50,6 +50,7 @@ import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ItemManager;
import net.runelite.client.game.ItemVariationMapping;
import net.runelite.client.input.KeyManager;
@@ -647,6 +648,24 @@ public class MenuEntrySwapperPlugin extends Plugin
{
swap("use", option, target, index);
}
else if (option.equals("collect to inventory") || option.startsWith("collect-note") || option.startsWith("collect-item"))
{
switch (config.swapGEItemCollect())
{
case ITEMS:
swap("collect-items", option, target, index);
swap("collect-item", option, target, index);
break;
case NOTES:
swap("collect-notes", option, target, index);
swap("collect-note", option, target, index);
break;
case BANK:
swap("collect to bank", option, target, index);
swap("bank", option, target, index);
break;
}
}
if (shiftModifier && config.swapTeleportSpell())
{