Advertisement
Guest User

Untitled

a guest
Feb 17th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.16 KB | None | 0 0
  1. import java.awt.Graphics;
  2. import java.awt.Graphics2D;
  3. import org.dreambot.api.methods.Calculations;
  4. import org.dreambot.api.methods.filter.Filter;
  5. import org.dreambot.api.methods.map.Area;
  6. import org.dreambot.api.methods.map.Tile;
  7. import org.dreambot.api.methods.skills.Skill;
  8. import org.dreambot.api.methods.walking.pathfinding.impl.obstacle.impl.PassableObstacle;
  9. import org.dreambot.api.script.AbstractScript;
  10. import org.dreambot.api.script.Category;
  11. import org.dreambot.api.script.ScriptManifest;
  12. import org.dreambot.api.utilities.Timer;
  13. import org.dreambot.api.wrappers.interactive.NPC;
  14. import org.dreambot.api.wrappers.items.Item;
  15.  
  16.  
  17. @ScriptManifest(author = "Messiah", category = Category.COMBAT, name = "ACBT", version = 1.0)
  18.  
  19. public class ACBT extends AbstractScript {
  20. // Mage Area
  21. // Area Cows = new Area(new Tile(3198, 3305, 0), new Tile(3201, 3303, 0));
  22.  
  23. // Close combat area
  24. Area War1 = new Area(new Tile(3282, 3176, 0), new Tile(3286, 3168, 0));
  25. Timer t;
  26. Tile WDoor = new Tile(3287, 3172, 0);
  27.  
  28. // Now in the onPaint do this:
  29. public static final String FOOD = "Lobster";
  30. public static final String WAR = "Al-Kharid warrior";
  31. public static final Filter<NPC> WAR_FILTER = npc -> {
  32.  
  33. if (npc == null) {
  34. return false;
  35. }
  36.  
  37. return npc.getName().equals(WAR) && !npc.isHealthBarVisible();
  38. };
  39.  
  40. /*
  41. *
  42. * public static final Filter<NPC> COW_AREA = npc -> {
  43. *
  44. * @Override public boolean match(NPC COW) {
  45. *
  46. * return COW != null && Cows1.contains(Cow) && npc.getName().equals(Cow) &&
  47. * !npc.isHealthBarVisible(); };
  48. *
  49. * }
  50. */
  51. @Override
  52. public void onStart() {
  53. t = new Timer();
  54. log("haxor initiated");
  55. }
  56.  
  57. @Override
  58. public int onLoop() {
  59.  
  60. getDialogues().clickContinue();
  61. // TODO
  62. if (getLocalPlayer().isInCombat()) {
  63.  
  64. // do nothing
  65.  
  66. log("Checking Combat");
  67.  
  68. }
  69.  
  70. if (War1.contains(getLocalPlayer())) {
  71.  
  72. NPC war = getNpcs().closest(WAR_FILTER);
  73.  
  74. if (war != null) {
  75.  
  76. war.interact("Attack");
  77.  
  78. if(getSkills().getBoostedLevels(Skill.HITPOINTS) < 40){
  79.  
  80. Item food = getInventory().get(fz -> fz != null
  81.  
  82. && fz.getName() != null
  83.  
  84. && fz.getName().contains("Lobster"));
  85.  
  86. interact(food, "Eat");
  87.  
  88. sleep(+Calculations.random(500,800));
  89. }
  90. sleep(Calculations.random(25000, 55000));
  91. }
  92.  
  93. log("Attacking Warriors");
  94.  
  95. } else {
  96.  
  97. getWalking().getAStarPathFinder().addObstacle(new PassableObstacle("Large door", "Open", null, null, null));
  98.  
  99. getWalking().walk(War1.getRandomTile());
  100.  
  101. log("Walking to Warriors");
  102. }
  103. return Calculations.random(500, 1000);
  104. }
  105.  
  106.  
  107.  
  108. private void interact(Item food2, String string) {
  109. // TODO Auto-generated method stub
  110.  
  111. }
  112.  
  113. public void onPaint(Graphics g1) {
  114.  
  115. Graphics2D g = (Graphics2D) g1;
  116.  
  117. g.drawString("Time Running: " + t.formatTime(), 330, 260);
  118.  
  119. }
  120.  
  121. /*
  122. * public long expPerHour(long t, int points){ long time = (int) ((t /
  123. * (1000*60*60)) % 24); long answer = exp/time; return answer; }
  124. */
  125. @Override
  126. public void onExit() {
  127.  
  128. }
  129. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement