Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import org.rsbot.script.Script;
  2. import org.rsbot.script.ScriptManifest;
  3. import org.rsbot.script.wrappers.RSArea;
  4. import org.rsbot.script.wrappers.RSGroundItem;
  5. import org.rsbot.script.wrappers.RSNPC;
  6. import org.rsbot.script.wrappers.RSObject;
  7. import org.rsbot.script.wrappers.RSTile;
  8. import org.rsbot.script.wrappers.RSTilePath;
  9.  
  10. @ScriptManifest(authors = { "Brad23" },
  11.         keywords = "Combat, Money Making, Unicorns, Brad23, TROLOLOL",
  12.         name = "DeadUnicorns by Brad23",
  13.         version = 1.0,
  14.         description = "Kills unicorns at Edgeville and banks the horns.")
  15.        
  16. public class DeadUnicorns extends Script{
  17.    
  18.     ///ID's///
  19.     private final int hornID = 237;
  20.  
  21.     ///Paths///
  22.     private final RSTile[] tilesToUnicorn1 = { new RSTile(3091, 3454), new RSTile(3087, 3460), new RSTile(3085, 3464), new RSTile(3080, 3467), new RSTile(3079, 3474), new RSTile(3080, 3483), new RSTile(3084, 3489), new RSTile(3092, 3491) };
  23.     private RSTilePath pathToUnicorn1;
  24.    
  25.     private final RSTile[] tilesToUnicorn2 = { new RSTile(3091, 3455), new RSTile(3087, 3461), new RSTile(3083, 3465), new RSTile(3080, 3467), new RSTile(3079, 3472), new RSTile(3080, 3479), new RSTile(3081, 3484), new RSTile(3084, 3485), new RSTile(3087, 3491), new RSTile(3092, 3490) };
  26.     private RSTilePath pathToUnicorn2;
  27.    
  28.     private final RSTile[] tilesToUnicorn3 = { new RSTile(3089, 3458), new RSTile(3087, 3462), new RSTile(3085, 3465), new RSTile(3082, 3466), new RSTile(3080, 3470), new RSTile(3080, 3478), new RSTile(3081, 3485), new RSTile(3085, 3489), new RSTile(3089, 3490) };
  29.     private RSTilePath pathToUnicorn3;
  30.    
  31.     ///Other///
  32.    
  33.     private RSArea UnicornArea = new RSArea(new RSTile(3099,3462), new RSTile(3081,3449));
  34.    
  35.     public boolean onStart() {
  36.         pathToUnicorn1 = walking.newTilePath(tilesToUnicorn1);
  37.         pathToUnicorn2 = walking.newTilePath(tilesToUnicorn2);
  38.         pathToUnicorn3 = walking.newTilePath(tilesToUnicorn3);
  39.           log ("DeadUnicorns Initializing!");
  40.      log ("DeadUnicorns Initialized!");
  41. log.warning ("Happy Botting, Cheater.");
  42.         return true;
  43.     }
  44.  
  45.    
  46.     @Override
  47.     public int loop() {
  48.         if (!inventory.isFull() & !UnicornArea.contains(getMyPlayer().getLocation())  
  49.                 & !getMyPlayer().isInCombat()) {
  50.             choosePathToUnicorn();
  51.         }
  52.        
  53.         if (inventory.isFull() & UnicornArea.contains(getMyPlayer().getLocation())){
  54.             choosePathToBank();
  55.         }
  56.        
  57.         if (inventory.isFull() & checkBank()){
  58.             useBank();
  59.             antiban();
  60.         }
  61.        
  62.         if (!inventory.isFull() & UnicornArea.contains(getMyPlayer().getLocation())){
  63.             attackUnicorns();
  64.             itempickup(hornID,"Unicorn horn");
  65.             antiban();
  66.         }
  67.         return random(876, 2300);
  68.     }
  69.    
  70.    
  71.     public void onFinish() {
  72.         log ("DeadUnicorns is de-activating!");
  73.      log ("DeadUnicorns is de-activated");
  74.    log ("DeadUnicorns is stopping");
  75.        
  76.     }
  77.    
  78.     public void attackUnicorns(){
  79.         if (getMyPlayer().getInteracting() == null) {
  80.             RSNPC Unicorn = npcs.getNearest("Unicorn");
  81.                if (Unicorn != null && !Unicorn.isInCombat() && Unicorn.getHPPercent() > 0) {
  82.                    Unicorn.doAction("Attack");
  83.                }
  84.         }
  85.     }
  86.        
  87.     public boolean checkBank(){
  88.         RSObject bank = objects.getNearest("bank");
  89.         if(bank != null)
  90.         if(bank.isOnScreen()){
  91.             return true;
  92.         }
  93.         return false;
  94.     }
  95.    
  96.         private void useBank(){
  97.             if (bank.isOpen()){
  98.                 if (bank.isOpen()){
  99.                     bank.deposit(hornID, 0);
  100.                     sleep(800, 1200);
  101.                 }else{
  102.                     bank.open();
  103.                     sleep(1800,2200);
  104.                 }    
  105.         }
  106.     }
  107.    
  108.         public void itempickup (int itemID, String itemText) {
  109.             while (groundItems.getNearest(itemID) != null & !inventory.isFull()) {  
  110.                     RSGroundItem item = groundItems.getNearest(itemID);
  111.                     if (calc.tileOnScreen(item.getLocation())) {
  112.                         item.doAction("Take " + itemText);
  113.                     } else if (!calc.tileOnScreen(item.getLocation())) {
  114.                         walking.walkTileMM(groundItems.getNearest(itemID).getLocation());
  115.                     } else {
  116.                         sleep(500, 1000);
  117.                     }
  118.                     sleep (800, 1200);
  119.             }
  120.         }
  121.  
  122.         public void antiban() {
  123.             int t = random(0, 100);
  124.             switch (t) {
  125.             case 1:
  126.                 if (random(0, 10) == 5) {
  127.                     mouse.moveSlightly();
  128.                 }
  129.                 break;
  130.             case 2:
  131.                 if (random(0, 25) == 5) {
  132.                     camera.setPitch(random(1, 100));
  133.                    
  134.                 }
  135.                 break;
  136.             case 3:
  137.                 if (random(0, 30) == 5) {
  138.                     game.openTab(random(0, 15));
  139.                     mouse.move(random(550, 735), random(210, 465));
  140.                     sleep(random(1000, 2000));
  141.                 }
  142.                 break;
  143.             case 4:
  144.                 if (random(0, 30) == 5) {
  145.                     game.openTab(random(0, 15));
  146.                     sleep(random(500, random(1000, 2000)));
  147.                 }
  148.                 break;
  149.             case 5:
  150.                 if (random(0, 40) == 5) {
  151.                     game.openTab(8);
  152.                     interfaces.getComponent(891, 10).doHover();
  153.                     sleep(random(1000, 2000));
  154.                 }
  155.                 break;
  156.             case 6:
  157.                 if (random(0, 70) == 5) {
  158.                     mouse.moveOffScreen();            
  159.                 }
  160.                 break;
  161.             case 7:
  162.                 if (random(0, 25) == 5) {
  163.                     camera.setAngle(random(1, 360));
  164.                    
  165.                 }
  166.                 break;
  167.             default:
  168.                 break;
  169.             }
  170.         }
  171.        
  172.         public boolean choosePathToUnicorn() {
  173.             int Path= random(0,3);
  174.                   switch (Path){      
  175.                     case 0:
  176.                        
  177.                         break;
  178.                     case 1:
  179.                         pathToUnicorn1.traverse();
  180.                         break;
  181.                     case 2:
  182.                         pathToUnicorn2.traverse();
  183.                         break;
  184.                     case 3:
  185.                         pathToUnicorn3.traverse();
  186.                         break;        
  187.                   }
  188.                 return true;
  189.                
  190.             }
  191.            
  192.         public boolean choosePathToBank() {
  193.     int Path= random(0,5);
  194.           switch (Path){      
  195.             case 0:
  196.                
  197.                 break;
  198.             case 1:
  199.                 pathToUnicorn1.reverse();
  200.                 pathToUnicorn1.traverse();
  201.                 pathToUnicorn1.reverse();
  202.                 break;
  203.             case 2:
  204.                 pathToUnicorn2.reverse();
  205.                 pathToUnicorn2.traverse();
  206.                 pathToUnicorn2.reverse();
  207.                 break;
  208.             case 3:
  209.                 pathToUnicorn3.reverse();
  210.                 pathToUnicorn3.traverse();
  211.                 pathToUnicorn3.reverse();
  212.                 break;
  213.  
  214.           }
  215.         return true;
  216.        
  217.     }
  218.    
  219. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement