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()
|
||||
|
||||
@@ -72,14 +72,14 @@ function update_form()
|
||||
end
|
||||
|
||||
if blizzard_query.exact then
|
||||
for key in temp-set 'class' 'subclass' 'slot' 'quality' do
|
||||
for key in temp-set('class', 'subclass', 'slot', 'quality') do
|
||||
_m[key..'_dropdown'].button:Disable()
|
||||
end
|
||||
else
|
||||
class_dropdown.button:Enable()
|
||||
quality_dropdown.button:Enable()
|
||||
end
|
||||
for key in temp-set 'min_level' 'max_level' do
|
||||
for key in temp-set('min_level', 'max_level') do
|
||||
if blizzard_query.exact then
|
||||
_m[key..'_input']:Disable()
|
||||
else
|
||||
@@ -92,7 +92,7 @@ function update_form()
|
||||
usable_checkbox:Enable()
|
||||
end
|
||||
|
||||
if any(temp-list 'min_level' 'max_level' 'usable' 'class' 'subclass' 'slot' 'quality', function(key) return blizzard_query[key] end) then
|
||||
if any(values('min_level', 'max_level', 'usable', 'class', 'subclass', 'slot', 'quality'), function(key) return blizzard_query[key] end) then
|
||||
exact_checkbox:Disable()
|
||||
else
|
||||
exact_checkbox:Enable()
|
||||
@@ -134,7 +134,7 @@ function get_filter_builder_query()
|
||||
add(strlower(_g['ITEM_QUALITY'..quality..'_DESC']))
|
||||
end
|
||||
|
||||
local post_filter_string = filter_util.query_string(temp-object :blizzard(tt) :post(post_filter))
|
||||
local post_filter_string = filter_util.query_string(temp-object('blizzard', tt, 'post', post_filter))
|
||||
add(post_filter_string ~= '' and post_filter_string)
|
||||
|
||||
return query_string or ''
|
||||
@@ -231,7 +231,7 @@ function data_link(id, str)
|
||||
end
|
||||
|
||||
post_filter = t
|
||||
filter_builder_state = -object :selected(0)
|
||||
filter_builder_state = -object('selected', 0)
|
||||
|
||||
function data_link_click()
|
||||
local button = arg3
|
||||
@@ -313,8 +313,8 @@ function set_filter_display_offset(x_offset, y_offset)
|
||||
end
|
||||
|
||||
function initialize_filter_dropdown()
|
||||
for _, filter in temp-list 'and' 'or' 'not' 'min-unit-bid' 'min-unit-buy' 'max-unit-bid' 'max-unit-buy' 'bid-profit' 'buy-profit' 'bid-vend-profit' 'buy-vend-profit' 'bid-dis-profit' 'buy-dis-profit' 'bid-pct' 'buy-pct' 'item' 'tooltip' 'min-lvl' 'max-lvl' 'rarity' 'left' 'utilizable' 'discard' do
|
||||
UIDropDownMenu_AddButton(-object :text(filter) :value(filter) :func(function()
|
||||
for _, filter in temp-list('and', 'or', 'not', 'min-unit-bid', 'min-unit-buy', 'max-unit-bid', 'max-unit-buy', 'bid-profit', 'buy-profit', 'bid-vend-profit', 'buy-vend-profit', 'bid-dis-profit', 'buy-dis-profit', 'bid-pct', 'buy-pct', 'item', 'tooltip', 'min-lvl', 'max-lvl', 'rarity', 'left', 'utilizable', 'discard') do
|
||||
UIDropDownMenu_AddButton(-object('text', filter, 'value', filter, 'func', function()
|
||||
filter_input:SetText(this.value)
|
||||
if index(filter_util.filters[this.value], 'input_type') == '' or this.value == 'not' then
|
||||
add_post_filter()
|
||||
@@ -323,8 +323,8 @@ function initialize_filter_dropdown()
|
||||
filter_parameter_input:SetFocus()
|
||||
else
|
||||
filter_input:SetFocus()
|
||||
end
|
||||
end))
|
||||
end)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ do
|
||||
while getn(searches) > search_index do
|
||||
tremove(searches)
|
||||
end
|
||||
local search = -object :filter_string(filter_string) :records(t)
|
||||
local search = -object('filter_string', filter_string, 'records', t)
|
||||
tinsert(searches, search)
|
||||
if getn(searches) > 5 then
|
||||
tremove(searches, 1)
|
||||
|
||||
Reference in New Issue
Block a user