Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Scripts;
- import java.awt.Graphics;
- import org.dreambot.api.methods.Calculations;
- import org.dreambot.api.methods.container.impl.bank.BankLocation;
- import org.dreambot.api.methods.map.Area;
- import org.dreambot.api.methods.map.Tile;
- import org.dreambot.api.methods.skills.Skill;
- import org.dreambot.api.script.AbstractScript;
- import org.dreambot.api.script.ScriptManifest;
- import org.dreambot.api.utilities.Timer;
- import org.dreambot.api.script.Category;
- import org.dreambot.api.wrappers.interactive.GameObject;
- @ScriptManifest(author = "henrique190", name = "CortadorBasico", version = 1.0, description = "Corta logs acima de draynor", category = Category.WOODCUTTING)
- public class main extends AbstractScript {
- String log = "Iniciando o script";
- Timer tempo;
- int cont = 0;
- int logsgained;
- Tile tileLumb = new Tile(5287, 2704);
- Tile tiledraynorbank = new Tile(11055,4782);
- Area arvoreArea = new Area(new Tile(3074, 3265), new Tile(3086, 3264), new Tile(3086, 3276), new Tile(3077, 3278),
- new Tile(3073, 3274));
- Area willowArea = new Area(new Tile(3055, 3251), new Tile(3064, 3251), new Tile(3064, 3258), new Tile(3056, 3257));
- GameObject depositbox; // depositbox
- Tile depositboxtile = new Tile(3045, 3234); // tile of the depositbox
- Skill wc = Skill.WOODCUTTING;
- String axes[] = {"Bronze axe","Iron axe", "Steel axe", "Black axe", "Mithril axe", "Adamant axe", "Rune axe", "Dragon axe"};
- BankLocation bankLocation;
- // private void getAxe(String a) {
- // if (tiledraynorbank.distance(getLocalPlayer()) <= 4) {
- // if (getBank().isOpen()) {
- // log = "Retirando";
- // getBank().withdraw(a);
- //
- // } else {
- // getBank().open();
- // getBank().withdraw(a);
- // }
- //
- // } else {
- // log = "indo trocar axe";
- // getWalking().walk(tiledraynorbank);
- // sleep(Calculations.random(1827, 2482));
- // }
- //
- //
- // }
- /*private void checkAxes(String a[], int lvl){
- if(lvl <= 20 && !getInventory().contains(a[0])) {
- getAxe(a[0]);
- }else if(lvl >= 20 && lvl <= 30 && !getInventory().contains(a[4])) {
- getAxe(a[4]);
- }else if(lvl >= 31 && lvl <= 40 && !getInventory().contains(a[5])) {
- getAxe(a[5]);
- }
- else if(lvl >= 41 && !getInventory().contains(a[6])) {
- getAxe(a[6]);
- }
- }*/
- private int verificalvl() {
- int lvl = getSkills().getRealLevel(wc);
- return lvl;
- }
- private String verificaTipo(int a) {
- String tipo = "";
- if (a >= 30) {
- tipo = "Willow";
- return tipo;
- } else {
- tipo = "Tree";
- return tipo;
- }
- }
- private Area verificaArea(String a) {
- if (a == "Tree") {
- return arvoreArea;
- } else {
- return willowArea;
- }
- }
- private void chopTree(String nameOfTree) {
- GameObject tree = getGameObjects()
- .closest(gameObject -> gameObject != null && gameObject.getName().equals(nameOfTree));
- if (tree != null && tree.interact("Chop down")) {
- int countLog = getInventory().count("Logs");
- sleepUntil(() -> getInventory().count("Logs") > countLog, 12000);
- }
- }
- public void onStart() {
- // TODO Auto-generated method stub
- super.onStart();
- tempo = new Timer();
- }
- @Override
- public int onLoop() {
- if (!getInventory().isFull()) {
- //checkAxes(axes, verificalvl());
- if (verificaArea(verificaTipo(verificalvl())).contains(getLocalPlayer())) {
- chopTree(verificaTipo(verificalvl()));
- log = "Cortando Tree";
- verificalvl();
- } else {
- getWalking().walk(verificaArea(verificaTipo(verificalvl())).getRandomTile());
- sleep(Calculations.random(1827, 2482));
- log = "Indo para a area";
- }
- } else {
- if (depositboxtile.distance(getLocalPlayer()) <= 4) {
- if (getDepositBox().isOpen()) {
- log = "Depositando";
- getDepositBox().depositAllItems();
- } else {
- log = "Abrindo o Depositador";
- depositbox = getGameObjects().closest(
- d -> d != null && d.getName().equals("Bank deposit box") && d.hasAction("Deposit"));
- depositbox.interact("Deposit");
- sleepUntil(() -> getDepositBox().isOpen(), Calculations.random(929, 1845));
- }
- } else {
- log = "indo depositar";
- getWalking().walk(depositboxtile);
- sleep(Calculations.random(1827, 2482));
- }
- }
- return Calculations.random(500, 600);
- }
- @Override
- public void onPaint(Graphics g) {
- // TODO Auto-generated method stub
- logsgained = (int) Math.floor(getSkillTracker().getGainedExperience(Skill.WOODCUTTING) / 67.5); // Detects
- // chopped logs
- g.drawString("Timer: " + tempo.formatTime(), 20, 200);
- g.drawString("action: " + log, 20, 220);
- g.drawString("WC lvl: " + verificalvl() , 20, 260);
- g.drawString("Cortando: " + verificaTipo(verificalvl()) , 20, 280);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement