Merge pull request #5 from MarcelineVQ/stack-size-saving-clean
[ add ] stack size saving
This commit is contained in:
@@ -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 uc** (Toggles automatic undercutting.)<br/>
|
||||||
**/aux ignore owner** (Disables waiting for owner names when scanning. Recommended)<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 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 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 sharing** (Enable or disable auction data sharing as described above)<br/>
|
||||||
**/aux theme** (Switch between the two themes)<br/>
|
**/aux theme** (Switch between the two themes)<br/>
|
||||||
**/aux purchase summary** (Toggles the purchase summary window that tracks gold spending)<br/>
|
**/aux purchase summary** (Toggles the purchase summary window that tracks gold spending)<br/>
|
||||||
|
|||||||
+3
-3
@@ -67,15 +67,15 @@ function handle.LOAD()
|
|||||||
crafting_cost = true,
|
crafting_cost = true,
|
||||||
post_bid = false,
|
post_bid = false,
|
||||||
post_duration = post.DURATION_24,
|
post_duration = post.DURATION_24,
|
||||||
post_stack = true,
|
post_stack = true,
|
||||||
undercut = true,
|
undercut = true,
|
||||||
price_per_unit = false,
|
price_per_unit = false,
|
||||||
items = {},
|
items = {},
|
||||||
item_ids = {},
|
item_ids = {},
|
||||||
auctionable_items = {},
|
auctionable_items = {},
|
||||||
merchant_buy = {},
|
merchant_buy = {},
|
||||||
merchant_sell = {},
|
merchant_sell = {},
|
||||||
sharing = true,
|
sharing = true,
|
||||||
theme = 'blizzard',
|
theme = 'blizzard',
|
||||||
purchase_summary = true,
|
purchase_summary = true,
|
||||||
})
|
})
|
||||||
|
|||||||
+11
-5
@@ -16,7 +16,7 @@ local gui = require 'aux.gui'
|
|||||||
|
|
||||||
local tab = aux.tab 'Post'
|
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, {}, {}, {}
|
local scan_id, inventory_records, bid_records, buyout_records = 0, {}, {}, {}
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ refresh = true
|
|||||||
selected_item = nil
|
selected_item = nil
|
||||||
|
|
||||||
function get_default_settings()
|
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
|
end
|
||||||
|
|
||||||
function aux.handle.LOAD2()
|
function aux.handle.LOAD2()
|
||||||
@@ -464,10 +464,16 @@ function update_item(item)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not aux.account_data.post_stack then
|
if not aux.account_data.post_stack then
|
||||||
stack_size_slider:SetValue(math.random(1,ii))
|
-- post_stack OFF: Always use full/max stack size
|
||||||
else
|
|
||||||
stack_size_slider:SetValue(aux.huge)
|
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
|
end
|
||||||
|
|
||||||
quantity_update(true)
|
quantity_update(true)
|
||||||
|
|||||||
+27
-1
@@ -165,14 +165,33 @@ function aux.handle.INIT_UI()
|
|||||||
slider:SetScript('OnValueChanged', function()
|
slider:SetScript('OnValueChanged', function()
|
||||||
quantity_update(true)
|
quantity_update(true)
|
||||||
end)
|
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.editbox.change = function()
|
||||||
slider:SetValue(this:GetNumber())
|
slider:SetValue(this:GetNumber())
|
||||||
quantity_update(true)
|
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()
|
local settings = read_settings()
|
||||||
|
settings.stack_size = slider:GetValue()
|
||||||
write_settings(settings)
|
write_settings(settings)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
slider.editbox:SetScript('OnEnterPressed', function()
|
||||||
|
slider.editbox:ClearFocus()
|
||||||
|
end)
|
||||||
slider.editbox:SetScript('OnTabPressed', function()
|
slider.editbox:SetScript('OnTabPressed', function()
|
||||||
if IsShiftKeyDown() then
|
if IsShiftKeyDown() then
|
||||||
unit_buyout_price_input:SetFocus()
|
unit_buyout_price_input:SetFocus()
|
||||||
@@ -182,6 +201,13 @@ function aux.handle.INIT_UI()
|
|||||||
unit_start_price_input:SetFocus()
|
unit_start_price_input:SetFocus()
|
||||||
end
|
end
|
||||||
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:SetNumeric(true)
|
||||||
slider.editbox:SetMaxLetters(3)
|
slider.editbox:SetMaxLetters(3)
|
||||||
slider.label:SetText('Stack Size')
|
slider.label:SetText('Stack Size')
|
||||||
|
|||||||
Reference in New Issue
Block a user