Advertisement
Guest User

Untitled

a guest
Sep 18th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.69 KB | None | 0 0
  1. import org.rsbot.event.events.MessageEvent;
  2.  
  3. import org.rsbot.event.listeners.MessageListener;
  4.  
  5. import org.rsbot.event.listeners.PaintListener;
  6.  
  7. import org.rsbot.script.Script;
  8.  
  9. import org.rsbot.script.ScriptManifest;
  10.  
  11. import org.rsbot.script.wrappers.RSComponent;
  12.  
  13. import org.rsbot.script.wrappers.RSItem;
  14.  
  15. import java.awt.*;
  16.  
  17. import java.awt.event.*;
  18.  
  19. import javax.swing.*;
  20.  
  21. import java.awt.event.KeyEvent;
  22.  
  23. import java.awt.event.KeyListener;
  24.  
  25. import org.rsbot.script.wrappers.*;
  26.  
  27. import org.rsbot.script.methods.*;
  28.  
  29. import org.rsbot.script.methods.Game.CHAT_MODE;
  30.  
  31.  
  32. @ScriptManifest(
  33.  
  34. name = "DommsCutter",
  35.  
  36. authors = "Domm-rsbot",
  37.  
  38. keywords = "",
  39.  
  40. version = 0.3,
  41.  
  42. description = "Start with chisel in your Inventory and Near a Bank!")
  43.  
  44. public class DommsCutter extends Script implements PaintListener, MessageListener{
  45.  
  46. public int expGained = 0;
  47.  
  48. public int startExp = 0;
  49.  
  50. int chisel = 1755;
  51.  
  52. public int Sapphire = 1623;
  53.  
  54. int Emerald = 1621;
  55.  
  56. int Diamond = 1617;
  57.  
  58. int Ruby = 1619;
  59.  
  60. int URT = 1629;
  61.  
  62. int Animation = 2717;
  63.  
  64. public boolean guiWait = true;
  65.  
  66. public long startTime = System.currentTimeMillis();
  67.  
  68. int GemsCut = 0;
  69.  
  70. int GemsSmashed = 0;
  71.  
  72. public int CutsHour = 0;
  73.  
  74. private String status = "Loading..";
  75.  
  76. public int GemXP;
  77.  
  78. int GemsTNL;
  79.  
  80. int Opal = 1625;
  81.  
  82. int Dragonstone = 1631;
  83.  
  84. int Jade = 1627;
  85.  
  86. int Onyx = 6571;
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93. gui g = new gui();
  94.  
  95.  
  96.  
  97.  
  98. public int GemsToCutA;
  99.  
  100. @Override
  101.  
  102.  
  103.  
  104. public boolean onStart(){
  105.  
  106. startExp = skills.getCurrentExp(Skills.CRAFTING);
  107.  
  108. g.setVisible(true);
  109.  
  110. while(guiWait) sleep (1000);
  111.  
  112. return true;
  113.  
  114.  
  115.  
  116. }
  117.  
  118. public void onFinish(){
  119.  
  120. env.saveScreenshot(true);
  121.  
  122. log ("Saving Screenshot, Please upload Your Proggies :]");
  123.  
  124. }
  125.  
  126.  
  127.  
  128.  
  129. public int loop(){
  130.  
  131. if(inventory.containsOneOf(GemsToCutA) && getMyPlayer().getAnimation() != Animation){
  132.  
  133. Cut();
  134.  
  135. sleep (500, 1000);
  136.  
  137. ok();
  138.  
  139. }else{
  140.  
  141. if(!inventory.containsOneOf(GemsToCutA)){
  142.  
  143. Bank();
  144.  
  145. }else{
  146.  
  147. if(getMyPlayer().getAnimation() == Animation){
  148.  
  149. AntiBan();
  150.  
  151. }else{
  152.  
  153. if(interfaces.canContinue()){
  154.  
  155. interfaces.clickContinue();
  156.  
  157. }
  158.  
  159. }
  160.  
  161.  
  162.  
  163.  
  164.  
  165. }}
  166.  
  167. return 110; }
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180. private void AntiBan() {
  181.  
  182. status = "Anitban";
  183.  
  184. int RandomA = random(0, 20);
  185.  
  186. if (RandomA == 1)
  187.  
  188. camera.setAngle(random(1, 359));
  189.  
  190. if(RandomA == 2)
  191.  
  192. mouse.move(23, 1);
  193.  
  194. if(RandomA == 3)
  195.  
  196. camera.setNorth();
  197.  
  198. if(RandomA == 4)
  199.  
  200. camera.setNorth();
  201.  
  202. sleep (200, 1800);
  203.  
  204. if(RandomA == 5){
  205.  
  206. mouse.moveOffScreen();
  207.  
  208. camera.setAngle(random(48, 200));
  209.  
  210. }if(RandomA == 6)
  211.  
  212. mouse.move(300, 200);
  213.  
  214. if(RandomA == 18);
  215.  
  216. mouse.moveOffScreen();
  217.  
  218. sleep (400, 800);
  219.  
  220. if(RandomA == 19);
  221.  
  222. mouse.moveOffScreen();
  223.  
  224. sleep (400, 1200);
  225.  
  226. if(RandomA == 20);
  227.  
  228. mouse.moveOffScreen();
  229.  
  230. sleep (700, 888);
  231.  
  232. }
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244. private void ok(){
  245.  
  246. status = "Clicking Cut All";
  247.  
  248. RSComponent temp = interfaces.getComponent(905, 14);
  249.  
  250. if (temp != null && temp.isValid()){
  251.  
  252. temp.doClick();
  253.  
  254. sleep(200, 300);
  255.  
  256. }else{
  257.  
  258. if(interfaces.canContinue()){
  259.  
  260. interfaces.clickContinue();
  261.  
  262. }
  263.  
  264. }
  265.  
  266. }
  267.  
  268.  
  269.  
  270.  
  271.  
  272. private void Cut() {
  273.  
  274. status = "Cutting";
  275.  
  276. RSItem Gem = inventory.getItem(GemsToCutA);
  277.  
  278. if (inventory.getSelectedItem() != null && inventory.getSelectedItem().getID() == GemsToCutA){
  279.  
  280. inventory.getItem(1755).doAction("Use ");
  281.  
  282. sleep(random(100,200));
  283.  
  284. }else{
  285.  
  286. if(inventory.getSelectedItem() == null){
  287.  
  288. inventory.getItem(GemsToCutA).doAction("Use");
  289.  
  290. }
  291.  
  292.  
  293.  
  294.  
  295.  
  296. }
  297.  
  298. }
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308. public void Bank(){
  309.  
  310. status = "Banking";
  311.  
  312. if(bank.isOpen()){
  313.  
  314. bank.depositAllExcept(chisel);
  315.  
  316. bank.withdraw(GemsToCutA, 27);
  317.  
  318. bank.close();
  319.  
  320.  
  321.  
  322. }else if(!bank.isOpen()){
  323.  
  324. status = "Banking";
  325.  
  326. bank.open();
  327.  
  328. bank.depositAllExcept(chisel);
  329.  
  330. bank.withdraw(GemsToCutA, 27);
  331.  
  332. bank.close();
  333.  
  334.  
  335.  
  336. }
  337.  
  338.  
  339.  
  340. }
  341.  
  342. private final Color color1 = new Color(255, 255, 255);
  343.  
  344. private final Color color2 = new Color(51, 255, 51);
  345.  
  346. private final Color color3 = new Color(51, 51, 51);
  347.  
  348. private final Color color4 = new Color(0, 0, 0);
  349.  
  350.  
  351.  
  352. private final BasicStroke stroke1 = new BasicStroke(5);
  353.  
  354.  
  355. private final Font font1 = new Font("Arial", 1, 12);
  356.  
  357. private final Font font2 = new Font("Arial", 1, 10);
  358.  
  359.  
  360. public void onRepaint(Graphics g1) {
  361.  
  362. long millis = System.currentTimeMillis() - startTime;
  363.  
  364. long hours = millis / (1000 * 60 * 60);
  365.  
  366. millis -= hours * (1000 * 60 * 60);
  367.  
  368. long minutes = millis / (1000 * 60);
  369.  
  370. millis -= minutes * (1000 * 60);
  371.  
  372. long seconds = millis / 1000;
  373.  
  374. CutsHour = (int) ((GemsCut) * 3600000D / (System.currentTimeMillis() - startTime));
  375.  
  376. expGained = skills.getCurrentExp(Skills.CRAFTING) - startExp;
  377.  
  378. GemsTNL = skills.getExpToNextLevel(Skills.CRAFTING)/ GemXP;
  379.  
  380.  
  381.  
  382.  
  383. Graphics2D g = (Graphics2D)g1;
  384.  
  385.  
  386.  
  387.  
  388.  
  389. g.setColor(color1);
  390.  
  391. g.setStroke(stroke1);
  392.  
  393. g.drawRect(558, 220, 174, 239);
  394.  
  395. g.setColor(color2);
  396.  
  397. g.fillRect(574, 228, 144, 221);
  398.  
  399. g.setColor(color1);
  400.  
  401. g.drawRect(574, 228, 144, 221);
  402.  
  403. g.setColor(color4);
  404.  
  405. g.fillRect(5, 456, 95, 23);
  406.  
  407.  
  408. g.setFont(font1);
  409.  
  410. g.setColor(color3);
  411.  
  412.  
  413.  
  414. g.drawString("Domms Cutter!", 602, 245);
  415.  
  416. g.setFont(font2);
  417.  
  418. g.drawString("Time Running: " + hours + ": " + minutes + ": " + seconds, 579, 263);
  419.  
  420. g.drawString("Gems Cut: " +GemsCut, 576, 292);
  421.  
  422. g.drawString(" " +status, 579, 276);
  423.  
  424. g.drawString("Exp Gained:" +expGained, 576, 309);
  425.  
  426. g.drawString("Exp Hour:" +CutsHour, 576, 324);
  427.  
  428. g.drawString("Cuts TNL:" +GemsTNL, 576, 339);
  429.  
  430. g.drawString("Gems Smashed:" +GemsSmashed, 576, 354);
  431.  
  432. g.drawString("Thanks for using!", 605, 437);
  433.  
  434. }
  435.  
  436.  
  437.  
  438.  
  439. //END: Code generated using Enfilade's Easel
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447. public void messageReceived(MessageEvent e) {
  448.  
  449. String x = e.getMessage().toLowerCase();
  450.  
  451. if (x.contains("ou cut the")){
  452.  
  453. GemsCut++;
  454.  
  455. if(x.contains("mis")){
  456.  
  457. GemsSmashed++;
  458.  
  459. }
  460.  
  461.  
  462.  
  463.  
  464.  
  465. }}
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473. class gui extends JFrame {
  474.  
  475. public gui() {
  476.  
  477. initComponents();
  478.  
  479. }
  480.  
  481.  
  482. private void button1ActionPerformed(ActionEvent e) {
  483.  
  484. String chosen = GemsToCutAA.getSelectedItem().toString();
  485.  
  486. if(chosen.equals("Sapphire")){
  487.  
  488. GemsToCutA = Sapphire;
  489.  
  490. GemXP = 50;
  491.  
  492. }else{
  493.  
  494. if(chosen.equals("Emerald")){
  495.  
  496. GemsToCutA = Emerald;
  497.  
  498. GemXP = 135 / 2;
  499.  
  500. }else{
  501.  
  502. if(chosen.equals("Ruby")){
  503.  
  504. GemsToCutA = Ruby;
  505.  
  506. GemXP = 85;
  507.  
  508. }else{
  509.  
  510. if(chosen.equals("Diamond")){
  511.  
  512. GemsToCutA = Diamond;
  513.  
  514. GemXP = 215 / 2;
  515.  
  516. }else{
  517.  
  518. if(chosen.equals("Opal")){
  519.  
  520. GemsToCutA = Opal;
  521.  
  522. GemXP = 15;
  523.  
  524. }else{
  525.  
  526. if(chosen.equals("Dragonstone")){
  527.  
  528. GemsToCutA = Dragonstone;
  529.  
  530. GemXP = 275 / 2;
  531.  
  532. }else{
  533.  
  534. if(chosen.equals("Jade")){
  535.  
  536. GemsToCutA = Jade;
  537.  
  538. GemXP = 20;
  539.  
  540. }else{
  541.  
  542. if(chosen.equals("Onyx")){
  543.  
  544. GemsToCutA = Onyx;
  545.  
  546. GemXP = 335 / 2;
  547.  
  548.  
  549.  
  550. }else{
  551.  
  552. if(chosen.equals("Red Topaz")){
  553.  
  554. GemsToCutA = URT;
  555.  
  556. GemXP = 25;
  557.  
  558. }
  559.  
  560. }
  561.  
  562. }
  563.  
  564. }
  565.  
  566. }
  567.  
  568. }
  569.  
  570. }
  571.  
  572. }
  573.  
  574. }
  575.  
  576.  
  577.  
  578. guiWait = false;
  579.  
  580. g.dispose();
  581.  
  582.  
  583.  
  584. }
  585.  
  586.  
  587. private void initComponents() {
  588.  
  589. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  590.  
  591. // Generated using JFormDesigner Evaluation license - Dom Das
  592.  
  593. label1 = new JLabel();
  594.  
  595. label2 = new JLabel();
  596.  
  597. GemsToCutAA = new JComboBox();
  598.  
  599. button1 = new JButton();
  600.  
  601.  
  602. //======== this ========
  603.  
  604. Container contentPane = getContentPane();
  605.  
  606.  
  607. //---- label1 ----
  608.  
  609. label1.setText("Domms Cutter!!");
  610.  
  611. label1.setFont(label1.getFont().deriveFont(label1.getFont().getSize() + 22f));
  612.  
  613.  
  614. //---- label2 ----
  615.  
  616. label2.setText("Gems To Cut :");
  617.  
  618. label2.setFont(label2.getFont().deriveFont(label2.getFont().getSize() + 3f));
  619.  
  620.  
  621. //---- GemsToCutAA ----
  622.  
  623. GemsToCutAA.setMaximumRowCount(50);
  624.  
  625. GemsToCutAA.setModel(new DefaultComboBoxModel(new String[] {
  626.  
  627. "Sapphire",
  628.  
  629. "Emerald",
  630.  
  631. "Ruby",
  632.  
  633. "Diamond",
  634.  
  635. "Opal",
  636.  
  637. "Dragonstone",
  638.  
  639. "Onyx",
  640.  
  641. "Jade",
  642.  
  643. "Red Topaz"
  644.  
  645.  
  646.  
  647. }));
  648.  
  649.  
  650. //---- button1 ----
  651.  
  652. button1.setText("Start Cutting!!");
  653.  
  654. button1.addActionListener(new ActionListener() {
  655.  
  656. @Override
  657.  
  658. public void actionPerformed(ActionEvent e) {
  659.  
  660. button1ActionPerformed(e);
  661.  
  662. }
  663.  
  664. });
  665.  
  666.  
  667. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  668.  
  669. contentPane.setLayout(contentPaneLayout);
  670.  
  671. contentPaneLayout.setHorizontalGroup(
  672.  
  673. contentPaneLayout.createParallelGroup()
  674.  
  675. .addGroup(contentPaneLayout.createSequentialGroup()
  676.  
  677. .addContainerGap()
  678.  
  679. .addGroup(contentPaneLayout.createParallelGroup()
  680.  
  681. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
  682.  
  683. .addGroup(contentPaneLayout.createSequentialGroup()
  684.  
  685. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 117, GroupLayout.PREFERRED_SIZE)
  686.  
  687. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  688.  
  689. .addComponent(GemsToCutAA, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  690.  
  691. .addComponent(label1, GroupLayout.PREFERRED_SIZE, 240, GroupLayout.PREFERRED_SIZE))
  692.  
  693. .addComponent(button1, GroupLayout.DEFAULT_SIZE, 257, Short.MAX_VALUE))
  694.  
  695. .addContainerGap())
  696.  
  697. );
  698.  
  699. contentPaneLayout.setVerticalGroup(
  700.  
  701. contentPaneLayout.createParallelGroup()
  702.  
  703. .addGroup(contentPaneLayout.createSequentialGroup()
  704.  
  705. .addContainerGap()
  706.  
  707. .addComponent(label1, GroupLayout.PREFERRED_SIZE, 29, GroupLayout.PREFERRED_SIZE)
  708.  
  709. .addGap(18, 18, 18)
  710.  
  711. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  712.  
  713. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE)
  714.  
  715. .addComponent(GemsToCutAA, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  716.  
  717. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 13, Short.MAX_VALUE)
  718.  
  719. .addComponent(button1)
  720.  
  721. .addContainerGap())
  722.  
  723. );
  724.  
  725. pack();
  726.  
  727. setLocationRelativeTo(getOwner());
  728.  
  729. // JFormDesigner - End of component initialization //GEN-END:initComponents
  730.  
  731. }
  732.  
  733.  
  734. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  735.  
  736. // Generated using JFormDesigner Evaluation license - Dom Das
  737.  
  738. private JLabel label1;
  739.  
  740. private JLabel label2;
  741.  
  742. private JComboBox GemsToCutAA;
  743.  
  744. private JButton button1;
  745.  
  746. // JFormDesigner - End of variables declaration //GEN-END:variables
  747.  
  748. }
  749.  
  750.  
  751. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement