I added coconuts and papayas (food from the archipelago mod) to the food merchants that visit your town from time to time.
The price of the items got me confused on how that works.
He sells eggs by 5 gold, while coconut by 10 and papaya by 15 gold. Ok.
I went to check the “raw” price of eggs, cause my coconuts has a really low price, how the egg is even cheaper?
It ends up the egg is set to 2 gold, my coconuts are 3 and papaya is 6.
product | raw price (in the json) | price in the shop (buying from merchant)
egg | 2 | 5
coconut | 3 | 10
papaya | 6 | 15
So I’m lost with the math here. coconuts are costing twice the price of the egg, but the raw price is only 50% higher. Papaya is ok, it is worth three times more, and is costing three time more too.
for uri, shop_item_data in pairs(entities) do
local shop_item_description = shop_item_data.entity_description
local quantity = shop_item_data.shop_data.quantity
local cost_multiplier = 1
if shop_item_data.shop_data.entry.price_multiplier then
cost_multiplier = shop_item_data.shop_data.entry.price_multiplier
elseif self._sv.options.overall_price_multiplier then
cost_multiplier = self._sv.options.overall_price_multiplier
local cost_rounded = math.floor(shop_item_description.sell_cost * cost_multiplier)
-- Round to the nearest 5.
cost_rounded = math.ceil(cost_rounded/5) * 5
if cost_rounded < 5 then
cost_rounded = 5