Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.28 KB | None | 0 0
  1. import java.awt.Graphics;
  2. import java.util.HashMap;
  3.  
  4. import org.rsbot.client.RSItem;
  5. import org.rsbot.event.events.MessageEvent;
  6. import org.rsbot.event.listeners.MessageListener;
  7. import org.rsbot.event.listeners.PaintListener;
  8. import org.rsbot.script.Script;
  9. import org.rsbot.script.ScriptManifest;
  10. import org.rsbot.script.methods.Skills;
  11. import org.rsbot.script.wrappers.RSArea;
  12. import org.rsbot.script.wrappers.RSObject;
  13. import org.rsbot.script.wrappers.RSTile;
  14. import org.rsbot.script.wrappers.RSTilePath;
  15.  
  16. @ScriptManifest(name = "Burning Firemaker", authors = {"Firexranger8"}, keywords = "Firemaking", version = 1.0,
  17. description = "Select options in the GUI. Good luck with your goal.")
  18. public class BurningFiremaker extends Script implements PaintListener, MessageListener{
  19.  
  20. int tinderboxID = 590;
  21. int bankBoothID = 0;
  22. int startExp;
  23. int startTime;
  24. int startLevel;
  25. public static FMLoc location;
  26. public static LOGS LOGS;
  27. private long activity_time;
  28. private static boolean gui_on = false;
  29. private RSTilePath path;
  30. private RSTilePath path_back;
  31. private long expGained;
  32. private int expHour;
  33. private static final FMLoc[] LOCATIONS = new FMLoc[]{
  34. new FMLoc("Varrock West", new RSArea(new RSTile(0000, 0000), new RSTile(0000, 0000)), new RSTile(0000, 0000), new RSTile(0000, 0000), new RSTile(0000, 0000), new RSTile(0000, 0000), new RSTile[]{new RSTile(0000, 0000)})
  35. };
  36. private static final LOGS[] Logs = new LOGS[]{
  37. new LOGS("Normal Logs", 123),
  38. new LOGS("Oak Logs", 234)};
  39.  
  40. @Override
  41. public int loop() {
  42. return 0;
  43. }
  44.  
  45. public boolean onStart(){
  46. new GUI().setVisible(true);
  47. while (gui_on) {
  48. sleep(20);
  49. }
  50. if (location.equals(LOCATIONS[0])) {
  51. log("We are firemaking at Varrock West.");
  52. } else if (location.equals(LOCATIONS[1])) {
  53. log("We are firemaking in Varrock East.");
  54. } else if (location.equals(LOCATIONS[2])) {
  55. log("We are firemaking in Varrock East.");
  56. } else if (location.equals(LOCATIONS[3])) {
  57. log("We are firemaking in Grand Exchange.");
  58. } else if (location.equals(LOCATIONS[4])) {
  59. log("We are firemaking in Draynor.");
  60. }
  61. path = walking.newTilePath(location.walk_path);
  62. path_back = walking.newTilePath(location.walk_path).reverse();
  63. startExp = skills.getCurrentExp(Skills.FIREMAKING);
  64. startLevel = skills.getCurrentLevel(Skills.FIREMAKING);
  65. startTime = (int) System.currentTimeMillis();
  66. if(!game.isLoggedIn()){
  67. log("Log before starting this script just cause I told you so!");
  68. stopScript();
  69. };
  70. log("Thanks for using my script today! Have fun botting!");
  71. log("Time to burn logs with a burning scipt!!! xD");
  72. return true;
  73. }
  74.  
  75. private boolean inArea(RSArea area) {
  76. return area.contains(getMyPlayer().getLocation());
  77. }
  78.  
  79. public void onFinish() {
  80. log("Thanks for using my script! Make reccomendations or tips at powerbot.org");
  81. log("This script is only to be used on rsbot version 2.25+ through powerbot.org");
  82. }
  83.  
  84. private void depositAll() {
  85. if(bank.isOpen()){
  86. bank.depositAllExcept(tinderboxID);
  87. }
  88. }
  89.  
  90. public void withdraw() {
  91. if(bank.isOpen()){
  92. org.rsbot.script.wrappers.RSItem logs = inventory.getItem(LOGS.inv_id);
  93. if(!inventory.containsOneOf(tinderboxID)){
  94. bank.withdraw(tinderboxID, 1);
  95. if(inventory.containsOneOf(tinderboxID)){
  96. bank.withdraw(LOGS, 0);
  97. for (int i = 0; i < 100
  98. && !inventory.contains(LOGS.inv_id); i++)
  99. sleep(20);
  100. }else {
  101. if (!inventory.contains(LOGS.inv_id)) {
  102. if (inventory.getCount() > 1) {
  103. bank.depositAll();
  104. }
  105. bank.withdraw(LOGS, 0);
  106. for (int i = 0; i < 100
  107. && !inventory.contains(LOGS.inv_id); i++)
  108. sleep(20);
  109. }
  110. }
  111. }
  112. }
  113. }
  114.  
  115. private void openBank() {
  116. if(getMyPlayer().getAnimation() == -1){
  117. RSObject bank = objects.getNearest(bankBoothID);{
  118. if(bank !=null && !inventory.contains(LOGS.inv_id));
  119. bank.doAction("uickly");
  120. }if(bank !=null && inventory.contains(LOGS.inv_id));
  121. firemake();
  122. }else
  123. log("[ERROR] You are not anywhere near the bank and you are out of logs!");
  124. log("[ERROR] Logging out now");
  125. stopScript();
  126. game.logout(true);
  127. }
  128.  
  129. private void closeBank() {
  130.  
  131. }
  132.  
  133. private void bank() {
  134. openBank();
  135. depositAll();
  136. withdraw();
  137. closeBank();
  138. }
  139.  
  140. private void firemake() {
  141. org.rsbot.script.wrappers.RSItem logs = inventory.getItem(LOGS.inv_id);
  142. org.rsbot.script.wrappers.RSItem dinderbox = inventory.getItem(tinderboxID);
  143. if(inventory.contains(LOGS.inv_id) && getMyPlayer().getAnimation() == -1);
  144. inventory.useItem(dinderbox, logs);
  145. sleep(random(140, 170));
  146. }
  147.  
  148. @Override
  149. public void onRepaint(Graphics render) {
  150.  
  151. }
  152.  
  153. @Override
  154. public void messageReceived(MessageEvent e) {
  155.  
  156. }
  157. /*
  158. * To change this template, choose Tools | Templates
  159. * and open the template in the editor.
  160. */
  161.  
  162. /*
  163. * GUI.java
  164. *
  165. * Created on Feb 5, 2011, 11:06:03 PM
  166. */
  167.  
  168. /**
  169. *
  170. * @author Matt / Firexranger8 / th3_n4m3les5
  171. */
  172. public static class GUI extends javax.swing.JFrame {
  173.  
  174. private final String[] LOGS = new String[Logs.length];
  175. private final String[] locations = new String[LOCATIONS.length];
  176. private HashMap<String, FMLoc> locMap = new HashMap<String, FMLoc>();
  177. private HashMap<String, LOGS> matMap = new HashMap<String, LOGS>();
  178.  
  179. /** Creates new form GUI */
  180. public GUI() {
  181. initComponents();
  182. }
  183.  
  184. /** This method is called from within the constructor to
  185. * initialize the form.
  186. * WARNING: Do NOT modify this code. The content of this method is
  187. * always regenerated by the Form Editor.
  188. */
  189. @SuppressWarnings("unchecked")
  190. // <editor-fold defaultstate="collapsed" desc="Generated Code">
  191. private void initComponents() {
  192.  
  193. gui_on = true;
  194. for (int i = 0; i < Logs.length; i++) {
  195. LOGS[i] = Logs[i].name;
  196. matMap.put(LOGS[i], Logs[i]);
  197. }
  198. for (int i = 0; i < LOCATIONS.length; i++) {
  199. locations[i] = LOCATIONS[i].name;
  200. locMap.put(locations[i], LOCATIONS[i]);
  201. }
  202.  
  203. jLabel1 = new javax.swing.JLabel();
  204. jLabel2 = new javax.swing.JLabel();
  205. jButton1 = new javax.swing.JButton();
  206. jComboBox1 = new javax.swing.JComboBox();
  207. jLabel3 = new javax.swing.JLabel();
  208. jLabel4 = new javax.swing.JLabel();
  209. jComboBox2 = new javax.swing.JComboBox();
  210.  
  211. setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
  212. setTitle("Burnign Firemaker | Firexranger8");
  213.  
  214. jLabel1.setFont(new java.awt.Font("Franklin Gothic Book", 1, 14)); // NOI18N
  215. jLabel1.setForeground(new java.awt.Color(153, 0, 0));
  216. jLabel1.setText("BURNING FIREMAKER");
  217.  
  218. jLabel2.setText("1337 Script by Firexranger8");
  219.  
  220. jButton1.setFont(new java.awt.Font("Monotype Corsiva", 0, 18)); // NOI18N
  221. jButton1.setText("START");
  222. jButton1.addActionListener(new java.awt.event.ActionListener() {
  223. public void actionPerformed(java.awt.event.ActionEvent evt) {
  224. jButton1ActionPerformed(evt);
  225. }
  226. });
  227.  
  228. jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Normal Logs", "Oak Logs", "Willow Logs", "Teak Logs", "Arctic Pine Logs", "Maple Logs", "Mahogany Logs", "Eucalyptus Logs", "Yew Logs", "Magic Logs", "Cursed Magic Logs" }));
  229.  
  230. jLabel3.setText("Logs");
  231.  
  232. jLabel4.setText("Location");
  233.  
  234. jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Varrock West", "Varrock East", "Grand Exchange", "Draynor", "Fist of Guthix", "Edgeville", "Falador", "Yanille" }));
  235.  
  236. javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  237. getContentPane().setLayout(layout);
  238. layout.setHorizontalGroup(
  239. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  240. .addGroup(layout.createSequentialGroup()
  241. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  242. .addGroup(layout.createSequentialGroup()
  243. .addContainerGap()
  244. .addComponent(jLabel2))
  245. .addGroup(layout.createSequentialGroup()
  246. .addGap(35, 35, 35)
  247. .addComponent(jButton1))
  248. .addComponent(jLabel1))
  249. .addGap(47, 47, 47)
  250. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  251. .addComponent(jLabel3)
  252. .addComponent(jLabel4))
  253. .addGap(40, 40, 40)
  254. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
  255. .addComponent(jComboBox2, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  256. .addComponent(jComboBox1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  257. .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  258. );
  259. layout.setVerticalGroup(
  260. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  261. .addGroup(layout.createSequentialGroup()
  262. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  263. .addGroup(layout.createSequentialGroup()
  264. .addComponent(jLabel1)
  265. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  266. .addComponent(jLabel2)
  267. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  268. .addComponent(jButton1))
  269. .addGroup(layout.createSequentialGroup()
  270. .addContainerGap()
  271. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  272. .addComponent(jLabel3)
  273. .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  274. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  275. .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  276. .addComponent(jLabel4)
  277. .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
  278. .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  279. );
  280.  
  281. pack();
  282. }// </editor-fold>
  283.  
  284. /**
  285. * @param args the command line arguments
  286. */
  287. public static void main(String args[]) {
  288. java.awt.EventQueue.invokeLater(new Runnable() {
  289. public void run() {
  290. new GUI().setVisible(true);
  291. }
  292. });
  293. }
  294.  
  295. private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
  296. location = locMap.get(jComboBox1.getSelectedItem().toString());
  297. LOGS = matMap.get(jComboBox2.getSelectedItem().toString());
  298. gui_on = false;
  299. setVisible(false);
  300. }
  301.  
  302. // Variables declaration - do not modify
  303. private javax.swing.JButton jButton1;
  304. private javax.swing.JComboBox jComboBox1;
  305. private javax.swing.JComboBox jComboBox2;
  306. private javax.swing.JLabel jLabel1;
  307. private javax.swing.JLabel jLabel2;
  308. private javax.swing.JLabel jLabel3;
  309. private javax.swing.JLabel jLabel4;
  310. // End of variables declaration
  311.  
  312. }
  313.  
  314. static class FMLoc {
  315. public String name;
  316. public RSArea bank_area;
  317. public RSTile spot1;
  318. public RSTile spot2;
  319. public RSTile spot3;
  320. public RSTile spot4;
  321. public RSTile[] walk_path;
  322.  
  323. public FMLoc(String name, RSArea bankZones, RSTile spot1, RSTile spot2, RSTile spot3, RSTile spot4,
  324. RSTile[] WALK_PATH) {
  325. this.name = name;
  326. this.bank_area = bankZones;
  327. this.spot1 = spot1;
  328. this.spot2 = spot2;
  329. this.spot3 = spot3;
  330. this.spot4 = spot4;
  331. this.walk_path = WALK_PATH;
  332. }
  333. }
  334.  
  335. static class LOGS {
  336. public String name;
  337. public int inv_id;
  338.  
  339. public LOGS(String name, int INV_ID) {
  340. this.name = name;
  341. this.inv_id = INV_ID;
  342. }
  343. }
  344.  
  345. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement