joedezzy1

Untitled

Jul 29th, 2014
465
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.83 KB | None | 0 0
  1. package scripts.airRunecrafter;
  2.  
  3. import org.tribot.api.Clicking;
  4. import org.tribot.api.General;
  5. import org.tribot.api.Timing;
  6. import org.tribot.api.types.generic.Condition;
  7. import org.tribot.api.util.ABCUtil;
  8. import org.tribot.api2007.Banking;
  9. import org.tribot.api2007.Game;
  10. import org.tribot.api2007.Inventory;
  11. import org.tribot.api2007.Objects;
  12. import org.tribot.api2007.Player;
  13. import org.tribot.api2007.Skills;
  14. import org.tribot.api2007.WebWalking;
  15. import org.tribot.api2007.types.RSObject;
  16. import org.tribot.api2007.types.RSTile;
  17. import org.tribot.script.Script;
  18.  
  19. public class Main extends Script {
  20.  
  21.     public static boolean running = true;
  22.     private STATE state;
  23.     private String ESSENCE_TYPE = "Pure essence";
  24.     private String TALISMAN = "Air talisman";
  25.     private String AIR_RUNES = "Air runes";
  26.     private RSTile RUINS_POS = new RSTile(2984, 3291, 0);
  27.     private RSTile ALTAR_POS = new RSTile(2987, 3294, 0);
  28.     private ABCUtil abc;
  29.  
  30.     enum STATE {
  31.         CRAFTING,
  32.         DEPOSITING,
  33.         WITHDRAWING,
  34.         TO_BANK,
  35.         EXITING_RUINS,
  36.         ENTERING_RUINS,
  37.         TO_ALTAR,
  38.         WAITING    
  39.     }
  40.    
  41.     @Override
  42.     public void run() {
  43.         implementAntiban();
  44.         while (running) {
  45.             executeSlave(600, 900);
  46.             antiban();
  47.         }
  48.     }
  49.    
  50.     public void implementAntiban() {
  51.         General.useAntiBanCompliance(true);
  52.         abc = new ABCUtil();
  53.     }
  54.  
  55.     private STATE getState() {
  56.         if (Banking.isInBank() && Inventory.find(ESSENCE_TYPE).length < 1){
  57.             if (Inventory.find(AIR_RUNES).length > 0) {
  58.                 return STATE.DEPOSITING;
  59.             }
  60.             else if (Inventory.find(ESSENCE_TYPE).length < 1) {
  61.                 return STATE.WITHDRAWING;  
  62.             }
  63.         }
  64.         else if (!atRuins() && Inventory.find(ESSENCE_TYPE).length < 1) {
  65.             return STATE.TO_ALTAR;
  66.         }
  67.         else if (atRuins() && Inventory.find(ESSENCE_TYPE).length < 1) {
  68.             return STATE.ENTERING_RUINS;
  69.         }
  70.         else if (inAltar()) {
  71.             if (Inventory.find(ESSENCE_TYPE).length > 0) {
  72.                 return STATE.CRAFTING;
  73.             }
  74.             else {
  75.                 return STATE.EXITING_RUINS;
  76.             }
  77.         }
  78.         else {
  79.             return STATE.TO_BANK;      
  80.         }
  81.         return STATE.WAITING;
  82.     }
  83.  
  84.     private boolean atRuins() {
  85.         RSObject[] ruins = Objects.getAt(RUINS_POS);
  86.         return ruins.length > 0 && ruins[0].isOnScreen();
  87.     }
  88.  
  89.     private boolean inAltar() {
  90.         RSObject[] altar = Objects.find(30, "Altar");
  91.         return altar.length > 0;
  92.     }
  93.  
  94.     private void executeSlave(int s1, int s2) {
  95.         state = getState();
  96.         switch (state) {
  97.         case CRAFTING:
  98.             DezUtils.interactObject("Altar", null, 10, new Condition() {
  99.                 @Override
  100.                 public boolean active() {
  101.                     return Inventory.find(ESSENCE_TYPE).length < 1;
  102.                 }          
  103.             }, General.random(4600, 7500));
  104.             break;
  105.         case DEPOSITING:
  106.             deposit();
  107.             break;
  108.         case ENTERING_RUINS:
  109.             enterRuins();
  110.             break;
  111.         case EXITING_RUINS:
  112.             DezUtils.interactObject("Portal", null, 10, new Condition() {
  113.                 @Override
  114.                 public boolean active() {
  115.                     return !inAltar();
  116.                 }          
  117.             }, General.random(4600, 7500));
  118.             break;
  119.         case TO_ALTAR:
  120.             DezUtils.takePath(ALTAR_POS);
  121.             break;
  122.         case TO_BANK:
  123.             if (!Player.isMoving()) WebWalking.walkToBank();
  124.             break;
  125.         case WAITING:
  126.             break;
  127.         case WITHDRAWING:
  128.             DezUtils.withdrawItem(ESSENCE_TYPE, null, 28 - Inventory.getAll().length, true);
  129.             break;
  130.         default:
  131.             break;         
  132.         }
  133.         sleep(s1, s2);
  134.     }
  135.    
  136.     private void enterRuins() {
  137.         if (Inventory.find(TALISMAN).length > 0 && !Game.getUptext().contains("Use")) {
  138.             Clicking.click(Inventory.find(TALISMAN));
  139.         }      
  140.         else {
  141.             DezUtils.interactObject(RUINS_POS, null, new Condition() {
  142.                 @Override
  143.                 public boolean active() {
  144.                     return inAltar();
  145.                 }              
  146.             }, General.random(4600, 7600));
  147.         }
  148.     }
  149.  
  150.     private void deposit() {
  151.         if (!Banking.isBankScreenOpen()) {
  152.             Banking.openBank();
  153.         }
  154.         else {
  155.             Banking.depositAllExcept(TALISMAN);
  156.         }
  157.     }
  158.  
  159.     public void antiban() {
  160.         checkXp();
  161.         ranRightClick();
  162.         checkEquipment();
  163.         checkFl();
  164.         checkMusic();
  165.         rotateCam();
  166.         ranMouseMoves();
  167.         examineObj();
  168.         pickUpMouse();
  169.         leaveGame();      
  170.     }
  171.  
  172.     public final void rotateCam() {
  173.         if (abc.TIME_TRACKER.ROTATE_CAMERA.next() <= Timing.currentTimeMillis()){
  174.             abc.performRotateCamera();
  175.         }
  176.     }
  177.  
  178.     public void checkXp() {
  179.         if (abc.TIME_TRACKER.CHECK_XP.next() <= Timing.currentTimeMillis()){
  180.             abc.performXPCheck(Skills.SKILLS.RUNECRAFTING);
  181.         }
  182.     }
  183.  
  184.     public final void pickUpMouse() {
  185.         if (abc.TIME_TRACKER.PICKUP_MOUSE.next() <= Timing.currentTimeMillis()){
  186.             abc.performPickupMouse();
  187.         }
  188.     }
  189.  
  190.     public void leaveGame() {
  191.         if (abc.TIME_TRACKER.LEAVE_GAME.next() <= Timing.currentTimeMillis()){
  192.             abc.performLeaveGame();
  193.             sleep(14000,30000);
  194.         }
  195.     }
  196.  
  197.     public void examineObj() {
  198.         if (abc.TIME_TRACKER.EXAMINE_OBJECT.next() <= Timing.currentTimeMillis()){
  199.             abc.performExamineObject();
  200.         }
  201.     }
  202.  
  203.     public void ranRightClick() {
  204.         if (abc.TIME_TRACKER.RANDOM_RIGHT_CLICK.next() <= Timing.currentTimeMillis()){
  205.             abc.performRandomRightClick();
  206.         }
  207.     }
  208.  
  209.     public void ranMouseMoves() {
  210.         if (abc.TIME_TRACKER.RANDOM_MOUSE_MOVEMENT.next() <= Timing.currentTimeMillis()){
  211.             abc.performRandomMouseMovement();
  212.         }
  213.     }
  214.  
  215.     public void checkEquipment() {
  216.         if (abc.TIME_TRACKER.CHECK_EQUIPMENT.next() <= Timing.currentTimeMillis()){
  217.             abc.performEquipmentCheck();
  218.         }
  219.     }
  220.  
  221.     public final void checkFl() {
  222.         if (abc.TIME_TRACKER.CHECK_FRIENDS.next() <= Timing.currentTimeMillis()){
  223.             abc.performFriendsCheck();
  224.         }
  225.     }
  226.  
  227.     public final void checkMusic() {
  228.         if (abc.TIME_TRACKER.CHECK_MUSIC.next() <= Timing.currentTimeMillis()){
  229.             abc.performMusicCheck();
  230.         }
  231.     }
  232. }
Advertisement
Add Comment
Please, Sign In to add comment