diff --git a/README.md b/README.md index aca29b2..9d59e61 100644 --- a/README.md +++ b/README.md @@ -64,8 +64,9 @@ The most advanced auction house addOn for the 1.12 client with some features mor **/aux uc** (Toggles automatic undercutting.)
**/aux ignore owner** (Disables waiting for owner names when scanning. Recommended)
**/aux post bid** (Adds a bid price listing to the post tab)
-**/aux crafting cost** (Toggles the crafting price information)
**/aux post duration _hours_** (Sets the default auction duration to _2_/_8_/_24_ hours)
+**/aux post stack** (Toggles stack size saving per item in the post tab)
+**/aux crafting cost** (Toggles the crafting price information)
**/aux sharing** (Enable or disable auction data sharing as described above)
**/aux theme** (Switch between the two themes)
**/aux purchase summary** (Toggles the purchase summary window that tracks gold spending)
diff --git a/aux-addon.lua b/aux-addon.lua index 77e7045..c77aecf 100644 --- a/aux-addon.lua +++ b/aux-addon.lua @@ -67,15 +67,15 @@ function handle.LOAD() crafting_cost = true, post_bid = false, post_duration = post.DURATION_24, - post_stack = true, - undercut = true, + post_stack = true, + undercut = true, price_per_unit = false, items = {}, item_ids = {}, auctionable_items = {}, merchant_buy = {}, merchant_sell = {}, - sharing = true, + sharing = true, theme = 'blizzard', purchase_summary = true, }) diff --git a/tabs/post/core.lua b/tabs/post/core.lua index b6b6bf9..332cd8f 100644 --- a/tabs/post/core.lua +++ b/tabs/post/core.lua @@ -16,7 +16,7 @@ local gui = require 'aux.gui' local tab = aux.tab 'Post' -local settings_schema = {'tuple', '#', {duration='number'}, {start_price='number'}, {buyout_price='number'}, {hidden='boolean'}} +local settings_schema = {'tuple', '#', {duration='number'}, {start_price='number'}, {buyout_price='number'}, {hidden='boolean'}, {stack_size='number'}} local scan_id, inventory_records, bid_records, buyout_records = 0, {}, {}, {} @@ -27,7 +27,7 @@ refresh = true selected_item = nil function get_default_settings() - return T.map('duration', aux.account_data.post_duration, 'start_price', 0, 'buyout_price', 0, 'hidden', false) + return T.map('duration', aux.account_data.post_duration, 'start_price', 0, 'buyout_price', 0, 'hidden', false, 'stack_size', 1) end function aux.handle.LOAD2() @@ -463,11 +463,17 @@ function update_item(item) stack_size_slider:SetMinMaxValues(1, min(selected_item.max_stack, selected_item.aux_quantity)) end - if not aux.account_data.post_stack then - stack_size_slider:SetValue(math.random(1,ii)) - else + if not aux.account_data.post_stack then + -- post_stack OFF: Always use full/max stack size stack_size_slider:SetValue(aux.huge) - --stack_size_slider:SetValue(1) + else + -- post_stack ON: Use saved stack size if available, otherwise full stack + local settings = read_settings(selected_item.key) + if settings.stack_size and settings.stack_size > 0 and settings.stack_size <= ii then + stack_size_slider:SetValue(settings.stack_size) + else + stack_size_slider:SetValue(aux.huge) + end end quantity_update(true) diff --git a/tabs/post/frame.lua b/tabs/post/frame.lua index 1c2983b..acbbcf2 100644 --- a/tabs/post/frame.lua +++ b/tabs/post/frame.lua @@ -165,14 +165,33 @@ function aux.handle.INIT_UI() slider:SetScript('OnValueChanged', function() quantity_update(true) end) + local user_is_dragging = false + local editbox_has_user_focus = false + slider:SetScript('OnMouseDown', function() + user_is_dragging = true + end) + slider:SetScript('OnMouseUp', function() + -- Only save stack size if user was actively dragging + if selected_item and aux.account_data.post_stack and user_is_dragging then + local settings = read_settings() + settings.stack_size = slider:GetValue() + write_settings(settings) + end + user_is_dragging = false + end) slider.editbox.change = function() slider:SetValue(this:GetNumber()) quantity_update(true) - if selected_item then + -- Only save if user is actively typing (has focus) + if editbox_has_user_focus and selected_item and aux.account_data.post_stack then local settings = read_settings() + settings.stack_size = slider:GetValue() write_settings(settings) end end + slider.editbox:SetScript('OnEnterPressed', function() + slider.editbox:ClearFocus() + end) slider.editbox:SetScript('OnTabPressed', function() if IsShiftKeyDown() then unit_buyout_price_input:SetFocus() @@ -182,6 +201,13 @@ function aux.handle.INIT_UI() unit_start_price_input:SetFocus() end end) + -- Hook into gui framework's focus system + slider.editbox.focus_gain = function() + editbox_has_user_focus = true + end + slider.editbox.focus_loss = function() + editbox_has_user_focus = false + end slider.editbox:SetNumeric(true) slider.editbox:SetMaxLetters(3) slider.label:SetText('Stack Size')