menu swapper: check home portal swap target
The swap was attemting to run on anything with the "enter" option, which conflicted with the quick-enter swap below it. Co-authored-by: Adam <Adam@sigterm.info>
This commit is contained in:
@@ -498,7 +498,7 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
{
|
||||
swap("harpoon", option, target, index);
|
||||
}
|
||||
else if (config.swapHomePortal() != HouseMode.ENTER && option.equals("enter"))
|
||||
else if (config.swapHomePortal() != HouseMode.ENTER && option.equals("enter") && target.equals("portal"))
|
||||
{
|
||||
switch (config.swapHomePortal())
|
||||
{
|
||||
|
||||
@@ -263,4 +263,35 @@ public class MenuEntrySwapperPluginTest
|
||||
menu("Cast", "Varrock Teleport", MenuAction.WIDGET_SECOND_OPTION),
|
||||
}, argumentCaptor.getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTobDoor()
|
||||
{
|
||||
when(config.swapQuick()).thenReturn(true);
|
||||
when(config.swapHomePortal()).thenReturn(HouseMode.HOME);
|
||||
|
||||
//Quick-enter, Enter
|
||||
entries = new MenuEntry[]{
|
||||
menu("Cancel", "", MenuAction.CANCEL),
|
||||
menu("Examine", "Formidable Passage", MenuAction.EXAMINE_OBJECT),
|
||||
menu("Walk here", "", MenuAction.WALK),
|
||||
|
||||
menu("Quick-Enter", "Formidable Passage", MenuAction.GAME_OBJECT_SECOND_OPTION),
|
||||
menu("Enter", "Formidable Passage", MenuAction.GAME_OBJECT_FIRST_OPTION),
|
||||
};
|
||||
|
||||
menuEntrySwapperPlugin.onClientTick(new ClientTick());
|
||||
|
||||
ArgumentCaptor<MenuEntry[]> argumentCaptor = ArgumentCaptor.forClass(MenuEntry[].class);
|
||||
verify(client).setMenuEntries(argumentCaptor.capture());
|
||||
|
||||
assertArrayEquals(new MenuEntry[]{
|
||||
menu("Cancel", "", MenuAction.CANCEL),
|
||||
menu("Examine", "Formidable Passage", MenuAction.EXAMINE_OBJECT),
|
||||
menu("Walk here", "", MenuAction.WALK),
|
||||
|
||||
menu("Enter", "Formidable Passage", MenuAction.GAME_OBJECT_FIRST_OPTION),
|
||||
menu("Quick-Enter", "Formidable Passage", MenuAction.GAME_OBJECT_SECOND_OPTION),
|
||||
}, argumentCaptor.getValue());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user