Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.dreambot.api.methods.Calculations;
- import org.dreambot.api.methods.map.Area;
- import org.dreambot.api.methods.skills.Skill;
- import org.dreambot.api.script.AbstractScript;
- import org.dreambot.api.script.Category;
- import org.dreambot.api.script.ScriptManifest;
- import org.dreambot.api.wrappers.interactive.NPC;
- import java.util.Random;
- @ScriptManifest(name = "HARAM Combat 50", description = "Trains combat skills to 50. Start on new acc in Lumbridge with Bronze Sword & Wooden Shield.", author = "HARAM", version = 1.1, category = Category.COMBAT)
- public class main extends AbstractScript {
- private Area chickArea = new Area(3183, 3290, 3171, 3301);
- private Area goblinArea = new Area(1243, 1234, 1234, 1234);
- private Area cowArea = new Area(1243, 1234, 1234, 1234);
- private Area swampArea = new Area(1243, 1234, 1234, 1234);
- private Random rand = new Random();
- //public boolean chickCombat = ((getSkills().getRealLevel(Skill.ATTACK) < 16) || (getSkills().getRealLevel(Skill.STRENGTH) < 16) || (getSkills().getRealLevel(Skill.DEFENCE) < 16));
- public enum State {
- // Default
- WAIT,
- // Chickens levels 1 - 15
- WALK_CHICKS,
- ATT_CHICKS,
- // Goblins levels 15 - 25
- WALK_GOBLINS,
- ATT_GOBLINS,
- // Cows levels 25 - 35
- WALK_COWS,
- ATT_COWS,
- // Swamp levels 35 - 50
- WALK_SWAMP,
- ATT_SWAMP,
- }
- private State getState() {
- if ( ((getSkills().getRealLevel(Skill.ATTACK) < 15) || (getSkills().getRealLevel(Skill.STRENGTH) < 15) || (getSkills().getRealLevel(Skill.DEFENCE) < 15)) && !chickArea.contains(getLocalPlayer())) {
- return State.WALK_CHICKS;
- } else if ((((getSkills().getRealLevel(Skill.ATTACK) < 15) || (getSkills().getRealLevel(Skill.STRENGTH) < 15) || (getSkills().getRealLevel(Skill.DEFENCE) < 15) && chickArea.contains(getLocalPlayer())) && !getLocalPlayer().isInCombat())) {
- return State.ATT_CHICKS;
- } else {
- return State.WAIT;
- }
- }
- public int onLoop() {
- switch (getState()) {
- case WAIT:
- if (getLocalPlayer().isInCombat()) {
- sleepWhile(() -> getLocalPlayer().isInCombat(), 1020 + rand.nextInt(2000));
- }
- case WALK_CHICKS:
- if (!chickArea.contains(getLocalPlayer())) {
- getWalking().walk(chickArea.getRandomTile());
- }
- case ATT_CHICKS:
- NPC target = getNpcs().closest(npc -> npc != null && npc.getName().equals("Chicken") && chickArea.contains(npc) && !npc.isHealthBarVisible());
- if (getMap().canReach(target)) {
- target.interact("Attack");
- }
- break;
- }
- return Calculations.random(362, 625);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement