Advertisement
Guest User

Untitled

a guest
Sep 17th, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.52 KB | None | 0 0
  1. package scripts.cakestealer;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Font;
  5. import java.awt.Graphics;
  6. import java.awt.Graphics2D;
  7.  
  8. import org.tribot.api.DynamicClicking;
  9. import org.tribot.api.General;
  10. import org.tribot.api.Timing;
  11. import org.tribot.api.input.Mouse;
  12. import org.tribot.api.interfaces.Positionable;
  13. import org.tribot.api2007.Game;
  14. import org.tribot.api2007.Options;
  15. import org.tribot.api2007.Skills;
  16. import org.tribot.api2007.Banking;
  17. import org.tribot.api2007.Camera;
  18. import org.tribot.api2007.Inventory;
  19. import org.tribot.api2007.Objects;
  20. import org.tribot.api2007.Player;
  21. import org.tribot.api2007.Skills.SKILLS;
  22. import org.tribot.api2007.WebWalking;
  23. import org.tribot.api2007.types.RSItem;
  24. import org.tribot.api2007.types.RSObject;
  25. import org.tribot.api2007.types.RSTile;
  26. import org.tribot.api2007.util.ThreadSettings;
  27. import org.tribot.script.Script;
  28. import org.tribot.script.ScriptManifest;
  29. import org.tribot.script.interfaces.Painting;
  30.  
  31. @ScriptManifest(authors = { "Genka" }, category = "Thieving", name = "ArdyCakeStealer")
  32. public class Main extends Script implements Painting{
  33.     boolean alive = true;
  34.     int startlevel = Skills.getActualLevel(SKILLS.THIEVING);
  35.     int startxp = Skills.getXP(SKILLS.THIEVING);
  36.     Positionable stalltile = new RSTile(2668, 3312);
  37.    
  38.     @Override
  39.     public void run() {
  40.         ThreadSettings.get().setObjectCModelMethod(ThreadSettings.MODEL_CLICKING_METHOD.CENTRE);
  41.         Camera.setCameraAngle(75);
  42.         Camera.setCameraRotation(0);
  43.         General.useAntiBanCompliance(true);
  44.         while(alive){
  45.             if(Inventory.isFull() && !Player.getRSPlayer().isInCombat()){
  46.                 ThreadSettings.get().setAlwaysRightClick(false);
  47.                 getRidOf();
  48.             } else {
  49.                 ThreadSettings.get().setAlwaysRightClick(true);
  50.                 steal();
  51.             }
  52.             if(Skills.getCurrentLevel(SKILLS.HITPOINTS) < 6){
  53.                 println(Skills.getCurrentLevel(SKILLS.HITPOINTS));
  54.                 eat();
  55.             }          
  56.             if(Game.getRunEnergy() > 10){
  57.                 Options.setRunOn(true);
  58.             }
  59.             sleep(10,50);
  60.         }
  61.        
  62.     }
  63.    
  64.     private void getRidOf(){
  65.         if(Player.getPosition().distanceTo(new RSTile(2654, 3284)) > 2){
  66.             WebWalking.walkTo(new RSTile(2654, 3284));
  67.         } else {
  68.             if(!Banking.isBankScreenOpen()){
  69.                 Banking.openBank();
  70.             } else {
  71.                 Banking.depositAll();
  72.                 sleep(600,1500);
  73.             }
  74.         }
  75.        
  76.     }
  77.    
  78.     private void eat(){
  79.         RSItem[] food = Inventory.find("Cake" , "Bread", "Chocolate slice", "2/3 Cake", "Slice of cake");
  80.         if(food.length > 0){
  81.             food[0].click("Eat");
  82.             sleep(600,1000);
  83.         }
  84.     }
  85.    
  86.     private void steal(){
  87.         RSObject[] stall = Objects.getAt(new RSTile(2667, 3310));
  88.         if(Player.getPosition().distanceTo(stalltile) == 0 && !Player.getRSPlayer().isInCombat() && !Inventory.isFull()){
  89.             if(stall.length > 0){
  90.                 if(Game.getUptext().contains("Steal-from")){
  91.                     sleep(0, 30);
  92.                     Mouse.click(1);
  93.                     sleep(1500,2500);
  94.                 } else if(stall[0].isOnScreen() && !stall[0].getDefinition().getName().equals("Market stall") && !Player.isMoving()){
  95.                     sleep(0, 50);
  96.                     stall[0].click("Steal-from");
  97.                     sleep(1500,2500);
  98.                 }
  99.             }
  100.         } else if(Player.getRSPlayer().isInCombat()){
  101.             if(Player.getPosition().distanceTo(new RSTile(2669, 3310)) > 0 && !Player.isMoving()){
  102.                 DynamicClicking.clickRSTile(new RSTile(2669, 3310), "Walk here");
  103.                 sleep(600,1000);
  104.             }
  105.         } else if(!Player.getRSPlayer().isInCombat() && Player.getPosition().distanceTo(stalltile) > 0 && !Player.isMoving()){
  106.             if(stalltile.getAnimablePosition().isOnScreen()){
  107.                 DynamicClicking.clickRSTile(stalltile, "Walk here");
  108.                 sleep(600,1000);
  109.             } else {
  110.                 WebWalking.walkTo(stalltile);
  111.             }
  112.         }
  113.            
  114.     }
  115.    
  116.       private final Color color1 = new Color(0, 102, 153);
  117.  
  118.         private final Font font1 = new Font("Arial", 0, 13);
  119.         private final Font font2 = new Font("Arial", 0, 12);
  120.  
  121.  
  122.     @Override
  123.     public void onPaint(Graphics g1) {
  124.        
  125.         double multiplier = getRunningTime() / 3600000.0D;
  126.         int xpPerHour = (int) ((Skills.getXP(SKILLS.THIEVING) - startxp) / multiplier);    
  127.         Graphics2D g = (Graphics2D)g1;
  128.         g.setFont(font1);
  129.         g.setColor(color1);
  130.         g.drawString("Runtime:", 344, 421);
  131.         g.drawString("Level:", 344, 436);
  132.         g.drawString("XP:", 344, 451);
  133.         g.setFont(font2);
  134.         g.drawString("" + Timing.msToString(getRunningTime()), 400, 421);
  135.         g.drawString("" + Skills.getActualLevel(SKILLS.THIEVING) + " (" + (Skills.getActualLevel(SKILLS.THIEVING) - startlevel) + " Gained)" , 379, 436);
  136.         g.drawString("" + (Skills.getXP(SKILLS.THIEVING) - startxp) + " (" + xpPerHour + " /Hour)", 366, 451);
  137.  
  138.        
  139.     }
  140.    
  141.    
  142.  
  143. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement