Code:
function BuyDropper:NumToBuy(item)
local toBuy = min(item.amount - CogsBagSpace:GetBagItemCount(item.id), item.available)
if item.preset > 1 then
toBuy = (self.db.profile.overstock and ceil or floor)(toBuy/item.preset)
end
return toBuy
end
Probable solution may be this:
Code:
function BuyDropper:NumToBuy(item)
local toBuy
if item.available == -1 then
toBuy = item.amount - CogsBagSpace:GetBagItemCount(item.id)
else
toBuy = min(item.amount - CogsBagSpace:GetBagItemCount(item.id), item.available)
end
if item.preset > 1 then
toBuy = (self.db.profile.overstock and ceil or floor)(toBuy/item.preset)
end
return toBuy
end
Thanks.