Jump to content

[Free] Cook's Assistant Quest completer


lisabe96

Recommended Posts

Cook's assistant quest completer

By RandQm

 

 

 

Features:

Completes whole the quest on it's own

Handles obstacles as doors/gates/...

Toggles running when energy is available

Uses webwalking

 

 

Reasons to use this:

Because why not

Only takes 5 minutes

Because it is believed having completed quests makes your account more legit (less chance on ban)

 

Instructions:

Do not have the supplies ready in your inventory, just start empty.

Stand in the Lumbridge kitchen when starting the bot

Do not interrupt the bot, it won't be able to pick up progress if you logged out in the middle of something

 

Click here to download the JAR

 

 

yXIDthq.png

 

 

 

 

Code for geeks:

package rqcooksassistant;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.RenderingHints;

import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.api.model.GroundItem;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.api.ui.Message;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

/**
 * 
 * @author randqm
 *
 */

@ScriptManifest(author = "RandQm", info = "Cooks Assistant", name = "RQ Cooks assistant", version = 1.0, logo = "")
public class Main extends Script {
	
	private String status = "Starting...";
	
	private int stage = -1;
	
	private long startTime;
	
	
	private void updateStage(int stage, String status) {
		this.stage = stage;
		this.status = status;
	}
	
	@Override
	public void onMessage(Message message) {
		switch (message.getMessage()) {
		case "You put the grain in the hopper.":
			updateStage(13, "Operating hopper controls.");
			break;
			
		case "You operate the hopper. The grain slides down the chute.":
			updateStage(14, "Going to the flour bin.");
			break;
		}
	}

	@Override
	public int onLoop() {
		log("stage: " + stage);
		
		switch (stage) {
		case -1:
			startTime = System.currentTimeMillis();
			updateStage(stage + 1, "Talking to cook.");
			break;
			
		case 0:
			NPC npc = npcs.closest("Cook");
			
			if (npc != null) {
				npc.interact("Talk-to");
				updateStage(stage + 1, "Handling conversation with cook.");
			}
			break;
			
		case 1:
		case 2:
			if (getDialogues().isPendingContinuation()) {
				getDialogues().clickContinue();
			} else if (getDialogues().isPendingOption()) {
				getDialogues().selectOption(1);
				updateStage(stage + 1, "Handling conversation with cook.");
			}
			break;
			
		case 3:
			if (getDialogues().isPendingContinuation()) {
				getDialogues().clickContinue();
			} else if (getDialogues().isPendingOption()) {
				getDialogues().selectOption(4);
				updateStage(stage + 1, "Handling conversation with cook.");
			}
			break;
			
		case 4:
			if (!getDialogues().isPendingContinuation()) {
				break;
			}
			getDialogues().clickContinue();
			updateStage(stage + 1, "Take pot.");
			break;
			
		case 5:
			GroundItem pot = getGroundItems().closest("Pot");
			
			if (pot != null) {
				pot.interact("Take");
				updateStage(stage + 1, "Head to wheat field.");
			}
			break;
			
		case 6:
			if (walkTo(new Position(3163, 3289, 0))) {
				if (checkDoor()) {
					updateStage(stage + 1, "Pick wheat.");
				}
			}
			break;
			
		case 7:
			RS2Object wheat = getObjects().closest("Wheat");
			
			if (wheat != null) {
				wheat.interact("Pick");
				updateStage(stage + 1, "Head to mill.");
			}
			break;
			
		case 8:
			if (!inventory.contains("Grain")) {
				break;
			}
			if (walkTo(new Position(3162, 3290, 0))) {
				if (checkDoor()) {
					updateStage(stage + 1, "Head to mill.");
				}
			}
			break;
			
		case 9:
			if (walkTo(new Position(3166, 3302, 0))) {
				if (checkDoor()) {
					updateStage(stage + 1, "Going to the hopper.");
				}
			}
			break;
			
		case 10:
			updateStage(stage + (climbLadder(true) ? 1 : -1), "Going to the hopper.");
			break;
			
		case 11:
			if (myPosition().getZ() != 1) {
				break;
			}
			updateStage(stage + (climbLadder(true) ? 1 : -1), "Putting grain into hopper.");
			break;
			
		case 12:
			if (myPosition().getZ() != 2) {
				break;
			}
			RS2Object hopper = getObjects().closest("Hopper");
			
			if (hopper != null) {
				getInventory().interact("Use", "Grain");
				
				if (!getInventory().isItemSelected()) {
					break;
				}
				hopper.interact("use");
			}
			break;
			
		case 13:
			RS2Object controls = getObjects().closest("Hopper controls");
			
			if (controls != null) {
				controls.interact("Operate");
			}
			break;
			
		case 14:
			updateStage(stage + (climbLadder(false) ? 1 : -1), "Going to the flour bin.");
			break;
			
		case 15:
			if (myPosition().getZ() != 1) {
				break;
			}
			updateStage(stage + (climbLadder(false) ? 1 : -1), "Putting flour into pot.");
			break;
			
		case 16:
			if (myPosition().getZ() != 0) {
				break;
			}
			RS2Object flourBin = getObjects().closest("Flour bin");
			
			if (flourBin != null) {
				getInventory().interact("Use", "Pot");
				
				if (!getInventory().isItemSelected()) {
					break;
				}
				flourBin.interact("use");
				updateStage(stage + 1, "Heading to chickens.");
			}
			break;
			
		case 17:
			if (!inventory.contains("Pot of flour")) {
				break;
			}
			if (checkDoor()) {
				updateStage(stage + 1, "Heading to chickens.");
			}
			break;
			
		case 18:
			if (walkTo(new Position(3238, 3295, 0))) {
				if (checkDoor()) {
					updateStage(stage + 1, "Heading to chickens.");
				}
			}
			break;
			
		case 19:
			if (walkTo(new Position(3230, 3298, 0))) {
				updateStage(stage + 1, "Taking an egg.");
			}
			break;
			
		case 20:
			GroundItem egg = getGroundItems().closest("Egg");
			
			if (egg == null || !egg.exists()) {
				break;
			}
			egg.interact("Take");
			updateStage(stage + 1, "Heading to bucket.");
			break;
			
		case 21:
			if (!getInventory().contains("Egg")) {
				break;
			}
			if (walkTo(new Position(3231, 3291, 0))) {
				if (checkDoor()) {
					updateStage(stage + 1, "Taking bucket.");
				}
			}
			break;
			
		case 22:
			GroundItem bucket = getGroundItems().closest("Bucket");
				
			if (bucket == null || !bucket.exists()) {
				break;
			}
			bucket.interact("Take");
			updateStage(stage + 1, "Heading to diary cow.");
			break;
			
		case 23:
			if (!getInventory().contains("Bucket")) {
				break;
			}
			if (walkTo(new Position(3236, 3295, 0))) {
				if (checkDoor()) {
					updateStage(stage + 1, "Heading to diary cow.");
				}
			}
			break;
			
		case 24:
			if (walkTo(new Position(3252, 3267, 0))) {
				if (checkDoor()) {
					updateStage(stage + 1, "Milking diary cow.");
				}
			}
			break;
			
		case 25:
			if (walkTo(new Position(3255, 3274, 0))) {
				RS2Object cow = getObjects().closest("Dairy cow");
				
				if (cow != null) {
					cow.interact("Milk");
					updateStage(stage + 1, "Heading back to cook.");
				}
			}
			break;
			
		case 26:
			if (!getInventory().contains("Bucket of milk")) {
				break;
			}
			if (walkTo(new Position(3253, 3267, 0))) {
				if (checkDoor()) {
					updateStage(stage + 1, "Talking to cook.");
				}
			}
			break;
			
		case 27:
			if (walkTo(new Position(3208, 3213, 0))) {
				NPC cook = getNpcs().closest("Cook");
				
				if (cook != null) {
					cook.interact("Talk-to");
					updateStage(stage + 1, "Finishing quest.");
				}
			}
			break;
			
		case 28:
			if (getDialogues().isPendingContinuation()) {
				getDialogues().clickContinue();
			} else {
				getWidgets().closeOpenInterface();
				updateStage(stage + 1, "Finished quest. Thanks for using my script.");
				stop();
			}
			break;
		}
		return 600;
	}
	
