Bug Issue recongizing failed hyperinflated seal lung use

Hyperinflated seal lungs can only be used once per day. Maximizer doesn't seem to realize that and suggests using another lung after my first has been used. It also decrements the number of lungs if I use them via the item manager (even if they aren't actually consumed because it's after my first use).
 

Bale

Minion
This is sort've an issue with every item in the game that can only be used a few times a day. Mafia only keeps track of a few of them. I think that the chocolates are more important to count than hyperinflated seal lungs.

Does anyone know if the wiki has a list of these items anywhere?
 

matt.chugg

Moderator
This is sort've an issue with every item in the game that can only be used a few times a day. Mafia only keeps track of a few of them. I think that the chocolates are more important to count than hyperinflated seal lungs.

Does anyone know if the wiki has a list of these items anywhere?

this list?!

http://kol.coldfront.net/thekolwiki/index.php/Daily_Activities

A daunting task adding all these, I'm guessing these need to be tracked in a preference, and not shown in maximizer

something like a preference _canUseitemnumberorname or maybe a proxy field for dailyuselimited..

ok, i'll come back and look at this when i've had coffee and am coherhant!
 

Bale

Minion
Yeah, _dailyUse#### for limited items would be the best way to implement that. And it would also be nice to have that dailyuselimit proxy field also.

Though this seems like a huge undertaking for something that only rarely causes anyone trouble since they pretty much only use those items on purpose.
 

matt.chugg

Moderator
I can see it being useful if you are using various items via the maximiser, possibly from basement diving, where trying to remember everything would be a bit arduous.

ok, this thread has taken a slight tangent, but anyway, the thing with the chocolate is that they are still usable and consumed after using three they just give a negative effect
 
Last edited:

matt.chugg

Moderator
compiles, but completely untested,

I believe it should work (but i've been wrong, (a lot) before). I think it leaves it ready to add other items that are restricted and then ignore them in the maximiser, i'll try and test this later but if anyone is sc and fancies test that would be very nice of them.

Code:
### Eclipse Workspace Patch 1.0
#P kolmafia
Index: src/net/sourceforge/kolmafia/request/UseItemRequest.java
===================================================================
--- src/net/sourceforge/kolmafia/request/UseItemRequest.java	(revision 9830)
+++ src/net/sourceforge/kolmafia/request/UseItemRequest.java	(working copy)
@@ -3900,6 +3900,19 @@
 			// inv_use.php?whichitem=3902&checked=1&pwd
 
 			return;
+			
+		case ItemPool.HYPERINFLATED_SEAL_LUNG:
+			//You inhale mightily from the lungs. Take that, Bill Clinton! 
+			//You don't think your lungs can handle another one of those today
+			if(responseText.indexOf( "inhale mightily" ) == -1) 
+			{
+				UseItemRequest.lastUpdate = "You don't think your lungs can handle another one of those today.";
+				KoLmafia.updateDisplay( KoLConstants.ERROR_STATE, UseItemRequest.lastUpdate );
+				ResultProcessor.processResult( item );
+			}
+			// doesn't matter what the response is, single use, so cannot use another whether last succeeded or failed
+			Preferences.setBoolean("_canUse3935", false);
+			return;
 
 		case ItemPool.SEAL_IRON_INGOT:
 
Index: src/data/defaults.txt
===================================================================
--- src/data/defaults.txt	(revision 9830)
+++ src/data/defaults.txt	(working copy)
@@ -678,6 +678,7 @@
 user	_brickoFights	0
 user	_cameraUsed	false
 user	_candySummons	0
+user	_canUse3935	true
 user	_carboLoaded	false
 user	_companionshipCasts	0
 user	_chipBags	0
Index: src/net/sourceforge/kolmafia/swingui/MaximizerFrame.java
===================================================================
--- src/net/sourceforge/kolmafia/swingui/MaximizerFrame.java	(revision 9830)
+++ src/net/sourceforge/kolmafia/swingui/MaximizerFrame.java	(working copy)
@@ -850,6 +850,24 @@
 						continue;
 					}
 					
+					// check whether the item has been limited by daily usage count
+					boolean ShouldIgnoreItem = false;
+					switch ( item.getItemId() ) 
+					{
+						case ItemPool.HYPERINFLATED_SEAL_LUNG:
+							if (!Preferences.getBoolean("_canUse" + item.getItemId())) 
+							{
+								ShouldIgnoreItem = true;
+							}
+							break;
+						default:
+							break;
+					}
+					if ( ShouldIgnoreItem ) {
+						continue;
+					}
+					
+					
 					int full = ItemDatabase.getFullness( iname );
 					if ( full > 0 &&
 						KoLCharacter.getFullness() + full > KoLCharacter.getFullnessLimit() )
Index: src/net/sourceforge/kolmafia/objectpool/ItemPool.java
===================================================================
--- src/net/sourceforge/kolmafia/objectpool/ItemPool.java	(revision 9830)
+++ src/net/sourceforge/kolmafia/objectpool/ItemPool.java	(working copy)
@@ -955,6 +955,7 @@
 	public static final int TURTLEMAIL_BITS = 3919;
 	public static final int TURTLING_ROD = 3927;
 	public static final int SEAL_IRON_INGOT = 3932;
+	public static final int HYPERINFLATED_SEAL_LUNG = 3935;
 	public static final int VIP_LOUNGE_KEY = 3947;
 	public static final int STUFFED_CHEST = 3949;
 	public static final int STUFFED_KEY = 3950;
 

lostcalpolydude

Developer
Staff member
If this setting is going to be part of a standard with other settings, then using ints would work for everything compared to booleans which only applies to things that can be used exactly once.
 

matt.chugg

Moderator
true, although then it would need to know how many the maximum was?

although I agree using ints would probably be more useful for scripts as well

I tried testing the above, but I can' actually figure out the command for the maximiser to show me sources of really deep breath, "adventure underwater" just shows equipment, even when I have the "show effects with no direct source" box checked, do I need to have "opened" the underwater zone to test this? I may ascend sc next run anway
 

lostcalpolydude

Developer
Staff member
Knowing how many of the item can be used could be done by changing
Code:
if (!Preferences.getBoolean("_canUse" + item.getItemId()))
to
Code:
if (!Preferences.getInteger("_dailyUses" + item.getItemId() > [hard-coded number for each item] ))
I think. Assuming your patch worked and the function is actually called getInteger().
 

matt.chugg

Moderator
I wonder if tradeitems should be updated to include daily consumption limits, which would then be usable in proxy fields

That would probably put this outside the scope of my current abilities!
 

slyz

Developer
Code:
[hard-coded number for each item] ))
Most of the entries in the Wiki page linked upthread are either already tracked by Mafia, or suspect ( I never noticed you could only eat one extra-greasy slider per day). But the large and growing number of limited-per-day items, skills and even adventures could perhaps justify a new data file, with this sort of format:
Code:
# name	type	max uses

# skills section
Chorale of Companionship	skill	10

# items section
Hyperinflated lung	item	1

One issue is checking for successful usage. Is there a generic way to do this for this sort of simple limited skill/items?

EDIT: adding a field to tradeitems.txt and classskills.txt would also do the trick, with 0 meaning "unlimited" (and/or "special").
 
Last edited:

roippi

Developer
EDIT: adding a field to tradeitems.txt and classskills.txt would also do the trick, with 0 meaning "unlimited" (and/or "special").

I'd honestly prefer a separate data file. Breaking a bunch of scripts for the quality update was justified in my mind since it's widely useful, every item needs an entry, and it doesn't really belong anywhere else; this, on the other hand makes sense being split off into a separate file.
 

slyz

Developer
If we add the field at the end of each line, it shouldn't break any script. And I don't think there are many scripts that import those two files.
 
Top