api: fix naming of menuoptionclicked params
This commit is contained in:
@@ -42,9 +42,13 @@ import net.runelite.api.MenuAction;
|
|||||||
public class MenuOptionClicked
|
public class MenuOptionClicked
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The action parameter used in the click.
|
* Action parameter 0. Its value depends on the menuAction.
|
||||||
*/
|
*/
|
||||||
private int actionParam;
|
private int param0;
|
||||||
|
/**
|
||||||
|
* Action parameter 1. Its value depends on the menuAction.
|
||||||
|
*/
|
||||||
|
private int param1;
|
||||||
/**
|
/**
|
||||||
* The option text added to the menu.
|
* The option text added to the menu.
|
||||||
*/
|
*/
|
||||||
@@ -61,12 +65,6 @@ public class MenuOptionClicked
|
|||||||
* The ID of the object, actor, or item that the interaction targets.
|
* The ID of the object, actor, or item that the interaction targets.
|
||||||
*/
|
*/
|
||||||
private int id;
|
private int id;
|
||||||
/**
|
|
||||||
* The ID of the widget where the menu was clicked.
|
|
||||||
*
|
|
||||||
* @see net.runelite.api.widgets.WidgetID
|
|
||||||
*/
|
|
||||||
private int widgetId;
|
|
||||||
/**
|
/**
|
||||||
* The selected item index at the time of the option click.
|
* The selected item index at the time of the option click.
|
||||||
*/
|
*/
|
||||||
@@ -87,4 +85,16 @@ public class MenuOptionClicked
|
|||||||
{
|
{
|
||||||
this.consumed = true;
|
this.consumed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public int getActionParam()
|
||||||
|
{
|
||||||
|
return param0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public int getWidgetId()
|
||||||
|
{
|
||||||
|
return param1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ public class MenuManager
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int widgetId = event.getWidgetId();
|
int widgetId = event.getParam1();
|
||||||
Collection<WidgetMenuOption> options = managedMenuOptions.get(widgetId);
|
Collection<WidgetMenuOption> options = managedMenuOptions.get(widgetId);
|
||||||
|
|
||||||
for (WidgetMenuOption curMenuOption : options)
|
for (WidgetMenuOption curMenuOption : options)
|
||||||
|
|||||||
@@ -371,12 +371,12 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onMenuOptionClicked(MenuOptionClicked event)
|
public void onMenuOptionClicked(MenuOptionClicked event)
|
||||||
{
|
{
|
||||||
if (event.getWidgetId() == WidgetInfo.BANK_ITEM_CONTAINER.getId()
|
if (event.getParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId()
|
||||||
&& event.getMenuAction() == MenuAction.RUNELITE
|
&& event.getMenuAction() == MenuAction.RUNELITE
|
||||||
&& event.getMenuOption().startsWith(EDIT_TAGS_MENU_OPTION))
|
&& event.getMenuOption().startsWith(EDIT_TAGS_MENU_OPTION))
|
||||||
{
|
{
|
||||||
event.consume();
|
event.consume();
|
||||||
int inventoryIndex = event.getActionParam();
|
int inventoryIndex = event.getParam0();
|
||||||
ItemContainer bankContainer = client.getItemContainer(InventoryID.BANK);
|
ItemContainer bankContainer = client.getItemContainer(InventoryID.BANK);
|
||||||
if (bankContainer == null)
|
if (bankContainer == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -661,26 +661,26 @@ public class TabInterface
|
|||||||
activateTab(null);
|
activateTab(null);
|
||||||
}
|
}
|
||||||
else if (activeTab != null
|
else if (activeTab != null
|
||||||
&& event.getWidgetId() == WidgetInfo.BANK_ITEM_CONTAINER.getId()
|
&& event.getParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId()
|
||||||
&& event.getMenuAction() == MenuAction.RUNELITE
|
&& event.getMenuAction() == MenuAction.RUNELITE
|
||||||
&& event.getMenuOption().startsWith(REMOVE_TAG))
|
&& event.getMenuOption().startsWith(REMOVE_TAG))
|
||||||
{
|
{
|
||||||
// Add "remove" menu entry to all items in bank while tab is selected
|
// Add "remove" menu entry to all items in bank while tab is selected
|
||||||
event.consume();
|
event.consume();
|
||||||
final ItemComposition item = getItem(event.getActionParam());
|
final ItemComposition item = getItem(event.getParam0());
|
||||||
final int itemId = item.getId();
|
final int itemId = item.getId();
|
||||||
tagManager.removeTag(itemId, activeTab.getTag());
|
tagManager.removeTag(itemId, activeTab.getTag());
|
||||||
bankSearch.layoutBank(); // re-layout to filter the removed item out
|
bankSearch.layoutBank(); // re-layout to filter the removed item out
|
||||||
}
|
}
|
||||||
else if (event.getMenuAction() == MenuAction.RUNELITE
|
else if (event.getMenuAction() == MenuAction.RUNELITE
|
||||||
&& ((event.getWidgetId() == WidgetInfo.BANK_DEPOSIT_INVENTORY.getId() && event.getMenuOption().equals(TAG_INVENTORY))
|
&& ((event.getParam1() == WidgetInfo.BANK_DEPOSIT_INVENTORY.getId() && event.getMenuOption().equals(TAG_INVENTORY))
|
||||||
|| (event.getWidgetId() == WidgetInfo.BANK_DEPOSIT_EQUIPMENT.getId() && event.getMenuOption().equals(TAG_GEAR))))
|
|| (event.getParam1() == WidgetInfo.BANK_DEPOSIT_EQUIPMENT.getId() && event.getMenuOption().equals(TAG_GEAR))))
|
||||||
{
|
{
|
||||||
handleDeposit(event, event.getWidgetId() == WidgetInfo.BANK_DEPOSIT_INVENTORY.getId());
|
handleDeposit(event, event.getParam1() == WidgetInfo.BANK_DEPOSIT_INVENTORY.getId());
|
||||||
}
|
}
|
||||||
else if (activeTab != null && ((event.getWidgetId() == WidgetInfo.BANK_EQUIPMENT_BUTTON.getId() && event.getMenuOption().equals(SHOW_WORN))
|
else if (activeTab != null && ((event.getParam1() == WidgetInfo.BANK_EQUIPMENT_BUTTON.getId() && event.getMenuOption().equals(SHOW_WORN))
|
||||||
|| (event.getWidgetId() == WidgetInfo.BANK_SETTINGS_BUTTON.getId() && event.getMenuOption().equals(SHOW_SETTINGS))
|
|| (event.getParam1() == WidgetInfo.BANK_SETTINGS_BUTTON.getId() && event.getMenuOption().equals(SHOW_SETTINGS))
|
||||||
|| (event.getWidgetId() == WidgetInfo.BANK_TUTORIAL_BUTTON.getId() && event.getMenuOption().equals(SHOW_TUTORIAL))))
|
|| (event.getParam1() == WidgetInfo.BANK_TUTORIAL_BUTTON.getId() && event.getMenuOption().equals(SHOW_TUTORIAL))))
|
||||||
{
|
{
|
||||||
saveTab();
|
saveTab();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
|
|||||||
// The menu option for clear history is "<col=ffff00>Public:</col> Clear history"
|
// The menu option for clear history is "<col=ffff00>Public:</col> Clear history"
|
||||||
if (menuOption.endsWith(CLEAR_HISTORY))
|
if (menuOption.endsWith(CLEAR_HISTORY))
|
||||||
{
|
{
|
||||||
clearChatboxHistory(ChatboxTab.of(event.getWidgetId()));
|
clearChatboxHistory(ChatboxTab.of(event.getParam1()));
|
||||||
}
|
}
|
||||||
else if (COPY_TO_CLIPBOARD.equals(menuOption) && !Strings.isNullOrEmpty(currentMessage))
|
else if (COPY_TO_CLIPBOARD.equals(menuOption) && !Strings.isNullOrEmpty(currentMessage))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ public class CrowdsourcingWoodcutting
|
|||||||
state = SkillingState.CLICKED;
|
state = SkillingState.CLICKED;
|
||||||
lastExperimentEnd = client.getTickCount();
|
lastExperimentEnd = client.getTickCount();
|
||||||
treeId = id;
|
treeId = id;
|
||||||
treeLocation = WorldPoint.fromScene(client, menuOptionClicked.getActionParam(), menuOptionClicked.getWidgetId(), client.getPlane());
|
treeLocation = WorldPoint.fromScene(client, menuOptionClicked.getParam0(), menuOptionClicked.getParam1(), client.getPlane());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -487,7 +487,7 @@ class WidgetInspector extends DevToolsFrame
|
|||||||
client.setSpellSelected(false);
|
client.setSpellSelected(false);
|
||||||
ev.consume();
|
ev.consume();
|
||||||
|
|
||||||
Object target = getWidgetOrWidgetItemForMenuOption(ev.getMenuAction().getId(), ev.getActionParam(), ev.getWidgetId());
|
Object target = getWidgetOrWidgetItemForMenuOption(ev.getMenuAction().getId(), ev.getParam0(), ev.getParam1());
|
||||||
if (target == null)
|
if (target == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -97,11 +97,11 @@ public class ExaminePlugin extends Plugin
|
|||||||
type = ExamineType.ITEM;
|
type = ExamineType.ITEM;
|
||||||
id = event.getId();
|
id = event.getId();
|
||||||
|
|
||||||
int widgetId = event.getWidgetId();
|
int widgetId = event.getParam1();
|
||||||
int widgetGroup = TO_GROUP(widgetId);
|
int widgetGroup = TO_GROUP(widgetId);
|
||||||
int widgetChild = TO_CHILD(widgetId);
|
int widgetChild = TO_CHILD(widgetId);
|
||||||
Widget widget = client.getWidget(widgetGroup, widgetChild);
|
Widget widget = client.getWidget(widgetGroup, widgetChild);
|
||||||
WidgetItem widgetItem = widget.getWidgetItem(event.getActionParam());
|
WidgetItem widgetItem = widget.getWidgetItem(event.getParam0());
|
||||||
quantity = widgetItem != null && widgetItem.getId() >= 0 ? widgetItem.getQuantity() : 1;
|
quantity = widgetItem != null && widgetItem.getId() >= 0 ? widgetItem.getQuantity() : 1;
|
||||||
|
|
||||||
// Examine on inventory items with more than 100000 quantity is handled locally and shows the item stack
|
// Examine on inventory items with more than 100000 quantity is handled locally and shows the item stack
|
||||||
@@ -127,7 +127,7 @@ public class ExaminePlugin extends Plugin
|
|||||||
case CC_OP_LOW_PRIORITY:
|
case CC_OP_LOW_PRIORITY:
|
||||||
{
|
{
|
||||||
type = ExamineType.ITEM_BANK_EQ;
|
type = ExamineType.ITEM_BANK_EQ;
|
||||||
int[] qi = findItemFromWidget(event.getWidgetId(), event.getActionParam());
|
int[] qi = findItemFromWidget(event.getParam1(), event.getParam0());
|
||||||
if (qi == null)
|
if (qi == null)
|
||||||
{
|
{
|
||||||
log.debug("Examine for item with unknown widget: {}", event);
|
log.debug("Examine for item with unknown widget: {}", event);
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ public class FriendNotesPlugin extends Plugin
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onMenuOptionClicked(MenuOptionClicked event)
|
public void onMenuOptionClicked(MenuOptionClicked event)
|
||||||
{
|
{
|
||||||
final int groupId = WidgetInfo.TO_GROUP(event.getWidgetId());
|
final int groupId = WidgetInfo.TO_GROUP(event.getParam1());
|
||||||
|
|
||||||
if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() || groupId == WidgetInfo.IGNORE_LIST.getGroupId())
|
if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() || groupId == WidgetInfo.IGNORE_LIST.getGroupId())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ public class HerbiboarPlugin extends Plugin
|
|||||||
case "Rock":
|
case "Rock":
|
||||||
case "Mushroom":
|
case "Mushroom":
|
||||||
case "Driftwood":
|
case "Driftwood":
|
||||||
startPoint = WorldPoint.fromScene(client, menuOpt.getActionParam(), menuOpt.getWidgetId(), client.getPlane());
|
startPoint = WorldPoint.fromScene(client, menuOpt.getParam0(), menuOpt.getParam1(), client.getPlane());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ public class KourendLibraryPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
if (MenuAction.GAME_OBJECT_FIRST_OPTION == menuOpt.getMenuAction() && menuOpt.getMenuTarget().contains("Bookshelf"))
|
if (MenuAction.GAME_OBJECT_FIRST_OPTION == menuOpt.getMenuAction() && menuOpt.getMenuTarget().contains("Bookshelf"))
|
||||||
{
|
{
|
||||||
lastBookcaseClick = WorldPoint.fromScene(client, menuOpt.getActionParam(), menuOpt.getWidgetId(), client.getPlane());
|
lastBookcaseClick = WorldPoint.fromScene(client, menuOpt.getParam0(), menuOpt.getParam1(), client.getPlane());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -646,7 +646,7 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onMenuOptionClicked(MenuOptionClicked event)
|
public void onMenuOptionClicked(MenuOptionClicked event)
|
||||||
{
|
{
|
||||||
if (event.getMenuAction() != MenuAction.RUNELITE || event.getWidgetId() != WidgetInfo.INVENTORY.getId())
|
if (event.getMenuAction() != MenuAction.RUNELITE || event.getParam1() != WidgetInfo.INVENTORY.getId())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -253,8 +253,8 @@ public class ObjectIndicatorsPlugin extends Plugin
|
|||||||
|
|
||||||
Scene scene = client.getScene();
|
Scene scene = client.getScene();
|
||||||
Tile[][][] tiles = scene.getTiles();
|
Tile[][][] tiles = scene.getTiles();
|
||||||
final int x = event.getActionParam();
|
final int x = event.getParam0();
|
||||||
final int y = event.getWidgetId();
|
final int y = event.getParam1();
|
||||||
final int z = client.getPlane();
|
final int z = client.getPlane();
|
||||||
final Tile tile = tiles[z][x][y];
|
final Tile tile = tiles[z][x][y];
|
||||||
|
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ public class PuzzleSolverPlugin extends Plugin
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onMenuOptionClicked(MenuOptionClicked menuOptionClicked)
|
public void onMenuOptionClicked(MenuOptionClicked menuOptionClicked)
|
||||||
{
|
{
|
||||||
int widgetId = menuOptionClicked.getWidgetId();
|
int widgetId = menuOptionClicked.getParam1();
|
||||||
if (TO_GROUP(widgetId) != WidgetID.LIGHT_BOX_GROUP_ID)
|
if (TO_GROUP(widgetId) != WidgetID.LIGHT_BOX_GROUP_ID)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -487,7 +487,7 @@ public class TimersPlugin extends Plugin
|
|||||||
imbuedHeartClickTick = client.getTickCount();
|
imbuedHeartClickTick = client.getTickCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
TeleportWidget teleportWidget = TeleportWidget.of(event.getWidgetId());
|
TeleportWidget teleportWidget = TeleportWidget.of(event.getParam1());
|
||||||
if (teleportWidget != null)
|
if (teleportWidget != null)
|
||||||
{
|
{
|
||||||
lastTeleportClicked = teleportWidget;
|
lastTeleportClicked = teleportWidget;
|
||||||
|
|||||||
@@ -284,11 +284,11 @@ public class WikiPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
id = lc.getId();
|
id = lc.getId();
|
||||||
name = lc.getName();
|
name = lc.getName();
|
||||||
location = WorldPoint.fromScene(client, ev.getActionParam(), ev.getWidgetId(), client.getPlane());
|
location = WorldPoint.fromScene(client, ev.getParam0(), ev.getParam1(), client.getPlane());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SPELL_CAST_ON_WIDGET:
|
case SPELL_CAST_ON_WIDGET:
|
||||||
Widget w = getWidget(ev.getWidgetId(), ev.getActionParam());
|
Widget w = getWidget(ev.getParam1(), ev.getParam0());
|
||||||
|
|
||||||
if (w.getType() == WidgetType.GRAPHIC && w.getItemId() != -1)
|
if (w.getType() == WidgetType.GRAPHIC && w.getItemId() != -1)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -538,7 +538,7 @@ public class XpTrackerPlugin extends Plugin
|
|||||||
public void onMenuOptionClicked(MenuOptionClicked event)
|
public void onMenuOptionClicked(MenuOptionClicked event)
|
||||||
{
|
{
|
||||||
if (event.getMenuAction().getId() != MenuAction.RUNELITE.getId()
|
if (event.getMenuAction().getId() != MenuAction.RUNELITE.getId()
|
||||||
|| TO_GROUP(event.getWidgetId()) != WidgetID.SKILLS_GROUP_ID)
|
|| TO_GROUP(event.getParam1()) != WidgetID.SKILLS_GROUP_ID)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user