Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.34 KB | None | 0 0
  1. ////Please do not use any part of this script and claim it as yours, please give proper credits!
  2. ////Thanks for using my first script ~ GsysSupa
  3. ////Special thanks to pinkeltje for the ANTIBAM! and GUI
  4.  
  5. import java.awt.*;
  6. import java.awt.event.*;
  7. import javax.imageio.ImageIO;
  8. import javax.swing.*;
  9. import javax.swing.border.*;
  10. import java.io.IOException;
  11. import java.net.URL;
  12. import java.net.MalformedURLException;
  13. import java.awt.image.BufferedImage;
  14.  
  15. import org.rsbot.event.events.MessageEvent;
  16. import org.rsbot.event.listeners.MessageListener;
  17. import org.rsbot.event.listeners.PaintListener;
  18. import org.rsbot.script.ScriptManifest;
  19. import org.rsbot.script.Script;
  20. import org.rsbot.script.wrappers.RSArea;
  21. import org.rsbot.script.wrappers.RSObject;
  22. import org.rsbot.script.wrappers.RSPath;
  23. import org.rsbot.script.wrappers.RSTile;
  24. import org.rsbot.script.methods.Camera;
  25.  
  26.  
  27. @ScriptManifest(authors = { "GsysSupa" }, keywords = { "Woodcutting Firemaking" }, name = "SupaChop", version = 1.04, description = "Chops Willows then burns em")
  28. public class SupaChop extends Script implements PaintListener, MessageListener, MouseListener { //Start
  29.  
  30. boolean lights = false;
  31. boolean antibam2 = true;
  32. boolean bank = false;
  33. boolean powerchop = false;
  34. boolean lightlogs = false;
  35. boolean showpaint = true;
  36. boolean showFancy = true;
  37. public long startTime = System.currentTimeMillis();
  38.  
  39. int expGained = 0;
  40. int expGained2 = 0;
  41. int startExp = 0;
  42. int startExp2 = 0;
  43. int Willowschopped = 0;
  44. int Logslit = 0;
  45. int lvlsgained = 0;
  46. int lvlsgained2 = 0;
  47. private final Color color2 = new Color(0, 0, 0);
  48. private final Color color11 = new Color(0, 255, 0);
  49. private final Color color22 = new Color(0, 0, 0, 70);
  50. private final Color color33 = new Color(0, 255, 0, 50);
  51. private final Color color44 = new Color(255, 0, 0, 50);
  52. private final Color color55 = new Color(255, 0, 0);
  53. private final Font font11 = new Font("Arial Bold", 0, 20);
  54. private final Font font22 = new Font("Arial Bold", 0, 15);
  55. private final Font font33 = new Font("Arial Bold", 0, 12);
  56. private int dontdrop[] = {1351, 1349, 1353, 1355, 1357, 1359, 1361, 590};
  57. private int logs[] = {1511, 1519};
  58. private int tree[] = {5551, 5552, 5553, 1308, 38627, 38616, 38627, 2210, 142, 2372, 139};
  59.  
  60.  
  61. Rectangle closeButton = new Rectangle(547, 452, 95, 15);//
  62. Point p;
  63.  
  64. public boolean onStart(){
  65. SupaChopGUI gui = new SupaChopGUI();
  66. gui.setVisible(true);
  67. while (!gui.isReady) {
  68. sleep(50);
  69. }
  70.  
  71. log("SupaChop Started...");
  72. startTime = System.currentTimeMillis();
  73. return true;
  74. }
  75.  
  76. private boolean lightlane() {
  77. RSArea lane = new RSArea(new RSTile(3010, 3191), new RSTile(2985, 3191));
  78. return lane.contains(getMyPlayer().getLocation());
  79. }
  80.  
  81. private boolean lightstart() {
  82. RSArea lane = new RSArea(new RSTile(3007, 3192), new RSTile(3009, 3189));
  83. return lane.contains(getMyPlayer().getLocation());
  84. }
  85.  
  86. private boolean lightend() {
  87. RSArea lane = new RSArea(new RSTile(2987, 3190), new RSTile(2984, 3192));
  88. return lane.contains(getMyPlayer().getLocation());
  89. }
  90.  
  91.  
  92. @Override
  93. public int loop() {
  94. if(inventory.isFull()) {
  95. if(lightlogs == true){
  96. walklane();
  97. if(lightstart()){
  98. lights = true;
  99. }
  100. }
  101. if(powerchop == true){
  102. drop();
  103. }
  104. } else {
  105. if(lightlane()){
  106. if(lightlogs == true){
  107. light();
  108. }
  109. if(lightend()){
  110. lights = false;
  111. }
  112. } else {
  113. choplogs();
  114. }
  115.  
  116. }
  117. if(lights == true){
  118. light();
  119. }
  120.  
  121. return random(600, 800);
  122. }
  123.  
  124.  
  125. private void choplogs() {
  126. if (objects.getNearest(tree) != null & !inventory.isFull()) {
  127. RSObject object = objects.getNearest(tree);
  128. if (calc.tileOnScreen(object.getLocation())) {
  129. if (getMyPlayer().getAnimation() == -1) {
  130. object.doAction("Chop");
  131. sleep(2000, 2500);
  132. }
  133. } else if (!calc.tileOnScreen(object.getLocation())) {
  134. camera.turnTo(object.getLocation());
  135. antiBam();
  136. walking.walkTileMM(objects.getNearest(tree).getLocation());
  137. sleep(800, 1000);
  138. }
  139. sleep(1800, 2000);
  140. }
  141. }
  142.  
  143. private void light() {
  144. if(lightlane()){
  145. if(inventory.contains(590) == true){
  146. if(getMyPlayer().getAnimation() != 733){
  147. mouse.setSpeed(random(8, 12));
  148. if(inventory.contains(1519) == true){
  149. inventory.useItem(590, 1519);
  150. camera.setAngle(random(19, 532));
  151. }
  152. sleep(random(10, 13));
  153. }
  154. }else {
  155. log("No Tinderbox found, switching to powerchopping");
  156. lightlogs = false;
  157. powerchop = true;
  158. lights = false;
  159. sleep(random(50, 200));
  160. }
  161. }
  162. }
  163.  
  164. private void drop() {
  165. inventory.dropAllExcept(dontdrop);
  166. sleep(random(50, 200));
  167. }
  168.  
  169. private void walklane() {
  170. camera.turnTo(new RSTile(3009, 3191));
  171. walking.walkTileOnScreen(new RSTile(3009, 3191));
  172. sleep(594, 1479);
  173. }
  174.  
  175.  
  176. public void mouseClicked(MouseEvent e) {
  177. p = e.getPoint();
  178. if(closeButton.contains(p)){
  179. showpaint = !showpaint;
  180. }
  181. }
  182. public void mouseEntered(MouseEvent e){
  183. }
  184. public void mouseExited(MouseEvent e){
  185. }
  186. public void mouseReleased(MouseEvent e){
  187. }
  188. public void mousePressed(MouseEvent e){
  189. }
  190.  
  191. private Image getImage(String url) {
  192. try {
  193. return ImageIO.read(new URL(url));
  194. } catch(IOException e) {
  195. return null;
  196. }
  197. }
  198.  
  199. @Override
  200. public void onRepaint(Graphics g) {
  201.  
  202. long millis = System.currentTimeMillis() - startTime;
  203. long hours = millis / (1000 * 60 * 60);
  204. millis -= hours * (1000 * 60 * 60);
  205. long minutes = millis / (1000 * 60);
  206. millis -= minutes * (1000 * 60);
  207. long seconds = millis / 1000;
  208.  
  209. Graphics2D g1 = (Graphics2D)g;
  210.  
  211. if(showpaint != true){
  212.  
  213. g.setColor(color2);
  214. g.setFont(font33);
  215. g.drawString("Show", 552, 463);
  216.  
  217. }else {
  218.  
  219. // Mouse
  220. g.setColor(color11);
  221. g.drawLine(0, (int) (mouse.getLocation().getY()), 800, (int) (mouse.getLocation().getY()));
  222. g.setColor(color55);
  223. g.drawLine((int) (mouse.getLocation().getX()), 0, (int) (mouse.getLocation().getX()), 800);
  224.  
  225. if(showFancy == true){
  226.  
  227. g.setColor(color22);
  228. g.fillRect(547, 205, 190, 261);
  229.  
  230. g.setFont(font33);
  231. g.setColor(color11);
  232. g.drawString("Runtime: "+ hours + ": " + minutes + ": " + seconds, 561, 222);
  233. g.drawString("Wc exp gained: "+ Willowschopped * 67, 561, 240);
  234. g.drawString("Willows chopped: "+ Willowschopped, 561, 258);
  235. g.drawString("Wc level: "+ skills.getCurrentLevel(skills.WOODCUTTING), 561, 276);
  236. g.drawString("Wc levels gained: "+ lvlsgained, 561, 294);
  237. g.drawString("Willow logs TNL: "+ skills.getExpToNextLevel(skills.WOODCUTTING) /67, 561, 312);
  238.  
  239.  
  240. g.setFont(font22);
  241. g.drawRect(547, 205, 190, 261);
  242. g.setFont(font33);
  243. g.drawString("Hide", 552, 463);//1
  244. g.drawRect(547, 451, 95, 15);
  245.  
  246.  
  247. g.fillRect(7, 459, 100, 14);
  248. g.setColor(Color.black);
  249. g.drawRect(7, 459, 100, 14);
  250. g.drawImage(img1, 700, 210, null);
  251.  
  252. //Progressbar
  253. final int percent = skills.getPercentToNextLevel(8);
  254. g.setColor(color33);
  255. g.fillRect(3, 3, percent*5, 21);
  256. g.setColor(color11);
  257. g.setFont(font11);
  258. g.drawString("Wc " + percent + "%", 250, 21);
  259. g.setColor(color11);
  260. g.drawRect(3, 3, percent*5, 21);
  261.  
  262. if(lightlogs == true){
  263. //Fm Progressbar
  264. final int percent2 = skills.getPercentToNextLevel(11);
  265. g.setColor(color44);
  266. g.fillRect(3, 25, percent2*5, 21);
  267. g.setColor(color55);
  268. g.setFont(font11);
  269. g.drawString("Fm " + percent2 + "%", 250, 43);
  270. g.setColor(color55);
  271. g.drawRect(3, 25, percent2*5, 21);
  272.  
  273. g.setFont(font33);
  274. g.setColor(color55);
  275. g.drawString("Fm exp gained: "+ Logslit * 90, 561, 348);
  276. g.drawString("Logs burned: "+ Logslit, 561, 366);
  277. g.drawString("Fm level: "+ skills.getCurrentLevel(skills.FIREMAKING), 561, 384);
  278. g.drawString("Fm levels gained: "+ lvlsgained2, 561, 402);
  279. g.drawString("Logs to burn TNL: "+ skills.getExpToNextLevel(skills.FIREMAKING) /67, 561, 420);
  280. g.drawString("Burning Logs", 647, 463);
  281. g.drawRect(642, 451, 95, 15);
  282. }
  283.  
  284. if(powerchop == true){
  285. g.setFont(font33);
  286. g.setColor(color11);
  287. g.drawString("Powerchopping", 647, 463);
  288. g.drawRect(642, 451, 95, 15);
  289. }
  290. }
  291. }
  292. }
  293.  
  294. public void antiBam() { //ANTIBAM! made by pinkeltje
  295. int b = random(0, 10);
  296. switch (b) {
  297. case 1:
  298. if(antibam2 == true){
  299. mouse.moveSlightly();
  300. sleep(500, 800);
  301. break;
  302. }
  303. case 2:
  304. if(antibam2 == true){
  305. mouse.moveRandomly(11, 51);
  306. sleep(2000, 1000);
  307. break;
  308. }
  309. case 3:
  310. if(antibam2 == true){
  311. mouse.moveOffScreen();
  312. sleep(2000, 3000);
  313. break;
  314. }
  315. case 4:
  316. if(antibam2 == true){
  317. camera.moveRandomly(random(800, 1300));
  318. sleep(1500, 1000);
  319. break;
  320. }
  321. case 5:
  322. if(antibam2 == true){
  323. camera.moveRandomly(random(700, 1000));
  324. mouse.moveRandomly(10, 50);
  325. break;
  326. }
  327. case 6:
  328. if(antibam2 == true){
  329. game.openTab(1);
  330. skills.doHover(skills.INTERFACE_WOODCUTTING);
  331. sleep(random(1000, 1100));
  332. break;
  333. }
  334. case 7:
  335. if(antibam2 == true){
  336. skills.doHover(skills.INTERFACE_FIREMAKING);
  337. camera.moveRandomly(random(100, 999));
  338. mouse.moveRandomly(40, 60);
  339. sleep(1000, 1200);
  340. }
  341. }
  342. }
  343.  
  344. public void messageReceived(MessageEvent e) {
  345. String txt = e.getMessage();
  346. if(txt.contains("You get some willow logs")) {
  347. Willowschopped++;
  348.  
  349.  
  350. }
  351. if(txt.contains("The fire catches and the logs begin to burn.")) {
  352. Logslit++;
  353. }
  354. if(txt.contains("Woodcutting level!")) {
  355. lvlsgained++;
  356. }
  357. if(txt.contains("Firemaking level!")) {
  358. lvlsgained2++;
  359. }
  360.  
  361. }
  362.  
  363. public void onFinish(){
  364. log("Thank you for using my first script");
  365. }
  366.  
  367. @SuppressWarnings("serial")
  368. public class SupaChopGUI extends JFrame {//GUI made by pinkeltje
  369. private boolean isReady;
  370. public SupaChopGUI() {
  371. initComponents();
  372. }
  373.  
  374. private void button1ActionPerformed(ActionEvent e) {
  375. String chosen = comboBox1.getSelectedItem().toString();
  376. if(chosen.equals("Powerchop")) {
  377. powerchop = true;
  378. }
  379. if(chosen.equals("Light logs")) {
  380. lightlogs = true;
  381. }
  382. setVisible(false);
  383. isReady = true;
  384. }
  385.  
  386. private void initComponents() {
  387.  
  388. label1 = new JLabel();
  389. comboBox1 = new JComboBox();
  390. button1 = new JButton();
  391.  
  392. //======== this ========
  393. setTitle("SupaChop");
  394. Container contentPane = getContentPane();
  395.  
  396. //---- label1 ----
  397. label1.setText("Woodcutting type?");
  398. label1.setFont(new Font("Georgia Ref", Font.PLAIN, 20));
  399.  
  400. //---- comboBox1 ----
  401. comboBox1.setModel(new DefaultComboBoxModel(new String[] {
  402. "Light logs",
  403. "Powerchop"
  404. }));
  405. comboBox1.setFont(new Font("Georgia Ref", Font.PLAIN, 11));
  406. comboBox1.setBorder(new EtchedBorder());
  407.  
  408. //---- button1 ----
  409. button1.setText("Start SupaChop");
  410. button1.setFont(new Font("Georgia Ref", Font.PLAIN, 11));
  411. button1.addActionListener(new ActionListener() {
  412. @Override
  413. public void actionPerformed(ActionEvent e) {
  414. button1ActionPerformed(e);
  415. }
  416. });
  417.  
  418. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  419. contentPane.setLayout(contentPaneLayout);
  420. contentPaneLayout.setHorizontalGroup(
  421. contentPaneLayout.createParallelGroup()
  422. .addGroup(contentPaneLayout.createSequentialGroup()
  423. .addGroup(contentPaneLayout.createParallelGroup()
  424. .addGroup(contentPaneLayout.createSequentialGroup()
  425. .addContainerGap()
  426. .addComponent(label1))
  427. .addGroup(contentPaneLayout.createSequentialGroup()
  428. .addGap(30, 30, 30)
  429. .addComponent(comboBox1, GroupLayout.PREFERRED_SIZE, 124, GroupLayout.PREFERRED_SIZE))
  430. .addGroup(contentPaneLayout.createSequentialGroup()
  431. .addGap(19, 19, 19)
  432. .addComponent(button1, GroupLayout.PREFERRED_SIZE, 146, GroupLayout.PREFERRED_SIZE)))
  433. .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  434. );
  435. contentPaneLayout.setVerticalGroup(
  436. contentPaneLayout.createParallelGroup()
  437. .addGroup(contentPaneLayout.createSequentialGroup()
  438. .addGap(4, 4, 4)
  439. .addComponent(label1)
  440. .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
  441. .addComponent(comboBox1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
  442. .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
  443. .addComponent(button1)
  444. .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  445. );
  446. pack();
  447. setLocationRelativeTo(getOwner());
  448. }
  449.  
  450. private JLabel label1;
  451. private JComboBox comboBox1;
  452. private JButton button1;
  453. }
  454.  
  455.  
  456.  
  457. } //End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement