Advertisement
Guest User

Untitled

a guest
Feb 15th, 2019
619
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.62 KB | None | 0 0
  1. import java.awt.BorderLayout;
  2. import java.awt.Color;
  3. import java.awt.Dimension;
  4. import java.awt.Font;
  5. import java.awt.Graphics;
  6. import java.text.DecimalFormat;
  7. import java.util.concurrent.TimeUnit;
  8. import javax.swing.border.EmptyBorder;
  9.  
  10. import org.rspeer.runetek.adapter.scene.Player;
  11. import org.rspeer.runetek.adapter.scene.SceneObject;
  12. import org.rspeer.runetek.api.commons.Time;
  13. import org.rspeer.runetek.api.component.Bank;
  14. import org.rspeer.runetek.api.component.tab.Inventory;
  15. import org.rspeer.runetek.api.movement.Movement;
  16. import org.rspeer.runetek.api.scene.Players;
  17. import org.rspeer.runetek.api.scene.SceneObjects;
  18. import org.rspeer.runetek.event.listeners.RenderListener;
  19. import org.rspeer.runetek.event.types.RenderEvent;
  20. import org.rspeer.script.Script;
  21. import org.rspeer.script.ScriptMeta;
  22. import org.rspeer.ui.Log;
  23. import org.rspeer.script.ScriptCategory;
  24.  
  25.  
  26. import javax.swing.JFrame;
  27. import javax.swing.JPanel;
  28. import javax.swing.JCheckBox;
  29. import javax.swing.JRadioButton;
  30. import javax.swing.JSplitPane;
  31. import javax.swing.JTextPane;
  32. import javax.swing.JButton;
  33. import javax.swing.ButtonGroup;
  34.  
  35.  
  36. @ScriptMeta(name = "DaylightDies' Filler", version = 1.0, desc = "", developer = "DaylightDies", category = ScriptCategory.MONEY_MAKING)
  37. public class main extends Script implements RenderListener {
  38. private long timeBegan;
  39. private long timeRan;
  40. public static final int BANKCHEST = 7411;
  41. public static final int FOUNTAIN = 879;
  42.  
  43. private int costOfItem;
  44. private int itemsMade;
  45. private int itemsMadePerHour;
  46. private int totalItemsMadePerHour;
  47. private double gpGained;
  48. private double totalGpGained;
  49. private int gpPerHour;
  50. private int totalGpPerHour;
  51.  
  52. // private boolean antiBanCheck;
  53. private boolean isRunning;
  54. public boolean doJugs;
  55. public boolean doBuckets;
  56. public int JUG_FULL = 0;
  57. public int JUG_EMPTY = 0;
  58.  
  59.  
  60.  
  61.  
  62.  
  63. @Override
  64. public void onStart() {
  65. createGUI();
  66. costOfItem = 17;
  67. Log.info("Starting Filler Script!");
  68. timeBegan = System.currentTimeMillis();
  69. }
  70. //WidgetChild deathClose = getWidgets().getWidgetChild(153, 89);
  71. public int loop() {
  72. if (isRunning) {
  73. Player me = Players.getLocal();
  74. SceneObject bankc = SceneObjects.getNearest("Bank chest");
  75. SceneObject fountain = SceneObjects.getNearest("Fountain");
  76.  
  77. if (Bank.isOpen()) {
  78. if (!Inventory.contains(JUG_EMPTY) && !Inventory.isEmpty()) {
  79. Bank.depositInventory();
  80. Time.sleepUntil(() -> !Inventory.isEmpty(), 1000);
  81. itemsMade += 28;
  82. Log.info("Total Items Made = " + itemsMade);
  83. }
  84. if (Inventory.isEmpty() && Bank.contains(JUG_EMPTY)) {
  85. Bank.withdrawAll(JUG_EMPTY);
  86. Time.sleepUntil(() -> Inventory.contains(JUG_EMPTY), 1000);
  87. }
  88. if (Inventory.contains(JUG_EMPTY)) {
  89. Bank.close();
  90. Time.sleepUntil(() -> !Bank.isOpen(), 1000);
  91. }
  92. else if (!Bank.contains(JUG_EMPTY)) {
  93. Log.info("Out of stuff");
  94. setStopping(true);
  95. }
  96. }
  97.  
  98. if (!Inventory.contains(JUG_EMPTY)) {
  99. if (bankc != null) {
  100. bankc.interact("Use");
  101. Time.sleepUntil(() -> Bank.isOpen(), 300);
  102. }
  103. else {
  104. Log.info("Wrong world? No Chest BRO... PVP WORLD ONLY");
  105. setStopping(true);
  106. }
  107. }
  108. if (!Movement.isRunEnabled() && Movement.getRunEnergy() > 20 && !Bank.isOpen()) {
  109. Movement.toggleRun(true);
  110. Time.sleep(300);
  111. }
  112.  
  113. if (Inventory.contains(JUG_EMPTY) && !Bank.isOpen() && !me.isAnimating()) {
  114. if (fountain != null) {
  115. Inventory.getFirst(JUG_EMPTY).interact("Use");
  116. Time.sleep(200,300);
  117. fountain.interact("Use");
  118. Time.sleepUntil(() -> !Inventory.contains(JUG_EMPTY), 25000);
  119. }
  120. else {
  121. Log.info("CANT FIND FOUNTAIN!!! START IN LUMBY IN PVP WORLD");
  122. setStopping(true);
  123. }
  124. }
  125. }
  126. return 1000;
  127. }
  128.  
  129.  
  130.  
  131. // public void antiBan1() {
  132. // int chance1=(int)(Math.random()*10+1);
  133. // int chance2=(int)(Math.random()*3+1);
  134. // Log.info("Roll:" + chance1);
  135. // if (chance1>=7) {
  136. // Log.info("we are doing antiban");
  137. // if (chance2==1) {
  138. // Log.info("mouse off screen");
  139. // getMouse().moveMouseOutsideScreen();
  140. // } else if (chance2==2 && !getBank().isOpen()) {
  141. // Log.info("checking lvls");
  142. // getTabs().openWithMouse(Tab.STATS);
  143. // } else {
  144. // Log.info("ab bank tile");
  145. // sleep(Calculations.random(100,500));
  146. // getCamera().rotateToTile(CHEST_TILE);
  147. //
  148. // }
  149. // } else if (chance1<7) {
  150. // Log.info("no antiban");
  151. // getMouse().move();
  152. //
  153. // }
  154. // }
  155. @Override
  156. public void onStop() {
  157. Log.info("Ending Filler Script!");
  158. }
  159. private final Color color1 = new Color(255, 255, 255, 66);
  160. private final Color color2 = new Color(0, 0, 0);
  161. private final Font font1 = new Font("Calibri", 1, 18);
  162.  
  163. public void notify(RenderEvent renderEvent) {
  164. Graphics g = renderEvent.getSource();
  165. g.setColor(color1);
  166. g.fillRoundRect(4, 230, 140, 117, 16, 16);
  167. g.setFont(font1);
  168. g.setColor(color2);
  169. g.drawLine(5, 255, 131, 255);
  170. totalGpPerHour = gpPerHour;
  171. timeRan = System.currentTimeMillis() - this.timeBegan;
  172. gpGained = itemsMade * costOfItem;
  173. totalGpGained = gpGained;
  174. totalItemsMadePerHour = itemsMadePerHour;
  175. DecimalFormat df = new DecimalFormat("#");
  176. drawShadowString(g, "DD's Filler", 20, 250, Color.WHITE, Color.BLACK);
  177. g.drawString(ft(timeRan), 10, 270);
  178. g.drawString("Profit:" + df.format(totalGpGained) + " ", 10, 292);
  179. g.drawString("GP/hr:" + df.format(totalGpPerHour) + "", 10, 314);
  180. g.drawString("Fills/Hr:" + df.format(totalItemsMadePerHour) + "", 10, 336);
  181. gpPerHour = (int) (gpGained / ((System.currentTimeMillis() - timeBegan) / 3600000.0D));
  182. itemsMadePerHour = (int) (itemsMade / ((System.currentTimeMillis() - timeBegan) / 3600000.0D));
  183.  
  184. }
  185. private void drawShadowString(Graphics g, String s, int x, int y, Color face, Color shadow)
  186. {
  187. g.setColor(shadow);
  188. g.drawString(s, x+1,y+1);
  189. g.setColor(face);
  190. g.drawString(s,x,y);
  191. }
  192.  
  193. public void createGUI() {
  194. JPanel contentPane;
  195. ButtonGroup buttonGroup = new ButtonGroup();
  196.  
  197. JFrame frame = new JFrame();
  198. frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  199. frame.setPreferredSize(new Dimension(450, 300));
  200. contentPane = new JPanel();
  201. contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
  202. contentPane.setLayout(new BorderLayout(0, 0));
  203. frame.setContentPane(contentPane);
  204.  
  205. JCheckBox antiBanCheckBox = new JCheckBox("Antiban *PLACEHOLDER*");
  206. contentPane.add(antiBanCheckBox, BorderLayout.NORTH);
  207. // antiBanCheckBox.addActionListener(e -> antiBanCheck = antiBanCheckBox.isSelected());
  208.  
  209. JSplitPane splitPane = new JSplitPane();
  210. splitPane.setResizeWeight(0.5);
  211. splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
  212. contentPane.add(splitPane, BorderLayout.WEST);
  213.  
  214. JRadioButton bbucket = new JRadioButton("Fill Buckets");
  215. buttonGroup.add(bbucket);
  216. splitPane.setLeftComponent(bbucket);
  217. bbucket.addActionListener(e ->{
  218. JUG_FULL = 1929;
  219. JUG_EMPTY = 1925;
  220. });
  221.  
  222. JRadioButton bjugs = new JRadioButton("Fill Jugs");
  223. buttonGroup.add(bjugs);
  224. splitPane.setRightComponent(bjugs);
  225. bjugs.addActionListener(e ->{
  226. JUG_FULL = 1937;
  227. JUG_EMPTY = 1935;
  228. });
  229.  
  230. JTextPane txtpnDaylightdiesFillerScript = new JTextPane();
  231. txtpnDaylightdiesFillerScript.setBackground(Color.LIGHT_GRAY);
  232. txtpnDaylightdiesFillerScript.setText(" \r\n\r\n\r\n\r\n \r\n\r\nThank You for using - DaylightDies' Filler Script!");
  233. contentPane.add(txtpnDaylightdiesFillerScript, BorderLayout.CENTER);
  234.  
  235. JButton btnPushToStart = new JButton("Push to Start!");
  236. btnPushToStart.setBackground(Color.CYAN);
  237. contentPane.add(btnPushToStart, BorderLayout.SOUTH);
  238. btnPushToStart.addActionListener(e -> {
  239. isRunning = true;
  240. frame.dispose();
  241. });
  242.  
  243. frame.pack();
  244. frame.setVisible(true);
  245.  
  246.  
  247. }
  248.  
  249. private String ft(long duration) {
  250. String res = "";
  251. long days = TimeUnit.MILLISECONDS.toDays(duration);
  252. long hours = TimeUnit.MILLISECONDS.toHours(duration)
  253. - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration));
  254. long minutes = TimeUnit.MILLISECONDS.toMinutes(duration)
  255. - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration));
  256. long seconds = TimeUnit.MILLISECONDS.toSeconds(duration)
  257. - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration));
  258. if (days == 0) {
  259. res = (hours + ":" + minutes + ":" + seconds);
  260. } else {
  261. res = (days + ":" + hours + ":" + minutes + ":" + seconds);
  262. }
  263. return res;
  264. }
  265.  
  266. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement