Guest
Public paste!

Rsbot Scripts

By: a guest | Feb 9th, 2010 | Syntax: None | Size: 3.93 KB | Hits: 394 | Expires: Never
Copy text to clipboard
  1. import java.awt.Color;
  2. import java.awt.Font;
  3. import java.awt.Graphics;
  4. import java.util.Map;
  5.  
  6. import org.rsbot.bot.Bot;
  7. import org.rsbot.event.listeners.PaintListener;
  8. import org.rsbot.script.Constants;
  9. import org.rsbot.script.Script;
  10. import org.rsbot.script.ScriptManifest;
  11. import org.rsbot.script.Random;
  12.  
  13.  
  14.  
  15. @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")
  16.  
  17. public class CamelotTeleporter extends Script implements PaintListener{    
  18.     private final ScriptManifest properties = getClass().getAnnotation(ScriptManifest.class);
  19.    
  20.     public boolean onStart(Map<String, String> args) {
  21.         startTime = System.currentTimeMillis();
  22.         if (check == false) {
  23.             if (airStaffCheck == false) {
  24.                 if (!equipmentContainsOneOf(airStaff)) {
  25.                     log("Cannot find air staff.");
  26.                     airStaffCheck = true;
  27.                     stopScript();
  28.                     return true;
  29.                     }
  30.                 }
  31.         }
  32.         return true;
  33.     }
  34. //Items
  35. public int lawRune = 563;
  36. public int airStaff = 1381;
  37.  
  38. //Paint
  39. public long startTime = System.currentTimeMillis();
  40. public int startexp;
  41. public int xpGained;
  42. public int casts = 0;
  43.  
  44. //Other
  45. boolean airStaffCheck = false;
  46. boolean lawCheck = false;
  47. boolean check = false;
  48.  
  49.  
  50. public int loop() {
  51.     if (lawCheck == false) {
  52.         if (inventoryContainsOneOf(lawRune) == false) {
  53.             log("You do not have any law runes.");
  54.             lawCheck = true;
  55.             stopScript();
  56.             return -1;
  57.         }
  58.         else {
  59.             if (getMyPlayer().getAnimation() == -1) {
  60.                 castTeleport();
  61.             }
  62.         }
  63.     }    
  64. return 0;
  65. }
  66.  
  67. public void castTeleport() {
  68.     while (getCurrentTab() != TAB_MAGIC) {
  69.         openTab(TAB_MAGIC);
  70.         return;
  71.     }
  72.     for (int a = 2; a > 1; a = a + 1) {
  73.     try {
  74.         if (getCurrentTab() != TAB_MAGIC) {
  75.             openTab(TAB_MAGIC);
  76.             wait (random(100,150));
  77.         }
  78.         if (getCurrentTab() == TAB_MAGIC) {
  79.             clickMouse((random(640,650)),(random(318,331)),true);
  80.             wait (random(100,150));
  81.         }
  82.     }
  83.     catch (Exception e) {
  84.         return;
  85.     }
  86.     }
  87. }
  88.  
  89. public void onRepaint(Graphics g) {
  90.         if (isLoggedIn()) {
  91.         if ( startexp == 0) {
  92.              startexp = skills.getCurrentSkillExp(STAT_MAGIC);
  93.         }
  94.         xpGained = skills.getCurrentSkillExp(STAT_MAGIC) - startexp;
  95.         long millis = System.currentTimeMillis() - startTime;
  96.             long hours = millis / (1000 * 60 * 60);
  97.             millis -= hours * (1000 * 60 * 60);
  98.             long minutes = millis / (1000 * 60);
  99.             millis -= minutes * (1000 * 60);
  100.             long seconds = millis / 1000;
  101.             long minutes2 = minutes + (hours * 60);
  102.         float xpsec = 0;
  103.         if ((minutes > 0 || hours > 0 || seconds > 0) && xpGained > 0) {
  104.         xpsec = ((float) xpGained)/(float)(seconds + (minutes*60) + (hours*60*60));
  105.         }
  106.         float xpmin = xpsec * 60;
  107.         float xphour = xpmin * 60;
  108.         g.setColor(Color.black);
  109.         g.drawRoundRect(7,255,230,78,10,10);
  110.         g.setColor(Color.blue);
  111.         g.fillRoundRect(7,255,230,79,10,10);
  112.             g.setColor(Color.white);
  113.         g.setFont(new Font("Times New Roman", Font.BOLD, 14));
  114.         g.drawString("dpedroia15's Dummy Curser", 9, 275);
  115.             g.drawString("Time running: " + hours + ":" + minutes + ":" + seconds + "." , 9, 305);
  116.             g.drawString("XP Gained: " + xpGained, 9, 290);
  117.             g.drawString("XP per Hour: " + (int)xphour, 9, 320);
  118.         g.drawString("Casts: " + casts , 9, 335);
  119.         }
  120.     }
  121. }