Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import impsoft.bots.ColorBot;
- import impsoft.bots.reflection.NPC;
- import impsoft.bots.reflection.NPCIterator;
- import impsoft.scripting.ibot.interfaces.AutoPaint;
- import impsoft.scripting.ibot.interfaces.PassiveScript;
- import impsoft.scripting.ibot.structs.XY;
- import impsoft.scripting.types.ColorScript;
- import java.awt.Color;
- import java.awt.Graphics;
- import java.awt.Polygon;
- import java.util.ArrayList;
- import bergCoder.BergUtils;
- public class passivePenguinHideAndSeek extends ColorScript implements AutoPaint, PassiveScript
- {
- BergUtils util = new BergUtils(this);
- /****** Identification *******/
- public static String name = "Berg's Penguin Seeker";
- public static double version = 1.02;
- public static String author = "BergCoder, Avaryan";
- public static String description = "Penguin Hide N' Seek Assistant";
- ArrayList<NPC> penguins = new ArrayList<NPC>();
- public passivePenguinHideAndSeek(ColorBot b, String command, String args[])
- {
- super(b);
- }
- public void script() throws InterruptedException
- {
- while (true)
- {
- //log("Seeking penguins"); // This log was annoying.
- penguins.clear();
- paintPenguins();
- sleep(1000);
- }
- }
- public void paintPenguins() throws InterruptedException
- {
- for (NPCIterator iterator = getNPCIterator(); iterator.hasNext();)
- {
- NPC npc = iterator.next();
- String name = npc.getName();
- if (name.equals("Crate") || name.equals("Bush") || name.equals("Barrel")
- || name.equals("Cactus") || name.equals("Rock") || name.equals("Toadstool")
- || name.equals("Pumpkin") || name.equals("Snowman"))
- {
- penguins.add(npc);
- }
- }
- }
- @SuppressWarnings({ "unchecked", "static-access" })
- public void paint(final Graphics g)
- {
- try {
- ArrayList<NPC> penguinsCopy = (ArrayList)this.penguins.clone();
- if (penguinsCopy.size() > 0) g.setColor(new Color(255, 0, 255, 255));
- else g.setColor(Color.WHITE);
- @SuppressWarnings("unused")
- int i=0;
- for (NPC npc : penguinsCopy)
- {
- Polygon p = npc.getGameScreenLocation(-10,10,-10,10,0,0);
- if (p != null)
- {
- XY point = util.getMedianXY(p);
- g.drawString("X",point.x, point.y);
- }
- XY minimap = theMiniMap.toOnScreenMiniMap(npc.getLocation());
- if(minimap !=null){
- g.setColor(new Color(255,0,255,255));
- g.drawString(npc.getName(),minimap.x,minimap.y);
- }
- //if (minimap != null) paintPoint(minimap, new Color(255, 0, 255, 255), 1000, 3);
- }
- g.drawString("Penguins: " + penguinsCopy.size(),340,48);
- } catch(Exception e) {}
- }
- }
Add Comment
Please, Sign In to add comment