Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.matslo.bots.skilling;
- import com.matslo.bots.api.Local;
- import com.runemate.game.api.hybrid.entities.GameObject;
- import com.runemate.game.api.hybrid.entities.PredefinedEntity;
- import com.runemate.game.api.hybrid.input.Keyboard;
- import com.runemate.game.api.hybrid.input.Mouse;
- import com.runemate.game.api.hybrid.local.Skill;
- import com.runemate.game.api.hybrid.local.hud.InteractableRectangle;
- import com.runemate.game.api.hybrid.local.hud.interfaces.Inventory;
- import com.runemate.game.api.hybrid.local.hud.interfaces.SpriteItem;
- import com.runemate.game.api.hybrid.location.Coordinate;
- import com.runemate.game.api.script.Execution;
- import com.runemate.game.api.script.framework.LoopingBot;
- import com.runemate.game.api.script.framework.listeners.SkillListener;
- import com.runemate.game.api.script.framework.listeners.events.SkillEvent;
- import java.awt.event.KeyEvent;
- public class AlKharid extends LoopingBot implements SkillListener {
- //private final static Coordinate[] guildCoords = {new Coordinate(3028, 9720, 0), new Coordinate(3029, 9721, 0), new Coordinate(3030, 9720, 0)};
- //private final static Coordinate[] ardyCoords = {new Coordinate( 2691, 3329, 0 ), new Coordinate( 2692, 3328, 0 ), new Coordinate( 2693, 3329, 0 )};
- private final static Coordinate[] varrockIronCoords = new Coordinate[]{new Coordinate(3285, 3369, 0), new Coordinate(3285, 3368, 0), new Coordinate(3286, 3369, 0), new Coordinate(3288, 3370, 0)};
- private final static Coordinate[] varrockCopperCoords = new Coordinate[]{new Coordinate(3289, 3363, 0), new Coordinate(3290, 3362, 0)};
- private final static Coordinate[] alKharid = {new Coordinate(3295, 3311, 0), new Coordinate(3294, 3310, 0), new Coordinate(3295, 3309, 0)};
- private final static Coordinate rockcoord1 = new Coordinate(3295, 3311, 0);
- private final static Coordinate rockcoord2 = new Coordinate(3294, 3310, 0);
- private final static Coordinate rockcoord3 = new Coordinate(3295, 3309, 0);
- private final static PredefinedEntity rock1 = PredefinedEntity.gameobject(rockcoord1, "Rocks");
- private final static PredefinedEntity rock2 = PredefinedEntity.gameobject(rockcoord2, "Rocks");
- private final static PredefinedEntity rock3 = PredefinedEntity.gameobject(rockcoord3, "Rocks");
- private int i = 0;
- private SpriteItem first, second;
- private boolean flag = true;
- private Local local = new Local();
- private int xp = 0;
- private final static InteractableRectangle slot0 = Inventory.getBoundsOf(0);
- private final static InteractableRectangle slot1 = Inventory.getBoundsOf(1);
- private boolean isOreInSlot0 = true;
- private boolean isOreInSlot1 = true;
- private final static int oreXP = 35;
- // private int[] copperRockID = new int[]{11161};
- // private int[] ironRockID = new int[]{11364, 11365, 11391};
- @Override
- public void onStart(String... arguments) {
- setLoopDelay(200, 400);
- Mouse.setPathGenerator(Mouse.MLP_PATH_GENERATOR);
- getEventDispatcher().addListener(this);
- }
- @Override
- public void onExperienceGained(SkillEvent event) {
- if (event.getSkill() == Skill.MINING) {
- xp += event.getChange();
- getLogger().info(xp);
- isOreInSlot0 = event.getChange()>=oreXP;
- isOreInSlot1 = event.getChange()>=2*oreXP;
- }
- }
- @Override
- public void onLoop() {
- Keyboard.pressKey(KeyEvent.VK_SHIFT);
- switch (i) {
- case (0): {
- //GameObject rock1 = GameObjects.newQuery().names("Rocks").on(rockcoord1).ids(ironRockID).results().first();
- if (rock1.isValid())
- dropAndMine(rock1, Skill.MINING.getExperience());
- else
- System.out.println("Rock1 is null");
- break;
- }
- case 1: {
- //GameObject rock2 = GameObjects.newQuery().names("Rocks").on(rockcoord2).ids(ironRockID).results().first();
- if (rock2.isValid())
- dropAndMine(rock2, Skill.MINING.getExperience());
- else
- System.out.println("Rock2 is null");
- break;
- }
- case 2: {
- //GameObject rock3 = GameObjects.newQuery().names("Rocks").on(rockcoord3).ids(ironRockID).results().first();
- if (rock3.isValid())
- dropAndMine(rock3, Skill.MINING.getExperience());
- else
- System.out.println("Rock3 is null");
- break;
- }
- }
- i++;
- i %= 3;
- }
- private void dropAndMine(PredefinedEntity rock, int miningExp){
- if (isOreInSlot0 && slot0.hover() && slot0.click())isOreInSlot0 = false;
- if (isOreInSlot1 && slot1.hover() && slot1.click())isOreInSlot1 = false;
- if(rock.interact("Mine"))
- {
- slot0.hover();
- Execution.delayUntil(() -> miningExp != Skill.MINING.getExperience() || !rock.isValid(),
- () -> local.getAnimationId() != -1, 1200, 1800);
- }
- }
- private void dropAndMine2(PredefinedEntity rock, int miningExp) {
- first = Inventory.getItemIn(0);
- if (first != null && first.hover()) first.click();
- if (!flag && second != null && second.hover() && second.click()) flag = true;
- if (rock.interact("Mine")) {
- if (first != null) first.hover();
- Execution.delayUntil(() -> {
- if (flag) {
- second = Inventory.getItemIn(1);
- if (second != null) flag = false;
- }
- return miningExp != Skill.MINING.getExperience() || !rock.isValid();
- }, () -> local.getAnimationId() != -1, 1200, 1800);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement