Created
October 5, 2016 16:31
-
-
Save benjefferies/2e014eda86269001b009caa3220fd106 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.powerbot.script.*; | |
import org.powerbot.script.rt6.ClientContext; | |
import org.powerbot.script.rt6.MobileIdNameQuery; | |
import org.powerbot.script.rt6.Npc; | |
import java.awt.*; | |
import java.util.ArrayList; | |
import java.util.Collection; | |
import java.util.HashMap; | |
import java.util.Map; | |
@Script.Manifest(name="Impling highlight", description="Highlights implings you want to catch") | |
public class ImplingLocator extends PollingScript<ClientContext> implements PaintListener { | |
@Override | |
public void poll() { | |
} | |
@Override | |
public void repaint(Graphics graphics) { | |
MobileIdNameQuery<Npc> npcs = ctx.npcs.id(Impling.ids); | |
for (Npc npc : npcs) { | |
if (npc.inViewport()) { | |
drawToMap(graphics, npc.centerPoint(), Impling.getColor(npc.id())); | |
} | |
} | |
MobileIdNameQuery<Npc> crystals = ctx.npcs.name("Crystal Impling"); | |
for (Npc npc : crystals) { | |
if (npc.inViewport()) { | |
drawToMap(graphics, npc.centerPoint(), Color.CYAN); | |
} | |
} | |
} | |
private void drawToMap(final Graphics g, final Point point, final Color col) { | |
g.setColor(col); | |
g.fillOval(point.x - 2, point.y - 2, 15, 15); | |
} | |
private enum Impling { | |
KINGLY(7906, Color.BLACK), | |
ZOMBIE(7905, Color.GREEN), | |
DRAGON(6064, Color.RED), | |
MAGPIE(6062, Color.PINK), | |
NINJA(6063, Color.BLACK), | |
DIVINE(14933, Color.YELLOW),; | |
private static int[] ids = new int[Impling.values().length]; | |
private static Map<Integer, Color> colorMap = new HashMap<>(); | |
private final int id; | |
private final Color color; | |
Impling(int id, Color color) { | |
this.id = id; | |
this.color = color; | |
} | |
static Color getColor(Integer id) { | |
return colorMap.get(id); | |
} | |
static { | |
initIds(); | |
initColorMap(); | |
} | |
private static void initColorMap() { | |
for (int i = 0; i < ids.length; i++) { | |
final Impling impling = Impling.values()[i]; | |
colorMap.put(impling.id, impling.color); | |
} | |
} | |
private static void initIds() { | |
for (int i = 0; i < ids.length; i++) { | |
ids[i] = Impling.values()[i].id; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Impling locator which can be used with RSbot to highlight all implings.