Feature - Implemented Set default amount to 1 in the input box for the quantity of items to create

slyz

Developer
A couple of Mafia users posted stories in the What idiotic thing/s have you done today? thread of the KoL GD forum. In both cases, the same user error came up: asking for Mafia to create as many of an item as was possible, in order to blow up a chef/bartender. Of course, Mafia diligently proceeds to buy enough ingredients and spends all of the user's meat, leaving him with NPC items to autosell worth half the original value.

There are of course many ways for the user to prevent such a thing from happening, but maybe it would help in most cases to simply change the default value of the "creating multiple..." input box to 1.

Those users generally think "Mafia will stop buying things when the servant explodes, so it's not a problem if I ask for 4m schnapps". Or they just click without thinking, and do not abort in time to prevent Mafia from buying ingredients. If 1 was the default and they had to type in an amount, they would probably put in a much lower one and loose less meat, and of course they would only blame themselves instead of cursing Mafia.

I don't know if this has been discussed before, and it probably was since this seems to be the n°1 way people choose to use Mafia to loose a lot of meat. Here is a (simple) solution at least: change line 121 of CreateItemPanel.java, and use the 3 parameter form of getQuantity() to specify 1 as the default:
PHP:
"Creating multiple " + selection.getName() + "...", selection.getQuantityPossible() + selection.getQuantityPullable() );
to
PHP:
"Creating multiple " + selection.getName() + "...", selection.getQuantityPossible() + selection.getQuantityPullable(), 1 );
I didn't try it, but I don't think anything else needs to be changed.

EDIT: post updated to use Lost's fix
 
Last edited:

Spiny

Member
I tend to be very cautious when it comes to the point that I want to blow up boxen. I disable each of buy from mall and buy from npc and I make sure that repairing boxen is not an option. Then I create things based on what I actually have on hand, or purchase specific things in small batches that I don't mind having on hand and craft til the boxen blow. Then I re-enable my preferred options and move along.

Edit: It dawns on me that what I do doesn't help anyone so please just disregard :)
 
Last edited:

Theraze

Active member
Well, yes/no. Knowing the exact easiest/best steps for blowing up boxes might make scripting it simpler... :)

Basically, save the setting of repair boxes bit, disable the repair boxes bit, and craft either the cheapest items possible, or items that will sell/donate well out of inventory or shop items. Repeat the crafting until it blows up, checking inventory on each step for cost, and stop when the box explodes, restoring the setting of repair boxes bit. Yes?
 

Terion

Member
Along these lines, is there any counter in Mafia that tracks box servant use? If Mafia could tell me that I had used my bartender-itb 60 times, then I'd know I only have to worry about 20-40 more uses to blow it up. I keep forgetting to keep track myself, and have no idea if I need 20 fermenting powders or 80. (This is less an issue in aftercore/pre-ascending, but more of one when I'm trying to blow up my bartender in-run to get a lens for a camera without tons of spare meat to waste.)

If there is a counter already that I don't know about, then an ash script or CLI command could look it up. If I were wishing on a star, I'd love to have it notated on the Make Cocktails: and Cook Stuff: screens; maybe even in the campground, though that could get cluttered. But something on the crafting screens saying something like "Your servant has cooked/mixed 27 items for you." would be wonderful.

[/make-a-Mafia tangent]
 

Spiny

Member
Along these lines, is there any counter in Mafia that tracks box servant use? If Mafia could tell me that I had used my bartender-itb 60 times, then I'd know I only have to worry about 20-40 more uses to blow it up. I keep forgetting to keep track myself, and have no idea if I need 20 fermenting powders or 80. (This is less an issue in aftercore/pre-ascending, but more of one when I'm trying to blow up my bartender in-run to get a lens for a camera without tons of spare meat to waste.)

If there is a counter already that I don't know about, then an ash script or CLI command could look it up. If I were wishing on a star, I'd love to have it notated on the Make Cocktails: and Cook Stuff: screens; maybe even in the campground, though that could get cluttered. But something on the crafting screens saying something like "Your servant has cooked/mixed 27 items for you." would be wonderful.

[/make-a-Mafia tangent]

Actually, that does ring a bell... thanks for the reminder

Mafia r7952 said:
Experimental feature: when you use a chef-in-the-box or a bartender-in-the-box, set chefTurnsUsed or bartenderTurnsUsed to 0. When ever you cook or mix and have a box servant, increment the appropriate counter by the number of items created. When it blows up, do nothing; you can still look at the variable to see how many turns it lasted.
 

heeheehee

Developer
Staff member
I recall Bale, I think, posting an alias somewhere...
Code:
alias boxen => ashq if(have_chef()) print("Chef turns used: "+get_property("chefTurnsUsed"),"green"); else print("No chef-in-a-box","gray"); if(have_bartender()) print("Bartender turns used: "+get_property("bartenderTurnsUsed"),"green"); else print("No bartender-in-a-box","gray");
 
Last edited:

lostcalpolydude

Developer
Staff member
I implemented this and it doesn't work how you would want it to. The problem is in InputFieldUtilities.java
Code:
		if (maximumValue == 1 && maximumValue == defaultValue) {
			return 1;
		}
Which means that 1 of the item is created without bringing up a dialog box. The solution is to call the 3-parameter getQuantity
Code:
					"Creating multiple " + selection.getName() + "...", selection.getQuantityPossible() + selection.getQuantityPullable(), 1 );
This allows you to make multiple of an item when you can with a pre-filled value of 1, but automatically makes the item if you can only make 1 of it. I'll report back if anything is wrong with doing it this way, but I've spent enough time looking at the functions that I'm fairly confident that there are no side effects (unlike last time, where I was somewhat expecting to discover that my solution wasn't good enough).
 

Bale

Minion
I'm using this mod now. It's quite nice since I usually only want to make 1 of an item.

Thumbs up!
 

Bale

Minion
Although I like it, I'm not sure that it should be applied to mafia for several reasons.

1. There's something to be said for the input box informing me of the maximum number I can make. That's useful info, even if it is in the window right behind the input box. (Sometimes you'd have to move the input if you need the reminder.)

2. It is not consistent! In the food/drink manager it still defaults to the maximum.
 

lostcalpolydude

Developer
Staff member
1. That's easy enough to change. The function calls are already in that line even and just need to be included again, and then it comes down to aesthetics.

2. While this could be worth changing, I don't think it should hold back this change. Food/booze use is limited by organ space at least, and completely different code needs changing.
 

fronobulax

Developer
Staff member
@Bale - It seems to me that you have changed your mind between posts 12 and 16. If that was not your intention then I need to figure out how to read your posts more closely.

@lost - are you suggesting a change to make Bale happier? If so, a new diff please.

Since the original problem was overbuying in order to blow up an in-the-box, it doesn't really bother me that create and Eat/Drink have different behaviors. But I understand that my mafia use is not typical. In fact, I am usually too lazy to actually try and blow up an in-the-box at the end of a run. As I think about it, that sounds like a job for a script and not a change to the interface.
 

lostcalpolydude

Developer
Staff member
@lost - are you suggesting a change to make Bale happier? If so, a new diff please.

There are plenty of ways to change the appearance, currently my build has "Creating multiple [itemname], [quantity] possible". Applying the diff and rearranging string concatenations in the first function argument is easy enough.
 

Attachments

  • createitem2.diff
    856 bytes · Views: 18

Grotfang

Developer
I run mafia with some changes (that I very much like) that I wouldn't think should be incorporated into the main code. Bale isn't necessarily contradicting himself.

However, I do like this as a change. As much as I hate to suggest this, maybe a preference setting could be added so folks can keep the maximum if they wanted?
 
Top