Advertisement
Guest User

Methods

a guest
Oct 3rd, 2015
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.29 KB | None | 0 0
  1. package scripts.Cannon;
  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.Inventory;
  7. import org.tribot.api2007.NPCChat;
  8. import org.tribot.api2007.Objects;
  9. import org.tribot.api2007.Player;
  10. import org.tribot.api2007.Skills;
  11. import org.tribot.api2007.Skills.SKILLS;
  12. import org.tribot.api2007.Walking;
  13. import org.tribot.api2007.WebWalking;
  14. import org.tribot.api2007.types.RSItem;
  15. import org.tribot.api2007.types.RSObject;
  16.  
  17. public class Methods {
  18. public static boolean HaveCannonParts(){
  19. if(Inventory.find(6).length > 0 && Inventory.find(12).length > 0 && Inventory.find(8).length > 0 && Inventory.find(10).length > 0){
  20. return true;
  21. }else{
  22. return false;
  23. }
  24. }
  25.  
  26. public static boolean randomPercent(int min, int max){
  27. return General.random(1, 100) <= General.random(min, max);
  28. }
  29.  
  30. public static void Eat(){
  31. RSItem[] food = Inventory.find(Variables.FoodIDs);
  32. if(food.length > 0){
  33. food[0].click();
  34. General.sleep(200,500);
  35. }else{
  36. General.println("No food found! Ending script...");
  37. Methods.PickUpCannon();
  38. Variables.RunScript = false;
  39. }
  40. }
  41.  
  42. public static void GetNextEat(int eat){
  43. Variables.NextEat = General.random(Skills.getActualLevel(SKILLS.HITPOINTS)/10, Skills.getActualLevel(SKILLS.HITPOINTS)/2);
  44. General.println("Next eat: " + Variables.NextEat);
  45. }
  46.  
  47. public static boolean CannonOut(){
  48. RSObject[] Cannon = Objects.find(3,6);
  49. if(Cannon.length == 1 && !HaveCannonParts()){
  50. General.println("Found cannon");
  51. return true;
  52. }else{
  53. return false;
  54. }
  55. }
  56.  
  57. public static RSObject[] OurCannon(){
  58. return Objects.find(3,6);
  59. }
  60.  
  61. public static boolean PickUpCannon(){
  62. if(OurCannon().length > 0){
  63. return OurCannon()[0].click("Pick-up");
  64. }
  65. return false;
  66. }
  67.  
  68. public static void LoadCannon(){
  69. if(OurCannon().length > 0){
  70. OurCannon()[0].click("Fire");
  71. General.sleep(1000,2000);
  72. }
  73. }
  74.  
  75. public static void Wait(){
  76. if(System.currentTimeMillis() >= Variables.abc.TIME_TRACKER.ROTATE_CAMERA.next()){
  77. Variables.abc.performRotateCamera();
  78. Variables.abc.TIME_TRACKER.ROTATE_CAMERA.reset();
  79. }
  80. Variables.abc.performTimedActions(SKILLS.RANGED);
  81. General.sleep(200,500);
  82. if(NPCChat.getMessage() != null){
  83. NPCChat.clickContinue(true);
  84. General.sleep(200,500);
  85. }
  86. }
  87.  
  88. public static void GetNextLoad(int load){
  89. Variables.NextLoad = General.random(0, 27);
  90. General.println("Next reload: " + Variables.NextLoad);
  91. }
  92.  
  93. public static void PutDownCannon(){
  94. if(HaveCannonParts()){
  95. if(Player.getPosition() != Variables.CannonSpot){
  96. if(Variables.CannonSpot.isOnScreen()){
  97. Walking.clickTileMS(Variables.CannonSpot, "Walk here");
  98. }else{
  99. WebWalking.walkTo(Variables.CannonSpot);
  100. }
  101. General.sleep(500,2000);
  102. }
  103. RSItem[] base = Inventory.find(6);
  104. if(base.length > 0){
  105. base[0].click();
  106. Timing.waitCondition(new Condition()
  107. {
  108. @Override
  109. public boolean active()
  110. {
  111. General.sleep(500);
  112. return Objects.find(6,3).length > 0;
  113. }
  114. }, General.random(10000, 15000));
  115. if(OurCannon().length > 0){
  116. OurCannon()[0].click("Fire");
  117. }
  118. }
  119. }
  120. }
  121. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement