@@ -0,0 +1,17 @@
|
|||||||
|
package net.runelite.client.plugins.raids.shortcuts;
|
||||||
|
|
||||||
|
import net.runelite.client.config.ConfigGroup;
|
||||||
|
import net.runelite.client.config.ConfigItem;
|
||||||
|
|
||||||
|
@ConfigGroup("shortcut")
|
||||||
|
public interface ShortcutConfig {
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "highlightShortcuts",
|
||||||
|
name = "Highlight shortcuts",
|
||||||
|
description = "Displays which shortcut it is"
|
||||||
|
)
|
||||||
|
default boolean highlightShortcuts()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
package net.runelite.client.plugins.raids.shortcuts;
|
||||||
|
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Polygon;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.GameObject;
|
||||||
|
import net.runelite.api.Perspective;
|
||||||
|
import net.runelite.api.Point;
|
||||||
|
import net.runelite.api.Skill;
|
||||||
|
import net.runelite.api.TileObject;
|
||||||
|
import net.runelite.client.game.SkillIconManager;
|
||||||
|
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;
|
||||||
|
|
||||||
|
public class ShortcutOverlay extends Overlay
|
||||||
|
{
|
||||||
|
private final Client client;
|
||||||
|
private final ShortcutConfig config;
|
||||||
|
private final ShortcutPlugin plugin;
|
||||||
|
private final BufferedImage treeIcon;
|
||||||
|
private final BufferedImage strengthIcon;
|
||||||
|
private final BufferedImage miningIcon;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
ShortcutOverlay(Client client, ShortcutConfig config, ShortcutPlugin plugin, SkillIconManager iconManager)
|
||||||
|
{
|
||||||
|
this.client = client;
|
||||||
|
this.config = config;
|
||||||
|
this.plugin = plugin;
|
||||||
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
|
setPriority(OverlayPriority.LOW);
|
||||||
|
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||||
|
|
||||||
|
treeIcon = iconManager.getSkillImage(Skill.WOODCUTTING);
|
||||||
|
strengthIcon = iconManager.getSkillImage(Skill.STRENGTH);
|
||||||
|
miningIcon = iconManager.getSkillImage(Skill.MINING);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dimension render(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
for (TileObject shortcut : plugin.getShortcut())
|
||||||
|
{
|
||||||
|
if (shortcut.getPlane() == client.getPlane())
|
||||||
|
{
|
||||||
|
Polygon poly;
|
||||||
|
if ((shortcut instanceof GameObject))
|
||||||
|
{
|
||||||
|
poly = ((GameObject) shortcut).getConvexHull();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
poly = shortcut.getCanvasTilePoly();
|
||||||
|
}
|
||||||
|
if (poly != null)
|
||||||
|
{
|
||||||
|
String name;
|
||||||
|
switch (shortcut.getId())
|
||||||
|
{
|
||||||
|
case 29736:
|
||||||
|
name = "Tree";
|
||||||
|
break;
|
||||||
|
case 29738:
|
||||||
|
name = "Rocks";
|
||||||
|
break;
|
||||||
|
case 297480:
|
||||||
|
name = "Boulder";
|
||||||
|
break;
|
||||||
|
case 29737:
|
||||||
|
case 29739:
|
||||||
|
default:
|
||||||
|
name = "null";
|
||||||
|
}
|
||||||
|
if (config.highlightShortcuts())
|
||||||
|
{
|
||||||
|
if (name.equals("Tree"))
|
||||||
|
{
|
||||||
|
Point canvasLoc = Perspective.getCanvasImageLocation(client, shortcut.getLocalLocation(),
|
||||||
|
treeIcon, 150);
|
||||||
|
if (canvasLoc != null)
|
||||||
|
{
|
||||||
|
graphics.drawImage(treeIcon, canvasLoc.getX(), canvasLoc.getY(), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (name.equals("Rocks"))
|
||||||
|
{
|
||||||
|
Point canvasLoc = Perspective.getCanvasImageLocation(client, shortcut.getLocalLocation(),
|
||||||
|
miningIcon, 150);
|
||||||
|
if (canvasLoc != null)
|
||||||
|
{
|
||||||
|
graphics.drawImage(miningIcon, canvasLoc.getX(), canvasLoc.getY(), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (name.equals("Boulder"))
|
||||||
|
{
|
||||||
|
Point canvasLoc = Perspective.getCanvasImageLocation(client, shortcut.getLocalLocation(),
|
||||||
|
strengthIcon, 150);
|
||||||
|
if (canvasLoc != null)
|
||||||
|
{
|
||||||
|
graphics.drawImage(strengthIcon, canvasLoc.getX(), canvasLoc.getY(), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
package net.runelite.client.plugins.raids.shortcuts;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import com.google.inject.Provides;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.TileObject;
|
||||||
|
import net.runelite.api.coords.WorldPoint;
|
||||||
|
import net.runelite.api.events.GameObjectDespawned;
|
||||||
|
import net.runelite.api.events.GameObjectSpawned;
|
||||||
|
import net.runelite.api.events.GameTick;
|
||||||
|
import net.runelite.client.config.ConfigManager;
|
||||||
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
|
import net.runelite.client.plugins.Plugin;
|
||||||
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
|
|
||||||
|
@PluginDescriptor(
|
||||||
|
name = "Raid Shortcuts",
|
||||||
|
description = "Highlights Raid Shortcuts",
|
||||||
|
tags = {"boulder", "cox", "raids", "highlight"}
|
||||||
|
)
|
||||||
|
@Slf4j
|
||||||
|
public class ShortcutPlugin extends Plugin
|
||||||
|
{
|
||||||
|
@Inject
|
||||||
|
private Client client;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private OverlayManager overlayManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ShortcutOverlay overlay;
|
||||||
|
|
||||||
|
private final List<TileObject> shortcut = new ArrayList<>();
|
||||||
|
|
||||||
|
List<TileObject> getShortcut()
|
||||||
|
{
|
||||||
|
return shortcut;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
ShortcutConfig provideConfig(ConfigManager configManager)
|
||||||
|
{
|
||||||
|
return (ShortcutConfig)configManager.getConfig(ShortcutConfig.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void startUp()
|
||||||
|
{
|
||||||
|
overlayManager.add(overlay);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void shutDown()
|
||||||
|
{
|
||||||
|
overlayManager.remove(overlay);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onGameObjectSpawned(GameObjectSpawned event)
|
||||||
|
{
|
||||||
|
WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, event.getGameObject().getLocalLocation());
|
||||||
|
if (worldPoint == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ((event.getGameObject().getId() == 29740) || (event.getGameObject().getId() == 29736) || (event.getGameObject().getId() == 29738))
|
||||||
|
{
|
||||||
|
shortcut.add(event.getGameObject());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onGameObjectDespawned(GameObjectDespawned event)
|
||||||
|
{
|
||||||
|
shortcut.remove(event.getGameObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onGameTick(GameTick tick)
|
||||||
|
{
|
||||||
|
if (shortcut == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Iterator<TileObject> it = shortcut.iterator();
|
||||||
|
while (it.hasNext())
|
||||||
|
{
|
||||||
|
TileObject object = (TileObject)it.next();
|
||||||
|
if (object.getCanvasLocation() == null)
|
||||||
|
{
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 349 B After Width: | Height: | Size: 483 B |
Binary file not shown.
|
Before Width: | Height: | Size: 368 B After Width: | Height: | Size: 425 B |
Reference in New Issue
Block a user