Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 409.47 KB | None | 0 0
  1. import java.awt.*;
  2. import java.awt.event.*;
  3. import javax.swing.*;
  4. import java.awt.event.KeyEvent;
  5. import org.rsbot.event.listeners.PaintListener;
  6. import org.rsbot.script.Script;
  7. import org.rsbot.script.ScriptManifest;
  8. import org.rsbot.script.methods.*;
  9. import org.rsbot.script.wrappers.*;
  10.  
  11. @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
  12. public class vialfiller extends Script implements PaintListener{
  13. //Variables
  14. // - Essentials
  15. private int bankerID = 6533;
  16. private int fountainID = 24214;
  17. private int emptyVialID = 229;
  18. private int fullVialID = 227;
  19. private int runEnergy = 50;
  20. RSNPC banker;
  21. RSObject fountain;
  22. RSItem myVial;
  23. RSTile theBank = new RSTile(3167, 3489);
  24. RSTile theFountain = new RSTile(3191, 3471);
  25. RSTile glitchSpot = new RSTile(3192, 3487);
  26. RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
  27. RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
  28. RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
  29. RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
  30.  
  31. // - GUI Options
  32. private int min = 1;
  33. private int max = 6;
  34. private int minSpeed = 6;
  35. private int maxSpeed = 9;
  36. private boolean guiWait = true;
  37. private boolean save = false;
  38.  
  39. // - State check
  40. private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
  41.  
  42. // - Paint stuff
  43. private String status = "Initializing...";
  44. private String isRunning = "";
  45. private int numFilled = 0;
  46. private int vialFilledPrice;
  47. private int vialEmptyPrice;
  48. private int profitPrice;
  49. private int profit;
  50. private long startTime;
  51. private long millis;
  52. private long hours;
  53. private long minutes;
  54. private long seconds;
  55. private float profSec = 0;
  56. private float profHour;
  57. private float hourlyProfit;
  58. private int hourlyProfitInt;
  59. private final Color color1 = new Color(0, 0, 0);
  60. private final Color color2 = new Color(255, 255, 255);
  61. private final BasicStroke stroke1 = new BasicStroke(1);
  62. private final Font font1 = new Font("Arial", 0, 13);
  63. private final Font font2 = new Font("Arial", 1, 13);
  64. private final Font font3 = new Font("Vijaya", 1, 17);
  65. private boolean antiban = true;
  66. gui g = new gui();
  67.  
  68. @Override
  69. public boolean onStart(){
  70. log("Welcome to Painlaws's Vial Filler");
  71. log("Waiting on GUI...");
  72. g.setVisible(true);
  73. while(guiWait){
  74. sleep(500);
  75. }
  76. log("GUI Settings loaded!");
  77. if(walking.isRunEnabled()){
  78. isRunning = "Yes";
  79. }
  80. else{
  81. isRunning = "No";
  82. }
  83. vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
  84. vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
  85. profitPrice = vialFilledPrice - vialEmptyPrice;
  86. if(!save){
  87. startTime = System.currentTimeMillis();
  88. }
  89. else{
  90. startTime = 0;
  91. }
  92. return true;
  93. }
  94.  
  95. @Override
  96. public void onFinish(){
  97. env.saveScreenshot(true);
  98. log("^ Don't forget to upload this proggie :P");
  99. log("Bye! PM Painlaws for comments/questions/requests");
  100. }
  101.  
  102. public void useItem(RSItem item, RSObject object){
  103. if(item != null && object != null && object.isOnScreen()){
  104. item.doClick(true);
  105. sleep(200, 300);
  106. object.doClick();
  107. }
  108. }
  109.  
  110. public void fillVials(){
  111. if(fountain != null){
  112. status = "Filling Vials";
  113. useItem(myVial, fountain);
  114. while(inventory.contains(emptyVialID)){
  115. sleep(random(1000,1500));
  116. if(antiban){
  117. if(random(1, 3) == 2){
  118. mouse.moveSlightly();
  119. }
  120. }
  121. }
  122. status = "Vials filled";
  123. }
  124. else{
  125. status = "Fountain is null...retrying";
  126. sleep(random(600, 800));
  127. }
  128. }
  129.  
  130. private void doBank(){
  131. try{
  132. if(banker != null){
  133. camera.turnTo(banker);
  134. if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
  135. status = "Opening Bank";
  136. banker.interact("Bank Banker");
  137. status = "Bank opened";
  138. sleep(random(900, 1050));
  139. status = "Depositing All";
  140. bank.depositAll();
  141. status = "Deposited All";
  142. sleep(random(780, 950));
  143. numFilled = bank.getCount(fullVialID);
  144. if(bank.getCount(emptyVialID) != 0){
  145. status = "Taking Vials";
  146. bank.withdraw(emptyVialID, 0);
  147. status = "Vials Taken";
  148. sleep(random(700, 960));
  149. }
  150. else{
  151. log("Out of vials. Quitting :/");
  152. bank.close();
  153. env.saveScreenshot(true);
  154. log("^ Don't forget to upload this proggie :P");
  155. log("Bye! PM Painlaws for comments/questions/requests");
  156. stopScript(true);
  157. }
  158. status = "Closing Bank";
  159. bank.close();
  160. status = "Bank Closed";
  161. sleep(random(750, 910));
  162. }
  163. }
  164. sleep(random(300,500));
  165. }catch(Exception e){log(e);}
  166. }
  167.  
  168. public void onToBank(){
  169. try{
  170. status = "Going to Bank";
  171. walking.walkTileMM(theBank);
  172. }catch(Exception e){log(e);}
  173. sleep(random(500, 700));
  174. }
  175.  
  176. public void onToGlitch(){
  177. try{
  178. status = "Going to Fountain"; //What you don't know can't hurt you :P
  179. walking.walkTileMM(glitchSpot);
  180. }catch(Exception e){log(e);}
  181. sleep(random(500, 710));
  182. }
  183.  
  184. public void onToFountain(){
  185. try{
  186. status = "Going to Fountain";
  187. walking.walkTileMM(theFountain);
  188. }catch(Exception e){log(e);}
  189. sleep(random(500, 705));
  190. }
  191.  
  192. public void runcheck() {
  193. try{
  194. runEnergy = (random(50, 70));
  195. if (walking.isRunEnabled()){
  196. isRunning = "Yes";
  197. }
  198. else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
  199. walking.setRun(true);
  200. isRunning = "Yes";
  201. sleep(random(300, 500));
  202. }
  203. else{
  204. isRunning = "No";
  205. sleep(random(300,500));
  206. }
  207. }catch(Exception ex){}
  208. }
  209.  
  210. @Override
  211. public int loop(){
  212. mouse.setSpeed(random(minSpeed, maxSpeed));
  213. runcheck();
  214. if(antiban){
  215. if(random(min, max) == 3){
  216. antiban();
  217. }
  218. }
  219. if(objects.getNearest(fountainID) != null){
  220. fountain = objects.getNearest(fountainID);
  221. }
  222. if(npcs.getNearest(bankerID) != null){
  223. banker = npcs.getNearest(bankerID);
  224. }
  225. if(inventory.getItem(emptyVialID) != null){
  226. myVial = inventory.getItem(emptyVialID);
  227. }
  228. switch(getState()){
  229. case TOFOUNTAIN:
  230. runcheck();
  231. onToFountain();
  232. if(fountainRange.contains(players.getMyPlayer().getLocation())){
  233. fillVials();
  234. }
  235. break;
  236.  
  237. case TOGLITCH:
  238. runcheck();
  239. onToGlitch();
  240. break;
  241.  
  242. case TOBANK:
  243. runcheck();
  244. onToBank();
  245. if(bankRange.contains(players.getMyPlayer().getLocation())){
  246. doBank();
  247. }
  248. break;
  249. }
  250. return(random(500, 1000));
  251. }
  252.  
  253. private State getState() {
  254. if (!inventory.contains(emptyVialID)) {
  255. return State.TOBANK;
  256. }
  257. else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
  258. return State.TOGLITCH;
  259. }
  260. else{
  261. return State.TOFOUNTAIN;
  262. }
  263. }
  264.  
  265. // GUI and Mouse
  266. public void onRepaint(Graphics g1) {
  267. profit = numFilled * profitPrice;
  268. if(!save){
  269. millis = System.currentTimeMillis() - startTime;
  270. hours = millis / (1000 * 60 * 60);
  271. millis -= hours * (1000 * 60 * 60);
  272. minutes = millis / (1000 * 60);
  273. millis -= minutes * (1000 * 60);
  274. seconds = millis / 1000;
  275.  
  276. if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
  277. profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
  278. }
  279. profHour = profSec * 3600;
  280. hourlyProfit = profHour * profitPrice;
  281. hourlyProfitInt = Math.round(hourlyProfit);
  282. }
  283. else{
  284. millis = 0;
  285. hours = 0;
  286. minutes = 0;
  287. seconds = 0;
  288. hourlyProfitInt = 9001;
  289. }
  290.  
  291. Graphics2D g = (Graphics2D)g1;
  292. g.setColor(color1);
  293. g.fillRect(7, 345, 488, 70);
  294. g.setStroke(stroke1);
  295. g.drawRect(7, 345, 488, 70);
  296. g.setFont(font1);
  297. g.setColor(color2);
  298. g.drawString("Status:", 14, 362);
  299. g.setFont(font2);
  300. g.drawString(status, 59, 362);
  301. g.setFont(font1);
  302. g.drawString("Filled Vials In Bank:", 209, 362);
  303. g.setFont(font2);
  304. g.drawString(Integer.toString(numFilled), 328, 362);
  305. g.setFont(font1);
  306. g.drawString("Profit:", 14, 383);
  307. g.setFont(font2);
  308. g.drawString(Integer.toString(profit), 59, 383);
  309. g.setFont(font1);
  310. g.drawString("Profit/hr:", 137, 383);
  311. g.setFont(font2);
  312. if(!save){
  313. g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
  314. }
  315. else{
  316. g.drawString("Mem Save", 190, 383);
  317. }
  318. g.setFont(font1);
  319. g.drawString("Runtime:", 270, 383);
  320. g.setFont(font2);
  321. if(!save){
  322. g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
  323. }
  324. else{
  325. g.drawString("Mem Save", 325, 384);
  326. }
  327. g.setFont(font1);
  328. g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
  329. g.drawString("Running:", 710, 139);
  330. g.setFont(font2);
  331. g.drawString(isRunning, 722, 156);
  332. g.setFont(font3);
  333. g.drawString("Painlaws", 440, 357);
  334.  
  335. g1.setColor(Color.green);
  336. g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
  337. g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
  338. }
  339.  
  340. /* Antiban stuff
  341. * Some credits to Aaimister :)
  342. * Partially copied, with permission
  343. */
  344.  
  345. public void rotateCamera() {
  346. final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  347. final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  348. final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  349. KeyEvent.VK_UP, KeyEvent.VK_UP };
  350. final int randomLR = random(0, 2);
  351. final int randomUD = random(0, 2);
  352. final int randomAll = random(0, 4);
  353. if (random(0, 3) == 0) {
  354. keyboard.pressKey(LR[randomLR]);
  355. sleepCR(random(2, 9));
  356. keyboard.pressKey(UD[randomUD]);
  357. sleepCR(random(6, 10));
  358. keyboard.releaseKey(UD[randomUD]);
  359. sleepCR(random(2, 7));
  360. keyboard.releaseKey(LR[randomLR]);
  361. } else {
  362. keyboard.pressKey(LRUD[randomAll]);
  363. if (randomAll > 1) {
  364. sleepCR(random(6, 11));
  365. } else {
  366. sleepCR(random(9, 12));
  367. }
  368. keyboard.releaseKey(LRUD[randomAll]);
  369. }
  370. }
  371.  
  372. private boolean sleepCR(final int amtOfHalfSecs) {
  373. for (int x = 0; x < amtOfHalfSecs + 1; x++) {
  374. sleep(random(48, 53));
  375. }
  376. return true;
  377. }
  378.  
  379. private void antiban(){
  380. int action = random(0, 5);
  381.  
  382. switch (action) {
  383. case 0:
  384. status = "Antiban";
  385. rotateCamera();
  386. sleep(200, 400);
  387. break;
  388. case 1:
  389. status = "Antiban";
  390. mouse.moveRandomly(100, 900);
  391. sleep(200, 400);
  392. break;
  393. case 2:
  394. status = "Antiban";
  395. mouse.moveSlightly();
  396. sleep(200, 400);
  397. break;
  398. case 3:
  399. status = "Antiban";
  400. camera.moveRandomly(random(750,1250));
  401. sleep(200, 400);
  402. break;
  403. case 4:
  404. status = "Antiban";
  405. checkEXP();
  406. sleep(200, 400);
  407. break;
  408. case 5:
  409. status = "Antiban";
  410. mouse.moveOffScreen();
  411. sleep(200, 400);
  412. break;
  413. }
  414. }
  415.  
  416. public void checkEXP() {
  417. game.openTab(Game.Tab.STATS);
  418. skills.doHover(Skills.INTERFACE_PRAYER);
  419. sleep(random(2100, 3400));
  420. game.openTab(Game.Tab.INVENTORY);
  421. sleep(random(540,760));
  422. }
  423.  
  424.  
  425. class gui extends JFrame {
  426. /**
  427. *
  428. */
  429. private static final long serialVersionUID = 1L;
  430. public gui() {
  431. initComponents();
  432. }
  433.  
  434. private void startButtonActionPerformed(ActionEvent e){
  435. String mode = selectionBox.getSelectedItem().toString();
  436. if(mode.equals("Maximum")){
  437. antiban = false;
  438. minSpeed = 5;
  439. maxSpeed = 6;
  440. }
  441. else if(mode.equals("Paranoid")){
  442. antiban = true;
  443. minSpeed = 8;
  444. maxSpeed = 10;
  445. min = 3;
  446. max = 3;
  447.  
  448. }
  449. save = memoryMode.isSelected();
  450. guiWait = false;
  451. g.dispose();
  452. }
  453.  
  454. private void initComponents() {
  455. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  456. label1 = new JLabel();
  457. selectionBox = new JComboBox();
  458. memoryMode = new JCheckBox();
  459. label2 = new JLabel();
  460. label3 = new JLabel();
  461. label4 = new JLabel();
  462. label5 = new JLabel();
  463. startButton = new JButton();
  464.  
  465. //======== this ========
  466. setTitle("Painlaws's Vial Filler");
  467. setResizable(false);
  468. Container contentPane = getContentPane();
  469.  
  470. //---- label1 ----
  471. label1.setText("Mode");
  472.  
  473. //---- selectionBox ----
  474. selectionBox.setModel(new DefaultComboBoxModel(new String[] {
  475. "Normal",
  476. "Paranoid",
  477. "Maximum"
  478. }));
  479.  
  480. //---- memoryMode ----
  481. memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
  482.  
  483. //---- label2 ----
  484. label2.setText("Modes:");
  485.  
  486. //---- label3 ----
  487. label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
  488.  
  489. //---- label4 ----
  490. label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
  491.  
  492. //---- label5 ----
  493. label5.setText("Maximum - No Antiban, Fast Mouse Speed");
  494.  
  495. //---- startButton ----
  496. startButton.setText("Let's Fill Some Vials!");
  497. startButton.addActionListener(new ActionListener() {
  498. public void actionPerformed(ActionEvent e){
  499. startButtonActionPerformed(e);
  500. }
  501. });
  502.  
  503. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  504. contentPane.setLayout(contentPaneLayout);
  505. contentPaneLayout.setHorizontalGroup(
  506. contentPaneLayout.createParallelGroup()
  507. .addGroup(contentPaneLayout.createSequentialGroup()
  508. .addGroup(contentPaneLayout.createParallelGroup()
  509. .addGroup(contentPaneLayout.createSequentialGroup()
  510. .addContainerGap()
  511. .addGroup(contentPaneLayout.createParallelGroup()
  512. .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  513. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  514. .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  515. .addGroup(contentPaneLayout.createSequentialGroup()
  516. .addComponent(label1)
  517. .addGap(18, 18, 18)
  518. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  519. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  520. .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  521. .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  522. .addGroup(contentPaneLayout.createSequentialGroup()
  523. .addGap(148, 148, 148)
  524. .addComponent(startButton)))
  525. .addContainerGap(2, Short.MAX_VALUE))
  526. );
  527. contentPaneLayout.setVerticalGroup(
  528. contentPaneLayout.createParallelGroup()
  529. .addGroup(contentPaneLayout.createSequentialGroup()
  530. .addContainerGap()
  531. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  532. .addComponent(label1)
  533. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  534. .addGap(18, 18, 18)
  535. .addComponent(memoryMode)
  536. .addGap(18, 18, 18)
  537. .addComponent(label2)
  538. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  539. .addComponent(label3)
  540. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  541. .addComponent(label4)
  542. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  543. .addComponent(label5)
  544. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
  545. .addComponent(startButton)
  546. .addContainerGap())
  547. );
  548. pack();
  549. setLocationRelativeTo(getOwner());
  550. // JFormDesigner - End of component initialization //GEN-END:initComponents
  551. }
  552.  
  553. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  554. private JLabel label1;
  555. private JComboBox selectionBox;
  556. private JCheckBox memoryMode;
  557. private JLabel label2;
  558. private JLabel label3;
  559. private JLabel label4;
  560. private JLabel label5;
  561. private JButton startButton;
  562. // JFormDesigner - End of variables declaration //GEN-END:variables
  563. }
  564.  
  565.  
  566. }
  567. import java.awt.*;
  568. import java.awt.event.*;
  569. import javax.swing.*;
  570. import java.awt.event.KeyEvent;
  571. import org.rsbot.event.listeners.PaintListener;
  572. import org.rsbot.script.Script;
  573. import org.rsbot.script.ScriptManifest;
  574. import org.rsbot.script.methods.*;
  575. import org.rsbot.script.wrappers.*;
  576.  
  577. @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
  578. public class vialfiller extends Script implements PaintListener{
  579. //Variables
  580. // - Essentials
  581. private int bankerID = 6533;
  582. private int fountainID = 24214;
  583. private int emptyVialID = 229;
  584. private int fullVialID = 227;
  585. private int runEnergy = 50;
  586. RSNPC banker;
  587. RSObject fountain;
  588. RSItem myVial;
  589. RSTile theBank = new RSTile(3167, 3489);
  590. RSTile theFountain = new RSTile(3191, 3471);
  591. RSTile glitchSpot = new RSTile(3192, 3487);
  592. RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
  593. RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
  594. RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
  595. RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
  596.  
  597. // - GUI Options
  598. private int min = 1;
  599. private int max = 6;
  600. private int minSpeed = 6;
  601. private int maxSpeed = 9;
  602. private boolean guiWait = true;
  603. private boolean save = false;
  604.  
  605. // - State check
  606. private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
  607.  
  608. // - Paint stuff
  609. private String status = "Initializing...";
  610. private String isRunning = "";
  611. private int numFilled = 0;
  612. private int vialFilledPrice;
  613. private int vialEmptyPrice;
  614. private int profitPrice;
  615. private int profit;
  616. private long startTime;
  617. private long millis;
  618. private long hours;
  619. private long minutes;
  620. private long seconds;
  621. private float profSec = 0;
  622. private float profHour;
  623. private float hourlyProfit;
  624. private int hourlyProfitInt;
  625. private final Color color1 = new Color(0, 0, 0);
  626. private final Color color2 = new Color(255, 255, 255);
  627. private final BasicStroke stroke1 = new BasicStroke(1);
  628. private final Font font1 = new Font("Arial", 0, 13);
  629. private final Font font2 = new Font("Arial", 1, 13);
  630. private final Font font3 = new Font("Vijaya", 1, 17);
  631. private boolean antiban = true;
  632. gui g = new gui();
  633.  
  634. @Override
  635. public boolean onStart(){
  636. log("Welcome to Painlaws's Vial Filler");
  637. log("Waiting on GUI...");
  638. g.setVisible(true);
  639. while(guiWait){
  640. sleep(500);
  641. }
  642. log("GUI Settings loaded!");
  643. if(walking.isRunEnabled()){
  644. isRunning = "Yes";
  645. }
  646. else{
  647. isRunning = "No";
  648. }
  649. vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
  650. vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
  651. profitPrice = vialFilledPrice - vialEmptyPrice;
  652. if(!save){
  653. startTime = System.currentTimeMillis();
  654. }
  655. else{
  656. startTime = 0;
  657. }
  658. return true;
  659. }
  660.  
  661. @Override
  662. public void onFinish(){
  663. env.saveScreenshot(true);
  664. log("^ Don't forget to upload this proggie :P");
  665. log("Bye! PM Painlaws for comments/questions/requests");
  666. }
  667.  
  668. public void useItem(RSItem item, RSObject object){
  669. if(item != null && object != null && object.isOnScreen()){
  670. item.doClick(true);
  671. sleep(200, 300);
  672. object.doClick();
  673. }
  674. }
  675.  
  676. public void fillVials(){
  677. if(fountain != null){
  678. status = "Filling Vials";
  679. useItem(myVial, fountain);
  680. while(inventory.contains(emptyVialID)){
  681. sleep(random(1000,1500));
  682. if(antiban){
  683. if(random(1, 3) == 2){
  684. mouse.moveSlightly();
  685. }
  686. }
  687. }
  688. status = "Vials filled";
  689. }
  690. else{
  691. status = "Fountain is null...retrying";
  692. sleep(random(600, 800));
  693. }
  694. }
  695.  
  696. private void doBank(){
  697. try{
  698. if(banker != null){
  699. camera.turnTo(banker);
  700. if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
  701. status = "Opening Bank";
  702. banker.interact("Bank Banker");
  703. status = "Bank opened";
  704. sleep(random(900, 1050));
  705. status = "Depositing All";
  706. bank.depositAll();
  707. status = "Deposited All";
  708. sleep(random(780, 950));
  709. numFilled = bank.getCount(fullVialID);
  710. if(bank.getCount(emptyVialID) != 0){
  711. status = "Taking Vials";
  712. bank.withdraw(emptyVialID, 0);
  713. status = "Vials Taken";
  714. sleep(random(700, 960));
  715. }
  716. else{
  717. log("Out of vials. Quitting :/");
  718. bank.close();
  719. env.saveScreenshot(true);
  720. log("^ Don't forget to upload this proggie :P");
  721. log("Bye! PM Painlaws for comments/questions/requests");
  722. stopScript(true);
  723. }
  724. status = "Closing Bank";
  725. bank.close();
  726. status = "Bank Closed";
  727. sleep(random(750, 910));
  728. }
  729. }
  730. sleep(random(300,500));
  731. }catch(Exception e){log(e);}
  732. }
  733.  
  734. public void onToBank(){
  735. try{
  736. status = "Going to Bank";
  737. walking.walkTileMM(theBank);
  738. }catch(Exception e){log(e);}
  739. sleep(random(500, 700));
  740. }
  741.  
  742. public void onToGlitch(){
  743. try{
  744. status = "Going to Fountain"; //What you don't know can't hurt you :P
  745. walking.walkTileMM(glitchSpot);
  746. }catch(Exception e){log(e);}
  747. sleep(random(500, 710));
  748. }
  749.  
  750. public void onToFountain(){
  751. try{
  752. status = "Going to Fountain";
  753. walking.walkTileMM(theFountain);
  754. }catch(Exception e){log(e);}
  755. sleep(random(500, 705));
  756. }
  757.  
  758. public void runcheck() {
  759. try{
  760. runEnergy = (random(50, 70));
  761. if (walking.isRunEnabled()){
  762. isRunning = "Yes";
  763. }
  764. else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
  765. walking.setRun(true);
  766. isRunning = "Yes";
  767. sleep(random(300, 500));
  768. }
  769. else{
  770. isRunning = "No";
  771. sleep(random(300,500));
  772. }
  773. }catch(Exception ex){}
  774. }
  775.  
  776. @Override
  777. public int loop(){
  778. mouse.setSpeed(random(minSpeed, maxSpeed));
  779. runcheck();
  780. if(antiban){
  781. if(random(min, max) == 3){
  782. antiban();
  783. }
  784. }
  785. if(objects.getNearest(fountainID) != null){
  786. fountain = objects.getNearest(fountainID);
  787. }
  788. if(npcs.getNearest(bankerID) != null){
  789. banker = npcs.getNearest(bankerID);
  790. }
  791. if(inventory.getItem(emptyVialID) != null){
  792. myVial = inventory.getItem(emptyVialID);
  793. }
  794. switch(getState()){
  795. case TOFOUNTAIN:
  796. runcheck();
  797. onToFountain();
  798. if(fountainRange.contains(players.getMyPlayer().getLocation())){
  799. fillVials();
  800. }
  801. break;
  802.  
  803. case TOGLITCH:
  804. runcheck();
  805. onToGlitch();
  806. break;
  807.  
  808. case TOBANK:
  809. runcheck();
  810. onToBank();
  811. if(bankRange.contains(players.getMyPlayer().getLocation())){
  812. doBank();
  813. }
  814. break;
  815. }
  816. return(random(500, 1000));
  817. }
  818.  
  819. private State getState() {
  820. if (!inventory.contains(emptyVialID)) {
  821. return State.TOBANK;
  822. }
  823. else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
  824. return State.TOGLITCH;
  825. }
  826. else{
  827. return State.TOFOUNTAIN;
  828. }
  829. }
  830.  
  831. // GUI and Mouse
  832. public void onRepaint(Graphics g1) {
  833. profit = numFilled * profitPrice;
  834. if(!save){
  835. millis = System.currentTimeMillis() - startTime;
  836. hours = millis / (1000 * 60 * 60);
  837. millis -= hours * (1000 * 60 * 60);
  838. minutes = millis / (1000 * 60);
  839. millis -= minutes * (1000 * 60);
  840. seconds = millis / 1000;
  841.  
  842. if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
  843. profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
  844. }
  845. profHour = profSec * 3600;
  846. hourlyProfit = profHour * profitPrice;
  847. hourlyProfitInt = Math.round(hourlyProfit);
  848. }
  849. else{
  850. millis = 0;
  851. hours = 0;
  852. minutes = 0;
  853. seconds = 0;
  854. hourlyProfitInt = 9001;
  855. }
  856.  
  857. Graphics2D g = (Graphics2D)g1;
  858. g.setColor(color1);
  859. g.fillRect(7, 345, 488, 70);
  860. g.setStroke(stroke1);
  861. g.drawRect(7, 345, 488, 70);
  862. g.setFont(font1);
  863. g.setColor(color2);
  864. g.drawString("Status:", 14, 362);
  865. g.setFont(font2);
  866. g.drawString(status, 59, 362);
  867. g.setFont(font1);
  868. g.drawString("Filled Vials In Bank:", 209, 362);
  869. g.setFont(font2);
  870. g.drawString(Integer.toString(numFilled), 328, 362);
  871. g.setFont(font1);
  872. g.drawString("Profit:", 14, 383);
  873. g.setFont(font2);
  874. g.drawString(Integer.toString(profit), 59, 383);
  875. g.setFont(font1);
  876. g.drawString("Profit/hr:", 137, 383);
  877. g.setFont(font2);
  878. if(!save){
  879. g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
  880. }
  881. else{
  882. g.drawString("Mem Save", 190, 383);
  883. }
  884. g.setFont(font1);
  885. g.drawString("Runtime:", 270, 383);
  886. g.setFont(font2);
  887. if(!save){
  888. g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
  889. }
  890. else{
  891. g.drawString("Mem Save", 325, 384);
  892. }
  893. g.setFont(font1);
  894. g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
  895. g.drawString("Running:", 710, 139);
  896. g.setFont(font2);
  897. g.drawString(isRunning, 722, 156);
  898. g.setFont(font3);
  899. g.drawString("Painlaws", 440, 357);
  900.  
  901. g1.setColor(Color.green);
  902. g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
  903. g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
  904. }
  905.  
  906. /* Antiban stuff
  907. * Some credits to Aaimister :)
  908. * Partially copied, with permission
  909. */
  910.  
  911. public void rotateCamera() {
  912. final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  913. final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  914. final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  915. KeyEvent.VK_UP, KeyEvent.VK_UP };
  916. final int randomLR = random(0, 2);
  917. final int randomUD = random(0, 2);
  918. final int randomAll = random(0, 4);
  919. if (random(0, 3) == 0) {
  920. keyboard.pressKey(LR[randomLR]);
  921. sleepCR(random(2, 9));
  922. keyboard.pressKey(UD[randomUD]);
  923. sleepCR(random(6, 10));
  924. keyboard.releaseKey(UD[randomUD]);
  925. sleepCR(random(2, 7));
  926. keyboard.releaseKey(LR[randomLR]);
  927. } else {
  928. keyboard.pressKey(LRUD[randomAll]);
  929. if (randomAll > 1) {
  930. sleepCR(random(6, 11));
  931. } else {
  932. sleepCR(random(9, 12));
  933. }
  934. keyboard.releaseKey(LRUD[randomAll]);
  935. }
  936. }
  937.  
  938. private boolean sleepCR(final int amtOfHalfSecs) {
  939. for (int x = 0; x < amtOfHalfSecs + 1; x++) {
  940. sleep(random(48, 53));
  941. }
  942. return true;
  943. }
  944.  
  945. private void antiban(){
  946. int action = random(0, 5);
  947.  
  948. switch (action) {
  949. case 0:
  950. status = "Antiban";
  951. rotateCamera();
  952. sleep(200, 400);
  953. break;
  954. case 1:
  955. status = "Antiban";
  956. mouse.moveRandomly(100, 900);
  957. sleep(200, 400);
  958. break;
  959. case 2:
  960. status = "Antiban";
  961. mouse.moveSlightly();
  962. sleep(200, 400);
  963. break;
  964. case 3:
  965. status = "Antiban";
  966. camera.moveRandomly(random(750,1250));
  967. sleep(200, 400);
  968. break;
  969. case 4:
  970. status = "Antiban";
  971. checkEXP();
  972. sleep(200, 400);
  973. break;
  974. case 5:
  975. status = "Antiban";
  976. mouse.moveOffScreen();
  977. sleep(200, 400);
  978. break;
  979. }
  980. }
  981.  
  982. public void checkEXP() {
  983. game.openTab(Game.Tab.STATS);
  984. skills.doHover(Skills.INTERFACE_PRAYER);
  985. sleep(random(2100, 3400));
  986. game.openTab(Game.Tab.INVENTORY);
  987. sleep(random(540,760));
  988. }
  989.  
  990.  
  991. class gui extends JFrame {
  992. /**
  993. *
  994. */
  995. private static final long serialVersionUID = 1L;
  996. public gui() {
  997. initComponents();
  998. }
  999.  
  1000. private void startButtonActionPerformed(ActionEvent e){
  1001. String mode = selectionBox.getSelectedItem().toString();
  1002. if(mode.equals("Maximum")){
  1003. antiban = false;
  1004. minSpeed = 5;
  1005. maxSpeed = 6;
  1006. }
  1007. else if(mode.equals("Paranoid")){
  1008. antiban = true;
  1009. minSpeed = 8;
  1010. maxSpeed = 10;
  1011. min = 3;
  1012. max = 3;
  1013.  
  1014. }
  1015. save = memoryMode.isSelected();
  1016. guiWait = false;
  1017. g.dispose();
  1018. }
  1019.  
  1020. private void initComponents() {
  1021. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  1022. label1 = new JLabel();
  1023. selectionBox = new JComboBox();
  1024. memoryMode = new JCheckBox();
  1025. label2 = new JLabel();
  1026. label3 = new JLabel();
  1027. label4 = new JLabel();
  1028. label5 = new JLabel();
  1029. startButton = new JButton();
  1030.  
  1031. //======== this ========
  1032. setTitle("Painlaws's Vial Filler");
  1033. setResizable(false);
  1034. Container contentPane = getContentPane();
  1035.  
  1036. //---- label1 ----
  1037. label1.setText("Mode");
  1038.  
  1039. //---- selectionBox ----
  1040. selectionBox.setModel(new DefaultComboBoxModel(new String[] {
  1041. "Normal",
  1042. "Paranoid",
  1043. "Maximum"
  1044. }));
  1045.  
  1046. //---- memoryMode ----
  1047. memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
  1048.  
  1049. //---- label2 ----
  1050. label2.setText("Modes:");
  1051.  
  1052. //---- label3 ----
  1053. label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
  1054.  
  1055. //---- label4 ----
  1056. label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
  1057.  
  1058. //---- label5 ----
  1059. label5.setText("Maximum - No Antiban, Fast Mouse Speed");
  1060.  
  1061. //---- startButton ----
  1062. startButton.setText("Let's Fill Some Vials!");
  1063. startButton.addActionListener(new ActionListener() {
  1064. public void actionPerformed(ActionEvent e){
  1065. startButtonActionPerformed(e);
  1066. }
  1067. });
  1068.  
  1069. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  1070. contentPane.setLayout(contentPaneLayout);
  1071. contentPaneLayout.setHorizontalGroup(
  1072. contentPaneLayout.createParallelGroup()
  1073. .addGroup(contentPaneLayout.createSequentialGroup()
  1074. .addGroup(contentPaneLayout.createParallelGroup()
  1075. .addGroup(contentPaneLayout.createSequentialGroup()
  1076. .addContainerGap()
  1077. .addGroup(contentPaneLayout.createParallelGroup()
  1078. .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  1079. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  1080. .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  1081. .addGroup(contentPaneLayout.createSequentialGroup()
  1082. .addComponent(label1)
  1083. .addGap(18, 18, 18)
  1084. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  1085. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  1086. .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  1087. .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  1088. .addGroup(contentPaneLayout.createSequentialGroup()
  1089. .addGap(148, 148, 148)
  1090. .addComponent(startButton)))
  1091. .addContainerGap(2, Short.MAX_VALUE))
  1092. );
  1093. contentPaneLayout.setVerticalGroup(
  1094. contentPaneLayout.createParallelGroup()
  1095. .addGroup(contentPaneLayout.createSequentialGroup()
  1096. .addContainerGap()
  1097. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  1098. .addComponent(label1)
  1099. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  1100. .addGap(18, 18, 18)
  1101. .addComponent(memoryMode)
  1102. .addGap(18, 18, 18)
  1103. .addComponent(label2)
  1104. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  1105. .addComponent(label3)
  1106. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  1107. .addComponent(label4)
  1108. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  1109. .addComponent(label5)
  1110. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
  1111. .addComponent(startButton)
  1112. .addContainerGap())
  1113. );
  1114. pack();
  1115. setLocationRelativeTo(getOwner());
  1116. // JFormDesigner - End of component initialization //GEN-END:initComponents
  1117. }
  1118.  
  1119. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  1120. private JLabel label1;
  1121. private JComboBox selectionBox;
  1122. private JCheckBox memoryMode;
  1123. private JLabel label2;
  1124. private JLabel label3;
  1125. private JLabel label4;
  1126. private JLabel label5;
  1127. private JButton startButton;
  1128. // JFormDesigner - End of variables declaration //GEN-END:variables
  1129. }
  1130.  
  1131.  
  1132. }
  1133. import java.awt.*;
  1134. import java.awt.event.*;
  1135. import javax.swing.*;
  1136. import java.awt.event.KeyEvent;
  1137. import org.rsbot.event.listeners.PaintListener;
  1138. import org.rsbot.script.Script;
  1139. import org.rsbot.script.ScriptManifest;
  1140. import org.rsbot.script.methods.*;
  1141. import org.rsbot.script.wrappers.*;
  1142.  
  1143. @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
  1144. public class vialfiller extends Script implements PaintListener{
  1145. //Variables
  1146. // - Essentials
  1147. private int bankerID = 6533;
  1148. private int fountainID = 24214;
  1149. private int emptyVialID = 229;
  1150. private int fullVialID = 227;
  1151. private int runEnergy = 50;
  1152. RSNPC banker;
  1153. RSObject fountain;
  1154. RSItem myVial;
  1155. RSTile theBank = new RSTile(3167, 3489);
  1156. RSTile theFountain = new RSTile(3191, 3471);
  1157. RSTile glitchSpot = new RSTile(3192, 3487);
  1158. RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
  1159. RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
  1160. RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
  1161. RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
  1162.  
  1163. // - GUI Options
  1164. private int min = 1;
  1165. private int max = 6;
  1166. private int minSpeed = 6;
  1167. private int maxSpeed = 9;
  1168. private boolean guiWait = true;
  1169. private boolean save = false;
  1170.  
  1171. // - State check
  1172. private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
  1173.  
  1174. // - Paint stuff
  1175. private String status = "Initializing...";
  1176. private String isRunning = "";
  1177. private int numFilled = 0;
  1178. private int vialFilledPrice;
  1179. private int vialEmptyPrice;
  1180. private int profitPrice;
  1181. private int profit;
  1182. private long startTime;
  1183. private long millis;
  1184. private long hours;
  1185. private long minutes;
  1186. private long seconds;
  1187. private float profSec = 0;
  1188. private float profHour;
  1189. private float hourlyProfit;
  1190. private int hourlyProfitInt;
  1191. private final Color color1 = new Color(0, 0, 0);
  1192. private final Color color2 = new Color(255, 255, 255);
  1193. private final BasicStroke stroke1 = new BasicStroke(1);
  1194. private final Font font1 = new Font("Arial", 0, 13);
  1195. private final Font font2 = new Font("Arial", 1, 13);
  1196. private final Font font3 = new Font("Vijaya", 1, 17);
  1197. private boolean antiban = true;
  1198. gui g = new gui();
  1199.  
  1200. @Override
  1201. public boolean onStart(){
  1202. log("Welcome to Painlaws's Vial Filler");
  1203. log("Waiting on GUI...");
  1204. g.setVisible(true);
  1205. while(guiWait){
  1206. sleep(500);
  1207. }
  1208. log("GUI Settings loaded!");
  1209. if(walking.isRunEnabled()){
  1210. isRunning = "Yes";
  1211. }
  1212. else{
  1213. isRunning = "No";
  1214. }
  1215. vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
  1216. vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
  1217. profitPrice = vialFilledPrice - vialEmptyPrice;
  1218. if(!save){
  1219. startTime = System.currentTimeMillis();
  1220. }
  1221. else{
  1222. startTime = 0;
  1223. }
  1224. return true;
  1225. }
  1226.  
  1227. @Override
  1228. public void onFinish(){
  1229. env.saveScreenshot(true);
  1230. log("^ Don't forget to upload this proggie :P");
  1231. log("Bye! PM Painlaws for comments/questions/requests");
  1232. }
  1233.  
  1234. public void useItem(RSItem item, RSObject object){
  1235. if(item != null && object != null && object.isOnScreen()){
  1236. item.doClick(true);
  1237. sleep(200, 300);
  1238. object.doClick();
  1239. }
  1240. }
  1241.  
  1242. public void fillVials(){
  1243. if(fountain != null){
  1244. status = "Filling Vials";
  1245. useItem(myVial, fountain);
  1246. while(inventory.contains(emptyVialID)){
  1247. sleep(random(1000,1500));
  1248. if(antiban){
  1249. if(random(1, 3) == 2){
  1250. mouse.moveSlightly();
  1251. }
  1252. }
  1253. }
  1254. status = "Vials filled";
  1255. }
  1256. else{
  1257. status = "Fountain is null...retrying";
  1258. sleep(random(600, 800));
  1259. }
  1260. }
  1261.  
  1262. private void doBank(){
  1263. try{
  1264. if(banker != null){
  1265. camera.turnTo(banker);
  1266. if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
  1267. status = "Opening Bank";
  1268. banker.interact("Bank Banker");
  1269. status = "Bank opened";
  1270. sleep(random(900, 1050));
  1271. status = "Depositing All";
  1272. bank.depositAll();
  1273. status = "Deposited All";
  1274. sleep(random(780, 950));
  1275. numFilled = bank.getCount(fullVialID);
  1276. if(bank.getCount(emptyVialID) != 0){
  1277. status = "Taking Vials";
  1278. bank.withdraw(emptyVialID, 0);
  1279. status = "Vials Taken";
  1280. sleep(random(700, 960));
  1281. }
  1282. else{
  1283. log("Out of vials. Quitting :/");
  1284. bank.close();
  1285. env.saveScreenshot(true);
  1286. log("^ Don't forget to upload this proggie :P");
  1287. log("Bye! PM Painlaws for comments/questions/requests");
  1288. stopScript(true);
  1289. }
  1290. status = "Closing Bank";
  1291. bank.close();
  1292. status = "Bank Closed";
  1293. sleep(random(750, 910));
  1294. }
  1295. }
  1296. sleep(random(300,500));
  1297. }catch(Exception e){log(e);}
  1298. }
  1299.  
  1300. public void onToBank(){
  1301. try{
  1302. status = "Going to Bank";
  1303. walking.walkTileMM(theBank);
  1304. }catch(Exception e){log(e);}
  1305. sleep(random(500, 700));
  1306. }
  1307.  
  1308. public void onToGlitch(){
  1309. try{
  1310. status = "Going to Fountain"; //What you don't know can't hurt you :P
  1311. walking.walkTileMM(glitchSpot);
  1312. }catch(Exception e){log(e);}
  1313. sleep(random(500, 710));
  1314. }
  1315.  
  1316. public void onToFountain(){
  1317. try{
  1318. status = "Going to Fountain";
  1319. walking.walkTileMM(theFountain);
  1320. }catch(Exception e){log(e);}
  1321. sleep(random(500, 705));
  1322. }
  1323.  
  1324. public void runcheck() {
  1325. try{
  1326. runEnergy = (random(50, 70));
  1327. if (walking.isRunEnabled()){
  1328. isRunning = "Yes";
  1329. }
  1330. else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
  1331. walking.setRun(true);
  1332. isRunning = "Yes";
  1333. sleep(random(300, 500));
  1334. }
  1335. else{
  1336. isRunning = "No";
  1337. sleep(random(300,500));
  1338. }
  1339. }catch(Exception ex){}
  1340. }
  1341.  
  1342. @Override
  1343. public int loop(){
  1344. mouse.setSpeed(random(minSpeed, maxSpeed));
  1345. runcheck();
  1346. if(antiban){
  1347. if(random(min, max) == 3){
  1348. antiban();
  1349. }
  1350. }
  1351. if(objects.getNearest(fountainID) != null){
  1352. fountain = objects.getNearest(fountainID);
  1353. }
  1354. if(npcs.getNearest(bankerID) != null){
  1355. banker = npcs.getNearest(bankerID);
  1356. }
  1357. if(inventory.getItem(emptyVialID) != null){
  1358. myVial = inventory.getItem(emptyVialID);
  1359. }
  1360. switch(getState()){
  1361. case TOFOUNTAIN:
  1362. runcheck();
  1363. onToFountain();
  1364. if(fountainRange.contains(players.getMyPlayer().getLocation())){
  1365. fillVials();
  1366. }
  1367. break;
  1368.  
  1369. case TOGLITCH:
  1370. runcheck();
  1371. onToGlitch();
  1372. break;
  1373.  
  1374. case TOBANK:
  1375. runcheck();
  1376. onToBank();
  1377. if(bankRange.contains(players.getMyPlayer().getLocation())){
  1378. doBank();
  1379. }
  1380. break;
  1381. }
  1382. return(random(500, 1000));
  1383. }
  1384.  
  1385. private State getState() {
  1386. if (!inventory.contains(emptyVialID)) {
  1387. return State.TOBANK;
  1388. }
  1389. else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
  1390. return State.TOGLITCH;
  1391. }
  1392. else{
  1393. return State.TOFOUNTAIN;
  1394. }
  1395. }
  1396.  
  1397. // GUI and Mouse
  1398. public void onRepaint(Graphics g1) {
  1399. profit = numFilled * profitPrice;
  1400. if(!save){
  1401. millis = System.currentTimeMillis() - startTime;
  1402. hours = millis / (1000 * 60 * 60);
  1403. millis -= hours * (1000 * 60 * 60);
  1404. minutes = millis / (1000 * 60);
  1405. millis -= minutes * (1000 * 60);
  1406. seconds = millis / 1000;
  1407.  
  1408. if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
  1409. profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
  1410. }
  1411. profHour = profSec * 3600;
  1412. hourlyProfit = profHour * profitPrice;
  1413. hourlyProfitInt = Math.round(hourlyProfit);
  1414. }
  1415. else{
  1416. millis = 0;
  1417. hours = 0;
  1418. minutes = 0;
  1419. seconds = 0;
  1420. hourlyProfitInt = 9001;
  1421. }
  1422.  
  1423. Graphics2D g = (Graphics2D)g1;
  1424. g.setColor(color1);
  1425. g.fillRect(7, 345, 488, 70);
  1426. g.setStroke(stroke1);
  1427. g.drawRect(7, 345, 488, 70);
  1428. g.setFont(font1);
  1429. g.setColor(color2);
  1430. g.drawString("Status:", 14, 362);
  1431. g.setFont(font2);
  1432. g.drawString(status, 59, 362);
  1433. g.setFont(font1);
  1434. g.drawString("Filled Vials In Bank:", 209, 362);
  1435. g.setFont(font2);
  1436. g.drawString(Integer.toString(numFilled), 328, 362);
  1437. g.setFont(font1);
  1438. g.drawString("Profit:", 14, 383);
  1439. g.setFont(font2);
  1440. g.drawString(Integer.toString(profit), 59, 383);
  1441. g.setFont(font1);
  1442. g.drawString("Profit/hr:", 137, 383);
  1443. g.setFont(font2);
  1444. if(!save){
  1445. g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
  1446. }
  1447. else{
  1448. g.drawString("Mem Save", 190, 383);
  1449. }
  1450. g.setFont(font1);
  1451. g.drawString("Runtime:", 270, 383);
  1452. g.setFont(font2);
  1453. if(!save){
  1454. g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
  1455. }
  1456. else{
  1457. g.drawString("Mem Save", 325, 384);
  1458. }
  1459. g.setFont(font1);
  1460. g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
  1461. g.drawString("Running:", 710, 139);
  1462. g.setFont(font2);
  1463. g.drawString(isRunning, 722, 156);
  1464. g.setFont(font3);
  1465. g.drawString("Painlaws", 440, 357);
  1466.  
  1467. g1.setColor(Color.green);
  1468. g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
  1469. g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
  1470. }
  1471.  
  1472. /* Antiban stuff
  1473. * Some credits to Aaimister :)
  1474. * Partially copied, with permission
  1475. */
  1476.  
  1477. public void rotateCamera() {
  1478. final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  1479. final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  1480. final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  1481. KeyEvent.VK_UP, KeyEvent.VK_UP };
  1482. final int randomLR = random(0, 2);
  1483. final int randomUD = random(0, 2);
  1484. final int randomAll = random(0, 4);
  1485. if (random(0, 3) == 0) {
  1486. keyboard.pressKey(LR[randomLR]);
  1487. sleepCR(random(2, 9));
  1488. keyboard.pressKey(UD[randomUD]);
  1489. sleepCR(random(6, 10));
  1490. keyboard.releaseKey(UD[randomUD]);
  1491. sleepCR(random(2, 7));
  1492. keyboard.releaseKey(LR[randomLR]);
  1493. } else {
  1494. keyboard.pressKey(LRUD[randomAll]);
  1495. if (randomAll > 1) {
  1496. sleepCR(random(6, 11));
  1497. } else {
  1498. sleepCR(random(9, 12));
  1499. }
  1500. keyboard.releaseKey(LRUD[randomAll]);
  1501. }
  1502. }
  1503.  
  1504. private boolean sleepCR(final int amtOfHalfSecs) {
  1505. for (int x = 0; x < amtOfHalfSecs + 1; x++) {
  1506. sleep(random(48, 53));
  1507. }
  1508. return true;
  1509. }
  1510.  
  1511. private void antiban(){
  1512. int action = random(0, 5);
  1513.  
  1514. switch (action) {
  1515. case 0:
  1516. status = "Antiban";
  1517. rotateCamera();
  1518. sleep(200, 400);
  1519. break;
  1520. case 1:
  1521. status = "Antiban";
  1522. mouse.moveRandomly(100, 900);
  1523. sleep(200, 400);
  1524. break;
  1525. case 2:
  1526. status = "Antiban";
  1527. mouse.moveSlightly();
  1528. sleep(200, 400);
  1529. break;
  1530. case 3:
  1531. status = "Antiban";
  1532. camera.moveRandomly(random(750,1250));
  1533. sleep(200, 400);
  1534. break;
  1535. case 4:
  1536. status = "Antiban";
  1537. checkEXP();
  1538. sleep(200, 400);
  1539. break;
  1540. case 5:
  1541. status = "Antiban";
  1542. mouse.moveOffScreen();
  1543. sleep(200, 400);
  1544. break;
  1545. }
  1546. }
  1547.  
  1548. public void checkEXP() {
  1549. game.openTab(Game.Tab.STATS);
  1550. skills.doHover(Skills.INTERFACE_PRAYER);
  1551. sleep(random(2100, 3400));
  1552. game.openTab(Game.Tab.INVENTORY);
  1553. sleep(random(540,760));
  1554. }
  1555.  
  1556.  
  1557. class gui extends JFrame {
  1558. /**
  1559. *
  1560. */
  1561. private static final long serialVersionUID = 1L;
  1562. public gui() {
  1563. initComponents();
  1564. }
  1565.  
  1566. private void startButtonActionPerformed(ActionEvent e){
  1567. String mode = selectionBox.getSelectedItem().toString();
  1568. if(mode.equals("Maximum")){
  1569. antiban = false;
  1570. minSpeed = 5;
  1571. maxSpeed = 6;
  1572. }
  1573. else if(mode.equals("Paranoid")){
  1574. antiban = true;
  1575. minSpeed = 8;
  1576. maxSpeed = 10;
  1577. min = 3;
  1578. max = 3;
  1579.  
  1580. }
  1581. save = memoryMode.isSelected();
  1582. guiWait = false;
  1583. g.dispose();
  1584. }
  1585.  
  1586. private void initComponents() {
  1587. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  1588. label1 = new JLabel();
  1589. selectionBox = new JComboBox();
  1590. memoryMode = new JCheckBox();
  1591. label2 = new JLabel();
  1592. label3 = new JLabel();
  1593. label4 = new JLabel();
  1594. label5 = new JLabel();
  1595. startButton = new JButton();
  1596.  
  1597. //======== this ========
  1598. setTitle("Painlaws's Vial Filler");
  1599. setResizable(false);
  1600. Container contentPane = getContentPane();
  1601.  
  1602. //---- label1 ----
  1603. label1.setText("Mode");
  1604.  
  1605. //---- selectionBox ----
  1606. selectionBox.setModel(new DefaultComboBoxModel(new String[] {
  1607. "Normal",
  1608. "Paranoid",
  1609. "Maximum"
  1610. }));
  1611.  
  1612. //---- memoryMode ----
  1613. memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
  1614.  
  1615. //---- label2 ----
  1616. label2.setText("Modes:");
  1617.  
  1618. //---- label3 ----
  1619. label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
  1620.  
  1621. //---- label4 ----
  1622. label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
  1623.  
  1624. //---- label5 ----
  1625. label5.setText("Maximum - No Antiban, Fast Mouse Speed");
  1626.  
  1627. //---- startButton ----
  1628. startButton.setText("Let's Fill Some Vials!");
  1629. startButton.addActionListener(new ActionListener() {
  1630. public void actionPerformed(ActionEvent e){
  1631. startButtonActionPerformed(e);
  1632. }
  1633. });
  1634.  
  1635. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  1636. contentPane.setLayout(contentPaneLayout);
  1637. contentPaneLayout.setHorizontalGroup(
  1638. contentPaneLayout.createParallelGroup()
  1639. .addGroup(contentPaneLayout.createSequentialGroup()
  1640. .addGroup(contentPaneLayout.createParallelGroup()
  1641. .addGroup(contentPaneLayout.createSequentialGroup()
  1642. .addContainerGap()
  1643. .addGroup(contentPaneLayout.createParallelGroup()
  1644. .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  1645. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  1646. .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  1647. .addGroup(contentPaneLayout.createSequentialGroup()
  1648. .addComponent(label1)
  1649. .addGap(18, 18, 18)
  1650. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  1651. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  1652. .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  1653. .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  1654. .addGroup(contentPaneLayout.createSequentialGroup()
  1655. .addGap(148, 148, 148)
  1656. .addComponent(startButton)))
  1657. .addContainerGap(2, Short.MAX_VALUE))
  1658. );
  1659. contentPaneLayout.setVerticalGroup(
  1660. contentPaneLayout.createParallelGroup()
  1661. .addGroup(contentPaneLayout.createSequentialGroup()
  1662. .addContainerGap()
  1663. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  1664. .addComponent(label1)
  1665. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  1666. .addGap(18, 18, 18)
  1667. .addComponent(memoryMode)
  1668. .addGap(18, 18, 18)
  1669. .addComponent(label2)
  1670. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  1671. .addComponent(label3)
  1672. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  1673. .addComponent(label4)
  1674. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  1675. .addComponent(label5)
  1676. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
  1677. .addComponent(startButton)
  1678. .addContainerGap())
  1679. );
  1680. pack();
  1681. setLocationRelativeTo(getOwner());
  1682. // JFormDesigner - End of component initialization //GEN-END:initComponents
  1683. }
  1684.  
  1685. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  1686. private JLabel label1;
  1687. private JComboBox selectionBox;
  1688. private JCheckBox memoryMode;
  1689. private JLabel label2;
  1690. private JLabel label3;
  1691. private JLabel label4;
  1692. private JLabel label5;
  1693. private JButton startButton;
  1694. // JFormDesigner - End of variables declaration //GEN-END:variables
  1695. }
  1696.  
  1697.  
  1698. }
  1699. import java.awt.*;
  1700. import java.awt.event.*;
  1701. import javax.swing.*;
  1702. import java.awt.event.KeyEvent;
  1703. import org.rsbot.event.listeners.PaintListener;
  1704. import org.rsbot.script.Script;
  1705. import org.rsbot.script.ScriptManifest;
  1706. import org.rsbot.script.methods.*;
  1707. import org.rsbot.script.wrappers.*;
  1708.  
  1709. @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
  1710. public class vialfiller extends Script implements PaintListener{
  1711. //Variables
  1712. // - Essentials
  1713. private int bankerID = 6533;
  1714. private int fountainID = 24214;
  1715. private int emptyVialID = 229;
  1716. private int fullVialID = 227;
  1717. private int runEnergy = 50;
  1718. RSNPC banker;
  1719. RSObject fountain;
  1720. RSItem myVial;
  1721. RSTile theBank = new RSTile(3167, 3489);
  1722. RSTile theFountain = new RSTile(3191, 3471);
  1723. RSTile glitchSpot = new RSTile(3192, 3487);
  1724. RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
  1725. RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
  1726. RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
  1727. RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
  1728.  
  1729. // - GUI Options
  1730. private int min = 1;
  1731. private int max = 6;
  1732. private int minSpeed = 6;
  1733. private int maxSpeed = 9;
  1734. private boolean guiWait = true;
  1735. private boolean save = false;
  1736.  
  1737. // - State check
  1738. private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
  1739.  
  1740. // - Paint stuff
  1741. private String status = "Initializing...";
  1742. private String isRunning = "";
  1743. private int numFilled = 0;
  1744. private int vialFilledPrice;
  1745. private int vialEmptyPrice;
  1746. private int profitPrice;
  1747. private int profit;
  1748. private long startTime;
  1749. private long millis;
  1750. private long hours;
  1751. private long minutes;
  1752. private long seconds;
  1753. private float profSec = 0;
  1754. private float profHour;
  1755. private float hourlyProfit;
  1756. private int hourlyProfitInt;
  1757. private final Color color1 = new Color(0, 0, 0);
  1758. private final Color color2 = new Color(255, 255, 255);
  1759. private final BasicStroke stroke1 = new BasicStroke(1);
  1760. private final Font font1 = new Font("Arial", 0, 13);
  1761. private final Font font2 = new Font("Arial", 1, 13);
  1762. private final Font font3 = new Font("Vijaya", 1, 17);
  1763. private boolean antiban = true;
  1764. gui g = new gui();
  1765.  
  1766. @Override
  1767. public boolean onStart(){
  1768. log("Welcome to Painlaws's Vial Filler");
  1769. log("Waiting on GUI...");
  1770. g.setVisible(true);
  1771. while(guiWait){
  1772. sleep(500);
  1773. }
  1774. log("GUI Settings loaded!");
  1775. if(walking.isRunEnabled()){
  1776. isRunning = "Yes";
  1777. }
  1778. else{
  1779. isRunning = "No";
  1780. }
  1781. vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
  1782. vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
  1783. profitPrice = vialFilledPrice - vialEmptyPrice;
  1784. if(!save){
  1785. startTime = System.currentTimeMillis();
  1786. }
  1787. else{
  1788. startTime = 0;
  1789. }
  1790. return true;
  1791. }
  1792.  
  1793. @Override
  1794. public void onFinish(){
  1795. env.saveScreenshot(true);
  1796. log("^ Don't forget to upload this proggie :P");
  1797. log("Bye! PM Painlaws for comments/questions/requests");
  1798. }
  1799.  
  1800. public void useItem(RSItem item, RSObject object){
  1801. if(item != null && object != null && object.isOnScreen()){
  1802. item.doClick(true);
  1803. sleep(200, 300);
  1804. object.doClick();
  1805. }
  1806. }
  1807.  
  1808. public void fillVials(){
  1809. if(fountain != null){
  1810. status = "Filling Vials";
  1811. useItem(myVial, fountain);
  1812. while(inventory.contains(emptyVialID)){
  1813. sleep(random(1000,1500));
  1814. if(antiban){
  1815. if(random(1, 3) == 2){
  1816. mouse.moveSlightly();
  1817. }
  1818. }
  1819. }
  1820. status = "Vials filled";
  1821. }
  1822. else{
  1823. status = "Fountain is null...retrying";
  1824. sleep(random(600, 800));
  1825. }
  1826. }
  1827.  
  1828. private void doBank(){
  1829. try{
  1830. if(banker != null){
  1831. camera.turnTo(banker);
  1832. if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
  1833. status = "Opening Bank";
  1834. banker.interact("Bank Banker");
  1835. status = "Bank opened";
  1836. sleep(random(900, 1050));
  1837. status = "Depositing All";
  1838. bank.depositAll();
  1839. status = "Deposited All";
  1840. sleep(random(780, 950));
  1841. numFilled = bank.getCount(fullVialID);
  1842. if(bank.getCount(emptyVialID) != 0){
  1843. status = "Taking Vials";
  1844. bank.withdraw(emptyVialID, 0);
  1845. status = "Vials Taken";
  1846. sleep(random(700, 960));
  1847. }
  1848. else{
  1849. log("Out of vials. Quitting :/");
  1850. bank.close();
  1851. env.saveScreenshot(true);
  1852. log("^ Don't forget to upload this proggie :P");
  1853. log("Bye! PM Painlaws for comments/questions/requests");
  1854. stopScript(true);
  1855. }
  1856. status = "Closing Bank";
  1857. bank.close();
  1858. status = "Bank Closed";
  1859. sleep(random(750, 910));
  1860. }
  1861. }
  1862. sleep(random(300,500));
  1863. }catch(Exception e){log(e);}
  1864. }
  1865.  
  1866. public void onToBank(){
  1867. try{
  1868. status = "Going to Bank";
  1869. walking.walkTileMM(theBank);
  1870. }catch(Exception e){log(e);}
  1871. sleep(random(500, 700));
  1872. }
  1873.  
  1874. public void onToGlitch(){
  1875. try{
  1876. status = "Going to Fountain"; //What you don't know can't hurt you :P
  1877. walking.walkTileMM(glitchSpot);
  1878. }catch(Exception e){log(e);}
  1879. sleep(random(500, 710));
  1880. }
  1881.  
  1882. public void onToFountain(){
  1883. try{
  1884. status = "Going to Fountain";
  1885. walking.walkTileMM(theFountain);
  1886. }catch(Exception e){log(e);}
  1887. sleep(random(500, 705));
  1888. }
  1889.  
  1890. public void runcheck() {
  1891. try{
  1892. runEnergy = (random(50, 70));
  1893. if (walking.isRunEnabled()){
  1894. isRunning = "Yes";
  1895. }
  1896. else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
  1897. walking.setRun(true);
  1898. isRunning = "Yes";
  1899. sleep(random(300, 500));
  1900. }
  1901. else{
  1902. isRunning = "No";
  1903. sleep(random(300,500));
  1904. }
  1905. }catch(Exception ex){}
  1906. }
  1907.  
  1908. @Override
  1909. public int loop(){
  1910. mouse.setSpeed(random(minSpeed, maxSpeed));
  1911. runcheck();
  1912. if(antiban){
  1913. if(random(min, max) == 3){
  1914. antiban();
  1915. }
  1916. }
  1917. if(objects.getNearest(fountainID) != null){
  1918. fountain = objects.getNearest(fountainID);
  1919. }
  1920. if(npcs.getNearest(bankerID) != null){
  1921. banker = npcs.getNearest(bankerID);
  1922. }
  1923. if(inventory.getItem(emptyVialID) != null){
  1924. myVial = inventory.getItem(emptyVialID);
  1925. }
  1926. switch(getState()){
  1927. case TOFOUNTAIN:
  1928. runcheck();
  1929. onToFountain();
  1930. if(fountainRange.contains(players.getMyPlayer().getLocation())){
  1931. fillVials();
  1932. }
  1933. break;
  1934.  
  1935. case TOGLITCH:
  1936. runcheck();
  1937. onToGlitch();
  1938. break;
  1939.  
  1940. case TOBANK:
  1941. runcheck();
  1942. onToBank();
  1943. if(bankRange.contains(players.getMyPlayer().getLocation())){
  1944. doBank();
  1945. }
  1946. break;
  1947. }
  1948. return(random(500, 1000));
  1949. }
  1950.  
  1951. private State getState() {
  1952. if (!inventory.contains(emptyVialID)) {
  1953. return State.TOBANK;
  1954. }
  1955. else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
  1956. return State.TOGLITCH;
  1957. }
  1958. else{
  1959. return State.TOFOUNTAIN;
  1960. }
  1961. }
  1962.  
  1963. // GUI and Mouse
  1964. public void onRepaint(Graphics g1) {
  1965. profit = numFilled * profitPrice;
  1966. if(!save){
  1967. millis = System.currentTimeMillis() - startTime;
  1968. hours = millis / (1000 * 60 * 60);
  1969. millis -= hours * (1000 * 60 * 60);
  1970. minutes = millis / (1000 * 60);
  1971. millis -= minutes * (1000 * 60);
  1972. seconds = millis / 1000;
  1973.  
  1974. if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
  1975. profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
  1976. }
  1977. profHour = profSec * 3600;
  1978. hourlyProfit = profHour * profitPrice;
  1979. hourlyProfitInt = Math.round(hourlyProfit);
  1980. }
  1981. else{
  1982. millis = 0;
  1983. hours = 0;
  1984. minutes = 0;
  1985. seconds = 0;
  1986. hourlyProfitInt = 9001;
  1987. }
  1988.  
  1989. Graphics2D g = (Graphics2D)g1;
  1990. g.setColor(color1);
  1991. g.fillRect(7, 345, 488, 70);
  1992. g.setStroke(stroke1);
  1993. g.drawRect(7, 345, 488, 70);
  1994. g.setFont(font1);
  1995. g.setColor(color2);
  1996. g.drawString("Status:", 14, 362);
  1997. g.setFont(font2);
  1998. g.drawString(status, 59, 362);
  1999. g.setFont(font1);
  2000. g.drawString("Filled Vials In Bank:", 209, 362);
  2001. g.setFont(font2);
  2002. g.drawString(Integer.toString(numFilled), 328, 362);
  2003. g.setFont(font1);
  2004. g.drawString("Profit:", 14, 383);
  2005. g.setFont(font2);
  2006. g.drawString(Integer.toString(profit), 59, 383);
  2007. g.setFont(font1);
  2008. g.drawString("Profit/hr:", 137, 383);
  2009. g.setFont(font2);
  2010. if(!save){
  2011. g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
  2012. }
  2013. else{
  2014. g.drawString("Mem Save", 190, 383);
  2015. }
  2016. g.setFont(font1);
  2017. g.drawString("Runtime:", 270, 383);
  2018. g.setFont(font2);
  2019. if(!save){
  2020. g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
  2021. }
  2022. else{
  2023. g.drawString("Mem Save", 325, 384);
  2024. }
  2025. g.setFont(font1);
  2026. g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
  2027. g.drawString("Running:", 710, 139);
  2028. g.setFont(font2);
  2029. g.drawString(isRunning, 722, 156);
  2030. g.setFont(font3);
  2031. g.drawString("Painlaws", 440, 357);
  2032.  
  2033. g1.setColor(Color.green);
  2034. g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
  2035. g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
  2036. }
  2037.  
  2038. /* Antiban stuff
  2039. * Some credits to Aaimister :)
  2040. * Partially copied, with permission
  2041. */
  2042.  
  2043. public void rotateCamera() {
  2044. final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  2045. final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  2046. final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  2047. KeyEvent.VK_UP, KeyEvent.VK_UP };
  2048. final int randomLR = random(0, 2);
  2049. final int randomUD = random(0, 2);
  2050. final int randomAll = random(0, 4);
  2051. if (random(0, 3) == 0) {
  2052. keyboard.pressKey(LR[randomLR]);
  2053. sleepCR(random(2, 9));
  2054. keyboard.pressKey(UD[randomUD]);
  2055. sleepCR(random(6, 10));
  2056. keyboard.releaseKey(UD[randomUD]);
  2057. sleepCR(random(2, 7));
  2058. keyboard.releaseKey(LR[randomLR]);
  2059. } else {
  2060. keyboard.pressKey(LRUD[randomAll]);
  2061. if (randomAll > 1) {
  2062. sleepCR(random(6, 11));
  2063. } else {
  2064. sleepCR(random(9, 12));
  2065. }
  2066. keyboard.releaseKey(LRUD[randomAll]);
  2067. }
  2068. }
  2069.  
  2070. private boolean sleepCR(final int amtOfHalfSecs) {
  2071. for (int x = 0; x < amtOfHalfSecs + 1; x++) {
  2072. sleep(random(48, 53));
  2073. }
  2074. return true;
  2075. }
  2076.  
  2077. private void antiban(){
  2078. int action = random(0, 5);
  2079.  
  2080. switch (action) {
  2081. case 0:
  2082. status = "Antiban";
  2083. rotateCamera();
  2084. sleep(200, 400);
  2085. break;
  2086. case 1:
  2087. status = "Antiban";
  2088. mouse.moveRandomly(100, 900);
  2089. sleep(200, 400);
  2090. break;
  2091. case 2:
  2092. status = "Antiban";
  2093. mouse.moveSlightly();
  2094. sleep(200, 400);
  2095. break;
  2096. case 3:
  2097. status = "Antiban";
  2098. camera.moveRandomly(random(750,1250));
  2099. sleep(200, 400);
  2100. break;
  2101. case 4:
  2102. status = "Antiban";
  2103. checkEXP();
  2104. sleep(200, 400);
  2105. break;
  2106. case 5:
  2107. status = "Antiban";
  2108. mouse.moveOffScreen();
  2109. sleep(200, 400);
  2110. break;
  2111. }
  2112. }
  2113.  
  2114. public void checkEXP() {
  2115. game.openTab(Game.Tab.STATS);
  2116. skills.doHover(Skills.INTERFACE_PRAYER);
  2117. sleep(random(2100, 3400));
  2118. game.openTab(Game.Tab.INVENTORY);
  2119. sleep(random(540,760));
  2120. }
  2121.  
  2122.  
  2123. class gui extends JFrame {
  2124. /**
  2125. *
  2126. */
  2127. private static final long serialVersionUID = 1L;
  2128. public gui() {
  2129. initComponents();
  2130. }
  2131.  
  2132. private void startButtonActionPerformed(ActionEvent e){
  2133. String mode = selectionBox.getSelectedItem().toString();
  2134. if(mode.equals("Maximum")){
  2135. antiban = false;
  2136. minSpeed = 5;
  2137. maxSpeed = 6;
  2138. }
  2139. else if(mode.equals("Paranoid")){
  2140. antiban = true;
  2141. minSpeed = 8;
  2142. maxSpeed = 10;
  2143. min = 3;
  2144. max = 3;
  2145.  
  2146. }
  2147. save = memoryMode.isSelected();
  2148. guiWait = false;
  2149. g.dispose();
  2150. }
  2151.  
  2152. private void initComponents() {
  2153. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  2154. label1 = new JLabel();
  2155. selectionBox = new JComboBox();
  2156. memoryMode = new JCheckBox();
  2157. label2 = new JLabel();
  2158. label3 = new JLabel();
  2159. label4 = new JLabel();
  2160. label5 = new JLabel();
  2161. startButton = new JButton();
  2162.  
  2163. //======== this ========
  2164. setTitle("Painlaws's Vial Filler");
  2165. setResizable(false);
  2166. Container contentPane = getContentPane();
  2167.  
  2168. //---- label1 ----
  2169. label1.setText("Mode");
  2170.  
  2171. //---- selectionBox ----
  2172. selectionBox.setModel(new DefaultComboBoxModel(new String[] {
  2173. "Normal",
  2174. "Paranoid",
  2175. "Maximum"
  2176. }));
  2177.  
  2178. //---- memoryMode ----
  2179. memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
  2180.  
  2181. //---- label2 ----
  2182. label2.setText("Modes:");
  2183.  
  2184. //---- label3 ----
  2185. label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
  2186.  
  2187. //---- label4 ----
  2188. label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
  2189.  
  2190. //---- label5 ----
  2191. label5.setText("Maximum - No Antiban, Fast Mouse Speed");
  2192.  
  2193. //---- startButton ----
  2194. startButton.setText("Let's Fill Some Vials!");
  2195. startButton.addActionListener(new ActionListener() {
  2196. public void actionPerformed(ActionEvent e){
  2197. startButtonActionPerformed(e);
  2198. }
  2199. });
  2200.  
  2201. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  2202. contentPane.setLayout(contentPaneLayout);
  2203. contentPaneLayout.setHorizontalGroup(
  2204. contentPaneLayout.createParallelGroup()
  2205. .addGroup(contentPaneLayout.createSequentialGroup()
  2206. .addGroup(contentPaneLayout.createParallelGroup()
  2207. .addGroup(contentPaneLayout.createSequentialGroup()
  2208. .addContainerGap()
  2209. .addGroup(contentPaneLayout.createParallelGroup()
  2210. .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  2211. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  2212. .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  2213. .addGroup(contentPaneLayout.createSequentialGroup()
  2214. .addComponent(label1)
  2215. .addGap(18, 18, 18)
  2216. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  2217. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  2218. .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  2219. .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  2220. .addGroup(contentPaneLayout.createSequentialGroup()
  2221. .addGap(148, 148, 148)
  2222. .addComponent(startButton)))
  2223. .addContainerGap(2, Short.MAX_VALUE))
  2224. );
  2225. contentPaneLayout.setVerticalGroup(
  2226. contentPaneLayout.createParallelGroup()
  2227. .addGroup(contentPaneLayout.createSequentialGroup()
  2228. .addContainerGap()
  2229. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  2230. .addComponent(label1)
  2231. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  2232. .addGap(18, 18, 18)
  2233. .addComponent(memoryMode)
  2234. .addGap(18, 18, 18)
  2235. .addComponent(label2)
  2236. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  2237. .addComponent(label3)
  2238. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  2239. .addComponent(label4)
  2240. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  2241. .addComponent(label5)
  2242. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
  2243. .addComponent(startButton)
  2244. .addContainerGap())
  2245. );
  2246. pack();
  2247. setLocationRelativeTo(getOwner());
  2248. // JFormDesigner - End of component initialization //GEN-END:initComponents
  2249. }
  2250.  
  2251. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  2252. private JLabel label1;
  2253. private JComboBox selectionBox;
  2254. private JCheckBox memoryMode;
  2255. private JLabel label2;
  2256. private JLabel label3;
  2257. private JLabel label4;
  2258. private JLabel label5;
  2259. private JButton startButton;
  2260. // JFormDesigner - End of variables declaration //GEN-END:variables
  2261. }
  2262.  
  2263.  
  2264. }
  2265. import java.awt.*;
  2266. import java.awt.event.*;
  2267. import javax.swing.*;
  2268. import java.awt.event.KeyEvent;
  2269. import org.rsbot.event.listeners.PaintListener;
  2270. import org.rsbot.script.Script;
  2271. import org.rsbot.script.ScriptManifest;
  2272. import org.rsbot.script.methods.*;
  2273. import org.rsbot.script.wrappers.*;
  2274.  
  2275. @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
  2276. public class vialfiller extends Script implements PaintListener{
  2277. //Variables
  2278. // - Essentials
  2279. private int bankerID = 6533;
  2280. private int fountainID = 24214;
  2281. private int emptyVialID = 229;
  2282. private int fullVialID = 227;
  2283. private int runEnergy = 50;
  2284. RSNPC banker;
  2285. RSObject fountain;
  2286. RSItem myVial;
  2287. RSTile theBank = new RSTile(3167, 3489);
  2288. RSTile theFountain = new RSTile(3191, 3471);
  2289. RSTile glitchSpot = new RSTile(3192, 3487);
  2290. RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
  2291. RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
  2292. RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
  2293. RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
  2294.  
  2295. // - GUI Options
  2296. private int min = 1;
  2297. private int max = 6;
  2298. private int minSpeed = 6;
  2299. private int maxSpeed = 9;
  2300. private boolean guiWait = true;
  2301. private boolean save = false;
  2302.  
  2303. // - State check
  2304. private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
  2305.  
  2306. // - Paint stuff
  2307. private String status = "Initializing...";
  2308. private String isRunning = "";
  2309. private int numFilled = 0;
  2310. private int vialFilledPrice;
  2311. private int vialEmptyPrice;
  2312. private int profitPrice;
  2313. private int profit;
  2314. private long startTime;
  2315. private long millis;
  2316. private long hours;
  2317. private long minutes;
  2318. private long seconds;
  2319. private float profSec = 0;
  2320. private float profHour;
  2321. private float hourlyProfit;
  2322. private int hourlyProfitInt;
  2323. private final Color color1 = new Color(0, 0, 0);
  2324. private final Color color2 = new Color(255, 255, 255);
  2325. private final BasicStroke stroke1 = new BasicStroke(1);
  2326. private final Font font1 = new Font("Arial", 0, 13);
  2327. private final Font font2 = new Font("Arial", 1, 13);
  2328. private final Font font3 = new Font("Vijaya", 1, 17);
  2329. private boolean antiban = true;
  2330. gui g = new gui();
  2331.  
  2332. @Override
  2333. public boolean onStart(){
  2334. log("Welcome to Painlaws's Vial Filler");
  2335. log("Waiting on GUI...");
  2336. g.setVisible(true);
  2337. while(guiWait){
  2338. sleep(500);
  2339. }
  2340. log("GUI Settings loaded!");
  2341. if(walking.isRunEnabled()){
  2342. isRunning = "Yes";
  2343. }
  2344. else{
  2345. isRunning = "No";
  2346. }
  2347. vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
  2348. vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
  2349. profitPrice = vialFilledPrice - vialEmptyPrice;
  2350. if(!save){
  2351. startTime = System.currentTimeMillis();
  2352. }
  2353. else{
  2354. startTime = 0;
  2355. }
  2356. return true;
  2357. }
  2358.  
  2359. @Override
  2360. public void onFinish(){
  2361. env.saveScreenshot(true);
  2362. log("^ Don't forget to upload this proggie :P");
  2363. log("Bye! PM Painlaws for comments/questions/requests");
  2364. }
  2365.  
  2366. public void useItem(RSItem item, RSObject object){
  2367. if(item != null && object != null && object.isOnScreen()){
  2368. item.doClick(true);
  2369. sleep(200, 300);
  2370. object.doClick();
  2371. }
  2372. }
  2373.  
  2374. public void fillVials(){
  2375. if(fountain != null){
  2376. status = "Filling Vials";
  2377. useItem(myVial, fountain);
  2378. while(inventory.contains(emptyVialID)){
  2379. sleep(random(1000,1500));
  2380. if(antiban){
  2381. if(random(1, 3) == 2){
  2382. mouse.moveSlightly();
  2383. }
  2384. }
  2385. }
  2386. status = "Vials filled";
  2387. }
  2388. else{
  2389. status = "Fountain is null...retrying";
  2390. sleep(random(600, 800));
  2391. }
  2392. }
  2393.  
  2394. private void doBank(){
  2395. try{
  2396. if(banker != null){
  2397. camera.turnTo(banker);
  2398. if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
  2399. status = "Opening Bank";
  2400. banker.interact("Bank Banker");
  2401. status = "Bank opened";
  2402. sleep(random(900, 1050));
  2403. status = "Depositing All";
  2404. bank.depositAll();
  2405. status = "Deposited All";
  2406. sleep(random(780, 950));
  2407. numFilled = bank.getCount(fullVialID);
  2408. if(bank.getCount(emptyVialID) != 0){
  2409. status = "Taking Vials";
  2410. bank.withdraw(emptyVialID, 0);
  2411. status = "Vials Taken";
  2412. sleep(random(700, 960));
  2413. }
  2414. else{
  2415. log("Out of vials. Quitting :/");
  2416. bank.close();
  2417. env.saveScreenshot(true);
  2418. log("^ Don't forget to upload this proggie :P");
  2419. log("Bye! PM Painlaws for comments/questions/requests");
  2420. stopScript(true);
  2421. }
  2422. status = "Closing Bank";
  2423. bank.close();
  2424. status = "Bank Closed";
  2425. sleep(random(750, 910));
  2426. }
  2427. }
  2428. sleep(random(300,500));
  2429. }catch(Exception e){log(e);}
  2430. }
  2431.  
  2432. public void onToBank(){
  2433. try{
  2434. status = "Going to Bank";
  2435. walking.walkTileMM(theBank);
  2436. }catch(Exception e){log(e);}
  2437. sleep(random(500, 700));
  2438. }
  2439.  
  2440. public void onToGlitch(){
  2441. try{
  2442. status = "Going to Fountain"; //What you don't know can't hurt you :P
  2443. walking.walkTileMM(glitchSpot);
  2444. }catch(Exception e){log(e);}
  2445. sleep(random(500, 710));
  2446. }
  2447.  
  2448. public void onToFountain(){
  2449. try{
  2450. status = "Going to Fountain";
  2451. walking.walkTileMM(theFountain);
  2452. }catch(Exception e){log(e);}
  2453. sleep(random(500, 705));
  2454. }
  2455.  
  2456. public void runcheck() {
  2457. try{
  2458. runEnergy = (random(50, 70));
  2459. if (walking.isRunEnabled()){
  2460. isRunning = "Yes";
  2461. }
  2462. else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
  2463. walking.setRun(true);
  2464. isRunning = "Yes";
  2465. sleep(random(300, 500));
  2466. }
  2467. else{
  2468. isRunning = "No";
  2469. sleep(random(300,500));
  2470. }
  2471. }catch(Exception ex){}
  2472. }
  2473.  
  2474. @Override
  2475. public int loop(){
  2476. mouse.setSpeed(random(minSpeed, maxSpeed));
  2477. runcheck();
  2478. if(antiban){
  2479. if(random(min, max) == 3){
  2480. antiban();
  2481. }
  2482. }
  2483. if(objects.getNearest(fountainID) != null){
  2484. fountain = objects.getNearest(fountainID);
  2485. }
  2486. if(npcs.getNearest(bankerID) != null){
  2487. banker = npcs.getNearest(bankerID);
  2488. }
  2489. if(inventory.getItem(emptyVialID) != null){
  2490. myVial = inventory.getItem(emptyVialID);
  2491. }
  2492. switch(getState()){
  2493. case TOFOUNTAIN:
  2494. runcheck();
  2495. onToFountain();
  2496. if(fountainRange.contains(players.getMyPlayer().getLocation())){
  2497. fillVials();
  2498. }
  2499. break;
  2500.  
  2501. case TOGLITCH:
  2502. runcheck();
  2503. onToGlitch();
  2504. break;
  2505.  
  2506. case TOBANK:
  2507. runcheck();
  2508. onToBank();
  2509. if(bankRange.contains(players.getMyPlayer().getLocation())){
  2510. doBank();
  2511. }
  2512. break;
  2513. }
  2514. return(random(500, 1000));
  2515. }
  2516.  
  2517. private State getState() {
  2518. if (!inventory.contains(emptyVialID)) {
  2519. return State.TOBANK;
  2520. }
  2521. else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
  2522. return State.TOGLITCH;
  2523. }
  2524. else{
  2525. return State.TOFOUNTAIN;
  2526. }
  2527. }
  2528.  
  2529. // GUI and Mouse
  2530. public void onRepaint(Graphics g1) {
  2531. profit = numFilled * profitPrice;
  2532. if(!save){
  2533. millis = System.currentTimeMillis() - startTime;
  2534. hours = millis / (1000 * 60 * 60);
  2535. millis -= hours * (1000 * 60 * 60);
  2536. minutes = millis / (1000 * 60);
  2537. millis -= minutes * (1000 * 60);
  2538. seconds = millis / 1000;
  2539.  
  2540. if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
  2541. profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
  2542. }
  2543. profHour = profSec * 3600;
  2544. hourlyProfit = profHour * profitPrice;
  2545. hourlyProfitInt = Math.round(hourlyProfit);
  2546. }
  2547. else{
  2548. millis = 0;
  2549. hours = 0;
  2550. minutes = 0;
  2551. seconds = 0;
  2552. hourlyProfitInt = 9001;
  2553. }
  2554.  
  2555. Graphics2D g = (Graphics2D)g1;
  2556. g.setColor(color1);
  2557. g.fillRect(7, 345, 488, 70);
  2558. g.setStroke(stroke1);
  2559. g.drawRect(7, 345, 488, 70);
  2560. g.setFont(font1);
  2561. g.setColor(color2);
  2562. g.drawString("Status:", 14, 362);
  2563. g.setFont(font2);
  2564. g.drawString(status, 59, 362);
  2565. g.setFont(font1);
  2566. g.drawString("Filled Vials In Bank:", 209, 362);
  2567. g.setFont(font2);
  2568. g.drawString(Integer.toString(numFilled), 328, 362);
  2569. g.setFont(font1);
  2570. g.drawString("Profit:", 14, 383);
  2571. g.setFont(font2);
  2572. g.drawString(Integer.toString(profit), 59, 383);
  2573. g.setFont(font1);
  2574. g.drawString("Profit/hr:", 137, 383);
  2575. g.setFont(font2);
  2576. if(!save){
  2577. g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
  2578. }
  2579. else{
  2580. g.drawString("Mem Save", 190, 383);
  2581. }
  2582. g.setFont(font1);
  2583. g.drawString("Runtime:", 270, 383);
  2584. g.setFont(font2);
  2585. if(!save){
  2586. g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
  2587. }
  2588. else{
  2589. g.drawString("Mem Save", 325, 384);
  2590. }
  2591. g.setFont(font1);
  2592. g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
  2593. g.drawString("Running:", 710, 139);
  2594. g.setFont(font2);
  2595. g.drawString(isRunning, 722, 156);
  2596. g.setFont(font3);
  2597. g.drawString("Painlaws", 440, 357);
  2598.  
  2599. g1.setColor(Color.green);
  2600. g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
  2601. g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
  2602. }
  2603.  
  2604. /* Antiban stuff
  2605. * Some credits to Aaimister :)
  2606. * Partially copied, with permission
  2607. */
  2608.  
  2609. public void rotateCamera() {
  2610. final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  2611. final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  2612. final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  2613. KeyEvent.VK_UP, KeyEvent.VK_UP };
  2614. final int randomLR = random(0, 2);
  2615. final int randomUD = random(0, 2);
  2616. final int randomAll = random(0, 4);
  2617. if (random(0, 3) == 0) {
  2618. keyboard.pressKey(LR[randomLR]);
  2619. sleepCR(random(2, 9));
  2620. keyboard.pressKey(UD[randomUD]);
  2621. sleepCR(random(6, 10));
  2622. keyboard.releaseKey(UD[randomUD]);
  2623. sleepCR(random(2, 7));
  2624. keyboard.releaseKey(LR[randomLR]);
  2625. } else {
  2626. keyboard.pressKey(LRUD[randomAll]);
  2627. if (randomAll > 1) {
  2628. sleepCR(random(6, 11));
  2629. } else {
  2630. sleepCR(random(9, 12));
  2631. }
  2632. keyboard.releaseKey(LRUD[randomAll]);
  2633. }
  2634. }
  2635.  
  2636. private boolean sleepCR(final int amtOfHalfSecs) {
  2637. for (int x = 0; x < amtOfHalfSecs + 1; x++) {
  2638. sleep(random(48, 53));
  2639. }
  2640. return true;
  2641. }
  2642.  
  2643. private void antiban(){
  2644. int action = random(0, 5);
  2645.  
  2646. switch (action) {
  2647. case 0:
  2648. status = "Antiban";
  2649. rotateCamera();
  2650. sleep(200, 400);
  2651. break;
  2652. case 1:
  2653. status = "Antiban";
  2654. mouse.moveRandomly(100, 900);
  2655. sleep(200, 400);
  2656. break;
  2657. case 2:
  2658. status = "Antiban";
  2659. mouse.moveSlightly();
  2660. sleep(200, 400);
  2661. break;
  2662. case 3:
  2663. status = "Antiban";
  2664. camera.moveRandomly(random(750,1250));
  2665. sleep(200, 400);
  2666. break;
  2667. case 4:
  2668. status = "Antiban";
  2669. checkEXP();
  2670. sleep(200, 400);
  2671. break;
  2672. case 5:
  2673. status = "Antiban";
  2674. mouse.moveOffScreen();
  2675. sleep(200, 400);
  2676. break;
  2677. }
  2678. }
  2679.  
  2680. public void checkEXP() {
  2681. game.openTab(Game.Tab.STATS);
  2682. skills.doHover(Skills.INTERFACE_PRAYER);
  2683. sleep(random(2100, 3400));
  2684. game.openTab(Game.Tab.INVENTORY);
  2685. sleep(random(540,760));
  2686. }
  2687.  
  2688.  
  2689. class gui extends JFrame {
  2690. /**
  2691. *
  2692. */
  2693. private static final long serialVersionUID = 1L;
  2694. public gui() {
  2695. initComponents();
  2696. }
  2697.  
  2698. private void startButtonActionPerformed(ActionEvent e){
  2699. String mode = selectionBox.getSelectedItem().toString();
  2700. if(mode.equals("Maximum")){
  2701. antiban = false;
  2702. minSpeed = 5;
  2703. maxSpeed = 6;
  2704. }
  2705. else if(mode.equals("Paranoid")){
  2706. antiban = true;
  2707. minSpeed = 8;
  2708. maxSpeed = 10;
  2709. min = 3;
  2710. max = 3;
  2711.  
  2712. }
  2713. save = memoryMode.isSelected();
  2714. guiWait = false;
  2715. g.dispose();
  2716. }
  2717.  
  2718. private void initComponents() {
  2719. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  2720. label1 = new JLabel();
  2721. selectionBox = new JComboBox();
  2722. memoryMode = new JCheckBox();
  2723. label2 = new JLabel();
  2724. label3 = new JLabel();
  2725. label4 = new JLabel();
  2726. label5 = new JLabel();
  2727. startButton = new JButton();
  2728.  
  2729. //======== this ========
  2730. setTitle("Painlaws's Vial Filler");
  2731. setResizable(false);
  2732. Container contentPane = getContentPane();
  2733.  
  2734. //---- label1 ----
  2735. label1.setText("Mode");
  2736.  
  2737. //---- selectionBox ----
  2738. selectionBox.setModel(new DefaultComboBoxModel(new String[] {
  2739. "Normal",
  2740. "Paranoid",
  2741. "Maximum"
  2742. }));
  2743.  
  2744. //---- memoryMode ----
  2745. memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
  2746.  
  2747. //---- label2 ----
  2748. label2.setText("Modes:");
  2749.  
  2750. //---- label3 ----
  2751. label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
  2752.  
  2753. //---- label4 ----
  2754. label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
  2755.  
  2756. //---- label5 ----
  2757. label5.setText("Maximum - No Antiban, Fast Mouse Speed");
  2758.  
  2759. //---- startButton ----
  2760. startButton.setText("Let's Fill Some Vials!");
  2761. startButton.addActionListener(new ActionListener() {
  2762. public void actionPerformed(ActionEvent e){
  2763. startButtonActionPerformed(e);
  2764. }
  2765. });
  2766.  
  2767. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  2768. contentPane.setLayout(contentPaneLayout);
  2769. contentPaneLayout.setHorizontalGroup(
  2770. contentPaneLayout.createParallelGroup()
  2771. .addGroup(contentPaneLayout.createSequentialGroup()
  2772. .addGroup(contentPaneLayout.createParallelGroup()
  2773. .addGroup(contentPaneLayout.createSequentialGroup()
  2774. .addContainerGap()
  2775. .addGroup(contentPaneLayout.createParallelGroup()
  2776. .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  2777. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  2778. .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  2779. .addGroup(contentPaneLayout.createSequentialGroup()
  2780. .addComponent(label1)
  2781. .addGap(18, 18, 18)
  2782. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  2783. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  2784. .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  2785. .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  2786. .addGroup(contentPaneLayout.createSequentialGroup()
  2787. .addGap(148, 148, 148)
  2788. .addComponent(startButton)))
  2789. .addContainerGap(2, Short.MAX_VALUE))
  2790. );
  2791. contentPaneLayout.setVerticalGroup(
  2792. contentPaneLayout.createParallelGroup()
  2793. .addGroup(contentPaneLayout.createSequentialGroup()
  2794. .addContainerGap()
  2795. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  2796. .addComponent(label1)
  2797. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  2798. .addGap(18, 18, 18)
  2799. .addComponent(memoryMode)
  2800. .addGap(18, 18, 18)
  2801. .addComponent(label2)
  2802. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  2803. .addComponent(label3)
  2804. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  2805. .addComponent(label4)
  2806. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  2807. .addComponent(label5)
  2808. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
  2809. .addComponent(startButton)
  2810. .addContainerGap())
  2811. );
  2812. pack();
  2813. setLocationRelativeTo(getOwner());
  2814. // JFormDesigner - End of component initialization //GEN-END:initComponents
  2815. }
  2816.  
  2817. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  2818. private JLabel label1;
  2819. private JComboBox selectionBox;
  2820. private JCheckBox memoryMode;
  2821. private JLabel label2;
  2822. private JLabel label3;
  2823. private JLabel label4;
  2824. private JLabel label5;
  2825. private JButton startButton;
  2826. // JFormDesigner - End of variables declaration //GEN-END:variables
  2827. }
  2828.  
  2829.  
  2830. }
  2831. import java.awt.*;
  2832. import java.awt.event.*;
  2833. import javax.swing.*;
  2834. import java.awt.event.KeyEvent;
  2835. import org.rsbot.event.listeners.PaintListener;
  2836. import org.rsbot.script.Script;
  2837. import org.rsbot.script.ScriptManifest;
  2838. import org.rsbot.script.methods.*;
  2839. import org.rsbot.script.wrappers.*;
  2840.  
  2841. @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
  2842. public class vialfiller extends Script implements PaintListener{
  2843. //Variables
  2844. // - Essentials
  2845. private int bankerID = 6533;
  2846. private int fountainID = 24214;
  2847. private int emptyVialID = 229;
  2848. private int fullVialID = 227;
  2849. private int runEnergy = 50;
  2850. RSNPC banker;
  2851. RSObject fountain;
  2852. RSItem myVial;
  2853. RSTile theBank = new RSTile(3167, 3489);
  2854. RSTile theFountain = new RSTile(3191, 3471);
  2855. RSTile glitchSpot = new RSTile(3192, 3487);
  2856. RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
  2857. RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
  2858. RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
  2859. RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
  2860.  
  2861. // - GUI Options
  2862. private int min = 1;
  2863. private int max = 6;
  2864. private int minSpeed = 6;
  2865. private int maxSpeed = 9;
  2866. private boolean guiWait = true;
  2867. private boolean save = false;
  2868.  
  2869. // - State check
  2870. private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
  2871.  
  2872. // - Paint stuff
  2873. private String status = "Initializing...";
  2874. private String isRunning = "";
  2875. private int numFilled = 0;
  2876. private int vialFilledPrice;
  2877. private int vialEmptyPrice;
  2878. private int profitPrice;
  2879. private int profit;
  2880. private long startTime;
  2881. private long millis;
  2882. private long hours;
  2883. private long minutes;
  2884. private long seconds;
  2885. private float profSec = 0;
  2886. private float profHour;
  2887. private float hourlyProfit;
  2888. private int hourlyProfitInt;
  2889. private final Color color1 = new Color(0, 0, 0);
  2890. private final Color color2 = new Color(255, 255, 255);
  2891. private final BasicStroke stroke1 = new BasicStroke(1);
  2892. private final Font font1 = new Font("Arial", 0, 13);
  2893. private final Font font2 = new Font("Arial", 1, 13);
  2894. private final Font font3 = new Font("Vijaya", 1, 17);
  2895. private boolean antiban = true;
  2896. gui g = new gui();
  2897.  
  2898. @Override
  2899. public boolean onStart(){
  2900. log("Welcome to Painlaws's Vial Filler");
  2901. log("Waiting on GUI...");
  2902. g.setVisible(true);
  2903. while(guiWait){
  2904. sleep(500);
  2905. }
  2906. log("GUI Settings loaded!");
  2907. if(walking.isRunEnabled()){
  2908. isRunning = "Yes";
  2909. }
  2910. else{
  2911. isRunning = "No";
  2912. }
  2913. vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
  2914. vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
  2915. profitPrice = vialFilledPrice - vialEmptyPrice;
  2916. if(!save){
  2917. startTime = System.currentTimeMillis();
  2918. }
  2919. else{
  2920. startTime = 0;
  2921. }
  2922. return true;
  2923. }
  2924.  
  2925. @Override
  2926. public void onFinish(){
  2927. env.saveScreenshot(true);
  2928. log("^ Don't forget to upload this proggie :P");
  2929. log("Bye! PM Painlaws for comments/questions/requests");
  2930. }
  2931.  
  2932. public void useItem(RSItem item, RSObject object){
  2933. if(item != null && object != null && object.isOnScreen()){
  2934. item.doClick(true);
  2935. sleep(200, 300);
  2936. object.doClick();
  2937. }
  2938. }
  2939.  
  2940. public void fillVials(){
  2941. if(fountain != null){
  2942. status = "Filling Vials";
  2943. useItem(myVial, fountain);
  2944. while(inventory.contains(emptyVialID)){
  2945. sleep(random(1000,1500));
  2946. if(antiban){
  2947. if(random(1, 3) == 2){
  2948. mouse.moveSlightly();
  2949. }
  2950. }
  2951. }
  2952. status = "Vials filled";
  2953. }
  2954. else{
  2955. status = "Fountain is null...retrying";
  2956. sleep(random(600, 800));
  2957. }
  2958. }
  2959.  
  2960. private void doBank(){
  2961. try{
  2962. if(banker != null){
  2963. camera.turnTo(banker);
  2964. if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
  2965. status = "Opening Bank";
  2966. banker.interact("Bank Banker");
  2967. status = "Bank opened";
  2968. sleep(random(900, 1050));
  2969. status = "Depositing All";
  2970. bank.depositAll();
  2971. status = "Deposited All";
  2972. sleep(random(780, 950));
  2973. numFilled = bank.getCount(fullVialID);
  2974. if(bank.getCount(emptyVialID) != 0){
  2975. status = "Taking Vials";
  2976. bank.withdraw(emptyVialID, 0);
  2977. status = "Vials Taken";
  2978. sleep(random(700, 960));
  2979. }
  2980. else{
  2981. log("Out of vials. Quitting :/");
  2982. bank.close();
  2983. env.saveScreenshot(true);
  2984. log("^ Don't forget to upload this proggie :P");
  2985. log("Bye! PM Painlaws for comments/questions/requests");
  2986. stopScript(true);
  2987. }
  2988. status = "Closing Bank";
  2989. bank.close();
  2990. status = "Bank Closed";
  2991. sleep(random(750, 910));
  2992. }
  2993. }
  2994. sleep(random(300,500));
  2995. }catch(Exception e){log(e);}
  2996. }
  2997.  
  2998. public void onToBank(){
  2999. try{
  3000. status = "Going to Bank";
  3001. walking.walkTileMM(theBank);
  3002. }catch(Exception e){log(e);}
  3003. sleep(random(500, 700));
  3004. }
  3005.  
  3006. public void onToGlitch(){
  3007. try{
  3008. status = "Going to Fountain"; //What you don't know can't hurt you :P
  3009. walking.walkTileMM(glitchSpot);
  3010. }catch(Exception e){log(e);}
  3011. sleep(random(500, 710));
  3012. }
  3013.  
  3014. public void onToFountain(){
  3015. try{
  3016. status = "Going to Fountain";
  3017. walking.walkTileMM(theFountain);
  3018. }catch(Exception e){log(e);}
  3019. sleep(random(500, 705));
  3020. }
  3021.  
  3022. public void runcheck() {
  3023. try{
  3024. runEnergy = (random(50, 70));
  3025. if (walking.isRunEnabled()){
  3026. isRunning = "Yes";
  3027. }
  3028. else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
  3029. walking.setRun(true);
  3030. isRunning = "Yes";
  3031. sleep(random(300, 500));
  3032. }
  3033. else{
  3034. isRunning = "No";
  3035. sleep(random(300,500));
  3036. }
  3037. }catch(Exception ex){}
  3038. }
  3039.  
  3040. @Override
  3041. public int loop(){
  3042. mouse.setSpeed(random(minSpeed, maxSpeed));
  3043. runcheck();
  3044. if(antiban){
  3045. if(random(min, max) == 3){
  3046. antiban();
  3047. }
  3048. }
  3049. if(objects.getNearest(fountainID) != null){
  3050. fountain = objects.getNearest(fountainID);
  3051. }
  3052. if(npcs.getNearest(bankerID) != null){
  3053. banker = npcs.getNearest(bankerID);
  3054. }
  3055. if(inventory.getItem(emptyVialID) != null){
  3056. myVial = inventory.getItem(emptyVialID);
  3057. }
  3058. switch(getState()){
  3059. case TOFOUNTAIN:
  3060. runcheck();
  3061. onToFountain();
  3062. if(fountainRange.contains(players.getMyPlayer().getLocation())){
  3063. fillVials();
  3064. }
  3065. break;
  3066.  
  3067. case TOGLITCH:
  3068. runcheck();
  3069. onToGlitch();
  3070. break;
  3071.  
  3072. case TOBANK:
  3073. runcheck();
  3074. onToBank();
  3075. if(bankRange.contains(players.getMyPlayer().getLocation())){
  3076. doBank();
  3077. }
  3078. break;
  3079. }
  3080. return(random(500, 1000));
  3081. }
  3082.  
  3083. private State getState() {
  3084. if (!inventory.contains(emptyVialID)) {
  3085. return State.TOBANK;
  3086. }
  3087. else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
  3088. return State.TOGLITCH;
  3089. }
  3090. else{
  3091. return State.TOFOUNTAIN;
  3092. }
  3093. }
  3094.  
  3095. // GUI and Mouse
  3096. public void onRepaint(Graphics g1) {
  3097. profit = numFilled * profitPrice;
  3098. if(!save){
  3099. millis = System.currentTimeMillis() - startTime;
  3100. hours = millis / (1000 * 60 * 60);
  3101. millis -= hours * (1000 * 60 * 60);
  3102. minutes = millis / (1000 * 60);
  3103. millis -= minutes * (1000 * 60);
  3104. seconds = millis / 1000;
  3105.  
  3106. if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
  3107. profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
  3108. }
  3109. profHour = profSec * 3600;
  3110. hourlyProfit = profHour * profitPrice;
  3111. hourlyProfitInt = Math.round(hourlyProfit);
  3112. }
  3113. else{
  3114. millis = 0;
  3115. hours = 0;
  3116. minutes = 0;
  3117. seconds = 0;
  3118. hourlyProfitInt = 9001;
  3119. }
  3120.  
  3121. Graphics2D g = (Graphics2D)g1;
  3122. g.setColor(color1);
  3123. g.fillRect(7, 345, 488, 70);
  3124. g.setStroke(stroke1);
  3125. g.drawRect(7, 345, 488, 70);
  3126. g.setFont(font1);
  3127. g.setColor(color2);
  3128. g.drawString("Status:", 14, 362);
  3129. g.setFont(font2);
  3130. g.drawString(status, 59, 362);
  3131. g.setFont(font1);
  3132. g.drawString("Filled Vials In Bank:", 209, 362);
  3133. g.setFont(font2);
  3134. g.drawString(Integer.toString(numFilled), 328, 362);
  3135. g.setFont(font1);
  3136. g.drawString("Profit:", 14, 383);
  3137. g.setFont(font2);
  3138. g.drawString(Integer.toString(profit), 59, 383);
  3139. g.setFont(font1);
  3140. g.drawString("Profit/hr:", 137, 383);
  3141. g.setFont(font2);
  3142. if(!save){
  3143. g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
  3144. }
  3145. else{
  3146. g.drawString("Mem Save", 190, 383);
  3147. }
  3148. g.setFont(font1);
  3149. g.drawString("Runtime:", 270, 383);
  3150. g.setFont(font2);
  3151. if(!save){
  3152. g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
  3153. }
  3154. else{
  3155. g.drawString("Mem Save", 325, 384);
  3156. }
  3157. g.setFont(font1);
  3158. g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
  3159. g.drawString("Running:", 710, 139);
  3160. g.setFont(font2);
  3161. g.drawString(isRunning, 722, 156);
  3162. g.setFont(font3);
  3163. g.drawString("Painlaws", 440, 357);
  3164.  
  3165. g1.setColor(Color.green);
  3166. g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
  3167. g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
  3168. }
  3169.  
  3170. /* Antiban stuff
  3171. * Some credits to Aaimister :)
  3172. * Partially copied, with permission
  3173. */
  3174.  
  3175. public void rotateCamera() {
  3176. final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  3177. final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  3178. final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  3179. KeyEvent.VK_UP, KeyEvent.VK_UP };
  3180. final int randomLR = random(0, 2);
  3181. final int randomUD = random(0, 2);
  3182. final int randomAll = random(0, 4);
  3183. if (random(0, 3) == 0) {
  3184. keyboard.pressKey(LR[randomLR]);
  3185. sleepCR(random(2, 9));
  3186. keyboard.pressKey(UD[randomUD]);
  3187. sleepCR(random(6, 10));
  3188. keyboard.releaseKey(UD[randomUD]);
  3189. sleepCR(random(2, 7));
  3190. keyboard.releaseKey(LR[randomLR]);
  3191. } else {
  3192. keyboard.pressKey(LRUD[randomAll]);
  3193. if (randomAll > 1) {
  3194. sleepCR(random(6, 11));
  3195. } else {
  3196. sleepCR(random(9, 12));
  3197. }
  3198. keyboard.releaseKey(LRUD[randomAll]);
  3199. }
  3200. }
  3201.  
  3202. private boolean sleepCR(final int amtOfHalfSecs) {
  3203. for (int x = 0; x < amtOfHalfSecs + 1; x++) {
  3204. sleep(random(48, 53));
  3205. }
  3206. return true;
  3207. }
  3208.  
  3209. private void antiban(){
  3210. int action = random(0, 5);
  3211.  
  3212. switch (action) {
  3213. case 0:
  3214. status = "Antiban";
  3215. rotateCamera();
  3216. sleep(200, 400);
  3217. break;
  3218. case 1:
  3219. status = "Antiban";
  3220. mouse.moveRandomly(100, 900);
  3221. sleep(200, 400);
  3222. break;
  3223. case 2:
  3224. status = "Antiban";
  3225. mouse.moveSlightly();
  3226. sleep(200, 400);
  3227. break;
  3228. case 3:
  3229. status = "Antiban";
  3230. camera.moveRandomly(random(750,1250));
  3231. sleep(200, 400);
  3232. break;
  3233. case 4:
  3234. status = "Antiban";
  3235. checkEXP();
  3236. sleep(200, 400);
  3237. break;
  3238. case 5:
  3239. status = "Antiban";
  3240. mouse.moveOffScreen();
  3241. sleep(200, 400);
  3242. break;
  3243. }
  3244. }
  3245.  
  3246. public void checkEXP() {
  3247. game.openTab(Game.Tab.STATS);
  3248. skills.doHover(Skills.INTERFACE_PRAYER);
  3249. sleep(random(2100, 3400));
  3250. game.openTab(Game.Tab.INVENTORY);
  3251. sleep(random(540,760));
  3252. }
  3253.  
  3254.  
  3255. class gui extends JFrame {
  3256. /**
  3257. *
  3258. */
  3259. private static final long serialVersionUID = 1L;
  3260. public gui() {
  3261. initComponents();
  3262. }
  3263.  
  3264. private void startButtonActionPerformed(ActionEvent e){
  3265. String mode = selectionBox.getSelectedItem().toString();
  3266. if(mode.equals("Maximum")){
  3267. antiban = false;
  3268. minSpeed = 5;
  3269. maxSpeed = 6;
  3270. }
  3271. else if(mode.equals("Paranoid")){
  3272. antiban = true;
  3273. minSpeed = 8;
  3274. maxSpeed = 10;
  3275. min = 3;
  3276. max = 3;
  3277.  
  3278. }
  3279. save = memoryMode.isSelected();
  3280. guiWait = false;
  3281. g.dispose();
  3282. }
  3283.  
  3284. private void initComponents() {
  3285. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  3286. label1 = new JLabel();
  3287. selectionBox = new JComboBox();
  3288. memoryMode = new JCheckBox();
  3289. label2 = new JLabel();
  3290. label3 = new JLabel();
  3291. label4 = new JLabel();
  3292. label5 = new JLabel();
  3293. startButton = new JButton();
  3294.  
  3295. //======== this ========
  3296. setTitle("Painlaws's Vial Filler");
  3297. setResizable(false);
  3298. Container contentPane = getContentPane();
  3299.  
  3300. //---- label1 ----
  3301. label1.setText("Mode");
  3302.  
  3303. //---- selectionBox ----
  3304. selectionBox.setModel(new DefaultComboBoxModel(new String[] {
  3305. "Normal",
  3306. "Paranoid",
  3307. "Maximum"
  3308. }));
  3309.  
  3310. //---- memoryMode ----
  3311. memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
  3312.  
  3313. //---- label2 ----
  3314. label2.setText("Modes:");
  3315.  
  3316. //---- label3 ----
  3317. label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
  3318.  
  3319. //---- label4 ----
  3320. label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
  3321.  
  3322. //---- label5 ----
  3323. label5.setText("Maximum - No Antiban, Fast Mouse Speed");
  3324.  
  3325. //---- startButton ----
  3326. startButton.setText("Let's Fill Some Vials!");
  3327. startButton.addActionListener(new ActionListener() {
  3328. public void actionPerformed(ActionEvent e){
  3329. startButtonActionPerformed(e);
  3330. }
  3331. });
  3332.  
  3333. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  3334. contentPane.setLayout(contentPaneLayout);
  3335. contentPaneLayout.setHorizontalGroup(
  3336. contentPaneLayout.createParallelGroup()
  3337. .addGroup(contentPaneLayout.createSequentialGroup()
  3338. .addGroup(contentPaneLayout.createParallelGroup()
  3339. .addGroup(contentPaneLayout.createSequentialGroup()
  3340. .addContainerGap()
  3341. .addGroup(contentPaneLayout.createParallelGroup()
  3342. .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  3343. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  3344. .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  3345. .addGroup(contentPaneLayout.createSequentialGroup()
  3346. .addComponent(label1)
  3347. .addGap(18, 18, 18)
  3348. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  3349. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  3350. .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  3351. .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  3352. .addGroup(contentPaneLayout.createSequentialGroup()
  3353. .addGap(148, 148, 148)
  3354. .addComponent(startButton)))
  3355. .addContainerGap(2, Short.MAX_VALUE))
  3356. );
  3357. contentPaneLayout.setVerticalGroup(
  3358. contentPaneLayout.createParallelGroup()
  3359. .addGroup(contentPaneLayout.createSequentialGroup()
  3360. .addContainerGap()
  3361. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  3362. .addComponent(label1)
  3363. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  3364. .addGap(18, 18, 18)
  3365. .addComponent(memoryMode)
  3366. .addGap(18, 18, 18)
  3367. .addComponent(label2)
  3368. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  3369. .addComponent(label3)
  3370. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  3371. .addComponent(label4)
  3372. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  3373. .addComponent(label5)
  3374. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
  3375. .addComponent(startButton)
  3376. .addContainerGap())
  3377. );
  3378. pack();
  3379. setLocationRelativeTo(getOwner());
  3380. // JFormDesigner - End of component initialization //GEN-END:initComponents
  3381. }
  3382.  
  3383. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  3384. private JLabel label1;
  3385. private JComboBox selectionBox;
  3386. private JCheckBox memoryMode;
  3387. private JLabel label2;
  3388. private JLabel label3;
  3389. private JLabel label4;
  3390. private JLabel label5;
  3391. private JButton startButton;
  3392. // JFormDesigner - End of variables declaration //GEN-END:variables
  3393. }
  3394.  
  3395.  
  3396. }
  3397. import java.awt.*;
  3398. import java.awt.event.*;
  3399. import javax.swing.*;
  3400. import java.awt.event.KeyEvent;
  3401. import org.rsbot.event.listeners.PaintListener;
  3402. import org.rsbot.script.Script;
  3403. import org.rsbot.script.ScriptManifest;
  3404. import org.rsbot.script.methods.*;
  3405. import org.rsbot.script.wrappers.*;
  3406.  
  3407. @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
  3408. public class vialfiller extends Script implements PaintListener{
  3409. //Variables
  3410. // - Essentials
  3411. private int bankerID = 6533;
  3412. private int fountainID = 24214;
  3413. private int emptyVialID = 229;
  3414. private int fullVialID = 227;
  3415. private int runEnergy = 50;
  3416. RSNPC banker;
  3417. RSObject fountain;
  3418. RSItem myVial;
  3419. RSTile theBank = new RSTile(3167, 3489);
  3420. RSTile theFountain = new RSTile(3191, 3471);
  3421. RSTile glitchSpot = new RSTile(3192, 3487);
  3422. RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
  3423. RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
  3424. RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
  3425. RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
  3426.  
  3427. // - GUI Options
  3428. private int min = 1;
  3429. private int max = 6;
  3430. private int minSpeed = 6;
  3431. private int maxSpeed = 9;
  3432. private boolean guiWait = true;
  3433. private boolean save = false;
  3434.  
  3435. // - State check
  3436. private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
  3437.  
  3438. // - Paint stuff
  3439. private String status = "Initializing...";
  3440. private String isRunning = "";
  3441. private int numFilled = 0;
  3442. private int vialFilledPrice;
  3443. private int vialEmptyPrice;
  3444. private int profitPrice;
  3445. private int profit;
  3446. private long startTime;
  3447. private long millis;
  3448. private long hours;
  3449. private long minutes;
  3450. private long seconds;
  3451. private float profSec = 0;
  3452. private float profHour;
  3453. private float hourlyProfit;
  3454. private int hourlyProfitInt;
  3455. private final Color color1 = new Color(0, 0, 0);
  3456. private final Color color2 = new Color(255, 255, 255);
  3457. private final BasicStroke stroke1 = new BasicStroke(1);
  3458. private final Font font1 = new Font("Arial", 0, 13);
  3459. private final Font font2 = new Font("Arial", 1, 13);
  3460. private final Font font3 = new Font("Vijaya", 1, 17);
  3461. private boolean antiban = true;
  3462. gui g = new gui();
  3463.  
  3464. @Override
  3465. public boolean onStart(){
  3466. log("Welcome to Painlaws's Vial Filler");
  3467. log("Waiting on GUI...");
  3468. g.setVisible(true);
  3469. while(guiWait){
  3470. sleep(500);
  3471. }
  3472. log("GUI Settings loaded!");
  3473. if(walking.isRunEnabled()){
  3474. isRunning = "Yes";
  3475. }
  3476. else{
  3477. isRunning = "No";
  3478. }
  3479. vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
  3480. vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
  3481. profitPrice = vialFilledPrice - vialEmptyPrice;
  3482. if(!save){
  3483. startTime = System.currentTimeMillis();
  3484. }
  3485. else{
  3486. startTime = 0;
  3487. }
  3488. return true;
  3489. }
  3490.  
  3491. @Override
  3492. public void onFinish(){
  3493. env.saveScreenshot(true);
  3494. log("^ Don't forget to upload this proggie :P");
  3495. log("Bye! PM Painlaws for comments/questions/requests");
  3496. }
  3497.  
  3498. public void useItem(RSItem item, RSObject object){
  3499. if(item != null && object != null && object.isOnScreen()){
  3500. item.doClick(true);
  3501. sleep(200, 300);
  3502. object.doClick();
  3503. }
  3504. }
  3505.  
  3506. public void fillVials(){
  3507. if(fountain != null){
  3508. status = "Filling Vials";
  3509. useItem(myVial, fountain);
  3510. while(inventory.contains(emptyVialID)){
  3511. sleep(random(1000,1500));
  3512. if(antiban){
  3513. if(random(1, 3) == 2){
  3514. mouse.moveSlightly();
  3515. }
  3516. }
  3517. }
  3518. status = "Vials filled";
  3519. }
  3520. else{
  3521. status = "Fountain is null...retrying";
  3522. sleep(random(600, 800));
  3523. }
  3524. }
  3525.  
  3526. private void doBank(){
  3527. try{
  3528. if(banker != null){
  3529. camera.turnTo(banker);
  3530. if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
  3531. status = "Opening Bank";
  3532. banker.interact("Bank Banker");
  3533. status = "Bank opened";
  3534. sleep(random(900, 1050));
  3535. status = "Depositing All";
  3536. bank.depositAll();
  3537. status = "Deposited All";
  3538. sleep(random(780, 950));
  3539. numFilled = bank.getCount(fullVialID);
  3540. if(bank.getCount(emptyVialID) != 0){
  3541. status = "Taking Vials";
  3542. bank.withdraw(emptyVialID, 0);
  3543. status = "Vials Taken";
  3544. sleep(random(700, 960));
  3545. }
  3546. else{
  3547. log("Out of vials. Quitting :/");
  3548. bank.close();
  3549. env.saveScreenshot(true);
  3550. log("^ Don't forget to upload this proggie :P");
  3551. log("Bye! PM Painlaws for comments/questions/requests");
  3552. stopScript(true);
  3553. }
  3554. status = "Closing Bank";
  3555. bank.close();
  3556. status = "Bank Closed";
  3557. sleep(random(750, 910));
  3558. }
  3559. }
  3560. sleep(random(300,500));
  3561. }catch(Exception e){log(e);}
  3562. }
  3563.  
  3564. public void onToBank(){
  3565. try{
  3566. status = "Going to Bank";
  3567. walking.walkTileMM(theBank);
  3568. }catch(Exception e){log(e);}
  3569. sleep(random(500, 700));
  3570. }
  3571.  
  3572. public void onToGlitch(){
  3573. try{
  3574. status = "Going to Fountain"; //What you don't know can't hurt you :P
  3575. walking.walkTileMM(glitchSpot);
  3576. }catch(Exception e){log(e);}
  3577. sleep(random(500, 710));
  3578. }
  3579.  
  3580. public void onToFountain(){
  3581. try{
  3582. status = "Going to Fountain";
  3583. walking.walkTileMM(theFountain);
  3584. }catch(Exception e){log(e);}
  3585. sleep(random(500, 705));
  3586. }
  3587.  
  3588. public void runcheck() {
  3589. try{
  3590. runEnergy = (random(50, 70));
  3591. if (walking.isRunEnabled()){
  3592. isRunning = "Yes";
  3593. }
  3594. else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
  3595. walking.setRun(true);
  3596. isRunning = "Yes";
  3597. sleep(random(300, 500));
  3598. }
  3599. else{
  3600. isRunning = "No";
  3601. sleep(random(300,500));
  3602. }
  3603. }catch(Exception ex){}
  3604. }
  3605.  
  3606. @Override
  3607. public int loop(){
  3608. mouse.setSpeed(random(minSpeed, maxSpeed));
  3609. runcheck();
  3610. if(antiban){
  3611. if(random(min, max) == 3){
  3612. antiban();
  3613. }
  3614. }
  3615. if(objects.getNearest(fountainID) != null){
  3616. fountain = objects.getNearest(fountainID);
  3617. }
  3618. if(npcs.getNearest(bankerID) != null){
  3619. banker = npcs.getNearest(bankerID);
  3620. }
  3621. if(inventory.getItem(emptyVialID) != null){
  3622. myVial = inventory.getItem(emptyVialID);
  3623. }
  3624. switch(getState()){
  3625. case TOFOUNTAIN:
  3626. runcheck();
  3627. onToFountain();
  3628. if(fountainRange.contains(players.getMyPlayer().getLocation())){
  3629. fillVials();
  3630. }
  3631. break;
  3632.  
  3633. case TOGLITCH:
  3634. runcheck();
  3635. onToGlitch();
  3636. break;
  3637.  
  3638. case TOBANK:
  3639. runcheck();
  3640. onToBank();
  3641. if(bankRange.contains(players.getMyPlayer().getLocation())){
  3642. doBank();
  3643. }
  3644. break;
  3645. }
  3646. return(random(500, 1000));
  3647. }
  3648.  
  3649. private State getState() {
  3650. if (!inventory.contains(emptyVialID)) {
  3651. return State.TOBANK;
  3652. }
  3653. else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
  3654. return State.TOGLITCH;
  3655. }
  3656. else{
  3657. return State.TOFOUNTAIN;
  3658. }
  3659. }
  3660.  
  3661. // GUI and Mouse
  3662. public void onRepaint(Graphics g1) {
  3663. profit = numFilled * profitPrice;
  3664. if(!save){
  3665. millis = System.currentTimeMillis() - startTime;
  3666. hours = millis / (1000 * 60 * 60);
  3667. millis -= hours * (1000 * 60 * 60);
  3668. minutes = millis / (1000 * 60);
  3669. millis -= minutes * (1000 * 60);
  3670. seconds = millis / 1000;
  3671.  
  3672. if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
  3673. profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
  3674. }
  3675. profHour = profSec * 3600;
  3676. hourlyProfit = profHour * profitPrice;
  3677. hourlyProfitInt = Math.round(hourlyProfit);
  3678. }
  3679. else{
  3680. millis = 0;
  3681. hours = 0;
  3682. minutes = 0;
  3683. seconds = 0;
  3684. hourlyProfitInt = 9001;
  3685. }
  3686.  
  3687. Graphics2D g = (Graphics2D)g1;
  3688. g.setColor(color1);
  3689. g.fillRect(7, 345, 488, 70);
  3690. g.setStroke(stroke1);
  3691. g.drawRect(7, 345, 488, 70);
  3692. g.setFont(font1);
  3693. g.setColor(color2);
  3694. g.drawString("Status:", 14, 362);
  3695. g.setFont(font2);
  3696. g.drawString(status, 59, 362);
  3697. g.setFont(font1);
  3698. g.drawString("Filled Vials In Bank:", 209, 362);
  3699. g.setFont(font2);
  3700. g.drawString(Integer.toString(numFilled), 328, 362);
  3701. g.setFont(font1);
  3702. g.drawString("Profit:", 14, 383);
  3703. g.setFont(font2);
  3704. g.drawString(Integer.toString(profit), 59, 383);
  3705. g.setFont(font1);
  3706. g.drawString("Profit/hr:", 137, 383);
  3707. g.setFont(font2);
  3708. if(!save){
  3709. g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
  3710. }
  3711. else{
  3712. g.drawString("Mem Save", 190, 383);
  3713. }
  3714. g.setFont(font1);
  3715. g.drawString("Runtime:", 270, 383);
  3716. g.setFont(font2);
  3717. if(!save){
  3718. g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
  3719. }
  3720. else{
  3721. g.drawString("Mem Save", 325, 384);
  3722. }
  3723. g.setFont(font1);
  3724. g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
  3725. g.drawString("Running:", 710, 139);
  3726. g.setFont(font2);
  3727. g.drawString(isRunning, 722, 156);
  3728. g.setFont(font3);
  3729. g.drawString("Painlaws", 440, 357);
  3730.  
  3731. g1.setColor(Color.green);
  3732. g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
  3733. g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
  3734. }
  3735.  
  3736. /* Antiban stuff
  3737. * Some credits to Aaimister :)
  3738. * Partially copied, with permission
  3739. */
  3740.  
  3741. public void rotateCamera() {
  3742. final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  3743. final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  3744. final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  3745. KeyEvent.VK_UP, KeyEvent.VK_UP };
  3746. final int randomLR = random(0, 2);
  3747. final int randomUD = random(0, 2);
  3748. final int randomAll = random(0, 4);
  3749. if (random(0, 3) == 0) {
  3750. keyboard.pressKey(LR[randomLR]);
  3751. sleepCR(random(2, 9));
  3752. keyboard.pressKey(UD[randomUD]);
  3753. sleepCR(random(6, 10));
  3754. keyboard.releaseKey(UD[randomUD]);
  3755. sleepCR(random(2, 7));
  3756. keyboard.releaseKey(LR[randomLR]);
  3757. } else {
  3758. keyboard.pressKey(LRUD[randomAll]);
  3759. if (randomAll > 1) {
  3760. sleepCR(random(6, 11));
  3761. } else {
  3762. sleepCR(random(9, 12));
  3763. }
  3764. keyboard.releaseKey(LRUD[randomAll]);
  3765. }
  3766. }
  3767.  
  3768. private boolean sleepCR(final int amtOfHalfSecs) {
  3769. for (int x = 0; x < amtOfHalfSecs + 1; x++) {
  3770. sleep(random(48, 53));
  3771. }
  3772. return true;
  3773. }
  3774.  
  3775. private void antiban(){
  3776. int action = random(0, 5);
  3777.  
  3778. switch (action) {
  3779. case 0:
  3780. status = "Antiban";
  3781. rotateCamera();
  3782. sleep(200, 400);
  3783. break;
  3784. case 1:
  3785. status = "Antiban";
  3786. mouse.moveRandomly(100, 900);
  3787. sleep(200, 400);
  3788. break;
  3789. case 2:
  3790. status = "Antiban";
  3791. mouse.moveSlightly();
  3792. sleep(200, 400);
  3793. break;
  3794. case 3:
  3795. status = "Antiban";
  3796. camera.moveRandomly(random(750,1250));
  3797. sleep(200, 400);
  3798. break;
  3799. case 4:
  3800. status = "Antiban";
  3801. checkEXP();
  3802. sleep(200, 400);
  3803. break;
  3804. case 5:
  3805. status = "Antiban";
  3806. mouse.moveOffScreen();
  3807. sleep(200, 400);
  3808. break;
  3809. }
  3810. }
  3811.  
  3812. public void checkEXP() {
  3813. game.openTab(Game.Tab.STATS);
  3814. skills.doHover(Skills.INTERFACE_PRAYER);
  3815. sleep(random(2100, 3400));
  3816. game.openTab(Game.Tab.INVENTORY);
  3817. sleep(random(540,760));
  3818. }
  3819.  
  3820.  
  3821. class gui extends JFrame {
  3822. /**
  3823. *
  3824. */
  3825. private static final long serialVersionUID = 1L;
  3826. public gui() {
  3827. initComponents();
  3828. }
  3829.  
  3830. private void startButtonActionPerformed(ActionEvent e){
  3831. String mode = selectionBox.getSelectedItem().toString();
  3832. if(mode.equals("Maximum")){
  3833. antiban = false;
  3834. minSpeed = 5;
  3835. maxSpeed = 6;
  3836. }
  3837. else if(mode.equals("Paranoid")){
  3838. antiban = true;
  3839. minSpeed = 8;
  3840. maxSpeed = 10;
  3841. min = 3;
  3842. max = 3;
  3843.  
  3844. }
  3845. save = memoryMode.isSelected();
  3846. guiWait = false;
  3847. g.dispose();
  3848. }
  3849.  
  3850. private void initComponents() {
  3851. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  3852. label1 = new JLabel();
  3853. selectionBox = new JComboBox();
  3854. memoryMode = new JCheckBox();
  3855. label2 = new JLabel();
  3856. label3 = new JLabel();
  3857. label4 = new JLabel();
  3858. label5 = new JLabel();
  3859. startButton = new JButton();
  3860.  
  3861. //======== this ========
  3862. setTitle("Painlaws's Vial Filler");
  3863. setResizable(false);
  3864. Container contentPane = getContentPane();
  3865.  
  3866. //---- label1 ----
  3867. label1.setText("Mode");
  3868.  
  3869. //---- selectionBox ----
  3870. selectionBox.setModel(new DefaultComboBoxModel(new String[] {
  3871. "Normal",
  3872. "Paranoid",
  3873. "Maximum"
  3874. }));
  3875.  
  3876. //---- memoryMode ----
  3877. memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
  3878.  
  3879. //---- label2 ----
  3880. label2.setText("Modes:");
  3881.  
  3882. //---- label3 ----
  3883. label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
  3884.  
  3885. //---- label4 ----
  3886. label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
  3887.  
  3888. //---- label5 ----
  3889. label5.setText("Maximum - No Antiban, Fast Mouse Speed");
  3890.  
  3891. //---- startButton ----
  3892. startButton.setText("Let's Fill Some Vials!");
  3893. startButton.addActionListener(new ActionListener() {
  3894. public void actionPerformed(ActionEvent e){
  3895. startButtonActionPerformed(e);
  3896. }
  3897. });
  3898.  
  3899. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  3900. contentPane.setLayout(contentPaneLayout);
  3901. contentPaneLayout.setHorizontalGroup(
  3902. contentPaneLayout.createParallelGroup()
  3903. .addGroup(contentPaneLayout.createSequentialGroup()
  3904. .addGroup(contentPaneLayout.createParallelGroup()
  3905. .addGroup(contentPaneLayout.createSequentialGroup()
  3906. .addContainerGap()
  3907. .addGroup(contentPaneLayout.createParallelGroup()
  3908. .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  3909. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  3910. .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  3911. .addGroup(contentPaneLayout.createSequentialGroup()
  3912. .addComponent(label1)
  3913. .addGap(18, 18, 18)
  3914. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  3915. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  3916. .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  3917. .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  3918. .addGroup(contentPaneLayout.createSequentialGroup()
  3919. .addGap(148, 148, 148)
  3920. .addComponent(startButton)))
  3921. .addContainerGap(2, Short.MAX_VALUE))
  3922. );
  3923. contentPaneLayout.setVerticalGroup(
  3924. contentPaneLayout.createParallelGroup()
  3925. .addGroup(contentPaneLayout.createSequentialGroup()
  3926. .addContainerGap()
  3927. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  3928. .addComponent(label1)
  3929. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  3930. .addGap(18, 18, 18)
  3931. .addComponent(memoryMode)
  3932. .addGap(18, 18, 18)
  3933. .addComponent(label2)
  3934. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  3935. .addComponent(label3)
  3936. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  3937. .addComponent(label4)
  3938. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  3939. .addComponent(label5)
  3940. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
  3941. .addComponent(startButton)
  3942. .addContainerGap())
  3943. );
  3944. pack();
  3945. setLocationRelativeTo(getOwner());
  3946. // JFormDesigner - End of component initialization //GEN-END:initComponents
  3947. }
  3948.  
  3949. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  3950. private JLabel label1;
  3951. private JComboBox selectionBox;
  3952. private JCheckBox memoryMode;
  3953. private JLabel label2;
  3954. private JLabel label3;
  3955. private JLabel label4;
  3956. private JLabel label5;
  3957. private JButton startButton;
  3958. // JFormDesigner - End of variables declaration //GEN-END:variables
  3959. }
  3960.  
  3961.  
  3962. }
  3963. import java.awt.*;
  3964. import java.awt.event.*;
  3965. import javax.swing.*;
  3966. import java.awt.event.KeyEvent;
  3967. import org.rsbot.event.listeners.PaintListener;
  3968. import org.rsbot.script.Script;
  3969. import org.rsbot.script.ScriptManifest;
  3970. import org.rsbot.script.methods.*;
  3971. import org.rsbot.script.wrappers.*;
  3972.  
  3973. @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
  3974. public class vialfiller extends Script implements PaintListener{
  3975. //Variables
  3976. // - Essentials
  3977. private int bankerID = 6533;
  3978. private int fountainID = 24214;
  3979. private int emptyVialID = 229;
  3980. private int fullVialID = 227;
  3981. private int runEnergy = 50;
  3982. RSNPC banker;
  3983. RSObject fountain;
  3984. RSItem myVial;
  3985. RSTile theBank = new RSTile(3167, 3489);
  3986. RSTile theFountain = new RSTile(3191, 3471);
  3987. RSTile glitchSpot = new RSTile(3192, 3487);
  3988. RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
  3989. RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
  3990. RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
  3991. RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
  3992.  
  3993. // - GUI Options
  3994. private int min = 1;
  3995. private int max = 6;
  3996. private int minSpeed = 6;
  3997. private int maxSpeed = 9;
  3998. private boolean guiWait = true;
  3999. private boolean save = false;
  4000.  
  4001. // - State check
  4002. private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
  4003.  
  4004. // - Paint stuff
  4005. private String status = "Initializing...";
  4006. private String isRunning = "";
  4007. private int numFilled = 0;
  4008. private int vialFilledPrice;
  4009. private int vialEmptyPrice;
  4010. private int profitPrice;
  4011. private int profit;
  4012. private long startTime;
  4013. private long millis;
  4014. private long hours;
  4015. private long minutes;
  4016. private long seconds;
  4017. private float profSec = 0;
  4018. private float profHour;
  4019. private float hourlyProfit;
  4020. private int hourlyProfitInt;
  4021. private final Color color1 = new Color(0, 0, 0);
  4022. private final Color color2 = new Color(255, 255, 255);
  4023. private final BasicStroke stroke1 = new BasicStroke(1);
  4024. private final Font font1 = new Font("Arial", 0, 13);
  4025. private final Font font2 = new Font("Arial", 1, 13);
  4026. private final Font font3 = new Font("Vijaya", 1, 17);
  4027. private boolean antiban = true;
  4028. gui g = new gui();
  4029.  
  4030. @Override
  4031. public boolean onStart(){
  4032. log("Welcome to Painlaws's Vial Filler");
  4033. log("Waiting on GUI...");
  4034. g.setVisible(true);
  4035. while(guiWait){
  4036. sleep(500);
  4037. }
  4038. log("GUI Settings loaded!");
  4039. if(walking.isRunEnabled()){
  4040. isRunning = "Yes";
  4041. }
  4042. else{
  4043. isRunning = "No";
  4044. }
  4045. vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
  4046. vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
  4047. profitPrice = vialFilledPrice - vialEmptyPrice;
  4048. if(!save){
  4049. startTime = System.currentTimeMillis();
  4050. }
  4051. else{
  4052. startTime = 0;
  4053. }
  4054. return true;
  4055. }
  4056.  
  4057. @Override
  4058. public void onFinish(){
  4059. env.saveScreenshot(true);
  4060. log("^ Don't forget to upload this proggie :P");
  4061. log("Bye! PM Painlaws for comments/questions/requests");
  4062. }
  4063.  
  4064. public void useItem(RSItem item, RSObject object){
  4065. if(item != null && object != null && object.isOnScreen()){
  4066. item.doClick(true);
  4067. sleep(200, 300);
  4068. object.doClick();
  4069. }
  4070. }
  4071.  
  4072. public void fillVials(){
  4073. if(fountain != null){
  4074. status = "Filling Vials";
  4075. useItem(myVial, fountain);
  4076. while(inventory.contains(emptyVialID)){
  4077. sleep(random(1000,1500));
  4078. if(antiban){
  4079. if(random(1, 3) == 2){
  4080. mouse.moveSlightly();
  4081. }
  4082. }
  4083. }
  4084. status = "Vials filled";
  4085. }
  4086. else{
  4087. status = "Fountain is null...retrying";
  4088. sleep(random(600, 800));
  4089. }
  4090. }
  4091.  
  4092. private void doBank(){
  4093. try{
  4094. if(banker != null){
  4095. camera.turnTo(banker);
  4096. if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
  4097. status = "Opening Bank";
  4098. banker.interact("Bank Banker");
  4099. status = "Bank opened";
  4100. sleep(random(900, 1050));
  4101. status = "Depositing All";
  4102. bank.depositAll();
  4103. status = "Deposited All";
  4104. sleep(random(780, 950));
  4105. numFilled = bank.getCount(fullVialID);
  4106. if(bank.getCount(emptyVialID) != 0){
  4107. status = "Taking Vials";
  4108. bank.withdraw(emptyVialID, 0);
  4109. status = "Vials Taken";
  4110. sleep(random(700, 960));
  4111. }
  4112. else{
  4113. log("Out of vials. Quitting :/");
  4114. bank.close();
  4115. env.saveScreenshot(true);
  4116. log("^ Don't forget to upload this proggie :P");
  4117. log("Bye! PM Painlaws for comments/questions/requests");
  4118. stopScript(true);
  4119. }
  4120. status = "Closing Bank";
  4121. bank.close();
  4122. status = "Bank Closed";
  4123. sleep(random(750, 910));
  4124. }
  4125. }
  4126. sleep(random(300,500));
  4127. }catch(Exception e){log(e);}
  4128. }
  4129.  
  4130. public void onToBank(){
  4131. try{
  4132. status = "Going to Bank";
  4133. walking.walkTileMM(theBank);
  4134. }catch(Exception e){log(e);}
  4135. sleep(random(500, 700));
  4136. }
  4137.  
  4138. public void onToGlitch(){
  4139. try{
  4140. status = "Going to Fountain"; //What you don't know can't hurt you :P
  4141. walking.walkTileMM(glitchSpot);
  4142. }catch(Exception e){log(e);}
  4143. sleep(random(500, 710));
  4144. }
  4145.  
  4146. public void onToFountain(){
  4147. try{
  4148. status = "Going to Fountain";
  4149. walking.walkTileMM(theFountain);
  4150. }catch(Exception e){log(e);}
  4151. sleep(random(500, 705));
  4152. }
  4153.  
  4154. public void runcheck() {
  4155. try{
  4156. runEnergy = (random(50, 70));
  4157. if (walking.isRunEnabled()){
  4158. isRunning = "Yes";
  4159. }
  4160. else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
  4161. walking.setRun(true);
  4162. isRunning = "Yes";
  4163. sleep(random(300, 500));
  4164. }
  4165. else{
  4166. isRunning = "No";
  4167. sleep(random(300,500));
  4168. }
  4169. }catch(Exception ex){}
  4170. }
  4171.  
  4172. @Override
  4173. public int loop(){
  4174. mouse.setSpeed(random(minSpeed, maxSpeed));
  4175. runcheck();
  4176. if(antiban){
  4177. if(random(min, max) == 3){
  4178. antiban();
  4179. }
  4180. }
  4181. if(objects.getNearest(fountainID) != null){
  4182. fountain = objects.getNearest(fountainID);
  4183. }
  4184. if(npcs.getNearest(bankerID) != null){
  4185. banker = npcs.getNearest(bankerID);
  4186. }
  4187. if(inventory.getItem(emptyVialID) != null){
  4188. myVial = inventory.getItem(emptyVialID);
  4189. }
  4190. switch(getState()){
  4191. case TOFOUNTAIN:
  4192. runcheck();
  4193. onToFountain();
  4194. if(fountainRange.contains(players.getMyPlayer().getLocation())){
  4195. fillVials();
  4196. }
  4197. break;
  4198.  
  4199. case TOGLITCH:
  4200. runcheck();
  4201. onToGlitch();
  4202. break;
  4203.  
  4204. case TOBANK:
  4205. runcheck();
  4206. onToBank();
  4207. if(bankRange.contains(players.getMyPlayer().getLocation())){
  4208. doBank();
  4209. }
  4210. break;
  4211. }
  4212. return(random(500, 1000));
  4213. }
  4214.  
  4215. private State getState() {
  4216. if (!inventory.contains(emptyVialID)) {
  4217. return State.TOBANK;
  4218. }
  4219. else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
  4220. return State.TOGLITCH;
  4221. }
  4222. else{
  4223. return State.TOFOUNTAIN;
  4224. }
  4225. }
  4226.  
  4227. // GUI and Mouse
  4228. public void onRepaint(Graphics g1) {
  4229. profit = numFilled * profitPrice;
  4230. if(!save){
  4231. millis = System.currentTimeMillis() - startTime;
  4232. hours = millis / (1000 * 60 * 60);
  4233. millis -= hours * (1000 * 60 * 60);
  4234. minutes = millis / (1000 * 60);
  4235. millis -= minutes * (1000 * 60);
  4236. seconds = millis / 1000;
  4237.  
  4238. if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
  4239. profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
  4240. }
  4241. profHour = profSec * 3600;
  4242. hourlyProfit = profHour * profitPrice;
  4243. hourlyProfitInt = Math.round(hourlyProfit);
  4244. }
  4245. else{
  4246. millis = 0;
  4247. hours = 0;
  4248. minutes = 0;
  4249. seconds = 0;
  4250. hourlyProfitInt = 9001;
  4251. }
  4252.  
  4253. Graphics2D g = (Graphics2D)g1;
  4254. g.setColor(color1);
  4255. g.fillRect(7, 345, 488, 70);
  4256. g.setStroke(stroke1);
  4257. g.drawRect(7, 345, 488, 70);
  4258. g.setFont(font1);
  4259. g.setColor(color2);
  4260. g.drawString("Status:", 14, 362);
  4261. g.setFont(font2);
  4262. g.drawString(status, 59, 362);
  4263. g.setFont(font1);
  4264. g.drawString("Filled Vials In Bank:", 209, 362);
  4265. g.setFont(font2);
  4266. g.drawString(Integer.toString(numFilled), 328, 362);
  4267. g.setFont(font1);
  4268. g.drawString("Profit:", 14, 383);
  4269. g.setFont(font2);
  4270. g.drawString(Integer.toString(profit), 59, 383);
  4271. g.setFont(font1);
  4272. g.drawString("Profit/hr:", 137, 383);
  4273. g.setFont(font2);
  4274. if(!save){
  4275. g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
  4276. }
  4277. else{
  4278. g.drawString("Mem Save", 190, 383);
  4279. }
  4280. g.setFont(font1);
  4281. g.drawString("Runtime:", 270, 383);
  4282. g.setFont(font2);
  4283. if(!save){
  4284. g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
  4285. }
  4286. else{
  4287. g.drawString("Mem Save", 325, 384);
  4288. }
  4289. g.setFont(font1);
  4290. g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
  4291. g.drawString("Running:", 710, 139);
  4292. g.setFont(font2);
  4293. g.drawString(isRunning, 722, 156);
  4294. g.setFont(font3);
  4295. g.drawString("Painlaws", 440, 357);
  4296.  
  4297. g1.setColor(Color.green);
  4298. g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
  4299. g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
  4300. }
  4301.  
  4302. /* Antiban stuff
  4303. * Some credits to Aaimister :)
  4304. * Partially copied, with permission
  4305. */
  4306.  
  4307. public void rotateCamera() {
  4308. final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  4309. final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  4310. final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  4311. KeyEvent.VK_UP, KeyEvent.VK_UP };
  4312. final int randomLR = random(0, 2);
  4313. final int randomUD = random(0, 2);
  4314. final int randomAll = random(0, 4);
  4315. if (random(0, 3) == 0) {
  4316. keyboard.pressKey(LR[randomLR]);
  4317. sleepCR(random(2, 9));
  4318. keyboard.pressKey(UD[randomUD]);
  4319. sleepCR(random(6, 10));
  4320. keyboard.releaseKey(UD[randomUD]);
  4321. sleepCR(random(2, 7));
  4322. keyboard.releaseKey(LR[randomLR]);
  4323. } else {
  4324. keyboard.pressKey(LRUD[randomAll]);
  4325. if (randomAll > 1) {
  4326. sleepCR(random(6, 11));
  4327. } else {
  4328. sleepCR(random(9, 12));
  4329. }
  4330. keyboard.releaseKey(LRUD[randomAll]);
  4331. }
  4332. }
  4333.  
  4334. private boolean sleepCR(final int amtOfHalfSecs) {
  4335. for (int x = 0; x < amtOfHalfSecs + 1; x++) {
  4336. sleep(random(48, 53));
  4337. }
  4338. return true;
  4339. }
  4340.  
  4341. private void antiban(){
  4342. int action = random(0, 5);
  4343.  
  4344. switch (action) {
  4345. case 0:
  4346. status = "Antiban";
  4347. rotateCamera();
  4348. sleep(200, 400);
  4349. break;
  4350. case 1:
  4351. status = "Antiban";
  4352. mouse.moveRandomly(100, 900);
  4353. sleep(200, 400);
  4354. break;
  4355. case 2:
  4356. status = "Antiban";
  4357. mouse.moveSlightly();
  4358. sleep(200, 400);
  4359. break;
  4360. case 3:
  4361. status = "Antiban";
  4362. camera.moveRandomly(random(750,1250));
  4363. sleep(200, 400);
  4364. break;
  4365. case 4:
  4366. status = "Antiban";
  4367. checkEXP();
  4368. sleep(200, 400);
  4369. break;
  4370. case 5:
  4371. status = "Antiban";
  4372. mouse.moveOffScreen();
  4373. sleep(200, 400);
  4374. break;
  4375. }
  4376. }
  4377.  
  4378. public void checkEXP() {
  4379. game.openTab(Game.Tab.STATS);
  4380. skills.doHover(Skills.INTERFACE_PRAYER);
  4381. sleep(random(2100, 3400));
  4382. game.openTab(Game.Tab.INVENTORY);
  4383. sleep(random(540,760));
  4384. }
  4385.  
  4386.  
  4387. class gui extends JFrame {
  4388. /**
  4389. *
  4390. */
  4391. private static final long serialVersionUID = 1L;
  4392. public gui() {
  4393. initComponents();
  4394. }
  4395.  
  4396. private void startButtonActionPerformed(ActionEvent e){
  4397. String mode = selectionBox.getSelectedItem().toString();
  4398. if(mode.equals("Maximum")){
  4399. antiban = false;
  4400. minSpeed = 5;
  4401. maxSpeed = 6;
  4402. }
  4403. else if(mode.equals("Paranoid")){
  4404. antiban = true;
  4405. minSpeed = 8;
  4406. maxSpeed = 10;
  4407. min = 3;
  4408. max = 3;
  4409.  
  4410. }
  4411. save = memoryMode.isSelected();
  4412. guiWait = false;
  4413. g.dispose();
  4414. }
  4415.  
  4416. private void initComponents() {
  4417. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  4418. label1 = new JLabel();
  4419. selectionBox = new JComboBox();
  4420. memoryMode = new JCheckBox();
  4421. label2 = new JLabel();
  4422. label3 = new JLabel();
  4423. label4 = new JLabel();
  4424. label5 = new JLabel();
  4425. startButton = new JButton();
  4426.  
  4427. //======== this ========
  4428. setTitle("Painlaws's Vial Filler");
  4429. setResizable(false);
  4430. Container contentPane = getContentPane();
  4431.  
  4432. //---- label1 ----
  4433. label1.setText("Mode");
  4434.  
  4435. //---- selectionBox ----
  4436. selectionBox.setModel(new DefaultComboBoxModel(new String[] {
  4437. "Normal",
  4438. "Paranoid",
  4439. "Maximum"
  4440. }));
  4441.  
  4442. //---- memoryMode ----
  4443. memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
  4444.  
  4445. //---- label2 ----
  4446. label2.setText("Modes:");
  4447.  
  4448. //---- label3 ----
  4449. label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
  4450.  
  4451. //---- label4 ----
  4452. label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
  4453.  
  4454. //---- label5 ----
  4455. label5.setText("Maximum - No Antiban, Fast Mouse Speed");
  4456.  
  4457. //---- startButton ----
  4458. startButton.setText("Let's Fill Some Vials!");
  4459. startButton.addActionListener(new ActionListener() {
  4460. public void actionPerformed(ActionEvent e){
  4461. startButtonActionPerformed(e);
  4462. }
  4463. });
  4464.  
  4465. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  4466. contentPane.setLayout(contentPaneLayout);
  4467. contentPaneLayout.setHorizontalGroup(
  4468. contentPaneLayout.createParallelGroup()
  4469. .addGroup(contentPaneLayout.createSequentialGroup()
  4470. .addGroup(contentPaneLayout.createParallelGroup()
  4471. .addGroup(contentPaneLayout.createSequentialGroup()
  4472. .addContainerGap()
  4473. .addGroup(contentPaneLayout.createParallelGroup()
  4474. .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  4475. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  4476. .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  4477. .addGroup(contentPaneLayout.createSequentialGroup()
  4478. .addComponent(label1)
  4479. .addGap(18, 18, 18)
  4480. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  4481. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  4482. .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  4483. .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  4484. .addGroup(contentPaneLayout.createSequentialGroup()
  4485. .addGap(148, 148, 148)
  4486. .addComponent(startButton)))
  4487. .addContainerGap(2, Short.MAX_VALUE))
  4488. );
  4489. contentPaneLayout.setVerticalGroup(
  4490. contentPaneLayout.createParallelGroup()
  4491. .addGroup(contentPaneLayout.createSequentialGroup()
  4492. .addContainerGap()
  4493. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  4494. .addComponent(label1)
  4495. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  4496. .addGap(18, 18, 18)
  4497. .addComponent(memoryMode)
  4498. .addGap(18, 18, 18)
  4499. .addComponent(label2)
  4500. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  4501. .addComponent(label3)
  4502. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  4503. .addComponent(label4)
  4504. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  4505. .addComponent(label5)
  4506. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
  4507. .addComponent(startButton)
  4508. .addContainerGap())
  4509. );
  4510. pack();
  4511. setLocationRelativeTo(getOwner());
  4512. // JFormDesigner - End of component initialization //GEN-END:initComponents
  4513. }
  4514.  
  4515. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  4516. private JLabel label1;
  4517. private JComboBox selectionBox;
  4518. private JCheckBox memoryMode;
  4519. private JLabel label2;
  4520. private JLabel label3;
  4521. private JLabel label4;
  4522. private JLabel label5;
  4523. private JButton startButton;
  4524. // JFormDesigner - End of variables declaration //GEN-END:variables
  4525. }
  4526.  
  4527.  
  4528. }
  4529. import java.awt.*;
  4530. import java.awt.event.*;
  4531. import javax.swing.*;
  4532. import java.awt.event.KeyEvent;
  4533. import org.rsbot.event.listeners.PaintListener;
  4534. import org.rsbot.script.Script;
  4535. import org.rsbot.script.ScriptManifest;
  4536. import org.rsbot.script.methods.*;
  4537. import org.rsbot.script.wrappers.*;
  4538.  
  4539. @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
  4540. public class vialfiller extends Script implements PaintListener{
  4541. //Variables
  4542. // - Essentials
  4543. private int bankerID = 6533;
  4544. private int fountainID = 24214;
  4545. private int emptyVialID = 229;
  4546. private int fullVialID = 227;
  4547. private int runEnergy = 50;
  4548. RSNPC banker;
  4549. RSObject fountain;
  4550. RSItem myVial;
  4551. RSTile theBank = new RSTile(3167, 3489);
  4552. RSTile theFountain = new RSTile(3191, 3471);
  4553. RSTile glitchSpot = new RSTile(3192, 3487);
  4554. RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
  4555. RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
  4556. RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
  4557. RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
  4558.  
  4559. // - GUI Options
  4560. private int min = 1;
  4561. private int max = 6;
  4562. private int minSpeed = 6;
  4563. private int maxSpeed = 9;
  4564. private boolean guiWait = true;
  4565. private boolean save = false;
  4566.  
  4567. // - State check
  4568. private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
  4569.  
  4570. // - Paint stuff
  4571. private String status = "Initializing...";
  4572. private String isRunning = "";
  4573. private int numFilled = 0;
  4574. private int vialFilledPrice;
  4575. private int vialEmptyPrice;
  4576. private int profitPrice;
  4577. private int profit;
  4578. private long startTime;
  4579. private long millis;
  4580. private long hours;
  4581. private long minutes;
  4582. private long seconds;
  4583. private float profSec = 0;
  4584. private float profHour;
  4585. private float hourlyProfit;
  4586. private int hourlyProfitInt;
  4587. private final Color color1 = new Color(0, 0, 0);
  4588. private final Color color2 = new Color(255, 255, 255);
  4589. private final BasicStroke stroke1 = new BasicStroke(1);
  4590. private final Font font1 = new Font("Arial", 0, 13);
  4591. private final Font font2 = new Font("Arial", 1, 13);
  4592. private final Font font3 = new Font("Vijaya", 1, 17);
  4593. private boolean antiban = true;
  4594. gui g = new gui();
  4595.  
  4596. @Override
  4597. public boolean onStart(){
  4598. log("Welcome to Painlaws's Vial Filler");
  4599. log("Waiting on GUI...");
  4600. g.setVisible(true);
  4601. while(guiWait){
  4602. sleep(500);
  4603. }
  4604. log("GUI Settings loaded!");
  4605. if(walking.isRunEnabled()){
  4606. isRunning = "Yes";
  4607. }
  4608. else{
  4609. isRunning = "No";
  4610. }
  4611. vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
  4612. vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
  4613. profitPrice = vialFilledPrice - vialEmptyPrice;
  4614. if(!save){
  4615. startTime = System.currentTimeMillis();
  4616. }
  4617. else{
  4618. startTime = 0;
  4619. }
  4620. return true;
  4621. }
  4622.  
  4623. @Override
  4624. public void onFinish(){
  4625. env.saveScreenshot(true);
  4626. log("^ Don't forget to upload this proggie :P");
  4627. log("Bye! PM Painlaws for comments/questions/requests");
  4628. }
  4629.  
  4630. public void useItem(RSItem item, RSObject object){
  4631. if(item != null && object != null && object.isOnScreen()){
  4632. item.doClick(true);
  4633. sleep(200, 300);
  4634. object.doClick();
  4635. }
  4636. }
  4637.  
  4638. public void fillVials(){
  4639. if(fountain != null){
  4640. status = "Filling Vials";
  4641. useItem(myVial, fountain);
  4642. while(inventory.contains(emptyVialID)){
  4643. sleep(random(1000,1500));
  4644. if(antiban){
  4645. if(random(1, 3) == 2){
  4646. mouse.moveSlightly();
  4647. }
  4648. }
  4649. }
  4650. status = "Vials filled";
  4651. }
  4652. else{
  4653. status = "Fountain is null...retrying";
  4654. sleep(random(600, 800));
  4655. }
  4656. }
  4657.  
  4658. private void doBank(){
  4659. try{
  4660. if(banker != null){
  4661. camera.turnTo(banker);
  4662. if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
  4663. status = "Opening Bank";
  4664. banker.interact("Bank Banker");
  4665. status = "Bank opened";
  4666. sleep(random(900, 1050));
  4667. status = "Depositing All";
  4668. bank.depositAll();
  4669. status = "Deposited All";
  4670. sleep(random(780, 950));
  4671. numFilled = bank.getCount(fullVialID);
  4672. if(bank.getCount(emptyVialID) != 0){
  4673. status = "Taking Vials";
  4674. bank.withdraw(emptyVialID, 0);
  4675. status = "Vials Taken";
  4676. sleep(random(700, 960));
  4677. }
  4678. else{
  4679. log("Out of vials. Quitting :/");
  4680. bank.close();
  4681. env.saveScreenshot(true);
  4682. log("^ Don't forget to upload this proggie :P");
  4683. log("Bye! PM Painlaws for comments/questions/requests");
  4684. stopScript(true);
  4685. }
  4686. status = "Closing Bank";
  4687. bank.close();
  4688. status = "Bank Closed";
  4689. sleep(random(750, 910));
  4690. }
  4691. }
  4692. sleep(random(300,500));
  4693. }catch(Exception e){log(e);}
  4694. }
  4695.  
  4696. public void onToBank(){
  4697. try{
  4698. status = "Going to Bank";
  4699. walking.walkTileMM(theBank);
  4700. }catch(Exception e){log(e);}
  4701. sleep(random(500, 700));
  4702. }
  4703.  
  4704. public void onToGlitch(){
  4705. try{
  4706. status = "Going to Fountain"; //What you don't know can't hurt you :P
  4707. walking.walkTileMM(glitchSpot);
  4708. }catch(Exception e){log(e);}
  4709. sleep(random(500, 710));
  4710. }
  4711.  
  4712. public void onToFountain(){
  4713. try{
  4714. status = "Going to Fountain";
  4715. walking.walkTileMM(theFountain);
  4716. }catch(Exception e){log(e);}
  4717. sleep(random(500, 705));
  4718. }
  4719.  
  4720. public void runcheck() {
  4721. try{
  4722. runEnergy = (random(50, 70));
  4723. if (walking.isRunEnabled()){
  4724. isRunning = "Yes";
  4725. }
  4726. else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
  4727. walking.setRun(true);
  4728. isRunning = "Yes";
  4729. sleep(random(300, 500));
  4730. }
  4731. else{
  4732. isRunning = "No";
  4733. sleep(random(300,500));
  4734. }
  4735. }catch(Exception ex){}
  4736. }
  4737.  
  4738. @Override
  4739. public int loop(){
  4740. mouse.setSpeed(random(minSpeed, maxSpeed));
  4741. runcheck();
  4742. if(antiban){
  4743. if(random(min, max) == 3){
  4744. antiban();
  4745. }
  4746. }
  4747. if(objects.getNearest(fountainID) != null){
  4748. fountain = objects.getNearest(fountainID);
  4749. }
  4750. if(npcs.getNearest(bankerID) != null){
  4751. banker = npcs.getNearest(bankerID);
  4752. }
  4753. if(inventory.getItem(emptyVialID) != null){
  4754. myVial = inventory.getItem(emptyVialID);
  4755. }
  4756. switch(getState()){
  4757. case TOFOUNTAIN:
  4758. runcheck();
  4759. onToFountain();
  4760. if(fountainRange.contains(players.getMyPlayer().getLocation())){
  4761. fillVials();
  4762. }
  4763. break;
  4764.  
  4765. case TOGLITCH:
  4766. runcheck();
  4767. onToGlitch();
  4768. break;
  4769.  
  4770. case TOBANK:
  4771. runcheck();
  4772. onToBank();
  4773. if(bankRange.contains(players.getMyPlayer().getLocation())){
  4774. doBank();
  4775. }
  4776. break;
  4777. }
  4778. return(random(500, 1000));
  4779. }
  4780.  
  4781. private State getState() {
  4782. if (!inventory.contains(emptyVialID)) {
  4783. return State.TOBANK;
  4784. }
  4785. else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
  4786. return State.TOGLITCH;
  4787. }
  4788. else{
  4789. return State.TOFOUNTAIN;
  4790. }
  4791. }
  4792.  
  4793. // GUI and Mouse
  4794. public void onRepaint(Graphics g1) {
  4795. profit = numFilled * profitPrice;
  4796. if(!save){
  4797. millis = System.currentTimeMillis() - startTime;
  4798. hours = millis / (1000 * 60 * 60);
  4799. millis -= hours * (1000 * 60 * 60);
  4800. minutes = millis / (1000 * 60);
  4801. millis -= minutes * (1000 * 60);
  4802. seconds = millis / 1000;
  4803.  
  4804. if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
  4805. profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
  4806. }
  4807. profHour = profSec * 3600;
  4808. hourlyProfit = profHour * profitPrice;
  4809. hourlyProfitInt = Math.round(hourlyProfit);
  4810. }
  4811. else{
  4812. millis = 0;
  4813. hours = 0;
  4814. minutes = 0;
  4815. seconds = 0;
  4816. hourlyProfitInt = 9001;
  4817. }
  4818.  
  4819. Graphics2D g = (Graphics2D)g1;
  4820. g.setColor(color1);
  4821. g.fillRect(7, 345, 488, 70);
  4822. g.setStroke(stroke1);
  4823. g.drawRect(7, 345, 488, 70);
  4824. g.setFont(font1);
  4825. g.setColor(color2);
  4826. g.drawString("Status:", 14, 362);
  4827. g.setFont(font2);
  4828. g.drawString(status, 59, 362);
  4829. g.setFont(font1);
  4830. g.drawString("Filled Vials In Bank:", 209, 362);
  4831. g.setFont(font2);
  4832. g.drawString(Integer.toString(numFilled), 328, 362);
  4833. g.setFont(font1);
  4834. g.drawString("Profit:", 14, 383);
  4835. g.setFont(font2);
  4836. g.drawString(Integer.toString(profit), 59, 383);
  4837. g.setFont(font1);
  4838. g.drawString("Profit/hr:", 137, 383);
  4839. g.setFont(font2);
  4840. if(!save){
  4841. g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
  4842. }
  4843. else{
  4844. g.drawString("Mem Save", 190, 383);
  4845. }
  4846. g.setFont(font1);
  4847. g.drawString("Runtime:", 270, 383);
  4848. g.setFont(font2);
  4849. if(!save){
  4850. g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
  4851. }
  4852. else{
  4853. g.drawString("Mem Save", 325, 384);
  4854. }
  4855. g.setFont(font1);
  4856. g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
  4857. g.drawString("Running:", 710, 139);
  4858. g.setFont(font2);
  4859. g.drawString(isRunning, 722, 156);
  4860. g.setFont(font3);
  4861. g.drawString("Painlaws", 440, 357);
  4862.  
  4863. g1.setColor(Color.green);
  4864. g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
  4865. g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
  4866. }
  4867.  
  4868. /* Antiban stuff
  4869. * Some credits to Aaimister :)
  4870. * Partially copied, with permission
  4871. */
  4872.  
  4873. public void rotateCamera() {
  4874. final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  4875. final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  4876. final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  4877. KeyEvent.VK_UP, KeyEvent.VK_UP };
  4878. final int randomLR = random(0, 2);
  4879. final int randomUD = random(0, 2);
  4880. final int randomAll = random(0, 4);
  4881. if (random(0, 3) == 0) {
  4882. keyboard.pressKey(LR[randomLR]);
  4883. sleepCR(random(2, 9));
  4884. keyboard.pressKey(UD[randomUD]);
  4885. sleepCR(random(6, 10));
  4886. keyboard.releaseKey(UD[randomUD]);
  4887. sleepCR(random(2, 7));
  4888. keyboard.releaseKey(LR[randomLR]);
  4889. } else {
  4890. keyboard.pressKey(LRUD[randomAll]);
  4891. if (randomAll > 1) {
  4892. sleepCR(random(6, 11));
  4893. } else {
  4894. sleepCR(random(9, 12));
  4895. }
  4896. keyboard.releaseKey(LRUD[randomAll]);
  4897. }
  4898. }
  4899.  
  4900. private boolean sleepCR(final int amtOfHalfSecs) {
  4901. for (int x = 0; x < amtOfHalfSecs + 1; x++) {
  4902. sleep(random(48, 53));
  4903. }
  4904. return true;
  4905. }
  4906.  
  4907. private void antiban(){
  4908. int action = random(0, 5);
  4909.  
  4910. switch (action) {
  4911. case 0:
  4912. status = "Antiban";
  4913. rotateCamera();
  4914. sleep(200, 400);
  4915. break;
  4916. case 1:
  4917. status = "Antiban";
  4918. mouse.moveRandomly(100, 900);
  4919. sleep(200, 400);
  4920. break;
  4921. case 2:
  4922. status = "Antiban";
  4923. mouse.moveSlightly();
  4924. sleep(200, 400);
  4925. break;
  4926. case 3:
  4927. status = "Antiban";
  4928. camera.moveRandomly(random(750,1250));
  4929. sleep(200, 400);
  4930. break;
  4931. case 4:
  4932. status = "Antiban";
  4933. checkEXP();
  4934. sleep(200, 400);
  4935. break;
  4936. case 5:
  4937. status = "Antiban";
  4938. mouse.moveOffScreen();
  4939. sleep(200, 400);
  4940. break;
  4941. }
  4942. }
  4943.  
  4944. public void checkEXP() {
  4945. game.openTab(Game.Tab.STATS);
  4946. skills.doHover(Skills.INTERFACE_PRAYER);
  4947. sleep(random(2100, 3400));
  4948. game.openTab(Game.Tab.INVENTORY);
  4949. sleep(random(540,760));
  4950. }
  4951.  
  4952.  
  4953. class gui extends JFrame {
  4954. /**
  4955. *
  4956. */
  4957. private static final long serialVersionUID = 1L;
  4958. public gui() {
  4959. initComponents();
  4960. }
  4961.  
  4962. private void startButtonActionPerformed(ActionEvent e){
  4963. String mode = selectionBox.getSelectedItem().toString();
  4964. if(mode.equals("Maximum")){
  4965. antiban = false;
  4966. minSpeed = 5;
  4967. maxSpeed = 6;
  4968. }
  4969. else if(mode.equals("Paranoid")){
  4970. antiban = true;
  4971. minSpeed = 8;
  4972. maxSpeed = 10;
  4973. min = 3;
  4974. max = 3;
  4975.  
  4976. }
  4977. save = memoryMode.isSelected();
  4978. guiWait = false;
  4979. g.dispose();
  4980. }
  4981.  
  4982. private void initComponents() {
  4983. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  4984. label1 = new JLabel();
  4985. selectionBox = new JComboBox();
  4986. memoryMode = new JCheckBox();
  4987. label2 = new JLabel();
  4988. label3 = new JLabel();
  4989. label4 = new JLabel();
  4990. label5 = new JLabel();
  4991. startButton = new JButton();
  4992.  
  4993. //======== this ========
  4994. setTitle("Painlaws's Vial Filler");
  4995. setResizable(false);
  4996. Container contentPane = getContentPane();
  4997.  
  4998. //---- label1 ----
  4999. label1.setText("Mode");
  5000.  
  5001. //---- selectionBox ----
  5002. selectionBox.setModel(new DefaultComboBoxModel(new String[] {
  5003. "Normal",
  5004. "Paranoid",
  5005. "Maximum"
  5006. }));
  5007.  
  5008. //---- memoryMode ----
  5009. memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
  5010.  
  5011. //---- label2 ----
  5012. label2.setText("Modes:");
  5013.  
  5014. //---- label3 ----
  5015. label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
  5016.  
  5017. //---- label4 ----
  5018. label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
  5019.  
  5020. //---- label5 ----
  5021. label5.setText("Maximum - No Antiban, Fast Mouse Speed");
  5022.  
  5023. //---- startButton ----
  5024. startButton.setText("Let's Fill Some Vials!");
  5025. startButton.addActionListener(new ActionListener() {
  5026. public void actionPerformed(ActionEvent e){
  5027. startButtonActionPerformed(e);
  5028. }
  5029. });
  5030.  
  5031. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  5032. contentPane.setLayout(contentPaneLayout);
  5033. contentPaneLayout.setHorizontalGroup(
  5034. contentPaneLayout.createParallelGroup()
  5035. .addGroup(contentPaneLayout.createSequentialGroup()
  5036. .addGroup(contentPaneLayout.createParallelGroup()
  5037. .addGroup(contentPaneLayout.createSequentialGroup()
  5038. .addContainerGap()
  5039. .addGroup(contentPaneLayout.createParallelGroup()
  5040. .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  5041. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  5042. .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  5043. .addGroup(contentPaneLayout.createSequentialGroup()
  5044. .addComponent(label1)
  5045. .addGap(18, 18, 18)
  5046. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  5047. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  5048. .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  5049. .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  5050. .addGroup(contentPaneLayout.createSequentialGroup()
  5051. .addGap(148, 148, 148)
  5052. .addComponent(startButton)))
  5053. .addContainerGap(2, Short.MAX_VALUE))
  5054. );
  5055. contentPaneLayout.setVerticalGroup(
  5056. contentPaneLayout.createParallelGroup()
  5057. .addGroup(contentPaneLayout.createSequentialGroup()
  5058. .addContainerGap()
  5059. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  5060. .addComponent(label1)
  5061. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  5062. .addGap(18, 18, 18)
  5063. .addComponent(memoryMode)
  5064. .addGap(18, 18, 18)
  5065. .addComponent(label2)
  5066. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  5067. .addComponent(label3)
  5068. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  5069. .addComponent(label4)
  5070. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  5071. .addComponent(label5)
  5072. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
  5073. .addComponent(startButton)
  5074. .addContainerGap())
  5075. );
  5076. pack();
  5077. setLocationRelativeTo(getOwner());
  5078. // JFormDesigner - End of component initialization //GEN-END:initComponents
  5079. }
  5080.  
  5081. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  5082. private JLabel label1;
  5083. private JComboBox selectionBox;
  5084. private JCheckBox memoryMode;
  5085. private JLabel label2;
  5086. private JLabel label3;
  5087. private JLabel label4;
  5088. private JLabel label5;
  5089. private JButton startButton;
  5090. // JFormDesigner - End of variables declaration //GEN-END:variables
  5091. }
  5092.  
  5093.  
  5094. }
  5095. import java.awt.*;
  5096. import java.awt.event.*;
  5097. import javax.swing.*;
  5098. import java.awt.event.KeyEvent;
  5099. import org.rsbot.event.listeners.PaintListener;
  5100. import org.rsbot.script.Script;
  5101. import org.rsbot.script.ScriptManifest;
  5102. import org.rsbot.script.methods.*;
  5103. import org.rsbot.script.wrappers.*;
  5104.  
  5105. @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
  5106. public class vialfiller extends Script implements PaintListener{
  5107. //Variables
  5108. // - Essentials
  5109. private int bankerID = 6533;
  5110. private int fountainID = 24214;
  5111. private int emptyVialID = 229;
  5112. private int fullVialID = 227;
  5113. private int runEnergy = 50;
  5114. RSNPC banker;
  5115. RSObject fountain;
  5116. RSItem myVial;
  5117. RSTile theBank = new RSTile(3167, 3489);
  5118. RSTile theFountain = new RSTile(3191, 3471);
  5119. RSTile glitchSpot = new RSTile(3192, 3487);
  5120. RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
  5121. RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
  5122. RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
  5123. RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
  5124.  
  5125. // - GUI Options
  5126. private int min = 1;
  5127. private int max = 6;
  5128. private int minSpeed = 6;
  5129. private int maxSpeed = 9;
  5130. private boolean guiWait = true;
  5131. private boolean save = false;
  5132.  
  5133. // - State check
  5134. private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
  5135.  
  5136. // - Paint stuff
  5137. private String status = "Initializing...";
  5138. private String isRunning = "";
  5139. private int numFilled = 0;
  5140. private int vialFilledPrice;
  5141. private int vialEmptyPrice;
  5142. private int profitPrice;
  5143. private int profit;
  5144. private long startTime;
  5145. private long millis;
  5146. private long hours;
  5147. private long minutes;
  5148. private long seconds;
  5149. private float profSec = 0;
  5150. private float profHour;
  5151. private float hourlyProfit;
  5152. private int hourlyProfitInt;
  5153. private final Color color1 = new Color(0, 0, 0);
  5154. private final Color color2 = new Color(255, 255, 255);
  5155. private final BasicStroke stroke1 = new BasicStroke(1);
  5156. private final Font font1 = new Font("Arial", 0, 13);
  5157. private final Font font2 = new Font("Arial", 1, 13);
  5158. private final Font font3 = new Font("Vijaya", 1, 17);
  5159. private boolean antiban = true;
  5160. gui g = new gui();
  5161.  
  5162. @Override
  5163. public boolean onStart(){
  5164. log("Welcome to Painlaws's Vial Filler");
  5165. log("Waiting on GUI...");
  5166. g.setVisible(true);
  5167. while(guiWait){
  5168. sleep(500);
  5169. }
  5170. log("GUI Settings loaded!");
  5171. if(walking.isRunEnabled()){
  5172. isRunning = "Yes";
  5173. }
  5174. else{
  5175. isRunning = "No";
  5176. }
  5177. vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
  5178. vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
  5179. profitPrice = vialFilledPrice - vialEmptyPrice;
  5180. if(!save){
  5181. startTime = System.currentTimeMillis();
  5182. }
  5183. else{
  5184. startTime = 0;
  5185. }
  5186. return true;
  5187. }
  5188.  
  5189. @Override
  5190. public void onFinish(){
  5191. env.saveScreenshot(true);
  5192. log("^ Don't forget to upload this proggie :P");
  5193. log("Bye! PM Painlaws for comments/questions/requests");
  5194. }
  5195.  
  5196. public void useItem(RSItem item, RSObject object){
  5197. if(item != null && object != null && object.isOnScreen()){
  5198. item.doClick(true);
  5199. sleep(200, 300);
  5200. object.doClick();
  5201. }
  5202. }
  5203.  
  5204. public void fillVials(){
  5205. if(fountain != null){
  5206. status = "Filling Vials";
  5207. useItem(myVial, fountain);
  5208. while(inventory.contains(emptyVialID)){
  5209. sleep(random(1000,1500));
  5210. if(antiban){
  5211. if(random(1, 3) == 2){
  5212. mouse.moveSlightly();
  5213. }
  5214. }
  5215. }
  5216. status = "Vials filled";
  5217. }
  5218. else{
  5219. status = "Fountain is null...retrying";
  5220. sleep(random(600, 800));
  5221. }
  5222. }
  5223.  
  5224. private void doBank(){
  5225. try{
  5226. if(banker != null){
  5227. camera.turnTo(banker);
  5228. if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
  5229. status = "Opening Bank";
  5230. banker.interact("Bank Banker");
  5231. status = "Bank opened";
  5232. sleep(random(900, 1050));
  5233. status = "Depositing All";
  5234. bank.depositAll();
  5235. status = "Deposited All";
  5236. sleep(random(780, 950));
  5237. numFilled = bank.getCount(fullVialID);
  5238. if(bank.getCount(emptyVialID) != 0){
  5239. status = "Taking Vials";
  5240. bank.withdraw(emptyVialID, 0);
  5241. status = "Vials Taken";
  5242. sleep(random(700, 960));
  5243. }
  5244. else{
  5245. log("Out of vials. Quitting :/");
  5246. bank.close();
  5247. env.saveScreenshot(true);
  5248. log("^ Don't forget to upload this proggie :P");
  5249. log("Bye! PM Painlaws for comments/questions/requests");
  5250. stopScript(true);
  5251. }
  5252. status = "Closing Bank";
  5253. bank.close();
  5254. status = "Bank Closed";
  5255. sleep(random(750, 910));
  5256. }
  5257. }
  5258. sleep(random(300,500));
  5259. }catch(Exception e){log(e);}
  5260. }
  5261.  
  5262. public void onToBank(){
  5263. try{
  5264. status = "Going to Bank";
  5265. walking.walkTileMM(theBank);
  5266. }catch(Exception e){log(e);}
  5267. sleep(random(500, 700));
  5268. }
  5269.  
  5270. public void onToGlitch(){
  5271. try{
  5272. status = "Going to Fountain"; //What you don't know can't hurt you :P
  5273. walking.walkTileMM(glitchSpot);
  5274. }catch(Exception e){log(e);}
  5275. sleep(random(500, 710));
  5276. }
  5277.  
  5278. public void onToFountain(){
  5279. try{
  5280. status = "Going to Fountain";
  5281. walking.walkTileMM(theFountain);
  5282. }catch(Exception e){log(e);}
  5283. sleep(random(500, 705));
  5284. }
  5285.  
  5286. public void runcheck() {
  5287. try{
  5288. runEnergy = (random(50, 70));
  5289. if (walking.isRunEnabled()){
  5290. isRunning = "Yes";
  5291. }
  5292. else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
  5293. walking.setRun(true);
  5294. isRunning = "Yes";
  5295. sleep(random(300, 500));
  5296. }
  5297. else{
  5298. isRunning = "No";
  5299. sleep(random(300,500));
  5300. }
  5301. }catch(Exception ex){}
  5302. }
  5303.  
  5304. @Override
  5305. public int loop(){
  5306. mouse.setSpeed(random(minSpeed, maxSpeed));
  5307. runcheck();
  5308. if(antiban){
  5309. if(random(min, max) == 3){
  5310. antiban();
  5311. }
  5312. }
  5313. if(objects.getNearest(fountainID) != null){
  5314. fountain = objects.getNearest(fountainID);
  5315. }
  5316. if(npcs.getNearest(bankerID) != null){
  5317. banker = npcs.getNearest(bankerID);
  5318. }
  5319. if(inventory.getItem(emptyVialID) != null){
  5320. myVial = inventory.getItem(emptyVialID);
  5321. }
  5322. switch(getState()){
  5323. case TOFOUNTAIN:
  5324. runcheck();
  5325. onToFountain();
  5326. if(fountainRange.contains(players.getMyPlayer().getLocation())){
  5327. fillVials();
  5328. }
  5329. break;
  5330.  
  5331. case TOGLITCH:
  5332. runcheck();
  5333. onToGlitch();
  5334. break;
  5335.  
  5336. case TOBANK:
  5337. runcheck();
  5338. onToBank();
  5339. if(bankRange.contains(players.getMyPlayer().getLocation())){
  5340. doBank();
  5341. }
  5342. break;
  5343. }
  5344. return(random(500, 1000));
  5345. }
  5346.  
  5347. private State getState() {
  5348. if (!inventory.contains(emptyVialID)) {
  5349. return State.TOBANK;
  5350. }
  5351. else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
  5352. return State.TOGLITCH;
  5353. }
  5354. else{
  5355. return State.TOFOUNTAIN;
  5356. }
  5357. }
  5358.  
  5359. // GUI and Mouse
  5360. public void onRepaint(Graphics g1) {
  5361. profit = numFilled * profitPrice;
  5362. if(!save){
  5363. millis = System.currentTimeMillis() - startTime;
  5364. hours = millis / (1000 * 60 * 60);
  5365. millis -= hours * (1000 * 60 * 60);
  5366. minutes = millis / (1000 * 60);
  5367. millis -= minutes * (1000 * 60);
  5368. seconds = millis / 1000;
  5369.  
  5370. if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
  5371. profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
  5372. }
  5373. profHour = profSec * 3600;
  5374. hourlyProfit = profHour * profitPrice;
  5375. hourlyProfitInt = Math.round(hourlyProfit);
  5376. }
  5377. else{
  5378. millis = 0;
  5379. hours = 0;
  5380. minutes = 0;
  5381. seconds = 0;
  5382. hourlyProfitInt = 9001;
  5383. }
  5384.  
  5385. Graphics2D g = (Graphics2D)g1;
  5386. g.setColor(color1);
  5387. g.fillRect(7, 345, 488, 70);
  5388. g.setStroke(stroke1);
  5389. g.drawRect(7, 345, 488, 70);
  5390. g.setFont(font1);
  5391. g.setColor(color2);
  5392. g.drawString("Status:", 14, 362);
  5393. g.setFont(font2);
  5394. g.drawString(status, 59, 362);
  5395. g.setFont(font1);
  5396. g.drawString("Filled Vials In Bank:", 209, 362);
  5397. g.setFont(font2);
  5398. g.drawString(Integer.toString(numFilled), 328, 362);
  5399. g.setFont(font1);
  5400. g.drawString("Profit:", 14, 383);
  5401. g.setFont(font2);
  5402. g.drawString(Integer.toString(profit), 59, 383);
  5403. g.setFont(font1);
  5404. g.drawString("Profit/hr:", 137, 383);
  5405. g.setFont(font2);
  5406. if(!save){
  5407. g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
  5408. }
  5409. else{
  5410. g.drawString("Mem Save", 190, 383);
  5411. }
  5412. g.setFont(font1);
  5413. g.drawString("Runtime:", 270, 383);
  5414. g.setFont(font2);
  5415. if(!save){
  5416. g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
  5417. }
  5418. else{
  5419. g.drawString("Mem Save", 325, 384);
  5420. }
  5421. g.setFont(font1);
  5422. g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
  5423. g.drawString("Running:", 710, 139);
  5424. g.setFont(font2);
  5425. g.drawString(isRunning, 722, 156);
  5426. g.setFont(font3);
  5427. g.drawString("Painlaws", 440, 357);
  5428.  
  5429. g1.setColor(Color.green);
  5430. g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
  5431. g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
  5432. }
  5433.  
  5434. /* Antiban stuff
  5435. * Some credits to Aaimister :)
  5436. * Partially copied, with permission
  5437. */
  5438.  
  5439. public void rotateCamera() {
  5440. final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  5441. final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  5442. final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  5443. KeyEvent.VK_UP, KeyEvent.VK_UP };
  5444. final int randomLR = random(0, 2);
  5445. final int randomUD = random(0, 2);
  5446. final int randomAll = random(0, 4);
  5447. if (random(0, 3) == 0) {
  5448. keyboard.pressKey(LR[randomLR]);
  5449. sleepCR(random(2, 9));
  5450. keyboard.pressKey(UD[randomUD]);
  5451. sleepCR(random(6, 10));
  5452. keyboard.releaseKey(UD[randomUD]);
  5453. sleepCR(random(2, 7));
  5454. keyboard.releaseKey(LR[randomLR]);
  5455. } else {
  5456. keyboard.pressKey(LRUD[randomAll]);
  5457. if (randomAll > 1) {
  5458. sleepCR(random(6, 11));
  5459. } else {
  5460. sleepCR(random(9, 12));
  5461. }
  5462. keyboard.releaseKey(LRUD[randomAll]);
  5463. }
  5464. }
  5465.  
  5466. private boolean sleepCR(final int amtOfHalfSecs) {
  5467. for (int x = 0; x < amtOfHalfSecs + 1; x++) {
  5468. sleep(random(48, 53));
  5469. }
  5470. return true;
  5471. }
  5472.  
  5473. private void antiban(){
  5474. int action = random(0, 5);
  5475.  
  5476. switch (action) {
  5477. case 0:
  5478. status = "Antiban";
  5479. rotateCamera();
  5480. sleep(200, 400);
  5481. break;
  5482. case 1:
  5483. status = "Antiban";
  5484. mouse.moveRandomly(100, 900);
  5485. sleep(200, 400);
  5486. break;
  5487. case 2:
  5488. status = "Antiban";
  5489. mouse.moveSlightly();
  5490. sleep(200, 400);
  5491. break;
  5492. case 3:
  5493. status = "Antiban";
  5494. camera.moveRandomly(random(750,1250));
  5495. sleep(200, 400);
  5496. break;
  5497. case 4:
  5498. status = "Antiban";
  5499. checkEXP();
  5500. sleep(200, 400);
  5501. break;
  5502. case 5:
  5503. status = "Antiban";
  5504. mouse.moveOffScreen();
  5505. sleep(200, 400);
  5506. break;
  5507. }
  5508. }
  5509.  
  5510. public void checkEXP() {
  5511. game.openTab(Game.Tab.STATS);
  5512. skills.doHover(Skills.INTERFACE_PRAYER);
  5513. sleep(random(2100, 3400));
  5514. game.openTab(Game.Tab.INVENTORY);
  5515. sleep(random(540,760));
  5516. }
  5517.  
  5518.  
  5519. class gui extends JFrame {
  5520. /**
  5521. *
  5522. */
  5523. private static final long serialVersionUID = 1L;
  5524. public gui() {
  5525. initComponents();
  5526. }
  5527.  
  5528. private void startButtonActionPerformed(ActionEvent e){
  5529. String mode = selectionBox.getSelectedItem().toString();
  5530. if(mode.equals("Maximum")){
  5531. antiban = false;
  5532. minSpeed = 5;
  5533. maxSpeed = 6;
  5534. }
  5535. else if(mode.equals("Paranoid")){
  5536. antiban = true;
  5537. minSpeed = 8;
  5538. maxSpeed = 10;
  5539. min = 3;
  5540. max = 3;
  5541.  
  5542. }
  5543. save = memoryMode.isSelected();
  5544. guiWait = false;
  5545. g.dispose();
  5546. }
  5547.  
  5548. private void initComponents() {
  5549. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  5550. label1 = new JLabel();
  5551. selectionBox = new JComboBox();
  5552. memoryMode = new JCheckBox();
  5553. label2 = new JLabel();
  5554. label3 = new JLabel();
  5555. label4 = new JLabel();
  5556. label5 = new JLabel();
  5557. startButton = new JButton();
  5558.  
  5559. //======== this ========
  5560. setTitle("Painlaws's Vial Filler");
  5561. setResizable(false);
  5562. Container contentPane = getContentPane();
  5563.  
  5564. //---- label1 ----
  5565. label1.setText("Mode");
  5566.  
  5567. //---- selectionBox ----
  5568. selectionBox.setModel(new DefaultComboBoxModel(new String[] {
  5569. "Normal",
  5570. "Paranoid",
  5571. "Maximum"
  5572. }));
  5573.  
  5574. //---- memoryMode ----
  5575. memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
  5576.  
  5577. //---- label2 ----
  5578. label2.setText("Modes:");
  5579.  
  5580. //---- label3 ----
  5581. label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
  5582.  
  5583. //---- label4 ----
  5584. label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
  5585.  
  5586. //---- label5 ----
  5587. label5.setText("Maximum - No Antiban, Fast Mouse Speed");
  5588.  
  5589. //---- startButton ----
  5590. startButton.setText("Let's Fill Some Vials!");
  5591. startButton.addActionListener(new ActionListener() {
  5592. public void actionPerformed(ActionEvent e){
  5593. startButtonActionPerformed(e);
  5594. }
  5595. });
  5596.  
  5597. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  5598. contentPane.setLayout(contentPaneLayout);
  5599. contentPaneLayout.setHorizontalGroup(
  5600. contentPaneLayout.createParallelGroup()
  5601. .addGroup(contentPaneLayout.createSequentialGroup()
  5602. .addGroup(contentPaneLayout.createParallelGroup()
  5603. .addGroup(contentPaneLayout.createSequentialGroup()
  5604. .addContainerGap()
  5605. .addGroup(contentPaneLayout.createParallelGroup()
  5606. .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  5607. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  5608. .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  5609. .addGroup(contentPaneLayout.createSequentialGroup()
  5610. .addComponent(label1)
  5611. .addGap(18, 18, 18)
  5612. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  5613. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  5614. .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  5615. .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  5616. .addGroup(contentPaneLayout.createSequentialGroup()
  5617. .addGap(148, 148, 148)
  5618. .addComponent(startButton)))
  5619. .addContainerGap(2, Short.MAX_VALUE))
  5620. );
  5621. contentPaneLayout.setVerticalGroup(
  5622. contentPaneLayout.createParallelGroup()
  5623. .addGroup(contentPaneLayout.createSequentialGroup()
  5624. .addContainerGap()
  5625. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  5626. .addComponent(label1)
  5627. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  5628. .addGap(18, 18, 18)
  5629. .addComponent(memoryMode)
  5630. .addGap(18, 18, 18)
  5631. .addComponent(label2)
  5632. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  5633. .addComponent(label3)
  5634. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  5635. .addComponent(label4)
  5636. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  5637. .addComponent(label5)
  5638. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
  5639. .addComponent(startButton)
  5640. .addContainerGap())
  5641. );
  5642. pack();
  5643. setLocationRelativeTo(getOwner());
  5644. // JFormDesigner - End of component initialization //GEN-END:initComponents
  5645. }
  5646.  
  5647. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  5648. private JLabel label1;
  5649. private JComboBox selectionBox;
  5650. private JCheckBox memoryMode;
  5651. private JLabel label2;
  5652. private JLabel label3;
  5653. private JLabel label4;
  5654. private JLabel label5;
  5655. private JButton startButton;
  5656. // JFormDesigner - End of variables declaration //GEN-END:variables
  5657. }
  5658.  
  5659.  
  5660. }
  5661. import java.awt.*;
  5662. import java.awt.event.*;
  5663. import javax.swing.*;
  5664. import java.awt.event.KeyEvent;
  5665. import org.rsbot.event.listeners.PaintListener;
  5666. import org.rsbot.script.Script;
  5667. import org.rsbot.script.ScriptManifest;
  5668. import org.rsbot.script.methods.*;
  5669. import org.rsbot.script.wrappers.*;
  5670.  
  5671. @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
  5672. public class vialfiller extends Script implements PaintListener{
  5673. //Variables
  5674. // - Essentials
  5675. private int bankerID = 6533;
  5676. private int fountainID = 24214;
  5677. private int emptyVialID = 229;
  5678. private int fullVialID = 227;
  5679. private int runEnergy = 50;
  5680. RSNPC banker;
  5681. RSObject fountain;
  5682. RSItem myVial;
  5683. RSTile theBank = new RSTile(3167, 3489);
  5684. RSTile theFountain = new RSTile(3191, 3471);
  5685. RSTile glitchSpot = new RSTile(3192, 3487);
  5686. RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
  5687. RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
  5688. RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
  5689. RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
  5690.  
  5691. // - GUI Options
  5692. private int min = 1;
  5693. private int max = 6;
  5694. private int minSpeed = 6;
  5695. private int maxSpeed = 9;
  5696. private boolean guiWait = true;
  5697. private boolean save = false;
  5698.  
  5699. // - State check
  5700. private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
  5701.  
  5702. // - Paint stuff
  5703. private String status = "Initializing...";
  5704. private String isRunning = "";
  5705. private int numFilled = 0;
  5706. private int vialFilledPrice;
  5707. private int vialEmptyPrice;
  5708. private int profitPrice;
  5709. private int profit;
  5710. private long startTime;
  5711. private long millis;
  5712. private long hours;
  5713. private long minutes;
  5714. private long seconds;
  5715. private float profSec = 0;
  5716. private float profHour;
  5717. private float hourlyProfit;
  5718. private int hourlyProfitInt;
  5719. private final Color color1 = new Color(0, 0, 0);
  5720. private final Color color2 = new Color(255, 255, 255);
  5721. private final BasicStroke stroke1 = new BasicStroke(1);
  5722. private final Font font1 = new Font("Arial", 0, 13);
  5723. private final Font font2 = new Font("Arial", 1, 13);
  5724. private final Font font3 = new Font("Vijaya", 1, 17);
  5725. private boolean antiban = true;
  5726. gui g = new gui();
  5727.  
  5728. @Override
  5729. public boolean onStart(){
  5730. log("Welcome to Painlaws's Vial Filler");
  5731. log("Waiting on GUI...");
  5732. g.setVisible(true);
  5733. while(guiWait){
  5734. sleep(500);
  5735. }
  5736. log("GUI Settings loaded!");
  5737. if(walking.isRunEnabled()){
  5738. isRunning = "Yes";
  5739. }
  5740. else{
  5741. isRunning = "No";
  5742. }
  5743. vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
  5744. vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
  5745. profitPrice = vialFilledPrice - vialEmptyPrice;
  5746. if(!save){
  5747. startTime = System.currentTimeMillis();
  5748. }
  5749. else{
  5750. startTime = 0;
  5751. }
  5752. return true;
  5753. }
  5754.  
  5755. @Override
  5756. public void onFinish(){
  5757. env.saveScreenshot(true);
  5758. log("^ Don't forget to upload this proggie :P");
  5759. log("Bye! PM Painlaws for comments/questions/requests");
  5760. }
  5761.  
  5762. public void useItem(RSItem item, RSObject object){
  5763. if(item != null && object != null && object.isOnScreen()){
  5764. item.doClick(true);
  5765. sleep(200, 300);
  5766. object.doClick();
  5767. }
  5768. }
  5769.  
  5770. public void fillVials(){
  5771. if(fountain != null){
  5772. status = "Filling Vials";
  5773. useItem(myVial, fountain);
  5774. while(inventory.contains(emptyVialID)){
  5775. sleep(random(1000,1500));
  5776. if(antiban){
  5777. if(random(1, 3) == 2){
  5778. mouse.moveSlightly();
  5779. }
  5780. }
  5781. }
  5782. status = "Vials filled";
  5783. }
  5784. else{
  5785. status = "Fountain is null...retrying";
  5786. sleep(random(600, 800));
  5787. }
  5788. }
  5789.  
  5790. private void doBank(){
  5791. try{
  5792. if(banker != null){
  5793. camera.turnTo(banker);
  5794. if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
  5795. status = "Opening Bank";
  5796. banker.interact("Bank Banker");
  5797. status = "Bank opened";
  5798. sleep(random(900, 1050));
  5799. status = "Depositing All";
  5800. bank.depositAll();
  5801. status = "Deposited All";
  5802. sleep(random(780, 950));
  5803. numFilled = bank.getCount(fullVialID);
  5804. if(bank.getCount(emptyVialID) != 0){
  5805. status = "Taking Vials";
  5806. bank.withdraw(emptyVialID, 0);
  5807. status = "Vials Taken";
  5808. sleep(random(700, 960));
  5809. }
  5810. else{
  5811. log("Out of vials. Quitting :/");
  5812. bank.close();
  5813. env.saveScreenshot(true);
  5814. log("^ Don't forget to upload this proggie :P");
  5815. log("Bye! PM Painlaws for comments/questions/requests");
  5816. stopScript(true);
  5817. }
  5818. status = "Closing Bank";
  5819. bank.close();
  5820. status = "Bank Closed";
  5821. sleep(random(750, 910));
  5822. }
  5823. }
  5824. sleep(random(300,500));
  5825. }catch(Exception e){log(e);}
  5826. }
  5827.  
  5828. public void onToBank(){
  5829. try{
  5830. status = "Going to Bank";
  5831. walking.walkTileMM(theBank);
  5832. }catch(Exception e){log(e);}
  5833. sleep(random(500, 700));
  5834. }
  5835.  
  5836. public void onToGlitch(){
  5837. try{
  5838. status = "Going to Fountain"; //What you don't know can't hurt you :P
  5839. walking.walkTileMM(glitchSpot);
  5840. }catch(Exception e){log(e);}
  5841. sleep(random(500, 710));
  5842. }
  5843.  
  5844. public void onToFountain(){
  5845. try{
  5846. status = "Going to Fountain";
  5847. walking.walkTileMM(theFountain);
  5848. }catch(Exception e){log(e);}
  5849. sleep(random(500, 705));
  5850. }
  5851.  
  5852. public void runcheck() {
  5853. try{
  5854. runEnergy = (random(50, 70));
  5855. if (walking.isRunEnabled()){
  5856. isRunning = "Yes";
  5857. }
  5858. else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
  5859. walking.setRun(true);
  5860. isRunning = "Yes";
  5861. sleep(random(300, 500));
  5862. }
  5863. else{
  5864. isRunning = "No";
  5865. sleep(random(300,500));
  5866. }
  5867. }catch(Exception ex){}
  5868. }
  5869.  
  5870. @Override
  5871. public int loop(){
  5872. mouse.setSpeed(random(minSpeed, maxSpeed));
  5873. runcheck();
  5874. if(antiban){
  5875. if(random(min, max) == 3){
  5876. antiban();
  5877. }
  5878. }
  5879. if(objects.getNearest(fountainID) != null){
  5880. fountain = objects.getNearest(fountainID);
  5881. }
  5882. if(npcs.getNearest(bankerID) != null){
  5883. banker = npcs.getNearest(bankerID);
  5884. }
  5885. if(inventory.getItem(emptyVialID) != null){
  5886. myVial = inventory.getItem(emptyVialID);
  5887. }
  5888. switch(getState()){
  5889. case TOFOUNTAIN:
  5890. runcheck();
  5891. onToFountain();
  5892. if(fountainRange.contains(players.getMyPlayer().getLocation())){
  5893. fillVials();
  5894. }
  5895. break;
  5896.  
  5897. case TOGLITCH:
  5898. runcheck();
  5899. onToGlitch();
  5900. break;
  5901.  
  5902. case TOBANK:
  5903. runcheck();
  5904. onToBank();
  5905. if(bankRange.contains(players.getMyPlayer().getLocation())){
  5906. doBank();
  5907. }
  5908. break;
  5909. }
  5910. return(random(500, 1000));
  5911. }
  5912.  
  5913. private State getState() {
  5914. if (!inventory.contains(emptyVialID)) {
  5915. return State.TOBANK;
  5916. }
  5917. else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
  5918. return State.TOGLITCH;
  5919. }
  5920. else{
  5921. return State.TOFOUNTAIN;
  5922. }
  5923. }
  5924.  
  5925. // GUI and Mouse
  5926. public void onRepaint(Graphics g1) {
  5927. profit = numFilled * profitPrice;
  5928. if(!save){
  5929. millis = System.currentTimeMillis() - startTime;
  5930. hours = millis / (1000 * 60 * 60);
  5931. millis -= hours * (1000 * 60 * 60);
  5932. minutes = millis / (1000 * 60);
  5933. millis -= minutes * (1000 * 60);
  5934. seconds = millis / 1000;
  5935.  
  5936. if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
  5937. profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
  5938. }
  5939. profHour = profSec * 3600;
  5940. hourlyProfit = profHour * profitPrice;
  5941. hourlyProfitInt = Math.round(hourlyProfit);
  5942. }
  5943. else{
  5944. millis = 0;
  5945. hours = 0;
  5946. minutes = 0;
  5947. seconds = 0;
  5948. hourlyProfitInt = 9001;
  5949. }
  5950.  
  5951. Graphics2D g = (Graphics2D)g1;
  5952. g.setColor(color1);
  5953. g.fillRect(7, 345, 488, 70);
  5954. g.setStroke(stroke1);
  5955. g.drawRect(7, 345, 488, 70);
  5956. g.setFont(font1);
  5957. g.setColor(color2);
  5958. g.drawString("Status:", 14, 362);
  5959. g.setFont(font2);
  5960. g.drawString(status, 59, 362);
  5961. g.setFont(font1);
  5962. g.drawString("Filled Vials In Bank:", 209, 362);
  5963. g.setFont(font2);
  5964. g.drawString(Integer.toString(numFilled), 328, 362);
  5965. g.setFont(font1);
  5966. g.drawString("Profit:", 14, 383);
  5967. g.setFont(font2);
  5968. g.drawString(Integer.toString(profit), 59, 383);
  5969. g.setFont(font1);
  5970. g.drawString("Profit/hr:", 137, 383);
  5971. g.setFont(font2);
  5972. if(!save){
  5973. g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
  5974. }
  5975. else{
  5976. g.drawString("Mem Save", 190, 383);
  5977. }
  5978. g.setFont(font1);
  5979. g.drawString("Runtime:", 270, 383);
  5980. g.setFont(font2);
  5981. if(!save){
  5982. g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
  5983. }
  5984. else{
  5985. g.drawString("Mem Save", 325, 384);
  5986. }
  5987. g.setFont(font1);
  5988. g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
  5989. g.drawString("Running:", 710, 139);
  5990. g.setFont(font2);
  5991. g.drawString(isRunning, 722, 156);
  5992. g.setFont(font3);
  5993. g.drawString("Painlaws", 440, 357);
  5994.  
  5995. g1.setColor(Color.green);
  5996. g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
  5997. g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
  5998. }
  5999.  
  6000. /* Antiban stuff
  6001. * Some credits to Aaimister :)
  6002. * Partially copied, with permission
  6003. */
  6004.  
  6005. public void rotateCamera() {
  6006. final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  6007. final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  6008. final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  6009. KeyEvent.VK_UP, KeyEvent.VK_UP };
  6010. final int randomLR = random(0, 2);
  6011. final int randomUD = random(0, 2);
  6012. final int randomAll = random(0, 4);
  6013. if (random(0, 3) == 0) {
  6014. keyboard.pressKey(LR[randomLR]);
  6015. sleepCR(random(2, 9));
  6016. keyboard.pressKey(UD[randomUD]);
  6017. sleepCR(random(6, 10));
  6018. keyboard.releaseKey(UD[randomUD]);
  6019. sleepCR(random(2, 7));
  6020. keyboard.releaseKey(LR[randomLR]);
  6021. } else {
  6022. keyboard.pressKey(LRUD[randomAll]);
  6023. if (randomAll > 1) {
  6024. sleepCR(random(6, 11));
  6025. } else {
  6026. sleepCR(random(9, 12));
  6027. }
  6028. keyboard.releaseKey(LRUD[randomAll]);
  6029. }
  6030. }
  6031.  
  6032. private boolean sleepCR(final int amtOfHalfSecs) {
  6033. for (int x = 0; x < amtOfHalfSecs + 1; x++) {
  6034. sleep(random(48, 53));
  6035. }
  6036. return true;
  6037. }
  6038.  
  6039. private void antiban(){
  6040. int action = random(0, 5);
  6041.  
  6042. switch (action) {
  6043. case 0:
  6044. status = "Antiban";
  6045. rotateCamera();
  6046. sleep(200, 400);
  6047. break;
  6048. case 1:
  6049. status = "Antiban";
  6050. mouse.moveRandomly(100, 900);
  6051. sleep(200, 400);
  6052. break;
  6053. case 2:
  6054. status = "Antiban";
  6055. mouse.moveSlightly();
  6056. sleep(200, 400);
  6057. break;
  6058. case 3:
  6059. status = "Antiban";
  6060. camera.moveRandomly(random(750,1250));
  6061. sleep(200, 400);
  6062. break;
  6063. case 4:
  6064. status = "Antiban";
  6065. checkEXP();
  6066. sleep(200, 400);
  6067. break;
  6068. case 5:
  6069. status = "Antiban";
  6070. mouse.moveOffScreen();
  6071. sleep(200, 400);
  6072. break;
  6073. }
  6074. }
  6075.  
  6076. public void checkEXP() {
  6077. game.openTab(Game.Tab.STATS);
  6078. skills.doHover(Skills.INTERFACE_PRAYER);
  6079. sleep(random(2100, 3400));
  6080. game.openTab(Game.Tab.INVENTORY);
  6081. sleep(random(540,760));
  6082. }
  6083.  
  6084.  
  6085. class gui extends JFrame {
  6086. /**
  6087. *
  6088. */
  6089. private static final long serialVersionUID = 1L;
  6090. public gui() {
  6091. initComponents();
  6092. }
  6093.  
  6094. private void startButtonActionPerformed(ActionEvent e){
  6095. String mode = selectionBox.getSelectedItem().toString();
  6096. if(mode.equals("Maximum")){
  6097. antiban = false;
  6098. minSpeed = 5;
  6099. maxSpeed = 6;
  6100. }
  6101. else if(mode.equals("Paranoid")){
  6102. antiban = true;
  6103. minSpeed = 8;
  6104. maxSpeed = 10;
  6105. min = 3;
  6106. max = 3;
  6107.  
  6108. }
  6109. save = memoryMode.isSelected();
  6110. guiWait = false;
  6111. g.dispose();
  6112. }
  6113.  
  6114. private void initComponents() {
  6115. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  6116. label1 = new JLabel();
  6117. selectionBox = new JComboBox();
  6118. memoryMode = new JCheckBox();
  6119. label2 = new JLabel();
  6120. label3 = new JLabel();
  6121. label4 = new JLabel();
  6122. label5 = new JLabel();
  6123. startButton = new JButton();
  6124.  
  6125. //======== this ========
  6126. setTitle("Painlaws's Vial Filler");
  6127. setResizable(false);
  6128. Container contentPane = getContentPane();
  6129.  
  6130. //---- label1 ----
  6131. label1.setText("Mode");
  6132.  
  6133. //---- selectionBox ----
  6134. selectionBox.setModel(new DefaultComboBoxModel(new String[] {
  6135. "Normal",
  6136. "Paranoid",
  6137. "Maximum"
  6138. }));
  6139.  
  6140. //---- memoryMode ----
  6141. memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
  6142.  
  6143. //---- label2 ----
  6144. label2.setText("Modes:");
  6145.  
  6146. //---- label3 ----
  6147. label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
  6148.  
  6149. //---- label4 ----
  6150. label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
  6151.  
  6152. //---- label5 ----
  6153. label5.setText("Maximum - No Antiban, Fast Mouse Speed");
  6154.  
  6155. //---- startButton ----
  6156. startButton.setText("Let's Fill Some Vials!");
  6157. startButton.addActionListener(new ActionListener() {
  6158. public void actionPerformed(ActionEvent e){
  6159. startButtonActionPerformed(e);
  6160. }
  6161. });
  6162.  
  6163. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  6164. contentPane.setLayout(contentPaneLayout);
  6165. contentPaneLayout.setHorizontalGroup(
  6166. contentPaneLayout.createParallelGroup()
  6167. .addGroup(contentPaneLayout.createSequentialGroup()
  6168. .addGroup(contentPaneLayout.createParallelGroup()
  6169. .addGroup(contentPaneLayout.createSequentialGroup()
  6170. .addContainerGap()
  6171. .addGroup(contentPaneLayout.createParallelGroup()
  6172. .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  6173. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  6174. .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  6175. .addGroup(contentPaneLayout.createSequentialGroup()
  6176. .addComponent(label1)
  6177. .addGap(18, 18, 18)
  6178. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  6179. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  6180. .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  6181. .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  6182. .addGroup(contentPaneLayout.createSequentialGroup()
  6183. .addGap(148, 148, 148)
  6184. .addComponent(startButton)))
  6185. .addContainerGap(2, Short.MAX_VALUE))
  6186. );
  6187. contentPaneLayout.setVerticalGroup(
  6188. contentPaneLayout.createParallelGroup()
  6189. .addGroup(contentPaneLayout.createSequentialGroup()
  6190. .addContainerGap()
  6191. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  6192. .addComponent(label1)
  6193. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  6194. .addGap(18, 18, 18)
  6195. .addComponent(memoryMode)
  6196. .addGap(18, 18, 18)
  6197. .addComponent(label2)
  6198. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  6199. .addComponent(label3)
  6200. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  6201. .addComponent(label4)
  6202. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  6203. .addComponent(label5)
  6204. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
  6205. .addComponent(startButton)
  6206. .addContainerGap())
  6207. );
  6208. pack();
  6209. setLocationRelativeTo(getOwner());
  6210. // JFormDesigner - End of component initialization //GEN-END:initComponents
  6211. }
  6212.  
  6213. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  6214. private JLabel label1;
  6215. private JComboBox selectionBox;
  6216. private JCheckBox memoryMode;
  6217. private JLabel label2;
  6218. private JLabel label3;
  6219. private JLabel label4;
  6220. private JLabel label5;
  6221. private JButton startButton;
  6222. // JFormDesigner - End of variables declaration //GEN-END:variables
  6223. }
  6224.  
  6225.  
  6226. }
  6227. import java.awt.*;
  6228. import java.awt.event.*;
  6229. import javax.swing.*;
  6230. import java.awt.event.KeyEvent;
  6231. import org.rsbot.event.listeners.PaintListener;
  6232. import org.rsbot.script.Script;
  6233. import org.rsbot.script.ScriptManifest;
  6234. import org.rsbot.script.methods.*;
  6235. import org.rsbot.script.wrappers.*;
  6236.  
  6237. @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
  6238. public class vialfiller extends Script implements PaintListener{
  6239. //Variables
  6240. // - Essentials
  6241. private int bankerID = 6533;
  6242. private int fountainID = 24214;
  6243. private int emptyVialID = 229;
  6244. private int fullVialID = 227;
  6245. private int runEnergy = 50;
  6246. RSNPC banker;
  6247. RSObject fountain;
  6248. RSItem myVial;
  6249. RSTile theBank = new RSTile(3167, 3489);
  6250. RSTile theFountain = new RSTile(3191, 3471);
  6251. RSTile glitchSpot = new RSTile(3192, 3487);
  6252. RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
  6253. RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
  6254. RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
  6255. RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
  6256.  
  6257. // - GUI Options
  6258. private int min = 1;
  6259. private int max = 6;
  6260. private int minSpeed = 6;
  6261. private int maxSpeed = 9;
  6262. private boolean guiWait = true;
  6263. private boolean save = false;
  6264.  
  6265. // - State check
  6266. private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
  6267.  
  6268. // - Paint stuff
  6269. private String status = "Initializing...";
  6270. private String isRunning = "";
  6271. private int numFilled = 0;
  6272. private int vialFilledPrice;
  6273. private int vialEmptyPrice;
  6274. private int profitPrice;
  6275. private int profit;
  6276. private long startTime;
  6277. private long millis;
  6278. private long hours;
  6279. private long minutes;
  6280. private long seconds;
  6281. private float profSec = 0;
  6282. private float profHour;
  6283. private float hourlyProfit;
  6284. private int hourlyProfitInt;
  6285. private final Color color1 = new Color(0, 0, 0);
  6286. private final Color color2 = new Color(255, 255, 255);
  6287. private final BasicStroke stroke1 = new BasicStroke(1);
  6288. private final Font font1 = new Font("Arial", 0, 13);
  6289. private final Font font2 = new Font("Arial", 1, 13);
  6290. private final Font font3 = new Font("Vijaya", 1, 17);
  6291. private boolean antiban = true;
  6292. gui g = new gui();
  6293.  
  6294. @Override
  6295. public boolean onStart(){
  6296. log("Welcome to Painlaws's Vial Filler");
  6297. log("Waiting on GUI...");
  6298. g.setVisible(true);
  6299. while(guiWait){
  6300. sleep(500);
  6301. }
  6302. log("GUI Settings loaded!");
  6303. if(walking.isRunEnabled()){
  6304. isRunning = "Yes";
  6305. }
  6306. else{
  6307. isRunning = "No";
  6308. }
  6309. vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
  6310. vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
  6311. profitPrice = vialFilledPrice - vialEmptyPrice;
  6312. if(!save){
  6313. startTime = System.currentTimeMillis();
  6314. }
  6315. else{
  6316. startTime = 0;
  6317. }
  6318. return true;
  6319. }
  6320.  
  6321. @Override
  6322. public void onFinish(){
  6323. env.saveScreenshot(true);
  6324. log("^ Don't forget to upload this proggie :P");
  6325. log("Bye! PM Painlaws for comments/questions/requests");
  6326. }
  6327.  
  6328. public void useItem(RSItem item, RSObject object){
  6329. if(item != null && object != null && object.isOnScreen()){
  6330. item.doClick(true);
  6331. sleep(200, 300);
  6332. object.doClick();
  6333. }
  6334. }
  6335.  
  6336. public void fillVials(){
  6337. if(fountain != null){
  6338. status = "Filling Vials";
  6339. useItem(myVial, fountain);
  6340. while(inventory.contains(emptyVialID)){
  6341. sleep(random(1000,1500));
  6342. if(antiban){
  6343. if(random(1, 3) == 2){
  6344. mouse.moveSlightly();
  6345. }
  6346. }
  6347. }
  6348. status = "Vials filled";
  6349. }
  6350. else{
  6351. status = "Fountain is null...retrying";
  6352. sleep(random(600, 800));
  6353. }
  6354. }
  6355.  
  6356. private void doBank(){
  6357. try{
  6358. if(banker != null){
  6359. camera.turnTo(banker);
  6360. if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
  6361. status = "Opening Bank";
  6362. banker.interact("Bank Banker");
  6363. status = "Bank opened";
  6364. sleep(random(900, 1050));
  6365. status = "Depositing All";
  6366. bank.depositAll();
  6367. status = "Deposited All";
  6368. sleep(random(780, 950));
  6369. numFilled = bank.getCount(fullVialID);
  6370. if(bank.getCount(emptyVialID) != 0){
  6371. status = "Taking Vials";
  6372. bank.withdraw(emptyVialID, 0);
  6373. status = "Vials Taken";
  6374. sleep(random(700, 960));
  6375. }
  6376. else{
  6377. log("Out of vials. Quitting :/");
  6378. bank.close();
  6379. env.saveScreenshot(true);
  6380. log("^ Don't forget to upload this proggie :P");
  6381. log("Bye! PM Painlaws for comments/questions/requests");
  6382. stopScript(true);
  6383. }
  6384. status = "Closing Bank";
  6385. bank.close();
  6386. status = "Bank Closed";
  6387. sleep(random(750, 910));
  6388. }
  6389. }
  6390. sleep(random(300,500));
  6391. }catch(Exception e){log(e);}
  6392. }
  6393.  
  6394. public void onToBank(){
  6395. try{
  6396. status = "Going to Bank";
  6397. walking.walkTileMM(theBank);
  6398. }catch(Exception e){log(e);}
  6399. sleep(random(500, 700));
  6400. }
  6401.  
  6402. public void onToGlitch(){
  6403. try{
  6404. status = "Going to Fountain"; //What you don't know can't hurt you :P
  6405. walking.walkTileMM(glitchSpot);
  6406. }catch(Exception e){log(e);}
  6407. sleep(random(500, 710));
  6408. }
  6409.  
  6410. public void onToFountain(){
  6411. try{
  6412. status = "Going to Fountain";
  6413. walking.walkTileMM(theFountain);
  6414. }catch(Exception e){log(e);}
  6415. sleep(random(500, 705));
  6416. }
  6417.  
  6418. public void runcheck() {
  6419. try{
  6420. runEnergy = (random(50, 70));
  6421. if (walking.isRunEnabled()){
  6422. isRunning = "Yes";
  6423. }
  6424. else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
  6425. walking.setRun(true);
  6426. isRunning = "Yes";
  6427. sleep(random(300, 500));
  6428. }
  6429. else{
  6430. isRunning = "No";
  6431. sleep(random(300,500));
  6432. }
  6433. }catch(Exception ex){}
  6434. }
  6435.  
  6436. @Override
  6437. public int loop(){
  6438. mouse.setSpeed(random(minSpeed, maxSpeed));
  6439. runcheck();
  6440. if(antiban){
  6441. if(random(min, max) == 3){
  6442. antiban();
  6443. }
  6444. }
  6445. if(objects.getNearest(fountainID) != null){
  6446. fountain = objects.getNearest(fountainID);
  6447. }
  6448. if(npcs.getNearest(bankerID) != null){
  6449. banker = npcs.getNearest(bankerID);
  6450. }
  6451. if(inventory.getItem(emptyVialID) != null){
  6452. myVial = inventory.getItem(emptyVialID);
  6453. }
  6454. switch(getState()){
  6455. case TOFOUNTAIN:
  6456. runcheck();
  6457. onToFountain();
  6458. if(fountainRange.contains(players.getMyPlayer().getLocation())){
  6459. fillVials();
  6460. }
  6461. break;
  6462.  
  6463. case TOGLITCH:
  6464. runcheck();
  6465. onToGlitch();
  6466. break;
  6467.  
  6468. case TOBANK:
  6469. runcheck();
  6470. onToBank();
  6471. if(bankRange.contains(players.getMyPlayer().getLocation())){
  6472. doBank();
  6473. }
  6474. break;
  6475. }
  6476. return(random(500, 1000));
  6477. }
  6478.  
  6479. private State getState() {
  6480. if (!inventory.contains(emptyVialID)) {
  6481. return State.TOBANK;
  6482. }
  6483. else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
  6484. return State.TOGLITCH;
  6485. }
  6486. else{
  6487. return State.TOFOUNTAIN;
  6488. }
  6489. }
  6490.  
  6491. // GUI and Mouse
  6492. public void onRepaint(Graphics g1) {
  6493. profit = numFilled * profitPrice;
  6494. if(!save){
  6495. millis = System.currentTimeMillis() - startTime;
  6496. hours = millis / (1000 * 60 * 60);
  6497. millis -= hours * (1000 * 60 * 60);
  6498. minutes = millis / (1000 * 60);
  6499. millis -= minutes * (1000 * 60);
  6500. seconds = millis / 1000;
  6501.  
  6502. if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
  6503. profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
  6504. }
  6505. profHour = profSec * 3600;
  6506. hourlyProfit = profHour * profitPrice;
  6507. hourlyProfitInt = Math.round(hourlyProfit);
  6508. }
  6509. else{
  6510. millis = 0;
  6511. hours = 0;
  6512. minutes = 0;
  6513. seconds = 0;
  6514. hourlyProfitInt = 9001;
  6515. }
  6516.  
  6517. Graphics2D g = (Graphics2D)g1;
  6518. g.setColor(color1);
  6519. g.fillRect(7, 345, 488, 70);
  6520. g.setStroke(stroke1);
  6521. g.drawRect(7, 345, 488, 70);
  6522. g.setFont(font1);
  6523. g.setColor(color2);
  6524. g.drawString("Status:", 14, 362);
  6525. g.setFont(font2);
  6526. g.drawString(status, 59, 362);
  6527. g.setFont(font1);
  6528. g.drawString("Filled Vials In Bank:", 209, 362);
  6529. g.setFont(font2);
  6530. g.drawString(Integer.toString(numFilled), 328, 362);
  6531. g.setFont(font1);
  6532. g.drawString("Profit:", 14, 383);
  6533. g.setFont(font2);
  6534. g.drawString(Integer.toString(profit), 59, 383);
  6535. g.setFont(font1);
  6536. g.drawString("Profit/hr:", 137, 383);
  6537. g.setFont(font2);
  6538. if(!save){
  6539. g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
  6540. }
  6541. else{
  6542. g.drawString("Mem Save", 190, 383);
  6543. }
  6544. g.setFont(font1);
  6545. g.drawString("Runtime:", 270, 383);
  6546. g.setFont(font2);
  6547. if(!save){
  6548. g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
  6549. }
  6550. else{
  6551. g.drawString("Mem Save", 325, 384);
  6552. }
  6553. g.setFont(font1);
  6554. g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
  6555. g.drawString("Running:", 710, 139);
  6556. g.setFont(font2);
  6557. g.drawString(isRunning, 722, 156);
  6558. g.setFont(font3);
  6559. g.drawString("Painlaws", 440, 357);
  6560.  
  6561. g1.setColor(Color.green);
  6562. g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
  6563. g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
  6564. }
  6565.  
  6566. /* Antiban stuff
  6567. * Some credits to Aaimister :)
  6568. * Partially copied, with permission
  6569. */
  6570.  
  6571. public void rotateCamera() {
  6572. final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  6573. final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  6574. final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  6575. KeyEvent.VK_UP, KeyEvent.VK_UP };
  6576. final int randomLR = random(0, 2);
  6577. final int randomUD = random(0, 2);
  6578. final int randomAll = random(0, 4);
  6579. if (random(0, 3) == 0) {
  6580. keyboard.pressKey(LR[randomLR]);
  6581. sleepCR(random(2, 9));
  6582. keyboard.pressKey(UD[randomUD]);
  6583. sleepCR(random(6, 10));
  6584. keyboard.releaseKey(UD[randomUD]);
  6585. sleepCR(random(2, 7));
  6586. keyboard.releaseKey(LR[randomLR]);
  6587. } else {
  6588. keyboard.pressKey(LRUD[randomAll]);
  6589. if (randomAll > 1) {
  6590. sleepCR(random(6, 11));
  6591. } else {
  6592. sleepCR(random(9, 12));
  6593. }
  6594. keyboard.releaseKey(LRUD[randomAll]);
  6595. }
  6596. }
  6597.  
  6598. private boolean sleepCR(final int amtOfHalfSecs) {
  6599. for (int x = 0; x < amtOfHalfSecs + 1; x++) {
  6600. sleep(random(48, 53));
  6601. }
  6602. return true;
  6603. }
  6604.  
  6605. private void antiban(){
  6606. int action = random(0, 5);
  6607.  
  6608. switch (action) {
  6609. case 0:
  6610. status = "Antiban";
  6611. rotateCamera();
  6612. sleep(200, 400);
  6613. break;
  6614. case 1:
  6615. status = "Antiban";
  6616. mouse.moveRandomly(100, 900);
  6617. sleep(200, 400);
  6618. break;
  6619. case 2:
  6620. status = "Antiban";
  6621. mouse.moveSlightly();
  6622. sleep(200, 400);
  6623. break;
  6624. case 3:
  6625. status = "Antiban";
  6626. camera.moveRandomly(random(750,1250));
  6627. sleep(200, 400);
  6628. break;
  6629. case 4:
  6630. status = "Antiban";
  6631. checkEXP();
  6632. sleep(200, 400);
  6633. break;
  6634. case 5:
  6635. status = "Antiban";
  6636. mouse.moveOffScreen();
  6637. sleep(200, 400);
  6638. break;
  6639. }
  6640. }
  6641.  
  6642. public void checkEXP() {
  6643. game.openTab(Game.Tab.STATS);
  6644. skills.doHover(Skills.INTERFACE_PRAYER);
  6645. sleep(random(2100, 3400));
  6646. game.openTab(Game.Tab.INVENTORY);
  6647. sleep(random(540,760));
  6648. }
  6649.  
  6650.  
  6651. class gui extends JFrame {
  6652. /**
  6653. *
  6654. */
  6655. private static final long serialVersionUID = 1L;
  6656. public gui() {
  6657. initComponents();
  6658. }
  6659.  
  6660. private void startButtonActionPerformed(ActionEvent e){
  6661. String mode = selectionBox.getSelectedItem().toString();
  6662. if(mode.equals("Maximum")){
  6663. antiban = false;
  6664. minSpeed = 5;
  6665. maxSpeed = 6;
  6666. }
  6667. else if(mode.equals("Paranoid")){
  6668. antiban = true;
  6669. minSpeed = 8;
  6670. maxSpeed = 10;
  6671. min = 3;
  6672. max = 3;
  6673.  
  6674. }
  6675. save = memoryMode.isSelected();
  6676. guiWait = false;
  6677. g.dispose();
  6678. }
  6679.  
  6680. private void initComponents() {
  6681. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  6682. label1 = new JLabel();
  6683. selectionBox = new JComboBox();
  6684. memoryMode = new JCheckBox();
  6685. label2 = new JLabel();
  6686. label3 = new JLabel();
  6687. label4 = new JLabel();
  6688. label5 = new JLabel();
  6689. startButton = new JButton();
  6690.  
  6691. //======== this ========
  6692. setTitle("Painlaws's Vial Filler");
  6693. setResizable(false);
  6694. Container contentPane = getContentPane();
  6695.  
  6696. //---- label1 ----
  6697. label1.setText("Mode");
  6698.  
  6699. //---- selectionBox ----
  6700. selectionBox.setModel(new DefaultComboBoxModel(new String[] {
  6701. "Normal",
  6702. "Paranoid",
  6703. "Maximum"
  6704. }));
  6705.  
  6706. //---- memoryMode ----
  6707. memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
  6708.  
  6709. //---- label2 ----
  6710. label2.setText("Modes:");
  6711.  
  6712. //---- label3 ----
  6713. label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
  6714.  
  6715. //---- label4 ----
  6716. label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
  6717.  
  6718. //---- label5 ----
  6719. label5.setText("Maximum - No Antiban, Fast Mouse Speed");
  6720.  
  6721. //---- startButton ----
  6722. startButton.setText("Let's Fill Some Vials!");
  6723. startButton.addActionListener(new ActionListener() {
  6724. public void actionPerformed(ActionEvent e){
  6725. startButtonActionPerformed(e);
  6726. }
  6727. });
  6728.  
  6729. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  6730. contentPane.setLayout(contentPaneLayout);
  6731. contentPaneLayout.setHorizontalGroup(
  6732. contentPaneLayout.createParallelGroup()
  6733. .addGroup(contentPaneLayout.createSequentialGroup()
  6734. .addGroup(contentPaneLayout.createParallelGroup()
  6735. .addGroup(contentPaneLayout.createSequentialGroup()
  6736. .addContainerGap()
  6737. .addGroup(contentPaneLayout.createParallelGroup()
  6738. .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  6739. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  6740. .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  6741. .addGroup(contentPaneLayout.createSequentialGroup()
  6742. .addComponent(label1)
  6743. .addGap(18, 18, 18)
  6744. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  6745. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  6746. .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  6747. .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  6748. .addGroup(contentPaneLayout.createSequentialGroup()
  6749. .addGap(148, 148, 148)
  6750. .addComponent(startButton)))
  6751. .addContainerGap(2, Short.MAX_VALUE))
  6752. );
  6753. contentPaneLayout.setVerticalGroup(
  6754. contentPaneLayout.createParallelGroup()
  6755. .addGroup(contentPaneLayout.createSequentialGroup()
  6756. .addContainerGap()
  6757. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  6758. .addComponent(label1)
  6759. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  6760. .addGap(18, 18, 18)
  6761. .addComponent(memoryMode)
  6762. .addGap(18, 18, 18)
  6763. .addComponent(label2)
  6764. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  6765. .addComponent(label3)
  6766. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  6767. .addComponent(label4)
  6768. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  6769. .addComponent(label5)
  6770. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
  6771. .addComponent(startButton)
  6772. .addContainerGap())
  6773. );
  6774. pack();
  6775. setLocationRelativeTo(getOwner());
  6776. // JFormDesigner - End of component initialization //GEN-END:initComponents
  6777. }
  6778.  
  6779. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  6780. private JLabel label1;
  6781. private JComboBox selectionBox;
  6782. private JCheckBox memoryMode;
  6783. private JLabel label2;
  6784. private JLabel label3;
  6785. private JLabel label4;
  6786. private JLabel label5;
  6787. private JButton startButton;
  6788. // JFormDesigner - End of variables declaration //GEN-END:variables
  6789. }
  6790.  
  6791.  
  6792. }
  6793. import java.awt.*;
  6794. import java.awt.event.*;
  6795. import javax.swing.*;
  6796. import java.awt.event.KeyEvent;
  6797. import org.rsbot.event.listeners.PaintListener;
  6798. import org.rsbot.script.Script;
  6799. import org.rsbot.script.ScriptManifest;
  6800. import org.rsbot.script.methods.*;
  6801. import org.rsbot.script.wrappers.*;
  6802.  
  6803. @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
  6804. public class vialfiller extends Script implements PaintListener{
  6805. //Variables
  6806. // - Essentials
  6807. private int bankerID = 6533;
  6808. private int fountainID = 24214;
  6809. private int emptyVialID = 229;
  6810. private int fullVialID = 227;
  6811. private int runEnergy = 50;
  6812. RSNPC banker;
  6813. RSObject fountain;
  6814. RSItem myVial;
  6815. RSTile theBank = new RSTile(3167, 3489);
  6816. RSTile theFountain = new RSTile(3191, 3471);
  6817. RSTile glitchSpot = new RSTile(3192, 3487);
  6818. RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
  6819. RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
  6820. RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
  6821. RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
  6822.  
  6823. // - GUI Options
  6824. private int min = 1;
  6825. private int max = 6;
  6826. private int minSpeed = 6;
  6827. private int maxSpeed = 9;
  6828. private boolean guiWait = true;
  6829. private boolean save = false;
  6830.  
  6831. // - State check
  6832. private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
  6833.  
  6834. // - Paint stuff
  6835. private String status = "Initializing...";
  6836. private String isRunning = "";
  6837. private int numFilled = 0;
  6838. private int vialFilledPrice;
  6839. private int vialEmptyPrice;
  6840. private int profitPrice;
  6841. private int profit;
  6842. private long startTime;
  6843. private long millis;
  6844. private long hours;
  6845. private long minutes;
  6846. private long seconds;
  6847. private float profSec = 0;
  6848. private float profHour;
  6849. private float hourlyProfit;
  6850. private int hourlyProfitInt;
  6851. private final Color color1 = new Color(0, 0, 0);
  6852. private final Color color2 = new Color(255, 255, 255);
  6853. private final BasicStroke stroke1 = new BasicStroke(1);
  6854. private final Font font1 = new Font("Arial", 0, 13);
  6855. private final Font font2 = new Font("Arial", 1, 13);
  6856. private final Font font3 = new Font("Vijaya", 1, 17);
  6857. private boolean antiban = true;
  6858. gui g = new gui();
  6859.  
  6860. @Override
  6861. public boolean onStart(){
  6862. log("Welcome to Painlaws's Vial Filler");
  6863. log("Waiting on GUI...");
  6864. g.setVisible(true);
  6865. while(guiWait){
  6866. sleep(500);
  6867. }
  6868. log("GUI Settings loaded!");
  6869. if(walking.isRunEnabled()){
  6870. isRunning = "Yes";
  6871. }
  6872. else{
  6873. isRunning = "No";
  6874. }
  6875. vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
  6876. vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
  6877. profitPrice = vialFilledPrice - vialEmptyPrice;
  6878. if(!save){
  6879. startTime = System.currentTimeMillis();
  6880. }
  6881. else{
  6882. startTime = 0;
  6883. }
  6884. return true;
  6885. }
  6886.  
  6887. @Override
  6888. public void onFinish(){
  6889. env.saveScreenshot(true);
  6890. log("^ Don't forget to upload this proggie :P");
  6891. log("Bye! PM Painlaws for comments/questions/requests");
  6892. }
  6893.  
  6894. public void useItem(RSItem item, RSObject object){
  6895. if(item != null && object != null && object.isOnScreen()){
  6896. item.doClick(true);
  6897. sleep(200, 300);
  6898. object.doClick();
  6899. }
  6900. }
  6901.  
  6902. public void fillVials(){
  6903. if(fountain != null){
  6904. status = "Filling Vials";
  6905. useItem(myVial, fountain);
  6906. while(inventory.contains(emptyVialID)){
  6907. sleep(random(1000,1500));
  6908. if(antiban){
  6909. if(random(1, 3) == 2){
  6910. mouse.moveSlightly();
  6911. }
  6912. }
  6913. }
  6914. status = "Vials filled";
  6915. }
  6916. else{
  6917. status = "Fountain is null...retrying";
  6918. sleep(random(600, 800));
  6919. }
  6920. }
  6921.  
  6922. private void doBank(){
  6923. try{
  6924. if(banker != null){
  6925. camera.turnTo(banker);
  6926. if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
  6927. status = "Opening Bank";
  6928. banker.interact("Bank Banker");
  6929. status = "Bank opened";
  6930. sleep(random(900, 1050));
  6931. status = "Depositing All";
  6932. bank.depositAll();
  6933. status = "Deposited All";
  6934. sleep(random(780, 950));
  6935. numFilled = bank.getCount(fullVialID);
  6936. if(bank.getCount(emptyVialID) != 0){
  6937. status = "Taking Vials";
  6938. bank.withdraw(emptyVialID, 0);
  6939. status = "Vials Taken";
  6940. sleep(random(700, 960));
  6941. }
  6942. else{
  6943. log("Out of vials. Quitting :/");
  6944. bank.close();
  6945. env.saveScreenshot(true);
  6946. log("^ Don't forget to upload this proggie :P");
  6947. log("Bye! PM Painlaws for comments/questions/requests");
  6948. stopScript(true);
  6949. }
  6950. status = "Closing Bank";
  6951. bank.close();
  6952. status = "Bank Closed";
  6953. sleep(random(750, 910));
  6954. }
  6955. }
  6956. sleep(random(300,500));
  6957. }catch(Exception e){log(e);}
  6958. }
  6959.  
  6960. public void onToBank(){
  6961. try{
  6962. status = "Going to Bank";
  6963. walking.walkTileMM(theBank);
  6964. }catch(Exception e){log(e);}
  6965. sleep(random(500, 700));
  6966. }
  6967.  
  6968. public void onToGlitch(){
  6969. try{
  6970. status = "Going to Fountain"; //What you don't know can't hurt you :P
  6971. walking.walkTileMM(glitchSpot);
  6972. }catch(Exception e){log(e);}
  6973. sleep(random(500, 710));
  6974. }
  6975.  
  6976. public void onToFountain(){
  6977. try{
  6978. status = "Going to Fountain";
  6979. walking.walkTileMM(theFountain);
  6980. }catch(Exception e){log(e);}
  6981. sleep(random(500, 705));
  6982. }
  6983.  
  6984. public void runcheck() {
  6985. try{
  6986. runEnergy = (random(50, 70));
  6987. if (walking.isRunEnabled()){
  6988. isRunning = "Yes";
  6989. }
  6990. else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
  6991. walking.setRun(true);
  6992. isRunning = "Yes";
  6993. sleep(random(300, 500));
  6994. }
  6995. else{
  6996. isRunning = "No";
  6997. sleep(random(300,500));
  6998. }
  6999. }catch(Exception ex){}
  7000. }
  7001.  
  7002. @Override
  7003. public int loop(){
  7004. mouse.setSpeed(random(minSpeed, maxSpeed));
  7005. runcheck();
  7006. if(antiban){
  7007. if(random(min, max) == 3){
  7008. antiban();
  7009. }
  7010. }
  7011. if(objects.getNearest(fountainID) != null){
  7012. fountain = objects.getNearest(fountainID);
  7013. }
  7014. if(npcs.getNearest(bankerID) != null){
  7015. banker = npcs.getNearest(bankerID);
  7016. }
  7017. if(inventory.getItem(emptyVialID) != null){
  7018. myVial = inventory.getItem(emptyVialID);
  7019. }
  7020. switch(getState()){
  7021. case TOFOUNTAIN:
  7022. runcheck();
  7023. onToFountain();
  7024. if(fountainRange.contains(players.getMyPlayer().getLocation())){
  7025. fillVials();
  7026. }
  7027. break;
  7028.  
  7029. case TOGLITCH:
  7030. runcheck();
  7031. onToGlitch();
  7032. break;
  7033.  
  7034. case TOBANK:
  7035. runcheck();
  7036. onToBank();
  7037. if(bankRange.contains(players.getMyPlayer().getLocation())){
  7038. doBank();
  7039. }
  7040. break;
  7041. }
  7042. return(random(500, 1000));
  7043. }
  7044.  
  7045. private State getState() {
  7046. if (!inventory.contains(emptyVialID)) {
  7047. return State.TOBANK;
  7048. }
  7049. else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
  7050. return State.TOGLITCH;
  7051. }
  7052. else{
  7053. return State.TOFOUNTAIN;
  7054. }
  7055. }
  7056.  
  7057. // GUI and Mouse
  7058. public void onRepaint(Graphics g1) {
  7059. profit = numFilled * profitPrice;
  7060. if(!save){
  7061. millis = System.currentTimeMillis() - startTime;
  7062. hours = millis / (1000 * 60 * 60);
  7063. millis -= hours * (1000 * 60 * 60);
  7064. minutes = millis / (1000 * 60);
  7065. millis -= minutes * (1000 * 60);
  7066. seconds = millis / 1000;
  7067.  
  7068. if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
  7069. profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
  7070. }
  7071. profHour = profSec * 3600;
  7072. hourlyProfit = profHour * profitPrice;
  7073. hourlyProfitInt = Math.round(hourlyProfit);
  7074. }
  7075. else{
  7076. millis = 0;
  7077. hours = 0;
  7078. minutes = 0;
  7079. seconds = 0;
  7080. hourlyProfitInt = 9001;
  7081. }
  7082.  
  7083. Graphics2D g = (Graphics2D)g1;
  7084. g.setColor(color1);
  7085. g.fillRect(7, 345, 488, 70);
  7086. g.setStroke(stroke1);
  7087. g.drawRect(7, 345, 488, 70);
  7088. g.setFont(font1);
  7089. g.setColor(color2);
  7090. g.drawString("Status:", 14, 362);
  7091. g.setFont(font2);
  7092. g.drawString(status, 59, 362);
  7093. g.setFont(font1);
  7094. g.drawString("Filled Vials In Bank:", 209, 362);
  7095. g.setFont(font2);
  7096. g.drawString(Integer.toString(numFilled), 328, 362);
  7097. g.setFont(font1);
  7098. g.drawString("Profit:", 14, 383);
  7099. g.setFont(font2);
  7100. g.drawString(Integer.toString(profit), 59, 383);
  7101. g.setFont(font1);
  7102. g.drawString("Profit/hr:", 137, 383);
  7103. g.setFont(font2);
  7104. if(!save){
  7105. g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
  7106. }
  7107. else{
  7108. g.drawString("Mem Save", 190, 383);
  7109. }
  7110. g.setFont(font1);
  7111. g.drawString("Runtime:", 270, 383);
  7112. g.setFont(font2);
  7113. if(!save){
  7114. g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
  7115. }
  7116. else{
  7117. g.drawString("Mem Save", 325, 384);
  7118. }
  7119. g.setFont(font1);
  7120. g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
  7121. g.drawString("Running:", 710, 139);
  7122. g.setFont(font2);
  7123. g.drawString(isRunning, 722, 156);
  7124. g.setFont(font3);
  7125. g.drawString("Painlaws", 440, 357);
  7126.  
  7127. g1.setColor(Color.green);
  7128. g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
  7129. g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
  7130. }
  7131.  
  7132. /* Antiban stuff
  7133. * Some credits to Aaimister :)
  7134. * Partially copied, with permission
  7135. */
  7136.  
  7137. public void rotateCamera() {
  7138. final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  7139. final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  7140. final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  7141. KeyEvent.VK_UP, KeyEvent.VK_UP };
  7142. final int randomLR = random(0, 2);
  7143. final int randomUD = random(0, 2);
  7144. final int randomAll = random(0, 4);
  7145. if (random(0, 3) == 0) {
  7146. keyboard.pressKey(LR[randomLR]);
  7147. sleepCR(random(2, 9));
  7148. keyboard.pressKey(UD[randomUD]);
  7149. sleepCR(random(6, 10));
  7150. keyboard.releaseKey(UD[randomUD]);
  7151. sleepCR(random(2, 7));
  7152. keyboard.releaseKey(LR[randomLR]);
  7153. } else {
  7154. keyboard.pressKey(LRUD[randomAll]);
  7155. if (randomAll > 1) {
  7156. sleepCR(random(6, 11));
  7157. } else {
  7158. sleepCR(random(9, 12));
  7159. }
  7160. keyboard.releaseKey(LRUD[randomAll]);
  7161. }
  7162. }
  7163.  
  7164. private boolean sleepCR(final int amtOfHalfSecs) {
  7165. for (int x = 0; x < amtOfHalfSecs + 1; x++) {
  7166. sleep(random(48, 53));
  7167. }
  7168. return true;
  7169. }
  7170.  
  7171. private void antiban(){
  7172. int action = random(0, 5);
  7173.  
  7174. switch (action) {
  7175. case 0:
  7176. status = "Antiban";
  7177. rotateCamera();
  7178. sleep(200, 400);
  7179. break;
  7180. case 1:
  7181. status = "Antiban";
  7182. mouse.moveRandomly(100, 900);
  7183. sleep(200, 400);
  7184. break;
  7185. case 2:
  7186. status = "Antiban";
  7187. mouse.moveSlightly();
  7188. sleep(200, 400);
  7189. break;
  7190. case 3:
  7191. status = "Antiban";
  7192. camera.moveRandomly(random(750,1250));
  7193. sleep(200, 400);
  7194. break;
  7195. case 4:
  7196. status = "Antiban";
  7197. checkEXP();
  7198. sleep(200, 400);
  7199. break;
  7200. case 5:
  7201. status = "Antiban";
  7202. mouse.moveOffScreen();
  7203. sleep(200, 400);
  7204. break;
  7205. }
  7206. }
  7207.  
  7208. public void checkEXP() {
  7209. game.openTab(Game.Tab.STATS);
  7210. skills.doHover(Skills.INTERFACE_PRAYER);
  7211. sleep(random(2100, 3400));
  7212. game.openTab(Game.Tab.INVENTORY);
  7213. sleep(random(540,760));
  7214. }
  7215.  
  7216.  
  7217. class gui extends JFrame {
  7218. /**
  7219. *
  7220. */
  7221. private static final long serialVersionUID = 1L;
  7222. public gui() {
  7223. initComponents();
  7224. }
  7225.  
  7226. private void startButtonActionPerformed(ActionEvent e){
  7227. String mode = selectionBox.getSelectedItem().toString();
  7228. if(mode.equals("Maximum")){
  7229. antiban = false;
  7230. minSpeed = 5;
  7231. maxSpeed = 6;
  7232. }
  7233. else if(mode.equals("Paranoid")){
  7234. antiban = true;
  7235. minSpeed = 8;
  7236. maxSpeed = 10;
  7237. min = 3;
  7238. max = 3;
  7239.  
  7240. }
  7241. save = memoryMode.isSelected();
  7242. guiWait = false;
  7243. g.dispose();
  7244. }
  7245.  
  7246. private void initComponents() {
  7247. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  7248. label1 = new JLabel();
  7249. selectionBox = new JComboBox();
  7250. memoryMode = new JCheckBox();
  7251. label2 = new JLabel();
  7252. label3 = new JLabel();
  7253. label4 = new JLabel();
  7254. label5 = new JLabel();
  7255. startButton = new JButton();
  7256.  
  7257. //======== this ========
  7258. setTitle("Painlaws's Vial Filler");
  7259. setResizable(false);
  7260. Container contentPane = getContentPane();
  7261.  
  7262. //---- label1 ----
  7263. label1.setText("Mode");
  7264.  
  7265. //---- selectionBox ----
  7266. selectionBox.setModel(new DefaultComboBoxModel(new String[] {
  7267. "Normal",
  7268. "Paranoid",
  7269. "Maximum"
  7270. }));
  7271.  
  7272. //---- memoryMode ----
  7273. memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
  7274.  
  7275. //---- label2 ----
  7276. label2.setText("Modes:");
  7277.  
  7278. //---- label3 ----
  7279. label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
  7280.  
  7281. //---- label4 ----
  7282. label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
  7283.  
  7284. //---- label5 ----
  7285. label5.setText("Maximum - No Antiban, Fast Mouse Speed");
  7286.  
  7287. //---- startButton ----
  7288. startButton.setText("Let's Fill Some Vials!");
  7289. startButton.addActionListener(new ActionListener() {
  7290. public void actionPerformed(ActionEvent e){
  7291. startButtonActionPerformed(e);
  7292. }
  7293. });
  7294.  
  7295. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  7296. contentPane.setLayout(contentPaneLayout);
  7297. contentPaneLayout.setHorizontalGroup(
  7298. contentPaneLayout.createParallelGroup()
  7299. .addGroup(contentPaneLayout.createSequentialGroup()
  7300. .addGroup(contentPaneLayout.createParallelGroup()
  7301. .addGroup(contentPaneLayout.createSequentialGroup()
  7302. .addContainerGap()
  7303. .addGroup(contentPaneLayout.createParallelGroup()
  7304. .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  7305. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  7306. .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  7307. .addGroup(contentPaneLayout.createSequentialGroup()
  7308. .addComponent(label1)
  7309. .addGap(18, 18, 18)
  7310. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  7311. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  7312. .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  7313. .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  7314. .addGroup(contentPaneLayout.createSequentialGroup()
  7315. .addGap(148, 148, 148)
  7316. .addComponent(startButton)))
  7317. .addContainerGap(2, Short.MAX_VALUE))
  7318. );
  7319. contentPaneLayout.setVerticalGroup(
  7320. contentPaneLayout.createParallelGroup()
  7321. .addGroup(contentPaneLayout.createSequentialGroup()
  7322. .addContainerGap()
  7323. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  7324. .addComponent(label1)
  7325. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  7326. .addGap(18, 18, 18)
  7327. .addComponent(memoryMode)
  7328. .addGap(18, 18, 18)
  7329. .addComponent(label2)
  7330. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  7331. .addComponent(label3)
  7332. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  7333. .addComponent(label4)
  7334. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  7335. .addComponent(label5)
  7336. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
  7337. .addComponent(startButton)
  7338. .addContainerGap())
  7339. );
  7340. pack();
  7341. setLocationRelativeTo(getOwner());
  7342. // JFormDesigner - End of component initialization //GEN-END:initComponents
  7343. }
  7344.  
  7345. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  7346. private JLabel label1;
  7347. private JComboBox selectionBox;
  7348. private JCheckBox memoryMode;
  7349. private JLabel label2;
  7350. private JLabel label3;
  7351. private JLabel label4;
  7352. private JLabel label5;
  7353. private JButton startButton;
  7354. // JFormDesigner - End of variables declaration //GEN-END:variables
  7355. }
  7356.  
  7357.  
  7358. }
  7359. import java.awt.*;
  7360. import java.awt.event.*;
  7361. import javax.swing.*;
  7362. import java.awt.event.KeyEvent;
  7363. import org.rsbot.event.listeners.PaintListener;
  7364. import org.rsbot.script.Script;
  7365. import org.rsbot.script.ScriptManifest;
  7366. import org.rsbot.script.methods.*;
  7367. import org.rsbot.script.wrappers.*;
  7368.  
  7369. @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
  7370. public class vialfiller extends Script implements PaintListener{
  7371. //Variables
  7372. // - Essentials
  7373. private int bankerID = 6533;
  7374. private int fountainID = 24214;
  7375. private int emptyVialID = 229;
  7376. private int fullVialID = 227;
  7377. private int runEnergy = 50;
  7378. RSNPC banker;
  7379. RSObject fountain;
  7380. RSItem myVial;
  7381. RSTile theBank = new RSTile(3167, 3489);
  7382. RSTile theFountain = new RSTile(3191, 3471);
  7383. RSTile glitchSpot = new RSTile(3192, 3487);
  7384. RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
  7385. RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
  7386. RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
  7387. RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
  7388.  
  7389. // - GUI Options
  7390. private int min = 1;
  7391. private int max = 6;
  7392. private int minSpeed = 6;
  7393. private int maxSpeed = 9;
  7394. private boolean guiWait = true;
  7395. private boolean save = false;
  7396.  
  7397. // - State check
  7398. private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
  7399.  
  7400. // - Paint stuff
  7401. private String status = "Initializing...";
  7402. private String isRunning = "";
  7403. private int numFilled = 0;
  7404. private int vialFilledPrice;
  7405. private int vialEmptyPrice;
  7406. private int profitPrice;
  7407. private int profit;
  7408. private long startTime;
  7409. private long millis;
  7410. private long hours;
  7411. private long minutes;
  7412. private long seconds;
  7413. private float profSec = 0;
  7414. private float profHour;
  7415. private float hourlyProfit;
  7416. private int hourlyProfitInt;
  7417. private final Color color1 = new Color(0, 0, 0);
  7418. private final Color color2 = new Color(255, 255, 255);
  7419. private final BasicStroke stroke1 = new BasicStroke(1);
  7420. private final Font font1 = new Font("Arial", 0, 13);
  7421. private final Font font2 = new Font("Arial", 1, 13);
  7422. private final Font font3 = new Font("Vijaya", 1, 17);
  7423. private boolean antiban = true;
  7424. gui g = new gui();
  7425.  
  7426. @Override
  7427. public boolean onStart(){
  7428. log("Welcome to Painlaws's Vial Filler");
  7429. log("Waiting on GUI...");
  7430. g.setVisible(true);
  7431. while(guiWait){
  7432. sleep(500);
  7433. }
  7434. log("GUI Settings loaded!");
  7435. if(walking.isRunEnabled()){
  7436. isRunning = "Yes";
  7437. }
  7438. else{
  7439. isRunning = "No";
  7440. }
  7441. vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
  7442. vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
  7443. profitPrice = vialFilledPrice - vialEmptyPrice;
  7444. if(!save){
  7445. startTime = System.currentTimeMillis();
  7446. }
  7447. else{
  7448. startTime = 0;
  7449. }
  7450. return true;
  7451. }
  7452.  
  7453. @Override
  7454. public void onFinish(){
  7455. env.saveScreenshot(true);
  7456. log("^ Don't forget to upload this proggie :P");
  7457. log("Bye! PM Painlaws for comments/questions/requests");
  7458. }
  7459.  
  7460. public void useItem(RSItem item, RSObject object){
  7461. if(item != null && object != null && object.isOnScreen()){
  7462. item.doClick(true);
  7463. sleep(200, 300);
  7464. object.doClick();
  7465. }
  7466. }
  7467.  
  7468. public void fillVials(){
  7469. if(fountain != null){
  7470. status = "Filling Vials";
  7471. useItem(myVial, fountain);
  7472. while(inventory.contains(emptyVialID)){
  7473. sleep(random(1000,1500));
  7474. if(antiban){
  7475. if(random(1, 3) == 2){
  7476. mouse.moveSlightly();
  7477. }
  7478. }
  7479. }
  7480. status = "Vials filled";
  7481. }
  7482. else{
  7483. status = "Fountain is null...retrying";
  7484. sleep(random(600, 800));
  7485. }
  7486. }
  7487.  
  7488. private void doBank(){
  7489. try{
  7490. if(banker != null){
  7491. camera.turnTo(banker);
  7492. if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
  7493. status = "Opening Bank";
  7494. banker.interact("Bank Banker");
  7495. status = "Bank opened";
  7496. sleep(random(900, 1050));
  7497. status = "Depositing All";
  7498. bank.depositAll();
  7499. status = "Deposited All";
  7500. sleep(random(780, 950));
  7501. numFilled = bank.getCount(fullVialID);
  7502. if(bank.getCount(emptyVialID) != 0){
  7503. status = "Taking Vials";
  7504. bank.withdraw(emptyVialID, 0);
  7505. status = "Vials Taken";
  7506. sleep(random(700, 960));
  7507. }
  7508. else{
  7509. log("Out of vials. Quitting :/");
  7510. bank.close();
  7511. env.saveScreenshot(true);
  7512. log("^ Don't forget to upload this proggie :P");
  7513. log("Bye! PM Painlaws for comments/questions/requests");
  7514. stopScript(true);
  7515. }
  7516. status = "Closing Bank";
  7517. bank.close();
  7518. status = "Bank Closed";
  7519. sleep(random(750, 910));
  7520. }
  7521. }
  7522. sleep(random(300,500));
  7523. }catch(Exception e){log(e);}
  7524. }
  7525.  
  7526. public void onToBank(){
  7527. try{
  7528. status = "Going to Bank";
  7529. walking.walkTileMM(theBank);
  7530. }catch(Exception e){log(e);}
  7531. sleep(random(500, 700));
  7532. }
  7533.  
  7534. public void onToGlitch(){
  7535. try{
  7536. status = "Going to Fountain"; //What you don't know can't hurt you :P
  7537. walking.walkTileMM(glitchSpot);
  7538. }catch(Exception e){log(e);}
  7539. sleep(random(500, 710));
  7540. }
  7541.  
  7542. public void onToFountain(){
  7543. try{
  7544. status = "Going to Fountain";
  7545. walking.walkTileMM(theFountain);
  7546. }catch(Exception e){log(e);}
  7547. sleep(random(500, 705));
  7548. }
  7549.  
  7550. public void runcheck() {
  7551. try{
  7552. runEnergy = (random(50, 70));
  7553. if (walking.isRunEnabled()){
  7554. isRunning = "Yes";
  7555. }
  7556. else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
  7557. walking.setRun(true);
  7558. isRunning = "Yes";
  7559. sleep(random(300, 500));
  7560. }
  7561. else{
  7562. isRunning = "No";
  7563. sleep(random(300,500));
  7564. }
  7565. }catch(Exception ex){}
  7566. }
  7567.  
  7568. @Override
  7569. public int loop(){
  7570. mouse.setSpeed(random(minSpeed, maxSpeed));
  7571. runcheck();
  7572. if(antiban){
  7573. if(random(min, max) == 3){
  7574. antiban();
  7575. }
  7576. }
  7577. if(objects.getNearest(fountainID) != null){
  7578. fountain = objects.getNearest(fountainID);
  7579. }
  7580. if(npcs.getNearest(bankerID) != null){
  7581. banker = npcs.getNearest(bankerID);
  7582. }
  7583. if(inventory.getItem(emptyVialID) != null){
  7584. myVial = inventory.getItem(emptyVialID);
  7585. }
  7586. switch(getState()){
  7587. case TOFOUNTAIN:
  7588. runcheck();
  7589. onToFountain();
  7590. if(fountainRange.contains(players.getMyPlayer().getLocation())){
  7591. fillVials();
  7592. }
  7593. break;
  7594.  
  7595. case TOGLITCH:
  7596. runcheck();
  7597. onToGlitch();
  7598. break;
  7599.  
  7600. case TOBANK:
  7601. runcheck();
  7602. onToBank();
  7603. if(bankRange.contains(players.getMyPlayer().getLocation())){
  7604. doBank();
  7605. }
  7606. break;
  7607. }
  7608. return(random(500, 1000));
  7609. }
  7610.  
  7611. private State getState() {
  7612. if (!inventory.contains(emptyVialID)) {
  7613. return State.TOBANK;
  7614. }
  7615. else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
  7616. return State.TOGLITCH;
  7617. }
  7618. else{
  7619. return State.TOFOUNTAIN;
  7620. }
  7621. }
  7622.  
  7623. // GUI and Mouse
  7624. public void onRepaint(Graphics g1) {
  7625. profit = numFilled * profitPrice;
  7626. if(!save){
  7627. millis = System.currentTimeMillis() - startTime;
  7628. hours = millis / (1000 * 60 * 60);
  7629. millis -= hours * (1000 * 60 * 60);
  7630. minutes = millis / (1000 * 60);
  7631. millis -= minutes * (1000 * 60);
  7632. seconds = millis / 1000;
  7633.  
  7634. if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
  7635. profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
  7636. }
  7637. profHour = profSec * 3600;
  7638. hourlyProfit = profHour * profitPrice;
  7639. hourlyProfitInt = Math.round(hourlyProfit);
  7640. }
  7641. else{
  7642. millis = 0;
  7643. hours = 0;
  7644. minutes = 0;
  7645. seconds = 0;
  7646. hourlyProfitInt = 9001;
  7647. }
  7648.  
  7649. Graphics2D g = (Graphics2D)g1;
  7650. g.setColor(color1);
  7651. g.fillRect(7, 345, 488, 70);
  7652. g.setStroke(stroke1);
  7653. g.drawRect(7, 345, 488, 70);
  7654. g.setFont(font1);
  7655. g.setColor(color2);
  7656. g.drawString("Status:", 14, 362);
  7657. g.setFont(font2);
  7658. g.drawString(status, 59, 362);
  7659. g.setFont(font1);
  7660. g.drawString("Filled Vials In Bank:", 209, 362);
  7661. g.setFont(font2);
  7662. g.drawString(Integer.toString(numFilled), 328, 362);
  7663. g.setFont(font1);
  7664. g.drawString("Profit:", 14, 383);
  7665. g.setFont(font2);
  7666. g.drawString(Integer.toString(profit), 59, 383);
  7667. g.setFont(font1);
  7668. g.drawString("Profit/hr:", 137, 383);
  7669. g.setFont(font2);
  7670. if(!save){
  7671. g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
  7672. }
  7673. else{
  7674. g.drawString("Mem Save", 190, 383);
  7675. }
  7676. g.setFont(font1);
  7677. g.drawString("Runtime:", 270, 383);
  7678. g.setFont(font2);
  7679. if(!save){
  7680. g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
  7681. }
  7682. else{
  7683. g.drawString("Mem Save", 325, 384);
  7684. }
  7685. g.setFont(font1);
  7686. g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
  7687. g.drawString("Running:", 710, 139);
  7688. g.setFont(font2);
  7689. g.drawString(isRunning, 722, 156);
  7690. g.setFont(font3);
  7691. g.drawString("Painlaws", 440, 357);
  7692.  
  7693. g1.setColor(Color.green);
  7694. g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
  7695. g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
  7696. }
  7697.  
  7698. /* Antiban stuff
  7699. * Some credits to Aaimister :)
  7700. * Partially copied, with permission
  7701. */
  7702.  
  7703. public void rotateCamera() {
  7704. final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  7705. final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  7706. final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  7707. KeyEvent.VK_UP, KeyEvent.VK_UP };
  7708. final int randomLR = random(0, 2);
  7709. final int randomUD = random(0, 2);
  7710. final int randomAll = random(0, 4);
  7711. if (random(0, 3) == 0) {
  7712. keyboard.pressKey(LR[randomLR]);
  7713. sleepCR(random(2, 9));
  7714. keyboard.pressKey(UD[randomUD]);
  7715. sleepCR(random(6, 10));
  7716. keyboard.releaseKey(UD[randomUD]);
  7717. sleepCR(random(2, 7));
  7718. keyboard.releaseKey(LR[randomLR]);
  7719. } else {
  7720. keyboard.pressKey(LRUD[randomAll]);
  7721. if (randomAll > 1) {
  7722. sleepCR(random(6, 11));
  7723. } else {
  7724. sleepCR(random(9, 12));
  7725. }
  7726. keyboard.releaseKey(LRUD[randomAll]);
  7727. }
  7728. }
  7729.  
  7730. private boolean sleepCR(final int amtOfHalfSecs) {
  7731. for (int x = 0; x < amtOfHalfSecs + 1; x++) {
  7732. sleep(random(48, 53));
  7733. }
  7734. return true;
  7735. }
  7736.  
  7737. private void antiban(){
  7738. int action = random(0, 5);
  7739.  
  7740. switch (action) {
  7741. case 0:
  7742. status = "Antiban";
  7743. rotateCamera();
  7744. sleep(200, 400);
  7745. break;
  7746. case 1:
  7747. status = "Antiban";
  7748. mouse.moveRandomly(100, 900);
  7749. sleep(200, 400);
  7750. break;
  7751. case 2:
  7752. status = "Antiban";
  7753. mouse.moveSlightly();
  7754. sleep(200, 400);
  7755. break;
  7756. case 3:
  7757. status = "Antiban";
  7758. camera.moveRandomly(random(750,1250));
  7759. sleep(200, 400);
  7760. break;
  7761. case 4:
  7762. status = "Antiban";
  7763. checkEXP();
  7764. sleep(200, 400);
  7765. break;
  7766. case 5:
  7767. status = "Antiban";
  7768. mouse.moveOffScreen();
  7769. sleep(200, 400);
  7770. break;
  7771. }
  7772. }
  7773.  
  7774. public void checkEXP() {
  7775. game.openTab(Game.Tab.STATS);
  7776. skills.doHover(Skills.INTERFACE_PRAYER);
  7777. sleep(random(2100, 3400));
  7778. game.openTab(Game.Tab.INVENTORY);
  7779. sleep(random(540,760));
  7780. }
  7781.  
  7782.  
  7783. class gui extends JFrame {
  7784. /**
  7785. *
  7786. */
  7787. private static final long serialVersionUID = 1L;
  7788. public gui() {
  7789. initComponents();
  7790. }
  7791.  
  7792. private void startButtonActionPerformed(ActionEvent e){
  7793. String mode = selectionBox.getSelectedItem().toString();
  7794. if(mode.equals("Maximum")){
  7795. antiban = false;
  7796. minSpeed = 5;
  7797. maxSpeed = 6;
  7798. }
  7799. else if(mode.equals("Paranoid")){
  7800. antiban = true;
  7801. minSpeed = 8;
  7802. maxSpeed = 10;
  7803. min = 3;
  7804. max = 3;
  7805.  
  7806. }
  7807. save = memoryMode.isSelected();
  7808. guiWait = false;
  7809. g.dispose();
  7810. }
  7811.  
  7812. private void initComponents() {
  7813. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  7814. label1 = new JLabel();
  7815. selectionBox = new JComboBox();
  7816. memoryMode = new JCheckBox();
  7817. label2 = new JLabel();
  7818. label3 = new JLabel();
  7819. label4 = new JLabel();
  7820. label5 = new JLabel();
  7821. startButton = new JButton();
  7822.  
  7823. //======== this ========
  7824. setTitle("Painlaws's Vial Filler");
  7825. setResizable(false);
  7826. Container contentPane = getContentPane();
  7827.  
  7828. //---- label1 ----
  7829. label1.setText("Mode");
  7830.  
  7831. //---- selectionBox ----
  7832. selectionBox.setModel(new DefaultComboBoxModel(new String[] {
  7833. "Normal",
  7834. "Paranoid",
  7835. "Maximum"
  7836. }));
  7837.  
  7838. //---- memoryMode ----
  7839. memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
  7840.  
  7841. //---- label2 ----
  7842. label2.setText("Modes:");
  7843.  
  7844. //---- label3 ----
  7845. label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
  7846.  
  7847. //---- label4 ----
  7848. label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
  7849.  
  7850. //---- label5 ----
  7851. label5.setText("Maximum - No Antiban, Fast Mouse Speed");
  7852.  
  7853. //---- startButton ----
  7854. startButton.setText("Let's Fill Some Vials!");
  7855. startButton.addActionListener(new ActionListener() {
  7856. public void actionPerformed(ActionEvent e){
  7857. startButtonActionPerformed(e);
  7858. }
  7859. });
  7860.  
  7861. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  7862. contentPane.setLayout(contentPaneLayout);
  7863. contentPaneLayout.setHorizontalGroup(
  7864. contentPaneLayout.createParallelGroup()
  7865. .addGroup(contentPaneLayout.createSequentialGroup()
  7866. .addGroup(contentPaneLayout.createParallelGroup()
  7867. .addGroup(contentPaneLayout.createSequentialGroup()
  7868. .addContainerGap()
  7869. .addGroup(contentPaneLayout.createParallelGroup()
  7870. .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  7871. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  7872. .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  7873. .addGroup(contentPaneLayout.createSequentialGroup()
  7874. .addComponent(label1)
  7875. .addGap(18, 18, 18)
  7876. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  7877. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  7878. .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  7879. .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  7880. .addGroup(contentPaneLayout.createSequentialGroup()
  7881. .addGap(148, 148, 148)
  7882. .addComponent(startButton)))
  7883. .addContainerGap(2, Short.MAX_VALUE))
  7884. );
  7885. contentPaneLayout.setVerticalGroup(
  7886. contentPaneLayout.createParallelGroup()
  7887. .addGroup(contentPaneLayout.createSequentialGroup()
  7888. .addContainerGap()
  7889. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  7890. .addComponent(label1)
  7891. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  7892. .addGap(18, 18, 18)
  7893. .addComponent(memoryMode)
  7894. .addGap(18, 18, 18)
  7895. .addComponent(label2)
  7896. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  7897. .addComponent(label3)
  7898. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  7899. .addComponent(label4)
  7900. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  7901. .addComponent(label5)
  7902. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
  7903. .addComponent(startButton)
  7904. .addContainerGap())
  7905. );
  7906. pack();
  7907. setLocationRelativeTo(getOwner());
  7908. // JFormDesigner - End of component initialization //GEN-END:initComponents
  7909. }
  7910.  
  7911. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  7912. private JLabel label1;
  7913. private JComboBox selectionBox;
  7914. private JCheckBox memoryMode;
  7915. private JLabel label2;
  7916. private JLabel label3;
  7917. private JLabel label4;
  7918. private JLabel label5;
  7919. private JButton startButton;
  7920. // JFormDesigner - End of variables declaration //GEN-END:variables
  7921. }
  7922.  
  7923.  
  7924. }
  7925. import java.awt.*;
  7926. import java.awt.event.*;
  7927. import javax.swing.*;
  7928. import java.awt.event.KeyEvent;
  7929. import org.rsbot.event.listeners.PaintListener;
  7930. import org.rsbot.script.Script;
  7931. import org.rsbot.script.ScriptManifest;
  7932. import org.rsbot.script.methods.*;
  7933. import org.rsbot.script.wrappers.*;
  7934.  
  7935. @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
  7936. public class vialfiller extends Script implements PaintListener{
  7937. //Variables
  7938. // - Essentials
  7939. private int bankerID = 6533;
  7940. private int fountainID = 24214;
  7941. private int emptyVialID = 229;
  7942. private int fullVialID = 227;
  7943. private int runEnergy = 50;
  7944. RSNPC banker;
  7945. RSObject fountain;
  7946. RSItem myVial;
  7947. RSTile theBank = new RSTile(3167, 3489);
  7948. RSTile theFountain = new RSTile(3191, 3471);
  7949. RSTile glitchSpot = new RSTile(3192, 3487);
  7950. RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
  7951. RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
  7952. RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
  7953. RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
  7954.  
  7955. // - GUI Options
  7956. private int min = 1;
  7957. private int max = 6;
  7958. private int minSpeed = 6;
  7959. private int maxSpeed = 9;
  7960. private boolean guiWait = true;
  7961. private boolean save = false;
  7962.  
  7963. // - State check
  7964. private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
  7965.  
  7966. // - Paint stuff
  7967. private String status = "Initializing...";
  7968. private String isRunning = "";
  7969. private int numFilled = 0;
  7970. private int vialFilledPrice;
  7971. private int vialEmptyPrice;
  7972. private int profitPrice;
  7973. private int profit;
  7974. private long startTime;
  7975. private long millis;
  7976. private long hours;
  7977. private long minutes;
  7978. private long seconds;
  7979. private float profSec = 0;
  7980. private float profHour;
  7981. private float hourlyProfit;
  7982. private int hourlyProfitInt;
  7983. private final Color color1 = new Color(0, 0, 0);
  7984. private final Color color2 = new Color(255, 255, 255);
  7985. private final BasicStroke stroke1 = new BasicStroke(1);
  7986. private final Font font1 = new Font("Arial", 0, 13);
  7987. private final Font font2 = new Font("Arial", 1, 13);
  7988. private final Font font3 = new Font("Vijaya", 1, 17);
  7989. private boolean antiban = true;
  7990. gui g = new gui();
  7991.  
  7992. @Override
  7993. public boolean onStart(){
  7994. log("Welcome to Painlaws's Vial Filler");
  7995. log("Waiting on GUI...");
  7996. g.setVisible(true);
  7997. while(guiWait){
  7998. sleep(500);
  7999. }
  8000. log("GUI Settings loaded!");
  8001. if(walking.isRunEnabled()){
  8002. isRunning = "Yes";
  8003. }
  8004. else{
  8005. isRunning = "No";
  8006. }
  8007. vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
  8008. vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
  8009. profitPrice = vialFilledPrice - vialEmptyPrice;
  8010. if(!save){
  8011. startTime = System.currentTimeMillis();
  8012. }
  8013. else{
  8014. startTime = 0;
  8015. }
  8016. return true;
  8017. }
  8018.  
  8019. @Override
  8020. public void onFinish(){
  8021. env.saveScreenshot(true);
  8022. log("^ Don't forget to upload this proggie :P");
  8023. log("Bye! PM Painlaws for comments/questions/requests");
  8024. }
  8025.  
  8026. public void useItem(RSItem item, RSObject object){
  8027. if(item != null && object != null && object.isOnScreen()){
  8028. item.doClick(true);
  8029. sleep(200, 300);
  8030. object.doClick();
  8031. }
  8032. }
  8033.  
  8034. public void fillVials(){
  8035. if(fountain != null){
  8036. status = "Filling Vials";
  8037. useItem(myVial, fountain);
  8038. while(inventory.contains(emptyVialID)){
  8039. sleep(random(1000,1500));
  8040. if(antiban){
  8041. if(random(1, 3) == 2){
  8042. mouse.moveSlightly();
  8043. }
  8044. }
  8045. }
  8046. status = "Vials filled";
  8047. }
  8048. else{
  8049. status = "Fountain is null...retrying";
  8050. sleep(random(600, 800));
  8051. }
  8052. }
  8053.  
  8054. private void doBank(){
  8055. try{
  8056. if(banker != null){
  8057. camera.turnTo(banker);
  8058. if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
  8059. status = "Opening Bank";
  8060. banker.interact("Bank Banker");
  8061. status = "Bank opened";
  8062. sleep(random(900, 1050));
  8063. status = "Depositing All";
  8064. bank.depositAll();
  8065. status = "Deposited All";
  8066. sleep(random(780, 950));
  8067. numFilled = bank.getCount(fullVialID);
  8068. if(bank.getCount(emptyVialID) != 0){
  8069. status = "Taking Vials";
  8070. bank.withdraw(emptyVialID, 0);
  8071. status = "Vials Taken";
  8072. sleep(random(700, 960));
  8073. }
  8074. else{
  8075. log("Out of vials. Quitting :/");
  8076. bank.close();
  8077. env.saveScreenshot(true);
  8078. log("^ Don't forget to upload this proggie :P");
  8079. log("Bye! PM Painlaws for comments/questions/requests");
  8080. stopScript(true);
  8081. }
  8082. status = "Closing Bank";
  8083. bank.close();
  8084. status = "Bank Closed";
  8085. sleep(random(750, 910));
  8086. }
  8087. }
  8088. sleep(random(300,500));
  8089. }catch(Exception e){log(e);}
  8090. }
  8091.  
  8092. public void onToBank(){
  8093. try{
  8094. status = "Going to Bank";
  8095. walking.walkTileMM(theBank);
  8096. }catch(Exception e){log(e);}
  8097. sleep(random(500, 700));
  8098. }
  8099.  
  8100. public void onToGlitch(){
  8101. try{
  8102. status = "Going to Fountain"; //What you don't know can't hurt you :P
  8103. walking.walkTileMM(glitchSpot);
  8104. }catch(Exception e){log(e);}
  8105. sleep(random(500, 710));
  8106. }
  8107.  
  8108. public void onToFountain(){
  8109. try{
  8110. status = "Going to Fountain";
  8111. walking.walkTileMM(theFountain);
  8112. }catch(Exception e){log(e);}
  8113. sleep(random(500, 705));
  8114. }
  8115.  
  8116. public void runcheck() {
  8117. try{
  8118. runEnergy = (random(50, 70));
  8119. if (walking.isRunEnabled()){
  8120. isRunning = "Yes";
  8121. }
  8122. else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
  8123. walking.setRun(true);
  8124. isRunning = "Yes";
  8125. sleep(random(300, 500));
  8126. }
  8127. else{
  8128. isRunning = "No";
  8129. sleep(random(300,500));
  8130. }
  8131. }catch(Exception ex){}
  8132. }
  8133.  
  8134. @Override
  8135. public int loop(){
  8136. mouse.setSpeed(random(minSpeed, maxSpeed));
  8137. runcheck();
  8138. if(antiban){
  8139. if(random(min, max) == 3){
  8140. antiban();
  8141. }
  8142. }
  8143. if(objects.getNearest(fountainID) != null){
  8144. fountain = objects.getNearest(fountainID);
  8145. }
  8146. if(npcs.getNearest(bankerID) != null){
  8147. banker = npcs.getNearest(bankerID);
  8148. }
  8149. if(inventory.getItem(emptyVialID) != null){
  8150. myVial = inventory.getItem(emptyVialID);
  8151. }
  8152. switch(getState()){
  8153. case TOFOUNTAIN:
  8154. runcheck();
  8155. onToFountain();
  8156. if(fountainRange.contains(players.getMyPlayer().getLocation())){
  8157. fillVials();
  8158. }
  8159. break;
  8160.  
  8161. case TOGLITCH:
  8162. runcheck();
  8163. onToGlitch();
  8164. break;
  8165.  
  8166. case TOBANK:
  8167. runcheck();
  8168. onToBank();
  8169. if(bankRange.contains(players.getMyPlayer().getLocation())){
  8170. doBank();
  8171. }
  8172. break;
  8173. }
  8174. return(random(500, 1000));
  8175. }
  8176.  
  8177. private State getState() {
  8178. if (!inventory.contains(emptyVialID)) {
  8179. return State.TOBANK;
  8180. }
  8181. else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
  8182. return State.TOGLITCH;
  8183. }
  8184. else{
  8185. return State.TOFOUNTAIN;
  8186. }
  8187. }
  8188.  
  8189. // GUI and Mouse
  8190. public void onRepaint(Graphics g1) {
  8191. profit = numFilled * profitPrice;
  8192. if(!save){
  8193. millis = System.currentTimeMillis() - startTime;
  8194. hours = millis / (1000 * 60 * 60);
  8195. millis -= hours * (1000 * 60 * 60);
  8196. minutes = millis / (1000 * 60);
  8197. millis -= minutes * (1000 * 60);
  8198. seconds = millis / 1000;
  8199.  
  8200. if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
  8201. profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
  8202. }
  8203. profHour = profSec * 3600;
  8204. hourlyProfit = profHour * profitPrice;
  8205. hourlyProfitInt = Math.round(hourlyProfit);
  8206. }
  8207. else{
  8208. millis = 0;
  8209. hours = 0;
  8210. minutes = 0;
  8211. seconds = 0;
  8212. hourlyProfitInt = 9001;
  8213. }
  8214.  
  8215. Graphics2D g = (Graphics2D)g1;
  8216. g.setColor(color1);
  8217. g.fillRect(7, 345, 488, 70);
  8218. g.setStroke(stroke1);
  8219. g.drawRect(7, 345, 488, 70);
  8220. g.setFont(font1);
  8221. g.setColor(color2);
  8222. g.drawString("Status:", 14, 362);
  8223. g.setFont(font2);
  8224. g.drawString(status, 59, 362);
  8225. g.setFont(font1);
  8226. g.drawString("Filled Vials In Bank:", 209, 362);
  8227. g.setFont(font2);
  8228. g.drawString(Integer.toString(numFilled), 328, 362);
  8229. g.setFont(font1);
  8230. g.drawString("Profit:", 14, 383);
  8231. g.setFont(font2);
  8232. g.drawString(Integer.toString(profit), 59, 383);
  8233. g.setFont(font1);
  8234. g.drawString("Profit/hr:", 137, 383);
  8235. g.setFont(font2);
  8236. if(!save){
  8237. g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
  8238. }
  8239. else{
  8240. g.drawString("Mem Save", 190, 383);
  8241. }
  8242. g.setFont(font1);
  8243. g.drawString("Runtime:", 270, 383);
  8244. g.setFont(font2);
  8245. if(!save){
  8246. g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
  8247. }
  8248. else{
  8249. g.drawString("Mem Save", 325, 384);
  8250. }
  8251. g.setFont(font1);
  8252. g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
  8253. g.drawString("Running:", 710, 139);
  8254. g.setFont(font2);
  8255. g.drawString(isRunning, 722, 156);
  8256. g.setFont(font3);
  8257. g.drawString("Painlaws", 440, 357);
  8258.  
  8259. g1.setColor(Color.green);
  8260. g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
  8261. g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
  8262. }
  8263.  
  8264. /* Antiban stuff
  8265. * Some credits to Aaimister :)
  8266. * Partially copied, with permission
  8267. */
  8268.  
  8269. public void rotateCamera() {
  8270. final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  8271. final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  8272. final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  8273. KeyEvent.VK_UP, KeyEvent.VK_UP };
  8274. final int randomLR = random(0, 2);
  8275. final int randomUD = random(0, 2);
  8276. final int randomAll = random(0, 4);
  8277. if (random(0, 3) == 0) {
  8278. keyboard.pressKey(LR[randomLR]);
  8279. sleepCR(random(2, 9));
  8280. keyboard.pressKey(UD[randomUD]);
  8281. sleepCR(random(6, 10));
  8282. keyboard.releaseKey(UD[randomUD]);
  8283. sleepCR(random(2, 7));
  8284. keyboard.releaseKey(LR[randomLR]);
  8285. } else {
  8286. keyboard.pressKey(LRUD[randomAll]);
  8287. if (randomAll > 1) {
  8288. sleepCR(random(6, 11));
  8289. } else {
  8290. sleepCR(random(9, 12));
  8291. }
  8292. keyboard.releaseKey(LRUD[randomAll]);
  8293. }
  8294. }
  8295.  
  8296. private boolean sleepCR(final int amtOfHalfSecs) {
  8297. for (int x = 0; x < amtOfHalfSecs + 1; x++) {
  8298. sleep(random(48, 53));
  8299. }
  8300. return true;
  8301. }
  8302.  
  8303. private void antiban(){
  8304. int action = random(0, 5);
  8305.  
  8306. switch (action) {
  8307. case 0:
  8308. status = "Antiban";
  8309. rotateCamera();
  8310. sleep(200, 400);
  8311. break;
  8312. case 1:
  8313. status = "Antiban";
  8314. mouse.moveRandomly(100, 900);
  8315. sleep(200, 400);
  8316. break;
  8317. case 2:
  8318. status = "Antiban";
  8319. mouse.moveSlightly();
  8320. sleep(200, 400);
  8321. break;
  8322. case 3:
  8323. status = "Antiban";
  8324. camera.moveRandomly(random(750,1250));
  8325. sleep(200, 400);
  8326. break;
  8327. case 4:
  8328. status = "Antiban";
  8329. checkEXP();
  8330. sleep(200, 400);
  8331. break;
  8332. case 5:
  8333. status = "Antiban";
  8334. mouse.moveOffScreen();
  8335. sleep(200, 400);
  8336. break;
  8337. }
  8338. }
  8339.  
  8340. public void checkEXP() {
  8341. game.openTab(Game.Tab.STATS);
  8342. skills.doHover(Skills.INTERFACE_PRAYER);
  8343. sleep(random(2100, 3400));
  8344. game.openTab(Game.Tab.INVENTORY);
  8345. sleep(random(540,760));
  8346. }
  8347.  
  8348.  
  8349. class gui extends JFrame {
  8350. /**
  8351. *
  8352. */
  8353. private static final long serialVersionUID = 1L;
  8354. public gui() {
  8355. initComponents();
  8356. }
  8357.  
  8358. private void startButtonActionPerformed(ActionEvent e){
  8359. String mode = selectionBox.getSelectedItem().toString();
  8360. if(mode.equals("Maximum")){
  8361. antiban = false;
  8362. minSpeed = 5;
  8363. maxSpeed = 6;
  8364. }
  8365. else if(mode.equals("Paranoid")){
  8366. antiban = true;
  8367. minSpeed = 8;
  8368. maxSpeed = 10;
  8369. min = 3;
  8370. max = 3;
  8371.  
  8372. }
  8373. save = memoryMode.isSelected();
  8374. guiWait = false;
  8375. g.dispose();
  8376. }
  8377.  
  8378. private void initComponents() {
  8379. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  8380. label1 = new JLabel();
  8381. selectionBox = new JComboBox();
  8382. memoryMode = new JCheckBox();
  8383. label2 = new JLabel();
  8384. label3 = new JLabel();
  8385. label4 = new JLabel();
  8386. label5 = new JLabel();
  8387. startButton = new JButton();
  8388.  
  8389. //======== this ========
  8390. setTitle("Painlaws's Vial Filler");
  8391. setResizable(false);
  8392. Container contentPane = getContentPane();
  8393.  
  8394. //---- label1 ----
  8395. label1.setText("Mode");
  8396.  
  8397. //---- selectionBox ----
  8398. selectionBox.setModel(new DefaultComboBoxModel(new String[] {
  8399. "Normal",
  8400. "Paranoid",
  8401. "Maximum"
  8402. }));
  8403.  
  8404. //---- memoryMode ----
  8405. memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
  8406.  
  8407. //---- label2 ----
  8408. label2.setText("Modes:");
  8409.  
  8410. //---- label3 ----
  8411. label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
  8412.  
  8413. //---- label4 ----
  8414. label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
  8415.  
  8416. //---- label5 ----
  8417. label5.setText("Maximum - No Antiban, Fast Mouse Speed");
  8418.  
  8419. //---- startButton ----
  8420. startButton.setText("Let's Fill Some Vials!");
  8421. startButton.addActionListener(new ActionListener() {
  8422. public void actionPerformed(ActionEvent e){
  8423. startButtonActionPerformed(e);
  8424. }
  8425. });
  8426.  
  8427. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  8428. contentPane.setLayout(contentPaneLayout);
  8429. contentPaneLayout.setHorizontalGroup(
  8430. contentPaneLayout.createParallelGroup()
  8431. .addGroup(contentPaneLayout.createSequentialGroup()
  8432. .addGroup(contentPaneLayout.createParallelGroup()
  8433. .addGroup(contentPaneLayout.createSequentialGroup()
  8434. .addContainerGap()
  8435. .addGroup(contentPaneLayout.createParallelGroup()
  8436. .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  8437. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  8438. .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  8439. .addGroup(contentPaneLayout.createSequentialGroup()
  8440. .addComponent(label1)
  8441. .addGap(18, 18, 18)
  8442. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  8443. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  8444. .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  8445. .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  8446. .addGroup(contentPaneLayout.createSequentialGroup()
  8447. .addGap(148, 148, 148)
  8448. .addComponent(startButton)))
  8449. .addContainerGap(2, Short.MAX_VALUE))
  8450. );
  8451. contentPaneLayout.setVerticalGroup(
  8452. contentPaneLayout.createParallelGroup()
  8453. .addGroup(contentPaneLayout.createSequentialGroup()
  8454. .addContainerGap()
  8455. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  8456. .addComponent(label1)
  8457. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  8458. .addGap(18, 18, 18)
  8459. .addComponent(memoryMode)
  8460. .addGap(18, 18, 18)
  8461. .addComponent(label2)
  8462. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  8463. .addComponent(label3)
  8464. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  8465. .addComponent(label4)
  8466. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  8467. .addComponent(label5)
  8468. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
  8469. .addComponent(startButton)
  8470. .addContainerGap())
  8471. );
  8472. pack();
  8473. setLocationRelativeTo(getOwner());
  8474. // JFormDesigner - End of component initialization //GEN-END:initComponents
  8475. }
  8476.  
  8477. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  8478. private JLabel label1;
  8479. private JComboBox selectionBox;
  8480. private JCheckBox memoryMode;
  8481. private JLabel label2;
  8482. private JLabel label3;
  8483. private JLabel label4;
  8484. private JLabel label5;
  8485. private JButton startButton;
  8486. // JFormDesigner - End of variables declaration //GEN-END:variables
  8487. }
  8488.  
  8489.  
  8490. }
  8491. import java.awt.*;
  8492. import java.awt.event.*;
  8493. import javax.swing.*;
  8494. import java.awt.event.KeyEvent;
  8495. import org.rsbot.event.listeners.PaintListener;
  8496. import org.rsbot.script.Script;
  8497. import org.rsbot.script.ScriptManifest;
  8498. import org.rsbot.script.methods.*;
  8499. import org.rsbot.script.wrappers.*;
  8500.  
  8501. @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
  8502. public class vialfiller extends Script implements PaintListener{
  8503. //Variables
  8504. // - Essentials
  8505. private int bankerID = 6533;
  8506. private int fountainID = 24214;
  8507. private int emptyVialID = 229;
  8508. private int fullVialID = 227;
  8509. private int runEnergy = 50;
  8510. RSNPC banker;
  8511. RSObject fountain;
  8512. RSItem myVial;
  8513. RSTile theBank = new RSTile(3167, 3489);
  8514. RSTile theFountain = new RSTile(3191, 3471);
  8515. RSTile glitchSpot = new RSTile(3192, 3487);
  8516. RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
  8517. RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
  8518. RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
  8519. RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
  8520.  
  8521. // - GUI Options
  8522. private int min = 1;
  8523. private int max = 6;
  8524. private int minSpeed = 6;
  8525. private int maxSpeed = 9;
  8526. private boolean guiWait = true;
  8527. private boolean save = false;
  8528.  
  8529. // - State check
  8530. private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
  8531.  
  8532. // - Paint stuff
  8533. private String status = "Initializing...";
  8534. private String isRunning = "";
  8535. private int numFilled = 0;
  8536. private int vialFilledPrice;
  8537. private int vialEmptyPrice;
  8538. private int profitPrice;
  8539. private int profit;
  8540. private long startTime;
  8541. private long millis;
  8542. private long hours;
  8543. private long minutes;
  8544. private long seconds;
  8545. private float profSec = 0;
  8546. private float profHour;
  8547. private float hourlyProfit;
  8548. private int hourlyProfitInt;
  8549. private final Color color1 = new Color(0, 0, 0);
  8550. private final Color color2 = new Color(255, 255, 255);
  8551. private final BasicStroke stroke1 = new BasicStroke(1);
  8552. private final Font font1 = new Font("Arial", 0, 13);
  8553. private final Font font2 = new Font("Arial", 1, 13);
  8554. private final Font font3 = new Font("Vijaya", 1, 17);
  8555. private boolean antiban = true;
  8556. gui g = new gui();
  8557.  
  8558. @Override
  8559. public boolean onStart(){
  8560. log("Welcome to Painlaws's Vial Filler");
  8561. log("Waiting on GUI...");
  8562. g.setVisible(true);
  8563. while(guiWait){
  8564. sleep(500);
  8565. }
  8566. log("GUI Settings loaded!");
  8567. if(walking.isRunEnabled()){
  8568. isRunning = "Yes";
  8569. }
  8570. else{
  8571. isRunning = "No";
  8572. }
  8573. vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
  8574. vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
  8575. profitPrice = vialFilledPrice - vialEmptyPrice;
  8576. if(!save){
  8577. startTime = System.currentTimeMillis();
  8578. }
  8579. else{
  8580. startTime = 0;
  8581. }
  8582. return true;
  8583. }
  8584.  
  8585. @Override
  8586. public void onFinish(){
  8587. env.saveScreenshot(true);
  8588. log("^ Don't forget to upload this proggie :P");
  8589. log("Bye! PM Painlaws for comments/questions/requests");
  8590. }
  8591.  
  8592. public void useItem(RSItem item, RSObject object){
  8593. if(item != null && object != null && object.isOnScreen()){
  8594. item.doClick(true);
  8595. sleep(200, 300);
  8596. object.doClick();
  8597. }
  8598. }
  8599.  
  8600. public void fillVials(){
  8601. if(fountain != null){
  8602. status = "Filling Vials";
  8603. useItem(myVial, fountain);
  8604. while(inventory.contains(emptyVialID)){
  8605. sleep(random(1000,1500));
  8606. if(antiban){
  8607. if(random(1, 3) == 2){
  8608. mouse.moveSlightly();
  8609. }
  8610. }
  8611. }
  8612. status = "Vials filled";
  8613. }
  8614. else{
  8615. status = "Fountain is null...retrying";
  8616. sleep(random(600, 800));
  8617. }
  8618. }
  8619.  
  8620. private void doBank(){
  8621. try{
  8622. if(banker != null){
  8623. camera.turnTo(banker);
  8624. if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
  8625. status = "Opening Bank";
  8626. banker.interact("Bank Banker");
  8627. status = "Bank opened";
  8628. sleep(random(900, 1050));
  8629. status = "Depositing All";
  8630. bank.depositAll();
  8631. status = "Deposited All";
  8632. sleep(random(780, 950));
  8633. numFilled = bank.getCount(fullVialID);
  8634. if(bank.getCount(emptyVialID) != 0){
  8635. status = "Taking Vials";
  8636. bank.withdraw(emptyVialID, 0);
  8637. status = "Vials Taken";
  8638. sleep(random(700, 960));
  8639. }
  8640. else{
  8641. log("Out of vials. Quitting :/");
  8642. bank.close();
  8643. env.saveScreenshot(true);
  8644. log("^ Don't forget to upload this proggie :P");
  8645. log("Bye! PM Painlaws for comments/questions/requests");
  8646. stopScript(true);
  8647. }
  8648. status = "Closing Bank";
  8649. bank.close();
  8650. status = "Bank Closed";
  8651. sleep(random(750, 910));
  8652. }
  8653. }
  8654. sleep(random(300,500));
  8655. }catch(Exception e){log(e);}
  8656. }
  8657.  
  8658. public void onToBank(){
  8659. try{
  8660. status = "Going to Bank";
  8661. walking.walkTileMM(theBank);
  8662. }catch(Exception e){log(e);}
  8663. sleep(random(500, 700));
  8664. }
  8665.  
  8666. public void onToGlitch(){
  8667. try{
  8668. status = "Going to Fountain"; //What you don't know can't hurt you :P
  8669. walking.walkTileMM(glitchSpot);
  8670. }catch(Exception e){log(e);}
  8671. sleep(random(500, 710));
  8672. }
  8673.  
  8674. public void onToFountain(){
  8675. try{
  8676. status = "Going to Fountain";
  8677. walking.walkTileMM(theFountain);
  8678. }catch(Exception e){log(e);}
  8679. sleep(random(500, 705));
  8680. }
  8681.  
  8682. public void runcheck() {
  8683. try{
  8684. runEnergy = (random(50, 70));
  8685. if (walking.isRunEnabled()){
  8686. isRunning = "Yes";
  8687. }
  8688. else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
  8689. walking.setRun(true);
  8690. isRunning = "Yes";
  8691. sleep(random(300, 500));
  8692. }
  8693. else{
  8694. isRunning = "No";
  8695. sleep(random(300,500));
  8696. }
  8697. }catch(Exception ex){}
  8698. }
  8699.  
  8700. @Override
  8701. public int loop(){
  8702. mouse.setSpeed(random(minSpeed, maxSpeed));
  8703. runcheck();
  8704. if(antiban){
  8705. if(random(min, max) == 3){
  8706. antiban();
  8707. }
  8708. }
  8709. if(objects.getNearest(fountainID) != null){
  8710. fountain = objects.getNearest(fountainID);
  8711. }
  8712. if(npcs.getNearest(bankerID) != null){
  8713. banker = npcs.getNearest(bankerID);
  8714. }
  8715. if(inventory.getItem(emptyVialID) != null){
  8716. myVial = inventory.getItem(emptyVialID);
  8717. }
  8718. switch(getState()){
  8719. case TOFOUNTAIN:
  8720. runcheck();
  8721. onToFountain();
  8722. if(fountainRange.contains(players.getMyPlayer().getLocation())){
  8723. fillVials();
  8724. }
  8725. break;
  8726.  
  8727. case TOGLITCH:
  8728. runcheck();
  8729. onToGlitch();
  8730. break;
  8731.  
  8732. case TOBANK:
  8733. runcheck();
  8734. onToBank();
  8735. if(bankRange.contains(players.getMyPlayer().getLocation())){
  8736. doBank();
  8737. }
  8738. break;
  8739. }
  8740. return(random(500, 1000));
  8741. }
  8742.  
  8743. private State getState() {
  8744. if (!inventory.contains(emptyVialID)) {
  8745. return State.TOBANK;
  8746. }
  8747. else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
  8748. return State.TOGLITCH;
  8749. }
  8750. else{
  8751. return State.TOFOUNTAIN;
  8752. }
  8753. }
  8754.  
  8755. // GUI and Mouse
  8756. public void onRepaint(Graphics g1) {
  8757. profit = numFilled * profitPrice;
  8758. if(!save){
  8759. millis = System.currentTimeMillis() - startTime;
  8760. hours = millis / (1000 * 60 * 60);
  8761. millis -= hours * (1000 * 60 * 60);
  8762. minutes = millis / (1000 * 60);
  8763. millis -= minutes * (1000 * 60);
  8764. seconds = millis / 1000;
  8765.  
  8766. if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
  8767. profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
  8768. }
  8769. profHour = profSec * 3600;
  8770. hourlyProfit = profHour * profitPrice;
  8771. hourlyProfitInt = Math.round(hourlyProfit);
  8772. }
  8773. else{
  8774. millis = 0;
  8775. hours = 0;
  8776. minutes = 0;
  8777. seconds = 0;
  8778. hourlyProfitInt = 9001;
  8779. }
  8780.  
  8781. Graphics2D g = (Graphics2D)g1;
  8782. g.setColor(color1);
  8783. g.fillRect(7, 345, 488, 70);
  8784. g.setStroke(stroke1);
  8785. g.drawRect(7, 345, 488, 70);
  8786. g.setFont(font1);
  8787. g.setColor(color2);
  8788. g.drawString("Status:", 14, 362);
  8789. g.setFont(font2);
  8790. g.drawString(status, 59, 362);
  8791. g.setFont(font1);
  8792. g.drawString("Filled Vials In Bank:", 209, 362);
  8793. g.setFont(font2);
  8794. g.drawString(Integer.toString(numFilled), 328, 362);
  8795. g.setFont(font1);
  8796. g.drawString("Profit:", 14, 383);
  8797. g.setFont(font2);
  8798. g.drawString(Integer.toString(profit), 59, 383);
  8799. g.setFont(font1);
  8800. g.drawString("Profit/hr:", 137, 383);
  8801. g.setFont(font2);
  8802. if(!save){
  8803. g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
  8804. }
  8805. else{
  8806. g.drawString("Mem Save", 190, 383);
  8807. }
  8808. g.setFont(font1);
  8809. g.drawString("Runtime:", 270, 383);
  8810. g.setFont(font2);
  8811. if(!save){
  8812. g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
  8813. }
  8814. else{
  8815. g.drawString("Mem Save", 325, 384);
  8816. }
  8817. g.setFont(font1);
  8818. g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
  8819. g.drawString("Running:", 710, 139);
  8820. g.setFont(font2);
  8821. g.drawString(isRunning, 722, 156);
  8822. g.setFont(font3);
  8823. g.drawString("Painlaws", 440, 357);
  8824.  
  8825. g1.setColor(Color.green);
  8826. g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
  8827. g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
  8828. }
  8829.  
  8830. /* Antiban stuff
  8831. * Some credits to Aaimister :)
  8832. * Partially copied, with permission
  8833. */
  8834.  
  8835. public void rotateCamera() {
  8836. final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  8837. final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  8838. final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  8839. KeyEvent.VK_UP, KeyEvent.VK_UP };
  8840. final int randomLR = random(0, 2);
  8841. final int randomUD = random(0, 2);
  8842. final int randomAll = random(0, 4);
  8843. if (random(0, 3) == 0) {
  8844. keyboard.pressKey(LR[randomLR]);
  8845. sleepCR(random(2, 9));
  8846. keyboard.pressKey(UD[randomUD]);
  8847. sleepCR(random(6, 10));
  8848. keyboard.releaseKey(UD[randomUD]);
  8849. sleepCR(random(2, 7));
  8850. keyboard.releaseKey(LR[randomLR]);
  8851. } else {
  8852. keyboard.pressKey(LRUD[randomAll]);
  8853. if (randomAll > 1) {
  8854. sleepCR(random(6, 11));
  8855. } else {
  8856. sleepCR(random(9, 12));
  8857. }
  8858. keyboard.releaseKey(LRUD[randomAll]);
  8859. }
  8860. }
  8861.  
  8862. private boolean sleepCR(final int amtOfHalfSecs) {
  8863. for (int x = 0; x < amtOfHalfSecs + 1; x++) {
  8864. sleep(random(48, 53));
  8865. }
  8866. return true;
  8867. }
  8868.  
  8869. private void antiban(){
  8870. int action = random(0, 5);
  8871.  
  8872. switch (action) {
  8873. case 0:
  8874. status = "Antiban";
  8875. rotateCamera();
  8876. sleep(200, 400);
  8877. break;
  8878. case 1:
  8879. status = "Antiban";
  8880. mouse.moveRandomly(100, 900);
  8881. sleep(200, 400);
  8882. break;
  8883. case 2:
  8884. status = "Antiban";
  8885. mouse.moveSlightly();
  8886. sleep(200, 400);
  8887. break;
  8888. case 3:
  8889. status = "Antiban";
  8890. camera.moveRandomly(random(750,1250));
  8891. sleep(200, 400);
  8892. break;
  8893. case 4:
  8894. status = "Antiban";
  8895. checkEXP();
  8896. sleep(200, 400);
  8897. break;
  8898. case 5:
  8899. status = "Antiban";
  8900. mouse.moveOffScreen();
  8901. sleep(200, 400);
  8902. break;
  8903. }
  8904. }
  8905.  
  8906. public void checkEXP() {
  8907. game.openTab(Game.Tab.STATS);
  8908. skills.doHover(Skills.INTERFACE_PRAYER);
  8909. sleep(random(2100, 3400));
  8910. game.openTab(Game.Tab.INVENTORY);
  8911. sleep(random(540,760));
  8912. }
  8913.  
  8914.  
  8915. class gui extends JFrame {
  8916. /**
  8917. *
  8918. */
  8919. private static final long serialVersionUID = 1L;
  8920. public gui() {
  8921. initComponents();
  8922. }
  8923.  
  8924. private void startButtonActionPerformed(ActionEvent e){
  8925. String mode = selectionBox.getSelectedItem().toString();
  8926. if(mode.equals("Maximum")){
  8927. antiban = false;
  8928. minSpeed = 5;
  8929. maxSpeed = 6;
  8930. }
  8931. else if(mode.equals("Paranoid")){
  8932. antiban = true;
  8933. minSpeed = 8;
  8934. maxSpeed = 10;
  8935. min = 3;
  8936. max = 3;
  8937.  
  8938. }
  8939. save = memoryMode.isSelected();
  8940. guiWait = false;
  8941. g.dispose();
  8942. }
  8943.  
  8944. private void initComponents() {
  8945. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  8946. label1 = new JLabel();
  8947. selectionBox = new JComboBox();
  8948. memoryMode = new JCheckBox();
  8949. label2 = new JLabel();
  8950. label3 = new JLabel();
  8951. label4 = new JLabel();
  8952. label5 = new JLabel();
  8953. startButton = new JButton();
  8954.  
  8955. //======== this ========
  8956. setTitle("Painlaws's Vial Filler");
  8957. setResizable(false);
  8958. Container contentPane = getContentPane();
  8959.  
  8960. //---- label1 ----
  8961. label1.setText("Mode");
  8962.  
  8963. //---- selectionBox ----
  8964. selectionBox.setModel(new DefaultComboBoxModel(new String[] {
  8965. "Normal",
  8966. "Paranoid",
  8967. "Maximum"
  8968. }));
  8969.  
  8970. //---- memoryMode ----
  8971. memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
  8972.  
  8973. //---- label2 ----
  8974. label2.setText("Modes:");
  8975.  
  8976. //---- label3 ----
  8977. label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
  8978.  
  8979. //---- label4 ----
  8980. label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
  8981.  
  8982. //---- label5 ----
  8983. label5.setText("Maximum - No Antiban, Fast Mouse Speed");
  8984.  
  8985. //---- startButton ----
  8986. startButton.setText("Let's Fill Some Vials!");
  8987. startButton.addActionListener(new ActionListener() {
  8988. public void actionPerformed(ActionEvent e){
  8989. startButtonActionPerformed(e);
  8990. }
  8991. });
  8992.  
  8993. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  8994. contentPane.setLayout(contentPaneLayout);
  8995. contentPaneLayout.setHorizontalGroup(
  8996. contentPaneLayout.createParallelGroup()
  8997. .addGroup(contentPaneLayout.createSequentialGroup()
  8998. .addGroup(contentPaneLayout.createParallelGroup()
  8999. .addGroup(contentPaneLayout.createSequentialGroup()
  9000. .addContainerGap()
  9001. .addGroup(contentPaneLayout.createParallelGroup()
  9002. .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  9003. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  9004. .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  9005. .addGroup(contentPaneLayout.createSequentialGroup()
  9006. .addComponent(label1)
  9007. .addGap(18, 18, 18)
  9008. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  9009. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  9010. .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  9011. .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  9012. .addGroup(contentPaneLayout.createSequentialGroup()
  9013. .addGap(148, 148, 148)
  9014. .addComponent(startButton)))
  9015. .addContainerGap(2, Short.MAX_VALUE))
  9016. );
  9017. contentPaneLayout.setVerticalGroup(
  9018. contentPaneLayout.createParallelGroup()
  9019. .addGroup(contentPaneLayout.createSequentialGroup()
  9020. .addContainerGap()
  9021. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  9022. .addComponent(label1)
  9023. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  9024. .addGap(18, 18, 18)
  9025. .addComponent(memoryMode)
  9026. .addGap(18, 18, 18)
  9027. .addComponent(label2)
  9028. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  9029. .addComponent(label3)
  9030. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  9031. .addComponent(label4)
  9032. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  9033. .addComponent(label5)
  9034. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
  9035. .addComponent(startButton)
  9036. .addContainerGap())
  9037. );
  9038. pack();
  9039. setLocationRelativeTo(getOwner());
  9040. // JFormDesigner - End of component initialization //GEN-END:initComponents
  9041. }
  9042.  
  9043. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  9044. private JLabel label1;
  9045. private JComboBox selectionBox;
  9046. private JCheckBox memoryMode;
  9047. private JLabel label2;
  9048. private JLabel label3;
  9049. private JLabel label4;
  9050. private JLabel label5;
  9051. private JButton startButton;
  9052. // JFormDesigner - End of variables declaration //GEN-END:variables
  9053. }
  9054.  
  9055.  
  9056. }
  9057. import java.awt.*;
  9058. import java.awt.event.*;
  9059. import javax.swing.*;
  9060. import java.awt.event.KeyEvent;
  9061. import org.rsbot.event.listeners.PaintListener;
  9062. import org.rsbot.script.Script;
  9063. import org.rsbot.script.ScriptManifest;
  9064. import org.rsbot.script.methods.*;
  9065. import org.rsbot.script.wrappers.*;
  9066.  
  9067. @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
  9068. public class vialfiller extends Script implements PaintListener{
  9069. //Variables
  9070. // - Essentials
  9071. private int bankerID = 6533;
  9072. private int fountainID = 24214;
  9073. private int emptyVialID = 229;
  9074. private int fullVialID = 227;
  9075. private int runEnergy = 50;
  9076. RSNPC banker;
  9077. RSObject fountain;
  9078. RSItem myVial;
  9079. RSTile theBank = new RSTile(3167, 3489);
  9080. RSTile theFountain = new RSTile(3191, 3471);
  9081. RSTile glitchSpot = new RSTile(3192, 3487);
  9082. RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
  9083. RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
  9084. RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
  9085. RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
  9086.  
  9087. // - GUI Options
  9088. private int min = 1;
  9089. private int max = 6;
  9090. private int minSpeed = 6;
  9091. private int maxSpeed = 9;
  9092. private boolean guiWait = true;
  9093. private boolean save = false;
  9094.  
  9095. // - State check
  9096. private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
  9097.  
  9098. // - Paint stuff
  9099. private String status = "Initializing...";
  9100. private String isRunning = "";
  9101. private int numFilled = 0;
  9102. private int vialFilledPrice;
  9103. private int vialEmptyPrice;
  9104. private int profitPrice;
  9105. private int profit;
  9106. private long startTime;
  9107. private long millis;
  9108. private long hours;
  9109. private long minutes;
  9110. private long seconds;
  9111. private float profSec = 0;
  9112. private float profHour;
  9113. private float hourlyProfit;
  9114. private int hourlyProfitInt;
  9115. private final Color color1 = new Color(0, 0, 0);
  9116. private final Color color2 = new Color(255, 255, 255);
  9117. private final BasicStroke stroke1 = new BasicStroke(1);
  9118. private final Font font1 = new Font("Arial", 0, 13);
  9119. private final Font font2 = new Font("Arial", 1, 13);
  9120. private final Font font3 = new Font("Vijaya", 1, 17);
  9121. private boolean antiban = true;
  9122. gui g = new gui();
  9123.  
  9124. @Override
  9125. public boolean onStart(){
  9126. log("Welcome to Painlaws's Vial Filler");
  9127. log("Waiting on GUI...");
  9128. g.setVisible(true);
  9129. while(guiWait){
  9130. sleep(500);
  9131. }
  9132. log("GUI Settings loaded!");
  9133. if(walking.isRunEnabled()){
  9134. isRunning = "Yes";
  9135. }
  9136. else{
  9137. isRunning = "No";
  9138. }
  9139. vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
  9140. vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
  9141. profitPrice = vialFilledPrice - vialEmptyPrice;
  9142. if(!save){
  9143. startTime = System.currentTimeMillis();
  9144. }
  9145. else{
  9146. startTime = 0;
  9147. }
  9148. return true;
  9149. }
  9150.  
  9151. @Override
  9152. public void onFinish(){
  9153. env.saveScreenshot(true);
  9154. log("^ Don't forget to upload this proggie :P");
  9155. log("Bye! PM Painlaws for comments/questions/requests");
  9156. }
  9157.  
  9158. public void useItem(RSItem item, RSObject object){
  9159. if(item != null && object != null && object.isOnScreen()){
  9160. item.doClick(true);
  9161. sleep(200, 300);
  9162. object.doClick();
  9163. }
  9164. }
  9165.  
  9166. public void fillVials(){
  9167. if(fountain != null){
  9168. status = "Filling Vials";
  9169. useItem(myVial, fountain);
  9170. while(inventory.contains(emptyVialID)){
  9171. sleep(random(1000,1500));
  9172. if(antiban){
  9173. if(random(1, 3) == 2){
  9174. mouse.moveSlightly();
  9175. }
  9176. }
  9177. }
  9178. status = "Vials filled";
  9179. }
  9180. else{
  9181. status = "Fountain is null...retrying";
  9182. sleep(random(600, 800));
  9183. }
  9184. }
  9185.  
  9186. private void doBank(){
  9187. try{
  9188. if(banker != null){
  9189. camera.turnTo(banker);
  9190. if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
  9191. status = "Opening Bank";
  9192. banker.interact("Bank Banker");
  9193. status = "Bank opened";
  9194. sleep(random(900, 1050));
  9195. status = "Depositing All";
  9196. bank.depositAll();
  9197. status = "Deposited All";
  9198. sleep(random(780, 950));
  9199. numFilled = bank.getCount(fullVialID);
  9200. if(bank.getCount(emptyVialID) != 0){
  9201. status = "Taking Vials";
  9202. bank.withdraw(emptyVialID, 0);
  9203. status = "Vials Taken";
  9204. sleep(random(700, 960));
  9205. }
  9206. else{
  9207. log("Out of vials. Quitting :/");
  9208. bank.close();
  9209. env.saveScreenshot(true);
  9210. log("^ Don't forget to upload this proggie :P");
  9211. log("Bye! PM Painlaws for comments/questions/requests");
  9212. stopScript(true);
  9213. }
  9214. status = "Closing Bank";
  9215. bank.close();
  9216. status = "Bank Closed";
  9217. sleep(random(750, 910));
  9218. }
  9219. }
  9220. sleep(random(300,500));
  9221. }catch(Exception e){log(e);}
  9222. }
  9223.  
  9224. public void onToBank(){
  9225. try{
  9226. status = "Going to Bank";
  9227. walking.walkTileMM(theBank);
  9228. }catch(Exception e){log(e);}
  9229. sleep(random(500, 700));
  9230. }
  9231.  
  9232. public void onToGlitch(){
  9233. try{
  9234. status = "Going to Fountain"; //What you don't know can't hurt you :P
  9235. walking.walkTileMM(glitchSpot);
  9236. }catch(Exception e){log(e);}
  9237. sleep(random(500, 710));
  9238. }
  9239.  
  9240. public void onToFountain(){
  9241. try{
  9242. status = "Going to Fountain";
  9243. walking.walkTileMM(theFountain);
  9244. }catch(Exception e){log(e);}
  9245. sleep(random(500, 705));
  9246. }
  9247.  
  9248. public void runcheck() {
  9249. try{
  9250. runEnergy = (random(50, 70));
  9251. if (walking.isRunEnabled()){
  9252. isRunning = "Yes";
  9253. }
  9254. else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
  9255. walking.setRun(true);
  9256. isRunning = "Yes";
  9257. sleep(random(300, 500));
  9258. }
  9259. else{
  9260. isRunning = "No";
  9261. sleep(random(300,500));
  9262. }
  9263. }catch(Exception ex){}
  9264. }
  9265.  
  9266. @Override
  9267. public int loop(){
  9268. mouse.setSpeed(random(minSpeed, maxSpeed));
  9269. runcheck();
  9270. if(antiban){
  9271. if(random(min, max) == 3){
  9272. antiban();
  9273. }
  9274. }
  9275. if(objects.getNearest(fountainID) != null){
  9276. fountain = objects.getNearest(fountainID);
  9277. }
  9278. if(npcs.getNearest(bankerID) != null){
  9279. banker = npcs.getNearest(bankerID);
  9280. }
  9281. if(inventory.getItem(emptyVialID) != null){
  9282. myVial = inventory.getItem(emptyVialID);
  9283. }
  9284. switch(getState()){
  9285. case TOFOUNTAIN:
  9286. runcheck();
  9287. onToFountain();
  9288. if(fountainRange.contains(players.getMyPlayer().getLocation())){
  9289. fillVials();
  9290. }
  9291. break;
  9292.  
  9293. case TOGLITCH:
  9294. runcheck();
  9295. onToGlitch();
  9296. break;
  9297.  
  9298. case TOBANK:
  9299. runcheck();
  9300. onToBank();
  9301. if(bankRange.contains(players.getMyPlayer().getLocation())){
  9302. doBank();
  9303. }
  9304. break;
  9305. }
  9306. return(random(500, 1000));
  9307. }
  9308.  
  9309. private State getState() {
  9310. if (!inventory.contains(emptyVialID)) {
  9311. return State.TOBANK;
  9312. }
  9313. else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
  9314. return State.TOGLITCH;
  9315. }
  9316. else{
  9317. return State.TOFOUNTAIN;
  9318. }
  9319. }
  9320.  
  9321. // GUI and Mouse
  9322. public void onRepaint(Graphics g1) {
  9323. profit = numFilled * profitPrice;
  9324. if(!save){
  9325. millis = System.currentTimeMillis() - startTime;
  9326. hours = millis / (1000 * 60 * 60);
  9327. millis -= hours * (1000 * 60 * 60);
  9328. minutes = millis / (1000 * 60);
  9329. millis -= minutes * (1000 * 60);
  9330. seconds = millis / 1000;
  9331.  
  9332. if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
  9333. profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
  9334. }
  9335. profHour = profSec * 3600;
  9336. hourlyProfit = profHour * profitPrice;
  9337. hourlyProfitInt = Math.round(hourlyProfit);
  9338. }
  9339. else{
  9340. millis = 0;
  9341. hours = 0;
  9342. minutes = 0;
  9343. seconds = 0;
  9344. hourlyProfitInt = 9001;
  9345. }
  9346.  
  9347. Graphics2D g = (Graphics2D)g1;
  9348. g.setColor(color1);
  9349. g.fillRect(7, 345, 488, 70);
  9350. g.setStroke(stroke1);
  9351. g.drawRect(7, 345, 488, 70);
  9352. g.setFont(font1);
  9353. g.setColor(color2);
  9354. g.drawString("Status:", 14, 362);
  9355. g.setFont(font2);
  9356. g.drawString(status, 59, 362);
  9357. g.setFont(font1);
  9358. g.drawString("Filled Vials In Bank:", 209, 362);
  9359. g.setFont(font2);
  9360. g.drawString(Integer.toString(numFilled), 328, 362);
  9361. g.setFont(font1);
  9362. g.drawString("Profit:", 14, 383);
  9363. g.setFont(font2);
  9364. g.drawString(Integer.toString(profit), 59, 383);
  9365. g.setFont(font1);
  9366. g.drawString("Profit/hr:", 137, 383);
  9367. g.setFont(font2);
  9368. if(!save){
  9369. g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
  9370. }
  9371. else{
  9372. g.drawString("Mem Save", 190, 383);
  9373. }
  9374. g.setFont(font1);
  9375. g.drawString("Runtime:", 270, 383);
  9376. g.setFont(font2);
  9377. if(!save){
  9378. g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
  9379. }
  9380. else{
  9381. g.drawString("Mem Save", 325, 384);
  9382. }
  9383. g.setFont(font1);
  9384. g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
  9385. g.drawString("Running:", 710, 139);
  9386. g.setFont(font2);
  9387. g.drawString(isRunning, 722, 156);
  9388. g.setFont(font3);
  9389. g.drawString("Painlaws", 440, 357);
  9390.  
  9391. g1.setColor(Color.green);
  9392. g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
  9393. g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
  9394. }
  9395.  
  9396. /* Antiban stuff
  9397. * Some credits to Aaimister :)
  9398. * Partially copied, with permission
  9399. */
  9400.  
  9401. public void rotateCamera() {
  9402. final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  9403. final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  9404. final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  9405. KeyEvent.VK_UP, KeyEvent.VK_UP };
  9406. final int randomLR = random(0, 2);
  9407. final int randomUD = random(0, 2);
  9408. final int randomAll = random(0, 4);
  9409. if (random(0, 3) == 0) {
  9410. keyboard.pressKey(LR[randomLR]);
  9411. sleepCR(random(2, 9));
  9412. keyboard.pressKey(UD[randomUD]);
  9413. sleepCR(random(6, 10));
  9414. keyboard.releaseKey(UD[randomUD]);
  9415. sleepCR(random(2, 7));
  9416. keyboard.releaseKey(LR[randomLR]);
  9417. } else {
  9418. keyboard.pressKey(LRUD[randomAll]);
  9419. if (randomAll > 1) {
  9420. sleepCR(random(6, 11));
  9421. } else {
  9422. sleepCR(random(9, 12));
  9423. }
  9424. keyboard.releaseKey(LRUD[randomAll]);
  9425. }
  9426. }
  9427.  
  9428. private boolean sleepCR(final int amtOfHalfSecs) {
  9429. for (int x = 0; x < amtOfHalfSecs + 1; x++) {
  9430. sleep(random(48, 53));
  9431. }
  9432. return true;
  9433. }
  9434.  
  9435. private void antiban(){
  9436. int action = random(0, 5);
  9437.  
  9438. switch (action) {
  9439. case 0:
  9440. status = "Antiban";
  9441. rotateCamera();
  9442. sleep(200, 400);
  9443. break;
  9444. case 1:
  9445. status = "Antiban";
  9446. mouse.moveRandomly(100, 900);
  9447. sleep(200, 400);
  9448. break;
  9449. case 2:
  9450. status = "Antiban";
  9451. mouse.moveSlightly();
  9452. sleep(200, 400);
  9453. break;
  9454. case 3:
  9455. status = "Antiban";
  9456. camera.moveRandomly(random(750,1250));
  9457. sleep(200, 400);
  9458. break;
  9459. case 4:
  9460. status = "Antiban";
  9461. checkEXP();
  9462. sleep(200, 400);
  9463. break;
  9464. case 5:
  9465. status = "Antiban";
  9466. mouse.moveOffScreen();
  9467. sleep(200, 400);
  9468. break;
  9469. }
  9470. }
  9471.  
  9472. public void checkEXP() {
  9473. game.openTab(Game.Tab.STATS);
  9474. skills.doHover(Skills.INTERFACE_PRAYER);
  9475. sleep(random(2100, 3400));
  9476. game.openTab(Game.Tab.INVENTORY);
  9477. sleep(random(540,760));
  9478. }
  9479.  
  9480.  
  9481. class gui extends JFrame {
  9482. /**
  9483. *
  9484. */
  9485. private static final long serialVersionUID = 1L;
  9486. public gui() {
  9487. initComponents();
  9488. }
  9489.  
  9490. private void startButtonActionPerformed(ActionEvent e){
  9491. String mode = selectionBox.getSelectedItem().toString();
  9492. if(mode.equals("Maximum")){
  9493. antiban = false;
  9494. minSpeed = 5;
  9495. maxSpeed = 6;
  9496. }
  9497. else if(mode.equals("Paranoid")){
  9498. antiban = true;
  9499. minSpeed = 8;
  9500. maxSpeed = 10;
  9501. min = 3;
  9502. max = 3;
  9503.  
  9504. }
  9505. save = memoryMode.isSelected();
  9506. guiWait = false;
  9507. g.dispose();
  9508. }
  9509.  
  9510. private void initComponents() {
  9511. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  9512. label1 = new JLabel();
  9513. selectionBox = new JComboBox();
  9514. memoryMode = new JCheckBox();
  9515. label2 = new JLabel();
  9516. label3 = new JLabel();
  9517. label4 = new JLabel();
  9518. label5 = new JLabel();
  9519. startButton = new JButton();
  9520.  
  9521. //======== this ========
  9522. setTitle("Painlaws's Vial Filler");
  9523. setResizable(false);
  9524. Container contentPane = getContentPane();
  9525.  
  9526. //---- label1 ----
  9527. label1.setText("Mode");
  9528.  
  9529. //---- selectionBox ----
  9530. selectionBox.setModel(new DefaultComboBoxModel(new String[] {
  9531. "Normal",
  9532. "Paranoid",
  9533. "Maximum"
  9534. }));
  9535.  
  9536. //---- memoryMode ----
  9537. memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
  9538.  
  9539. //---- label2 ----
  9540. label2.setText("Modes:");
  9541.  
  9542. //---- label3 ----
  9543. label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
  9544.  
  9545. //---- label4 ----
  9546. label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
  9547.  
  9548. //---- label5 ----
  9549. label5.setText("Maximum - No Antiban, Fast Mouse Speed");
  9550.  
  9551. //---- startButton ----
  9552. startButton.setText("Let's Fill Some Vials!");
  9553. startButton.addActionListener(new ActionListener() {
  9554. public void actionPerformed(ActionEvent e){
  9555. startButtonActionPerformed(e);
  9556. }
  9557. });
  9558.  
  9559. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  9560. contentPane.setLayout(contentPaneLayout);
  9561. contentPaneLayout.setHorizontalGroup(
  9562. contentPaneLayout.createParallelGroup()
  9563. .addGroup(contentPaneLayout.createSequentialGroup()
  9564. .addGroup(contentPaneLayout.createParallelGroup()
  9565. .addGroup(contentPaneLayout.createSequentialGroup()
  9566. .addContainerGap()
  9567. .addGroup(contentPaneLayout.createParallelGroup()
  9568. .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  9569. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  9570. .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  9571. .addGroup(contentPaneLayout.createSequentialGroup()
  9572. .addComponent(label1)
  9573. .addGap(18, 18, 18)
  9574. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  9575. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  9576. .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  9577. .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  9578. .addGroup(contentPaneLayout.createSequentialGroup()
  9579. .addGap(148, 148, 148)
  9580. .addComponent(startButton)))
  9581. .addContainerGap(2, Short.MAX_VALUE))
  9582. );
  9583. contentPaneLayout.setVerticalGroup(
  9584. contentPaneLayout.createParallelGroup()
  9585. .addGroup(contentPaneLayout.createSequentialGroup()
  9586. .addContainerGap()
  9587. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  9588. .addComponent(label1)
  9589. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  9590. .addGap(18, 18, 18)
  9591. .addComponent(memoryMode)
  9592. .addGap(18, 18, 18)
  9593. .addComponent(label2)
  9594. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  9595. .addComponent(label3)
  9596. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  9597. .addComponent(label4)
  9598. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  9599. .addComponent(label5)
  9600. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
  9601. .addComponent(startButton)
  9602. .addContainerGap())
  9603. );
  9604. pack();
  9605. setLocationRelativeTo(getOwner());
  9606. // JFormDesigner - End of component initialization //GEN-END:initComponents
  9607. }
  9608.  
  9609. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  9610. private JLabel label1;
  9611. private JComboBox selectionBox;
  9612. private JCheckBox memoryMode;
  9613. private JLabel label2;
  9614. private JLabel label3;
  9615. private JLabel label4;
  9616. private JLabel label5;
  9617. private JButton startButton;
  9618. // JFormDesigner - End of variables declaration //GEN-END:variables
  9619. }
  9620.  
  9621.  
  9622. }
  9623. import java.awt.*;
  9624. import java.awt.event.*;
  9625. import javax.swing.*;
  9626. import java.awt.event.KeyEvent;
  9627. import org.rsbot.event.listeners.PaintListener;
  9628. import org.rsbot.script.Script;
  9629. import org.rsbot.script.ScriptManifest;
  9630. import org.rsbot.script.methods.*;
  9631. import org.rsbot.script.wrappers.*;
  9632.  
  9633. @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
  9634. public class vialfiller extends Script implements PaintListener{
  9635. //Variables
  9636. // - Essentials
  9637. private int bankerID = 6533;
  9638. private int fountainID = 24214;
  9639. private int emptyVialID = 229;
  9640. private int fullVialID = 227;
  9641. private int runEnergy = 50;
  9642. RSNPC banker;
  9643. RSObject fountain;
  9644. RSItem myVial;
  9645. RSTile theBank = new RSTile(3167, 3489);
  9646. RSTile theFountain = new RSTile(3191, 3471);
  9647. RSTile glitchSpot = new RSTile(3192, 3487);
  9648. RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
  9649. RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
  9650. RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
  9651. RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
  9652.  
  9653. // - GUI Options
  9654. private int min = 1;
  9655. private int max = 6;
  9656. private int minSpeed = 6;
  9657. private int maxSpeed = 9;
  9658. private boolean guiWait = true;
  9659. private boolean save = false;
  9660.  
  9661. // - State check
  9662. private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
  9663.  
  9664. // - Paint stuff
  9665. private String status = "Initializing...";
  9666. private String isRunning = "";
  9667. private int numFilled = 0;
  9668. private int vialFilledPrice;
  9669. private int vialEmptyPrice;
  9670. private int profitPrice;
  9671. private int profit;
  9672. private long startTime;
  9673. private long millis;
  9674. private long hours;
  9675. private long minutes;
  9676. private long seconds;
  9677. private float profSec = 0;
  9678. private float profHour;
  9679. private float hourlyProfit;
  9680. private int hourlyProfitInt;
  9681. private final Color color1 = new Color(0, 0, 0);
  9682. private final Color color2 = new Color(255, 255, 255);
  9683. private final BasicStroke stroke1 = new BasicStroke(1);
  9684. private final Font font1 = new Font("Arial", 0, 13);
  9685. private final Font font2 = new Font("Arial", 1, 13);
  9686. private final Font font3 = new Font("Vijaya", 1, 17);
  9687. private boolean antiban = true;
  9688. gui g = new gui();
  9689.  
  9690. @Override
  9691. public boolean onStart(){
  9692. log("Welcome to Painlaws's Vial Filler");
  9693. log("Waiting on GUI...");
  9694. g.setVisible(true);
  9695. while(guiWait){
  9696. sleep(500);
  9697. }
  9698. log("GUI Settings loaded!");
  9699. if(walking.isRunEnabled()){
  9700. isRunning = "Yes";
  9701. }
  9702. else{
  9703. isRunning = "No";
  9704. }
  9705. vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
  9706. vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
  9707. profitPrice = vialFilledPrice - vialEmptyPrice;
  9708. if(!save){
  9709. startTime = System.currentTimeMillis();
  9710. }
  9711. else{
  9712. startTime = 0;
  9713. }
  9714. return true;
  9715. }
  9716.  
  9717. @Override
  9718. public void onFinish(){
  9719. env.saveScreenshot(true);
  9720. log("^ Don't forget to upload this proggie :P");
  9721. log("Bye! PM Painlaws for comments/questions/requests");
  9722. }
  9723.  
  9724. public void useItem(RSItem item, RSObject object){
  9725. if(item != null && object != null && object.isOnScreen()){
  9726. item.doClick(true);
  9727. sleep(200, 300);
  9728. object.doClick();
  9729. }
  9730. }
  9731.  
  9732. public void fillVials(){
  9733. if(fountain != null){
  9734. status = "Filling Vials";
  9735. useItem(myVial, fountain);
  9736. while(inventory.contains(emptyVialID)){
  9737. sleep(random(1000,1500));
  9738. if(antiban){
  9739. if(random(1, 3) == 2){
  9740. mouse.moveSlightly();
  9741. }
  9742. }
  9743. }
  9744. status = "Vials filled";
  9745. }
  9746. else{
  9747. status = "Fountain is null...retrying";
  9748. sleep(random(600, 800));
  9749. }
  9750. }
  9751.  
  9752. private void doBank(){
  9753. try{
  9754. if(banker != null){
  9755. camera.turnTo(banker);
  9756. if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
  9757. status = "Opening Bank";
  9758. banker.interact("Bank Banker");
  9759. status = "Bank opened";
  9760. sleep(random(900, 1050));
  9761. status = "Depositing All";
  9762. bank.depositAll();
  9763. status = "Deposited All";
  9764. sleep(random(780, 950));
  9765. numFilled = bank.getCount(fullVialID);
  9766. if(bank.getCount(emptyVialID) != 0){
  9767. status = "Taking Vials";
  9768. bank.withdraw(emptyVialID, 0);
  9769. status = "Vials Taken";
  9770. sleep(random(700, 960));
  9771. }
  9772. else{
  9773. log("Out of vials. Quitting :/");
  9774. bank.close();
  9775. env.saveScreenshot(true);
  9776. log("^ Don't forget to upload this proggie :P");
  9777. log("Bye! PM Painlaws for comments/questions/requests");
  9778. stopScript(true);
  9779. }
  9780. status = "Closing Bank";
  9781. bank.close();
  9782. status = "Bank Closed";
  9783. sleep(random(750, 910));
  9784. }
  9785. }
  9786. sleep(random(300,500));
  9787. }catch(Exception e){log(e);}
  9788. }
  9789.  
  9790. public void onToBank(){
  9791. try{
  9792. status = "Going to Bank";
  9793. walking.walkTileMM(theBank);
  9794. }catch(Exception e){log(e);}
  9795. sleep(random(500, 700));
  9796. }
  9797.  
  9798. public void onToGlitch(){
  9799. try{
  9800. status = "Going to Fountain"; //What you don't know can't hurt you :P
  9801. walking.walkTileMM(glitchSpot);
  9802. }catch(Exception e){log(e);}
  9803. sleep(random(500, 710));
  9804. }
  9805.  
  9806. public void onToFountain(){
  9807. try{
  9808. status = "Going to Fountain";
  9809. walking.walkTileMM(theFountain);
  9810. }catch(Exception e){log(e);}
  9811. sleep(random(500, 705));
  9812. }
  9813.  
  9814. public void runcheck() {
  9815. try{
  9816. runEnergy = (random(50, 70));
  9817. if (walking.isRunEnabled()){
  9818. isRunning = "Yes";
  9819. }
  9820. else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
  9821. walking.setRun(true);
  9822. isRunning = "Yes";
  9823. sleep(random(300, 500));
  9824. }
  9825. else{
  9826. isRunning = "No";
  9827. sleep(random(300,500));
  9828. }
  9829. }catch(Exception ex){}
  9830. }
  9831.  
  9832. @Override
  9833. public int loop(){
  9834. mouse.setSpeed(random(minSpeed, maxSpeed));
  9835. runcheck();
  9836. if(antiban){
  9837. if(random(min, max) == 3){
  9838. antiban();
  9839. }
  9840. }
  9841. if(objects.getNearest(fountainID) != null){
  9842. fountain = objects.getNearest(fountainID);
  9843. }
  9844. if(npcs.getNearest(bankerID) != null){
  9845. banker = npcs.getNearest(bankerID);
  9846. }
  9847. if(inventory.getItem(emptyVialID) != null){
  9848. myVial = inventory.getItem(emptyVialID);
  9849. }
  9850. switch(getState()){
  9851. case TOFOUNTAIN:
  9852. runcheck();
  9853. onToFountain();
  9854. if(fountainRange.contains(players.getMyPlayer().getLocation())){
  9855. fillVials();
  9856. }
  9857. break;
  9858.  
  9859. case TOGLITCH:
  9860. runcheck();
  9861. onToGlitch();
  9862. break;
  9863.  
  9864. case TOBANK:
  9865. runcheck();
  9866. onToBank();
  9867. if(bankRange.contains(players.getMyPlayer().getLocation())){
  9868. doBank();
  9869. }
  9870. break;
  9871. }
  9872. return(random(500, 1000));
  9873. }
  9874.  
  9875. private State getState() {
  9876. if (!inventory.contains(emptyVialID)) {
  9877. return State.TOBANK;
  9878. }
  9879. else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
  9880. return State.TOGLITCH;
  9881. }
  9882. else{
  9883. return State.TOFOUNTAIN;
  9884. }
  9885. }
  9886.  
  9887. // GUI and Mouse
  9888. public void onRepaint(Graphics g1) {
  9889. profit = numFilled * profitPrice;
  9890. if(!save){
  9891. millis = System.currentTimeMillis() - startTime;
  9892. hours = millis / (1000 * 60 * 60);
  9893. millis -= hours * (1000 * 60 * 60);
  9894. minutes = millis / (1000 * 60);
  9895. millis -= minutes * (1000 * 60);
  9896. seconds = millis / 1000;
  9897.  
  9898. if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
  9899. profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
  9900. }
  9901. profHour = profSec * 3600;
  9902. hourlyProfit = profHour * profitPrice;
  9903. hourlyProfitInt = Math.round(hourlyProfit);
  9904. }
  9905. else{
  9906. millis = 0;
  9907. hours = 0;
  9908. minutes = 0;
  9909. seconds = 0;
  9910. hourlyProfitInt = 9001;
  9911. }
  9912.  
  9913. Graphics2D g = (Graphics2D)g1;
  9914. g.setColor(color1);
  9915. g.fillRect(7, 345, 488, 70);
  9916. g.setStroke(stroke1);
  9917. g.drawRect(7, 345, 488, 70);
  9918. g.setFont(font1);
  9919. g.setColor(color2);
  9920. g.drawString("Status:", 14, 362);
  9921. g.setFont(font2);
  9922. g.drawString(status, 59, 362);
  9923. g.setFont(font1);
  9924. g.drawString("Filled Vials In Bank:", 209, 362);
  9925. g.setFont(font2);
  9926. g.drawString(Integer.toString(numFilled), 328, 362);
  9927. g.setFont(font1);
  9928. g.drawString("Profit:", 14, 383);
  9929. g.setFont(font2);
  9930. g.drawString(Integer.toString(profit), 59, 383);
  9931. g.setFont(font1);
  9932. g.drawString("Profit/hr:", 137, 383);
  9933. g.setFont(font2);
  9934. if(!save){
  9935. g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
  9936. }
  9937. else{
  9938. g.drawString("Mem Save", 190, 383);
  9939. }
  9940. g.setFont(font1);
  9941. g.drawString("Runtime:", 270, 383);
  9942. g.setFont(font2);
  9943. if(!save){
  9944. g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
  9945. }
  9946. else{
  9947. g.drawString("Mem Save", 325, 384);
  9948. }
  9949. g.setFont(font1);
  9950. g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
  9951. g.drawString("Running:", 710, 139);
  9952. g.setFont(font2);
  9953. g.drawString(isRunning, 722, 156);
  9954. g.setFont(font3);
  9955. g.drawString("Painlaws", 440, 357);
  9956.  
  9957. g1.setColor(Color.green);
  9958. g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
  9959. g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
  9960. }
  9961.  
  9962. /* Antiban stuff
  9963. * Some credits to Aaimister :)
  9964. * Partially copied, with permission
  9965. */
  9966.  
  9967. public void rotateCamera() {
  9968. final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  9969. final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  9970. final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  9971. KeyEvent.VK_UP, KeyEvent.VK_UP };
  9972. final int randomLR = random(0, 2);
  9973. final int randomUD = random(0, 2);
  9974. final int randomAll = random(0, 4);
  9975. if (random(0, 3) == 0) {
  9976. keyboard.pressKey(LR[randomLR]);
  9977. sleepCR(random(2, 9));
  9978. keyboard.pressKey(UD[randomUD]);
  9979. sleepCR(random(6, 10));
  9980. keyboard.releaseKey(UD[randomUD]);
  9981. sleepCR(random(2, 7));
  9982. keyboard.releaseKey(LR[randomLR]);
  9983. } else {
  9984. keyboard.pressKey(LRUD[randomAll]);
  9985. if (randomAll > 1) {
  9986. sleepCR(random(6, 11));
  9987. } else {
  9988. sleepCR(random(9, 12));
  9989. }
  9990. keyboard.releaseKey(LRUD[randomAll]);
  9991. }
  9992. }
  9993.  
  9994. private boolean sleepCR(final int amtOfHalfSecs) {
  9995. for (int x = 0; x < amtOfHalfSecs + 1; x++) {
  9996. sleep(random(48, 53));
  9997. }
  9998. return true;
  9999. }
  10000.  
  10001. private void antiban(){
  10002. int action = random(0, 5);
  10003.  
  10004. switch (action) {
  10005. case 0:
  10006. status = "Antiban";
  10007. rotateCamera();
  10008. sleep(200, 400);
  10009. break;
  10010. case 1:
  10011. status = "Antiban";
  10012. mouse.moveRandomly(100, 900);
  10013. sleep(200, 400);
  10014. break;
  10015. case 2:
  10016. status = "Antiban";
  10017. mouse.moveSlightly();
  10018. sleep(200, 400);
  10019. break;
  10020. case 3:
  10021. status = "Antiban";
  10022. camera.moveRandomly(random(750,1250));
  10023. sleep(200, 400);
  10024. break;
  10025. case 4:
  10026. status = "Antiban";
  10027. checkEXP();
  10028. sleep(200, 400);
  10029. break;
  10030. case 5:
  10031. status = "Antiban";
  10032. mouse.moveOffScreen();
  10033. sleep(200, 400);
  10034. break;
  10035. }
  10036. }
  10037.  
  10038. public void checkEXP() {
  10039. game.openTab(Game.Tab.STATS);
  10040. skills.doHover(Skills.INTERFACE_PRAYER);
  10041. sleep(random(2100, 3400));
  10042. game.openTab(Game.Tab.INVENTORY);
  10043. sleep(random(540,760));
  10044. }
  10045.  
  10046.  
  10047. class gui extends JFrame {
  10048. /**
  10049. *
  10050. */
  10051. private static final long serialVersionUID = 1L;
  10052. public gui() {
  10053. initComponents();
  10054. }
  10055.  
  10056. private void startButtonActionPerformed(ActionEvent e){
  10057. String mode = selectionBox.getSelectedItem().toString();
  10058. if(mode.equals("Maximum")){
  10059. antiban = false;
  10060. minSpeed = 5;
  10061. maxSpeed = 6;
  10062. }
  10063. else if(mode.equals("Paranoid")){
  10064. antiban = true;
  10065. minSpeed = 8;
  10066. maxSpeed = 10;
  10067. min = 3;
  10068. max = 3;
  10069.  
  10070. }
  10071. save = memoryMode.isSelected();
  10072. guiWait = false;
  10073. g.dispose();
  10074. }
  10075.  
  10076. private void initComponents() {
  10077. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  10078. label1 = new JLabel();
  10079. selectionBox = new JComboBox();
  10080. memoryMode = new JCheckBox();
  10081. label2 = new JLabel();
  10082. label3 = new JLabel();
  10083. label4 = new JLabel();
  10084. label5 = new JLabel();
  10085. startButton = new JButton();
  10086.  
  10087. //======== this ========
  10088. setTitle("Painlaws's Vial Filler");
  10089. setResizable(false);
  10090. Container contentPane = getContentPane();
  10091.  
  10092. //---- label1 ----
  10093. label1.setText("Mode");
  10094.  
  10095. //---- selectionBox ----
  10096. selectionBox.setModel(new DefaultComboBoxModel(new String[] {
  10097. "Normal",
  10098. "Paranoid",
  10099. "Maximum"
  10100. }));
  10101.  
  10102. //---- memoryMode ----
  10103. memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
  10104.  
  10105. //---- label2 ----
  10106. label2.setText("Modes:");
  10107.  
  10108. //---- label3 ----
  10109. label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
  10110.  
  10111. //---- label4 ----
  10112. label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
  10113.  
  10114. //---- label5 ----
  10115. label5.setText("Maximum - No Antiban, Fast Mouse Speed");
  10116.  
  10117. //---- startButton ----
  10118. startButton.setText("Let's Fill Some Vials!");
  10119. startButton.addActionListener(new ActionListener() {
  10120. public void actionPerformed(ActionEvent e){
  10121. startButtonActionPerformed(e);
  10122. }
  10123. });
  10124.  
  10125. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  10126. contentPane.setLayout(contentPaneLayout);
  10127. contentPaneLayout.setHorizontalGroup(
  10128. contentPaneLayout.createParallelGroup()
  10129. .addGroup(contentPaneLayout.createSequentialGroup()
  10130. .addGroup(contentPaneLayout.createParallelGroup()
  10131. .addGroup(contentPaneLayout.createSequentialGroup()
  10132. .addContainerGap()
  10133. .addGroup(contentPaneLayout.createParallelGroup()
  10134. .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  10135. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  10136. .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  10137. .addGroup(contentPaneLayout.createSequentialGroup()
  10138. .addComponent(label1)
  10139. .addGap(18, 18, 18)
  10140. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  10141. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  10142. .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  10143. .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  10144. .addGroup(contentPaneLayout.createSequentialGroup()
  10145. .addGap(148, 148, 148)
  10146. .addComponent(startButton)))
  10147. .addContainerGap(2, Short.MAX_VALUE))
  10148. );
  10149. contentPaneLayout.setVerticalGroup(
  10150. contentPaneLayout.createParallelGroup()
  10151. .addGroup(contentPaneLayout.createSequentialGroup()
  10152. .addContainerGap()
  10153. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  10154. .addComponent(label1)
  10155. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  10156. .addGap(18, 18, 18)
  10157. .addComponent(memoryMode)
  10158. .addGap(18, 18, 18)
  10159. .addComponent(label2)
  10160. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  10161. .addComponent(label3)
  10162. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  10163. .addComponent(label4)
  10164. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  10165. .addComponent(label5)
  10166. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
  10167. .addComponent(startButton)
  10168. .addContainerGap())
  10169. );
  10170. pack();
  10171. setLocationRelativeTo(getOwner());
  10172. // JFormDesigner - End of component initialization //GEN-END:initComponents
  10173. }
  10174.  
  10175. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  10176. private JLabel label1;
  10177. private JComboBox selectionBox;
  10178. private JCheckBox memoryMode;
  10179. private JLabel label2;
  10180. private JLabel label3;
  10181. private JLabel label4;
  10182. private JLabel label5;
  10183. private JButton startButton;
  10184. // JFormDesigner - End of variables declaration //GEN-END:variables
  10185. }
  10186.  
  10187.  
  10188. }
  10189. import java.awt.*;
  10190. import java.awt.event.*;
  10191. import javax.swing.*;
  10192. import java.awt.event.KeyEvent;
  10193. import org.rsbot.event.listeners.PaintListener;
  10194. import org.rsbot.script.Script;
  10195. import org.rsbot.script.ScriptManifest;
  10196. import org.rsbot.script.methods.*;
  10197. import org.rsbot.script.wrappers.*;
  10198.  
  10199. @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
  10200. public class vialfiller extends Script implements PaintListener{
  10201. //Variables
  10202. // - Essentials
  10203. private int bankerID = 6533;
  10204. private int fountainID = 24214;
  10205. private int emptyVialID = 229;
  10206. private int fullVialID = 227;
  10207. private int runEnergy = 50;
  10208. RSNPC banker;
  10209. RSObject fountain;
  10210. RSItem myVial;
  10211. RSTile theBank = new RSTile(3167, 3489);
  10212. RSTile theFountain = new RSTile(3191, 3471);
  10213. RSTile glitchSpot = new RSTile(3192, 3487);
  10214. RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
  10215. RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
  10216. RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
  10217. RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
  10218.  
  10219. // - GUI Options
  10220. private int min = 1;
  10221. private int max = 6;
  10222. private int minSpeed = 6;
  10223. private int maxSpeed = 9;
  10224. private boolean guiWait = true;
  10225. private boolean save = false;
  10226.  
  10227. // - State check
  10228. private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
  10229.  
  10230. // - Paint stuff
  10231. private String status = "Initializing...";
  10232. private String isRunning = "";
  10233. private int numFilled = 0;
  10234. private int vialFilledPrice;
  10235. private int vialEmptyPrice;
  10236. private int profitPrice;
  10237. private int profit;
  10238. private long startTime;
  10239. private long millis;
  10240. private long hours;
  10241. private long minutes;
  10242. private long seconds;
  10243. private float profSec = 0;
  10244. private float profHour;
  10245. private float hourlyProfit;
  10246. private int hourlyProfitInt;
  10247. private final Color color1 = new Color(0, 0, 0);
  10248. private final Color color2 = new Color(255, 255, 255);
  10249. private final BasicStroke stroke1 = new BasicStroke(1);
  10250. private final Font font1 = new Font("Arial", 0, 13);
  10251. private final Font font2 = new Font("Arial", 1, 13);
  10252. private final Font font3 = new Font("Vijaya", 1, 17);
  10253. private boolean antiban = true;
  10254. gui g = new gui();
  10255.  
  10256. @Override
  10257. public boolean onStart(){
  10258. log("Welcome to Painlaws's Vial Filler");
  10259. log("Waiting on GUI...");
  10260. g.setVisible(true);
  10261. while(guiWait){
  10262. sleep(500);
  10263. }
  10264. log("GUI Settings loaded!");
  10265. if(walking.isRunEnabled()){
  10266. isRunning = "Yes";
  10267. }
  10268. else{
  10269. isRunning = "No";
  10270. }
  10271. vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
  10272. vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
  10273. profitPrice = vialFilledPrice - vialEmptyPrice;
  10274. if(!save){
  10275. startTime = System.currentTimeMillis();
  10276. }
  10277. else{
  10278. startTime = 0;
  10279. }
  10280. return true;
  10281. }
  10282.  
  10283. @Override
  10284. public void onFinish(){
  10285. env.saveScreenshot(true);
  10286. log("^ Don't forget to upload this proggie :P");
  10287. log("Bye! PM Painlaws for comments/questions/requests");
  10288. }
  10289.  
  10290. public void useItem(RSItem item, RSObject object){
  10291. if(item != null && object != null && object.isOnScreen()){
  10292. item.doClick(true);
  10293. sleep(200, 300);
  10294. object.doClick();
  10295. }
  10296. }
  10297.  
  10298. public void fillVials(){
  10299. if(fountain != null){
  10300. status = "Filling Vials";
  10301. useItem(myVial, fountain);
  10302. while(inventory.contains(emptyVialID)){
  10303. sleep(random(1000,1500));
  10304. if(antiban){
  10305. if(random(1, 3) == 2){
  10306. mouse.moveSlightly();
  10307. }
  10308. }
  10309. }
  10310. status = "Vials filled";
  10311. }
  10312. else{
  10313. status = "Fountain is null...retrying";
  10314. sleep(random(600, 800));
  10315. }
  10316. }
  10317.  
  10318. private void doBank(){
  10319. try{
  10320. if(banker != null){
  10321. camera.turnTo(banker);
  10322. if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
  10323. status = "Opening Bank";
  10324. banker.interact("Bank Banker");
  10325. status = "Bank opened";
  10326. sleep(random(900, 1050));
  10327. status = "Depositing All";
  10328. bank.depositAll();
  10329. status = "Deposited All";
  10330. sleep(random(780, 950));
  10331. numFilled = bank.getCount(fullVialID);
  10332. if(bank.getCount(emptyVialID) != 0){
  10333. status = "Taking Vials";
  10334. bank.withdraw(emptyVialID, 0);
  10335. status = "Vials Taken";
  10336. sleep(random(700, 960));
  10337. }
  10338. else{
  10339. log("Out of vials. Quitting :/");
  10340. bank.close();
  10341. env.saveScreenshot(true);
  10342. log("^ Don't forget to upload this proggie :P");
  10343. log("Bye! PM Painlaws for comments/questions/requests");
  10344. stopScript(true);
  10345. }
  10346. status = "Closing Bank";
  10347. bank.close();
  10348. status = "Bank Closed";
  10349. sleep(random(750, 910));
  10350. }
  10351. }
  10352. sleep(random(300,500));
  10353. }catch(Exception e){log(e);}
  10354. }
  10355.  
  10356. public void onToBank(){
  10357. try{
  10358. status = "Going to Bank";
  10359. walking.walkTileMM(theBank);
  10360. }catch(Exception e){log(e);}
  10361. sleep(random(500, 700));
  10362. }
  10363.  
  10364. public void onToGlitch(){
  10365. try{
  10366. status = "Going to Fountain"; //What you don't know can't hurt you :P
  10367. walking.walkTileMM(glitchSpot);
  10368. }catch(Exception e){log(e);}
  10369. sleep(random(500, 710));
  10370. }
  10371.  
  10372. public void onToFountain(){
  10373. try{
  10374. status = "Going to Fountain";
  10375. walking.walkTileMM(theFountain);
  10376. }catch(Exception e){log(e);}
  10377. sleep(random(500, 705));
  10378. }
  10379.  
  10380. public void runcheck() {
  10381. try{
  10382. runEnergy = (random(50, 70));
  10383. if (walking.isRunEnabled()){
  10384. isRunning = "Yes";
  10385. }
  10386. else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
  10387. walking.setRun(true);
  10388. isRunning = "Yes";
  10389. sleep(random(300, 500));
  10390. }
  10391. else{
  10392. isRunning = "No";
  10393. sleep(random(300,500));
  10394. }
  10395. }catch(Exception ex){}
  10396. }
  10397.  
  10398. @Override
  10399. public int loop(){
  10400. mouse.setSpeed(random(minSpeed, maxSpeed));
  10401. runcheck();
  10402. if(antiban){
  10403. if(random(min, max) == 3){
  10404. antiban();
  10405. }
  10406. }
  10407. if(objects.getNearest(fountainID) != null){
  10408. fountain = objects.getNearest(fountainID);
  10409. }
  10410. if(npcs.getNearest(bankerID) != null){
  10411. banker = npcs.getNearest(bankerID);
  10412. }
  10413. if(inventory.getItem(emptyVialID) != null){
  10414. myVial = inventory.getItem(emptyVialID);
  10415. }
  10416. switch(getState()){
  10417. case TOFOUNTAIN:
  10418. runcheck();
  10419. onToFountain();
  10420. if(fountainRange.contains(players.getMyPlayer().getLocation())){
  10421. fillVials();
  10422. }
  10423. break;
  10424.  
  10425. case TOGLITCH:
  10426. runcheck();
  10427. onToGlitch();
  10428. break;
  10429.  
  10430. case TOBANK:
  10431. runcheck();
  10432. onToBank();
  10433. if(bankRange.contains(players.getMyPlayer().getLocation())){
  10434. doBank();
  10435. }
  10436. break;
  10437. }
  10438. return(random(500, 1000));
  10439. }
  10440.  
  10441. private State getState() {
  10442. if (!inventory.contains(emptyVialID)) {
  10443. return State.TOBANK;
  10444. }
  10445. else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
  10446. return State.TOGLITCH;
  10447. }
  10448. else{
  10449. return State.TOFOUNTAIN;
  10450. }
  10451. }
  10452.  
  10453. // GUI and Mouse
  10454. public void onRepaint(Graphics g1) {
  10455. profit = numFilled * profitPrice;
  10456. if(!save){
  10457. millis = System.currentTimeMillis() - startTime;
  10458. hours = millis / (1000 * 60 * 60);
  10459. millis -= hours * (1000 * 60 * 60);
  10460. minutes = millis / (1000 * 60);
  10461. millis -= minutes * (1000 * 60);
  10462. seconds = millis / 1000;
  10463.  
  10464. if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
  10465. profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
  10466. }
  10467. profHour = profSec * 3600;
  10468. hourlyProfit = profHour * profitPrice;
  10469. hourlyProfitInt = Math.round(hourlyProfit);
  10470. }
  10471. else{
  10472. millis = 0;
  10473. hours = 0;
  10474. minutes = 0;
  10475. seconds = 0;
  10476. hourlyProfitInt = 9001;
  10477. }
  10478.  
  10479. Graphics2D g = (Graphics2D)g1;
  10480. g.setColor(color1);
  10481. g.fillRect(7, 345, 488, 70);
  10482. g.setStroke(stroke1);
  10483. g.drawRect(7, 345, 488, 70);
  10484. g.setFont(font1);
  10485. g.setColor(color2);
  10486. g.drawString("Status:", 14, 362);
  10487. g.setFont(font2);
  10488. g.drawString(status, 59, 362);
  10489. g.setFont(font1);
  10490. g.drawString("Filled Vials In Bank:", 209, 362);
  10491. g.setFont(font2);
  10492. g.drawString(Integer.toString(numFilled), 328, 362);
  10493. g.setFont(font1);
  10494. g.drawString("Profit:", 14, 383);
  10495. g.setFont(font2);
  10496. g.drawString(Integer.toString(profit), 59, 383);
  10497. g.setFont(font1);
  10498. g.drawString("Profit/hr:", 137, 383);
  10499. g.setFont(font2);
  10500. if(!save){
  10501. g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
  10502. }
  10503. else{
  10504. g.drawString("Mem Save", 190, 383);
  10505. }
  10506. g.setFont(font1);
  10507. g.drawString("Runtime:", 270, 383);
  10508. g.setFont(font2);
  10509. if(!save){
  10510. g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
  10511. }
  10512. else{
  10513. g.drawString("Mem Save", 325, 384);
  10514. }
  10515. g.setFont(font1);
  10516. g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
  10517. g.drawString("Running:", 710, 139);
  10518. g.setFont(font2);
  10519. g.drawString(isRunning, 722, 156);
  10520. g.setFont(font3);
  10521. g.drawString("Painlaws", 440, 357);
  10522.  
  10523. g1.setColor(Color.green);
  10524. g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
  10525. g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
  10526. }
  10527.  
  10528. /* Antiban stuff
  10529. * Some credits to Aaimister :)
  10530. * Partially copied, with permission
  10531. */
  10532.  
  10533. public void rotateCamera() {
  10534. final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  10535. final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  10536. final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  10537. KeyEvent.VK_UP, KeyEvent.VK_UP };
  10538. final int randomLR = random(0, 2);
  10539. final int randomUD = random(0, 2);
  10540. final int randomAll = random(0, 4);
  10541. if (random(0, 3) == 0) {
  10542. keyboard.pressKey(LR[randomLR]);
  10543. sleepCR(random(2, 9));
  10544. keyboard.pressKey(UD[randomUD]);
  10545. sleepCR(random(6, 10));
  10546. keyboard.releaseKey(UD[randomUD]);
  10547. sleepCR(random(2, 7));
  10548. keyboard.releaseKey(LR[randomLR]);
  10549. } else {
  10550. keyboard.pressKey(LRUD[randomAll]);
  10551. if (randomAll > 1) {
  10552. sleepCR(random(6, 11));
  10553. } else {
  10554. sleepCR(random(9, 12));
  10555. }
  10556. keyboard.releaseKey(LRUD[randomAll]);
  10557. }
  10558. }
  10559.  
  10560. private boolean sleepCR(final int amtOfHalfSecs) {
  10561. for (int x = 0; x < amtOfHalfSecs + 1; x++) {
  10562. sleep(random(48, 53));
  10563. }
  10564. return true;
  10565. }
  10566.  
  10567. private void antiban(){
  10568. int action = random(0, 5);
  10569.  
  10570. switch (action) {
  10571. case 0:
  10572. status = "Antiban";
  10573. rotateCamera();
  10574. sleep(200, 400);
  10575. break;
  10576. case 1:
  10577. status = "Antiban";
  10578. mouse.moveRandomly(100, 900);
  10579. sleep(200, 400);
  10580. break;
  10581. case 2:
  10582. status = "Antiban";
  10583. mouse.moveSlightly();
  10584. sleep(200, 400);
  10585. break;
  10586. case 3:
  10587. status = "Antiban";
  10588. camera.moveRandomly(random(750,1250));
  10589. sleep(200, 400);
  10590. break;
  10591. case 4:
  10592. status = "Antiban";
  10593. checkEXP();
  10594. sleep(200, 400);
  10595. break;
  10596. case 5:
  10597. status = "Antiban";
  10598. mouse.moveOffScreen();
  10599. sleep(200, 400);
  10600. break;
  10601. }
  10602. }
  10603.  
  10604. public void checkEXP() {
  10605. game.openTab(Game.Tab.STATS);
  10606. skills.doHover(Skills.INTERFACE_PRAYER);
  10607. sleep(random(2100, 3400));
  10608. game.openTab(Game.Tab.INVENTORY);
  10609. sleep(random(540,760));
  10610. }
  10611.  
  10612.  
  10613. class gui extends JFrame {
  10614. /**
  10615. *
  10616. */
  10617. private static final long serialVersionUID = 1L;
  10618. public gui() {
  10619. initComponents();
  10620. }
  10621.  
  10622. private void startButtonActionPerformed(ActionEvent e){
  10623. String mode = selectionBox.getSelectedItem().toString();
  10624. if(mode.equals("Maximum")){
  10625. antiban = false;
  10626. minSpeed = 5;
  10627. maxSpeed = 6;
  10628. }
  10629. else if(mode.equals("Paranoid")){
  10630. antiban = true;
  10631. minSpeed = 8;
  10632. maxSpeed = 10;
  10633. min = 3;
  10634. max = 3;
  10635.  
  10636. }
  10637. save = memoryMode.isSelected();
  10638. guiWait = false;
  10639. g.dispose();
  10640. }
  10641.  
  10642. private void initComponents() {
  10643. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  10644. label1 = new JLabel();
  10645. selectionBox = new JComboBox();
  10646. memoryMode = new JCheckBox();
  10647. label2 = new JLabel();
  10648. label3 = new JLabel();
  10649. label4 = new JLabel();
  10650. label5 = new JLabel();
  10651. startButton = new JButton();
  10652.  
  10653. //======== this ========
  10654. setTitle("Painlaws's Vial Filler");
  10655. setResizable(false);
  10656. Container contentPane = getContentPane();
  10657.  
  10658. //---- label1 ----
  10659. label1.setText("Mode");
  10660.  
  10661. //---- selectionBox ----
  10662. selectionBox.setModel(new DefaultComboBoxModel(new String[] {
  10663. "Normal",
  10664. "Paranoid",
  10665. "Maximum"
  10666. }));
  10667.  
  10668. //---- memoryMode ----
  10669. memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
  10670.  
  10671. //---- label2 ----
  10672. label2.setText("Modes:");
  10673.  
  10674. //---- label3 ----
  10675. label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
  10676.  
  10677. //---- label4 ----
  10678. label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
  10679.  
  10680. //---- label5 ----
  10681. label5.setText("Maximum - No Antiban, Fast Mouse Speed");
  10682.  
  10683. //---- startButton ----
  10684. startButton.setText("Let's Fill Some Vials!");
  10685. startButton.addActionListener(new ActionListener() {
  10686. public void actionPerformed(ActionEvent e){
  10687. startButtonActionPerformed(e);
  10688. }
  10689. });
  10690.  
  10691. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  10692. contentPane.setLayout(contentPaneLayout);
  10693. contentPaneLayout.setHorizontalGroup(
  10694. contentPaneLayout.createParallelGroup()
  10695. .addGroup(contentPaneLayout.createSequentialGroup()
  10696. .addGroup(contentPaneLayout.createParallelGroup()
  10697. .addGroup(contentPaneLayout.createSequentialGroup()
  10698. .addContainerGap()
  10699. .addGroup(contentPaneLayout.createParallelGroup()
  10700. .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  10701. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  10702. .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  10703. .addGroup(contentPaneLayout.createSequentialGroup()
  10704. .addComponent(label1)
  10705. .addGap(18, 18, 18)
  10706. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  10707. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  10708. .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  10709. .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  10710. .addGroup(contentPaneLayout.createSequentialGroup()
  10711. .addGap(148, 148, 148)
  10712. .addComponent(startButton)))
  10713. .addContainerGap(2, Short.MAX_VALUE))
  10714. );
  10715. contentPaneLayout.setVerticalGroup(
  10716. contentPaneLayout.createParallelGroup()
  10717. .addGroup(contentPaneLayout.createSequentialGroup()
  10718. .addContainerGap()
  10719. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  10720. .addComponent(label1)
  10721. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  10722. .addGap(18, 18, 18)
  10723. .addComponent(memoryMode)
  10724. .addGap(18, 18, 18)
  10725. .addComponent(label2)
  10726. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  10727. .addComponent(label3)
  10728. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  10729. .addComponent(label4)
  10730. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  10731. .addComponent(label5)
  10732. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
  10733. .addComponent(startButton)
  10734. .addContainerGap())
  10735. );
  10736. pack();
  10737. setLocationRelativeTo(getOwner());
  10738. // JFormDesigner - End of component initialization //GEN-END:initComponents
  10739. }
  10740.  
  10741. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  10742. private JLabel label1;
  10743. private JComboBox selectionBox;
  10744. private JCheckBox memoryMode;
  10745. private JLabel label2;
  10746. private JLabel label3;
  10747. private JLabel label4;
  10748. private JLabel label5;
  10749. private JButton startButton;
  10750. // JFormDesigner - End of variables declaration //GEN-END:variables
  10751. }
  10752.  
  10753.  
  10754. }
  10755. import java.awt.*;
  10756. import java.awt.event.*;
  10757. import javax.swing.*;
  10758. import java.awt.event.KeyEvent;
  10759. import org.rsbot.event.listeners.PaintListener;
  10760. import org.rsbot.script.Script;
  10761. import org.rsbot.script.ScriptManifest;
  10762. import org.rsbot.script.methods.*;
  10763. import org.rsbot.script.wrappers.*;
  10764.  
  10765. @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
  10766. public class vialfiller extends Script implements PaintListener{
  10767. //Variables
  10768. // - Essentials
  10769. private int bankerID = 6533;
  10770. private int fountainID = 24214;
  10771. private int emptyVialID = 229;
  10772. private int fullVialID = 227;
  10773. private int runEnergy = 50;
  10774. RSNPC banker;
  10775. RSObject fountain;
  10776. RSItem myVial;
  10777. RSTile theBank = new RSTile(3167, 3489);
  10778. RSTile theFountain = new RSTile(3191, 3471);
  10779. RSTile glitchSpot = new RSTile(3192, 3487);
  10780. RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
  10781. RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
  10782. RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
  10783. RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
  10784.  
  10785. // - GUI Options
  10786. private int min = 1;
  10787. private int max = 6;
  10788. private int minSpeed = 6;
  10789. private int maxSpeed = 9;
  10790. private boolean guiWait = true;
  10791. private boolean save = false;
  10792.  
  10793. // - State check
  10794. private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
  10795.  
  10796. // - Paint stuff
  10797. private String status = "Initializing...";
  10798. private String isRunning = "";
  10799. private int numFilled = 0;
  10800. private int vialFilledPrice;
  10801. private int vialEmptyPrice;
  10802. private int profitPrice;
  10803. private int profit;
  10804. private long startTime;
  10805. private long millis;
  10806. private long hours;
  10807. private long minutes;
  10808. private long seconds;
  10809. private float profSec = 0;
  10810. private float profHour;
  10811. private float hourlyProfit;
  10812. private int hourlyProfitInt;
  10813. private final Color color1 = new Color(0, 0, 0);
  10814. private final Color color2 = new Color(255, 255, 255);
  10815. private final BasicStroke stroke1 = new BasicStroke(1);
  10816. private final Font font1 = new Font("Arial", 0, 13);
  10817. private final Font font2 = new Font("Arial", 1, 13);
  10818. private final Font font3 = new Font("Vijaya", 1, 17);
  10819. private boolean antiban = true;
  10820. gui g = new gui();
  10821.  
  10822. @Override
  10823. public boolean onStart(){
  10824. log("Welcome to Painlaws's Vial Filler");
  10825. log("Waiting on GUI...");
  10826. g.setVisible(true);
  10827. while(guiWait){
  10828. sleep(500);
  10829. }
  10830. log("GUI Settings loaded!");
  10831. if(walking.isRunEnabled()){
  10832. isRunning = "Yes";
  10833. }
  10834. else{
  10835. isRunning = "No";
  10836. }
  10837. vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
  10838. vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
  10839. profitPrice = vialFilledPrice - vialEmptyPrice;
  10840. if(!save){
  10841. startTime = System.currentTimeMillis();
  10842. }
  10843. else{
  10844. startTime = 0;
  10845. }
  10846. return true;
  10847. }
  10848.  
  10849. @Override
  10850. public void onFinish(){
  10851. env.saveScreenshot(true);
  10852. log("^ Don't forget to upload this proggie :P");
  10853. log("Bye! PM Painlaws for comments/questions/requests");
  10854. }
  10855.  
  10856. public void useItem(RSItem item, RSObject object){
  10857. if(item != null && object != null && object.isOnScreen()){
  10858. item.doClick(true);
  10859. sleep(200, 300);
  10860. object.doClick();
  10861. }
  10862. }
  10863.  
  10864. public void fillVials(){
  10865. if(fountain != null){
  10866. status = "Filling Vials";
  10867. useItem(myVial, fountain);
  10868. while(inventory.contains(emptyVialID)){
  10869. sleep(random(1000,1500));
  10870. if(antiban){
  10871. if(random(1, 3) == 2){
  10872. mouse.moveSlightly();
  10873. }
  10874. }
  10875. }
  10876. status = "Vials filled";
  10877. }
  10878. else{
  10879. status = "Fountain is null...retrying";
  10880. sleep(random(600, 800));
  10881. }
  10882. }
  10883.  
  10884. private void doBank(){
  10885. try{
  10886. if(banker != null){
  10887. camera.turnTo(banker);
  10888. if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
  10889. status = "Opening Bank";
  10890. banker.interact("Bank Banker");
  10891. status = "Bank opened";
  10892. sleep(random(900, 1050));
  10893. status = "Depositing All";
  10894. bank.depositAll();
  10895. status = "Deposited All";
  10896. sleep(random(780, 950));
  10897. numFilled = bank.getCount(fullVialID);
  10898. if(bank.getCount(emptyVialID) != 0){
  10899. status = "Taking Vials";
  10900. bank.withdraw(emptyVialID, 0);
  10901. status = "Vials Taken";
  10902. sleep(random(700, 960));
  10903. }
  10904. else{
  10905. log("Out of vials. Quitting :/");
  10906. bank.close();
  10907. env.saveScreenshot(true);
  10908. log("^ Don't forget to upload this proggie :P");
  10909. log("Bye! PM Painlaws for comments/questions/requests");
  10910. stopScript(true);
  10911. }
  10912. status = "Closing Bank";
  10913. bank.close();
  10914. status = "Bank Closed";
  10915. sleep(random(750, 910));
  10916. }
  10917. }
  10918. sleep(random(300,500));
  10919. }catch(Exception e){log(e);}
  10920. }
  10921.  
  10922. public void onToBank(){
  10923. try{
  10924. status = "Going to Bank";
  10925. walking.walkTileMM(theBank);
  10926. }catch(Exception e){log(e);}
  10927. sleep(random(500, 700));
  10928. }
  10929.  
  10930. public void onToGlitch(){
  10931. try{
  10932. status = "Going to Fountain"; //What you don't know can't hurt you :P
  10933. walking.walkTileMM(glitchSpot);
  10934. }catch(Exception e){log(e);}
  10935. sleep(random(500, 710));
  10936. }
  10937.  
  10938. public void onToFountain(){
  10939. try{
  10940. status = "Going to Fountain";
  10941. walking.walkTileMM(theFountain);
  10942. }catch(Exception e){log(e);}
  10943. sleep(random(500, 705));
  10944. }
  10945.  
  10946. public void runcheck() {
  10947. try{
  10948. runEnergy = (random(50, 70));
  10949. if (walking.isRunEnabled()){
  10950. isRunning = "Yes";
  10951. }
  10952. else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
  10953. walking.setRun(true);
  10954. isRunning = "Yes";
  10955. sleep(random(300, 500));
  10956. }
  10957. else{
  10958. isRunning = "No";
  10959. sleep(random(300,500));
  10960. }
  10961. }catch(Exception ex){}
  10962. }
  10963.  
  10964. @Override
  10965. public int loop(){
  10966. mouse.setSpeed(random(minSpeed, maxSpeed));
  10967. runcheck();
  10968. if(antiban){
  10969. if(random(min, max) == 3){
  10970. antiban();
  10971. }
  10972. }
  10973. if(objects.getNearest(fountainID) != null){
  10974. fountain = objects.getNearest(fountainID);
  10975. }
  10976. if(npcs.getNearest(bankerID) != null){
  10977. banker = npcs.getNearest(bankerID);
  10978. }
  10979. if(inventory.getItem(emptyVialID) != null){
  10980. myVial = inventory.getItem(emptyVialID);
  10981. }
  10982. switch(getState()){
  10983. case TOFOUNTAIN:
  10984. runcheck();
  10985. onToFountain();
  10986. if(fountainRange.contains(players.getMyPlayer().getLocation())){
  10987. fillVials();
  10988. }
  10989. break;
  10990.  
  10991. case TOGLITCH:
  10992. runcheck();
  10993. onToGlitch();
  10994. break;
  10995.  
  10996. case TOBANK:
  10997. runcheck();
  10998. onToBank();
  10999. if(bankRange.contains(players.getMyPlayer().getLocation())){
  11000. doBank();
  11001. }
  11002. break;
  11003. }
  11004. return(random(500, 1000));
  11005. }
  11006.  
  11007. private State getState() {
  11008. if (!inventory.contains(emptyVialID)) {
  11009. return State.TOBANK;
  11010. }
  11011. else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
  11012. return State.TOGLITCH;
  11013. }
  11014. else{
  11015. return State.TOFOUNTAIN;
  11016. }
  11017. }
  11018.  
  11019. // GUI and Mouse
  11020. public void onRepaint(Graphics g1) {
  11021. profit = numFilled * profitPrice;
  11022. if(!save){
  11023. millis = System.currentTimeMillis() - startTime;
  11024. hours = millis / (1000 * 60 * 60);
  11025. millis -= hours * (1000 * 60 * 60);
  11026. minutes = millis / (1000 * 60);
  11027. millis -= minutes * (1000 * 60);
  11028. seconds = millis / 1000;
  11029.  
  11030. if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
  11031. profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
  11032. }
  11033. profHour = profSec * 3600;
  11034. hourlyProfit = profHour * profitPrice;
  11035. hourlyProfitInt = Math.round(hourlyProfit);
  11036. }
  11037. else{
  11038. millis = 0;
  11039. hours = 0;
  11040. minutes = 0;
  11041. seconds = 0;
  11042. hourlyProfitInt = 9001;
  11043. }
  11044.  
  11045. Graphics2D g = (Graphics2D)g1;
  11046. g.setColor(color1);
  11047. g.fillRect(7, 345, 488, 70);
  11048. g.setStroke(stroke1);
  11049. g.drawRect(7, 345, 488, 70);
  11050. g.setFont(font1);
  11051. g.setColor(color2);
  11052. g.drawString("Status:", 14, 362);
  11053. g.setFont(font2);
  11054. g.drawString(status, 59, 362);
  11055. g.setFont(font1);
  11056. g.drawString("Filled Vials In Bank:", 209, 362);
  11057. g.setFont(font2);
  11058. g.drawString(Integer.toString(numFilled), 328, 362);
  11059. g.setFont(font1);
  11060. g.drawString("Profit:", 14, 383);
  11061. g.setFont(font2);
  11062. g.drawString(Integer.toString(profit), 59, 383);
  11063. g.setFont(font1);
  11064. g.drawString("Profit/hr:", 137, 383);
  11065. g.setFont(font2);
  11066. if(!save){
  11067. g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
  11068. }
  11069. else{
  11070. g.drawString("Mem Save", 190, 383);
  11071. }
  11072. g.setFont(font1);
  11073. g.drawString("Runtime:", 270, 383);
  11074. g.setFont(font2);
  11075. if(!save){
  11076. g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
  11077. }
  11078. else{
  11079. g.drawString("Mem Save", 325, 384);
  11080. }
  11081. g.setFont(font1);
  11082. g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
  11083. g.drawString("Running:", 710, 139);
  11084. g.setFont(font2);
  11085. g.drawString(isRunning, 722, 156);
  11086. g.setFont(font3);
  11087. g.drawString("Painlaws", 440, 357);
  11088.  
  11089. g1.setColor(Color.green);
  11090. g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
  11091. g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
  11092. }
  11093.  
  11094. /* Antiban stuff
  11095. * Some credits to Aaimister :)
  11096. * Partially copied, with permission
  11097. */
  11098.  
  11099. public void rotateCamera() {
  11100. final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  11101. final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  11102. final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  11103. KeyEvent.VK_UP, KeyEvent.VK_UP };
  11104. final int randomLR = random(0, 2);
  11105. final int randomUD = random(0, 2);
  11106. final int randomAll = random(0, 4);
  11107. if (random(0, 3) == 0) {
  11108. keyboard.pressKey(LR[randomLR]);
  11109. sleepCR(random(2, 9));
  11110. keyboard.pressKey(UD[randomUD]);
  11111. sleepCR(random(6, 10));
  11112. keyboard.releaseKey(UD[randomUD]);
  11113. sleepCR(random(2, 7));
  11114. keyboard.releaseKey(LR[randomLR]);
  11115. } else {
  11116. keyboard.pressKey(LRUD[randomAll]);
  11117. if (randomAll > 1) {
  11118. sleepCR(random(6, 11));
  11119. } else {
  11120. sleepCR(random(9, 12));
  11121. }
  11122. keyboard.releaseKey(LRUD[randomAll]);
  11123. }
  11124. }
  11125.  
  11126. private boolean sleepCR(final int amtOfHalfSecs) {
  11127. for (int x = 0; x < amtOfHalfSecs + 1; x++) {
  11128. sleep(random(48, 53));
  11129. }
  11130. return true;
  11131. }
  11132.  
  11133. private void antiban(){
  11134. int action = random(0, 5);
  11135.  
  11136. switch (action) {
  11137. case 0:
  11138. status = "Antiban";
  11139. rotateCamera();
  11140. sleep(200, 400);
  11141. break;
  11142. case 1:
  11143. status = "Antiban";
  11144. mouse.moveRandomly(100, 900);
  11145. sleep(200, 400);
  11146. break;
  11147. case 2:
  11148. status = "Antiban";
  11149. mouse.moveSlightly();
  11150. sleep(200, 400);
  11151. break;
  11152. case 3:
  11153. status = "Antiban";
  11154. camera.moveRandomly(random(750,1250));
  11155. sleep(200, 400);
  11156. break;
  11157. case 4:
  11158. status = "Antiban";
  11159. checkEXP();
  11160. sleep(200, 400);
  11161. break;
  11162. case 5:
  11163. status = "Antiban";
  11164. mouse.moveOffScreen();
  11165. sleep(200, 400);
  11166. break;
  11167. }
  11168. }
  11169.  
  11170. public void checkEXP() {
  11171. game.openTab(Game.Tab.STATS);
  11172. skills.doHover(Skills.INTERFACE_PRAYER);
  11173. sleep(random(2100, 3400));
  11174. game.openTab(Game.Tab.INVENTORY);
  11175. sleep(random(540,760));
  11176. }
  11177.  
  11178.  
  11179. class gui extends JFrame {
  11180. /**
  11181. *
  11182. */
  11183. private static final long serialVersionUID = 1L;
  11184. public gui() {
  11185. initComponents();
  11186. }
  11187.  
  11188. private void startButtonActionPerformed(ActionEvent e){
  11189. String mode = selectionBox.getSelectedItem().toString();
  11190. if(mode.equals("Maximum")){
  11191. antiban = false;
  11192. minSpeed = 5;
  11193. maxSpeed = 6;
  11194. }
  11195. else if(mode.equals("Paranoid")){
  11196. antiban = true;
  11197. minSpeed = 8;
  11198. maxSpeed = 10;
  11199. min = 3;
  11200. max = 3;
  11201.  
  11202. }
  11203. save = memoryMode.isSelected();
  11204. guiWait = false;
  11205. g.dispose();
  11206. }
  11207.  
  11208. private void initComponents() {
  11209. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  11210. label1 = new JLabel();
  11211. selectionBox = new JComboBox();
  11212. memoryMode = new JCheckBox();
  11213. label2 = new JLabel();
  11214. label3 = new JLabel();
  11215. label4 = new JLabel();
  11216. label5 = new JLabel();
  11217. startButton = new JButton();
  11218.  
  11219. //======== this ========
  11220. setTitle("Painlaws's Vial Filler");
  11221. setResizable(false);
  11222. Container contentPane = getContentPane();
  11223.  
  11224. //---- label1 ----
  11225. label1.setText("Mode");
  11226.  
  11227. //---- selectionBox ----
  11228. selectionBox.setModel(new DefaultComboBoxModel(new String[] {
  11229. "Normal",
  11230. "Paranoid",
  11231. "Maximum"
  11232. }));
  11233.  
  11234. //---- memoryMode ----
  11235. memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
  11236.  
  11237. //---- label2 ----
  11238. label2.setText("Modes:");
  11239.  
  11240. //---- label3 ----
  11241. label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
  11242.  
  11243. //---- label4 ----
  11244. label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
  11245.  
  11246. //---- label5 ----
  11247. label5.setText("Maximum - No Antiban, Fast Mouse Speed");
  11248.  
  11249. //---- startButton ----
  11250. startButton.setText("Let's Fill Some Vials!");
  11251. startButton.addActionListener(new ActionListener() {
  11252. public void actionPerformed(ActionEvent e){
  11253. startButtonActionPerformed(e);
  11254. }
  11255. });
  11256.  
  11257. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  11258. contentPane.setLayout(contentPaneLayout);
  11259. contentPaneLayout.setHorizontalGroup(
  11260. contentPaneLayout.createParallelGroup()
  11261. .addGroup(contentPaneLayout.createSequentialGroup()
  11262. .addGroup(contentPaneLayout.createParallelGroup()
  11263. .addGroup(contentPaneLayout.createSequentialGroup()
  11264. .addContainerGap()
  11265. .addGroup(contentPaneLayout.createParallelGroup()
  11266. .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  11267. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  11268. .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  11269. .addGroup(contentPaneLayout.createSequentialGroup()
  11270. .addComponent(label1)
  11271. .addGap(18, 18, 18)
  11272. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  11273. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  11274. .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  11275. .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  11276. .addGroup(contentPaneLayout.createSequentialGroup()
  11277. .addGap(148, 148, 148)
  11278. .addComponent(startButton)))
  11279. .addContainerGap(2, Short.MAX_VALUE))
  11280. );
  11281. contentPaneLayout.setVerticalGroup(
  11282. contentPaneLayout.createParallelGroup()
  11283. .addGroup(contentPaneLayout.createSequentialGroup()
  11284. .addContainerGap()
  11285. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  11286. .addComponent(label1)
  11287. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  11288. .addGap(18, 18, 18)
  11289. .addComponent(memoryMode)
  11290. .addGap(18, 18, 18)
  11291. .addComponent(label2)
  11292. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  11293. .addComponent(label3)
  11294. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  11295. .addComponent(label4)
  11296. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  11297. .addComponent(label5)
  11298. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
  11299. .addComponent(startButton)
  11300. .addContainerGap())
  11301. );
  11302. pack();
  11303. setLocationRelativeTo(getOwner());
  11304. // JFormDesigner - End of component initialization //GEN-END:initComponents
  11305. }
  11306.  
  11307. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  11308. private JLabel label1;
  11309. private JComboBox selectionBox;
  11310. private JCheckBox memoryMode;
  11311. private JLabel label2;
  11312. private JLabel label3;
  11313. private JLabel label4;
  11314. private JLabel label5;
  11315. private JButton startButton;
  11316. // JFormDesigner - End of variables declaration //GEN-END:variables
  11317. }
  11318.  
  11319.  
  11320. }
  11321. import java.awt.*;
  11322. import java.awt.event.*;
  11323. import javax.swing.*;
  11324. import java.awt.event.KeyEvent;
  11325. import org.rsbot.event.listeners.PaintListener;
  11326. import org.rsbot.script.Script;
  11327. import org.rsbot.script.ScriptManifest;
  11328. import org.rsbot.script.methods.*;
  11329. import org.rsbot.script.wrappers.*;
  11330.  
  11331. @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
  11332. public class vialfiller extends Script implements PaintListener{
  11333. //Variables
  11334. // - Essentials
  11335. private int bankerID = 6533;
  11336. private int fountainID = 24214;
  11337. private int emptyVialID = 229;
  11338. private int fullVialID = 227;
  11339. private int runEnergy = 50;
  11340. RSNPC banker;
  11341. RSObject fountain;
  11342. RSItem myVial;
  11343. RSTile theBank = new RSTile(3167, 3489);
  11344. RSTile theFountain = new RSTile(3191, 3471);
  11345. RSTile glitchSpot = new RSTile(3192, 3487);
  11346. RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
  11347. RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
  11348. RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
  11349. RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
  11350.  
  11351. // - GUI Options
  11352. private int min = 1;
  11353. private int max = 6;
  11354. private int minSpeed = 6;
  11355. private int maxSpeed = 9;
  11356. private boolean guiWait = true;
  11357. private boolean save = false;
  11358.  
  11359. // - State check
  11360. private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
  11361.  
  11362. // - Paint stuff
  11363. private String status = "Initializing...";
  11364. private String isRunning = "";
  11365. private int numFilled = 0;
  11366. private int vialFilledPrice;
  11367. private int vialEmptyPrice;
  11368. private int profitPrice;
  11369. private int profit;
  11370. private long startTime;
  11371. private long millis;
  11372. private long hours;
  11373. private long minutes;
  11374. private long seconds;
  11375. private float profSec = 0;
  11376. private float profHour;
  11377. private float hourlyProfit;
  11378. private int hourlyProfitInt;
  11379. private final Color color1 = new Color(0, 0, 0);
  11380. private final Color color2 = new Color(255, 255, 255);
  11381. private final BasicStroke stroke1 = new BasicStroke(1);
  11382. private final Font font1 = new Font("Arial", 0, 13);
  11383. private final Font font2 = new Font("Arial", 1, 13);
  11384. private final Font font3 = new Font("Vijaya", 1, 17);
  11385. private boolean antiban = true;
  11386. gui g = new gui();
  11387.  
  11388. @Override
  11389. public boolean onStart(){
  11390. log("Welcome to Painlaws's Vial Filler");
  11391. log("Waiting on GUI...");
  11392. g.setVisible(true);
  11393. while(guiWait){
  11394. sleep(500);
  11395. }
  11396. log("GUI Settings loaded!");
  11397. if(walking.isRunEnabled()){
  11398. isRunning = "Yes";
  11399. }
  11400. else{
  11401. isRunning = "No";
  11402. }
  11403. vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
  11404. vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
  11405. profitPrice = vialFilledPrice - vialEmptyPrice;
  11406. if(!save){
  11407. startTime = System.currentTimeMillis();
  11408. }
  11409. else{
  11410. startTime = 0;
  11411. }
  11412. return true;
  11413. }
  11414.  
  11415. @Override
  11416. public void onFinish(){
  11417. env.saveScreenshot(true);
  11418. log("^ Don't forget to upload this proggie :P");
  11419. log("Bye! PM Painlaws for comments/questions/requests");
  11420. }
  11421.  
  11422. public void useItem(RSItem item, RSObject object){
  11423. if(item != null && object != null && object.isOnScreen()){
  11424. item.doClick(true);
  11425. sleep(200, 300);
  11426. object.doClick();
  11427. }
  11428. }
  11429.  
  11430. public void fillVials(){
  11431. if(fountain != null){
  11432. status = "Filling Vials";
  11433. useItem(myVial, fountain);
  11434. while(inventory.contains(emptyVialID)){
  11435. sleep(random(1000,1500));
  11436. if(antiban){
  11437. if(random(1, 3) == 2){
  11438. mouse.moveSlightly();
  11439. }
  11440. }
  11441. }
  11442. status = "Vials filled";
  11443. }
  11444. else{
  11445. status = "Fountain is null...retrying";
  11446. sleep(random(600, 800));
  11447. }
  11448. }
  11449.  
  11450. private void doBank(){
  11451. try{
  11452. if(banker != null){
  11453. camera.turnTo(banker);
  11454. if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
  11455. status = "Opening Bank";
  11456. banker.interact("Bank Banker");
  11457. status = "Bank opened";
  11458. sleep(random(900, 1050));
  11459. status = "Depositing All";
  11460. bank.depositAll();
  11461. status = "Deposited All";
  11462. sleep(random(780, 950));
  11463. numFilled = bank.getCount(fullVialID);
  11464. if(bank.getCount(emptyVialID) != 0){
  11465. status = "Taking Vials";
  11466. bank.withdraw(emptyVialID, 0);
  11467. status = "Vials Taken";
  11468. sleep(random(700, 960));
  11469. }
  11470. else{
  11471. log("Out of vials. Quitting :/");
  11472. bank.close();
  11473. env.saveScreenshot(true);
  11474. log("^ Don't forget to upload this proggie :P");
  11475. log("Bye! PM Painlaws for comments/questions/requests");
  11476. stopScript(true);
  11477. }
  11478. status = "Closing Bank";
  11479. bank.close();
  11480. status = "Bank Closed";
  11481. sleep(random(750, 910));
  11482. }
  11483. }
  11484. sleep(random(300,500));
  11485. }catch(Exception e){log(e);}
  11486. }
  11487.  
  11488. public void onToBank(){
  11489. try{
  11490. status = "Going to Bank";
  11491. walking.walkTileMM(theBank);
  11492. }catch(Exception e){log(e);}
  11493. sleep(random(500, 700));
  11494. }
  11495.  
  11496. public void onToGlitch(){
  11497. try{
  11498. status = "Going to Fountain"; //What you don't know can't hurt you :P
  11499. walking.walkTileMM(glitchSpot);
  11500. }catch(Exception e){log(e);}
  11501. sleep(random(500, 710));
  11502. }
  11503.  
  11504. public void onToFountain(){
  11505. try{
  11506. status = "Going to Fountain";
  11507. walking.walkTileMM(theFountain);
  11508. }catch(Exception e){log(e);}
  11509. sleep(random(500, 705));
  11510. }
  11511.  
  11512. public void runcheck() {
  11513. try{
  11514. runEnergy = (random(50, 70));
  11515. if (walking.isRunEnabled()){
  11516. isRunning = "Yes";
  11517. }
  11518. else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
  11519. walking.setRun(true);
  11520. isRunning = "Yes";
  11521. sleep(random(300, 500));
  11522. }
  11523. else{
  11524. isRunning = "No";
  11525. sleep(random(300,500));
  11526. }
  11527. }catch(Exception ex){}
  11528. }
  11529.  
  11530. @Override
  11531. public int loop(){
  11532. mouse.setSpeed(random(minSpeed, maxSpeed));
  11533. runcheck();
  11534. if(antiban){
  11535. if(random(min, max) == 3){
  11536. antiban();
  11537. }
  11538. }
  11539. if(objects.getNearest(fountainID) != null){
  11540. fountain = objects.getNearest(fountainID);
  11541. }
  11542. if(npcs.getNearest(bankerID) != null){
  11543. banker = npcs.getNearest(bankerID);
  11544. }
  11545. if(inventory.getItem(emptyVialID) != null){
  11546. myVial = inventory.getItem(emptyVialID);
  11547. }
  11548. switch(getState()){
  11549. case TOFOUNTAIN:
  11550. runcheck();
  11551. onToFountain();
  11552. if(fountainRange.contains(players.getMyPlayer().getLocation())){
  11553. fillVials();
  11554. }
  11555. break;
  11556.  
  11557. case TOGLITCH:
  11558. runcheck();
  11559. onToGlitch();
  11560. break;
  11561.  
  11562. case TOBANK:
  11563. runcheck();
  11564. onToBank();
  11565. if(bankRange.contains(players.getMyPlayer().getLocation())){
  11566. doBank();
  11567. }
  11568. break;
  11569. }
  11570. return(random(500, 1000));
  11571. }
  11572.  
  11573. private State getState() {
  11574. if (!inventory.contains(emptyVialID)) {
  11575. return State.TOBANK;
  11576. }
  11577. else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
  11578. return State.TOGLITCH;
  11579. }
  11580. else{
  11581. return State.TOFOUNTAIN;
  11582. }
  11583. }
  11584.  
  11585. // GUI and Mouse
  11586. public void onRepaint(Graphics g1) {
  11587. profit = numFilled * profitPrice;
  11588. if(!save){
  11589. millis = System.currentTimeMillis() - startTime;
  11590. hours = millis / (1000 * 60 * 60);
  11591. millis -= hours * (1000 * 60 * 60);
  11592. minutes = millis / (1000 * 60);
  11593. millis -= minutes * (1000 * 60);
  11594. seconds = millis / 1000;
  11595.  
  11596. if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
  11597. profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
  11598. }
  11599. profHour = profSec * 3600;
  11600. hourlyProfit = profHour * profitPrice;
  11601. hourlyProfitInt = Math.round(hourlyProfit);
  11602. }
  11603. else{
  11604. millis = 0;
  11605. hours = 0;
  11606. minutes = 0;
  11607. seconds = 0;
  11608. hourlyProfitInt = 9001;
  11609. }
  11610.  
  11611. Graphics2D g = (Graphics2D)g1;
  11612. g.setColor(color1);
  11613. g.fillRect(7, 345, 488, 70);
  11614. g.setStroke(stroke1);
  11615. g.drawRect(7, 345, 488, 70);
  11616. g.setFont(font1);
  11617. g.setColor(color2);
  11618. g.drawString("Status:", 14, 362);
  11619. g.setFont(font2);
  11620. g.drawString(status, 59, 362);
  11621. g.setFont(font1);
  11622. g.drawString("Filled Vials In Bank:", 209, 362);
  11623. g.setFont(font2);
  11624. g.drawString(Integer.toString(numFilled), 328, 362);
  11625. g.setFont(font1);
  11626. g.drawString("Profit:", 14, 383);
  11627. g.setFont(font2);
  11628. g.drawString(Integer.toString(profit), 59, 383);
  11629. g.setFont(font1);
  11630. g.drawString("Profit/hr:", 137, 383);
  11631. g.setFont(font2);
  11632. if(!save){
  11633. g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
  11634. }
  11635. else{
  11636. g.drawString("Mem Save", 190, 383);
  11637. }
  11638. g.setFont(font1);
  11639. g.drawString("Runtime:", 270, 383);
  11640. g.setFont(font2);
  11641. if(!save){
  11642. g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
  11643. }
  11644. else{
  11645. g.drawString("Mem Save", 325, 384);
  11646. }
  11647. g.setFont(font1);
  11648. g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
  11649. g.drawString("Running:", 710, 139);
  11650. g.setFont(font2);
  11651. g.drawString(isRunning, 722, 156);
  11652. g.setFont(font3);
  11653. g.drawString("Painlaws", 440, 357);
  11654.  
  11655. g1.setColor(Color.green);
  11656. g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
  11657. g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
  11658. }
  11659.  
  11660. /* Antiban stuff
  11661. * Some credits to Aaimister :)
  11662. * Partially copied, with permission
  11663. */
  11664.  
  11665. public void rotateCamera() {
  11666. final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  11667. final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  11668. final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  11669. KeyEvent.VK_UP, KeyEvent.VK_UP };
  11670. final int randomLR = random(0, 2);
  11671. final int randomUD = random(0, 2);
  11672. final int randomAll = random(0, 4);
  11673. if (random(0, 3) == 0) {
  11674. keyboard.pressKey(LR[randomLR]);
  11675. sleepCR(random(2, 9));
  11676. keyboard.pressKey(UD[randomUD]);
  11677. sleepCR(random(6, 10));
  11678. keyboard.releaseKey(UD[randomUD]);
  11679. sleepCR(random(2, 7));
  11680. keyboard.releaseKey(LR[randomLR]);
  11681. } else {
  11682. keyboard.pressKey(LRUD[randomAll]);
  11683. if (randomAll > 1) {
  11684. sleepCR(random(6, 11));
  11685. } else {
  11686. sleepCR(random(9, 12));
  11687. }
  11688. keyboard.releaseKey(LRUD[randomAll]);
  11689. }
  11690. }
  11691.  
  11692. private boolean sleepCR(final int amtOfHalfSecs) {
  11693. for (int x = 0; x < amtOfHalfSecs + 1; x++) {
  11694. sleep(random(48, 53));
  11695. }
  11696. return true;
  11697. }
  11698.  
  11699. private void antiban(){
  11700. int action = random(0, 5);
  11701.  
  11702. switch (action) {
  11703. case 0:
  11704. status = "Antiban";
  11705. rotateCamera();
  11706. sleep(200, 400);
  11707. break;
  11708. case 1:
  11709. status = "Antiban";
  11710. mouse.moveRandomly(100, 900);
  11711. sleep(200, 400);
  11712. break;
  11713. case 2:
  11714. status = "Antiban";
  11715. mouse.moveSlightly();
  11716. sleep(200, 400);
  11717. break;
  11718. case 3:
  11719. status = "Antiban";
  11720. camera.moveRandomly(random(750,1250));
  11721. sleep(200, 400);
  11722. break;
  11723. case 4:
  11724. status = "Antiban";
  11725. checkEXP();
  11726. sleep(200, 400);
  11727. break;
  11728. case 5:
  11729. status = "Antiban";
  11730. mouse.moveOffScreen();
  11731. sleep(200, 400);
  11732. break;
  11733. }
  11734. }
  11735.  
  11736. public void checkEXP() {
  11737. game.openTab(Game.Tab.STATS);
  11738. skills.doHover(Skills.INTERFACE_PRAYER);
  11739. sleep(random(2100, 3400));
  11740. game.openTab(Game.Tab.INVENTORY);
  11741. sleep(random(540,760));
  11742. }
  11743.  
  11744.  
  11745. class gui extends JFrame {
  11746. /**
  11747. *
  11748. */
  11749. private static final long serialVersionUID = 1L;
  11750. public gui() {
  11751. initComponents();
  11752. }
  11753.  
  11754. private void startButtonActionPerformed(ActionEvent e){
  11755. String mode = selectionBox.getSelectedItem().toString();
  11756. if(mode.equals("Maximum")){
  11757. antiban = false;
  11758. minSpeed = 5;
  11759. maxSpeed = 6;
  11760. }
  11761. else if(mode.equals("Paranoid")){
  11762. antiban = true;
  11763. minSpeed = 8;
  11764. maxSpeed = 10;
  11765. min = 3;
  11766. max = 3;
  11767.  
  11768. }
  11769. save = memoryMode.isSelected();
  11770. guiWait = false;
  11771. g.dispose();
  11772. }
  11773.  
  11774. private void initComponents() {
  11775. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  11776. label1 = new JLabel();
  11777. selectionBox = new JComboBox();
  11778. memoryMode = new JCheckBox();
  11779. label2 = new JLabel();
  11780. label3 = new JLabel();
  11781. label4 = new JLabel();
  11782. label5 = new JLabel();
  11783. startButton = new JButton();
  11784.  
  11785. //======== this ========
  11786. setTitle("Painlaws's Vial Filler");
  11787. setResizable(false);
  11788. Container contentPane = getContentPane();
  11789.  
  11790. //---- label1 ----
  11791. label1.setText("Mode");
  11792.  
  11793. //---- selectionBox ----
  11794. selectionBox.setModel(new DefaultComboBoxModel(new String[] {
  11795. "Normal",
  11796. "Paranoid",
  11797. "Maximum"
  11798. }));
  11799.  
  11800. //---- memoryMode ----
  11801. memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
  11802.  
  11803. //---- label2 ----
  11804. label2.setText("Modes:");
  11805.  
  11806. //---- label3 ----
  11807. label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
  11808.  
  11809. //---- label4 ----
  11810. label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
  11811.  
  11812. //---- label5 ----
  11813. label5.setText("Maximum - No Antiban, Fast Mouse Speed");
  11814.  
  11815. //---- startButton ----
  11816. startButton.setText("Let's Fill Some Vials!");
  11817. startButton.addActionListener(new ActionListener() {
  11818. public void actionPerformed(ActionEvent e){
  11819. startButtonActionPerformed(e);
  11820. }
  11821. });
  11822.  
  11823. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  11824. contentPane.setLayout(contentPaneLayout);
  11825. contentPaneLayout.setHorizontalGroup(
  11826. contentPaneLayout.createParallelGroup()
  11827. .addGroup(contentPaneLayout.createSequentialGroup()
  11828. .addGroup(contentPaneLayout.createParallelGroup()
  11829. .addGroup(contentPaneLayout.createSequentialGroup()
  11830. .addContainerGap()
  11831. .addGroup(contentPaneLayout.createParallelGroup()
  11832. .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  11833. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  11834. .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  11835. .addGroup(contentPaneLayout.createSequentialGroup()
  11836. .addComponent(label1)
  11837. .addGap(18, 18, 18)
  11838. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  11839. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  11840. .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  11841. .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  11842. .addGroup(contentPaneLayout.createSequentialGroup()
  11843. .addGap(148, 148, 148)
  11844. .addComponent(startButton)))
  11845. .addContainerGap(2, Short.MAX_VALUE))
  11846. );
  11847. contentPaneLayout.setVerticalGroup(
  11848. contentPaneLayout.createParallelGroup()
  11849. .addGroup(contentPaneLayout.createSequentialGroup()
  11850. .addContainerGap()
  11851. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  11852. .addComponent(label1)
  11853. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  11854. .addGap(18, 18, 18)
  11855. .addComponent(memoryMode)
  11856. .addGap(18, 18, 18)
  11857. .addComponent(label2)
  11858. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  11859. .addComponent(label3)
  11860. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  11861. .addComponent(label4)
  11862. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  11863. .addComponent(label5)
  11864. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
  11865. .addComponent(startButton)
  11866. .addContainerGap())
  11867. );
  11868. pack();
  11869. setLocationRelativeTo(getOwner());
  11870. // JFormDesigner - End of component initialization //GEN-END:initComponents
  11871. }
  11872.  
  11873. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  11874. private JLabel label1;
  11875. private JComboBox selectionBox;
  11876. private JCheckBox memoryMode;
  11877. private JLabel label2;
  11878. private JLabel label3;
  11879. private JLabel label4;
  11880. private JLabel label5;
  11881. private JButton startButton;
  11882. // JFormDesigner - End of variables declaration //GEN-END:variables
  11883. }
  11884.  
  11885.  
  11886. }
  11887. import java.awt.*;
  11888. import java.awt.event.*;
  11889. import javax.swing.*;
  11890. import java.awt.event.KeyEvent;
  11891. import org.rsbot.event.listeners.PaintListener;
  11892. import org.rsbot.script.Script;
  11893. import org.rsbot.script.ScriptManifest;
  11894. import org.rsbot.script.methods.*;
  11895. import org.rsbot.script.wrappers.*;
  11896.  
  11897. @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
  11898. public class vialfiller extends Script implements PaintListener{
  11899. //Variables
  11900. // - Essentials
  11901. private int bankerID = 6533;
  11902. private int fountainID = 24214;
  11903. private int emptyVialID = 229;
  11904. private int fullVialID = 227;
  11905. private int runEnergy = 50;
  11906. RSNPC banker;
  11907. RSObject fountain;
  11908. RSItem myVial;
  11909. RSTile theBank = new RSTile(3167, 3489);
  11910. RSTile theFountain = new RSTile(3191, 3471);
  11911. RSTile glitchSpot = new RSTile(3192, 3487);
  11912. RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
  11913. RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
  11914. RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
  11915. RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
  11916.  
  11917. // - GUI Options
  11918. private int min = 1;
  11919. private int max = 6;
  11920. private int minSpeed = 6;
  11921. private int maxSpeed = 9;
  11922. private boolean guiWait = true;
  11923. private boolean save = false;
  11924.  
  11925. // - State check
  11926. private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
  11927.  
  11928. // - Paint stuff
  11929. private String status = "Initializing...";
  11930. private String isRunning = "";
  11931. private int numFilled = 0;
  11932. private int vialFilledPrice;
  11933. private int vialEmptyPrice;
  11934. private int profitPrice;
  11935. private int profit;
  11936. private long startTime;
  11937. private long millis;
  11938. private long hours;
  11939. private long minutes;
  11940. private long seconds;
  11941. private float profSec = 0;
  11942. private float profHour;
  11943. private float hourlyProfit;
  11944. private int hourlyProfitInt;
  11945. private final Color color1 = new Color(0, 0, 0);
  11946. private final Color color2 = new Color(255, 255, 255);
  11947. private final BasicStroke stroke1 = new BasicStroke(1);
  11948. private final Font font1 = new Font("Arial", 0, 13);
  11949. private final Font font2 = new Font("Arial", 1, 13);
  11950. private final Font font3 = new Font("Vijaya", 1, 17);
  11951. private boolean antiban = true;
  11952. gui g = new gui();
  11953.  
  11954. @Override
  11955. public boolean onStart(){
  11956. log("Welcome to Painlaws's Vial Filler");
  11957. log("Waiting on GUI...");
  11958. g.setVisible(true);
  11959. while(guiWait){
  11960. sleep(500);
  11961. }
  11962. log("GUI Settings loaded!");
  11963. if(walking.isRunEnabled()){
  11964. isRunning = "Yes";
  11965. }
  11966. else{
  11967. isRunning = "No";
  11968. }
  11969. vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
  11970. vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
  11971. profitPrice = vialFilledPrice - vialEmptyPrice;
  11972. if(!save){
  11973. startTime = System.currentTimeMillis();
  11974. }
  11975. else{
  11976. startTime = 0;
  11977. }
  11978. return true;
  11979. }
  11980.  
  11981. @Override
  11982. public void onFinish(){
  11983. env.saveScreenshot(true);
  11984. log("^ Don't forget to upload this proggie :P");
  11985. log("Bye! PM Painlaws for comments/questions/requests");
  11986. }
  11987.  
  11988. public void useItem(RSItem item, RSObject object){
  11989. if(item != null && object != null && object.isOnScreen()){
  11990. item.doClick(true);
  11991. sleep(200, 300);
  11992. object.doClick();
  11993. }
  11994. }
  11995.  
  11996. public void fillVials(){
  11997. if(fountain != null){
  11998. status = "Filling Vials";
  11999. useItem(myVial, fountain);
  12000. while(inventory.contains(emptyVialID)){
  12001. sleep(random(1000,1500));
  12002. if(antiban){
  12003. if(random(1, 3) == 2){
  12004. mouse.moveSlightly();
  12005. }
  12006. }
  12007. }
  12008. status = "Vials filled";
  12009. }
  12010. else{
  12011. status = "Fountain is null...retrying";
  12012. sleep(random(600, 800));
  12013. }
  12014. }
  12015.  
  12016. private void doBank(){
  12017. try{
  12018. if(banker != null){
  12019. camera.turnTo(banker);
  12020. if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
  12021. status = "Opening Bank";
  12022. banker.interact("Bank Banker");
  12023. status = "Bank opened";
  12024. sleep(random(900, 1050));
  12025. status = "Depositing All";
  12026. bank.depositAll();
  12027. status = "Deposited All";
  12028. sleep(random(780, 950));
  12029. numFilled = bank.getCount(fullVialID);
  12030. if(bank.getCount(emptyVialID) != 0){
  12031. status = "Taking Vials";
  12032. bank.withdraw(emptyVialID, 0);
  12033. status = "Vials Taken";
  12034. sleep(random(700, 960));
  12035. }
  12036. else{
  12037. log("Out of vials. Quitting :/");
  12038. bank.close();
  12039. env.saveScreenshot(true);
  12040. log("^ Don't forget to upload this proggie :P");
  12041. log("Bye! PM Painlaws for comments/questions/requests");
  12042. stopScript(true);
  12043. }
  12044. status = "Closing Bank";
  12045. bank.close();
  12046. status = "Bank Closed";
  12047. sleep(random(750, 910));
  12048. }
  12049. }
  12050. sleep(random(300,500));
  12051. }catch(Exception e){log(e);}
  12052. }
  12053.  
  12054. public void onToBank(){
  12055. try{
  12056. status = "Going to Bank";
  12057. walking.walkTileMM(theBank);
  12058. }catch(Exception e){log(e);}
  12059. sleep(random(500, 700));
  12060. }
  12061.  
  12062. public void onToGlitch(){
  12063. try{
  12064. status = "Going to Fountain"; //What you don't know can't hurt you :P
  12065. walking.walkTileMM(glitchSpot);
  12066. }catch(Exception e){log(e);}
  12067. sleep(random(500, 710));
  12068. }
  12069.  
  12070. public void onToFountain(){
  12071. try{
  12072. status = "Going to Fountain";
  12073. walking.walkTileMM(theFountain);
  12074. }catch(Exception e){log(e);}
  12075. sleep(random(500, 705));
  12076. }
  12077.  
  12078. public void runcheck() {
  12079. try{
  12080. runEnergy = (random(50, 70));
  12081. if (walking.isRunEnabled()){
  12082. isRunning = "Yes";
  12083. }
  12084. else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
  12085. walking.setRun(true);
  12086. isRunning = "Yes";
  12087. sleep(random(300, 500));
  12088. }
  12089. else{
  12090. isRunning = "No";
  12091. sleep(random(300,500));
  12092. }
  12093. }catch(Exception ex){}
  12094. }
  12095.  
  12096. @Override
  12097. public int loop(){
  12098. mouse.setSpeed(random(minSpeed, maxSpeed));
  12099. runcheck();
  12100. if(antiban){
  12101. if(random(min, max) == 3){
  12102. antiban();
  12103. }
  12104. }
  12105. if(objects.getNearest(fountainID) != null){
  12106. fountain = objects.getNearest(fountainID);
  12107. }
  12108. if(npcs.getNearest(bankerID) != null){
  12109. banker = npcs.getNearest(bankerID);
  12110. }
  12111. if(inventory.getItem(emptyVialID) != null){
  12112. myVial = inventory.getItem(emptyVialID);
  12113. }
  12114. switch(getState()){
  12115. case TOFOUNTAIN:
  12116. runcheck();
  12117. onToFountain();
  12118. if(fountainRange.contains(players.getMyPlayer().getLocation())){
  12119. fillVials();
  12120. }
  12121. break;
  12122.  
  12123. case TOGLITCH:
  12124. runcheck();
  12125. onToGlitch();
  12126. break;
  12127.  
  12128. case TOBANK:
  12129. runcheck();
  12130. onToBank();
  12131. if(bankRange.contains(players.getMyPlayer().getLocation())){
  12132. doBank();
  12133. }
  12134. break;
  12135. }
  12136. return(random(500, 1000));
  12137. }
  12138.  
  12139. private State getState() {
  12140. if (!inventory.contains(emptyVialID)) {
  12141. return State.TOBANK;
  12142. }
  12143. else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
  12144. return State.TOGLITCH;
  12145. }
  12146. else{
  12147. return State.TOFOUNTAIN;
  12148. }
  12149. }
  12150.  
  12151. // GUI and Mouse
  12152. public void onRepaint(Graphics g1) {
  12153. profit = numFilled * profitPrice;
  12154. if(!save){
  12155. millis = System.currentTimeMillis() - startTime;
  12156. hours = millis / (1000 * 60 * 60);
  12157. millis -= hours * (1000 * 60 * 60);
  12158. minutes = millis / (1000 * 60);
  12159. millis -= minutes * (1000 * 60);
  12160. seconds = millis / 1000;
  12161.  
  12162. if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
  12163. profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
  12164. }
  12165. profHour = profSec * 3600;
  12166. hourlyProfit = profHour * profitPrice;
  12167. hourlyProfitInt = Math.round(hourlyProfit);
  12168. }
  12169. else{
  12170. millis = 0;
  12171. hours = 0;
  12172. minutes = 0;
  12173. seconds = 0;
  12174. hourlyProfitInt = 9001;
  12175. }
  12176.  
  12177. Graphics2D g = (Graphics2D)g1;
  12178. g.setColor(color1);
  12179. g.fillRect(7, 345, 488, 70);
  12180. g.setStroke(stroke1);
  12181. g.drawRect(7, 345, 488, 70);
  12182. g.setFont(font1);
  12183. g.setColor(color2);
  12184. g.drawString("Status:", 14, 362);
  12185. g.setFont(font2);
  12186. g.drawString(status, 59, 362);
  12187. g.setFont(font1);
  12188. g.drawString("Filled Vials In Bank:", 209, 362);
  12189. g.setFont(font2);
  12190. g.drawString(Integer.toString(numFilled), 328, 362);
  12191. g.setFont(font1);
  12192. g.drawString("Profit:", 14, 383);
  12193. g.setFont(font2);
  12194. g.drawString(Integer.toString(profit), 59, 383);
  12195. g.setFont(font1);
  12196. g.drawString("Profit/hr:", 137, 383);
  12197. g.setFont(font2);
  12198. if(!save){
  12199. g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
  12200. }
  12201. else{
  12202. g.drawString("Mem Save", 190, 383);
  12203. }
  12204. g.setFont(font1);
  12205. g.drawString("Runtime:", 270, 383);
  12206. g.setFont(font2);
  12207. if(!save){
  12208. g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
  12209. }
  12210. else{
  12211. g.drawString("Mem Save", 325, 384);
  12212. }
  12213. g.setFont(font1);
  12214. g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
  12215. g.drawString("Running:", 710, 139);
  12216. g.setFont(font2);
  12217. g.drawString(isRunning, 722, 156);
  12218. g.setFont(font3);
  12219. g.drawString("Painlaws", 440, 357);
  12220.  
  12221. g1.setColor(Color.green);
  12222. g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
  12223. g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
  12224. }
  12225.  
  12226. /* Antiban stuff
  12227. * Some credits to Aaimister :)
  12228. * Partially copied, with permission
  12229. */
  12230.  
  12231. public void rotateCamera() {
  12232. final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  12233. final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  12234. final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  12235. KeyEvent.VK_UP, KeyEvent.VK_UP };
  12236. final int randomLR = random(0, 2);
  12237. final int randomUD = random(0, 2);
  12238. final int randomAll = random(0, 4);
  12239. if (random(0, 3) == 0) {
  12240. keyboard.pressKey(LR[randomLR]);
  12241. sleepCR(random(2, 9));
  12242. keyboard.pressKey(UD[randomUD]);
  12243. sleepCR(random(6, 10));
  12244. keyboard.releaseKey(UD[randomUD]);
  12245. sleepCR(random(2, 7));
  12246. keyboard.releaseKey(LR[randomLR]);
  12247. } else {
  12248. keyboard.pressKey(LRUD[randomAll]);
  12249. if (randomAll > 1) {
  12250. sleepCR(random(6, 11));
  12251. } else {
  12252. sleepCR(random(9, 12));
  12253. }
  12254. keyboard.releaseKey(LRUD[randomAll]);
  12255. }
  12256. }
  12257.  
  12258. private boolean sleepCR(final int amtOfHalfSecs) {
  12259. for (int x = 0; x < amtOfHalfSecs + 1; x++) {
  12260. sleep(random(48, 53));
  12261. }
  12262. return true;
  12263. }
  12264.  
  12265. private void antiban(){
  12266. int action = random(0, 5);
  12267.  
  12268. switch (action) {
  12269. case 0:
  12270. status = "Antiban";
  12271. rotateCamera();
  12272. sleep(200, 400);
  12273. break;
  12274. case 1:
  12275. status = "Antiban";
  12276. mouse.moveRandomly(100, 900);
  12277. sleep(200, 400);
  12278. break;
  12279. case 2:
  12280. status = "Antiban";
  12281. mouse.moveSlightly();
  12282. sleep(200, 400);
  12283. break;
  12284. case 3:
  12285. status = "Antiban";
  12286. camera.moveRandomly(random(750,1250));
  12287. sleep(200, 400);
  12288. break;
  12289. case 4:
  12290. status = "Antiban";
  12291. checkEXP();
  12292. sleep(200, 400);
  12293. break;
  12294. case 5:
  12295. status = "Antiban";
  12296. mouse.moveOffScreen();
  12297. sleep(200, 400);
  12298. break;
  12299. }
  12300. }
  12301.  
  12302. public void checkEXP() {
  12303. game.openTab(Game.Tab.STATS);
  12304. skills.doHover(Skills.INTERFACE_PRAYER);
  12305. sleep(random(2100, 3400));
  12306. game.openTab(Game.Tab.INVENTORY);
  12307. sleep(random(540,760));
  12308. }
  12309.  
  12310.  
  12311. class gui extends JFrame {
  12312. /**
  12313. *
  12314. */
  12315. private static final long serialVersionUID = 1L;
  12316. public gui() {
  12317. initComponents();
  12318. }
  12319.  
  12320. private void startButtonActionPerformed(ActionEvent e){
  12321. String mode = selectionBox.getSelectedItem().toString();
  12322. if(mode.equals("Maximum")){
  12323. antiban = false;
  12324. minSpeed = 5;
  12325. maxSpeed = 6;
  12326. }
  12327. else if(mode.equals("Paranoid")){
  12328. antiban = true;
  12329. minSpeed = 8;
  12330. maxSpeed = 10;
  12331. min = 3;
  12332. max = 3;
  12333.  
  12334. }
  12335. save = memoryMode.isSelected();
  12336. guiWait = false;
  12337. g.dispose();
  12338. }
  12339.  
  12340. private void initComponents() {
  12341. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  12342. label1 = new JLabel();
  12343. selectionBox = new JComboBox();
  12344. memoryMode = new JCheckBox();
  12345. label2 = new JLabel();
  12346. label3 = new JLabel();
  12347. label4 = new JLabel();
  12348. label5 = new JLabel();
  12349. startButton = new JButton();
  12350.  
  12351. //======== this ========
  12352. setTitle("Painlaws's Vial Filler");
  12353. setResizable(false);
  12354. Container contentPane = getContentPane();
  12355.  
  12356. //---- label1 ----
  12357. label1.setText("Mode");
  12358.  
  12359. //---- selectionBox ----
  12360. selectionBox.setModel(new DefaultComboBoxModel(new String[] {
  12361. "Normal",
  12362. "Paranoid",
  12363. "Maximum"
  12364. }));
  12365.  
  12366. //---- memoryMode ----
  12367. memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
  12368.  
  12369. //---- label2 ----
  12370. label2.setText("Modes:");
  12371.  
  12372. //---- label3 ----
  12373. label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
  12374.  
  12375. //---- label4 ----
  12376. label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
  12377.  
  12378. //---- label5 ----
  12379. label5.setText("Maximum - No Antiban, Fast Mouse Speed");
  12380.  
  12381. //---- startButton ----
  12382. startButton.setText("Let's Fill Some Vials!");
  12383. startButton.addActionListener(new ActionListener() {
  12384. public void actionPerformed(ActionEvent e){
  12385. startButtonActionPerformed(e);
  12386. }
  12387. });
  12388.  
  12389. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  12390. contentPane.setLayout(contentPaneLayout);
  12391. contentPaneLayout.setHorizontalGroup(
  12392. contentPaneLayout.createParallelGroup()
  12393. .addGroup(contentPaneLayout.createSequentialGroup()
  12394. .addGroup(contentPaneLayout.createParallelGroup()
  12395. .addGroup(contentPaneLayout.createSequentialGroup()
  12396. .addContainerGap()
  12397. .addGroup(contentPaneLayout.createParallelGroup()
  12398. .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  12399. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  12400. .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  12401. .addGroup(contentPaneLayout.createSequentialGroup()
  12402. .addComponent(label1)
  12403. .addGap(18, 18, 18)
  12404. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  12405. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  12406. .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  12407. .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  12408. .addGroup(contentPaneLayout.createSequentialGroup()
  12409. .addGap(148, 148, 148)
  12410. .addComponent(startButton)))
  12411. .addContainerGap(2, Short.MAX_VALUE))
  12412. );
  12413. contentPaneLayout.setVerticalGroup(
  12414. contentPaneLayout.createParallelGroup()
  12415. .addGroup(contentPaneLayout.createSequentialGroup()
  12416. .addContainerGap()
  12417. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  12418. .addComponent(label1)
  12419. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  12420. .addGap(18, 18, 18)
  12421. .addComponent(memoryMode)
  12422. .addGap(18, 18, 18)
  12423. .addComponent(label2)
  12424. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  12425. .addComponent(label3)
  12426. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  12427. .addComponent(label4)
  12428. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  12429. .addComponent(label5)
  12430. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
  12431. .addComponent(startButton)
  12432. .addContainerGap())
  12433. );
  12434. pack();
  12435. setLocationRelativeTo(getOwner());
  12436. // JFormDesigner - End of component initialization //GEN-END:initComponents
  12437. }
  12438.  
  12439. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  12440. private JLabel label1;
  12441. private JComboBox selectionBox;
  12442. private JCheckBox memoryMode;
  12443. private JLabel label2;
  12444. private JLabel label3;
  12445. private JLabel label4;
  12446. private JLabel label5;
  12447. private JButton startButton;
  12448. // JFormDesigner - End of variables declaration //GEN-END:variables
  12449. }
  12450.  
  12451.  
  12452. }
  12453. import java.awt.*;
  12454. import java.awt.event.*;
  12455. import javax.swing.*;
  12456. import java.awt.event.KeyEvent;
  12457. import org.rsbot.event.listeners.PaintListener;
  12458. import org.rsbot.script.Script;
  12459. import org.rsbot.script.ScriptManifest;
  12460. import org.rsbot.script.methods.*;
  12461. import org.rsbot.script.wrappers.*;
  12462.  
  12463. @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
  12464. public class vialfiller extends Script implements PaintListener{
  12465. //Variables
  12466. // - Essentials
  12467. private int bankerID = 6533;
  12468. private int fountainID = 24214;
  12469. private int emptyVialID = 229;
  12470. private int fullVialID = 227;
  12471. private int runEnergy = 50;
  12472. RSNPC banker;
  12473. RSObject fountain;
  12474. RSItem myVial;
  12475. RSTile theBank = new RSTile(3167, 3489);
  12476. RSTile theFountain = new RSTile(3191, 3471);
  12477. RSTile glitchSpot = new RSTile(3192, 3487);
  12478. RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
  12479. RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
  12480. RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
  12481. RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
  12482.  
  12483. // - GUI Options
  12484. private int min = 1;
  12485. private int max = 6;
  12486. private int minSpeed = 6;
  12487. private int maxSpeed = 9;
  12488. private boolean guiWait = true;
  12489. private boolean save = false;
  12490.  
  12491. // - State check
  12492. private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
  12493.  
  12494. // - Paint stuff
  12495. private String status = "Initializing...";
  12496. private String isRunning = "";
  12497. private int numFilled = 0;
  12498. private int vialFilledPrice;
  12499. private int vialEmptyPrice;
  12500. private int profitPrice;
  12501. private int profit;
  12502. private long startTime;
  12503. private long millis;
  12504. private long hours;
  12505. private long minutes;
  12506. private long seconds;
  12507. private float profSec = 0;
  12508. private float profHour;
  12509. private float hourlyProfit;
  12510. private int hourlyProfitInt;
  12511. private final Color color1 = new Color(0, 0, 0);
  12512. private final Color color2 = new Color(255, 255, 255);
  12513. private final BasicStroke stroke1 = new BasicStroke(1);
  12514. private final Font font1 = new Font("Arial", 0, 13);
  12515. private final Font font2 = new Font("Arial", 1, 13);
  12516. private final Font font3 = new Font("Vijaya", 1, 17);
  12517. private boolean antiban = true;
  12518. gui g = new gui();
  12519.  
  12520. @Override
  12521. public boolean onStart(){
  12522. log("Welcome to Painlaws's Vial Filler");
  12523. log("Waiting on GUI...");
  12524. g.setVisible(true);
  12525. while(guiWait){
  12526. sleep(500);
  12527. }
  12528. log("GUI Settings loaded!");
  12529. if(walking.isRunEnabled()){
  12530. isRunning = "Yes";
  12531. }
  12532. else{
  12533. isRunning = "No";
  12534. }
  12535. vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
  12536. vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
  12537. profitPrice = vialFilledPrice - vialEmptyPrice;
  12538. if(!save){
  12539. startTime = System.currentTimeMillis();
  12540. }
  12541. else{
  12542. startTime = 0;
  12543. }
  12544. return true;
  12545. }
  12546.  
  12547. @Override
  12548. public void onFinish(){
  12549. env.saveScreenshot(true);
  12550. log("^ Don't forget to upload this proggie :P");
  12551. log("Bye! PM Painlaws for comments/questions/requests");
  12552. }
  12553.  
  12554. public void useItem(RSItem item, RSObject object){
  12555. if(item != null && object != null && object.isOnScreen()){
  12556. item.doClick(true);
  12557. sleep(200, 300);
  12558. object.doClick();
  12559. }
  12560. }
  12561.  
  12562. public void fillVials(){
  12563. if(fountain != null){
  12564. status = "Filling Vials";
  12565. useItem(myVial, fountain);
  12566. while(inventory.contains(emptyVialID)){
  12567. sleep(random(1000,1500));
  12568. if(antiban){
  12569. if(random(1, 3) == 2){
  12570. mouse.moveSlightly();
  12571. }
  12572. }
  12573. }
  12574. status = "Vials filled";
  12575. }
  12576. else{
  12577. status = "Fountain is null...retrying";
  12578. sleep(random(600, 800));
  12579. }
  12580. }
  12581.  
  12582. private void doBank(){
  12583. try{
  12584. if(banker != null){
  12585. camera.turnTo(banker);
  12586. if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
  12587. status = "Opening Bank";
  12588. banker.interact("Bank Banker");
  12589. status = "Bank opened";
  12590. sleep(random(900, 1050));
  12591. status = "Depositing All";
  12592. bank.depositAll();
  12593. status = "Deposited All";
  12594. sleep(random(780, 950));
  12595. numFilled = bank.getCount(fullVialID);
  12596. if(bank.getCount(emptyVialID) != 0){
  12597. status = "Taking Vials";
  12598. bank.withdraw(emptyVialID, 0);
  12599. status = "Vials Taken";
  12600. sleep(random(700, 960));
  12601. }
  12602. else{
  12603. log("Out of vials. Quitting :/");
  12604. bank.close();
  12605. env.saveScreenshot(true);
  12606. log("^ Don't forget to upload this proggie :P");
  12607. log("Bye! PM Painlaws for comments/questions/requests");
  12608. stopScript(true);
  12609. }
  12610. status = "Closing Bank";
  12611. bank.close();
  12612. status = "Bank Closed";
  12613. sleep(random(750, 910));
  12614. }
  12615. }
  12616. sleep(random(300,500));
  12617. }catch(Exception e){log(e);}
  12618. }
  12619.  
  12620. public void onToBank(){
  12621. try{
  12622. status = "Going to Bank";
  12623. walking.walkTileMM(theBank);
  12624. }catch(Exception e){log(e);}
  12625. sleep(random(500, 700));
  12626. }
  12627.  
  12628. public void onToGlitch(){
  12629. try{
  12630. status = "Going to Fountain"; //What you don't know can't hurt you :P
  12631. walking.walkTileMM(glitchSpot);
  12632. }catch(Exception e){log(e);}
  12633. sleep(random(500, 710));
  12634. }
  12635.  
  12636. public void onToFountain(){
  12637. try{
  12638. status = "Going to Fountain";
  12639. walking.walkTileMM(theFountain);
  12640. }catch(Exception e){log(e);}
  12641. sleep(random(500, 705));
  12642. }
  12643.  
  12644. public void runcheck() {
  12645. try{
  12646. runEnergy = (random(50, 70));
  12647. if (walking.isRunEnabled()){
  12648. isRunning = "Yes";
  12649. }
  12650. else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
  12651. walking.setRun(true);
  12652. isRunning = "Yes";
  12653. sleep(random(300, 500));
  12654. }
  12655. else{
  12656. isRunning = "No";
  12657. sleep(random(300,500));
  12658. }
  12659. }catch(Exception ex){}
  12660. }
  12661.  
  12662. @Override
  12663. public int loop(){
  12664. mouse.setSpeed(random(minSpeed, maxSpeed));
  12665. runcheck();
  12666. if(antiban){
  12667. if(random(min, max) == 3){
  12668. antiban();
  12669. }
  12670. }
  12671. if(objects.getNearest(fountainID) != null){
  12672. fountain = objects.getNearest(fountainID);
  12673. }
  12674. if(npcs.getNearest(bankerID) != null){
  12675. banker = npcs.getNearest(bankerID);
  12676. }
  12677. if(inventory.getItem(emptyVialID) != null){
  12678. myVial = inventory.getItem(emptyVialID);
  12679. }
  12680. switch(getState()){
  12681. case TOFOUNTAIN:
  12682. runcheck();
  12683. onToFountain();
  12684. if(fountainRange.contains(players.getMyPlayer().getLocation())){
  12685. fillVials();
  12686. }
  12687. break;
  12688.  
  12689. case TOGLITCH:
  12690. runcheck();
  12691. onToGlitch();
  12692. break;
  12693.  
  12694. case TOBANK:
  12695. runcheck();
  12696. onToBank();
  12697. if(bankRange.contains(players.getMyPlayer().getLocation())){
  12698. doBank();
  12699. }
  12700. break;
  12701. }
  12702. return(random(500, 1000));
  12703. }
  12704.  
  12705. private State getState() {
  12706. if (!inventory.contains(emptyVialID)) {
  12707. return State.TOBANK;
  12708. }
  12709. else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
  12710. return State.TOGLITCH;
  12711. }
  12712. else{
  12713. return State.TOFOUNTAIN;
  12714. }
  12715. }
  12716.  
  12717. // GUI and Mouse
  12718. public void onRepaint(Graphics g1) {
  12719. profit = numFilled * profitPrice;
  12720. if(!save){
  12721. millis = System.currentTimeMillis() - startTime;
  12722. hours = millis / (1000 * 60 * 60);
  12723. millis -= hours * (1000 * 60 * 60);
  12724. minutes = millis / (1000 * 60);
  12725. millis -= minutes * (1000 * 60);
  12726. seconds = millis / 1000;
  12727.  
  12728. if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
  12729. profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
  12730. }
  12731. profHour = profSec * 3600;
  12732. hourlyProfit = profHour * profitPrice;
  12733. hourlyProfitInt = Math.round(hourlyProfit);
  12734. }
  12735. else{
  12736. millis = 0;
  12737. hours = 0;
  12738. minutes = 0;
  12739. seconds = 0;
  12740. hourlyProfitInt = 9001;
  12741. }
  12742.  
  12743. Graphics2D g = (Graphics2D)g1;
  12744. g.setColor(color1);
  12745. g.fillRect(7, 345, 488, 70);
  12746. g.setStroke(stroke1);
  12747. g.drawRect(7, 345, 488, 70);
  12748. g.setFont(font1);
  12749. g.setColor(color2);
  12750. g.drawString("Status:", 14, 362);
  12751. g.setFont(font2);
  12752. g.drawString(status, 59, 362);
  12753. g.setFont(font1);
  12754. g.drawString("Filled Vials In Bank:", 209, 362);
  12755. g.setFont(font2);
  12756. g.drawString(Integer.toString(numFilled), 328, 362);
  12757. g.setFont(font1);
  12758. g.drawString("Profit:", 14, 383);
  12759. g.setFont(font2);
  12760. g.drawString(Integer.toString(profit), 59, 383);
  12761. g.setFont(font1);
  12762. g.drawString("Profit/hr:", 137, 383);
  12763. g.setFont(font2);
  12764. if(!save){
  12765. g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
  12766. }
  12767. else{
  12768. g.drawString("Mem Save", 190, 383);
  12769. }
  12770. g.setFont(font1);
  12771. g.drawString("Runtime:", 270, 383);
  12772. g.setFont(font2);
  12773. if(!save){
  12774. g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
  12775. }
  12776. else{
  12777. g.drawString("Mem Save", 325, 384);
  12778. }
  12779. g.setFont(font1);
  12780. g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
  12781. g.drawString("Running:", 710, 139);
  12782. g.setFont(font2);
  12783. g.drawString(isRunning, 722, 156);
  12784. g.setFont(font3);
  12785. g.drawString("Painlaws", 440, 357);
  12786.  
  12787. g1.setColor(Color.green);
  12788. g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
  12789. g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
  12790. }
  12791.  
  12792. /* Antiban stuff
  12793. * Some credits to Aaimister :)
  12794. * Partially copied, with permission
  12795. */
  12796.  
  12797. public void rotateCamera() {
  12798. final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  12799. final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  12800. final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  12801. KeyEvent.VK_UP, KeyEvent.VK_UP };
  12802. final int randomLR = random(0, 2);
  12803. final int randomUD = random(0, 2);
  12804. final int randomAll = random(0, 4);
  12805. if (random(0, 3) == 0) {
  12806. keyboard.pressKey(LR[randomLR]);
  12807. sleepCR(random(2, 9));
  12808. keyboard.pressKey(UD[randomUD]);
  12809. sleepCR(random(6, 10));
  12810. keyboard.releaseKey(UD[randomUD]);
  12811. sleepCR(random(2, 7));
  12812. keyboard.releaseKey(LR[randomLR]);
  12813. } else {
  12814. keyboard.pressKey(LRUD[randomAll]);
  12815. if (randomAll > 1) {
  12816. sleepCR(random(6, 11));
  12817. } else {
  12818. sleepCR(random(9, 12));
  12819. }
  12820. keyboard.releaseKey(LRUD[randomAll]);
  12821. }
  12822. }
  12823.  
  12824. private boolean sleepCR(final int amtOfHalfSecs) {
  12825. for (int x = 0; x < amtOfHalfSecs + 1; x++) {
  12826. sleep(random(48, 53));
  12827. }
  12828. return true;
  12829. }
  12830.  
  12831. private void antiban(){
  12832. int action = random(0, 5);
  12833.  
  12834. switch (action) {
  12835. case 0:
  12836. status = "Antiban";
  12837. rotateCamera();
  12838. sleep(200, 400);
  12839. break;
  12840. case 1:
  12841. status = "Antiban";
  12842. mouse.moveRandomly(100, 900);
  12843. sleep(200, 400);
  12844. break;
  12845. case 2:
  12846. status = "Antiban";
  12847. mouse.moveSlightly();
  12848. sleep(200, 400);
  12849. break;
  12850. case 3:
  12851. status = "Antiban";
  12852. camera.moveRandomly(random(750,1250));
  12853. sleep(200, 400);
  12854. break;
  12855. case 4:
  12856. status = "Antiban";
  12857. checkEXP();
  12858. sleep(200, 400);
  12859. break;
  12860. case 5:
  12861. status = "Antiban";
  12862. mouse.moveOffScreen();
  12863. sleep(200, 400);
  12864. break;
  12865. }
  12866. }
  12867.  
  12868. public void checkEXP() {
  12869. game.openTab(Game.Tab.STATS);
  12870. skills.doHover(Skills.INTERFACE_PRAYER);
  12871. sleep(random(2100, 3400));
  12872. game.openTab(Game.Tab.INVENTORY);
  12873. sleep(random(540,760));
  12874. }
  12875.  
  12876.  
  12877. class gui extends JFrame {
  12878. /**
  12879. *
  12880. */
  12881. private static final long serialVersionUID = 1L;
  12882. public gui() {
  12883. initComponents();
  12884. }
  12885.  
  12886. private void startButtonActionPerformed(ActionEvent e){
  12887. String mode = selectionBox.getSelectedItem().toString();
  12888. if(mode.equals("Maximum")){
  12889. antiban = false;
  12890. minSpeed = 5;
  12891. maxSpeed = 6;
  12892. }
  12893. else if(mode.equals("Paranoid")){
  12894. antiban = true;
  12895. minSpeed = 8;
  12896. maxSpeed = 10;
  12897. min = 3;
  12898. max = 3;
  12899.  
  12900. }
  12901. save = memoryMode.isSelected();
  12902. guiWait = false;
  12903. g.dispose();
  12904. }
  12905.  
  12906. private void initComponents() {
  12907. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  12908. label1 = new JLabel();
  12909. selectionBox = new JComboBox();
  12910. memoryMode = new JCheckBox();
  12911. label2 = new JLabel();
  12912. label3 = new JLabel();
  12913. label4 = new JLabel();
  12914. label5 = new JLabel();
  12915. startButton = new JButton();
  12916.  
  12917. //======== this ========
  12918. setTitle("Painlaws's Vial Filler");
  12919. setResizable(false);
  12920. Container contentPane = getContentPane();
  12921.  
  12922. //---- label1 ----
  12923. label1.setText("Mode");
  12924.  
  12925. //---- selectionBox ----
  12926. selectionBox.setModel(new DefaultComboBoxModel(new String[] {
  12927. "Normal",
  12928. "Paranoid",
  12929. "Maximum"
  12930. }));
  12931.  
  12932. //---- memoryMode ----
  12933. memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
  12934.  
  12935. //---- label2 ----
  12936. label2.setText("Modes:");
  12937.  
  12938. //---- label3 ----
  12939. label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
  12940.  
  12941. //---- label4 ----
  12942. label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
  12943.  
  12944. //---- label5 ----
  12945. label5.setText("Maximum - No Antiban, Fast Mouse Speed");
  12946.  
  12947. //---- startButton ----
  12948. startButton.setText("Let's Fill Some Vials!");
  12949. startButton.addActionListener(new ActionListener() {
  12950. public void actionPerformed(ActionEvent e){
  12951. startButtonActionPerformed(e);
  12952. }
  12953. });
  12954.  
  12955. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  12956. contentPane.setLayout(contentPaneLayout);
  12957. contentPaneLayout.setHorizontalGroup(
  12958. contentPaneLayout.createParallelGroup()
  12959. .addGroup(contentPaneLayout.createSequentialGroup()
  12960. .addGroup(contentPaneLayout.createParallelGroup()
  12961. .addGroup(contentPaneLayout.createSequentialGroup()
  12962. .addContainerGap()
  12963. .addGroup(contentPaneLayout.createParallelGroup()
  12964. .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  12965. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  12966. .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  12967. .addGroup(contentPaneLayout.createSequentialGroup()
  12968. .addComponent(label1)
  12969. .addGap(18, 18, 18)
  12970. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  12971. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  12972. .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  12973. .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  12974. .addGroup(contentPaneLayout.createSequentialGroup()
  12975. .addGap(148, 148, 148)
  12976. .addComponent(startButton)))
  12977. .addContainerGap(2, Short.MAX_VALUE))
  12978. );
  12979. contentPaneLayout.setVerticalGroup(
  12980. contentPaneLayout.createParallelGroup()
  12981. .addGroup(contentPaneLayout.createSequentialGroup()
  12982. .addContainerGap()
  12983. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  12984. .addComponent(label1)
  12985. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  12986. .addGap(18, 18, 18)
  12987. .addComponent(memoryMode)
  12988. .addGap(18, 18, 18)
  12989. .addComponent(label2)
  12990. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  12991. .addComponent(label3)
  12992. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  12993. .addComponent(label4)
  12994. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  12995. .addComponent(label5)
  12996. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
  12997. .addComponent(startButton)
  12998. .addContainerGap())
  12999. );
  13000. pack();
  13001. setLocationRelativeTo(getOwner());
  13002. // JFormDesigner - End of component initialization //GEN-END:initComponents
  13003. }
  13004.  
  13005. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  13006. private JLabel label1;
  13007. private JComboBox selectionBox;
  13008. private JCheckBox memoryMode;
  13009. private JLabel label2;
  13010. private JLabel label3;
  13011. private JLabel label4;
  13012. private JLabel label5;
  13013. private JButton startButton;
  13014. // JFormDesigner - End of variables declaration //GEN-END:variables
  13015. }
  13016.  
  13017.  
  13018. }
  13019. import java.awt.*;
  13020. import java.awt.event.*;
  13021. import javax.swing.*;
  13022. import java.awt.event.KeyEvent;
  13023. import org.rsbot.event.listeners.PaintListener;
  13024. import org.rsbot.script.Script;
  13025. import org.rsbot.script.ScriptManifest;
  13026. import org.rsbot.script.methods.*;
  13027. import org.rsbot.script.wrappers.*;
  13028.  
  13029. @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
  13030. public class vialfiller extends Script implements PaintListener{
  13031. //Variables
  13032. // - Essentials
  13033. private int bankerID = 6533;
  13034. private int fountainID = 24214;
  13035. private int emptyVialID = 229;
  13036. private int fullVialID = 227;
  13037. private int runEnergy = 50;
  13038. RSNPC banker;
  13039. RSObject fountain;
  13040. RSItem myVial;
  13041. RSTile theBank = new RSTile(3167, 3489);
  13042. RSTile theFountain = new RSTile(3191, 3471);
  13043. RSTile glitchSpot = new RSTile(3192, 3487);
  13044. RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
  13045. RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
  13046. RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
  13047. RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
  13048.  
  13049. // - GUI Options
  13050. private int min = 1;
  13051. private int max = 6;
  13052. private int minSpeed = 6;
  13053. private int maxSpeed = 9;
  13054. private boolean guiWait = true;
  13055. private boolean save = false;
  13056.  
  13057. // - State check
  13058. private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
  13059.  
  13060. // - Paint stuff
  13061. private String status = "Initializing...";
  13062. private String isRunning = "";
  13063. private int numFilled = 0;
  13064. private int vialFilledPrice;
  13065. private int vialEmptyPrice;
  13066. private int profitPrice;
  13067. private int profit;
  13068. private long startTime;
  13069. private long millis;
  13070. private long hours;
  13071. private long minutes;
  13072. private long seconds;
  13073. private float profSec = 0;
  13074. private float profHour;
  13075. private float hourlyProfit;
  13076. private int hourlyProfitInt;
  13077. private final Color color1 = new Color(0, 0, 0);
  13078. private final Color color2 = new Color(255, 255, 255);
  13079. private final BasicStroke stroke1 = new BasicStroke(1);
  13080. private final Font font1 = new Font("Arial", 0, 13);
  13081. private final Font font2 = new Font("Arial", 1, 13);
  13082. private final Font font3 = new Font("Vijaya", 1, 17);
  13083. private boolean antiban = true;
  13084. gui g = new gui();
  13085.  
  13086. @Override
  13087. public boolean onStart(){
  13088. log("Welcome to Painlaws's Vial Filler");
  13089. log("Waiting on GUI...");
  13090. g.setVisible(true);
  13091. while(guiWait){
  13092. sleep(500);
  13093. }
  13094. log("GUI Settings loaded!");
  13095. if(walking.isRunEnabled()){
  13096. isRunning = "Yes";
  13097. }
  13098. else{
  13099. isRunning = "No";
  13100. }
  13101. vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
  13102. vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
  13103. profitPrice = vialFilledPrice - vialEmptyPrice;
  13104. if(!save){
  13105. startTime = System.currentTimeMillis();
  13106. }
  13107. else{
  13108. startTime = 0;
  13109. }
  13110. return true;
  13111. }
  13112.  
  13113. @Override
  13114. public void onFinish(){
  13115. env.saveScreenshot(true);
  13116. log("^ Don't forget to upload this proggie :P");
  13117. log("Bye! PM Painlaws for comments/questions/requests");
  13118. }
  13119.  
  13120. public void useItem(RSItem item, RSObject object){
  13121. if(item != null && object != null && object.isOnScreen()){
  13122. item.doClick(true);
  13123. sleep(200, 300);
  13124. object.doClick();
  13125. }
  13126. }
  13127.  
  13128. public void fillVials(){
  13129. if(fountain != null){
  13130. status = "Filling Vials";
  13131. useItem(myVial, fountain);
  13132. while(inventory.contains(emptyVialID)){
  13133. sleep(random(1000,1500));
  13134. if(antiban){
  13135. if(random(1, 3) == 2){
  13136. mouse.moveSlightly();
  13137. }
  13138. }
  13139. }
  13140. status = "Vials filled";
  13141. }
  13142. else{
  13143. status = "Fountain is null...retrying";
  13144. sleep(random(600, 800));
  13145. }
  13146. }
  13147.  
  13148. private void doBank(){
  13149. try{
  13150. if(banker != null){
  13151. camera.turnTo(banker);
  13152. if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
  13153. status = "Opening Bank";
  13154. banker.interact("Bank Banker");
  13155. status = "Bank opened";
  13156. sleep(random(900, 1050));
  13157. status = "Depositing All";
  13158. bank.depositAll();
  13159. status = "Deposited All";
  13160. sleep(random(780, 950));
  13161. numFilled = bank.getCount(fullVialID);
  13162. if(bank.getCount(emptyVialID) != 0){
  13163. status = "Taking Vials";
  13164. bank.withdraw(emptyVialID, 0);
  13165. status = "Vials Taken";
  13166. sleep(random(700, 960));
  13167. }
  13168. else{
  13169. log("Out of vials. Quitting :/");
  13170. bank.close();
  13171. env.saveScreenshot(true);
  13172. log("^ Don't forget to upload this proggie :P");
  13173. log("Bye! PM Painlaws for comments/questions/requests");
  13174. stopScript(true);
  13175. }
  13176. status = "Closing Bank";
  13177. bank.close();
  13178. status = "Bank Closed";
  13179. sleep(random(750, 910));
  13180. }
  13181. }
  13182. sleep(random(300,500));
  13183. }catch(Exception e){log(e);}
  13184. }
  13185.  
  13186. public void onToBank(){
  13187. try{
  13188. status = "Going to Bank";
  13189. walking.walkTileMM(theBank);
  13190. }catch(Exception e){log(e);}
  13191. sleep(random(500, 700));
  13192. }
  13193.  
  13194. public void onToGlitch(){
  13195. try{
  13196. status = "Going to Fountain"; //What you don't know can't hurt you :P
  13197. walking.walkTileMM(glitchSpot);
  13198. }catch(Exception e){log(e);}
  13199. sleep(random(500, 710));
  13200. }
  13201.  
  13202. public void onToFountain(){
  13203. try{
  13204. status = "Going to Fountain";
  13205. walking.walkTileMM(theFountain);
  13206. }catch(Exception e){log(e);}
  13207. sleep(random(500, 705));
  13208. }
  13209.  
  13210. public void runcheck() {
  13211. try{
  13212. runEnergy = (random(50, 70));
  13213. if (walking.isRunEnabled()){
  13214. isRunning = "Yes";
  13215. }
  13216. else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
  13217. walking.setRun(true);
  13218. isRunning = "Yes";
  13219. sleep(random(300, 500));
  13220. }
  13221. else{
  13222. isRunning = "No";
  13223. sleep(random(300,500));
  13224. }
  13225. }catch(Exception ex){}
  13226. }
  13227.  
  13228. @Override
  13229. public int loop(){
  13230. mouse.setSpeed(random(minSpeed, maxSpeed));
  13231. runcheck();
  13232. if(antiban){
  13233. if(random(min, max) == 3){
  13234. antiban();
  13235. }
  13236. }
  13237. if(objects.getNearest(fountainID) != null){
  13238. fountain = objects.getNearest(fountainID);
  13239. }
  13240. if(npcs.getNearest(bankerID) != null){
  13241. banker = npcs.getNearest(bankerID);
  13242. }
  13243. if(inventory.getItem(emptyVialID) != null){
  13244. myVial = inventory.getItem(emptyVialID);
  13245. }
  13246. switch(getState()){
  13247. case TOFOUNTAIN:
  13248. runcheck();
  13249. onToFountain();
  13250. if(fountainRange.contains(players.getMyPlayer().getLocation())){
  13251. fillVials();
  13252. }
  13253. break;
  13254.  
  13255. case TOGLITCH:
  13256. runcheck();
  13257. onToGlitch();
  13258. break;
  13259.  
  13260. case TOBANK:
  13261. runcheck();
  13262. onToBank();
  13263. if(bankRange.contains(players.getMyPlayer().getLocation())){
  13264. doBank();
  13265. }
  13266. break;
  13267. }
  13268. return(random(500, 1000));
  13269. }
  13270.  
  13271. private State getState() {
  13272. if (!inventory.contains(emptyVialID)) {
  13273. return State.TOBANK;
  13274. }
  13275. else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
  13276. return State.TOGLITCH;
  13277. }
  13278. else{
  13279. return State.TOFOUNTAIN;
  13280. }
  13281. }
  13282.  
  13283. // GUI and Mouse
  13284. public void onRepaint(Graphics g1) {
  13285. profit = numFilled * profitPrice;
  13286. if(!save){
  13287. millis = System.currentTimeMillis() - startTime;
  13288. hours = millis / (1000 * 60 * 60);
  13289. millis -= hours * (1000 * 60 * 60);
  13290. minutes = millis / (1000 * 60);
  13291. millis -= minutes * (1000 * 60);
  13292. seconds = millis / 1000;
  13293.  
  13294. if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
  13295. profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
  13296. }
  13297. profHour = profSec * 3600;
  13298. hourlyProfit = profHour * profitPrice;
  13299. hourlyProfitInt = Math.round(hourlyProfit);
  13300. }
  13301. else{
  13302. millis = 0;
  13303. hours = 0;
  13304. minutes = 0;
  13305. seconds = 0;
  13306. hourlyProfitInt = 9001;
  13307. }
  13308.  
  13309. Graphics2D g = (Graphics2D)g1;
  13310. g.setColor(color1);
  13311. g.fillRect(7, 345, 488, 70);
  13312. g.setStroke(stroke1);
  13313. g.drawRect(7, 345, 488, 70);
  13314. g.setFont(font1);
  13315. g.setColor(color2);
  13316. g.drawString("Status:", 14, 362);
  13317. g.setFont(font2);
  13318. g.drawString(status, 59, 362);
  13319. g.setFont(font1);
  13320. g.drawString("Filled Vials In Bank:", 209, 362);
  13321. g.setFont(font2);
  13322. g.drawString(Integer.toString(numFilled), 328, 362);
  13323. g.setFont(font1);
  13324. g.drawString("Profit:", 14, 383);
  13325. g.setFont(font2);
  13326. g.drawString(Integer.toString(profit), 59, 383);
  13327. g.setFont(font1);
  13328. g.drawString("Profit/hr:", 137, 383);
  13329. g.setFont(font2);
  13330. if(!save){
  13331. g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
  13332. }
  13333. else{
  13334. g.drawString("Mem Save", 190, 383);
  13335. }
  13336. g.setFont(font1);
  13337. g.drawString("Runtime:", 270, 383);
  13338. g.setFont(font2);
  13339. if(!save){
  13340. g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
  13341. }
  13342. else{
  13343. g.drawString("Mem Save", 325, 384);
  13344. }
  13345. g.setFont(font1);
  13346. g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
  13347. g.drawString("Running:", 710, 139);
  13348. g.setFont(font2);
  13349. g.drawString(isRunning, 722, 156);
  13350. g.setFont(font3);
  13351. g.drawString("Painlaws", 440, 357);
  13352.  
  13353. g1.setColor(Color.green);
  13354. g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
  13355. g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
  13356. }
  13357.  
  13358. /* Antiban stuff
  13359. * Some credits to Aaimister :)
  13360. * Partially copied, with permission
  13361. */
  13362.  
  13363. public void rotateCamera() {
  13364. final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  13365. final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  13366. final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  13367. KeyEvent.VK_UP, KeyEvent.VK_UP };
  13368. final int randomLR = random(0, 2);
  13369. final int randomUD = random(0, 2);
  13370. final int randomAll = random(0, 4);
  13371. if (random(0, 3) == 0) {
  13372. keyboard.pressKey(LR[randomLR]);
  13373. sleepCR(random(2, 9));
  13374. keyboard.pressKey(UD[randomUD]);
  13375. sleepCR(random(6, 10));
  13376. keyboard.releaseKey(UD[randomUD]);
  13377. sleepCR(random(2, 7));
  13378. keyboard.releaseKey(LR[randomLR]);
  13379. } else {
  13380. keyboard.pressKey(LRUD[randomAll]);
  13381. if (randomAll > 1) {
  13382. sleepCR(random(6, 11));
  13383. } else {
  13384. sleepCR(random(9, 12));
  13385. }
  13386. keyboard.releaseKey(LRUD[randomAll]);
  13387. }
  13388. }
  13389.  
  13390. private boolean sleepCR(final int amtOfHalfSecs) {
  13391. for (int x = 0; x < amtOfHalfSecs + 1; x++) {
  13392. sleep(random(48, 53));
  13393. }
  13394. return true;
  13395. }
  13396.  
  13397. private void antiban(){
  13398. int action = random(0, 5);
  13399.  
  13400. switch (action) {
  13401. case 0:
  13402. status = "Antiban";
  13403. rotateCamera();
  13404. sleep(200, 400);
  13405. break;
  13406. case 1:
  13407. status = "Antiban";
  13408. mouse.moveRandomly(100, 900);
  13409. sleep(200, 400);
  13410. break;
  13411. case 2:
  13412. status = "Antiban";
  13413. mouse.moveSlightly();
  13414. sleep(200, 400);
  13415. break;
  13416. case 3:
  13417. status = "Antiban";
  13418. camera.moveRandomly(random(750,1250));
  13419. sleep(200, 400);
  13420. break;
  13421. case 4:
  13422. status = "Antiban";
  13423. checkEXP();
  13424. sleep(200, 400);
  13425. break;
  13426. case 5:
  13427. status = "Antiban";
  13428. mouse.moveOffScreen();
  13429. sleep(200, 400);
  13430. break;
  13431. }
  13432. }
  13433.  
  13434. public void checkEXP() {
  13435. game.openTab(Game.Tab.STATS);
  13436. skills.doHover(Skills.INTERFACE_PRAYER);
  13437. sleep(random(2100, 3400));
  13438. game.openTab(Game.Tab.INVENTORY);
  13439. sleep(random(540,760));
  13440. }
  13441.  
  13442.  
  13443. class gui extends JFrame {
  13444. /**
  13445. *
  13446. */
  13447. private static final long serialVersionUID = 1L;
  13448. public gui() {
  13449. initComponents();
  13450. }
  13451.  
  13452. private void startButtonActionPerformed(ActionEvent e){
  13453. String mode = selectionBox.getSelectedItem().toString();
  13454. if(mode.equals("Maximum")){
  13455. antiban = false;
  13456. minSpeed = 5;
  13457. maxSpeed = 6;
  13458. }
  13459. else if(mode.equals("Paranoid")){
  13460. antiban = true;
  13461. minSpeed = 8;
  13462. maxSpeed = 10;
  13463. min = 3;
  13464. max = 3;
  13465.  
  13466. }
  13467. save = memoryMode.isSelected();
  13468. guiWait = false;
  13469. g.dispose();
  13470. }
  13471.  
  13472. private void initComponents() {
  13473. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  13474. label1 = new JLabel();
  13475. selectionBox = new JComboBox();
  13476. memoryMode = new JCheckBox();
  13477. label2 = new JLabel();
  13478. label3 = new JLabel();
  13479. label4 = new JLabel();
  13480. label5 = new JLabel();
  13481. startButton = new JButton();
  13482.  
  13483. //======== this ========
  13484. setTitle("Painlaws's Vial Filler");
  13485. setResizable(false);
  13486. Container contentPane = getContentPane();
  13487.  
  13488. //---- label1 ----
  13489. label1.setText("Mode");
  13490.  
  13491. //---- selectionBox ----
  13492. selectionBox.setModel(new DefaultComboBoxModel(new String[] {
  13493. "Normal",
  13494. "Paranoid",
  13495. "Maximum"
  13496. }));
  13497.  
  13498. //---- memoryMode ----
  13499. memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
  13500.  
  13501. //---- label2 ----
  13502. label2.setText("Modes:");
  13503.  
  13504. //---- label3 ----
  13505. label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
  13506.  
  13507. //---- label4 ----
  13508. label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
  13509.  
  13510. //---- label5 ----
  13511. label5.setText("Maximum - No Antiban, Fast Mouse Speed");
  13512.  
  13513. //---- startButton ----
  13514. startButton.setText("Let's Fill Some Vials!");
  13515. startButton.addActionListener(new ActionListener() {
  13516. public void actionPerformed(ActionEvent e){
  13517. startButtonActionPerformed(e);
  13518. }
  13519. });
  13520.  
  13521. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  13522. contentPane.setLayout(contentPaneLayout);
  13523. contentPaneLayout.setHorizontalGroup(
  13524. contentPaneLayout.createParallelGroup()
  13525. .addGroup(contentPaneLayout.createSequentialGroup()
  13526. .addGroup(contentPaneLayout.createParallelGroup()
  13527. .addGroup(contentPaneLayout.createSequentialGroup()
  13528. .addContainerGap()
  13529. .addGroup(contentPaneLayout.createParallelGroup()
  13530. .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  13531. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  13532. .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  13533. .addGroup(contentPaneLayout.createSequentialGroup()
  13534. .addComponent(label1)
  13535. .addGap(18, 18, 18)
  13536. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  13537. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  13538. .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  13539. .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  13540. .addGroup(contentPaneLayout.createSequentialGroup()
  13541. .addGap(148, 148, 148)
  13542. .addComponent(startButton)))
  13543. .addContainerGap(2, Short.MAX_VALUE))
  13544. );
  13545. contentPaneLayout.setVerticalGroup(
  13546. contentPaneLayout.createParallelGroup()
  13547. .addGroup(contentPaneLayout.createSequentialGroup()
  13548. .addContainerGap()
  13549. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  13550. .addComponent(label1)
  13551. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  13552. .addGap(18, 18, 18)
  13553. .addComponent(memoryMode)
  13554. .addGap(18, 18, 18)
  13555. .addComponent(label2)
  13556. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  13557. .addComponent(label3)
  13558. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  13559. .addComponent(label4)
  13560. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  13561. .addComponent(label5)
  13562. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
  13563. .addComponent(startButton)
  13564. .addContainerGap())
  13565. );
  13566. pack();
  13567. setLocationRelativeTo(getOwner());
  13568. // JFormDesigner - End of component initialization //GEN-END:initComponents
  13569. }
  13570.  
  13571. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  13572. private JLabel label1;
  13573. private JComboBox selectionBox;
  13574. private JCheckBox memoryMode;
  13575. private JLabel label2;
  13576. private JLabel label3;
  13577. private JLabel label4;
  13578. private JLabel label5;
  13579. private JButton startButton;
  13580. // JFormDesigner - End of variables declaration //GEN-END:variables
  13581. }
  13582.  
  13583.  
  13584. }
  13585. import java.awt.*;
  13586. import java.awt.event.*;
  13587. import javax.swing.*;
  13588. import java.awt.event.KeyEvent;
  13589. import org.rsbot.event.listeners.PaintListener;
  13590. import org.rsbot.script.Script;
  13591. import org.rsbot.script.ScriptManifest;
  13592. import org.rsbot.script.methods.*;
  13593. import org.rsbot.script.wrappers.*;
  13594.  
  13595. @ScriptManifest(authors = { "Painlaws" }, name = "Vial filler", keywords = "Vials", version = 2.0, description = ("Fills n' banks vials near Grand Exchange."))
  13596. public class vialfiller extends Script implements PaintListener{
  13597. //Variables
  13598. // - Essentials
  13599. private int bankerID = 6533;
  13600. private int fountainID = 24214;
  13601. private int emptyVialID = 229;
  13602. private int fullVialID = 227;
  13603. private int runEnergy = 50;
  13604. RSNPC banker;
  13605. RSObject fountain;
  13606. RSItem myVial;
  13607. RSTile theBank = new RSTile(3167, 3489);
  13608. RSTile theFountain = new RSTile(3191, 3471);
  13609. RSTile glitchSpot = new RSTile(3192, 3487);
  13610. RSArea fountainRange = new RSArea(new RSTile(3189, 3468), new RSTile(3192, 3473));
  13611. RSArea bankRange = new RSArea(new RSTile(3166, 3488), new RSTile(3167, 3490));
  13612. RSArea glitchRange = new RSArea(new RSTile(3191, 3485), new RSTile(3193, 3490));
  13613. RSArea fountainArea = new RSArea(new RSTile(3189, 3468), new RSTile(3196, 3490));
  13614.  
  13615. // - GUI Options
  13616. private int min = 1;
  13617. private int max = 6;
  13618. private int minSpeed = 6;
  13619. private int maxSpeed = 9;
  13620. private boolean guiWait = true;
  13621. private boolean save = false;
  13622.  
  13623. // - State check
  13624. private enum State {TOBANK, TOFOUNTAIN, TOGLITCH}
  13625.  
  13626. // - Paint stuff
  13627. private String status = "Initializing...";
  13628. private String isRunning = "";
  13629. private int numFilled = 0;
  13630. private int vialFilledPrice;
  13631. private int vialEmptyPrice;
  13632. private int profitPrice;
  13633. private int profit;
  13634. private long startTime;
  13635. private long millis;
  13636. private long hours;
  13637. private long minutes;
  13638. private long seconds;
  13639. private float profSec = 0;
  13640. private float profHour;
  13641. private float hourlyProfit;
  13642. private int hourlyProfitInt;
  13643. private final Color color1 = new Color(0, 0, 0);
  13644. private final Color color2 = new Color(255, 255, 255);
  13645. private final BasicStroke stroke1 = new BasicStroke(1);
  13646. private final Font font1 = new Font("Arial", 0, 13);
  13647. private final Font font2 = new Font("Arial", 1, 13);
  13648. private final Font font3 = new Font("Vijaya", 1, 17);
  13649. private boolean antiban = true;
  13650. gui g = new gui();
  13651.  
  13652. @Override
  13653. public boolean onStart(){
  13654. log("Welcome to Painlaws's Vial Filler");
  13655. log("Waiting on GUI...");
  13656. g.setVisible(true);
  13657. while(guiWait){
  13658. sleep(500);
  13659. }
  13660. log("GUI Settings loaded!");
  13661. if(walking.isRunEnabled()){
  13662. isRunning = "Yes";
  13663. }
  13664. else{
  13665. isRunning = "No";
  13666. }
  13667. vialFilledPrice = grandExchange.lookup(fullVialID).getGuidePrice();
  13668. vialEmptyPrice = grandExchange.lookup(emptyVialID).getGuidePrice();
  13669. profitPrice = vialFilledPrice - vialEmptyPrice;
  13670. if(!save){
  13671. startTime = System.currentTimeMillis();
  13672. }
  13673. else{
  13674. startTime = 0;
  13675. }
  13676. return true;
  13677. }
  13678.  
  13679. @Override
  13680. public void onFinish(){
  13681. env.saveScreenshot(true);
  13682. log("^ Don't forget to upload this proggie :P");
  13683. log("Bye! PM Painlaws for comments/questions/requests");
  13684. }
  13685.  
  13686. public void useItem(RSItem item, RSObject object){
  13687. if(item != null && object != null && object.isOnScreen()){
  13688. item.doClick(true);
  13689. sleep(200, 300);
  13690. object.doClick();
  13691. }
  13692. }
  13693.  
  13694. public void fillVials(){
  13695. if(fountain != null){
  13696. status = "Filling Vials";
  13697. useItem(myVial, fountain);
  13698. while(inventory.contains(emptyVialID)){
  13699. sleep(random(1000,1500));
  13700. if(antiban){
  13701. if(random(1, 3) == 2){
  13702. mouse.moveSlightly();
  13703. }
  13704. }
  13705. }
  13706. status = "Vials filled";
  13707. }
  13708. else{
  13709. status = "Fountain is null...retrying";
  13710. sleep(random(600, 800));
  13711. }
  13712. }
  13713.  
  13714. private void doBank(){
  13715. try{
  13716. if(banker != null){
  13717. camera.turnTo(banker);
  13718. if (!bank.isOpen() /*&& banker != null*/ && banker.isOnScreen()) {
  13719. status = "Opening Bank";
  13720. banker.interact("Bank Banker");
  13721. status = "Bank opened";
  13722. sleep(random(900, 1050));
  13723. status = "Depositing All";
  13724. bank.depositAll();
  13725. status = "Deposited All";
  13726. sleep(random(780, 950));
  13727. numFilled = bank.getCount(fullVialID);
  13728. if(bank.getCount(emptyVialID) != 0){
  13729. status = "Taking Vials";
  13730. bank.withdraw(emptyVialID, 0);
  13731. status = "Vials Taken";
  13732. sleep(random(700, 960));
  13733. }
  13734. else{
  13735. log("Out of vials. Quitting :/");
  13736. bank.close();
  13737. env.saveScreenshot(true);
  13738. log("^ Don't forget to upload this proggie :P");
  13739. log("Bye! PM Painlaws for comments/questions/requests");
  13740. stopScript(true);
  13741. }
  13742. status = "Closing Bank";
  13743. bank.close();
  13744. status = "Bank Closed";
  13745. sleep(random(750, 910));
  13746. }
  13747. }
  13748. sleep(random(300,500));
  13749. }catch(Exception e){log(e);}
  13750. }
  13751.  
  13752. public void onToBank(){
  13753. try{
  13754. status = "Going to Bank";
  13755. walking.walkTileMM(theBank);
  13756. }catch(Exception e){log(e);}
  13757. sleep(random(500, 700));
  13758. }
  13759.  
  13760. public void onToGlitch(){
  13761. try{
  13762. status = "Going to Fountain"; //What you don't know can't hurt you :P
  13763. walking.walkTileMM(glitchSpot);
  13764. }catch(Exception e){log(e);}
  13765. sleep(random(500, 710));
  13766. }
  13767.  
  13768. public void onToFountain(){
  13769. try{
  13770. status = "Going to Fountain";
  13771. walking.walkTileMM(theFountain);
  13772. }catch(Exception e){log(e);}
  13773. sleep(random(500, 705));
  13774. }
  13775.  
  13776. public void runcheck() {
  13777. try{
  13778. runEnergy = (random(50, 70));
  13779. if (walking.isRunEnabled()){
  13780. isRunning = "Yes";
  13781. }
  13782. else if (!walking.isRunEnabled() && walking.getEnergy() > runEnergy) {
  13783. walking.setRun(true);
  13784. isRunning = "Yes";
  13785. sleep(random(300, 500));
  13786. }
  13787. else{
  13788. isRunning = "No";
  13789. sleep(random(300,500));
  13790. }
  13791. }catch(Exception ex){}
  13792. }
  13793.  
  13794. @Override
  13795. public int loop(){
  13796. mouse.setSpeed(random(minSpeed, maxSpeed));
  13797. runcheck();
  13798. if(antiban){
  13799. if(random(min, max) == 3){
  13800. antiban();
  13801. }
  13802. }
  13803. if(objects.getNearest(fountainID) != null){
  13804. fountain = objects.getNearest(fountainID);
  13805. }
  13806. if(npcs.getNearest(bankerID) != null){
  13807. banker = npcs.getNearest(bankerID);
  13808. }
  13809. if(inventory.getItem(emptyVialID) != null){
  13810. myVial = inventory.getItem(emptyVialID);
  13811. }
  13812. switch(getState()){
  13813. case TOFOUNTAIN:
  13814. runcheck();
  13815. onToFountain();
  13816. if(fountainRange.contains(players.getMyPlayer().getLocation())){
  13817. fillVials();
  13818. }
  13819. break;
  13820.  
  13821. case TOGLITCH:
  13822. runcheck();
  13823. onToGlitch();
  13824. break;
  13825.  
  13826. case TOBANK:
  13827. runcheck();
  13828. onToBank();
  13829. if(bankRange.contains(players.getMyPlayer().getLocation())){
  13830. doBank();
  13831. }
  13832. break;
  13833. }
  13834. return(random(500, 1000));
  13835. }
  13836.  
  13837. private State getState() {
  13838. if (!inventory.contains(emptyVialID)) {
  13839. return State.TOBANK;
  13840. }
  13841. else if (!(glitchRange.contains(players.getMyPlayer().getLocation())) && !(fountainArea.contains(players.getMyPlayer().getLocation()))){
  13842. return State.TOGLITCH;
  13843. }
  13844. else{
  13845. return State.TOFOUNTAIN;
  13846. }
  13847. }
  13848.  
  13849. // GUI and Mouse
  13850. public void onRepaint(Graphics g1) {
  13851. profit = numFilled * profitPrice;
  13852. if(!save){
  13853. millis = System.currentTimeMillis() - startTime;
  13854. hours = millis / (1000 * 60 * 60);
  13855. millis -= hours * (1000 * 60 * 60);
  13856. minutes = millis / (1000 * 60);
  13857. millis -= minutes * (1000 * 60);
  13858. seconds = millis / 1000;
  13859.  
  13860. if ((minutes > 0 || hours > 0 || seconds > 0) && numFilled > 0){
  13861. profSec = ((float) numFilled)/(float)(seconds + (minutes*60) + (hours*60*60));
  13862. }
  13863. profHour = profSec * 3600;
  13864. hourlyProfit = profHour * profitPrice;
  13865. hourlyProfitInt = Math.round(hourlyProfit);
  13866. }
  13867. else{
  13868. millis = 0;
  13869. hours = 0;
  13870. minutes = 0;
  13871. seconds = 0;
  13872. hourlyProfitInt = 9001;
  13873. }
  13874.  
  13875. Graphics2D g = (Graphics2D)g1;
  13876. g.setColor(color1);
  13877. g.fillRect(7, 345, 488, 70);
  13878. g.setStroke(stroke1);
  13879. g.drawRect(7, 345, 488, 70);
  13880. g.setFont(font1);
  13881. g.setColor(color2);
  13882. g.drawString("Status:", 14, 362);
  13883. g.setFont(font2);
  13884. g.drawString(status, 59, 362);
  13885. g.setFont(font1);
  13886. g.drawString("Filled Vials In Bank:", 209, 362);
  13887. g.setFont(font2);
  13888. g.drawString(Integer.toString(numFilled), 328, 362);
  13889. g.setFont(font1);
  13890. g.drawString("Profit:", 14, 383);
  13891. g.setFont(font2);
  13892. g.drawString(Integer.toString(profit), 59, 383);
  13893. g.setFont(font1);
  13894. g.drawString("Profit/hr:", 137, 383);
  13895. g.setFont(font2);
  13896. if(!save){
  13897. g.drawString(Integer.toString(hourlyProfitInt), 190, 383);
  13898. }
  13899. else{
  13900. g.drawString("Mem Save", 190, 383);
  13901. }
  13902. g.setFont(font1);
  13903. g.drawString("Runtime:", 270, 383);
  13904. g.setFont(font2);
  13905. if(!save){
  13906. g.drawString(hours + ":" + minutes + ":" + seconds, 325, 384);
  13907. }
  13908. else{
  13909. g.drawString("Mem Save", 325, 384);
  13910. }
  13911. g.setFont(font1);
  13912. g.drawString("Profit is calculated by subtracting the cost of an empty vial from the cost of a full vial", 10, 410);
  13913. g.drawString("Running:", 710, 139);
  13914. g.setFont(font2);
  13915. g.drawString(isRunning, 722, 156);
  13916. g.setFont(font3);
  13917. g.drawString("Painlaws", 440, 357);
  13918.  
  13919. g1.setColor(Color.green);
  13920. g1.drawLine(mouse.getLocation().x - 10, mouse.getLocation().y, mouse.getLocation().x + 10, mouse.getLocation().y);
  13921. g1.drawLine(mouse.getLocation().x, mouse.getLocation().y - 10, mouse.getLocation().x, mouse.getLocation().y + 10);
  13922. }
  13923.  
  13924. /* Antiban stuff
  13925. * Some credits to Aaimister :)
  13926. * Partially copied, with permission
  13927. */
  13928.  
  13929. public void rotateCamera() {
  13930. final char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
  13931. final char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
  13932. final char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
  13933. KeyEvent.VK_UP, KeyEvent.VK_UP };
  13934. final int randomLR = random(0, 2);
  13935. final int randomUD = random(0, 2);
  13936. final int randomAll = random(0, 4);
  13937. if (random(0, 3) == 0) {
  13938. keyboard.pressKey(LR[randomLR]);
  13939. sleepCR(random(2, 9));
  13940. keyboard.pressKey(UD[randomUD]);
  13941. sleepCR(random(6, 10));
  13942. keyboard.releaseKey(UD[randomUD]);
  13943. sleepCR(random(2, 7));
  13944. keyboard.releaseKey(LR[randomLR]);
  13945. } else {
  13946. keyboard.pressKey(LRUD[randomAll]);
  13947. if (randomAll > 1) {
  13948. sleepCR(random(6, 11));
  13949. } else {
  13950. sleepCR(random(9, 12));
  13951. }
  13952. keyboard.releaseKey(LRUD[randomAll]);
  13953. }
  13954. }
  13955.  
  13956. private boolean sleepCR(final int amtOfHalfSecs) {
  13957. for (int x = 0; x < amtOfHalfSecs + 1; x++) {
  13958. sleep(random(48, 53));
  13959. }
  13960. return true;
  13961. }
  13962.  
  13963. private void antiban(){
  13964. int action = random(0, 5);
  13965.  
  13966. switch (action) {
  13967. case 0:
  13968. status = "Antiban";
  13969. rotateCamera();
  13970. sleep(200, 400);
  13971. break;
  13972. case 1:
  13973. status = "Antiban";
  13974. mouse.moveRandomly(100, 900);
  13975. sleep(200, 400);
  13976. break;
  13977. case 2:
  13978. status = "Antiban";
  13979. mouse.moveSlightly();
  13980. sleep(200, 400);
  13981. break;
  13982. case 3:
  13983. status = "Antiban";
  13984. camera.moveRandomly(random(750,1250));
  13985. sleep(200, 400);
  13986. break;
  13987. case 4:
  13988. status = "Antiban";
  13989. checkEXP();
  13990. sleep(200, 400);
  13991. break;
  13992. case 5:
  13993. status = "Antiban";
  13994. mouse.moveOffScreen();
  13995. sleep(200, 400);
  13996. break;
  13997. }
  13998. }
  13999.  
  14000. public void checkEXP() {
  14001. game.openTab(Game.Tab.STATS);
  14002. skills.doHover(Skills.INTERFACE_PRAYER);
  14003. sleep(random(2100, 3400));
  14004. game.openTab(Game.Tab.INVENTORY);
  14005. sleep(random(540,760));
  14006. }
  14007.  
  14008.  
  14009. class gui extends JFrame {
  14010. /**
  14011. *
  14012. */
  14013. private static final long serialVersionUID = 1L;
  14014. public gui() {
  14015. initComponents();
  14016. }
  14017.  
  14018. private void startButtonActionPerformed(ActionEvent e){
  14019. String mode = selectionBox.getSelectedItem().toString();
  14020. if(mode.equals("Maximum")){
  14021. antiban = false;
  14022. minSpeed = 5;
  14023. maxSpeed = 6;
  14024. }
  14025. else if(mode.equals("Paranoid")){
  14026. antiban = true;
  14027. minSpeed = 8;
  14028. maxSpeed = 10;
  14029. min = 3;
  14030. max = 3;
  14031.  
  14032. }
  14033. save = memoryMode.isSelected();
  14034. guiWait = false;
  14035. g.dispose();
  14036. }
  14037.  
  14038. private void initComponents() {
  14039. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  14040. label1 = new JLabel();
  14041. selectionBox = new JComboBox();
  14042. memoryMode = new JCheckBox();
  14043. label2 = new JLabel();
  14044. label3 = new JLabel();
  14045. label4 = new JLabel();
  14046. label5 = new JLabel();
  14047. startButton = new JButton();
  14048.  
  14049. //======== this ========
  14050. setTitle("Painlaws's Vial Filler");
  14051. setResizable(false);
  14052. Container contentPane = getContentPane();
  14053.  
  14054. //---- label1 ----
  14055. label1.setText("Mode");
  14056.  
  14057. //---- selectionBox ----
  14058. selectionBox.setModel(new DefaultComboBoxModel(new String[] {
  14059. "Normal",
  14060. "Paranoid",
  14061. "Maximum"
  14062. }));
  14063.  
  14064. //---- memoryMode ----
  14065. memoryMode.setText("Memory Save (No calculation of profit/hr, time running, etc)");
  14066.  
  14067. //---- label2 ----
  14068. label2.setText("Modes:");
  14069.  
  14070. //---- label3 ----
  14071. label3.setText("Normal - Antiban has 1 in 6 chance of happening per run, Average Mouse Speed");
  14072.  
  14073. //---- label4 ----
  14074. label4.setText("Paranoid - Antiban occurs at all times and is at its strongest, Human-like Mouse Speed");
  14075.  
  14076. //---- label5 ----
  14077. label5.setText("Maximum - No Antiban, Fast Mouse Speed");
  14078.  
  14079. //---- startButton ----
  14080. startButton.setText("Let's Fill Some Vials!");
  14081. startButton.addActionListener(new ActionListener() {
  14082. public void actionPerformed(ActionEvent e){
  14083. startButtonActionPerformed(e);
  14084. }
  14085. });
  14086.  
  14087. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  14088. contentPane.setLayout(contentPaneLayout);
  14089. contentPaneLayout.setHorizontalGroup(
  14090. contentPaneLayout.createParallelGroup()
  14091. .addGroup(contentPaneLayout.createSequentialGroup()
  14092. .addGroup(contentPaneLayout.createParallelGroup()
  14093. .addGroup(contentPaneLayout.createSequentialGroup()
  14094. .addContainerGap()
  14095. .addGroup(contentPaneLayout.createParallelGroup()
  14096. .addComponent(label5, GroupLayout.PREFERRED_SIZE, 241, GroupLayout.PREFERRED_SIZE)
  14097. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  14098. .addComponent(memoryMode, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  14099. .addGroup(contentPaneLayout.createSequentialGroup()
  14100. .addComponent(label1)
  14101. .addGap(18, 18, 18)
  14102. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  14103. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  14104. .addComponent(label3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  14105. .addComponent(label4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
  14106. .addGroup(contentPaneLayout.createSequentialGroup()
  14107. .addGap(148, 148, 148)
  14108. .addComponent(startButton)))
  14109. .addContainerGap(2, Short.MAX_VALUE))
  14110. );
  14111. contentPaneLayout.setVerticalGroup(
  14112. contentPaneLayout.createParallelGroup()
  14113. .addGroup(contentPaneLayout.createSequentialGroup()
  14114. .addContainerGap()
  14115. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  14116. .addComponent(label1)
  14117. .addComponent(selectionBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  14118. .addGap(18, 18, 18)
  14119. .addComponent(memoryMode)
  14120. .addGap(18, 18, 18)
  14121. .addComponent(label2)
  14122. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  14123. .addComponent(label3)
  14124. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  14125. .addComponent(label4)
  14126. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  14127. .addComponent(label5)
  14128. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 15, Short.MAX_VALUE)
  14129. .addComponent(startButton)
  14130. .addContainerGap())
  14131. );
  14132. pack();
  14133. setLocationRelativeTo(getOwner());
  14134. // JFormDesigner - End of component initialization //GEN-END:initComponents
  14135. }
  14136.  
  14137. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  14138. private JLabel label1;
  14139. private JComboBox selectionBox;
  14140. private JCheckBox memoryMode;
  14141. private JLabel label2;
  14142. private JLabel label3;
  14143. private JLabel label4;
  14144. private JLabel label5;
  14145. private JButton startButton;
  14146. // JFormDesigner - End of variables declaration //GEN-END:variables
  14147. }
  14148.  
  14149.  
  14150. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement