post layout change
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
Aux = {
|
Aux = {
|
||||||
version = '2.6.2',
|
version = '2.6.3',
|
||||||
blizzard_ui_shown = false,
|
blizzard_ui_shown = false,
|
||||||
orig = {},
|
orig = {},
|
||||||
}
|
}
|
||||||
|
|||||||
+133
-67
@@ -7,6 +7,7 @@ local inventory_records
|
|||||||
local selected_item
|
local selected_item
|
||||||
|
|
||||||
local DURATION_4, DURATION_8, DURATION_24 = 120, 480, 1440
|
local DURATION_4, DURATION_8, DURATION_24 = 120, 480, 1440
|
||||||
|
local BUYOUT_MODE, BID_MODE, FULL_MODE = 1, 2, 3
|
||||||
|
|
||||||
function private.load_settings(item_record)
|
function private.load_settings(item_record)
|
||||||
local item_record = item_record or selected_item
|
local item_record = item_record or selected_item
|
||||||
@@ -18,14 +19,14 @@ function private.load_settings(item_record)
|
|||||||
start_price = 0,
|
start_price = 0,
|
||||||
buyout_price = 0,
|
buyout_price = 0,
|
||||||
post_all = true,
|
post_all = true,
|
||||||
no_bidding = true,
|
|
||||||
hidden = false,
|
hidden = false,
|
||||||
|
mode = BUYOUT_MODE,
|
||||||
}
|
}
|
||||||
return dataset.post[item_record.key]
|
return dataset.post[item_record.key]
|
||||||
end
|
end
|
||||||
|
|
||||||
function private.get_unit_start_price()
|
function private.get_unit_start_price()
|
||||||
if private.no_bidding_checkbox:GetChecked() then
|
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())
|
||||||
else
|
else
|
||||||
return Aux.money.from_string(private.unit_start_price:GetText())
|
return Aux.money.from_string(private.unit_start_price:GetText())
|
||||||
@@ -33,17 +34,23 @@ function private.get_unit_start_price()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function private.set_unit_start_price(amount)
|
function private.set_unit_start_price(amount)
|
||||||
if not private.no_bidding_checkbox:GetChecked() then
|
if UIDropDownMenu_GetSelectedValue(private.mode_dropdown) ~= BUYOUT_MODE then
|
||||||
private.unit_start_price:SetText(Aux.money.to_string(amount, true, nil, 3))
|
private.unit_start_price:SetText(Aux.money.to_string(amount, true, nil, 3))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function private.get_unit_buyout_price()
|
function private.get_unit_buyout_price()
|
||||||
return Aux.money.from_string(private.unit_buyout_price:GetText())
|
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())
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function private.set_unit_buyout_price(amount)
|
function private.set_unit_buyout_price(amount)
|
||||||
private.unit_buyout_price:SetText(Aux.money.to_string(amount, true, nil, 3))
|
if UIDropDownMenu_GetSelectedValue(private.mode_dropdown) ~= BID_MODE then
|
||||||
|
private.unit_buyout_price:SetText(Aux.money.to_string(amount, true, nil, 3))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function private.update_inventory_listing()
|
function private.update_inventory_listing()
|
||||||
@@ -353,66 +360,29 @@ function public.on_load()
|
|||||||
-- private.batch_posting_checkbox = checkbox
|
-- private.batch_posting_checkbox = checkbox
|
||||||
-- end
|
-- end
|
||||||
do
|
do
|
||||||
local editbox = Aux.gui.editbox(AuxSellParameters)
|
local dropdown = Aux.gui.dropdown(AuxSellParameters)
|
||||||
editbox:SetJustifyH('RIGHT')
|
dropdown:SetPoint('TOPRIGHT', -15, -42)
|
||||||
editbox:SetPoint('TOPRIGHT', -30, -50)
|
dropdown:SetWidth(120)
|
||||||
editbox:SetWidth(150)
|
dropdown:SetHeight(10)
|
||||||
editbox:SetScript('OnTextChanged', function()
|
local label = Aux.gui.label(dropdown, 13)
|
||||||
if selected_item then
|
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
|
||||||
local settings = private.load_settings()
|
label:SetText('Mode')
|
||||||
settings.buyout_price = Aux.money.from_string(this:GetText())
|
UIDropDownMenu_Initialize(dropdown, private.initialize_mode_dropdown)
|
||||||
end
|
dropdown:SetScript('OnShow', function()
|
||||||
refresh = true
|
UIDropDownMenu_Initialize(this, private.initialize_mode_dropdown)
|
||||||
end)
|
end)
|
||||||
editbox:SetScript('OnTabPressed', function()
|
private.mode_dropdown = dropdown
|
||||||
if IsShiftKeyDown() then
|
|
||||||
private.unit_start_price:SetFocus()
|
|
||||||
else
|
|
||||||
private.stack_size_slider.editbox:SetFocus()
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
editbox:SetScript('OnEnterPressed', function()
|
|
||||||
this:ClearFocus()
|
|
||||||
end)
|
|
||||||
editbox:SetScript('OnEscapePressed', function()
|
|
||||||
this:ClearFocus()
|
|
||||||
end)
|
|
||||||
editbox:SetScript('OnEditFocusGained', function()
|
|
||||||
this:HighlightText()
|
|
||||||
end)
|
|
||||||
editbox:SetScript('OnEditFocusLost', function()
|
|
||||||
this:SetText(Aux.money.to_string(Aux.money.from_string(this:GetText()), true, nil, 3))
|
|
||||||
end)
|
|
||||||
local label = Aux.gui.label(editbox, 13)
|
|
||||||
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
|
|
||||||
label:SetText('Unit Buyout Price')
|
|
||||||
private.unit_buyout_price = editbox
|
|
||||||
end
|
|
||||||
do
|
|
||||||
local checkbox = CreateFrame('CheckButton', nil, AuxSellInventory, 'UICheckButtonTemplate')
|
|
||||||
checkbox:SetWidth(22)
|
|
||||||
checkbox:SetHeight(22)
|
|
||||||
checkbox:SetPoint('TOPLEFT', private.unit_buyout_price, 'BOTTOMLEFT', -3, -4)
|
|
||||||
checkbox:SetScript('OnClick', function()
|
|
||||||
local settings = private.load_settings()
|
|
||||||
settings.no_bidding = this:GetChecked()
|
|
||||||
private.update_recommendation()
|
|
||||||
refresh = true
|
|
||||||
end)
|
|
||||||
local label = Aux.gui.label(checkbox, 13)
|
|
||||||
label:SetPoint('LEFT', checkbox, 'RIGHT', 2, 1)
|
|
||||||
label:SetText('No Bidding')
|
|
||||||
private.no_bidding_checkbox = checkbox
|
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
local editbox = Aux.gui.editbox(AuxSellParameters)
|
local editbox = Aux.gui.editbox(AuxSellParameters)
|
||||||
editbox:SetJustifyH('RIGHT')
|
editbox:SetJustifyH('RIGHT')
|
||||||
editbox:SetPoint('TOP', private.unit_buyout_price, 'BOTTOM', 0, -42)
|
|
||||||
editbox:SetWidth(150)
|
editbox:SetWidth(150)
|
||||||
editbox:SetScript('OnTextChanged', function()
|
editbox:SetScript('OnTextChanged', function()
|
||||||
if selected_item then
|
if selected_item then
|
||||||
local settings = private.load_settings()
|
local settings = private.load_settings()
|
||||||
settings.start_price = Aux.money.from_string(this:GetText())
|
settings.start_price = Aux.money.from_string(this:GetText())
|
||||||
|
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 '---')
|
||||||
end
|
end
|
||||||
refresh = true
|
refresh = true
|
||||||
end)
|
end)
|
||||||
@@ -437,14 +407,69 @@ function public.on_load()
|
|||||||
editbox:SetScript('OnEditFocusLost', function()
|
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()), true, nil, 3))
|
||||||
end)
|
end)
|
||||||
local label = Aux.gui.label(editbox, 13)
|
do
|
||||||
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
|
local label = Aux.gui.label(editbox, 13)
|
||||||
label:SetText('Unit Starting Price')
|
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
|
||||||
|
label:SetText('Unit Starting Price')
|
||||||
|
end
|
||||||
|
do
|
||||||
|
local label = Aux.gui.label(editbox, 13)
|
||||||
|
label:SetPoint('LEFT', editbox, 'RIGHT', 3, 0)
|
||||||
|
label:SetWidth(50)
|
||||||
|
label:SetJustifyH('CENTER')
|
||||||
|
private.start_price_percentage = label
|
||||||
|
end
|
||||||
private.unit_start_price = editbox
|
private.unit_start_price = editbox
|
||||||
end
|
end
|
||||||
|
do
|
||||||
|
local editbox = Aux.gui.editbox(AuxSellParameters)
|
||||||
|
editbox:SetJustifyH('RIGHT')
|
||||||
|
editbox:SetWidth(150)
|
||||||
|
editbox:SetScript('OnTextChanged', function()
|
||||||
|
if selected_item then
|
||||||
|
local settings = private.load_settings()
|
||||||
|
settings.buyout_price = Aux.money.from_string(this:GetText())
|
||||||
|
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 '---')
|
||||||
|
end
|
||||||
|
refresh = true
|
||||||
|
end)
|
||||||
|
editbox:SetScript('OnTabPressed', function()
|
||||||
|
if IsShiftKeyDown() then
|
||||||
|
private.unit_start_price:SetFocus()
|
||||||
|
else
|
||||||
|
private.stack_size_slider.editbox:SetFocus()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
editbox:SetScript('OnEnterPressed', function()
|
||||||
|
this:ClearFocus()
|
||||||
|
end)
|
||||||
|
editbox:SetScript('OnEscapePressed', function()
|
||||||
|
this:ClearFocus()
|
||||||
|
end)
|
||||||
|
editbox:SetScript('OnEditFocusGained', function()
|
||||||
|
this:HighlightText()
|
||||||
|
end)
|
||||||
|
editbox:SetScript('OnEditFocusLost', function()
|
||||||
|
this:SetText(Aux.money.to_string(Aux.money.from_string(this:GetText()), true, nil, 3))
|
||||||
|
end)
|
||||||
|
do
|
||||||
|
local label = Aux.gui.label(editbox, 13)
|
||||||
|
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
|
||||||
|
label:SetText('Unit Buyout Price')
|
||||||
|
end
|
||||||
|
do
|
||||||
|
local label = Aux.gui.label(editbox, 13)
|
||||||
|
label:SetPoint('LEFT', editbox, 'RIGHT', 3, 0)
|
||||||
|
label:SetWidth(50)
|
||||||
|
label:SetJustifyH('CENTER')
|
||||||
|
private.buyout_price_percentage = label
|
||||||
|
end
|
||||||
|
private.unit_buyout_price = editbox
|
||||||
|
end
|
||||||
do
|
do
|
||||||
local btn = Aux.gui.button(AuxSellParameters, 16, '$parentPostButton')
|
local btn = Aux.gui.button(AuxSellParameters, 16, '$parentPostButton')
|
||||||
btn:SetPoint('TOPRIGHT', private.unit_start_price, 'BOTTOMRIGHT', 0, -33)
|
btn:SetPoint('TOPRIGHT', -15, -163)
|
||||||
btn:SetWidth(150)
|
btn:SetWidth(150)
|
||||||
btn:SetHeight(20)
|
btn:SetHeight(20)
|
||||||
btn:GetFontString():SetTextHeight(15)
|
btn:GetFontString():SetTextHeight(15)
|
||||||
@@ -592,9 +617,10 @@ function private.update_recommendation()
|
|||||||
AuxSellParametersItemName:SetTextColor(unpack(Aux.gui.config.label_color.enabled))
|
AuxSellParametersItemName:SetTextColor(unpack(Aux.gui.config.label_color.enabled))
|
||||||
AuxSellParametersItemName:SetText('No item selected')
|
AuxSellParametersItemName:SetText('No item selected')
|
||||||
|
|
||||||
private.unit_buyout_price:Hide()
|
private.mode_dropdown:Hide()
|
||||||
private.no_bidding_checkbox:Hide()
|
|
||||||
private.unit_start_price:Hide()
|
private.unit_start_price:Hide()
|
||||||
|
private.unit_buyout_price:Hide()
|
||||||
|
|
||||||
private.stack_size_slider:Hide()
|
private.stack_size_slider:Hide()
|
||||||
private.post_all_checkbox:Hide()
|
private.post_all_checkbox:Hide()
|
||||||
private.stack_count_slider:Hide()
|
private.stack_count_slider:Hide()
|
||||||
@@ -603,13 +629,24 @@ function private.update_recommendation()
|
|||||||
private.historical_value_button:Hide()
|
private.historical_value_button:Hide()
|
||||||
private.hide_checkbox:Hide()
|
private.hide_checkbox:Hide()
|
||||||
else
|
else
|
||||||
private.unit_buyout_price:Show()
|
private.mode_dropdown:Show()
|
||||||
private.no_bidding_checkbox:Show()
|
private.unit_start_price:Hide()
|
||||||
if private.no_bidding_checkbox:GetChecked() then
|
private.unit_buyout_price:Hide()
|
||||||
private.unit_start_price:Hide()
|
private.unit_start_price:ClearAllPoints()
|
||||||
else
|
private.unit_buyout_price:ClearAllPoints()
|
||||||
|
if UIDropDownMenu_GetSelectedValue(private.mode_dropdown) == BUYOUT_MODE then
|
||||||
|
private.unit_buyout_price:SetPoint('TOPRIGHT', -65, -100)
|
||||||
|
private.unit_buyout_price:Show()
|
||||||
|
elseif UIDropDownMenu_GetSelectedValue(private.mode_dropdown) == BID_MODE then
|
||||||
|
private.unit_start_price:SetPoint('TOPRIGHT', -65, -100)
|
||||||
private.unit_start_price:Show()
|
private.unit_start_price:Show()
|
||||||
|
elseif UIDropDownMenu_GetSelectedValue(private.mode_dropdown) == FULL_MODE then
|
||||||
|
private.unit_start_price:SetPoint('TOPRIGHT', -65, -89)
|
||||||
|
private.unit_start_price:Show()
|
||||||
|
private.unit_buyout_price:SetPoint('TOPRIGHT', private.unit_start_price, 'BOTTOMRIGHT', 0, -15)
|
||||||
|
private.unit_buyout_price:Show()
|
||||||
end
|
end
|
||||||
|
|
||||||
private.stack_size_slider:Show()
|
private.stack_size_slider:Show()
|
||||||
private.post_all_checkbox:Show()
|
private.post_all_checkbox:Show()
|
||||||
if private.post_all_checkbox:GetChecked() then
|
if private.post_all_checkbox:GetChecked() then
|
||||||
@@ -733,9 +770,11 @@ function private.set_item(item)
|
|||||||
UIDropDownMenu_Initialize(private.duration_dropdown, private.initialize_duration_dropdown) -- TODO, wtf, why is this needed
|
UIDropDownMenu_Initialize(private.duration_dropdown, private.initialize_duration_dropdown) -- TODO, wtf, why is this needed
|
||||||
UIDropDownMenu_SetSelectedValue(private.duration_dropdown, settings.duration)
|
UIDropDownMenu_SetSelectedValue(private.duration_dropdown, settings.duration)
|
||||||
|
|
||||||
|
UIDropDownMenu_Initialize(private.mode_dropdown, private.initialize_mode_dropdown)
|
||||||
|
UIDropDownMenu_SetSelectedValue(private.mode_dropdown, settings.mode)
|
||||||
|
|
||||||
private.hide_checkbox:SetChecked(settings.hidden)
|
private.hide_checkbox:SetChecked(settings.hidden)
|
||||||
private.post_all_checkbox:SetChecked(settings.post_all)
|
private.post_all_checkbox:SetChecked(settings.post_all)
|
||||||
private.no_bidding_checkbox:SetChecked(settings.no_bidding)
|
|
||||||
|
|
||||||
private.stack_size_slider:SetMinMaxValues(1, selected_item.charges and 5 or selected_item.max_stack)
|
private.stack_size_slider:SetMinMaxValues(1, selected_item.charges and 5 or selected_item.max_stack)
|
||||||
private.stack_size_slider:SetValue(settings.stack_size)
|
private.stack_size_slider:SetValue(settings.stack_size)
|
||||||
@@ -936,3 +975,30 @@ function private.initialize_duration_dropdown()
|
|||||||
func = on_click,
|
func = on_click,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function private.initialize_mode_dropdown()
|
||||||
|
local function on_click()
|
||||||
|
UIDropDownMenu_SetSelectedValue(private.mode_dropdown, this.value)
|
||||||
|
local settings = private.load_settings()
|
||||||
|
settings.mode = this.value
|
||||||
|
private.update_recommendation()
|
||||||
|
end
|
||||||
|
|
||||||
|
UIDropDownMenu_AddButton{
|
||||||
|
text = 'Buyout',
|
||||||
|
value = BUYOUT_MODE,
|
||||||
|
func = on_click,
|
||||||
|
}
|
||||||
|
|
||||||
|
UIDropDownMenu_AddButton{
|
||||||
|
text = 'Bid',
|
||||||
|
value = BID_MODE,
|
||||||
|
func = on_click,
|
||||||
|
}
|
||||||
|
|
||||||
|
UIDropDownMenu_AddButton{
|
||||||
|
text = 'Full',
|
||||||
|
value = FULL_MODE,
|
||||||
|
func = on_click,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ function SlashCmdList.AUX(parameter)
|
|||||||
if parameter == 'clear history' then
|
if parameter == 'clear history' then
|
||||||
Aux.persistence.load_dataset().history = {}
|
Aux.persistence.load_dataset().history = {}
|
||||||
Aux.log('History cleared.')
|
Aux.log('History cleared.')
|
||||||
|
elseif parameter == 'clear post' then
|
||||||
|
Aux.persistence.load_dataset().post = {}
|
||||||
|
Aux.log('Post settings cleared.')
|
||||||
elseif parameter == 'clear' then
|
elseif parameter == 'clear' then
|
||||||
aux_database = {}
|
aux_database = {}
|
||||||
Aux.log('Database cleared.')
|
Aux.log('Database cleared.')
|
||||||
|
|||||||
Reference in New Issue
Block a user