Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.Script;
- import org.rsbot.script.methods.Skills;
- import org.rsbot.script.wrappers.*;
- import org.rsbot.event.listeners.PaintListener;
- import java.awt.*;
- import javax.imageio.ImageIO;
- import java.io.IOException;
- import java.net.URL;
- import org.rsbot.event.events.MessageEvent;
- import org.rsbot.event.listeners.MessageListener;
- @ScriptManifest(authors = { "adwalvekar" }, keywords = { "MaplePowerCutter" }, name = "DaemonhiemMapleChopper", version = 1.0, description = "Daemonhiem Maple Tree Cutter. Only PowerCuts (Supports most hatchets)")
- public class DaemonhiemMapleChopper extends Script implements PaintListener, MessageListener {
- private int mapleLogID = 1517;
- private int mapleTree = 1307;
- private int hatchets[] = {1349, 1351, 1353, 1355, 1357, 1359, 1361, 6739, 13470};
- private int startXP;
- public long startTime = System.currentTimeMillis();
- private int startLevel;
- private int gainedLevel;
- private int Percent;
- public int xpGained;
- public int logsLeft;
- public int logsCut;
- String status = "";
- private int profit =0;
- private int logprice;
- public boolean onStart(){
- logprice = grandExchange.lookup(mapleLogID).getGuidePrice();
- startXP = skills.getCurrentExp(Skills.WOODCUTTING);
- return true;
- }
- public void messageReceived(MessageEvent e) {
- if(e.getMessage().contains("some maple logs" )){
- logsCut++;
- }
- }
- public void chop() {
- if (getMyPlayer().getAnimation() == -1){
- RSObject tree = objects.getNearest(mapleTree);
- if (tree != null) {
- status = "Cutting tree";
- if (!tree.isOnScreen() && tree != null) {
- camera.turnTo(tree.getLocation());
- if (calc.distanceTo(tree) > 6) {
- walking.walkTileMM(tree.getLocation());
- }
- }
- tree.doAction("Chop down Maple");
- sleep(random(2000, 3000));
- }
- }else{
- antiban();
- }
- }
- public void antiban(){
- int r = random(1,10);
- if (r == 1){
- camera.setAngle (random (0, 200));
- sleep(random(400, 800));
- }
- if (r == 2){
- camera.setPitch(random(0, 85));
- sleep(random(400, 800));
- }
- if (r == 3){
- mouse.moveSlightly();
- sleep(random(400, 800));
- }
- if (r == 4){
- mouse.moveSlightly();
- sleep(random(100, 200));
- mouse.moveSlightly();
- sleep(random(100, 200));
- mouse.moveSlightly();
- sleep(random(400, 800));
- }
- if (r == 5){
- mouse.moveSlightly();
- mouse.moveSlightly();
- mouse.moveSlightly();
- sleep(random(400, 800));
- }
- if (r == 6) {
- skills.doHover(Skills.INTERFACE_WOODCUTTING);
- sleep(random(0, 1500));
- }
- if (r == 7) {
- skills.doHover(Skills.INTERFACE_CONSTITUTION);
- sleep(random(0, 1500));
- }
- if (r == 8) {
- skills.doHover(Skills.INTERFACE_STRENGTH);
- sleep(random(0, 1500));
- }
- if (r == 9) {
- skills.doHover(Skills.INTERFACE_ATTACK);
- sleep(random(0, 1500));
- }
- }
- public int loop(){
- mouse.setSpeed(random(0, 2));
- if (walking.getEnergy()> (random(50, 100))){
- walking.setRun(true);
- sleep(random(700, 800));
- }
- if(inventory.isFull ()){
- status = ("Dropping logs");
- inventory.dropAllExcept(hatchets);
- }else{
- chop();
- }
- return (0);
- }
- public void onFinish(){
- log("Thank You for Using.");
- }
- private Image getImage(String url) {
- try {
- return ImageIO.read(new URL(url));
- } catch(IOException e) {
- return null;
- }
- }
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(0, 0, 0, 0);
- private final Color color3 = new Color(0,0,0);
- private final Color color4 = new Color(250,250,250);
- private final Font font1 = new Font("Impact", 0, 16);
- private final Font font2 = new Font("Impact" , 0,20);
- public void onRepaint(Graphics g1) {
- 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;
- final int percent = skills.getPercentToNextLevel(8);
- logsLeft = (skills.getExpToNextLevel(Skills.WOODCUTTING)/100);
- xpGained = ( skills.getCurrentExp(Skills.WOODCUTTING) - startXP);
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(723, 27, 18, 15);
- g.fillRect(743, 67, 13, 14);
- g.fillRect(5, 457, 127, 17);
- g.setColor(color2);
- g.fillRoundRect(556, 213, 173, 144, 16, 16);
- g.setFont(font1);
- g.setColor(color3);
- g.drawString("Percent TNL: " +percent+ "%" ,562, 446);
- g.drawString("Time Running: " + hours + ":" + minutes + ":" + seconds , 562, 416);
- g.drawString("Logs To level: " + logsLeft ,562,386);
- g.drawString("XP Gained: " +xpGained ,562, 356);
- g.drawString("Logs Cut: " +logsCut ,562, 326);
- g.drawString("Status: " +status , 562, 296);
- g.setFont(font2);
- g.setColor(color4);
- g.drawString("Daemonhiem", 590,236);
- g.drawString("Maple Chopper", 590, 256);
- g.setColor(Color.white);
- g.drawLine(0, (int)(mouse.getLocation().getY()), 800, (int)(mouse.getLocation().getY()));
- g.drawLine((int)(mouse.getLocation().getX()), 0, (int)(mouse.getLocation().getX()), 800);
- g.setColor(Color.white);
- g.drawLine(0, (int)(mouse.getLocation().getY()) +1, 800, (int)(mouse.getLocation().getY())+1);
- g.drawLine((int)(mouse.getLocation().getX()) +1, 0, (int)(mouse.getLocation().getX())+1, 800);
- }
- }
Add Comment
Please, Sign In to add comment