Advertisement
Guest User

Willow Chop'N'Sell

a guest
Nov 24th, 2013
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.88 KB | None | 0 0
  1. package scripts;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Dimension;
  5. import java.awt.Font;
  6. import java.awt.Graphics;
  7. import java.awt.Graphics2D;
  8. import java.awt.Image;
  9. import java.awt.Polygon;
  10. import java.awt.Toolkit;
  11. import java.io.IOException;
  12. import java.net.URL;
  13.  
  14. import javax.imageio.ImageIO;
  15.  
  16. import org.tribot.api.DynamicClicking;
  17. import org.tribot.api.General;
  18. import org.tribot.api.Timing;
  19. import org.tribot.api.input.Keyboard;
  20. import org.tribot.api.input.Mouse;
  21. import org.tribot.api2007.Camera;
  22. import org.tribot.api2007.ChooseOption;
  23. import org.tribot.api2007.Game;
  24. import org.tribot.api2007.GameTab;
  25. import org.tribot.api2007.Interfaces;
  26. import org.tribot.api2007.Inventory;
  27. import org.tribot.api2007.Login;
  28. import org.tribot.api2007.NPCs;
  29. import org.tribot.api2007.Objects;
  30. import org.tribot.api2007.Options;
  31. import org.tribot.api2007.PathFinding;
  32. import org.tribot.api2007.Player;
  33. import org.tribot.api2007.Players;
  34. import org.tribot.api2007.Screen;
  35. import org.tribot.api2007.Skills;
  36. import org.tribot.api2007.Walking;
  37. import org.tribot.api2007.types.RSInterfaceChild;
  38. import org.tribot.api2007.types.RSItem;
  39. import org.tribot.api2007.types.RSNPC;
  40. import org.tribot.api2007.types.RSObject;
  41. import org.tribot.api2007.types.RSPlayer;
  42. import org.tribot.api2007.types.RSTile;
  43. import org.tribot.script.Script;
  44. import org.tribot.script.ScriptManifest;
  45. import org.tribot.script.interfaces.Painting;
  46.  
  47. @ScriptManifest(authors = { "Coca Cola" }, category = "Woodcutting", name = "CC Willow Chop'N'Sell V2", description = "Now supports fletching the logs! Start the script anywhere within walking distance to Rimmington, or in Rimmington to be safe.")
  48. public class WillowsChopnSellV2 extends Script implements Painting {
  49.  
  50. private final Polygon shopArea = new Polygon(new int[] { 2945, 2951, 2951,
  51. 2945 }, new int[] { 3211, 3211, 3219, 3219 }, 4);
  52.  
  53. private final Polygon treesArea = new Polygon(new int[] { 2953, 2970, 2970,
  54. 2953 }, new int[] { 3193, 3193, 3203, 3203 }, 4);
  55.  
  56. RSTile[] shopPath = new RSTile[] { new RSTile(2963, 3199),
  57. new RSTile(2961, 3207), new RSTile(2960, 3208),
  58. new RSTile(2955, 3211), new RSTile(2951, 3214),
  59. new RSTile(2949, 3217) };
  60.  
  61. RSTile[] shopDoorPath = new RSTile[] { new RSTile(2963, 3199),
  62. new RSTile(2961, 3207), new RSTile(2960, 3208),
  63. new RSTile(2955, 3211), new RSTile(2951, 3214) };
  64.  
  65. RSTile[] treesPath = new RSTile[] { new RSTile(2951, 3214),
  66. new RSTile(2955, 3211), new RSTile(2960, 3208),
  67. new RSTile(2962, 3204), new RSTile(2963, 3200),
  68. new RSTile(2963, 3196) };
  69.  
  70. private final int[] DO_NOT_DROP = { 946, 60, 58, 6743, 6739, 494, 496, 498,
  71. 500, 502, 504, 506, 1519, 995, 1349, 1351, 1353, 1355, 1357, 1359,
  72. 1361 };
  73.  
  74. private final int[] ITEMS_TO_SELL = { 1519, 58, 60 };
  75.  
  76. private final int[] junk = { 1521, 1971, 1917, 6961, 2327, 9003, 6180,
  77. 6181, 6182, 6654, 6655, 6656, 6657, 6658, 6659, 6183, 3057, 3058,
  78. 3059, 3060, 3061, 117, 1607, 1608, 1623, 1624, 1625, 1606, 1621,
  79. 1622, 1603, 1604, 1619, 1620, 1601, 1602, 1617, 1618, 1973, 995 };
  80.  
  81. public final int[] WILLOW_IDS = { 9397, 9396, 9395, };
  82. public final int SHOP_DOOR_CLOSED = 7116;
  83.  
  84. public String METHOD;
  85.  
  86. public boolean GUI_COMPLETE = false;
  87.  
  88. Timer time = new Timer(2500);
  89.  
  90. final long startTime = System.currentTimeMillis();
  91.  
  92. final int LOGS = 1519;
  93. final int SHORTBOW = 60;
  94. final int LONGBOW = 58;
  95.  
  96. final int[] BOWS = { 60, 58 };
  97.  
  98. @SuppressWarnings("deprecation")
  99. int startLvl = Skills.getActualLevel("Woodcutting");
  100. @SuppressWarnings("deprecation")
  101. int startXP = Skills.getXP("Woodcutting");
  102. int willowsSold = 0;
  103. int startFletchXP = Skills.getXP("Fletching");
  104. int startFletchLvl = Skills.getActualLevel("Fletching");
  105. int bowsSold = 0;
  106.  
  107. private Image getImage(String url) {
  108. try {
  109. return ImageIO.read(new URL(url));
  110. } catch (IOException e) {
  111. return null;
  112. }
  113. }
  114.  
  115. private final Image img = getImage("http://s21.postimg.org/6mflgq2vb/Chop_n_Sell_Paint.png");
  116. private final Image img2 = getImage("http://s24.postimg.org/3pu17hm6t/chopnsellpaintwithfletch.png");
  117.  
  118. public void run() {
  119.  
  120. Mouse.setSpeed(200);
  121.  
  122. GUI GUI = new GUI();
  123.  
  124. Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  125. int screenW = screenSize.width;
  126. int screenH = screenSize.height;
  127.  
  128. Dimension dim = GUI.getSize();
  129.  
  130. GUI.setVisible(true);
  131. println("Please select your desired settings in the GUI.");
  132.  
  133. GUI.setLocation((screenW / 2) - (dim.width / 2), (screenH / 2)
  134. - (dim.height / 2));
  135.  
  136. while (!GUI_COMPLETE) {
  137. sleep(200);
  138. }
  139.  
  140. GUI.setVisible(false);
  141.  
  142. println("GUI Closed. Script initialized with chosen settings.");
  143. println("Selected method: " + METHOD);
  144.  
  145. if (onStart()) {
  146. while (true) {
  147. sleep(loop());
  148. }
  149. }
  150. }
  151.  
  152. private boolean onStart() {
  153. return true;
  154.  
  155. }
  156.  
  157. public RSObject findNearest(int distance, int... ids) {
  158. RSObject[] objects = Objects.findNearest(distance, ids);
  159.  
  160. for (RSObject object : objects) {
  161. if (object != null) {
  162. return object;
  163. }
  164. }
  165.  
  166. return null;
  167.  
  168. }
  169.  
  170. @SuppressWarnings("serial")
  171. class GUI extends javax.swing.JFrame {
  172.  
  173. public GUI() {
  174. initComponents();
  175. }
  176.  
  177. @SuppressWarnings({ "unchecked", "rawtypes" })
  178. private void initComponents() {
  179.  
  180. jLabel2 = new javax.swing.JLabel();
  181. METHOD_DROPDOWN = new javax.swing.JComboBox();
  182. jLabel4 = new javax.swing.JLabel();
  183. jLabel1 = new javax.swing.JLabel();
  184. START_BUTTON = new javax.swing.JButton();
  185.  
  186. setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
  187.  
  188. jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
  189. jLabel2.setText("Please choose a method:");
  190.  
  191. METHOD_DROPDOWN.setModel(new javax.swing.DefaultComboBoxModel(
  192. new String[] { " ", "Fletch bows and sell",
  193. "Just sell logs" }));
  194. METHOD_DROPDOWN
  195. .addActionListener(new java.awt.event.ActionListener() {
  196. public void actionPerformed(
  197. java.awt.event.ActionEvent evt) {
  198. METHOD_DROPDOWNActionPerformed(evt);
  199. }
  200. });
  201.  
  202. jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14));
  203. jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  204. jLabel4.setText("Coca Cola's Willow Chop'N'Sell");
  205.  
  206. jLabel1.setForeground(new java.awt.Color(255, 0, 0));
  207. jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  208. jLabel1.setText("Note: You need a knife in your inventory if you choose to fletch.");
  209.  
  210. START_BUTTON.setText("Start");
  211. START_BUTTON.addActionListener(new java.awt.event.ActionListener() {
  212. public void actionPerformed(java.awt.event.ActionEvent evt) {
  213. START_BUTTONActionPerformed(evt);
  214. }
  215. });
  216.  
  217. javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
  218. getContentPane());
  219. getContentPane().setLayout(layout);
  220. layout.setHorizontalGroup(layout
  221. .createParallelGroup(
  222. javax.swing.GroupLayout.Alignment.LEADING)
  223. .addComponent(jLabel1,
  224. javax.swing.GroupLayout.DEFAULT_SIZE,
  225. javax.swing.GroupLayout.DEFAULT_SIZE,
  226. Short.MAX_VALUE)
  227. .addComponent(jLabel4,
  228. javax.swing.GroupLayout.Alignment.TRAILING,
  229. javax.swing.GroupLayout.DEFAULT_SIZE,
  230. javax.swing.GroupLayout.DEFAULT_SIZE,
  231. Short.MAX_VALUE)
  232. .addGroup(
  233. javax.swing.GroupLayout.Alignment.TRAILING,
  234. layout.createSequentialGroup()
  235. .addContainerGap(39, Short.MAX_VALUE)
  236. .addComponent(jLabel2)
  237. .addGap(18, 18, 18)
  238. .addComponent(
  239. METHOD_DROPDOWN,
  240. javax.swing.GroupLayout.PREFERRED_SIZE,
  241. javax.swing.GroupLayout.DEFAULT_SIZE,
  242. javax.swing.GroupLayout.PREFERRED_SIZE)
  243. .addGap(25, 25, 25))
  244. .addComponent(START_BUTTON,
  245. javax.swing.GroupLayout.Alignment.TRAILING,
  246. javax.swing.GroupLayout.DEFAULT_SIZE,
  247. javax.swing.GroupLayout.DEFAULT_SIZE,
  248. Short.MAX_VALUE));
  249. layout.setVerticalGroup(layout
  250. .createParallelGroup(
  251. javax.swing.GroupLayout.Alignment.LEADING)
  252. .addGroup(
  253. layout.createSequentialGroup()
  254. .addContainerGap()
  255. .addComponent(jLabel4)
  256. .addGap(32, 32, 32)
  257. .addGroup(
  258. layout.createParallelGroup(
  259. javax.swing.GroupLayout.Alignment.BASELINE)
  260. .addComponent(jLabel2)
  261. .addComponent(
  262. METHOD_DROPDOWN,
  263. javax.swing.GroupLayout.PREFERRED_SIZE,
  264. javax.swing.GroupLayout.DEFAULT_SIZE,
  265. javax.swing.GroupLayout.PREFERRED_SIZE))
  266. .addPreferredGap(
  267. javax.swing.LayoutStyle.ComponentPlacement.RELATED,
  268. 22, Short.MAX_VALUE)
  269. .addComponent(START_BUTTON)
  270. .addGap(18, 18, 18).addComponent(jLabel1)));
  271.  
  272. pack();
  273. }
  274.  
  275. private void METHOD_DROPDOWNActionPerformed(
  276. java.awt.event.ActionEvent evt) {
  277.  
  278. METHOD = METHOD_DROPDOWN.getSelectedItem().toString();
  279.  
  280. }
  281.  
  282. private void START_BUTTONActionPerformed(java.awt.event.ActionEvent evt) {
  283.  
  284. if (METHOD == null) {
  285. println("Please select a method..");
  286. return;
  287. } else {
  288.  
  289. GUI_COMPLETE = true;
  290.  
  291. }
  292.  
  293. }
  294.  
  295. @SuppressWarnings("rawtypes")
  296. private javax.swing.JComboBox METHOD_DROPDOWN;
  297. private javax.swing.JButton START_BUTTON;
  298. private javax.swing.JLabel jLabel1;
  299. private javax.swing.JLabel jLabel2;
  300. private javax.swing.JLabel jLabel4;
  301. }
  302.  
  303. public int loop() {
  304.  
  305. while (Player.getAnimation() != -1) {
  306. ent();
  307. invCheck();
  308. }
  309.  
  310. RSObject willow = findNearest(10, WILLOW_IDS);
  311. RSObject shopdoorclosed = findNearest(5, SHOP_DOOR_CLOSED);
  312.  
  313. RSPlayer[] allPlayers = Players.getAll();
  314. for (RSPlayer i : allPlayers) {
  315. if (treesArea.contains(i.getPosition().getX(), i.getPosition()
  316. .getY())
  317. && i.getName() != Player.getRSPlayer().getName()
  318. && !loggedOut()) {
  319. println("Somebody is near-by, going to hop worlds.");
  320. Worldhopper.switchWorld(Worldhopper.getRandomWorld());
  321. }
  322. }
  323.  
  324. switch (METHOD) {
  325.  
  326. case "Just sell logs":
  327.  
  328. if (Inventory.isFull()) {
  329. startRunning();
  330. openInvTab();
  331. sellLogs();
  332. }
  333.  
  334. if (!treesArea.contains(Player.getPosition().getX(), Player
  335. .getPosition().getY())
  336. && !Inventory.isFull() && !(Inventory.getCount(LOGS) >= 1)) {
  337. if (PathFinding.canReach(new RSTile(2963, 3196), true)) {
  338. Walking.walkPath(treesPath);
  339. } else {
  340. Walking.walkPath(shopDoorPath);
  341. if (shopdoorclosed != null) {
  342. if (shopdoorclosed.isOnScreen()) {
  343. shopdoorclosed.click("Open Door");
  344. sleep(1000);
  345. }
  346. }
  347. if (shopdoorclosed == null) {
  348. Walking.walkPath(treesPath);
  349. }
  350. }
  351. }
  352.  
  353. if (treesArea.contains(Player.getPosition().getX(), Player
  354. .getPosition().getY())
  355. && Player.getRSPlayer().getAnimation() == -1
  356. && !Inventory.isFull()) {
  357. if (willow != null) {
  358. if (willow.isOnScreen()) {
  359. willow.click("Chop down Willow");
  360. time.reset();
  361. while (Player.getRSPlayer().getAnimation() == -1
  362. && time.isRunning()) {
  363. sleep(10);
  364. }
  365. } else {
  366. Walking.walkTo(willow);
  367. Camera.turnToTile(willow.getPosition());
  368. }
  369. }
  370. }
  371.  
  372. break;
  373.  
  374. case "Fletch bows and sell":
  375.  
  376. if (Skills.getCurrentLevel("Fletching") < 35) {
  377. println("You need a fletching level of at least 35 to fletch willows.");
  378. println("Your method has been switched to just selling logs.");
  379. METHOD = "Just sell logs";
  380. }
  381.  
  382. if (Inventory.isFull()) {
  383. if (Inventory.getCount(LOGS) >= 1) {
  384. makeBows();
  385. while (Player.getAnimation() == 1248) {
  386. sleep(20);
  387. }
  388. }
  389. if (Inventory.getCount(LOGS) < 1
  390. && Inventory.getCount(LONGBOW) >= 1
  391. || Inventory.getCount(SHORTBOW) >= 1) {
  392. startRunning();
  393. openInvTab();
  394. sellLogs();
  395. }
  396. }
  397.  
  398. if (!treesArea.contains(Player.getPosition().getX(), Player
  399. .getPosition().getY())
  400. && !Inventory.isFull() && !(Inventory.getCount(LOGS) >= 1)) {
  401. if (PathFinding.canReach(new RSTile(2963, 3196), true)) {
  402. Walking.walkPath(treesPath);
  403. } else {
  404. Walking.walkPath(shopDoorPath);
  405. if (shopdoorclosed != null) {
  406. if (shopdoorclosed.isOnScreen()) {
  407. shopdoorclosed.click("Open Door");
  408. sleep(1000);
  409. }
  410. }
  411. if (shopdoorclosed == null) {
  412. Walking.walkPath(treesPath);
  413. }
  414. }
  415. }
  416.  
  417. if (treesArea.contains(Player.getPosition().getX(), Player
  418. .getPosition().getY())
  419. && Player.getRSPlayer().getAnimation() == -1
  420. && !Inventory.isFull()) {
  421. if (willow != null) {
  422. if (willow.isOnScreen()) {
  423. willow.click("Chop down Willow");
  424. time.reset();
  425. while (Player.getRSPlayer().getAnimation() == -1
  426. && time.isRunning()) {
  427. sleep(10);
  428. }
  429. } else {
  430. Walking.walkTo(willow);
  431. Camera.turnToTile(willow.getPosition());
  432. }
  433. }
  434. }
  435.  
  436. break;
  437.  
  438. case " ":
  439. println("Invalid selection, method set to just sell logs by default.");
  440. METHOD = "Just sell logs";
  441. break;
  442.  
  443. }
  444.  
  445. return 50;
  446. }
  447.  
  448. public void sellLogs() {
  449.  
  450. RSNPC[] shopassist = NPCs.findNearest("Shop assistant");
  451. RSObject shopdoorclosed = findNearest(5, SHOP_DOOR_CLOSED);
  452.  
  453. switch (METHOD) {
  454. case "Just sell logs":
  455. if (!shopArea.contains(Player.getPosition().getX(), Player
  456. .getPosition().getY())
  457. && Inventory.getCount(LOGS) >= 1) {
  458. if (PathFinding.canReach(new RSTile(2949, 3217), true)) {
  459. Walking.walkPath(shopPath);
  460. } else {
  461. Walking.walkPath(shopDoorPath);
  462. if (shopdoorclosed != null) {
  463. if (shopdoorclosed.isOnScreen()) {
  464. shopdoorclosed.click("Open Door");
  465. sleep(1000);
  466. }
  467. }
  468. if (shopdoorclosed == null) {
  469. Walking.walkPath(shopPath);
  470. }
  471. }
  472.  
  473. } else {
  474. if (shopArea.contains(Player.getPosition().getX(), Player
  475. .getPosition().getY())) {
  476. while (shopassist != null && !Shop.isShopOpen()
  477. && !Player.isMoving()) {
  478. DynamicClicking.clickRSNPC(shopassist[0],
  479. "Trade Shop assistant");
  480. sleep(1000);
  481. }
  482. if (Shop.isShopOpen()) {
  483. willowsSold += Inventory.getCount(LOGS);
  484. while (Inventory.getCount(ITEMS_TO_SELL) >= 1) {
  485. Mouse.setSpeed(744);
  486. Shop.sell(LOGS, 10);
  487. Shop.sell(LONGBOW, 10);
  488. Shop.sell(SHORTBOW, 10);
  489. Mouse.setSpeed(200);
  490. }
  491. }
  492. }
  493. }
  494. break;
  495. case "Fletch bows and sell":
  496. if (!shopArea.contains(Player.getPosition().getX(), Player
  497. .getPosition().getY())
  498. && Inventory.getCount(BOWS) >= 1) {
  499. if (PathFinding.canReach(new RSTile(2949, 3217), true)) {
  500. Walking.walkPath(shopPath);
  501. } else {
  502. Walking.walkPath(shopDoorPath);
  503. if (shopdoorclosed != null) {
  504. if (shopdoorclosed.isOnScreen()) {
  505. shopdoorclosed.click("Open Door");
  506. sleep(1000);
  507. }
  508. }
  509. if (shopdoorclosed == null) {
  510. Walking.walkPath(shopPath);
  511. }
  512. }
  513.  
  514. } else {
  515. if (shopArea.contains(Player.getPosition().getX(), Player
  516. .getPosition().getY())) {
  517. while (shopassist != null && !Shop.isShopOpen()
  518. && !Player.isMoving()) {
  519. DynamicClicking.clickRSNPC(shopassist[0],
  520. "Trade Shop assistant");
  521. sleep(1000);
  522. }
  523. if (Shop.isShopOpen()) {
  524. bowsSold += Inventory.getCount(LONGBOW)
  525. + Inventory.getCount(SHORTBOW);
  526. while (Inventory.getCount(ITEMS_TO_SELL) >= 1) {
  527. Mouse.setSpeed(744);
  528. Shop.sell(LOGS, 10);
  529. Shop.sell(LONGBOW, 10);
  530. Shop.sell(SHORTBOW, 10);
  531. Mouse.setSpeed(200);
  532. }
  533. }
  534. }
  535. }
  536.  
  537. break;
  538. }
  539. }
  540.  
  541. public void openInvTab() {
  542. if (GameTab.getOpen() == GameTab.TABS.INVENTORY) {
  543. return;
  544. } else {
  545. GameTab.open(GameTab.TABS.INVENTORY);
  546. }
  547. }
  548.  
  549. public void startRunning() {
  550. if (!Game.isRunOn()) {
  551. if (Game.getRunEnergy() >= General.random(20, 35)) {
  552. Options.setRunOn(true);
  553. }
  554. } else {
  555. return;
  556. }
  557. }
  558.  
  559. private boolean makex() {
  560. RSInterfaceChild amount = Interfaces.get(548, 94);
  561. if ((amount != null) && (!amount.isHidden())) {
  562. String txt = amount.getText();
  563. if (txt != null)
  564. txt.equals("*");
  565.  
  566. }
  567.  
  568. return false;
  569. }
  570.  
  571. @SuppressWarnings("deprecation")
  572. public void makeBows() {
  573. RSItem[] log = Inventory.find(new int[] { 1519 });
  574. RSItem[] knife = Inventory.find(new int[] { 946 });
  575. RSInterfaceChild shaft = Interfaces.get(548, 88);
  576.  
  577. if (knife[0].click(new String[] { "Use" })) {
  578. sleep(450, 655);
  579. if (log[0].click(new String[] { "Use" })) {
  580. sleep(1455, 1644);
  581. if (shaft != null) {
  582. if (Skills.getCurrentLevel("Fletching") >= 35
  583. && Skills.getCurrentLevel("Fletching") <= 39) {
  584. Mouse.clickBox(63, 396, 94, 422, 3);
  585. ChooseOption.select(new String[] { "x" });
  586. makex();
  587. sleep(500, 650);
  588. Keyboard.typeSend("" + General.random(28, 99));
  589. sleep(2300, 4000);
  590. }
  591.  
  592. if (Skills.getCurrentLevel("Fletching") >= 40) {
  593. Mouse.clickBox(220, 392, 280, 424, 3);
  594. ChooseOption.select(new String[] { "x" });
  595. makex();
  596. sleep(500, 650);
  597. Keyboard.typeSend("" + General.random(28, 99));
  598. sleep(2300, 4000);
  599. }
  600.  
  601. }
  602. }
  603. }
  604. }
  605.  
  606. public void ent() {
  607.  
  608. RSNPC[] ent = NPCs.findNearest("Willow");
  609.  
  610. RSObject willow = findNearest(5, WILLOW_IDS);
  611.  
  612. RSTile current_tree = willow.getPosition();
  613.  
  614. if (ent.length > 0) {
  615. if (ent[0].getPosition().distanceTo(current_tree) < 2) {
  616.  
  617. willow.click("Chop down Willow");
  618. sleep(500, 1700);
  619. println("Ent detected - Switching tree.");
  620. } else {
  621. sleep(500);
  622. }
  623. }
  624. }
  625.  
  626. public void invCheck() {
  627. if (Inventory.getCount(junk) >= 1) {
  628. Inventory.dropAllExcept(DO_NOT_DROP);
  629. }
  630. }
  631.  
  632. public boolean loggedOut() {
  633. return (Login.getLoginState() == Login.STATE.LOGINSCREEN)
  634. && !(Screen.getColorAt(100, 200).equals(new Color(0, 0, 0)));
  635. }
  636.  
  637. @SuppressWarnings("deprecation")
  638. public void onPaint(Graphics g) {
  639.  
  640. long timeRan = System.currentTimeMillis() - startTime;
  641. int currentLvl = Skills.getActualLevel("Woodcutting");
  642. int currentFletchLvl = Skills.getActualLevel("Fletching");
  643. int gainedLvl = currentLvl - startLvl;
  644. int gainedXp = Skills.getXP("Woodcutting") - startXP;
  645. int gainedFletchLvl = currentFletchLvl - startFletchLvl;
  646. int gainedFletchXP = Skills.getXP("Fletching") - startFletchXP;
  647. long xpPerHour = (long) (gainedXp * 3600000d / timeRan);
  648. long fletchXPPerHour = (long) (gainedFletchXP * 3600000d / timeRan);
  649. long willowsSoldPerHour = (long) (willowsSold * 3600000d / timeRan);
  650. long bowsSoldPerHour = (long) (bowsSold * 3600000d / timeRan);
  651.  
  652. Graphics2D yolo = (Graphics2D) g;
  653. switch (METHOD) {
  654. case "Just sell logs":
  655.  
  656. Font font = new Font("Trajan Pro", Font.BOLD, 14);
  657. g.setColor(new Color(0, 127, 14));
  658. g.setFont(font);
  659.  
  660. yolo.drawImage(img, -14, 308, null);
  661.  
  662. g.drawString(" " + Timing.msToString(timeRan), 200, 370);
  663. g.drawString(" " + currentLvl + " (Gained " + gainedLvl
  664. + " levels)", 200, 400);
  665. g.drawString(" " + gainedXp + " (" + xpPerHour + " Per hour" + ")",
  666. 200, 431);
  667. g.drawString(" " + willowsSold + " (" + willowsSoldPerHour
  668. + " Per hour" + ")", 200, 461);
  669. break;
  670. case "Fletch bows and sell":
  671.  
  672. Font font1 = new Font("Trajan Pro", Font.BOLD, 12);
  673. g.setColor(new Color(0, 127, 14));
  674. g.setFont(font1);
  675.  
  676. yolo.drawImage(img2, -9, 313, null);
  677.  
  678. g.drawString(" " + Timing.msToString(timeRan), 200, 360);
  679. g.drawString(" " + currentLvl + " (Gained " + gainedLvl
  680. + " levels)", 200, 381);
  681. g.drawString(" " + gainedXp + " (" + xpPerHour + " Per hour" + ")",
  682. 200, 402);
  683. g.drawString(" " + currentFletchLvl + " (Gained " + gainedFletchLvl
  684. + " levels)", 200, 422);
  685. g.drawString(" " + gainedFletchXP + " (" + fletchXPPerHour
  686. + " Per hour" + ")", 200, 444);
  687. g.drawString(" " + bowsSold + " (" + bowsSoldPerHour + " Per hour"
  688. + ")", 200, 465);
  689.  
  690. break;
  691. }
  692.  
  693. }
  694. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement