post money input fix
This commit is contained in:
@@ -83,13 +83,13 @@ function m.from_string(value)
|
||||
local gold = tonumber(({strfind(value, '(%d*%.?%d+)g')})[3])
|
||||
local silver = tonumber(({strfind(value, '(%d*%.?%d+)s')})[3])
|
||||
local copper = tonumber(({strfind(value, '(%d*%.?%d+)c')})[3])
|
||||
-- if not gold and not silver and not copper then return end
|
||||
if not gold and not silver and not copper then return end
|
||||
|
||||
-- test that there are no extra characters (other than spaces)
|
||||
value = gsub(value, '%d*%.?%d+g', '', 1)
|
||||
value = gsub(value, '%d*%.?%d+s', '', 1)
|
||||
value = gsub(value, '%d*%.?%d+c', '', 1)
|
||||
if strfind(value, '%S') then return 0 end
|
||||
if strfind(value, '%S') then return end
|
||||
|
||||
return m.from_GSC(gold or 0, silver or 0, copper or 0)
|
||||
end
|
||||
|
||||
+23
-11
@@ -62,9 +62,9 @@ end
|
||||
|
||||
function private.get_unit_start_price()
|
||||
if UIDropDownMenu_GetSelectedValue(private.mode_dropdown) == BUYOUT_MODE then
|
||||
return Aux.money.from_string(private.unit_buyout_price:GetText())
|
||||
return Aux.money.from_string(private.unit_buyout_price:GetText()) or 0
|
||||
else
|
||||
return Aux.money.from_string(private.unit_start_price:GetText())
|
||||
return Aux.money.from_string(private.unit_start_price:GetText()) or 0
|
||||
end
|
||||
end
|
||||
|
||||
@@ -76,7 +76,7 @@ end
|
||||
|
||||
function private.get_unit_buyout_price()
|
||||
if UIDropDownMenu_GetSelectedValue(private.mode_dropdown) == BUYOUT_MODE or UIDropDownMenu_GetSelectedValue(private.mode_dropdown) == FULL_MODE then
|
||||
return Aux.money.from_string(private.unit_buyout_price:GetText())
|
||||
return Aux.money.from_string(private.unit_buyout_price:GetText()) or 0
|
||||
else
|
||||
return 0
|
||||
end
|
||||
@@ -414,9 +414,15 @@ function public.on_load()
|
||||
editbox:SetScript('OnTextChanged', function()
|
||||
if selected_item then
|
||||
local settings = private.read_settings()
|
||||
settings.start_price = Aux.money.from_string(this:GetText())
|
||||
|
||||
local input = Aux.money.from_string(this:GetText())
|
||||
if input then
|
||||
settings.start_price = input
|
||||
end
|
||||
input = input or 0
|
||||
|
||||
local historical_value = Aux.history.value(selected_item.key)
|
||||
private.start_price_percentage:SetText(historical_value and Aux.auction_listing.percentage_historical(Aux.round(settings.start_price / historical_value * 100)) or '---')
|
||||
private.start_price_percentage:SetText(historical_value and Aux.auction_listing.percentage_historical(Aux.round(input / historical_value * 100)) or '---')
|
||||
private.write_settings(settings)
|
||||
end
|
||||
refresh = true
|
||||
@@ -440,7 +446,7 @@ function public.on_load()
|
||||
this:HighlightText()
|
||||
end)
|
||||
editbox:SetScript('OnEditFocusLost', function()
|
||||
this:SetText(Aux.money.to_string(Aux.money.from_string(this:GetText()), true, nil, 3))
|
||||
this:SetText(Aux.money.to_string(Aux.money.from_string(this:GetText()) or 0, true, nil, 3))
|
||||
end)
|
||||
do
|
||||
local label = Aux.gui.label(editbox, 13)
|
||||
@@ -463,9 +469,15 @@ function public.on_load()
|
||||
editbox:SetScript('OnTextChanged', function()
|
||||
if selected_item then
|
||||
local settings = private.read_settings()
|
||||
settings.buyout_price = Aux.money.from_string(this:GetText())
|
||||
|
||||
local input = Aux.money.from_string(this:GetText())
|
||||
if input then
|
||||
settings.buyout_price = input
|
||||
end
|
||||
input = input or 0
|
||||
|
||||
local historical_value = Aux.history.value(selected_item.key)
|
||||
private.buyout_price_percentage:SetText(historical_value and Aux.auction_listing.percentage_historical(Aux.round(settings.buyout_price / historical_value * 100)) or '---')
|
||||
private.buyout_price_percentage:SetText(historical_value and Aux.auction_listing.percentage_historical(Aux.round(input / historical_value * 100)) or '---')
|
||||
private.write_settings(settings)
|
||||
end
|
||||
refresh = true
|
||||
@@ -487,7 +499,7 @@ function public.on_load()
|
||||
this:HighlightText()
|
||||
end)
|
||||
editbox:SetScript('OnEditFocusLost', function()
|
||||
this:SetText(Aux.money.to_string(Aux.money.from_string(this:GetText()), true, nil, 3))
|
||||
this:SetText(Aux.money.to_string(Aux.money.from_string(this:GetText()) or 0, true, nil, 3))
|
||||
end)
|
||||
do
|
||||
local label = Aux.gui.label(editbox, 13)
|
||||
@@ -639,14 +651,14 @@ function private.update_recommendation()
|
||||
private.hide_checkbox:Hide()
|
||||
else
|
||||
private.mode_dropdown:Show()
|
||||
private.unit_start_price:Hide()
|
||||
private.unit_buyout_price:Hide()
|
||||
private.unit_start_price:ClearAllPoints()
|
||||
private.unit_buyout_price:ClearAllPoints()
|
||||
if UIDropDownMenu_GetSelectedValue(private.mode_dropdown) == BUYOUT_MODE then
|
||||
private.unit_start_price:Hide()
|
||||
private.unit_buyout_price:SetPoint('TOPRIGHT', -65, -100)
|
||||
private.unit_buyout_price:Show()
|
||||
elseif UIDropDownMenu_GetSelectedValue(private.mode_dropdown) == BID_MODE then
|
||||
private.unit_buyout_price:Hide()
|
||||
private.unit_start_price:SetPoint('TOPRIGHT', -65, -100)
|
||||
private.unit_start_price:Show()
|
||||
elseif UIDropDownMenu_GetSelectedValue(private.mode_dropdown) == FULL_MODE then
|
||||
|
||||
+6
-6
@@ -133,7 +133,7 @@ m.filters = {
|
||||
['min-bid'] = {
|
||||
arity = 1,
|
||||
test = function(amount)
|
||||
amount = Aux.money.from_string(amount or '')
|
||||
amount = Aux.money.from_string(amount or '') or 0
|
||||
if amount > 0 then
|
||||
return function(auction_record)
|
||||
return auction_record.unit_bid_price >= amount
|
||||
@@ -147,7 +147,7 @@ m.filters = {
|
||||
['min-buyout'] = {
|
||||
arity = 1,
|
||||
test = function(amount)
|
||||
amount = Aux.money.from_string(amount or '')
|
||||
amount = Aux.money.from_string(amount or '') or 0
|
||||
if amount > 0 then
|
||||
return function(auction_record)
|
||||
return auction_record.unit_buyout_price >= amount
|
||||
@@ -161,7 +161,7 @@ m.filters = {
|
||||
['max-bid'] = {
|
||||
arity = 1,
|
||||
test = function(amount)
|
||||
amount = Aux.money.from_string(amount or '')
|
||||
amount = Aux.money.from_string(amount or '') or 0
|
||||
if amount > 0 then
|
||||
return function(auction_record)
|
||||
return auction_record.unit_bid_price <= amount
|
||||
@@ -175,7 +175,7 @@ m.filters = {
|
||||
['max-buyout'] = {
|
||||
arity = 1,
|
||||
test = function(amount)
|
||||
amount = Aux.money.from_string(amount or '')
|
||||
amount = Aux.money.from_string(amount or '') or 0
|
||||
if amount > 0 then
|
||||
return function(auction_record)
|
||||
return auction_record.buyout_price > 0 and auction_record.unit_buyout_price <= amount
|
||||
@@ -221,7 +221,7 @@ m.filters = {
|
||||
['bid-profit'] = {
|
||||
arity = 1,
|
||||
test = function(amount)
|
||||
amount = Aux.money.from_string(amount or '')
|
||||
amount = Aux.money.from_string(amount or '') or 0
|
||||
if amount > 0 then
|
||||
return function(auction_record)
|
||||
return Aux.history.value(auction_record.item_key) and Aux.history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.bid_price >= amount
|
||||
@@ -235,7 +235,7 @@ m.filters = {
|
||||
['buyout-profit'] = {
|
||||
arity = 1,
|
||||
test = function(amount)
|
||||
amount = Aux.money.from_string(amount or '')
|
||||
amount = Aux.money.from_string(amount or '') or 0
|
||||
if amount > 0 then
|
||||
return function(auction_record)
|
||||
return Aux.history.value(auction_record.item_key) and Aux.history.value(auction_record.item_key) * auction_record.aux_quantity - auction_record.buyout_price >= amount
|
||||
|
||||
Reference in New Issue
Block a user