Jump to content

roguehippos PieMaker [F2P] [P2P] makes all pies!


roguehippo

Recommended Posts

Hey there everyone, im making this post to announce a new script im releasing in order to hopefully have something on the sdn to become a scripter I and II. 

it is a very profitable method in both f2p and p2p . I know the prices will crash but when the market is good it is easy to make like 500k+ an hour in f2p making apple pies or pie shells. In p2p the uncooked pie prices can get pretty high when looking at the higher pies. They are mostly used for the bake pie lunars spell so if the price ever goes down low enough bake pie bots will be great. the limiting factor here is that you can only but 500 pie dishes every 4 or 6 hours so you need multiple accounts buying those if u want to make a lot of gp.

Features:

Combines ingredients to form any pie members and non members!

~1800 pies / hr (2 ingredient pies)

Banks and logs out when you cant get a full inv of ingredients.

Screenshots:

Spoiler

f55c41faf918a82f14551e5c16e94c99.png

BYul1Fk.gif

Edited by roguehippo
Link to comment
Share on other sites

I submitted an upload to the sdn and was hoping it would be up for free soon. Should I put up the jar file for people to download?

 

PieMaker.jar

heres the code if anyone wants. 

Spoiler

import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.model.NPC;
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 java.awt.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;

import javax.swing.JOptionPane;

@ScriptManifest(author = "roguehippo", info = "roguehippos uncooked pie maker", name = "Pie Maker", version = 0, logo = "")
public class main extends Script {
	String pie = "";
	int withdrawNum = 0;
	HashMap<String , String[]> pieMap;
	HashMap<String, Integer[]> specialMap;
	String[] ingredients;
	Area bankArea;
	int piesMade = 0;
	Date startTime;
	//this variable is going to be used to hopefully fix a minor issue in which we wait atleast 1 second each iteration of the script.
	//we will use this to make a general time when waiting one second is ok (checking to see if the pies are being made currently)
	boolean probablyMakingPies = false;
	@Override
	public void onStart() {
		log("Welcome to roguehippos unfinished pie maker");
		log("If you experience any issues while running this script please report them to me on the forums.");
		log("Enjoy the script!");
		makePieMap();
		makeSpecialMap();
		startTime = new Date();
		//names of possible pies
		Object[] pieOptions = {"Pie shell","Redberry pie", "Meat pie", "Mud pie", "Apple pie", "Garden pie", "Fish pie", "Botanical pie", "Admiral pie", "Wild pie", "Summer pie"};
		//this where they choose the pie
		pie = (String) JOptionPane.showInputDialog(
				null, "Choose the pie to make",
		        "roguehippo's uncooked pie maker",
		        JOptionPane.QUESTION_MESSAGE,
		        null,
		        pieOptions, // Array of choices
		        pieOptions[0]); // Initial choice
		
		while(pie == "")
		{
			//while they are chosing which pie to select.
			mySleep(150,300);
		}
		ingredients = pieMap.get(pie);
		log("you have chosen to make: " + pie);
		log("your ingredients are: ");
		for(String s: ingredients)
		{
			log(s);
		}
		
		
	}

	private enum State {
		MAKE, BANK, WAIT
	};

	private State getState() {
		if (shouldMakePie())
			return State.MAKE;
		if (shouldBank())
			return State.BANK;
		return State.WAIT;
	}

	@Override
	public int onLoop() throws InterruptedException {
		switch (getState()) {
		case MAKE:
			makePie();
			break;
		case BANK:
			bank();
			break;
		case WAIT:
			mySleep(150,300);
			break;
		}
		return random(200, 300);
	}

	@Override
	public void onExit() {
		log("Thanks for running my Pie Maker!");
		log("you made: " + String.valueOf(piesMade)+ "pies!");
		log("you botted for " + getTimeSpent());
	}

