Sign in to follow this  
joedobo

[RELEASED] Make all recipies known

Recommended Posts

I don't like discovering recipes and wanted them to just be known by default. Here is a simple script runner mod to do this. I also removed all custom naming because I don't like that either. If you want to leave the naming remove the code between the two comments.

 

To use this:
1. Copy the code in the white box inside the spoiler.
2. Paste into a text editor program (notepad, wordpad, notepad++, ....).
3. Save as a something with .js extension.
4. Put that file in the appropriate folder: Wurm Unlimited Dedicated Server\mods\scriptrunner\scripts\ onServerStarted.

 

 

Spoiler

//****************************
var removePlayerNaming = true; // prevent recipes from being nameable. Apparently for default WU there aren't any nameable recipes.
var removeSpecialNaming = true; // foods named after the developers who worked on the food system and couple contest winner's names.
//****************************

var Recipes = Packages.com.wurmonline.server.items.Recipes;
var ReflectionUtil = Packages.org.gotti.wurmunlimited.modloader.ReflectionUtil;
var Class = Packages.java.lang.Class;
var Logger = Packages.java.util.logging.Logger;
var logger = Logger.getLogger("com.joedobo27.scriptRunnerMods.make-all-recipes-known");

function onServerStarted(){
	recipes = Recipes.getAllRecipes();
	var fieldKnown = ReflectionUtil.getField(Class.forName("com.wurmonline.server.items.Recipe"), "known");
	var fieldName = ReflectionUtil.getField(Class.forName("com.wurmonline.server.items.Recipe"), "name");
	var fieldNameable = ReflectionUtil.getField(Class.forName("com.wurmonline.server.items.Recipe"), "nameable");

	for (i = 0; i < recipes.length; i++) {
		ReflectionUtil.setPrivateField(recipes[i], fieldKnown, true);
		ReflectionUtil.setPrivateField(recipes[i], fieldNameable, false);

		if (removePlayerNaming){
			var name = recipes[i].getRecipeName();
		}
		if (removeSpecialNaming){
			if (name == "Belrindor's maple bacon pancakes"){
				ReflectionUtil.setPrivateField(recipes[i], fieldName, "maple bacon pancakes");
			}
			if (name == "Budda's terrible pasta dish"){
				ReflectionUtil.setPrivateField(recipes[i], fieldName, "terrible pasta dish");
			}
			if (name == "Cerber's triple hops"){
				ReflectionUtil.setPrivateField(recipes[i], fieldName, "triple hops");
			}
			if (name == "Lisabet's corned beef and cabbage"){
				ReflectionUtil.setPrivateField(recipes[i], fieldName, "corned beef and cabbage");
			}
			if (name == "marine's stew"){
				ReflectionUtil.setPrivateField(recipes[i], fieldName, "fish and corn stew");
			}
			if (name == "Nicrolis' gingerbeer"){
				ReflectionUtil.setPrivateField(recipes[i], fieldName, "gingerbeer");
			}
			if (name == "Pandalet's one true pizza"){
				ReflectionUtil.setPrivateField(recipes[i], fieldName, "one true pizza");
			}
			if (name == "Retrograde pie"){
				ReflectionUtil.setPrivateField(recipes[i], fieldName, "snake pie");
			}
			if (name == "Robbycrusoe's poutine"){
				ReflectionUtil.setPrivateField(recipes[i], fieldName, "poutine");
			}
			if (name == "Rolf's favourite sandwich"){
				ReflectionUtil.setPrivateField(recipes[i], fieldName, "cucumber and cheese sandwich");
			}
			if (name == "Thor's Austrian dream schnitzel"){
				ReflectionUtil.setPrivateField(recipes[i], fieldName, "dream schnitzel");
			}
			if (name == "Tich's game jalfrezi"){
				ReflectionUtil.setPrivateField(recipes[i], fieldName, "game jalfrezi");
			}
		}
	}
	if(removeSpecialNaming){
		logger.info("All special named foods renamed.");
	}
	if(removePlayerNaming){
		logger.info("Any nameable recipes are no longer nameable.");
	}
	logger.info("All recipes are now known.");
}

 

 

Edited by joedobo
updated script runner code.

Share this post


Link to post
Share on other sites

The "custom naming" thing isn't the same as the custom names on WO recipes.

 

They are specific named dishes after the dev team who worked on it, as well as those who lent significant time testing.

 

Still, nice work no the making it all known

  • Like 1

Share this post


Link to post
Share on other sites
8 minutes ago, joedobo said:

@RetrogradeI wanted to remove both the nameable recipes and the dev named ones. And as you can see I did.

there are no nameable ones in WU, theyre WO only

Share this post


Link to post
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.

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.

Sign in to follow this