diff --git a/tabs/post/core.lua b/tabs/post/core.lua index 9f1980c7..f77493c7 100644 --- a/tabs/post/core.lua +++ b/tabs/post/core.lua @@ -65,6 +65,16 @@ function refresh_button_click() refresh = true end +function update_start_price_visibility() + if start_equals_buyout_checkbox:GetChecked() then + unit_start_price_input:Hide() + start_price_percentage:Hide() + else + unit_start_price_input:Show() + start_price_percentage:Show() + end +end + function tab.OPEN() frame:Show() update_inventory_records() @@ -198,7 +208,7 @@ end function post_auctions() if selected_item then - local unit_start_price = get_unit_start_price() + local unit_start_price = start_equals_buyout_checkbox:GetChecked() and get_unit_buyout_price() or get_unit_start_price() local unit_buyout_price = get_unit_buyout_price() local stack_size = stack_size_slider:GetValue() local stack_count @@ -249,55 +259,7 @@ function post_auctions() end function M.post_auctions_bind() - if selected_item then - local unit_start_price = get_unit_start_price() - local unit_buyout_price = get_unit_buyout_price() - local stack_size = stack_size_slider:GetValue() - local stack_count - stack_count = stack_count_slider:GetValue() - local duration = UIDropDownMenu_GetSelectedValue(duration_dropdown) - local key = selected_item.key - - local duration_code - if duration == DURATION_2 then - duration_code = 2 - elseif duration == DURATION_8 then - duration_code = 3 - elseif duration == DURATION_24 then - duration_code = 4 - end - - post.start( - key, - stack_size, - duration, - unit_start_price, - unit_buyout_price, - stack_count, - function(posted) - if not frame:IsShown() then - return - end - for i = 1, posted do - record_auction(key, stack_size, unit_start_price * stack_size, unit_buyout_price, duration_code, UnitName'player') - end - update_inventory_records() - local same - for _, record in inventory_records do - if record.key == key then - same = record - break - end - end - if same then - update_item(same) - else - selected_item = nil - end - refresh = true - end - ) - end + post_auctions() end function validate_parameters() @@ -305,7 +267,7 @@ function validate_parameters() post_button:Disable() return end - if get_unit_buyout_price() > 0 and get_unit_start_price() > get_unit_buyout_price() then + if not start_equals_buyout_checkbox:GetChecked() and get_unit_buyout_price() > 0 and get_unit_start_price() > get_unit_buyout_price() then post_button:Disable() return end @@ -338,7 +300,7 @@ function update_item_configuration() hide_checkbox:Hide() vendor_price_label:Hide() else - unit_start_price_input:Show() + update_start_price_visibility() unit_buyout_price_input:Show() stack_size_slider:Show() stack_count_slider:Show() diff --git a/tabs/post/frame.lua b/tabs/post/frame.lua index acbbcf27..f976ea08 100644 --- a/tabs/post/frame.lua +++ b/tabs/post/frame.lua @@ -264,7 +264,15 @@ function aux.handle.INIT_UI() hide_checkbox = checkbox end do - local editbox = gui.editbox(frame.parameters) + local checkbox = gui.checkbox(frame.parameters) + checkbox:SetPoint('RIGHT', hide_checkbox, 'LEFT', -135, 0) + checkbox:SetScript('OnClick', update_start_price_visibility) + local label = gui.label(checkbox, gui.font_size.small) + label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1) + label:SetText('Starting = Buyout') + start_equals_buyout_checkbox = checkbox + end + do local editbox = gui.editbox(frame.parameters) editbox:SetPoint('TOPRIGHT', -71, -60) editbox:SetWidth(180) editbox:SetHeight(22)