Advertisement
Guest User

Pest control topbot

a guest
May 30th, 2015
466
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.69 KB | None | 0 0
  1. package Pestcontroller;
  2.  
  3.  
  4.  
  5. import java.awt.*;
  6.  
  7. import org.tbot.graphics.MouseTrail;
  8. import org.tbot.internal.AbstractScript;
  9. import org.tbot.internal.Manifest;
  10. import org.tbot.internal.ScriptCategory;
  11. import org.tbot.internal.event.listeners.PaintListener;
  12. import org.tbot.internal.handlers.LogHandler;
  13. import org.tbot.methods.Camera;
  14. import org.tbot.methods.GameObjects;
  15. import org.tbot.methods.GroundItems;
  16. import org.tbot.methods.NPCChat;
  17. import org.tbot.methods.Npcs;
  18. import org.tbot.methods.Players;
  19. import org.tbot.methods.Random;
  20. import org.tbot.methods.Time;
  21. import org.tbot.methods.Widgets;
  22. import org.tbot.methods.walking.Path;
  23. import org.tbot.methods.walking.Walking;
  24. import org.tbot.util.Condition;
  25. import org.tbot.wrappers.GameObject;
  26. import org.tbot.wrappers.NPC;
  27. import org.tbot.wrappers.GroundItem;
  28. import org.tbot.wrappers.Area;
  29. import org.tbot.wrappers.Player;
  30. import org.tbot.wrappers.Tile;
  31.  
  32.           @Manifest(name = "Free medium boat Pestcontrol", authors = "Trester/Rivaldo", description = "Plays the pest control minigame on the medium boat", version = 1.0, category = ScriptCategory.MINIGAMES)
  33.           public class Pestcontrol extends AbstractScript implements PaintListener{
  34.               Timer t = new Timer();
  35.               String Status = " ";
  36.                int[] npcIds = {1727, 1690, 1716, 1705, 1689, 1691, 1706, 1715, 1726, 1736, 1749, 1735, 1709, 1752, 1710, 1711, 1750};
  37.                Area BOAT_AREA = new Area(2638, 2647,2641,2642);
  38.                Tile LANDING_AREA = new Tile(2644, 2644);
  39.                static final Area ISLAND_AREA = new Area(11093, 2215, 11116, 2230);
  40.                private final MouseTrail mt = new MouseTrail();
  41.                public Image cursor;
  42.                int gamesPlayed;
  43.                boolean fighting = false;
  44.                String pointies;
  45.                
  46.                
  47.                
  48.         public boolean onStart() {
  49.             LogHandler.log("I punched a racoon today.");
  50.             return true;
  51.         }
  52.  
  53.  
  54.         public int loop() {
  55.        
  56.             NPC noob = Npcs.getNearest("Shifter");
  57.             GameObject gangplank = GameObjects.getNearest("Gangplank");
  58.             Player p = Players.getLocal();
  59.             GameObject nullThing = GameObjects.getNearest(14282);
  60.            
  61.            
  62.              if (noob != null) {
  63.                     if (noob.isOnScreen()) {
  64.                       if (p.getAnimation() == -1 && noob.distance() < 7) {
  65.                           Status = "Fighting";
  66.                           fighting = true;
  67.                           Time.sleep(27,140);
  68.                          noob.interact("Attack");
  69.                          Time.sleep(1300, 2700);
  70.                          Time.sleepUntil(new Condition() {
  71.                                 public boolean check() {
  72.                                     return Players.getLocal().getAnimation() == -1;
  73.                                 }
  74.                             }, Random.nextInt(1800, 2400));
  75.                     }
  76.                     }else if(noob.distance() <= 7){
  77.                         Camera.turnTo(noob);
  78.                     }else{
  79.                         Path path = Walking.findLocalPath(noob.getLocation());
  80.                           if(path !=null) {
  81.                                if(path.traverse()) {
  82.                             Time.sleep(Random.nextInt(421, 1582));
  83.                                }
  84.                             }
  85.                     }
  86.                 }
  87.              
  88.              
  89.              if(noob == null || noob.distance() > 7){
  90.                  fighting = false;
  91.              }
  92.          
  93.             if (LANDING_AREA != null && p.getLocation().equals(LANDING_AREA)) {
  94.                 if (gangplank != null && p.getAnimation() == -1) {
  95.                      fighting = false;
  96.                   gangplank.interact("Cross");
  97.                   Status = "Clicking the gangplank";
  98.                   Time.sleep(300, 1700);
  99.                 }
  100.               }
  101.            
  102.             if(gangplank != null && !p.getLocation().equals(LANDING_AREA) && !this.BOAT_AREA.contains(p)){
  103.                  fighting = false;
  104.                   Path path4 = Walking.findLocalPath(LANDING_AREA);
  105.                   if(path4 !=null) {
  106.                        if(path4.traverse()) {
  107.                            LogHandler.log("Antifail activated.");
  108.                     Time.sleep(Random.nextInt(421, 1582));
  109.                        }
  110.                     }
  111.             }
  112.            
  113.             if(nullThing != null  && fighting == false){
  114.             Path path1 = Walking.findLocalPath(nullThing.getLocation());
  115.                 Status = "walking Middle";
  116.                 if(path1 !=null && nullThing.distance() > 7) {
  117.                    if(path1.traverse()) {
  118.                     Time.sleep(Random.nextInt(421, 1582));
  119.                 }
  120.             }
  121.             }
  122.            
  123.             if(noob != null && noob.getLocation().equals(Players.getLocal().getLocation())){
  124.                  Status = "Fighting";
  125.               fighting = true;
  126.                  noob.interact("Attack");
  127.                  Time.sleep(1300, 2700);
  128.                  Time.sleepUntil(new Condition() {
  129.                         public boolean check() {
  130.                             return Players.getLocal().getAnimation() == -1;
  131.                         }
  132.                     }, Random.nextInt(1800, 2400));
  133.              }
  134.            
  135.               if (BOAT_AREA != null && this.BOAT_AREA.contains(p)) {
  136.                 Status = "In boat";
  137.                 fighting = false;
  138.                 if(Widgets.getWidget(407, 14) != null && Widgets.getWidget(407, 14).isValid() && Widgets.getWidget(407, 14).isVisible()){
  139.                     pointies = Widgets.getWidget(407, 14).getText().split(": ")[1].toString();
  140.                    
  141.                 }
  142.                
  143.                 if (Random.nextInt(5423) == 7)
  144.                      Status = "Random camera movement while waiting";
  145.                   Camera.setAngle(Random.nextInt(32, 360));
  146.                 Time.sleep(300, 1700);
  147.                 Camera.setPitch(Random.nextInt(32, 98));
  148.                 Time.sleep(300, 1700);
  149.               }
  150.              
  151.             return Random.nextInt(121 , 423);
  152.         }
  153.          
  154.        
  155.  
  156.         public void onRepaint(Graphics g) {
  157.  
  158.             Graphics2D gr = (Graphics2D) g;
  159.             gr.setColor(Color.WHITE);
  160.             gr.setFont(new Font("Arial", 1, 11));
  161.            
  162.            
  163.             gr.drawString("Time Running: " + t.getFormattedTime(), 275, 315);
  164.             g.drawString("UltraStakur simonzz :D ", 275, 330);
  165.             g.drawString("Current Points: " + pointies , 275, 345);
  166.             g.drawString("Status: " + Status, 275, 360);
  167.            
  168.          
  169.             mt.draw(gr);
  170.         }
  171.  
  172.        
  173.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement