blahs44

Untitled

Sep 25th, 2013
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.30 KB | None | 0 0
  1. package Woodcutter;
  2.  
  3. import java.awt.Graphics;
  4.  
  5. import org.osbot.script.Script;
  6. import org.osbot.script.ScriptManifest;
  7. import org.osbot.script.rs2.model.Entity;
  8. import org.osbot.script.rs2.model.Player;
  9. import org.osbot.script.rs2.ui.Bank;
  10. import org.osbot.script.rs2.ui.Inventory;
  11. import org.osbot.script.rs2.utility.Area;
  12.  
  13. @ScriptManifest(author = "HighBall", info = "Chops willows at draynor", name = "Woodcutter", version = 0.1)
  14. public class Woodcutter extends Script {
  15.  
  16.         final String WILLOW_NAME = "Willow";
  17.  
  18.         final Area BANK_AREA = new Area(3092, 3240, 3097, 3246);
  19.         final Area WILLOW_AREA = new Area(3081, 3223, 3092, 3239);
  20.  
  21.         final int BANK_BOOTH_ID = 23961;
  22.  
  23.         // code used at start
  24.         public void onStart() {
  25.  
  26.         }
  27.  
  28.         // code to be executted at the end
  29.         public void onExit() {
  30.  
  31.         }
  32.  
  33.         // code in loop
  34.         public int onLoop() throws InterruptedException {
  35.  
  36.                 Inventory inven = client.getInventory();
  37.                 Player player = client.getMyPlayer();
  38.                 Bank bank = client.getBank();
  39.  
  40.                 if (!inven.isFull()) {
  41.                         // chop
  42.  
  43.                         if(WILLOW_AREA.contains(player)){
  44.                         Entity willow = closestObjectForName(WILLOW_NAME);
  45.  
  46.                         if (willow != null) {
  47.                                 if (willow.isVisible()) {
  48.                                         if (!player.isAnimating()) {
  49.                                                 if (!player.isMoving()) {
  50.                                                         willow.interact("Chop down");
  51.                                                         sleep(random(700, 800));
  52.                                                 }
  53.                                         }
  54.                                 } else {
  55.                                         client.moveCameraToEntity(willow);
  56.                                 }
  57.                         }
  58.                         }else{
  59.                                 walk(WILLOW_AREA);
  60.                         }
  61.                 } else {
  62.                         // bank
  63.                         if (BANK_AREA.contains(player)) {
  64.                                 Entity bankbooth = closestObject(BANK_BOOTH_ID);
  65.  
  66.                                 if (bank.isOpen()) {
  67.                                         bank.depositAll();
  68.                                 } else {
  69.                                         if (bankbooth != null) {
  70.                                                 if (bankbooth.isVisible()) {
  71.                                                         bankbooth.interact("Bank");
  72.                                                         sleep(random(700, 800));
  73.                                                 }else{
  74.                                                         client.moveCameraToEntity(bankbooth);
  75.                                                 }
  76.                                         }
  77.                                 }
  78.  
  79.                         } else {
  80.                                 walk(BANK_AREA);
  81.                         }
  82.                 }
  83.  
  84.                 return 50;
  85.         }
  86.  
  87.         // paint
  88.         public void onPaint(Graphics g) {
  89.  
  90.         }
  91.  
  92. }
Advertisement
Add Comment
Please, Sign In to add comment