Merge pull request #9389 from Nightfirecat/tag-to-untag
Use "Un-tag" and "Unmark" menu options for tagged NPCs and marked objects/tiles
This commit is contained in:
@@ -68,6 +68,7 @@ public class GroundMarkerPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
private static final String CONFIG_GROUP = "groundMarker";
|
private static final String CONFIG_GROUP = "groundMarker";
|
||||||
private static final String MARK = "Mark tile";
|
private static final String MARK = "Mark tile";
|
||||||
|
private static final String UNMARK = "Unmark tile";
|
||||||
private static final String WALK_HERE = "Walk here";
|
private static final String WALK_HERE = "Walk here";
|
||||||
private static final String REGION_PREFIX = "region_";
|
private static final String REGION_PREFIX = "region_";
|
||||||
|
|
||||||
@@ -213,7 +214,11 @@ public class GroundMarkerPlugin extends Plugin
|
|||||||
|
|
||||||
MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry();
|
MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry();
|
||||||
|
|
||||||
menuEntry.setOption(MARK);
|
final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, client.getSelectedSceneTile().getLocalLocation());
|
||||||
|
final int regionId = worldPoint.getRegionID();
|
||||||
|
final GroundMarkerPoint point = new GroundMarkerPoint(regionId, worldPoint.getRegionX(), worldPoint.getRegionY(), client.getPlane(), config.markerColor());
|
||||||
|
|
||||||
|
menuEntry.setOption(getPoints(regionId).contains(point) ? UNMARK : MARK);
|
||||||
menuEntry.setTarget(event.getTarget());
|
menuEntry.setTarget(event.getTarget());
|
||||||
menuEntry.setType(MenuAction.RUNELITE.getId());
|
menuEntry.setType(MenuAction.RUNELITE.getId());
|
||||||
|
|
||||||
@@ -224,7 +229,8 @@ public class GroundMarkerPlugin extends Plugin
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onMenuOptionClicked(MenuOptionClicked event)
|
public void onMenuOptionClicked(MenuOptionClicked event)
|
||||||
{
|
{
|
||||||
if (event.getMenuAction().getId() != MenuAction.RUNELITE.getId() || !event.getMenuOption().equals(MARK))
|
if (event.getMenuAction().getId() != MenuAction.RUNELITE.getId() ||
|
||||||
|
!(event.getMenuOption().equals(MARK) || event.getMenuOption().equals(UNMARK)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ public class NpcIndicatorsPlugin extends Plugin
|
|||||||
|
|
||||||
// Option added to NPC menu
|
// Option added to NPC menu
|
||||||
private static final String TAG = "Tag";
|
private static final String TAG = "Tag";
|
||||||
|
private static final String UNTAG = "Un-tag";
|
||||||
|
|
||||||
private static final Set<MenuAction> NPC_MENU_ACTIONS = ImmutableSet.of(MenuAction.NPC_FIRST_OPTION, MenuAction.NPC_SECOND_OPTION,
|
private static final Set<MenuAction> NPC_MENU_ACTIONS = ImmutableSet.of(MenuAction.NPC_FIRST_OPTION, MenuAction.NPC_SECOND_OPTION,
|
||||||
MenuAction.NPC_THIRD_OPTION, MenuAction.NPC_FOURTH_OPTION, MenuAction.NPC_FIFTH_OPTION);
|
MenuAction.NPC_THIRD_OPTION, MenuAction.NPC_FOURTH_OPTION, MenuAction.NPC_FIFTH_OPTION);
|
||||||
@@ -273,7 +274,7 @@ public class NpcIndicatorsPlugin extends Plugin
|
|||||||
MenuEntry[] menuEntries = client.getMenuEntries();
|
MenuEntry[] menuEntries = client.getMenuEntries();
|
||||||
menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1);
|
menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1);
|
||||||
final MenuEntry tagEntry = menuEntries[menuEntries.length - 1] = new MenuEntry();
|
final MenuEntry tagEntry = menuEntries[menuEntries.length - 1] = new MenuEntry();
|
||||||
tagEntry.setOption(TAG);
|
tagEntry.setOption(highlightedNpcs.stream().anyMatch(npc -> npc.getIndex() == event.getIdentifier()) ? UNTAG : TAG);
|
||||||
tagEntry.setTarget(event.getTarget());
|
tagEntry.setTarget(event.getTarget());
|
||||||
tagEntry.setParam0(event.getActionParam0());
|
tagEntry.setParam0(event.getActionParam0());
|
||||||
tagEntry.setParam1(event.getActionParam1());
|
tagEntry.setParam1(event.getActionParam1());
|
||||||
@@ -286,7 +287,8 @@ public class NpcIndicatorsPlugin extends Plugin
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onMenuOptionClicked(MenuOptionClicked click)
|
public void onMenuOptionClicked(MenuOptionClicked click)
|
||||||
{
|
{
|
||||||
if (click.getMenuAction() != MenuAction.RUNELITE || !click.getMenuOption().equals(TAG))
|
if (click.getMenuAction() != MenuAction.RUNELITE ||
|
||||||
|
!(click.getMenuOption().equals(TAG) || click.getMenuOption().equals(UNTAG)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ public class ObjectIndicatorsPlugin extends Plugin implements KeyListener
|
|||||||
{
|
{
|
||||||
private static final String CONFIG_GROUP = "objectindicators";
|
private static final String CONFIG_GROUP = "objectindicators";
|
||||||
private static final String MARK = "Mark object";
|
private static final String MARK = "Mark object";
|
||||||
|
private static final String UNMARK = "Unmark object";
|
||||||
|
|
||||||
private final Gson GSON = new Gson();
|
private final Gson GSON = new Gson();
|
||||||
@Getter(AccessLevel.PACKAGE)
|
@Getter(AccessLevel.PACKAGE)
|
||||||
@@ -216,10 +217,12 @@ public class ObjectIndicatorsPlugin extends Plugin implements KeyListener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Tile tile = client.getScene().getTiles()[client.getPlane()][event.getActionParam0()][event.getActionParam1()];
|
||||||
|
|
||||||
MenuEntry[] menuEntries = client.getMenuEntries();
|
MenuEntry[] menuEntries = client.getMenuEntries();
|
||||||
menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1);
|
menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1);
|
||||||
MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry();
|
MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry();
|
||||||
menuEntry.setOption(MARK);
|
menuEntry.setOption(objects.contains(findTileObject(tile, event.getIdentifier())) ? UNMARK : MARK);
|
||||||
menuEntry.setTarget(event.getTarget());
|
menuEntry.setTarget(event.getTarget());
|
||||||
menuEntry.setParam0(event.getActionParam0());
|
menuEntry.setParam0(event.getActionParam0());
|
||||||
menuEntry.setParam1(event.getActionParam1());
|
menuEntry.setParam1(event.getActionParam1());
|
||||||
@@ -231,7 +234,8 @@ public class ObjectIndicatorsPlugin extends Plugin implements KeyListener
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onMenuOptionClicked(MenuOptionClicked event)
|
public void onMenuOptionClicked(MenuOptionClicked event)
|
||||||
{
|
{
|
||||||
if (event.getMenuAction() != MenuAction.RUNELITE || !event.getMenuOption().equals(MARK))
|
if (event.getMenuAction() != MenuAction.RUNELITE
|
||||||
|
|| !(event.getMenuOption().equals(MARK) || event.getMenuOption().equals(UNMARK)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user