Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.76 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Container;
  3. import java.awt.Cursor;
  4. import java.awt.Dimension;
  5. import java.awt.Font;
  6. import java.awt.Graphics;
  7. import java.awt.Insets;
  8. import java.awt.Point;
  9. import java.awt.Rectangle;
  10. import java.awt.RenderingHints;
  11. import java.awt.event.ActionEvent;
  12. import java.awt.event.ActionListener;
  13. import java.util.LinkedList;
  14. import java.util.List;
  15. import java.awt.*;
  16. import javax.imageio.ImageIO;
  17. import java.io.IOException;
  18. import java.net.URL;
  19. import org.rsbot.script.methods.Magic;
  20. import org.rsbot.script.methods.Skills;
  21.  
  22. import javax.swing.DefaultComboBoxModel;
  23. import javax.swing.JButton;
  24. import javax.swing.JComboBox;
  25. import javax.swing.JFrame;
  26. import javax.swing.JLabel;
  27. import javax.swing.SwingConstants;
  28. import javax.swing.WindowConstants;
  29.  
  30. import org.rsbot.event.events.ServerMessageEvent;
  31. import org.rsbot.event.listeners.PaintListener;
  32. import org.rsbot.event.listeners.ServerMessageListener;
  33. import org.rsbot.script.Script;
  34. import org.rsbot.script.ScriptManifest;
  35. import org.rsbot.script.util.Filter;
  36. import org.rsbot.script.wrappers.RSComponent;
  37. import org.rsbot.script.wrappers.RSNPC;
  38. import org.rsbot.script.wrappers.RSObject;
  39.  
  40. @ScriptManifest(authors = "Spin" , name = "ZezimaTabs",
  41. description = "Exclusive for Zezima Tabs", version = 1.0)
  42. public class ZezimaTabs extends Script implements PaintListener,
  43. ServerMessageListener {
  44. String tabName = " ";
  45. String kistrue = " ";
  46. int roundedxpperh = 0;
  47. int roundedxpgained = 0;
  48. int moneyroundedmade = 0;
  49. int moneyroundedperh = 0;
  50. public int expTab = 0;
  51. public int tabCounter = 0;
  52. int currentXP;
  53. int startXP;
  54. int gainedXP;
  55. int xpPerHour;
  56. public int moneymade = 0;
  57. public int moneymadeperh = 0;
  58. long runTime;
  59. long seconds;
  60. long minutes;
  61. long hours;
  62. public int selectedTab = 0;
  63. public int tabsperhour = 0;
  64. public int TabID = 0;
  65. public int TabPrice = 0;
  66. public int lumbtele = 8008;
  67. public int ardotele = 8011;
  68. public int cametele = 8010;
  69. public int falatele = 8009;
  70. public int houstele = 8013;
  71. public int varrtele = 8007;
  72. public int btbtele = 8014;
  73. public int btptele = 8015;
  74. public int enditele = 8019;
  75. public int endrtele = 8020;
  76. public int enemtele = 8017;
  77. public int enontele = 8021;
  78. public int enrutele = 8018;
  79. public int ensatele = 8016;
  80. public int watctele = 8012;
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101. public static interface GameConstants {
  102.  
  103. int[] LECTERN_IDS = new int[] { 13642, 13643, 13644, 13645, 13646, 13647, 13648 };
  104.  
  105. int[] BUTLER_IDS = new int[] { 4241, 4243 };
  106.  
  107. int HOUSE_INTERFACE = 232;
  108.  
  109. int SOFT_CLAY_INTERFACE = 234;
  110.  
  111. int PAYMENT_INTERFACE = 232;
  112.  
  113. int PAYMENT_CHAT_INTERFACE = 243;
  114.  
  115. int SOFT_CLAY = 1761;
  116.  
  117. int PORTAL = 15482;
  118.  
  119. int LAW_RUNE = 563;
  120.  
  121. int TAB_INTERFACE = 400;
  122.  
  123. }
  124.  
  125. //Paint Variables
  126. public long startTime = System.currentTimeMillis();
  127. private String status = "";
  128. private final ScriptManifest properties = getClass().getAnnotation(ScriptManifest.class);
  129.  
  130.  
  131.  
  132. public static interface PaintConstants {
  133.  
  134. RenderingHints RENDERING_HINTS = new RenderingHints(
  135. RenderingHints.KEY_TEXT_ANTIALIASING,
  136. RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
  137.  
  138. Color MOUSE_COLOR = new Color(0, 0, 0, 50);
  139.  
  140. Color MOUSE_BORDER_COLOR = new Color(255, 252, 0, 50);
  141.  
  142. }
  143.  
  144. public static interface Action {
  145.  
  146. public void process();
  147.  
  148. public boolean isValid();
  149.  
  150. }
  151.  
  152. public class PortalAction implements Action {
  153.  
  154. public void process() {
  155. if (isInterfaceValid(GameConstants.HOUSE_INTERFACE)) {
  156. interfaces.getComponent(GameConstants.HOUSE_INTERFACE, 2).doClick();
  157. sleep(900, 1200);
  158. } else {
  159. RSObject portal = objects.getNearest(GameConstants.PORTAL);
  160. if (portal != null) {
  161. if (portal.isOnScreen()) {
  162. if (portal.doAction("Enter")) {
  163. sleep(500);
  164. if (!getMyPlayer().isIdle()) {
  165. sleep(1000);
  166. }
  167. }
  168. } else {
  169. if (walking.getDestination() == null || calc.distanceBetween(walking.getDestination(), portal.getLocation()) > 4) {
  170. walking.walkTo(portal.getLocation());
  171. sleep(750, 900);
  172. } else {
  173. idle();
  174. }
  175. }
  176. }
  177. }
  178. }
  179.  
  180. public boolean isValid() {
  181. return !hasHousePortal();
  182. }
  183.  
  184. }
  185.  
  186. public class BankingAction implements Action {
  187.  
  188. public void process() {
  189. if (isInterfaceValid(GameConstants.SOFT_CLAY_INTERFACE)
  190. || isInterfaceValid(GameConstants.PAYMENT_CHAT_INTERFACE)
  191. || isInterfaceValid(GameConstants.PAYMENT_INTERFACE)) {
  192. if (isInterfaceValid(GameConstants.SOFT_CLAY_INTERFACE)) {
  193. if (interfaces.getComponent(GameConstants.SOFT_CLAY_INTERFACE, 3).getText().contains("clay")) {
  194. interfaces.getComponent(GameConstants.SOFT_CLAY_INTERFACE, 3).doClick();
  195. sleep(750, 1200);
  196. keyboard.sendText("" + (28 - inventory.getCount()), true);
  197. sleep(600, 1200);
  198. } else if (interfaces.getComponent(GameConstants.SOFT_CLAY_INTERFACE, 2).getText().contains("clay")) {
  199. interfaces.getComponent(GameConstants.SOFT_CLAY_INTERFACE, 2).doClick();
  200. sleep(500, 700);
  201. } else {
  202. interfaces.getComponent(GameConstants.SOFT_CLAY_INTERFACE, 6).doClick();
  203. sleep(500, 700);
  204. }
  205. } else if (isInterfaceValid(GameConstants.PAYMENT_CHAT_INTERFACE)) {
  206. interfaces.clickContinue();
  207. sleep(900, 1200);
  208. } else if (isInterfaceValid(GameConstants.PAYMENT_INTERFACE) && interfaces.getComponent(GameConstants.PAYMENT_INTERFACE, 3).getText().contains("bank")) {
  209. interfaces.getComponent(GameConstants.PAYMENT_INTERFACE, 3).doClick();
  210. sleep(1000, 1200);
  211. } else if (isInterfaceValid(GameConstants.PAYMENT_INTERFACE)) {
  212. interfaces.getComponent(GameConstants.PAYMENT_INTERFACE, 5).doClick();
  213. sleep(1000, 1200);
  214. }
  215. return;
  216. }
  217. RSObject door = objects.getNearest(doorFilter);
  218. if (door != null) {
  219. if(door.doAction("Open")) {
  220. sleep(700);
  221. } else {
  222. return;
  223. }
  224. }
  225. RSNPC butler = npcs.getNearest(GameConstants.BUTLER_IDS);
  226. if (butler != null) {
  227. if (butler.isOnScreen()) {
  228. sleep(750);
  229. if (canCraft()) {
  230. return;
  231. }
  232. if (butler.doAction("Fetch-from-bank")) {
  233. sleep(3000);
  234. if (!getMyPlayer().isIdle()) {
  235. sleep(3000);
  236. }
  237. }
  238. } else {
  239. if (walking.getDestination() == null || calc.distanceBetween(walking.getDestination(), butler.getLocation()) > 4) {
  240. walking.walkTo(butler.getLocation());
  241. sleep(750, 900);
  242. } else {
  243. idle();
  244. }
  245. }
  246. } else {
  247. idle();
  248. }
  249. }
  250.  
  251. public boolean isValid() {
  252. return !canCraft() && hasHousePortal();
  253. }
  254.  
  255. }
  256.  
  257. public class WaitingAction implements Action {
  258.  
  259. int ticks = 0;
  260.  
  261. public void process() {
  262. if (getMyPlayer().getAnimation() != -1) {
  263. ticks = 0;
  264. idle();
  265. } else if (ticks > 30) {
  266. setCrafting(false);
  267. ticks = 0;
  268. } else {
  269. ticks ++;
  270. idle();
  271. }
  272. }
  273.  
  274. public boolean isValid() {
  275. return canCraft() && isCrafting() && hasHousePortal();
  276. }
  277.  
  278. }
  279.  
  280. public class CraftingAction implements Action {
  281.  
  282. public void process() {
  283. if (isInterfaceValid(GameConstants.TAB_INTERFACE)) {
  284. RSComponent tab = interfaces.getComponent(GameConstants.TAB_INTERFACE, craftingTab);
  285. if (tab != null && tab.isValid()) {
  286. tab.doAction("Make-all");
  287. setCrafting(true);
  288. sleep(600);
  289. }
  290. } else {
  291. if (lectern == null) {
  292. lectern = objects.getNearest(GameConstants.LECTERN_IDS);
  293. }
  294. if (lectern != null) {
  295. RSObject door = objects.getNearest(doorFilter);
  296. if (door != null) {
  297. if(door.doAction("Open")) {
  298. sleep(700);
  299. } else {
  300. return;
  301. }
  302. }
  303. if (lectern.isOnScreen()) {
  304. if(lectern.doAction("Study")) {
  305. sleep(900, 1200);
  306. if (!getMyPlayer().isIdle()) {
  307. sleep(1000);
  308. }
  309. }
  310. } else {
  311. if (walking.getDestination() == null || calc.distanceBetween(walking.getDestination(), lectern.getLocation()) > 4) {
  312. walking.walkTo(lectern.getLocation());
  313. sleep(750, 900);
  314. } else {
  315. idle();
  316. }
  317. }
  318. }
  319. }
  320. }
  321.  
  322. public boolean isValid() {
  323. return canCraft() && !isCrafting() && hasHousePortal();
  324. }
  325.  
  326. }
  327.  
  328. private List<Action> actions = new LinkedList<Action>();
  329. private RSObject lectern;
  330. private int craftingTab = -1;
  331. private boolean crafting = false;
  332. private Filter<RSObject> doorFilter = new Filter<RSObject>() {
  333. public boolean accept(RSObject t) {
  334. if (t.getDef() == null || t.getDef().getName() == null) {
  335. return false;
  336. }
  337. if (calc.distanceTo(t) > 2) {
  338. return false;
  339. }
  340. if (t.getDef().getName().equals("Door") && t.getDef().getActions() != null && t.getDef().getActions().length > 0) {
  341. for (String action : t.getDef().getActions()) {
  342. if (action == null)
  343. continue;
  344. if (action.equals("Open")) {
  345. return true;
  346. }
  347. }
  348. }
  349. return false;
  350. }
  351. };
  352. private ArbiTabsGUI gui = new ArbiTabsGUI();
  353. private int[] CRAFTING_TABS = new int[] { 15, 13, 5, 2, 14, 16, 11, 8, 10, 6, 7, 9, 3, 4 };
  354. private int[] SELECTED_TAB = new int[] { varrtele, lumbtele, cametele, ardotele, houstele, watctele, ensatele, enemtele, enrutele, enditele, endrtele, enontele, btbtele, btptele };
  355. private int[] EXP_TAB = new int[] { 35, 41, 55, 61, 30, 68, 17, 37, 59, 67, 78, 97, 25, 65 };
  356. private String[] TAB_NAME = new String[] { "Varrock", "Lumbridge", "Camelot", "Ardounge", "House", "WatchTower", "Sapphire", "Emerald", "Ruby", "Diamond", "Dragon", "Onyx", "Bannanas", "Peaches" };
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371. public boolean onStart() {
  372.  
  373. log.severe("Welcome to ZezimaTabs's clan chat only B2P tab maker");
  374. log.severe("Created by some fool, rewritten/sped up/ fixed by Spin=]");
  375. log.severe("Happy Tab Making!");
  376. log("Do I get some type of reward for this? ;P");
  377.  
  378.  
  379.  
  380. startXP = skills.getCurrentExp(Skills.MAGIC);
  381. gui.setVisible(true);
  382. while (!gui.isStart()) {
  383. sleep(100, 200);
  384. }
  385. selectedTab = SELECTED_TAB[gui.comboBox1.getSelectedIndex()];
  386. tabName = TAB_NAME[gui.comboBox1.getSelectedIndex()];
  387. expTab = EXP_TAB[gui.comboBox1.getSelectedIndex()];
  388. craftingTab = CRAFTING_TABS[gui.comboBox1.getSelectedIndex()];
  389. actions.add(new WaitingAction());
  390. actions.add(new CraftingAction());
  391. actions.add(new BankingAction());
  392. actions.add(new PortalAction());
  393. mouse.setSpeed(1);
  394. return true;
  395.  
  396.  
  397. }
  398.  
  399. public void onFinish() {
  400. log.severe("Ran For howeverlong you ran it for.");
  401. log.severe("In Addition I hope it worked fine. ");
  402. log.severe("Thanks for using ZezimaTabs =]");
  403.  
  404. }
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416. public int loop() {
  417. for (Action action : actions) {
  418. if (action.isValid()) {
  419. action.process();
  420. return random(100, 200);
  421. }
  422. }
  423. return -1;
  424. }
  425.  
  426. private boolean hasHousePortal() {
  427. return objects.getNearest(13405) != null;
  428. }
  429.  
  430. private boolean canCraft() {
  431. return inventory.getCount(GameConstants.SOFT_CLAY) > 0;
  432. }
  433.  
  434. private boolean isInterfaceValid(int interfaceId) {
  435. return interfaces.getComponent(interfaceId, 0).isValid();
  436. }
  437.  
  438. private void idle() {
  439. if (random(0, 50) == 0) {
  440. int rand2 = random(1, 3);
  441. for (int i = 0; i < rand2; i++) {
  442. mouse.move(random(100, 500), random(100, 300));
  443. sleep(random(200, 500));
  444. }
  445. mouse.move(random(0, 400), 647, 50, 100);
  446. sleep(random(100, 750));
  447. mouse.move(random(75, 400), random(75, 400), 30);
  448. }
  449. if (random(0, 50) == 0) {
  450. Point curPos = mouse.getLocation();
  451. mouse.move(random(0, 500), random(0, 300), 20);
  452. sleep(random(100, 300));
  453. mouse.move(curPos, 20, 20);
  454. }
  455. if (random(0, 50) == 0) {
  456. int angle = camera.getAngle() + random(-40, 40);
  457. if (angle < 0) {
  458. angle += 359;
  459. }
  460. if (angle > 359) {
  461. angle -= 359;
  462. }
  463. camera.setAngle(angle);
  464. }
  465. if (random(0, 50) == 0) {
  466. if (random(0, 4) == 0) {
  467. camera.setPitch(random(50, 80));
  468. } else {
  469. camera.setPitch(true);
  470. }
  471. }
  472. }
  473.  
  474. public void serverMessageRecieved(ServerMessageEvent e) {
  475. }
  476.  
  477.  
  478.  
  479. public void setCrafting(boolean crafting) {
  480. this.crafting = crafting;
  481. }
  482.  
  483. public boolean isCrafting() {
  484. return crafting;
  485. }
  486.  
  487. private class ArbiTabsGUI extends JFrame {
  488.  
  489. private static final long serialVersionUID = 1L;
  490. private boolean start = false;
  491.  
  492. public ArbiTabsGUI() {
  493. initComponents();
  494. }
  495.  
  496. private void button1ActionPerformed(ActionEvent e) {
  497. setStart(true);
  498. this.setVisible(false);
  499. }
  500.  
  501. private void initComponents() {
  502. label1 = new JLabel();
  503. comboBox1 = new JComboBox();
  504. label2 = new JLabel();
  505. button1 = new JButton();
  506.  
  507. setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
  508. setTitle("AutoTabMaker");
  509. setAlwaysOnTop(true);
  510. setResizable(false);
  511. Container contentPane = getContentPane();
  512. contentPane.setLayout(null);
  513.  
  514. label1.setText("AutoTabMaker");
  515. label1.setHorizontalAlignment(SwingConstants.CENTER);
  516. label1.setFont(new Font("Verdana", Font.PLAIN, 16));
  517. contentPane.add(label1);
  518. label1.setBounds(0, 0, 395, 25);
  519.  
  520. comboBox1.setModel(new DefaultComboBoxModel(new String[] {
  521. "Varrock Teleport",
  522. "Lumbridge Teleport",
  523. "Camelot Teleport",
  524. "Ardougne Teleport",
  525. "Home Teleport",
  526. "Watchtower Teleport",
  527. "Enchant Saphire",
  528. "Enchant Emerald",
  529. "Enchant Ruby",
  530. "Enchant Diamond",
  531. "Enchant Dragonstone",
  532. "Enchant Onyx",
  533. "Bones To Bananas",
  534. "Bones To Peaches"
  535. }));
  536. comboBox1.setFont(new Font("Verdana", Font.PLAIN, 12));
  537. contentPane.add(comboBox1);
  538. comboBox1.setBounds(85, 30, 300, 35);
  539.  
  540. label2.setText("Make Tab:");
  541. label2.setFont(new Font("Verdana", Font.PLAIN, 14));
  542. label2.setLabelFor(comboBox1);
  543. contentPane.add(label2);
  544. label2.setBounds(new Rectangle(new Point(5, 35), label2.getPreferredSize()));
  545.  
  546. button1.setText("Start");
  547. button1.setFont(new Font("Verdana", Font.PLAIN, 14));
  548. button1.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  549. button1.addActionListener(new ActionListener() {
  550. @Override
  551. public void actionPerformed(ActionEvent e) {
  552. button1ActionPerformed(e);
  553. }
  554. });
  555. contentPane.add(button1);
  556. button1.setBounds(new Rectangle(new Point(315, 70), button1.getPreferredSize()));
  557.  
  558. {
  559. Dimension preferredSize = new Dimension();
  560. for(int i = 0; i < contentPane.getComponentCount(); i++) {
  561. Rectangle bounds = contentPane.getComponent(i).getBounds();
  562. preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
  563. preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
  564. }
  565. Insets insets = contentPane.getInsets();
  566. preferredSize.width += insets.right;
  567. preferredSize.height += insets.bottom;
  568. contentPane.setMinimumSize(preferredSize);
  569. contentPane.setPreferredSize(preferredSize);
  570. }
  571. setSize(400, 135);
  572. setLocationRelativeTo(null);
  573. }
  574.  
  575. public void setStart(boolean start) {
  576. this.start = start;
  577. }
  578.  
  579. public boolean isStart() {
  580. return start;
  581. }
  582.  
  583. private JLabel label1;
  584. private JComboBox comboBox1;
  585. private JLabel label2;
  586. private JButton button1;
  587.  
  588. }
  589.  
  590.  
  591.  
  592. private Image getImage(String url) {
  593. try {
  594. return ImageIO.read(new URL(url));
  595. } catch(IOException e) {
  596. return null;
  597. }
  598. }
  599.  
  600.  
  601. public void onRepaint(Graphics g1) {
  602.  
  603.  
  604. }
  605.  
  606. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement