Reset player menu types whenever the options are changed

This commit is contained in:
Adam
2018-03-10 21:17:59 -05:00
parent 24abe9b5d1
commit 14299f543d
2 changed files with 26 additions and 0 deletions

View File

@@ -210,6 +210,15 @@ public enum MenuAction
*/
WIDGET_FIFTH_OPTION(43),
PLAYER_FIRST_OPTION(44),
PLAYER_SECOND_OPTION(45),
PLAYER_THIRD_OPTION(46),
PLAYER_FOURTH_OPTION(47),
PLAYER_FIFTH_OPTION(48),
PLAYER_SIXTH_OPTION(49),
PLAYER_SEVENTH_OPTION(50),
PLAYER_EIGTH_OPTION(51),
/**
* Default menu action for a widget.
*/

View File

@@ -34,6 +34,14 @@ import net.runelite.api.GrandExchangeOffer;
import net.runelite.api.IndexedSprite;
import net.runelite.api.InventoryID;
import net.runelite.api.MenuAction;
import static net.runelite.api.MenuAction.PLAYER_EIGTH_OPTION;
import static net.runelite.api.MenuAction.PLAYER_FIFTH_OPTION;
import static net.runelite.api.MenuAction.PLAYER_FIRST_OPTION;
import static net.runelite.api.MenuAction.PLAYER_FOURTH_OPTION;
import static net.runelite.api.MenuAction.PLAYER_SECOND_OPTION;
import static net.runelite.api.MenuAction.PLAYER_SEVENTH_OPTION;
import static net.runelite.api.MenuAction.PLAYER_SIXTH_OPTION;
import static net.runelite.api.MenuAction.PLAYER_THIRD_OPTION;
import net.runelite.api.MenuEntry;
import net.runelite.api.NPC;
import net.runelite.api.Node;
@@ -481,6 +489,15 @@ public abstract class RSClientMixin implements RSClient
@Inject
public static void playerOptionsChanged(int idx)
{
// Reset the menu type
MenuAction[] playerActions = {PLAYER_FIRST_OPTION, PLAYER_SECOND_OPTION, PLAYER_THIRD_OPTION, PLAYER_FOURTH_OPTION,
PLAYER_FIFTH_OPTION, PLAYER_SIXTH_OPTION, PLAYER_SEVENTH_OPTION, PLAYER_EIGTH_OPTION};
if (idx >= 0 && idx < playerActions.length)
{
MenuAction playerAction = playerActions[idx];
client.getPlayerMenuTypes()[idx] = playerAction.getId();
}
PlayerMenuOptionsChanged optionsChanged = new PlayerMenuOptionsChanged();
optionsChanged.setIndex(idx);
eventBus.post(optionsChanged);