mirror of
https://github.com/2006Scape-Scripts/ParaScript.git
synced 2026-07-02 16:49:02 +00:00
Update Mine.java
This commit is contained in:
@@ -1,27 +1,24 @@
|
|||||||
package ParaScript.strategies;
|
package ParaScript.strategies;
|
||||||
|
|
||||||
import ParaScript.data.Variables;
|
import ParaScript.data.Variables;
|
||||||
|
import ParaScript.data.variables.Rocks;
|
||||||
import org.parabot.environment.api.utils.Time;
|
import org.parabot.environment.api.utils.Time;
|
||||||
import org.parabot.environment.scripts.framework.Strategy;
|
import org.parabot.environment.scripts.framework.Strategy;
|
||||||
import org.rev317.min.api.methods.Inventory;
|
import org.rev317.min.api.methods.*;
|
||||||
import org.rev317.min.api.methods.Items;
|
|
||||||
import org.rev317.min.api.methods.Players;
|
|
||||||
import org.rev317.min.api.methods.SceneObjects;
|
|
||||||
import org.rev317.min.api.wrappers.SceneObject;
|
import org.rev317.min.api.wrappers.SceneObject;
|
||||||
|
|
||||||
public class Mine implements Strategy {
|
public class Mine implements Strategy {
|
||||||
private SceneObject ore;
|
private SceneObject rock;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean activate() {
|
public boolean activate() {
|
||||||
ore = ore(); // set the local Variable
|
rock = rock(); // set the local Variable
|
||||||
if (Variables.running
|
if (Variables.running
|
||||||
&& ore != null
|
&& rock != null
|
||||||
&& (Variables.getStatus().equals("none") || Variables.getStatus().equals("mining"))
|
&& (Variables.getStatus() == "none" || Variables.getStatus() == "mining")
|
||||||
&& Variables.VARROCK_EAST_MINE_ZONE.inTheZone()
|
|
||||||
&& !Players.getMyPlayer().isInCombat()
|
&& !Players.getMyPlayer().isInCombat()
|
||||||
&& Players.getMyPlayer().getAnimation() == -1
|
&& !Inventory.isFull()
|
||||||
&& !Inventory.isFull()) {
|
) {
|
||||||
Variables.setStatus("mining");
|
Variables.setStatus("mining");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -32,25 +29,30 @@ public class Mine implements Strategy {
|
|||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
try {
|
try {
|
||||||
if (Variables.shouldDropItems()) {
|
if (Variables.mining_rock_selected.hash == 0) {
|
||||||
if (Inventory.getCount(441) >= 1) Inventory.getItem(441).interact(Items.Option.DROP);
|
Variables.mining_rock_selected.hash = rock.getHash();
|
||||||
|
Variables.mining_rock_selected.x = rock.getLocalRegionX();
|
||||||
|
Variables.mining_rock_selected.y = rock.getLocalRegionY();
|
||||||
}
|
}
|
||||||
ore.interact(SceneObjects.Option.MINE);
|
Rocks myOre = Variables.mining_rock_selected;
|
||||||
|
// 502, rock_hash, local_x, local_y, 4
|
||||||
|
Menu.sendAction(502, myOre.hash, myOre.x, myOre.y, 4);
|
||||||
|
// Wait 1 seconds for the player to reach the rock
|
||||||
Time.sleep(1000);
|
Time.sleep(1000);
|
||||||
Time.sleep(() -> Players.getMyPlayer().getAnimation() == -1, 3000);
|
// Sleep until player is mining the rock for a maximum of 2 seconds
|
||||||
|
Time.sleep(() -> Players.getMyPlayer().getAnimation() != -1, 2000);
|
||||||
|
// Sleep until not mining for a maximum of 10 seconds
|
||||||
|
Time.sleep(() -> Players.getMyPlayer().getAnimation() == -1, 10000);
|
||||||
} catch (Exception ಠ_ಠ){
|
} catch (Exception ಠ_ಠ){
|
||||||
System.out.println("Mining error: ¯\\_(ツ)_/¯");
|
System.out.println("Mining error: ¯\\_(ツ)_/¯");
|
||||||
}
|
}
|
||||||
Time.sleep(1000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private SceneObject ore(){
|
private SceneObject rock(){
|
||||||
int[] ore_to_mine = Variables.mining_ore_selected.getIDs();
|
int[] rock_to_mine = Variables.mining_rock_selected.getIDs();
|
||||||
for(SceneObject ore : SceneObjects.getNearest(ore_to_mine)){
|
for(SceneObject rock : SceneObjects.getNearest(rock_to_mine)){
|
||||||
if(Variables.VARROCK_EAST_MINE_ZONE.inTheZoneObject(ore)) {
|
return rock;
|
||||||
return ore;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user