Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package zen;
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.Graphics2D;
- import java.awt.RenderingHints;
- import org.dreambot.api.methods.map.Area;
- import org.dreambot.api.methods.skills.Skill;
- import org.dreambot.api.script.AbstractScript;
- import org.dreambot.api.script.Category;
- import org.dreambot.api.script.ScriptManifest;
- import org.dreambot.api.utilities.Timer;
- import org.dreambot.api.wrappers.interactive.GameObject;
- import org.dreambot.api.wrappers.interactive.NPC;
- @ScriptManifest(author = "Pixel", category = Category.WOODCUTTING, description = "It Cuts and banks trees anywhere! :D", name = "PixelCutter", version = 1.1)
- public class Woodcutter extends AbstractScript {
- private GameObject tree;
- private long startTime;
- private NPC banker;
- Area bankArea = new Area(3092, 3240, 3097, 3246, 0);
- Area TreeArea = new Area(3086, 3264, 3074, 3273, 0 );
- public void onStart() {
- getClient().getInstance().setDrawMouse(true);
- getSkillTracker().start(Skill.WOODCUTTING);
- getSkillTracker().start(Skill.WOODCUTTING);
- startTime = System.currentTimeMillis();
- log("Hey this is my first script.");
- log("Hope ya like it! :D");
- }
- @Override
- public int onLoop() {
- tree = getGameObjects ().closest (gameObject -> gameObject != null && gameObject.getName ().equals ("Tree"));
- tree.interact("Chop down");
- int countLog = getInventory().count("Logs");
- sleepUntil(() -> getInventory().count("Logs") > countLog, 8000);
- if(getInventory().isFull()) { //Walking to bank!
- if(bankArea.contains(getLocalPlayer())) { // instead of interacting with a npc you could do the same with a bank booth
- NPC banker = getNpcs().closest(npc -> npc != null && npc.hasAction("Bank"));
- if(banker.interact("Bank")) {
- if(sleepUntil(() -> getBank().isOpen(), 9000))
- getBank().depositAllExcept (item -> item !=null && item.getName().contains("axe"));
- if(sleepUntil(() -> !getInventory().isFull(), 8000)){
- if(getBank().close()){
- sleepUntil(() -> !getBank().isOpen(), 8000);
- }
- }
- }
- }
- }
- return 1000;
- }
- public void onExit() {
- getClient().getInstance().setDrawMouse(true);
- log("Thanks for using my script you sexy beast :)");
- log("If there were any errors please report them on the thread! :P");
- }
- public void onPaint(Graphics2D paint) {
- long runTime = System.currentTimeMillis() - startTime;
- Color blueTrans = new Color(0, 0, 0, 127);
- paint.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- paint.setFont(new Font("RuneScape Chat Regular", Font.PLAIN, 16));
- // paint.drawImage(image, 0, 290, null);
- paint.setColor(blueTrans);
- paint.fillRect(4, 280, 512, 58);
- paint.setColor(Color.WHITE);
- paint.drawString("Pixel Woodcutter v: " +getVersion(), 10, 298);
- paint.drawString("Run Time: " + Timer.formatTime(runTime), 10, 315);
- //paint.drawString("Status: " +status, 10, 332);
- // paint.drawString("Mode: " , 10, 419);
- paint.drawString("EXP: " +getSkillTracker().getGainedExperience(Skill.WOODCUTTING), 195, 298);
- paint.drawString("EXP H/R: " + getSkillTracker().getGainedExperiencePerHour(Skill.WOODCUTTING), 195, 315);
- paint.drawString("TTL: " + Timer.formatTime(getSkillTracker().getTimeToLevel(Skill.WOODCUTTING)), 195, 332);
- // paint.drawString("Profit Made: "+ getPrice(itemID) + " ("+"e"+")", 380, 298);
- paint.drawString("Woodcutting Level: " +getSkills().getRealLevel(Skill.WOODCUTTING) + " ("+getSkillTracker().getGainedLevels(Skill.WOODCUTTING)+")", 380, 315);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement