Java Code Examples for net.runelite.api.MenuEntry#getOpcode()

The following examples show how to use net.runelite.api.MenuEntry#getOpcode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AgilityPlugin.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
private boolean checkAndModify(MenuEntry old)
{
	//Guarding against non-first option because agility shortcuts are always that type of event.
	if (old.getOpcode() != MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId())
	{
		return false;
	}

	for (Obstacle nearbyObstacle : getObstacles().values())
	{
		AgilityShortcut shortcut = nearbyObstacle.getShortcut();
		if (shortcut != null && Ints.contains(shortcut.getObstacleIds(), old.getIdentifier()))
		{
			final int reqLevel = shortcut.getLevel();
			final String requirementText = ColorUtil.getLevelColorString(reqLevel, getAgilityLevel()) + "  (level-" + reqLevel + ")";

			old.setTarget(old.getTarget() + requirementText);
			return true;
		}
	}

	return false;
}
 
Example 2
Source File: Runes.java    From ExternalPlugins with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean isEntryValid(MenuEntry event)
{
	return event.getOpcode() == MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId() &&
		event.getOption().equals("Craft-rune") &&
		event.getTarget().equals("<col=ffff>Altar");
}
 
Example 3
Source File: Bones.java    From ExternalPlugins with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean isClickValid(MenuEntry event)
{
	return event.getOpcode() == MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId() &&
		event.getTarget().contains("<col=ff9040>Bones<col=ffffff> -> ") &&
		event.getTarget().toLowerCase().contains("altar");
}
 
Example 4
Source File: Spell.java    From ExternalPlugins with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean isEntryValid(MenuEntry event)
{
	return event.getOpcode() == MenuOpcode.WIDGET_TYPE_2.getId() &&
		event.getOption().equals("Cast") &&
		event.getTarget().equals("<col=00ff00>" + spell + "</col>");
}
 
Example 5
Source File: WidgetInspector.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private void onMenuEntryAdded(MenuEntryAdded event)
{
	if (!pickerSelected)
	{
		return;
	}

	MenuEntry[] menuEntries = client.getMenuEntries();

	for (int i = 0; i < menuEntries.length; i++)
	{
		MenuEntry entry = menuEntries[i];
		if (entry.getOpcode() != MenuOpcode.ITEM_USE_ON_WIDGET.getId()
			&& entry.getOpcode() != MenuOpcode.SPELL_CAST_ON_WIDGET.getId())
		{
			continue;
		}
		String name = WidgetInfo.TO_GROUP(entry.getParam1()) + "." + WidgetInfo.TO_CHILD(entry.getParam1());

		if (entry.getParam0() != -1)
		{
			name += " [" + entry.getParam0() + "]";
		}

		Color color = colorForWidget(i, menuEntries.length);

		entry.setTarget(ColorUtil.wrapWithColorTag(name, color));
	}

	client.setMenuEntries(menuEntries);
}
 
Example 6
Source File: Darts.java    From ExternalPlugins with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean isEntryValid(MenuEntry event)
{
	return event.getOpcode() == MenuOpcode.ITEM_USE.getId() &&
		(DART_TIPS.contains(event.getIdentifier()) || BOLTS.contains(event.getIdentifier()));
}
 
Example 7
Source File: Birdhouses.java    From ExternalPlugins with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean isClickValid(MenuEntry event)
{
	return event.getOpcode() == MenuOpcode.ITEM_USE_ON_GAME_OBJECT.getId() &&
		event.getTarget().contains("<col=ff9040>Hops seed<col=ffffff> -> ");
}
 
Example 8
Source File: Birdhouses.java    From ExternalPlugins with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean isEntryValid(MenuEntry event)
{
	return event.getOpcode() == MenuOpcode.GAME_OBJECT_SECOND_OPTION.getId() &&
		BIRD_HOUSES_NAMES.contains(event.getTarget());
}
 
Example 9
Source File: Tiara.java    From ExternalPlugins with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean isClickValid(MenuEntry event)
{
	return event.getOpcode() == MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId() &&
		event.getTarget().equals("<col=ff9040>Tiara<col=ffffff> -> <col=ffff>Altar");
}
 
Example 10
Source File: Karambwans.java    From ExternalPlugins with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean isEntryValid(MenuEntry event)
{
	return event.getOpcode() == MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId() &&
		event.getOption().equals("Cook");
}
 
Example 11
Source File: Healer.java    From ExternalPlugins with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean isEntryValid(MenuEntry event)
{
	return event.getOpcode() == 1003 && event.getTarget().contains("Penance Healer");
}
 
Example 12
Source File: Herbtar.java    From ExternalPlugins with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean isClickValid(MenuEntry event)
{
	return event.getOpcode() == MenuOpcode.ITEM_USE.getId() &&
		event.getTarget().contains("<col=ff9040>Swamp tar<col=ffffff> -> ");
}
 
Example 13
Source File: Herbtar.java    From ExternalPlugins with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean isEntryValid(MenuEntry event)
{
	return event.getOpcode() == MenuOpcode.ITEM_USE.getId() &&
		HERBS.contains(event.getIdentifier());
}
 
Example 14
Source File: Darts.java    From ExternalPlugins with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean isClickValid(MenuEntry event)
{
	return event.getOpcode() == MenuOpcode.ITEM_USE.getId() &&
		event.getTarget().contains("<col=ff9040>Feather<col=ffffff> -> ");
}
 
Example 15
Source File: DarkEssence.java    From ExternalPlugins with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean isClickValid(MenuEntry event)
{
	return event.getOpcode() == MenuOpcode.ITEM_USE.getId() &&
		event.getTarget().contains("<col=ff9040>Chisel<col=ffffff> ->");
}
 
Example 16
Source File: Runes.java    From ExternalPlugins with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean isClickValid(MenuEntry event)
{
	return (event.getOpcode() == MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId() && event.getTarget().equals(rune)) ||
		(event.getOpcode() == MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId() && event.getTarget().equals("<col=ff9040>Magic Imbue<col=ffffff> -> <col=ffff>Yourself"));
}
 
Example 17
Source File: Seeds.java    From ExternalPlugins with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean isEntryValid(MenuEntry event)
{
	return event.getOpcode() == MenuOpcode.EXAMINE_OBJECT.getId() &&
		event.getTarget().toLowerCase().contains("tithe");
}
 
Example 18
Source File: Firemaking.java    From ExternalPlugins with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean isClickValid(MenuEntry event)
{
	return event.getOpcode() == MenuOpcode.ITEM_USE.getId() &&
		event.getTarget().contains("<col=ff9040>Tinderbox<col=ffffff> -> ");
}
 
Example 19
Source File: Karambwans.java    From ExternalPlugins with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean isClickValid(MenuEntry event)
{
	return event.getOpcode() == MenuOpcode.GAME_OBJECT_FIRST_OPTION.getId() &&
		event.getTarget().contains("<col=ff9040>Raw karambwan<col=ffffff> -> ");
}
 
Example 20
Source File: Compost.java    From ExternalPlugins with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean isEntryValid(MenuEntry event)
{
	return event.getOpcode() == MenuOpcode.ITEM_USE.getId() &&
		event.getIdentifier() == ItemID.COMPOST;
}