Search in sources :

Example 11 with GameObject

use of net.runelite.api.GameObject in project runelite by runelite.

the class MotherlodePlugin method onGameObjectChanged.

@Subscribe
public void onGameObjectChanged(GameObjectChanged event) {
    GameObject previous = event.getPrevious();
    GameObject gameObject = event.getGameObject();
    rocks.remove(previous);
    if (ROCK_OBSTACLES.contains(gameObject.getId())) {
        rocks.add(gameObject);
    }
}
Also used : GameObject(net.runelite.api.GameObject) Subscribe(com.google.common.eventbus.Subscribe)

Example 12 with GameObject

use of net.runelite.api.GameObject in project runelite by runelite.

the class MapClue method makeWorldOverlayHint.

@Override
public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin) {
    LocalPoint localLocation = LocalPoint.fromWorld(plugin.getClient(), getLocation());
    if (localLocation == null) {
        return;
    }
    // Mark game object
    if (objectId != -1) {
        Region region = plugin.getClient().getRegion();
        Tile[][][] tiles = region.getTiles();
        Tile tile = tiles[plugin.getClient().getPlane()][localLocation.getRegionX()][localLocation.getRegionY()];
        net.runelite.api.Point mousePosition = plugin.getClient().getMouseCanvasPosition();
        for (GameObject gameObject : tile.getGameObjects()) {
            if (gameObject != null) {
                OverlayUtil.renderHoverableArea(graphics, gameObject.getClickbox(), mousePosition, CLICKBOX_FILL_COLOR, CLICKBOX_BORDER_COLOR, CLICKBOX_HOVER_BORDER_COLOR);
                OverlayUtil.renderImageLocation(plugin.getClient(), graphics, localLocation, CLUE_SCROLL_IMAGE, IMAGE_Z_OFFSET);
            }
        }
    } else {
        OverlayUtil.renderTileOverlay(plugin.getClient(), graphics, localLocation, SPADE_IMAGE, Color.ORANGE);
    }
}
Also used : LocalPoint(net.runelite.api.coords.LocalPoint) GameObject(net.runelite.api.GameObject) Region(net.runelite.api.Region) Tile(net.runelite.api.Tile)

Example 13 with GameObject

use of net.runelite.api.GameObject in project runelite by runelite.

the class CrypticClue method makeWorldOverlayHint.

@Override
public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin) {
    // Mark dig location
    if (getLocation() != null && getNpc() == null && objectId == -1) {
        LocalPoint localLocation = LocalPoint.fromWorld(plugin.getClient(), getLocation());
        if (localLocation != null) {
            OverlayUtil.renderTileOverlay(plugin.getClient(), graphics, localLocation, SPADE_IMAGE, Color.ORANGE);
        }
    }
    // Mark NPC
    if (plugin.getNpcsToMark() != null) {
        for (NPC npc : plugin.getNpcsToMark()) {
            OverlayUtil.renderActorOverlayImage(graphics, npc, CLUE_SCROLL_IMAGE, Color.ORANGE, IMAGE_Z_OFFSET);
        }
    }
    // Mark game object
    if (objectId != -1) {
        net.runelite.api.Point mousePosition = plugin.getClient().getMouseCanvasPosition();
        if (plugin.getObjectsToMark() != null) {
            for (GameObject gameObject : plugin.getObjectsToMark()) {
                OverlayUtil.renderHoverableArea(graphics, gameObject.getClickbox(), mousePosition, CLICKBOX_FILL_COLOR, CLICKBOX_BORDER_COLOR, CLICKBOX_HOVER_BORDER_COLOR);
                OverlayUtil.renderImageLocation(plugin.getClient(), graphics, gameObject.getLocalLocation(), CLUE_SCROLL_IMAGE, IMAGE_Z_OFFSET);
            }
        }
    }
}
Also used : NPC(net.runelite.api.NPC) LocalPoint(net.runelite.api.coords.LocalPoint) GameObject(net.runelite.api.GameObject)

Aggregations

GameObject (net.runelite.api.GameObject)13 Subscribe (com.google.common.eventbus.Subscribe)9 LocalPoint (net.runelite.api.coords.LocalPoint)4 Player (net.runelite.api.Player)2 Tile (net.runelite.api.Tile)2 Color (java.awt.Color)1 Area (java.awt.geom.Area)1 Instant (java.time.Instant)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Actor (net.runelite.api.Actor)1 NPC (net.runelite.api.NPC)1 Point (net.runelite.api.Point)1 Region (net.runelite.api.Region)1 WorldPoint (net.runelite.api.coords.WorldPoint)1 GameObjectChanged (net.runelite.api.events.GameObjectChanged)1 GameObjectDespawned (net.runelite.api.events.GameObjectDespawned)1 GameObjectSpawned (net.runelite.api.events.GameObjectSpawned)1 FieldHook (net.runelite.api.mixins.FieldHook)1 Inject (net.runelite.api.mixins.Inject)1