Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 14 additions & 52 deletions tabs/post/core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -249,63 +259,15 @@ 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()
if not selected_item then
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
Expand Down Expand Up @@ -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()
Expand Down
10 changes: 9 additions & 1 deletion tabs/post/frame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down