Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package scripts;
- import java.awt.*;
- import java.awt.event.KeyEvent;
- import org.tribot.api.DynamicClicking;
- import org.tribot.api.General;
- import org.tribot.api.Screen;
- import org.tribot.api.Timing;
- import org.tribot.api.input.Keyboard;
- import org.tribot.api.input.Mouse;
- import org.tribot.api.interfaces.Positionable;
- import org.tribot.api.types.generic.Condition;
- import org.tribot.api.types.generic.FilterGroup;
- import org.tribot.api2007.Banking;
- import org.tribot.api2007.Camera;
- import org.tribot.api2007.ChooseOption;
- import org.tribot.api2007.Game;
- import org.tribot.api2007.GameTab;
- import org.tribot.api2007.GameTab.TABS;
- import org.tribot.api2007.Constants;
- import org.tribot.api2007.Equipment;
- import org.tribot.api2007.GroundItems;
- import org.tribot.api2007.Interfaces;
- import org.tribot.api2007.Inventory;
- import org.tribot.api2007.Login;
- import org.tribot.api2007.NPCChat;
- import org.tribot.api2007.NPCs;
- import org.tribot.api2007.Objects;
- import org.tribot.api2007.Player;
- import org.tribot.api2007.Players;
- import org.tribot.api2007.Projection;
- import org.tribot.api2007.Skills;
- import org.tribot.api2007.Walking;
- import org.tribot.api2007.WebWalking;
- import org.tribot.api2007.types.RSCharacter;
- import org.tribot.api2007.types.RSGroundItem;
- import org.tribot.api2007.types.RSInterface;
- import org.tribot.api2007.types.RSInterfaceChild;
- import org.tribot.api2007.types.RSItem;
- import org.tribot.api2007.types.RSNPC;
- import org.tribot.api2007.types.RSObject;
- import org.tribot.api2007.types.RSPlayer;
- import org.tribot.api2007.types.RSTile;
- import org.tribot.script.Script;
- import org.tribot.script.ScriptManifest;
- import org.tribot.script.interfaces.Breaking;
- import org.tribot.script.interfaces.MessageListening07;
- import org.tribot.script.interfaces.Painting;
- import org.tribot.script.interfaces.Pausing;
- import org.tribot.script.interfaces.RandomEvents;
- import javax.imageio.ImageIO;
- import java.io.IOException;
- import java.net.URL;
- import java.text.NumberFormat;
- import java.text.ParseException;
- import java.util.ArrayList;
- @ScriptManifest(authors = {"Flexx"}, version = 1.0, category = "Money making", name = "Tab Maker", description = "Makes varrock tabs! Have a rope bell pull, and your house in Rimmington")
- public class TabMaker extends Script implements Painting, MessageListening07, Breaking, RandomEvents {
- private final long timeBegan = System.currentTimeMillis();
- private final RSArea bank =
- new RSArea(2946, 3097, 0, 2957, 3229, 0);
- private final RSArea walk =
- new RSArea(2539, 3074, 0, 2608, 3109, 0);
- private final RSArea portal =
- new RSArea(2946, 3097, 0, 2957, 3229, 0);
- private final RSArea rimmington =
- new RSArea(2975, 3191, 0, 2929, 3236, 0);
- private final RSTile portalTile = new RSTile(2954, 3224, 0);
- int runeID = 0;
- int tabsMade = 0;
- boolean sup = false;
- boolean unlogged;
- boolean sleeping = false;
- private final Color blue = new Color(0, 0, 128);
- public Point first = new Point(258, 429);
- public Point second = new Point(259, 427);
- public Point third = new Point(261, 431);
- private boolean onStart(){
- println("Starting script...");
- Mouse.setSpeed(General.random(114, 120));
- Camera.setCameraAngle(100);
- Walking.setControlClick(true);
- Walking.setWalkingTimeout(General.random(2200,3200));
- println("Your mouse speed is: " + Mouse.getSpeed());
- return true;
- }
- private boolean houseSelect(){
- if(Interfaces.get(232, 0) != null){
- return true;
- }
- return false;
- }
- private boolean loadScreen(){
- if(Screen.getColourAt(108,250).equals(Color.black) && Screen.getColourAt(483,51).equals(Color.black)){
- return true;
- }
- return false;
- }
- private void typeName(){
- RSInterface hi = Interfaces.get(232,1);
- if(hi != null){
- hi.click();
- waitFor(new Condition() {
- @Override
- public boolean active() {
- return atHouse() && !loadScreen();
- }
- }, General.random(5000, 6000));
- }
- }
- private boolean atHouse(){
- if(Player.getPosition().getY() > 3500 || Player.getPosition().getY() < 2500 || Player.getPosition().getX() > 2800){
- if(!atArea(rimmington)){
- return true;
- }
- }
- return false;
- }
- private void enterHouse(){
- RSObject[] portal = Objects.findNearest(10, "Portal");
- if(portal.length > 0){
- if(portal[0].isOnScreen()){
- portal[0].hover();
- sleep(200,300);
- Mouse.click(3);
- waitFor(new Condition() {
- @Override
- public boolean active() {
- return ChooseOption.isOpen();
- }
- }, General.random(3000, 4000));
- if(ChooseOption.isOpen()){
- if(ChooseOption.isOptionValid("Enter")){
- if(ChooseOption.select("Enter")){
- waitFor(new Condition() {
- @Override
- public boolean active() {
- return houseSelect();
- }
- }, General.random(3000, 4000));
- }
- typeName();
- }else{
- ChooseOption.close();
- }
- }
- }else{
- WebWalking.walkTo(portal[0].getPosition());
- sleep(100);
- while(Player.isMoving()){
- sleep(50);
- }
- }
- }
- }
- private void findButler(){
- RSObject[] bell = Objects.findNearest(20, "Rope bell-pull");
- if(bell.length > 0){
- if(bell[0].isOnScreen()){
- if(!Player.isMoving()){
- if(!ChooseOption.isOpen()){
- bell[0].hover();
- sleep(100,200);
- if(Game.getUptext().contains("Ring")){
- Mouse.click(3);
- waitFor(new Condition() {
- @Override
- public boolean active() {
- return ChooseOption.isOpen();
- }
- }, General.random(500, 800));
- }else{
- return;
- }
- }else{
- if(ChooseOption.isOptionValid("Ring")){
- if(ChooseOption.select("Ring")){
- sleep(100,200);
- while(Player.isMoving()){
- sleep(100,200);
- }
- waitFor(new Condition() {
- @Override
- public boolean active() {
- return butlerTalking();
- }
- }, General.random(4000, 5000));
- }
- }else{
- ChooseOption.close();
- }
- }
- }
- }else{
- Walking.blindWalkTo(bell[0].getPosition());
- }
- }
- }
- private boolean isButler(){
- RSNPC[] butler = NPCs.find("Demon butler");
- if(butler.length > 0){
- if(butler[0].isOnScreen() && butler[0].getPosition().distanceTo(Player.getPosition()) < 3){
- return true;
- }
- }
- return false;
- }
- private boolean butlerTalking(){
- if(Interfaces.get(241,1) != null){
- return true;
- }
- return false;
- }
- private boolean chatInterfaces(){
- if(Interfaces.get(241,1) != null || Interfaces.get(234, 0) != null || Interfaces.get(228, 0) != null
- || Interfaces.get(64,1) != null || enterAmount() || Interfaces.get(242,1) != null || Interfaces.get(230,1) != null ||
- Interfaces.get(243,2) != null){
- return true;
- }
- return false;
- }
- private boolean enterAmount(){
- if(Screen.getColourAt(first).equals(blue) && Screen.getColourAt(second).equals(blue) && Screen.getColourAt(third).equals(blue)){
- return true;
- }
- return false;
- }
- private boolean chooseOption(){
- if(Interfaces.get(234, 0) != null){
- return true;
- }
- return false;
- }
- private boolean toBankInterface(){
- if(Interfaces.get(234,2) != null){
- if(Interfaces.get(234,2).getText().contains("Go to the bank...")){
- return true;
- }
- }
- return false;
- }
- private boolean secondChooseOption(){
- if(Interfaces.get(228, 0) != null || Interfaces.get(230,0) != null){
- return true;
- }
- return false;
- }
- private boolean takeSomething(){
- if(Interfaces.get(228,2) != null){
- return true;
- }
- return false;
- }
- private boolean userChat(){
- if(Interfaces.get(64,1) != null){
- return true;
- }
- return false;
- }
- private boolean pageOne(){
- if(Interfaces.get(234,1) != null && Interfaces.get(234,1).getText().contains("Wooden")){
- return true;
- }
- return false;
- }
- private boolean pageTwo(){
- if(Interfaces.get(234,1) != null && Interfaces.get(234,1).getText().contains("Soft")){
- return true;
- }
- return false;
- }
- private boolean lastChat(){
- if(Interfaces.get(242,1) != null){
- return true;
- }
- return false;
- }
- private boolean payMe(){
- if(Interfaces.get(243,2) != null){
- if(Interfaces.get(243,2).getText().contains("Master")){
- return true;
- }
- }
- return false;
- }
- private boolean payInterface(){
- if(Interfaces.get(230,1) != null){
- if(Interfaces.get(230,1).getText().contains("Pay servant")){
- return true;
- }
- }
- return false;
- }
- private boolean fireServant(){
- if(Interfaces.get(228,0) != null){
- if(Interfaces.get(228,0).getText().contains("Do you really want")){
- return true;
- }
- }
- return false;
- }
- private boolean noMoney(){
- if(Inventory.getCount(995) < 10000){
- return true;
- }
- return false;
- }
- private void interactButler(){
- RSNPC[] butler = NPCs.find("Demon butler");
- if(butler.length > 0){
- if(!chatInterfaces()){
- if(Interfaces.get(79) != null){
- Walking.walkTo(Player.getPosition());
- }
- if(butler[0].click("Talk-to")){
- waitFor(new Condition() {
- @Override
- public boolean active() {
- return chatInterfaces();
- }
- }, General.random(3000, 4000));
- }
- }else{
- if(noMoney()){
- println("We've run out of cash, stopping.");
- stopScript();
- }
- if(payMe()){
- if(NPCChat.getClickContinueInterface() != null){
- NPCChat.clickContinue(true);
- }
- }
- if(lastChat()){
- if(NPCChat.getClickContinueInterface() != null){
- if(NPCChat.clickContinue(true)){
- RSObject[] lectern = Objects.findNearest(15, 13647);
- Walking.walkTo(lectern[0].getPosition());
- waitFor(new Condition() {
- @Override
- public boolean active() {
- return chatInterfaces();
- }
- }, General.random(9000, 10000));
- }
- }
- }
- if(butlerTalking() || userChat()){
- if(NPCChat.getClickContinueInterface() != null){
- NPCChat.clickContinue(true);
- }
- }
- if(chooseOption() || secondChooseOption()){
- if(payInterface()){
- RSInterface pay = Interfaces.get(230,1);
- if(pay != null){
- if(pay.hover()){
- Mouse.click(1);
- waitFor(new Condition() {
- @Override
- public boolean active() {
- return lastChat();
- }
- }, General.random(3000, 4000));
- tabsMade = tabsMade - 7;
- }
- }
- }
- if(toBankInterface()){
- RSInterface toBank = Interfaces.get(234,2);
- if(toBank != null){
- if(toBank.hover()){
- Mouse.click(1);
- waitFor(new Condition() {
- @Override
- public boolean active() {
- return takeSomething();
- }
- }, General.random(3000, 4000));
- }
- }
- }
- if(fireServant()){
- println("ALMOST FIRED");
- RSInterface no = Interfaces.get(228,2);
- if(no != null){
- no.hover();
- sleep(400,500);
- Mouse.click(1);
- waitFor(new Condition() {
- @Override
- public boolean active() {
- return !chatInterfaces();
- }
- }, General.random(3000, 4000));
- }
- }
- if(takeSomething()){
- RSInterface bringSomething = Interfaces.get(228,2);
- if(bringSomething != null){
- bringSomething.hover();
- Mouse.click(1);
- waitFor(new Condition() {
- @Override
- public boolean active() {
- return userChat();
- }
- }, General.random(3000, 4000));
- }
- }
- if(pageOne()){
- RSInterface more = Interfaces.get(234,5);
- if(more != null){
- if(more.hover()){
- Mouse.click(1);
- waitFor(new Condition() {
- @Override
- public boolean active() {
- return pageTwo();
- }
- }, General.random(3000, 4000));
- }
- }
- }
- if(pageTwo()){
- RSInterface clay = Interfaces.get(234,1);
- if(clay != null){
- if(clay.hover()){
- Mouse.click(1);
- waitFor(new Condition() {
- @Override
- public boolean active() {
- return enterAmount();
- }
- }, General.random(3000, 4000));
- }
- }
- }
- }
- if(enterAmount()){
- Keyboard.typeSend("24");
- waitFor(new Condition() {
- @Override
- public boolean active() {
- return lastChat();
- }
- }, General.random(3000, 4000));
- if(lastChat()){
- if(NPCChat.getClickContinueInterface() != null){
- if(NPCChat.clickContinue(true)){
- RSObject[] lectern = Objects.findNearest(15, 13647);
- if(lectern.length > 0){
- Walking.walkTo(lectern[0].getPosition());
- waitFor(new Condition() {
- @Override
- public boolean active() {
- return chatInterfaces();
- }
- }, General.random(9000, 10000));
- }
- }
- }
- }
- }
- }
- }
- }
- @Override
- public void run() {
- if(onStart()){
- while(true){
- sleep(50,100);
- if(atArea(portal)){
- enterHouse();
- }
- if(atHouse()){
- if(readyToMakeTabs()){
- if(!tabOpen()){
- Inventory.dropAllExcept(8013,557,995,563, 561,8015,1761,8010);
- clickLectern();
- }else{
- makeTabs();
- }
- }else{
- if(!isButler()){
- findButler();
- }else{
- interactButler();
- }
- }
- }
- if(!atArea(portal) && !atHouse() && !atArea(walk) && !atArea(bank)){
- println("Relocating");
- WebWalking.walkTo(portalTile);
- }
- }
- }
- }
- private void makeTabs(){
- sleep(300,500);
- RSInterface varrock = Interfaces.get(79,17);
- if(varrock != null){
- if(Inventory.getCount(1761) != 1){
- if(varrock.hover()){
- Mouse.click(3);
- if(ChooseOption.isOpen()){
- if(ChooseOption.isOptionValid("Make")){
- ChooseOption.select("Make-All");
- }
- }
- waitFor(new Condition() {
- @Override
- public boolean active() {
- return Interfaces.get(79) == null;
- }
- }, General.random(5000, 6000));
- tabsMade++;
- }
- }else{
- if(varrock.click()){
- waitFor(new Condition() {
- @Override
- public boolean active() {
- return Player.getAnimation() == -1;
- }
- }, General.random(5000, 6000));
- tabsMade++;
- }
- }
- }
- }
- private boolean readyToMakeTabs(){
- if(Inventory.getCount(runeID) > 0 && Inventory.getCount(1761) > 0){
- return true;
- }
- return false;
- }
- private boolean tabOpen(){
- if(Interfaces.get(79) != null){
- return true;
- }
- return false;
- }
- private void clickLectern(){
- RSObject[] lectern = Objects.findNearest(15, 13647);
- if(lectern.length > 0){
- if(Player.getPosition().distanceTo(lectern[0].getPosition()) > 3){
- Walking.walkTo(lectern[0].getPosition());
- sleep(100,200);
- while(Player.isMoving()){
- sleep(75,100);
- }
- }else{
- if(lectern[0].isOnScreen()){
- GameTab.open(TABS.INVENTORY);
- if(!ChooseOption.isOpen()){
- lectern[0].hover();
- waitFor(new Condition() {
- @Override
- public boolean active() {
- return !Game.getUptext().contains("Walk here");
- }
- }, General.random(500,600));
- Mouse.click(3);
- waitFor(new Condition() {
- @Override
- public boolean active() {
- return ChooseOption.isOpen();
- }
- }, General.random(500,600));
- }else{
- if(ChooseOption.isOptionValid("Study")){
- ChooseOption.select("Study");
- Mouse.moveBox(325, 171, 494, 26);
- waitFor(new Condition() {
- @Override
- public boolean active() {
- return tabOpen();
- }
- }, General.random(3000, 4000));
- }else{
- ChooseOption.close();
- }
- }
- }else{
- Walking.walkTo(lectern[0].getPosition());
- sleep(100);
- while(Player.isMoving()){
- sleep(75,100);
- }
- }
- }
- }
- }
- public boolean waitFor(Condition c, long timeout) {
- Timer t = new Timer(timeout);
- while ((t.isRunning()) && (!c.active())) {
- sleep(20);
- }
- c.active();
- return c.active();
- }
- private boolean atArea(RSArea a){
- if(a.ContainsRSTile(Player.getPosition())){
- return true;
- }
- return false;
- }
- private final Color color1 = new Color(102, 204, 0);
- private final Color color2 = new Color(0, 0, 0);
- private final Color color3 = new Color(255, 0, 0);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 1, 20);
- private final Font font2 = new Font("Arial", 0, 11);
- public void onPaint(Graphics g1) {
- long timeRan = System.currentTimeMillis() - timeBegan;
- int gpGained = ((tabsMade * 370));
- int gpPerHour = (int) (gpGained / ((System.currentTimeMillis() - timeBegan) / 3600000.0D));
- int tabsPerHour = (int) (tabsMade / ((System.currentTimeMillis() - timeBegan) / 3600000.0D));
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(16, 348, 468, 76);
- g.setColor(color2);
- g.setStroke(stroke1);
- g.drawRect(16, 348, 468, 76);
- g.setFont(font1);
- g.setColor(color3);
- g.drawString("Tabs r fun", 377, 369);
- g.setFont(font2);
- g.setColor(color2);
- g.drawString("Time ran: " + Timing.msToString(timeRan), 24, 365);
- g.drawString("Tabs made: " + tabsMade, 25, 396);
- g.drawString("Tabs /h: " + tabsPerHour, 26, 410);
- g.drawString("Money made: " + gpGained, 155, 398);
- g.drawString("Money /h: " + gpPerHour, 155, 408);
- g.drawString("Who's house?: ", 96, 378);
- }
- @Override
- public void clanMessageReceived(String arg0, String arg1) {
- // TODO Auto-generated method stub
- }
- @Override
- public void personalMessageReceived(String arg0, String arg1) {
- }
- @Override
- public void playerMessageReceived(String arg0, String arg1) {
- // TODO Auto-generated method stub
- }
- boolean a = false;
- @Override
- public void serverMessageReceived(String arg0){
- if(arg0.contains("You must hire a")){
- println("Fired servant, stopping");
- stopScript();
- }
- }
- @Override
- public void tradeRequestReceived(String arg0) {
- // TODO Auto-generated method stub
- }
- @Override
- public void onBreakEnd() {
- // TODO Auto-generated method stub
- }
- @Override
- public void onBreakStart(){
- }
- @Override
- public void onRandom(RANDOM_SOLVERS arg0) {
- Walking.walkTo(Player.getPosition());
- Walking.walkTo(Player.getPosition());
- Walking.walkTo(Player.getPosition());
- }
- @Override
- public boolean randomFailed(RANDOM_SOLVERS arg0) {
- // TODO Auto-generated method stub
- return false;
- }
- @Override
- public void randomSolved(RANDOM_SOLVERS arg0) {
- // TODO Auto-generated method stub
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement