Guest User

Untitled

a guest
Jul 14th, 2012
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.72 KB | None | 0 0
  1. import java.awt.*;
  2.  
  3. import java.awt.Component;
  4. import java.awt.Graphics;
  5.  
  6. import javax.swing.JOptionPane;
  7.  
  8. import org.powerbot.concurrent.Task;
  9. import org.powerbot.concurrent.strategy.Condition;
  10. import org.powerbot.concurrent.strategy.Strategy;
  11. import org.powerbot.game.api.ActiveScript;
  12. import org.powerbot.game.api.Manifest;
  13. import org.powerbot.game.api.methods.interactive.Players;
  14. import org.powerbot.game.api.methods.node.SceneEntities;
  15. import org.powerbot.game.api.methods.tab.Inventory;
  16. import org.powerbot.game.api.util.Filter;
  17. import org.powerbot.game.api.util.Time;
  18. import org.powerbot.game.api.wrappers.node.Item;
  19. import org.powerbot.game.api.wrappers.node.SceneObject;
  20. import org.powerbot.game.bot.event.listener.PaintListener;
  21.  
  22. import java.util.Timer;
  23.  
  24. @Manifest(authors = { "Syndicate" }, name = "SynMiner", description = "Power Mines Any Rock!", version = 1.0)
  25. public class SynMiner extends ActiveScript implements PaintListener{
  26.  
  27. private int rock; // ints are stored values that are numbers only
  28. private int ore;
  29.  
  30.  
  31. private boolean start = false; // booleans are always a way to determin true or false
  32.  
  33.  
  34. @Override
  35. protected void setup() {
  36. AskRock ar = new AskRock();
  37. submit(ar);
  38.  
  39. Mine m = new Mine();
  40. Strategy mStrategy = new Strategy(m, m);
  41. provide(mStrategy);
  42.  
  43. Drop d = new Drop();
  44. Strategy dStrategy = new Strategy(d, d);
  45. provide(dStrategy);
  46.  
  47. } // everything inside above is what gets started up when the script starts
  48. //(this stuff only runs once when the script is started then not again)
  49.  
  50.  
  51.  
  52.  
  53.  
  54. private class AskRock implements Task,Condition {
  55.  
  56. @Override
  57. public void run() {
  58. try {
  59. Component frame = null;
  60. rock = Integer.parseInt(JOptionPane.showInputDialog(frame, // opens a window to ask
  61. "Enter Your Rock ID Here!" + // for a number thats the ID of the rock
  62. " Iron Ore Is: 11956 / Varrock",
  63. "SynMiner V1.0 By: Syndicate",
  64. JOptionPane.INFORMATION_MESSAGE));
  65. } catch (Exception e) {
  66. stop();
  67. }
  68. AskOre ao = new AskOre();
  69. submit(ao);
  70. }
  71.  
  72. @Override
  73. public boolean validate() {
  74. return true;
  75. }
  76.  
  77.  
  78. }
  79.  
  80. private class AskOre implements Task,Condition {
  81.  
  82. @Override
  83. public void run() {
  84. try {
  85. Component frame = null;
  86. ore = Integer.parseInt(JOptionPane.showInputDialog(frame, // opens a window to ask
  87. "Enter Your Ore ID Here!" + // for a number thats the ID of the ore
  88. " Iron Ore Is: 440",
  89. "SynMiner V1.0 By: Syndicate",
  90. JOptionPane.INFORMATION_MESSAGE));
  91. } catch (Exception e) {
  92. stop();
  93. }
  94. start = true;
  95. }
  96.  
  97. @Override
  98. public boolean validate() {
  99. return false;
  100. }
  101.  
  102.  
  103. }
  104.  
  105.  
  106. private class Mine implements Task,Condition {
  107.  
  108. @Override
  109. public void run() {
  110.  
  111. SceneObject Rock = SceneEntities.getNearest(new Filter<SceneObject>() {
  112.  
  113. @Override
  114. public boolean accept(SceneObject ROCK) {
  115. //
  116. return start && ROCK.getId() == rock;
  117. }
  118.  
  119.  
  120.  
  121. });
  122.  
  123. if (Rock.isOnScreen() && !Inventory.isFull()) {
  124. Rock.interact("Mine");
  125. Time.sleep(1000,1800);
  126. if (Players.getLocal().getAnimation() != -1) {
  127. Time.sleep(500,800);
  128. }
  129.  
  130. }
  131.  
  132. }
  133.  
  134. @Override
  135. public boolean validate() {
  136.  
  137. return start;
  138. }
  139.  
  140.  
  141.  
  142.  
  143. }
  144.  
  145. private class Drop implements Task,Condition {
  146.  
  147. @Override
  148. public void run() {
  149. for (Item i : Inventory.getItems(new Filter<Item>()
  150. {public boolean accept(Item a) {return (a.getId() == ore);}})) {
  151. i.getWidgetChild().interact("Drop");
  152. }
  153. }
  154.  
  155.  
  156.  
  157. @Override
  158. public boolean validate() {
  159. return start && Inventory.getCount() == 28;
  160. }
  161.  
  162.  
  163.  
  164.  
  165. }
  166.  
  167.  
  168.  
  169. {
  170.  
  171.  
  172. }
  173.  
  174.  
  175.  
  176. public void onRepaint1(Graphics arg0) {
  177.  
  178.  
  179. }
  180.  
  181. private final Color color1 = new Color(18, 122, 55, 188);
  182. private final Color color2 = new Color(0, 0, 0);
  183. private final Color color3 = new Color(0, 239, 255);
  184.  
  185. private final BasicStroke stroke1 = new BasicStroke(1);
  186.  
  187. private final Font font1 = new Font("Arial", 0, 14);
  188.  
  189. public void onRepaint(Graphics g1) {
  190. Graphics2D g = (Graphics2D)g1;
  191. g.setColor(color1);
  192. g.fillRoundRect(547, 264, 190, 218, 16, 16);
  193. g.setColor(color2);
  194. g.setStroke(stroke1);
  195. g.drawRoundRect(547, 264, 190, 218, 16, 16);
  196. g.setFont(font1);
  197. g.setColor(color3);
  198. g.drawString("SynMiner v1", 581, 284);
  199. g.drawString("Time Running:", 548, 326);
  200. g.drawString("Xp Per Hour:", 550, 367);
  201. g.drawString("Xp Gained:", 551, 407);
  202. g.drawString("Made By Syndicate", 578, 476);
  203. }
  204.  
  205. }
Advertisement
Add Comment
Please, Sign In to add comment