Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 3rd, 2012  |  syntax: None  |  size: 8.79 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import java.awt.*;
  2. import javax.imageio.ImageIO;
  3. import java.io.IOException;
  4. import java.net.URL;
  5. import java.awt.Color;
  6. import java.awt.Graphics;
  7. import java.awt.Image;
  8. import java.awt.Point;
  9.  
  10. import org.rsbot.event.listeners.PaintListener;
  11. import org.rsbot.script.ScriptManifest;
  12. import org.rsbot.script.Script;
  13. import org.rsbot.script.methods.Game;
  14. import org.rsbot.script.methods.Skills;
  15. import org.rsbot.script.util.Timer;
  16. import org.rsbot.script.wrappers.RSGroundItem;
  17. import org.rsbot.script.wrappers.RSItem;
  18. import org.rsbot.script.wrappers.RSNPC;
  19. import org.rsbot.script.wrappers.RSObject;
  20.  
  21. @ScriptManifest(authors = { "Zachsta69" }, keywords = { "ankou, kill" }, name = "AnkouSlayerPro", version = 1.0, description = "kills Ankou and Picks up Good Drops!")
  22. public class AnkouPro extends Script implements PaintListener{
  23.        
  24.         //consumables
  25.         private int[] sumpots = {12140, 12142, 12144, 12146};
  26.         private int[] food = {385, 7946, 379, 373, 361};
  27.         //familiars
  28.         private int bunyip = 12029, pouchCost = 10;
  29.         //npcs
  30.         private int[] ankou = {4383, 4386};
  31.         //drops
  32.         private int[] drops = {448, 7937, 560, 563, 890, 5295, 565, 12158, 12159, 12160, 12163};
  33.         //paint
  34.         private int startStrengthExp;
  35.         private int gainedStrengthExp;
  36.         private int startAttackExp;
  37.         private int gainedAttackExp;
  38.         private int startDefenseExp;
  39.         private int gainedDefenseExp;
  40.         private int startHpExp;
  41.         private int gainedHpExp;
  42.         long startTime;
  43.         Timer runTime;
  44.        
  45.         public boolean onStart(){
  46.                 log(Color.CYAN, "Welcome to AnkouPro");
  47.                 startStrengthExp = skills.getCurrentExp(Skills.STRENGTH);
  48.                 startAttackExp = skills.getCurrentExp(Skills.ATTACK);
  49.                 startDefenseExp = skills.getCurrentExp(Skills.DEFENSE);
  50.                 startHpExp = skills.getCurrentExp(Skills.CONSTITUTION);        
  51.                 startTime = (int) System.currentTimeMillis();
  52.         runTime = new Timer (0);
  53.                 return true;
  54.     }
  55.  
  56.     public int loop(){
  57.         mouse.setSpeed(random(4, 7));
  58.         if(inventory.contains(bunyip)){                
  59.         }else{
  60.                 stopScript(true);
  61.         }
  62.                
  63.         if (!summoning.isFamiliarSummoned() && skills.getCurrentLevel(Skills.SUMMONING) >= 10) {
  64.                 if (inventory.contains(12029)) {
  65.                 inventory.getItem(12029).doAction("Summon");
  66.                 sleep(random(3000, 3500));
  67.     }
  68.         antiban2();
  69.         } else if (!summoning.isFamiliarSummoned() && inventory.containsOneOf(sumpots) && inventory.containsOneOf(12029)
  70.                 && skills.getCurrentLevel(Skills.SUMMONING) <= 10) {
  71.                 inventory.getItem(sumpots).doAction("Drink");
  72.                 sleep(random(1000, 1500));
  73.     }
  74.        
  75.         if (combat.getLifePoints() <= 350) {
  76.                 inventory.getItem(food).doAction("Eat");
  77.                 sleep(800, 1000);
  78.                 antiban2();
  79.         }else{                                 
  80.                 if(getMyPlayer().isValid()){   
  81.                         attack();              
  82.                         pickup();                      
  83.                         antiban1();
  84.                 }
  85.         }              
  86.                 return random(500, 700);
  87. }
  88.    
  89.     public void attack() {     
  90.         if(getMyPlayer().isInCombat()){
  91.                 sleep(500);
  92.         }else{
  93.        
  94.         RSNPC npc = npcs.getNearest(ankou);      
  95.         if (npc != null && !npc.isInCombat() && npc.getHPPercent() > 0) {
  96.                    npc.doAction("Attack");
  97.                    sleep(800, 1200);
  98.                }
  99.        }
  100.  }
  101.    
  102.     public void pickup() {
  103.    
  104.         RSGroundItem drop = groundItems.getNearest(drops);     
  105.     if(drop != null){
  106.                 if(drop.isOnScreen()){                
  107.             drop.interact("Take");
  108.                     sleep(900);                                    
  109.             }
  110.                 }
  111.         }
  112.  
  113.     public void antiban1() {
  114.              
  115.                 int b = random(0, 5);
  116.                      switch (b) {
  117.                      case 1:
  118.                          if (random(0, 5) == 1) {
  119.                                  mouse.moveSlightly();
  120.                              sleep(200, 600);
  121.                              mouse.moveRandomly(158, 506);
  122.                          }
  123.                          break;
  124.                      case 2:
  125.                          if (random(0, 5) == 2) {
  126.                                  camera.setAngle(random(35, 97));
  127.                              sleep(400, 1200);                                     
  128.                          }            
  129.                          break;
  130.                      case 3:
  131.                          if (random(0, 5) == 3) {                        
  132.                                  mouse.moveOffScreen();
  133.                              sleep(random(600, random(1200, 2000)));
  134.                          }
  135.                          break;
  136.                      case 4:
  137.                          if (random(0, 5) == 4) {
  138.                                  camera.setAngle(random(20, 360));
  139.                              sleep(400, 1200);                
  140.                            
  141.                          }            
  142.                          break;
  143.                      case 5:
  144.                          if (random(0, 5) == 5) {
  145.                                  mouse.moveSlightly();
  146.                              sleep(200, 600);
  147.                              mouse.moveRandomly(20, 420);
  148.                          }
  149.                          break;
  150.                          default:
  151.                                  break;
  152.                      }
  153.     }  
  154.                 public void antiban2(){    
  155.                         int b = random(0, 6);
  156.                         switch (b) {
  157.                      case 1:
  158.                          if (random(0,6) == 1){
  159.                                  game.openTab(Game.TAB_STATS);
  160.                                                 skills.doHover(Skills.ATTACK);
  161.                                                 sleep(1000, 1400);
  162.                                                 game.openTab(Game.TAB_INVENTORY);
  163.  
  164.                          }
  165.                          break;
  166.                      case 2:
  167.                          if (random(0,6) == 2){
  168.                                  game.openTab(Game.TAB_STATS);
  169.                                                 skills.doHover(Skills.STRENGTH);
  170.                                                 sleep(1000, 1400);
  171.                                                 game.openTab(Game.TAB_INVENTORY);
  172.  
  173.                          }
  174.                          break;
  175.                      case 3:
  176.                          if (random(0,6) == 3){
  177.                                  game.openTab(Game.TAB_STATS);
  178.                                                 skills.doHover(Skills.DEFENSE);
  179.                                                 sleep(1000, 1400);
  180.                                                 game.openTab(Game.TAB_INVENTORY);
  181.  
  182.                          }
  183.                          break;
  184.                      case 4:
  185.                          if (random(0,6) == 4){
  186.                                  game.openTab(Game.TAB_STATS);
  187.                                                 skills.doHover(Skills.CONSTITUTION);
  188.                                                 sleep(1000, 1400);
  189.                                                 game.openTab(Game.TAB_INVENTORY);
  190.  
  191.                          }
  192.                          break;
  193.                      case 5:
  194.                          if (random(0,6) == 5){
  195.                                  game.openTab(Game.TAB_STATS);
  196.                                                 skills.doHover(Skills.RANGE);
  197.                                                 sleep(1000, 1400);
  198.                                                 game.openTab(Game.TAB_INVENTORY);
  199.  
  200.                          }
  201.                          break;
  202.                      case 6:
  203.                                  if (random(0,6) == 6){
  204.                                          game.openTab(Game.TAB_STATS);
  205.                                                         skills.doHover(Skills.MAGIC);
  206.                                                         sleep(1000, 1400);
  207.                                                         game.openTab(Game.TAB_INVENTORY);
  208.  
  209.                                  }
  210.                              break;
  211.                    default:
  212.                          break;
  213.              }
  214.        
  215.     }
  216.    
  217.     public void onFinish(){
  218.                 log(Color.CYAN, "Thanks for Using AnkouSlayerPro");
  219.     }
  220.    
  221.    
  222.     private Image getImage(String url) {
  223.         try {
  224.             return ImageIO.read(new URL(url));
  225.         } catch(IOException e) {
  226.             return null;
  227.         }
  228.     }
  229.  
  230.     private final Color color1 = new Color(0, 153, 153);
  231.     private final Color color2 = new Color(255, 255, 255);
  232.     private final Color color3 = new Color(0, 0, 0);
  233.  
  234.     private final Font font1 = new Font("Brush Script MT", 0, 32);
  235.     private final Font font2 = new Font("Arial", 1, 16);
  236.     private final Font font3 = new Font("Arial", 1, 14);
  237.     private final Font font4 = new Font("Brush Script MT", 1, 16);
  238.  
  239.     private final Image img1 = getImage("http://runescapers132.com/images/monsters/ankou.gif");
  240.     private final Image img2 = getImage("http://shiningpaladins.com/images/skillcape/strength_cape.gif");
  241.     private final Image img3 = getImage("http://shiningpaladins.com/images/skillcape/attack_cape.gif");
  242.     private final Image img4 = getImage("http://shiningpaladins.com/images/skillcape/defence_cape.gif");
  243.  
  244.     public void onRepaint(Graphics g1) {
  245.         Graphics2D g = (Graphics2D)g1;
  246.         gainedAttackExp = skills.getCurrentExp(Skills.ATTACK) - startAttackExp;
  247.         gainedDefenseExp = skills.getCurrentExp(Skills.DEFENSE) - startDefenseExp;
  248.         gainedStrengthExp = skills.getCurrentExp(Skills.STRENGTH) - startStrengthExp;
  249.         gainedHpExp = skills.getCurrentExp(Skills.CONSTITUTION) - startHpExp;
  250.         g.setColor(color1);
  251.         g.fillRect(7, 345, 506, 128);
  252.         g.setFont(font1);
  253.         g.setColor(color2);
  254.         g.drawString("Ankou Slayer Pro", 150, 29);
  255.         g.setFont(font2);
  256.         g.setColor(color3);
  257.         g.drawString("Time Running:" + runTime.toElapsedString(), 12, 371);
  258.         g.drawString("Attack EXP Gained:" + gainedAttackExp, 11, 395);
  259.         g.drawString("Strength EXP Gained:" + gainedStrengthExp, 10, 418);
  260.         g.drawString("Defense EXP Gained:" + gainedDefenseExp, 10, 441);
  261.         g.drawString("HP EXP Gained:" + gainedHpExp, 10, 464);
  262.         g.drawImage(img1, 454, 319, null);
  263.         g.drawImage(img2, 345, 355, null);
  264.         g.drawImage(img3, 288, 355, null);
  265.         g.drawImage(img4, 233, 355, null);
  266.         g.setFont(font3);
  267.         g.setColor(color2);
  268.         g.drawString("Script and Paint By:", 241, 467);
  269.         g.setFont(font4);
  270.         g.drawString("Zachsta69", 385, 465);
  271.  
  272.         g.drawLine(mouse.getLocation().x - 6, mouse.getLocation().y,
  273.                         mouse.getLocation().x + 6, mouse.getLocation().y);
  274.                         g.drawLine(mouse.getLocation
  275.  
  276.                         ().x, mouse.getLocation().y - 6,
  277.                                                        
  278.  
  279.                         mouse.getLocation().x, mouse.getLocation().y + 6);
  280.     }
  281.  
  282. }