Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package scripts.tasks;
- import org.tribot.api.General;
- import org.tribot.api.input.Mouse;
- import org.tribot.api2007.GameTab;
- import org.tribot.api2007.GameTab.TABS;
- import org.tribot.api2007.Inventory;
- import org.tribot.api2007.Player;
- import org.tribot.api2007.Skills;
- import org.tribot.api2007.Skills.SKILLS;
- import org.tribot.api2007.Walking;
- import scripts.data.Vars;
- import scripts.tools.Fighting;
- import scripts.tools.Interaction;
- import scripts.tools.Timer;
- import scripts.tools.Walk;
- public class TrainTo13 {
- /*
- * the style int is a value for what attack style the bot should be using. 0
- * = ATTACK 1 = STRENGTH 2 = DEFENCE 3 = DONE WITH TRAINING
- */
- private static int style;
- private static int currentStyle = 4;
- private static boolean doneTraining = false;
- private static int UpdateAttackStyle() {
- if (Skills.getActualLevel(SKILLS.DEFENCE) >= 10 && Skills.getActualLevel(SKILLS.HITPOINTS) >=15) {
- style = 3;
- return 3;
- }
- if (Skills.getActualLevel(SKILLS.STRENGTH) >= 11) {
- style = 2;
- return 2;
- }
- if (Skills.getActualLevel(SKILLS.ATTACK) >= 10) {
- style = 1;
- return 1;
- } else {
- style = 0;
- return 0;
- }
- }
- private static void SwitchStyle() {
- UpdateAttackStyle();
- GameTab.open(TABS.COMBAT);
- if (style == 0 && currentStyle != style) {
- Mouse.click(General.random(594, 615), General.random(266, 282), 1);
- currentStyle = style;
- General.sleep(300, 600);
- }
- if (style == 1 && currentStyle != style) {
- Mouse.click(General.random(671, 701), General.random(266, 282), 1);
- currentStyle = style;
- General.sleep(300, 600);
- }
- if (style == 2 && currentStyle != style) {
- Mouse.click(General.random(671, 701), General.random(316, 332), 1);
- currentStyle = style;
- General.sleep(300, 600);
- }
- }
- private static void GrabGear() {
- // 1277 is bronze sword ID
- // 9703 is training sword ID
- if (Vars.combatLevel < 13) {
- if (Inventory.find(1277).length < 1) {
- if (Inventory.find(9703).length < 1) {
- System.out.println(Vars.accountName + " needs a weapon. Walking to tutors...");
- Walk.CombatTutors(120000);
- long t = Timer.Tic();
- while (Inventory.find(9703).length < 1 || Timer.Toc(t) < 30000) {
- Interaction.TalkToNPC(3216, 20, 10000, null);
- }
- }
- }
- if (Inventory.find(1277).length >= 1) {
- Inventory.find(1277)[0].click("Wield");
- }
- if (Inventory.find(9703).length >= 1) {
- Inventory.find(9703)[0].click("Wield");
- }
- }
- }
- public static void Train() {
- if (Vars.combatLevel < 13) {
- System.out.println(Vars.accountName + " is too low level. Time to train at chickens...");
- GrabGear();
- Walk.LumbridgeChickens(120000);
- Interaction.WithObject(Vars.CLOSED_GATE, 5, "Open", 10000);
- while (style != 3) {
- while (!Fighting.IsInCombat()) {
- if (!Vars.LUMBRIDGE_CHICKENS_AREA.contains(Player.getPosition())) {
- Walking.blindWalkTo(Vars.CHICKEN_PEN_TILE);
- }
- General.sleep(400, 560);
- SwitchStyle();
- System.out.println("ATTACK STYLE: " + style);
- Fighting.AttackMonster(Vars.CHICKENS);
- }
- }
- System.out.println(Vars.accountName + " is done training. Walking to Varrock...");
- Walk.VarrockBank(240000);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement