Merge pull request #5 from MarcelineVQ/stack-size-saving-clean

[ add ] stack size saving
This commit is contained in:
OldManAlpha
2025-10-02 16:39:09 -07:00
committed by GitHub
4 changed files with 44 additions and 11 deletions
+2 -1
View File
@@ -64,8 +64,9 @@ The most advanced auction house addOn for the 1.12 client with some features mor
**/aux uc** (Toggles automatic undercutting.)<br/>
**/aux ignore owner** (Disables waiting for owner names when scanning. Recommended)<br/>
**/aux post bid** (Adds a bid price listing to the post tab)<br/>
**/aux crafting cost** (Toggles the crafting price information)<br/>
**/aux post duration _hours_** (Sets the default auction duration to _2_/_8_/_24_ hours)<br/>
**/aux post stack** (Toggles stack size saving per item in the post tab)<br/>
**/aux crafting cost** (Toggles the crafting price information)<br/>
**/aux sharing** (Enable or disable auction data sharing as described above)<br/>
**/aux theme** (Switch between the two themes)<br/>
**/aux purchase summary** (Toggles the purchase summary window that tracks gold spending)<br/>
+3 -3
View File
@@ -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,
})
+12 -6
View File
@@ -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)
+27 -1
View File
@@ -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')