Bug - Fixed Mafia buying peppermint twists instead of peppermint sprouts

Running r10336 I used the CLI to create 9 Vodka Matryoshka. It searched only for peppermint twists and bought those instead of the over 1000 meat cheaper peppermint sprouts that it could have made peppermint twists from at no meat or adventure cost. CLI output included below.

Code:
Verifying ingredients for Vodka Matryoshka (9)...
Searching for "peppermint twist"...
Search complete.
Purchasing peppermint twist (9 @ 4,950)...
You acquire peppermint twist (9)
 

roippi

Developer
InventoryManager.java (678):

Code:
	switch ( mixingMethod )
		{
		// Sub-ingredients for star charts, pixels and malus
		// ingredients can get very expensive. Therefore, skip over
		// them in this step.

		case KoLConstants.NOCREATE:
		case KoLConstants.STARCHART:
		case KoLConstants.PIXEL:
		case KoLConstants.MALUS:
		case KoLConstants.STAFF:
-->		case KoLConstants.MULTI_USE:
			scriptSaysBuy = true;
			break;

In english, any "multi-usable" item can only be acquired by purchasing the final product from the mall. Creation by purchasing the constituent components will not be considered.

I think there's a historical reason for this, but it might need to be re-examined. My guess is that this restriction is in there because you could accidentally ask mafia to acquire a BRICKO gargantuchicken and suddenly be out a large amount of meat. (autoBuyPriceLimit would not stop that purchase either, since it is the sum of a lot of little purchases)

So, deleting the arrowed line fixes this bug, but I think something else is necessary. Perhaps autoBuyPriceLimit=x should stop purchases of many small items that add up to in excess of x, as well as individual items priced more than x?
 

slyz

Developer
If scriptSaysBuy is not set to true for items created by MULTI_USE, it is set either by the user's buyScript or by InventoryManager.cheaperToBuy(). In theory, that means Mafia will compare buying the final product versus buying the ingredients and creating.
 

slyz

Developer
After removing the line roippi pointed out, it seems to work as intended:
Code:
> create 1 Vodka Matryoshka

Verifying ingredients for Vodka Matryoshka (1)...
Searching for "bottle of vodka"...
Search complete.
Searching for "fermenting powder"...
Search complete.
Searching for "bowl of rye sprouts"...
Search complete.
Using cached search results for bottle of vodka...
Purchasing bottle of vodka (1 @ 110)...
You acquire an item: bottle of vodka
Purchases complete.
Searching for "peppermint twist"...
Search complete.
Searching for "peppermint sprout"...
Search complete.
Verifying ingredients for peppermint twist (1)...
Using cached search results for peppermint sprout...
Purchasing peppermint sprout (1 @ 4,275)...
You acquire an item: peppermint sprout
Purchases complete.
You acquire an item: peppermint twist
Successfully created peppermint twist (1)
Creating Vodka Matryoshka (1)...
You acquire an item: Vodka Matryoshka
Successfully created Vodka Matryoshka (1)
 
Top