Bug - Fixed Pullable/Buyable in softcore uses meat on hand instead of in hangks

icon315

Member
As the title says, the maximizer uses the meat you have on hand to determine if you are able to acquire the item, instead of using your meat in hangks. This makes it so that the option is grayed out and therefore it can't be selected
http://i.imgur.com/XJWz3KE.png


PS:
While i am on topic of the maximizer, could it be possible to add the Spacegate Vaccination Machine to it as well as the daily deeds.?
 

Darzil

Developer
Spacegate Vaccine machine is covered, I see it, so you might want to check relevant preferences.

Will look at the greying out code.
 

Darzil

Developer
As always, I hate the swing code. As you can see in the screenshot, the boosts are all returned by maximizer, but then are greyed out in swing, and I cannot currently find the code where this decision is made.
 

icon315

Member
The code finding whether you have enough meat is here

PHP:
// net.sourceforge.kolmafia.maximizer.Maximizer.java
//1,650: 
if (price > KoLCharacter.getAvailableMeat()) 
	
//To fix it (maybe) change it to:
if (price > (KoLCharacter.canInteract() ? KoLCharacter.getAvailableMeat() : KoLCharacter.getStorageMeat()))
Though as i am writing this I can already see an issue for aftercore where someone may not take their meat out of hangks.
The problem is currently that availableMeat returns meat on hand (since you can't buy from closet). As seen here:
PHP:
//net.sourceforge.kolmafia.request.CharPaneRequest.java
//685: 
int availableMeat = StringUtilities.parseInt( matcher.group( 1 ).replaceAll( "<[^>]*>", "" ).replaceAll( "[^\\d]+", "" ) ); 
		if ( matcher != null && matcher.find() )
		{
			int availableMeat = StringUtilities.parseInt( matcher.group( 1 ).replaceAll( "<[^>]*>", "" ).replaceAll( "[^\\d]+", "" ) );
			KoLCharacter.setAvailableMeat( availableMeat );
		}
It doesn't take into account meat in storage.
 

Darzil

Developer
Thanks, much simpler that I expected, must be code somewhere that greys it out when cmd="", which I couldn't find, so didn't start looking for things setting cmd to "".

Try r18079 (untested)
 

icon315

Member
Yeah the code for graying out is in maximizer.buffs.java
In the first of the functions. I'll test it when I get home
 
Last edited:

icon315

Member
It doesn't work. The problem is that it still checks your meat on hand, since the second if statement is still executed; Therefore it still blanks out cmd.
 

Darzil

Developer
You are right, I am an idiot! (and this is the trouble with not having a character in position to test)

Try 18084
 
Top