So basically ALL it does, kills a few cows, doesn`t pick up any cowhides and runs to bank, and back.
States:
private enum State {
KILL, LOOT, WALK_TO_BANK, BANK, WALK_TO_KILL, WAIT
};
private State getState() {
NPC cow = npcs.closest("Cow", "Cow calf");
if (!myPlayer().isUnderAttack() && cow !=null && !myPlayer().isAnimating() && !cow.isUnderAttack())
return State.KILL;
GroundItem cowhide = groundItems.closest("Cowhide");
if (!myPlayer().isUnderAttack() && cowhide !=null)
return State.LOOT;
if (inventory.isFull() && KILL_AREA.contains(myPlayer()))
return State.WALK_TO_BANK;
if (!inventory.isFull() && BANK_AREA.contains(myPlayer()))
return State.WALK_TO_KILL;
if (inventory.isFull() && BANK_AREA.contains(myPlayer()))
return State.BANK;
return State.WAIT;
}
onLoop:
@Override
public int onLoop() throws InterruptedException {
if(myPlayer().getInteracting() != null) {
return random(453, 999);
}
switch (getState()){
case KILL:
Player player = myPlayer();
NPC cow = npcs.closest("Cow","Cow calf");
if (!player.isUnderAttack() && (cow != null) && (cow.isAttackable()) && (!player.isMoving())) {
cow.interact("Attack");
return random(323, 532);
} else {
camera.toEntity(cow);
}
break;
case LOOT:
GroundItem cowhide = groundItems.closest("Cowhide");
if(!inventory.isFull() && !myPlayer().isUnderAttack() && groundItems.equals(cowhide) && cowhide.isOnScreen()) {
cowhide.interact("Take");
return random(212, 326);
} else {
camera.toEntity(cowhide);
}
case WALK_TO_BANK:
traversePath(path, false);
sleep(random(1230,2452));
break;
case WALK_TO_KILL:
traversePath(path, true);
sleep(random(1343,2212));
break;
case WAIT:
return random(121,212);
case BANK:
RS2Object bankBooth = objects.closest("Bank booth");
if (bankBooth != null && bankBooth.isVisible()) {
if (bankBooth.interact("Bank")) {
while (!bank.isOpen())
sleep(random(465, 863));
bank.depositAll();
}
}
break;
}
return random(243, 411);
}
Doesnt work so no need for full source.
Can anybody give any tips?