Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.dreambot.api.input.Mouse;
- import org.dreambot.api.methods.Calculations;
- import org.dreambot.api.methods.container.impl.bank.BankLocation;
- import org.dreambot.api.methods.MethodProvider;
- import org.dreambot.api.methods.filter.Filter;
- import org.dreambot.api.methods.map.Area;
- import org.dreambot.api.methods.map.Tile;
- import org.dreambot.api.methods.widget.Widget;
- import org.dreambot.api.script.AbstractScript;
- import org.dreambot.api.script.Category;
- import org.dreambot.api.script.ScriptManifest;
- import org.dreambot.api.utilities.impl.Condition;
- import org.dreambot.api.wrappers.interactive.GameObject;
- import org.dreambot.api.wrappers.items.Item;
- import org.dreambot.api.wrappers.widgets.WidgetChild;
- @ScriptManifest(category = Category.WOODCUTTING, name = "Cosmic's Woodcutter", author = "Cosmic", version = 3.1)
- public class WoodCut extends AbstractScript{
- int[] worlds = {301, 326, 393};
- public static final String TREE = "Tree";
- public static final String AXE = " axe";
- Area cutArea = new Area(3280,3442, 3274, 3457);
- // TREE cut = TREE.COMMON;
- /* public GameObject getTrees(){
- MethodProvider.log("Looking for trees");
- int[] ids;
- int count =0;
- for(int id: cut.name)
- count+=1;
- ids = new int[count];
- count=0;
- for(int id: cut.name){
- ids[count]=id;
- count+=1;
- }
- return getGameObjects().closest(new Filter<GameObject>(){
- @Override
- public boolean match(GameObject obj) {
- for(int id: ids)
- if(obj.getID()==id)
- return true;
- return false;
- }
- });
- }*/
- @Override
- public void onStart() {
- log("Welcome to Cosmic's Wootcutter!");
- }
- @Override
- public int onLoop() {
- log("sup");
- if(!getLocalPlayer().isAnimating()) {
- if(getInventory().isFull()) {
- if(getBank().isOpen()) {
- getBank().depositAllExcept(item -> item != null && item.getName().contains(AXE));
- sleep(Calculations.random(10000, 60000));
- }else {
- getBank().open(BankLocation.VARROCK_EAST);
- }
- }else if(cutArea.contains(getLocalPlayer())){
- log("tup");
- chopTree("Tree");//issue right here see method
- /* if(tree != null) {
- getCamera().mouseRotateToEntity(tree);
- sleep(Calculations.random(100, 300));
- tree.getClickablePoint();
- tree.interact("Chop down"); */
- int ran = Calculations.random(0,10);
- if (ran == 0) {
- getSkills().open();
- }else if(ran == 1) {
- getWorldHopper().openWorldHopper();
- sleep(Calculations.random(1000,5000));
- int ranr = Calculations.random(0,25);
- if(ranr == 22) {
- getWorldHopper().hopWorld(worlds[Calculations.random(0,2)]);
- }else {
- getWorldHopper().closeWorldHopper();
- }
- }
- sleep(Calculations.random(1500,2000));
- }
- else {
- getWalking().walk(cutArea.getRandomTile());
- }
- }
- return Calculations.random(1000, 5000);
- }
- private void chopTree(String nameOfTree) {
- log("mup");
- GameObject tree = getGameObjects().closest(gameObject -> gameObject != null
- && gameObject.getName().equals(nameOfTree)); // issue right here!
- log("vup");
- if (tree != null && tree.interact("Chop down")) {
- int countLog = getInventory().count("logs");
- sleepUntil(() -> getInventory().count("logs") > countLog, 12000);
- }
- }
- }
- // @Override
- /* public enum TREE{
- COMMON("Tree", 1, new Area());
- private String name;
- private int level;
- private Area area;
- TREE(String name, int level, Area area){
- this.name = name;
- this.level = level;
- this.area = area;
- }
- }*/
Advertisement
Add Comment
Please, Sign In to add comment