Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 4.65 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  
  2.  
  3. import java.awt.Color;
  4. import java.awt.Graphics;
  5. import java.awt.Point;
  6.  
  7.  
  8.  
  9. import com.quirlion.script.Calculations;
  10. import com.quirlion.script.Script;
  11.  
  12. import com.quirlion.script.types.GroundItem;
  13. import com.quirlion.script.types.Player;
  14.  
  15. import com.quirlion.script.types.Location;
  16.  
  17. import com.quirlion.script.types.NPC;
  18.  
  19.  
  20.  
  21.  
  22. public class mCows extends Script {
  23.  
  24.         int[] intCowId = {397,81,1767,1768};
  25.         int intBeefyBill = 246;
  26.         Location locBeefyBill = new Location(3180, 3320);
  27.         int cowHide = 1739;
  28.         String strCowHide = "Cowhide";
  29.  
  30.  
  31.  
  32.         @Override
  33.  
  34.         public void onStart() {
  35.                
  36.  
  37.  
  38.         }
  39.  
  40.  
  41.  
  42.         @Override
  43.  
  44.         public int loop() {
  45.                        
  46.                 if(players.getCurrent().isMoving()){
  47.                     return Calculations.random(1000, 1500);
  48.                 }
  49.                 if(players.getCurrent().isInCombat()){
  50.                         return Calculations.random(1000, 1500);
  51.                 }
  52.                 if(players.getCurrent().getAnimation() != -1){
  53.                         return Calculations.random(1000, 1500);
  54.                 }
  55.                 if(isInCombat()){
  56.                         while(isInCombat()){
  57.                                
  58.                         }
  59.                         return Calculations.random(100, 300);
  60.                 }
  61.                 if(inventory.isFull()){
  62.                         walker.walkTo(locBeefyBill);
  63.                         if(Calculations.getDistanceBetween(npcs.getNearestByID(intBeefyBill).getLocation(),players.getCurrent().getLocation())<6){
  64.                                 NPC  b = npcs.getNearestByID(intBeefyBill);
  65.                                 inventory.clickItem(1);
  66.                                 b.click("Use");
  67.                         }else{
  68.                                 walker.walkTo(npcs.getNearestByID(intBeefyBill).getLocation());
  69.                         }
  70.                 }
  71.                
  72.                 if(getClosestItem(6) != null)  {
  73.              
  74.                     GroundItem cowH = getClosestItem(6);
  75.                     if(Calculations.getDistanceBetween(players.getCurrent().getLocation(),cowH.getLocation()) < 6){
  76.                         cowH.click("Take " + strCowHide);
  77.                         return Calculations.random(1000, 1500);
  78.                     }else{
  79.                         Location place = cowH.getLocation();
  80.                         walker.walkTileMM(place);
  81.                         return Calculations.random(1000, 1500);
  82.                     }
  83.  
  84.  
  85.                }
  86.                
  87.                 NPC tstClosest = getclosestfreeNPC();
  88.                 if(tstClosest != null){
  89.                         log("2");
  90.                     if(tstClosest.isOnScreen()){
  91.                        
  92.                         tstClosest.click("Attack");
  93.                         return Calculations.random(1000, 1500);
  94.                     }else{
  95.                        
  96.                         Location ppp = tstClosest.getLocation();
  97.                         walker.walkTileMM(ppp);
  98.                         return Calculations.random(1000, 1500);
  99.  
  100.                     }
  101.                 }
  102.  
  103.  
  104.                 return Calculations.random(1000, 2000);
  105.  
  106.         }
  107.  
  108.  
  109.  
  110.  
  111.         public void paint(Graphics g) {
  112.     Point s = input.getBotMousePosition();
  113.     g.drawRect(s.x, s.y, 10, 10);
  114.  
  115.  
  116.  
  117.         }
  118.      public NPC getclosestfreeNPC(){
  119.             NPC a = null;
  120.          
  121.             int distance = 80000;
  122.             NPC[] arrNPC =npcs.getNearestNPCs(intCowId);
  123.             for(NPC s : arrNPC){
  124.                 if(Calculations.getDistanceBetween(players.getCurrent().getLocation(), s.getLocation()) < distance){
  125.                    if(s.getInteracting() == null){
  126.                     a = s;
  127.                     distance = Calculations.getDistanceBetween(players.getCurrent().getLocation(), s.getLocation());
  128.                    
  129.                    }
  130.                 }
  131.             }
  132.             return a;
  133.         }
  134. public GroundItem getClosestItem(int range){
  135.         GroundItem z = null;
  136.         GroundItem[] aa ;
  137.         int furth = 80000;
  138.         if (groundItems.getNearest(cowHide) != null){
  139.         aa = groundItems.getNearest(cowHide);
  140.         if(aa.length > 0){
  141.         for(GroundItem p : aa){
  142.                 if(p !=null){
  143.                 if(Calculations.getDistanceBetween(players.getCurrent().getLocation(), p.getLocation()) <= range){
  144.                         if(Calculations.getDistanceBetween(players.getCurrent().getLocation(),p.getLocation()) < furth){
  145.                                 furth = Calculations.getDistanceBetween(players.getCurrent().getLocation(),p.getLocation());
  146.                                 z = p;
  147.                         }
  148.                 }
  149.                 }
  150.         }
  151.         }
  152.         }
  153.         return z;
  154. }
  155. public boolean isInCombat(){
  156.         Player plyName = players.getCurrent();
  157.         NPC[] arrNPC = npcs.getNearestNPCs(intCowId);
  158.         if(arrNPC.length >0){
  159.         for(NPC s : arrNPC){
  160.                 if(s.getInteracting() != plyName){
  161.                        
  162.                 }else{
  163.                         return true;
  164.                 }
  165.         }
  166.         }
  167.         return false;
  168. }
  169. }