Reset player menu types whenever the options are changed
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user