joedezzy1

Untitled

Jul 30th, 2014
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 6.52 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.     public static void gearUp() {      
  16.         if (Inventory.find(Crafter.RUNE_TYPE).length > 0 || Inventory.find("Amulet of glory").length > 0 ) {
  17.             depositInventory();        
  18.         }      
  19.         else if (Skills.getCurrentLevel(SKILLS.HITPOINTS) <= Crafter.SAFE_HEALTH) {
  20.             healUp();          
  21.         }        
  22.         else if (Crafter.usingEnergyPotion && needEnergyPotion()) {
  23.             if(!ENERGY_ITEM.equals("Resting")) {
  24.             getEnergy();
  25.             }
  26.             else {
  27.             General.sleep(10000);
  28.         Camera.setRotation(General.random(0, 360));
  29.             }
  30.         }        
  31.         else if (!Equipment.isEquipped(GLORY)) {
  32.             getGlory();        
  33.         }
  34.         else if (usingEmergencyTeleport && Inventory.find(TELE_TABS).length < 1) {
  35.             getEmergenyTeleport();
  36.         }
  37.         else if (Inventory.find(POUCHES).length > 0 &&!pouchesFilled()) {
  38.             fillPouches();
  39.         }
  40.         else if (Inventory.find(ESSENCE_TYPE).length < Inventory.find(ESSENCE_TYPE).length
  41.                                 + (28 - Inventory.getAll().length)) {
  42.             getEssence();          
  43.         }
  44.     }
  45.    
  46.     private static void getEssence() {     
  47.         if(openBank()){
  48.             if(Banking.withdraw(inventorySpace(), ESSENCE_TYPE)){
  49.                 General.sleep(1200, 2100);
  50.             }
  51.         }
  52.     }
  53.  
  54.     private static void getEmergenyTeleport() {    
  55.         if(openBank()){
  56.             if(Banking.withdraw(1, TELE_TABS)){
  57.             General.sleep(1200, 2100);
  58.             }    
  59.     }
  60.     }
  61.  
  62.     private static void fillPouches() {    
  63.         if(Inventory.find(ESSENCE_TYPE).length < 4){
  64.             if(openBank()){
  65.             if(Banking.withdraw(inventorySpace(), ESSENCE_TYPE)){
  66.                 General.sleep(1200, 2100);
  67.                 }
  68.             }          
  69.         }      
  70.         else if(Banking.close()){
  71.             storeEssence();        
  72.         }
  73.     }
  74.  
  75.     private static void getGlory() {       
  76.         if(Inventory.find(GLORY).length > 0){
  77.             if(Banking.close()){
  78.             if(Clicking.click(Inventory.find(GLORY))){
  79.                 General.sleep(2200, 4200);
  80.             }
  81.             }          
  82.         }      
  83.         else if(openBank()){
  84.             if(Banking.find(GLORY).length > 0){
  85.             if(Banking.withdraw(1, GLORY)){
  86.                 General.sleep(1300, 2330);
  87.             }          
  88.             }          
  89.             else {
  90.             GloryRechargeNavigator.start();        
  91.             }
  92.         }
  93.     }
  94.  
  95.     private static void getEnergy() {
  96.     RSItem[] energy = Inventory.find(ENERGY_ITEMS);    
  97.         if(energy.length > 0){
  98.             if(Banking.close()){
  99.             if(Clicking.click(energy[0])){
  100.                 General.sleep(2200, 4200);
  101.             }
  102.             }          
  103.         }      
  104.         else if(openBank()){
  105.             if(Banking.withdraw(1, ENERGY_ITEMS)){
  106.             General.sleep(1300, 2330);
  107.             }
  108.         }
  109.     }
  110.  
  111.     private static void healUp() {     
  112.         if(Inventory.find(FOOD_NAME).length > 0){
  113.             eatFood();         
  114.         }        
  115.         else if(openBank()){        
  116.             if(Inventory.isFull()){
  117.             if(Banking.deposit(getFoodCount(), ESSENCE_TYPE)){
  118.                 General.sleep(800, 1300);
  119.             }
  120.             }      
  121.             else {
  122.             getFood();
  123.             }          
  124.         }
  125.     }
  126.  
  127.     private static void getFood() {    
  128.     if(Banking.find(FOOD_NAME).length > 0){
  129.             if(Banking.withdraw(getFoodCount(), FOOD_NAME)){
  130.             General.sleep(1300, 2330);
  131.             }
  132.     }        
  133.     else {
  134.         General.println("Out of food thanks for using!");
  135.         running = false;
  136.     }
  137.     }
  138.  
  139.     private static void eatFood() {    
  140.     if(Banking.close()){
  141.         if(Clicking.click(Inventory.find(FOOD_NAME))){
  142.         General.sleep(900, 2900);
  143.         }
  144.     }
  145.     }
  146.  
  147.     private static void depositInventory() {    
  148.         if(openBank()){
  149.             Banking.depositAllExcept(POUCHES);      
  150.         }
  151.     }
  152.  
  153.     public static boolean openBank() {     
  154.     return Banking.isBankScreenOpen() || Banking.openBank();
  155.     }
  156.  
  157.     public static boolean pouchesFilled() {        
  158.         return ((Inventory.find(POUCHES[3]).length > 0)
  159.                     ? Game.getSetting(SMALL_POUCH_SETTING) >= SMALL_FILLED_ID : true)
  160.                 &&
  161.                 ((Inventory.find(POUCHES[2]).length > 0)
  162.                         ? Game.getSetting(MED_POUCH_SETTING) >= MED_FILLED_ID : true)
  163.                 &&
  164.                 ((Inventory.find(POUCHES[1]).length > 0)
  165.                         ? Game.getSetting(LRG_POUCH_SETTING) >= LRG_FILLED_ID : true)            
  166.                 &&
  167.                 ((Inventory.find(POUCHES[0]).length > 0)
  168.                         ? Game.getSetting(GIANT_POUCH_SETTING) >= GIANT_FILLED_ID : true);
  169.     }
  170.  
  171.     private static void storeEssence() {
  172.         for (RSItem e : Inventory.find(POUCHES)) {         
  173.             if (e != null) {            
  174.                 if (e.getDefinition().getName().contains("Small")) {
  175.                     if (Game.getSetting(SMALL_POUCH_SETTING) < SMALL_FILLED_ID) {
  176.                         if (Clicking.click(FILL_POUCH, e)) {
  177.                             General.sleep(400, 1700);
  178.                         }
  179.                     }
  180.                 }              
  181.                 else if (e.getDefinition().getName().contains("Medium")) {
  182.                     if (Game.getSetting(MED_POUCH_SETTING) < MED_FILLED_ID) {
  183.                         if (Clicking.click(FILL_POUCH, e)) {
  184.                             General.sleep(400, 1700);
  185.                         }
  186.                     }
  187.                 }              
  188.                 else if (e.getDefinition().getName().contains("Large")) {
  189.                     if (Game.getSetting(LRG_POUCH_SETTING) < LRG_FILLED_ID) {
  190.                         if (Clicking.click(FILL_POUCH, e)) {
  191.                             General.sleep(400, 1700);
  192.                         }
  193.                     }
  194.                 }              
  195.                 else if (e.getDefinition().getName().contains("Giant")) {
  196.                     if (Game.getSetting(GIANT_POUCH_SETTING) < GIANT_FILLED_ID) {
  197.                         if (Clicking.click(FILL_POUCH, e)) {
  198.                             General.sleep(400, 1700);
  199.                         }
  200.                     }
  201.                 }            
  202.             }
  203.         }
  204.     }
  205. }
Advertisement
Add Comment
Please, Sign In to add comment