Guest User

Untitled

a guest
Aug 15th, 2016
70
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package scripts.usa.api.wilderness;
  2.  
  3. import org.tribot.api.General;
  4. import org.tribot.api.Timing;
  5. import org.tribot.api.types.generic.Condition;
  6. import org.tribot.api2007.Interfaces;
  7. import org.tribot.api2007.PathFinding;
  8. import org.tribot.api2007.Player;
  9. import org.tribot.api2007.types.RSInterfaceChild;
  10. import org.tribot.api2007.types.RSTile;
  11.  
  12. public class Wilderness {
  13.  
  14. private final static int ENTER_WILDERNESS_MASTER = 382;
  15. private final static int ENTER_WILDERNESS_CHILD = 18;
  16.  
  17. private final static int WILDERNESS_LEVEL_MASTER = 90;
  18. private final static int WILDERNESS_LEVEL_CHILD = 29;
  19.  
  20. public static boolean isWarningUp() {
  21. return Interfaces.isInterfaceValid(ENTER_WILDERNESS_MASTER);
  22. }
  23.  
  24. public static boolean enter() {
  25. if (!isWarningUp())
  26. return false;
  27.  
  28. RSInterfaceChild child = Interfaces.get(ENTER_WILDERNESS_MASTER, ENTER_WILDERNESS_CHILD);
  29. if (child == null)
  30. return false;
  31.  
  32. final RSTile tile = Player.getPosition();
  33.  
  34. if (child.click()) {
  35. long timer = System.currentTimeMillis() + 3000;
  36. while (timer > System.currentTimeMillis()) {
  37. if (Player.isMoving() || Player.getAnimation() != -1)
  38. timer = System.currentTimeMillis() + 3000;
  39. if (!PathFinding.canReach(tile, false))
  40. return true;
  41. General.sleep(General.random(0, 100));
  42. }
  43. }
  44. return false;
  45. }
  46.  
  47. public static boolean isIn() {
  48. return Interfaces.isInterfaceValid(WILDERNESS_LEVEL_MASTER);
  49. }
  50.  
  51. public static int getLevel() {
  52. if (!isIn())
  53. return 0;
  54.  
  55. RSInterfaceChild child = Interfaces.get(WILDERNESS_LEVEL_MASTER, WILDERNESS_LEVEL_CHILD);
  56. if (child == null)
  57. return 0;
  58.  
  59. String text = child.getText();
  60. if (text == null || text.length() == 0 || text.equals("Deadman") || text.equals("No PvP"))
  61. return 0;
  62.  
  63. return Integer.parseInt(text.replace("Level: ", ""));
  64. }
  65. }
RAW Paste Data