runeliteplusplus / RuneLitePlusPlus

RuneLite client with added plugins [DEPRECATED]
36 stars 21 forks source link

This isnt a issue at all. Just didnt know how to do a pull request. #17

Closed kaffeknugen closed 5 years ago

kaffeknugen commented 5 years ago

For the vorkath plugin. the acid pools. Shouldnt it be possible to do something with this style to make it work? Also, A olm crystal and bomb plugin would be nice. So you can see where they are gonna land.

package net.runelite.client.plugins.grotesqueguardians;

import javax.inject.Inject; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.ui.overlay.OverlayManager;

@PluginDescriptor( name = "Grotesque Guardians", description = "Display tile indicators for the Grotesque Guardian special attacks", tags = {"grotesque", "guardians", "gargoyle", "garg"} ) public class GrotesqueGuardiansPlugin extends Plugin { @Inject private OverlayManager overlayManager;

@Inject
private GrotesqueGuardiansOverlay overlay;

@Override
protected void startUp() throws Exception
{
    overlayManager.add(overlay);
}

@Override
protected void shutDown() throws Exception
{
    overlayManager.remove(overlay);
}

}

package net.runelite.client.plugins.grotesqueguardians;

import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Polygon; import javax.inject.Inject; import net.runelite.api.Client; import net.runelite.api.GraphicID; import net.runelite.api.GraphicsObject; import net.runelite.api.Perspective; import net.runelite.api.coords.LocalPoint; import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayLayer; import net.runelite.client.ui.overlay.OverlayPosition; import net.runelite.client.ui.overlay.OverlayPriority; import net.runelite.client.ui.overlay.OverlayUtil;

class GrotesqueGuardiansOverlay extends Overlay { private static final int GROTESQUE_GUARDIANS_REGION_ID = 6727; private final Client client;

@Inject
private GrotesqueGuardiansOverlay(Client client)
{
    this.client = client;
    setPosition(OverlayPosition.DYNAMIC);
    setLayer(OverlayLayer.ABOVE_SCENE);
    setPriority(OverlayPriority.LOW);
}

@Override
public Dimension render(Graphics2D graphics)
{
    if (!client.isInInstancedRegion() || client.getMapRegions()[0] != GROTESQUE_GUARDIANS_REGION_ID)
    {
        return null;
    }

    // TODO: Awaiting GraphicsObjectDespawn event to be tracked to make this more efficient.
    for (GraphicsObject graphicsObject : client.getGraphicsObjects())
    {
        Color color = null;

        if (graphicsObject.getId() >= GraphicID.GROTESQUE_GUARDIANS_LIGHTNING_START && graphicsObject.getId() <= GraphicID.GROTESQUE_GUARDIANS_LIGHTNING_END)
        {
            color = Color.ORANGE;
        }
        else if (graphicsObject.getId() == GraphicID.GROTESQUE_GUARDIANS_STONE_ORB)
        {
            color = Color.GRAY;
        }
        else if (graphicsObject.getId() == GraphicID.GROTESQUE_GUARDIANS_FALLING_ROCKS)
        {
            color = Color.YELLOW;
        }
        else
        {
            continue;
        }

        LocalPoint lp = graphicsObject.getLocation();
        Polygon poly = Perspective.getCanvasTilePoly(client, lp);

        if (poly != null)
        {
            OverlayUtil.renderPolygon(graphics, poly, color);
        }
    }
    return null;
}

}