refactoring
This commit is contained in:
+13
-25
@@ -4,12 +4,7 @@ local DURATION_4, DURATION_8, DURATION_24 = 120, 480, 1440
|
||||
local settings_schema = {'record', '#', {stack_size='number'}, {duration='number'}, {start_price='number'}, {buyout_price='number'}, {hidden='boolean'}}
|
||||
|
||||
function accessor.default_settings()
|
||||
return -object
|
||||
:duration(DURATION_8)
|
||||
:stack_size(1)
|
||||
:start_price(0)
|
||||
:buyout_price(0)
|
||||
:hidden(false)
|
||||
return -object('duration', DURATION_8 , 'stack_size', 1, 'start_price', 0, 'buyout_price', 0, 'hidden', false)
|
||||
end
|
||||
|
||||
do
|
||||
@@ -400,18 +395,17 @@ function update_inventory_records()
|
||||
availability[i] = 0
|
||||
end
|
||||
availability[charge_class] = item_info.count
|
||||
auctionable_map[item_info.item_key] = -object
|
||||
:item_id (item_info.item_id)
|
||||
:suffix_id (item_info.suffix_id)
|
||||
:key (item_info.item_key)
|
||||
:itemstring (item_info.itemstring)
|
||||
:name (item_info.name)
|
||||
:texture (item_info.texture)
|
||||
:quality (item_info.quality)
|
||||
:aux_quantity (item_info.charges or item_info.count)
|
||||
:max_stack (item_info.max_stack)
|
||||
:max_charges (item_info.max_charges)
|
||||
:availability (availability)
|
||||
auctionable_map[item_info.item_key] = -object ('item_id', item_info.item_id, 'suffix_id', item_info.suffix_id, 'key', item_info.item_key)
|
||||
:itemstring(item_info.itemstring)
|
||||
:name(item_info.name)
|
||||
:texture(item_info.texture)
|
||||
:quality(item_info.quality)
|
||||
:aux_quantity(item_info.charges or item_info.count)
|
||||
:max_stack(item_info.max_stack)
|
||||
:max_charges(item_info.max_charges)
|
||||
:availability(availability)
|
||||
-- for k, v in auctionable_map[item_info.item_key].max_charges do log(k, v) end
|
||||
|
||||
else
|
||||
local auctionable = auctionable_map[item_info.item_key]
|
||||
auctionable.availability[charge_class] = (auctionable.availability[charge_class] or 0) + item_info.count
|
||||
@@ -482,13 +476,7 @@ function record_auction(key, aux_quantity, unit_blizzard_bid, unit_buyout_price,
|
||||
end
|
||||
end
|
||||
if not entry then
|
||||
entry = -object
|
||||
:stack_size (aux_quantity)
|
||||
:unit_blizzard_bid (unit_blizzard_bid)
|
||||
:unit_buyout_price (unit_buyout_price)
|
||||
:duration (duration)
|
||||
:own (is_player(owner))
|
||||
:count (0)
|
||||
entry = -object('stack_size', aux_quantity 'unit_blizzard_bid', unit_blizzard_bid 'unit_buyout_price', unit_buyout_price 'duration', duration 'own', is_player(owner) 'count', 0)
|
||||
tinsert(existing_auctions[key], entry)
|
||||
end
|
||||
entry.count = entry.count + 1
|
||||
|
||||
+14
-14
@@ -1,4 +1,4 @@
|
||||
module 'post_tab' import [''] 'core' 'gui' 'listing' 'item_listing' 'money'
|
||||
module 'post_tab' import [''] 'core' 'gui' 'listing' 'item_listing' 'money' 'search_tab'
|
||||
|
||||
function create_frames()
|
||||
frame = CreateFrame('Frame', nil, aux_frame)
|
||||
@@ -34,7 +34,7 @@ function create_frames()
|
||||
end)
|
||||
local label = gui.label(checkbox, gui.font_size.small)
|
||||
label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1)
|
||||
label:SetText('Show hidden items')
|
||||
label:SetText 'Show hidden items'
|
||||
show_hidden_checkbox = checkbox
|
||||
end
|
||||
|
||||
@@ -57,15 +57,15 @@ function create_frames()
|
||||
)
|
||||
|
||||
auction_listing = listing.CreateScrollingTable(frame.auctions)
|
||||
auction_listing:SetColInfo({
|
||||
{ name='Auctions', width=.12, align='CENTER' },
|
||||
{ name='Left', width=.1, align='CENTER' },
|
||||
{ name='Qty', width=.08, align='CENTER' },
|
||||
{ name='Bid/ea', width=.22, align='RIGHT' },
|
||||
{ name='Bid Pct', width=.13, align='CENTER' },
|
||||
{ name='Buy/ea', width=.22, align='RIGHT' },
|
||||
{ name='Buy Pct', width=.13, align='CENTER' }
|
||||
})
|
||||
auction_listing:SetColInfo{
|
||||
{name='Auctions', width=.12, align='CENTER'},
|
||||
{name='Left', width=.1, align='CENTER'},
|
||||
{name='Qty', width=.08, align='CENTER'},
|
||||
{name='Bid/ea', width=.22, align='RIGHT'},
|
||||
{name='Bid Pct', width=.13, align='CENTER'},
|
||||
{name='Buy/ea', width=.22, align='RIGHT'},
|
||||
{name='Buy Pct', width=.13, align='CENTER'}
|
||||
}
|
||||
auction_listing:EnableSorting(false)
|
||||
auction_listing:DisableSelection(true)
|
||||
auction_listing:SetHandler('OnClick', function(table, row_data, column, button)
|
||||
@@ -86,14 +86,14 @@ function create_frames()
|
||||
status_bar:SetHeight(25)
|
||||
status_bar:SetPoint('TOPLEFT', aux_frame.content, 'BOTTOMLEFT', 0, -6)
|
||||
status_bar:update_status(100, 100)
|
||||
status_bar:set_text('')
|
||||
status_bar:set_text ''
|
||||
end
|
||||
do
|
||||
local btn = gui.button(frame.parameters, 16)
|
||||
btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Post')
|
||||
btn:SetText 'Post'
|
||||
btn:SetScript('OnClick', post_auctions)
|
||||
post_button = btn
|
||||
end
|
||||
@@ -102,7 +102,7 @@ function create_frames()
|
||||
btn:SetPoint('TOPLEFT', post_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Refresh')
|
||||
btn:SetText 'Refresh'
|
||||
btn:SetScript('OnClick', function()
|
||||
scan.abort(scan_id)
|
||||
refresh_entries()
|
||||
|
||||
Reference in New Issue
Block a user