Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.70 KB | None | 0 0
  1. import org.rsbot.script.Script;
  2. import org.rsbot.script.ScriptManifest;
  3. import org.rsbot.script.methods.Combat;
  4. import org.rsbot.script.methods.Equipment;
  5. import org.rsbot.script.methods.Walking;
  6. import org.rsbot.script.methods.Skills;
  7. import org.rsbot.script.wrappers.RSGroundItem;
  8. import org.rsbot.script.wrappers.RSTile;
  9. import org.rsbot.script.wrappers.RSNPC;
  10. import org.rsbot.script.util.Filter;
  11.  
  12. @ScriptManifest(authors = {"Tooth"},
  13. name = "TMinoMurderer",
  14. version = 0.2,
  15. description = "Kills Minotaurs in the Stronghold of Security.")
  16.  
  17. public class TMinoMurderer extends Script {
  18.    
  19.     //vars
  20.     boolean range = false;
  21.     boolean sling = false;
  22.     boolean food = false;
  23.     int minoID = 4404;
  24.     int idle = -1;
  25.     int[] arrowID = {882, 884, 886, 888, 890};
  26.     int startXP, XPGained, skill;
  27.     String status, skillTrained;
  28.    
  29.     RSTile minoTile = new RSTile(1868, 5189);
  30.    
  31.     public boolean onStart() {
  32.         if (range) {
  33.             skill = 4;
  34.             skillTrained = "Range";
  35.         } else {
  36.             skill = 2;
  37.             skillTrained = "Strength";
  38.         }
  39.        
  40.         startXP = skills.getCurrentExp(skill);
  41.        
  42.         String status = "Starting Up.";
  43.         log(status);
  44.         if (combat.getFightMode() == 1) {
  45.             log("Everything is set: Starting Script.");
  46.         } else {
  47.             combat.setFightMode(1);
  48.             log("Attack Mode set to Rapid.");
  49.             sleep(random(200,400));
  50.         }
  51.     return true;
  52.     }
  53.    
  54.     @Override
  55.     public int loop() {
  56.         RSGroundItem gItem = groundItems.getNearest();
  57.         if (equipment.getCount(Equipment.AMMO) == 0) {
  58.             if (!range || sling) {
  59.                 attackMino();
  60.             } else {
  61.                 pickupArrows();
  62.                 if (gItem.getItem().getStackSize() < 2) {
  63.                     attackMino();
  64.                 } else {
  65.                     pickupArrows();
  66.                 }
  67.             }
  68.         } else {
  69.             log("Out of Ammo: Loggin Out");
  70.             stopScript();
  71.         }
  72.         return 100;
  73.     }
  74.    
  75.     public void onFinish() {
  76.         XPGained = skills.getCurrentExp(skill) - startXP;
  77.         log("Gained " + XPGained + " " + skillTrained + " exp. Thanks for using TMinoMurderer.");
  78.     }
  79.    
  80.     //Methods
  81.     private void attackMino() {
  82.         if (status != "Killing Minotaurs.") {
  83.             status = "Killing Minotaurs.";
  84.             log(status);
  85.         }
  86.        
  87.         RSNPC mino = npcs.getNearest(minoID);
  88.         if (mino != null) {
  89.             if (getMyPlayer().getAnimation() == idle) {
  90.                 if (!getMyPlayer().isInCombat()) {
  91.                     mino.doAction("attack");
  92.                     sleep(random(400,600));
  93.                 }
  94.             }
  95.         } else {
  96.             //
  97.         }
  98.     }
  99.    
  100.     private void pickupArrows() {
  101.         if (status != "Picking up Arrows.") {
  102.             status = "Picking up Arrows.";
  103.             log(status);
  104.         }
  105.        
  106.         RSGroundItem gItem = groundItems.getNearest(arrowID);
  107.         if (gItem != null) {
  108.             if (gItem.getItem().getStackSize() > 1) {
  109.                 if (getMyPlayer().getAnimation() == idle) {
  110.                     gItem.doAction("attack");
  111.                     sleep(random(400,600));
  112.                 }
  113.             }
  114.         }
  115.     }
  116.  
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement