Feature - Implemented add your own black heart to restores

Fluxxdog

Active member
Uh, yeah. Title says it all. As far as limits go, I haven't found any and I've gone well over 1000.
 

Veracity

Developer
Staff member
Do you want it to appear on the "Restore Items" list (the one that is in the same section as Booze/Food/Spleen on the Item Manager)? That is possible, although I might prefer to wait on this until we can include additional annotations to items on that panel, such as appear on the other three that I mentioned. E.g., expected restoration ranges and such.

The fact that it is untradeable doesn't bother me so much since that means that if you have one, you KNOW how you got it.

If you want to add it to the restore items that you can select via the HP/MP restoration panel, which means it is available for automatic usage by KoLmafia, I'll say no.
 

Bale

Minion
Ah. I was assuming he meant the second thing you mention. If he meant the first, then this request seems quite reasonable. He must have meant the usable restores list, not the HP/MP "use these restores" list.

Troublesomely vague feature request wording.
 

Fluxxdog

Active member
Definitely the first, though I'm unsure what annotations you mean. Do you need data or is there reformatting to be done? Inquiring minds want to know ^^
 

Darzil

Developer
I'm pretty sure both ultimately end up looking at the same data in the end. MPRestoreItemList and HPRestoreItemList. These show everything, so at present in order to achieve this we have to add it to the restore lists, albeit unticked so Mafia won't use them automatically.

Given those lists are getting pretty unwieldy, I guess we could do with a restores.txt data file, with fields perhaps of name, hp restored (range), mp restored (range), in_combat?. Then maybe an extra preference, which lists the names of those which can appear in the "use these restores", so we can make that list configurable.

However, that's a significant change, so maybe for now we should just add it unticked ?
 

Fluxxdog

Active member
Given those lists are getting pretty unwieldy, I guess we could do with a restores.txt data file, with fields perhaps of name, hp restored (range), mp restored (range), in_combat?. Then maybe an extra preference, which lists the names of those which can appear in the "use these restores", so we can make that list configurable.
Honestly, the hardcoded lists were a surprise. My first thought was that they were in a .txt data file.
 

slyz

Developer
Something like this?

Universal recovery is widely used, I bet people think its recoveryScript_map_v2.txt is part of Mafia :)
 

Veracity

Developer
Staff member
I'm pretty sure both ultimately end up looking at the same data in the end. MPRestoreItemList and HPRestoreItemList.
I'm pretty sure that's not true.

swingui/panels/RestorativeItemsPanel:

Code:
	public RestorativeItemPanel()
	{
		super( "use item", "check wiki", KoLConstants.inventory, new boolean[] {false, true} );
		this.filterItems();
	}
The Restorative Items Panel shows you everything in your inventory…

Code:
	private class RestorativeItemFilterField
		extends FilterItemField
	{
		@Override
		public boolean isVisible( final Object element )
		{
			AdventureResult item = (AdventureResult) element;
			int itemId = item.getItemId();

			switch ( ItemDatabase.getConsumptionType( itemId ) )
			{
			case KoLConstants.MP_RESTORE:
			case KoLConstants.HP_RESTORE:
			case KoLConstants.HPMP_RESTORE:
				if ( KoLCharacter.inBeecore() && KoLCharacter.hasBeeosity( item.getName() ) )
				{
					return false;
				}
				return super.isVisible( element );

			default:
				return false;
			}
		}
	}
… That is an HP, MP or HP/MP restore item. It pays no attention whatsoever to the HPRestoreItemList and MPRestoreItemList, which are hardcoded data structures that determine what is available in the HP/MP Usage panel of the Adventure Frame for use in KoLmafia's built-in restoration.

In order for "your own black heart" to appear in the "Restoratives" list, all we have to do is change its usage from "usable" to "hpmp" in items.txt.

I wrote this Feature Request more than two years ago suggesting that we provide more details of restoration items in the Restoratives panel. Obviously, that would best be done with having them in a data file, preferably with the range of HP and/or MP that are restored and a notes field for additional annotations.

These show everything, so at present in order to achieve this we have to add it to the restore lists, albeit unticked so Mafia won't use them automatically.
Not so. We have to manually add things to the HP and MP restoration list to have them appear in the HP/MP Usage panel. We have had many bug reports over the years about things not appearing there.

Given those lists are getting pretty unwieldy, I guess we could do with a restores.txt data file, with fields perhaps of name, hp restored (range), mp restored (range), in_combat?.
And a notes field. And the data from this file could be used to satisfy my Feature Request.

Then maybe an extra preference, which lists the names of those which can appear in the "use these restores", so we can make that list configurable.
Given the file, we can build the HP and MP lists at runtime, sorted by "most restored" down to "least restored", as the hard-coded lists are right now. The additional preference could be used to say "exclude these from the list" - although if everything starts out unticked (as now), I'm not sure that is necessary.

In any case, as I said, in order to get this item on the Restoratives panel, all we have to do is change its usage in items.txt. Souping up the display of that panel and making the restorative go into a data file are additional feature requests - which go hand in hand.
 

Veracity

Developer
Staff member
Something like this?
Yes, something like that, but with the last two columns omitted (they seem to be the "average hp restored" and "average mp restored" - which is to say, they are trivially calculated from other fields) and a "notes" field added.
 

Darzil

Developer
… That is an HP, MP or HP/MP restore item. It pays no attention whatsoever to the HPRestoreItemList and MPRestoreItemList, which are hardcoded data structures that determine what is available in the HP/MP Usage panel of the Adventure Frame for use in KoLmafia's built-in restoration.

Agreed, but the values they restore do come from those lists, so if you (currently) want them to have values in the restore panel, they have to be there.

Seems like a good project.
 

Darzil

Developer
This does now appear in restores, with expected hp restore values when not used, and with no values once used.
It does not appear in the choices that are used for KoLmafia's built-in restoration.
 

Veracity

Developer
Staff member
Why the "no values once used"? Is this a once per day thing? A once per ascension thing?

Or are you signaling that this is a "heals you fully" item and if you are completely full, it is of no benefit? Sort of like scroll of drastic healing, eh? What does THAT show if you are currently fully healed?
 

Darzil

Developer
It was clearly too late last night, I was confused with Heart of Dark Chocolate, which acts like that as a once a day thing.
 

Darzil

Developer
Yeah, working on that along with other changes at present. There will be a new version of restores.txt which will include columns for adv cost, daily uses remaining and notes. That means the restores will return the right values even if they cannot currently be used.
 

Fluxxdog

Active member
Quick note: As of 14063, this is mostly implemented, but the line in restores.txt needs a change. It should be:
Code:
your own black heart		item	[HP]	[HP]	[MP]	[MP]	0
Once changed, I think you can mark this Implemented for good.
 
Top