Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.osbot.rs07.api.model.RS2Object;
- import org.osbot.rs07.api.ui.RS2Widget;
- import org.osbot.rs07.script.Script;
- import org.osbot.rs07.script.ScriptManifest;
- import org.osbot.rs07.utility.Area;
- @ScriptManifest(author = "Charlie", info = "Cooks food in Nardah Duh", name = "Nardah Cooker", version = 0, logo = "")
- public class NCooker extends Script {
- Area cookArea = new Area(3432, 2889, 3435, 2886);
- Area bankArea = new Area(3427, 2893, 3430, 2890);
- private enum State {
- COOK, BANK, WALK2BANK, WALK2STOVE
- };
- private NCooker.State getState()
- {
- if ((this.inventory.contains(new String[] { "Raw shrimps" })) && (cookArea.contains(myPlayer().getPosition()))) {
- return NCooker.State.COOK;
- }
- if ((!this.inventory.contains(new String[] { "Raw shrimps" })) && (!cookArea.contains(myPlayer().getPosition()))) {
- return NCooker.State.BANK;
- }
- if ((this.inventory.contains(new String[] { "Raw shrimps" })) && (!cookArea.contains(myPlayer().getPosition()))) {
- return NCooker.State.WALK2STOVE;
- }
- return NCooker.State.WALK2BANK;
- }
- @Override
- public int onLoop()
- throws InterruptedException
- {
- switch (getState())
- {
- case BANK:
- RS2Object bankBooth = (RS2Object)this.objects.closest(new String[] { "Bank booth" });
- if (bankBooth != null) {
- if (bankBooth.interact(new String[] { "Bank" }))
- {
- while (!this.bank.isOpen()) {
- sleep(250L);
- }
- this.bank.depositAll();
- if (this.bank.contains(new String[] { "Raw shrimps" })) {
- this.bank.withdraw("Raw shrimps", 27);
- } else {
- stop();
- }
- this.bank.close();
- }
- }
- break;
- case COOK:
- if (!myPlayer().isAnimating())
- {
- if (this.inventory.contains(new String[] { "Raw shrimps" }))
- {
- getInventory().getItem("Raw shrimps").interact("Use");
- getObjects().closest("Clay Oven").interact("Use");
- sleep (500L);
- RS2Widget w = widgets.get(162,40);
- if (w != null)
- w.interact("Cook All");
- sleep (1000L);
- break;
- }
- }
- break;
- case WALK2STOVE:
- this.localWalker.walk(this.cookArea, true);
- sleep(random(700, 900));
- break;
- case WALK2BANK:
- this.localWalker.walk(this.bankArea, true);
- sleep(random(700, 900));
- }
- return random(200, 300);
- }
- @Override
- public void onStart() {
- log("Charlie's Nardah Cooker Started");
- log("If you experience any errors while using this scripts please talk to Charlie :)");
- log("Enjoy the Cooking Gains!");
- }
- @Override
- public void onExit() {
- log("Thanks for using Nardah Cooker! Hope you made gains.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement