Advertisement
Aleksander

AeroGildedAltar

Apr 9th, 2013
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.86 KB | None | 0 0
  1. package scripts;
  2.  
  3. import java.awt.Graphics;
  4. import java.awt.Point;
  5.  
  6. import org.tribot.api.Timing;
  7. import org.tribot.api.input.Keyboard;
  8. import org.tribot.api.input.Mouse;
  9. import org.tribot.api.types.generic.Condition;
  10. import org.tribot.api.types.generic.Filter;
  11. import org.tribot.api2007.Banking;
  12. import org.tribot.api2007.Camera;
  13. import org.tribot.api2007.Interfaces;
  14. import org.tribot.api2007.Inventory;
  15. import org.tribot.api2007.Objects;
  16. import org.tribot.api2007.Player;
  17. import org.tribot.api2007.Projection;
  18. import org.tribot.api2007.Walking;
  19. import org.tribot.api2007.types.RSItem;
  20. import org.tribot.api2007.types.RSObject;
  21. import org.tribot.api2007.types.RSTile;
  22. import org.tribot.script.Script;
  23. import org.tribot.script.interfaces.Painting;
  24.  
  25. public class AeroGildedAltar extends Script implements Painting {
  26.    
  27.     public static RSTile[] yanillePath = new RSTile[] {
  28.         new RSTile(2610, 3093),
  29.         new RSTile(2598, 3098),
  30.         new RSTile(2586, 3097),
  31.         new RSTile(2575, 3090),
  32.         new RSTile(2560, 3089),
  33.         new RSTile(2545, 3091)
  34.     };
  35.     public static RSTile[] yanillePathReverse;
  36.    
  37.     public static int ITEM_BIG_BONES = 532;
  38.    
  39.     public static int OBJECT_EXIT_PORTAL = 13405;
  40.     public static int OBJECT_YANILLE_PORTAL = 15482;
  41.     public static int OBJECT_BANK_BOOTH = 2213;
  42.    
  43.     public static String NAME = "Goodwin";
  44.    
  45.     @Override
  46.     public void run() {
  47.         if (!onStart()) {
  48.             stopScript();
  49.         } else {
  50.             while (true) {
  51.                 loop();
  52.             }
  53.         }
  54.     }
  55.    
  56.     public boolean onStart()
  57.     {
  58.         Mouse.setSpeed(100);
  59.         yanillePathReverse = reversePath(yanillePath);
  60.         return true;
  61.     }
  62.    
  63.     public void loop()
  64.     {
  65.         RSObject[] portalObject = Objects.find(20, OBJECT_YANILLE_PORTAL);
  66.         RSObject[] altairObject = Objects.find(20, new Filter<RSObject>() {
  67.  
  68.             @Override
  69.             public boolean accept(RSObject arg0) {
  70.                 return arg0.getID() == 13197;
  71.             }
  72.            
  73.         });
  74.         if (Inventory.find(ITEM_BIG_BONES).length > 0) {
  75.             if (altairObject.length > 0) {
  76.                 if (Interfaces.get(399) == null) {
  77.                     if (Player.getPosition().distanceTo(altairObject[0].getPosition()) > 5) {
  78.                         Walking.walkTo(altairObject[0].getPosition());
  79.                     } else if (altairObject[0].isOnScreen()) {
  80.                         RSItem[] bones = Inventory.find(ITEM_BIG_BONES);
  81.                         if (bones[0].click("use")) {
  82.                             if (altairObject[0].click("-> Altar")) {
  83.                                 Timing.waitCondition(new Condition() {
  84.                                    
  85.                                     @Override
  86.                                     public boolean active() {
  87.                                         return Player.getAnimation() == 3705;
  88.                                     }
  89.                                 }, 2000);
  90.                             }
  91.                         }
  92.                     } else {
  93.                         Camera.turnToTile(altairObject[0].getPosition());
  94.                     }
  95.                 }
  96.             } else if (Interfaces.get(232, 3) != null) {
  97.                 if (Interfaces.get(232, 3).click("Continue")) {
  98.                     sleep(1750, 2000);
  99.                     Keyboard.typeSend(NAME);
  100.                     sleep(2000, 3000);
  101.                 }
  102.             } else if (portalObject.length > 0) {
  103.                 if (portalObject[0].isOnScreen()) {
  104.                     if (!Player.isMoving()) {
  105.                         Camera.setCameraAngle(0);
  106.                         Point point = Projection.tileToScreen(portalObject[0].getPosition(), 10);
  107.                         Mouse.click(new Point(point.x + 1, point.y), 1);
  108.                     }
  109.                 } else {
  110.                     Camera.turnToTile(portalObject[0].getPosition());
  111.                     Walking.walkTo(portalObject[0].getPosition());
  112.                 }
  113.             } else {
  114.                 Walking.walkPath(yanillePath);
  115.             }
  116.         } else {
  117.             RSObject[] exitportal = Objects.find(20, OBJECT_EXIT_PORTAL);
  118.             RSObject[] bankbooth = Objects.find(20, OBJECT_BANK_BOOTH);
  119.             if (exitportal.length > 0) {
  120.                 if (exitportal[0].isOnScreen()) {
  121.                     if (!Player.isMoving()) {
  122.                         Camera.setCameraAngle(0);
  123.                         Point point = Projection.tileToScreen(exitportal[0].getPosition(), 10);
  124.                         Mouse.click(new Point(point.x + 1, point.y), 1);
  125.                     }
  126.                 } else {
  127.                     Walking.walkTo(exitportal[0].getPosition());
  128.                     Camera.turnToTile(exitportal[0].getPosition());
  129.                 }
  130.             } else if (bankbooth.length > 0) {
  131.                 if (bankbooth[0].isOnScreen()) {
  132.                     if (!Banking.isBankScreenOpen()) {
  133.                         if (bankbooth[0].click("Bank")) {
  134.                             Timing.waitCondition(new Condition() {
  135.                                
  136.                                 @Override
  137.                                 public boolean active() {
  138.                                     return Banking.isBankScreenOpen();
  139.                                 }
  140.                             }, 2000);
  141.                         }
  142.                     } else {
  143.                         if (Inventory.getCount(ITEM_BIG_BONES) > 0) {
  144.                             Banking.close();
  145.                         } else {
  146.                             if (Banking.find(ITEM_BIG_BONES)[0].click("Withdraw All")) {
  147.                                 Banking.close();
  148.                             }
  149.                         }
  150.                     }
  151.                 } else {
  152.                     Camera.turnToTile(bankbooth[0].getPosition());
  153.                 }
  154.             } else {
  155.                 Walking.walkPath(yanillePathReverse);
  156.             }
  157.         }
  158.     }
  159.     @Override
  160.     public void onPaint(Graphics arg0) {
  161.         // TODO Auto-generated method stub
  162.        
  163.     }
  164.  
  165.     public static RSTile[] reversePath(RSTile[] path) {
  166.         RSTile[] reverse = new RSTile[path.length];
  167.         int index = 0;
  168.         for (int i = path.length - 1; i >= 0; i--) {
  169.             if(path[i] == null) {
  170.                 continue;
  171.             }
  172.             reverse[index] = path[i];
  173.             index++;
  174.         }
  175.         return reverse;
  176.     }
  177.    
  178. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement