Advertisement
Tezlaz

TrainTo13

Aug 6th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. package scripts.tasks;
  2.  
  3. import org.tribot.api.General;
  4. import org.tribot.api.input.Mouse;
  5. import org.tribot.api2007.GameTab;
  6. import org.tribot.api2007.GameTab.TABS;
  7.  
  8. import org.tribot.api2007.Inventory;
  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.  
  14. import scripts.data.Vars;
  15. import scripts.tools.Fighting;
  16. import scripts.tools.Interaction;
  17. import scripts.tools.Timer;
  18. import scripts.tools.Walk;
  19.  
  20. public class TrainTo13 {
  21.  
  22. /*
  23. * the style int is a value for what attack style the bot should be using. 0
  24. * = ATTACK 1 = STRENGTH 2 = DEFENCE 3 = DONE WITH TRAINING
  25. */
  26. private static int style;
  27. private static int currentStyle = 4;
  28. private static boolean doneTraining = false;
  29.  
  30. private static int UpdateAttackStyle() {
  31. if (Skills.getActualLevel(SKILLS.DEFENCE) >= 10 && Skills.getActualLevel(SKILLS.HITPOINTS) >=15) {
  32. style = 3;
  33. return 3;
  34. }
  35. if (Skills.getActualLevel(SKILLS.STRENGTH) >= 11) {
  36. style = 2;
  37. return 2;
  38. }
  39. if (Skills.getActualLevel(SKILLS.ATTACK) >= 10) {
  40. style = 1;
  41. return 1;
  42. } else {
  43. style = 0;
  44. return 0;
  45. }
  46. }
  47.  
  48. private static void SwitchStyle() {
  49. UpdateAttackStyle();
  50. GameTab.open(TABS.COMBAT);
  51.  
  52. if (style == 0 && currentStyle != style) {
  53. Mouse.click(General.random(594, 615), General.random(266, 282), 1);
  54. currentStyle = style;
  55. General.sleep(300, 600);
  56. }
  57. if (style == 1 && currentStyle != style) {
  58. Mouse.click(General.random(671, 701), General.random(266, 282), 1);
  59. currentStyle = style;
  60. General.sleep(300, 600);
  61. }
  62. if (style == 2 && currentStyle != style) {
  63. Mouse.click(General.random(671, 701), General.random(316, 332), 1);
  64. currentStyle = style;
  65. General.sleep(300, 600);
  66. }
  67. }
  68.  
  69. private static void GrabGear() {
  70. // 1277 is bronze sword ID
  71. // 9703 is training sword ID
  72.  
  73. if (Vars.combatLevel < 13) {
  74. if (Inventory.find(1277).length < 1) {
  75. if (Inventory.find(9703).length < 1) {
  76. System.out.println(Vars.accountName + " needs a weapon. Walking to tutors...");
  77. Walk.CombatTutors(120000);
  78. long t = Timer.Tic();
  79. while (Inventory.find(9703).length < 1 || Timer.Toc(t) < 30000) {
  80. Interaction.TalkToNPC(3216, 20, 10000, null);
  81. }
  82. }
  83. }
  84. if (Inventory.find(1277).length >= 1) {
  85. Inventory.find(1277)[0].click("Wield");
  86. }
  87. if (Inventory.find(9703).length >= 1) {
  88. Inventory.find(9703)[0].click("Wield");
  89. }
  90. }
  91. }
  92.  
  93. public static void Train() {
  94. if (Vars.combatLevel < 13) {
  95. System.out.println(Vars.accountName + " is too low level. Time to train at chickens...");
  96. GrabGear();
  97. Walk.LumbridgeChickens(120000);
  98. Interaction.WithObject(Vars.CLOSED_GATE, 5, "Open", 10000);
  99.  
  100. while (style != 3) {
  101. while (!Fighting.IsInCombat()) {
  102. if (!Vars.LUMBRIDGE_CHICKENS_AREA.contains(Player.getPosition())) {
  103. Walking.blindWalkTo(Vars.CHICKEN_PEN_TILE);
  104. }
  105. General.sleep(400, 560);
  106. SwitchStyle();
  107. System.out.println("ATTACK STYLE: " + style);
  108. Fighting.AttackMonster(Vars.CHICKENS);
  109. }
  110. }
  111. System.out.println(Vars.accountName + " is done training. Walking to Varrock...");
  112. Walk.VarrockBank(240000);
  113. }
  114. }
  115.  
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement