Advertisement
Guest User

Untitled

a guest
Aug 12th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.21 KB | None | 0 0
  1. import org.rsbot.event.listeners.PaintListener;
  2. import org.rsbot.script.Script;
  3. import org.rsbot.script.ScriptManifest;
  4. import org.rsbot.script.methods.Game;
  5. import org.rsbot.script.methods.Skills;
  6. import org.rsbot.script.wrappers.RSItem;
  7. import java.awt.*;
  8. import org.rsbot.event.events.MessageEvent;
  9. import org.rsbot.event.listeners.MessageListener;
  10. import java.awt.*;
  11. import java.awt.event.*;
  12. import javax.swing.*;
  13.  
  14. @ScriptManifest(
  15. name = "DommsBoneBury",
  16. authors = "Domm-rsbot",
  17. keywords = "",
  18. version = 1.3,
  19. description = "Burys bones and banks")
  20.  
  21. public class DommsBoneBury extends Script implements PaintListener, MessageListener {
  22. public int startLevel;
  23. public int currLevel;
  24. public int lvlsGained;
  25.  
  26. private int percentTNL;
  27. public int MonkeyBones = 528;
  28. public int BigBones = 532;
  29. public int NormalBone = 526;
  30. public int BonesBuried = 0;
  31. public int BabyDragonBones = 534;
  32. public int DragonBones = 536;
  33. public int DagannothBones = 6729;
  34. public int FrostDragonBones = 18832;
  35. private final Color color1 = new Color(0, 255, 51, 158);
  36. private final Color color5 = new Color(255, 0, 51);
  37. private final Color color6 = new Color(0, 0, 0);
  38. private final Color color7 = new Color(0, 255, 0);
  39. private final Color color8 = new Color(0, 255, 51);
  40.  
  41. private final BasicStroke stroke2 = new BasicStroke(2);
  42.  
  43.  
  44. public int BonesToBury;
  45. ///////////////////////// BONES TO NEXT LEVEL WTF FIX!
  46. public int NormalBoneEXP = (int) 4.5;
  47. public int bonesTill;
  48. int boneXP;
  49. ///////////////////////BONES TO NEXT LEVEL WTF FIX!
  50.  
  51. public long startTime = System.currentTimeMillis();
  52.  
  53. private final Color color2 = new Color(0, 0, 0);
  54.  
  55. private final Font font1 = new Font("Consolas", 1, 15);
  56. private final Font font2 = new Font("Arial", 1, 11);
  57.  
  58. public int expGained = 0;
  59.  
  60. private String status = "Loading..";
  61. public int startExp = 0;
  62. public int BurysHour = 0;
  63.  
  64. private boolean guiWait = true;
  65. Gui g = new Gui();
  66.  
  67.  
  68.  
  69. public boolean onStart(){
  70. startLevel = skills.getCurrentLevel(Skills.PRAYER);
  71. startExp = skills.getCurrentExp(Skills.PRAYER);
  72. g.setVisible(true);
  73. while(guiWait) sleep (500);
  74. return true;
  75. }
  76.  
  77.  
  78. @Override
  79. public int loop(){
  80. if(inventory.containsOneOf(BonesToBury)){
  81. Bury();
  82. }else if(!inventory.containsOneOf(BonesToBury)){
  83. Bank();
  84.  
  85.  
  86.  
  87. }
  88. return 200;
  89. }
  90.  
  91. public void Bank(){
  92. status = "Banking..";
  93. if(bank.isOpen()){
  94. bank.depositAllExcept(BonesToBury);
  95. bank.withdraw(BonesToBury, 28);
  96. bank.close();
  97.  
  98. }else if(!bank.isOpen()){
  99. status = "Banking..";
  100. bank.open();
  101. bank.depositAllExcept(BonesToBury);
  102. bank.withdraw(BonesToBury, 28);
  103. bank.close();
  104.  
  105. }
  106. }
  107.  
  108.  
  109.  
  110. private void antiban(){
  111.  
  112. }
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121. private void Bury(){
  122. while (inventory.containsOneOf(BonesToBury)) {
  123. sleep(random(30, 60));
  124. mouse.setSpeed(random(10, 15));
  125. status = "Burying bones";
  126. inventory.getItem(BonesToBury).doAction("Bury");
  127. BonesBuried++;
  128. sleep(random(900, 1250));
  129. }
  130. }
  131.  
  132.  
  133.  
  134.  
  135. @Override
  136. public void onRepaint(Graphics g1) {
  137. long millis = System.currentTimeMillis() - startTime;
  138. long hours = millis / (1000 * 60 * 60);
  139. millis -= hours * (1000 * 60 * 60);
  140. long minutes = millis / (1000 * 60);
  141. millis -= minutes * (1000 * 60);
  142. long seconds = millis / 1000;
  143. BurysHour = (int) ((BonesBuried) * 3600000D / (System.currentTimeMillis() - startTime));
  144. bonesTill = (int) (skills.getExpToNextLevel(Skills.PRAYER) / boneXP);
  145.  
  146. currLevel = skills.getCurrentLevel(skills.PRAYER);
  147. lvlsGained = currLevel - startLevel;
  148. percentTNL = skills.getPercentToNextLevel(skills.PRAYER);
  149. final int percentBar = (int) (skills.getPercentToNextLevel(skills.PRAYER)*1.75);
  150.  
  151. Graphics2D g = (Graphics2D)g1;
  152. expGained = skills.getCurrentExp(Skills.PRAYER) - startExp;
  153. g.setColor(color1);
  154. g.fillRoundRect(4, 6, 243, 173, 16, 16);
  155.  
  156.  
  157. g.setFont(font1);
  158. g.setColor(color2);
  159. g.drawString("Domm's Bone Burier!", 15, 32);
  160. g.setFont(font2);
  161. g.drawString("Time Running: " + hours + ": " + minutes + ": " + seconds, 14, 55);
  162. g.drawString("Status:" + status, 13, 74);
  163. g.drawString("Exp Gained:" + expGained, 10, 91);
  164. g.drawString("Levels Gained:" + lvlsGained, 125, 91);
  165. g.drawString("Bones Buried:" + BonesBuried, 10, 108);
  166. g.drawString("Bury's Per Hour:" + BurysHour, 8, 124);
  167. g.drawString("Aprox Bury's TNL:" +bonesTill, 8, 143);
  168. g.setColor(color5);
  169. g.fillRoundRect(10, 195, 175, 25, 16, 16);
  170. g.setColor(color6);
  171. g.setStroke(stroke2);
  172. g.drawRoundRect(10, 195, 175, 25, 16, 16);
  173. g.setColor(color7);
  174. g.fillRoundRect(10, 195, percentBar, 23, 16, 16);
  175. g.setColor(color8);
  176. g.drawRoundRect(10, 195, percentBar, 23, 16, 16);
  177. }
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184. @Override
  185. public void messageReceived(MessageEvent e) {
  186. String x = e.getMessage().toLowerCase();
  187. if (x.contains("dig a hole in")){
  188. BonesBuried++;
  189. }
  190. } class Gui extends JFrame {
  191. public Gui() {
  192. initComponents();
  193. }
  194.  
  195. private void button1ActionPerformed(ActionEvent e) {
  196. String chosen = BoneSelected.getSelectedItem().toString();
  197. if(chosen.equals("Big Bones")){
  198. BonesToBury = BigBones;
  199. boneXP = 25;
  200. log ("Command Detected - Burying Big Bones");
  201. }else if(chosen.equals("Normal Bones")){
  202. BonesToBury = NormalBone;
  203. boneXP = 9/2;
  204. log ("Command Detected - Burying Normal Bones");
  205. }else if(chosen.equals("Monkey Bones")){
  206. BonesToBury = MonkeyBones;
  207. boneXP = 5;
  208. log ("Command Detected - Burying Monkey Bones");
  209. }else if(chosen.equals("Dragon Bones")){
  210. BonesToBury = DragonBones;
  211. boneXP = 72;
  212. log ("Command Detected - Burying Dragon Bones");
  213. }else if(chosen.equals("Baby Dragon Bones")){
  214. BonesToBury = BabyDragonBones;
  215. boneXP = 35;
  216. log ("Command Detected - Baby Dragon Bones");
  217. }else if(chosen.equals("Dagannoth Bones")){
  218. BonesToBury = DagannothBones;
  219. boneXP = 125;
  220. log ("Command Detected - Burying Dagannoth Bones");
  221. }else if(chosen.equals("Frost Dragon Bones")){
  222. BonesToBury = FrostDragonBones;
  223. boneXP = 180;
  224. log ("Command Detected - Burying Frost Dragon Bones");
  225.  
  226.  
  227. }
  228. guiWait = false;
  229. g.dispose();
  230. }
  231.  
  232. private void initComponents() {
  233. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  234. // Generated using JFormDesigner Evaluation license - Dom Das
  235. label1 = new JLabel();
  236. label2 = new JLabel();
  237. BoneSelected = new JComboBox();
  238. button1 = new JButton();
  239.  
  240. //======== this ========
  241. Container contentPane = getContentPane();
  242.  
  243. //---- label1 ----
  244. label1.setText("Domm's Bone Burier");
  245. label1.setFont(label1.getFont().deriveFont(label1.getFont().getSize() + 8f));
  246.  
  247. //---- label2 ----
  248. label2.setText("Bones to Bury:");
  249. label2.setFont(label2.getFont().deriveFont(label2.getFont().getSize() + 4f));
  250.  
  251. //---- BoneSelected ----
  252. BoneSelected.setModel(new DefaultComboBoxModel(new String[] {
  253. "Big Bones",
  254. "Monkey Bones",
  255. "Normal Bones",
  256. "Baby Dragon Bones",
  257. "Dragon Bones",
  258. "Dagannoth Bones",
  259. "Frost Dragon Bones"
  260. }));
  261.  
  262. //---- button1 ----
  263. button1.setText("START");
  264. button1.addActionListener(new ActionListener() {
  265. @Override
  266. public void actionPerformed(ActionEvent e) {
  267. button1ActionPerformed(e);
  268. }
  269. });
  270.  
  271. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  272. contentPane.setLayout(contentPaneLayout);
  273. contentPaneLayout.setHorizontalGroup(
  274. contentPaneLayout.createParallelGroup()
  275. .addGroup(contentPaneLayout.createSequentialGroup()
  276. .addGroup(contentPaneLayout.createParallelGroup()
  277. .addGroup(contentPaneLayout.createSequentialGroup()
  278. .addGap(45, 45, 45)
  279. .addComponent(label1, GroupLayout.PREFERRED_SIZE, 179, GroupLayout.PREFERRED_SIZE))
  280. .addGroup(contentPaneLayout.createSequentialGroup()
  281. .addContainerGap()
  282. .addComponent(label2, GroupLayout.PREFERRED_SIZE, 108, GroupLayout.PREFERRED_SIZE)
  283. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  284. .addComponent(BoneSelected, GroupLayout.PREFERRED_SIZE, 120, GroupLayout.PREFERRED_SIZE)))
  285. .addContainerGap(30, Short.MAX_VALUE))
  286. .addGroup(GroupLayout.Alignment.TRAILING, contentPaneLayout.createSequentialGroup()
  287. .addContainerGap(65, Short.MAX_VALUE)
  288. .addComponent(button1, GroupLayout.PREFERRED_SIZE, 151, GroupLayout.PREFERRED_SIZE)
  289. .addGap(56, 56, 56))
  290. );
  291. contentPaneLayout.setVerticalGroup(
  292. contentPaneLayout.createParallelGroup()
  293. .addGroup(contentPaneLayout.createSequentialGroup()
  294. .addComponent(label1)
  295. .addGap(18, 18, 18)
  296. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  297. .addComponent(label2)
  298. .addComponent(BoneSelected, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  299. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 60, Short.MAX_VALUE)
  300. .addComponent(button1, GroupLayout.PREFERRED_SIZE, 35, GroupLayout.PREFERRED_SIZE)
  301. .addContainerGap())
  302. );
  303. pack();
  304. setLocationRelativeTo(getOwner());
  305. // JFormDesigner - End of component initialization //GEN-END:initComponents
  306. }
  307.  
  308. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  309. // Generated using JFormDesigner Evaluation license - Dom Das
  310. private JLabel label1;
  311. private JLabel label2;
  312. private JComboBox BoneSelected;
  313. private JButton button1;
  314. // JFormDesigner - End of variables declaration //GEN-END:variables
  315. }
  316. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement