Feature - Implemented Cap the default value for item creation

lostcalpolydude

Developer
Staff member
When you use the Item Manager -> Creatable section to create an item, and you click "create item", the field is pre-filled with a value representing as much as you can make. If you have the meat to make thousands of items, you probably don't want to actually make that many. However, it seems to be common enough (at least once every few months) that someone uses all of their meat making bottles of gin or something because they just wanted to blow up their bartender before ascending. I think it would be nice if the pre-filled number there was however many you can make or 100 (maybe some other number), whichever is smaller. I made the following change to my version of mafia, and it worked properly for all of the cases I could think to test.

Code:
Index: src/net/sourceforge/kolmafia/utilities/InputFieldUtilities.java
===================================================================
--- src/net/sourceforge/kolmafia/utilities/InputFieldUtilities.java	(revision 8515)
+++ src/net/sourceforge/kolmafia/utilities/InputFieldUtilities.java	(working copy)
@@ -218,7 +218,10 @@
 	public static final int getQuantity(
 		final String title, final int maximumValue) {
 
-		return InputFieldUtilities.getQuantity(title, maximumValue, maximumValue);
+		//return InputFieldUtilities.getQuantity(title, maximumValue, maximumValue);
+		
+		int defaultCap = 100;
+		return InputFieldUtilities.getQuantity(title, maximumValue, defaultCap);
 	}
 
 	public static final int getQuantity(

First, there are plenty of parts of mafia I don't use, and it took me three tries to find the right file to change, so it's possible there are unintended side effects. Second, I feel like defaultCap should be a user-changeable variable (CLI/ash only I expect), and it should have a better name in that case.
 

fronobulax

Developer
Staff member
Would a better solution be a script to blow up the in-the-boxen? It seems to me that the script just loops through items that can be made with material on hand, makes one, sees whether the box has blown up and if so, aborts. Probably needs to override and restore the user setting to repair in-the-box. I'm mildly interested except I won't have a character I'd want to test it with for a few weeks, so I'm not likely to write it soon.
 

lostcalpolydude

Developer
Staff member
This could also help for someone that wants to just create 5 of something but foolishly pushes enter before typing in a number (not related to mafia because I did it in the relay browser, but this is how I sold a Mr. A for 5k once). Besides, I bet most mafia users will never think of using a script.
 

icon315

Member
I would really like this I lost like 2m trying to blow up my chef. I thought it would by the ingridients as it went along instead of buying them before
 

lostcalpolydude

Developer
Staff member
And I finally got to the unintended side effects. That same value is applied to mallselling or autoselling stuff, where you're more likely to want to have the full value. I expect that making them separate is a bit of work and beyond my abilities.
 
Top