Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.rsbot.script.*;
- import org.rsbot.script.wrappers.*;
- import org.rsbot.script.methods.*;
- import org.rsbot.event.listeners.PaintListener;
- import java.awt.image.BufferedImage;
- import java.awt.*;
- import javax.imageio.ImageIO;
- import java.io.IOException;
- import java.net.MalformedURLException;
- import java.net.URL;
- @ScriptManifest(authors = {"Dew"}, keywords = {"Home", "Construction", "Moneymaking"}, name = "Tab Maker Premium", description = "start with Demon Butler following and by your lectern", version = 0.83)
- public class tabMakerFree extends Script implements PaintListener {
- public static final int AIR_STAFF = 1381;
- public static final int SOFT_CLAY = 1761;
- public static final int LAW_RUNE = 563;
- public static final int GP = 995;
- public int tabID = 0;
- public int tabPrice = 0;
- private Double ver = tabMakerFree.class.getAnnotation(ScriptManifest.class).version();
- //public int lumbtele = 8008;
- //public int ardotele = 8011;
- //public int cametele = 8010;
- //public int falatele = 8009;
- //public int houstele = 8013;
- public int varrtele = 8007;
- //public int btbtele = 8014;
- //public int btptele = 8015;
- //public int enditele = 8019;
- //public int endrtele = 8020;
- //public int enemtele = 8017;
- //public int enontele = 8021;
- //public int enrutele = 8018;
- //public int ensatele = 8016;
- //public int watctele = 8012;
- public boolean paying = false;
- public boolean useAirStaff;
- public boolean moneyInBank;
- public boolean enterAmount = false;
- public boolean sleeper = true;
- public int studyAnim = 3652;
- public int startTabs = 0;
- public int nowTabs = 0;
- public int tabHr = 0;
- public int lvlsGained = 0;
- public long startTime = 0;
- public long millis = 0;
- public long hours = 0;
- public long minutes = 0;
- public long seconds = 0;
- private String status = "Setting up";
- BufferedImage normal = null;
- BufferedImage clicked = null;
- public String cursorU;//Cursor unclicked
- public String cursorC;//Cursor clicked
- public int check1 = 0;
- public int check2 = 0;
- private org.rsbot.script.util.Timer checkTimer = new org.rsbot.script.util.Timer(15000);
- private org.rsbot.script.util.Timer interTimer = new org.rsbot.script.util.Timer(10000); //10 sec
- ///////
- ///AntibanStuff
- ///////
- int antiMisClick = 0;
- public static final int[] LECTERN_IDS = new int[] { 13642, 13643,
- 13644, 13645, 13646, 13647, 13648 };
- public static final int[] BUTLER_IDS = new int[] { 4241, 4243 };
- public static final int TAB_INTERFACE = 400;
- public boolean checkLaws() {
- if (inventory.contains(LAW_RUNE)) {
- return true;
- }
- return false;
- }
- public int invCheck() {
- check1 = inventory.getCount(SOFT_CLAY);
- return check1;
- }
- // <editor-fold defaultstate="collapsed" desc="making the tabs">
- //this checks if the tab interface is open or not.
- //true if it is false if not
- public boolean checkTabInterface() {
- RSInterface inter = interfaces.get(TAB_INTERFACE);
- RSComponent com = inter.getComponent(tabID);
- if (inter.isValid() && inter != null) {
- return true;
- }
- return false;
- }
- //this opens the tab making interface
- public void openTabInterface() {
- RSObject lect = objects.getNearest(LECTERN_IDS);
- RSInterface inter = interfaces.get(TAB_INTERFACE);
- if (!checkTabInterface()) {
- if (lect != null) {
- if (lect.isOnScreen()) {
- lect.doAction("Study");
- sleep(2000, 5000);
- } else {
- walking.walkTo(lect.getLocation());
- }
- } else {
- sleep(1000, 1250);
- }
- } else {
- makeTabs();
- }
- }
- //this makes the tabs
- public void makeTabs() {
- RSComponent com = interfaces.get(TAB_INTERFACE).getComponent(tabID);
- if (checkTabInterface()) {
- if (com.isValid()) {
- if (com.isValid()) {
- com.doAction("Make-all");
- sleeper = true;
- sleep(5000, 6000);
- }
- }
- }
- }// </editor-fold>
- // <editor-fold defaultstate="collapsed" desc="onStart Checks">
- //checks if inventory contains any clay at all
- //true if contains clay, false if not
- public boolean checkClays() {
- if (inventory.contains(SOFT_CLAY)) {
- check2 = inventory.getCount(SOFT_CLAY);
- return true;
- }
- return false;
- }
- public boolean checkLectOnScreen() {
- RSObject lect = objects.getNearest(LECTERN_IDS);
- if (lect.isOnScreen()) {
- return true;
- }
- return false;
- }
- //checks if inventory contains money
- //true if does, false if doesn't
- public boolean moneyInBank() {
- if (inventory.contains(GP)) {
- return false;
- }
- return true;
- }
- //checks if inventory contains an air staff
- //true if contains one, if true equips false if doesn't contain one
- public boolean useAirStaff() {
- if (inventory.contains(AIR_STAFF)) {
- inventory.getItem(AIR_STAFF).doClick(true);
- return true;
- }
- return false;
- }// </editor-fold>
- public int checkItem(int item) {
- if (inventory.contains(item)) {
- inventory.getCount(item);
- }
- return item;
- }
- @Override
- public boolean onStart() {
- cursorU = "http://i360.photobucket.com/albums/oo47/perez048/mouseReg.png";
- cursorC = "http://i360.photobucket.com/albums/oo47/perez048/mouseClicked.png";
- while (game.isLoginScreen() || game.isWelcomeScreen()) {
- log("Waiting to be logged in...");
- sleep(1000);
- }
- /*if (!checkLectOnScreen()) {
- log("Please go to your study room and start this script!");
- return false;
- }*/
- log("If you are using an air staff, leave it unequipped!");
- if (!moneyInBank()) {
- log("We have money in inventory. we will use this money!");
- } else {
- log("No money in our inventory! We will use money from the bank.");
- }
- if (useAirStaff()) {
- log("using Air Staff!");
- } else {
- log("Using Air Runes!");
- }
- tabID = 15;
- useAirStaff = useAirStaff();
- moneyInBank = moneyInBank();
- startTabs = checkItem(varrtele);
- log("");
- log("Thank you for choosing Deww1's Tab Maker!");
- log("Make sure to start with demon butler following and by your lectern!");
- log("This bot has not had much testing, so I need feedback! ");
- try {
- final URL cursorURL = new URL(cursorU);
- final URL cursor80URL = new URL(cursorC);
- normal = ImageIO.read(cursorURL);
- clicked = ImageIO.read(cursor80URL);
- } catch (MalformedURLException e) {
- log("Unable to buffer cursor.");
- } catch (IOException e) {
- log("Unable to open cursor image.");
- }
- startTime = System.currentTimeMillis();
- return true;
- }
- public int loop() {
- checkLevelUp();
- nowTabs = startTabs - checkItem(varrtele);
- checkLaws();
- if (!checkLaws()) {
- status = "Stopping Script.";
- log("out of laws.. Stopping Script.");
- onFinish();
- }
- log("check1 ="+ check1 + " : check2 = " +check2);
- invCheck();
- while (sleeper) {
- status = "Sleeping...(zzz)";
- if (!inventory.contains(SOFT_CLAY)) {
- sleeper = false;
- } else {
- if (invCheck() != check2) {
- checkTimer.reset();
- } else {
- sleeper = false;
- }
- sleep(500, 1250);
- }
- }
- //test();
- if (checkIfPayButler()) {
- status = "Paying Butler.";
- paying = true;
- payButler();
- }
- if (!paying)
- if (!checkClays()) {
- if (!fetchClayInterface()) {
- clickButlerToFetch();
- } else {
- status = "Fetching Clay From Bank.";
- fetchClays();
- }
- } else {
- if (checkTabInterface()) {
- status = "Making Tabs.";
- makeTabs();
- } else {
- status = "Opening Tab Interface.";
- openTabInterface();
- }
- }
- return random(500,800);
- }
- // <editor-fold defaultstate="collapsed" desc="onFinish">
- @Override
- public void onFinish() {
- log("Thank you for using Tab Maker Free! By Deww1.");
- log("Visit my thread and post some feedback!");
- env.saveScreenshot(false);
- }// </editor-fold>
- // <editor-fold defaultstate="collapsed" desc="paying butler stuff">
- public void payButler() {
- RSInterface inter = interfaces.get(243); //butler interface
- RSComponent com = inter.getComponent(4); //contains text my services
- RSComponent cont = inter.getComponent(7); //continue button
- RSInterface inter2 = interfaces.get(232); //butler pay interface
- RSComponent pay1 = inter2.getComponent(2); //pay from inventory
- RSComponent pay2 = inter2.getComponent(3); //pay from bank
- if (inter != null && inter.isValid()) {
- if (com != null && com.isValid()) {
- if (com.containsText("my continued service")) {
- if (cont != null && cont.isValid()) {
- cont.doClick(true);
- }
- }
- }
- } else if (inter2 != null && inter2.isValid()) {
- if (!moneyInBank()) {
- if (pay1 != null && pay1.isValid()) {
- if (pay1.containsText("coins")) {
- pay1.doClick(true);
- log("We are paying our butler 10k!");
- paying = false;
- sleep(1000, 1250);
- }
- }
- } else {
- if (pay2 != null && pay2.isValid()) {
- if (pay2.containsText("bank")) {
- pay2.doClick(true);
- log("We are paying our butler 10k!");
- paying = false;
- sleep(1000, 1250);
- }
- }
- }
- }
- }
- public boolean checkIfPayButler() {
- RSInterface inter = interfaces.get(243); //butler interface
- RSInterface inter2 = interfaces.get(232); //butler pay interface
- RSComponent com = inter.getComponent(4); //contains text my services
- RSComponent pay1 = inter2.getComponent(2); //pay from inventory
- RSComponent pay2 = inter2.getComponent(3); //pay from bank
- if (inter != null && inter.isValid()
- || inter2 != null && inter2.isValid()) {
- if (com.containsText("my continued service")
- || pay1.containsText("coins")
- || pay2.containsText("bank")) {
- return true;
- }
- }
- return false;
- }// </editor-fold>
- public void test() {
- RSInterface inter = interfaces.get(232); //fetch interface
- RSInterface inter2 = interfaces.get(234); //clay page
- RSInterface inter3 = interfaces.get(752); //enter amount page
- RSComponent com1 = inter.getComponent(5); //MORE component
- RSComponent com2 = inter2.getComponent(3); //SOFT_CLAY component
- RSComponent com3 = inter3.getComponent(4); //ENTER AMOUNT: component
- if (!inter.isValid() && inter2.isValid()) {
- log("test1");
- }
- if (inter.isValid() && !inter2.isValid()) {
- log("test2");
- }
- if (!com3.containsText("amount")) {
- log("test3");
- }
- stopScript();
- }
- // <editor-fold defaultstate="collapsed" desc="fetching methods">
- public boolean fetchClayInterface() {
- RSInterface inter = interfaces.get(232); //fetch interface
- RSInterface inter2 = interfaces.get(234); //clay page
- RSInterface inter3 = interfaces.get(752); //enter amount page
- RSComponent com1 = inter.getComponent(5); //MORE component
- RSComponent com2 = inter2.getComponent(3); //SOFT_CLAY component
- RSComponent com3 = inter3.getComponent(4); //ENTER AMOUNT: component
- if (!inter.isValid() && !inter2.isValid()) {
- return false;
- }
- return true;
- }
- public void clickButlerToFetch() {
- RSNPC butler = npcs.getNearest(BUTLER_IDS);
- if (butler != null) {
- if (butler.isOnScreen()) {
- butler.doAction("Fetch-from-bank");
- sleep(1500, 2000);
- } else {
- walking.walkTo(butler.getLocation());
- }
- }
- }
- public void fetchClays() {
- RSInterface inter = interfaces.get(232); //fetch interface
- RSInterface inter2 = interfaces.get(234); //clay page
- RSInterface inter3 = interfaces.get(752); //enter amount page
- RSComponent com1 = inter.getComponent(5); //MORE component
- RSComponent com2 = inter2.getComponent(3); //SOFT_CLAY component
- RSComponent com3 = inter3.getComponent(4); //ENTER AMOUNT: component
- RSComponent com4 = inter2.getComponent(2); //GET MORE
- if (inter2 != null && inter2.isValid() &&
- com4 != null && com4.isValid()) {
- if (com4.containsText("another 24")) {
- com4.doClick(true);
- sleep(1000, 1250);
- check2 = 24;
- } else {
- }
- } else {
- if (inter != null && inter.isValid()) {
- if (com1 != null && com1.isValid()) {
- if (com1.containsText("ore")) {
- com1.doClick(true);
- sleep(800, 1400);
- }
- }
- }
- if (inter2 != null && inter2.isValid()) {
- if (com2 != null && com2.isValid()) {
- if (com2.containsText("clay")) {
- com2.doClick(true);
- enterAmount = true;
- sleep(800, 1400);
- }
- }
- }
- if (inter3 != null && inter3.isValid()) {
- if (com3 != null && com3.isValid()) {
- if (com3.containsText("amount") && enterAmount) {
- keyboard.sendText("24", true);
- check2 = 24;
- enterAmount = false;
- sleep(1000, 1400);
- }
- }
- }
- }
- }// </editor-fold>
- public void checkLevelUp() {
- RSInterface inter = interfaces.get(740);
- RSComponent com1 = inter.getComponent(0);
- RSComponent com2 = inter.getComponent(3);
- if (inter != null && inter.isValid()) {
- if (com1 != null && com1.isValid()) {
- if (com2 != null && com2.isValid()) {
- log("You Leveled up!");
- walking.walkTileOnScreen(getMyPlayer().getLocation());
- lvlsGained++;
- }
- }
- }
- }
- //START: Code generated using Enfilade's Easel
- private final Color color1 = new Color(0, 153, 0, 155);
- private final Color color2 = new Color(0, 0, 0);
- private final Color color3 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Calibri", 0, 15);
- public void onRepaint(Graphics g1) {
- Graphics2D g = (Graphics2D)g1;
- if (normal != null) {
- final int mouse_x = mouse.getLocation().x;
- final int mouse_y = mouse.getLocation().y;
- final int mouse_x2 = mouse.getPressLocation().x;
- final int mouse_y2 = mouse.getPressLocation().y;
- final long mpt = System.currentTimeMillis()
- - mouse.getPressTime();
- if (mouse.getPressTime() == -1 || mpt >= 1000) {
- g.drawImage(normal, mouse_x - 8, mouse_y - 8, null); //this show the mouse when its not clicked
- }
- if (mpt < 1000) {
- g.drawImage(clicked, mouse_x2 - 8, mouse_y2 - 8, null); //this show the four squares where you clicked.
- g.drawImage(normal, mouse_x - 8, mouse_y - 8, null); //this show the mouse as normal when its/just clicked
- }
- }
- tabHr = (int) ((nowTabs) * 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(color1);
- g.fillRect(2, 290, 514, 48);
- g.setColor(color2);
- g.setStroke(stroke1);
- g.drawRect(2, 290, 514, 48);
- g.setColor(color1);
- g.fillRect(298, 339, 218, 140);
- g.setColor(color2);
- g.drawRect(298, 339, 218, 140);
- g.setFont(font1);
- g.setColor(color3);
- g.drawString("Run Time: "+ hours + ":" + minutes + ":" + seconds, 301, 366);
- g.drawString("Total Tabs Made: "+nowTabs, 301, 396);
- g.drawString("Tabs Per Hour: "+tabHr, 301, 426);
- g.drawString("Total Money Made:", 301, 456);
- g.drawString("Script Status: "+status, 4, 335);
- g.drawString("Script Written by : Deww1", 5, 311);
- g.drawString("Script Version: "+ver, 381, 337);
- g.drawString("Automatic Tablet Maker FREE", 333, 311);
- }
- //END: Code generated using Enfilade's Easel
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement