Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.KeyEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
- public class vialfiller extends Script implements PaintListener{
- //Variables
- // - Essentials
- private int bankerID = 6533;
- private int fountainID = 24214;
- private int emptyVialID = 229;
- private int fullVialID = 227;
- private int runEnergy = 50;
- RSNPC banker;
- RSObject fountain;
- RSItem myVial;
- RSTile theBank = new RSTile(3167, 3489);
- RSTile theFountain = new RSTile(3191, 3471);
- RSTile glitchSpot = new RSTile(3192, 3487);
- RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
- RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
- RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
- RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
- // - GUI Options
- private int min = 1;
- private int max = 6;
- private int minSpeed = 6;
- private int maxSpeed = 9;
- private boolean guiWait = true;
- private boolean save = false;
- // - State check
- private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
- // - Paint stuff
- private String status = "Initializing...";
- private String isRunning = "";
- private int numFilled = 0;
- private int vialFilledPrice;
- private int vialEmptyPrice;
- private int profitPrice;
- private int profit;
- private long startTime;
- private long millis;
- private long hours;
- private long minutes;
- private long seconds;
- private float profSec = 0;
- private float profHour;
- private float hourlyProfit;
- private int hourlyProfitInt;
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 13);
- private final Font font2 = new Font("Arial", 1, 13);
- private final Font font3 = new Font("Vijaya", 1, 17);
- private boolean antiban = true;
- gui g = new gui();
- @Override
- public boolean onStart(){
- log("Welcome to Painlaws's Vial Filler");
- log("Waiting on GUI...");
- g.setVisible(true);
- while(guiWait){
- sleep(500);
- }
- log("GUI Settings loaded!");
- if(walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else{
- isRunning = "No";
- }
- vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
- vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
- profitPrice = vialFilledPrice - vialEmptyPrice;
- if(!save){
- startTime = System.currentTimeMillis();
- }
- else{
- startTime = 0;
- }
- return true;
- }
- @Override
- public void onFinish(){
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- }
- public void useItem(RSItem item, RSObject object){
- if(item != null && object != null && object.isOnScreen()){
- item.doClick(true);
- sleep(200, 300);
- object.doClick();
- }
- }
- public void fillVials(){
- if(fountain != null){
- status = "Filling Vials";
- useItem(myVial, fountain);
- while(inventory.contains(emptyVialID)){
- sleep(random(1000,1500));
- if(antiban){
- if(random(1, 3) == 2){
- mouse.moveSlightly();
- }
- }
- }
- status = "Vials filled";
- }
- else{
- status = "Fountain is null...retrying";
- sleep(random(600, 800));
- }
- }
- private void doBank(){
- try{
- if(banker != null){
- camera.turnTo(banker);
- if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
- status = "Opening Bank";
- banker.interact("Bank Banker");
- status = "Bank opened";
- sleep(random(900, 1050));
- status = "Depositing All";
- bank.depositAll();
- status = "Deposited All";
- sleep(random(780, 950));
- numFilled = bank.getCount(fullVialID);
- if(bank.getCount(emptyVialID) != 0){
- status = "Taking Vials";
- bank.withdraw(emptyVialID, 0);
- status = "Vials Taken";
- sleep(random(700, 960));
- }
- else{
- log("Out of vials. Quitting :/");
- bank.close();
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- stopScript(true);
- }
- status = "Closing Bank";
- bank.close();
- status = "Bank Closed";
- sleep(random(750, 910));
- }
- }
- sleep(random(300,500));
- }catch(Exception e){log(e);}
- }
- public void onToBank(){
- try{
- status = "Going to Bank";
- walking.walkTileMM(theBank);
- }catch(Exception e){log(e);}
- sleep(random(500, 700));
- }
- public void onToGlitch(){
- try{
- status = "Going to Fountain"; //What you don't know can't hurt you :P
- walking.walkTileMM(glitchSpot);
- }catch(Exception e){log(e);}
- sleep(random(500, 710));
- }
- public void onToFountain(){
- try{
- status = "Going to Fountain";
- walking.walkTileMM(theFountain);
- }catch(Exception e){log(e);}
- sleep(random(500, 705));
- }
- public void runcheck() {
- try{
- runEnergy = (random(50, 70));
- if (walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
- walking.setRun(true);
- isRunning = "Yes";
- sleep(random(300, 500));
- }
- else{
- isRunning = "No";
- sleep(random(300,500));
- }
- }catch(Exception ex){}
- }
- @Override
- public int loop(){
- mouse.setSpeed(random(minSpeed, maxSpeed));
- runcheck();
- if(antiban){
- if(random(min, max) == 3){
- antiban();
- }
- }
- if(objects.getNearest(fountainID) != null){
- fountain = objects.getNearest(fountainID);
- }
- if(npcs.getNearest(bankerID) != null){
- banker = npcs.getNearest(bankerID);
- }
- if(inventory.getItem(emptyVialID) != null){
- myVial = inventory.getItem(emptyVialID);
- }
- switch(getState()){
- case TOFOUNTAIN:
- runcheck();
- onToFountain();
- if(fountainRange.contains(players.getMyPlayer().getLocation())){
- fillVials();
- }
- break;
- case TOGLITCH:
- runcheck();
- onToGlitch();
- break;
- case TOBANK:
- runcheck();
- onToBank();
- if(bankRange.contains(players.getMyPlayer().getLocation())){
- doBank();
- }
- break;
- }
- return(random(500, 1000));
- }
- private State getState() {
- if (!inventory.contains(emptyVialID)) {
- return State.TOBANK;
- }
- else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
- return State.TOGLITCH;
- }
- else{
- return State.TOFOUNTAIN;
- }
- }
- // GUI and Mouse
- public void onRepaint(Graphics g1) {
- profit = numFilled * profitPrice;
- if(!save){
- 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;
- if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
- profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- profHour = profSec * 3600;
- hourlyProfit = profHour * profitPrice;
- hourlyProfitInt = Math.round(hourlyProfit);
- }
- else{
- millis = 0;
- hours = 0;
- minutes = 0;
- seconds = 0;
- hourlyProfitInt = 9001;
- }
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(7, 345, 488, 70);
- g.setStroke(stroke1);
- g.drawRect(7, 345, 488, 70);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Status:", 14, 362);
- g.setFont(font2);
- g.drawString(status, 59, 362);
- g.setFont(font1);
- g.drawString("Filled Vials In Bank:", 209, 362);
- g.setFont(font2);
- g.drawString(Integer.toString(numFilled), 328, 362);
- g.setFont(font1);
- g.drawString("Profit:", 14, 383);
- g.setFont(font2);
- g.drawString(Integer.toString(profit), 59, 383);
- g.setFont(font1);
- g.drawString("Profit/hr:", 137, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
- }
- else{
- g.drawString("Mem Save", 190, 383);
- }
- g.setFont(font1);
- g.drawString("Runtime:", 270, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
- }
- else{
- g.drawString("Mem Save", 325, 384);
- }
- g.setFont(font1);
- g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
- g.drawString("Running:", 710, 139);
- g.setFont(font2);
- g.drawString(isRunning, 722, 156);
- g.setFont(font3);
- g.drawString("Painlaws", 440, 357);
- g1.setColor(Color.green);
- g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
- g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
- }
- /* Antiban stuff
- * Some credits to Aaimister :)
- * Partially copied, with permission
- */
- public void rotateCamera() {
- final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- final int randomLR = random(0, 2);
- final int randomUD = random(0, 2);
- final int randomAll = random(0, 4);
- if (random(0, 3) == 0) {
- keyboard.pressKey(LR[randomLR]);
- sleepCR(random(2, 9));
- keyboard.pressKey(UD[randomUD]);
- sleepCR(random(6, 10));
- keyboard.releaseKey(UD[randomUD]);
- sleepCR(random(2, 7));
- keyboard.releaseKey(LR[randomLR]);
- } else {
- keyboard.pressKey(LRUD[randomAll]);
- if (randomAll > 1) {
- sleepCR(random(6, 11));
- } else {
- sleepCR(random(9, 12));
- }
- keyboard.releaseKey(LRUD[randomAll]);
- }
- }
- private boolean sleepCR(final int amtOfHalfSecs) {
- for (int x = 0; x < amtOfHalfSecs + 1; x++) {
- sleep(random(48, 53));
- }
- return true;
- }
- private void antiban(){
- int action = random(0, 5);
- switch (action) {
- case 0:
- status = "Antiban";
- rotateCamera();
- sleep(200, 400);
- break;
- case 1:
- status = "Antiban";
- mouse.moveRandomly(100, 900);
- sleep(200, 400);
- break;
- case 2:
- status = "Antiban";
- mouse.moveSlightly();
- sleep(200, 400);
- break;
- case 3:
- status = "Antiban";
- camera.moveRandomly(random(750,1250));
- sleep(200, 400);
- break;
- case 4:
- status = "Antiban";
- checkEXP();
- sleep(200, 400);
- break;
- case 5:
- status = "Antiban";
- mouse.moveOffScreen();
- sleep(200, 400);
- break;
- }
- }
- public void checkEXP() {
- game.openTab(Game.Tab.STATS);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(random(2100, 3400));
- game.openTab(Game.Tab.INVENTORY);
- sleep(random(540,760));
- }
- class gui extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e){
- String mode = selectionBox.getSelectedItem().toString();
- if(mode.equals("Maximum")){
- antiban = false;
- minSpeed = 5;
- maxSpeed = 6;
- }
- else if(mode.equals("Paranoid")){
- antiban = true;
- minSpeed = 8;
- maxSpeed = 10;
- min = 3;
- max = 3;
- }
- save = memoryMode.isSelected();
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- selectionBox = new JComboBox();
- memoryMode = new JCheckBox();
- label2 = new JLabel();
- label3 = new JLabel();
- label4 = new JLabel();
- label5 = new JLabel();
- startButton = new JButton();
- //======== this ========
- setTitle("Painlaws's Vial Filler");
- setResizable(false);
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Mode");
- //---- selectionBox ----
- selectionBox.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Paranoid",
- "Maximum"
- }));
- //---- memoryMode ----
- memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
- //---- label2 ----
- label2.setText("Modes:");
- //---- label3 ----
- label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
- //---- label4 ----
- label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
- //---- label5 ----
- label5.setText("Maximum - No Antiban, Fast Mouse Speed");
- //---- startButton ----
- startButton.setText("Let's Fill Some Vials!");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e){
- startButtonActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
- .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGap(148, 148, 148)
- .addComponent(startButton)))
- .addContainerGap(2, Short.MAX_VALUE))
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label1)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(memoryMode)
- .addGap(18, 18, 18)
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label4)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox selectionBox;
- private JCheckBox memoryMode;
- private JLabel label2;
- private JLabel label3;
- private JLabel label4;
- private JLabel label5;
- private JButton startButton;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.KeyEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
- public class vialfiller extends Script implements PaintListener{
- //Variables
- // - Essentials
- private int bankerID = 6533;
- private int fountainID = 24214;
- private int emptyVialID = 229;
- private int fullVialID = 227;
- private int runEnergy = 50;
- RSNPC banker;
- RSObject fountain;
- RSItem myVial;
- RSTile theBank = new RSTile(3167, 3489);
- RSTile theFountain = new RSTile(3191, 3471);
- RSTile glitchSpot = new RSTile(3192, 3487);
- RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
- RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
- RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
- RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
- // - GUI Options
- private int min = 1;
- private int max = 6;
- private int minSpeed = 6;
- private int maxSpeed = 9;
- private boolean guiWait = true;
- private boolean save = false;
- // - State check
- private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
- // - Paint stuff
- private String status = "Initializing...";
- private String isRunning = "";
- private int numFilled = 0;
- private int vialFilledPrice;
- private int vialEmptyPrice;
- private int profitPrice;
- private int profit;
- private long startTime;
- private long millis;
- private long hours;
- private long minutes;
- private long seconds;
- private float profSec = 0;
- private float profHour;
- private float hourlyProfit;
- private int hourlyProfitInt;
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 13);
- private final Font font2 = new Font("Arial", 1, 13);
- private final Font font3 = new Font("Vijaya", 1, 17);
- private boolean antiban = true;
- gui g = new gui();
- @Override
- public boolean onStart(){
- log("Welcome to Painlaws's Vial Filler");
- log("Waiting on GUI...");
- g.setVisible(true);
- while(guiWait){
- sleep(500);
- }
- log("GUI Settings loaded!");
- if(walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else{
- isRunning = "No";
- }
- vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
- vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
- profitPrice = vialFilledPrice - vialEmptyPrice;
- if(!save){
- startTime = System.currentTimeMillis();
- }
- else{
- startTime = 0;
- }
- return true;
- }
- @Override
- public void onFinish(){
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- }
- public void useItem(RSItem item, RSObject object){
- if(item != null && object != null && object.isOnScreen()){
- item.doClick(true);
- sleep(200, 300);
- object.doClick();
- }
- }
- public void fillVials(){
- if(fountain != null){
- status = "Filling Vials";
- useItem(myVial, fountain);
- while(inventory.contains(emptyVialID)){
- sleep(random(1000,1500));
- if(antiban){
- if(random(1, 3) == 2){
- mouse.moveSlightly();
- }
- }
- }
- status = "Vials filled";
- }
- else{
- status = "Fountain is null...retrying";
- sleep(random(600, 800));
- }
- }
- private void doBank(){
- try{
- if(banker != null){
- camera.turnTo(banker);
- if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
- status = "Opening Bank";
- banker.interact("Bank Banker");
- status = "Bank opened";
- sleep(random(900, 1050));
- status = "Depositing All";
- bank.depositAll();
- status = "Deposited All";
- sleep(random(780, 950));
- numFilled = bank.getCount(fullVialID);
- if(bank.getCount(emptyVialID) != 0){
- status = "Taking Vials";
- bank.withdraw(emptyVialID, 0);
- status = "Vials Taken";
- sleep(random(700, 960));
- }
- else{
- log("Out of vials. Quitting :/");
- bank.close();
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- stopScript(true);
- }
- status = "Closing Bank";
- bank.close();
- status = "Bank Closed";
- sleep(random(750, 910));
- }
- }
- sleep(random(300,500));
- }catch(Exception e){log(e);}
- }
- public void onToBank(){
- try{
- status = "Going to Bank";
- walking.walkTileMM(theBank);
- }catch(Exception e){log(e);}
- sleep(random(500, 700));
- }
- public void onToGlitch(){
- try{
- status = "Going to Fountain"; //What you don't know can't hurt you :P
- walking.walkTileMM(glitchSpot);
- }catch(Exception e){log(e);}
- sleep(random(500, 710));
- }
- public void onToFountain(){
- try{
- status = "Going to Fountain";
- walking.walkTileMM(theFountain);
- }catch(Exception e){log(e);}
- sleep(random(500, 705));
- }
- public void runcheck() {
- try{
- runEnergy = (random(50, 70));
- if (walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
- walking.setRun(true);
- isRunning = "Yes";
- sleep(random(300, 500));
- }
- else{
- isRunning = "No";
- sleep(random(300,500));
- }
- }catch(Exception ex){}
- }
- @Override
- public int loop(){
- mouse.setSpeed(random(minSpeed, maxSpeed));
- runcheck();
- if(antiban){
- if(random(min, max) == 3){
- antiban();
- }
- }
- if(objects.getNearest(fountainID) != null){
- fountain = objects.getNearest(fountainID);
- }
- if(npcs.getNearest(bankerID) != null){
- banker = npcs.getNearest(bankerID);
- }
- if(inventory.getItem(emptyVialID) != null){
- myVial = inventory.getItem(emptyVialID);
- }
- switch(getState()){
- case TOFOUNTAIN:
- runcheck();
- onToFountain();
- if(fountainRange.contains(players.getMyPlayer().getLocation())){
- fillVials();
- }
- break;
- case TOGLITCH:
- runcheck();
- onToGlitch();
- break;
- case TOBANK:
- runcheck();
- onToBank();
- if(bankRange.contains(players.getMyPlayer().getLocation())){
- doBank();
- }
- break;
- }
- return(random(500, 1000));
- }
- private State getState() {
- if (!inventory.contains(emptyVialID)) {
- return State.TOBANK;
- }
- else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
- return State.TOGLITCH;
- }
- else{
- return State.TOFOUNTAIN;
- }
- }
- // GUI and Mouse
- public void onRepaint(Graphics g1) {
- profit = numFilled * profitPrice;
- if(!save){
- 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;
- if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
- profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- profHour = profSec * 3600;
- hourlyProfit = profHour * profitPrice;
- hourlyProfitInt = Math.round(hourlyProfit);
- }
- else{
- millis = 0;
- hours = 0;
- minutes = 0;
- seconds = 0;
- hourlyProfitInt = 9001;
- }
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(7, 345, 488, 70);
- g.setStroke(stroke1);
- g.drawRect(7, 345, 488, 70);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Status:", 14, 362);
- g.setFont(font2);
- g.drawString(status, 59, 362);
- g.setFont(font1);
- g.drawString("Filled Vials In Bank:", 209, 362);
- g.setFont(font2);
- g.drawString(Integer.toString(numFilled), 328, 362);
- g.setFont(font1);
- g.drawString("Profit:", 14, 383);
- g.setFont(font2);
- g.drawString(Integer.toString(profit), 59, 383);
- g.setFont(font1);
- g.drawString("Profit/hr:", 137, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
- }
- else{
- g.drawString("Mem Save", 190, 383);
- }
- g.setFont(font1);
- g.drawString("Runtime:", 270, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
- }
- else{
- g.drawString("Mem Save", 325, 384);
- }
- g.setFont(font1);
- g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
- g.drawString("Running:", 710, 139);
- g.setFont(font2);
- g.drawString(isRunning, 722, 156);
- g.setFont(font3);
- g.drawString("Painlaws", 440, 357);
- g1.setColor(Color.green);
- g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
- g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
- }
- /* Antiban stuff
- * Some credits to Aaimister :)
- * Partially copied, with permission
- */
- public void rotateCamera() {
- final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- final int randomLR = random(0, 2);
- final int randomUD = random(0, 2);
- final int randomAll = random(0, 4);
- if (random(0, 3) == 0) {
- keyboard.pressKey(LR[randomLR]);
- sleepCR(random(2, 9));
- keyboard.pressKey(UD[randomUD]);
- sleepCR(random(6, 10));
- keyboard.releaseKey(UD[randomUD]);
- sleepCR(random(2, 7));
- keyboard.releaseKey(LR[randomLR]);
- } else {
- keyboard.pressKey(LRUD[randomAll]);
- if (randomAll > 1) {
- sleepCR(random(6, 11));
- } else {
- sleepCR(random(9, 12));
- }
- keyboard.releaseKey(LRUD[randomAll]);
- }
- }
- private boolean sleepCR(final int amtOfHalfSecs) {
- for (int x = 0; x < amtOfHalfSecs + 1; x++) {
- sleep(random(48, 53));
- }
- return true;
- }
- private void antiban(){
- int action = random(0, 5);
- switch (action) {
- case 0:
- status = "Antiban";
- rotateCamera();
- sleep(200, 400);
- break;
- case 1:
- status = "Antiban";
- mouse.moveRandomly(100, 900);
- sleep(200, 400);
- break;
- case 2:
- status = "Antiban";
- mouse.moveSlightly();
- sleep(200, 400);
- break;
- case 3:
- status = "Antiban";
- camera.moveRandomly(random(750,1250));
- sleep(200, 400);
- break;
- case 4:
- status = "Antiban";
- checkEXP();
- sleep(200, 400);
- break;
- case 5:
- status = "Antiban";
- mouse.moveOffScreen();
- sleep(200, 400);
- break;
- }
- }
- public void checkEXP() {
- game.openTab(Game.Tab.STATS);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(random(2100, 3400));
- game.openTab(Game.Tab.INVENTORY);
- sleep(random(540,760));
- }
- class gui extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e){
- String mode = selectionBox.getSelectedItem().toString();
- if(mode.equals("Maximum")){
- antiban = false;
- minSpeed = 5;
- maxSpeed = 6;
- }
- else if(mode.equals("Paranoid")){
- antiban = true;
- minSpeed = 8;
- maxSpeed = 10;
- min = 3;
- max = 3;
- }
- save = memoryMode.isSelected();
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- selectionBox = new JComboBox();
- memoryMode = new JCheckBox();
- label2 = new JLabel();
- label3 = new JLabel();
- label4 = new JLabel();
- label5 = new JLabel();
- startButton = new JButton();
- //======== this ========
- setTitle("Painlaws's Vial Filler");
- setResizable(false);
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Mode");
- //---- selectionBox ----
- selectionBox.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Paranoid",
- "Maximum"
- }));
- //---- memoryMode ----
- memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
- //---- label2 ----
- label2.setText("Modes:");
- //---- label3 ----
- label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
- //---- label4 ----
- label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
- //---- label5 ----
- label5.setText("Maximum - No Antiban, Fast Mouse Speed");
- //---- startButton ----
- startButton.setText("Let's Fill Some Vials!");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e){
- startButtonActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
- .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGap(148, 148, 148)
- .addComponent(startButton)))
- .addContainerGap(2, Short.MAX_VALUE))
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label1)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(memoryMode)
- .addGap(18, 18, 18)
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label4)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox selectionBox;
- private JCheckBox memoryMode;
- private JLabel label2;
- private JLabel label3;
- private JLabel label4;
- private JLabel label5;
- private JButton startButton;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.KeyEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
- public class vialfiller extends Script implements PaintListener{
- //Variables
- // - Essentials
- private int bankerID = 6533;
- private int fountainID = 24214;
- private int emptyVialID = 229;
- private int fullVialID = 227;
- private int runEnergy = 50;
- RSNPC banker;
- RSObject fountain;
- RSItem myVial;
- RSTile theBank = new RSTile(3167, 3489);
- RSTile theFountain = new RSTile(3191, 3471);
- RSTile glitchSpot = new RSTile(3192, 3487);
- RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
- RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
- RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
- RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
- // - GUI Options
- private int min = 1;
- private int max = 6;
- private int minSpeed = 6;
- private int maxSpeed = 9;
- private boolean guiWait = true;
- private boolean save = false;
- // - State check
- private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
- // - Paint stuff
- private String status = "Initializing...";
- private String isRunning = "";
- private int numFilled = 0;
- private int vialFilledPrice;
- private int vialEmptyPrice;
- private int profitPrice;
- private int profit;
- private long startTime;
- private long millis;
- private long hours;
- private long minutes;
- private long seconds;
- private float profSec = 0;
- private float profHour;
- private float hourlyProfit;
- private int hourlyProfitInt;
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 13);
- private final Font font2 = new Font("Arial", 1, 13);
- private final Font font3 = new Font("Vijaya", 1, 17);
- private boolean antiban = true;
- gui g = new gui();
- @Override
- public boolean onStart(){
- log("Welcome to Painlaws's Vial Filler");
- log("Waiting on GUI...");
- g.setVisible(true);
- while(guiWait){
- sleep(500);
- }
- log("GUI Settings loaded!");
- if(walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else{
- isRunning = "No";
- }
- vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
- vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
- profitPrice = vialFilledPrice - vialEmptyPrice;
- if(!save){
- startTime = System.currentTimeMillis();
- }
- else{
- startTime = 0;
- }
- return true;
- }
- @Override
- public void onFinish(){
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- }
- public void useItem(RSItem item, RSObject object){
- if(item != null && object != null && object.isOnScreen()){
- item.doClick(true);
- sleep(200, 300);
- object.doClick();
- }
- }
- public void fillVials(){
- if(fountain != null){
- status = "Filling Vials";
- useItem(myVial, fountain);
- while(inventory.contains(emptyVialID)){
- sleep(random(1000,1500));
- if(antiban){
- if(random(1, 3) == 2){
- mouse.moveSlightly();
- }
- }
- }
- status = "Vials filled";
- }
- else{
- status = "Fountain is null...retrying";
- sleep(random(600, 800));
- }
- }
- private void doBank(){
- try{
- if(banker != null){
- camera.turnTo(banker);
- if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
- status = "Opening Bank";
- banker.interact("Bank Banker");
- status = "Bank opened";
- sleep(random(900, 1050));
- status = "Depositing All";
- bank.depositAll();
- status = "Deposited All";
- sleep(random(780, 950));
- numFilled = bank.getCount(fullVialID);
- if(bank.getCount(emptyVialID) != 0){
- status = "Taking Vials";
- bank.withdraw(emptyVialID, 0);
- status = "Vials Taken";
- sleep(random(700, 960));
- }
- else{
- log("Out of vials. Quitting :/");
- bank.close();
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- stopScript(true);
- }
- status = "Closing Bank";
- bank.close();
- status = "Bank Closed";
- sleep(random(750, 910));
- }
- }
- sleep(random(300,500));
- }catch(Exception e){log(e);}
- }
- public void onToBank(){
- try{
- status = "Going to Bank";
- walking.walkTileMM(theBank);
- }catch(Exception e){log(e);}
- sleep(random(500, 700));
- }
- public void onToGlitch(){
- try{
- status = "Going to Fountain"; //What you don't know can't hurt you :P
- walking.walkTileMM(glitchSpot);
- }catch(Exception e){log(e);}
- sleep(random(500, 710));
- }
- public void onToFountain(){
- try{
- status = "Going to Fountain";
- walking.walkTileMM(theFountain);
- }catch(Exception e){log(e);}
- sleep(random(500, 705));
- }
- public void runcheck() {
- try{
- runEnergy = (random(50, 70));
- if (walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
- walking.setRun(true);
- isRunning = "Yes";
- sleep(random(300, 500));
- }
- else{
- isRunning = "No";
- sleep(random(300,500));
- }
- }catch(Exception ex){}
- }
- @Override
- public int loop(){
- mouse.setSpeed(random(minSpeed, maxSpeed));
- runcheck();
- if(antiban){
- if(random(min, max) == 3){
- antiban();
- }
- }
- if(objects.getNearest(fountainID) != null){
- fountain = objects.getNearest(fountainID);
- }
- if(npcs.getNearest(bankerID) != null){
- banker = npcs.getNearest(bankerID);
- }
- if(inventory.getItem(emptyVialID) != null){
- myVial = inventory.getItem(emptyVialID);
- }
- switch(getState()){
- case TOFOUNTAIN:
- runcheck();
- onToFountain();
- if(fountainRange.contains(players.getMyPlayer().getLocation())){
- fillVials();
- }
- break;
- case TOGLITCH:
- runcheck();
- onToGlitch();
- break;
- case TOBANK:
- runcheck();
- onToBank();
- if(bankRange.contains(players.getMyPlayer().getLocation())){
- doBank();
- }
- break;
- }
- return(random(500, 1000));
- }
- private State getState() {
- if (!inventory.contains(emptyVialID)) {
- return State.TOBANK;
- }
- else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
- return State.TOGLITCH;
- }
- else{
- return State.TOFOUNTAIN;
- }
- }
- // GUI and Mouse
- public void onRepaint(Graphics g1) {
- profit = numFilled * profitPrice;
- if(!save){
- 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;
- if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
- profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- profHour = profSec * 3600;
- hourlyProfit = profHour * profitPrice;
- hourlyProfitInt = Math.round(hourlyProfit);
- }
- else{
- millis = 0;
- hours = 0;
- minutes = 0;
- seconds = 0;
- hourlyProfitInt = 9001;
- }
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(7, 345, 488, 70);
- g.setStroke(stroke1);
- g.drawRect(7, 345, 488, 70);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Status:", 14, 362);
- g.setFont(font2);
- g.drawString(status, 59, 362);
- g.setFont(font1);
- g.drawString("Filled Vials In Bank:", 209, 362);
- g.setFont(font2);
- g.drawString(Integer.toString(numFilled), 328, 362);
- g.setFont(font1);
- g.drawString("Profit:", 14, 383);
- g.setFont(font2);
- g.drawString(Integer.toString(profit), 59, 383);
- g.setFont(font1);
- g.drawString("Profit/hr:", 137, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
- }
- else{
- g.drawString("Mem Save", 190, 383);
- }
- g.setFont(font1);
- g.drawString("Runtime:", 270, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
- }
- else{
- g.drawString("Mem Save", 325, 384);
- }
- g.setFont(font1);
- g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
- g.drawString("Running:", 710, 139);
- g.setFont(font2);
- g.drawString(isRunning, 722, 156);
- g.setFont(font3);
- g.drawString("Painlaws", 440, 357);
- g1.setColor(Color.green);
- g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
- g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
- }
- /* Antiban stuff
- * Some credits to Aaimister :)
- * Partially copied, with permission
- */
- public void rotateCamera() {
- final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- final int randomLR = random(0, 2);
- final int randomUD = random(0, 2);
- final int randomAll = random(0, 4);
- if (random(0, 3) == 0) {
- keyboard.pressKey(LR[randomLR]);
- sleepCR(random(2, 9));
- keyboard.pressKey(UD[randomUD]);
- sleepCR(random(6, 10));
- keyboard.releaseKey(UD[randomUD]);
- sleepCR(random(2, 7));
- keyboard.releaseKey(LR[randomLR]);
- } else {
- keyboard.pressKey(LRUD[randomAll]);
- if (randomAll > 1) {
- sleepCR(random(6, 11));
- } else {
- sleepCR(random(9, 12));
- }
- keyboard.releaseKey(LRUD[randomAll]);
- }
- }
- private boolean sleepCR(final int amtOfHalfSecs) {
- for (int x = 0; x < amtOfHalfSecs + 1; x++) {
- sleep(random(48, 53));
- }
- return true;
- }
- private void antiban(){
- int action = random(0, 5);
- switch (action) {
- case 0:
- status = "Antiban";
- rotateCamera();
- sleep(200, 400);
- break;
- case 1:
- status = "Antiban";
- mouse.moveRandomly(100, 900);
- sleep(200, 400);
- break;
- case 2:
- status = "Antiban";
- mouse.moveSlightly();
- sleep(200, 400);
- break;
- case 3:
- status = "Antiban";
- camera.moveRandomly(random(750,1250));
- sleep(200, 400);
- break;
- case 4:
- status = "Antiban";
- checkEXP();
- sleep(200, 400);
- break;
- case 5:
- status = "Antiban";
- mouse.moveOffScreen();
- sleep(200, 400);
- break;
- }
- }
- public void checkEXP() {
- game.openTab(Game.Tab.STATS);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(random(2100, 3400));
- game.openTab(Game.Tab.INVENTORY);
- sleep(random(540,760));
- }
- class gui extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e){
- String mode = selectionBox.getSelectedItem().toString();
- if(mode.equals("Maximum")){
- antiban = false;
- minSpeed = 5;
- maxSpeed = 6;
- }
- else if(mode.equals("Paranoid")){
- antiban = true;
- minSpeed = 8;
- maxSpeed = 10;
- min = 3;
- max = 3;
- }
- save = memoryMode.isSelected();
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- selectionBox = new JComboBox();
- memoryMode = new JCheckBox();
- label2 = new JLabel();
- label3 = new JLabel();
- label4 = new JLabel();
- label5 = new JLabel();
- startButton = new JButton();
- //======== this ========
- setTitle("Painlaws's Vial Filler");
- setResizable(false);
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Mode");
- //---- selectionBox ----
- selectionBox.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Paranoid",
- "Maximum"
- }));
- //---- memoryMode ----
- memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
- //---- label2 ----
- label2.setText("Modes:");
- //---- label3 ----
- label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
- //---- label4 ----
- label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
- //---- label5 ----
- label5.setText("Maximum - No Antiban, Fast Mouse Speed");
- //---- startButton ----
- startButton.setText("Let's Fill Some Vials!");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e){
- startButtonActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
- .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGap(148, 148, 148)
- .addComponent(startButton)))
- .addContainerGap(2, Short.MAX_VALUE))
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label1)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(memoryMode)
- .addGap(18, 18, 18)
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label4)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox selectionBox;
- private JCheckBox memoryMode;
- private JLabel label2;
- private JLabel label3;
- private JLabel label4;
- private JLabel label5;
- private JButton startButton;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.KeyEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
- public class vialfiller extends Script implements PaintListener{
- //Variables
- // - Essentials
- private int bankerID = 6533;
- private int fountainID = 24214;
- private int emptyVialID = 229;
- private int fullVialID = 227;
- private int runEnergy = 50;
- RSNPC banker;
- RSObject fountain;
- RSItem myVial;
- RSTile theBank = new RSTile(3167, 3489);
- RSTile theFountain = new RSTile(3191, 3471);
- RSTile glitchSpot = new RSTile(3192, 3487);
- RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
- RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
- RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
- RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
- // - GUI Options
- private int min = 1;
- private int max = 6;
- private int minSpeed = 6;
- private int maxSpeed = 9;
- private boolean guiWait = true;
- private boolean save = false;
- // - State check
- private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
- // - Paint stuff
- private String status = "Initializing...";
- private String isRunning = "";
- private int numFilled = 0;
- private int vialFilledPrice;
- private int vialEmptyPrice;
- private int profitPrice;
- private int profit;
- private long startTime;
- private long millis;
- private long hours;
- private long minutes;
- private long seconds;
- private float profSec = 0;
- private float profHour;
- private float hourlyProfit;
- private int hourlyProfitInt;
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 13);
- private final Font font2 = new Font("Arial", 1, 13);
- private final Font font3 = new Font("Vijaya", 1, 17);
- private boolean antiban = true;
- gui g = new gui();
- @Override
- public boolean onStart(){
- log("Welcome to Painlaws's Vial Filler");
- log("Waiting on GUI...");
- g.setVisible(true);
- while(guiWait){
- sleep(500);
- }
- log("GUI Settings loaded!");
- if(walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else{
- isRunning = "No";
- }
- vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
- vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
- profitPrice = vialFilledPrice - vialEmptyPrice;
- if(!save){
- startTime = System.currentTimeMillis();
- }
- else{
- startTime = 0;
- }
- return true;
- }
- @Override
- public void onFinish(){
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- }
- public void useItem(RSItem item, RSObject object){
- if(item != null && object != null && object.isOnScreen()){
- item.doClick(true);
- sleep(200, 300);
- object.doClick();
- }
- }
- public void fillVials(){
- if(fountain != null){
- status = "Filling Vials";
- useItem(myVial, fountain);
- while(inventory.contains(emptyVialID)){
- sleep(random(1000,1500));
- if(antiban){
- if(random(1, 3) == 2){
- mouse.moveSlightly();
- }
- }
- }
- status = "Vials filled";
- }
- else{
- status = "Fountain is null...retrying";
- sleep(random(600, 800));
- }
- }
- private void doBank(){
- try{
- if(banker != null){
- camera.turnTo(banker);
- if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
- status = "Opening Bank";
- banker.interact("Bank Banker");
- status = "Bank opened";
- sleep(random(900, 1050));
- status = "Depositing All";
- bank.depositAll();
- status = "Deposited All";
- sleep(random(780, 950));
- numFilled = bank.getCount(fullVialID);
- if(bank.getCount(emptyVialID) != 0){
- status = "Taking Vials";
- bank.withdraw(emptyVialID, 0);
- status = "Vials Taken";
- sleep(random(700, 960));
- }
- else{
- log("Out of vials. Quitting :/");
- bank.close();
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- stopScript(true);
- }
- status = "Closing Bank";
- bank.close();
- status = "Bank Closed";
- sleep(random(750, 910));
- }
- }
- sleep(random(300,500));
- }catch(Exception e){log(e);}
- }
- public void onToBank(){
- try{
- status = "Going to Bank";
- walking.walkTileMM(theBank);
- }catch(Exception e){log(e);}
- sleep(random(500, 700));
- }
- public void onToGlitch(){
- try{
- status = "Going to Fountain"; //What you don't know can't hurt you :P
- walking.walkTileMM(glitchSpot);
- }catch(Exception e){log(e);}
- sleep(random(500, 710));
- }
- public void onToFountain(){
- try{
- status = "Going to Fountain";
- walking.walkTileMM(theFountain);
- }catch(Exception e){log(e);}
- sleep(random(500, 705));
- }
- public void runcheck() {
- try{
- runEnergy = (random(50, 70));
- if (walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
- walking.setRun(true);
- isRunning = "Yes";
- sleep(random(300, 500));
- }
- else{
- isRunning = "No";
- sleep(random(300,500));
- }
- }catch(Exception ex){}
- }
- @Override
- public int loop(){
- mouse.setSpeed(random(minSpeed, maxSpeed));
- runcheck();
- if(antiban){
- if(random(min, max) == 3){
- antiban();
- }
- }
- if(objects.getNearest(fountainID) != null){
- fountain = objects.getNearest(fountainID);
- }
- if(npcs.getNearest(bankerID) != null){
- banker = npcs.getNearest(bankerID);
- }
- if(inventory.getItem(emptyVialID) != null){
- myVial = inventory.getItem(emptyVialID);
- }
- switch(getState()){
- case TOFOUNTAIN:
- runcheck();
- onToFountain();
- if(fountainRange.contains(players.getMyPlayer().getLocation())){
- fillVials();
- }
- break;
- case TOGLITCH:
- runcheck();
- onToGlitch();
- break;
- case TOBANK:
- runcheck();
- onToBank();
- if(bankRange.contains(players.getMyPlayer().getLocation())){
- doBank();
- }
- break;
- }
- return(random(500, 1000));
- }
- private State getState() {
- if (!inventory.contains(emptyVialID)) {
- return State.TOBANK;
- }
- else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
- return State.TOGLITCH;
- }
- else{
- return State.TOFOUNTAIN;
- }
- }
- // GUI and Mouse
- public void onRepaint(Graphics g1) {
- profit = numFilled * profitPrice;
- if(!save){
- 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;
- if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
- profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- profHour = profSec * 3600;
- hourlyProfit = profHour * profitPrice;
- hourlyProfitInt = Math.round(hourlyProfit);
- }
- else{
- millis = 0;
- hours = 0;
- minutes = 0;
- seconds = 0;
- hourlyProfitInt = 9001;
- }
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(7, 345, 488, 70);
- g.setStroke(stroke1);
- g.drawRect(7, 345, 488, 70);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Status:", 14, 362);
- g.setFont(font2);
- g.drawString(status, 59, 362);
- g.setFont(font1);
- g.drawString("Filled Vials In Bank:", 209, 362);
- g.setFont(font2);
- g.drawString(Integer.toString(numFilled), 328, 362);
- g.setFont(font1);
- g.drawString("Profit:", 14, 383);
- g.setFont(font2);
- g.drawString(Integer.toString(profit), 59, 383);
- g.setFont(font1);
- g.drawString("Profit/hr:", 137, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
- }
- else{
- g.drawString("Mem Save", 190, 383);
- }
- g.setFont(font1);
- g.drawString("Runtime:", 270, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
- }
- else{
- g.drawString("Mem Save", 325, 384);
- }
- g.setFont(font1);
- g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
- g.drawString("Running:", 710, 139);
- g.setFont(font2);
- g.drawString(isRunning, 722, 156);
- g.setFont(font3);
- g.drawString("Painlaws", 440, 357);
- g1.setColor(Color.green);
- g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
- g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
- }
- /* Antiban stuff
- * Some credits to Aaimister :)
- * Partially copied, with permission
- */
- public void rotateCamera() {
- final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- final int randomLR = random(0, 2);
- final int randomUD = random(0, 2);
- final int randomAll = random(0, 4);
- if (random(0, 3) == 0) {
- keyboard.pressKey(LR[randomLR]);
- sleepCR(random(2, 9));
- keyboard.pressKey(UD[randomUD]);
- sleepCR(random(6, 10));
- keyboard.releaseKey(UD[randomUD]);
- sleepCR(random(2, 7));
- keyboard.releaseKey(LR[randomLR]);
- } else {
- keyboard.pressKey(LRUD[randomAll]);
- if (randomAll > 1) {
- sleepCR(random(6, 11));
- } else {
- sleepCR(random(9, 12));
- }
- keyboard.releaseKey(LRUD[randomAll]);
- }
- }
- private boolean sleepCR(final int amtOfHalfSecs) {
- for (int x = 0; x < amtOfHalfSecs + 1; x++) {
- sleep(random(48, 53));
- }
- return true;
- }
- private void antiban(){
- int action = random(0, 5);
- switch (action) {
- case 0:
- status = "Antiban";
- rotateCamera();
- sleep(200, 400);
- break;
- case 1:
- status = "Antiban";
- mouse.moveRandomly(100, 900);
- sleep(200, 400);
- break;
- case 2:
- status = "Antiban";
- mouse.moveSlightly();
- sleep(200, 400);
- break;
- case 3:
- status = "Antiban";
- camera.moveRandomly(random(750,1250));
- sleep(200, 400);
- break;
- case 4:
- status = "Antiban";
- checkEXP();
- sleep(200, 400);
- break;
- case 5:
- status = "Antiban";
- mouse.moveOffScreen();
- sleep(200, 400);
- break;
- }
- }
- public void checkEXP() {
- game.openTab(Game.Tab.STATS);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(random(2100, 3400));
- game.openTab(Game.Tab.INVENTORY);
- sleep(random(540,760));
- }
- class gui extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e){
- String mode = selectionBox.getSelectedItem().toString();
- if(mode.equals("Maximum")){
- antiban = false;
- minSpeed = 5;
- maxSpeed = 6;
- }
- else if(mode.equals("Paranoid")){
- antiban = true;
- minSpeed = 8;
- maxSpeed = 10;
- min = 3;
- max = 3;
- }
- save = memoryMode.isSelected();
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- selectionBox = new JComboBox();
- memoryMode = new JCheckBox();
- label2 = new JLabel();
- label3 = new JLabel();
- label4 = new JLabel();
- label5 = new JLabel();
- startButton = new JButton();
- //======== this ========
- setTitle("Painlaws's Vial Filler");
- setResizable(false);
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Mode");
- //---- selectionBox ----
- selectionBox.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Paranoid",
- "Maximum"
- }));
- //---- memoryMode ----
- memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
- //---- label2 ----
- label2.setText("Modes:");
- //---- label3 ----
- label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
- //---- label4 ----
- label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
- //---- label5 ----
- label5.setText("Maximum - No Antiban, Fast Mouse Speed");
- //---- startButton ----
- startButton.setText("Let's Fill Some Vials!");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e){
- startButtonActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
- .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGap(148, 148, 148)
- .addComponent(startButton)))
- .addContainerGap(2, Short.MAX_VALUE))
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label1)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(memoryMode)
- .addGap(18, 18, 18)
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label4)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox selectionBox;
- private JCheckBox memoryMode;
- private JLabel label2;
- private JLabel label3;
- private JLabel label4;
- private JLabel label5;
- private JButton startButton;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.KeyEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
- public class vialfiller extends Script implements PaintListener{
- //Variables
- // - Essentials
- private int bankerID = 6533;
- private int fountainID = 24214;
- private int emptyVialID = 229;
- private int fullVialID = 227;
- private int runEnergy = 50;
- RSNPC banker;
- RSObject fountain;
- RSItem myVial;
- RSTile theBank = new RSTile(3167, 3489);
- RSTile theFountain = new RSTile(3191, 3471);
- RSTile glitchSpot = new RSTile(3192, 3487);
- RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
- RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
- RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
- RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
- // - GUI Options
- private int min = 1;
- private int max = 6;
- private int minSpeed = 6;
- private int maxSpeed = 9;
- private boolean guiWait = true;
- private boolean save = false;
- // - State check
- private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
- // - Paint stuff
- private String status = "Initializing...";
- private String isRunning = "";
- private int numFilled = 0;
- private int vialFilledPrice;
- private int vialEmptyPrice;
- private int profitPrice;
- private int profit;
- private long startTime;
- private long millis;
- private long hours;
- private long minutes;
- private long seconds;
- private float profSec = 0;
- private float profHour;
- private float hourlyProfit;
- private int hourlyProfitInt;
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 13);
- private final Font font2 = new Font("Arial", 1, 13);
- private final Font font3 = new Font("Vijaya", 1, 17);
- private boolean antiban = true;
- gui g = new gui();
- @Override
- public boolean onStart(){
- log("Welcome to Painlaws's Vial Filler");
- log("Waiting on GUI...");
- g.setVisible(true);
- while(guiWait){
- sleep(500);
- }
- log("GUI Settings loaded!");
- if(walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else{
- isRunning = "No";
- }
- vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
- vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
- profitPrice = vialFilledPrice - vialEmptyPrice;
- if(!save){
- startTime = System.currentTimeMillis();
- }
- else{
- startTime = 0;
- }
- return true;
- }
- @Override
- public void onFinish(){
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- }
- public void useItem(RSItem item, RSObject object){
- if(item != null && object != null && object.isOnScreen()){
- item.doClick(true);
- sleep(200, 300);
- object.doClick();
- }
- }
- public void fillVials(){
- if(fountain != null){
- status = "Filling Vials";
- useItem(myVial, fountain);
- while(inventory.contains(emptyVialID)){
- sleep(random(1000,1500));
- if(antiban){
- if(random(1, 3) == 2){
- mouse.moveSlightly();
- }
- }
- }
- status = "Vials filled";
- }
- else{
- status = "Fountain is null...retrying";
- sleep(random(600, 800));
- }
- }
- private void doBank(){
- try{
- if(banker != null){
- camera.turnTo(banker);
- if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
- status = "Opening Bank";
- banker.interact("Bank Banker");
- status = "Bank opened";
- sleep(random(900, 1050));
- status = "Depositing All";
- bank.depositAll();
- status = "Deposited All";
- sleep(random(780, 950));
- numFilled = bank.getCount(fullVialID);
- if(bank.getCount(emptyVialID) != 0){
- status = "Taking Vials";
- bank.withdraw(emptyVialID, 0);
- status = "Vials Taken";
- sleep(random(700, 960));
- }
- else{
- log("Out of vials. Quitting :/");
- bank.close();
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- stopScript(true);
- }
- status = "Closing Bank";
- bank.close();
- status = "Bank Closed";
- sleep(random(750, 910));
- }
- }
- sleep(random(300,500));
- }catch(Exception e){log(e);}
- }
- public void onToBank(){
- try{
- status = "Going to Bank";
- walking.walkTileMM(theBank);
- }catch(Exception e){log(e);}
- sleep(random(500, 700));
- }
- public void onToGlitch(){
- try{
- status = "Going to Fountain"; //What you don't know can't hurt you :P
- walking.walkTileMM(glitchSpot);
- }catch(Exception e){log(e);}
- sleep(random(500, 710));
- }
- public void onToFountain(){
- try{
- status = "Going to Fountain";
- walking.walkTileMM(theFountain);
- }catch(Exception e){log(e);}
- sleep(random(500, 705));
- }
- public void runcheck() {
- try{
- runEnergy = (random(50, 70));
- if (walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
- walking.setRun(true);
- isRunning = "Yes";
- sleep(random(300, 500));
- }
- else{
- isRunning = "No";
- sleep(random(300,500));
- }
- }catch(Exception ex){}
- }
- @Override
- public int loop(){
- mouse.setSpeed(random(minSpeed, maxSpeed));
- runcheck();
- if(antiban){
- if(random(min, max) == 3){
- antiban();
- }
- }
- if(objects.getNearest(fountainID) != null){
- fountain = objects.getNearest(fountainID);
- }
- if(npcs.getNearest(bankerID) != null){
- banker = npcs.getNearest(bankerID);
- }
- if(inventory.getItem(emptyVialID) != null){
- myVial = inventory.getItem(emptyVialID);
- }
- switch(getState()){
- case TOFOUNTAIN:
- runcheck();
- onToFountain();
- if(fountainRange.contains(players.getMyPlayer().getLocation())){
- fillVials();
- }
- break;
- case TOGLITCH:
- runcheck();
- onToGlitch();
- break;
- case TOBANK:
- runcheck();
- onToBank();
- if(bankRange.contains(players.getMyPlayer().getLocation())){
- doBank();
- }
- break;
- }
- return(random(500, 1000));
- }
- private State getState() {
- if (!inventory.contains(emptyVialID)) {
- return State.TOBANK;
- }
- else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
- return State.TOGLITCH;
- }
- else{
- return State.TOFOUNTAIN;
- }
- }
- // GUI and Mouse
- public void onRepaint(Graphics g1) {
- profit = numFilled * profitPrice;
- if(!save){
- 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;
- if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
- profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- profHour = profSec * 3600;
- hourlyProfit = profHour * profitPrice;
- hourlyProfitInt = Math.round(hourlyProfit);
- }
- else{
- millis = 0;
- hours = 0;
- minutes = 0;
- seconds = 0;
- hourlyProfitInt = 9001;
- }
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(7, 345, 488, 70);
- g.setStroke(stroke1);
- g.drawRect(7, 345, 488, 70);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Status:", 14, 362);
- g.setFont(font2);
- g.drawString(status, 59, 362);
- g.setFont(font1);
- g.drawString("Filled Vials In Bank:", 209, 362);
- g.setFont(font2);
- g.drawString(Integer.toString(numFilled), 328, 362);
- g.setFont(font1);
- g.drawString("Profit:", 14, 383);
- g.setFont(font2);
- g.drawString(Integer.toString(profit), 59, 383);
- g.setFont(font1);
- g.drawString("Profit/hr:", 137, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
- }
- else{
- g.drawString("Mem Save", 190, 383);
- }
- g.setFont(font1);
- g.drawString("Runtime:", 270, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
- }
- else{
- g.drawString("Mem Save", 325, 384);
- }
- g.setFont(font1);
- g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
- g.drawString("Running:", 710, 139);
- g.setFont(font2);
- g.drawString(isRunning, 722, 156);
- g.setFont(font3);
- g.drawString("Painlaws", 440, 357);
- g1.setColor(Color.green);
- g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
- g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
- }
- /* Antiban stuff
- * Some credits to Aaimister :)
- * Partially copied, with permission
- */
- public void rotateCamera() {
- final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- final int randomLR = random(0, 2);
- final int randomUD = random(0, 2);
- final int randomAll = random(0, 4);
- if (random(0, 3) == 0) {
- keyboard.pressKey(LR[randomLR]);
- sleepCR(random(2, 9));
- keyboard.pressKey(UD[randomUD]);
- sleepCR(random(6, 10));
- keyboard.releaseKey(UD[randomUD]);
- sleepCR(random(2, 7));
- keyboard.releaseKey(LR[randomLR]);
- } else {
- keyboard.pressKey(LRUD[randomAll]);
- if (randomAll > 1) {
- sleepCR(random(6, 11));
- } else {
- sleepCR(random(9, 12));
- }
- keyboard.releaseKey(LRUD[randomAll]);
- }
- }
- private boolean sleepCR(final int amtOfHalfSecs) {
- for (int x = 0; x < amtOfHalfSecs + 1; x++) {
- sleep(random(48, 53));
- }
- return true;
- }
- private void antiban(){
- int action = random(0, 5);
- switch (action) {
- case 0:
- status = "Antiban";
- rotateCamera();
- sleep(200, 400);
- break;
- case 1:
- status = "Antiban";
- mouse.moveRandomly(100, 900);
- sleep(200, 400);
- break;
- case 2:
- status = "Antiban";
- mouse.moveSlightly();
- sleep(200, 400);
- break;
- case 3:
- status = "Antiban";
- camera.moveRandomly(random(750,1250));
- sleep(200, 400);
- break;
- case 4:
- status = "Antiban";
- checkEXP();
- sleep(200, 400);
- break;
- case 5:
- status = "Antiban";
- mouse.moveOffScreen();
- sleep(200, 400);
- break;
- }
- }
- public void checkEXP() {
- game.openTab(Game.Tab.STATS);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(random(2100, 3400));
- game.openTab(Game.Tab.INVENTORY);
- sleep(random(540,760));
- }
- class gui extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e){
- String mode = selectionBox.getSelectedItem().toString();
- if(mode.equals("Maximum")){
- antiban = false;
- minSpeed = 5;
- maxSpeed = 6;
- }
- else if(mode.equals("Paranoid")){
- antiban = true;
- minSpeed = 8;
- maxSpeed = 10;
- min = 3;
- max = 3;
- }
- save = memoryMode.isSelected();
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- selectionBox = new JComboBox();
- memoryMode = new JCheckBox();
- label2 = new JLabel();
- label3 = new JLabel();
- label4 = new JLabel();
- label5 = new JLabel();
- startButton = new JButton();
- //======== this ========
- setTitle("Painlaws's Vial Filler");
- setResizable(false);
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Mode");
- //---- selectionBox ----
- selectionBox.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Paranoid",
- "Maximum"
- }));
- //---- memoryMode ----
- memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
- //---- label2 ----
- label2.setText("Modes:");
- //---- label3 ----
- label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
- //---- label4 ----
- label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
- //---- label5 ----
- label5.setText("Maximum - No Antiban, Fast Mouse Speed");
- //---- startButton ----
- startButton.setText("Let's Fill Some Vials!");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e){
- startButtonActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
- .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGap(148, 148, 148)
- .addComponent(startButton)))
- .addContainerGap(2, Short.MAX_VALUE))
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label1)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(memoryMode)
- .addGap(18, 18, 18)
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label4)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox selectionBox;
- private JCheckBox memoryMode;
- private JLabel label2;
- private JLabel label3;
- private JLabel label4;
- private JLabel label5;
- private JButton startButton;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.KeyEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
- public class vialfiller extends Script implements PaintListener{
- //Variables
- // - Essentials
- private int bankerID = 6533;
- private int fountainID = 24214;
- private int emptyVialID = 229;
- private int fullVialID = 227;
- private int runEnergy = 50;
- RSNPC banker;
- RSObject fountain;
- RSItem myVial;
- RSTile theBank = new RSTile(3167, 3489);
- RSTile theFountain = new RSTile(3191, 3471);
- RSTile glitchSpot = new RSTile(3192, 3487);
- RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
- RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
- RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
- RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
- // - GUI Options
- private int min = 1;
- private int max = 6;
- private int minSpeed = 6;
- private int maxSpeed = 9;
- private boolean guiWait = true;
- private boolean save = false;
- // - State check
- private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
- // - Paint stuff
- private String status = "Initializing...";
- private String isRunning = "";
- private int numFilled = 0;
- private int vialFilledPrice;
- private int vialEmptyPrice;
- private int profitPrice;
- private int profit;
- private long startTime;
- private long millis;
- private long hours;
- private long minutes;
- private long seconds;
- private float profSec = 0;
- private float profHour;
- private float hourlyProfit;
- private int hourlyProfitInt;
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 13);
- private final Font font2 = new Font("Arial", 1, 13);
- private final Font font3 = new Font("Vijaya", 1, 17);
- private boolean antiban = true;
- gui g = new gui();
- @Override
- public boolean onStart(){
- log("Welcome to Painlaws's Vial Filler");
- log("Waiting on GUI...");
- g.setVisible(true);
- while(guiWait){
- sleep(500);
- }
- log("GUI Settings loaded!");
- if(walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else{
- isRunning = "No";
- }
- vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
- vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
- profitPrice = vialFilledPrice - vialEmptyPrice;
- if(!save){
- startTime = System.currentTimeMillis();
- }
- else{
- startTime = 0;
- }
- return true;
- }
- @Override
- public void onFinish(){
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- }
- public void useItem(RSItem item, RSObject object){
- if(item != null && object != null && object.isOnScreen()){
- item.doClick(true);
- sleep(200, 300);
- object.doClick();
- }
- }
- public void fillVials(){
- if(fountain != null){
- status = "Filling Vials";
- useItem(myVial, fountain);
- while(inventory.contains(emptyVialID)){
- sleep(random(1000,1500));
- if(antiban){
- if(random(1, 3) == 2){
- mouse.moveSlightly();
- }
- }
- }
- status = "Vials filled";
- }
- else{
- status = "Fountain is null...retrying";
- sleep(random(600, 800));
- }
- }
- private void doBank(){
- try{
- if(banker != null){
- camera.turnTo(banker);
- if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
- status = "Opening Bank";
- banker.interact("Bank Banker");
- status = "Bank opened";
- sleep(random(900, 1050));
- status = "Depositing All";
- bank.depositAll();
- status = "Deposited All";
- sleep(random(780, 950));
- numFilled = bank.getCount(fullVialID);
- if(bank.getCount(emptyVialID) != 0){
- status = "Taking Vials";
- bank.withdraw(emptyVialID, 0);
- status = "Vials Taken";
- sleep(random(700, 960));
- }
- else{
- log("Out of vials. Quitting :/");
- bank.close();
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- stopScript(true);
- }
- status = "Closing Bank";
- bank.close();
- status = "Bank Closed";
- sleep(random(750, 910));
- }
- }
- sleep(random(300,500));
- }catch(Exception e){log(e);}
- }
- public void onToBank(){
- try{
- status = "Going to Bank";
- walking.walkTileMM(theBank);
- }catch(Exception e){log(e);}
- sleep(random(500, 700));
- }
- public void onToGlitch(){
- try{
- status = "Going to Fountain"; //What you don't know can't hurt you :P
- walking.walkTileMM(glitchSpot);
- }catch(Exception e){log(e);}
- sleep(random(500, 710));
- }
- public void onToFountain(){
- try{
- status = "Going to Fountain";
- walking.walkTileMM(theFountain);
- }catch(Exception e){log(e);}
- sleep(random(500, 705));
- }
- public void runcheck() {
- try{
- runEnergy = (random(50, 70));
- if (walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
- walking.setRun(true);
- isRunning = "Yes";
- sleep(random(300, 500));
- }
- else{
- isRunning = "No";
- sleep(random(300,500));
- }
- }catch(Exception ex){}
- }
- @Override
- public int loop(){
- mouse.setSpeed(random(minSpeed, maxSpeed));
- runcheck();
- if(antiban){
- if(random(min, max) == 3){
- antiban();
- }
- }
- if(objects.getNearest(fountainID) != null){
- fountain = objects.getNearest(fountainID);
- }
- if(npcs.getNearest(bankerID) != null){
- banker = npcs.getNearest(bankerID);
- }
- if(inventory.getItem(emptyVialID) != null){
- myVial = inventory.getItem(emptyVialID);
- }
- switch(getState()){
- case TOFOUNTAIN:
- runcheck();
- onToFountain();
- if(fountainRange.contains(players.getMyPlayer().getLocation())){
- fillVials();
- }
- break;
- case TOGLITCH:
- runcheck();
- onToGlitch();
- break;
- case TOBANK:
- runcheck();
- onToBank();
- if(bankRange.contains(players.getMyPlayer().getLocation())){
- doBank();
- }
- break;
- }
- return(random(500, 1000));
- }
- private State getState() {
- if (!inventory.contains(emptyVialID)) {
- return State.TOBANK;
- }
- else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
- return State.TOGLITCH;
- }
- else{
- return State.TOFOUNTAIN;
- }
- }
- // GUI and Mouse
- public void onRepaint(Graphics g1) {
- profit = numFilled * profitPrice;
- if(!save){
- 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;
- if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
- profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- profHour = profSec * 3600;
- hourlyProfit = profHour * profitPrice;
- hourlyProfitInt = Math.round(hourlyProfit);
- }
- else{
- millis = 0;
- hours = 0;
- minutes = 0;
- seconds = 0;
- hourlyProfitInt = 9001;
- }
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(7, 345, 488, 70);
- g.setStroke(stroke1);
- g.drawRect(7, 345, 488, 70);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Status:", 14, 362);
- g.setFont(font2);
- g.drawString(status, 59, 362);
- g.setFont(font1);
- g.drawString("Filled Vials In Bank:", 209, 362);
- g.setFont(font2);
- g.drawString(Integer.toString(numFilled), 328, 362);
- g.setFont(font1);
- g.drawString("Profit:", 14, 383);
- g.setFont(font2);
- g.drawString(Integer.toString(profit), 59, 383);
- g.setFont(font1);
- g.drawString("Profit/hr:", 137, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
- }
- else{
- g.drawString("Mem Save", 190, 383);
- }
- g.setFont(font1);
- g.drawString("Runtime:", 270, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
- }
- else{
- g.drawString("Mem Save", 325, 384);
- }
- g.setFont(font1);
- g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
- g.drawString("Running:", 710, 139);
- g.setFont(font2);
- g.drawString(isRunning, 722, 156);
- g.setFont(font3);
- g.drawString("Painlaws", 440, 357);
- g1.setColor(Color.green);
- g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
- g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
- }
- /* Antiban stuff
- * Some credits to Aaimister :)
- * Partially copied, with permission
- */
- public void rotateCamera() {
- final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- final int randomLR = random(0, 2);
- final int randomUD = random(0, 2);
- final int randomAll = random(0, 4);
- if (random(0, 3) == 0) {
- keyboard.pressKey(LR[randomLR]);
- sleepCR(random(2, 9));
- keyboard.pressKey(UD[randomUD]);
- sleepCR(random(6, 10));
- keyboard.releaseKey(UD[randomUD]);
- sleepCR(random(2, 7));
- keyboard.releaseKey(LR[randomLR]);
- } else {
- keyboard.pressKey(LRUD[randomAll]);
- if (randomAll > 1) {
- sleepCR(random(6, 11));
- } else {
- sleepCR(random(9, 12));
- }
- keyboard.releaseKey(LRUD[randomAll]);
- }
- }
- private boolean sleepCR(final int amtOfHalfSecs) {
- for (int x = 0; x < amtOfHalfSecs + 1; x++) {
- sleep(random(48, 53));
- }
- return true;
- }
- private void antiban(){
- int action = random(0, 5);
- switch (action) {
- case 0:
- status = "Antiban";
- rotateCamera();
- sleep(200, 400);
- break;
- case 1:
- status = "Antiban";
- mouse.moveRandomly(100, 900);
- sleep(200, 400);
- break;
- case 2:
- status = "Antiban";
- mouse.moveSlightly();
- sleep(200, 400);
- break;
- case 3:
- status = "Antiban";
- camera.moveRandomly(random(750,1250));
- sleep(200, 400);
- break;
- case 4:
- status = "Antiban";
- checkEXP();
- sleep(200, 400);
- break;
- case 5:
- status = "Antiban";
- mouse.moveOffScreen();
- sleep(200, 400);
- break;
- }
- }
- public void checkEXP() {
- game.openTab(Game.Tab.STATS);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(random(2100, 3400));
- game.openTab(Game.Tab.INVENTORY);
- sleep(random(540,760));
- }
- class gui extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e){
- String mode = selectionBox.getSelectedItem().toString();
- if(mode.equals("Maximum")){
- antiban = false;
- minSpeed = 5;
- maxSpeed = 6;
- }
- else if(mode.equals("Paranoid")){
- antiban = true;
- minSpeed = 8;
- maxSpeed = 10;
- min = 3;
- max = 3;
- }
- save = memoryMode.isSelected();
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- selectionBox = new JComboBox();
- memoryMode = new JCheckBox();
- label2 = new JLabel();
- label3 = new JLabel();
- label4 = new JLabel();
- label5 = new JLabel();
- startButton = new JButton();
- //======== this ========
- setTitle("Painlaws's Vial Filler");
- setResizable(false);
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Mode");
- //---- selectionBox ----
- selectionBox.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Paranoid",
- "Maximum"
- }));
- //---- memoryMode ----
- memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
- //---- label2 ----
- label2.setText("Modes:");
- //---- label3 ----
- label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
- //---- label4 ----
- label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
- //---- label5 ----
- label5.setText("Maximum - No Antiban, Fast Mouse Speed");
- //---- startButton ----
- startButton.setText("Let's Fill Some Vials!");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e){
- startButtonActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
- .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGap(148, 148, 148)
- .addComponent(startButton)))
- .addContainerGap(2, Short.MAX_VALUE))
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label1)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(memoryMode)
- .addGap(18, 18, 18)
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label4)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox selectionBox;
- private JCheckBox memoryMode;
- private JLabel label2;
- private JLabel label3;
- private JLabel label4;
- private JLabel label5;
- private JButton startButton;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.KeyEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
- public class vialfiller extends Script implements PaintListener{
- //Variables
- // - Essentials
- private int bankerID = 6533;
- private int fountainID = 24214;
- private int emptyVialID = 229;
- private int fullVialID = 227;
- private int runEnergy = 50;
- RSNPC banker;
- RSObject fountain;
- RSItem myVial;
- RSTile theBank = new RSTile(3167, 3489);
- RSTile theFountain = new RSTile(3191, 3471);
- RSTile glitchSpot = new RSTile(3192, 3487);
- RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
- RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
- RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
- RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
- // - GUI Options
- private int min = 1;
- private int max = 6;
- private int minSpeed = 6;
- private int maxSpeed = 9;
- private boolean guiWait = true;
- private boolean save = false;
- // - State check
- private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
- // - Paint stuff
- private String status = "Initializing...";
- private String isRunning = "";
- private int numFilled = 0;
- private int vialFilledPrice;
- private int vialEmptyPrice;
- private int profitPrice;
- private int profit;
- private long startTime;
- private long millis;
- private long hours;
- private long minutes;
- private long seconds;
- private float profSec = 0;
- private float profHour;
- private float hourlyProfit;
- private int hourlyProfitInt;
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 13);
- private final Font font2 = new Font("Arial", 1, 13);
- private final Font font3 = new Font("Vijaya", 1, 17);
- private boolean antiban = true;
- gui g = new gui();
- @Override
- public boolean onStart(){
- log("Welcome to Painlaws's Vial Filler");
- log("Waiting on GUI...");
- g.setVisible(true);
- while(guiWait){
- sleep(500);
- }
- log("GUI Settings loaded!");
- if(walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else{
- isRunning = "No";
- }
- vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
- vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
- profitPrice = vialFilledPrice - vialEmptyPrice;
- if(!save){
- startTime = System.currentTimeMillis();
- }
- else{
- startTime = 0;
- }
- return true;
- }
- @Override
- public void onFinish(){
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- }
- public void useItem(RSItem item, RSObject object){
- if(item != null && object != null && object.isOnScreen()){
- item.doClick(true);
- sleep(200, 300);
- object.doClick();
- }
- }
- public void fillVials(){
- if(fountain != null){
- status = "Filling Vials";
- useItem(myVial, fountain);
- while(inventory.contains(emptyVialID)){
- sleep(random(1000,1500));
- if(antiban){
- if(random(1, 3) == 2){
- mouse.moveSlightly();
- }
- }
- }
- status = "Vials filled";
- }
- else{
- status = "Fountain is null...retrying";
- sleep(random(600, 800));
- }
- }
- private void doBank(){
- try{
- if(banker != null){
- camera.turnTo(banker);
- if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
- status = "Opening Bank";
- banker.interact("Bank Banker");
- status = "Bank opened";
- sleep(random(900, 1050));
- status = "Depositing All";
- bank.depositAll();
- status = "Deposited All";
- sleep(random(780, 950));
- numFilled = bank.getCount(fullVialID);
- if(bank.getCount(emptyVialID) != 0){
- status = "Taking Vials";
- bank.withdraw(emptyVialID, 0);
- status = "Vials Taken";
- sleep(random(700, 960));
- }
- else{
- log("Out of vials. Quitting :/");
- bank.close();
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- stopScript(true);
- }
- status = "Closing Bank";
- bank.close();
- status = "Bank Closed";
- sleep(random(750, 910));
- }
- }
- sleep(random(300,500));
- }catch(Exception e){log(e);}
- }
- public void onToBank(){
- try{
- status = "Going to Bank";
- walking.walkTileMM(theBank);
- }catch(Exception e){log(e);}
- sleep(random(500, 700));
- }
- public void onToGlitch(){
- try{
- status = "Going to Fountain"; //What you don't know can't hurt you :P
- walking.walkTileMM(glitchSpot);
- }catch(Exception e){log(e);}
- sleep(random(500, 710));
- }
- public void onToFountain(){
- try{
- status = "Going to Fountain";
- walking.walkTileMM(theFountain);
- }catch(Exception e){log(e);}
- sleep(random(500, 705));
- }
- public void runcheck() {
- try{
- runEnergy = (random(50, 70));
- if (walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
- walking.setRun(true);
- isRunning = "Yes";
- sleep(random(300, 500));
- }
- else{
- isRunning = "No";
- sleep(random(300,500));
- }
- }catch(Exception ex){}
- }
- @Override
- public int loop(){
- mouse.setSpeed(random(minSpeed, maxSpeed));
- runcheck();
- if(antiban){
- if(random(min, max) == 3){
- antiban();
- }
- }
- if(objects.getNearest(fountainID) != null){
- fountain = objects.getNearest(fountainID);
- }
- if(npcs.getNearest(bankerID) != null){
- banker = npcs.getNearest(bankerID);
- }
- if(inventory.getItem(emptyVialID) != null){
- myVial = inventory.getItem(emptyVialID);
- }
- switch(getState()){
- case TOFOUNTAIN:
- runcheck();
- onToFountain();
- if(fountainRange.contains(players.getMyPlayer().getLocation())){
- fillVials();
- }
- break;
- case TOGLITCH:
- runcheck();
- onToGlitch();
- break;
- case TOBANK:
- runcheck();
- onToBank();
- if(bankRange.contains(players.getMyPlayer().getLocation())){
- doBank();
- }
- break;
- }
- return(random(500, 1000));
- }
- private State getState() {
- if (!inventory.contains(emptyVialID)) {
- return State.TOBANK;
- }
- else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
- return State.TOGLITCH;
- }
- else{
- return State.TOFOUNTAIN;
- }
- }
- // GUI and Mouse
- public void onRepaint(Graphics g1) {
- profit = numFilled * profitPrice;
- if(!save){
- 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;
- if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
- profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- profHour = profSec * 3600;
- hourlyProfit = profHour * profitPrice;
- hourlyProfitInt = Math.round(hourlyProfit);
- }
- else{
- millis = 0;
- hours = 0;
- minutes = 0;
- seconds = 0;
- hourlyProfitInt = 9001;
- }
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(7, 345, 488, 70);
- g.setStroke(stroke1);
- g.drawRect(7, 345, 488, 70);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Status:", 14, 362);
- g.setFont(font2);
- g.drawString(status, 59, 362);
- g.setFont(font1);
- g.drawString("Filled Vials In Bank:", 209, 362);
- g.setFont(font2);
- g.drawString(Integer.toString(numFilled), 328, 362);
- g.setFont(font1);
- g.drawString("Profit:", 14, 383);
- g.setFont(font2);
- g.drawString(Integer.toString(profit), 59, 383);
- g.setFont(font1);
- g.drawString("Profit/hr:", 137, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
- }
- else{
- g.drawString("Mem Save", 190, 383);
- }
- g.setFont(font1);
- g.drawString("Runtime:", 270, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
- }
- else{
- g.drawString("Mem Save", 325, 384);
- }
- g.setFont(font1);
- g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
- g.drawString("Running:", 710, 139);
- g.setFont(font2);
- g.drawString(isRunning, 722, 156);
- g.setFont(font3);
- g.drawString("Painlaws", 440, 357);
- g1.setColor(Color.green);
- g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
- g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
- }
- /* Antiban stuff
- * Some credits to Aaimister :)
- * Partially copied, with permission
- */
- public void rotateCamera() {
- final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- final int randomLR = random(0, 2);
- final int randomUD = random(0, 2);
- final int randomAll = random(0, 4);
- if (random(0, 3) == 0) {
- keyboard.pressKey(LR[randomLR]);
- sleepCR(random(2, 9));
- keyboard.pressKey(UD[randomUD]);
- sleepCR(random(6, 10));
- keyboard.releaseKey(UD[randomUD]);
- sleepCR(random(2, 7));
- keyboard.releaseKey(LR[randomLR]);
- } else {
- keyboard.pressKey(LRUD[randomAll]);
- if (randomAll > 1) {
- sleepCR(random(6, 11));
- } else {
- sleepCR(random(9, 12));
- }
- keyboard.releaseKey(LRUD[randomAll]);
- }
- }
- private boolean sleepCR(final int amtOfHalfSecs) {
- for (int x = 0; x < amtOfHalfSecs + 1; x++) {
- sleep(random(48, 53));
- }
- return true;
- }
- private void antiban(){
- int action = random(0, 5);
- switch (action) {
- case 0:
- status = "Antiban";
- rotateCamera();
- sleep(200, 400);
- break;
- case 1:
- status = "Antiban";
- mouse.moveRandomly(100, 900);
- sleep(200, 400);
- break;
- case 2:
- status = "Antiban";
- mouse.moveSlightly();
- sleep(200, 400);
- break;
- case 3:
- status = "Antiban";
- camera.moveRandomly(random(750,1250));
- sleep(200, 400);
- break;
- case 4:
- status = "Antiban";
- checkEXP();
- sleep(200, 400);
- break;
- case 5:
- status = "Antiban";
- mouse.moveOffScreen();
- sleep(200, 400);
- break;
- }
- }
- public void checkEXP() {
- game.openTab(Game.Tab.STATS);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(random(2100, 3400));
- game.openTab(Game.Tab.INVENTORY);
- sleep(random(540,760));
- }
- class gui extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e){
- String mode = selectionBox.getSelectedItem().toString();
- if(mode.equals("Maximum")){
- antiban = false;
- minSpeed = 5;
- maxSpeed = 6;
- }
- else if(mode.equals("Paranoid")){
- antiban = true;
- minSpeed = 8;
- maxSpeed = 10;
- min = 3;
- max = 3;
- }
- save = memoryMode.isSelected();
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- selectionBox = new JComboBox();
- memoryMode = new JCheckBox();
- label2 = new JLabel();
- label3 = new JLabel();
- label4 = new JLabel();
- label5 = new JLabel();
- startButton = new JButton();
- //======== this ========
- setTitle("Painlaws's Vial Filler");
- setResizable(false);
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Mode");
- //---- selectionBox ----
- selectionBox.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Paranoid",
- "Maximum"
- }));
- //---- memoryMode ----
- memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
- //---- label2 ----
- label2.setText("Modes:");
- //---- label3 ----
- label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
- //---- label4 ----
- label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
- //---- label5 ----
- label5.setText("Maximum - No Antiban, Fast Mouse Speed");
- //---- startButton ----
- startButton.setText("Let's Fill Some Vials!");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e){
- startButtonActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
- .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGap(148, 148, 148)
- .addComponent(startButton)))
- .addContainerGap(2, Short.MAX_VALUE))
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label1)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(memoryMode)
- .addGap(18, 18, 18)
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label4)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox selectionBox;
- private JCheckBox memoryMode;
- private JLabel label2;
- private JLabel label3;
- private JLabel label4;
- private JLabel label5;
- private JButton startButton;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.KeyEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
- public class vialfiller extends Script implements PaintListener{
- //Variables
- // - Essentials
- private int bankerID = 6533;
- private int fountainID = 24214;
- private int emptyVialID = 229;
- private int fullVialID = 227;
- private int runEnergy = 50;
- RSNPC banker;
- RSObject fountain;
- RSItem myVial;
- RSTile theBank = new RSTile(3167, 3489);
- RSTile theFountain = new RSTile(3191, 3471);
- RSTile glitchSpot = new RSTile(3192, 3487);
- RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
- RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
- RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
- RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
- // - GUI Options
- private int min = 1;
- private int max = 6;
- private int minSpeed = 6;
- private int maxSpeed = 9;
- private boolean guiWait = true;
- private boolean save = false;
- // - State check
- private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
- // - Paint stuff
- private String status = "Initializing...";
- private String isRunning = "";
- private int numFilled = 0;
- private int vialFilledPrice;
- private int vialEmptyPrice;
- private int profitPrice;
- private int profit;
- private long startTime;
- private long millis;
- private long hours;
- private long minutes;
- private long seconds;
- private float profSec = 0;
- private float profHour;
- private float hourlyProfit;
- private int hourlyProfitInt;
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 13);
- private final Font font2 = new Font("Arial", 1, 13);
- private final Font font3 = new Font("Vijaya", 1, 17);
- private boolean antiban = true;
- gui g = new gui();
- @Override
- public boolean onStart(){
- log("Welcome to Painlaws's Vial Filler");
- log("Waiting on GUI...");
- g.setVisible(true);
- while(guiWait){
- sleep(500);
- }
- log("GUI Settings loaded!");
- if(walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else{
- isRunning = "No";
- }
- vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
- vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
- profitPrice = vialFilledPrice - vialEmptyPrice;
- if(!save){
- startTime = System.currentTimeMillis();
- }
- else{
- startTime = 0;
- }
- return true;
- }
- @Override
- public void onFinish(){
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- }
- public void useItem(RSItem item, RSObject object){
- if(item != null && object != null && object.isOnScreen()){
- item.doClick(true);
- sleep(200, 300);
- object.doClick();
- }
- }
- public void fillVials(){
- if(fountain != null){
- status = "Filling Vials";
- useItem(myVial, fountain);
- while(inventory.contains(emptyVialID)){
- sleep(random(1000,1500));
- if(antiban){
- if(random(1, 3) == 2){
- mouse.moveSlightly();
- }
- }
- }
- status = "Vials filled";
- }
- else{
- status = "Fountain is null...retrying";
- sleep(random(600, 800));
- }
- }
- private void doBank(){
- try{
- if(banker != null){
- camera.turnTo(banker);
- if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
- status = "Opening Bank";
- banker.interact("Bank Banker");
- status = "Bank opened";
- sleep(random(900, 1050));
- status = "Depositing All";
- bank.depositAll();
- status = "Deposited All";
- sleep(random(780, 950));
- numFilled = bank.getCount(fullVialID);
- if(bank.getCount(emptyVialID) != 0){
- status = "Taking Vials";
- bank.withdraw(emptyVialID, 0);
- status = "Vials Taken";
- sleep(random(700, 960));
- }
- else{
- log("Out of vials. Quitting :/");
- bank.close();
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- stopScript(true);
- }
- status = "Closing Bank";
- bank.close();
- status = "Bank Closed";
- sleep(random(750, 910));
- }
- }
- sleep(random(300,500));
- }catch(Exception e){log(e);}
- }
- public void onToBank(){
- try{
- status = "Going to Bank";
- walking.walkTileMM(theBank);
- }catch(Exception e){log(e);}
- sleep(random(500, 700));
- }
- public void onToGlitch(){
- try{
- status = "Going to Fountain"; //What you don't know can't hurt you :P
- walking.walkTileMM(glitchSpot);
- }catch(Exception e){log(e);}
- sleep(random(500, 710));
- }
- public void onToFountain(){
- try{
- status = "Going to Fountain";
- walking.walkTileMM(theFountain);
- }catch(Exception e){log(e);}
- sleep(random(500, 705));
- }
- public void runcheck() {
- try{
- runEnergy = (random(50, 70));
- if (walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
- walking.setRun(true);
- isRunning = "Yes";
- sleep(random(300, 500));
- }
- else{
- isRunning = "No";
- sleep(random(300,500));
- }
- }catch(Exception ex){}
- }
- @Override
- public int loop(){
- mouse.setSpeed(random(minSpeed, maxSpeed));
- runcheck();
- if(antiban){
- if(random(min, max) == 3){
- antiban();
- }
- }
- if(objects.getNearest(fountainID) != null){
- fountain = objects.getNearest(fountainID);
- }
- if(npcs.getNearest(bankerID) != null){
- banker = npcs.getNearest(bankerID);
- }
- if(inventory.getItem(emptyVialID) != null){
- myVial = inventory.getItem(emptyVialID);
- }
- switch(getState()){
- case TOFOUNTAIN:
- runcheck();
- onToFountain();
- if(fountainRange.contains(players.getMyPlayer().getLocation())){
- fillVials();
- }
- break;
- case TOGLITCH:
- runcheck();
- onToGlitch();
- break;
- case TOBANK:
- runcheck();
- onToBank();
- if(bankRange.contains(players.getMyPlayer().getLocation())){
- doBank();
- }
- break;
- }
- return(random(500, 1000));
- }
- private State getState() {
- if (!inventory.contains(emptyVialID)) {
- return State.TOBANK;
- }
- else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
- return State.TOGLITCH;
- }
- else{
- return State.TOFOUNTAIN;
- }
- }
- // GUI and Mouse
- public void onRepaint(Graphics g1) {
- profit = numFilled * profitPrice;
- if(!save){
- 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;
- if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
- profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- profHour = profSec * 3600;
- hourlyProfit = profHour * profitPrice;
- hourlyProfitInt = Math.round(hourlyProfit);
- }
- else{
- millis = 0;
- hours = 0;
- minutes = 0;
- seconds = 0;
- hourlyProfitInt = 9001;
- }
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(7, 345, 488, 70);
- g.setStroke(stroke1);
- g.drawRect(7, 345, 488, 70);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Status:", 14, 362);
- g.setFont(font2);
- g.drawString(status, 59, 362);
- g.setFont(font1);
- g.drawString("Filled Vials In Bank:", 209, 362);
- g.setFont(font2);
- g.drawString(Integer.toString(numFilled), 328, 362);
- g.setFont(font1);
- g.drawString("Profit:", 14, 383);
- g.setFont(font2);
- g.drawString(Integer.toString(profit), 59, 383);
- g.setFont(font1);
- g.drawString("Profit/hr:", 137, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
- }
- else{
- g.drawString("Mem Save", 190, 383);
- }
- g.setFont(font1);
- g.drawString("Runtime:", 270, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
- }
- else{
- g.drawString("Mem Save", 325, 384);
- }
- g.setFont(font1);
- g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
- g.drawString("Running:", 710, 139);
- g.setFont(font2);
- g.drawString(isRunning, 722, 156);
- g.setFont(font3);
- g.drawString("Painlaws", 440, 357);
- g1.setColor(Color.green);
- g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
- g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
- }
- /* Antiban stuff
- * Some credits to Aaimister :)
- * Partially copied, with permission
- */
- public void rotateCamera() {
- final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- final int randomLR = random(0, 2);
- final int randomUD = random(0, 2);
- final int randomAll = random(0, 4);
- if (random(0, 3) == 0) {
- keyboard.pressKey(LR[randomLR]);
- sleepCR(random(2, 9));
- keyboard.pressKey(UD[randomUD]);
- sleepCR(random(6, 10));
- keyboard.releaseKey(UD[randomUD]);
- sleepCR(random(2, 7));
- keyboard.releaseKey(LR[randomLR]);
- } else {
- keyboard.pressKey(LRUD[randomAll]);
- if (randomAll > 1) {
- sleepCR(random(6, 11));
- } else {
- sleepCR(random(9, 12));
- }
- keyboard.releaseKey(LRUD[randomAll]);
- }
- }
- private boolean sleepCR(final int amtOfHalfSecs) {
- for (int x = 0; x < amtOfHalfSecs + 1; x++) {
- sleep(random(48, 53));
- }
- return true;
- }
- private void antiban(){
- int action = random(0, 5);
- switch (action) {
- case 0:
- status = "Antiban";
- rotateCamera();
- sleep(200, 400);
- break;
- case 1:
- status = "Antiban";
- mouse.moveRandomly(100, 900);
- sleep(200, 400);
- break;
- case 2:
- status = "Antiban";
- mouse.moveSlightly();
- sleep(200, 400);
- break;
- case 3:
- status = "Antiban";
- camera.moveRandomly(random(750,1250));
- sleep(200, 400);
- break;
- case 4:
- status = "Antiban";
- checkEXP();
- sleep(200, 400);
- break;
- case 5:
- status = "Antiban";
- mouse.moveOffScreen();
- sleep(200, 400);
- break;
- }
- }
- public void checkEXP() {
- game.openTab(Game.Tab.STATS);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(random(2100, 3400));
- game.openTab(Game.Tab.INVENTORY);
- sleep(random(540,760));
- }
- class gui extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e){
- String mode = selectionBox.getSelectedItem().toString();
- if(mode.equals("Maximum")){
- antiban = false;
- minSpeed = 5;
- maxSpeed = 6;
- }
- else if(mode.equals("Paranoid")){
- antiban = true;
- minSpeed = 8;
- maxSpeed = 10;
- min = 3;
- max = 3;
- }
- save = memoryMode.isSelected();
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- selectionBox = new JComboBox();
- memoryMode = new JCheckBox();
- label2 = new JLabel();
- label3 = new JLabel();
- label4 = new JLabel();
- label5 = new JLabel();
- startButton = new JButton();
- //======== this ========
- setTitle("Painlaws's Vial Filler");
- setResizable(false);
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Mode");
- //---- selectionBox ----
- selectionBox.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Paranoid",
- "Maximum"
- }));
- //---- memoryMode ----
- memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
- //---- label2 ----
- label2.setText("Modes:");
- //---- label3 ----
- label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
- //---- label4 ----
- label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
- //---- label5 ----
- label5.setText("Maximum - No Antiban, Fast Mouse Speed");
- //---- startButton ----
- startButton.setText("Let's Fill Some Vials!");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e){
- startButtonActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
- .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGap(148, 148, 148)
- .addComponent(startButton)))
- .addContainerGap(2, Short.MAX_VALUE))
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label1)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(memoryMode)
- .addGap(18, 18, 18)
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label4)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox selectionBox;
- private JCheckBox memoryMode;
- private JLabel label2;
- private JLabel label3;
- private JLabel label4;
- private JLabel label5;
- private JButton startButton;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.KeyEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
- public class vialfiller extends Script implements PaintListener{
- //Variables
- // - Essentials
- private int bankerID = 6533;
- private int fountainID = 24214;
- private int emptyVialID = 229;
- private int fullVialID = 227;
- private int runEnergy = 50;
- RSNPC banker;
- RSObject fountain;
- RSItem myVial;
- RSTile theBank = new RSTile(3167, 3489);
- RSTile theFountain = new RSTile(3191, 3471);
- RSTile glitchSpot = new RSTile(3192, 3487);
- RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
- RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
- RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
- RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
- // - GUI Options
- private int min = 1;
- private int max = 6;
- private int minSpeed = 6;
- private int maxSpeed = 9;
- private boolean guiWait = true;
- private boolean save = false;
- // - State check
- private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
- // - Paint stuff
- private String status = "Initializing...";
- private String isRunning = "";
- private int numFilled = 0;
- private int vialFilledPrice;
- private int vialEmptyPrice;
- private int profitPrice;
- private int profit;
- private long startTime;
- private long millis;
- private long hours;
- private long minutes;
- private long seconds;
- private float profSec = 0;
- private float profHour;
- private float hourlyProfit;
- private int hourlyProfitInt;
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 13);
- private final Font font2 = new Font("Arial", 1, 13);
- private final Font font3 = new Font("Vijaya", 1, 17);
- private boolean antiban = true;
- gui g = new gui();
- @Override
- public boolean onStart(){
- log("Welcome to Painlaws's Vial Filler");
- log("Waiting on GUI...");
- g.setVisible(true);
- while(guiWait){
- sleep(500);
- }
- log("GUI Settings loaded!");
- if(walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else{
- isRunning = "No";
- }
- vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
- vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
- profitPrice = vialFilledPrice - vialEmptyPrice;
- if(!save){
- startTime = System.currentTimeMillis();
- }
- else{
- startTime = 0;
- }
- return true;
- }
- @Override
- public void onFinish(){
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- }
- public void useItem(RSItem item, RSObject object){
- if(item != null && object != null && object.isOnScreen()){
- item.doClick(true);
- sleep(200, 300);
- object.doClick();
- }
- }
- public void fillVials(){
- if(fountain != null){
- status = "Filling Vials";
- useItem(myVial, fountain);
- while(inventory.contains(emptyVialID)){
- sleep(random(1000,1500));
- if(antiban){
- if(random(1, 3) == 2){
- mouse.moveSlightly();
- }
- }
- }
- status = "Vials filled";
- }
- else{
- status = "Fountain is null...retrying";
- sleep(random(600, 800));
- }
- }
- private void doBank(){
- try{
- if(banker != null){
- camera.turnTo(banker);
- if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
- status = "Opening Bank";
- banker.interact("Bank Banker");
- status = "Bank opened";
- sleep(random(900, 1050));
- status = "Depositing All";
- bank.depositAll();
- status = "Deposited All";
- sleep(random(780, 950));
- numFilled = bank.getCount(fullVialID);
- if(bank.getCount(emptyVialID) != 0){
- status = "Taking Vials";
- bank.withdraw(emptyVialID, 0);
- status = "Vials Taken";
- sleep(random(700, 960));
- }
- else{
- log("Out of vials. Quitting :/");
- bank.close();
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- stopScript(true);
- }
- status = "Closing Bank";
- bank.close();
- status = "Bank Closed";
- sleep(random(750, 910));
- }
- }
- sleep(random(300,500));
- }catch(Exception e){log(e);}
- }
- public void onToBank(){
- try{
- status = "Going to Bank";
- walking.walkTileMM(theBank);
- }catch(Exception e){log(e);}
- sleep(random(500, 700));
- }
- public void onToGlitch(){
- try{
- status = "Going to Fountain"; //What you don't know can't hurt you :P
- walking.walkTileMM(glitchSpot);
- }catch(Exception e){log(e);}
- sleep(random(500, 710));
- }
- public void onToFountain(){
- try{
- status = "Going to Fountain";
- walking.walkTileMM(theFountain);
- }catch(Exception e){log(e);}
- sleep(random(500, 705));
- }
- public void runcheck() {
- try{
- runEnergy = (random(50, 70));
- if (walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
- walking.setRun(true);
- isRunning = "Yes";
- sleep(random(300, 500));
- }
- else{
- isRunning = "No";
- sleep(random(300,500));
- }
- }catch(Exception ex){}
- }
- @Override
- public int loop(){
- mouse.setSpeed(random(minSpeed, maxSpeed));
- runcheck();
- if(antiban){
- if(random(min, max) == 3){
- antiban();
- }
- }
- if(objects.getNearest(fountainID) != null){
- fountain = objects.getNearest(fountainID);
- }
- if(npcs.getNearest(bankerID) != null){
- banker = npcs.getNearest(bankerID);
- }
- if(inventory.getItem(emptyVialID) != null){
- myVial = inventory.getItem(emptyVialID);
- }
- switch(getState()){
- case TOFOUNTAIN:
- runcheck();
- onToFountain();
- if(fountainRange.contains(players.getMyPlayer().getLocation())){
- fillVials();
- }
- break;
- case TOGLITCH:
- runcheck();
- onToGlitch();
- break;
- case TOBANK:
- runcheck();
- onToBank();
- if(bankRange.contains(players.getMyPlayer().getLocation())){
- doBank();
- }
- break;
- }
- return(random(500, 1000));
- }
- private State getState() {
- if (!inventory.contains(emptyVialID)) {
- return State.TOBANK;
- }
- else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
- return State.TOGLITCH;
- }
- else{
- return State.TOFOUNTAIN;
- }
- }
- // GUI and Mouse
- public void onRepaint(Graphics g1) {
- profit = numFilled * profitPrice;
- if(!save){
- 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;
- if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
- profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- profHour = profSec * 3600;
- hourlyProfit = profHour * profitPrice;
- hourlyProfitInt = Math.round(hourlyProfit);
- }
- else{
- millis = 0;
- hours = 0;
- minutes = 0;
- seconds = 0;
- hourlyProfitInt = 9001;
- }
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(7, 345, 488, 70);
- g.setStroke(stroke1);
- g.drawRect(7, 345, 488, 70);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Status:", 14, 362);
- g.setFont(font2);
- g.drawString(status, 59, 362);
- g.setFont(font1);
- g.drawString("Filled Vials In Bank:", 209, 362);
- g.setFont(font2);
- g.drawString(Integer.toString(numFilled), 328, 362);
- g.setFont(font1);
- g.drawString("Profit:", 14, 383);
- g.setFont(font2);
- g.drawString(Integer.toString(profit), 59, 383);
- g.setFont(font1);
- g.drawString("Profit/hr:", 137, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
- }
- else{
- g.drawString("Mem Save", 190, 383);
- }
- g.setFont(font1);
- g.drawString("Runtime:", 270, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
- }
- else{
- g.drawString("Mem Save", 325, 384);
- }
- g.setFont(font1);
- g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
- g.drawString("Running:", 710, 139);
- g.setFont(font2);
- g.drawString(isRunning, 722, 156);
- g.setFont(font3);
- g.drawString("Painlaws", 440, 357);
- g1.setColor(Color.green);
- g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
- g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
- }
- /* Antiban stuff
- * Some credits to Aaimister :)
- * Partially copied, with permission
- */
- public void rotateCamera() {
- final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- final int randomLR = random(0, 2);
- final int randomUD = random(0, 2);
- final int randomAll = random(0, 4);
- if (random(0, 3) == 0) {
- keyboard.pressKey(LR[randomLR]);
- sleepCR(random(2, 9));
- keyboard.pressKey(UD[randomUD]);
- sleepCR(random(6, 10));
- keyboard.releaseKey(UD[randomUD]);
- sleepCR(random(2, 7));
- keyboard.releaseKey(LR[randomLR]);
- } else {
- keyboard.pressKey(LRUD[randomAll]);
- if (randomAll > 1) {
- sleepCR(random(6, 11));
- } else {
- sleepCR(random(9, 12));
- }
- keyboard.releaseKey(LRUD[randomAll]);
- }
- }
- private boolean sleepCR(final int amtOfHalfSecs) {
- for (int x = 0; x < amtOfHalfSecs + 1; x++) {
- sleep(random(48, 53));
- }
- return true;
- }
- private void antiban(){
- int action = random(0, 5);
- switch (action) {
- case 0:
- status = "Antiban";
- rotateCamera();
- sleep(200, 400);
- break;
- case 1:
- status = "Antiban";
- mouse.moveRandomly(100, 900);
- sleep(200, 400);
- break;
- case 2:
- status = "Antiban";
- mouse.moveSlightly();
- sleep(200, 400);
- break;
- case 3:
- status = "Antiban";
- camera.moveRandomly(random(750,1250));
- sleep(200, 400);
- break;
- case 4:
- status = "Antiban";
- checkEXP();
- sleep(200, 400);
- break;
- case 5:
- status = "Antiban";
- mouse.moveOffScreen();
- sleep(200, 400);
- break;
- }
- }
- public void checkEXP() {
- game.openTab(Game.Tab.STATS);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(random(2100, 3400));
- game.openTab(Game.Tab.INVENTORY);
- sleep(random(540,760));
- }
- class gui extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e){
- String mode = selectionBox.getSelectedItem().toString();
- if(mode.equals("Maximum")){
- antiban = false;
- minSpeed = 5;
- maxSpeed = 6;
- }
- else if(mode.equals("Paranoid")){
- antiban = true;
- minSpeed = 8;
- maxSpeed = 10;
- min = 3;
- max = 3;
- }
- save = memoryMode.isSelected();
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- selectionBox = new JComboBox();
- memoryMode = new JCheckBox();
- label2 = new JLabel();
- label3 = new JLabel();
- label4 = new JLabel();
- label5 = new JLabel();
- startButton = new JButton();
- //======== this ========
- setTitle("Painlaws's Vial Filler");
- setResizable(false);
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Mode");
- //---- selectionBox ----
- selectionBox.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Paranoid",
- "Maximum"
- }));
- //---- memoryMode ----
- memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
- //---- label2 ----
- label2.setText("Modes:");
- //---- label3 ----
- label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
- //---- label4 ----
- label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
- //---- label5 ----
- label5.setText("Maximum - No Antiban, Fast Mouse Speed");
- //---- startButton ----
- startButton.setText("Let's Fill Some Vials!");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e){
- startButtonActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
- .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGap(148, 148, 148)
- .addComponent(startButton)))
- .addContainerGap(2, Short.MAX_VALUE))
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label1)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(memoryMode)
- .addGap(18, 18, 18)
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label4)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox selectionBox;
- private JCheckBox memoryMode;
- private JLabel label2;
- private JLabel label3;
- private JLabel label4;
- private JLabel label5;
- private JButton startButton;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.KeyEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
- public class vialfiller extends Script implements PaintListener{
- //Variables
- // - Essentials
- private int bankerID = 6533;
- private int fountainID = 24214;
- private int emptyVialID = 229;
- private int fullVialID = 227;
- private int runEnergy = 50;
- RSNPC banker;
- RSObject fountain;
- RSItem myVial;
- RSTile theBank = new RSTile(3167, 3489);
- RSTile theFountain = new RSTile(3191, 3471);
- RSTile glitchSpot = new RSTile(3192, 3487);
- RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
- RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
- RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
- RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
- // - GUI Options
- private int min = 1;
- private int max = 6;
- private int minSpeed = 6;
- private int maxSpeed = 9;
- private boolean guiWait = true;
- private boolean save = false;
- // - State check
- private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
- // - Paint stuff
- private String status = "Initializing...";
- private String isRunning = "";
- private int numFilled = 0;
- private int vialFilledPrice;
- private int vialEmptyPrice;
- private int profitPrice;
- private int profit;
- private long startTime;
- private long millis;
- private long hours;
- private long minutes;
- private long seconds;
- private float profSec = 0;
- private float profHour;
- private float hourlyProfit;
- private int hourlyProfitInt;
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 13);
- private final Font font2 = new Font("Arial", 1, 13);
- private final Font font3 = new Font("Vijaya", 1, 17);
- private boolean antiban = true;
- gui g = new gui();
- @Override
- public boolean onStart(){
- log("Welcome to Painlaws's Vial Filler");
- log("Waiting on GUI...");
- g.setVisible(true);
- while(guiWait){
- sleep(500);
- }
- log("GUI Settings loaded!");
- if(walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else{
- isRunning = "No";
- }
- vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
- vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
- profitPrice = vialFilledPrice - vialEmptyPrice;
- if(!save){
- startTime = System.currentTimeMillis();
- }
- else{
- startTime = 0;
- }
- return true;
- }
- @Override
- public void onFinish(){
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- }
- public void useItem(RSItem item, RSObject object){
- if(item != null && object != null && object.isOnScreen()){
- item.doClick(true);
- sleep(200, 300);
- object.doClick();
- }
- }
- public void fillVials(){
- if(fountain != null){
- status = "Filling Vials";
- useItem(myVial, fountain);
- while(inventory.contains(emptyVialID)){
- sleep(random(1000,1500));
- if(antiban){
- if(random(1, 3) == 2){
- mouse.moveSlightly();
- }
- }
- }
- status = "Vials filled";
- }
- else{
- status = "Fountain is null...retrying";
- sleep(random(600, 800));
- }
- }
- private void doBank(){
- try{
- if(banker != null){
- camera.turnTo(banker);
- if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
- status = "Opening Bank";
- banker.interact("Bank Banker");
- status = "Bank opened";
- sleep(random(900, 1050));
- status = "Depositing All";
- bank.depositAll();
- status = "Deposited All";
- sleep(random(780, 950));
- numFilled = bank.getCount(fullVialID);
- if(bank.getCount(emptyVialID) != 0){
- status = "Taking Vials";
- bank.withdraw(emptyVialID, 0);
- status = "Vials Taken";
- sleep(random(700, 960));
- }
- else{
- log("Out of vials. Quitting :/");
- bank.close();
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- stopScript(true);
- }
- status = "Closing Bank";
- bank.close();
- status = "Bank Closed";
- sleep(random(750, 910));
- }
- }
- sleep(random(300,500));
- }catch(Exception e){log(e);}
- }
- public void onToBank(){
- try{
- status = "Going to Bank";
- walking.walkTileMM(theBank);
- }catch(Exception e){log(e);}
- sleep(random(500, 700));
- }
- public void onToGlitch(){
- try{
- status = "Going to Fountain"; //What you don't know can't hurt you :P
- walking.walkTileMM(glitchSpot);
- }catch(Exception e){log(e);}
- sleep(random(500, 710));
- }
- public void onToFountain(){
- try{
- status = "Going to Fountain";
- walking.walkTileMM(theFountain);
- }catch(Exception e){log(e);}
- sleep(random(500, 705));
- }
- public void runcheck() {
- try{
- runEnergy = (random(50, 70));
- if (walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
- walking.setRun(true);
- isRunning = "Yes";
- sleep(random(300, 500));
- }
- else{
- isRunning = "No";
- sleep(random(300,500));
- }
- }catch(Exception ex){}
- }
- @Override
- public int loop(){
- mouse.setSpeed(random(minSpeed, maxSpeed));
- runcheck();
- if(antiban){
- if(random(min, max) == 3){
- antiban();
- }
- }
- if(objects.getNearest(fountainID) != null){
- fountain = objects.getNearest(fountainID);
- }
- if(npcs.getNearest(bankerID) != null){
- banker = npcs.getNearest(bankerID);
- }
- if(inventory.getItem(emptyVialID) != null){
- myVial = inventory.getItem(emptyVialID);
- }
- switch(getState()){
- case TOFOUNTAIN:
- runcheck();
- onToFountain();
- if(fountainRange.contains(players.getMyPlayer().getLocation())){
- fillVials();
- }
- break;
- case TOGLITCH:
- runcheck();
- onToGlitch();
- break;
- case TOBANK:
- runcheck();
- onToBank();
- if(bankRange.contains(players.getMyPlayer().getLocation())){
- doBank();
- }
- break;
- }
- return(random(500, 1000));
- }
- private State getState() {
- if (!inventory.contains(emptyVialID)) {
- return State.TOBANK;
- }
- else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
- return State.TOGLITCH;
- }
- else{
- return State.TOFOUNTAIN;
- }
- }
- // GUI and Mouse
- public void onRepaint(Graphics g1) {
- profit = numFilled * profitPrice;
- if(!save){
- 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;
- if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
- profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- profHour = profSec * 3600;
- hourlyProfit = profHour * profitPrice;
- hourlyProfitInt = Math.round(hourlyProfit);
- }
- else{
- millis = 0;
- hours = 0;
- minutes = 0;
- seconds = 0;
- hourlyProfitInt = 9001;
- }
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(7, 345, 488, 70);
- g.setStroke(stroke1);
- g.drawRect(7, 345, 488, 70);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Status:", 14, 362);
- g.setFont(font2);
- g.drawString(status, 59, 362);
- g.setFont(font1);
- g.drawString("Filled Vials In Bank:", 209, 362);
- g.setFont(font2);
- g.drawString(Integer.toString(numFilled), 328, 362);
- g.setFont(font1);
- g.drawString("Profit:", 14, 383);
- g.setFont(font2);
- g.drawString(Integer.toString(profit), 59, 383);
- g.setFont(font1);
- g.drawString("Profit/hr:", 137, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
- }
- else{
- g.drawString("Mem Save", 190, 383);
- }
- g.setFont(font1);
- g.drawString("Runtime:", 270, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
- }
- else{
- g.drawString("Mem Save", 325, 384);
- }
- g.setFont(font1);
- g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
- g.drawString("Running:", 710, 139);
- g.setFont(font2);
- g.drawString(isRunning, 722, 156);
- g.setFont(font3);
- g.drawString("Painlaws", 440, 357);
- g1.setColor(Color.green);
- g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
- g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
- }
- /* Antiban stuff
- * Some credits to Aaimister :)
- * Partially copied, with permission
- */
- public void rotateCamera() {
- final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- final int randomLR = random(0, 2);
- final int randomUD = random(0, 2);
- final int randomAll = random(0, 4);
- if (random(0, 3) == 0) {
- keyboard.pressKey(LR[randomLR]);
- sleepCR(random(2, 9));
- keyboard.pressKey(UD[randomUD]);
- sleepCR(random(6, 10));
- keyboard.releaseKey(UD[randomUD]);
- sleepCR(random(2, 7));
- keyboard.releaseKey(LR[randomLR]);
- } else {
- keyboard.pressKey(LRUD[randomAll]);
- if (randomAll > 1) {
- sleepCR(random(6, 11));
- } else {
- sleepCR(random(9, 12));
- }
- keyboard.releaseKey(LRUD[randomAll]);
- }
- }
- private boolean sleepCR(final int amtOfHalfSecs) {
- for (int x = 0; x < amtOfHalfSecs + 1; x++) {
- sleep(random(48, 53));
- }
- return true;
- }
- private void antiban(){
- int action = random(0, 5);
- switch (action) {
- case 0:
- status = "Antiban";
- rotateCamera();
- sleep(200, 400);
- break;
- case 1:
- status = "Antiban";
- mouse.moveRandomly(100, 900);
- sleep(200, 400);
- break;
- case 2:
- status = "Antiban";
- mouse.moveSlightly();
- sleep(200, 400);
- break;
- case 3:
- status = "Antiban";
- camera.moveRandomly(random(750,1250));
- sleep(200, 400);
- break;
- case 4:
- status = "Antiban";
- checkEXP();
- sleep(200, 400);
- break;
- case 5:
- status = "Antiban";
- mouse.moveOffScreen();
- sleep(200, 400);
- break;
- }
- }
- public void checkEXP() {
- game.openTab(Game.Tab.STATS);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(random(2100, 3400));
- game.openTab(Game.Tab.INVENTORY);
- sleep(random(540,760));
- }
- class gui extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e){
- String mode = selectionBox.getSelectedItem().toString();
- if(mode.equals("Maximum")){
- antiban = false;
- minSpeed = 5;
- maxSpeed = 6;
- }
- else if(mode.equals("Paranoid")){
- antiban = true;
- minSpeed = 8;
- maxSpeed = 10;
- min = 3;
- max = 3;
- }
- save = memoryMode.isSelected();
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- selectionBox = new JComboBox();
- memoryMode = new JCheckBox();
- label2 = new JLabel();
- label3 = new JLabel();
- label4 = new JLabel();
- label5 = new JLabel();
- startButton = new JButton();
- //======== this ========
- setTitle("Painlaws's Vial Filler");
- setResizable(false);
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Mode");
- //---- selectionBox ----
- selectionBox.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Paranoid",
- "Maximum"
- }));
- //---- memoryMode ----
- memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
- //---- label2 ----
- label2.setText("Modes:");
- //---- label3 ----
- label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
- //---- label4 ----
- label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
- //---- label5 ----
- label5.setText("Maximum - No Antiban, Fast Mouse Speed");
- //---- startButton ----
- startButton.setText("Let's Fill Some Vials!");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e){
- startButtonActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
- .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGap(148, 148, 148)
- .addComponent(startButton)))
- .addContainerGap(2, Short.MAX_VALUE))
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label1)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(memoryMode)
- .addGap(18, 18, 18)
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label4)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox selectionBox;
- private JCheckBox memoryMode;
- private JLabel label2;
- private JLabel label3;
- private JLabel label4;
- private JLabel label5;
- private JButton startButton;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.KeyEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
- public class vialfiller extends Script implements PaintListener{
- //Variables
- // - Essentials
- private int bankerID = 6533;
- private int fountainID = 24214;
- private int emptyVialID = 229;
- private int fullVialID = 227;
- private int runEnergy = 50;
- RSNPC banker;
- RSObject fountain;
- RSItem myVial;
- RSTile theBank = new RSTile(3167, 3489);
- RSTile theFountain = new RSTile(3191, 3471);
- RSTile glitchSpot = new RSTile(3192, 3487);
- RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
- RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
- RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
- RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
- // - GUI Options
- private int min = 1;
- private int max = 6;
- private int minSpeed = 6;
- private int maxSpeed = 9;
- private boolean guiWait = true;
- private boolean save = false;
- // - State check
- private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
- // - Paint stuff
- private String status = "Initializing...";
- private String isRunning = "";
- private int numFilled = 0;
- private int vialFilledPrice;
- private int vialEmptyPrice;
- private int profitPrice;
- private int profit;
- private long startTime;
- private long millis;
- private long hours;
- private long minutes;
- private long seconds;
- private float profSec = 0;
- private float profHour;
- private float hourlyProfit;
- private int hourlyProfitInt;
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 13);
- private final Font font2 = new Font("Arial", 1, 13);
- private final Font font3 = new Font("Vijaya", 1, 17);
- private boolean antiban = true;
- gui g = new gui();
- @Override
- public boolean onStart(){
- log("Welcome to Painlaws's Vial Filler");
- log("Waiting on GUI...");
- g.setVisible(true);
- while(guiWait){
- sleep(500);
- }
- log("GUI Settings loaded!");
- if(walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else{
- isRunning = "No";
- }
- vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
- vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
- profitPrice = vialFilledPrice - vialEmptyPrice;
- if(!save){
- startTime = System.currentTimeMillis();
- }
- else{
- startTime = 0;
- }
- return true;
- }
- @Override
- public void onFinish(){
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- }
- public void useItem(RSItem item, RSObject object){
- if(item != null && object != null && object.isOnScreen()){
- item.doClick(true);
- sleep(200, 300);
- object.doClick();
- }
- }
- public void fillVials(){
- if(fountain != null){
- status = "Filling Vials";
- useItem(myVial, fountain);
- while(inventory.contains(emptyVialID)){
- sleep(random(1000,1500));
- if(antiban){
- if(random(1, 3) == 2){
- mouse.moveSlightly();
- }
- }
- }
- status = "Vials filled";
- }
- else{
- status = "Fountain is null...retrying";
- sleep(random(600, 800));
- }
- }
- private void doBank(){
- try{
- if(banker != null){
- camera.turnTo(banker);
- if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
- status = "Opening Bank";
- banker.interact("Bank Banker");
- status = "Bank opened";
- sleep(random(900, 1050));
- status = "Depositing All";
- bank.depositAll();
- status = "Deposited All";
- sleep(random(780, 950));
- numFilled = bank.getCount(fullVialID);
- if(bank.getCount(emptyVialID) != 0){
- status = "Taking Vials";
- bank.withdraw(emptyVialID, 0);
- status = "Vials Taken";
- sleep(random(700, 960));
- }
- else{
- log("Out of vials. Quitting :/");
- bank.close();
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- stopScript(true);
- }
- status = "Closing Bank";
- bank.close();
- status = "Bank Closed";
- sleep(random(750, 910));
- }
- }
- sleep(random(300,500));
- }catch(Exception e){log(e);}
- }
- public void onToBank(){
- try{
- status = "Going to Bank";
- walking.walkTileMM(theBank);
- }catch(Exception e){log(e);}
- sleep(random(500, 700));
- }
- public void onToGlitch(){
- try{
- status = "Going to Fountain"; //What you don't know can't hurt you :P
- walking.walkTileMM(glitchSpot);
- }catch(Exception e){log(e);}
- sleep(random(500, 710));
- }
- public void onToFountain(){
- try{
- status = "Going to Fountain";
- walking.walkTileMM(theFountain);
- }catch(Exception e){log(e);}
- sleep(random(500, 705));
- }
- public void runcheck() {
- try{
- runEnergy = (random(50, 70));
- if (walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
- walking.setRun(true);
- isRunning = "Yes";
- sleep(random(300, 500));
- }
- else{
- isRunning = "No";
- sleep(random(300,500));
- }
- }catch(Exception ex){}
- }
- @Override
- public int loop(){
- mouse.setSpeed(random(minSpeed, maxSpeed));
- runcheck();
- if(antiban){
- if(random(min, max) == 3){
- antiban();
- }
- }
- if(objects.getNearest(fountainID) != null){
- fountain = objects.getNearest(fountainID);
- }
- if(npcs.getNearest(bankerID) != null){
- banker = npcs.getNearest(bankerID);
- }
- if(inventory.getItem(emptyVialID) != null){
- myVial = inventory.getItem(emptyVialID);
- }
- switch(getState()){
- case TOFOUNTAIN:
- runcheck();
- onToFountain();
- if(fountainRange.contains(players.getMyPlayer().getLocation())){
- fillVials();
- }
- break;
- case TOGLITCH:
- runcheck();
- onToGlitch();
- break;
- case TOBANK:
- runcheck();
- onToBank();
- if(bankRange.contains(players.getMyPlayer().getLocation())){
- doBank();
- }
- break;
- }
- return(random(500, 1000));
- }
- private State getState() {
- if (!inventory.contains(emptyVialID)) {
- return State.TOBANK;
- }
- else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
- return State.TOGLITCH;
- }
- else{
- return State.TOFOUNTAIN;
- }
- }
- // GUI and Mouse
- public void onRepaint(Graphics g1) {
- profit = numFilled * profitPrice;
- if(!save){
- 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;
- if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
- profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- profHour = profSec * 3600;
- hourlyProfit = profHour * profitPrice;
- hourlyProfitInt = Math.round(hourlyProfit);
- }
- else{
- millis = 0;
- hours = 0;
- minutes = 0;
- seconds = 0;
- hourlyProfitInt = 9001;
- }
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(7, 345, 488, 70);
- g.setStroke(stroke1);
- g.drawRect(7, 345, 488, 70);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Status:", 14, 362);
- g.setFont(font2);
- g.drawString(status, 59, 362);
- g.setFont(font1);
- g.drawString("Filled Vials In Bank:", 209, 362);
- g.setFont(font2);
- g.drawString(Integer.toString(numFilled), 328, 362);
- g.setFont(font1);
- g.drawString("Profit:", 14, 383);
- g.setFont(font2);
- g.drawString(Integer.toString(profit), 59, 383);
- g.setFont(font1);
- g.drawString("Profit/hr:", 137, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
- }
- else{
- g.drawString("Mem Save", 190, 383);
- }
- g.setFont(font1);
- g.drawString("Runtime:", 270, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
- }
- else{
- g.drawString("Mem Save", 325, 384);
- }
- g.setFont(font1);
- g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
- g.drawString("Running:", 710, 139);
- g.setFont(font2);
- g.drawString(isRunning, 722, 156);
- g.setFont(font3);
- g.drawString("Painlaws", 440, 357);
- g1.setColor(Color.green);
- g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
- g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
- }
- /* Antiban stuff
- * Some credits to Aaimister :)
- * Partially copied, with permission
- */
- public void rotateCamera() {
- final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- final int randomLR = random(0, 2);
- final int randomUD = random(0, 2);
- final int randomAll = random(0, 4);
- if (random(0, 3) == 0) {
- keyboard.pressKey(LR[randomLR]);
- sleepCR(random(2, 9));
- keyboard.pressKey(UD[randomUD]);
- sleepCR(random(6, 10));
- keyboard.releaseKey(UD[randomUD]);
- sleepCR(random(2, 7));
- keyboard.releaseKey(LR[randomLR]);
- } else {
- keyboard.pressKey(LRUD[randomAll]);
- if (randomAll > 1) {
- sleepCR(random(6, 11));
- } else {
- sleepCR(random(9, 12));
- }
- keyboard.releaseKey(LRUD[randomAll]);
- }
- }
- private boolean sleepCR(final int amtOfHalfSecs) {
- for (int x = 0; x < amtOfHalfSecs + 1; x++) {
- sleep(random(48, 53));
- }
- return true;
- }
- private void antiban(){
- int action = random(0, 5);
- switch (action) {
- case 0:
- status = "Antiban";
- rotateCamera();
- sleep(200, 400);
- break;
- case 1:
- status = "Antiban";
- mouse.moveRandomly(100, 900);
- sleep(200, 400);
- break;
- case 2:
- status = "Antiban";
- mouse.moveSlightly();
- sleep(200, 400);
- break;
- case 3:
- status = "Antiban";
- camera.moveRandomly(random(750,1250));
- sleep(200, 400);
- break;
- case 4:
- status = "Antiban";
- checkEXP();
- sleep(200, 400);
- break;
- case 5:
- status = "Antiban";
- mouse.moveOffScreen();
- sleep(200, 400);
- break;
- }
- }
- public void checkEXP() {
- game.openTab(Game.Tab.STATS);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(random(2100, 3400));
- game.openTab(Game.Tab.INVENTORY);
- sleep(random(540,760));
- }
- class gui extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e){
- String mode = selectionBox.getSelectedItem().toString();
- if(mode.equals("Maximum")){
- antiban = false;
- minSpeed = 5;
- maxSpeed = 6;
- }
- else if(mode.equals("Paranoid")){
- antiban = true;
- minSpeed = 8;
- maxSpeed = 10;
- min = 3;
- max = 3;
- }
- save = memoryMode.isSelected();
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- selectionBox = new JComboBox();
- memoryMode = new JCheckBox();
- label2 = new JLabel();
- label3 = new JLabel();
- label4 = new JLabel();
- label5 = new JLabel();
- startButton = new JButton();
- //======== this ========
- setTitle("Painlaws's Vial Filler");
- setResizable(false);
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Mode");
- //---- selectionBox ----
- selectionBox.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Paranoid",
- "Maximum"
- }));
- //---- memoryMode ----
- memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
- //---- label2 ----
- label2.setText("Modes:");
- //---- label3 ----
- label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
- //---- label4 ----
- label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
- //---- label5 ----
- label5.setText("Maximum - No Antiban, Fast Mouse Speed");
- //---- startButton ----
- startButton.setText("Let's Fill Some Vials!");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e){
- startButtonActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
- .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGap(148, 148, 148)
- .addComponent(startButton)))
- .addContainerGap(2, Short.MAX_VALUE))
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label1)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(memoryMode)
- .addGap(18, 18, 18)
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label4)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox selectionBox;
- private JCheckBox memoryMode;
- private JLabel label2;
- private JLabel label3;
- private JLabel label4;
- private JLabel label5;
- private JButton startButton;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.KeyEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
- public class vialfiller extends Script implements PaintListener{
- //Variables
- // - Essentials
- private int bankerID = 6533;
- private int fountainID = 24214;
- private int emptyVialID = 229;
- private int fullVialID = 227;
- private int runEnergy = 50;
- RSNPC banker;
- RSObject fountain;
- RSItem myVial;
- RSTile theBank = new RSTile(3167, 3489);
- RSTile theFountain = new RSTile(3191, 3471);
- RSTile glitchSpot = new RSTile(3192, 3487);
- RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
- RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
- RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
- RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
- // - GUI Options
- private int min = 1;
- private int max = 6;
- private int minSpeed = 6;
- private int maxSpeed = 9;
- private boolean guiWait = true;
- private boolean save = false;
- // - State check
- private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
- // - Paint stuff
- private String status = "Initializing...";
- private String isRunning = "";
- private int numFilled = 0;
- private int vialFilledPrice;
- private int vialEmptyPrice;
- private int profitPrice;
- private int profit;
- private long startTime;
- private long millis;
- private long hours;
- private long minutes;
- private long seconds;
- private float profSec = 0;
- private float profHour;
- private float hourlyProfit;
- private int hourlyProfitInt;
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 13);
- private final Font font2 = new Font("Arial", 1, 13);
- private final Font font3 = new Font("Vijaya", 1, 17);
- private boolean antiban = true;
- gui g = new gui();
- @Override
- public boolean onStart(){
- log("Welcome to Painlaws's Vial Filler");
- log("Waiting on GUI...");
- g.setVisible(true);
- while(guiWait){
- sleep(500);
- }
- log("GUI Settings loaded!");
- if(walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else{
- isRunning = "No";
- }
- vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
- vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
- profitPrice = vialFilledPrice - vialEmptyPrice;
- if(!save){
- startTime = System.currentTimeMillis();
- }
- else{
- startTime = 0;
- }
- return true;
- }
- @Override
- public void onFinish(){
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- }
- public void useItem(RSItem item, RSObject object){
- if(item != null && object != null && object.isOnScreen()){
- item.doClick(true);
- sleep(200, 300);
- object.doClick();
- }
- }
- public void fillVials(){
- if(fountain != null){
- status = "Filling Vials";
- useItem(myVial, fountain);
- while(inventory.contains(emptyVialID)){
- sleep(random(1000,1500));
- if(antiban){
- if(random(1, 3) == 2){
- mouse.moveSlightly();
- }
- }
- }
- status = "Vials filled";
- }
- else{
- status = "Fountain is null...retrying";
- sleep(random(600, 800));
- }
- }
- private void doBank(){
- try{
- if(banker != null){
- camera.turnTo(banker);
- if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
- status = "Opening Bank";
- banker.interact("Bank Banker");
- status = "Bank opened";
- sleep(random(900, 1050));
- status = "Depositing All";
- bank.depositAll();
- status = "Deposited All";
- sleep(random(780, 950));
- numFilled = bank.getCount(fullVialID);
- if(bank.getCount(emptyVialID) != 0){
- status = "Taking Vials";
- bank.withdraw(emptyVialID, 0);
- status = "Vials Taken";
- sleep(random(700, 960));
- }
- else{
- log("Out of vials. Quitting :/");
- bank.close();
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- stopScript(true);
- }
- status = "Closing Bank";
- bank.close();
- status = "Bank Closed";
- sleep(random(750, 910));
- }
- }
- sleep(random(300,500));
- }catch(Exception e){log(e);}
- }
- public void onToBank(){
- try{
- status = "Going to Bank";
- walking.walkTileMM(theBank);
- }catch(Exception e){log(e);}
- sleep(random(500, 700));
- }
- public void onToGlitch(){
- try{
- status = "Going to Fountain"; //What you don't know can't hurt you :P
- walking.walkTileMM(glitchSpot);
- }catch(Exception e){log(e);}
- sleep(random(500, 710));
- }
- public void onToFountain(){
- try{
- status = "Going to Fountain";
- walking.walkTileMM(theFountain);
- }catch(Exception e){log(e);}
- sleep(random(500, 705));
- }
- public void runcheck() {
- try{
- runEnergy = (random(50, 70));
- if (walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
- walking.setRun(true);
- isRunning = "Yes";
- sleep(random(300, 500));
- }
- else{
- isRunning = "No";
- sleep(random(300,500));
- }
- }catch(Exception ex){}
- }
- @Override
- public int loop(){
- mouse.setSpeed(random(minSpeed, maxSpeed));
- runcheck();
- if(antiban){
- if(random(min, max) == 3){
- antiban();
- }
- }
- if(objects.getNearest(fountainID) != null){
- fountain = objects.getNearest(fountainID);
- }
- if(npcs.getNearest(bankerID) != null){
- banker = npcs.getNearest(bankerID);
- }
- if(inventory.getItem(emptyVialID) != null){
- myVial = inventory.getItem(emptyVialID);
- }
- switch(getState()){
- case TOFOUNTAIN:
- runcheck();
- onToFountain();
- if(fountainRange.contains(players.getMyPlayer().getLocation())){
- fillVials();
- }
- break;
- case TOGLITCH:
- runcheck();
- onToGlitch();
- break;
- case TOBANK:
- runcheck();
- onToBank();
- if(bankRange.contains(players.getMyPlayer().getLocation())){
- doBank();
- }
- break;
- }
- return(random(500, 1000));
- }
- private State getState() {
- if (!inventory.contains(emptyVialID)) {
- return State.TOBANK;
- }
- else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
- return State.TOGLITCH;
- }
- else{
- return State.TOFOUNTAIN;
- }
- }
- // GUI and Mouse
- public void onRepaint(Graphics g1) {
- profit = numFilled * profitPrice;
- if(!save){
- 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;
- if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
- profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- profHour = profSec * 3600;
- hourlyProfit = profHour * profitPrice;
- hourlyProfitInt = Math.round(hourlyProfit);
- }
- else{
- millis = 0;
- hours = 0;
- minutes = 0;
- seconds = 0;
- hourlyProfitInt = 9001;
- }
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(7, 345, 488, 70);
- g.setStroke(stroke1);
- g.drawRect(7, 345, 488, 70);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Status:", 14, 362);
- g.setFont(font2);
- g.drawString(status, 59, 362);
- g.setFont(font1);
- g.drawString("Filled Vials In Bank:", 209, 362);
- g.setFont(font2);
- g.drawString(Integer.toString(numFilled), 328, 362);
- g.setFont(font1);
- g.drawString("Profit:", 14, 383);
- g.setFont(font2);
- g.drawString(Integer.toString(profit), 59, 383);
- g.setFont(font1);
- g.drawString("Profit/hr:", 137, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
- }
- else{
- g.drawString("Mem Save", 190, 383);
- }
- g.setFont(font1);
- g.drawString("Runtime:", 270, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
- }
- else{
- g.drawString("Mem Save", 325, 384);
- }
- g.setFont(font1);
- g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
- g.drawString("Running:", 710, 139);
- g.setFont(font2);
- g.drawString(isRunning, 722, 156);
- g.setFont(font3);
- g.drawString("Painlaws", 440, 357);
- g1.setColor(Color.green);
- g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
- g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
- }
- /* Antiban stuff
- * Some credits to Aaimister :)
- * Partially copied, with permission
- */
- public void rotateCamera() {
- final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- final int randomLR = random(0, 2);
- final int randomUD = random(0, 2);
- final int randomAll = random(0, 4);
- if (random(0, 3) == 0) {
- keyboard.pressKey(LR[randomLR]);
- sleepCR(random(2, 9));
- keyboard.pressKey(UD[randomUD]);
- sleepCR(random(6, 10));
- keyboard.releaseKey(UD[randomUD]);
- sleepCR(random(2, 7));
- keyboard.releaseKey(LR[randomLR]);
- } else {
- keyboard.pressKey(LRUD[randomAll]);
- if (randomAll > 1) {
- sleepCR(random(6, 11));
- } else {
- sleepCR(random(9, 12));
- }
- keyboard.releaseKey(LRUD[randomAll]);
- }
- }
- private boolean sleepCR(final int amtOfHalfSecs) {
- for (int x = 0; x < amtOfHalfSecs + 1; x++) {
- sleep(random(48, 53));
- }
- return true;
- }
- private void antiban(){
- int action = random(0, 5);
- switch (action) {
- case 0:
- status = "Antiban";
- rotateCamera();
- sleep(200, 400);
- break;
- case 1:
- status = "Antiban";
- mouse.moveRandomly(100, 900);
- sleep(200, 400);
- break;
- case 2:
- status = "Antiban";
- mouse.moveSlightly();
- sleep(200, 400);
- break;
- case 3:
- status = "Antiban";
- camera.moveRandomly(random(750,1250));
- sleep(200, 400);
- break;
- case 4:
- status = "Antiban";
- checkEXP();
- sleep(200, 400);
- break;
- case 5:
- status = "Antiban";
- mouse.moveOffScreen();
- sleep(200, 400);
- break;
- }
- }
- public void checkEXP() {
- game.openTab(Game.Tab.STATS);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(random(2100, 3400));
- game.openTab(Game.Tab.INVENTORY);
- sleep(random(540,760));
- }
- class gui extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e){
- String mode = selectionBox.getSelectedItem().toString();
- if(mode.equals("Maximum")){
- antiban = false;
- minSpeed = 5;
- maxSpeed = 6;
- }
- else if(mode.equals("Paranoid")){
- antiban = true;
- minSpeed = 8;
- maxSpeed = 10;
- min = 3;
- max = 3;
- }
- save = memoryMode.isSelected();
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- selectionBox = new JComboBox();
- memoryMode = new JCheckBox();
- label2 = new JLabel();
- label3 = new JLabel();
- label4 = new JLabel();
- label5 = new JLabel();
- startButton = new JButton();
- //======== this ========
- setTitle("Painlaws's Vial Filler");
- setResizable(false);
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Mode");
- //---- selectionBox ----
- selectionBox.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Paranoid",
- "Maximum"
- }));
- //---- memoryMode ----
- memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
- //---- label2 ----
- label2.setText("Modes:");
- //---- label3 ----
- label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
- //---- label4 ----
- label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
- //---- label5 ----
- label5.setText("Maximum - No Antiban, Fast Mouse Speed");
- //---- startButton ----
- startButton.setText("Let's Fill Some Vials!");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e){
- startButtonActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
- .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGap(148, 148, 148)
- .addComponent(startButton)))
- .addContainerGap(2, Short.MAX_VALUE))
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label1)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(memoryMode)
- .addGap(18, 18, 18)
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label4)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox selectionBox;
- private JCheckBox memoryMode;
- private JLabel label2;
- private JLabel label3;
- private JLabel label4;
- private JLabel label5;
- private JButton startButton;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.KeyEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
- public class vialfiller extends Script implements PaintListener{
- //Variables
- // - Essentials
- private int bankerID = 6533;
- private int fountainID = 24214;
- private int emptyVialID = 229;
- private int fullVialID = 227;
- private int runEnergy = 50;
- RSNPC banker;
- RSObject fountain;
- RSItem myVial;
- RSTile theBank = new RSTile(3167, 3489);
- RSTile theFountain = new RSTile(3191, 3471);
- RSTile glitchSpot = new RSTile(3192, 3487);
- RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
- RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
- RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
- RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
- // - GUI Options
- private int min = 1;
- private int max = 6;
- private int minSpeed = 6;
- private int maxSpeed = 9;
- private boolean guiWait = true;
- private boolean save = false;
- // - State check
- private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
- // - Paint stuff
- private String status = "Initializing...";
- private String isRunning = "";
- private int numFilled = 0;
- private int vialFilledPrice;
- private int vialEmptyPrice;
- private int profitPrice;
- private int profit;
- private long startTime;
- private long millis;
- private long hours;
- private long minutes;
- private long seconds;
- private float profSec = 0;
- private float profHour;
- private float hourlyProfit;
- private int hourlyProfitInt;
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 13);
- private final Font font2 = new Font("Arial", 1, 13);
- private final Font font3 = new Font("Vijaya", 1, 17);
- private boolean antiban = true;
- gui g = new gui();
- @Override
- public boolean onStart(){
- log("Welcome to Painlaws's Vial Filler");
- log("Waiting on GUI...");
- g.setVisible(true);
- while(guiWait){
- sleep(500);
- }
- log("GUI Settings loaded!");
- if(walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else{
- isRunning = "No";
- }
- vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
- vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
- profitPrice = vialFilledPrice - vialEmptyPrice;
- if(!save){
- startTime = System.currentTimeMillis();
- }
- else{
- startTime = 0;
- }
- return true;
- }
- @Override
- public void onFinish(){
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- }
- public void useItem(RSItem item, RSObject object){
- if(item != null && object != null && object.isOnScreen()){
- item.doClick(true);
- sleep(200, 300);
- object.doClick();
- }
- }
- public void fillVials(){
- if(fountain != null){
- status = "Filling Vials";
- useItem(myVial, fountain);
- while(inventory.contains(emptyVialID)){
- sleep(random(1000,1500));
- if(antiban){
- if(random(1, 3) == 2){
- mouse.moveSlightly();
- }
- }
- }
- status = "Vials filled";
- }
- else{
- status = "Fountain is null...retrying";
- sleep(random(600, 800));
- }
- }
- private void doBank(){
- try{
- if(banker != null){
- camera.turnTo(banker);
- if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
- status = "Opening Bank";
- banker.interact("Bank Banker");
- status = "Bank opened";
- sleep(random(900, 1050));
- status = "Depositing All";
- bank.depositAll();
- status = "Deposited All";
- sleep(random(780, 950));
- numFilled = bank.getCount(fullVialID);
- if(bank.getCount(emptyVialID) != 0){
- status = "Taking Vials";
- bank.withdraw(emptyVialID, 0);
- status = "Vials Taken";
- sleep(random(700, 960));
- }
- else{
- log("Out of vials. Quitting :/");
- bank.close();
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- stopScript(true);
- }
- status = "Closing Bank";
- bank.close();
- status = "Bank Closed";
- sleep(random(750, 910));
- }
- }
- sleep(random(300,500));
- }catch(Exception e){log(e);}
- }
- public void onToBank(){
- try{
- status = "Going to Bank";
- walking.walkTileMM(theBank);
- }catch(Exception e){log(e);}
- sleep(random(500, 700));
- }
- public void onToGlitch(){
- try{
- status = "Going to Fountain"; //What you don't know can't hurt you :P
- walking.walkTileMM(glitchSpot);
- }catch(Exception e){log(e);}
- sleep(random(500, 710));
- }
- public void onToFountain(){
- try{
- status = "Going to Fountain";
- walking.walkTileMM(theFountain);
- }catch(Exception e){log(e);}
- sleep(random(500, 705));
- }
- public void runcheck() {
- try{
- runEnergy = (random(50, 70));
- if (walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
- walking.setRun(true);
- isRunning = "Yes";
- sleep(random(300, 500));
- }
- else{
- isRunning = "No";
- sleep(random(300,500));
- }
- }catch(Exception ex){}
- }
- @Override
- public int loop(){
- mouse.setSpeed(random(minSpeed, maxSpeed));
- runcheck();
- if(antiban){
- if(random(min, max) == 3){
- antiban();
- }
- }
- if(objects.getNearest(fountainID) != null){
- fountain = objects.getNearest(fountainID);
- }
- if(npcs.getNearest(bankerID) != null){
- banker = npcs.getNearest(bankerID);
- }
- if(inventory.getItem(emptyVialID) != null){
- myVial = inventory.getItem(emptyVialID);
- }
- switch(getState()){
- case TOFOUNTAIN:
- runcheck();
- onToFountain();
- if(fountainRange.contains(players.getMyPlayer().getLocation())){
- fillVials();
- }
- break;
- case TOGLITCH:
- runcheck();
- onToGlitch();
- break;
- case TOBANK:
- runcheck();
- onToBank();
- if(bankRange.contains(players.getMyPlayer().getLocation())){
- doBank();
- }
- break;
- }
- return(random(500, 1000));
- }
- private State getState() {
- if (!inventory.contains(emptyVialID)) {
- return State.TOBANK;
- }
- else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
- return State.TOGLITCH;
- }
- else{
- return State.TOFOUNTAIN;
- }
- }
- // GUI and Mouse
- public void onRepaint(Graphics g1) {
- profit = numFilled * profitPrice;
- if(!save){
- 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;
- if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
- profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- profHour = profSec * 3600;
- hourlyProfit = profHour * profitPrice;
- hourlyProfitInt = Math.round(hourlyProfit);
- }
- else{
- millis = 0;
- hours = 0;
- minutes = 0;
- seconds = 0;
- hourlyProfitInt = 9001;
- }
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(7, 345, 488, 70);
- g.setStroke(stroke1);
- g.drawRect(7, 345, 488, 70);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Status:", 14, 362);
- g.setFont(font2);
- g.drawString(status, 59, 362);
- g.setFont(font1);
- g.drawString("Filled Vials In Bank:", 209, 362);
- g.setFont(font2);
- g.drawString(Integer.toString(numFilled), 328, 362);
- g.setFont(font1);
- g.drawString("Profit:", 14, 383);
- g.setFont(font2);
- g.drawString(Integer.toString(profit), 59, 383);
- g.setFont(font1);
- g.drawString("Profit/hr:", 137, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
- }
- else{
- g.drawString("Mem Save", 190, 383);
- }
- g.setFont(font1);
- g.drawString("Runtime:", 270, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
- }
- else{
- g.drawString("Mem Save", 325, 384);
- }
- g.setFont(font1);
- g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
- g.drawString("Running:", 710, 139);
- g.setFont(font2);
- g.drawString(isRunning, 722, 156);
- g.setFont(font3);
- g.drawString("Painlaws", 440, 357);
- g1.setColor(Color.green);
- g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
- g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
- }
- /* Antiban stuff
- * Some credits to Aaimister :)
- * Partially copied, with permission
- */
- public void rotateCamera() {
- final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- final int randomLR = random(0, 2);
- final int randomUD = random(0, 2);
- final int randomAll = random(0, 4);
- if (random(0, 3) == 0) {
- keyboard.pressKey(LR[randomLR]);
- sleepCR(random(2, 9));
- keyboard.pressKey(UD[randomUD]);
- sleepCR(random(6, 10));
- keyboard.releaseKey(UD[randomUD]);
- sleepCR(random(2, 7));
- keyboard.releaseKey(LR[randomLR]);
- } else {
- keyboard.pressKey(LRUD[randomAll]);
- if (randomAll > 1) {
- sleepCR(random(6, 11));
- } else {
- sleepCR(random(9, 12));
- }
- keyboard.releaseKey(LRUD[randomAll]);
- }
- }
- private boolean sleepCR(final int amtOfHalfSecs) {
- for (int x = 0; x < amtOfHalfSecs + 1; x++) {
- sleep(random(48, 53));
- }
- return true;
- }
- private void antiban(){
- int action = random(0, 5);
- switch (action) {
- case 0:
- status = "Antiban";
- rotateCamera();
- sleep(200, 400);
- break;
- case 1:
- status = "Antiban";
- mouse.moveRandomly(100, 900);
- sleep(200, 400);
- break;
- case 2:
- status = "Antiban";
- mouse.moveSlightly();
- sleep(200, 400);
- break;
- case 3:
- status = "Antiban";
- camera.moveRandomly(random(750,1250));
- sleep(200, 400);
- break;
- case 4:
- status = "Antiban";
- checkEXP();
- sleep(200, 400);
- break;
- case 5:
- status = "Antiban";
- mouse.moveOffScreen();
- sleep(200, 400);
- break;
- }
- }
- public void checkEXP() {
- game.openTab(Game.Tab.STATS);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(random(2100, 3400));
- game.openTab(Game.Tab.INVENTORY);
- sleep(random(540,760));
- }
- class gui extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e){
- String mode = selectionBox.getSelectedItem().toString();
- if(mode.equals("Maximum")){
- antiban = false;
- minSpeed = 5;
- maxSpeed = 6;
- }
- else if(mode.equals("Paranoid")){
- antiban = true;
- minSpeed = 8;
- maxSpeed = 10;
- min = 3;
- max = 3;
- }
- save = memoryMode.isSelected();
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- selectionBox = new JComboBox();
- memoryMode = new JCheckBox();
- label2 = new JLabel();
- label3 = new JLabel();
- label4 = new JLabel();
- label5 = new JLabel();
- startButton = new JButton();
- //======== this ========
- setTitle("Painlaws's Vial Filler");
- setResizable(false);
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Mode");
- //---- selectionBox ----
- selectionBox.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Paranoid",
- "Maximum"
- }));
- //---- memoryMode ----
- memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
- //---- label2 ----
- label2.setText("Modes:");
- //---- label3 ----
- label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
- //---- label4 ----
- label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
- //---- label5 ----
- label5.setText("Maximum - No Antiban, Fast Mouse Speed");
- //---- startButton ----
- startButton.setText("Let's Fill Some Vials!");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e){
- startButtonActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
- .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGap(148, 148, 148)
- .addComponent(startButton)))
- .addContainerGap(2, Short.MAX_VALUE))
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label1)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(memoryMode)
- .addGap(18, 18, 18)
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label4)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox selectionBox;
- private JCheckBox memoryMode;
- private JLabel label2;
- private JLabel label3;
- private JLabel label4;
- private JLabel label5;
- private JButton startButton;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.KeyEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
- public class vialfiller extends Script implements PaintListener{
- //Variables
- // - Essentials
- private int bankerID = 6533;
- private int fountainID = 24214;
- private int emptyVialID = 229;
- private int fullVialID = 227;
- private int runEnergy = 50;
- RSNPC banker;
- RSObject fountain;
- RSItem myVial;
- RSTile theBank = new RSTile(3167, 3489);
- RSTile theFountain = new RSTile(3191, 3471);
- RSTile glitchSpot = new RSTile(3192, 3487);
- RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
- RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
- RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
- RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
- // - GUI Options
- private int min = 1;
- private int max = 6;
- private int minSpeed = 6;
- private int maxSpeed = 9;
- private boolean guiWait = true;
- private boolean save = false;
- // - State check
- private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
- // - Paint stuff
- private String status = "Initializing...";
- private String isRunning = "";
- private int numFilled = 0;
- private int vialFilledPrice;
- private int vialEmptyPrice;
- private int profitPrice;
- private int profit;
- private long startTime;
- private long millis;
- private long hours;
- private long minutes;
- private long seconds;
- private float profSec = 0;
- private float profHour;
- private float hourlyProfit;
- private int hourlyProfitInt;
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 13);
- private final Font font2 = new Font("Arial", 1, 13);
- private final Font font3 = new Font("Vijaya", 1, 17);
- private boolean antiban = true;
- gui g = new gui();
- @Override
- public boolean onStart(){
- log("Welcome to Painlaws's Vial Filler");
- log("Waiting on GUI...");
- g.setVisible(true);
- while(guiWait){
- sleep(500);
- }
- log("GUI Settings loaded!");
- if(walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else{
- isRunning = "No";
- }
- vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
- vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
- profitPrice = vialFilledPrice - vialEmptyPrice;
- if(!save){
- startTime = System.currentTimeMillis();
- }
- else{
- startTime = 0;
- }
- return true;
- }
- @Override
- public void onFinish(){
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- }
- public void useItem(RSItem item, RSObject object){
- if(item != null && object != null && object.isOnScreen()){
- item.doClick(true);
- sleep(200, 300);
- object.doClick();
- }
- }
- public void fillVials(){
- if(fountain != null){
- status = "Filling Vials";
- useItem(myVial, fountain);
- while(inventory.contains(emptyVialID)){
- sleep(random(1000,1500));
- if(antiban){
- if(random(1, 3) == 2){
- mouse.moveSlightly();
- }
- }
- }
- status = "Vials filled";
- }
- else{
- status = "Fountain is null...retrying";
- sleep(random(600, 800));
- }
- }
- private void doBank(){
- try{
- if(banker != null){
- camera.turnTo(banker);
- if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
- status = "Opening Bank";
- banker.interact("Bank Banker");
- status = "Bank opened";
- sleep(random(900, 1050));
- status = "Depositing All";
- bank.depositAll();
- status = "Deposited All";
- sleep(random(780, 950));
- numFilled = bank.getCount(fullVialID);
- if(bank.getCount(emptyVialID) != 0){
- status = "Taking Vials";
- bank.withdraw(emptyVialID, 0);
- status = "Vials Taken";
- sleep(random(700, 960));
- }
- else{
- log("Out of vials. Quitting :/");
- bank.close();
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- stopScript(true);
- }
- status = "Closing Bank";
- bank.close();
- status = "Bank Closed";
- sleep(random(750, 910));
- }
- }
- sleep(random(300,500));
- }catch(Exception e){log(e);}
- }
- public void onToBank(){
- try{
- status = "Going to Bank";
- walking.walkTileMM(theBank);
- }catch(Exception e){log(e);}
- sleep(random(500, 700));
- }
- public void onToGlitch(){
- try{
- status = "Going to Fountain"; //What you don't know can't hurt you :P
- walking.walkTileMM(glitchSpot);
- }catch(Exception e){log(e);}
- sleep(random(500, 710));
- }
- public void onToFountain(){
- try{
- status = "Going to Fountain";
- walking.walkTileMM(theFountain);
- }catch(Exception e){log(e);}
- sleep(random(500, 705));
- }
- public void runcheck() {
- try{
- runEnergy = (random(50, 70));
- if (walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
- walking.setRun(true);
- isRunning = "Yes";
- sleep(random(300, 500));
- }
- else{
- isRunning = "No";
- sleep(random(300,500));
- }
- }catch(Exception ex){}
- }
- @Override
- public int loop(){
- mouse.setSpeed(random(minSpeed, maxSpeed));
- runcheck();
- if(antiban){
- if(random(min, max) == 3){
- antiban();
- }
- }
- if(objects.getNearest(fountainID) != null){
- fountain = objects.getNearest(fountainID);
- }
- if(npcs.getNearest(bankerID) != null){
- banker = npcs.getNearest(bankerID);
- }
- if(inventory.getItem(emptyVialID) != null){
- myVial = inventory.getItem(emptyVialID);
- }
- switch(getState()){
- case TOFOUNTAIN:
- runcheck();
- onToFountain();
- if(fountainRange.contains(players.getMyPlayer().getLocation())){
- fillVials();
- }
- break;
- case TOGLITCH:
- runcheck();
- onToGlitch();
- break;
- case TOBANK:
- runcheck();
- onToBank();
- if(bankRange.contains(players.getMyPlayer().getLocation())){
- doBank();
- }
- break;
- }
- return(random(500, 1000));
- }
- private State getState() {
- if (!inventory.contains(emptyVialID)) {
- return State.TOBANK;
- }
- else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
- return State.TOGLITCH;
- }
- else{
- return State.TOFOUNTAIN;
- }
- }
- // GUI and Mouse
- public void onRepaint(Graphics g1) {
- profit = numFilled * profitPrice;
- if(!save){
- 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;
- if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
- profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- profHour = profSec * 3600;
- hourlyProfit = profHour * profitPrice;
- hourlyProfitInt = Math.round(hourlyProfit);
- }
- else{
- millis = 0;
- hours = 0;
- minutes = 0;
- seconds = 0;
- hourlyProfitInt = 9001;
- }
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(7, 345, 488, 70);
- g.setStroke(stroke1);
- g.drawRect(7, 345, 488, 70);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Status:", 14, 362);
- g.setFont(font2);
- g.drawString(status, 59, 362);
- g.setFont(font1);
- g.drawString("Filled Vials In Bank:", 209, 362);
- g.setFont(font2);
- g.drawString(Integer.toString(numFilled), 328, 362);
- g.setFont(font1);
- g.drawString("Profit:", 14, 383);
- g.setFont(font2);
- g.drawString(Integer.toString(profit), 59, 383);
- g.setFont(font1);
- g.drawString("Profit/hr:", 137, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
- }
- else{
- g.drawString("Mem Save", 190, 383);
- }
- g.setFont(font1);
- g.drawString("Runtime:", 270, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
- }
- else{
- g.drawString("Mem Save", 325, 384);
- }
- g.setFont(font1);
- g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
- g.drawString("Running:", 710, 139);
- g.setFont(font2);
- g.drawString(isRunning, 722, 156);
- g.setFont(font3);
- g.drawString("Painlaws", 440, 357);
- g1.setColor(Color.green);
- g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
- g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
- }
- /* Antiban stuff
- * Some credits to Aaimister :)
- * Partially copied, with permission
- */
- public void rotateCamera() {
- final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- final int randomLR = random(0, 2);
- final int randomUD = random(0, 2);
- final int randomAll = random(0, 4);
- if (random(0, 3) == 0) {
- keyboard.pressKey(LR[randomLR]);
- sleepCR(random(2, 9));
- keyboard.pressKey(UD[randomUD]);
- sleepCR(random(6, 10));
- keyboard.releaseKey(UD[randomUD]);
- sleepCR(random(2, 7));
- keyboard.releaseKey(LR[randomLR]);
- } else {
- keyboard.pressKey(LRUD[randomAll]);
- if (randomAll > 1) {
- sleepCR(random(6, 11));
- } else {
- sleepCR(random(9, 12));
- }
- keyboard.releaseKey(LRUD[randomAll]);
- }
- }
- private boolean sleepCR(final int amtOfHalfSecs) {
- for (int x = 0; x < amtOfHalfSecs + 1; x++) {
- sleep(random(48, 53));
- }
- return true;
- }
- private void antiban(){
- int action = random(0, 5);
- switch (action) {
- case 0:
- status = "Antiban";
- rotateCamera();
- sleep(200, 400);
- break;
- case 1:
- status = "Antiban";
- mouse.moveRandomly(100, 900);
- sleep(200, 400);
- break;
- case 2:
- status = "Antiban";
- mouse.moveSlightly();
- sleep(200, 400);
- break;
- case 3:
- status = "Antiban";
- camera.moveRandomly(random(750,1250));
- sleep(200, 400);
- break;
- case 4:
- status = "Antiban";
- checkEXP();
- sleep(200, 400);
- break;
- case 5:
- status = "Antiban";
- mouse.moveOffScreen();
- sleep(200, 400);
- break;
- }
- }
- public void checkEXP() {
- game.openTab(Game.Tab.STATS);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(random(2100, 3400));
- game.openTab(Game.Tab.INVENTORY);
- sleep(random(540,760));
- }
- class gui extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e){
- String mode = selectionBox.getSelectedItem().toString();
- if(mode.equals("Maximum")){
- antiban = false;
- minSpeed = 5;
- maxSpeed = 6;
- }
- else if(mode.equals("Paranoid")){
- antiban = true;
- minSpeed = 8;
- maxSpeed = 10;
- min = 3;
- max = 3;
- }
- save = memoryMode.isSelected();
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- selectionBox = new JComboBox();
- memoryMode = new JCheckBox();
- label2 = new JLabel();
- label3 = new JLabel();
- label4 = new JLabel();
- label5 = new JLabel();
- startButton = new JButton();
- //======== this ========
- setTitle("Painlaws's Vial Filler");
- setResizable(false);
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Mode");
- //---- selectionBox ----
- selectionBox.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Paranoid",
- "Maximum"
- }));
- //---- memoryMode ----
- memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
- //---- label2 ----
- label2.setText("Modes:");
- //---- label3 ----
- label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
- //---- label4 ----
- label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
- //---- label5 ----
- label5.setText("Maximum - No Antiban, Fast Mouse Speed");
- //---- startButton ----
- startButton.setText("Let's Fill Some Vials!");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e){
- startButtonActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
- .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGap(148, 148, 148)
- .addComponent(startButton)))
- .addContainerGap(2, Short.MAX_VALUE))
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label1)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(memoryMode)
- .addGap(18, 18, 18)
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label4)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox selectionBox;
- private JCheckBox memoryMode;
- private JLabel label2;
- private JLabel label3;
- private JLabel label4;
- private JLabel label5;
- private JButton startButton;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.KeyEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
- public class vialfiller extends Script implements PaintListener{
- //Variables
- // - Essentials
- private int bankerID = 6533;
- private int fountainID = 24214;
- private int emptyVialID = 229;
- private int fullVialID = 227;
- private int runEnergy = 50;
- RSNPC banker;
- RSObject fountain;
- RSItem myVial;
- RSTile theBank = new RSTile(3167, 3489);
- RSTile theFountain = new RSTile(3191, 3471);
- RSTile glitchSpot = new RSTile(3192, 3487);
- RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
- RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
- RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
- RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
- // - GUI Options
- private int min = 1;
- private int max = 6;
- private int minSpeed = 6;
- private int maxSpeed = 9;
- private boolean guiWait = true;
- private boolean save = false;
- // - State check
- private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
- // - Paint stuff
- private String status = "Initializing...";
- private String isRunning = "";
- private int numFilled = 0;
- private int vialFilledPrice;
- private int vialEmptyPrice;
- private int profitPrice;
- private int profit;
- private long startTime;
- private long millis;
- private long hours;
- private long minutes;
- private long seconds;
- private float profSec = 0;
- private float profHour;
- private float hourlyProfit;
- private int hourlyProfitInt;
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 13);
- private final Font font2 = new Font("Arial", 1, 13);
- private final Font font3 = new Font("Vijaya", 1, 17);
- private boolean antiban = true;
- gui g = new gui();
- @Override
- public boolean onStart(){
- log("Welcome to Painlaws's Vial Filler");
- log("Waiting on GUI...");
- g.setVisible(true);
- while(guiWait){
- sleep(500);
- }
- log("GUI Settings loaded!");
- if(walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else{
- isRunning = "No";
- }
- vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
- vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
- profitPrice = vialFilledPrice - vialEmptyPrice;
- if(!save){
- startTime = System.currentTimeMillis();
- }
- else{
- startTime = 0;
- }
- return true;
- }
- @Override
- public void onFinish(){
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- }
- public void useItem(RSItem item, RSObject object){
- if(item != null && object != null && object.isOnScreen()){
- item.doClick(true);
- sleep(200, 300);
- object.doClick();
- }
- }
- public void fillVials(){
- if(fountain != null){
- status = "Filling Vials";
- useItem(myVial, fountain);
- while(inventory.contains(emptyVialID)){
- sleep(random(1000,1500));
- if(antiban){
- if(random(1, 3) == 2){
- mouse.moveSlightly();
- }
- }
- }
- status = "Vials filled";
- }
- else{
- status = "Fountain is null...retrying";
- sleep(random(600, 800));
- }
- }
- private void doBank(){
- try{
- if(banker != null){
- camera.turnTo(banker);
- if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
- status = "Opening Bank";
- banker.interact("Bank Banker");
- status = "Bank opened";
- sleep(random(900, 1050));
- status = "Depositing All";
- bank.depositAll();
- status = "Deposited All";
- sleep(random(780, 950));
- numFilled = bank.getCount(fullVialID);
- if(bank.getCount(emptyVialID) != 0){
- status = "Taking Vials";
- bank.withdraw(emptyVialID, 0);
- status = "Vials Taken";
- sleep(random(700, 960));
- }
- else{
- log("Out of vials. Quitting :/");
- bank.close();
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- stopScript(true);
- }
- status = "Closing Bank";
- bank.close();
- status = "Bank Closed";
- sleep(random(750, 910));
- }
- }
- sleep(random(300,500));
- }catch(Exception e){log(e);}
- }
- public void onToBank(){
- try{
- status = "Going to Bank";
- walking.walkTileMM(theBank);
- }catch(Exception e){log(e);}
- sleep(random(500, 700));
- }
- public void onToGlitch(){
- try{
- status = "Going to Fountain"; //What you don't know can't hurt you :P
- walking.walkTileMM(glitchSpot);
- }catch(Exception e){log(e);}
- sleep(random(500, 710));
- }
- public void onToFountain(){
- try{
- status = "Going to Fountain";
- walking.walkTileMM(theFountain);
- }catch(Exception e){log(e);}
- sleep(random(500, 705));
- }
- public void runcheck() {
- try{
- runEnergy = (random(50, 70));
- if (walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
- walking.setRun(true);
- isRunning = "Yes";
- sleep(random(300, 500));
- }
- else{
- isRunning = "No";
- sleep(random(300,500));
- }
- }catch(Exception ex){}
- }
- @Override
- public int loop(){
- mouse.setSpeed(random(minSpeed, maxSpeed));
- runcheck();
- if(antiban){
- if(random(min, max) == 3){
- antiban();
- }
- }
- if(objects.getNearest(fountainID) != null){
- fountain = objects.getNearest(fountainID);
- }
- if(npcs.getNearest(bankerID) != null){
- banker = npcs.getNearest(bankerID);
- }
- if(inventory.getItem(emptyVialID) != null){
- myVial = inventory.getItem(emptyVialID);
- }
- switch(getState()){
- case TOFOUNTAIN:
- runcheck();
- onToFountain();
- if(fountainRange.contains(players.getMyPlayer().getLocation())){
- fillVials();
- }
- break;
- case TOGLITCH:
- runcheck();
- onToGlitch();
- break;
- case TOBANK:
- runcheck();
- onToBank();
- if(bankRange.contains(players.getMyPlayer().getLocation())){
- doBank();
- }
- break;
- }
- return(random(500, 1000));
- }
- private State getState() {
- if (!inventory.contains(emptyVialID)) {
- return State.TOBANK;
- }
- else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
- return State.TOGLITCH;
- }
- else{
- return State.TOFOUNTAIN;
- }
- }
- // GUI and Mouse
- public void onRepaint(Graphics g1) {
- profit = numFilled * profitPrice;
- if(!save){
- 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;
- if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
- profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- profHour = profSec * 3600;
- hourlyProfit = profHour * profitPrice;
- hourlyProfitInt = Math.round(hourlyProfit);
- }
- else{
- millis = 0;
- hours = 0;
- minutes = 0;
- seconds = 0;
- hourlyProfitInt = 9001;
- }
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(7, 345, 488, 70);
- g.setStroke(stroke1);
- g.drawRect(7, 345, 488, 70);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Status:", 14, 362);
- g.setFont(font2);
- g.drawString(status, 59, 362);
- g.setFont(font1);
- g.drawString("Filled Vials In Bank:", 209, 362);
- g.setFont(font2);
- g.drawString(Integer.toString(numFilled), 328, 362);
- g.setFont(font1);
- g.drawString("Profit:", 14, 383);
- g.setFont(font2);
- g.drawString(Integer.toString(profit), 59, 383);
- g.setFont(font1);
- g.drawString("Profit/hr:", 137, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
- }
- else{
- g.drawString("Mem Save", 190, 383);
- }
- g.setFont(font1);
- g.drawString("Runtime:", 270, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
- }
- else{
- g.drawString("Mem Save", 325, 384);
- }
- g.setFont(font1);
- g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
- g.drawString("Running:", 710, 139);
- g.setFont(font2);
- g.drawString(isRunning, 722, 156);
- g.setFont(font3);
- g.drawString("Painlaws", 440, 357);
- g1.setColor(Color.green);
- g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
- g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
- }
- /* Antiban stuff
- * Some credits to Aaimister :)
- * Partially copied, with permission
- */
- public void rotateCamera() {
- final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- final int randomLR = random(0, 2);
- final int randomUD = random(0, 2);
- final int randomAll = random(0, 4);
- if (random(0, 3) == 0) {
- keyboard.pressKey(LR[randomLR]);
- sleepCR(random(2, 9));
- keyboard.pressKey(UD[randomUD]);
- sleepCR(random(6, 10));
- keyboard.releaseKey(UD[randomUD]);
- sleepCR(random(2, 7));
- keyboard.releaseKey(LR[randomLR]);
- } else {
- keyboard.pressKey(LRUD[randomAll]);
- if (randomAll > 1) {
- sleepCR(random(6, 11));
- } else {
- sleepCR(random(9, 12));
- }
- keyboard.releaseKey(LRUD[randomAll]);
- }
- }
- private boolean sleepCR(final int amtOfHalfSecs) {
- for (int x = 0; x < amtOfHalfSecs + 1; x++) {
- sleep(random(48, 53));
- }
- return true;
- }
- private void antiban(){
- int action = random(0, 5);
- switch (action) {
- case 0:
- status = "Antiban";
- rotateCamera();
- sleep(200, 400);
- break;
- case 1:
- status = "Antiban";
- mouse.moveRandomly(100, 900);
- sleep(200, 400);
- break;
- case 2:
- status = "Antiban";
- mouse.moveSlightly();
- sleep(200, 400);
- break;
- case 3:
- status = "Antiban";
- camera.moveRandomly(random(750,1250));
- sleep(200, 400);
- break;
- case 4:
- status = "Antiban";
- checkEXP();
- sleep(200, 400);
- break;
- case 5:
- status = "Antiban";
- mouse.moveOffScreen();
- sleep(200, 400);
- break;
- }
- }
- public void checkEXP() {
- game.openTab(Game.Tab.STATS);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(random(2100, 3400));
- game.openTab(Game.Tab.INVENTORY);
- sleep(random(540,760));
- }
- class gui extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e){
- String mode = selectionBox.getSelectedItem().toString();
- if(mode.equals("Maximum")){
- antiban = false;
- minSpeed = 5;
- maxSpeed = 6;
- }
- else if(mode.equals("Paranoid")){
- antiban = true;
- minSpeed = 8;
- maxSpeed = 10;
- min = 3;
- max = 3;
- }
- save = memoryMode.isSelected();
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- selectionBox = new JComboBox();
- memoryMode = new JCheckBox();
- label2 = new JLabel();
- label3 = new JLabel();
- label4 = new JLabel();
- label5 = new JLabel();
- startButton = new JButton();
- //======== this ========
- setTitle("Painlaws's Vial Filler");
- setResizable(false);
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Mode");
- //---- selectionBox ----
- selectionBox.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Paranoid",
- "Maximum"
- }));
- //---- memoryMode ----
- memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
- //---- label2 ----
- label2.setText("Modes:");
- //---- label3 ----
- label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
- //---- label4 ----
- label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
- //---- label5 ----
- label5.setText("Maximum - No Antiban, Fast Mouse Speed");
- //---- startButton ----
- startButton.setText("Let's Fill Some Vials!");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e){
- startButtonActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
- .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGap(148, 148, 148)
- .addComponent(startButton)))
- .addContainerGap(2, Short.MAX_VALUE))
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label1)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(memoryMode)
- .addGap(18, 18, 18)
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label4)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox selectionBox;
- private JCheckBox memoryMode;
- private JLabel label2;
- private JLabel label3;
- private JLabel label4;
- private JLabel label5;
- private JButton startButton;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.KeyEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
- public class vialfiller extends Script implements PaintListener{
- //Variables
- // - Essentials
- private int bankerID = 6533;
- private int fountainID = 24214;
- private int emptyVialID = 229;
- private int fullVialID = 227;
- private int runEnergy = 50;
- RSNPC banker;
- RSObject fountain;
- RSItem myVial;
- RSTile theBank = new RSTile(3167, 3489);
- RSTile theFountain = new RSTile(3191, 3471);
- RSTile glitchSpot = new RSTile(3192, 3487);
- RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
- RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
- RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
- RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
- // - GUI Options
- private int min = 1;
- private int max = 6;
- private int minSpeed = 6;
- private int maxSpeed = 9;
- private boolean guiWait = true;
- private boolean save = false;
- // - State check
- private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
- // - Paint stuff
- private String status = "Initializing...";
- private String isRunning = "";
- private int numFilled = 0;
- private int vialFilledPrice;
- private int vialEmptyPrice;
- private int profitPrice;
- private int profit;
- private long startTime;
- private long millis;
- private long hours;
- private long minutes;
- private long seconds;
- private float profSec = 0;
- private float profHour;
- private float hourlyProfit;
- private int hourlyProfitInt;
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 13);
- private final Font font2 = new Font("Arial", 1, 13);
- private final Font font3 = new Font("Vijaya", 1, 17);
- private boolean antiban = true;
- gui g = new gui();
- @Override
- public boolean onStart(){
- log("Welcome to Painlaws's Vial Filler");
- log("Waiting on GUI...");
- g.setVisible(true);
- while(guiWait){
- sleep(500);
- }
- log("GUI Settings loaded!");
- if(walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else{
- isRunning = "No";
- }
- vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
- vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
- profitPrice = vialFilledPrice - vialEmptyPrice;
- if(!save){
- startTime = System.currentTimeMillis();
- }
- else{
- startTime = 0;
- }
- return true;
- }
- @Override
- public void onFinish(){
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- }
- public void useItem(RSItem item, RSObject object){
- if(item != null && object != null && object.isOnScreen()){
- item.doClick(true);
- sleep(200, 300);
- object.doClick();
- }
- }
- public void fillVials(){
- if(fountain != null){
- status = "Filling Vials";
- useItem(myVial, fountain);
- while(inventory.contains(emptyVialID)){
- sleep(random(1000,1500));
- if(antiban){
- if(random(1, 3) == 2){
- mouse.moveSlightly();
- }
- }
- }
- status = "Vials filled";
- }
- else{
- status = "Fountain is null...retrying";
- sleep(random(600, 800));
- }
- }
- private void doBank(){
- try{
- if(banker != null){
- camera.turnTo(banker);
- if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
- status = "Opening Bank";
- banker.interact("Bank Banker");
- status = "Bank opened";
- sleep(random(900, 1050));
- status = "Depositing All";
- bank.depositAll();
- status = "Deposited All";
- sleep(random(780, 950));
- numFilled = bank.getCount(fullVialID);
- if(bank.getCount(emptyVialID) != 0){
- status = "Taking Vials";
- bank.withdraw(emptyVialID, 0);
- status = "Vials Taken";
- sleep(random(700, 960));
- }
- else{
- log("Out of vials. Quitting :/");
- bank.close();
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- stopScript(true);
- }
- status = "Closing Bank";
- bank.close();
- status = "Bank Closed";
- sleep(random(750, 910));
- }
- }
- sleep(random(300,500));
- }catch(Exception e){log(e);}
- }
- public void onToBank(){
- try{
- status = "Going to Bank";
- walking.walkTileMM(theBank);
- }catch(Exception e){log(e);}
- sleep(random(500, 700));
- }
- public void onToGlitch(){
- try{
- status = "Going to Fountain"; //What you don't know can't hurt you :P
- walking.walkTileMM(glitchSpot);
- }catch(Exception e){log(e);}
- sleep(random(500, 710));
- }
- public void onToFountain(){
- try{
- status = "Going to Fountain";
- walking.walkTileMM(theFountain);
- }catch(Exception e){log(e);}
- sleep(random(500, 705));
- }
- public void runcheck() {
- try{
- runEnergy = (random(50, 70));
- if (walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
- walking.setRun(true);
- isRunning = "Yes";
- sleep(random(300, 500));
- }
- else{
- isRunning = "No";
- sleep(random(300,500));
- }
- }catch(Exception ex){}
- }
- @Override
- public int loop(){
- mouse.setSpeed(random(minSpeed, maxSpeed));
- runcheck();
- if(antiban){
- if(random(min, max) == 3){
- antiban();
- }
- }
- if(objects.getNearest(fountainID) != null){
- fountain = objects.getNearest(fountainID);
- }
- if(npcs.getNearest(bankerID) != null){
- banker = npcs.getNearest(bankerID);
- }
- if(inventory.getItem(emptyVialID) != null){
- myVial = inventory.getItem(emptyVialID);
- }
- switch(getState()){
- case TOFOUNTAIN:
- runcheck();
- onToFountain();
- if(fountainRange.contains(players.getMyPlayer().getLocation())){
- fillVials();
- }
- break;
- case TOGLITCH:
- runcheck();
- onToGlitch();
- break;
- case TOBANK:
- runcheck();
- onToBank();
- if(bankRange.contains(players.getMyPlayer().getLocation())){
- doBank();
- }
- break;
- }
- return(random(500, 1000));
- }
- private State getState() {
- if (!inventory.contains(emptyVialID)) {
- return State.TOBANK;
- }
- else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
- return State.TOGLITCH;
- }
- else{
- return State.TOFOUNTAIN;
- }
- }
- // GUI and Mouse
- public void onRepaint(Graphics g1) {
- profit = numFilled * profitPrice;
- if(!save){
- 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;
- if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
- profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- profHour = profSec * 3600;
- hourlyProfit = profHour * profitPrice;
- hourlyProfitInt = Math.round(hourlyProfit);
- }
- else{
- millis = 0;
- hours = 0;
- minutes = 0;
- seconds = 0;
- hourlyProfitInt = 9001;
- }
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(7, 345, 488, 70);
- g.setStroke(stroke1);
- g.drawRect(7, 345, 488, 70);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Status:", 14, 362);
- g.setFont(font2);
- g.drawString(status, 59, 362);
- g.setFont(font1);
- g.drawString("Filled Vials In Bank:", 209, 362);
- g.setFont(font2);
- g.drawString(Integer.toString(numFilled), 328, 362);
- g.setFont(font1);
- g.drawString("Profit:", 14, 383);
- g.setFont(font2);
- g.drawString(Integer.toString(profit), 59, 383);
- g.setFont(font1);
- g.drawString("Profit/hr:", 137, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
- }
- else{
- g.drawString("Mem Save", 190, 383);
- }
- g.setFont(font1);
- g.drawString("Runtime:", 270, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
- }
- else{
- g.drawString("Mem Save", 325, 384);
- }
- g.setFont(font1);
- g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
- g.drawString("Running:", 710, 139);
- g.setFont(font2);
- g.drawString(isRunning, 722, 156);
- g.setFont(font3);
- g.drawString("Painlaws", 440, 357);
- g1.setColor(Color.green);
- g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
- g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
- }
- /* Antiban stuff
- * Some credits to Aaimister :)
- * Partially copied, with permission
- */
- public void rotateCamera() {
- final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- final int randomLR = random(0, 2);
- final int randomUD = random(0, 2);
- final int randomAll = random(0, 4);
- if (random(0, 3) == 0) {
- keyboard.pressKey(LR[randomLR]);
- sleepCR(random(2, 9));
- keyboard.pressKey(UD[randomUD]);
- sleepCR(random(6, 10));
- keyboard.releaseKey(UD[randomUD]);
- sleepCR(random(2, 7));
- keyboard.releaseKey(LR[randomLR]);
- } else {
- keyboard.pressKey(LRUD[randomAll]);
- if (randomAll > 1) {
- sleepCR(random(6, 11));
- } else {
- sleepCR(random(9, 12));
- }
- keyboard.releaseKey(LRUD[randomAll]);
- }
- }
- private boolean sleepCR(final int amtOfHalfSecs) {
- for (int x = 0; x < amtOfHalfSecs + 1; x++) {
- sleep(random(48, 53));
- }
- return true;
- }
- private void antiban(){
- int action = random(0, 5);
- switch (action) {
- case 0:
- status = "Antiban";
- rotateCamera();
- sleep(200, 400);
- break;
- case 1:
- status = "Antiban";
- mouse.moveRandomly(100, 900);
- sleep(200, 400);
- break;
- case 2:
- status = "Antiban";
- mouse.moveSlightly();
- sleep(200, 400);
- break;
- case 3:
- status = "Antiban";
- camera.moveRandomly(random(750,1250));
- sleep(200, 400);
- break;
- case 4:
- status = "Antiban";
- checkEXP();
- sleep(200, 400);
- break;
- case 5:
- status = "Antiban";
- mouse.moveOffScreen();
- sleep(200, 400);
- break;
- }
- }
- public void checkEXP() {
- game.openTab(Game.Tab.STATS);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(random(2100, 3400));
- game.openTab(Game.Tab.INVENTORY);
- sleep(random(540,760));
- }
- class gui extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e){
- String mode = selectionBox.getSelectedItem().toString();
- if(mode.equals("Maximum")){
- antiban = false;
- minSpeed = 5;
- maxSpeed = 6;
- }
- else if(mode.equals("Paranoid")){
- antiban = true;
- minSpeed = 8;
- maxSpeed = 10;
- min = 3;
- max = 3;
- }
- save = memoryMode.isSelected();
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- selectionBox = new JComboBox();
- memoryMode = new JCheckBox();
- label2 = new JLabel();
- label3 = new JLabel();
- label4 = new JLabel();
- label5 = new JLabel();
- startButton = new JButton();
- //======== this ========
- setTitle("Painlaws's Vial Filler");
- setResizable(false);
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Mode");
- //---- selectionBox ----
- selectionBox.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Paranoid",
- "Maximum"
- }));
- //---- memoryMode ----
- memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
- //---- label2 ----
- label2.setText("Modes:");
- //---- label3 ----
- label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
- //---- label4 ----
- label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
- //---- label5 ----
- label5.setText("Maximum - No Antiban, Fast Mouse Speed");
- //---- startButton ----
- startButton.setText("Let's Fill Some Vials!");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e){
- startButtonActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
- .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGap(148, 148, 148)
- .addComponent(startButton)))
- .addContainerGap(2, Short.MAX_VALUE))
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label1)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(memoryMode)
- .addGap(18, 18, 18)
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label4)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox selectionBox;
- private JCheckBox memoryMode;
- private JLabel label2;
- private JLabel label3;
- private JLabel label4;
- private JLabel label5;
- private JButton startButton;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.KeyEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
- public class vialfiller extends Script implements PaintListener{
- //Variables
- // - Essentials
- private int bankerID = 6533;
- private int fountainID = 24214;
- private int emptyVialID = 229;
- private int fullVialID = 227;
- private int runEnergy = 50;
- RSNPC banker;
- RSObject fountain;
- RSItem myVial;
- RSTile theBank = new RSTile(3167, 3489);
- RSTile theFountain = new RSTile(3191, 3471);
- RSTile glitchSpot = new RSTile(3192, 3487);
- RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
- RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
- RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
- RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
- // - GUI Options
- private int min = 1;
- private int max = 6;
- private int minSpeed = 6;
- private int maxSpeed = 9;
- private boolean guiWait = true;
- private boolean save = false;
- // - State check
- private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
- // - Paint stuff
- private String status = "Initializing...";
- private String isRunning = "";
- private int numFilled = 0;
- private int vialFilledPrice;
- private int vialEmptyPrice;
- private int profitPrice;
- private int profit;
- private long startTime;
- private long millis;
- private long hours;
- private long minutes;
- private long seconds;
- private float profSec = 0;
- private float profHour;
- private float hourlyProfit;
- private int hourlyProfitInt;
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 13);
- private final Font font2 = new Font("Arial", 1, 13);
- private final Font font3 = new Font("Vijaya", 1, 17);
- private boolean antiban = true;
- gui g = new gui();
- @Override
- public boolean onStart(){
- log("Welcome to Painlaws's Vial Filler");
- log("Waiting on GUI...");
- g.setVisible(true);
- while(guiWait){
- sleep(500);
- }
- log("GUI Settings loaded!");
- if(walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else{
- isRunning = "No";
- }
- vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
- vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
- profitPrice = vialFilledPrice - vialEmptyPrice;
- if(!save){
- startTime = System.currentTimeMillis();
- }
- else{
- startTime = 0;
- }
- return true;
- }
- @Override
- public void onFinish(){
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- }
- public void useItem(RSItem item, RSObject object){
- if(item != null && object != null && object.isOnScreen()){
- item.doClick(true);
- sleep(200, 300);
- object.doClick();
- }
- }
- public void fillVials(){
- if(fountain != null){
- status = "Filling Vials";
- useItem(myVial, fountain);
- while(inventory.contains(emptyVialID)){
- sleep(random(1000,1500));
- if(antiban){
- if(random(1, 3) == 2){
- mouse.moveSlightly();
- }
- }
- }
- status = "Vials filled";
- }
- else{
- status = "Fountain is null...retrying";
- sleep(random(600, 800));
- }
- }
- private void doBank(){
- try{
- if(banker != null){
- camera.turnTo(banker);
- if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
- status = "Opening Bank";
- banker.interact("Bank Banker");
- status = "Bank opened";
- sleep(random(900, 1050));
- status = "Depositing All";
- bank.depositAll();
- status = "Deposited All";
- sleep(random(780, 950));
- numFilled = bank.getCount(fullVialID);
- if(bank.getCount(emptyVialID) != 0){
- status = "Taking Vials";
- bank.withdraw(emptyVialID, 0);
- status = "Vials Taken";
- sleep(random(700, 960));
- }
- else{
- log("Out of vials. Quitting :/");
- bank.close();
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- stopScript(true);
- }
- status = "Closing Bank";
- bank.close();
- status = "Bank Closed";
- sleep(random(750, 910));
- }
- }
- sleep(random(300,500));
- }catch(Exception e){log(e);}
- }
- public void onToBank(){
- try{
- status = "Going to Bank";
- walking.walkTileMM(theBank);
- }catch(Exception e){log(e);}
- sleep(random(500, 700));
- }
- public void onToGlitch(){
- try{
- status = "Going to Fountain"; //What you don't know can't hurt you :P
- walking.walkTileMM(glitchSpot);
- }catch(Exception e){log(e);}
- sleep(random(500, 710));
- }
- public void onToFountain(){
- try{
- status = "Going to Fountain";
- walking.walkTileMM(theFountain);
- }catch(Exception e){log(e);}
- sleep(random(500, 705));
- }
- public void runcheck() {
- try{
- runEnergy = (random(50, 70));
- if (walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
- walking.setRun(true);
- isRunning = "Yes";
- sleep(random(300, 500));
- }
- else{
- isRunning = "No";
- sleep(random(300,500));
- }
- }catch(Exception ex){}
- }
- @Override
- public int loop(){
- mouse.setSpeed(random(minSpeed, maxSpeed));
- runcheck();
- if(antiban){
- if(random(min, max) == 3){
- antiban();
- }
- }
- if(objects.getNearest(fountainID) != null){
- fountain = objects.getNearest(fountainID);
- }
- if(npcs.getNearest(bankerID) != null){
- banker = npcs.getNearest(bankerID);
- }
- if(inventory.getItem(emptyVialID) != null){
- myVial = inventory.getItem(emptyVialID);
- }
- switch(getState()){
- case TOFOUNTAIN:
- runcheck();
- onToFountain();
- if(fountainRange.contains(players.getMyPlayer().getLocation())){
- fillVials();
- }
- break;
- case TOGLITCH:
- runcheck();
- onToGlitch();
- break;
- case TOBANK:
- runcheck();
- onToBank();
- if(bankRange.contains(players.getMyPlayer().getLocation())){
- doBank();
- }
- break;
- }
- return(random(500, 1000));
- }
- private State getState() {
- if (!inventory.contains(emptyVialID)) {
- return State.TOBANK;
- }
- else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
- return State.TOGLITCH;
- }
- else{
- return State.TOFOUNTAIN;
- }
- }
- // GUI and Mouse
- public void onRepaint(Graphics g1) {
- profit = numFilled * profitPrice;
- if(!save){
- 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;
- if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
- profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- profHour = profSec * 3600;
- hourlyProfit = profHour * profitPrice;
- hourlyProfitInt = Math.round(hourlyProfit);
- }
- else{
- millis = 0;
- hours = 0;
- minutes = 0;
- seconds = 0;
- hourlyProfitInt = 9001;
- }
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(7, 345, 488, 70);
- g.setStroke(stroke1);
- g.drawRect(7, 345, 488, 70);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Status:", 14, 362);
- g.setFont(font2);
- g.drawString(status, 59, 362);
- g.setFont(font1);
- g.drawString("Filled Vials In Bank:", 209, 362);
- g.setFont(font2);
- g.drawString(Integer.toString(numFilled), 328, 362);
- g.setFont(font1);
- g.drawString("Profit:", 14, 383);
- g.setFont(font2);
- g.drawString(Integer.toString(profit), 59, 383);
- g.setFont(font1);
- g.drawString("Profit/hr:", 137, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
- }
- else{
- g.drawString("Mem Save", 190, 383);
- }
- g.setFont(font1);
- g.drawString("Runtime:", 270, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
- }
- else{
- g.drawString("Mem Save", 325, 384);
- }
- g.setFont(font1);
- g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
- g.drawString("Running:", 710, 139);
- g.setFont(font2);
- g.drawString(isRunning, 722, 156);
- g.setFont(font3);
- g.drawString("Painlaws", 440, 357);
- g1.setColor(Color.green);
- g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
- g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
- }
- /* Antiban stuff
- * Some credits to Aaimister :)
- * Partially copied, with permission
- */
- public void rotateCamera() {
- final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- final int randomLR = random(0, 2);
- final int randomUD = random(0, 2);
- final int randomAll = random(0, 4);
- if (random(0, 3) == 0) {
- keyboard.pressKey(LR[randomLR]);
- sleepCR(random(2, 9));
- keyboard.pressKey(UD[randomUD]);
- sleepCR(random(6, 10));
- keyboard.releaseKey(UD[randomUD]);
- sleepCR(random(2, 7));
- keyboard.releaseKey(LR[randomLR]);
- } else {
- keyboard.pressKey(LRUD[randomAll]);
- if (randomAll > 1) {
- sleepCR(random(6, 11));
- } else {
- sleepCR(random(9, 12));
- }
- keyboard.releaseKey(LRUD[randomAll]);
- }
- }
- private boolean sleepCR(final int amtOfHalfSecs) {
- for (int x = 0; x < amtOfHalfSecs + 1; x++) {
- sleep(random(48, 53));
- }
- return true;
- }
- private void antiban(){
- int action = random(0, 5);
- switch (action) {
- case 0:
- status = "Antiban";
- rotateCamera();
- sleep(200, 400);
- break;
- case 1:
- status = "Antiban";
- mouse.moveRandomly(100, 900);
- sleep(200, 400);
- break;
- case 2:
- status = "Antiban";
- mouse.moveSlightly();
- sleep(200, 400);
- break;
- case 3:
- status = "Antiban";
- camera.moveRandomly(random(750,1250));
- sleep(200, 400);
- break;
- case 4:
- status = "Antiban";
- checkEXP();
- sleep(200, 400);
- break;
- case 5:
- status = "Antiban";
- mouse.moveOffScreen();
- sleep(200, 400);
- break;
- }
- }
- public void checkEXP() {
- game.openTab(Game.Tab.STATS);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(random(2100, 3400));
- game.openTab(Game.Tab.INVENTORY);
- sleep(random(540,760));
- }
- class gui extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e){
- String mode = selectionBox.getSelectedItem().toString();
- if(mode.equals("Maximum")){
- antiban = false;
- minSpeed = 5;
- maxSpeed = 6;
- }
- else if(mode.equals("Paranoid")){
- antiban = true;
- minSpeed = 8;
- maxSpeed = 10;
- min = 3;
- max = 3;
- }
- save = memoryMode.isSelected();
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- selectionBox = new JComboBox();
- memoryMode = new JCheckBox();
- label2 = new JLabel();
- label3 = new JLabel();
- label4 = new JLabel();
- label5 = new JLabel();
- startButton = new JButton();
- //======== this ========
- setTitle("Painlaws's Vial Filler");
- setResizable(false);
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Mode");
- //---- selectionBox ----
- selectionBox.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Paranoid",
- "Maximum"
- }));
- //---- memoryMode ----
- memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
- //---- label2 ----
- label2.setText("Modes:");
- //---- label3 ----
- label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
- //---- label4 ----
- label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
- //---- label5 ----
- label5.setText("Maximum - No Antiban, Fast Mouse Speed");
- //---- startButton ----
- startButton.setText("Let's Fill Some Vials!");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e){
- startButtonActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
- .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGap(148, 148, 148)
- .addComponent(startButton)))
- .addContainerGap(2, Short.MAX_VALUE))
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label1)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(memoryMode)
- .addGap(18, 18, 18)
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label4)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox selectionBox;
- private JCheckBox memoryMode;
- private JLabel label2;
- private JLabel label3;
- private JLabel label4;
- private JLabel label5;
- private JButton startButton;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.KeyEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
- public class vialfiller extends Script implements PaintListener{
- //Variables
- // - Essentials
- private int bankerID = 6533;
- private int fountainID = 24214;
- private int emptyVialID = 229;
- private int fullVialID = 227;
- private int runEnergy = 50;
- RSNPC banker;
- RSObject fountain;
- RSItem myVial;
- RSTile theBank = new RSTile(3167, 3489);
- RSTile theFountain = new RSTile(3191, 3471);
- RSTile glitchSpot = new RSTile(3192, 3487);
- RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
- RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
- RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
- RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
- // - GUI Options
- private int min = 1;
- private int max = 6;
- private int minSpeed = 6;
- private int maxSpeed = 9;
- private boolean guiWait = true;
- private boolean save = false;
- // - State check
- private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
- // - Paint stuff
- private String status = "Initializing...";
- private String isRunning = "";
- private int numFilled = 0;
- private int vialFilledPrice;
- private int vialEmptyPrice;
- private int profitPrice;
- private int profit;
- private long startTime;
- private long millis;
- private long hours;
- private long minutes;
- private long seconds;
- private float profSec = 0;
- private float profHour;
- private float hourlyProfit;
- private int hourlyProfitInt;
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 13);
- private final Font font2 = new Font("Arial", 1, 13);
- private final Font font3 = new Font("Vijaya", 1, 17);
- private boolean antiban = true;
- gui g = new gui();
- @Override
- public boolean onStart(){
- log("Welcome to Painlaws's Vial Filler");
- log("Waiting on GUI...");
- g.setVisible(true);
- while(guiWait){
- sleep(500);
- }
- log("GUI Settings loaded!");
- if(walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else{
- isRunning = "No";
- }
- vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
- vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
- profitPrice = vialFilledPrice - vialEmptyPrice;
- if(!save){
- startTime = System.currentTimeMillis();
- }
- else{
- startTime = 0;
- }
- return true;
- }
- @Override
- public void onFinish(){
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- }
- public void useItem(RSItem item, RSObject object){
- if(item != null && object != null && object.isOnScreen()){
- item.doClick(true);
- sleep(200, 300);
- object.doClick();
- }
- }
- public void fillVials(){
- if(fountain != null){
- status = "Filling Vials";
- useItem(myVial, fountain);
- while(inventory.contains(emptyVialID)){
- sleep(random(1000,1500));
- if(antiban){
- if(random(1, 3) == 2){
- mouse.moveSlightly();
- }
- }
- }
- status = "Vials filled";
- }
- else{
- status = "Fountain is null...retrying";
- sleep(random(600, 800));
- }
- }
- private void doBank(){
- try{
- if(banker != null){
- camera.turnTo(banker);
- if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
- status = "Opening Bank";
- banker.interact("Bank Banker");
- status = "Bank opened";
- sleep(random(900, 1050));
- status = "Depositing All";
- bank.depositAll();
- status = "Deposited All";
- sleep(random(780, 950));
- numFilled = bank.getCount(fullVialID);
- if(bank.getCount(emptyVialID) != 0){
- status = "Taking Vials";
- bank.withdraw(emptyVialID, 0);
- status = "Vials Taken";
- sleep(random(700, 960));
- }
- else{
- log("Out of vials. Quitting :/");
- bank.close();
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- stopScript(true);
- }
- status = "Closing Bank";
- bank.close();
- status = "Bank Closed";
- sleep(random(750, 910));
- }
- }
- sleep(random(300,500));
- }catch(Exception e){log(e);}
- }
- public void onToBank(){
- try{
- status = "Going to Bank";
- walking.walkTileMM(theBank);
- }catch(Exception e){log(e);}
- sleep(random(500, 700));
- }
- public void onToGlitch(){
- try{
- status = "Going to Fountain"; //What you don't know can't hurt you :P
- walking.walkTileMM(glitchSpot);
- }catch(Exception e){log(e);}
- sleep(random(500, 710));
- }
- public void onToFountain(){
- try{
- status = "Going to Fountain";
- walking.walkTileMM(theFountain);
- }catch(Exception e){log(e);}
- sleep(random(500, 705));
- }
- public void runcheck() {
- try{
- runEnergy = (random(50, 70));
- if (walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
- walking.setRun(true);
- isRunning = "Yes";
- sleep(random(300, 500));
- }
- else{
- isRunning = "No";
- sleep(random(300,500));
- }
- }catch(Exception ex){}
- }
- @Override
- public int loop(){
- mouse.setSpeed(random(minSpeed, maxSpeed));
- runcheck();
- if(antiban){
- if(random(min, max) == 3){
- antiban();
- }
- }
- if(objects.getNearest(fountainID) != null){
- fountain = objects.getNearest(fountainID);
- }
- if(npcs.getNearest(bankerID) != null){
- banker = npcs.getNearest(bankerID);
- }
- if(inventory.getItem(emptyVialID) != null){
- myVial = inventory.getItem(emptyVialID);
- }
- switch(getState()){
- case TOFOUNTAIN:
- runcheck();
- onToFountain();
- if(fountainRange.contains(players.getMyPlayer().getLocation())){
- fillVials();
- }
- break;
- case TOGLITCH:
- runcheck();
- onToGlitch();
- break;
- case TOBANK:
- runcheck();
- onToBank();
- if(bankRange.contains(players.getMyPlayer().getLocation())){
- doBank();
- }
- break;
- }
- return(random(500, 1000));
- }
- private State getState() {
- if (!inventory.contains(emptyVialID)) {
- return State.TOBANK;
- }
- else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
- return State.TOGLITCH;
- }
- else{
- return State.TOFOUNTAIN;
- }
- }
- // GUI and Mouse
- public void onRepaint(Graphics g1) {
- profit = numFilled * profitPrice;
- if(!save){
- 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;
- if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
- profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- profHour = profSec * 3600;
- hourlyProfit = profHour * profitPrice;
- hourlyProfitInt = Math.round(hourlyProfit);
- }
- else{
- millis = 0;
- hours = 0;
- minutes = 0;
- seconds = 0;
- hourlyProfitInt = 9001;
- }
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(7, 345, 488, 70);
- g.setStroke(stroke1);
- g.drawRect(7, 345, 488, 70);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Status:", 14, 362);
- g.setFont(font2);
- g.drawString(status, 59, 362);
- g.setFont(font1);
- g.drawString("Filled Vials In Bank:", 209, 362);
- g.setFont(font2);
- g.drawString(Integer.toString(numFilled), 328, 362);
- g.setFont(font1);
- g.drawString("Profit:", 14, 383);
- g.setFont(font2);
- g.drawString(Integer.toString(profit), 59, 383);
- g.setFont(font1);
- g.drawString("Profit/hr:", 137, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
- }
- else{
- g.drawString("Mem Save", 190, 383);
- }
- g.setFont(font1);
- g.drawString("Runtime:", 270, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
- }
- else{
- g.drawString("Mem Save", 325, 384);
- }
- g.setFont(font1);
- g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
- g.drawString("Running:", 710, 139);
- g.setFont(font2);
- g.drawString(isRunning, 722, 156);
- g.setFont(font3);
- g.drawString("Painlaws", 440, 357);
- g1.setColor(Color.green);
- g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
- g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
- }
- /* Antiban stuff
- * Some credits to Aaimister :)
- * Partially copied, with permission
- */
- public void rotateCamera() {
- final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- final int randomLR = random(0, 2);
- final int randomUD = random(0, 2);
- final int randomAll = random(0, 4);
- if (random(0, 3) == 0) {
- keyboard.pressKey(LR[randomLR]);
- sleepCR(random(2, 9));
- keyboard.pressKey(UD[randomUD]);
- sleepCR(random(6, 10));
- keyboard.releaseKey(UD[randomUD]);
- sleepCR(random(2, 7));
- keyboard.releaseKey(LR[randomLR]);
- } else {
- keyboard.pressKey(LRUD[randomAll]);
- if (randomAll > 1) {
- sleepCR(random(6, 11));
- } else {
- sleepCR(random(9, 12));
- }
- keyboard.releaseKey(LRUD[randomAll]);
- }
- }
- private boolean sleepCR(final int amtOfHalfSecs) {
- for (int x = 0; x < amtOfHalfSecs + 1; x++) {
- sleep(random(48, 53));
- }
- return true;
- }
- private void antiban(){
- int action = random(0, 5);
- switch (action) {
- case 0:
- status = "Antiban";
- rotateCamera();
- sleep(200, 400);
- break;
- case 1:
- status = "Antiban";
- mouse.moveRandomly(100, 900);
- sleep(200, 400);
- break;
- case 2:
- status = "Antiban";
- mouse.moveSlightly();
- sleep(200, 400);
- break;
- case 3:
- status = "Antiban";
- camera.moveRandomly(random(750,1250));
- sleep(200, 400);
- break;
- case 4:
- status = "Antiban";
- checkEXP();
- sleep(200, 400);
- break;
- case 5:
- status = "Antiban";
- mouse.moveOffScreen();
- sleep(200, 400);
- break;
- }
- }
- public void checkEXP() {
- game.openTab(Game.Tab.STATS);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(random(2100, 3400));
- game.openTab(Game.Tab.INVENTORY);
- sleep(random(540,760));
- }
- class gui extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e){
- String mode = selectionBox.getSelectedItem().toString();
- if(mode.equals("Maximum")){
- antiban = false;
- minSpeed = 5;
- maxSpeed = 6;
- }
- else if(mode.equals("Paranoid")){
- antiban = true;
- minSpeed = 8;
- maxSpeed = 10;
- min = 3;
- max = 3;
- }
- save = memoryMode.isSelected();
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- selectionBox = new JComboBox();
- memoryMode = new JCheckBox();
- label2 = new JLabel();
- label3 = new JLabel();
- label4 = new JLabel();
- label5 = new JLabel();
- startButton = new JButton();
- //======== this ========
- setTitle("Painlaws's Vial Filler");
- setResizable(false);
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Mode");
- //---- selectionBox ----
- selectionBox.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Paranoid",
- "Maximum"
- }));
- //---- memoryMode ----
- memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
- //---- label2 ----
- label2.setText("Modes:");
- //---- label3 ----
- label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
- //---- label4 ----
- label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
- //---- label5 ----
- label5.setText("Maximum - No Antiban, Fast Mouse Speed");
- //---- startButton ----
- startButton.setText("Let's Fill Some Vials!");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e){
- startButtonActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
- .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGap(148, 148, 148)
- .addComponent(startButton)))
- .addContainerGap(2, Short.MAX_VALUE))
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label1)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(memoryMode)
- .addGap(18, 18, 18)
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label4)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox selectionBox;
- private JCheckBox memoryMode;
- private JLabel label2;
- private JLabel label3;
- private JLabel label4;
- private JLabel label5;
- private JButton startButton;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.KeyEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
- public class vialfiller extends Script implements PaintListener{
- //Variables
- // - Essentials
- private int bankerID = 6533;
- private int fountainID = 24214;
- private int emptyVialID = 229;
- private int fullVialID = 227;
- private int runEnergy = 50;
- RSNPC banker;
- RSObject fountain;
- RSItem myVial;
- RSTile theBank = new RSTile(3167, 3489);
- RSTile theFountain = new RSTile(3191, 3471);
- RSTile glitchSpot = new RSTile(3192, 3487);
- RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
- RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
- RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
- RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
- // - GUI Options
- private int min = 1;
- private int max = 6;
- private int minSpeed = 6;
- private int maxSpeed = 9;
- private boolean guiWait = true;
- private boolean save = false;
- // - State check
- private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
- // - Paint stuff
- private String status = "Initializing...";
- private String isRunning = "";
- private int numFilled = 0;
- private int vialFilledPrice;
- private int vialEmptyPrice;
- private int profitPrice;
- private int profit;
- private long startTime;
- private long millis;
- private long hours;
- private long minutes;
- private long seconds;
- private float profSec = 0;
- private float profHour;
- private float hourlyProfit;
- private int hourlyProfitInt;
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 13);
- private final Font font2 = new Font("Arial", 1, 13);
- private final Font font3 = new Font("Vijaya", 1, 17);
- private boolean antiban = true;
- gui g = new gui();
- @Override
- public boolean onStart(){
- log("Welcome to Painlaws's Vial Filler");
- log("Waiting on GUI...");
- g.setVisible(true);
- while(guiWait){
- sleep(500);
- }
- log("GUI Settings loaded!");
- if(walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else{
- isRunning = "No";
- }
- vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
- vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
- profitPrice = vialFilledPrice - vialEmptyPrice;
- if(!save){
- startTime = System.currentTimeMillis();
- }
- else{
- startTime = 0;
- }
- return true;
- }
- @Override
- public void onFinish(){
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- }
- public void useItem(RSItem item, RSObject object){
- if(item != null && object != null && object.isOnScreen()){
- item.doClick(true);
- sleep(200, 300);
- object.doClick();
- }
- }
- public void fillVials(){
- if(fountain != null){
- status = "Filling Vials";
- useItem(myVial, fountain);
- while(inventory.contains(emptyVialID)){
- sleep(random(1000,1500));
- if(antiban){
- if(random(1, 3) == 2){
- mouse.moveSlightly();
- }
- }
- }
- status = "Vials filled";
- }
- else{
- status = "Fountain is null...retrying";
- sleep(random(600, 800));
- }
- }
- private void doBank(){
- try{
- if(banker != null){
- camera.turnTo(banker);
- if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
- status = "Opening Bank";
- banker.interact("Bank Banker");
- status = "Bank opened";
- sleep(random(900, 1050));
- status = "Depositing All";
- bank.depositAll();
- status = "Deposited All";
- sleep(random(780, 950));
- numFilled = bank.getCount(fullVialID);
- if(bank.getCount(emptyVialID) != 0){
- status = "Taking Vials";
- bank.withdraw(emptyVialID, 0);
- status = "Vials Taken";
- sleep(random(700, 960));
- }
- else{
- log("Out of vials. Quitting :/");
- bank.close();
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- stopScript(true);
- }
- status = "Closing Bank";
- bank.close();
- status = "Bank Closed";
- sleep(random(750, 910));
- }
- }
- sleep(random(300,500));
- }catch(Exception e){log(e);}
- }
- public void onToBank(){
- try{
- status = "Going to Bank";
- walking.walkTileMM(theBank);
- }catch(Exception e){log(e);}
- sleep(random(500, 700));
- }
- public void onToGlitch(){
- try{
- status = "Going to Fountain"; //What you don't know can't hurt you :P
- walking.walkTileMM(glitchSpot);
- }catch(Exception e){log(e);}
- sleep(random(500, 710));
- }
- public void onToFountain(){
- try{
- status = "Going to Fountain";
- walking.walkTileMM(theFountain);
- }catch(Exception e){log(e);}
- sleep(random(500, 705));
- }
- public void runcheck() {
- try{
- runEnergy = (random(50, 70));
- if (walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
- walking.setRun(true);
- isRunning = "Yes";
- sleep(random(300, 500));
- }
- else{
- isRunning = "No";
- sleep(random(300,500));
- }
- }catch(Exception ex){}
- }
- @Override
- public int loop(){
- mouse.setSpeed(random(minSpeed, maxSpeed));
- runcheck();
- if(antiban){
- if(random(min, max) == 3){
- antiban();
- }
- }
- if(objects.getNearest(fountainID) != null){
- fountain = objects.getNearest(fountainID);
- }
- if(npcs.getNearest(bankerID) != null){
- banker = npcs.getNearest(bankerID);
- }
- if(inventory.getItem(emptyVialID) != null){
- myVial = inventory.getItem(emptyVialID);
- }
- switch(getState()){
- case TOFOUNTAIN:
- runcheck();
- onToFountain();
- if(fountainRange.contains(players.getMyPlayer().getLocation())){
- fillVials();
- }
- break;
- case TOGLITCH:
- runcheck();
- onToGlitch();
- break;
- case TOBANK:
- runcheck();
- onToBank();
- if(bankRange.contains(players.getMyPlayer().getLocation())){
- doBank();
- }
- break;
- }
- return(random(500, 1000));
- }
- private State getState() {
- if (!inventory.contains(emptyVialID)) {
- return State.TOBANK;
- }
- else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
- return State.TOGLITCH;
- }
- else{
- return State.TOFOUNTAIN;
- }
- }
- // GUI and Mouse
- public void onRepaint(Graphics g1) {
- profit = numFilled * profitPrice;
- if(!save){
- 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;
- if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
- profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- profHour = profSec * 3600;
- hourlyProfit = profHour * profitPrice;
- hourlyProfitInt = Math.round(hourlyProfit);
- }
- else{
- millis = 0;
- hours = 0;
- minutes = 0;
- seconds = 0;
- hourlyProfitInt = 9001;
- }
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(7, 345, 488, 70);
- g.setStroke(stroke1);
- g.drawRect(7, 345, 488, 70);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Status:", 14, 362);
- g.setFont(font2);
- g.drawString(status, 59, 362);
- g.setFont(font1);
- g.drawString("Filled Vials In Bank:", 209, 362);
- g.setFont(font2);
- g.drawString(Integer.toString(numFilled), 328, 362);
- g.setFont(font1);
- g.drawString("Profit:", 14, 383);
- g.setFont(font2);
- g.drawString(Integer.toString(profit), 59, 383);
- g.setFont(font1);
- g.drawString("Profit/hr:", 137, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
- }
- else{
- g.drawString("Mem Save", 190, 383);
- }
- g.setFont(font1);
- g.drawString("Runtime:", 270, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
- }
- else{
- g.drawString("Mem Save", 325, 384);
- }
- g.setFont(font1);
- g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
- g.drawString("Running:", 710, 139);
- g.setFont(font2);
- g.drawString(isRunning, 722, 156);
- g.setFont(font3);
- g.drawString("Painlaws", 440, 357);
- g1.setColor(Color.green);
- g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
- g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
- }
- /* Antiban stuff
- * Some credits to Aaimister :)
- * Partially copied, with permission
- */
- public void rotateCamera() {
- final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- final int randomLR = random(0, 2);
- final int randomUD = random(0, 2);
- final int randomAll = random(0, 4);
- if (random(0, 3) == 0) {
- keyboard.pressKey(LR[randomLR]);
- sleepCR(random(2, 9));
- keyboard.pressKey(UD[randomUD]);
- sleepCR(random(6, 10));
- keyboard.releaseKey(UD[randomUD]);
- sleepCR(random(2, 7));
- keyboard.releaseKey(LR[randomLR]);
- } else {
- keyboard.pressKey(LRUD[randomAll]);
- if (randomAll > 1) {
- sleepCR(random(6, 11));
- } else {
- sleepCR(random(9, 12));
- }
- keyboard.releaseKey(LRUD[randomAll]);
- }
- }
- private boolean sleepCR(final int amtOfHalfSecs) {
- for (int x = 0; x < amtOfHalfSecs + 1; x++) {
- sleep(random(48, 53));
- }
- return true;
- }
- private void antiban(){
- int action = random(0, 5);
- switch (action) {
- case 0:
- status = "Antiban";
- rotateCamera();
- sleep(200, 400);
- break;
- case 1:
- status = "Antiban";
- mouse.moveRandomly(100, 900);
- sleep(200, 400);
- break;
- case 2:
- status = "Antiban";
- mouse.moveSlightly();
- sleep(200, 400);
- break;
- case 3:
- status = "Antiban";
- camera.moveRandomly(random(750,1250));
- sleep(200, 400);
- break;
- case 4:
- status = "Antiban";
- checkEXP();
- sleep(200, 400);
- break;
- case 5:
- status = "Antiban";
- mouse.moveOffScreen();
- sleep(200, 400);
- break;
- }
- }
- public void checkEXP() {
- game.openTab(Game.Tab.STATS);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(random(2100, 3400));
- game.openTab(Game.Tab.INVENTORY);
- sleep(random(540,760));
- }
- class gui extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e){
- String mode = selectionBox.getSelectedItem().toString();
- if(mode.equals("Maximum")){
- antiban = false;
- minSpeed = 5;
- maxSpeed = 6;
- }
- else if(mode.equals("Paranoid")){
- antiban = true;
- minSpeed = 8;
- maxSpeed = 10;
- min = 3;
- max = 3;
- }
- save = memoryMode.isSelected();
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- selectionBox = new JComboBox();
- memoryMode = new JCheckBox();
- label2 = new JLabel();
- label3 = new JLabel();
- label4 = new JLabel();
- label5 = new JLabel();
- startButton = new JButton();
- //======== this ========
- setTitle("Painlaws's Vial Filler");
- setResizable(false);
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Mode");
- //---- selectionBox ----
- selectionBox.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Paranoid",
- "Maximum"
- }));
- //---- memoryMode ----
- memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
- //---- label2 ----
- label2.setText("Modes:");
- //---- label3 ----
- label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
- //---- label4 ----
- label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
- //---- label5 ----
- label5.setText("Maximum - No Antiban, Fast Mouse Speed");
- //---- startButton ----
- startButton.setText("Let's Fill Some Vials!");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e){
- startButtonActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
- .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGap(148, 148, 148)
- .addComponent(startButton)))
- .addContainerGap(2, Short.MAX_VALUE))
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label1)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(memoryMode)
- .addGap(18, 18, 18)
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label4)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox selectionBox;
- private JCheckBox memoryMode;
- private JLabel label2;
- private JLabel label3;
- private JLabel label4;
- private JLabel label5;
- private JButton startButton;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.KeyEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
- public class vialfiller extends Script implements PaintListener{
- //Variables
- // - Essentials
- private int bankerID = 6533;
- private int fountainID = 24214;
- private int emptyVialID = 229;
- private int fullVialID = 227;
- private int runEnergy = 50;
- RSNPC banker;
- RSObject fountain;
- RSItem myVial;
- RSTile theBank = new RSTile(3167, 3489);
- RSTile theFountain = new RSTile(3191, 3471);
- RSTile glitchSpot = new RSTile(3192, 3487);
- RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
- RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
- RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
- RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
- // - GUI Options
- private int min = 1;
- private int max = 6;
- private int minSpeed = 6;
- private int maxSpeed = 9;
- private boolean guiWait = true;
- private boolean save = false;
- // - State check
- private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
- // - Paint stuff
- private String status = "Initializing...";
- private String isRunning = "";
- private int numFilled = 0;
- private int vialFilledPrice;
- private int vialEmptyPrice;
- private int profitPrice;
- private int profit;
- private long startTime;
- private long millis;
- private long hours;
- private long minutes;
- private long seconds;
- private float profSec = 0;
- private float profHour;
- private float hourlyProfit;
- private int hourlyProfitInt;
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 13);
- private final Font font2 = new Font("Arial", 1, 13);
- private final Font font3 = new Font("Vijaya", 1, 17);
- private boolean antiban = true;
- gui g = new gui();
- @Override
- public boolean onStart(){
- log("Welcome to Painlaws's Vial Filler");
- log("Waiting on GUI...");
- g.setVisible(true);
- while(guiWait){
- sleep(500);
- }
- log("GUI Settings loaded!");
- if(walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else{
- isRunning = "No";
- }
- vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
- vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
- profitPrice = vialFilledPrice - vialEmptyPrice;
- if(!save){
- startTime = System.currentTimeMillis();
- }
- else{
- startTime = 0;
- }
- return true;
- }
- @Override
- public void onFinish(){
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- }
- public void useItem(RSItem item, RSObject object){
- if(item != null && object != null && object.isOnScreen()){
- item.doClick(true);
- sleep(200, 300);
- object.doClick();
- }
- }
- public void fillVials(){
- if(fountain != null){
- status = "Filling Vials";
- useItem(myVial, fountain);
- while(inventory.contains(emptyVialID)){
- sleep(random(1000,1500));
- if(antiban){
- if(random(1, 3) == 2){
- mouse.moveSlightly();
- }
- }
- }
- status = "Vials filled";
- }
- else{
- status = "Fountain is null...retrying";
- sleep(random(600, 800));
- }
- }
- private void doBank(){
- try{
- if(banker != null){
- camera.turnTo(banker);
- if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
- status = "Opening Bank";
- banker.interact("Bank Banker");
- status = "Bank opened";
- sleep(random(900, 1050));
- status = "Depositing All";
- bank.depositAll();
- status = "Deposited All";
- sleep(random(780, 950));
- numFilled = bank.getCount(fullVialID);
- if(bank.getCount(emptyVialID) != 0){
- status = "Taking Vials";
- bank.withdraw(emptyVialID, 0);
- status = "Vials Taken";
- sleep(random(700, 960));
- }
- else{
- log("Out of vials. Quitting :/");
- bank.close();
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- stopScript(true);
- }
- status = "Closing Bank";
- bank.close();
- status = "Bank Closed";
- sleep(random(750, 910));
- }
- }
- sleep(random(300,500));
- }catch(Exception e){log(e);}
- }
- public void onToBank(){
- try{
- status = "Going to Bank";
- walking.walkTileMM(theBank);
- }catch(Exception e){log(e);}
- sleep(random(500, 700));
- }
- public void onToGlitch(){
- try{
- status = "Going to Fountain"; //What you don't know can't hurt you :P
- walking.walkTileMM(glitchSpot);
- }catch(Exception e){log(e);}
- sleep(random(500, 710));
- }
- public void onToFountain(){
- try{
- status = "Going to Fountain";
- walking.walkTileMM(theFountain);
- }catch(Exception e){log(e);}
- sleep(random(500, 705));
- }
- public void runcheck() {
- try{
- runEnergy = (random(50, 70));
- if (walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
- walking.setRun(true);
- isRunning = "Yes";
- sleep(random(300, 500));
- }
- else{
- isRunning = "No";
- sleep(random(300,500));
- }
- }catch(Exception ex){}
- }
- @Override
- public int loop(){
- mouse.setSpeed(random(minSpeed, maxSpeed));
- runcheck();
- if(antiban){
- if(random(min, max) == 3){
- antiban();
- }
- }
- if(objects.getNearest(fountainID) != null){
- fountain = objects.getNearest(fountainID);
- }
- if(npcs.getNearest(bankerID) != null){
- banker = npcs.getNearest(bankerID);
- }
- if(inventory.getItem(emptyVialID) != null){
- myVial = inventory.getItem(emptyVialID);
- }
- switch(getState()){
- case TOFOUNTAIN:
- runcheck();
- onToFountain();
- if(fountainRange.contains(players.getMyPlayer().getLocation())){
- fillVials();
- }
- break;
- case TOGLITCH:
- runcheck();
- onToGlitch();
- break;
- case TOBANK:
- runcheck();
- onToBank();
- if(bankRange.contains(players.getMyPlayer().getLocation())){
- doBank();
- }
- break;
- }
- return(random(500, 1000));
- }
- private State getState() {
- if (!inventory.contains(emptyVialID)) {
- return State.TOBANK;
- }
- else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
- return State.TOGLITCH;
- }
- else{
- return State.TOFOUNTAIN;
- }
- }
- // GUI and Mouse
- public void onRepaint(Graphics g1) {
- profit = numFilled * profitPrice;
- if(!save){
- 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;
- if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
- profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- profHour = profSec * 3600;
- hourlyProfit = profHour * profitPrice;
- hourlyProfitInt = Math.round(hourlyProfit);
- }
- else{
- millis = 0;
- hours = 0;
- minutes = 0;
- seconds = 0;
- hourlyProfitInt = 9001;
- }
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(7, 345, 488, 70);
- g.setStroke(stroke1);
- g.drawRect(7, 345, 488, 70);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Status:", 14, 362);
- g.setFont(font2);
- g.drawString(status, 59, 362);
- g.setFont(font1);
- g.drawString("Filled Vials In Bank:", 209, 362);
- g.setFont(font2);
- g.drawString(Integer.toString(numFilled), 328, 362);
- g.setFont(font1);
- g.drawString("Profit:", 14, 383);
- g.setFont(font2);
- g.drawString(Integer.toString(profit), 59, 383);
- g.setFont(font1);
- g.drawString("Profit/hr:", 137, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
- }
- else{
- g.drawString("Mem Save", 190, 383);
- }
- g.setFont(font1);
- g.drawString("Runtime:", 270, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
- }
- else{
- g.drawString("Mem Save", 325, 384);
- }
- g.setFont(font1);
- g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
- g.drawString("Running:", 710, 139);
- g.setFont(font2);
- g.drawString(isRunning, 722, 156);
- g.setFont(font3);
- g.drawString("Painlaws", 440, 357);
- g1.setColor(Color.green);
- g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
- g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
- }
- /* Antiban stuff
- * Some credits to Aaimister :)
- * Partially copied, with permission
- */
- public void rotateCamera() {
- final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- final int randomLR = random(0, 2);
- final int randomUD = random(0, 2);
- final int randomAll = random(0, 4);
- if (random(0, 3) == 0) {
- keyboard.pressKey(LR[randomLR]);
- sleepCR(random(2, 9));
- keyboard.pressKey(UD[randomUD]);
- sleepCR(random(6, 10));
- keyboard.releaseKey(UD[randomUD]);
- sleepCR(random(2, 7));
- keyboard.releaseKey(LR[randomLR]);
- } else {
- keyboard.pressKey(LRUD[randomAll]);
- if (randomAll > 1) {
- sleepCR(random(6, 11));
- } else {
- sleepCR(random(9, 12));
- }
- keyboard.releaseKey(LRUD[randomAll]);
- }
- }
- private boolean sleepCR(final int amtOfHalfSecs) {
- for (int x = 0; x < amtOfHalfSecs + 1; x++) {
- sleep(random(48, 53));
- }
- return true;
- }
- private void antiban(){
- int action = random(0, 5);
- switch (action) {
- case 0:
- status = "Antiban";
- rotateCamera();
- sleep(200, 400);
- break;
- case 1:
- status = "Antiban";
- mouse.moveRandomly(100, 900);
- sleep(200, 400);
- break;
- case 2:
- status = "Antiban";
- mouse.moveSlightly();
- sleep(200, 400);
- break;
- case 3:
- status = "Antiban";
- camera.moveRandomly(random(750,1250));
- sleep(200, 400);
- break;
- case 4:
- status = "Antiban";
- checkEXP();
- sleep(200, 400);
- break;
- case 5:
- status = "Antiban";
- mouse.moveOffScreen();
- sleep(200, 400);
- break;
- }
- }
- public void checkEXP() {
- game.openTab(Game.Tab.STATS);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(random(2100, 3400));
- game.openTab(Game.Tab.INVENTORY);
- sleep(random(540,760));
- }
- class gui extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e){
- String mode = selectionBox.getSelectedItem().toString();
- if(mode.equals("Maximum")){
- antiban = false;
- minSpeed = 5;
- maxSpeed = 6;
- }
- else if(mode.equals("Paranoid")){
- antiban = true;
- minSpeed = 8;
- maxSpeed = 10;
- min = 3;
- max = 3;
- }
- save = memoryMode.isSelected();
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- selectionBox = new JComboBox();
- memoryMode = new JCheckBox();
- label2 = new JLabel();
- label3 = new JLabel();
- label4 = new JLabel();
- label5 = new JLabel();
- startButton = new JButton();
- //======== this ========
- setTitle("Painlaws's Vial Filler");
- setResizable(false);
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Mode");
- //---- selectionBox ----
- selectionBox.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Paranoid",
- "Maximum"
- }));
- //---- memoryMode ----
- memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
- //---- label2 ----
- label2.setText("Modes:");
- //---- label3 ----
- label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
- //---- label4 ----
- label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
- //---- label5 ----
- label5.setText("Maximum - No Antiban, Fast Mouse Speed");
- //---- startButton ----
- startButton.setText("Let's Fill Some Vials!");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e){
- startButtonActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
- .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGap(148, 148, 148)
- .addComponent(startButton)))
- .addContainerGap(2, Short.MAX_VALUE))
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label1)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(memoryMode)
- .addGap(18, 18, 18)
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label4)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox selectionBox;
- private JCheckBox memoryMode;
- private JLabel label2;
- private JLabel label3;
- private JLabel label4;
- private JLabel label5;
- private JButton startButton;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.KeyEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
- public class vialfiller extends Script implements PaintListener{
- //Variables
- // - Essentials
- private int bankerID = 6533;
- private int fountainID = 24214;
- private int emptyVialID = 229;
- private int fullVialID = 227;
- private int runEnergy = 50;
- RSNPC banker;
- RSObject fountain;
- RSItem myVial;
- RSTile theBank = new RSTile(3167, 3489);
- RSTile theFountain = new RSTile(3191, 3471);
- RSTile glitchSpot = new RSTile(3192, 3487);
- RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
- RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
- RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
- RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
- // - GUI Options
- private int min = 1;
- private int max = 6;
- private int minSpeed = 6;
- private int maxSpeed = 9;
- private boolean guiWait = true;
- private boolean save = false;
- // - State check
- private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
- // - Paint stuff
- private String status = "Initializing...";
- private String isRunning = "";
- private int numFilled = 0;
- private int vialFilledPrice;
- private int vialEmptyPrice;
- private int profitPrice;
- private int profit;
- private long startTime;
- private long millis;
- private long hours;
- private long minutes;
- private long seconds;
- private float profSec = 0;
- private float profHour;
- private float hourlyProfit;
- private int hourlyProfitInt;
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 13);
- private final Font font2 = new Font("Arial", 1, 13);
- private final Font font3 = new Font("Vijaya", 1, 17);
- private boolean antiban = true;
- gui g = new gui();
- @Override
- public boolean onStart(){
- log("Welcome to Painlaws's Vial Filler");
- log("Waiting on GUI...");
- g.setVisible(true);
- while(guiWait){
- sleep(500);
- }
- log("GUI Settings loaded!");
- if(walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else{
- isRunning = "No";
- }
- vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
- vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
- profitPrice = vialFilledPrice - vialEmptyPrice;
- if(!save){
- startTime = System.currentTimeMillis();
- }
- else{
- startTime = 0;
- }
- return true;
- }
- @Override
- public void onFinish(){
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- }
- public void useItem(RSItem item, RSObject object){
- if(item != null && object != null && object.isOnScreen()){
- item.doClick(true);
- sleep(200, 300);
- object.doClick();
- }
- }
- public void fillVials(){
- if(fountain != null){
- status = "Filling Vials";
- useItem(myVial, fountain);
- while(inventory.contains(emptyVialID)){
- sleep(random(1000,1500));
- if(antiban){
- if(random(1, 3) == 2){
- mouse.moveSlightly();
- }
- }
- }
- status = "Vials filled";
- }
- else{
- status = "Fountain is null...retrying";
- sleep(random(600, 800));
- }
- }
- private void doBank(){
- try{
- if(banker != null){
- camera.turnTo(banker);
- if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
- status = "Opening Bank";
- banker.interact("Bank Banker");
- status = "Bank opened";
- sleep(random(900, 1050));
- status = "Depositing All";
- bank.depositAll();
- status = "Deposited All";
- sleep(random(780, 950));
- numFilled = bank.getCount(fullVialID);
- if(bank.getCount(emptyVialID) != 0){
- status = "Taking Vials";
- bank.withdraw(emptyVialID, 0);
- status = "Vials Taken";
- sleep(random(700, 960));
- }
- else{
- log("Out of vials. Quitting :/");
- bank.close();
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- stopScript(true);
- }
- status = "Closing Bank";
- bank.close();
- status = "Bank Closed";
- sleep(random(750, 910));
- }
- }
- sleep(random(300,500));
- }catch(Exception e){log(e);}
- }
- public void onToBank(){
- try{
- status = "Going to Bank";
- walking.walkTileMM(theBank);
- }catch(Exception e){log(e);}
- sleep(random(500, 700));
- }
- public void onToGlitch(){
- try{
- status = "Going to Fountain"; //What you don't know can't hurt you :P
- walking.walkTileMM(glitchSpot);
- }catch(Exception e){log(e);}
- sleep(random(500, 710));
- }
- public void onToFountain(){
- try{
- status = "Going to Fountain";
- walking.walkTileMM(theFountain);
- }catch(Exception e){log(e);}
- sleep(random(500, 705));
- }
- public void runcheck() {
- try{
- runEnergy = (random(50, 70));
- if (walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
- walking.setRun(true);
- isRunning = "Yes";
- sleep(random(300, 500));
- }
- else{
- isRunning = "No";
- sleep(random(300,500));
- }
- }catch(Exception ex){}
- }
- @Override
- public int loop(){
- mouse.setSpeed(random(minSpeed, maxSpeed));
- runcheck();
- if(antiban){
- if(random(min, max) == 3){
- antiban();
- }
- }
- if(objects.getNearest(fountainID) != null){
- fountain = objects.getNearest(fountainID);
- }
- if(npcs.getNearest(bankerID) != null){
- banker = npcs.getNearest(bankerID);
- }
- if(inventory.getItem(emptyVialID) != null){
- myVial = inventory.getItem(emptyVialID);
- }
- switch(getState()){
- case TOFOUNTAIN:
- runcheck();
- onToFountain();
- if(fountainRange.contains(players.getMyPlayer().getLocation())){
- fillVials();
- }
- break;
- case TOGLITCH:
- runcheck();
- onToGlitch();
- break;
- case TOBANK:
- runcheck();
- onToBank();
- if(bankRange.contains(players.getMyPlayer().getLocation())){
- doBank();
- }
- break;
- }
- return(random(500, 1000));
- }
- private State getState() {
- if (!inventory.contains(emptyVialID)) {
- return State.TOBANK;
- }
- else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
- return State.TOGLITCH;
- }
- else{
- return State.TOFOUNTAIN;
- }
- }
- // GUI and Mouse
- public void onRepaint(Graphics g1) {
- profit = numFilled * profitPrice;
- if(!save){
- 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;
- if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
- profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- profHour = profSec * 3600;
- hourlyProfit = profHour * profitPrice;
- hourlyProfitInt = Math.round(hourlyProfit);
- }
- else{
- millis = 0;
- hours = 0;
- minutes = 0;
- seconds = 0;
- hourlyProfitInt = 9001;
- }
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(7, 345, 488, 70);
- g.setStroke(stroke1);
- g.drawRect(7, 345, 488, 70);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Status:", 14, 362);
- g.setFont(font2);
- g.drawString(status, 59, 362);
- g.setFont(font1);
- g.drawString("Filled Vials In Bank:", 209, 362);
- g.setFont(font2);
- g.drawString(Integer.toString(numFilled), 328, 362);
- g.setFont(font1);
- g.drawString("Profit:", 14, 383);
- g.setFont(font2);
- g.drawString(Integer.toString(profit), 59, 383);
- g.setFont(font1);
- g.drawString("Profit/hr:", 137, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
- }
- else{
- g.drawString("Mem Save", 190, 383);
- }
- g.setFont(font1);
- g.drawString("Runtime:", 270, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
- }
- else{
- g.drawString("Mem Save", 325, 384);
- }
- g.setFont(font1);
- g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
- g.drawString("Running:", 710, 139);
- g.setFont(font2);
- g.drawString(isRunning, 722, 156);
- g.setFont(font3);
- g.drawString("Painlaws", 440, 357);
- g1.setColor(Color.green);
- g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
- g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
- }
- /* Antiban stuff
- * Some credits to Aaimister :)
- * Partially copied, with permission
- */
- public void rotateCamera() {
- final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- final int randomLR = random(0, 2);
- final int randomUD = random(0, 2);
- final int randomAll = random(0, 4);
- if (random(0, 3) == 0) {
- keyboard.pressKey(LR[randomLR]);
- sleepCR(random(2, 9));
- keyboard.pressKey(UD[randomUD]);
- sleepCR(random(6, 10));
- keyboard.releaseKey(UD[randomUD]);
- sleepCR(random(2, 7));
- keyboard.releaseKey(LR[randomLR]);
- } else {
- keyboard.pressKey(LRUD[randomAll]);
- if (randomAll > 1) {
- sleepCR(random(6, 11));
- } else {
- sleepCR(random(9, 12));
- }
- keyboard.releaseKey(LRUD[randomAll]);
- }
- }
- private boolean sleepCR(final int amtOfHalfSecs) {
- for (int x = 0; x < amtOfHalfSecs + 1; x++) {
- sleep(random(48, 53));
- }
- return true;
- }
- private void antiban(){
- int action = random(0, 5);
- switch (action) {
- case 0:
- status = "Antiban";
- rotateCamera();
- sleep(200, 400);
- break;
- case 1:
- status = "Antiban";
- mouse.moveRandomly(100, 900);
- sleep(200, 400);
- break;
- case 2:
- status = "Antiban";
- mouse.moveSlightly();
- sleep(200, 400);
- break;
- case 3:
- status = "Antiban";
- camera.moveRandomly(random(750,1250));
- sleep(200, 400);
- break;
- case 4:
- status = "Antiban";
- checkEXP();
- sleep(200, 400);
- break;
- case 5:
- status = "Antiban";
- mouse.moveOffScreen();
- sleep(200, 400);
- break;
- }
- }
- public void checkEXP() {
- game.openTab(Game.Tab.STATS);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(random(2100, 3400));
- game.openTab(Game.Tab.INVENTORY);
- sleep(random(540,760));
- }
- class gui extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e){
- String mode = selectionBox.getSelectedItem().toString();
- if(mode.equals("Maximum")){
- antiban = false;
- minSpeed = 5;
- maxSpeed = 6;
- }
- else if(mode.equals("Paranoid")){
- antiban = true;
- minSpeed = 8;
- maxSpeed = 10;
- min = 3;
- max = 3;
- }
- save = memoryMode.isSelected();
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- selectionBox = new JComboBox();
- memoryMode = new JCheckBox();
- label2 = new JLabel();
- label3 = new JLabel();
- label4 = new JLabel();
- label5 = new JLabel();
- startButton = new JButton();
- //======== this ========
- setTitle("Painlaws's Vial Filler");
- setResizable(false);
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Mode");
- //---- selectionBox ----
- selectionBox.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Paranoid",
- "Maximum"
- }));
- //---- memoryMode ----
- memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
- //---- label2 ----
- label2.setText("Modes:");
- //---- label3 ----
- label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
- //---- label4 ----
- label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
- //---- label5 ----
- label5.setText("Maximum - No Antiban, Fast Mouse Speed");
- //---- startButton ----
- startButton.setText("Let's Fill Some Vials!");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e){
- startButtonActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
- .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGap(148, 148, 148)
- .addComponent(startButton)))
- .addContainerGap(2, Short.MAX_VALUE))
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label1)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(memoryMode)
- .addGap(18, 18, 18)
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label4)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox selectionBox;
- private JCheckBox memoryMode;
- private JLabel label2;
- private JLabel label3;
- private JLabel label4;
- private JLabel label5;
- private JButton startButton;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.KeyEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
- public class vialfiller extends Script implements PaintListener{
- //Variables
- // - Essentials
- private int bankerID = 6533;
- private int fountainID = 24214;
- private int emptyVialID = 229;
- private int fullVialID = 227;
- private int runEnergy = 50;
- RSNPC banker;
- RSObject fountain;
- RSItem myVial;
- RSTile theBank = new RSTile(3167, 3489);
- RSTile theFountain = new RSTile(3191, 3471);
- RSTile glitchSpot = new RSTile(3192, 3487);
- RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
- RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
- RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
- RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
- // - GUI Options
- private int min = 1;
- private int max = 6;
- private int minSpeed = 6;
- private int maxSpeed = 9;
- private boolean guiWait = true;
- private boolean save = false;
- // - State check
- private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
- // - Paint stuff
- private String status = "Initializing...";
- private String isRunning = "";
- private int numFilled = 0;
- private int vialFilledPrice;
- private int vialEmptyPrice;
- private int profitPrice;
- private int profit;
- private long startTime;
- private long millis;
- private long hours;
- private long minutes;
- private long seconds;
- private float profSec = 0;
- private float profHour;
- private float hourlyProfit;
- private int hourlyProfitInt;
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 13);
- private final Font font2 = new Font("Arial", 1, 13);
- private final Font font3 = new Font("Vijaya", 1, 17);
- private boolean antiban = true;
- gui g = new gui();
- @Override
- public boolean onStart(){
- log("Welcome to Painlaws's Vial Filler");
- log("Waiting on GUI...");
- g.setVisible(true);
- while(guiWait){
- sleep(500);
- }
- log("GUI Settings loaded!");
- if(walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else{
- isRunning = "No";
- }
- vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
- vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
- profitPrice = vialFilledPrice - vialEmptyPrice;
- if(!save){
- startTime = System.currentTimeMillis();
- }
- else{
- startTime = 0;
- }
- return true;
- }
- @Override
- public void onFinish(){
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- }
- public void useItem(RSItem item, RSObject object){
- if(item != null && object != null && object.isOnScreen()){
- item.doClick(true);
- sleep(200, 300);
- object.doClick();
- }
- }
- public void fillVials(){
- if(fountain != null){
- status = "Filling Vials";
- useItem(myVial, fountain);
- while(inventory.contains(emptyVialID)){
- sleep(random(1000,1500));
- if(antiban){
- if(random(1, 3) == 2){
- mouse.moveSlightly();
- }
- }
- }
- status = "Vials filled";
- }
- else{
- status = "Fountain is null...retrying";
- sleep(random(600, 800));
- }
- }
- private void doBank(){
- try{
- if(banker != null){
- camera.turnTo(banker);
- if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
- status = "Opening Bank";
- banker.interact("Bank Banker");
- status = "Bank opened";
- sleep(random(900, 1050));
- status = "Depositing All";
- bank.depositAll();
- status = "Deposited All";
- sleep(random(780, 950));
- numFilled = bank.getCount(fullVialID);
- if(bank.getCount(emptyVialID) != 0){
- status = "Taking Vials";
- bank.withdraw(emptyVialID, 0);
- status = "Vials Taken";
- sleep(random(700, 960));
- }
- else{
- log("Out of vials. Quitting :/");
- bank.close();
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- stopScript(true);
- }
- status = "Closing Bank";
- bank.close();
- status = "Bank Closed";
- sleep(random(750, 910));
- }
- }
- sleep(random(300,500));
- }catch(Exception e){log(e);}
- }
- public void onToBank(){
- try{
- status = "Going to Bank";
- walking.walkTileMM(theBank);
- }catch(Exception e){log(e);}
- sleep(random(500, 700));
- }
- public void onToGlitch(){
- try{
- status = "Going to Fountain"; //What you don't know can't hurt you :P
- walking.walkTileMM(glitchSpot);
- }catch(Exception e){log(e);}
- sleep(random(500, 710));
- }
- public void onToFountain(){
- try{
- status = "Going to Fountain";
- walking.walkTileMM(theFountain);
- }catch(Exception e){log(e);}
- sleep(random(500, 705));
- }
- public void runcheck() {
- try{
- runEnergy = (random(50, 70));
- if (walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
- walking.setRun(true);
- isRunning = "Yes";
- sleep(random(300, 500));
- }
- else{
- isRunning = "No";
- sleep(random(300,500));
- }
- }catch(Exception ex){}
- }
- @Override
- public int loop(){
- mouse.setSpeed(random(minSpeed, maxSpeed));
- runcheck();
- if(antiban){
- if(random(min, max) == 3){
- antiban();
- }
- }
- if(objects.getNearest(fountainID) != null){
- fountain = objects.getNearest(fountainID);
- }
- if(npcs.getNearest(bankerID) != null){
- banker = npcs.getNearest(bankerID);
- }
- if(inventory.getItem(emptyVialID) != null){
- myVial = inventory.getItem(emptyVialID);
- }
- switch(getState()){
- case TOFOUNTAIN:
- runcheck();
- onToFountain();
- if(fountainRange.contains(players.getMyPlayer().getLocation())){
- fillVials();
- }
- break;
- case TOGLITCH:
- runcheck();
- onToGlitch();
- break;
- case TOBANK:
- runcheck();
- onToBank();
- if(bankRange.contains(players.getMyPlayer().getLocation())){
- doBank();
- }
- break;
- }
- return(random(500, 1000));
- }
- private State getState() {
- if (!inventory.contains(emptyVialID)) {
- return State.TOBANK;
- }
- else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
- return State.TOGLITCH;
- }
- else{
- return State.TOFOUNTAIN;
- }
- }
- // GUI and Mouse
- public void onRepaint(Graphics g1) {
- profit = numFilled * profitPrice;
- if(!save){
- 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;
- if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
- profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- profHour = profSec * 3600;
- hourlyProfit = profHour * profitPrice;
- hourlyProfitInt = Math.round(hourlyProfit);
- }
- else{
- millis = 0;
- hours = 0;
- minutes = 0;
- seconds = 0;
- hourlyProfitInt = 9001;
- }
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(7, 345, 488, 70);
- g.setStroke(stroke1);
- g.drawRect(7, 345, 488, 70);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Status:", 14, 362);
- g.setFont(font2);
- g.drawString(status, 59, 362);
- g.setFont(font1);
- g.drawString("Filled Vials In Bank:", 209, 362);
- g.setFont(font2);
- g.drawString(Integer.toString(numFilled), 328, 362);
- g.setFont(font1);
- g.drawString("Profit:", 14, 383);
- g.setFont(font2);
- g.drawString(Integer.toString(profit), 59, 383);
- g.setFont(font1);
- g.drawString("Profit/hr:", 137, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
- }
- else{
- g.drawString("Mem Save", 190, 383);
- }
- g.setFont(font1);
- g.drawString("Runtime:", 270, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
- }
- else{
- g.drawString("Mem Save", 325, 384);
- }
- g.setFont(font1);
- g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
- g.drawString("Running:", 710, 139);
- g.setFont(font2);
- g.drawString(isRunning, 722, 156);
- g.setFont(font3);
- g.drawString("Painlaws", 440, 357);
- g1.setColor(Color.green);
- g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
- g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
- }
- /* Antiban stuff
- * Some credits to Aaimister :)
- * Partially copied, with permission
- */
- public void rotateCamera() {
- final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- final int randomLR = random(0, 2);
- final int randomUD = random(0, 2);
- final int randomAll = random(0, 4);
- if (random(0, 3) == 0) {
- keyboard.pressKey(LR[randomLR]);
- sleepCR(random(2, 9));
- keyboard.pressKey(UD[randomUD]);
- sleepCR(random(6, 10));
- keyboard.releaseKey(UD[randomUD]);
- sleepCR(random(2, 7));
- keyboard.releaseKey(LR[randomLR]);
- } else {
- keyboard.pressKey(LRUD[randomAll]);
- if (randomAll > 1) {
- sleepCR(random(6, 11));
- } else {
- sleepCR(random(9, 12));
- }
- keyboard.releaseKey(LRUD[randomAll]);
- }
- }
- private boolean sleepCR(final int amtOfHalfSecs) {
- for (int x = 0; x < amtOfHalfSecs + 1; x++) {
- sleep(random(48, 53));
- }
- return true;
- }
- private void antiban(){
- int action = random(0, 5);
- switch (action) {
- case 0:
- status = "Antiban";
- rotateCamera();
- sleep(200, 400);
- break;
- case 1:
- status = "Antiban";
- mouse.moveRandomly(100, 900);
- sleep(200, 400);
- break;
- case 2:
- status = "Antiban";
- mouse.moveSlightly();
- sleep(200, 400);
- break;
- case 3:
- status = "Antiban";
- camera.moveRandomly(random(750,1250));
- sleep(200, 400);
- break;
- case 4:
- status = "Antiban";
- checkEXP();
- sleep(200, 400);
- break;
- case 5:
- status = "Antiban";
- mouse.moveOffScreen();
- sleep(200, 400);
- break;
- }
- }
- public void checkEXP() {
- game.openTab(Game.Tab.STATS);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(random(2100, 3400));
- game.openTab(Game.Tab.INVENTORY);
- sleep(random(540,760));
- }
- class gui extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e){
- String mode = selectionBox.getSelectedItem().toString();
- if(mode.equals("Maximum")){
- antiban = false;
- minSpeed = 5;
- maxSpeed = 6;
- }
- else if(mode.equals("Paranoid")){
- antiban = true;
- minSpeed = 8;
- maxSpeed = 10;
- min = 3;
- max = 3;
- }
- save = memoryMode.isSelected();
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- selectionBox = new JComboBox();
- memoryMode = new JCheckBox();
- label2 = new JLabel();
- label3 = new JLabel();
- label4 = new JLabel();
- label5 = new JLabel();
- startButton = new JButton();
- //======== this ========
- setTitle("Painlaws's Vial Filler");
- setResizable(false);
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Mode");
- //---- selectionBox ----
- selectionBox.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Paranoid",
- "Maximum"
- }));
- //---- memoryMode ----
- memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
- //---- label2 ----
- label2.setText("Modes:");
- //---- label3 ----
- label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
- //---- label4 ----
- label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
- //---- label5 ----
- label5.setText("Maximum - No Antiban, Fast Mouse Speed");
- //---- startButton ----
- startButton.setText("Let's Fill Some Vials!");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e){
- startButtonActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
- .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGap(148, 148, 148)
- .addComponent(startButton)))
- .addContainerGap(2, Short.MAX_VALUE))
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label1)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(memoryMode)
- .addGap(18, 18, 18)
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label4)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox selectionBox;
- private JCheckBox memoryMode;
- private JLabel label2;
- private JLabel label3;
- private JLabel label4;
- private JLabel label5;
- private JButton startButton;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.KeyEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
- public class vialfiller extends Script implements PaintListener{
- //Variables
- // - Essentials
- private int bankerID = 6533;
- private int fountainID = 24214;
- private int emptyVialID = 229;
- private int fullVialID = 227;
- private int runEnergy = 50;
- RSNPC banker;
- RSObject fountain;
- RSItem myVial;
- RSTile theBank = new RSTile(3167, 3489);
- RSTile theFountain = new RSTile(3191, 3471);
- RSTile glitchSpot = new RSTile(3192, 3487);
- RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
- RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
- RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
- RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
- // - GUI Options
- private int min = 1;
- private int max = 6;
- private int minSpeed = 6;
- private int maxSpeed = 9;
- private boolean guiWait = true;
- private boolean save = false;
- // - State check
- private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
- // - Paint stuff
- private String status = "Initializing...";
- private String isRunning = "";
- private int numFilled = 0;
- private int vialFilledPrice;
- private int vialEmptyPrice;
- private int profitPrice;
- private int profit;
- private long startTime;
- private long millis;
- private long hours;
- private long minutes;
- private long seconds;
- private float profSec = 0;
- private float profHour;
- private float hourlyProfit;
- private int hourlyProfitInt;
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 13);
- private final Font font2 = new Font("Arial", 1, 13);
- private final Font font3 = new Font("Vijaya", 1, 17);
- private boolean antiban = true;
- gui g = new gui();
- @Override
- public boolean onStart(){
- log("Welcome to Painlaws's Vial Filler");
- log("Waiting on GUI...");
- g.setVisible(true);
- while(guiWait){
- sleep(500);
- }
- log("GUI Settings loaded!");
- if(walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else{
- isRunning = "No";
- }
- vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
- vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
- profitPrice = vialFilledPrice - vialEmptyPrice;
- if(!save){
- startTime = System.currentTimeMillis();
- }
- else{
- startTime = 0;
- }
- return true;
- }
- @Override
- public void onFinish(){
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- }
- public void useItem(RSItem item, RSObject object){
- if(item != null && object != null && object.isOnScreen()){
- item.doClick(true);
- sleep(200, 300);
- object.doClick();
- }
- }
- public void fillVials(){
- if(fountain != null){
- status = "Filling Vials";
- useItem(myVial, fountain);
- while(inventory.contains(emptyVialID)){
- sleep(random(1000,1500));
- if(antiban){
- if(random(1, 3) == 2){
- mouse.moveSlightly();
- }
- }
- }
- status = "Vials filled";
- }
- else{
- status = "Fountain is null...retrying";
- sleep(random(600, 800));
- }
- }
- private void doBank(){
- try{
- if(banker != null){
- camera.turnTo(banker);
- if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
- status = "Opening Bank";
- banker.interact("Bank Banker");
- status = "Bank opened";
- sleep(random(900, 1050));
- status = "Depositing All";
- bank.depositAll();
- status = "Deposited All";
- sleep(random(780, 950));
- numFilled = bank.getCount(fullVialID);
- if(bank.getCount(emptyVialID) != 0){
- status = "Taking Vials";
- bank.withdraw(emptyVialID, 0);
- status = "Vials Taken";
- sleep(random(700, 960));
- }
- else{
- log("Out of vials. Quitting :/");
- bank.close();
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- stopScript(true);
- }
- status = "Closing Bank";
- bank.close();
- status = "Bank Closed";
- sleep(random(750, 910));
- }
- }
- sleep(random(300,500));
- }catch(Exception e){log(e);}
- }
- public void onToBank(){
- try{
- status = "Going to Bank";
- walking.walkTileMM(theBank);
- }catch(Exception e){log(e);}
- sleep(random(500, 700));
- }
- public void onToGlitch(){
- try{
- status = "Going to Fountain"; //What you don't know can't hurt you :P
- walking.walkTileMM(glitchSpot);
- }catch(Exception e){log(e);}
- sleep(random(500, 710));
- }
- public void onToFountain(){
- try{
- status = "Going to Fountain";
- walking.walkTileMM(theFountain);
- }catch(Exception e){log(e);}
- sleep(random(500, 705));
- }
- public void runcheck() {
- try{
- runEnergy = (random(50, 70));
- if (walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
- walking.setRun(true);
- isRunning = "Yes";
- sleep(random(300, 500));
- }
- else{
- isRunning = "No";
- sleep(random(300,500));
- }
- }catch(Exception ex){}
- }
- @Override
- public int loop(){
- mouse.setSpeed(random(minSpeed, maxSpeed));
- runcheck();
- if(antiban){
- if(random(min, max) == 3){
- antiban();
- }
- }
- if(objects.getNearest(fountainID) != null){
- fountain = objects.getNearest(fountainID);
- }
- if(npcs.getNearest(bankerID) != null){
- banker = npcs.getNearest(bankerID);
- }
- if(inventory.getItem(emptyVialID) != null){
- myVial = inventory.getItem(emptyVialID);
- }
- switch(getState()){
- case TOFOUNTAIN:
- runcheck();
- onToFountain();
- if(fountainRange.contains(players.getMyPlayer().getLocation())){
- fillVials();
- }
- break;
- case TOGLITCH:
- runcheck();
- onToGlitch();
- break;
- case TOBANK:
- runcheck();
- onToBank();
- if(bankRange.contains(players.getMyPlayer().getLocation())){
- doBank();
- }
- break;
- }
- return(random(500, 1000));
- }
- private State getState() {
- if (!inventory.contains(emptyVialID)) {
- return State.TOBANK;
- }
- else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
- return State.TOGLITCH;
- }
- else{
- return State.TOFOUNTAIN;
- }
- }
- // GUI and Mouse
- public void onRepaint(Graphics g1) {
- profit = numFilled * profitPrice;
- if(!save){
- 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;
- if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
- profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- profHour = profSec * 3600;
- hourlyProfit = profHour * profitPrice;
- hourlyProfitInt = Math.round(hourlyProfit);
- }
- else{
- millis = 0;
- hours = 0;
- minutes = 0;
- seconds = 0;
- hourlyProfitInt = 9001;
- }
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(7, 345, 488, 70);
- g.setStroke(stroke1);
- g.drawRect(7, 345, 488, 70);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Status:", 14, 362);
- g.setFont(font2);
- g.drawString(status, 59, 362);
- g.setFont(font1);
- g.drawString("Filled Vials In Bank:", 209, 362);
- g.setFont(font2);
- g.drawString(Integer.toString(numFilled), 328, 362);
- g.setFont(font1);
- g.drawString("Profit:", 14, 383);
- g.setFont(font2);
- g.drawString(Integer.toString(profit), 59, 383);
- g.setFont(font1);
- g.drawString("Profit/hr:", 137, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
- }
- else{
- g.drawString("Mem Save", 190, 383);
- }
- g.setFont(font1);
- g.drawString("Runtime:", 270, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
- }
- else{
- g.drawString("Mem Save", 325, 384);
- }
- g.setFont(font1);
- g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
- g.drawString("Running:", 710, 139);
- g.setFont(font2);
- g.drawString(isRunning, 722, 156);
- g.setFont(font3);
- g.drawString("Painlaws", 440, 357);
- g1.setColor(Color.green);
- g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
- g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
- }
- /* Antiban stuff
- * Some credits to Aaimister :)
- * Partially copied, with permission
- */
- public void rotateCamera() {
- final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- final int randomLR = random(0, 2);
- final int randomUD = random(0, 2);
- final int randomAll = random(0, 4);
- if (random(0, 3) == 0) {
- keyboard.pressKey(LR[randomLR]);
- sleepCR(random(2, 9));
- keyboard.pressKey(UD[randomUD]);
- sleepCR(random(6, 10));
- keyboard.releaseKey(UD[randomUD]);
- sleepCR(random(2, 7));
- keyboard.releaseKey(LR[randomLR]);
- } else {
- keyboard.pressKey(LRUD[randomAll]);
- if (randomAll > 1) {
- sleepCR(random(6, 11));
- } else {
- sleepCR(random(9, 12));
- }
- keyboard.releaseKey(LRUD[randomAll]);
- }
- }
- private boolean sleepCR(final int amtOfHalfSecs) {
- for (int x = 0; x < amtOfHalfSecs + 1; x++) {
- sleep(random(48, 53));
- }
- return true;
- }
- private void antiban(){
- int action = random(0, 5);
- switch (action) {
- case 0:
- status = "Antiban";
- rotateCamera();
- sleep(200, 400);
- break;
- case 1:
- status = "Antiban";
- mouse.moveRandomly(100, 900);
- sleep(200, 400);
- break;
- case 2:
- status = "Antiban";
- mouse.moveSlightly();
- sleep(200, 400);
- break;
- case 3:
- status = "Antiban";
- camera.moveRandomly(random(750,1250));
- sleep(200, 400);
- break;
- case 4:
- status = "Antiban";
- checkEXP();
- sleep(200, 400);
- break;
- case 5:
- status = "Antiban";
- mouse.moveOffScreen();
- sleep(200, 400);
- break;
- }
- }
- public void checkEXP() {
- game.openTab(Game.Tab.STATS);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(random(2100, 3400));
- game.openTab(Game.Tab.INVENTORY);
- sleep(random(540,760));
- }
- class gui extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e){
- String mode = selectionBox.getSelectedItem().toString();
- if(mode.equals("Maximum")){
- antiban = false;
- minSpeed = 5;
- maxSpeed = 6;
- }
- else if(mode.equals("Paranoid")){
- antiban = true;
- minSpeed = 8;
- maxSpeed = 10;
- min = 3;
- max = 3;
- }
- save = memoryMode.isSelected();
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- selectionBox = new JComboBox();
- memoryMode = new JCheckBox();
- label2 = new JLabel();
- label3 = new JLabel();
- label4 = new JLabel();
- label5 = new JLabel();
- startButton = new JButton();
- //======== this ========
- setTitle("Painlaws's Vial Filler");
- setResizable(false);
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Mode");
- //---- selectionBox ----
- selectionBox.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Paranoid",
- "Maximum"
- }));
- //---- memoryMode ----
- memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
- //---- label2 ----
- label2.setText("Modes:");
- //---- label3 ----
- label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
- //---- label4 ----
- label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
- //---- label5 ----
- label5.setText("Maximum - No Antiban, Fast Mouse Speed");
- //---- startButton ----
- startButton.setText("Let's Fill Some Vials!");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e){
- startButtonActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
- .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGap(148, 148, 148)
- .addComponent(startButton)))
- .addContainerGap(2, Short.MAX_VALUE))
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label1)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(memoryMode)
- .addGap(18, 18, 18)
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label4)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox selectionBox;
- private JCheckBox memoryMode;
- private JLabel label2;
- private JLabel label3;
- private JLabel label4;
- private JLabel label5;
- private JButton startButton;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.KeyEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
- public class vialfiller extends Script implements PaintListener{
- //Variables
- // - Essentials
- private int bankerID = 6533;
- private int fountainID = 24214;
- private int emptyVialID = 229;
- private int fullVialID = 227;
- private int runEnergy = 50;
- RSNPC banker;
- RSObject fountain;
- RSItem myVial;
- RSTile theBank = new RSTile(3167, 3489);
- RSTile theFountain = new RSTile(3191, 3471);
- RSTile glitchSpot = new RSTile(3192, 3487);
- RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
- RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
- RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
- RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
- // - GUI Options
- private int min = 1;
- private int max = 6;
- private int minSpeed = 6;
- private int maxSpeed = 9;
- private boolean guiWait = true;
- private boolean save = false;
- // - State check
- private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
- // - Paint stuff
- private String status = "Initializing...";
- private String isRunning = "";
- private int numFilled = 0;
- private int vialFilledPrice;
- private int vialEmptyPrice;
- private int profitPrice;
- private int profit;
- private long startTime;
- private long millis;
- private long hours;
- private long minutes;
- private long seconds;
- private float profSec = 0;
- private float profHour;
- private float hourlyProfit;
- private int hourlyProfitInt;
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 13);
- private final Font font2 = new Font("Arial", 1, 13);
- private final Font font3 = new Font("Vijaya", 1, 17);
- private boolean antiban = true;
- gui g = new gui();
- @Override
- public boolean onStart(){
- log("Welcome to Painlaws's Vial Filler");
- log("Waiting on GUI...");
- g.setVisible(true);
- while(guiWait){
- sleep(500);
- }
- log("GUI Settings loaded!");
- if(walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else{
- isRunning = "No";
- }
- vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
- vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
- profitPrice = vialFilledPrice - vialEmptyPrice;
- if(!save){
- startTime = System.currentTimeMillis();
- }
- else{
- startTime = 0;
- }
- return true;
- }
- @Override
- public void onFinish(){
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- }
- public void useItem(RSItem item, RSObject object){
- if(item != null && object != null && object.isOnScreen()){
- item.doClick(true);
- sleep(200, 300);
- object.doClick();
- }
- }
- public void fillVials(){
- if(fountain != null){
- status = "Filling Vials";
- useItem(myVial, fountain);
- while(inventory.contains(emptyVialID)){
- sleep(random(1000,1500));
- if(antiban){
- if(random(1, 3) == 2){
- mouse.moveSlightly();
- }
- }
- }
- status = "Vials filled";
- }
- else{
- status = "Fountain is null...retrying";
- sleep(random(600, 800));
- }
- }
- private void doBank(){
- try{
- if(banker != null){
- camera.turnTo(banker);
- if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
- status = "Opening Bank";
- banker.interact("Bank Banker");
- status = "Bank opened";
- sleep(random(900, 1050));
- status = "Depositing All";
- bank.depositAll();
- status = "Deposited All";
- sleep(random(780, 950));
- numFilled = bank.getCount(fullVialID);
- if(bank.getCount(emptyVialID) != 0){
- status = "Taking Vials";
- bank.withdraw(emptyVialID, 0);
- status = "Vials Taken";
- sleep(random(700, 960));
- }
- else{
- log("Out of vials. Quitting :/");
- bank.close();
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- stopScript(true);
- }
- status = "Closing Bank";
- bank.close();
- status = "Bank Closed";
- sleep(random(750, 910));
- }
- }
- sleep(random(300,500));
- }catch(Exception e){log(e);}
- }
- public void onToBank(){
- try{
- status = "Going to Bank";
- walking.walkTileMM(theBank);
- }catch(Exception e){log(e);}
- sleep(random(500, 700));
- }
- public void onToGlitch(){
- try{
- status = "Going to Fountain"; //What you don't know can't hurt you :P
- walking.walkTileMM(glitchSpot);
- }catch(Exception e){log(e);}
- sleep(random(500, 710));
- }
- public void onToFountain(){
- try{
- status = "Going to Fountain";
- walking.walkTileMM(theFountain);
- }catch(Exception e){log(e);}
- sleep(random(500, 705));
- }
- public void runcheck() {
- try{
- runEnergy = (random(50, 70));
- if (walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
- walking.setRun(true);
- isRunning = "Yes";
- sleep(random(300, 500));
- }
- else{
- isRunning = "No";
- sleep(random(300,500));
- }
- }catch(Exception ex){}
- }
- @Override
- public int loop(){
- mouse.setSpeed(random(minSpeed, maxSpeed));
- runcheck();
- if(antiban){
- if(random(min, max) == 3){
- antiban();
- }
- }
- if(objects.getNearest(fountainID) != null){
- fountain = objects.getNearest(fountainID);
- }
- if(npcs.getNearest(bankerID) != null){
- banker = npcs.getNearest(bankerID);
- }
- if(inventory.getItem(emptyVialID) != null){
- myVial = inventory.getItem(emptyVialID);
- }
- switch(getState()){
- case TOFOUNTAIN:
- runcheck();
- onToFountain();
- if(fountainRange.contains(players.getMyPlayer().getLocation())){
- fillVials();
- }
- break;
- case TOGLITCH:
- runcheck();
- onToGlitch();
- break;
- case TOBANK:
- runcheck();
- onToBank();
- if(bankRange.contains(players.getMyPlayer().getLocation())){
- doBank();
- }
- break;
- }
- return(random(500, 1000));
- }
- private State getState() {
- if (!inventory.contains(emptyVialID)) {
- return State.TOBANK;
- }
- else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
- return State.TOGLITCH;
- }
- else{
- return State.TOFOUNTAIN;
- }
- }
- // GUI and Mouse
- public void onRepaint(Graphics g1) {
- profit = numFilled * profitPrice;
- if(!save){
- 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;
- if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
- profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- profHour = profSec * 3600;
- hourlyProfit = profHour * profitPrice;
- hourlyProfitInt = Math.round(hourlyProfit);
- }
- else{
- millis = 0;
- hours = 0;
- minutes = 0;
- seconds = 0;
- hourlyProfitInt = 9001;
- }
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(7, 345, 488, 70);
- g.setStroke(stroke1);
- g.drawRect(7, 345, 488, 70);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Status:", 14, 362);
- g.setFont(font2);
- g.drawString(status, 59, 362);
- g.setFont(font1);
- g.drawString("Filled Vials In Bank:", 209, 362);
- g.setFont(font2);
- g.drawString(Integer.toString(numFilled), 328, 362);
- g.setFont(font1);
- g.drawString("Profit:", 14, 383);
- g.setFont(font2);
- g.drawString(Integer.toString(profit), 59, 383);
- g.setFont(font1);
- g.drawString("Profit/hr:", 137, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
- }
- else{
- g.drawString("Mem Save", 190, 383);
- }
- g.setFont(font1);
- g.drawString("Runtime:", 270, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
- }
- else{
- g.drawString("Mem Save", 325, 384);
- }
- g.setFont(font1);
- g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
- g.drawString("Running:", 710, 139);
- g.setFont(font2);
- g.drawString(isRunning, 722, 156);
- g.setFont(font3);
- g.drawString("Painlaws", 440, 357);
- g1.setColor(Color.green);
- g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
- g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
- }
- /* Antiban stuff
- * Some credits to Aaimister :)
- * Partially copied, with permission
- */
- public void rotateCamera() {
- final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- final int randomLR = random(0, 2);
- final int randomUD = random(0, 2);
- final int randomAll = random(0, 4);
- if (random(0, 3) == 0) {
- keyboard.pressKey(LR[randomLR]);
- sleepCR(random(2, 9));
- keyboard.pressKey(UD[randomUD]);
- sleepCR(random(6, 10));
- keyboard.releaseKey(UD[randomUD]);
- sleepCR(random(2, 7));
- keyboard.releaseKey(LR[randomLR]);
- } else {
- keyboard.pressKey(LRUD[randomAll]);
- if (randomAll > 1) {
- sleepCR(random(6, 11));
- } else {
- sleepCR(random(9, 12));
- }
- keyboard.releaseKey(LRUD[randomAll]);
- }
- }
- private boolean sleepCR(final int amtOfHalfSecs) {
- for (int x = 0; x < amtOfHalfSecs + 1; x++) {
- sleep(random(48, 53));
- }
- return true;
- }
- private void antiban(){
- int action = random(0, 5);
- switch (action) {
- case 0:
- status = "Antiban";
- rotateCamera();
- sleep(200, 400);
- break;
- case 1:
- status = "Antiban";
- mouse.moveRandomly(100, 900);
- sleep(200, 400);
- break;
- case 2:
- status = "Antiban";
- mouse.moveSlightly();
- sleep(200, 400);
- break;
- case 3:
- status = "Antiban";
- camera.moveRandomly(random(750,1250));
- sleep(200, 400);
- break;
- case 4:
- status = "Antiban";
- checkEXP();
- sleep(200, 400);
- break;
- case 5:
- status = "Antiban";
- mouse.moveOffScreen();
- sleep(200, 400);
- break;
- }
- }
- public void checkEXP() {
- game.openTab(Game.Tab.STATS);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(random(2100, 3400));
- game.openTab(Game.Tab.INVENTORY);
- sleep(random(540,760));
- }
- class gui extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e){
- String mode = selectionBox.getSelectedItem().toString();
- if(mode.equals("Maximum")){
- antiban = false;
- minSpeed = 5;
- maxSpeed = 6;
- }
- else if(mode.equals("Paranoid")){
- antiban = true;
- minSpeed = 8;
- maxSpeed = 10;
- min = 3;
- max = 3;
- }
- save = memoryMode.isSelected();
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- selectionBox = new JComboBox();
- memoryMode = new JCheckBox();
- label2 = new JLabel();
- label3 = new JLabel();
- label4 = new JLabel();
- label5 = new JLabel();
- startButton = new JButton();
- //======== this ========
- setTitle("Painlaws's Vial Filler");
- setResizable(false);
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Mode");
- //---- selectionBox ----
- selectionBox.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Paranoid",
- "Maximum"
- }));
- //---- memoryMode ----
- memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
- //---- label2 ----
- label2.setText("Modes:");
- //---- label3 ----
- label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
- //---- label4 ----
- label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
- //---- label5 ----
- label5.setText("Maximum - No Antiban, Fast Mouse Speed");
- //---- startButton ----
- startButton.setText("Let's Fill Some Vials!");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e){
- startButtonActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
- .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGap(148, 148, 148)
- .addComponent(startButton)))
- .addContainerGap(2, Short.MAX_VALUE))
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label1)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(memoryMode)
- .addGap(18, 18, 18)
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label4)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox selectionBox;
- private JCheckBox memoryMode;
- private JLabel label2;
- private JLabel label3;
- private JLabel label4;
- private JLabel label5;
- private JButton startButton;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import java.awt.event.KeyEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
- public class vialfiller extends Script implements PaintListener{
- //Variables
- // - Essentials
- private int bankerID = 6533;
- private int fountainID = 24214;
- private int emptyVialID = 229;
- private int fullVialID = 227;
- private int runEnergy = 50;
- RSNPC banker;
- RSObject fountain;
- RSItem myVial;
- RSTile theBank = new RSTile(3167, 3489);
- RSTile theFountain = new RSTile(3191, 3471);
- RSTile glitchSpot = new RSTile(3192, 3487);
- RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
- RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
- RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
- RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
- // - GUI Options
- private int min = 1;
- private int max = 6;
- private int minSpeed = 6;
- private int maxSpeed = 9;
- private boolean guiWait = true;
- private boolean save = false;
- // - State check
- private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
- // - Paint stuff
- private String status = "Initializing...";
- private String isRunning = "";
- private int numFilled = 0;
- private int vialFilledPrice;
- private int vialEmptyPrice;
- private int profitPrice;
- private int profit;
- private long startTime;
- private long millis;
- private long hours;
- private long minutes;
- private long seconds;
- private float profSec = 0;
- private float profHour;
- private float hourlyProfit;
- private int hourlyProfitInt;
- private final Color color1 = new Color(0, 0, 0);
- private final Color color2 = new Color(255, 255, 255);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 13);
- private final Font font2 = new Font("Arial", 1, 13);
- private final Font font3 = new Font("Vijaya", 1, 17);
- private boolean antiban = true;
- gui g = new gui();
- @Override
- public boolean onStart(){
- log("Welcome to Painlaws's Vial Filler");
- log("Waiting on GUI...");
- g.setVisible(true);
- while(guiWait){
- sleep(500);
- }
- log("GUI Settings loaded!");
- if(walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else{
- isRunning = "No";
- }
- vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
- vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
- profitPrice = vialFilledPrice - vialEmptyPrice;
- if(!save){
- startTime = System.currentTimeMillis();
- }
- else{
- startTime = 0;
- }
- return true;
- }
- @Override
- public void onFinish(){
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- }
- public void useItem(RSItem item, RSObject object){
- if(item != null && object != null && object.isOnScreen()){
- item.doClick(true);
- sleep(200, 300);
- object.doClick();
- }
- }
- public void fillVials(){
- if(fountain != null){
- status = "Filling Vials";
- useItem(myVial, fountain);
- while(inventory.contains(emptyVialID)){
- sleep(random(1000,1500));
- if(antiban){
- if(random(1, 3) == 2){
- mouse.moveSlightly();
- }
- }
- }
- status = "Vials filled";
- }
- else{
- status = "Fountain is null...retrying";
- sleep(random(600, 800));
- }
- }
- private void doBank(){
- try{
- if(banker != null){
- camera.turnTo(banker);
- if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
- status = "Opening Bank";
- banker.interact("Bank Banker");
- status = "Bank opened";
- sleep(random(900, 1050));
- status = "Depositing All";
- bank.depositAll();
- status = "Deposited All";
- sleep(random(780, 950));
- numFilled = bank.getCount(fullVialID);
- if(bank.getCount(emptyVialID) != 0){
- status = "Taking Vials";
- bank.withdraw(emptyVialID, 0);
- status = "Vials Taken";
- sleep(random(700, 960));
- }
- else{
- log("Out of vials. Quitting :/");
- bank.close();
- env.saveScreenshot(true);
- log("^ Don't forget to upload this proggie :P");
- log("Bye! PM Painlaws for comments/questions/requests");
- stopScript(true);
- }
- status = "Closing Bank";
- bank.close();
- status = "Bank Closed";
- sleep(random(750, 910));
- }
- }
- sleep(random(300,500));
- }catch(Exception e){log(e);}
- }
- public void onToBank(){
- try{
- status = "Going to Bank";
- walking.walkTileMM(theBank);
- }catch(Exception e){log(e);}
- sleep(random(500, 700));
- }
- public void onToGlitch(){
- try{
- status = "Going to Fountain"; //What you don't know can't hurt you :P
- walking.walkTileMM(glitchSpot);
- }catch(Exception e){log(e);}
- sleep(random(500, 710));
- }
- public void onToFountain(){
- try{
- status = "Going to Fountain";
- walking.walkTileMM(theFountain);
- }catch(Exception e){log(e);}
- sleep(random(500, 705));
- }
- public void runcheck() {
- try{
- runEnergy = (random(50, 70));
- if (walking.isRunEnabled()){
- isRunning = "Yes";
- }
- else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
- walking.setRun(true);
- isRunning = "Yes";
- sleep(random(300, 500));
- }
- else{
- isRunning = "No";
- sleep(random(300,500));
- }
- }catch(Exception ex){}
- }
- @Override
- public int loop(){
- mouse.setSpeed(random(minSpeed, maxSpeed));
- runcheck();
- if(antiban){
- if(random(min, max) == 3){
- antiban();
- }
- }
- if(objects.getNearest(fountainID) != null){
- fountain = objects.getNearest(fountainID);
- }
- if(npcs.getNearest(bankerID) != null){
- banker = npcs.getNearest(bankerID);
- }
- if(inventory.getItem(emptyVialID) != null){
- myVial = inventory.getItem(emptyVialID);
- }
- switch(getState()){
- case TOFOUNTAIN:
- runcheck();
- onToFountain();
- if(fountainRange.contains(players.getMyPlayer().getLocation())){
- fillVials();
- }
- break;
- case TOGLITCH:
- runcheck();
- onToGlitch();
- break;
- case TOBANK:
- runcheck();
- onToBank();
- if(bankRange.contains(players.getMyPlayer().getLocation())){
- doBank();
- }
- break;
- }
- return(random(500, 1000));
- }
- private State getState() {
- if (!inventory.contains(emptyVialID)) {
- return State.TOBANK;
- }
- else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
- return State.TOGLITCH;
- }
- else{
- return State.TOFOUNTAIN;
- }
- }
- // GUI and Mouse
- public void onRepaint(Graphics g1) {
- profit = numFilled * profitPrice;
- if(!save){
- 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;
- if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
- profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- profHour = profSec * 3600;
- hourlyProfit = profHour * profitPrice;
- hourlyProfitInt = Math.round(hourlyProfit);
- }
- else{
- millis = 0;
- hours = 0;
- minutes = 0;
- seconds = 0;
- hourlyProfitInt = 9001;
- }
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(7, 345, 488, 70);
- g.setStroke(stroke1);
- g.drawRect(7, 345, 488, 70);
- g.setFont(font1);
- g.setColor(color2);
- g.drawString("Status:", 14, 362);
- g.setFont(font2);
- g.drawString(status, 59, 362);
- g.setFont(font1);
- g.drawString("Filled Vials In Bank:", 209, 362);
- g.setFont(font2);
- g.drawString(Integer.toString(numFilled), 328, 362);
- g.setFont(font1);
- g.drawString("Profit:", 14, 383);
- g.setFont(font2);
- g.drawString(Integer.toString(profit), 59, 383);
- g.setFont(font1);
- g.drawString("Profit/hr:", 137, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
- }
- else{
- g.drawString("Mem Save", 190, 383);
- }
- g.setFont(font1);
- g.drawString("Runtime:", 270, 383);
- g.setFont(font2);
- if(!save){
- g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
- }
- else{
- g.drawString("Mem Save", 325, 384);
- }
- g.setFont(font1);
- g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
- g.drawString("Running:", 710, 139);
- g.setFont(font2);
- g.drawString(isRunning, 722, 156);
- g.setFont(font3);
- g.drawString("Painlaws", 440, 357);
- g1.setColor(Color.green);
- g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
- g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
- }
- /* Antiban stuff
- * Some credits to Aaimister :)
- * Partially copied, with permission
- */
- public void rotateCamera() {
- final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- final int randomLR = random(0, 2);
- final int randomUD = random(0, 2);
- final int randomAll = random(0, 4);
- if (random(0, 3) == 0) {
- keyboard.pressKey(LR[randomLR]);
- sleepCR(random(2, 9));
- keyboard.pressKey(UD[randomUD]);
- sleepCR(random(6, 10));
- keyboard.releaseKey(UD[randomUD]);
- sleepCR(random(2, 7));
- keyboard.releaseKey(LR[randomLR]);
- } else {
- keyboard.pressKey(LRUD[randomAll]);
- if (randomAll > 1) {
- sleepCR(random(6, 11));
- } else {
- sleepCR(random(9, 12));
- }
- keyboard.releaseKey(LRUD[randomAll]);
- }
- }
- private boolean sleepCR(final int amtOfHalfSecs) {
- for (int x = 0; x < amtOfHalfSecs + 1; x++) {
- sleep(random(48, 53));
- }
- return true;
- }
- private void antiban(){
- int action = random(0, 5);
- switch (action) {
- case 0:
- status = "Antiban";
- rotateCamera();
- sleep(200, 400);
- break;
- case 1:
- status = "Antiban";
- mouse.moveRandomly(100, 900);
- sleep(200, 400);
- break;
- case 2:
- status = "Antiban";
- mouse.moveSlightly();
- sleep(200, 400);
- break;
- case 3:
- status = "Antiban";
- camera.moveRandomly(random(750,1250));
- sleep(200, 400);
- break;
- case 4:
- status = "Antiban";
- checkEXP();
- sleep(200, 400);
- break;
- case 5:
- status = "Antiban";
- mouse.moveOffScreen();
- sleep(200, 400);
- break;
- }
- }
- public void checkEXP() {
- game.openTab(Game.Tab.STATS);
- skills.doHover(Skills.INTERFACE_PRAYER);
- sleep(random(2100, 3400));
- game.openTab(Game.Tab.INVENTORY);
- sleep(random(540,760));
- }
- class gui extends JFrame {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- public gui() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e){
- String mode = selectionBox.getSelectedItem().toString();
- if(mode.equals("Maximum")){
- antiban = false;
- minSpeed = 5;
- maxSpeed = 6;
- }
- else if(mode.equals("Paranoid")){
- antiban = true;
- minSpeed = 8;
- maxSpeed = 10;
- min = 3;
- max = 3;
- }
- save = memoryMode.isSelected();
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- label1 = new JLabel();
- selectionBox = new JComboBox();
- memoryMode = new JCheckBox();
- label2 = new JLabel();
- label3 = new JLabel();
- label4 = new JLabel();
- label5 = new JLabel();
- startButton = new JButton();
- //======== this ========
- setTitle("Painlaws's Vial Filler");
- setResizable(false);
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Mode");
- //---- selectionBox ----
- selectionBox.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Paranoid",
- "Maximum"
- }));
- //---- memoryMode ----
- memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
- //---- label2 ----
- label2.setText("Modes:");
- //---- label3 ----
- label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
- //---- label4 ----
- label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
- //---- label5 ----
- label5.setText("Maximum - No Antiban, Fast Mouse Speed");
- //---- startButton ----
- startButton.setText("Let's Fill Some Vials!");
- startButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e){
- startButtonActionPerformed(e);
- }
- });
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
- .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addGap(148, 148, 148)
- .addComponent(startButton)))
- .addContainerGap(2, Short.MAX_VALUE))
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(label1)
- .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addComponent(memoryMode)
- .addGap(18, 18, 18)
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label4)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label5)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
- .addComponent(startButton)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- private JLabel label1;
- private JComboBox selectionBox;
- private JCheckBox memoryMode;
- private JLabel label2;
- private JLabel label3;
- private JLabel label4;
- private JLabel label5;
- private JButton startButton;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement