Advertisement
Leffen

Untitled

Aug 10th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.73 KB | None | 0 0
  1. import org.dreambot.api.methods.container.impl.bank.BankLocation;
  2. import org.dreambot.api.methods.container.impl.equipment.EquipmentSlot;
  3. import org.dreambot.api.methods.filter.Filter;
  4. import org.dreambot.api.methods.map.Area;
  5. import org.dreambot.api.methods.map.Tile;
  6. import org.dreambot.api.methods.skills.Skill;
  7. import org.dreambot.api.script.AbstractScript;
  8. import org.dreambot.api.script.Category;
  9. import org.dreambot.api.script.ScriptManifest;
  10. import org.dreambot.api.wrappers.interactive.GameObject;
  11. import org.dreambot.api.wrappers.interactive.NPC;
  12. import org.dreambot.api.wrappers.items.GroundItem;
  13. import org.dreambot.api.wrappers.widgets.WidgetChild;
  14.  
  15.  
  16. import java.awt.event.KeyEvent;
  17.  
  18.  
  19. @ScriptManifest(
  20.         author = "ZeddyBoi",
  21.         description = "Kills Cows, burys bones, will bank when inv full",
  22.         category = Category.COMBAT,
  23.         version = 1.0,
  24.         name = "FallyCowKiller"
  25. )
  26.  
  27. public class Main extends AbstractScript {
  28. Area KillArea = new Area(3024, 3310, 3041, 3298 );
  29. public static int cowhide = 1739;
  30. public static int bonesid = 526;
  31.     public static final String COW = "Cow";
  32.  
  33.     public static final Filter<NPC> COW_FILTER = new Filter<NPC>() {
  34.         @Override
  35.         public boolean match(NPC npc) {
  36.             if (npc == null ){
  37.                 return false;
  38.             }
  39.             return npc.getName().equals(COW) && !npc.isHealthBarVisible();
  40.  
  41.         }
  42.     };
  43.  
  44.  
  45.     @Override
  46.     public int onLoop() {
  47.         //Check if the user has a full inventory
  48.         if (getInventory().isFull()){
  49.             if (getBank().isOpen()){
  50.                 getBank().depositAll("cowhide");
  51.             }
  52.             else {
  53.                     sleep(2000);
  54.                     getBank().open(BankLocation.FALADOR_EAST);
  55.             }
  56.         }
  57.         //Check is user is in cow pen, then check if there's loot on the floor already
  58.         else{
  59.             //Check if the user is in the kill areas
  60.             if (KillArea.contains(getLocalPlayer())){
  61.                 //check if there is bones and cowhide near
  62.                 GroundItem groundItemsToLoot = getGroundItems().closest("Cowhide", "Bones");
  63.                 if(!getInventory().contains(cowhide)) {
  64.                     if (groundItemsToLoot != null)
  65.                         groundItemsToLoot.interact("Take");
  66.                 }
  67.                 else{
  68.                     NPC cow = getNpcs().closest(COW_FILTER);
  69.                     if (cow != null) {
  70.                         cow.interact("Attack");
  71.                         sleep(10000);
  72.                     }
  73.                 }
  74.             }
  75.             else{
  76.                 getWalking().walk(KillArea.getRandomTile());
  77.             }
  78.         }
  79.  
  80.         return 0;
  81.     }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement