NissanNut

TeaStealer V1.1

Feb 12th, 2012
428
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.09 KB | None | 0 0
  1. import java.awt.*;
  2. import java.util.LinkedList;
  3. import java.util.List;
  4.  
  5. import org.runedream.api.Script;
  6. import org.runedream.api.ScriptManifest;
  7.  
  8. import org.runedream.api.methods.*;
  9. import org.runedream.api.util.Log;
  10. import org.runedream.api.util.Random;
  11. import org.runedream.api.util.Time;
  12. import org.runedream.api.wrappers.Tab;
  13.  
  14. @ScriptManifest(
  15.                 authors = { "Nissan Nut" },
  16.                 name = "Tea Stealer",
  17.                 version = 1.1,
  18.                 description = "Script Skeleton.",
  19.                 keywords = { "tea", "jbot", "theiving", "nissan nut"},
  20.                 language = { true, true, true, true })
  21.  
  22. public class TeaStealer extends Script{
  23.    
  24.         public long millis = 0;
  25.         public long hours = 0;
  26.         public long minutes = 0;
  27.         public long seconds = 0;
  28.         private int xpGained = 0;
  29.         private int teaHour = 0;
  30.         private int xpHour = 0;
  31.         private long startTime = 0;
  32.         private int inventory = 0;
  33.         private int stolen = 0;
  34.         private static final Color tea = new Color(85, 77, 73);
  35.         private static final Color stall = new Color(228, 216, 196);
  36.         private List<Point> teaPoints = new LinkedList<Point>();
  37.         private List<Point> stallPoints = new LinkedList<Point>();
  38.         private static final Rectangle CLOSEVIEW = new Rectangle(290, 110, 360, 190);
  39.  
  40.         @Override
  41.         public boolean onStart(){
  42.             Game.clickCompass();
  43.             Camera.pitchUp(1000);
  44.             Inventory.open();
  45.             return true;      
  46.         }
  47.  
  48.         @Override
  49.         public int loop() {  
  50.             Mouse.setSpeed(Random.random(4, 7));
  51.             inventory = Inventory.getCount();
  52.             stallPoints = ImageUtil.getPointsWithColor(Game.getImage(), stall, 0.01);
  53.             if (stallPoints.size() > 0){
  54.                 Point Stall = stallPoints.get(Random.random(0, stallPoints.size()));
  55.                 teaPoints = ImageUtil.getPointsWithColor(Game.getImage(), tea, 0.01);
  56.                 if (teaPoints.size() > 0){
  57.                     Point Tea = teaPoints.get(Random.random(0, teaPoints.size()));
  58.                     if (CLOSEVIEW.contains(Tea)){
  59.                         Time.sleep(25, 250);
  60.                         Mouse.click(Stall);
  61.                         if (!Inventory.isFull()){
  62.                             Time.sleep(7975);
  63.                         }
  64.                     }
  65.                 }
  66.             }
  67.            
  68.             if (Inventory.getCount() > inventory){
  69.                 stolen++;
  70.             }
  71.            
  72.             if (Inventory.isFull()){
  73.                 for(int i = 0; i < 28; i++){
  74.                     if(Inventory.getSlotAt(i).isEmpty())
  75.                         continue;
  76.                     final Point CENTER = Inventory.getSlotAt(i).getCenter();
  77.                     final Point CLICK = new Point(Random.random(CENTER.x - 6, CENTER.x + 6), Random.random(CENTER.y - 6, CENTER.y + 6));
  78.                     Mouse.click(CLICK, false);
  79.                     Time.sleep(400, 600);
  80.                     if(Mouse.getLocation().y > 403){
  81.                         Point p = new Point((int) (Mouse.getLocation().x + (Random.random(-10, 10))), Random.random(455, 470));
  82.                         if (Game.isPointValid(p)) {
  83.                             Mouse.click(p);
  84.                         }
  85.                     }else{
  86.                        Point p = new Point((int) (Mouse.getLocation().x + (Random.random(-10, 10))), (int) (Mouse.getLocation().y + (Random.random(54, 67))));
  87.                         if (Game.isPointValid(p)) {
  88.                             Mouse.click(p);
  89.                         }
  90.                     }
  91.                     Time.sleep(500, 800);
  92.                 }
  93.             }
  94.        
  95.             antiban();
  96.            
  97.             return 1;
  98.         }
  99.        
  100.         private void antiban() {
  101.             switch (Random.random(1, 100)){
  102.             case 1:
  103.                 Mouse.moveOffScreen();
  104.                 Time.sleep(1000, 3000);
  105.                 break;
  106.             case 2:
  107.                 Mouse.moveSlightly();
  108.                 break;
  109.             case 3:
  110.                 Camera.pitchDown(100);
  111.                 Camera.pitchUp(150);
  112.                 break;
  113.             case 4:
  114.                 Tabs.openTab(Tab.STATS);
  115.                 Time.sleep(100, 500);
  116.                 Mouse.moveSlightly();
  117.                 Time.sleep(1000, 3000);
  118.                 Inventory.open();
  119.                 Time.sleep(100, 500);
  120.                 break;
  121.             case 5:
  122.                 Time.sleep(1000, 3000);
  123.                 break;
  124.             }
  125.            
  126.         }
  127.         @Override
  128.         public void onRepaint(Graphics g1) {
  129.             Graphics2D g = (Graphics2D) g1;
  130.             millis = System.currentTimeMillis() - startTime;
  131.             hours = millis / (1000 * 60 * 60);
  132.             millis -= hours * (1000 * 60 * 60);
  133.             minutes = millis / (1000 * 60);
  134.             millis -= minutes * (1000 * 60);
  135.             seconds = millis / 1000;
  136.            
  137.             xpGained = (int) (stolen*16);
  138.             teaHour = (int) ((stolen) * 3600000D / (System.currentTimeMillis() - startTime));
  139.             xpHour = (int) (teaHour*16);
  140.            
  141.             g.drawString("Tea Stealer by Nissan Nut", 12, 280);
  142.             g.drawString("Runtime: "  + hours +":"+ minutes + ":" + seconds, 12, 290);
  143.             g.drawString("Tea Stolen: "+ stolen, 12, 300);
  144.             g.drawString("Tea/Hour: "+ teaHour, 12, 310);
  145.             g.drawString("XP Gained: "+ xpGained, 12, 320);
  146.             g.drawString("XP/Hour: "+ xpHour, 12, 330);
  147.            
  148.        
  149.         }
  150.  
  151.         @Override
  152.         public void onStop(){
  153.             Log.log("Tea's Stolen: " + stolen);
  154.             Log.log("XP Gained: " + stolen*16);  
  155.         }
  156.        
  157.        
  158. }
Add Comment
Please, Sign In to add comment