Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import java.awt.Graphics;
- import java.awt.Point;
- import java.io.BufferedReader;
- import java.io.InputStreamReader;
- import java.net.URL;
- import java.net.URLConnection;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.util.WindowUtil;
- import org.rsbot.script.wrappers.RSArea;
- import org.rsbot.script.wrappers.RSItem;
- import org.rsbot.script.wrappers.RSObject;
- import org.rsbot.script.wrappers.RSPath;
- import org.rsbot.script.wrappers.RSTile;
- @org.rsbot.script.ScriptManifest(authors = { "Eagledude4" }, name = "EDYewWoodcutter", version = 3, description = "This script is a woodcutter that cuts outside east Varrock, and then banks. Also, feedback, progress reports and new ideas are extremely welcome!")
- public class EDYewWoodcutter extends Script implements PaintListener {
- // Script Variables
- public boolean hasHatchet = false;
- public boolean toldUpdate = false;
- public boolean canStart = false;
- public boolean hatchetEquipped = false;
- public boolean chopping = false;
- public boolean walkedToRoad = false;
- public boolean isAtSouth = false;
- public boolean isAtNorth = false;
- public boolean goingSouth = false;
- public boolean goingNorth = false;
- public boolean didlast1 = false;
- public boolean didlast2 = false;
- public boolean didlast3 = false;
- public boolean didlast4 = false;
- public boolean didlast5 = false;
- public boolean hour10 = false;
- public boolean hour15 = false;
- public boolean hour20 = false;
- public boolean hour25 = false;
- public boolean hour30 = false;
- public boolean hour35 = false;
- public boolean hour40 = false;
- public boolean hour45 = false;
- public boolean hour50 = false;
- public boolean is99 = false;
- public int switched = 0;
- public int runeHatchet = 1359;
- public int dragonHatchet = 6739;
- public RSArea southYewArea = new RSArea(new RSTile(3266, 3466), new RSTile(3276, 3476));
- public RSArea northYewArea = new RSArea(new RSTile(3262, 3489), new RSTile(3272, 3499));
- public RSTile bankLoc = new RSTile(3254, 3420);
- public RSTile roadWalkLoc = new RSTile(3283, 3428);
- public RSTile southYewWalkLoc = new RSTile (3269, 3471);
- public RSTile southYewChopLoc = new RSTile (3271, 3473);
- public RSTile southYewLoc = new RSTile (3271, 3471);
- public RSTile middleLoc = new RSTile(3268, 3481);
- public RSTile northYewChopLoc = new RSTile (3267, 3492);
- public RSTile northYewLoc = new RSTile (3267, 3494);
- //Paint Variables
- public boolean hasBanked = false;
- public boolean displayAntiban = false;
- public int timesBanked = 0;
- public int totalLogsP = 0;
- public int yewPrice = 0;
- public int profit = 0;
- public long startTime = 0;
- public long EXPGained;
- public int startLevel;
- public int startEXP;
- public int levelsGained;
- public String status = "Starting";
- //Paint Methods
- public void onRepaint(Graphics g) {
- if (game.isLoggedIn()) {
- drawMouse(g);
- long millis = System.currentTimeMillis() - startTime;
- long hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- long minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- long seconds = millis / 1000;
- EXPGained = skills.getCurrentExp(8) - startEXP;
- levelsGained = skills.getCurrentLevel(8) - startLevel;
- int x;
- int LTL;
- LTL = skills.getExpToNextLevel(8) / 175;
- int xpTillLvl = skills.getExpToNextLevel(8);
- g.setColor(new Color(0, 0, 0, 150));
- g.fillRect(197, 1, 321, 120);
- g.setColor(Color.YELLOW);
- g.drawString("ED Yew Woodcutter", 305, 20);
- //Left
- x = 200;
- g.setColor(Color.GREEN);
- g.drawString(""+status, x, 40);
- g.setColor(Color.WHITE);
- if (status == "Checking" || status == "Starting") {
- g.drawString("Runtime: 0:0:0", x, 55);
- } else if (status != "Checking" && status != "Starting") {
- g.drawString("Runtime: "+hours+":"+minutes+":"+seconds, x, 55);
- }
- //Center
- x = 300;
- g.setColor(Color.WHITE);
- g.drawString("Current Level: "+skills.getCurrentLevel(8), x, 40);
- if (status == "Checking" || status == "Starting") {
- g.drawString("Levels Gained: 0", x, 55);
- } else {
- g.drawString("Levels Gained: "+levelsGained, x, 55);
- }
- if (status == "Checking" || status == "Starting") {
- g.drawString("EXP Gained: 0", x, 70);
- } else {
- if (EXPGained < 1000) {
- g.drawString("EXP Gained: "+EXPGained+"xp", x, 70);
- } else if (EXPGained > 1000 && EXPGained < 10000) {
- g.drawString("EXP Gained: "+EXPGained / 1000+"k xp", x, 70);
- } else if (EXPGained > 10000 && EXPGained < 100000) {
- g.drawString("EXP Gained: "+EXPGained/ 1000+"k xp", x, 70);
- } else if (EXPGained > 100000 && EXPGained < 1000000) {
- g.drawString("EXP Gained: "+EXPGained / 1000+"k xp", x, 70);
- } else if (EXPGained > 1000000) {
- g.drawString("EXP Gained: "+EXPGained / 1000000+"m xp", x, 70);
- }
- }
- if (is99 == true) {
- g.drawString("Logs till level: 0", x, 85);
- } else if (is99 == false) {
- if (LTL < 1000) {
- g.drawString("Logs till level: "+LTL+"", x, 85);
- } else if (LTL > 1000 && LTL< 10000) {
- g.drawString("Logs till level: "+LTL / 1000+"k", x, 85);
- } else if (LTL > 10000 && LTL < 100000) {
- g.drawString("Logs till level: "+LTL / 1000+"k", x, 85);
- }
- }
- //Right
- x = 415;
- if (timesBanked == 0) {
- g.drawString("Banked: Not Yet", x, 40);
- g.drawString("Logs In Bank: TBA", x, 55);
- } else if (timesBanked == 1) {
- g.drawString("Banked: Once", x, 40);
- } else if (timesBanked > 1) {
- g.drawString("Banked: "+timesBanked+" times", x, 40);
- }
- if (totalLogsP < 1000 && timesBanked != 0) {
- g.drawString("Logs In Bank: "+totalLogsP+"", x, 55);
- } else if (totalLogsP > 1000 && totalLogsP < 10000) {
- g.drawString("Logs In Bank: "+totalLogsP / 1000+"k", x, 55);;
- } else if (totalLogsP > 10000 && totalLogsP < 100000) {
- g.drawString("Logs In Bank: "+totalLogsP / 1000+"k", x, 55);
- } else if (totalLogsP > 100000 && totalLogsP < 1000000) {
- g.drawString("Logs In Bank: "+totalLogsP / 1000+"k", x, 55);
- } else if (totalLogsP > 1000000) {
- g.drawString("Logs In Bank: "+totalLogsP / 1000000+"m", x, 55);
- }
- g.drawString("Log Price: "+yewPrice+" gp", x, 70);
- g.setColor(Color.GREEN);
- if (profit < 1000) {
- g.drawString("Profit: "+profit+" gp", x, 85);
- } else if (profit > 1000 && profit < 10000) {
- g.drawString("Profit: "+profit / 1000+"k", x, 85);
- } else if (profit > 10000 && profit < 100000) {
- g.drawString("Profit: "+profit / 1000+"k", x, 85);
- } else if (profit > 100000 && profit < 1000000) {
- g.drawString("Profit: "+profit / 1000+"k", x, 85);;
- } else if (profit > 1000000) {
- g.drawString("Profit: "+profit / 1000000+"m", x, 85);
- }
- //Progress Bar
- g.setColor(Color.WHITE);
- g.drawRect(202, 94, 311, 21);
- g.setColor(Color.RED);
- g.fillRect(203, 95, 310, 20);
- g.setColor(Color.GREEN);
- g.fillRect(203, 95, (310*skills.getPercentToNextLevel(8))/100, 20);
- g.setColor(Color.BLACK);
- g.drawString(+skills.getPercentToNextLevel(8)+"% -", 290, 109);
- if (xpTillLvl < 1000) {
- g.drawString("Exp till level: "+xpTillLvl+"xp", 330, 109);
- } else if (xpTillLvl > 1000 && xpTillLvl < 10000) {
- g.drawString("Exp till level: "+xpTillLvl / 1000+"k xp", 330, 109);
- } else if (xpTillLvl > 10000 && xpTillLvl < 100000) {
- g.drawString("Exp till level: "+xpTillLvl / 1000+"k xp", 330, 109);
- } else if (xpTillLvl > 100000 && xpTillLvl < 1000000) {
- g.drawString("Exp till level: "+xpTillLvl/ 1000+"k xp", 330, 109);
- } else if (xpTillLvl > 1000000) {
- g.drawString("Exp till level: "+xpTillLvl / 1000000+"m xp", 330, 109);
- }
- //AntiBan Display
- g.setColor(Color.RED);
- if (displayAntiban == true) {
- g.drawString("Antiban", 460, 330);
- } else if (displayAntiban == false) {
- g.drawString("", 460, 330);
- }
- }
- }
- private void drawMouse(final Graphics g) {
- final Point loc = mouse.getLocation();
- if (loc.x < 516) {
- g.setColor(Color.GREEN);
- } else if (loc.x > 516)
- g.setColor(Color.RED);
- g.drawOval(loc.x - 14, loc.y - 14, 28, 28);
- g.fillOval(loc.x - 7, loc.y - 7, 14, 14);
- }
- //Script Methods
- public boolean onStart() {
- if (game.isLoggedIn()) {
- mouse.setSpeed(5);
- if (skills.getCurrentLevel(8) == 99) {
- is99 = true;
- }
- }
- return true;
- }
- public void onFinish() {
- log("Thanks for using my script.");
- return;
- }
- public int loop() {
- RSPath toRoad = walking.getPath(roadWalkLoc);
- RSPath toYews = walking.getPath(southYewWalkLoc);
- RSPath toBank = walking.getPath(bankLoc);
- long millis = System.currentTimeMillis() - startTime;
- long hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- long minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- long seconds = millis / 1000;
- try {
- if (game.isLoggedIn()) {
- camera.setPitch(true);
- if (hatchetEquipped == false) {
- profit = (timesBanked * 27 * yewPrice) + (inventory.getCount(1515) * yewPrice);
- } else if (hatchetEquipped == false) {
- profit = (timesBanked * 28 * yewPrice) + (inventory.getCount(1515) * yewPrice);
- }
- if (hasHatchet == false) {
- game.openTab(4);
- checkInventory();
- }
- if (yewPrice == 0) {
- yewPrice = grandExchange.lookup(1515).getGuidePrice();
- }
- if (hours == 10 && minutes == 0 && seconds == 0) {
- hour10 = true;
- log("Nice, 10 hours! Screenshot :)");
- } else {
- hour10 = false;
- }
- if (hours == 15 && minutes == 0 && seconds == 0) {
- hour15 = true;
- log("Nice, 15 hours! Screenshot :)");
- } else {
- hour15 = false;
- }
- if (hours == 20 && minutes == 0 && seconds == 0) {
- hour20 = true;
- log("Nice, 20 hours! Screenshot :)");
- } else {
- hour20 = false;
- }
- if (hours == 25 && minutes == 0 && seconds == 0) {
- hour25 = true;
- log("Nice, 25 hours! Screenshot :)");
- } else {
- hour25 = false;
- }
- if (hours == 30 && minutes == 0 && seconds == 0) {
- hour30 = true;
- log("Nice, 30 hours! Screenshot :)");
- } else {
- hour30 = false;
- }
- if (hours == 35 && minutes == 0 && seconds == 0) {
- hour35 = true;
- log("Nice, 35 hours! Screenshot :)");
- } else {
- hour35 = false;
- }
- if (hours == 40 && minutes == 0 && seconds == 0) {
- hour40 = true;
- log("Nice, 40 hours! Screenshot :)");
- } else {
- hour40 = false;
- }
- if (hours == 45 && minutes == 0 && seconds == 0) {
- hour45 = true;
- log("Nice, 45 hours! Screenshot :)");
- } else {
- hour45 = false;
- }
- if (hours == 50 && minutes == 0 && seconds == 0) {
- hour50 = true;
- log("Nice, 50 hours! Screenshot :)");
- } else {
- hour50 = false;
- }
- if (hour10 == true || hour15 == true || hour20 == true || hour25 == true || hour30 == true || hour35 == true || hour40 == true || hour45 == true || hour50 == true) {
- env.saveScreenshot(true);
- }
- if (is99 == false && skills.getCurrentLevel(8) == 99) {
- env.saveScreenshot(true);
- log("Grats on 99, Wo0T!");
- is99 = true;
- }
- if (startTime == 0 && skills.getCurrentLevel(8) != 0) {
- startTime = System.currentTimeMillis();
- startLevel = skills.getCurrentLevel(8);
- startEXP = skills.getCurrentExp(8);
- }
- if (calc.distanceTo(bankLoc) <= 5 || calc.distanceTo(southYewWalkLoc) <= 5) {
- walkedToRoad = false;
- }
- if (calc.distanceTo(roadWalkLoc) < 3) {
- walkedToRoad = true;
- }
- if (calc.distanceTo(walking.getDestination()) > 3) {
- sleep(500);
- }
- if (inventory.isFull()) {
- if (calc.distanceTo(bankLoc) <= 5) {
- useBank();
- } else if (getMyPlayer().getLocation().getY() < 3499) {
- if (walkedToRoad == false) {
- status = "Walking";
- toRoad.traverse();
- sleep(random(2000, 2500));
- } else if (walkedToRoad == true) {
- toBank.traverse();
- sleep(random(2000, 2500));
- }
- }
- }
- if (!inventory.isFull()) {
- if (getMyPlayer().getLocation().getY() < 3471) {
- if (walkedToRoad == false) {
- status = "Walking";
- toRoad.traverse();
- sleep(random(2000, 2500));
- } else if (walkedToRoad == true) {
- toYews.traverse();
- sleep(random(2000, 2500));
- }
- }
- if (isAtSouth == true) {
- chopSouthTree();
- goingSouth = false;
- } else if (isAtNorth == true) {
- chopNorthTree();
- goingNorth = false;
- }
- }
- if (goingNorth == true && getMyPlayer().getLocation().getY() < 3492) {
- status = "Switching";
- walking.walkTileMM(northYewChopLoc);
- sleep(random(2000, 2500));
- } else if (goingSouth == true && getMyPlayer().getLocation().getY() > 3473) {
- status = "Switching";
- walking.walkTileMM(southYewChopLoc);
- sleep(random(2000, 2500));
- }
- if (southYewArea.contains(getMyPlayer().getLocation())) {
- isAtSouth = true;
- } else if (!southYewArea.contains(getMyPlayer().getLocation())) {
- isAtSouth = false;
- }
- if (northYewArea.contains(getMyPlayer().getLocation())) {
- isAtNorth = true;
- } else if (!northYewArea.contains(getMyPlayer().getLocation())) {
- isAtNorth = false;
- }
- }
- } catch (final Exception e) {
- }
- return 500;
- }
- public void checkInventory() {
- RSItem runeHatchet = inventory.getItem(1359);
- RSItem dragonHatchet = inventory.getItem(6739);
- game.openTab(4);
- sleep(1000);
- if (inventory.contains(1359) && skills.getCurrentLevel(0) >= 41) {
- runeHatchet.doClick(true);
- hasHatchet = true;
- } else if (inventory.contains(6739) && skills.getCurrentLevel(0) >= 61) {
- dragonHatchet.doClick(true);
- hasHatchet = true;
- }
- if (inventory.contains(1359) && skills.getCurrentLevel(0) < 41) {
- hasHatchet = true;
- } else if (inventory.contains(6739) && skills.getCurrentLevel(0) < 61) {
- hasHatchet = true;
- }
- if (!inventory.contains(1359) && !inventory.contains(6739)) {
- checkEquipment();
- }
- }
- public void checkEquipment() {
- game.openTab(5);
- sleep(1000);
- if (equipment.containsOneOf(runeHatchet) == true || equipment.containsOneOf(dragonHatchet) == true) {
- hasHatchet= true;
- hatchetEquipped = true;
- } else if (equipment.containsOneOf(runeHatchet) == false && equipment.containsOneOf(dragonHatchet) == false) {
- hatchetEquipped = false;
- WindowUtil.showDialog("You don't have an appropriate hatchet");
- log("You must have either a rune or dragon hatchet equiped or in your");
- log("inventory to use this script.");
- game.logout(true);
- sleep(1000);
- stopScript();
- }
- }
- public void chopSouthTree() {
- RSObject Tree = objects.getNearest(1309);
- RSTile treeLoc = Tree.getLocation();
- if (getMyPlayer().getAnimation() == 879) {
- chopping = true;
- status = "Chopping";
- } else {
- chopping = false;
- }
- if (calc.distanceTo(treeLoc) > 5 && calc.distanceTo(southYewLoc) <= 3) {
- if (switched != 2) {
- status = "No Tree";
- walking.walkTileMM(middleLoc);
- switched++;
- goingNorth = true;
- } else if (switched == 2) {
- status = "Waiting";
- antiBan();
- }
- }
- if (chopping == false && calc.distanceTo(treeLoc) <= 3) {
- if (!getMyPlayer().isMoving()) {
- sleep(random(800, 1500));
- Tree.doAction("Chop down");
- switched = 0;
- antiBan();
- }
- }
- }
- public void chopNorthTree() {
- RSObject Tree = objects.getNearest(1309);
- RSTile treeLoc = Tree.getLocation();
- if (getMyPlayer().getAnimation() == 879) {
- chopping = true;
- status = "Chopping";
- } else {
- chopping = false;
- }
- if (calc.distanceTo(treeLoc) > 5 && calc.distanceTo(northYewLoc) <= 3) {
- if (switched != 2) {
- status = "No Tree";
- walking.walkTileMM(middleLoc);
- switched++;
- goingSouth = true;
- } else if (switched == 2) {
- status = "Waiting";
- antiBan();
- }
- }
- if (chopping == false && calc.distanceTo(treeLoc) <= 3) {
- if (!getMyPlayer().isMoving()) {
- sleep(random(800, 1500));
- Tree.doAction("Chop down");
- switched = 0;
- antiBan();
- }
- }
- }
- public void useBank() {
- final RSObject bankBooth = objects.getNearest(782);
- try {
- if (bank.getInterface().isValid()) {
- depositLogs();
- } else if (!getMyPlayer().isMoving() && !bank.getInterface().isValid()) {
- bankBooth.doAction("Use-quickly");
- }
- } catch (final Exception e) {
- }
- }
- public void depositLogs() {
- int Bank = bank.getCount(1515);
- int Inventory = inventory.getCount(1515);
- int totalLogs = Bank + Inventory;
- sleep(random(1000, 1500));
- if (hatchetEquipped == false) {
- bank.depositAllExcept(runeHatchet, dragonHatchet);
- } else if (hatchetEquipped == true) {
- mouse.move(random(382, 410), (random(299, 312)));
- sleep(random(800, 1200));
- mouse.click(true);
- }
- sleep(random(4000, 4500));
- bank.close();
- timesBanked++;
- totalLogsP = totalLogs;
- }
- public void antiBan() {
- final int ranNo = random(1, 75);
- try {
- if (ranNo == 1 && didlast1 == false && is99 == false) { //check woodcutting stat
- displayAntiban = true;
- mouse.move(random(587, 608), random(173, 196));
- sleep(random(800, 1200));
- mouse.move(random(682, 726), random(354, 370));
- sleep(random(1500, 2500));
- game.openTab(4);
- didlast1 = true;
- didlast2 = false;
- didlast3 = false;
- didlast4 = false;
- didlast5 = false;
- displayAntiban = false;
- } else if (ranNo == 2 && didlast2 == false) { //check friends tab
- displayAntiban = true;
- game.openTab(9);
- sleep(random(800, 1200));
- mouse.click(true);
- sleep(random(2000, 3000));
- game.openTab(4);
- didlast1 = false;
- didlast2 = true;
- didlast3 = false;
- didlast4 = false;
- didlast5 = false;
- displayAntiban = false;
- } else if (ranNo == 3 && didlast3 == false) { //turn camera
- displayAntiban = true;
- camera.setAngle(random(90, 180));
- sleep(random(400, 800));
- didlast1 = false;
- didlast2 = false;
- didlast3 = true;
- didlast4 = false;
- didlast5 = false;
- displayAntiban = false;
- } else if (ranNo == 4 && didlast4 == false) { //move mouse randomly
- displayAntiban = true;
- mouse.move(random(25, 500), random(16, 291));
- sleep(random(800, 1200));
- didlast1 = false;
- didlast2 = false;
- didlast3 = false;
- didlast4 = true;
- didlast5 = false;
- displayAntiban = false;
- } else if (ranNo == 5 && didlast5 == false) { //move mouse offscreen
- displayAntiban = true;
- mouse.moveOffScreen();
- sleep(random(10000, 25000));
- didlast1 = false;
- didlast2 = false;
- didlast3 = false;
- didlast4 = false;
- didlast5 = true;
- displayAntiban = false;
- }
- } catch (final Exception e) {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement