joedezzy1

BANKER

Jul 3rd, 2014
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 6.83 KB | None | 0 0
  1. package scripts.abyssCrafter;
  2.  
  3. import org.tribot.api.Clicking;
  4. import org.tribot.api.General;
  5. import org.tribot.api2007.Banking;
  6. import org.tribot.api2007.Equipment;
  7. import org.tribot.api2007.Game;
  8. import org.tribot.api2007.Inventory;
  9. import org.tribot.api2007.Skills;
  10. import org.tribot.api2007.Skills.SKILLS;
  11. import org.tribot.api2007.types.RSItem;
  12.  
  13. public class Banker extends Crafter{
  14.  
  15.  
  16.     public static void gearUp() {
  17.        
  18.         if (Inventory.find(Crafter.RUNE_TYPE).length > 0
  19.                 || Inventory.find("Amulet of glory").length > 0 ) {
  20.             depositInventory();
  21.            
  22.         }
  23.        
  24.         else if (Skills.getCurrentLevel(SKILLS.HITPOINTS) <= Crafter.SAFE_HEALTH) {
  25.             healUp();
  26.            
  27.         }
  28.        
  29.         else if (Crafter.usingEnergyPotion
  30.                    ? needEnergyPotion() : false) {
  31.             // **gets and drinks energy potion if player wants to use them**\\
  32.             if(!ENERGY_ITEM.equals("Resting"))
  33.                 getEnergy();
  34.             else
  35.                 General.sleep(100);
  36.         }
  37.        
  38.         else if (!Equipment.isEquipped(GLORY)) {
  39.             // **Gets & Equipts glory**\\
  40.             getGlory();
  41.            
  42.        } else if (usingEmergencyTeleport
  43.                    ? Inventory.find(TELE_TABS).length < 1 : false) {
  44.            getEmergenyTeleport();
  45.            
  46.         }
  47.        
  48.        else if (Inventory.find(POUCHES).length > 0 &&!pouchesFilled()) {
  49.             // **fills pouches if needs to be filled**\\
  50.             fillPouches();
  51.            
  52.         }
  53.        
  54.        else if (Inventory.find(ESSENCE_TYPE).length < Inventory.find(ESSENCE_TYPE).length + (28 - Inventory.getAll().length)) {
  55.             // **Gets essence if player is ready**\\
  56.             getEssence();
  57.            
  58.         }
  59.     }
  60.  
  61.    
  62.     private static void getEssence() {
  63.        
  64.         if(openBank()){
  65.             if(Banking.withdraw(inventorySpace(), ESSENCE_TYPE)){
  66.                 General.sleep(1200, 2100);
  67.             }
  68.         }
  69.     }
  70.  
  71.     private static void getEmergenyTeleport() {
  72.        
  73.         if(openBank()){
  74.           if(Banking.withdraw(1, TELE_TABS)){
  75.               General.sleep(1200, 2100);
  76.           }    
  77.        }
  78.     }
  79.  
  80.     private static void fillPouches() {
  81.        
  82.         if(Inventory.find(ESSENCE_TYPE).length < 4){
  83.             if(openBank()){
  84.                 if(Banking.withdraw(inventorySpace(), ESSENCE_TYPE)){
  85.                     General.sleep(1200, 2100);
  86.                 }
  87.             }          
  88.         }
  89.        
  90.         else if(Banking.close()){
  91.             storeEssence();
  92.            
  93.         }
  94.     }
  95.  
  96.     private static void getGlory() {
  97.        
  98.         if(Inventory.find(GLORY).length > 0){
  99.             if(Banking.close()){
  100.                 if(Clicking.click(Inventory.find(GLORY))){
  101.                     General.sleep(2200, 4200);
  102.                 }
  103.             }
  104.            
  105.         }
  106.        
  107.         else if(openBank()){
  108.             if(Banking.find(GLORY).length > 0){
  109.                 if(Banking.withdraw(1, GLORY)){
  110.                     General.sleep(1300, 2330);
  111.                 }
  112.                
  113.             }
  114.            
  115.             else {
  116.                 General.println("Out of glories!, will add support for recharge, thanks for using");
  117.                 GloryRechargeNavigator.start();
  118.                
  119.             }
  120.         }
  121.     }
  122.  
  123.    
  124.  
  125.     private static void getEnergy() {
  126.  
  127.         RSItem[] energy = Inventory.find(ENERGY_ITEMS);
  128.        
  129.         if(energy.length > 0){
  130.             if(Banking.close()){
  131.                 if(Clicking.click(energy[0])){
  132.                     General.sleep(2200, 4200);
  133.                 }
  134.             }
  135.            
  136.         }
  137.        
  138.         else if(openBank()){
  139.             if(Banking.withdraw(1, ENERGY_ITEMS)){
  140.                 General.sleep(1300, 2330);
  141.             }
  142.         }
  143.     }
  144.  
  145.     private static void healUp() {
  146.        
  147.         if(Inventory.find(FOOD_NAME).length > 0){
  148.             eatFood();
  149.            
  150.         }
  151.        
  152.         else if(openBank()){
  153.            
  154.             if(Inventory.isFull()){
  155.                 if(Banking.deposit(getFoodCount(), ESSENCE_TYPE)){
  156.                     General.sleep(800, 1300);
  157.                 }
  158.             }
  159.            
  160.             else {
  161.                 getFood();
  162.             }
  163.            
  164.         }
  165.     }
  166.  
  167.     private static void getFood() {
  168.        
  169.         if(Banking.find(FOOD_NAME).length > 0){
  170.             if(Banking.withdraw(getFoodCount(), FOOD_NAME)){
  171.                 General.sleep(1300, 2330);
  172.             }
  173.         }
  174.          
  175.         else {
  176.             General.println("Out of food thanks for using!");
  177.             running = false;
  178.         }
  179.     }
  180.  
  181.     private static void eatFood() {
  182.        
  183.         if(Banking.close()){
  184.             if(Clicking.click(Inventory.find(FOOD_NAME))){
  185.                 General.sleep(900, 2900);
  186.             }
  187.         }
  188.     }
  189.  
  190.     private static void depositInventory() {
  191.        
  192.         if(openBank()){
  193.             Banking.depositAllExcept(POUCHES);
  194.            
  195.         }
  196.     }
  197.  
  198.     public static boolean openBank() {
  199.        
  200.         return Banking.isBankScreenOpen() || Banking.openBank();
  201.     }
  202.  
  203.     public static boolean pouchesFilled() {
  204.        
  205.         return ((Inventory.find(POUCHES[3]).length > 0)
  206.                     ? Game.getSetting(SMALL_POUCH_SETTING) >= SMALL_FILLED_ID : true)
  207.                 &&
  208.                 ((Inventory.find(POUCHES[2]).length > 0)
  209.                         ? Game.getSetting(MED_POUCH_SETTING) >= MED_FILLED_ID : true)
  210.                 &&
  211.                 ((Inventory.find(POUCHES[1]).length > 0)
  212.                         ? Game.getSetting(LRG_POUCH_SETTING) >= LRG_FILLED_ID : true)            
  213.                 &&
  214.                 ((Inventory.find(POUCHES[0]).length > 0)
  215.                         ? Game.getSetting(GIANT_POUCH_SETTING) >= GIANT_FILLED_ID : true);
  216.     }
  217.  
  218.     private static void storeEssence() {
  219.  
  220.         for (RSItem e : Inventory.find(POUCHES)) {
  221.            
  222.             if (e != null) {            
  223.                 if (e.getDefinition().getName().contains("Small")) {
  224.                     if (Game.getSetting(SMALL_POUCH_SETTING) < SMALL_FILLED_ID) {
  225.                         if (Clicking.click(FILL_POUCH, e)) {
  226.                             General.sleep(400, 1700);
  227.                         }
  228.                     }
  229.                 }
  230.                
  231.                 else if (e.getDefinition().getName().contains("Medium")) {
  232.                     if (Game.getSetting(MED_POUCH_SETTING) < MED_FILLED_ID) {
  233.                         if (Clicking.click(FILL_POUCH, e)) {
  234.                             General.sleep(400, 1700);
  235.                         }
  236.                     }
  237.                 }
  238.                
  239.                 else if (e.getDefinition().getName().contains("Large")) {
  240.                     if (Game.getSetting(LRG_POUCH_SETTING) < LRG_FILLED_ID) {
  241.                         if (Clicking.click(FILL_POUCH, e)) {
  242.                             General.sleep(400, 1700);
  243.                         }
  244.                     }
  245.                 }
  246.                
  247.                 else if (e.getDefinition().getName().contains("Giant")) {
  248.                     if (Game.getSetting(GIANT_POUCH_SETTING) < GIANT_FILLED_ID) {
  249.                         if (Clicking.click(FILL_POUCH, e)) {
  250.                             General.sleep(400, 1700);
  251.                         }
  252.                     }
  253.                 }            
  254.             }
  255.         }
  256.     }
  257. }
Add Comment
Please, Sign In to add comment