import com.ms.arga.sal.*;
import com.ms.arga.hooks.*;
import com.ms.arga.common.*;
/**
* Theres no need for a fish dropper because in draynor, its quicker to bank than drop
*/
public class FlyFisher extends SALScript {
public String getName() {
return "FlyFisher";
}
private boolean banking = false;
Tile[] toBank = {
new Tile(3102, 3437),
new Tile(3095, 3442),
new Tile(3091, 3449),
new Tile(3088, 3457),
new Tile(3084, 3464),
new Tile(3080, 3471),
new Tile(3080, 3479),
new Tile(3086, 3486),
new Tile(3093, 3491),
};
Tile[] toSpot = reversePath(toBank);
Tile bank = new Tile(3093, 3491);
Tile spot = new Tile(3102, 3437);
private final int ITEM_FISHING_ROD = 2309;
private final int ITEM_FEATHER = 2314;
enum Walking {
NONE, WALK_BANK, WALK_FISH,
};
Walking w = Walking.WALK_FISH;
public int cycle() {
if (!loggedIn())
login("barnicleboy0", "barnicles");
if (getMyPlayer() != null && getMyPlayer().isMoving() > 0) {
return 3000;
}
Tile pos = getPosition(getMyPlayer());
if (distanceTo(bank) < 10) {
log("Close to bank, walking back to fish.");
w = Walking.WALK_FISH;
} else if (distanceTo(spot) < 10) {
log("Close to fishing spot, walking back to bank.");
w = Walking.WALK_BANK;
}
switch (w) {
case NONE:
w = Walking.WALK_FISH;
log("Walking unset... we are idle.");
break;
case WALK_FISH:
log("Walking to fishing spot.");
walkPathMM(toSpot, 15);
w = Walking.WALK_BANK;
break;
case WALK_BANK:
log("Walking to bank.");
walkPathMM(toBank, 15);
break;
}
return random(1000, 2000);
}
public boolean walkChecking() {
if (banking) {
log("Walking to bank");
return false;
}
if (w == Walking.WALK_BANK) {
log("Walking to bank...");
walkPathMM(toBank, 15);
return false;
}
return true; // we are there
}
private boolean fish() {
if (banking)
return false;
// grab how many items are in our inventory
if (getInventoryCount() == 28) {
banking = true;
return false;
} else {
if (!isFishing()) {
NPC toFish = getFishingNPC();
if (toFish != null)
atNPC(getFishingNPC(), "Lure");
return isFishing();
}
}
return false;
}
/**
* Returns an npc to fish. If we have made a few too many misclicks. It will walk somewhere
* and enable a recalulation of the npc spot.
* @return NPC to fish
*/
private NPC getFishingNPC() {
return getNearestNPCByName("Fishing spot");
}
private boolean doBanking() {
// opens bank and returns if successfully opened
if (openBank()) {
//get our inventory array at the bank
int[] inv = getInventoryArray();
for (int x = 0; x < inv.length; x++) {
if (getInventoryCount() == 1) {
banking = false;
w = Walking.WALK_FISH;
return true;
}
if (inv[x] != ITEM_FISHING_ROD && inv[x] != ITEM_FEATHER && inv[x] != -1) {
atInventoryItem(x, "Store All");
}
}
}
return !banking;
}
}