Advertisement
Guest User

Untitled

a guest
Jan 21st, 2018
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.89 KB | None | 0 0
  1. import org.dreambot.api.methods.Calculations;
  2. import org.dreambot.api.methods.map.Area;
  3. import org.dreambot.api.methods.skills.Skill;
  4. import org.dreambot.api.script.AbstractScript;
  5. import org.dreambot.api.script.Category;
  6. import org.dreambot.api.script.ScriptManifest;
  7. import org.dreambot.api.wrappers.interactive.NPC;
  8.  
  9. import java.util.Random;
  10.  
  11.  
  12.  
  13. @ScriptManifest(name = "HARAM Combat 50", description = "Trains combat skills to 50. Start on new acc in Lumbridge with Bronze Sword & Wooden Shield.", author = "HARAM", version = 1.1, category = Category.COMBAT)
  14. public class main extends AbstractScript {
  15.  
  16. private Area chickArea = new Area(3183, 3290, 3171, 3301);
  17. private Area goblinArea = new Area(1243, 1234, 1234, 1234);
  18. private Area cowArea = new Area(1243, 1234, 1234, 1234);
  19. private Area swampArea = new Area(1243, 1234, 1234, 1234);
  20.  
  21. private Random rand = new Random();
  22.  
  23.  
  24. //public boolean chickCombat = ((getSkills().getRealLevel(Skill.ATTACK) < 16) || (getSkills().getRealLevel(Skill.STRENGTH) < 16) || (getSkills().getRealLevel(Skill.DEFENCE) < 16));
  25. public enum State {
  26.  
  27. // Default
  28. WAIT,
  29.  
  30. // Chickens levels 1 - 15
  31. WALK_CHICKS,
  32. ATT_CHICKS,
  33.  
  34. // Goblins levels 15 - 25
  35. WALK_GOBLINS,
  36. ATT_GOBLINS,
  37.  
  38. // Cows levels 25 - 35
  39. WALK_COWS,
  40. ATT_COWS,
  41.  
  42. // Swamp levels 35 - 50
  43. WALK_SWAMP,
  44. ATT_SWAMP,
  45. }
  46.  
  47. private State getState() {
  48. if ( ((getSkills().getRealLevel(Skill.ATTACK) < 15) || (getSkills().getRealLevel(Skill.STRENGTH) < 15) || (getSkills().getRealLevel(Skill.DEFENCE) < 15)) && !chickArea.contains(getLocalPlayer())) {
  49. return State.WALK_CHICKS;
  50. } else if ((((getSkills().getRealLevel(Skill.ATTACK) < 15) || (getSkills().getRealLevel(Skill.STRENGTH) < 15) || (getSkills().getRealLevel(Skill.DEFENCE) < 15) && chickArea.contains(getLocalPlayer())) && !getLocalPlayer().isInCombat())) {
  51. return State.ATT_CHICKS;
  52. } else {
  53. return State.WAIT;
  54. }
  55. }
  56. public int onLoop() {
  57. switch (getState()) {
  58. case WAIT:
  59. if (getLocalPlayer().isInCombat()) {
  60. sleepWhile(() -> getLocalPlayer().isInCombat(), 1020 + rand.nextInt(2000));
  61. }
  62.  
  63. case WALK_CHICKS:
  64. if (!chickArea.contains(getLocalPlayer())) {
  65. getWalking().walk(chickArea.getRandomTile());
  66. }
  67.  
  68. case ATT_CHICKS:
  69. NPC target = getNpcs().closest(npc -> npc != null && npc.getName().equals("Chicken") && chickArea.contains(npc) && !npc.isHealthBarVisible());
  70. if (getMap().canReach(target)) {
  71. target.interact("Attack");
  72. }
  73. break;
  74.  
  75. }
  76. return Calculations.random(362, 625);
  77. }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement