Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class zCopperMiner extends AbstractScript{
- private int state;
- private String ore;
- private int rockID = 7474;
- private GameObject rock = getGameObjects().closest(rockID);
- Area bankArea = new Area(2977, 3248, 3092, 3246, 0);
- Tile finalDestination = new Tile(2977, 3248);
- Area bankArea2 = new Area(2977, 3248, 3012, 3355, 0);
- private int count;
- public void onStart() {
- ore = "Copper Ore";
- count = 0;
- state = 0;
- }
- @Override
- public int onLoop() {
- if (state == 0) {
- getWalking().walk(finalDestination);
- mine();
- } else if (state == 1) {
- getWalking().walk(bankArea.getCenter());
- bank();
- } else if (state == 2) {
- getWalking().walk(bankArea2.getCenter());
- bank2();
- } else {
- }
- return 500;
- }
- private void mine() {
- if (!getInventory().isFull()) {
- rock = getGameObjects().closest(rockID);
- if(rock != null) {
- if(rock.interact("Mine")) {
- sleepUntil(() -> getInventory().count(ore) > count, Calculations.random(1000, 10000));
- if (getInventory().count(ore) > count) {
- count++;
- }
- }
- }
- } else {
- state = 1;
- }
- }
- private void bank() {
- if (getBank().isOpen()) {
- getBank().depositAll(ore);
- } else {
- getBank().open();
- sleepUntil(getBank().isOpen());
- state = 2;
- }
- }
- private void bank2() {
- if (getBank().isOpen()) {
- getBank().depositAll(ore);
- } else {
- getBank().open();
- sleepUntil(getBank().isOpen());
- state = 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement