Vanyel

Make new items storable in BsB/FsB

Recommended Posts

As per title, I'd love an easy way to add items to the list of what is/not able to be stored in a BsB/FsB.

 

Preferably controlled with a config/properties file - maybe even an edit/update to the sortmod?

 

What I'm imagining is a simple line in a file to add items to, ie:

<snip>

bulkitems: 765, 380, 

bulkfood: 373, 

</snip>

 

This example would allow source crystals and diamonds to go into bsb's and porridge to go into fsb's... (purely an example)

 

While I'm dreaming of this, maybe a new item for bulk liquids? possibly something with the huge oil barrel graphic? 

 

Many thanks

 

 

Share this post


Link to post
Share on other sites

Here is a scriptrunner tool I used expand what can go inside bulk containers. The numbers are from the ItemList class and are just an example. Change it to whatever you like.

To use it: copy the code, paste it into a text editor, save the file as whatever but with .js extension, finally put the js file in the onServerStarted folder (mods\scriptrunner\scripts\onServerStarted).

//****************************
// logHuge,pelt,saddle,stoneKeystone,marbleKeystone,fishingHookWood,fishingHookIron,fishingHookWoodAndString,
//   fishingHookIronAndString,
//   butter,tomato ketchup,snowball,cocoa,pineapple,
//   emerald,emeraldStar,ruby,rubyStar,opal,opalBlack,diamond,diamondStar,sapphire,sapphireStar,candle,yoke,source crystal
// Leave blank to make no change.
var makeTheseItemsBulk = [385,313,621,905,906,96,95,151,150,1186,1211,1276,1152,1235,374,375,376,377,378,379,380,381,382,383,133,632,765];
//****************************

var logger = Packages.java.util.logging.Logger.getLogger("com.joedobo27.scriptRunnerMods.make-item-bulk");

function onServerStarted() {
	var fieldBulk = Packages.org.gotti.wurmunlimited.modloader.ReflectionUtil.getField(Packages.java.lang.Class.forName("com.wurmonline.server.items.ItemTemplate"), "bulk");
	var templates = Packages.com.wurmonline.server.items.ItemTemplateFactory.getInstance().getTemplates();

	for (i = 0; i < templates.length; i++) {
		if (arrayContains(makeTheseItemsBulk, templates[i].getTemplateId())) {
			Packages.org.gotti.wurmunlimited.modloader.ReflectionUtil.setPrivateField(templates[i], fieldBulk, true);
		}
	}
	logger.info("Templates listed in option makeTheseItemsBulk are now bulk items");
}

function arrayContains(array, value) {
	for (i1 = 0; i1 < array.length; i1++) {
		if (array[i1] == value) {
			return true
		}
	}
	return false
}

Share this post


Link to post
Share on other sites

Liquids in bulk bins don't work. I tried to do it once and there are other problems. But the only advantage to be gained by putting them in there would be zero decay. An option to the decay thing might be to add new actions for sealing containers that don't require a peg or wax kit. This would let us seal more containers too, like say a tub or a fountain. I think the bigger ones would work. Kinda depends on how restrictive the logic is in wurm code. If it needed bytecode hackery to remove wurm's logic checks I'd probably avoid it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now