Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /////////////
- ///IMPORTS///
- /////////////
- import org.rsbot.event.events.MessageEvent;
- import org.rsbot.event.listeners.MessageListener;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.*;
- import org.rsbot.script.wrappers.*;
- import java.awt.*;
- //////////////
- ///MANIFEST///
- //////////////
- @SuppressWarnings("deprecation")
- @ScriptManifest(authors = {"dodgercp"}, keywords = {"Fletches Maples."}, name = "MFletcher", description = "Fletches Maples.", version = 1)
- public class MFletcher extends Script implements PaintListener,MessageListener{
- int FLETCHING_ANIM = 1248;
- 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 startExp = 0;
- private int bowsfletched = 0;
- public int fletchHour = 0;
- public int expHour = 0;
- public int expGained = 0;
- int waitCount = 0;
- private enum ACTION {
- WITHDRAW, DEPOSIT, FLETCH, WAIT, ERROR
- }
- private ACTION getAction() {
- if(!inventory.contains(MAPLE_LOGS) && !inventory.contains(UNSTRUNG_BOWS)) {
- return ACTION.WITHDRAW;
- } else if (!inventory.contains(MAPLE_LOGS) && inventory.contains(UNSTRUNG_BOWS)){
- return ACTION.DEPOSIT;
- } else if (inventory.containsAll(MAPLE_LOGS, KNIFE) && getMyPlayer().getAnimation() !=FLETCHING_ANIM) {
- return ACTION.FLETCH;
- } else if (getMyPlayer().getAnimation() == FLETCHING_ANIM) {
- return ACTION.WAIT;
- }
- return ACTION.ERROR;
- }
- int MAPLE_LOGS = 1517;
- int UNSTRUNG_BOWS = 62;
- int KNIFE = 946;
- RSItem selectedItem;
- RSInterface FLETCH_INTERFACE;
- RSComponent FLETCH_COMPONENT;
- @Override
- public boolean onStart() {
- log("Thanks for using MFletcher!"); {
- log("I'm here to get you 99 fletching in no time!");
- FLETCH_INTERFACE = interfaces.get(905);
- startTime = System.currentTimeMillis();
- startExp = skills.getCurrentExp(skills.FLETCHING);
- return true;}
- }
- public int loop() {
- if(random(1, 15) == 7) antiBan();
- ACTION actionSelector = getAction();
- switch (actionSelector) {
- case WITHDRAW:
- if(!bank.isOpen()) {
- bank.open();
- while(!bank.isOpen() && waitCount < 10) {
- sleep(250,1100);
- waitCount++;
- }
- waitCount = 0;
- } else {
- if(!inventory.contains(KNIFE)) {
- bank.withdraw(KNIFE, 1);
- }
- bank.withdraw(MAPLE_LOGS, 0);
- }
- break;
- case DEPOSIT:
- if(!bank.isOpen()) {
- bank.open();
- while(!bank.isOpen() && waitCount < 10) {
- sleep(250,1250);
- waitCount++;
- }
- waitCount = 0;
- } else {
- bank.depositAllExcept(KNIFE);
- }
- break;
- case FLETCH:
- if(bank.isOpen()){
- bank.close();
- }
- if(FLETCH_INTERFACE.isValid()) {
- FLETCH_COMPONENT = FLETCH_INTERFACE.getComponent(15);
- sleep(200, 500);
- FLETCH_COMPONENT.doClick();
- break;
- } else {
- if (random(1,2) == 1) {
- inventory.getItem(KNIFE).doClick(true);
- while(inventory.getSelectedItem() == null && waitCount < 10) {
- sleep(500,1500);
- waitCount++;
- }
- selectedItem = inventory.getSelectedItem();
- if(selectedItem != null && selectedItem.getID() == KNIFE){
- inventory.getItem(MAPLE_LOGS).doClick(true);
- }
- } else {
- inventory.getItem(MAPLE_LOGS).doClick(true);
- while(inventory.getSelectedItem() == null && waitCount < 10) {
- sleep(500,1500);
- waitCount++;
- }
- selectedItem = inventory.getSelectedItem();
- if(selectedItem != null && selectedItem.getID() == MAPLE_LOGS){
- inventory.getItem(KNIFE).doClick(true);
- }
- }
- }
- break;
- case WAIT:
- sleep(250, 1300);
- break;
- case ERROR:
- game.logout(false);
- break;
- }
- return random(500, 1500);
- }
- ///////////
- ///PAINT///
- ///////////
- //START: Code generated using Enfilade's Easel
- private final Color color1 = new Color(0, 204, 204, 147);
- private final Color color2 = new Color(0, 0, 0);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Comic Sans MS", 0, 15);
- private final Font font2 = new Font("Vivaldi", 0, 15);
- public void onRepaint(Graphics g1) {
- Graphics2D g = (Graphics2D)g1;
- 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;
- fletchHour = (int) ((bowsfletched) * 3600000D / (System.currentTimeMillis() - startTime));
- expGained = skills.getCurrentExp(skills.FLETCHING) - startExp;
- expHour = (int) ((expGained) * 3600000D / (System.currentTimeMillis() - startTime));
- g.setColor(color1);
- g.fillRect(361, 130, 156, 208);
- g.setColor(color2);
- g.setStroke(stroke1);
- g.drawRect(361, 130, 156, 208);
- g.setFont(font1);
- g.drawString("MFletcher", 406, 150);
- g.drawString("Run Time: " + hours +":" + minutes + ":" + seconds, 390, 180);
- g.drawString("Fletched: " + bowsfletched , 390, 210);
- g.drawString("Bows/H: " + fletchHour, 390, 240);
- g.drawString("EXP/Gained: " + expGained, 390, 270);
- g.drawString("EXP/Hour: " + expHour, 390, 300);
- g.setFont(font2);
- g.drawString("Dodgercp", 409, 323);
- ///////////
- ///MOUSE///
- ///////////
- g.setColor(Color.blue);
- 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.green);
- 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);
- }
- //END: Code generated using Enfilade's Easel
- public void messageReceived(MessageEvent e) {
- String x = e.getMessage().toLowerCase();
- if (x.contains("longbow")){
- bowsfletched++;
- }
- }
- @Override
- public void onFinish() {
- env.saveScreenshot(true);
- log("Please post your proggy on my thread!");
- log("I hope you enjoyed using dodgercp's MFletcher!");
- log("Time Run: " + hours +":" + minutes + ":" + seconds);
- log("Bows Fletched: " + bowsfletched);
- log("EXP Gained: " + expGained);}
- private void antiBan() {
- int r = random(0, 30);
- switch(r) {
- case 3:
- mouse.moveSlightly();
- sleep(500, 800);
- break;
- case 7:
- mouse.moveRandomly(10, 50);
- break;
- case 16:
- mouse.moveOffScreen();
- sleep(2000, 3000);
- break;
- case 18:
- camera.moveRandomly(random(750, 1250));
- break;
- }
- }
- }
Add Comment
Please, Sign In to add comment