Swap herb clean/use menu by level
This commit is contained in:
@@ -54,6 +54,7 @@ import net.runelite.client.plugins.menuentryswapper.util.QuestCapeMode;
|
|||||||
import net.runelite.client.plugins.menuentryswapper.util.RingOfWealthMode;
|
import net.runelite.client.plugins.menuentryswapper.util.RingOfWealthMode;
|
||||||
import net.runelite.client.plugins.menuentryswapper.util.SkillsNecklaceMode;
|
import net.runelite.client.plugins.menuentryswapper.util.SkillsNecklaceMode;
|
||||||
import net.runelite.client.plugins.menuentryswapper.util.SlayerRingMode;
|
import net.runelite.client.plugins.menuentryswapper.util.SlayerRingMode;
|
||||||
|
import net.runelite.client.plugins.menuentryswapper.util.SwapGrimyHerbMode;
|
||||||
import net.runelite.client.plugins.menuentryswapper.util.XericsTalismanMode;
|
import net.runelite.client.plugins.menuentryswapper.util.XericsTalismanMode;
|
||||||
|
|
||||||
|
|
||||||
@@ -1127,6 +1128,32 @@ public interface MenuEntrySwapperConfig extends Config
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "swapGrimyHerb",
|
||||||
|
name = "Grimy Herbs",
|
||||||
|
description = "",
|
||||||
|
position = 6,
|
||||||
|
section = "skillingSection"
|
||||||
|
)
|
||||||
|
default boolean getSwapGrimyHerb()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "swapGrimyHerbMode",
|
||||||
|
name = "Mode",
|
||||||
|
description = "",
|
||||||
|
position = 7,
|
||||||
|
section = "skillingSection",
|
||||||
|
hidden = true,
|
||||||
|
unhide = "swapGrimyHerb"
|
||||||
|
)
|
||||||
|
default SwapGrimyHerbMode swapGrimyHerbMode()
|
||||||
|
{
|
||||||
|
return SwapGrimyHerbMode.DYNAMIC;
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------//
|
//------------------------------------------------------------//
|
||||||
// Talk-To
|
// Talk-To
|
||||||
//------------------------------------------------------------//
|
//------------------------------------------------------------//
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ import net.runelite.client.plugins.PluginManager;
|
|||||||
import net.runelite.client.plugins.PluginType;
|
import net.runelite.client.plugins.PluginType;
|
||||||
import net.runelite.client.plugins.menuentryswapper.comparables.BankComparableEntry;
|
import net.runelite.client.plugins.menuentryswapper.comparables.BankComparableEntry;
|
||||||
import net.runelite.client.plugins.menuentryswapper.comparables.EquipmentComparableEntry;
|
import net.runelite.client.plugins.menuentryswapper.comparables.EquipmentComparableEntry;
|
||||||
|
import net.runelite.client.plugins.menuentryswapper.comparables.GrimyHerbComparableEntry;
|
||||||
import net.runelite.client.plugins.menuentryswapper.comparables.InventoryComparableEntry;
|
import net.runelite.client.plugins.menuentryswapper.comparables.InventoryComparableEntry;
|
||||||
import net.runelite.client.plugins.menuentryswapper.comparables.ShopComparableEntry;
|
import net.runelite.client.plugins.menuentryswapper.comparables.ShopComparableEntry;
|
||||||
import net.runelite.client.plugins.menuentryswapper.comparables.WithdrawComparableEntry;
|
import net.runelite.client.plugins.menuentryswapper.comparables.WithdrawComparableEntry;
|
||||||
@@ -110,6 +111,7 @@ import net.runelite.client.plugins.menuentryswapper.util.QuestCapeMode;
|
|||||||
import net.runelite.client.plugins.menuentryswapper.util.RingOfWealthMode;
|
import net.runelite.client.plugins.menuentryswapper.util.RingOfWealthMode;
|
||||||
import net.runelite.client.plugins.menuentryswapper.util.SkillsNecklaceMode;
|
import net.runelite.client.plugins.menuentryswapper.util.SkillsNecklaceMode;
|
||||||
import net.runelite.client.plugins.menuentryswapper.util.SlayerRingMode;
|
import net.runelite.client.plugins.menuentryswapper.util.SlayerRingMode;
|
||||||
|
import net.runelite.client.plugins.menuentryswapper.util.SwapGrimyHerbMode;
|
||||||
import net.runelite.client.plugins.menuentryswapper.util.XericsTalismanMode;
|
import net.runelite.client.plugins.menuentryswapper.util.XericsTalismanMode;
|
||||||
import net.runelite.client.plugins.pvptools.PvpToolsConfig;
|
import net.runelite.client.plugins.pvptools.PvpToolsConfig;
|
||||||
import net.runelite.client.plugins.pvptools.PvpToolsPlugin;
|
import net.runelite.client.plugins.pvptools.PvpToolsPlugin;
|
||||||
@@ -206,6 +208,7 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
private OccultAltarMode swapOccultMode;
|
private OccultAltarMode swapOccultMode;
|
||||||
private QuestCapeMode questCapeMode;
|
private QuestCapeMode questCapeMode;
|
||||||
private RingOfWealthMode getRingofWealthMode;
|
private RingOfWealthMode getRingofWealthMode;
|
||||||
|
private SwapGrimyHerbMode swapGrimyHerbMode;
|
||||||
private Set<String> hideCastIgnoredCoX;
|
private Set<String> hideCastIgnoredCoX;
|
||||||
private Set<String> hideCastIgnoredToB;
|
private Set<String> hideCastIgnoredToB;
|
||||||
private SkillsNecklaceMode getSkillsNecklaceMode;
|
private SkillsNecklaceMode getSkillsNecklaceMode;
|
||||||
@@ -230,6 +233,7 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
private boolean getSwapExplorersRing;
|
private boolean getSwapExplorersRing;
|
||||||
private boolean getSwapMagicCape;
|
private boolean getSwapMagicCape;
|
||||||
private boolean getSwapPuro;
|
private boolean getSwapPuro;
|
||||||
|
private boolean getSwapGrimyHerb;
|
||||||
private boolean getSwapSawmill;
|
private boolean getSwapSawmill;
|
||||||
private boolean getSwapSawmillPlanks;
|
private boolean getSwapSawmillPlanks;
|
||||||
private boolean getSwapTanning;
|
private boolean getSwapTanning;
|
||||||
@@ -1157,6 +1161,11 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
menuManager.addPriorityEntry(this.swapHouseAdMode.getEntry());
|
menuManager.addPriorityEntry(this.swapHouseAdMode.getEntry());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.getSwapGrimyHerb)
|
||||||
|
{
|
||||||
|
menuManager.addPriorityEntry(new GrimyHerbComparableEntry(this.swapGrimyHerbMode, client));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeSwaps()
|
private void removeSwaps()
|
||||||
@@ -1269,6 +1278,7 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
menuManager.removePriorityEntry(new EquipmentComparableEntry(this.getXericsTalismanMode.toString(), "talisman"));
|
menuManager.removePriorityEntry(new EquipmentComparableEntry(this.getXericsTalismanMode.toString(), "talisman"));
|
||||||
menuManager.removePriorityEntry(new InventoryComparableEntry("Rub", "", false));
|
menuManager.removePriorityEntry(new InventoryComparableEntry("Rub", "", false));
|
||||||
menuManager.removePriorityEntry(new InventoryComparableEntry("Teleport", "", false));
|
menuManager.removePriorityEntry(new InventoryComparableEntry("Teleport", "", false));
|
||||||
|
menuManager.removePriorityEntry(new GrimyHerbComparableEntry(this.swapGrimyHerbMode, client));
|
||||||
menuManager.removePriorityEntry(newBankComparableEntry("Empty", "Coal bag"));
|
menuManager.removePriorityEntry(newBankComparableEntry("Empty", "Coal bag"));
|
||||||
menuManager.removePriorityEntry(this.constructionCapeMode.toString(), "Construct. cape");
|
menuManager.removePriorityEntry(this.constructionCapeMode.toString(), "Construct. cape");
|
||||||
menuManager.removePriorityEntry(this.constructionCapeMode.toString(), "Construct. cape(t)");
|
menuManager.removePriorityEntry(this.constructionCapeMode.toString(), "Construct. cape(t)");
|
||||||
@@ -1562,6 +1572,7 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
this.getNecklaceofPassageMode = config.getNecklaceofPassageMode();
|
this.getNecklaceofPassageMode = config.getNecklaceofPassageMode();
|
||||||
this.getRingofWealth = config.getRingofWealth();
|
this.getRingofWealth = config.getRingofWealth();
|
||||||
this.getRingofWealthMode = config.getRingofWealthMode();
|
this.getRingofWealthMode = config.getRingofWealthMode();
|
||||||
|
this.swapGrimyHerbMode = config.swapGrimyHerbMode();
|
||||||
this.getSkillsNecklace = config.getSkillsNecklace();
|
this.getSkillsNecklace = config.getSkillsNecklace();
|
||||||
this.getSkillsNecklaceMode = config.getSkillsNecklaceMode();
|
this.getSkillsNecklaceMode = config.getSkillsNecklaceMode();
|
||||||
this.getSlayerRing = config.getSlayerRing();
|
this.getSlayerRing = config.getSlayerRing();
|
||||||
@@ -1572,6 +1583,7 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
this.getSwapExplorersRing = config.getSwapExplorersRing();
|
this.getSwapExplorersRing = config.getSwapExplorersRing();
|
||||||
this.getSwapMagicCape = config.getSwapMagicCape();
|
this.getSwapMagicCape = config.getSwapMagicCape();
|
||||||
this.getSwapPuro = config.getSwapPuro();
|
this.getSwapPuro = config.getSwapPuro();
|
||||||
|
this.getSwapGrimyHerb = config.getSwapGrimyHerb();
|
||||||
this.getSwapSawmill = config.getSwapSawmill();
|
this.getSwapSawmill = config.getSwapSawmill();
|
||||||
this.getSwapSawmillPlanks = config.getSwapSawmillPlanks();
|
this.getSwapSawmillPlanks = config.getSwapSawmillPlanks();
|
||||||
this.getSwapTanning = config.getSwapTanning();
|
this.getSwapTanning = config.getSwapTanning();
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package net.runelite.client.plugins.menuentryswapper.comparables;
|
||||||
|
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.MenuEntry;
|
||||||
|
import net.runelite.api.Skill;
|
||||||
|
import net.runelite.api.widgets.WidgetID;
|
||||||
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
|
import net.runelite.client.menus.AbstractComparableEntry;
|
||||||
|
import net.runelite.client.plugins.menuentryswapper.util.GrimyHerbLookup;
|
||||||
|
import net.runelite.client.plugins.menuentryswapper.util.HerbNotFoundException;
|
||||||
|
import net.runelite.client.plugins.menuentryswapper.util.SwapGrimyHerbMode;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
public class GrimyHerbComparableEntry extends AbstractComparableEntry
|
||||||
|
{
|
||||||
|
private SwapGrimyHerbMode mode;
|
||||||
|
|
||||||
|
private final GrimyHerbLookup lookup = new GrimyHerbLookup();
|
||||||
|
private final Client client;
|
||||||
|
|
||||||
|
public GrimyHerbComparableEntry(SwapGrimyHerbMode mode, Client client)
|
||||||
|
{
|
||||||
|
this.mode = mode;
|
||||||
|
this.client = client;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getPriority()
|
||||||
|
{
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object other)
|
||||||
|
{
|
||||||
|
return other instanceof GrimyHerbComparableEntry && ((GrimyHerbComparableEntry) other).mode == mode && super.equals(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean matches(MenuEntry entry)
|
||||||
|
{
|
||||||
|
final int groupId = WidgetInfo.TO_GROUP(entry.getParam1());
|
||||||
|
|
||||||
|
if (groupId != WidgetID.INVENTORY_GROUP_ID)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int cleanLevel;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
cleanLevel = lookup.getCleanLevel(entry.getIdentifier());
|
||||||
|
}
|
||||||
|
catch (HerbNotFoundException e)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.mode == SwapGrimyHerbMode.USE)
|
||||||
|
{
|
||||||
|
return StringUtils.equalsIgnoreCase(entry.getOption(), "use");
|
||||||
|
}
|
||||||
|
|
||||||
|
String swapOption = "use";
|
||||||
|
if (client.getBoostedSkillLevel(Skill.HERBLORE) >= cleanLevel)
|
||||||
|
{
|
||||||
|
swapOption = "clean";
|
||||||
|
}
|
||||||
|
|
||||||
|
return StringUtils.equalsIgnoreCase(entry.getOption(), swapOption);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package net.runelite.client.plugins.menuentryswapper.util;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.annotations.SerializedName;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public class GrimyHerbLookup
|
||||||
|
{
|
||||||
|
private static Map<String, HerbInfo> mapping;
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
final InputStream herbFile = GrimyHerbLookup.class.getResourceAsStream("/herbs.json");
|
||||||
|
Gson gson = new Gson();
|
||||||
|
mapping = gson.fromJson(new InputStreamReader(herbFile), new TypeToken<Map<String, HerbInfo>>()
|
||||||
|
{
|
||||||
|
}.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCleanLevel(int itemId)
|
||||||
|
{
|
||||||
|
HerbInfo info = mapping.get(String.valueOf(itemId));
|
||||||
|
if (info == null)
|
||||||
|
{
|
||||||
|
throw new HerbNotFoundException();
|
||||||
|
}
|
||||||
|
|
||||||
|
return info.level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCleanedItemId(int itemId)
|
||||||
|
{
|
||||||
|
HerbInfo info = mapping.get(String.valueOf(itemId));
|
||||||
|
if (info == null)
|
||||||
|
{
|
||||||
|
throw new HerbNotFoundException();
|
||||||
|
}
|
||||||
|
|
||||||
|
return info.cleanedId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getGrimyHerbIds()
|
||||||
|
{
|
||||||
|
return mapping.keySet().stream().mapToInt(Integer::valueOf).boxed().collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
private class HerbInfo
|
||||||
|
{
|
||||||
|
@SerializedName("cleaned")
|
||||||
|
private int cleanedId;
|
||||||
|
private int level;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package net.runelite.client.plugins.menuentryswapper.util;
|
||||||
|
|
||||||
|
public class HerbNotFoundException extends RuntimeException
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package net.runelite.client.plugins.menuentryswapper.util;
|
||||||
|
|
||||||
|
public enum SwapGrimyHerbMode
|
||||||
|
{
|
||||||
|
USE("Use"),
|
||||||
|
DYNAMIC("By level");
|
||||||
|
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
SwapGrimyHerbMode(String name)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
||||||
57
runelite-client/src/main/resources/herbs.json
Normal file
57
runelite-client/src/main/resources/herbs.json
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
{
|
||||||
|
"199": {
|
||||||
|
"cleaned": 249,
|
||||||
|
"level": 3
|
||||||
|
},
|
||||||
|
"201": {
|
||||||
|
"cleaned": 251,
|
||||||
|
"level": 5
|
||||||
|
},
|
||||||
|
"203": {
|
||||||
|
"cleaned": 253,
|
||||||
|
"level": 11
|
||||||
|
},
|
||||||
|
"205": {
|
||||||
|
"cleaned": 255,
|
||||||
|
"level": 20
|
||||||
|
},
|
||||||
|
"207": {
|
||||||
|
"cleaned": 257,
|
||||||
|
"level": 25
|
||||||
|
},
|
||||||
|
"3049": {
|
||||||
|
"cleaned": 2998,
|
||||||
|
"level": 30
|
||||||
|
},
|
||||||
|
"209": {
|
||||||
|
"cleaned": 259,
|
||||||
|
"level": 40
|
||||||
|
},
|
||||||
|
"211": {
|
||||||
|
"cleaned": 261,
|
||||||
|
"level": 48
|
||||||
|
},
|
||||||
|
"213": {
|
||||||
|
"cleaned": 263,
|
||||||
|
"level": 54
|
||||||
|
},
|
||||||
|
"3051": {
|
||||||
|
"cleaned": 3000,
|
||||||
|
"level": 59
|
||||||
|
},
|
||||||
|
"215": {
|
||||||
|
"cleaned": 265,
|
||||||
|
"level": 65
|
||||||
|
},
|
||||||
|
"2485": {
|
||||||
|
"level": 67
|
||||||
|
},
|
||||||
|
"217": {
|
||||||
|
"cleaned": 267,
|
||||||
|
"level": 70
|
||||||
|
},
|
||||||
|
"219": {
|
||||||
|
"cleaned": 269,
|
||||||
|
"level": 75
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user