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

Untitled

By: a guest on Aug 3rd, 2012  |  syntax: None  |  size: 32.77 KB  |  hits: 13  |  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.  
  3. import java.awt.Graphics;
  4.  
  5. import java.awt.Image;
  6.  
  7. import java.awt.Point;
  8.  
  9. import java.io.IOException;
  10.  
  11. import java.net.MalformedURLException;
  12.  
  13. import java.net.URL;
  14.  
  15. import org.rsbot.event.events.ServerMessageEvent;
  16.  
  17. import org.rsbot.event.listeners.PaintListener;
  18.  
  19. import org.rsbot.event.listeners.ServerMessageListener;
  20.  
  21. import org.rsbot.script.Script;
  22.  
  23. import org.rsbot.script.ScriptManifest;
  24.  
  25. import org.rsbot.script.methods.Skills;
  26.  
  27. import org.rsbot.script.util.Filter;
  28.  
  29. import org.rsbot.script.util.Timer;
  30.  
  31. import org.rsbot.script.util.WindowUtil;
  32.  
  33. import org.rsbot.script.wrappers.RSCharacter;
  34.  
  35. import org.rsbot.script.wrappers.RSGroundItem;
  36.  
  37. import org.rsbot.script.wrappers.RSNPC;
  38.  
  39. import org.rsbot.script.wrappers.RSObject;
  40.  
  41. import org.rsbot.script.wrappers.RSTile;
  42.  
  43.  
  44. @ScriptManifest(authors = {"Revnge"}, name = "Auto BDK", version = 1.0, description = "Auto BDK")
  45.  
  46. public class AutoBDK extends Script implements PaintListener,
  47.  
  48.         ServerMessageListener {
  49.  
  50.  
  51.    
  52.  
  53.    
  54.  
  55.   //Walking
  56.  
  57.   RSTile[] agilitysctotravdung = {new RSTile(2922, 3364), new RSTile(2912, 3373), new RSTile(2898, 3377), new RSTile(2890, 3391), new RSTile(2884, 3395)};
  58.  
  59.   RSTile[] walktodungeon = {new RSTile(2903, 9804), new RSTile(2911, 9808)};
  60.  
  61.   RSTile[] toBank = {new RSTile(2952, 3379), new RSTile(2946, 3368)};
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.   //AREAS
  76.  
  77.   int[] bankBoundry = {2943, 3368, 2949, 3373};
  78.  
  79.   private RSTile[] centerDung = {new RSTile(1011, 4520), new RSTile(1002, 4509), new RSTile(987, 4502)};
  80.  
  81.   int[] totravladderboundary = {2934, 3355, 2879, 3402};
  82.  
  83.   int[] atbluedragonsboundary = {3914, 9796, 2901, 9820};
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.   //INTS
  96.  
  97.  
  98.  
  99.   final int[] strengthPots = {2440, 157, 159, 161};
  100.  
  101.   final int[] attackPots = {2436, 145, 147, 149};
  102.  
  103.   final int[] antiPots = {2452, 2454, 2456, 2458};
  104.  
  105.   public int[] drop = {229, 995, 1355, 1069, 555, 1179};
  106.  
  107.   private RSGroundItem lootz;
  108.  
  109.   private RSGroundItem charmz;
  110.  
  111.   private RSGroundItem lootzd;
  112.  
  113.   int food, withdraw;
  114.  
  115.   public int agility1 = 11844;
  116.  
  117.   public int fallytab = 8009;
  118.  
  119.   int[] loots = {536, 985, 1213, 1163, 18778, 1149};
  120.  
  121.   String[] names = {"Dragon bones", "Tooth", "Rune da", "Rune ful", "Ancient", "Dragon Med"};
  122.  
  123.   public int[] charms = {12158, 12159, 12160, 12161, 12162, 12163, 12164, 12165, 12166, 12167};
  124.  
  125.   int tab;
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.   //PAINT INTS
  136.  
  137.   private String st;
  138.  
  139.   Image paint;
  140.  
  141.   private int totalLoot;
  142.  
  143.   private int lph;
  144.  
  145.   private int bankRun = 0;
  146.  
  147.   String stat;
  148.  
  149.   Timer tm = new Timer(0);
  150.  
  151.   public long startTime = System.currentTimeMillis();
  152.  
  153.   public int[] prices = new int[6];
  154.  
  155.   public int startBone, startHide, bankBone, bankHide, totalBone, totalHide, ivenBone, ivenHide;
  156.  
  157.    
  158.  
  159.    
  160.  
  161.  
  162.   //BOOLEANS
  163.  
  164.  
  165.  
  166.   boolean dungeon = false;
  167.  
  168.   boolean dPots = false, dAnti = false, lCharms = false;
  169.  
  170.   private boolean nanti;
  171.  
  172.   boolean tabTaken = false;
  173.  
  174.   boolean shortcut;
  175.  
  176.   boolean lootCharms;
  177.  
  178.   boolean startScript = false;
  179.  
  180.   boolean nBank = false;
  181.  
  182.        
  183.  
  184.        
  185.  
  186.        
  187.  
  188.    //NPC's
  189.  
  190.    final Filter<RSNPC> filt1 = new Filter<RSNPC>() {
  191.  
  192.              public boolean accept(RSNPC npc) {
  193.  
  194.             if ((npc.getInteracting() == getMyPlayer() || (npc.getName().equals("Blue dragon")
  195.  
  196.                     && !npc.isInCombat() && !npc.isInteractingWithLocalPlayer()))) {
  197.  
  198.                 return true;
  199.  
  200.             }
  201.  
  202.             return false;
  203.  
  204.         }
  205.  
  206.     };
  207.  
  208.     final Filter<RSNPC> filt2 = new Filter<RSNPC>() {
  209.  
  210.  
  211.         public boolean accept(RSNPC npc) {
  212.  
  213.             if (npc.getName().equals("Blue dragon")
  214.  
  215.                     && (npc.getInteracting() == getMyPlayer()
  216.  
  217.                     || (getMyPlayer().getInteracting() == npc))) {
  218.  
  219.                 return true;
  220.  
  221.             }
  222.  
  223.             return false;
  224.  
  225.         }
  226.  
  227.     };
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.   //ONSTART
  235.  
  236.        
  237.  
  238.         @Override
  239.  
  240.     public boolean onStart() {
  241.  
  242.         if (game.isLoggedIn()) {
  243.  
  244.  
  245.             if (skills.getRealLevel(Skills.AGILITY) >= 70) {
  246.  
  247.                 shortcut = true;
  248.  
  249.             }
  250.  
  251.  
  252.             if (skills.getRealLevel(Skills.DUNGEONEERING) >= 60) {
  253.  
  254.                 dungeon = true;
  255.  
  256.             }
  257.  
  258.  
  259.             try {
  260.  
  261.                 paint = java.awt.Toolkit.getDefaultToolkit().getImage(new URL("http://2.bp.blogspot.com/_cFIjMju8udw/SOmIyToR1_I/AAAAAAAAACk/1cUtVvgEEXo/s400/Blue_Dragon.gif")).getScaledInstance(516, 140, Image.SCALE_DEFAULT);
  262.  
  263.             } catch (MalformedURLException ex) {
  264.  
  265.             }
  266.  
  267.  
  268.  
  269.  
  270.            
  271.  
  272.             if (!shortcut) {
  273.  
  274.                 WindowUtil.showDialog("You dont have the required agility level (70). Script will now stop.");
  275.  
  276.                 log("Don't have agility requirement for blue dragons.");
  277.  
  278.                 return false;
  279.  
  280.             }
  281.  
  282.  
  283.  
  284.             BDKGUI g = new BDKGUI();
  285.  
  286.             g.setVisible(true);
  287.  
  288.             while (!startScript) {
  289.  
  290.                 sleep(10);
  291.  
  292.             }
  293.  
  294.  
  295.             combat.setAutoRetaliate(true);
  296.  
  297.  
  298.            
  299.  
  300.             mouse.setSpeed(random(5, 6));
  301.  
  302.             ivenBone = inventory.getCount(536);
  303.  
  304.             ivenHide = inventory.getCount(1753);
  305.  
  306.             tm.reset();
  307.  
  308.             return true;
  309.  
  310.         }
  311.  
  312.         log("Not logged in.");
  313.  
  314.         return false;
  315.  
  316.     }
  317.  
  318.  
  319.    
  320.  
  321. private void checkTabs() {
  322.  
  323. if (inventory.getCount(fallytab) <= 1) {
  324.  
  325. log("Out Of Fally Tabs Loging Out");
  326.  
  327.  stopScript();
  328.  
  329.  }
  330.  
  331. }
  332.  
  333.  
  334.  
  335.   //LOOP
  336.  
  337. @Override
  338.  
  339.     public int loop() {
  340.  
  341.              
  342.  
  343.                                                                          
  344.  
  345.                                                                          
  346.  
  347.         for (int i = 0; i < drop.length; i++) {
  348.  
  349.             if (inventory.contains(drop[i])) {
  350.  
  351.                 inventory.getItem(drop[i]).doAction("Drop");      
  352.  
  353.             }
  354.  
  355.         }
  356.  
  357.  
  358.         if (!lCharms) {
  359.  
  360.             if (inventory.containsOneOf(charms)) {
  361.  
  362.                 inventory.getItem(charms).doAction("Drop");    
  363.  
  364.             }
  365.  
  366.         }
  367.  
  368.  
  369.  
  370.         camera.setPitch(true);
  371.  
  372.         if (walking.getEnergy() > random(20, 40)) {    
  373.  
  374.             walking.setRun(true);
  375.  
  376.         }
  377.  
  378.  
  379.  
  380.         if (nBank) {
  381.  
  382.             stat = "Walking to Bank";          
  383.  
  384.             walking.walkPathMM(toBank);
  385.  
  386.             if (isInArea(bankBoundry)) {    
  387.  
  388.                 bankRun++;
  389.  
  390.                 nBank = false;
  391.  
  392.             }
  393.  
  394.         } else if (isInArea(bankBoundry)) {
  395.  
  396.             stat = "Banking";
  397.  
  398.             if (inventory.contains(fallytab) && inventory.contains(food)
  399.  
  400.                     && !inventory.contains(1751) && !inventory.contains(536)) {      
  401.  
  402.                 stat = "Walking to wall";
  403.  
  404.                 walking.walkTo(walking.getPath(new RSTile(2939, 3356)).getNext());
  405.  
  406.             } else {
  407.  
  408.                 RSObject b = objects.getNearest(11758);
  409.  
  410.                 if (b != null) {
  411.  
  412.                     camera.turnToObject(b);              
  413.  
  414.                     if (!b.isOnScreen()) {                    
  415.  
  416.                         walking.walkTileMM(b.getLocation());
  417.  
  418.                     } else {
  419.  
  420.                         bank.open();
  421.  
  422.                         sleep(random(2000, 2200));
  423.  
  424.                         if (bank.isOpen()) {
  425.  
  426.                             if (!tabTaken) {              
  427.  
  428.                                 sleep(random(4000, 5000));
  429.  
  430.                                 tab = bank.getCurrentTab();
  431.  
  432.                                 log("Current tab is" + tab);            
  433.  
  434.  
  435.                                 tabTaken = true;
  436.  
  437.                                 startBone = bank.getCount(loots[0]);
  438.  
  439.                                 startHide = bank.getCount(loots[1]);      
  440.  
  441.  
  442.  
  443.  
  444.                             } else {
  445.  
  446.                                 if (bank.getCurrentTab() != tab) {
  447.  
  448.                                     openBankTab(tab);                 //!tab
  449.  
  450.                                     sleep(random(2000, 3000));
  451.  
  452.                                 }
  453.  
  454.                             }
  455.  
  456.  
  457.                             if (bank.depositAllExcept(fallytab)) {
  458.  
  459.                                 totalBone = bank.getCount(loots[0]) - startBone - ivenBone;
  460.  
  461.                                 totalHide = bank.getCount(loots[1]) - startHide - ivenHide;    
  462.  
  463.                                 ivenBone = 0;
  464.  
  465.                                 ivenHide = 0;
  466.  
  467.                                 sleep(random(1000, 2000));
  468.  
  469.                                 if ((food != 0) && bank.isOpen()) {
  470.  
  471.                                     while (!inventory.contains(food)) {
  472.  
  473.                                         if (bank.getCurrentTab() != tab) {
  474.  
  475.                                             openBankTab(tab);
  476.  
  477.                                             sleep(random(2000, 3000));
  478.  
  479.                                         }
  480.  
  481.                                         bank.withdraw(food, withdraw);
  482.  
  483.                                         sleep(random(800, 1000));
  484.  
  485.                                     }
  486.  
  487.                                 }
  488.  
  489.                                 if (dPots) {
  490.  
  491.                                     bank.withdraw(gap(strengthPots), 1);  
  492.  
  493.                                     sleep(random(800, 1000));
  494.  
  495.  
  496.                                     bank.withdraw(gap(attackPots), 1);
  497.  
  498.                                     sleep(random(800, 1000));
  499.  
  500.                                 }
  501.  
  502.                                 if (dAnti) {
  503.  
  504.                                     bank.withdraw(gap(antiPots), 1);
  505.  
  506.                                     sleep(random(800, 1000));
  507.  
  508.                                 }
  509.  
  510.  
  511.                                 if (bank.close()) {
  512.  
  513.                                     sleep(random(600, 700));   //close
  514.  
  515.                                     if (dPots) {
  516.  
  517.                                         if (didPot(strengthPots)) {
  518.  
  519.                                             sleep(random(800, 1000));
  520.  
  521.                                         }
  522.  
  523.                                         if (didPot(attackPots)) {
  524.  
  525.                                             sleep(random(800, 1000));
  526.  
  527.                                         }
  528.  
  529.                                     }
  530.  
  531.                                     if (dAnti) {
  532.  
  533.                                         if (didPot(antiPots)) {
  534.  
  535.                                             nanti = false;
  536.  
  537.                                             sleep(random(800, 1000));
  538.  
  539.                                         }
  540.  
  541.                                     } else {
  542.  
  543.                                         nanti = false;
  544.  
  545.                                     }
  546.  
  547.                                     if (dPots) {
  548.  
  549.                                         if (bank.open()) {
  550.  
  551.                                             while (!bank.getInterface().isValid()) {
  552.  
  553.                                                 sleep(random(1500, 2000));
  554.  
  555.                                                 bank.open();
  556.  
  557.                                             }
  558.  
  559.                                         }
  560.  
  561.                                         if (bank.isOpen()) {
  562.  
  563.                                             if (!inventory.containsOneOf(antiPots[0], antiPots[1], antiPots[2], antiPots[3]) && dAnti) { //no pots depsot
  564.  
  565.                                                 bank.depositAllExcept(fallytab, food);
  566.  
  567.  
  568.                                                 if (bank.getCurrentTab() != tab) {
  569.  
  570.                                                     openBankTab(tab);
  571.  
  572.                                                     sleep(random(1000, 1800));
  573.  
  574.                                                 }
  575.  
  576.                                                 bank.withdraw(gap(antiPots), 1);
  577.  
  578.                                                 sleep(random(500, 600));
  579.  
  580.                                             } else {
  581.  
  582.                                                 bank.depositAllExcept(fallytab, food, antiPots[0], antiPots[1], antiPots[2], antiPots[3]);
  583.  
  584.                                                 sleep(random(500, 600));
  585.  
  586.                                             }
  587.  
  588.                                         }
  589.  
  590.                                     }
  591.  
  592.                                 }
  593.  
  594.                             }
  595.  
  596.                         }
  597.  
  598.                     }
  599.  
  600.                 }
  601.  
  602.             }
  603.  
  604.         } else if (isInArea(new int[]{2936, 3352, 2942, 3376})) {
  605.  
  606.             stat = "Walking to wall";
  607.  
  608.             RSObject a = objects.getNearest(agility1);
  609.  
  610.             if (a != null) {
  611.  
  612.                 if (calc.distanceTo(a) <= 4) {
  613.  
  614.                     camera.turnToObject(a);
  615.  
  616.                     a.doAction("Climb");
  617.  
  618.                     waitToMove();
  619.  
  620.                 } else {
  621.  
  622.                     walking.walkTo(walking.getPath(new RSTile(2939, 3356)).getNext());
  623.  
  624.                 }
  625.  
  626.             } else {
  627.  
  628.                 walking.walkTo(walking.getPath(new RSTile(2939, 3356)).getNext());
  629.  
  630.             }
  631.  
  632.         } else if (isInArea(new int[]{2878, 3350, 2943, 3422})) {
  633.  
  634.             stat = "Walking to dungeon";
  635.  
  636.             RSObject l = objects.getNearest(55404);
  637.  
  638.             if (l != null) {
  639.  
  640.                 if (l.isOnScreen()) {
  641.  
  642.                     l.doAction("Climb");
  643.  
  644.                     sleep(random(800, 1200));
  645.  
  646.                 } else {
  647.  
  648.                     walking.walkPathMM(agilitysctotravdung);
  649.  
  650.                 }
  651.  
  652.             } else {
  653.  
  654.                 walking.walkPathMM(agilitysctotravdung);
  655.  
  656.             }
  657.  
  658.         } else if (isInArea(new int[]{2881, 9794, 2887, 9801})) {
  659.  
  660.             RSObject h = objects.getNearest(9293);
  661.  
  662.             if (h != null) {
  663.  
  664.                 if (h.isOnScreen()) {
  665.  
  666.                     h.doAction("Squeeze");
  667.  
  668.                     sleep(random(3000, 4000));
  669.  
  670.                     waitToMove();
  671.  
  672.                 } else {
  673.  
  674.                     camera.turnToObject(h);
  675.  
  676.                 }
  677.  
  678.             }
  679.  
  680.         } else if (isInArea(new int[]{2889, 9793, 2923, 9813})) {
  681.  
  682.             stat = "Fighting drags";
  683.  
  684.             if (dungeon) {
  685.  
  686.                 RSObject d = objects.getNearest(52852);
  687.  
  688.                 if (d != null) {
  689.  
  690.                     if (d.isOnScreen()) {
  691.  
  692.                         d.doAction("Enter");
  693.  
  694.                         sleep(random(1500, 2200));
  695.  
  696.                     } else {
  697.  
  698.                         walking.walkPathMM(walktodungeon);
  699.  
  700.                     }
  701.  
  702.                 } else {
  703.  
  704.                     walking.walkPathMM(walktodungeon);
  705.  
  706.                 }
  707.  
  708.             } else {
  709.  
  710.                 fight();
  711.  
  712.             }
  713.  
  714.         } else if ((Math.floor(getMyPlayer().getLocation().getY() / 1000) == 4.0)) {
  715.  
  716.             fight();
  717.  
  718.         } else {
  719.  
  720.         }
  721.  
  722.         return (random(200, 400));
  723.  
  724.  
  725.     }
  726.  
  727.  
  728.     public void waitToMove() {
  729.  
  730.         sleep(random(1500, 2000));
  731.  
  732.         while (getMyPlayer().isMoving()) {
  733.  
  734.             sleep(random(100, 200));
  735.  
  736.         }
  737.  
  738.     }
  739.  
  740.  
  741.     public int gap(int[] pots) {
  742.  
  743.         if (bank.isOpen()) {
  744.  
  745.             if (bank.getCount(pots[0]) > 0) {
  746.  
  747.                 return pots[0];
  748.  
  749.             } else if (bank.getCount(pots[1]) > 0) {
  750.  
  751.                 return pots[1];
  752.  
  753.             } else if (bank.getCount(pots[2]) > 0) {
  754.  
  755.                 return pots[2];
  756.  
  757.             } else if (bank.getCount(pots[3]) > 0) {
  758.  
  759.                 return pots[3];
  760.  
  761.             }
  762.  
  763.         } else {
  764.  
  765.             return 0;
  766.  
  767.         }
  768.  
  769.         return 0;
  770.  
  771.     }
  772.  
  773.  
  774.     private boolean isInArea(int[] xy) {//Creds Ownageful
  775.  
  776.         final int x = getMyPlayer().getLocation().getX();
  777.  
  778.         final int y = getMyPlayer().getLocation().getY();
  779.  
  780.         if (x >= xy[0] && x <= xy[2] && y >= xy[1] && y <= xy[3]) {
  781.  
  782.             return true;
  783.  
  784.         } else {
  785.  
  786.             return false;
  787.  
  788.  
  789.         }
  790.  
  791.     }
  792.  
  793.  
  794.     public boolean openBankTab(int tab) {
  795.  
  796.         if (!bank.isOpen() || (63 - (tab * 2) < 47)) {
  797.  
  798.             return false;
  799.  
  800.         }
  801.  
  802.         try {
  803.  
  804.             return bank.getInterface().getComponent(63 - (tab * 2)).doClick();
  805.  
  806.         } catch (NullPointerException e) {
  807.  
  808.             return false;
  809.  
  810.         }
  811.  
  812.     }
  813.  
  814.  
  815.     public boolean didPot(int[] pots) {
  816.  
  817.         if (inventory.containsOneOf(pots)) {
  818.  
  819.             if (inventory.getItem(pots).doAction("Drink")) {
  820.  
  821.                 return true;
  822.  
  823.             }
  824.  
  825.         }
  826.  
  827.         return false;
  828.  
  829.     }
  830.  
  831.  
  832.     private void performHumanAction() {
  833.  
  834.         int randomNum = random(1, 30);
  835.  
  836.         int r = random(1, 35);
  837.  
  838.         if (randomNum == 6) {
  839.  
  840.             if (r == 1) {
  841.  
  842.                 if (game.getCurrentTab() != game.TAB_STATS) {
  843.  
  844.                     game.openTab(game.TAB_STATS);
  845.  
  846.                     mouse.move(random(680, 730), random(355, 370));
  847.  
  848.                     sleep(random(1000, 1500));
  849.  
  850.                 }
  851.  
  852.             }
  853.  
  854.             if (r == 2) {
  855.  
  856.                 game.openTab(random(1, 14));
  857.  
  858.             }
  859.  
  860.             if (r == 3) {
  861.  
  862.                 Point mPos = mouse.getLocation();
  863.  
  864.                 mouse.move(mPos.x + random(-90, 90), mPos.y + random(-90, 90));
  865.  
  866.             }
  867.  
  868.             if (r == 4) {
  869.  
  870.                 Point mPos = mouse.getLocation();
  871.  
  872.                 mouse.move(mPos.x + random(-90, 90), mPos.y + random(-90, 90));
  873.  
  874.             }
  875.  
  876.             if (r == 5) {
  877.  
  878.                 Point mPos = mouse.getLocation();
  879.  
  880.                 mouse.move(mPos.x + random(-90, 90), mPos.y + random(-90, 90));
  881.  
  882.             }
  883.  
  884.             if (r == 6) {
  885.  
  886.                 Point mPos = mouse.getLocation();
  887.  
  888.                 mouse.move(mPos.x + random(-90, 90), mPos.y + random(-90, 90));
  889.  
  890.             }
  891.  
  892.             if (r == 7) {
  893.  
  894.                 Point mPos = mouse.getLocation();
  895.  
  896.                 mouse.move(mPos.x + random(-90, 90), mPos.y + random(-90, 90));
  897.  
  898.             }
  899.  
  900.             if (r == 8) {
  901.  
  902.                 camera.setAngle(random(100, 360));
  903.  
  904.             }
  905.  
  906.             if (r == 9) {
  907.  
  908.                 camera.setAngle(random(100, 360));
  909.  
  910.             }
  911.  
  912.             if (r == 10) {
  913.  
  914.                 camera.setAngle(random(100, 360));
  915.  
  916.             }
  917.  
  918.         }
  919.  
  920.     }
  921.  
  922.  
  923.    
  924.  
  925.         private int fight() {
  926.  
  927.         if (nanti) {
  928.  
  929.             if (inventory.containsOneOf(antiPots[0], antiPots[1], antiPots[2], antiPots[3])) {
  930.  
  931.                 if (inventory.getItem(antiPots).doAction("Drink")) {
  932.  
  933.                     sleep(random(800, 900));
  934.  
  935.                     nanti = false;
  936.  
  937.                     return 20;
  938.  
  939.                 }
  940.  
  941.             }
  942.  
  943.         }
  944.  
  945.  
  946.         if (inventory.isFull() && inventory.getCount(food) == 0) {
  947.  
  948.             try {
  949.  
  950.                 inventory.getItem(fallytab).doAction("Break");
  951.  
  952.                 nBank = true;
  953.  
  954.                 return 100;
  955.  
  956.             } catch (NullPointerException e) {
  957.  
  958.                 log("Out of fally teleport.");
  959.  
  960.                 stopScript();
  961.  
  962.             }
  963.  
  964.             sleep(random(100, 200));
  965.  
  966.         }
  967.  
  968.         if (game.isLoggedIn()) {
  969.  
  970.             if (getMyPlayer().getHPPercent() < 30) {
  971.  
  972.                 if (inventory.contains(food)) {
  973.  
  974.                     inventory.getItem(food).doAction("Eat");
  975.  
  976.                     sleep(random(600, 800));
  977.  
  978.                     return 100;
  979.  
  980.                 } else {
  981.  
  982.                     inventory.getItem(fallytab).doAction("Break");
  983.  
  984.                     sleep(random(4000, 5500));
  985.  
  986.                     nBank = true;
  987.  
  988.                     return 100;
  989.  
  990.                 }
  991.  
  992.             }
  993.  
  994.         }
  995.  
  996.         if (lCharms) {
  997.  
  998.             charmz = groundItems.getNearest(charms);
  999.  
  1000.             if (charmz != null) {
  1001.  
  1002.                 if (calc.tileOnScreen(charmz.getLocation())) {
  1003.  
  1004.                     if (inventory.isFull() && inventory.contains(food) && !inventory.contains(charmz.getItem().getID())) {
  1005.  
  1006.                         inventory.getItem(food).doAction("Eat");
  1007.  
  1008.                         sleep(random(100, 300));
  1009.  
  1010.                     }
  1011.  
  1012.                     charmz.doAction("Take");
  1013.  
  1014.                     while (getMyPlayer().isMoving()) {
  1015.  
  1016.                         sleep(200, 400);
  1017.  
  1018.                     }
  1019.  
  1020.                     return 100;
  1021.  
  1022.                 } else {
  1023.  
  1024.                     if (calc.tileOnMap(charmz.getLocation())) {
  1025.  
  1026.                         walking.walkTileMM(charmz.getLocation());
  1027.  
  1028.                         while (getMyPlayer().isMoving()) {
  1029.  
  1030.                             sleep(200, 400);
  1031.  
  1032.                         }
  1033.  
  1034.                         return 100;
  1035.  
  1036.                     }
  1037.  
  1038.                 }
  1039.  
  1040.             }
  1041.  
  1042.         }
  1043.  
  1044.         lootzd = groundItems.getNearest(loots[0]);
  1045.  
  1046.         if (lootzd != null) {
  1047.  
  1048.             if (calc.tileOnScreen(lootzd.getLocation())) {
  1049.  
  1050.                 if (inventory.isFull() && inventory.contains(food)) {
  1051.  
  1052.                     inventory.getItem(food).doAction("Eat");
  1053.  
  1054.                     sleep(random(400, 500));
  1055.  
  1056.                 }
  1057.  
  1058.                 lootzd.doAction("Take Drag");
  1059.  
  1060.                 while (getMyPlayer().isMoving()) {
  1061.  
  1062.                     sleep(100, 300);
  1063.  
  1064.                 }
  1065.  
  1066.                 return (random(400, 600));
  1067.  
  1068.             } else {
  1069.  
  1070.                 if (calc.tileOnMap(lootzd.getLocation())) {
  1071.  
  1072.                     walking.walkTileMM(lootzd.getLocation());
  1073.  
  1074.                     while (getMyPlayer().isMoving()) {
  1075.  
  1076.                         sleep(300, 400);
  1077.  
  1078.                     }
  1079.  
  1080.                     return (random(150,200));
  1081.  
  1082.                 }
  1083.  
  1084.             }
  1085.  
  1086.         }
  1087.  
  1088.  
  1089.         lootz = groundItems.getNearest(loots);
  1090.  
  1091.         if (lootz != null) {
  1092.  
  1093.             for (int i = 0; i < loots.length; i++) {
  1094.  
  1095.                 if (lootz.getItem().getID() == loots[i]) {
  1096.  
  1097.                     if (calc.tileOnScreen(lootz.getLocation())) {
  1098.  
  1099.                         if (inventory.isFull() && inventory.contains(food)) {
  1100.  
  1101.                             inventory.getItem(food).doAction("Eat");
  1102.  
  1103.                             sleep(random(700, 900));
  1104.  
  1105.                         }
  1106.  
  1107.                         lootz.doAction("Take " + names[i]);
  1108.  
  1109.                         while (getMyPlayer().isMoving()) {
  1110.  
  1111.                             sleep(400, 500);
  1112.  
  1113.                         }
  1114.  
  1115.                         return (random(150,200));
  1116.  
  1117.                     } else {
  1118.  
  1119.                         if (calc.tileOnMap(lootz.getLocation())) {
  1120.  
  1121.                             walking.walkTileMM(lootz.getLocation());
  1122.  
  1123.                             while (getMyPlayer().isMoving()) {
  1124.  
  1125.                                 sleep(200, 400);
  1126.  
  1127.                             }
  1128.  
  1129.                             return (random(100,200));
  1130.  
  1131.                         }
  1132.  
  1133.                     }
  1134.  
  1135.                 }
  1136.  
  1137.             }
  1138.  
  1139.  
  1140.         }
  1141.  
  1142.  
  1143.         RSCharacter inter = getMyPlayer().getInteracting();
  1144.  
  1145.         if (inter != null) {
  1146.  
  1147.             if (inter.getName().contains("Blue dragon")) {
  1148.  
  1149.                 if (inter.getAnimation() == 12250) {
  1150.  
  1151.                     sleep(random(1000, 1500));
  1152.  
  1153.                     return (random(400, 700));
  1154.  
  1155.                 } else {
  1156.  
  1157.                     sleep(random(400, 500));
  1158.  
  1159.                 }
  1160.  
  1161.             }
  1162.  
  1163.         } else {
  1164.  
  1165.             RSNPC drag = npcs.getNearest(filt1);
  1166.  
  1167.             if (drag != null) {
  1168.  
  1169.                 if (drag.isOnScreen()) {
  1170.  
  1171.                     drag.doAction("Attack");
  1172.  
  1173.                     sleep(random(600, 650));
  1174.  
  1175.                 } else {
  1176.  
  1177.                     walking.walkTileMM(drag.getLocation());
  1178.  
  1179.                 }
  1180.  
  1181.             } else {
  1182.  
  1183.                 if (dungeon) {
  1184.  
  1185.                     walking.walkPathMM(centerDung);
  1186.  
  1187.                 }
  1188.  
  1189.             }
  1190.  
  1191.  
  1192.             return (random(550,700));
  1193.  
  1194.         }
  1195.  
  1196.         return (random(200, 300));
  1197.  
  1198.     }
  1199.  
  1200.  
  1201.    
  1202.  
  1203.    
  1204.  
  1205.         //GUI
  1206.  
  1207.         class BDKGUI extends javax.swing.JFrame {
  1208.  
  1209.  
  1210.         public BDKGUI() {
  1211.  
  1212.             initComponents();
  1213.  
  1214.         }
  1215.  
  1216.  
  1217.         private void initComponents() {
  1218.  
  1219.  
  1220.             jPanel1 = new javax.swing.JPanel();
  1221.  
  1222.             jButton1 = new javax.swing.JButton();
  1223.  
  1224.             jTextField2 = new javax.swing.JTextField();
  1225.  
  1226.             jTextField1 = new javax.swing.JTextField();
  1227.  
  1228.             jLabel2 = new javax.swing.JLabel();
  1229.  
  1230.             jLabel1 = new javax.swing.JLabel();
  1231.  
  1232.             jLabel4 = new javax.swing.JLabel();
  1233.  
  1234.             jCheckBox1 = new javax.swing.JCheckBox();
  1235.  
  1236.             jLabel3 = new javax.swing.JLabel();
  1237.  
  1238.             jCheckBox2 = new javax.swing.JCheckBox();
  1239.  
  1240.             jCheckBox3 = new javax.swing.JCheckBox();
  1241.  
  1242.             jLabel5 = new javax.swing.JLabel();
  1243.  
  1244.  
  1245.             setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
  1246.  
  1247.             setTitle("Rev's Auto BDK .");
  1248.  
  1249.             setAlwaysOnTop(true);
  1250.  
  1251.             setBackground(new java.awt.Color(255, 255, 255));
  1252.  
  1253.             setFocusable(false);
  1254.  
  1255.  
  1256.             jPanel1.setBackground(new java.awt.Color(255, 255, 255));
  1257.  
  1258.             jPanel1.setForeground(new java.awt.Color(255, 255, 255));
  1259.  
  1260.  
  1261.             jButton1.setText("Start");
  1262.  
  1263.             jButton1.addActionListener(new java.awt.event.ActionListener() {
  1264.  
  1265.  
  1266.                 public void actionPerformed(java.awt.event.ActionEvent evt) {
  1267.  
  1268.                     jButton1ActionPerformed(evt);
  1269.  
  1270.                 }
  1271.  
  1272.             });
  1273.  
  1274.  
  1275.             jLabel2.setText("Withdraw:");
  1276.  
  1277.  
  1278.  
  1279.  
  1280.             jLabel1.setText("Food ID:");
  1281.  
  1282.  
  1283.             jLabel4.setText("Fally Teleport Tabs In The First Slot");
  1284.  
  1285.  
  1286.             jCheckBox1.setBackground(new java.awt.Color(255, 255, 255));
  1287.  
  1288.             jCheckBox1.setText("Loot Charms?(not working)");
  1289.  
  1290.  
  1291.             jLabel3.setText("Start script in fally bank with:");
  1292.  
  1293.             jLabel5.setText("<html><img src=http://2.bp.blogspot.com/_cFIjMju8udw/SOmIyToR1_I/AAAAAAAAACk/1cUtVvgEEXo/s400/Blue_Dragon.gif /></html>");
  1294.  
  1295.  
  1296.  
  1297.             jCheckBox2.setText("Drink Antifire");
  1298.  
  1299.  
  1300.             jCheckBox3.setText("Drink Super Pots");
  1301.  
  1302.  
  1303.             javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
  1304.  
  1305.             jPanel1.setLayout(jPanel1Layout);
  1306.  
  1307.             jPanel1Layout.setHorizontalGroup(
  1308.  
  1309.                     jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addComponent(jCheckBox1).addGap(28, 28, 28).addComponent(jLabel1).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 129, Short.MAX_VALUE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(jLabel2).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE).addContainerGap()).addGroup(jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false).addGroup(jPanel1Layout.createSequentialGroup().addComponent(jCheckBox2).addGap(18, 18, 18).addComponent(jCheckBox3).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)).addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING).addComponent(jLabel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 332, javax.swing.GroupLayout.PREFERRED_SIZE)).addGap(28, 28, 28)))));
  1310.  
  1311.             jPanel1Layout.setVerticalGroup(
  1312.  
  1313.                     jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup().addContainerGap(11, Short.MAX_VALUE).addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jCheckBox1).addComponent(jLabel1).addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel2).addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel3).addGap(1, 1, 1).addComponent(jLabel4).addGap(7, 7, 7).addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jCheckBox2).addComponent(jCheckBox3)).addContainerGap()));
  1314.  
  1315.  
  1316.             jLabel5.setBackground(new java.awt.Color(255, 255, 255));
  1317.  
  1318.             jLabel5.setForeground(new java.awt.Color(255, 255, 255));
  1319.  
  1320.  
  1321.             javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  1322.  
  1323.             getContentPane().setLayout(layout);
  1324.  
  1325.             layout.setHorizontalGroup(
  1326.  
  1327.                     layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, 436, Short.MAX_VALUE));
  1328.  
  1329.             layout.setVerticalGroup(
  1330.  
  1331.                     layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, 216, Short.MAX_VALUE).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)));
  1332.  
  1333.  
  1334.             pack();
  1335.  
  1336.         }
  1337.  
  1338.  
  1339.         private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
  1340.  
  1341.             if (jCheckBox1.isSelected()) {
  1342.  
  1343.                 lCharms = true;
  1344.  
  1345.             }
  1346.  
  1347.             if (jCheckBox2.isSelected()) {
  1348.  
  1349.                 dAnti = true;
  1350.  
  1351.             }
  1352.  
  1353.             if (jCheckBox3.isSelected()) {
  1354.  
  1355.                 dPots = true;
  1356.  
  1357.             }
  1358.  
  1359.  
  1360.  
  1361.             food = Integer.parseInt(jTextField1.getText());
  1362.  
  1363.             withdraw = Integer.parseInt(jTextField2.getText());
  1364.  
  1365.             startScript = true;
  1366.  
  1367.            
  1368.  
  1369.         }
  1370.  
  1371.         private javax.swing.JButton jButton1;
  1372.  
  1373.         private javax.swing.JCheckBox jCheckBox1;
  1374.  
  1375.         private javax.swing.JCheckBox jCheckBox2;
  1376.  
  1377.         private javax.swing.JCheckBox jCheckBox3;
  1378.  
  1379.         private javax.swing.JLabel jLabel1;
  1380.  
  1381.         private javax.swing.JLabel jLabel2;
  1382.  
  1383.         private javax.swing.JLabel jLabel3;
  1384.  
  1385.         private javax.swing.JLabel jLabel4;
  1386.  
  1387.         private javax.swing.JLabel jLabel5;
  1388.  
  1389.         private javax.swing.JPanel jPanel1;
  1390.  
  1391.         private javax.swing.JTextField jTextField1;
  1392.  
  1393.         private javax.swing.JTextField jTextField2;
  1394.  
  1395.     }
  1396.  
  1397.  
  1398.        
  1399.  
  1400.         //PAINT
  1401.  
  1402.         private void drawMouse(final Graphics g) {
  1403.  
  1404.         final Point loc = mouse.getLocation();
  1405.  
  1406.         if (System.currentTimeMillis()
  1407.  
  1408.                 - mouse.getPressTime() < 500) {
  1409.  
  1410.             g.setColor(Color.red);
  1411.  
  1412.             g.fillOval(loc.x - 5, loc.y - 5, 10, 10);
  1413.  
  1414.         } else {
  1415.  
  1416.             g.setColor(Color.black);
  1417.  
  1418.         }
  1419.  
  1420.         g.drawLine(0, loc.y, game.getWidth(), loc.y);
  1421.  
  1422.         g.drawLine(loc.x, 0, loc.x, game.getHeight());
  1423.  
  1424.     }
  1425.  
  1426.  
  1427.     public void onRepaint(Graphics g) {
  1428.  
  1429.         st = tm.toElapsedString();
  1430.  
  1431.         totalLoot = ((totalBone + inventory.getCount(loots[0]) - ivenBone) * prices[0])
  1432.  
  1433.                 + ((totalHide + inventory.getCount(loots[1]) - ivenHide) * prices[1]);
  1434.  
  1435.         lph = (int) (totalLoot / ((Double.parseDouble(st.substring(0, 2))) + (Double.parseDouble(st.substring(3, 5)) / 60)
  1436.  
  1437.                 + (Double.parseDouble(st.substring(6, 8)) / 3600)));
  1438.  
  1439.         g.setColor(Color.blue);
  1440.  
  1441.         g.drawImage(paint, 1, 340, null);
  1442.  
  1443.         g.drawString(st + "", 290, 389);
  1444.  
  1445.         g.drawString("" + totalLoot, 321, 406);
  1446.  
  1447.         g.drawString(lph + "", 307, 427);
  1448.  
  1449.         g.drawString(bankRun + "", 279, 445);
  1450.  
  1451.         g.drawString(stat, 289, 462);
  1452.  
  1453.     }
  1454.  
  1455.        
  1456.  
  1457.  
  1458.        
  1459.  
  1460.        
  1461.  
  1462.        
  1463.  
  1464.         //SERVER MESS
  1465.  
  1466. public void serverMessageRecieved(ServerMessageEvent sme) {
  1467.  
  1468.         String str = sme.getMessage().toString();
  1469.  
  1470.         if (str.contains("fiery breath") && dAnti) {
  1471.  
  1472.             nanti = true;
  1473.  
  1474.         }
  1475.  
  1476.     }
  1477.  
  1478. }