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

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 11.84 KB  |  hits: 11  |  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.Color;
  2. import java.awt.Font;
  3. import java.awt.Graphics;
  4. import java.awt.image.BufferedImage;
  5. import java.io.IOException;
  6. import java.net.MalformedURLException;
  7. import java.net.URL;
  8. import java.util.Map;
  9.  
  10. import javax.imageio.ImageIO;
  11.  
  12. import org.rsbot.bot.Bot;
  13. import org.rsbot.bot.input.Mouse;
  14. import org.rsbot.event.events.ServerMessageEvent;
  15. import org.rsbot.event.listeners.PaintListener;
  16. import org.rsbot.script.Bank;
  17. import org.rsbot.script.Script;
  18. import org.rsbot.script.ScriptManifest;
  19. import org.rsbot.script.wrappers.RSNPC;
  20. import org.rsbot.script.wrappers.RSObject;
  21. import org.rsbot.script.wrappers.RSTile;
  22.  
  23. @ScriptManifest(authors = {"Icanon"}, category = "Magic",
  24.                 name = "Icanon's Wine Grabber", version = 1.0,
  25.                 description = ("<html>\n"
  26.                  + "<body style='font-family: Segoe Print; color:white; padding: 0px; text-align: center; background-color: GREEN;'>"
  27.                  + "<h2>Stoned Al Kharid Tanner</h2>"
  28.                  + "<b>by Tokeaholic</h2></b>"
  29.                  + "<br><b>If Selling, Please Sell Above MID</h2></b>"
  30.                  + "<br>Start in Al-Kharid Bank, with your Hides and Gold at the Top of the Bank."
  31.                  + "<br><b>Select the type of Staff you want to use? : "
  32.                  + "<select name=\"Staff\"><option>Air<option>Water<option>None</select>"
  33.                  + "<br><b>Select Method?"
  34.                  + "<select name=\teleporting\"><option>Faldor Tele-Tab<option>Walk<option>Fallytele</select>"
  35.                  + "<br><b>Select a Summoning Pet:</br>"
  36.          + "<select name=\"summon\"><option>None</option><option>Thorny Snail</option><option>Kalphite</option><option>Terror Bird</option><option>Tortise</option><option>Yak</option></select>"
  37.          + "<br><b>I discourage the use of familars due to the Fact that there not 100 complete good yet."
  38.          + "<br><b>Remember I am not responsible if you die, while picking you must be over level 58.</br>"+
  39.          + "<br><b>Recommended Equipment - Ring of life and Phoinex necklace."
  40.          + "<br><b>Updates are in the future."              
  41.                 + "<br><b>Have Auto-Retaliate off when starting, Also start in the hall before entering ankous.")
  42. public class IcanonsWineGrabber  extends Script implements PaintListener {
  43.  
  44.                 // Paths
  45.                 RSTile[] toWine = {
  46.                 new RSTile(2947, 3368), new RSTile(2953, 3378), new RSTile(2963, 3385),
  47.                 new RSTile(2965, 3396), new RSTile(2965, 3407), new RSTile(2957, 3416),
  48.                 new RSTile(2952, 3426), new RSTile(2950, 3437), new RSTile(2948, 3448),
  49.                 new RSTile(2946, 3459), new RSTile(2946, 3470), new RSTile(2946, 3481),
  50.                 new RSTile(2945, 3492), new RSTile(2941, 3503), new RSTile(2941, 3514),
  51.                 new RSTile(2933, 3516)};
  52.                 RSTile[] toBank = reversePath{toWine};
  53.  
  54.                 // Intigers
  55.                 int failCount = 0;
  56.                 public int startExp = 0;
  57.                 public int gainedExp = 0;
  58.                 public int avgPerHour = 0;
  59.                 public int startLevel = 0;
  60.                 public int oldExp = 0;
  61.                 public long lastAvgCheck = 0;
  62.                 public float secExp = 0;
  63.                 public float minuteExp = 0;
  64.                 public float hourExp = 0;
  65.                 long startTime = 0;
  66.                 long runTime = 0, seconds = 0 ,minutes = 0, hours = 0;
  67.                 public int staff = 0;
  68.                 public int staffOfWater;
  69.                 public int staffOfAir;
  70.                 int runes[] = {563, 556, 555 };
  71.                 int zWine = 245;
  72.                 int faldorTeleTab = 8009;
  73.                 int grabCoordsX[] = { 707, 725 };
  74.                 int grabCoordsY[] = { 269, 283 };
  75.                 int fallyCoordsX[] = { 590, 602 };
  76.                 int fallyCoordsY[] = { 295, 308 };
  77.                 int teleGear[] = {8009, 563, 556, 555 };
  78.                
  79.                 // Images
  80.                 BufferedImage normal = null;
  81.                 BufferedImage mouse1 = null;
  82.                 BufferedImage mouse2 = null;
  83.                 BufferedImage mouse3 = null;
  84.                 BufferedImage mouse4 = null;
  85.                 BufferedImage mouse5 = null;
  86.                 BufferedImage mouse6 = null;
  87.                 BufferedImage mouseAll = null;
  88.                
  89.                 // Longs
  90.                 private long scriptStartTime = 0;
  91.                
  92.                 // Strings
  93.                 public String staffType;
  94.                 public String actionID;
  95.                 public String status;
  96.                 public String uWines;
  97.                 public String uTeleGrab;
  98.                
  99.          // Script Start
  100.                 public boolean onStart(Map<String, String> args) {
  101.                   try {
  102.                           final URL normalURL = new URL("http://i49.tinypic.com/2n6r7l1.png");
  103.                           final URL mouse1URL = new URL("http://i46.tinypic.com/5nlkd4.png");
  104.                           final URL mouse2URL = new URL("http://i48.tinypic.com/hui0wi.png");
  105.                           final URL mouse3URL = new URL("http://i50.tinypic.com/67ulwg.png");
  106.                           final URL mouse4URL = new URL("http://i50.tinypic.com/24mhvyp.png");
  107.                           final URL mouse5URL = new URL("http://i46.tinypic.com/nz2829.png");
  108.                           final URL mouse6URL = new URL("http://i45.tinypic.com/2uttfl1.jpg");
  109.                           final URL mouseAllURL = new URL("http://i50.tinypic.com/rsd24p.png");
  110.                           normal = ImageIO.read(normalURL);
  111.                           mouse1 = ImageIO.read(mouse1URL);
  112.                           mouse2 = ImageIO.read(mouse2URL);
  113.                           mouse3 = ImageIO.read(mouse3URL);
  114.                           mouse4 = ImageIO.read(mouse4URL);
  115.                           mouse5 = ImageIO.read(mouse5URL);
  116.                           mouse6 = ImageIO.read(mouse6URL);
  117.                           mouseAll = ImageIO.read(mouseAllURL);
  118.                   }
  119.                   catch (MalformedURLException e) {
  120.                                 log("Cannot Read Image URL Correctly");
  121.                   }
  122.                   catch (IOException e) {
  123.                                 log("Cannot Open Cursor Image");
  124.                   }
  125.                 if (args.get("summon").equals ("None")) {
  126.                     pouch = 0;
  127.                 }
  128.                 if (args.get("summon"). equals ("Thorny Snail")) {
  129.                     pouch = 12019;
  130.                 }
  131.                 if (args.get("summon").equals ("Kalphite")) {
  132.                     pouch = 12063;
  133.                 }
  134.                 if (args.get("summon").equals ("Terror Bird")) {
  135.                     pouch = 12007;
  136.                 }
  137.                 if (args.get("summon").equals ("Tortoise")) {
  138.                     pouch = 12031;
  139.                 }
  140.                 if (args.get("summon").equals ("Yak")) {
  141.                     pouch = 12093;
  142.                 }
  143.                 if(args.get("teleporting").equals("Faldor Tele-Tab")) {
  144.                    teleport = 8009;
  145.                 }
  146.                 if(args.get("teleporting").equals("Walk")) {
  147.                    teleport = 0;
  148.                 }
  149.                 if(args.get("teleporting").equals("Fally Tele")) {
  150.                    teleport =
  151.                 }
  152.                 return true;
  153.                         }
  154.                 public boolean useBank() {
  155.                                 if(isInventoryFull()) {
  156.                                 RSObject BankBooth = GetNearestObjectById(11758);
  157.                                 if(bankBooth == null);
  158.                                 atObject(bankBooth, "Use-quickly");
  159.                                 }
  160.                                 return true;
  161.                 }
  162.                
  163.                 public boolean deposit() {
  164.                                         return bank.depositAllExcept(teleGear);
  165.                                
  166.                 }
  167.                
  168.                 public boolean withdraw() {
  169.                                 bank.withdraw(pouch, 1);
  170.                                 return bank.close();
  171.                                
  172.                 }
  173.                
  174.                 public boolean summon() {
  175.                                 atInventoryItem(pouch, "summon");
  176.                                 return true;
  177.                                
  178.                 }
  179.                
  180.                 public boolean toWine() {
  181.                                 if(!isInventoryfull()) {
  182.                                 walkPathMM(randomizePath(toWine,2,2));
  183.                                 wait(random(1500,3000));
  184.                                 }
  185.                                 return isActive;
  186.                                
  187.                 }
  188.                
  189.                 puglic boolean teleGrabWine(Point p) {
  190.                          // new method, named Telegrab requires input of a Point named p
  191.                 if(game.getCurrentTab() != Game.TAB_MAGIC)
  192.                 // single line if statement, refers only to below line. tab check
  193.                 game.openTab(Game.TAB_MAGIC);
  194.                 //opens tab if check is true
  195.  
  196.                 if(game.getCurrentTab() == Game.TAB_MAGIC) {
  197.                     // check again, should always be true because of above check, added just incase
  198.                      IComponent spellInterface = interfaces.getComponent(192,26);
  199.                     // looks for interface with the id of 192 and child of 26
  200.                     if(spellInterface != null)
  201.                     // single line if, check if interface is around
  202.                         if(spellInterface.doAction("Cast")) {
  203.                             // a very interesting call to a boolean, note doAction are booleans and return true after they do something
  204.                           mouse.moveMouse(p, false);
  205.                             // therefore if it did actually do something I will click on the point given by p, in this case p is ground item location
  206.                             return true;
  207.                             // this boolean action will return true if I click on the object and casted
  208.                         }
  209.                 }
  210.                 return false;
  211.             }
  212.         public boolean storeFamiliar() {
  213.                                 if(isInventoryFull()) {
  214.                                  RSNPC scary = getNearestFreeNPCByName("Thorny snail, Kalphite, Terrorbird, tortiose, Yak");
  215.                                  if (scary !=null);
  216.                                  atNPC(scary, "Store");
  217.                                  atInventoryItem(snape, "Store");
  218.                                  
  219.                                 }
  220.                                 return true;
  221.                 }
  222.                
  223.                 private boolean isInventoryFull() {
  224.                         // TODO Auto-generated method stub
  225.                         return false;
  226.                 }
  227.                 boolean teleGrabSome(Point p) {
  228.                          // new method, named Telegrab requires input of a Point named p
  229.                 if(game.getCurrentTab() != Game.TAB_MAGIC)
  230.                 // single line if statement, refers only to below line. tab check
  231.                 game.openTab(Game.TAB_MAGIC);
  232.                 //opens tab if check is true
  233.  
  234.                 if(game.getCurrentTab() == Game.TAB_MAGIC) {
  235.                     // check again, should always be true because of above check, added just incase
  236.                      IComponent spellInterface = interfaces.getComponent(192,26);
  237.                     // looks for interface with the id of 192 and child of 26
  238.                     if(spellInterface != null)
  239.                     // single line if, check if interface is around
  240.                         if(spellInterface.doAction("Cast")) {
  241.                             // a very interesting call to a boolean, note doAction are booleans and return true after they do something
  242.                           mouse.moveMouse(p, false);
  243.                             // therefore if it did actually do something I will click on the point given by p, in this case p is ground item location
  244.                             return true;
  245.                             // this boolean action will return true if I click on the object and casted
  246.                         }
  247.                 }
  248.                 return false;
  249.             }
  250.                 public boolean leave() {
  251.                                 if(isInventoryFull()) {
  252.                                 atInventoryItem(teleport, "break");
  253.                 }else{
  254.                                 walkPathmm(randomizePath(toBank,2,2));
  255.                 }else{
  256.                                 magic.SPELL_FALADOR_TELEPORT
  257.                 }
  258.                                 return true;
  259.                 }
  260.                
  261.                 @Override
  262.                 public int loop() {
  263.                                 setRun(true);
  264.                                 setCameraAltitude(true);
  265.                                                 if(isInventoryFull())
  266.                                                                 if(useBank()) {
  267.                                                                                 if(deposit()) {
  268.                                                                                                 if(withdraw()) {
  269.                                                                                                         if(summon())
  270.                                                                                                         return random(500,800);
  271.                                                                                                        
  272.                                                                                                 }
  273.                                                                 }else{
  274.                                                                                 if(!isInventoryFull()) {
  275.                                                                                 if(summon()) {
  276.                                                                                                 if(toWine()) {
  277.                                                                                                                 if(teleGrabWine()) {
  278.                                                                                                                 if(isInventoryFull()) {
  279.                                                                                                                 if(storeFamiliar()) {
  280.                                                                                                                                 if(teleGrabSome())
  281. if(leave())
  282.        
  283. return random(300,700);
  284.                                                                                                                                                           }
  285.                                                                                                                                                    }
  286.                                                                                                 }
  287.                                                                                 }
  288.                                                                                 }
  289.                                                                                 }
  290.                                                                 }
  291.                                                                 }
  292.                                                         return random (1000,2000);
  293.                                                 }
  294.                
  295.                 @Override
  296.                 public void onRepaint(Graphics g) {
  297.                 long millis = System.currentTimeMillis() - startTime;
  298.                 long hours = millis / (1000 * 60 * 60);
  299.                 millis -= hours * (1000 * 60 * 60);
  300.                 long minutes = millis / (1000 * 60);
  301.                 millis -= minutes * (1000 * 60);
  302.                 long seconds = millis / 1000;
  303.                 //This paint was made using Enfilade's Paint Maker
  304.                 g.setColor(new Color(0, 255, 0));
  305.                 g.fillRoundRect(7, 345, 489, 57, 4, 4);
  306.                 g.setFont(new Font("Arial Black", 0, 20));
  307.                 g.setColor(new Color(255, 255, 0));
  308.                 g.drawString("Icanon's Wine Grabber", 137, 377);
  309.                 g.setColor(new Color(255, 51, 0, 203));
  310.                 g.fillRoundRect(7, 402, 489, 57, 4, 4);
  311.                 g.setColor(new Color(0, 0, 0));
  312.                 g.fillRect(6, 459, 489, 14);
  313.                 g.setFont(new Font("Arial Black", 0, 8));
  314.                 g.setColor(new Color(255, 255, 0));
  315.                 g.drawString("This was Made by Icanon, from I canon Inc.", 13, 469);
  316.                 g.setFont(new Font("Arial Black", 0, 11));
  317.                 g.setColor(new Color(255, 255, 0));
  318.                 g.drawString("RunTime:" + hours + " hours " + minutes + " minutes " + seconds + " seconds.", 13, 418);
  319.                 g.setFont(new Font("Arial Black", 0, 11));
  320.                 g.setColor(new Color(255, 255, 0));
  321.                 g.drawString("Trips:" + Runs, 13, 436);
  322.                 g.setFont(new Font("Arial Black", 0, 11));
  323.                 g.setColor(new Color(255, 255, 0));
  324.                 g.drawString("Took:"+ Runs*28 + " snape grass.", 13, 454);
  325.                 g.setFont(new Font("Arial Black", 0, 11));
  326.                 g.setColor(new Color(255, 255, 0));
  327.                 g.drawString("Made:" + Integer.toString(Runs) + " load(s).", 307, 454);                
  328.                 }
  329.         public void onFinish() {
  330.         log("Thanks for using");
  331.         }
  332.         private void log(String string) {
  333.                 // TODO Auto-generated method stub
  334.                
  335.         }      
  336.         }