Created
February 17, 2015 11:23
-
-
Save lordgmage/66fd191b7c96b3b6a8df to your computer and use it in GitHub Desktop.
LordFlax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.parabot.environment.scripts.Category; | |
import org.parabot.environment.scripts.Script; | |
import org.parabot.environment.scripts.ScriptManifest; | |
import org.parabot.environment.scripts.framework.Strategy; | |
import strategies.BankingFlax; | |
import strategies.PickingFlax; | |
import strategies.ToFlax; | |
import java.awt.*; | |
import java.util.ArrayList; | |
@ScriptManifest(author = "LordgMage", | |
category = Category.OTHER, | |
description = "Picks Flax and banks", | |
name = "LordFlax", | |
servers = { "Ikov" }, | |
version = 1.7) | |
public class LordFlax extends Script { | |
private static ArrayList<Strategy> strategies = new ArrayList<Strategy>(); | |
public long startTime = System.currentTimeMillis(); | |
//START: Code generated using Enfilade's Easel | |
private final Color color1 = new Color(0, 0, 0); | |
private final Font font1 = new Font("Arial", 0, 15); | |
public void onRepaint(Graphics g1) { | |
long millis = System.currentTimeMillis() - startTime; | |
long hours = millis / (1000 * 60 * 60); | |
millis -= hours * (1000 * 60 * 60); | |
long minutes = millis / (1000 * 60); | |
millis -= minutes * (1000 * 60); | |
long seconds = millis / 1000; | |
Graphics2D g = (Graphics2D)g1; | |
g.setFont(font1); | |
g.setColor(color1); | |
g.drawString("Flax Picked:", 30, 364); | |
g.drawString("Time Run:" + hours + ": " + minutes + ": " + seconds, 29, 398); | |
g.drawString("Status:", 29, 429); | |
} | |
//END: Code generated using Enfilade's Easel | |
public boolean onExecute() { | |
strategies.add(new BankingFlax()); | |
strategies.add(new PickingFlax()); | |
strategies.add(new ToFlax()); | |
provide(strategies); | |
return true; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package strategies; | |
import org.parabot.environment.api.utils.Time; | |
import org.parabot.environment.scripts.framework.SleepCondition; | |
import org.parabot.environment.scripts.framework.Strategy; | |
import org.rev317.min.api.methods.*; | |
import org.rev317.min.api.wrappers.Tile; | |
public class BankingFlax implements Strategy { | |
@Override | |
public boolean activate() { | |
return Inventory.isFull() && !Bank.isOpen(); | |
} | |
@Override | |
public void execute() { | |
Menu.clickButton(1541); | |
Time.sleep(new SleepCondition() { | |
@Override | |
public boolean isValid() { | |
return Game.getOpenBackDialogId() == 2491; | |
} | |
}, 2000); | |
Menu.sendAction(315, -1, -1, 2494); | |
Time.sleep(1000); | |
Menu.sendAction(315, -1, -1, 2496); | |
Time.sleep(2500); | |
Bank.open(); | |
Time.sleep(new SleepCondition() { | |
@Override | |
public boolean isValid() { | |
return Bank.isOpen(); | |
} | |
}, 3000); | |
System.out.print("Banking"); | |
Menu.sendAction(646, 1521, 3, 21012); | |
Time.sleep(new SleepCondition() { | |
@Override | |
public boolean isValid() { | |
return Inventory.isEmpty(); | |
} | |
},2000); | |
Bank.close(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package strategies; | |
import org.parabot.environment.api.utils.Time; | |
import org.parabot.environment.scripts.framework.SleepCondition; | |
import org.parabot.environment.scripts.framework.Strategy; | |
import org.rev317.min.api.methods.Bank; | |
import org.rev317.min.api.methods.Inventory; | |
import org.rev317.min.api.methods.Players; | |
import org.rev317.min.api.methods.SceneObjects; | |
import org.rev317.min.api.wrappers.SceneObject; | |
import org.rev317.min.api.wrappers.Tile; | |
public class PickingFlax implements Strategy { | |
SceneObject[] Flax_ID = SceneObjects.getNearest(2646); | |
@Override | |
public boolean activate() { | |
return !Inventory.isFull() && !Bank.isOpen() && Players.getMyPlayer().getAnimation() == -1 && Players.getMyPlayer().getLocation().equals(new Tile(2739,3445)); | |
} | |
@Override | |
public void execute() { | |
SceneObject[] Flax_ID = SceneObjects.getNearest(2646); | |
if (Flax_ID.length > 0 && Flax_ID != null | |
&& Flax_ID[0].distanceTo() > 0 | |
&& Players.getMyPlayer().getAnimation() == -1) { | |
Flax_ID[0].interact(Flax_ID[0].getHash()); | |
Time.sleep(new SleepCondition() { | |
@Override | |
public boolean isValid() { | |
return Players.getMyPlayer().getAnimation() != -1; | |
} | |
}, 1000); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package strategies; | |
import org.parabot.environment.api.utils.Time; | |
import org.parabot.environment.scripts.framework.Strategy; | |
import org.rev317.min.api.methods.Bank; | |
import org.rev317.min.api.methods.Inventory; | |
import org.rev317.min.api.methods.SceneObjects; | |
import org.rev317.min.api.wrappers.SceneObject; | |
import org.rev317.min.api.wrappers.Tile; | |
import org.rev317.min.api.wrappers.TilePath; | |
public class ToFlax implements Strategy { | |
public static Tile[] FlaxPath = {new Tile(2725,3484), new Tile(2722,3473,0), new Tile(2720,3466), new Tile(2727,3453,0), new Tile(2739,3445)}; | |
SceneObject[] Flax_ID = SceneObjects.getNearest(2646); | |
@Override | |
public boolean activate() { | |
return !Inventory.isFull() && !Bank.isOpen() && Flax_ID[0].distanceTo() > 10 && Inventory.getCount() == 0; | |
} | |
@Override | |
public void execute() { | |
TilePath FlaxPatch = new TilePath(FlaxPath);{ | |
FlaxPatch.traverse(); | |
Time.sleep(2000); | |
} | |
System.out.print("ToFlax"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment