Advertisement
Guest User

My first try

a guest
Apr 19th, 2015
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.15 KB | None | 0 0
  1. import java.awt.*;
  2.  
  3. import org.dreambot.api.methods.Calculations;
  4. import org.dreambot.api.methods.event.EventHandler;
  5. import org.dreambot.api.methods.event.PaintEvent;
  6. import org.dreambot.api.methods.container.impl.bank.BankLocation;
  7. import org.dreambot.api.methods.filter.Filter;
  8. import org.dreambot.api.methods.map.Area;
  9. import org.dreambot.api.methods.map.Tile;
  10. import org.dreambot.api.methods.walking.path.impl.LocalPath;
  11. import org.dreambot.api.script.AbstractScript;
  12. import org.dreambot.api.script.Category;
  13. import org.dreambot.api.script.ScriptManifest;
  14. import org.dreambot.api.utilities.impl.Condition;
  15. import org.dreambot.api.wrappers.interactive.GameObject;
  16. import org.dreambot.api.wrappers.items.GroundItem;
  17.  
  18. import org.dreambot.api.methods.Calculations;
  19. import org.dreambot.api.methods.event.EventHandler;
  20. import org.dreambot.api.methods.event.PaintEvent;
  21. import org.dreambot.api.methods.skills.Skill;
  22. import org.dreambot.api.methods.tabs.Tab;
  23. import org.dreambot.api.methods.widget.Widget;
  24. import org.dreambot.api.script.AbstractScript;
  25. import org.dreambot.api.script.Category;
  26. import org.dreambot.api.script.ScriptManifest;
  27. import org.dreambot.api.utilities.impl.Condition;
  28. import org.dreambot.api.utilities.impl.Filter;
  29. import org.dreambot.api.wrappers.interactive.NPC;
  30. import org.dreambot.api.wrappers.widgets.WidgetChild;
  31.  
  32.  
  33. import org.dreambot.api.methods.Calculations;
  34. import org.dreambot.api.methods.container.impl.bank.BankLocation;
  35. import org.dreambot.api.methods.filter.Filter;
  36. import org.dreambot.api.methods.map.Area;
  37. import org.dreambot.api.methods.map.Tile;
  38. import org.dreambot.api.methods.walking.path.impl.LocalPath;
  39. import org.dreambot.api.script.AbstractScript;
  40. import org.dreambot.api.script.Category;
  41. import org.dreambot.api.script.ScriptManifest;
  42. import org.dreambot.api.utilities.impl.Condition;
  43. import org.dreambot.api.wrappers.interactive.GameObject;
  44. import org.dreambot.api.wrappers.items.GroundItem;
  45. import org.dreambot.api.methods.event.EventHandler;
  46. import org.dreambot.api.methods.event.PaintEvent;
  47.  
  48.  
  49.  
  50.  
  51.  
  52.     @ScriptManifest(author="BZmake", category= Category.COMBAT, name="Slaying Cows", version=0.1, description="Slays cows and banks hides")
  53.     public class BZcows extends AbstractScript{
  54.  
  55.      
  56.  
  57.      @Override
  58.         public int onLoop() throws InterruptedException {
  59.             getClient().disableIdleMouse();
  60.             // Click away level up messages
  61.             getDialogues().clickContinue();
  62.                
  63.            
  64.      }
  65.      
  66.      // Area's //
  67.      private final Area BANK_AREA = new Area();
  68.      private final Area COW_AREA = new Area ();
  69.      
  70.      //Tiles
  71.      private final Tile IN_FRONT_OF_GATE = new Tile ();// tile in front of gate
  72.      
  73.      
  74.      
  75.      
  76.      // Path //
  77.      private final localPath pathFromBank = new localPath();
  78.      
  79.      public void onStart(){
  80.          pathFromBank = new localPath(getClient().getMethodContext());
  81.             log("Lets Start!"); //Use log to print to the console
  82.         }
  83.      
  84.      
  85.      //States
  86.      private State state;
  87.      
  88.      //Declaring States
  89.      private enum state() {
  90.          BANK,
  91.          WALK_TO_BANK,
  92.          WALK_TO_COWS,
  93.          ATTACK,
  94.          PICK_UP,
  95.          IDLE,
  96.          DIALOGUE
  97.      }
  98.      
  99.      //state currently in
  100.      private State getState() {
  101.          //if inv full, bank
  102.          if(getInventory().isFull()){
  103.              if(BANK_AREA.contains(getLocalPlayer())){
  104.                  return State.BANK;
  105.                  
  106.              }
  107.              else{
  108.                  return State.WALK_TO_BANK
  109.              }
  110.      
  111.          }
  112.          else{
  113.              //if not full, attack and collect
  114.              if(COW_AREA.contains(getLocalPlayer())){
  115.                  return State.ATTACK;
  116.                  
  117.                  if (getLocalPlayer().myPlayer().isInCombat()) {
  118.                      NPC cow = getNpcs().getClosest(Cow);
  119.  
  120.                     //checks if cow isnt null and cow is on screen
  121.  
  122.                      if(cow!=null && cow.isOnScreen())
  123.  
  124.                      {
  125.  
  126.                     cow.interact("Attack");
  127.  
  128.       }
  129.                      
  130.              }
  131.              else{
  132.                  return State.PICK_UP;
  133.              }
  134.              else{
  135.                  return State.WALK_TO_COWS;
  136.              }
  137.          }
  138.          
  139.      }
  140.  
  141.  
  142.      public void onPaint(Graphics g){
  143.             g.setColor(new Color(247, 148, 230));
  144.             g.drawString("DreamBot is awesome!", 100, 100);
  145.             g.drawString("IsInCombat: " + getLocalPlayer().isInCombat(), 100, 120);
  146.         }
  147. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement