Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.event.events.MessageEvent;
- import org.rsbot.event.listeners.MessageListener;
- import org.rsbot.script.*;
- import org.rsbot.script.wrappers.RSArea;
- import org.rsbot.script.wrappers.RSObject;
- import org.rsbot.script.wrappers.RSTile;
- import org.rsbot.script.methods.Skills;
- @ScriptManifest(authors = {"JsMxBiCs"}, keywords = {"WoodCutting"}, name = "WillowWc", description = "Cuts Willows at Port-Sarim & Banks.", version = 1)
- public class WillowWc extends Script implements PaintListener, MessageListener{
- private int WillowID[] = {5551, 5552, 5553};
- private int WillowLogID = 1519;
- public int [] kapIDs = {1349, 1351, 1353, 1355, 1357, 1359, 1361, 6739, 13470};
- public final int[] nestIDs = {5070, 5071, 5072, 5073, 5074, 5075, 5076, 7413, 11966};
- private int bankID = 36788;
- private RSTile[] WalkingToBank = { new RSTile(3059, 3253), new RSTile(3047, 3246), new RSTile(3041, 3239), new RSTile(3047, 3235) };
- private RSTile[] WalkingToWillowTrees = { new RSTile(3047, 3236), new RSTile(3042, 3247), new RSTile(3052, 3247), new RSTile(3060, 3253) }; public long startTime = 0;
- public long millis = 0;
- public long hours = 0;
- public long minutes = 0;
- public long seconds = 0;
- public long last = 0;
- private int logsChopped = 0;
- public int expForLog = 67;
- public int logsTNL;
- public int logsHour = 0;
- public int expGained = 0;
- public int expHour = 0;
- public int currLevel;
- public int startLevel;
- public int lvlsGained;
- private int startExp;
- private long secondsTNL;
- private long hoursTNL;
- private long minutesTNL;
- @Override
- public boolean onStart() {
- startTime = System.currentTimeMillis();
- startExp = skills.getCurrentExp(skills.WOODCUTTING);
- startLevel = skills.getCurrentLevel(skills.WOODCUTTING);
- return true;
- }
- public void messageReceived(MessageEvent e) {
- String x = e.getMessage().toLowerCase();
- if (x.contains("you raped a log!")){
- logsChopped++;
- }
- }
- public void checkRun() {
- if(!walking.isRunEnabled()) {
- if(walking.getEnergy() < random(66,90)) {
- walking.rest(random(78,100));
- } else
- walking.setRun(true);
- }
- }
- public void cutWillows() {
- RSObject willowtree = objects.getNearest(WillowID);
- if (willowtree != null && getMyPlayer().getAnimation() == -1) {
- willowtree.doAction("Chop down");
- sleep(random(800, 1000));
- if (!willowtree.isOnScreen()) {
- camera.turnToTile(willowtree.getLocation());
- }
- }
- }
- /*ANTIBAN MADE BY CHKENMUFFIN*\
- * THANKS FOR USING*\
- */
- public void chooserandomAFK(){
- switch(random(0, 4)) {
- case 0: sleep(random(5000, 9000));
- case 1: sleep(random(4000, 10000));
- case 2: sleep(random(5000, 15000));
- case 3: sleep(random(4000, 10000));
- case 4: log("Not doing AFK");
- }
- }
- public void mouseHandler(){
- switch(random(0, 5)) {
- case 0: mouse.moveOffScreen();
- sleep(random(5000, 10000));
- case 1: mouse.moveOffScreen();
- sleep(random(8000, 15000));
- case 2: mouse.moveSlightly();
- case 3: mouse.moveSlightly();
- case 4: log("Not moving mouse");
- case 5:log("Taking offscreen break 30-60 secs");
- mouse.moveOffScreen();
- sleep(random(30000, 60000));
- }
- }
- public void superAntiMoveMouse(){
- switch(random(0, 10)) {
- case 0: log("Doing superAnti! Wiggling mouse a lot");
- mouse.setSpeed(random(6, 9));
- mouse.moveSlightly();
- mouse.moveSlightly();
- mouse.moveSlightly();
- case 1: log("Doing superAnti! Wiggling mouse ");
- mouse.setSpeed(random(6, 9));
- mouse.moveSlightly();
- mouse.moveSlightly();
- case 2: log("Doing superAnti! Wiggling mouse a lot");
- mouse.setSpeed(random(6, 9));
- mouse.moveSlightly();
- mouse.moveSlightly(); mouse.moveSlightly();
- mouse.moveSlightly(); mouse.moveSlightly();
- mouse.moveSlightly();
- }
- }
- public void randomtab(){
- switch(random(0, 12)) {
- case 0: game.openTab(game.TAB_STATS);
- game.openTab(game.TAB_INVENTORY);
- case 1: game.openTab(game.TAB_INVENTORY);
- case 2: game.openTab(game.TAB_CLAN);
- game.openTab(game.TAB_INVENTORY);
- case 3: game.openTab(game.TAB_FRIENDS);
- game.openTab(game.TAB_INVENTORY);
- case 4: game.openTab(game.TAB_IGNORE);
- game.openTab(game.TAB_INVENTORY);
- case 5: game.openTab(game.TAB_EQUIPMENT);
- game.openTab(game.TAB_INVENTORY);
- case 6: game.openTab(game.TAB_MAGIC);
- game.openTab(game.TAB_INVENTORY);
- case 7: game.openTab(game.TAB_QUESTS);
- game.openTab(game.TAB_INVENTORY);
- case 8: game.openTab(game.TAB_ACHIEVEMENTS);
- game.openTab(game.TAB_INVENTORY);
- case 9: game.openTab(game.TAB_NOTES);
- game.openTab(game.TAB_INVENTORY);
- case 10: game.openTab(game.TAB_PRAYER);
- game.openTab(game.TAB_INVENTORY);
- case 11: game.openTab(game.TAB_MUSIC);
- game.openTab(game.TAB_INVENTORY);
- }
- }
- public void randomXPcheck(){
- game.openTab(game.TAB_STATS);
- switch(random(0, 20)) {
- case 0: skills.doHover(skills.INTERFACE_FISHING);
- sleep(random(5000, 7000));
- game.openTab(game.TAB_INVENTORY);
- case 1:
- skills.doHover(skills.INTERFACE_WOODCUTTING);
- sleep(random(5000, 7000));
- game.openTab(game.TAB_INVENTORY);
- case 2:
- skills.doHover(skills.INTERFACE_ATTACK);
- sleep(random(5000, 7000));
- game.openTab(game.TAB_INVENTORY);
- case 3:
- skills.doHover(skills.INTERFACE_STRENGTH);
- sleep(random(5000, 7000));
- game.openTab(game.TAB_INVENTORY);
- case 4:
- skills.doHover(skills.INTERFACE_COOKING);
- sleep(random(5000, 7000));
- game.openTab(game.TAB_INVENTORY);
- case 5:
- skills.doHover(skills.INTERFACE_RANGE);
- sleep(random(5000, 7000));
- game.openTab(game.TAB_INVENTORY);
- case 6:
- skills.doHover(skills.INTERFACE_FIREMAKING);
- sleep(random(5000, 7000));
- game.openTab(game.TAB_INVENTORY);
- case 7:
- skills.doHover(skills.INTERFACE_CONSTRUCTION);
- sleep(random(5000, 7000));
- game.openTab(game.TAB_INVENTORY);
- case 8:
- skills.doHover(skills.INTERFACE_RUNECRAFTING);
- sleep(random(5000, 7000));
- game.openTab(game.TAB_INVENTORY);
- case 9:
- skills.doHover(skills.INTERFACE_SUMMONING);
- sleep(random(5000, 7000));
- game.openTab(game.TAB_INVENTORY);
- case 10:
- skills.doHover(skills.INTERFACE_SLAYER);
- sleep(random(5000, 7000));
- game.openTab(game.TAB_INVENTORY);
- case 11:
- skills.doHover(skills.INTERFACE_CRAFTING);
- sleep(random(5000, 7000));
- game.openTab(game.TAB_INVENTORY);
- case 12:
- skills.doHover(skills.INTERFACE_FARMING);
- sleep(random(5000, 7000));
- game.openTab(game.TAB_INVENTORY);
- case 13:
- skills.doHover(skills.INTERFACE_AGILITY);
- sleep(random(5000, 7000));
- game.openTab(game.TAB_INVENTORY);
- case 14:
- skills.doHover(skills.INTERFACE_THIEVING);
- sleep(random(5000, 7000));
- game.openTab(game.TAB_INVENTORY);
- case 15:
- skills.doHover(skills.INTERFACE_HUNTER);
- sleep(random(5000, 7000));
- game.openTab(game.TAB_INVENTORY);
- case 16:
- skills.doHover(skills.INTERFACE_MINING);
- sleep(random(5000, 7000));
- game.openTab(game.TAB_INVENTORY);
- case 17:
- skills.doHover(skills.INTERFACE_SMITHING);
- sleep(random(5000, 7000));
- game.openTab(game.TAB_INVENTORY);
- case 18:
- skills.doHover(skills.INTERFACE_MAGIC);
- sleep(random(5000, 7000));
- game.openTab(game.TAB_INVENTORY);
- case 19:
- skills.doHover(skills.INTERFACE_FLETCHING);
- sleep(random(5000, 7000));
- game.openTab(game.TAB_INVENTORY);
- case 20:
- skills.doHover(skills.INTERFACE_PRAYER);
- sleep(random(5000, 7000));
- game.openTab(game.TAB_INVENTORY);
- }
- }
- public int antibanlist() {
- switch(random(0, 17)) {
- case 0:
- chooserandomAFK();
- case 1:
- case 2:
- case 3: chooserandomAFK();
- case 4:
- mouse.moveSlightly();
- case 5: chooserandomAFK();
- case 6:
- case 7: mouseHandler();
- case 8: superAntiMoveMouse();
- case 9:randomXPcheck();
- case 10: randomtab();
- case 11:
- case 12:randomtab();
- case 13:superAntiMoveMouse();
- break;
- case 14:randomXPcheck();
- case 15:
- case 16:
- case 17:
- break;
- default:
- break;
- }
- return 500;
- }
- public int loop() {
- try {
- mouse.setSpeed(random(5, 8));
- switch (getState()) {
- case 1://chopping
- cutWillows();
- if (getMyPlayer().getAnimation() != -1) {
- }
- return random(50, 100);
- case 2://banking
- checkRun();
- walkToBank();
- sleep(random(1800, 2100));
- return random(50, 100);
- case 3://back to willows
- checkRun();
- walkToWillowTrees();
- sleep(random(2000, 2300));
- return random(50, 100);
- case 4: //banking
- if (objects.getNearest(bankID) != null
- && !objects.getNearest(bankID).isOnScreen()) {
- camera.turnToObject(objects.getNearest(bankID), 10);
- }
- if (objects.getNearest(bankID).isOnScreen()) {
- objects.getNearest(bankID).doAction("Deposit");
- sleep(3000, 3300);
- }
- if (bank.getBoxCount() == 28 && interfaces.getComponent(11, 0).isValid()) {
- sleep(1000, 1200);
- bank.depositAllExcept(kapIDs);
- sleep(1500, 1700);
- bank.close();
- }
- return random(50, 100);
- }
- } catch (NullPointerException e) {
- }
- secondsTNL = (skills.getExpToNextLevel(skills.WOODCUTTING)) / (expHour / 3600);
- hoursTNL = secondsTNL / (60 * 60);
- secondsTNL -= hoursTNL * (60 * 60);
- minutesTNL = secondsTNL / 60;
- secondsTNL -= minutesTNL * 60;
- return 5;
- }
- public int getState() {
- if (atWillows() && !inventory.isFull()) {
- sleep(random(300, 350));
- return 1;
- }
- if (!atBank() && inventory.isFull()) {
- sleep(random(300, 350));
- return 2;
- }
- if (!atWillows() && !inventory.isFull() && !inventory.contains(WillowLogID) && !interfaces.getComponent(11, 0).isValid()) {
- sleep(random(300, 350));
- return 3;
- }
- if (atBank() && !bank.isDepositOpen()) {
- sleep(random(300, 350));
- return 4;
- }
- return -1;
- }
- private boolean walkToWillowTrees() {
- RSTile[] randomizedPath = walking.randomizePath(WalkingToWillowTrees,
- 1, 1);
- return walking.walkPathMM(randomizedPath);
- }
- private void walkToBank() {
- RSTile[] randomizedPath = walking.randomizePath(WalkingToBank,
- 1, 1);
- walking.walkPathMM(randomizedPath);
- }
- private boolean atWillows() {
- RSArea area = new RSArea(new RSTile(3056, 3250), new RSTile(3064, 3258));
- return area.contains(getMyPlayer().getLocation());
- }
- private boolean atBank() {
- RSArea area = new RSArea(new RSTile(3042, 3235), new RSTile(3050, 3237));
- return area.contains(getMyPlayer().getLocation());
- }
- @Override
- public void onFinish() {
- }
- //START: Code generated using Enfilade's Easel
- private final Color color1 = new Color(1, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final Color color3 = new Color(0, 0, 0);
- private final Color color4 = new Color(51, 51, 0);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final BasicStroke stroke2 = new BasicStroke(4);
- private final Font font1 = new Font("BIRTH OF A HERO", 3, 32);
- private final Font font2 = new Font("RuneScape Chat", 0, 17);
- public void onRepaint(Graphics g1) {
- Graphics2D g = (Graphics2D)g1;
- lvlsGained = currLevel - startLevel;
- currLevel = skills.getCurrentLevel(skills.WOODCUTTING);
- expHour = (int) ((expGained) * 3600000D / (System.currentTimeMillis() - startTime));
- logsHour = (int) ((logsChopped) * 3600000D / (System.currentTimeMillis() - startTime));
- millis = System.currentTimeMillis() - startTime;
- hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- seconds = millis / 1000;
- g.setColor(color2);
- g.fillRoundRect(353, 7, 158, 269, 16, 16);
- g.setColor(color2);
- g.setStroke(stroke1);
- g.drawRoundRect(353, 7, 158, 269, 16, 16);
- g.setColor(color2);
- g.fillRoundRect(5, 344, 493, 113, 16, 16);
- g.setColor(color2);
- g.drawRoundRect(5, 344, 493, 113, 16, 16);
- g.setFont(font1);
- g.setColor(color4);
- g.drawString("JsMxBiCs WoodCutter!", 92, 408);
- g.setColor(color2);
- g.fillRoundRect(5, 459, 98, 14, 16, 16);
- g.setColor(color2);
- g.fillRoundRect(353, 7, 157, 215, 16, 16);
- g.setColor(color2);
- g.setStroke(stroke1);
- g.drawRoundRect(353, 7, 157, 215, 16, 16);
- g.setFont(font2);
- g.setColor(color4);
- g.drawString("Time Running: " + hours +":"+ minutes + ":" + seconds, 355, 46);
- g.drawString("Logs Chopped: " + logsChopped, 355, 75);
- g.drawString("Exp: ", 355, 131);
- g.drawString("Exp/hr: ", 355, 159);
- g.drawString("ExpTNL: " + skills.getExpToNextLevel(skills.WOODCUTTING), 355, 190);
- g.drawString("TimeTNL: ", 355, 104);
- g.drawString("Level: " + currLevel + " (" + lvlsGained + ")", 355, 217);
- g.drawString("Logs/hr: ", 355, 244);
- g.drawString("LogsTNL: " + logsTNL, 356, 270);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement