Guest User

Untitled

a guest
Aug 16th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.32 KB | None | 0 0
  1. // Made by PureFloy
  2. /* Copyright 2010
  3. /* All right reserved.
  4. */
  5.  
  6. import org.rsbot.script.Script;
  7. import org.rsbot.script.ScriptManifest;
  8. import org.rsbot.script.wrappers.RSObject;
  9. import org.rsbot.script.methods.Game;
  10. import org.rsbot.script.methods.Keyboard;
  11. import org.rsbot.script.methods.Skills;
  12.  
  13. import org.rsbot.event.listeners.PaintListener;
  14. import org.rsbot.event.events.ServerMessageEvent;
  15. import org.rsbot.event.listeners.ServerMessageListener;
  16.  
  17. import java.awt.*;
  18.  
  19. import javax.swing.*;
  20.  
  21. @ScriptManifest(authors = "PureFloy", keywords = "powermining, easy, flawless", name = "mineIT", version = 0.1, description = "Powermining.")
  22.  
  23. public class mineIT extends Script implements PaintListener, ServerMessageListener {
  24.  
  25. private String status;
  26.  
  27. int[] pickID = {1267, 1265, 1271, 1269, 1275, 1273};
  28. int[] ironRock = {2093, 2093, 2092, 9717, 9719, 9717, 9718, 11956, 11955, 11954, 37307, 37309, 31072, 31073, 31071, 37308};
  29. int[] copperRock = {11938, 11936, 11963, 11937, 9709, 9708, 9710, 11960, 11962, 11961, 31080, 31082};
  30. int[] tinRock = {11935, 11934, 11933, 11959, 11957, 11959, 11958, 9714, 9716, 31079, 31077, 31078};
  31. int[] clayRock = {9711, 9713};
  32. int[] silverRock = {11949, 11950, 37306, 37304, 2311, 37305, 9714, 9716, 9713, 11950};
  33. int[] goldRock = {37312, 37310, 9722, 9720, 15505, 15503, 11185, 11184, 11183, 9720, 9722, 37313, 31065, 31066};
  34.  
  35. public long startTime = System.currentTimeMillis();
  36. public int mineLevelStart = 0;
  37. public int mineExpStart = 0;
  38. public int mineLevelGained;
  39. public int mineExpGained = 0;
  40. public int minedOres;
  41. public int invCount;
  42.  
  43. int remainingXP = skills.getExpToNextLevel(skills.MINING);
  44. int rockID;
  45.  
  46. gui mineITGUI;
  47. public boolean guiWait = true;
  48.  
  49. public boolean onStart() {
  50. status = "Starting Up..";
  51. gui = new mineITGUI();
  52. gui.setVisible(true);
  53. while (guiwait) {
  54. sleep(100);
  55. }
  56. log("Happy Powermining!");
  57. minedOres = 0;
  58. mineLevelGained = 0;
  59. mineExpGained = 0;
  60. invCount = 0;
  61. return true;
  62. }
  63.  
  64. public void onFinish() {
  65. log("Thanks for using mineIT. Please donate if you liked it.");
  66. log("Ores Mined:" + minedOres);
  67. }
  68.  
  69. public void dropOre() {
  70. status = "Dropping Ores..";
  71. inventory.dropAllExcept(pickID);
  72. invCount ++;
  73. }
  74.  
  75. private void mine() {
  76. status = "Mining..";
  77. RSObject ores = objects.getNearest(rockID);
  78. if (ores != null && getMyPlayer().getAnimation() == -1) {
  79. if (ores.isOnScreen()) {
  80. ores.doAction("Mine");
  81. }
  82. }
  83. }
  84.  
  85. private void antiBan() {
  86. status = "Antiban..";
  87. switch (random(0, 30)) {
  88. case 1:
  89. camera.setAngle(random(0, 140));
  90. camera.setPitch(random(140, 335));
  91. break;
  92.  
  93. case 7:
  94. game.openTab(Game.TAB_STATS);
  95. sleep(random(800,2000));
  96. game.openTab(Game.TAB_INVENTORY);
  97. break;
  98.  
  99. case 11:
  100. sleep(random(400,1000));
  101. break;
  102.  
  103. case 15:
  104. camera.setAngle(random(0, 145));
  105. camera.setPitch(random(145, 360));
  106. game.openTab(Game.TAB_STATS);
  107. sleep(random(850,1650));
  108. game.openTab(Game.TAB_INVENTORY);
  109.  
  110. case 18:
  111. camera.setAngle(random(0, 180));
  112. camera.setPitch(random(180, 360));
  113. break;
  114. default:
  115. }
  116. }
  117.  
  118. public void serverMessageRecieved(ServerMessageEvent e) {
  119. final String word = e.getMessage().toLowerCase();
  120. String svrmsg = e.getMessage();
  121. if (svrmsg.contains("manage to mine")) {
  122. minedOres = minedOres + 1;
  123. }
  124. if (word.contains("tin")) {
  125. mineExpGained = mineExpGained + 18;
  126. }
  127. if (word.contains("copper")) {
  128. mineExpGained = mineExpGained + 18;
  129. }
  130. if (word.contains("clay")) {
  131. mineExpGained = mineExpGained + 5;
  132. }
  133. if (word.contains("iron")) {
  134. mineExpGained = mineExpGained + 35;
  135. }
  136. if (word.contains("silver")) {
  137. mineExpGained = mineExpGained + 40;
  138. }
  139. if (word.contains("coal")) {
  140. mineExpGained = mineExpGained + 50;
  141. }
  142. if (word.contains("gold")) {
  143. mineExpGained = mineExpGained + 65;
  144. }
  145. if (word.contains("advanced")) {
  146. mineLevelGained++;
  147. }
  148. if (word.contains("died")) {
  149. log("You have died! Stopping script..");
  150. log("Ores Mined:" + minedOres);
  151. stopScript();
  152. }
  153. }
  154.  
  155. private final Color color1 = new Color(0, 0, 0, 130);
  156. private final Color color2 = new Color(0, 0, 0);
  157. private final Color color3 = new Color(0, 204, 255);
  158. private final Color color4 = new Color(0, 0, 0, 205);
  159. private final Color color5 = new Color(0, 0, 0, 144);
  160.  
  161. private final BasicStroke stroke1 = new BasicStroke(1);
  162.  
  163. private final Font font1 = new Font("Arial", 1, 25);
  164. private final Font font2 = new Font("Arial", 0, 15);
  165.  
  166. public void onRepaint(Graphics g1) {
  167. Graphics2D g = (Graphics2D)g1;
  168.  
  169. long runTime = 0;
  170. long seconds = 0;
  171. long minutes = 0;
  172. long hours = 0;
  173.  
  174. runTime = System.currentTimeMillis() - startTime;
  175. seconds = runTime / 1000;
  176. if ( seconds >= 60 ) {
  177. minutes = seconds / 60;
  178. seconds -= (minutes * 60);
  179. }
  180. if ( minutes >= 60 ) {
  181. hours = minutes / 60;
  182. minutes -= (hours * 60);
  183. }
  184.  
  185. g.setColor(color1);
  186. g.fillRect(547, 207, 190, 212);
  187. g.setColor(color2);
  188. g.setStroke(stroke1);
  189. g.drawRect(547, 207, 190, 212);
  190. g.setFont(font1);
  191. g.setColor(color3);
  192. g.drawString("mineIT", 598, 242);
  193. g.setFont(font2);
  194. g.drawString("Run Time: " + hours + "." + minutes + "." + seconds, 550, 275);
  195. g.drawString("Ores Mined: " + minedOres, 550, 300);
  196. g.drawString("Levels Gained: " + mineLevelGained, 550, 325);
  197. g.drawString("Exp To Lvl: " + remainingXP, 550, 350);
  198. g.drawString("Exp Gained: " + mineExpGained, 550, 375);
  199. g.drawString("Inventories Dropped: " + invCount, 550, 400);
  200. g.setColor(color4);
  201. g.fillRect(9, 457, 152, 15);
  202. g.setColor(color2);
  203. g.drawRect(9, 457, 152, 15);
  204. g.setColor(color3);
  205. g.drawString("Status:" + status, 10, 470);
  206. g.setColor(color5);
  207. g.fillRect(3, 3, 107, 20);
  208. g.setColor(color2);
  209. g.drawRect(3, 3, 107, 20);
  210. g.setColor(color3);
  211. g.drawString("by PureFloy", 6, 18);
  212. }
  213.  
  214.  
  215. public int loop() {
  216. if(random(1, 500) > 425) {
  217. antiBan();
  218. }
  219. if (inventory.isFull()) {
  220. dropOre();
  221. } else if (!inventory.isFull()) {
  222. if (getMyPlayer().isIdle()) {
  223. mine();
  224. }
  225. }
  226. return random(300, 600);
  227. }
  228.  
  229. public class mineITGUI extends JPanel {
  230. public mineITGUI() {
  231. initComponents();
  232. }
  233.  
  234. private void initComponents() {
  235. // Generated using JFormDesigner Evaluation license - RuleZ.
  236. dialog1 = new JDialog();
  237. startscript = new JButton();
  238. title = new JLabel();
  239. oreselect = new JComboBox();
  240. selectore = new JLabel();
  241.  
  242. //======== dialog1 ========
  243. {
  244. dialog1.setResizable(false);
  245. dialog1.setTitle("mineIT GUI");
  246. Container dialog1ContentPane = dialog1.getContentPane();
  247. dialog1ContentPane.setLayout(null);
  248.  
  249. //---- startscript ----
  250. startscript.setText("Start");
  251. startscript.setSelectedIcon(null);
  252. dialog1ContentPane.add(startscript);
  253. startscript.setBounds(75, 95, 85, 25);
  254. startscript.addActionListener(new ActionListener() {
  255. public void actionPerformed(ActionEvent e) {
  256. startActionPerformed(e);
  257. }
  258. });
  259.  
  260. //---- title ----
  261. title.setText("mineIT");
  262. title.setFont(new Font("Tahoma", Font.PLAIN, 48));
  263. dialog1ContentPane.add(title);
  264. title.setBounds(10, 5, 155, 45);
  265.  
  266. //---- oreselect ----
  267. oreselect.setModel(new DefaultComboBoxModel(new String[] {
  268. "Clay",
  269. "Tin",
  270. "Copper",
  271. "Iron",
  272. "Silver",
  273. "Gold"
  274. }));
  275. dialog1ContentPane.add(oreselect);
  276. oreselect.setBounds(75, 65, 85, 25);
  277.  
  278. //---- selectore ----
  279. selectore.setText("Select Ore:");
  280. dialog1ContentPane.add(selectore);
  281. selectore.setBounds(5, 65, 70, 26);
  282.  
  283. { // compute preferred size
  284. Dimension preferredSize = new Dimension();
  285. for(int i = 0; i < dialog1ContentPane.getComponentCount(); i++) {
  286. Rectangle bounds = dialog1ContentPane.getComponent(i).getBounds();
  287. preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
  288. preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
  289. }
  290. Insets insets = dialog1ContentPane.getInsets();
  291. preferredSize.width += insets.right;
  292. preferredSize.height += insets.bottom;
  293. dialog1ContentPane.setMinimumSize(preferredSize);
  294. dialog1ContentPane.setPreferredSize(preferredSize);
  295. }
  296. dialog1.pack();
  297. dialog1.setLocationRelativeTo(dialog1.getOwner());
  298. }
  299. }
  300.  
  301. public void startActionPerformed(ActionEvent e) {
  302. if (selectore.getSelectedItem().equals("Clay")) {
  303. rockID = clayRock;
  304. } else if (selectore.getSelectedItem().equals("Tin")) {
  305. rockID = int[] tinRock;
  306. } else if (selectore.getSelectedItem().equals("Copper")) {
  307. rockID = int[] copperRock;
  308. } else if (selectore.getSelectedItem().equals("Iron")) {
  309. rockID = int[] ironRock;
  310. } else if (selectore.getSelectedItem().equals("Silver")) {
  311. rockID = int[] silverRock;
  312. } else if (selectore.getSelectedItem().equals("Gold")) {
  313. rockID = int[] goldRock;
  314. }
  315. }
  316.  
  317. // Generated using JFormDesigner Evaluation license - RuleZ.
  318. private JDialog dialog1;
  319. private JButton startscript;
  320. private JLabel title;
  321. private JComboBox oreselect;
  322. private JLabel selectore;
  323. }
  324.  
  325. }
Add Comment
Please, Sign In to add comment