Mark / umark, tag / untag
This commit is contained in:
@@ -45,6 +45,7 @@ import net.runelite.api.Client;
|
|||||||
import net.runelite.api.Constants;
|
import net.runelite.api.Constants;
|
||||||
import net.runelite.api.MainBufferProvider;
|
import net.runelite.api.MainBufferProvider;
|
||||||
import net.runelite.api.NullItemID;
|
import net.runelite.api.NullItemID;
|
||||||
|
import net.runelite.api.Point;
|
||||||
import net.runelite.api.RenderOverview;
|
import net.runelite.api.RenderOverview;
|
||||||
import net.runelite.api.Renderable;
|
import net.runelite.api.Renderable;
|
||||||
import net.runelite.api.WorldMapManager;
|
import net.runelite.api.WorldMapManager;
|
||||||
@@ -396,6 +397,18 @@ public class Hooks implements Callbacks
|
|||||||
BufferedImage image = (BufferedImage) bufferProvider.getImage();
|
BufferedImage image = (BufferedImage) bufferProvider.getImage();
|
||||||
Graphics2D graphics2d = image.createGraphics();
|
Graphics2D graphics2d = image.createGraphics();
|
||||||
|
|
||||||
|
// Update selected scene tile
|
||||||
|
if (!client.isMenuOpen())
|
||||||
|
{
|
||||||
|
Point p = client.getMouseCanvasPosition();
|
||||||
|
p = new Point(
|
||||||
|
p.getX() - client.getViewportXOffset(),
|
||||||
|
p.getY() - client.getViewportYOffset());
|
||||||
|
|
||||||
|
client.setCheckClick(true);
|
||||||
|
client.setMouseCanvasHoverPosition(p);
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
renderer.render(graphics2d, OverlayLayer.ABOVE_SCENE);
|
renderer.render(graphics2d, OverlayLayer.ABOVE_SCENE);
|
||||||
|
|||||||
@@ -82,6 +82,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 = "Untag";
|
||||||
|
|
||||||
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);
|
||||||
@@ -271,7 +272,7 @@ public class NpcIndicatorsPlugin extends Plugin
|
|||||||
// Add tag option
|
// Add tag option
|
||||||
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(npcTags.contains(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());
|
||||||
@@ -284,7 +285,9 @@ 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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,6 +80,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)
|
||||||
@@ -221,7 +222,44 @@ public class ObjectIndicatorsPlugin extends Plugin implements KeyListener
|
|||||||
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);
|
|
||||||
|
String option = MARK;
|
||||||
|
|
||||||
|
Scene scene = client.getScene();
|
||||||
|
Tile[][][] tiles = scene.getTiles();
|
||||||
|
final int x = event.getActionParam0();
|
||||||
|
final int y = event.getActionParam1();
|
||||||
|
final int z = client.getPlane();
|
||||||
|
final Tile tile = tiles[z][x][y];
|
||||||
|
final TileObject object = findTileObject(tile, event.getIdentifier());
|
||||||
|
if (object != null)
|
||||||
|
{
|
||||||
|
final ObjectComposition objectDefinition = client.getObjectDefinition(object.getId());
|
||||||
|
final String name = objectDefinition.getName();
|
||||||
|
|
||||||
|
if (!Strings.isNullOrEmpty(name))
|
||||||
|
{
|
||||||
|
final WorldPoint loc = WorldPoint.fromLocalInstance(client, tile.getLocalLocation());
|
||||||
|
final int regionId = loc.getRegionID();
|
||||||
|
|
||||||
|
final ObjectPoint point = new ObjectPoint(
|
||||||
|
name,
|
||||||
|
regionId,
|
||||||
|
loc.getX() & (REGION_SIZE - 1),
|
||||||
|
loc.getY() & (REGION_SIZE - 1),
|
||||||
|
client.getPlane());
|
||||||
|
|
||||||
|
final Set<ObjectPoint> objectPoints = points.get(regionId);
|
||||||
|
|
||||||
|
if (objectPoints != null && objectPoints.contains(point))
|
||||||
|
{
|
||||||
|
option = UNMARK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
menuEntry.setOption(option);
|
||||||
|
|
||||||
menuEntry.setTarget(event.getTarget());
|
menuEntry.setTarget(event.getTarget());
|
||||||
menuEntry.setParam0(event.getActionParam0());
|
menuEntry.setParam0(event.getActionParam0());
|
||||||
menuEntry.setParam1(event.getActionParam1());
|
menuEntry.setParam1(event.getActionParam1());
|
||||||
@@ -233,7 +271,9 @@ 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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import java.awt.Polygon;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.Perspective;
|
import net.runelite.api.Perspective;
|
||||||
import net.runelite.api.Point;
|
|
||||||
import net.runelite.api.coords.LocalPoint;
|
import net.runelite.api.coords.LocalPoint;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
@@ -59,18 +58,6 @@ public class TileIndicatorsOverlay extends Overlay
|
|||||||
{
|
{
|
||||||
if (config.highlightHoveredTile())
|
if (config.highlightHoveredTile())
|
||||||
{
|
{
|
||||||
// Update selected scene tile
|
|
||||||
if (!client.isMenuOpen())
|
|
||||||
{
|
|
||||||
Point p = client.getMouseCanvasPosition();
|
|
||||||
p = new Point(
|
|
||||||
p.getX() - client.getViewportXOffset(),
|
|
||||||
p.getY() - client.getViewportYOffset());
|
|
||||||
|
|
||||||
client.setCheckClick(true);
|
|
||||||
client.setMouseCanvasHoverPosition(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we have tile "selected" render it
|
// If we have tile "selected" render it
|
||||||
if (client.getSelectedSceneTile() != null)
|
if (client.getSelectedSceneTile() != null)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user