Advertisement
Guest User

CortadorBasico v1

a guest
Feb 27th, 2018
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.74 KB | None | 0 0
  1. package Scripts;
  2.  
  3. import java.awt.Graphics;
  4.  
  5. import org.dreambot.api.methods.Calculations;
  6. import org.dreambot.api.methods.container.impl.bank.BankLocation;
  7. import org.dreambot.api.methods.map.Area;
  8. import org.dreambot.api.methods.map.Tile;
  9. import org.dreambot.api.methods.skills.Skill;
  10. import org.dreambot.api.script.AbstractScript;
  11. import org.dreambot.api.script.ScriptManifest;
  12. import org.dreambot.api.utilities.Timer;
  13. import org.dreambot.api.script.Category;
  14. import org.dreambot.api.wrappers.interactive.GameObject;
  15.  
  16. @ScriptManifest(author = "henrique190", name = "CortadorBasico", version = 1.0, description = "Corta logs acima de draynor", category = Category.WOODCUTTING)
  17. public class main extends AbstractScript {
  18.  
  19.     String log = "Iniciando o script";
  20.     Timer tempo;
  21.     int cont = 0;
  22.     int logsgained;
  23.     Tile tileLumb = new Tile(5287, 2704);
  24.     Tile tiledraynorbank = new Tile(11055,4782);
  25.     Area arvoreArea = new Area(new Tile(3074, 3265), new Tile(3086, 3264), new Tile(3086, 3276), new Tile(3077, 3278),
  26.             new Tile(3073, 3274));
  27.     Area willowArea = new Area(new Tile(3055, 3251), new Tile(3064, 3251), new Tile(3064, 3258), new Tile(3056, 3257));
  28.     GameObject depositbox; // depositbox
  29.     Tile depositboxtile = new Tile(3045, 3234); // tile of the depositbox
  30.     Skill wc = Skill.WOODCUTTING;
  31.     String axes[] = {"Bronze axe","Iron axe", "Steel axe", "Black axe", "Mithril axe", "Adamant axe", "Rune axe", "Dragon axe"};
  32.     BankLocation bankLocation;
  33.    
  34.    
  35.    
  36. //  private void getAxe(String a) {
  37. //      if (tiledraynorbank.distance(getLocalPlayer()) <= 4) {
  38. //          if (getBank().isOpen()) {
  39. //              log = "Retirando";
  40. //              getBank().withdraw(a);
  41. //
  42. //          } else {
  43. //              getBank().open();
  44. //              getBank().withdraw(a);
  45. //          }
  46. //             
  47. //      } else {
  48. //          log = "indo trocar axe";
  49. //          getWalking().walk(tiledraynorbank);
  50. //          sleep(Calculations.random(1827, 2482));
  51. //      }
  52. //     
  53. //     
  54. //  }
  55.    
  56.     /*private void checkAxes(String a[], int lvl){
  57.         if(lvl <= 20 && !getInventory().contains(a[0])) {
  58.             getAxe(a[0]);
  59.         }else if(lvl >= 20 && lvl <= 30 && !getInventory().contains(a[4])) {
  60.             getAxe(a[4]);
  61.         }else if(lvl >= 31 && lvl <= 40 && !getInventory().contains(a[5])) {
  62.             getAxe(a[5]);
  63.         }
  64.         else if(lvl >= 41 && !getInventory().contains(a[6])) {
  65.             getAxe(a[6]);
  66.         }
  67.     }*/
  68.    
  69.     private int verificalvl() {
  70.         int lvl = getSkills().getRealLevel(wc);
  71.         return lvl;
  72.     }
  73.  
  74.     private String verificaTipo(int a) {
  75.         String tipo = "";
  76.         if (a >= 30) {
  77.             tipo = "Willow";
  78.             return tipo;
  79.         } else {
  80.             tipo = "Tree";
  81.             return tipo;
  82.         }
  83.     }
  84.  
  85.     private Area verificaArea(String a) {
  86.         if (a == "Tree") {
  87.             return arvoreArea;
  88.  
  89.         } else {
  90.             return willowArea;
  91.         }
  92.  
  93.     }
  94.  
  95.     private void chopTree(String nameOfTree) {
  96.         GameObject tree = getGameObjects()
  97.                 .closest(gameObject -> gameObject != null && gameObject.getName().equals(nameOfTree));
  98.         if (tree != null && tree.interact("Chop down")) {
  99.             int countLog = getInventory().count("Logs");
  100.             sleepUntil(() -> getInventory().count("Logs") > countLog, 12000);
  101.         }
  102.     }
  103.  
  104.     public void onStart() {
  105.         // TODO Auto-generated method stub
  106.         super.onStart();
  107.         tempo = new Timer();
  108.     }
  109.  
  110.     @Override
  111.     public int onLoop() {
  112.        
  113.             if (!getInventory().isFull()) {
  114.                 //checkAxes(axes, verificalvl());
  115.                 if (verificaArea(verificaTipo(verificalvl())).contains(getLocalPlayer())) {
  116.    
  117.                     chopTree(verificaTipo(verificalvl()));
  118.                     log = "Cortando Tree";
  119.                     verificalvl();
  120.    
  121.                 } else {
  122.    
  123.                     getWalking().walk(verificaArea(verificaTipo(verificalvl())).getRandomTile());
  124.                     sleep(Calculations.random(1827, 2482));
  125.                     log = "Indo para a area";
  126.                 }
  127.    
  128.             } else {
  129.                 if (depositboxtile.distance(getLocalPlayer()) <= 4) {
  130.                     if (getDepositBox().isOpen()) {
  131.                         log = "Depositando";
  132.                         getDepositBox().depositAllItems();
  133.    
  134.                     } else {
  135.                         log = "Abrindo o Depositador";
  136.                         depositbox = getGameObjects().closest(
  137.                                 d -> d != null && d.getName().equals("Bank deposit box") && d.hasAction("Deposit"));
  138.                         depositbox.interact("Deposit");
  139.                         sleepUntil(() -> getDepositBox().isOpen(), Calculations.random(929, 1845));
  140.                     }
  141.                 } else {
  142.                     log = "indo depositar";
  143.                     getWalking().walk(depositboxtile);
  144.                     sleep(Calculations.random(1827, 2482));
  145.                 }
  146.    
  147.             }
  148.  
  149.         return Calculations.random(500, 600);
  150.     }
  151.  
  152.     @Override
  153.     public void onPaint(Graphics g) {
  154.         // TODO Auto-generated method stub
  155.         logsgained = (int) Math.floor(getSkillTracker().getGainedExperience(Skill.WOODCUTTING) / 67.5); // Detects
  156.                                                                                                         // chopped logs
  157.         g.drawString("Timer: " + tempo.formatTime(), 20, 200);
  158.         g.drawString("action: " + log, 20, 220);
  159.         g.drawString("WC lvl: " + verificalvl() , 20, 260);
  160.         g.drawString("Cortando: " + verificaTipo(verificalvl()) , 20, 280);
  161.     }
  162. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement