Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 7.98 KB | None | 0 0
  1. import java.util.*;
  2. import java.awt.*;
  3. import org.rsbot.script.ScriptManifest;
  4. import org.rsbot.script.Script;
  5. import org.rsbot.script.methods.Game;
  6. import org.rsbot.script.methods.Bank;
  7. import org.rsbot.script.wrappers.RSObject;
  8. import org.rsbot.script.wrappers.RSTile;
  9. import org.rsbot.script.wrappers.RSArea;
  10. import org.rsbot.script.wrappers.RSNPC;
  11. import org.rsbot.script.methods.Calculations;
  12. import org.rsbot.script.methods.GroundItems;
  13. import org.rsbot.script.wrappers.RSGroundItem;
  14. import org.rsbot.script.wrappers.RSComponent;
  15. import org.rsbot.script.methods.Mouse;
  16. import org.rsbot.event.listeners.PaintListener;
  17. @ScriptManifest(authors = { "Brianpsv1" }, keywords = { "Money Making" }, name = "Anti-Dragon Shield Collector", version = 1.01, description = "A Anti-Dragon Shield Collector!")
  18. public class AntiDragonCollector extends Script implements PaintListener {
  19. public RSTile[] toNPC2 = { new RSTile(3208, 3320), new RSTile(3206, 3224), new RSTile(3206, 3229) };
  20. public RSTile[] toBank2 = { new RSTile(3208, 3323) };
  21. public RSTile[] toBank1 = { new RSTile(3206, 3224), new RSTile(3206, 3228) };
  22. public RSTile[] toNPC1 = { new RSTile(3207, 3222) };
  23. public RSTile[] goNPC = { new RSTile(3210, 3222) };
  24. public RSTile[] toDoor = { new RSTile(3206, 3222) };
  25. public RSArea NPCarea = new RSArea(new RSTile(3209, 3219), new RSTile(3212, 3225));
  26. public RSArea STAIRarea = new RSArea(new RSTile(3205, 3224), new RSTile(3207, 3228));
  27. public RSArea DoorArea = new RSArea(new RSTile(3206, 3220), new RSTile(3209, 3224));
  28. public long startTime = System.currentTimeMillis();
  29. int floor = 0;
  30. int count = 0;
  31. int duke = 741;
  32. int none = 0;
  33. int bankBooth = 36786;
  34. int notedShield = 1541;
  35. int unnotedShield = 1540;
  36. int downstairs = 36778;
  37. int upstairs = 36777;
  38. int opendoor = 36845;
  39. int closedoor = 36844;
  40. int banked = 0;
  41.  
  42.     public boolean onStart(){
  43.     log("Brian's Anti-Dragon Shield Collector");
  44.     startTime = System.currentTimeMillis();
  45.         return true;
  46.     }
  47.         public void onRepaint(Graphics g) {
  48.         long millis = System.currentTimeMillis() - startTime;
  49.         long hours = millis / (1000 * 60 * 60);
  50.         millis -= hours * (1000 * 60 * 60);
  51.         long minutes = millis / (1000 * 60);
  52.         millis -= minutes * (1000 * 60);
  53.         long seconds = millis / 1000;
  54.         long minutes2 = minutes + (hours * 60);
  55.         g.setColor(new Color(0, 0, 0, 154));
  56.         g.fillRect(378, 304, 138, 34);
  57.         g.setFont(new Font("Comic Sans MS", 0, 11));
  58.         g.setColor(new Color(255, 0, 0));
  59.         g.drawString("Time Running: "  + hours + ":" + minutes + ":" + seconds , 383, 316);
  60.         g.setColor(new Color(255, 255, 0));
  61.         g.drawRect(378, 303, 139, 34);
  62.         g.setFont(new Font("Comic Sans MS", 0, 11));
  63.         g.setColor(new Color(255, 0, 0));
  64.         g.drawString("Collected: " + banked, 384, 331);
  65.         }
  66.     public int loop(){
  67.         try {
  68.         if ( walking.getEnergy() > random(60,70)) {
  69.         walking.setRun(true);
  70.         }
  71.         floor = game.getPlane();
  72.         if(inventory.isFull()){
  73.        
  74.         } else {
  75.          if( floor == 1) {
  76.          if(count == 4) {
  77.          RSGroundItem shield1 = groundItems.getNearest(notedShield);
  78.          if (shield1 != null) {
  79.          shield1.doAction("Take");
  80.          }
  81.          if(inventory.getCount() > 0) {
  82.          count = 5;
  83.          }
  84.          return 1500;
  85.          }
  86.          if(count == 8) {
  87.          // We Collected 10 shields so we should go bank :D
  88.          // But first we pick them up.
  89.          RSGroundItem shield1 = groundItems.getNearest(notedShield);
  90.          RSGroundItem shield2 = groundItems.getNearest(unnotedShield);
  91.          if (shield1 != null) {
  92.          shield1.doAction("Take");
  93.          } else if (shield2 != null) {
  94.          shield2.doAction("Take");
  95.          }
  96.          if(shield1 == null && shield2 == null) {
  97.          // We took all dropped sheild so we should go banking.
  98.          RSObject checkDoor1 = objects.getNearest(opendoor);
  99.          RSObject checkDoor2 = objects.getNearest(closedoor);
  100.          RSObject theStairs = objects.getNearest(upstairs);
  101.          
  102.          if (checkDoor1 != null) {
  103.          if ( DoorArea.contains(checkDoor1.getLocation())) {
  104.          // Walk to Stairs
  105.          if(calc.distanceTo(theStairs) < 3) {
  106.          
  107.          try {
  108.          camera.turnToObject(theStairs);
  109.          } catch (NullPointerException e) {
  110.          }
  111.          theStairs.doAction("Climb-up");
  112.          } else {
  113.          walking.walkPathMM(toBank1, 0 ,0);
  114.          }
  115.          }
  116.          }
  117.          if ( NPCarea.contains(getMyPlayer().getLocation())) {
  118.          if (checkDoor2 != null) {
  119.          if ( DoorArea.contains(checkDoor2.getLocation())) {
  120.          try {
  121.          camera.turnToObject(checkDoor2);
  122.          } catch (NullPointerException e) {
  123.          }
  124.          checkDoor2.doAction("Open");
  125.          // OpenDoor
  126.          }
  127.          }
  128.          } else {
  129.          if(calc.distanceTo(theStairs) < 3) {
  130.          
  131.          try {
  132.          camera.turnToObject(theStairs);
  133.          } catch (NullPointerException e) {
  134.          }
  135.          theStairs.doAction("Climb-up");
  136.          } else {
  137.          walking.walkPathMM(toBank1, 0 ,0);
  138.          }
  139.          }
  140.          //
  141.          }
  142.          }
  143.          if ( NPCarea.contains(getMyPlayer().getLocation())) {
  144.          // Get Shield
  145.          if(count == 8) {
  146.          } else {
  147.          if (!interfaces.getComponent(242, 6).isValid() && !interfaces.getComponent(519, 2).isValid() && !interfaces.getComponent(64, 5).isValid() && !interfaces.getComponent(65, 6).isValid() && !interfaces.getComponent(230, 2).isValid() && !interfaces.getComponent(241, 5).isValid()) {
  148.          // Not Talking :(
  149.          
  150.          inventory.dropAllExcept(none);
  151.          RSNPC DukeHaz = npcs.getNearest(duke);
  152.          if (DukeHaz != null && DukeHaz.isOnScreen()) {            
  153.          DukeHaz.doAction("Talk-to");
  154.          } else {
  155.          camera.turnToCharacter(DukeHaz);
  156.          }
  157.          }
  158.          if (interfaces.getComponent(242, 6).isValid()){
  159.          interfaces.getComponent(242, 6).doAction("Continue");     
  160.          }
  161.           if (interfaces.getComponent(519, 2).isValid()){
  162.          interfaces.getComponent(519, 2).doAction("Continue");
  163.           count = count + 1;
  164.           banked++;
  165.           sleep(300);
  166.           inventory.dropAllExcept(none);         
  167.          }
  168.          if (interfaces.getComponent(64, 5).isValid()){
  169.          interfaces.getComponent(64, 5).doAction("Continue");      
  170.          }
  171.          if (interfaces.getComponent(65, 6).isValid()){
  172.          interfaces.getComponent(65, 6).doAction("Continue");      
  173.          }
  174.          if (interfaces.getComponent(230, 2).isValid()){
  175.          interfaces.getComponent(230, 2).doAction("Continue");     
  176.          }
  177.          if (interfaces.getComponent(241, 5).isValid()){
  178.          interfaces.getComponent(241, 5).doAction("Continue");     
  179.          }
  180.          }
  181.          } else {
  182.          if(count == 8) {
  183.          } else {
  184.          RSObject checkDoor1 = objects.getNearest(opendoor);
  185.          RSObject checkDoor2 = objects.getNearest(closedoor);
  186.          if (checkDoor1 != null) {
  187.          if ( DoorArea.contains(checkDoor1.getLocation())) {
  188.          // Walk into Area
  189.          walking.walkPathMM(goNPC, 0 ,0);
  190.          }
  191.          }
  192.          if (checkDoor2 != null) {
  193.          if ( DoorArea.contains(checkDoor2.getLocation())) {
  194.          try {
  195.          camera.turnToObject(checkDoor2);
  196.          } catch (NullPointerException e) {
  197.          }
  198.          if(calc.distanceTo(checkDoor2) < 3) {
  199.          // Open door
  200.          checkDoor2.doAction("Open");
  201.          } else {
  202.          walking.walkPathMM(toDoor, 0 ,0);
  203.          }
  204.          
  205.          }
  206.          }
  207.          }
  208.          }
  209.          }
  210.          if ( floor == 2) {
  211.          if (inventory.getCount() > 2) {
  212.          
  213.          RSObject theBank = objects.getNearest(bankBooth);
  214.          if(calc.distanceTo(theBank) < 3) {
  215.          
  216.          if (!bank.isOpen()) {
  217.          try {
  218.          camera.turnToObject(theBank);
  219.          } catch (NullPointerException e) {
  220.          }
  221.          theBank.doAction("Use-quickly");
  222.          }
  223.          if (bank.isOpen()) {
  224.          bank.depositAllExcept(none);
  225.          bank.setWithdrawModeToNote();
  226.          bank.withdraw(1540, 1000000);
  227.          bank.close();
  228.          count = 0;
  229.          }
  230.          } else {
  231.          
  232.          RSTile goTheBank = new RSTile(theBank.getLocation().getX(), theBank.getLocation().getY());
  233.          walking.walkTo(goTheBank);
  234.          }
  235.          } else {
  236.          RSObject goDown = objects.getNearest(downstairs);
  237.          if(goDown != null) {
  238.          if(calc.distanceTo(goDown) < 3) {
  239.          goDown.doAction("Climb-down");
  240.          // Climb Down
  241.          } else {
  242.          walking.walkPathMM(toNPC2, 0 ,0);
  243.          }
  244.          }
  245.          }
  246.         }
  247.         }
  248.         } catch (NullPointerException e) {
  249.        
  250.         }
  251.         return random(1400, 1500);
  252.     }
  253.    
  254.    
  255.  
  256.     private void dropAll(){
  257.  
  258.     }
  259.    
  260.  
  261.     public void onFinish(){
  262.        
  263.     }
  264. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement