New Content - Implemented Tracking for Distention pill, Dog Hair pill

roippi

Developer
Gave the dog hair pill a crack myself. Might have time to look at distention in a couple of days.

Code:
Index: src/net/sourceforge/kolmafia/objectpool/ItemPool.java
===================================================================
--- src/net/sourceforge/kolmafia/objectpool/ItemPool.java	(revision 9402)
+++ src/net/sourceforge/kolmafia/objectpool/ItemPool.java	(working copy)
@@ -1245,6 +1245,7 @@
 	public static final int LUNAR_ISOTOPE = 5134;
 	public static final int HONEYPOT = 5145;
 	public static final int SPOOKY_LITTLE_GIRL = 5165;
+	public static final int SYNTHETIC_DOG_HAIR_PILL = 5167;
 	public static final int TRANSPORTER_TRANSPONDER = 5170;
 	public static final int RONALD_SHELTER_MAP = 5171;
 	public static final int GRIMACE_SHELTER_MAP = 5172;
Index: src/net/sourceforge/kolmafia/request/UseItemRequest.java
===================================================================
--- src/net/sourceforge/kolmafia/request/UseItemRequest.java	(revision 9402)
+++ src/net/sourceforge/kolmafia/request/UseItemRequest.java	(working copy)
@@ -430,7 +430,12 @@
 		case ItemPool.SPICE_MELANGE:
 			UseItemRequest.limiter = "daily limit";
 			return Preferences.getBoolean( "spiceMelangeUsed" ) ? 0 : 1;
+		
+		case ItemPool.SYNTHETIC_DOG_HAIR_PILL:
+			UseItemRequest.limiter = "daily limit";
+			return Preferences.getBoolean( "syntheticDogHairPillUsed" ) ? 0 : 1;
 
+
 		case ItemPool.BURROWGRUB_HIVE:
 			UseItemRequest.limiter = "daily limit";
 			return Preferences.getBoolean( "burrowgrubHiveUsed" ) ? 0 : 1;
@@ -3182,6 +3187,23 @@
 			}
 			return;
 
+		case ItemPool.SYNTHETIC_DOG_HAIR_PILL:
+
+			//Your liver feels better! And quivers a bit.
+			if ( responseText.indexOf( "liver can't take any more abuse" ) != -1 )
+			{
+				Preferences.setBoolean( "syntheticDogHairPillUsed", true );
+				ResultProcessor.processResult( item );
+			}
+			else if ( responseText.indexOf( "quivers" ) != -1 )
+			{
+				KoLCharacter.setInebriety( Math.max( 0, KoLCharacter.getInebriety() - 1 ) );
+				Preferences.setBoolean( "syntheticDogHairPillUsed", true );
+				KoLCharacter.updateStatus();
+				ConcoctionDatabase.getUsables().sort();
+			}
+			return;
+
 		case ItemPool.MILK_OF_MAGNESIUM:
 
 			ConcoctionDatabase.getUsables().sort();
Index: src/net/sourceforge/kolmafia/KoLmafia.java
===================================================================
--- src/net/sourceforge/kolmafia/KoLmafia.java	(revision 9402)
+++ src/net/sourceforge/kolmafia/KoLmafia.java	(working copy)
@@ -898,6 +898,7 @@
 		Preferences.setBoolean( "spiceMelangeUsed", false );
 		Preferences.setInteger( "spookyPuttyCopiesMade", 0 );
 		Preferences.setBoolean( "styxPixieVisited", false );
+		Preferences.setBoolean( "syntheticDogHairPillUsed", false );
 		Preferences.setBoolean( "telescopeLookedHigh", false );
 		Preferences.setInteger( "tempuraSummons", 0 );
 		Preferences.setInteger( "timesRested", 0 );
Index: src/data/defaults.txt
===================================================================
--- src/data/defaults.txt	(revision 9402)
+++ src/data/defaults.txt	(working copy)
@@ -605,6 +605,7 @@
 user	sugarCounter4182	0
 user	sugarCounter4183	0
 user	sugarCounter4191	0
+user	syntheticDogHairPillUsed	false
 user	tavernLayout	0000000000000000000000000
 user	telescope1
 user	telescope2

I didn't do anything to daily deeds (or UseItemEnqueuePanel) because I'm not sure if that's something people want. I personally think Daily Deeds are already pretty crowded.
 

Veracity

Developer
Staff member
This is a one-per-day thing that resets on rollover? Then make the setting a "_" setting and you can remove resetting it from KoLmafia.java.
 

roippi

Developer
I realize that's a better way of doing it, but melange and mojo filters are reset this way and I was trying to be consistent.
 

roippi

Developer
Attempt 2.

Code:
Index: src/net/sourceforge/kolmafia/objectpool/ItemPool.java
===================================================================
--- src/net/sourceforge/kolmafia/objectpool/ItemPool.java	(revision 9402)
+++ src/net/sourceforge/kolmafia/objectpool/ItemPool.java	(working copy)
@@ -1245,6 +1245,7 @@
 	public static final int LUNAR_ISOTOPE = 5134;
 	public static final int HONEYPOT = 5145;
 	public static final int SPOOKY_LITTLE_GIRL = 5165;
+	public static final int SYNTHETIC_DOG_HAIR_PILL = 5167;
 	public static final int TRANSPORTER_TRANSPONDER = 5170;
 	public static final int RONALD_SHELTER_MAP = 5171;
 	public static final int GRIMACE_SHELTER_MAP = 5172;
Index: src/net/sourceforge/kolmafia/request/UseItemRequest.java
===================================================================
--- src/net/sourceforge/kolmafia/request/UseItemRequest.java	(revision 9402)
+++ src/net/sourceforge/kolmafia/request/UseItemRequest.java	(working copy)
@@ -430,6 +430,10 @@
 		case ItemPool.SPICE_MELANGE:
 			UseItemRequest.limiter = "daily limit";
 			return Preferences.getBoolean( "spiceMelangeUsed" ) ? 0 : 1;
+		
+		case ItemPool.SYNTHETIC_DOG_HAIR_PILL:
+			UseItemRequest.limiter = "daily limit";
+			return Preferences.getBoolean( "_syntheticDogHairPillUsed" ) ? 0 : 1;
 
 		case ItemPool.BURROWGRUB_HIVE:
 			UseItemRequest.limiter = "daily limit";
@@ -3182,6 +3186,23 @@
 			}
 			return;
 
+		case ItemPool.SYNTHETIC_DOG_HAIR_PILL:
+
+			//Your liver feels better! And quivers a bit.
+			if ( responseText.indexOf( "liver can't take any more abuse" ) != -1 )
+			{
+				Preferences.setBoolean( "_syntheticDogHairPillUsed", true );
+				ResultProcessor.processResult( item );
+			}
+			else if ( responseText.indexOf( "quivers" ) != -1 )
+			{
+				KoLCharacter.setInebriety( Math.max( 0, KoLCharacter.getInebriety() - 1 ) );
+				Preferences.setBoolean( "_syntheticDogHairPillUsed", true );
+				KoLCharacter.updateStatus();
+				ConcoctionDatabase.getUsables().sort();
+			}
+			return;
+
 		case ItemPool.MILK_OF_MAGNESIUM:
 
 			ConcoctionDatabase.getUsables().sort();
Index: src/data/defaults.txt
===================================================================
--- src/data/defaults.txt	(revision 9402)
+++ src/data/defaults.txt	(working copy)
@@ -689,6 +689,7 @@
 user	_skateBuff5	false
 user	_stinkyCheeseCount	0
 user	_stressBallSqueezes	0
+user	_syntheticDogHairPillUsed	false
 user	_madTeaParty	false
 user	_timeHelmetAdv	0
 user	_toastSummons	0

Code:
> get _syntheticDogHairPillUsed

false

> use synthetic dog hair

Using 1 synthetic dog hair pill...
Finished using 1 synthetic dog hair pill.

> get _syntheticDogHairPillUsed

true

> use synthetic dog hair

(usable quantity of synthetic dog hair pill is limited to 0 by daily limit)
 

Veracity

Developer
Staff member
This has no effect if you are at Inebriety 0, right? Perhaps another use limiter to detect that case?
And how about a button on the UseItemEnqueuePanel - greyed out if already used for the day or at Inebriety 0? :)

So far, so good.
 

roippi

Developer
Correct - there's a second error response distinct from the you-already-used-one-today one. "You should probably get at least a little drunk before experimenting with this." A good place for a limiter.

Now that I look at UseItemEnqueuePanel, there's clearly room for a button there; I agree it deserves a spot. I'm still not sure how I feel about Daily Deeds, though.
 

Veracity

Developer
Staff member
I don't use daily deeds. This is something you'll think about when you are on the Booze panel, in my opinion. A button there - enabled if you have a pill, have some drunkenness, and have not used a pill today, disabled otherwise - seems good.
 

roippi

Developer
Okay, this is as far as I got today.

Code:
Index: src/net/sourceforge/kolmafia/swingui/panel/UseItemEnqueuePanel.java
===================================================================
--- src/net/sourceforge/kolmafia/swingui/panel/UseItemEnqueuePanel.java	(revision 9402)
+++ src/net/sourceforge/kolmafia/swingui/panel/UseItemEnqueuePanel.java	(working copy)
@@ -90,9 +90,13 @@
 		if ( this.food || this.booze )
 		{
 			listeners.add( new FamiliarFeedListener() );
+			listeners.add( new BuffUpListener() );
 		}
 
-		listeners.add( new BuffUpListener() );
+		if ( this.booze || this.spleen )
+		{	
+		listeners.add( new FlushListener() );
+		}
 
 		ActionListener [] listenerArray = new ActionListener[ listeners.size() ];
 		listeners.toArray( listenerArray );
@@ -331,6 +335,23 @@
 			{
 				RequestThread.postRequest( UseSkillRequest.getInstance( "The Ode to Booze", 1 ) );
 			}
+		}
+
+		public String toString()
+		{
+			return UseItemEnqueuePanel.this.food ? "use milk" : UseItemEnqueuePanel.this.booze ? "cast ode" : "" ;
+		}
+	}
+
+	private class FlushListener
+		extends ThreadedListener
+	{
+		public void run()
+		{
+			if ( UseItemEnqueuePanel.this.booze )
+			{
+				RequestThread.postRequest( new UseItemRequest( ItemPool.get( ItemPool.SYNTHETIC_DOG_HAIR_PILL, 1 ) ) );
+			}
 			else if ( UseItemEnqueuePanel.this.spleen )
 			{
 				RequestThread.postRequest( new UseItemRequest( ItemPool.get( ItemPool.MOJO_FILTER, 1 ) ) );
@@ -339,9 +360,10 @@
 
 		public String toString()
 		{
-			return UseItemEnqueuePanel.this.food ? "use milk" : UseItemEnqueuePanel.this.booze ? "cast ode" : "flush mojo";
+			return UseItemEnqueuePanel.this.food ? "distention" : UseItemEnqueuePanel.this.booze ? "dog hair" : "flush mojo";
 		}
-	}
+	}	
+	
 
 	private class ConsumableFilterField
 		extends FilterItemField
Index: src/net/sourceforge/kolmafia/objectpool/ItemPool.java
===================================================================
--- src/net/sourceforge/kolmafia/objectpool/ItemPool.java	(revision 9402)
+++ src/net/sourceforge/kolmafia/objectpool/ItemPool.java	(working copy)
@@ -1245,6 +1245,7 @@
 	public static final int LUNAR_ISOTOPE = 5134;
 	public static final int HONEYPOT = 5145;
 	public static final int SPOOKY_LITTLE_GIRL = 5165;
+	public static final int SYNTHETIC_DOG_HAIR_PILL = 5167;
 	public static final int TRANSPORTER_TRANSPONDER = 5170;
 	public static final int RONALD_SHELTER_MAP = 5171;
 	public static final int GRIMACE_SHELTER_MAP = 5172;
Index: src/net/sourceforge/kolmafia/request/UseItemRequest.java
===================================================================
--- src/net/sourceforge/kolmafia/request/UseItemRequest.java	(revision 9402)
+++ src/net/sourceforge/kolmafia/request/UseItemRequest.java	(working copy)
@@ -430,6 +430,15 @@
 		case ItemPool.SPICE_MELANGE:
 			UseItemRequest.limiter = "daily limit";
 			return Preferences.getBoolean( "spiceMelangeUsed" ) ? 0 : 1;
+		
+		case ItemPool.SYNTHETIC_DOG_HAIR_PILL:
+			if ( KoLCharacter.getInebriety() == 0 )
+			{
+				UseItemRequest.limiter = "need inebriety";
+				return 0;
+			}
+			UseItemRequest.limiter = "daily limit";
+			return Preferences.getBoolean( "_syntheticDogHairPillUsed" ) ? 0 : 1;
 
 		case ItemPool.BURROWGRUB_HIVE:
 			UseItemRequest.limiter = "daily limit";
@@ -3182,6 +3191,23 @@
 			}
 			return;
 
+		case ItemPool.SYNTHETIC_DOG_HAIR_PILL:
+
+			//Your liver feels better! And quivers a bit.
+			if ( responseText.indexOf( "liver can't take any more abuse" ) != -1 )
+			{
+				Preferences.setBoolean( "_syntheticDogHairPillUsed", true );
+				ResultProcessor.processResult( item );
+			}
+			else if ( responseText.indexOf( "quivers" ) != -1 )
+			{
+				KoLCharacter.setInebriety( Math.max( 0, KoLCharacter.getInebriety() - 1 ) );
+				Preferences.setBoolean( "_syntheticDogHairPillUsed", true );
+				KoLCharacter.updateStatus();
+				ConcoctionDatabase.getUsables().sort();
+			}
+			return;
+
 		case ItemPool.MILK_OF_MAGNESIUM:
 
 			ConcoctionDatabase.getUsables().sort();
Index: src/data/defaults.txt
===================================================================
--- src/data/defaults.txt	(revision 9402)
+++ src/data/defaults.txt	(working copy)
@@ -689,6 +689,7 @@
 user	_skateBuff5	false
 user	_stinkyCheeseCount	0
 user	_stressBallSqueezes	0
+user	_syntheticDogHairPillUsed	false
 user	_madTeaParty	false
 user	_timeHelmetAdv	0
 user	_toastSummons	0

Zero inebriety is now a limiter (untested), and there's a button on boozepanel that will use a dog hair pill.

I had to refactor the listeners a bit to make this sane. Instead of mojo filters being a part of BuffUpListener (which doesn't really fit anyway), it and the other two filter-types are handled by the new FlushListener. Or would be, except..

I got partway into implementing the equivalent Distention pill stuff, and had a thought. Should distention pills be considered helpers? If so, they wouldn't get a button on UseItemRequestPanel and should be handled like other helpers.
 

Veracity

Developer
Staff member
How do they work? The synthetic hair of the dog acts just like a mojo filter, as I understand it, but what does the distention pill do, exactly? Remove fullness? If so, it's like mojo filter. Or make the next food eaten take one less fullness? In which case, it is definitely a helper - and now we have the case where you might want TWO helpers - the salad fork and the distention pill, say.

You can trust KoL to keep adding new mechanisms which we need to deal with! :-/
 
While you guys are working on this, can you make the filters Queueable, like the Helpers? The Flush button is nice, but it'd be so much better if we could just queue up 3 agua de vida, the mojo filter, and then the 4th agua and consume everything in one shot. The booze filter could work the same way, if you have liver, queue up the first 4 adv/super cocks, queue up the synthetic dog hair pill, add a 5th adv/super to the queue and drink everything at once.
 

lostcalpolydude

Developer
Staff member
For Daily Deeds, I would suggest adding buttons on the same line as the mojo filter button.

The list of helpers is getting kind of long, sometimes pushing things that you can actually consume out of view (without scrolling). I don't know if it's worth a checkbox (taking up more space) to toggle displaying them, but sometimes I wish they weren't shown there.
 

roippi

Developer
Okay, think I'm done with dog hair pills.

Code:
Index: src/net/sourceforge/kolmafia/swingui/panel/UseItemEnqueuePanel.java
===================================================================
--- src/net/sourceforge/kolmafia/swingui/panel/UseItemEnqueuePanel.java	(revision 9402)
+++ src/net/sourceforge/kolmafia/swingui/panel/UseItemEnqueuePanel.java	(working copy)
@@ -57,6 +57,7 @@
 import net.sourceforge.kolmafia.preferences.Preferences;
 import net.sourceforge.kolmafia.request.UseItemRequest;
 import net.sourceforge.kolmafia.request.UseSkillRequest;
+import net.sourceforge.kolmafia.session.InventoryManager;
 import net.sourceforge.kolmafia.swingui.listener.ThreadedListener;
 import net.sourceforge.kolmafia.swingui.widget.AutoFilterTextField;
 import net.sourceforge.kolmafia.utilities.InputFieldUtilities;
@@ -90,9 +91,13 @@
 		if ( this.food || this.booze )
 		{
 			listeners.add( new FamiliarFeedListener() );
+			listeners.add( new BuffUpListener() );
 		}
 
-		listeners.add( new BuffUpListener() );
+		if ( this.booze || this.spleen )
+		{	
+			listeners.add( new FlushListener() );
+		}
 
 		ActionListener [] listenerArray = new ActionListener[ listeners.size() ];
 		listeners.toArray( listenerArray );
@@ -135,11 +140,29 @@
 		}
 
 		this.setEnabled( true );
+
 		this.northPanel.add( filterPanel, BorderLayout.NORTH );
 
 		this.filterItems();
 	}
 
+	public void setEnabled( final boolean isEnabled )
+	{
+		super.setEnabled( isEnabled );
+
+		boolean havepill = InventoryManager.getCount( ItemPool.SYNTHETIC_DOG_HAIR_PILL ) > 0;
+		boolean usedpill = Preferences.getBoolean( "_syntheticDogHairPillUsed" );
+		boolean havedrunk = KoLCharacter.getInebriety() > 0;
+		
+		//we gray out the dog hair button unless 
+		//we have drunkenness, have a pill, and
+		//haven't used one today.
+		if ( this.booze )
+		{
+			this.buttons[ 4 ].setEnabled( havedrunk && ( havepill && !usedpill ) );
+		}
+	}
+
 	public AutoFilterTextField getWordFilter()
 	{
 		return new ConsumableFilterField();
@@ -331,6 +354,23 @@
 			{
 				RequestThread.postRequest( UseSkillRequest.getInstance( "The Ode to Booze", 1 ) );
 			}
+		}
+
+		public String toString()
+		{
+			return UseItemEnqueuePanel.this.food ? "use milk" : UseItemEnqueuePanel.this.booze ? "cast ode" : "" ;
+		}
+	}
+
+	private class FlushListener
+		extends ThreadedListener
+	{
+		public void run()
+		{
+			if ( UseItemEnqueuePanel.this.booze )
+			{
+				RequestThread.postRequest( new UseItemRequest( ItemPool.get( ItemPool.SYNTHETIC_DOG_HAIR_PILL, 1 ) ) );
+			}
 			else if ( UseItemEnqueuePanel.this.spleen )
 			{
 				RequestThread.postRequest( new UseItemRequest( ItemPool.get( ItemPool.MOJO_FILTER, 1 ) ) );
@@ -339,9 +379,10 @@
 
 		public String toString()
 		{
-			return UseItemEnqueuePanel.this.food ? "use milk" : UseItemEnqueuePanel.this.booze ? "cast ode" : "flush mojo";
+			return UseItemEnqueuePanel.this.food ? "" : UseItemEnqueuePanel.this.booze ? "dog hair" : "flush mojo";
 		}
-	}
+	}	
+	
 
 	private class ConsumableFilterField
 		extends FilterItemField
Index: src/net/sourceforge/kolmafia/objectpool/ItemPool.java
===================================================================
--- src/net/sourceforge/kolmafia/objectpool/ItemPool.java	(revision 9402)
+++ src/net/sourceforge/kolmafia/objectpool/ItemPool.java	(working copy)
@@ -1245,6 +1245,7 @@
 	public static final int LUNAR_ISOTOPE = 5134;
 	public static final int HONEYPOT = 5145;
 	public static final int SPOOKY_LITTLE_GIRL = 5165;
+	public static final int SYNTHETIC_DOG_HAIR_PILL = 5167;
 	public static final int TRANSPORTER_TRANSPONDER = 5170;
 	public static final int RONALD_SHELTER_MAP = 5171;
 	public static final int GRIMACE_SHELTER_MAP = 5172;
Index: src/net/sourceforge/kolmafia/request/UseItemRequest.java
===================================================================
--- src/net/sourceforge/kolmafia/request/UseItemRequest.java	(revision 9402)
+++ src/net/sourceforge/kolmafia/request/UseItemRequest.java	(working copy)
@@ -430,6 +430,15 @@
 		case ItemPool.SPICE_MELANGE:
 			UseItemRequest.limiter = "daily limit";
 			return Preferences.getBoolean( "spiceMelangeUsed" ) ? 0 : 1;
+		
+		case ItemPool.SYNTHETIC_DOG_HAIR_PILL:
+			if ( KoLCharacter.getInebriety() == 0 )
+			{
+				UseItemRequest.limiter = "need inebriety";
+				return 0;
+			}
+			UseItemRequest.limiter = "daily limit";
+			return Preferences.getBoolean( "_syntheticDogHairPillUsed" ) ? 0 : 1;
 
 		case ItemPool.BURROWGRUB_HIVE:
 			UseItemRequest.limiter = "daily limit";
@@ -3182,6 +3191,23 @@
 			}
 			return;
 
+		case ItemPool.SYNTHETIC_DOG_HAIR_PILL:
+
+			//Your liver feels better! And quivers a bit.
+			if ( responseText.indexOf( "liver can't take any more abuse" ) != -1 )
+			{
+				Preferences.setBoolean( "_syntheticDogHairPillUsed", true );
+				ResultProcessor.processResult( item );
+			}
+			else if ( responseText.indexOf( "quivers" ) != -1 )
+			{
+				KoLCharacter.setInebriety( Math.max( 0, KoLCharacter.getInebriety() - 1 ) );
+				Preferences.setBoolean( "_syntheticDogHairPillUsed", true );
+				KoLCharacter.updateStatus();
+				ConcoctionDatabase.getUsables().sort();
+			}
+			return;
+
 		case ItemPool.MILK_OF_MAGNESIUM:
 
 			ConcoctionDatabase.getUsables().sort();
Index: src/data/defaults.txt
===================================================================
--- src/data/defaults.txt	(revision 9402)
+++ src/data/defaults.txt	(working copy)
@@ -689,6 +689,7 @@
 user	_skateBuff5	false
 user	_stinkyCheeseCount	0
 user	_stressBallSqueezes	0
+user	_syntheticDogHairPillUsed	false
 user	_madTeaParty	false
 user	_timeHelmetAdv	0
 user	_toastSummons	0

This should add a button on UseItemEnqueuePanel for dog hair pills. The button is greyed out unless we have drunk, have a pill, and have not used one today.

Messing with the helper code is beyond me, so I'll leave the distention pill up to others. :)
 

roippi

Developer
Trying for distention pill now.

Code:
Index: src/net/sourceforge/kolmafia/persistence/ConcoctionDatabase.java
===================================================================
--- src/net/sourceforge/kolmafia/persistence/ConcoctionDatabase.java	(revision 9485)
+++ src/net/sourceforge/kolmafia/persistence/ConcoctionDatabase.java	(working copy)
@@ -621,7 +621,7 @@
 		int consumpt = ItemDatabase.getConsumptionType( id );
 
 		if ( c.getFullness() > 0 || consumpt == KoLConstants.CONSUME_FOOD_HELPER ||
-			id == ItemPool.MUNCHIES_PILL )
+			id == ItemPool.MUNCHIES_PILL || id == ItemPool.DISTENTION_PILL )
 		{
 			queuedChanges = ConcoctionDatabase.queuedFoodChanges;
 			queuedIngredients = ConcoctionDatabase.queuedFoodIngredients;
Index: src/net/sourceforge/kolmafia/swingui/widget/ListCellRendererFactory.java
===================================================================
--- src/net/sourceforge/kolmafia/swingui/widget/ListCellRendererFactory.java	(revision 9485)
+++ src/net/sourceforge/kolmafia/swingui/widget/ListCellRendererFactory.java	(working copy)
@@ -243,6 +243,10 @@
 			
 			switch ( item.getItemId() )
 			{
+			case ItemPool.DISTENTION_PILL:
+				stringForm.append( "-1 full from next food eaten" );
+				break;
+
 			case ItemPool.MUNCHIES_PILL:
 				stringForm.append( "+1-3 adv from next food eaten" );
 				break;
Index: src/net/sourceforge/kolmafia/swingui/panel/UseItemDequeuePanel.java
===================================================================
--- src/net/sourceforge/kolmafia/swingui/panel/UseItemDequeuePanel.java	(revision 9485)
+++ src/net/sourceforge/kolmafia/swingui/panel/UseItemDequeuePanel.java	(working copy)
@@ -251,8 +251,15 @@
 					return true;
 				}
 				break;
+				
+			case KoLConstants.CONSUME_USE:
+				if ( UseItemDequeuePanel.this.food &&
+					creation.getItemId() == ItemPool.DISTENTION_PILL )
+				{
+					return true;
+				}
+				break;	
 			}
-
 			return false;
 		}
 	}
Index: src/net/sourceforge/kolmafia/swingui/panel/UseItemEnqueuePanel.java
===================================================================
--- src/net/sourceforge/kolmafia/swingui/panel/UseItemEnqueuePanel.java	(revision 9485)
+++ src/net/sourceforge/kolmafia/swingui/panel/UseItemEnqueuePanel.java	(working copy)
@@ -459,6 +459,17 @@
 					return super.isVisible( element );
 				}
 				
+			case KoLConstants.CONSUME_USE:
+				if ( !UseItemEnqueuePanel.this.food || 
+					creation.getItemId() != ItemPool.DISTENTION_PILL )
+				{
+					return false;
+				}
+				else
+				{
+					return super.isVisible( element );
+				}
+				
 			default:
 				return false;
 			}
Index: src/net/sourceforge/kolmafia/swingui/panel/ItemManagePanel.java
===================================================================
--- src/net/sourceforge/kolmafia/swingui/panel/ItemManagePanel.java	(revision 9485)
+++ src/net/sourceforge/kolmafia/swingui/panel/ItemManagePanel.java	(working copy)
@@ -961,7 +961,8 @@
 					// are marked as expected.
 
 					isVisibleWithFilter = FilterItemField.this.other;
-					if ( name.equalsIgnoreCase( "milk of magnesium" ) || name.equalsIgnoreCase( "munchies pills" ) )
+					if ( name.equalsIgnoreCase( "milk of magnesium" ) || name.equalsIgnoreCase( "munchies pills" ) 
+								|| name.equalsIgnoreCase( "distention pill" ) );
 					{
 						isVisibleWithFilter |= FilterItemField.this.food;
 					}
Index: src/net/sourceforge/kolmafia/objectpool/ItemPool.java
===================================================================
--- src/net/sourceforge/kolmafia/objectpool/ItemPool.java	(revision 9485)
+++ src/net/sourceforge/kolmafia/objectpool/ItemPool.java	(working copy)
@@ -1260,6 +1260,7 @@
 	public static final int HONEYPOT = 5145;
 	public static final int SPOOKY_LITTLE_GIRL = 5165;
 	public static final int SYNTHETIC_DOG_HAIR_PILL = 5167;
+	public static final int DISTENTION_PILL = 5168;
 	public static final int TRANSPORTER_TRANSPONDER = 5170;
 	public static final int RONALD_SHELTER_MAP = 5171;
 	public static final int GRIMACE_SHELTER_MAP = 5172;
Index: src/net/sourceforge/kolmafia/request/UseItemRequest.java
===================================================================
--- src/net/sourceforge/kolmafia/request/UseItemRequest.java	(revision 9485)
+++ src/net/sourceforge/kolmafia/request/UseItemRequest.java	(working copy)
@@ -439,6 +439,19 @@
 			}
 			UseItemRequest.limiter = "daily limit";
 			return Preferences.getBoolean( "_syntheticDogHairPillUsed" ) ? 0 : 1;
+			
+		case ItemPool.DISTENTION_PILL:
+			boolean stomachAvailable = ( KoLCharacter.getFullnessLimit() - KoLCharacter.getFullness() ) > 0;
+			
+			//The distention pill is not usable when you're full.
+			//Even if you plan on eating a 1-full food.
+			if ( !stomachAvailable )
+			{
+				UseItemRequest.limiter = "remaining fullness";
+				return 0;
+			}
+			UseItemRequest.limiter = "daily limit";
+			return Preferences.getBoolean( "_distentionPillUsed" ) ? 0 : 1;
 
 		case ItemPool.BURROWGRUB_HIVE:
 			UseItemRequest.limiter = "daily limit";
@@ -3206,6 +3219,23 @@
 				ConcoctionDatabase.getUsables().sort();
 			}
 			return;
+			
+		case ItemPool.DISTENTION_PILL:
+			
+			//Your stomach feels rather stretched out
+			if ( responseText.indexOf( "stomach feels rather stretched" ) != -1 )
+			{
+				Preferences.setBoolean( "_distentionPillUsed", true );
+				Preferences.setBoolean( "_distentionPillActive", true );
+				ConcoctionDatabase.getUsables().sort();
+			}
+			else if ( responseText.indexOf( "stomach can't take any more abuse" ) != -1 )
+			{
+				Preferences.setBoolean( "_distentionPillUsed", true );
+				KoLCharacter.updateStatus();
+				ConcoctionDatabase.getUsables().sort();
+			}
+			return;
 
 		case ItemPool.MILK_OF_MAGNESIUM:
 
@@ -4273,7 +4303,17 @@
 				count = maxcount;
 				UseItemRequest.lastItemUsed = UseItemRequest.lastItemUsed.getInstance( maxcount );
 			}
-			Preferences.increment( "currentFullness", fullness * count );
+			if ( Preferences.getBoolean( "_distentionPillActive" ) == true)
+			{
+				Preferences.increment( "currentFullness", fullness * count - 1 );
+				RequestLogger.printLine( "Incrementing fullness by " + (fullness * count - 1) 
+					+ " instead of " + ( fullness * count) + " because your stomach was distended.");
+				Preferences.setBoolean( "_distentionPillActive", false );
+			}
+			else
+			{
+				Preferences.increment( "currentFullness", fullness * count );
+			}
 			Preferences.setInteger( "munchiesPillsUsed", Math.max( Preferences.getInteger( "munchiesPillsUsed" ) - count, 0 ) );
 			break;
 		}
Index: src/data/defaults.txt
===================================================================
--- src/data/defaults.txt	(revision 9485)
+++ src/data/defaults.txt	(working copy)
@@ -661,6 +661,8 @@
 user	_chipBags	0
 user	_crimboTree	false
 user	_deluxeKlawSummons	0
+user	_distentionPillActive	false
+user	_distentionPillUsed	false
 user	_fingertrapArrows	0
 user	_gapBuffs	0
 user	_gibbererAdv	0

This is somewhat unsatisfying to me. It works but is implemented in a way similar to munchies pills (that is, implement special case so it doesn't get filtered out of UseItemEnqueuePanel), which feels like "legacy" behavior.

I spent a good amount of time trying to call it a food helper but I just couldn't wrap my brain around how those work. It's fine if there's a better way to implement this, I just need a nudge in the right direction.
 

Veracity

Developer
Staff member
Well...if it is closer in behavior to a munchies pill than to a salad fork, say, then I see no problem with implementing it like the munchies pill. Now that we have two special cases, perhaps it is time to figure out how to generalize both of them into food helpers. Or perhaps we can put that off to another time. :)

How does your solution "feel" to you operationally, regardless of how you feel about the implementation?
 

roippi

Developer
Well...if it is closer in behavior to a munchies pill than to a salad fork, say, then I see no problem with implementing it like the munchies pill. Now that we have two special cases, perhaps it is time to figure out how to generalize both of them into food helpers. Or perhaps we can put that off to another time. :)

How does your solution "feel" to you operationally, regardless of how you feel about the implementation?

It's definitely functionally more similar to a munchies pill. You can eat one, log off, log back on, eat food. No AJAX or menus involved.

Operationally, I've tested it a grand total of one times. I closed my session and the log doesn't capture all of the CLI output (hm. probably should add a RequestLogger.updateSessionLog() for the message that I added), but:

Code:
use 1 distention pill

eat 2 tasty tart
You gain 6 Adventures
You gain 5 Muscleboundness
You gain 5 Enchantedness
You gain 5 Roguishness
You gain 7 Adventures
You gain 6 Strengthliness
You gain 6 Mysteriousness
You gain 6 Roguishness
You lose some of an effect: Got Milk
> _distentionPillActive (user, now 'false', default false)
> _distentionPillUsed (user, now 'true', default false)

.. and fullness only went up by 1; there's a line telling you that in the CLI.

What worries me is all the weird interactions that are possible. Distention && salad fork, distention && munchies && salad fork, distention && 0-fullness food, etc. I have tested none of them.
 

roippi

Developer
Actually I just noticed this on the wiki:

* Your next consumption includes the message:

"You feel your stomach shrink back to normal size. "

We should check for that. Actually, that could completely obviate the need for a _distentionPillActive user preference.
 
Top