	@Override
	public void onPaint(Graphics2D graphics) {
		Graphics2D g = (Graphics2D) graphics;
		g.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF));
	    
	    g.setColor(Color.CYAN);

	    g.drawString("Status: " + status, 10, 310);
	    g.drawString("Running: " + formatTime(System.currentTimeMillis() - startTime), 10, 330);
	}
	
	private boolean checkDoor() {
		boolean opened = false;
		
		for (RS2Object obj : objects.getAll()) {
			if (obj.getPosition().distance(myPosition()) < 2) {
				if (obj.hasAction("Open")) {
					obj.interact("Open");
					opened = true;
				}
			}
		}
		if (opened) {
			log("Opened closable");
			return false;
		}
		return true;
	}

	private String formatTime(long ms){
	    long s = ms / 1000, m = s / 60, h = m / 60;
	    s %= 60; m %= 60; h %= 24;
	    return String.format("%02d:%02d:%02d", h, m, s);
	}
	
	private boolean climbLadder(boolean up) {
		RS2Object ladder = getObjects().closest("Ladder");
		
		if (ladder != null) {
			ladder.interact(up ? "Climb-up" : "Climb-down");
			return true;
		}
		return false;
	}
	
	private boolean walkTo(Position pos) {
		if (!myPlayer().isMoving()) {
			boolean opened = false;
			
			for (RS2Object obj : objects.getAll()) {
				if (obj.getPosition().distance(myPosition()) < 3) {
					if (obj.hasAction("Open")) {
						obj.interact("Open");
						opened = true;
					}
				}
			}
			if (opened) {
				log("Opened closable");
				return false;
			}
			if (pos.distance(myPosition()) > 2) {
				getWalking().webWalk(pos);
				return false;
			}
			log("Finished walking");
			return true;
		}
		if (!getSettings().isRunning()) {
			if (getSettings().getRunEnergy() > 10) {
				getSettings().setRunning(true);
			}
		}
		return false;
	}
	
}

Edited by lisabe96
  • Like 3
Link to comment
Share on other sites

  • 2 weeks later...

Hey thanks for the script, just testing out now, it looks like it got stuck when the windmill door was closed. It was stuck waiting outside after it picked the wheat. Managed to keep going once I opened the door, will update if there are any further bugs.

Yeah having problems with walking since the last update,

waiting for a next update to push fixes to my scripts

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...