Bug - Fixed Single-use items bought from the mall one at a time

stannius

Member
gCLI said:
> use 8 l root

Searching for "licorice root"...
Search complete.
Purchasing licorice root (1 @ 1,000)...
You acquire an item: licorice root
Purchases complete.
Using licorice root (1 of 8)...
You acquire an effect: Rootin' Around (duration: 20 Adventures)
Using cached search results for licorice root...
Purchasing licorice root (1 @ 1,000)...
You acquire an item: licorice root
Purchases complete.
Using licorice root (2 of 8)...
You acquire an effect: Rootin' Around (duration: 20 Adventures)
Using cached search results for licorice root...
Purchasing licorice root (1 @ 1,000)...
You acquire an item: licorice root
Purchases complete.
Using licorice root (3 of 8)...
You acquire an effect: Rootin' Around (duration: 20 Adventures)
Using cached search results for licorice root...
Purchasing licorice root (1 @ 1,000)...
You acquire an item: licorice root
Purchases complete.
Using licorice root (4 of 8)...
You acquire an effect: Rootin' Around (duration: 20 Adventures)
Using cached search results for licorice root...
Purchasing licorice root (1 @ 1,000)...
You acquire an item: licorice root
Purchases complete.
Using licorice root (5 of 8)...
You acquire an effect: Rootin' Around (duration: 20 Adventures)
Using cached search results for licorice root...
Purchasing licorice root (1 @ 1,000)...
You acquire an item: licorice root
Purchases complete.
Using licorice root (6 of 8)...
You acquire an effect: Rootin' Around (duration: 20 Adventures)
Using cached search results for licorice root...
Purchasing licorice root (1 @ 1,000)...
You acquire an item: licorice root
Purchases complete.
Using licorice root (7 of 8)...
You acquire an effect: Rootin' Around (duration: 20 Adventures)
Using cached search results for licorice root...
Purchasing licorice root (1 @ 1,000)...
You acquire an item: licorice root
Purchases complete.
Using licorice root (8 of 8)...
You acquire an effect: Rootin' Around (duration: 20 Adventures)
Finished using 8 licorice root.
 

slyz

Developer
Not a bug per say, I'll switch this to a Feature Request. I guess it would save server hits to retrieve the items before starting to single use them.
 

Veracity

Developer
Staff member
We call retrieve_item() in UseItemRequest.useOnce(), which is called once per iteration. For things that you can use multiple, there will be one iteration.

Note that that is also called for any sort of usage - including drinking booze and using spleen items.

If I say "use 1000 twinkly wad", do you want us to go to the mall and buy 1000 of them and then use 15 of them?
Suppose there is a single-use item which has some other limit on it, which we only detect via a consumption failure message. Should we buy 100 of them (or whatever you ask for) and then use them one at time, giving up after 30, say, leaving 70 in inventory?

Just pointing out that this is not necessarily a trivial change - or necessarily always a good thing.
 

holatuwol

Developer
I think the logic is that way for drinks using tiny plastic swords, where using it actually gives you one of its ingredients back and that ingredient is super expensive.
 

stannius

Member
Just trying to save a few server hits. No skin off my nose either way. I didn't realize it would be tough to implement.
 

Veracity

Developer
Staff member
I think the logic is that way for drinks using tiny plastic swords, where using it actually gives you one of its ingredients back and that ingredient is super expensive.
I've investigated this and I discovered the following (rewritten slightly for clarity):

Code:
		if ( this.consumptionType != KoLConstants.INFINITE_USES &&
		     ItemDatabase.getPriceById( itemId ) != 0 &&
		     !UseItemRequest.sequentialConsume( itemId ) &&
		     !InventoryManager.retrieveItem( this.itemUsed ) )
		{
			return;
		}
This is in front of the useOnce loop.

If the item is sequentially consumed (like a TPS drink) or can be used infinitely, we do not retrieve it before the loop. Instead, useOnce calls retrieveItem, which will get one into inventory, somehow.

licorice root is excluded because of the price check. For some reason, we do not try to retrieve items with an autosell price of 0 - like licorice root. I believe that is a vestige of the past where we excluded such things since they tended to be expensive. Now, we have autoBuyPriceLimit and buy scripts and such to manage that. I believe we can simply remove the "price != 0" check. I'll do that, by and by.

This bug report could have been more accurately titled "licorice root bought from the mall one at a time" rather than generalizing it to "single-use items bought from the mall one at a time". You want to generalize? "single use items with no autosell price bought from the mall one at a time."
 
Top