SimmysProjects

Astral RuneCrafter - Soulplay

Aug 30th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.80 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Graphics;
  3. import java.text.NumberFormat;
  4. import java.util.Locale;
  5. import java.util.concurrent.Callable;
  6. import xobot.client.callback.listeners.MessageListener;
  7. import xobot.client.callback.listeners.PaintListener;
  8. import xobot.client.events.MessageEvent;
  9. import xobot.script.ActiveScript;
  10. import xobot.script.Manifest;
  11. import xobot.script.methods.GameObjects;
  12. import xobot.script.methods.NPCs;
  13. import xobot.script.methods.Packets;
  14. import xobot.script.methods.Widgets;
  15. import xobot.script.methods.tabs.Inventory;
  16. import xobot.script.methods.tabs.Skills;
  17. import xobot.script.util.Time;
  18. import xobot.script.util.Timer;
  19. import xobot.script.wrappers.Widget;
  20. import xobot.script.wrappers.WidgetChild;
  21. import xobot.script.wrappers.interactive.GameObject;
  22. import xobot.script.wrappers.interactive.Item;
  23. import xobot.script.wrappers.interactive.NPC;
  24.  
  25. @Manifest(
  26. authors = {"Simmy"},
  27. name = "Universal Astrals",
  28. description = "Will Make Astral Runes @ Home"
  29. )
  30. public class AstralRuneCrafter extends ActiveScript implements PaintListener, MessageListener {
  31. private Timer timer;
  32. private int RCExp = 0;
  33. public static int Rune_Crafted = 0;
  34. String status = "Loading Data..";
  35. NPC Banker = NPCs.getNearest(new int[]{494});
  36. GameObject Altar = GameObjects.getNearest(new int[]{17010});
  37. GameObject Booth = GameObjects.getNearest(new int[]{26972});
  38. Item Ess = Inventory.getItem(1437);
  39.  
  40. public boolean onStart() {
  41. this.timer = new Timer();
  42. this.RCExp = Skills.RUNECRAFTING.getCurrentExp();
  43. return true;
  44. }
  45.  
  46. public void MessageRecieved(MessageEvent message) {
  47. if (message.getMessage().contentEquals("You bind the temple's power into 26 Astral runes.")) {
  48. Rune_Crafted += 26;
  49. }
  50.  
  51. if (message.getMessage().contentEquals("You bind the temple's power into 27 Astral runes.")) {
  52. Rune_Crafted += 27;
  53. }
  54.  
  55. if (message.getMessage().contentEquals("You bind the temple's power into 52 Astral runes.")) {
  56. Rune_Crafted += 52;
  57. }
  58.  
  59. if (message.getMessage().contentEquals("You bind the temple's power into 54 Astral runes.")) {
  60. Rune_Crafted += 54;
  61. }
  62.  
  63. }
  64.  
  65. public int loop() {
  66. if (this.Altar == null & this.Banker == null) {
  67. this.status = "We Are Going Home!";
  68. this.teleport("Edgeville");
  69. Time.sleep(() -> {
  70. return this.Banker != null;
  71. }, 6000);
  72. } else if (Inventory.getFreeSlots() >= 1 & this.Banker != null) {
  73. this.status = "We Are Un-Noting The Essence!";
  74. this.Ess.interact("Use");
  75. Time.sleep(850);
  76. this.Booth.interact("Use with");
  77. Time.sleep(() -> {
  78. return Inventory.getFreeSlots() <= 0;
  79. }, 1000);
  80. } else if (Inventory.getFreeSlots() <= 0 & this.Ess != null & this.Altar != null) {
  81. this.status = "Attempting To Craft Runes!";
  82. this.Altar.interact("Craft-rune");
  83. Time.sleep(() -> {
  84. return Inventory.getFreeSlots() >= 1;
  85. }, 1000);
  86. }
  87.  
  88. return 0;
  89. }
  90.  
  91. public void repaint(Graphics g) {
  92. int RCXP = Skills.RUNECRAFTING.getCurrentExp() - this.RCExp;
  93. int RCXPs = (int)((double)RCXP * 3600000.0D / (double)this.timer.getElapsed());
  94. g.setColor(Color.white);
  95. g.drawString("Runtime: " + this.timer.toElapsedString(), 15, 250);
  96. g.drawString("Status: " + this.status, 15, 265);
  97. g.drawString("Astrals Crafted: " + Rune_Crafted, 15, 280);
  98. g.drawString("RC Exp Gained: " + NumberFormat.getNumberInstance(Locale.US).format((long)RCXP), 15, 295);
  99. g.drawString("RC Exp(hr): " + NumberFormat.getNumberInstance(Locale.US).format((long)RCXPs), 15, 310);
  100. g.drawString("Universal Astral Crafter by Simmy", 180, 30);
  101. }
  102.  
  103. public boolean teleport(String destination) {
  104. Widget container = Widgets.get(25411);
  105. if (container != null) {
  106. WidgetChild[] children = container.getChildren();
  107. WidgetChild[] array = children;
  108. int length = children.length;
  109.  
  110. for(int i = 0; i < length; ++i) {
  111. WidgetChild child = array[i];
  112. WidgetChild[] grandChildren = child.getChildren();
  113. WidgetChild[] array2 = grandChildren;
  114. int length2 = grandChildren.length;
  115.  
  116. for(int j = 0; j < length2; ++j) {
  117. WidgetChild grandChild = array2[j];
  118. String text = grandChild.getText();
  119. if (text != null && !text.isEmpty() && text.trim().toLowerCase().equals(destination.toLowerCase())) {
  120. Packets.sendAction(315, 0, 0, grandChild.getParentId() - 1);
  121. Time.sleep(500);
  122. return true;
  123. }
  124. }
  125. }
  126. }
  127.  
  128. return false;
  129. }
Add Comment
Please, Sign In to add comment