Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.wrappers.RSObject;
- import org.rsbot.script.wrappers.RSPath;
- import org.rsbot.script.wrappers.RSTile;
- import org.rsbot.script.wrappers.RSArea;
- import org.rsbot.script.wrappers.RSTilePath;
- import org.rsbot.event.listeners.PaintListener;
- @ScriptManifest(authors = { "Creations" }, keywords = { "KEYWORDS" }, name = "CFungy", version = 1.0, description = "Picks Fungus.")
- public class CFungusEnums extends Script implements PaintListener {
- RSTile bankToGate[] = { new RSTile(3509, 3480), new RSTile(3506, 3480),
- new RSTile(3503, 3480), new RSTile(3500, 3481),
- new RSTile(3497, 3481), new RSTile(3494, 3481),
- new RSTile(3491, 3481), new RSTile(3488, 3480),
- new RSTile(3486, 3479), new RSTile(3484, 3478),
- new RSTile(3481, 3477), new RSTile(3478, 3477),
- new RSTile(3475, 3476), new RSTile(3472, 3475),
- new RSTile(3469, 3474), new RSTile(3466, 3473),
- new RSTile(3464, 3472), new RSTile(3462, 3470),
- new RSTile(3459, 3469), new RSTile(3457, 3467),
- new RSTile(3454, 3467), new RSTile(3451, 3466),
- new RSTile(3448, 3465), new RSTile(3446, 3463),
- new RSTile(3444, 3461), new RSTile(3444, 3458),
- new RSTile(3443, 3458) };
- RSTile PathToDoor[] = { new RSTile(3217, 3219), new RSTile(3223, 3219),
- new RSTile(3230, 3219), new RSTile(3232, 3215),
- new RSTile(3236, 3211), new RSTile(3241, 3207),
- new RSTile(3243, 3207) };
- RSTile[] barToBank = { new RSTile(3494, 3475), new RSTile(3494, 3479),
- new RSTile(3497, 3480), new RSTile(3500, 3480),
- new RSTile(3503, 3480), new RSTile(3506, 3480),
- new RSTile(3510, 3480), new RSTile(3512, 3480),
- new RSTile(3512, 3478) };
- RSTile teletoChurch[] = { new RSTile(3217, 3219),
- new RSTile(3223, 3219), new RSTile(3230, 3219),
- new RSTile(3232, 3215), new RSTile(3236, 3211),
- new RSTile(3241, 3207), new RSTile(3243, 3207) };
- RSTile gateToFungus = new RSTile(3436, 3453);
- public int[] gate = {3506, 3507};
- public int fungusLog = 3509;
- public int log = 3508;
- public int fungusID = 2383;
- public boolean THROUGH = false;
- int k;
- int w;
- RSArea atBank = new RSArea(3512, 3483, 3511, 3477);//NE SW
- RSArea atGate = new RSArea(3445, 3459, 3442, 3458);//NE SW
- RSArea atPastGate = new RSArea(3444, 3457, 3442, 3456);//NE SW
- RSArea atFungusLog = new RSArea(3436, 3453, 3436, 3453);//NE SW
- public int nextenergy;
- @Override
- public void onRepaint(Graphics arg0) {
- // TODO Auto-generated method stub
- }
- public enum State {
- walkToGate, openGate, walkToFungus, bloom, pickFungus, waiting
- }
- private State getState() {
- if (!inventory.isFull()) {
- if (atLocation()) {
- if (logPresent()) {
- return State.pickFungus;
- } else {
- return State.bloom;
- }
- } else {
- if (atGate()) {
- return State.openGate;
- }
- return State.walkToFungus;
- }
- } else {
- // do stuff when full?
- }
- return State.waiting;
- }
- private boolean atGate() {
- RSObject g = objects.getNearest(gate);
- if (g != null && THROUGH == false) {
- return calc.distanceTo(g) < 6;
- }
- return false;
- }
- private boolean logPresent() {
- return objects.getNearest(fungusLog) != null;
- }
- private boolean atLocation() {
- return atFungusLog.contains(getMyPlayer().getLocation());
- }
- private boolean walkThePath(RSTile[] path){
- int w = random(4,6);
- int k = random(2,4);
- int b = k;
- int t = w;
- boolean D=false;
- try{
- RSTilePath pathToWalk = walking.newTilePath(path);
- RSTile next = pathToWalk.getNext();
- RSTile start = pathToWalk.getStart();
- if ((walking.getDestination() == null||calc.distanceTo(walking.getDestination()) < t ||calc.distanceBetween(next,walking.getDestination()) > b)) {
- if(!walking.walkTileMM(next)){
- if(walking.walkTileMM(start)){
- sleep(412,565);
- D=true;
- }else{
- walkToTile(walking.getClosestTileOnMap(next));
- sleep(random(1000,2000));
- }
- }else{
- sleep(299,565);
- D=true;
- }
- }
- return D;
- }catch(Exception e ){ log("Caught a Exception in pathToWalk. Saved the script from stopping!"); sleep(554,789); }
- return D;
- }
- private boolean walkToTile(RSTile tile){
- int q = k;
- int i = w;
- boolean D = false;
- try{
- if ((walking.getDestination() == null||(calc.distanceTo(walking.getDestination()) < q &&calc.distanceBetween(tile,walking.getDestination()) > i))) {
- if(calc.tileOnScreen(tile)){
- if(walking.walkTileOnScreen(tile))
- D = true;
- }else if(calc.tileOnMap(tile)){
- if(walking.walkTileMM(tile))
- D = true;
- }else{
- if(walkToTile(walking.getClosestTileOnMap(tile)))
- D = true;
- }
- sleep(random(1000,2000));
- }
- return D;
- }catch(Exception e){ log("Caught an Exception in walkToTile. Saved the script from stopping!"); sleep(554,789); }
- return D;
- }
- public int loop() {
- switch(getState()) {
- case walkToGate:
- walkThePath(bankToGate);
- break;
- case openGate:
- objects.getNearest(gate).doAction("Open");
- THROUGH = true;
- break;
- case walkToFungus:
- walking.walkTileMM(gateToFungus, 0, 0);
- break;
- case bloom:
- game.openTab(5);
- sleep(100);
- interfaces.get(387).getComponent(17).doAction("Bloom");
- sleep(2600);
- break;
- case pickFungus:
- objects.getNearest(fungusLog).doAction(
- "Pick Fungi");
- break;
- case waiting:
- sleep(random(300,600));
- break;
- }
- return 590;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement