fix for decimal points/undercutting by 1c
This commit is contained in:
+2
-2
@@ -425,8 +425,8 @@ local methods = {
|
||||
row.cells[5]:SetText(TIME_LEFT_STRINGS[record.duration or 0] or '---')
|
||||
row.cells[6]:SetText(Aux.is_player(record.owner) and ('|cffffff00'..record.owner..'|r') or (record.owner or '---'))
|
||||
local bid, buyout, colorBid, colorBuyout = self.GetRowPrices(record, aux_price_per_unit)
|
||||
row.cells[7]:SetText(bid > 0 and Aux.money.to_string(bid, true, false, colorBid) or '---')
|
||||
row.cells[8]:SetText(buyout > 0 and Aux.money.to_string(buyout, true, false, colorBuyout) or '---')
|
||||
row.cells[7]:SetText(bid > 0 and Aux.money.to_string(bid, true, false, nil, colorBid) or '---')
|
||||
row.cells[8]:SetText(buyout > 0 and Aux.money.to_string(buyout, true, false, nil, colorBuyout) or '---')
|
||||
local pct, bidPct = self:GetRecordPercent(record)
|
||||
row.cells[9]:SetText((pct or bidPct) and public.percentage_market(pct or bidPct, not pct) or '---')
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
AuxVersion = '2.4.16'
|
||||
AuxVersion = '2.4.17'
|
||||
AuxAuthors = 'shirsig; Zerf; Zirco (Auctionator); Nimeral (Auctionator backport)'
|
||||
|
||||
Aux = {
|
||||
|
||||
@@ -7,7 +7,7 @@ local COPPER_TEXT = '|cffeda55fc|r'
|
||||
local COPPER_PER_SILVER = 100
|
||||
local COPPER_PER_GOLD = 10000
|
||||
|
||||
function m.to_string(money, pad, trim, color, no_color)
|
||||
function m.to_string(money, pad, trim, decimal_points, color, no_color)
|
||||
|
||||
local is_negative = money < 0
|
||||
money = abs(money)
|
||||
@@ -16,6 +16,10 @@ function m.to_string(money, pad, trim, color, no_color)
|
||||
-- local copper = Aux.round(mod(money, COPPER_PER_SILVER))
|
||||
local copper = mod(money, COPPER_PER_SILVER)
|
||||
|
||||
if decimal_points then
|
||||
copper = tonumber(format('%.'..decimal_points..'f', copper))
|
||||
end
|
||||
|
||||
local gold_text, silver_text, copper_text
|
||||
if no_color then
|
||||
gold_text, silver_text, copper_text = 'g', 's', 'c'
|
||||
@@ -78,7 +82,7 @@ function m.from_string(value)
|
||||
value = gsub(value, '%d*%.?%d+c', '', 1)
|
||||
if strfind(value, '%S') then return 0 end
|
||||
|
||||
return Aux.round(((gold or 0) * COPPER_PER_GOLD) + ((silver or 0) * COPPER_PER_SILVER) + (copper or 0))
|
||||
return ((gold or 0) * COPPER_PER_GOLD) + ((silver or 0) * COPPER_PER_SILVER) + (copper or 0)
|
||||
end
|
||||
|
||||
function m.format_number(num, pad, color)
|
||||
|
||||
@@ -82,7 +82,7 @@ function private.post_auction(slot, k)
|
||||
ClickAuctionSellItemButton()
|
||||
ClearCursor()
|
||||
local stack_size = Aux.info.container_item(slot.bag, slot.bag_slot).aux_quantity
|
||||
StartAuction(ceil(state.unit_start_price * stack_size), ceil(state.unit_buyout_price * stack_size), state.duration)
|
||||
StartAuction(max(1, Aux.round(state.unit_start_price * stack_size)), Aux.round(state.unit_buyout_price * stack_size), state.duration)
|
||||
controller().wait(function() return not GetContainerItemInfo(slot.bag, slot.bag_slot) end, function()
|
||||
return k(stack_size)
|
||||
end)
|
||||
|
||||
+5
-5
@@ -52,7 +52,7 @@ function private.update_auction_listing()
|
||||
{ value=auction_record.yours },
|
||||
{ value=Aux.auction_listing.time_left(auction_record.duration) },
|
||||
{ value=stack_size },
|
||||
{ value=Aux.money.to_string(tonumber(format('%.3f', auction_record.unit_buyout_price)), true, false) },
|
||||
{ value=Aux.money.to_string(auction_record.unit_buyout_price, true, nil, 3) },
|
||||
{ value=Aux.auction_listing.percentage_market(market_value and Aux.round(auction_record.unit_buyout_price/market_value * 100) or '---') },
|
||||
},
|
||||
record = auction_record,
|
||||
@@ -587,8 +587,8 @@ function private.update_recommendation()
|
||||
end
|
||||
end
|
||||
|
||||
private.unit_start_price:SetText(Aux.money.to_string(tonumber(format('%.3f', start_price))))
|
||||
private.unit_buyout_price:SetText(Aux.money.to_string(tonumber(format('%.3f', buyout_price))))
|
||||
private.unit_start_price:SetText(Aux.money.to_string(start_price, nil, nil, settings.pricing_model ~= FIXED and 3))
|
||||
private.unit_buyout_price:SetText(Aux.money.to_string(buyout_price, nil, nil, settings.pricing_model ~= FIXED and 3))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -598,13 +598,13 @@ function private.undercutting_suggestion()
|
||||
|
||||
if existing_auctions[selected_item.key].selected then
|
||||
|
||||
local basis_price = existing_auctions[selected_item.key].selected.unit_buyout_price * private.stack_size_slider:GetValue()
|
||||
local basis_price = existing_auctions[selected_item.key].selected.unit_buyout_price * existing_auctions[selected_item.key].selected.stack_size
|
||||
|
||||
if existing_auctions[selected_item.key].selected.yours == 0 then
|
||||
basis_price = private.undercut(basis_price)
|
||||
end
|
||||
|
||||
local price_suggestion = basis_price / private.stack_size_slider:GetValue()
|
||||
local price_suggestion = basis_price / existing_auctions[selected_item.key].selected.stack_size
|
||||
return price_suggestion * 0.95, price_suggestion
|
||||
end
|
||||
end
|
||||
|
||||
+1
-1
@@ -233,7 +233,7 @@ function m.filter_to_string(filter)
|
||||
end
|
||||
|
||||
if filter.max_price then
|
||||
add(Aux.money.to_string(filter.max_price, nil, true, nil, true))
|
||||
add(Aux.money.to_string(filter.max_price, nil, true, nil, nil, true))
|
||||
end
|
||||
|
||||
if filter.max_percent then
|
||||
|
||||
Reference in New Issue
Block a user