	@Override
	public void onPaint(Graphics2D g) {
		mouse(g);
		g.setColor(Color.decode("#FD8748"));
		g.fillRect(2, 340, 175, 60);
		g.setColor(Color.decode("#41350B"));
		g.drawString("roguehippos Pie Maker", 5, 350);
		g.drawString("Pies Made:" + piesMade, 5, 365);
		g.drawString("Time Spent: " + getTimeSpent(), 5, 380);

	}
	//the green cross that shows the mouse.
	public void mouse(Graphics2D g)
	{
		Point mp = getMouse().getPosition();
		g.setColor(Color.GREEN);
		g.drawLine((int)mp.getX() - 10,(int)mp.getY(),(int)mp.getX() + 10,(int)mp.getY() );
		g.drawLine((int)mp.getX(), (int)mp.getY() - 10, (int)mp.getX(), (int)mp.getY() + 10);
		
	}
	//determines if we should make pies.
	private boolean shouldMakePie()
	{
		boolean retval = false;
		if(definitelyNotMakingPies() && isSpecialPie()  )
		{
			String ingred1 = ingredients[2];
			String ingred2 = ingredients[3];
			Integer[] parts = specialMap.get(pie);
			int part1 = parts[0];
			int part2 = parts[1];
			log("looking for ingredient combo");
			if(invContainsAll(ingredients))
			{
				log("found normal ingredients");
				retval = true;
			}
			if( inventory.contains(parts[0]) && inventory.contains(ingredients[2]))
			{
				log("found first part of pie");
				retval = true;
			}
			if(inventory.contains(parts[1]) && inventory.contains(ingredients[3]))
			{
				log("found second part of pie");
				retval = true;
			}
		}
		else if(invContainsAll(ingredients) && definitelyNotMakingPies() )
		{
			retval = true;
		}
		
		
		return retval;
	}
	//the function to actually make the pies
	//involves checking if the bank is open, opens it if its not,
	
	public void makePie()
	{
		if(bank.isOpen())
		{
			if(bank.close())
			{
				mySleep(50,100);
			}
		}
		//special pie exceptions
		if(getWidgets().isVisible(270, 14))
		{
			RS2Widget cookingWidget = getWidgets().get(270,14);
			String[] availableActions = cookingWidget.getInteractActions();
			for(String s: availableActions)
			{
				if(s.equals("Make"))
				{
					if(cookingWidget.interact("Make"))
					{
						probablyMakingPies = true;
						mySleep(1000,1750);
					}
					
				}
			}
		}
		else if(isSpecialPie())
		{
			Integer[] sIL = specialMap.get(pie);
			makeSpecialPie(sIL);		
		}
		else if(inventory.isItemSelected())
		{
			if(!listContainsString(ingredients,inventory.getSelectedItemName()))
			{
				if(inventory.deselectItem())
				{
					mySleep(50,90);
				}
			}
			else
			{
				if(inventory.interact("Use", ingredients[1]))
				{
					RS2Widget chatbox =getWidgets().get(162,30);
					mySleep(10,50);
					chatbox.hover();
					
					probablyMakingPies = true;
				}
			}
			
		}
		else
		{
			
			if(inventory.interact("Use",ingredients[0]))
			{
				mySleep(20,40);
			}
		}
	}
	private boolean shouldBank()
	{
		boolean retval = false;
		if(!isSpecialPie() && !invContainsAll(ingredients))
		{
			if(canSeeBooth())
			{
				retval = true;
			}
			else if(canSeeBanker())
			{
				retval = true;
			}
			else if(canSeeChest())
			{
				retval = true;
			}
			
			
		}
		if(isSpecialPie())
		{
			Integer[] sIL = specialMap.get(pie);
			int[] partNums = Arrays.stream(sIL).mapToInt(Integer::intValue).toArray();
			
			if((!inventory.contains(ingredients[0]) && !inventory.contains(ingredients[1])) &&
					(!inventory.contains(ingredients[2]) && !inventory.contains(partNums[0])) &&
					(!inventory.contains(ingredients[3]) && !inventory.contains(partNums[1]) ))
			{
				log("banking when special pie");
				retval = true;
			}
		}
		
		return retval;
	}
	
