Bug - Fixed Inconsistencies in Worthless Items - retrieve_item and available_amount

Theraze

Active member
Noticed some weirdness tied into worthless items. Two things. First, in this quote, if you try to retrieve a specific worthless item type, mafia won't retrieve it automatically or fall over to other worthless types.
> ash retrieve_item(1, $item[worthless trinket])

Returned:
true

> ash retrieve_item(2, $item[worthless
trinket])


You need 1 more worthless
trinket to continue.

Returned: false

>
ash retrieve_item(2, $item[worthless item])


Purchasing chewing gum on
a string (1 @ 50)...
You acquire an item: chewing gum on a string
You
spent 50 Meat
Purchases complete.
Placing items into closet...
Using
1 chewing gum on a string...
You acquire an item: ravioli hat
Finished
using 1 chewing gum on a string.
Purchasing chewing gum on a string (1
@ 50)...
You acquire an item: chewing gum on a string
You spent 50
Meat
Purchases complete.
Using 1 chewing gum on a string...
You
acquire an item: worthless trinket
Finished using 1 chewing gum on a
string.
Removing items from closet...
You acquire an item: worthless
trinket
Returned: true
Second is that available amount on worthless items completely ignores them...
> ash retrieve_item(3, $item[worthless item])

Returned:
true

> ash available_amount($item[worthless
item])


Returned: 0

> ash
item_amount($item[worthless item])


Returned: 0

>
inv worthless


worthless gewgaw
worthless trinket (2)

The second bug is definitely more worrying when trying to plan things out. The first one could be considered a feature, and if you'd like that to be made as a separate FReq, I can do that. The second, having mafia claim you don't have any worthless items though retrieve_item works on it, definitely seems like a bug rather than a 'feature'. Apologies if I'm completely miscategorized this thread though. :)
 

slyz

Developer
"worthless item" is a pseudo-item that Mafia creates itself to simplify some handling. InventoryManager.retrieveItem() knows how to handle it, and that is the function called by retrieve_item(). Other parts of Mafia, like ConcoctionDatabase or the GoalManager know how to handle it.

The parts of mafia that are used by available_amount() and item_amount() don't know how to count the "worthless item" item, since you never actually have any in your inventory/closet.

I guess you should use some ash function to count worthless items:
PHP:
int num_trinkets()
{
    return item_amount($item[worthless trinket]) + item_amount($item[worthless gewgaw]) +  item_amount($item[worthless knick-knack]) ;
}
for example (replace item_amount() with available_amount() if you want to count the closeted ones too.

Of course, with the advent of $coinmaster[], you can now use
PHP:
int num_trinkets()
{
      return $coinmater[ hermit ].available_tokens;
}
(although that doesn't count the worthless items in your closet).
 

Veracity

Developer
Staff member
If you try to retrieve a specific worthless item type, mafia won't retrieve it automatically or fall over to other worthless types.
Why would you want to do that?

The first one could be considered a feature, and if you'd like that to be made as a separate FReq, I can do that.
Feel free to do that. Explain exactly why it is important to get a particular type of worthless item. If you can't make a good enough case, we'll just reject it. :)
 

Veracity

Developer
Staff member
Revision 9660 makes available_amount() and retrieve_item() agree wrt $item[worthless item ].

Which is to say, both of them look only in inventory and will use chewing gum to get more if needed.

If you want worthless item retrieval to pull from storage and obey autosatisfywith closet, et all, that's a different feature request.
 

Theraze

Active member
I didn't actually want/need the specific WI retrieval, I was just trying to come up with something that worked for both retrieve_item and available_amount. As the pseudo-item works for RI, I thought it should work for AA as well. As the real item works for AA, I thought it should work for RI as well. If I did make the FReq, it would be to make RI on a specific worthless consider all worthless for that purpose instead...

Basically, I want to be able to do available_amount($item[<some coinmaster item>].seller.item) and have it, well, work. I think it currently should work on all coinmaster-sold items except for the hermit, and that's the part that was weird. :)

Thanks for the update! I'll make a new FReq to make available_amount consider the other locations that retrieve_item would normally check. :) I'll try to word it properly though. So I suppose this can get closed, and I'll work on creating a proper new FReq?
 

slyz

Developer
Just as a heads up: available_amount( $item[ worthless item ] ) will work now, but not item_amount( $item[ worthless item ] ) or closet_amount( $item[ worthless item ] ).
 
Top