There is an interesting setup in the Mall right now regarding candies that are useful for "Synthesis: Greed" - Meat Drop +300%.
fruitfilm:
460 limit 5 @ 1,000 - Hoop Dreams
1189 @ 19,990 - Malibu Stacey's Dream House
Gummi-DNA:
356 limit 5 @ 1,490 - Hoop Dreams
615 @ 9,190 - Malibu Stacey's Dream House
Note synthesizing with those two candies costs 2,490 for the first five casts - and then 29,180 for any more than five.
That first price happens to be the most cost effective pairing. The second one, not so much.
For some reason, even when I synthesize one cast at a time, the synthesize() function wants to keep using that candy pairing - and after five casts it gets Very Expensive. You are welcome, Malibu Stacey; your shop cleaned up from me today.
This is with a freshly logged in character who has visited the "cheap" store five times in a previous login today.
1) Notice that it used cached mall prices without checking.
2) Notice that had it checked, it would have found a different pairing.
CandyDatabase's constructor for a Candy object uses MallPriceDatabase.getPrice(itemId) to get the lowest price.
Here is a character casting Sweet Synthesis the first time:
Notice that it checked the mall price...
Here are 4 more times:
Notice that it knew which shops to buy from.
Here are 2 more casts:
Notice that it continued to try to buy from the cheap stores and when they failed, moved to the expensive stores.
1) When you've bought out a store, that store's price is not necessarily the cheapest any more.
2) In fact, that candy may no longer be part of the cheapest pair of candies for the desired effect.
If I don't want to keep giving Malibu Stacey millions of Meat, I'm going to have to figure out where and how to deal with this.
Perhaps MallPriceDatabase should update its cache when you buy your limit at a store? Somehow.
Pondering.
fruitfilm:
460 limit 5 @ 1,000 - Hoop Dreams
1189 @ 19,990 - Malibu Stacey's Dream House
Gummi-DNA:
356 limit 5 @ 1,490 - Hoop Dreams
615 @ 9,190 - Malibu Stacey's Dream House
Note synthesizing with those two candies costs 2,490 for the first five casts - and then 29,180 for any more than five.
That first price happens to be the most cost effective pairing. The second one, not so much.
For some reason, even when I synthesize one cast at a time, the synthesize() function wants to keep using that candy pairing - and after five casts it gets Very Expensive. You are welcome, Malibu Stacey; your shop cleaned up from me today.

This is with a freshly logged in character who has visited the "cheap" store five times in a previous login today.
Code:
> ash sweet_synthesis_pair( $effect[ Synthesis: Greed ] )
Returned: aggregate item [2]
0 => fruitfilm
1 => Gummi-DNA
> ash mall_price( $item[ fruitfilm] )
Searching for "fruitfilm"...
Search complete.
Returned: 19990
> ash sweet_synthesis_pair( $effect[ Synthesis: Greed ] )
Returned: aggregate item [2]
0 => Crimbo fudge
1 => Gummi-DNA
> ash mall_price( $item[ Gummi-DNA ] )
Searching for "Gummi-DNA"...
Search complete.
Returned: 9190
> ash sweet_synthesis_pair( $effect[ Synthesis: Greed ] )
Returned: aggregate item [2]
0 => Crimbo fudge
1 => strawberry-flavored Hob-O
1) Notice that it used cached mall prices without checking.
2) Notice that had it checked, it would have found a different pairing.
CandyDatabase's constructor for a Candy object uses MallPriceDatabase.getPrice(itemId) to get the lowest price.
Code:
update_candy_prices();
...
// Do it one cast at a time, since candy costs can vary widely
while ( synthesis_casts-- > 0 ) {
sweet_synthesis( 1, synthesis_target, flags );
spleen -= 1;
}
Here is a character casting Sweet Synthesis the first time:
Code:
mall.php?category=allitems&consumable_byme=0&weaponattribute=3&wearable_byme=0&nolimits=0&max_price=0&sortresultsby=price&justitems=0&x_cheapest=0&pudnuggler=%22fruitfilm%22
buy 1 fruitfilm for 1000 each from shop #3483633 on 20211214
mall.php?category=allitems&consumable_byme=0&weaponattribute=3&wearable_byme=0&nolimits=0&max_price=0&sortresultsby=price&justitems=0&x_cheapest=0&pudnuggler=%22Gummi-DNA%22
buy 1 Gummi-DNA for 1490 each from shop #3483633 on 20211214
cast 1 Sweet Synthesis
synthesize 1 fruitfilm, Gummi-DNA
You acquire an effect: Synthesis: Greed (30)
Here are 4 more times:
Code:
buy 1 fruitfilm for 1000 each from shop #3483633 on 20211214
buy 1 Gummi-DNA for 1490 each from shop #3483633 on 20211214
cast 1 Sweet Synthesis
synthesize 1 fruitfilm, Gummi-DNA
You acquire an effect: Synthesis: Greed (30)
buy 1 fruitfilm for 1000 each from shop #3483633 on 20211214
buy 1 Gummi-DNA for 1490 each from shop #3483633 on 20211214
cast 1 Sweet Synthesis
synthesize 1 fruitfilm, Gummi-DNA
You acquire an effect: Synthesis: Greed (30)
buy 1 fruitfilm for 1000 each from shop #3483633 on 20211214
buy 1 Gummi-DNA for 1490 each from shop #3483633 on 20211214
cast 1 Sweet Synthesis
synthesize 1 fruitfilm, Gummi-DNA
You acquire an effect: Synthesis: Greed (30)
buy 1 fruitfilm for 1000 each from shop #3483633 on 20211214
buy 1 Gummi-DNA for 1490 each from shop #3483633 on 20211214
cast 1 Sweet Synthesis
synthesize 1 fruitfilm, Gummi-DNA
You acquire an effect: Synthesis: Greed (30)
Here are 2 more casts:
Code:
buy 1 fruitfilm for 1000 each from shop #3483633 on 20211214
buy 1 fruitfilm for 19990 each from shop #2705901 on 20211214
buy 1 Gummi-DNA for 1490 each from shop #3483633 on 20211214
buy 1 Gummi-DNA for 9190 each from shop #2705901 on 20211214
cast 1 Sweet Synthesis
synthesize 1 fruitfilm, Gummi-DNA
You acquire an effect: Synthesis: Greed (30)
buy 1 fruitfilm for 1000 each from shop #3483633 on 20211214
buy 1 fruitfilm for 19990 each from shop #2705901 on 20211214
buy 1 Gummi-DNA for 1490 each from shop #3483633 on 20211214
buy 1 Gummi-DNA for 9190 each from shop #2705901 on 20211214
cast 1 Sweet Synthesis
synthesize 1 fruitfilm, Gummi-DNA
You acquire an effect: Synthesis: Greed (30)
1) When you've bought out a store, that store's price is not necessarily the cheapest any more.
2) In fact, that candy may no longer be part of the cheapest pair of candies for the desired effect.
If I don't want to keep giving Malibu Stacey millions of Meat, I'm going to have to figure out where and how to deal with this.
Perhaps MallPriceDatabase should update its cache when you buy your limit at a store? Somehow.
Pondering.