Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import java.awt.Graphics;
- import java.text.NumberFormat;
- import java.util.Locale;
- import java.util.concurrent.Callable;
- import xobot.client.callback.listeners.MessageListener;
- import xobot.client.callback.listeners.PaintListener;
- import xobot.client.events.MessageEvent;
- import xobot.script.ActiveScript;
- import xobot.script.Manifest;
- import xobot.script.methods.GameObjects;
- import xobot.script.methods.NPCs;
- import xobot.script.methods.Packets;
- import xobot.script.methods.Widgets;
- import xobot.script.methods.tabs.Inventory;
- import xobot.script.methods.tabs.Skills;
- import xobot.script.util.Time;
- import xobot.script.util.Timer;
- import xobot.script.wrappers.Widget;
- import xobot.script.wrappers.WidgetChild;
- import xobot.script.wrappers.interactive.GameObject;
- import xobot.script.wrappers.interactive.Item;
- import xobot.script.wrappers.interactive.NPC;
- @Manifest(
- authors = {"Simmy"},
- name = "Universal Astrals",
- description = "Will Make Astral Runes @ Home"
- )
- public class AstralRuneCrafter extends ActiveScript implements PaintListener, MessageListener {
- private Timer timer;
- private int RCExp = 0;
- public static int Rune_Crafted = 0;
- String status = "Loading Data..";
- NPC Banker = NPCs.getNearest(new int[]{494});
- GameObject Altar = GameObjects.getNearest(new int[]{17010});
- GameObject Booth = GameObjects.getNearest(new int[]{26972});
- Item Ess = Inventory.getItem(1437);
- public boolean onStart() {
- this.timer = new Timer();
- this.RCExp = Skills.RUNECRAFTING.getCurrentExp();
- return true;
- }
- public void MessageRecieved(MessageEvent message) {
- if (message.getMessage().contentEquals("You bind the temple's power into 26 Astral runes.")) {
- Rune_Crafted += 26;
- }
- if (message.getMessage().contentEquals("You bind the temple's power into 27 Astral runes.")) {
- Rune_Crafted += 27;
- }
- if (message.getMessage().contentEquals("You bind the temple's power into 52 Astral runes.")) {
- Rune_Crafted += 52;
- }
- if (message.getMessage().contentEquals("You bind the temple's power into 54 Astral runes.")) {
- Rune_Crafted += 54;
- }
- }
- public int loop() {
- if (this.Altar == null & this.Banker == null) {
- this.status = "We Are Going Home!";
- this.teleport("Edgeville");
- Time.sleep(() -> {
- return this.Banker != null;
- }, 6000);
- } else if (Inventory.getFreeSlots() >= 1 & this.Banker != null) {
- this.status = "We Are Un-Noting The Essence!";
- this.Ess.interact("Use");
- Time.sleep(850);
- this.Booth.interact("Use with");
- Time.sleep(() -> {
- return Inventory.getFreeSlots() <= 0;
- }, 1000);
- } else if (Inventory.getFreeSlots() <= 0 & this.Ess != null & this.Altar != null) {
- this.status = "Attempting To Craft Runes!";
- this.Altar.interact("Craft-rune");
- Time.sleep(() -> {
- return Inventory.getFreeSlots() >= 1;
- }, 1000);
- }
- return 0;
- }
- public void repaint(Graphics g) {
- int RCXP = Skills.RUNECRAFTING.getCurrentExp() - this.RCExp;
- int RCXPs = (int)((double)RCXP * 3600000.0D / (double)this.timer.getElapsed());
- g.setColor(Color.white);
- g.drawString("Runtime: " + this.timer.toElapsedString(), 15, 250);
- g.drawString("Status: " + this.status, 15, 265);
- g.drawString("Astrals Crafted: " + Rune_Crafted, 15, 280);
- g.drawString("RC Exp Gained: " + NumberFormat.getNumberInstance(Locale.US).format((long)RCXP), 15, 295);
- g.drawString("RC Exp(hr): " + NumberFormat.getNumberInstance(Locale.US).format((long)RCXPs), 15, 310);
- g.drawString("Universal Astral Crafter by Simmy", 180, 30);
- }
- public boolean teleport(String destination) {
- Widget container = Widgets.get(25411);
- if (container != null) {
- WidgetChild[] children = container.getChildren();
- WidgetChild[] array = children;
- int length = children.length;
- for(int i = 0; i < length; ++i) {
- WidgetChild child = array[i];
- WidgetChild[] grandChildren = child.getChildren();
- WidgetChild[] array2 = grandChildren;
- int length2 = grandChildren.length;
- for(int j = 0; j < length2; ++j) {
- WidgetChild grandChild = array2[j];
- String text = grandChild.getText();
- if (text != null && !text.isEmpty() && text.trim().toLowerCase().equals(destination.toLowerCase())) {
- Packets.sendAction(315, 0, 0, grandChild.getParentId() - 1);
- Time.sleep(500);
- return true;
- }
- }
- }
- }
- return false;
- }
Add Comment
Please, Sign In to add comment