	public void bank()
	{
		probablyMakingPies = false;
		if(inventory.isItemSelected())
		{
			inventory.deselectItem();
		}
		if(!bank.isOpen())
		{
			if(canSeeBooth())
			{
				RS2Object booth = getObjects().closest("Bank booth");
				if(booth.interact("Bank"))
				{
					Date startTimerDate = new Date();
					while(!bank.isOpen() && lessThanXSeconds(startTimerDate,new Date(),4))
					{
						mySleep(100, 250);
					}
				}
			}
			else if(canSeeBanker())
			{
				NPC banker = getNpcs().closest("Banker");
				if(banker.interact("Bank"))
				{
					Date startTimerDate = new Date();
					while(!bank.isOpen() && lessThanXSeconds(startTimerDate,new Date(),4))
					{
						mySleep(100, 250);
					}
				}
			}
			else 
			{
				RS2Object chest = getObjects().closest("Bank chest");
				if(chest.interact("Bank"))
				{
					Date startTimerDate = new Date();
					while(!bank.isOpen() && lessThanXSeconds(startTimerDate,new Date(),4))
					{
						mySleep(100, 250);
					}
				}
			}
			
			
		}
		else//if the bank is open
		{
			if(withdrawNum == 0)
			{
				log("setting withdraw num");
				withdrawNum = 28 / ingredients.length;
			}	
			
			if(!inventory.onlyContains(ingredients))
			{
				if(bank.depositAllExcept(ingredients))
				{
					piesMade += withdrawNum;
					mySleep(75,150);
				}
			}
			checkBankForIngredients();
			//get the amount we need for each ingredient
			
			//step through the list of ingredients
			for(String s : ingredients)
			{
				//checking if we should withdraw or deposit if we don't have the right amount of items.
				int currentNumItem = (int)inventory.getAmount(s);
				if(currentNumItem < withdrawNum)
				{
					int amountToWithdraw = withdrawNum - currentNumItem;
					if(bank.withdraw(s, amountToWithdraw))
					{
						mySleep(100,199);
					}
				}
				else if( currentNumItem > withdrawNum)
				{
					int amountToDeposit = currentNumItem - withdrawNum;
					if(bank.deposit(s, amountToDeposit))
					{
						mySleep(75,150);
					}
				}
			}
		}
		
	}
	//making custom sleep to avoid ugly try catches everywhere
	private void mySleep(int lowBound, int highBound)
	{
		try {
			sleep(random(lowBound,highBound));
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	private void makePieMap()
	{
		pieMap = new HashMap<String, String[]>();
		String[] rbp = {"Pie shell","Redberries"};
		String[] meatPie = {"Pie shell","Cooked meat",};
		String[] mudPie = {"Pie shell",	"Compost", "Bucket of water", "Clay"};
		String[] ap = {"Pie shell", "Cooking apple"};
		String[] gp = {"Pie shell",	"Tomato", "Onion", "Cabbage"};
		String[] fp = {"Pie shell",	"Trout", "Cod", "Potato"};
		String[] bp = {"Pie shell",	"Golovanova fruit top"};
		String[] adp = {"Pie shell","Salmon", "Tuna", "Raw potato"};
		String[] wp = {"Pie shell", "Raw bear meat", "Raw chompy", "Raw rabbit"};
		String[] sp = {"Pie shell",	"Strawberry", "Watermelon", "Cooking apple"};	
		String[] ps = {"Pie dish","Pastry dough"};
		pieMap.put("Redberry pie" , rbp);
		pieMap.put("Pie shell", ps);
		pieMap.put("Meat pie",meatPie);
		pieMap.put("Mud pie" , mudPie );
		pieMap.put("Apple pie" , ap);
		pieMap.put("Garden pie" , gp);
		pieMap.put("Fish pie" , fp);
		pieMap.put("Botanical pie" ,bp );
		pieMap.put("Admiral pie" ,adp );
		pieMap.put("Wild pie" , wp);
		pieMap.put("Summer pie" , sp);
	}
	private void makeSpecialMap()
	{
		specialMap = new HashMap<String, Integer[]>();
		Integer[] mp = {7164,7166};
		Integer[] gp = {7172,7174};
		Integer[] fp = {7182,7184};
		Integer[] ap = {7192,7194};
		Integer[] wp = {7202,7204};
		Integer[] sp = {7212,7214};
		specialMap.put("Meat pie", mp);
		specialMap.put("Garden pie", gp);
		specialMap.put("Fish pie", fp);
		specialMap.put("Admiral pie", ap);
		specialMap.put("Wild pie", wp);
		specialMap.put("Summer pie", sp);
		
	}
	private boolean invContainsAll(String[] ingrediantList)
	{
		boolean retval = true;
		//step through the ingrediant list.
		for(int i = 0; i < ingrediantList.length; i++)
		{
			//if the inventory does not contain the ingrediant we need, set the return value to false
			if(!inventory.contains(ingrediantList[i]))
			{
				retval = false;
				//break because we know we need to bank at the first sign of missing ingrediant.
				break;
			}
		}
		
		return retval;
		
	}
	private boolean invContainsAll(Integer[] ingrediantList)
	{
		boolean retval = true;
		//step through the ingrediant list.
		for(int i = 0; i < ingrediantList.length; i++)
		{
			//if the inventory does not contain the ingrediant we need, set the return value to false
			if(!inventory.contains(ingrediantList[i]))
			{
				retval = false;
				//break because we know we need to bank at the first sign of missing ingrediant.
				break;
			}
		}
		
		return retval;
		
	}
	private boolean lessThanXSeconds(Date oldDate, Date newDate, int timer)
	{
		boolean retval = false;
		double milliseconds = newDate.getTime() - oldDate.getTime();
		
		int seconds = (int)(milliseconds / 1000);
		
		if(seconds < timer)
		{
			
			retval = true;
		}
		return retval;
	}
	private boolean definitelyNotMakingPies()
	{
		log("checking if we are making pies.");
		boolean retval = true;
		int numItems = 28 - getInventory().getEmptySlotCount();
		Date beforeLoop = new Date();
		int currentAmount; 
		if(inventory.isFull())
		{
			return retval;
		}
		while(lessThanXSeconds(beforeLoop, new Date(),2))
		{
			mySleep(150,250);
			currentAmount = 28 - getInventory().getEmptySlotCount();
			if(numItems != currentAmount)
			{
				log("breaking ");
				retval = false;
				break; 
			}
		}
		return retval;
	}
	private boolean canSeeBanker()
	{
		boolean retval = false;
		NPC banker = getNpcs().closest("Banker");
		if(banker != null && banker.isVisible())
		{
			retval = true;
		}
		
		return retval;
				
	}
	private boolean canSeeChest()
	{
		boolean retval = false;
		RS2Object chest = getObjects().closest("Bank chest");
		if(chest != null && chest.isVisible())
		{
			retval = true;
		}
		return retval;
	}
	private boolean canSeeBooth()
	{
		boolean retval = false;
		RS2Object booth = getObjects().closest("Bank booth");
		if(booth != null && booth.isVisible())
		{
			retval = true;
		}
		return retval;
	}
	private boolean listContainsString(String[] list, String string)
	{
		boolean retval = false;
		for(String s: list)
		{
			if(s.equals(string))
			{
				retval = true;
				break;
			}
		}
		
		return retval;
	}
	private void checkBankForIngredients()
	{
		for(String s: ingredients)
		{
			int ingredientAmount = (int)bank.getAmount(s);
			if(ingredientAmount < withdrawNum)
			{
				log("not enough ingredients  (" + s + ")");
				log("stopping script");
				stop();
			}
		}
	}
	private String getTimeSpent()
	{
		long millis = new Date().getTime() - startTime.getTime();
		long second = (millis / 1000) % 60;
		long minute = (millis / (1000 * 60)) % 60;
		long hour = (millis / (1000 * 60 * 60)) % 24;

		return String.format("%02d:%02d:%02d", hour, minute, second);
	}
	private boolean isSpecialPie()
	{
		boolean retval = false;
		String[] specialPies = {"Fish pie","Garden pie","Admiral pie", "Wild pie", "Summer pie", "Mud pie"};
		for(String s: specialPies)
		{
			if(pie.equals(s))
			{
				retval = true;
				break;
			}
		}
		return retval;
	}
	
	private void makeSpecialPie(Integer[] sIL)
	{
		//if an item is not selected
		if(!inventory.isItemSelected())
		{
			if(inventory.contains(ingredients[0]))
			{
				inventory.interact("Use", ingredients[0]);
			}
			else if(inventory.contains(sIL[0]) && inventory.contains(ingredients[2]))
			{
				inventory.interact("Use",ingredients[2]);
			}
			else if(inventory.contains(sIL[1]) && inventory.contains(ingredients[3]))
			{
				inventory.interact("Use", ingredients[3]);
			}
			 
		}
		else//if an item is selected
		{
			
			//if we selected the first part of the pie
			if(inventory.getSelectedItemName().equals(ingredients[0]))
			{
				if(inventory.interact("Use", ingredients[1]))
				{
					mySleep(140,199);
				}
			}
			//if we selected the second part of the pie
			else if(inventory.getSelectedItemName().equals(ingredients[2]))
			{
				if(inventory.interact("Use", sIL[0]))
				{
					mySleep(140,199);
				}
			}
			else if(inventory.getSelectedItemName().equals(ingredients[3]))
			{
				if(inventory.interact("Use", sIL[1]))
				{
					mySleep(140,199);
				}
			}
			//if we selected a wrong item.
			else
			{
				inventory.deselectItem();
			}
		}
	}
}

 

 

Edited by roguehippo
Link to comment
Share on other sites

ive made 10m in the past week from selling apple pies and pie shells. you have to wait for someone who wants pies to buy them. look at graphs from rsbuddy or ge tracker to see the prices

(obviously the prices will go down to meet the new flood of pies but i need to upload a script and its free, and hey if the pies go down in price it will be the cheapest and fastest cooking xp in game.)

3ff1162bf7590f511845e21d5e6c995f.png

Edited by roguehippo
Link to comment
Share on other sites

  • 1 month later...
  • 4 years later...

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...