Probably want to do something like:
Code:
int totalprice;
totalprice += historical_price($item[prismatic wad]) * max(0, 34 - available_amount($item[prismatic wad]));
totalprice += historical_price($item[mojo filter]) * max(0, 3 - available_amount($item[mojo filter]));
totalprice += historical_price($item[munchies pill]) * max(0, 5 - available_amount($item[munchies pill]));
totalprice += historical_price($item[ol' scratch's salad fork]) * max(0, 5 - available_amount($item[ol' scratch's salad fork]));
totalprice += historical_price($item[frosty's frosty mug]) * max(0, 6 - available_amount($item[frosty's frosty mug]));
totalprice += historical_price($item[spice melange]) * max(0, 1 - available_amount($item[spice melange]));
totalprice += historical_price($item[pumpkin pie]) * max(0, 1 - available_amount($item[pumpkin pie]));
totalprice += historical_price($item[hodgman's blanket]) * max(0, 1 - available_amount($item[hodgman's blanket]));
totalprice += historical_price($item[pumpkin beer]) * max(0, 1 - available_amount($item[pumpkin beer]));
totalprice += historical_price($item[jar of fermented pickle juice]) * max(0, 3 - available_amount($item[jar of fermented pickle juice]));
totalprice += historical_price($item[extra-greasy slider]) * max(0, 3 - available_amount($item[extra-greasy slider]));
Note that it's spice melange, not spice melenge... unless you want some major fails.
Also, we collect/price all 34 prismatic wads at once. That's because if you run 2 retrieve_item(17, $item[prismatic wad]) in a row, you only end up with 17 wads... it collects that many total, not that many additional. You want 34, so we need to do that as one.
We use max(0, <number needed> - available_amount($item)) because we never want to end up with a 'discount' because of having more than the number already... either 0 or the amount needed will be higher. No negative numbers. We use available_amount, not item_amount or anything else, because that's how many items retrieve_item will consider, so you get an accurate summary of how much you actually will be spending.
Oh, and we're using historical_price rather than mall_price because we want it to run fast. If you care about the absolute latest info... change those to mall_price, but they'll need to hit the server once every new-instance of mafia, rather than using shared prices.
Oh, and code blocks go in {code}{/code} or {php}{/php} blocks. Change {} to [].

Code gives fixed width, b/w text. Php gives colourized (sometimes well, sometimes horribly) fixed width text.