Merge remote-tracking branch 'runelite/master'
This commit is contained in:
@@ -2084,6 +2084,13 @@ public interface Client extends OAuthApi, GameEngine
|
||||
*/
|
||||
int getSelectedItemIndex();
|
||||
|
||||
/**
|
||||
* Get the selected widget, such as a selected spell or selected item (eg. "Use")
|
||||
* @return the selected widget
|
||||
*/
|
||||
@Nullable
|
||||
Widget getSelectedWidget();
|
||||
|
||||
/**
|
||||
* Returns client item composition cache
|
||||
*/
|
||||
|
||||
@@ -37,9 +37,9 @@ public enum MenuAction
|
||||
*/
|
||||
ITEM_USE_ON_GAME_OBJECT(1),
|
||||
/**
|
||||
* Menu action for casting a spell on a tile object (GameObject or GroundObject).
|
||||
* Menu action for using a widget on a tile object (GameObject or GroundObject).
|
||||
*/
|
||||
SPELL_CAST_ON_GAME_OBJECT(2),
|
||||
WIDGET_TARGET_ON_GAME_OBJECT(2),
|
||||
/**
|
||||
* First menu action for a game object.
|
||||
*/
|
||||
@@ -66,9 +66,9 @@ public enum MenuAction
|
||||
*/
|
||||
ITEM_USE_ON_NPC(7),
|
||||
/**
|
||||
* Menu action for casting a spell on an NPC.
|
||||
* Menu action for using a widget on an NPC.
|
||||
*/
|
||||
SPELL_CAST_ON_NPC(8),
|
||||
WIDGET_TARGET_ON_NPC(8),
|
||||
/**
|
||||
* First menu action for an NPC.
|
||||
*/
|
||||
@@ -95,18 +95,18 @@ public enum MenuAction
|
||||
*/
|
||||
ITEM_USE_ON_PLAYER(14),
|
||||
/**
|
||||
* Menu action for casting a spell on a player.
|
||||
* Menu action for using a widget on a player.
|
||||
*/
|
||||
SPELL_CAST_ON_PLAYER(15),
|
||||
WIDGET_TARGET_ON_PLAYER(15),
|
||||
|
||||
/**
|
||||
* Menu action for using an item on an item on the ground.
|
||||
*/
|
||||
ITEM_USE_ON_GROUND_ITEM(16),
|
||||
/**
|
||||
* Menu action for casting a spell on an item on the ground.
|
||||
* Menu action for using a widget on an item on the ground.
|
||||
*/
|
||||
SPELL_CAST_ON_GROUND_ITEM(17),
|
||||
WIDGET_TARGET_ON_GROUND_ITEM(17),
|
||||
/**
|
||||
* First menu action for an item on the ground.
|
||||
*/
|
||||
@@ -138,13 +138,14 @@ public enum MenuAction
|
||||
*/
|
||||
WIDGET_TYPE_1(24),
|
||||
/**
|
||||
* Interaction with widget (type 2).
|
||||
* Select the widget for targeting other widgets/entites etc.
|
||||
* @see Client#getSelectedWidget()
|
||||
*/
|
||||
WIDGET_TYPE_2(25),
|
||||
WIDGET_TARGET(25),
|
||||
/**
|
||||
* Interaction with widget (type 3).
|
||||
* Performs an ifclose.
|
||||
*/
|
||||
WIDGET_TYPE_3(26),
|
||||
WIDGET_CLOSE(26),
|
||||
/**
|
||||
* Interaction with widget (type 4).
|
||||
*/
|
||||
@@ -154,19 +155,17 @@ public enum MenuAction
|
||||
*/
|
||||
WIDGET_TYPE_5(29),
|
||||
/**
|
||||
* Interaction with widget (type 6).
|
||||
*
|
||||
* This is the continue button on message boxes
|
||||
* Performs a Continue
|
||||
*/
|
||||
WIDGET_TYPE_6(30),
|
||||
WIDGET_CONTINUE(30),
|
||||
/**
|
||||
* Menu action when using an item on another item inside a widget (inventory).
|
||||
* Menu action when using an item on another item
|
||||
*/
|
||||
ITEM_USE_ON_WIDGET_ITEM(31),
|
||||
ITEM_USE_ON_ITEM(31),
|
||||
/**
|
||||
* Menu action when using an item on a widget.
|
||||
* Menu action when using a component on an item
|
||||
*/
|
||||
ITEM_USE_ON_WIDGET(32),
|
||||
WIDGET_USE_ON_ITEM(32),
|
||||
|
||||
/**
|
||||
* First menu action for an item.
|
||||
@@ -229,20 +228,15 @@ public enum MenuAction
|
||||
CC_OP(57),
|
||||
|
||||
/**
|
||||
* Casting a spell / op target on a widget
|
||||
* Using a widget on another widget
|
||||
*/
|
||||
SPELL_CAST_ON_WIDGET(58),
|
||||
WIDGET_TARGET_ON_WIDGET(58),
|
||||
|
||||
/**
|
||||
* Menu action for high priority runelite options
|
||||
*/
|
||||
RUNELITE_HIGH_PRIORITY(999),
|
||||
|
||||
/**
|
||||
* Sub 1000 so it doesn't get sorted down in the list
|
||||
*/
|
||||
PRIO_RUNELITE(666),
|
||||
|
||||
/**
|
||||
* Menu action triggered by examining an object.
|
||||
*/
|
||||
@@ -290,9 +284,6 @@ public enum MenuAction
|
||||
*/
|
||||
RUNELITE_INFOBOX(1504),
|
||||
|
||||
FOLLOW(2046),
|
||||
TRADE(2047),
|
||||
|
||||
/**
|
||||
* Menu action triggered when the id is not defined in this class.
|
||||
*/
|
||||
@@ -326,4 +317,4 @@ public enum MenuAction
|
||||
{
|
||||
return map.getOrDefault(id, UNKNOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,8 @@
|
||||
package net.runelite.api;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import javax.annotation.Nullable;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
|
||||
/**
|
||||
* A menu entry in a right-click menu.
|
||||
@@ -93,21 +95,31 @@ public interface MenuEntry
|
||||
*/
|
||||
MenuEntry onClick(Consumer<MenuEntry> callback);
|
||||
|
||||
@Deprecated
|
||||
int getOpcode();
|
||||
@Deprecated
|
||||
void setOpcode(int opcode);
|
||||
/**
|
||||
* Test if this menu entry is an item op. "Use" and "Examine" are not considered item ops.
|
||||
* @return
|
||||
*/
|
||||
boolean isItemOp();
|
||||
|
||||
@Deprecated
|
||||
int getActionParam0();
|
||||
@Deprecated
|
||||
void setActionParam0(int param0);
|
||||
/**
|
||||
* If this menu entry is an item op, get the item op id
|
||||
* @return 1-5
|
||||
*/
|
||||
int getItemOp();
|
||||
|
||||
@Deprecated
|
||||
int getActionParam1();
|
||||
@Deprecated
|
||||
void setActionParam1(int param0);
|
||||
/**
|
||||
* If this menu entry is an item op, get the item id
|
||||
* @return
|
||||
* @see ItemID
|
||||
* @see NullItemID
|
||||
*/
|
||||
int getItemId();
|
||||
|
||||
@Deprecated
|
||||
MenuAction getMenuAction();
|
||||
/**
|
||||
* Get the widget this menu entry is on, if this is a menu entry
|
||||
* with an associated widget. Such as eg, CC_OP.
|
||||
* @return
|
||||
*/
|
||||
@Nullable
|
||||
Widget getWidget();
|
||||
}
|
||||
@@ -24,9 +24,11 @@
|
||||
*/
|
||||
package net.runelite.api.events;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
|
||||
/**
|
||||
* An event where a menu option has been clicked.
|
||||
@@ -39,42 +41,106 @@ import net.runelite.api.MenuEntry;
|
||||
* By default, when there is no action performed when left-clicking,
|
||||
* it seems that this event still triggers with the "Cancel" action.
|
||||
*/
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class MenuOptionClicked
|
||||
{
|
||||
/**
|
||||
* Action parameter 0. Its value depends on the menuAction.
|
||||
* The clicked menu entry
|
||||
*/
|
||||
private int param0;
|
||||
/**
|
||||
* Action parameter 1. Its value depends on the menuAction.
|
||||
*/
|
||||
private int param1;
|
||||
/**
|
||||
* The option text added to the menu.
|
||||
*/
|
||||
private String menuOption;
|
||||
/**
|
||||
* The target of the action.
|
||||
*/
|
||||
private String menuTarget;
|
||||
/**
|
||||
* The action performed.
|
||||
*/
|
||||
private MenuAction menuAction;
|
||||
/**
|
||||
* The ID of the object, actor, or item that the interaction targets.
|
||||
*/
|
||||
private int id;
|
||||
/**
|
||||
* The selected item index at the time of the option click.
|
||||
*/
|
||||
private int selectedItemIndex;
|
||||
private final MenuEntry menuEntry;
|
||||
/**
|
||||
* Whether or not the event has been consumed by a subscriber.
|
||||
*/
|
||||
@Getter
|
||||
private boolean consumed;
|
||||
|
||||
/**
|
||||
* Action parameter 0. Its value depends on the menuAction.
|
||||
*/
|
||||
public int getParam0()
|
||||
{
|
||||
return menuEntry.getParam0();
|
||||
}
|
||||
|
||||
/**
|
||||
* Action parameter 1. Its value depends on the menuAction.
|
||||
*/
|
||||
public int getParam1()
|
||||
{
|
||||
return menuEntry.getParam1();
|
||||
}
|
||||
|
||||
/**
|
||||
* The option text added to the menu.
|
||||
*/
|
||||
public String getMenuOption()
|
||||
{
|
||||
return menuEntry.getOption();
|
||||
}
|
||||
|
||||
/**
|
||||
* The target of the action.
|
||||
*/
|
||||
public String getMenuTarget()
|
||||
{
|
||||
return menuEntry.getTarget();
|
||||
}
|
||||
|
||||
/**
|
||||
* The action performed.
|
||||
*/
|
||||
public MenuAction getMenuAction()
|
||||
{
|
||||
return menuEntry.getType();
|
||||
}
|
||||
|
||||
/**
|
||||
* The ID of the object, actor, or item that the interaction targets.
|
||||
*/
|
||||
public int getId()
|
||||
{
|
||||
return menuEntry.getIdentifier();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if this menu entry is an item op. "Use" and "Examine" are not considered item ops.
|
||||
* @return
|
||||
*/
|
||||
public boolean isItemOp()
|
||||
{
|
||||
return menuEntry.isItemOp();
|
||||
}
|
||||
|
||||
/**
|
||||
* If this menu entry is an item op, get the item op id
|
||||
* @return 1-5
|
||||
*/
|
||||
public int getItemOp()
|
||||
{
|
||||
return menuEntry.getItemOp();
|
||||
}
|
||||
|
||||
/**
|
||||
* If this menu entry is an item op, get the item id
|
||||
* @return
|
||||
* @see net.runelite.api.ItemID
|
||||
* @see net.runelite.api.NullItemID
|
||||
*/
|
||||
public int getItemId()
|
||||
{
|
||||
return menuEntry.getItemId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the widget this menu entry is on, if this is a menu entry
|
||||
* with an associated widget. Such as eg, CC_OP.
|
||||
* @return
|
||||
*/
|
||||
public Widget getWidget()
|
||||
{
|
||||
return menuEntry.getWidget();
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks the event as having been consumed.
|
||||
* <p>
|
||||
@@ -87,37 +153,15 @@ public class MenuOptionClicked
|
||||
this.consumed = true;
|
||||
}
|
||||
|
||||
public void setMenuEntry(MenuEntry entry)
|
||||
{
|
||||
this.setMenuOption(entry.getOption());
|
||||
this.setMenuTarget(entry.getTarget());
|
||||
this.setId(entry.getIdentifier());
|
||||
this.setMenuAction(entry.getType());
|
||||
this.setParam0(entry.getParam0());
|
||||
this.setParam1(entry.getParam1());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int getActionParam()
|
||||
{
|
||||
return param0;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setActionParam(int i)
|
||||
{
|
||||
param0 = i;
|
||||
return menuEntry.getParam0();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public int getWidgetId()
|
||||
{
|
||||
return param1;
|
||||
return menuEntry.getParam1();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public void setWidgetId(int i)
|
||||
{
|
||||
param1 = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user