Merge pull request #1327 from Ganom/fix-equipment-swaps

menuentryswapper: add equipment swaps, and use them to fix swaps.
This commit is contained in:
Kyleeld
2019-08-15 01:38:55 +01:00
committed by GitHub
3 changed files with 47 additions and 16 deletions

View File

@@ -19,6 +19,7 @@ public class BankComparableEntry extends AbstractComparableEntry
public boolean matches(MenuEntry entry) public boolean matches(MenuEntry entry)
{ {
final int groupId = WidgetInfo.TO_GROUP(entry.getParam1()); final int groupId = WidgetInfo.TO_GROUP(entry.getParam1());
if (groupId != WidgetID.BANK_GROUP_ID && groupId != WidgetID.BANK_INVENTORY_GROUP_ID) if (groupId != WidgetID.BANK_GROUP_ID && groupId != WidgetID.BANK_INVENTORY_GROUP_ID)
{ {
return false; return false;

View File

@@ -0,0 +1,32 @@
package net.runelite.client.plugins.menuentryswapper;
import lombok.EqualsAndHashCode;
import net.runelite.api.MenuEntry;
import net.runelite.api.widgets.WidgetID;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.menus.AbstractComparableEntry;
import net.runelite.client.util.Text;
import org.apache.commons.lang3.StringUtils;
@EqualsAndHashCode(callSuper = true)
public class EquipmentComparableEntry extends AbstractComparableEntry
{
public EquipmentComparableEntry(String option, String itemName)
{
this.setOption(Text.standardize(option));
this.setTarget(Text.standardize(itemName));
}
public boolean matches(MenuEntry entry)
{
final int groupId = WidgetInfo.TO_GROUP(entry.getParam1());
if (groupId != WidgetID.EQUIPMENT_GROUP_ID)
{
return false;
}
return StringUtils.equalsIgnoreCase(entry.getOption(), this.getOption())
&& Text.standardize(entry.getTarget()).contains(this.getTarget());
}
}

View File

@@ -1124,8 +1124,8 @@ public class MenuEntrySwapperPlugin extends Plugin
if (this.getSwapConstructionCape) if (this.getSwapConstructionCape)
{ {
menuManager.addPriorityEntry(this.constructionCapeMode.toString(), "Construct. cape"); menuManager.addPriorityEntry(this.constructionCapeMode.toString(), "Construct. cape").setPriority(100);
menuManager.addPriorityEntry(this.constructionCapeMode.toString(), "Construct. cape(t)"); menuManager.addPriorityEntry(this.constructionCapeMode.toString(), "Construct. cape(t)").setPriority(100);
} }
if (this.getSwapMagicCape) if (this.getSwapMagicCape)
@@ -1360,7 +1360,7 @@ public class MenuEntrySwapperPlugin extends Plugin
menuManager.addPriorityEntry("Configure", "Fairy ring"); menuManager.addPriorityEntry("Configure", "Fairy ring");
break; break;
case LAST_DESTINATION: case LAST_DESTINATION:
menuManager.addPriorityEntry("Last-destination"); menuManager.addPriorityEntry("Last-destination", "Fairy ring");
break; break;
} }
@@ -1407,54 +1407,52 @@ public class MenuEntrySwapperPlugin extends Plugin
if (this.getCombatBracelet) if (this.getCombatBracelet)
{ {
menuManager.addPriorityEntry(this.getCombatBraceletMode.toString()); menuManager.addPriorityEntry(new EquipmentComparableEntry(this.getCombatBraceletMode.toString(), "combat bracelet"));
} }
if (this.getGamesNecklace) if (this.getGamesNecklace)
{ {
menuManager.addPriorityEntry(this.getGamesNecklaceMode.toString()); menuManager.addPriorityEntry(new EquipmentComparableEntry(this.getGamesNecklaceMode.toString(), "games necklace"));
} }
if (this.getDuelingRing) if (this.getDuelingRing)
{ {
menuManager.addPriorityEntry(this.getDuelingRingMode.toString()); menuManager.addPriorityEntry(new EquipmentComparableEntry(this.getDuelingRingMode.toString(), "ring of dueling"));
} }
if (this.getGlory) if (this.getGlory)
{ {
menuManager.addPriorityEntry(this.getGloryMode.toString()); menuManager.addPriorityEntry(new EquipmentComparableEntry(this.getGloryMode.toString(), "glory"));
menuManager.addPriorityEntry(this.getGloryMode.toString());
} }
if (this.getSkillsNecklace) if (this.getSkillsNecklace)
{ {
menuManager.addPriorityEntry(this.getSkillsNecklaceMode.toString()); menuManager.addPriorityEntry(new EquipmentComparableEntry(this.getSkillsNecklaceMode.toString(), "skills necklace"));
} }
if (this.getNecklaceofPassage) if (this.getNecklaceofPassage)
{ {
menuManager.addPriorityEntry(this.getNecklaceofPassageMode.toString()); menuManager.addPriorityEntry(new EquipmentComparableEntry(this.getNecklaceofPassageMode.toString(), "necklace of passage"));
} }
if (this.getDigsitePendant) if (this.getDigsitePendant)
{ {
menuManager.addPriorityEntry(this.getDigsitePendantMode.toString()); menuManager.addPriorityEntry(new EquipmentComparableEntry(this.getDigsitePendantMode.toString(), "digsite pendant"));
} }
if (this.getSlayerRing) if (this.getSlayerRing)
{ {
menuManager.addPriorityEntry(this.getSlayerRingMode.toString()); menuManager.addPriorityEntry(new EquipmentComparableEntry(this.getSlayerRingMode.toString(), "slayer ring"));
menuManager.addPriorityEntry(this.getSlayerRingMode.toString());
} }
if (this.getXericsTalisman) if (this.getXericsTalisman)
{ {
menuManager.addPriorityEntry(this.getXericsTalismanMode.toString()); menuManager.addPriorityEntry(new EquipmentComparableEntry(this.getXericsTalismanMode.toString(), "talisman"));
} }
if (this.getRingofWealth) if (this.getRingofWealth)
{ {
menuManager.addPriorityEntry(this.getRingofWealthMode.toString()); menuManager.addPriorityEntry(new EquipmentComparableEntry(this.getRingofWealthMode.toString(), "ring of wealth"));
} }
if (this.swapMax) if (this.swapMax)
@@ -1937,4 +1935,4 @@ public class MenuEntrySwapperPlugin extends Plugin
this.hideCastCoX = config.hideCastCoX(); this.hideCastCoX = config.hideCastCoX();
this.hideCastIgnoredCoX = Sets.newHashSet(Text.fromCSV(config.hideCastIgnoredCoX().toLowerCase())); this.hideCastIgnoredCoX = Sets.newHashSet(Text.fromCSV(config.hideCastIgnoredCoX().toLowerCase()));
} }
} }