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;
|
||||
|
||||
import ParaScript.data.Variables;
|
||||
import ParaScript.data.variables.Rocks;
|
||||
import org.parabot.environment.api.utils.Time;
|
||||
import org.parabot.environment.scripts.framework.Strategy;
|
||||
import org.rev317.min.api.methods.Inventory;
|
||||
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.methods.*;
|
||||
import org.rev317.min.api.wrappers.SceneObject;
|
||||
|
||||
public class Mine implements Strategy {
|
||||
private SceneObject ore;
|
||||
private SceneObject rock;
|
||||
|
||||
@Override
|
||||
public boolean activate() {
|
||||
ore = ore(); // set the local Variable
|
||||
rock = rock(); // set the local Variable
|
||||
if (Variables.running
|
||||
&& ore != null
|
||||
&& (Variables.getStatus().equals("none") || Variables.getStatus().equals("mining"))
|
||||
&& Variables.VARROCK_EAST_MINE_ZONE.inTheZone()
|
||||
&& rock != null
|
||||
&& (Variables.getStatus() == "none" || Variables.getStatus() == "mining")
|
||||
&& !Players.getMyPlayer().isInCombat()
|
||||
&& Players.getMyPlayer().getAnimation() == -1
|
||||
&& !Inventory.isFull()) {
|
||||
&& !Inventory.isFull()
|
||||
) {
|
||||
Variables.setStatus("mining");
|
||||
return true;
|
||||
}
|
||||
@@ -32,24 +29,29 @@ public class Mine implements Strategy {
|
||||
@Override
|
||||
public void execute() {
|
||||
try {
|
||||
if (Variables.shouldDropItems()) {
|
||||
if (Inventory.getCount(441) >= 1) Inventory.getItem(441).interact(Items.Option.DROP);
|
||||
if (Variables.mining_rock_selected.hash == 0) {
|
||||
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(() -> 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 ಠ_ಠ){
|
||||
System.out.println("Mining error: ¯\\_(ツ)_/¯");
|
||||
}
|
||||
Time.sleep(1000);
|
||||
}
|
||||
|
||||
private SceneObject ore(){
|
||||
int[] ore_to_mine = Variables.mining_ore_selected.getIDs();
|
||||
for(SceneObject ore : SceneObjects.getNearest(ore_to_mine)){
|
||||
if(Variables.VARROCK_EAST_MINE_ZONE.inTheZoneObject(ore)) {
|
||||
return ore;
|
||||
}
|
||||
private SceneObject rock(){
|
||||
int[] rock_to_mine = Variables.mining_rock_selected.getIDs();
|
||||
for(SceneObject rock : SceneObjects.getNearest(rock_to_mine)){
|
||||
return rock;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user