@@ -29,6 +29,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.DecorativeObject;
|
||||
import net.runelite.api.GameObject;
|
||||
import net.runelite.api.TileObject;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
@@ -65,22 +66,31 @@ class ObjectIndicatorsOverlay extends Overlay
|
||||
}
|
||||
|
||||
final Polygon polygon;
|
||||
Polygon polygon2 = null;
|
||||
|
||||
if (object instanceof GameObject)
|
||||
{
|
||||
polygon = ((GameObject) object).getConvexHull();
|
||||
}
|
||||
else if (object instanceof DecorativeObject)
|
||||
{
|
||||
polygon = ((DecorativeObject) object).getConvexHull();
|
||||
polygon2 = ((DecorativeObject) object).getConvexHull2();
|
||||
}
|
||||
else
|
||||
{
|
||||
polygon = object.getCanvasTilePoly();
|
||||
}
|
||||
|
||||
if (polygon == null)
|
||||
if (polygon != null)
|
||||
{
|
||||
continue;
|
||||
OverlayUtil.renderPolygon(graphics, polygon, config.markerColor());
|
||||
}
|
||||
|
||||
OverlayUtil.renderPolygon(graphics, polygon, config.markerColor());
|
||||
if (polygon2 != null)
|
||||
{
|
||||
OverlayUtil.renderPolygon(graphics, polygon2, config.markerColor());
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -43,6 +43,7 @@ import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import static net.runelite.api.Constants.REGION_SIZE;
|
||||
import net.runelite.api.DecorativeObject;
|
||||
import net.runelite.api.GameObject;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.MenuAction;
|
||||
@@ -58,6 +59,8 @@ import net.runelite.api.events.GameObjectSpawned;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.MenuEntryAdded;
|
||||
import net.runelite.api.events.MenuOptionClicked;
|
||||
import net.runelite.api.events.DecorativeObjectSpawned;
|
||||
import net.runelite.api.events.DecorativeObjectDespawned;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.input.KeyListener;
|
||||
@@ -158,26 +161,15 @@ public class ObjectIndicatorsPlugin extends Plugin implements KeyListener
|
||||
@Subscribe
|
||||
public void onGameObjectSpawned(GameObjectSpawned event)
|
||||
{
|
||||
final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, event.getGameObject().getLocalLocation());
|
||||
final Set<ObjectPoint> objectPoints = points.get(worldPoint.getRegionID());
|
||||
final GameObject eventObject = event.getGameObject();
|
||||
checkObjectPoints(eventObject);
|
||||
}
|
||||
|
||||
if (objectPoints == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (ObjectPoint objectPoint : objectPoints)
|
||||
{
|
||||
if ((worldPoint.getX() & (REGION_SIZE - 1)) == objectPoint.getRegionX()
|
||||
&& (worldPoint.getY() & (REGION_SIZE - 1)) == objectPoint.getRegionY())
|
||||
{
|
||||
if (objectPoint.getName().equals(client.getObjectDefinition(event.getGameObject().getId()).getName()))
|
||||
{
|
||||
objects.add(event.getGameObject());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@Subscribe
|
||||
public void onDecorativeObjectSpawned(DecorativeObjectSpawned event)
|
||||
{
|
||||
final DecorativeObject eventObject = event.getDecorativeObject();
|
||||
checkObjectPoints(eventObject);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -186,6 +178,12 @@ public class ObjectIndicatorsPlugin extends Plugin implements KeyListener
|
||||
objects.remove(event.getGameObject());
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onDecorativeObjectDespawned(DecorativeObjectDespawned event)
|
||||
{
|
||||
objects.remove(event.getDecorativeObject());
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged gameStateChanged)
|
||||
{
|
||||
@@ -263,6 +261,30 @@ public class ObjectIndicatorsPlugin extends Plugin implements KeyListener
|
||||
markObject(name, object);
|
||||
}
|
||||
|
||||
private void checkObjectPoints(TileObject object)
|
||||
{
|
||||
final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, object.getLocalLocation());
|
||||
final Set<ObjectPoint> objectPoints = points.get(worldPoint.getRegionID());
|
||||
|
||||
if (objectPoints == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (ObjectPoint objectPoint : objectPoints)
|
||||
{
|
||||
if ((worldPoint.getX() & (REGION_SIZE - 1)) == objectPoint.getRegionX()
|
||||
&& (worldPoint.getY() & (REGION_SIZE - 1)) == objectPoint.getRegionY())
|
||||
{
|
||||
if (objectPoint.getName().equals(client.getObjectDefinition(object.getId()).getName()))
|
||||
{
|
||||
objects.add(object);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private TileObject findTileObject(Tile tile, int id)
|
||||
{
|
||||
if (tile == null)
|
||||
@@ -271,6 +293,12 @@ public class ObjectIndicatorsPlugin extends Plugin implements KeyListener
|
||||
}
|
||||
|
||||
final GameObject[] tileGameObjects = tile.getGameObjects();
|
||||
final DecorativeObject tileDecorativeObject = tile.getDecorativeObject();
|
||||
|
||||
if (tileDecorativeObject != null && tileDecorativeObject.getId() == id)
|
||||
{
|
||||
return tileDecorativeObject;
|
||||
}
|
||||
|
||||
for (GameObject object : tileGameObjects)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user