- import java.awt.Color;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.util.Map;
- import org.rsbot.bot.Bot;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Constants;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.Random;
- @ScriptManifest(authors = { "dpedroia15" }, category = "Magic", name = "Camelot Teleporter", version = 1.00, description = "<html><title>dpedroia15's Camelot Teleporter</title><head><b>Customized For Dalis! </b></head><body>Have an air staff equipped with law runes in your inventory. Start anywhere.</body></html\n")
- public class CamelotTeleporter extends Script implements PaintListener{
- private final ScriptManifest properties = getClass().getAnnotation(ScriptManifest.class);
- public boolean onStart(Map<String, String> args) {
- startTime = System.currentTimeMillis();
- if (check == false) {
- if (airStaffCheck == false) {
- if (!equipmentContainsOneOf(airStaff)) {
- log("Cannot find air staff.");
- airStaffCheck = true;
- stopScript();
- return true;
- }
- }
- }
- return true;
- }
- //Items
- public int lawRune = 563;
- public int airStaff = 1381;
- //Paint
- public long startTime = System.currentTimeMillis();
- public int startexp;
- public int xpGained;
- public int casts = 0;
- //Other
- boolean airStaffCheck = false;
- boolean lawCheck = false;
- boolean check = false;
- public int loop() {
- if (lawCheck == false) {
- if (inventoryContainsOneOf(lawRune) == false) {
- log("You do not have any law runes.");
- lawCheck = true;
- stopScript();
- return -1;
- }
- else {
- if (getMyPlayer().getAnimation() == -1) {
- castTeleport();
- }
- }
- }
- return 0;
- }
- public void castTeleport() {
- while (getCurrentTab() != TAB_MAGIC) {
- openTab(TAB_MAGIC);
- return;
- }
- for (int a = 2; a > 1; a = a + 1) {
- try {
- if (getCurrentTab() != TAB_MAGIC) {
- openTab(TAB_MAGIC);
- wait (random(100,150));
- }
- if (getCurrentTab() == TAB_MAGIC) {
- clickMouse((random(640,650)),(random(318,331)),true);
- wait (random(100,150));
- }
- }
- catch (Exception e) {
- return;
- }
- }
- }
- public void onRepaint(Graphics g) {
- if (isLoggedIn()) {
- if ( startexp == 0) {
- startexp = skills.getCurrentSkillExp(STAT_MAGIC);
- }
- xpGained = skills.getCurrentSkillExp(STAT_MAGIC) - startexp;
- long millis = System.currentTimeMillis() - startTime;
- long hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- long minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- long seconds = millis / 1000;
- long minutes2 = minutes + (hours * 60);
- float xpsec = 0;
- if ((minutes > 0 || hours > 0 || seconds > 0) && xpGained > 0) {
- xpsec = ((float) xpGained)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- float xpmin = xpsec * 60;
- float xphour = xpmin * 60;
- g.setColor(Color.black);
- g.drawRoundRect(7,255,230,78,10,10);
- g.setColor(Color.blue);
- g.fillRoundRect(7,255,230,79,10,10);
- g.setColor(Color.white);
- g.setFont(new Font("Times New Roman", Font.BOLD, 14));
- g.drawString("dpedroia15's Dummy Curser", 9, 275);
- g.drawString("Time running: " + hours + ":" + minutes + ":" + seconds + "." , 9, 305);
- g.drawString("XP Gained: " + xpGained, 9, 290);
- g.drawString("XP per Hour: " + (int)xphour, 9, 320);
- g.drawString("Casts: " + casts , 9, 335);
- }
- }
- }
