Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 18th, 2010 | Syntax: Java | Size: 9.91 KB | Hits: 38 | Expires: Never
Copy text to clipboard
  1. import bergCoder.BergUtils;
  2. import impsoft.bots.ColorBot;
  3. import impsoft.bots.reflection.NPC;
  4. //import impsoft.bots.reflection.WorldObject;
  5. import impsoft.scripting.ibot.enums.Skill;
  6. import impsoft.scripting.ibot.interfaces.AutoPaint;
  7. import impsoft.scripting.ibot.interfaces.ChatListener;
  8. import impsoft.scripting.ibot.structs.AryanTile;
  9. import impsoft.scripting.ibot.structs.AryanTileZone;
  10. import impsoft.scripting.ibot.structs.XY;
  11. import impsoft.scripting.types.ColorScript;
  12. import impsoft.utils.general.Timer;
  13. //import impsoft.utils.uber.UberClickOptions;
  14. //import impsoft.utils.uber.UberNPCOptions;
  15. //import impsoft.utils.uber.UberScriptUtils;
  16.  
  17. import java.awt.Graphics;
  18. //import java.awt.Polygon;
  19. //import java.util.EnumSet;
  20. //import java.util.regex.Pattern;
  21.  
  22. public class CatherbyLobs extends ColorScript implements AutoPaint, ChatListener {
  23.             public CatherbyLobs(ColorBot c){
  24.                 super(c);
  25.   }
  26.       BergUtils util = new BergUtils(this);
  27.       public static String name = "CatherbyLobs";
  28.       public static String author = "Monopoly";
  29.       public static String description = "catches lobsters in catherby";
  30.       public static double version = 0.1;
  31.       private Timer timeran = new Timer(0);
  32.       public String status="";
  33.      
  34.                 int startExp;
  35.                 int startLvl;
  36.                 int currentExp;
  37.                 int currentLvl;
  38.                 int expGain = 0;
  39.                 int fishCaught = 0;
  40.                 int lvlGain = 0;
  41.                 int lobCage = 301;
  42.                 int bankTrips = 0;
  43.                
  44.                 public  int botState = 1;
  45.                 public static final int Banking = 1;
  46.                 public static final int Fish = 2;
  47.                 public static final int logOut = 3;
  48.                 public static final int goToStore = 4;//this is right?
  49.                
  50.                
  51.                  
  52.                
  53.                         String Status;
  54.       //catherby                       
  55.      AryanTileZone catherbyBank = new AryanTileZone (new AryanTile(2811, 3439), (new AryanTile(2807, 3441)));
  56.      AryanTileZone fishSpot = new AryanTileZone (new AryanTile(1111, 2222), (new AryanTile(1111, 2223)));//will get actual tiles later when ibot works again
  57.      AryanTileZone harryFishStore = new AryanTileZone (new AryanTile(1234, 1234), new AryanTile(1235, 1234));//will get actual tiles later
  58.      AryanTile lobster1 = new AryanTile(2836, 3432);
  59.      AryanTile lobster2 = new AryanTile(2837, 3432);
  60.      AryanTile lobster3 = new AryanTile(2855, 3424);
  61.      AryanTile lobster4 = new AryanTile(2859, 3427);
  62.      public int [] fishIds = {312,321,324,333,405,1332,1399,3804}; //suckmyscim
  63.      public String [] fishNames = {"lobster"};
  64.      /*
  65.       * AryanTiles// 1 min continue on wait :o
  66.       */
  67.      public void script() throws InterruptedException, Exception {
  68.         log("script initialization");
  69.         randomEventsLobster();
  70.         checkBotState();
  71.         antiBan.start();
  72.        
  73.         while (true){
  74.        switch(botState){
  75.         case 1:
  76.            banking1();
  77.        break;
  78.         case 2:
  79.            fishing();
  80.        break;
  81.         case 3:
  82.  
  83.        }
  84.        
  85.        }
  86.  
  87.      }
  88.      
  89.      {
  90.      }
  91.      public void checkBotState() throws InterruptedException {
  92.          if(theTabs.Inventory.isFull()) {
  93.                  botState = Banking;
  94.          }
  95.          if (theTabs.Inventory.count("Lobster pot") != 1 ) {
  96.              log("need lobster pot/you have too many, you can only have one lobster pot");
  97.                
  98.             botState = Banking;//o yea i
  99. }
  100.          if (theTabs.Inventory.count("Lobster pot") == 1 ) {
  101.                  log("starting script brah :)");
  102.                  theCamera.setPitchUp();
  103.                  theParallelCompass.setYawRandom();
  104.                  util.setFastRun(true);
  105.                  
  106.                         botState = Fish;
  107.          }
  108.          if (theTabs.Inventory.isFull()) {
  109.                  botState = Banking;
  110.          }
  111.          if (!theTabs.Inventory.isFull()) fishSpot.isInZone(getLocation()); {
  112.          botState = Fish;
  113.          }
  114.                  
  115.          }
  116.  
  117.      public void randomEventsLobster() throws InterruptedException {
  118.          startAllRandoms(); {
  119.           stopRandom("PublicChatOff");
  120.           stopRandom("NotMoving");
  121.           stopRandom("NPCChatClickHere");
  122.          }
  123.      
  124.  
  125.           while(!isLoggedIn()) sleep(random(2500, 5000));
  126.           timeran = new Timer(0);
  127.                 this.currentExp = this.theTabs.Statistics.getStatExperience(Skill.FISHING);
  128.                         this.currentLvl = this.theTabs.Statistics.getStatBottom(Skill.FISHING);
  129.                                 this.startExp = this.currentExp;
  130.                                         this.startLvl = this.currentLvl;
  131.                                                 sleep(random(20, 100));
  132.                                                                                                        
  133.      }
  134.                                        
  135.  
  136.                 public void fishing() throws InterruptedException, Exception {//credits to suckmyscim and CarbonFire
  137.             log("catchem fishes");  
  138.          /*  
  139.          /*NPC[] fishspot = UberScriptUtils.findNPC(this, fishIds, fishNames,null, null, null, null, null, getLocation(), EnumSet.of(UberNPCOptions.CAN_REACH_FROM_MYPLAYER, UberNPCOptions.RETURN_ONE_MATCH));
  140.          /*for (WorldObject wo: fishspot ) {
  141.          /*UberScriptUtils.clickWorldObject(this, wo, Pattern.compile("Cage fishing spot"), Pattern.compile("Cage"),EnumSet.of(UberClickOptions.USE_MENU, UberClickOptions.CHECK_TOP_TEXT));
  142.          /*  //suckmyscim
  143.          /* }
  144.          
  145.           */
  146.           //
  147.             NPC fishspot = util.getNPCByName(new String [] {"Harpoon", "Cage"}, getLocation());
  148.             AryanTile fishtile = fishspot.getBestAccessibleTile(null);
  149.             theWorldMap.walkTo(fishtile);
  150.             XY fish = fishspot.getRecommendPointToClick();
  151.             mouseMove(fish);
  152.             if (random(1,5)==2){
  153.                 mouseClickRight(fish);
  154.             }
  155.                 else  {
  156.                         mouseClickLeft(fish);
  157.                         theMenuFinder.doMenu("Cage");
  158.                        
  159.                 }
  160.            
  161.          
  162.             while (!theTabs.Inventory.isFull()) {
  163.                   if (getAnimation() != -1) {
  164.                                 log("Fishing");
  165.                                 sleep(random(50, 275));
  166.                                
  167.                        
  168.                         }
  169.                         if (getAnimation() == -1 && fishspot == null){
  170.                                 botState = Fish;
  171.                         } else {
  172.                                 botState = Fish;
  173.                         }
  174.             }
  175.        
  176.                 if (theTabs.Inventory.isFull()){
  177.                         botState = Banking;
  178.                         log("banking");
  179.  
  180.                            
  181. }
  182.                 botState = Banking;
  183. }
  184.  
  185.                 public void banking1() throws InterruptedException {
  186.                        
  187.                
  188.                 log("finished up a trip");
  189.                 theWorldMap.walkToBank();
  190.                                                                                                                                                 bankTrips++;
  191.                         log("deposisting items");
  192.                                         if(!theBank.isInterfaceIsUp())
  193.                                         {
  194.                                                         theBank.open();                                                
  195.                                                                 theBank.waitTillInterfaceIsUp();                               
  196.                                                                         theBank.doDepositAllBut(new String[] { "Lobster pot" });};                                                     
  197.                                                                                 theBank.exit();
  198.                                                                                
  199.                                         if (theTabs.Inventory.count("Lobster pot") == 1 ) {
  200.                                                 theBank.open();
  201.                                                 theBank.doDepositAll();
  202.                                                 theBank.doWithDraw1("Lobster pot", false);
  203.                                                
  204.                                         }else{
  205.                                         if(theBank.countStackOf("Lobster pot") <1 ) {
  206.                                                 theBank.doWithDrawX("Coins", 20);
  207.                                                
  208.                                         }
  209.                                                        
  210.                                         }                
  211.                                          }
  212.  
  213.          
  214.          public void chat(String chat){
  215.                  
  216.                  if (chat.startsWith("You catch a")) { 
  217.                          fishCaught++;
  218.                          
  219.                  }               
  220.          }
  221.          
  222.  
  223.                
  224.                
  225.          
  226.          
  227.          public void paint(Graphics g){
  228.                 }
  229.          
  230.          
  231.        
  232.          
  233.  
  234.  
  235.                        
  236.                
  237. Thread antiBan = new Thread() {//not started yet, planning on having the mouse speed antiban here instead of on the top k
  238.          public void run() {
  239.  
  240.         log("Activating antiban");
  241.  
  242.             Timer antibanT = new Timer(random(20000, 150000));
  243.             setName("MonopolyAntiBan");
  244.             setPriority(MAX_PRIORITY);
  245.             while(true) {
  246.                 try {
  247.            
  248.                         sleep(random(200, 1050));
  249.                         if(antibanT.isUp()) {
  250.                         int randominteger = random(1, 4);
  251.                                 switch(randominteger) {
  252.                                     case 1:
  253.                                        tabSwitch();
  254.                                        break;
  255.                                     case 2:
  256.                                        mouseSpeedAdjustment();
  257.                                        break;
  258.                                     case 3:
  259.                                         cameraAngleSwitch();
  260.                                        break;
  261.                                     case 4:
  262.                                         idleAntiBan();
  263.                                         break;
  264.  
  265.                                 }
  266.                                         antibanT.reset();
  267.                         }
  268.                         sleep(random(300, 1000));
  269.                 } catch (InterruptedException e) {
  270.                     info("Thread Stopped");
  271.                    break;
  272.                 }
  273.             }
  274.         }
  275.          };
  276.          
  277.  public void tabSwitch() throws InterruptedException {
  278.            int  randominteger = random(1, 6);
  279.                 switch(randominteger) {
  280.                 case 1:
  281.                         log("Switching to Friends tab.");
  282.                         util.setTab("Friends");
  283.                         break;
  284.                 case 2:
  285.                         log("Switching to Statistics tab.");
  286.                         util.setTab("Statistics");
  287.                         break;
  288.                 case 3:
  289.                         log("Switching to Inventory tab.");
  290.                         util.setTab("Inventory");
  291.                         break;
  292.                 case 4:
  293.                         log("Switching to Emotes tab");
  294.                         util.setTab("Emotes");
  295.                 case 5:
  296.                         log("Switching to Clan Chat tab");
  297.                         util.setTab("Clan Chat");
  298.                 case 6:
  299.                         idleAntiBan();
  300.                        
  301.                 }
  302.         }
  303.  
  304.  
  305.  public void mouseSpeedAdjustment() throws InterruptedException {
  306.      util.mouseSpeedSwitcherAntiban();
  307.  }
  308. public void cameraAngleSwitch() throws InterruptedException {
  309.            int  randominteger = random(1, 2);
  310.                 switch(randominteger) {
  311.                 case 1:
  312.                         log("Rotating compass randomly");
  313.                         theCamera.setYawRandom();
  314.                 case 2:
  315.                         idleAntiBan();
  316.                 }
  317. }
  318. public void idleAntiBan() throws InterruptedException {
  319.         log("Idle");
  320.         sleep(random(200,800));
  321. }
  322. }