Created
October 3, 2012 18:11
-
-
Save phl0w/3828705 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.core.event.listeners.PaintListener; | |
| import org.powerbot.core.script.ActiveScript; | |
| import org.powerbot.game.api.Manifest; | |
| import org.powerbot.game.api.methods.Calculations; | |
| import org.powerbot.game.api.methods.interactive.NPCs; | |
| import org.powerbot.game.api.methods.interactive.Players; | |
| import org.powerbot.game.api.methods.node.SceneEntities; | |
| import org.powerbot.game.api.util.Random; | |
| import org.powerbot.game.api.wrappers.Tile; | |
| import org.powerbot.game.api.wrappers.interactive.NPC; | |
| import org.powerbot.game.api.wrappers.interactive.Player; | |
| import org.powerbot.game.api.wrappers.node.SceneObject; | |
| import java.awt.*; | |
| @Manifest(authors = {"_phl0w"}, name = "Impling locator", version = 1.0) | |
| public class ImplingLocator extends ActiveScript implements PaintListener { | |
| private static final Color color1 = new Color(51, 51, 51, 96); | |
| private static final Color color2 = new Color(153, 0, 0); | |
| private static final BasicStroke stroke1 = new BasicStroke(1); | |
| private static final Font font2 = new Font("Arial", Font.BOLD, 16); | |
| private static final Font font3 = new Font("Arial", Font.PLAIN, 10); | |
| private String name = "null"; | |
| private static final int[] IMPLINGS = {6062, 6064, 7903, 7906}; | |
| private static final int[] OBJECTS = {25016, 25017, 25018, 25019, 25020, 25021, 25022, 25023, 25024, 25025, 25026, 25027}; | |
| @Override | |
| public int loop() { | |
| return Random.nextInt(200, 300); | |
| } | |
| private void drawChar(final Graphics2D g) { | |
| final Player myChar = Players.getLocal(); | |
| if (myChar != null) { | |
| Tile charLocation = myChar.getLocation(); | |
| Point p = Calculations.worldToMap(charLocation.getX(), charLocation.getY()); | |
| if (Calculations.isOnScreen(p)) { | |
| g.setColor(Color.blue); | |
| g.fillOval(p.x - 2, p.y - 2, 4, 4); | |
| } | |
| } | |
| } | |
| private void drawToMap(final Graphics2D g, final Tile tile, final Color col) { | |
| Point p = Calculations.worldToMap(tile.getX(), tile.getY()); | |
| if (Calculations.isOnScreen(p)) { | |
| g.setColor(col); | |
| g.fillOval(p.x - 2, p.y - 2, 4, 4); | |
| } | |
| } | |
| public void drawTile(final Graphics2D g, final Tile tile, final Color col) { | |
| top: | |
| for (Polygon poly : tile.getBounds()) { | |
| for (int i = 0; i < poly.npoints; i++) | |
| if (!Calculations.isOnScreen(new Point(poly.xpoints[i], poly.ypoints[i]))) | |
| continue top; | |
| g.setColor(new Color(col.getRed(), col.getGreen(), col.getBlue(), 80)); | |
| g.fillPolygon(poly); | |
| g.setColor(col); | |
| g.drawPolygon(poly); | |
| } | |
| } | |
| @Override | |
| public void onRepaint(final Graphics render) { | |
| Graphics2D g = (Graphics2D) render; | |
| SceneObject[] objects = SceneEntities.getLoaded(OBJECTS); | |
| NPC[] npcs = NPCs.getLoaded(IMPLINGS); | |
| drawChar(g); | |
| for (SceneObject o : objects) { | |
| drawToMap(g, o.getLocation(), Color.YELLOW); | |
| } | |
| for (NPC n : npcs) { | |
| drawToMap(g, n.getLocation(), Color.RED); | |
| name = n.getName(); | |
| drawTile(g, n.getLocation(), Color.GREEN); | |
| } | |
| g.setColor(color1); | |
| g.fillRoundRect(383, 265, 125, 60, 20, 20); | |
| g.setColor(color2); | |
| g.setStroke(stroke1); | |
| g.drawRoundRect(383, 265, 125, 60, 20, 20); | |
| g.setFont(font2); | |
| if (name.equals("null")) { | |
| g.setColor(Color.red); | |
| g.drawString(" Searching...", 392, 300); | |
| g.setFont(font3); | |
| g.drawString(" For a impling ;)", 392, 320); | |
| } else { | |
| g.setFont(font2); | |
| g.setColor(Color.green); | |
| g.drawString(" Impling Found: ", 385, 290); | |
| g.drawString(" " + name, 385, 310); | |
| name = "null"; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment