Feature - Implemented Fullness and potency of new foods and drinks

slyz

Developer
February 05, 2013 - Food and non-booze beverages now show their size in their descriptions. Not that non-booze beverages are of any interest to anybody.
All foods now have their "Size" indicated in their description. Booze have their "Potency".

Here is a patch that parses those values when an unknown item is registered. It also adds a line containing the fullness.txt or inebriety.txt entry to the info Mafia prints about the new item:
Code:
Unknown item found: black forest ham (2343, 332243935)
--------------------
2343 black forest ham 332243935 ham.gif food t,d 40
black forest ham 3 7 good 0 0 0 0
# black forest ham
--------------------

> ash $item[ black forest ham ]

Returned: black forest ham
plural => black forest hams
descid => 332243935
image => ham.gif
levelreq => 7
quality => good
adventures => 0
muscle => 0
mysticality => 0
moxie => 0
fullness => 3
inebriety => 0
spleen => 0
notes => unkown adventure yield
quest => false
gift => false
tradeable => true
discardable => true
combat => false
reusable => false
usable => false
multi => false
fancy => false
candy => false
bounty => none
bounty_count => 0
seller => none
buyer => none
name_length => 0

> eatsilent 1 black forest ham

Eating 1 black forest ham...
You gain 9 Adventures
You gain 43 Fortitude
Finished eating 1 black forest ham.
The adventure and stat ranges are set to 0, but I think the output could be helpful for devs nonetheless.

The other goal of this patch was to make the food/booze immediately available for the player to consume. This works with CLI commands, as the log shows.

However, I can't figure out how to make the new item appear in the Food panel of the ItemManager. I'm guessing it should somehow be added to ConcoctionDatabase.usableList, but I don't see how this is supposed to happen, appart from having the item in the data file when Mafia is launched.

I hope another dev more familiar with this part of Mafia (Roippi?) can help out.
 

Attachments

  • new_food_booze.patch
    4.4 KB · Views: 38

lostcalpolydude

Developer
Staff member
I'm pretty sure this would result in more entries never being updated from 0 adventures in fullness/inebriety.txt, since checkitems won't catch them. Maybe there's another check command that covers that though.
 

roippi

Developer
I'm pretty sure this would result in more entries never being updated from 0 adventures in fullness/inebriety.txt, since checkitems won't catch them. Maybe there's another check command that covers that though.

That's an issue, but more with checkitems than with the proposed patch. We could, say, maintain a parallel "temp" LockableListModel with these items in it so that we could know which are still missing from the datafile, and have checkitems report on those. Or something.

@slyz yeah, looks like there's no method that adds to ConcoctionDatabase.usableList outside of the initialization block right now, but that's just a ~10 line static accessory method that needs to be added. The only tricky part is concatenating all of the various strings and ints you have into a new Concoction.
 

Darzil

Developer
If it's any help, I like the idea of entries appearing with 0 adventures fullness/drunk in the lists, as it'd encourage me to gets my alts to spade them.
 

slyz

Developer
I'm pretty sure this would result in more entries never being updated from 0 adventures in fullness/inebriety.txt, since checkitems won't catch them.
Having a fullness.txt/inebriety.txt line printed out is mostly a side effect, it doesn't mean we have to rush in an add it as-is to our data files.

The goal of this patch is actually the opposite: letting users eat new food/booze automatically, so we can wait until the adventure range is known before adding it to the data file.

I played around a bit with checkitems too (checkconsumables, actually... maybe it would be easier with checkitems), but I still need to find a satisfying way to handle pseudo items that are consumables but don't appear in the data files.

@slyz yeah, looks like there's no method that adds to ConcoctionDatabase.usableList outside of the initialization block right now, but that's just a ~10 line static accessory method that needs to be added. The only tricky part is concatenating all of the various strings and ints you have into a new Concoction.
I'll try that then. I guess it should be done in ItemDatabase.registerItem(), when a new Concoction is created for the item.
 

roippi

Developer
Just noticed that api.php?what=item now has a "plural" key/value. Wonder when that happened.

edit: oh, it only appears when you have more than one of the thing. That seems.. if not buggy, then poorly featured. I'll see if CDM can just make it always be there.
 
Last edited:

Rinn

Developer
We could probably set the adventure range to the minimum for that quality of consumable, so it sorts somewhat correctly in the list.
 

slyz

Developer
I think they are easier to find if they stay at 0 and always stay at the bottom of the list.
 

lostcalpolydude

Developer
Staff member
Strangely, this almost makes it inconvenient to have food/booze added to items.txt without it being in fullness/inebriety.txt, because then you once again get to the situation where it isn't in the Food/Booze section of the Item Manager when you have one. That's how things have always been, but it kind of seems like a missing feature when compared with an item mafia knows nothing about.
 

slyz

Developer
I think we can add food/booze to the list when we meet them in items.txt, then fill up the details (size, level, adventure range etc...) as we go through the other data files.

Maybe I can look at this over the next two weekends? Now I know what a perpetual 2 week deadline feels like! :)
 
Top