refactoring
This commit is contained in:
+24
-22
@@ -39,30 +39,32 @@ do
|
||||
end
|
||||
|
||||
function LOAD()
|
||||
ARMOR = -set
|
||||
'INVTYPE_HEAD'
|
||||
'INVTYPE_NECK'
|
||||
'INVTYPE_SHOULDER'
|
||||
'INVTYPE_BODY'
|
||||
'INVTYPE_CHEST'
|
||||
'INVTYPE_ROBE'
|
||||
'INVTYPE_WAIST'
|
||||
'INVTYPE_LEGS'
|
||||
'INVTYPE_FEET'
|
||||
'INVTYPE_WRIST'
|
||||
'INVTYPE_HAND'
|
||||
'INVTYPE_FINGER'
|
||||
'INVTYPE_TRINKET'
|
||||
'INVTYPE_CLOAK'
|
||||
ARMOR = -set(
|
||||
'INVTYPE_HEAD',
|
||||
'INVTYPE_NECK',
|
||||
'INVTYPE_SHOULDER',
|
||||
'INVTYPE_BODY',
|
||||
'INVTYPE_CHEST',
|
||||
'INVTYPE_ROBE',
|
||||
'INVTYPE_WAIST',
|
||||
'INVTYPE_LEGS',
|
||||
'INVTYPE_FEET',
|
||||
'INVTYPE_WRIST',
|
||||
'INVTYPE_HAND',
|
||||
'INVTYPE_FINGER',
|
||||
'INVTYPE_TRINKET',
|
||||
'INVTYPE_CLOAK',
|
||||
'INVTYPE_HOLDABLE'
|
||||
WEAPON = -set
|
||||
'INVTYPE_2HWEAPON'
|
||||
'INVTYPE_WEAPONMAINHAND'
|
||||
'INVTYPE_WEAPON'
|
||||
'INVTYPE_WEAPONOFFHAND'
|
||||
'INVTYPE_SHIELD'
|
||||
'INVTYPE_RANGED'
|
||||
)
|
||||
WEAPON = -set(
|
||||
'INVTYPE_2HWEAPON',
|
||||
'INVTYPE_WEAPONMAINHAND',
|
||||
'INVTYPE_WEAPON',
|
||||
'INVTYPE_WEAPONOFFHAND',
|
||||
'INVTYPE_SHIELD',
|
||||
'INVTYPE_RANGED',
|
||||
'INVTYPE_RANGEDRIGHT'
|
||||
)
|
||||
end
|
||||
|
||||
function public.value(slot, quality, level)
|
||||
|
||||
+1
-5
@@ -93,12 +93,8 @@ function public.value(item_key)
|
||||
else
|
||||
value = calculate_market_value(item_record)
|
||||
end
|
||||
value_cache[item_key] = -object('value', value, 'next_push', tem_record.next_push)
|
||||
value_cache[item_key] = -object('value', value, 'next_push', item_record.next_push)
|
||||
end
|
||||
if type(value_cache[item_key].value) == 'table' then
|
||||
for k, v in value_cache[item_key].value.value do log(k, v) end
|
||||
end
|
||||
log (value_cache[item_key].value)
|
||||
return value_cache[item_key].value
|
||||
end
|
||||
|
||||
|
||||
+13
-11
@@ -395,17 +395,19 @@ 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)
|
||||
-- for k, v in auctionable_map[item_info.item_key].max_charges do log(k, v) end
|
||||
|
||||
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
|
||||
)
|
||||
else
|
||||
local auctionable = auctionable_map[item_info.item_key]
|
||||
auctionable.availability[charge_class] = (auctionable.availability[charge_class] or 0) + item_info.count
|
||||
|
||||
+23
-19
@@ -314,17 +314,21 @@ 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()
|
||||
filter_input:SetText(this.value)
|
||||
if index(filter_util.filters[this.value], 'input_type') == '' or this.value == 'not' then
|
||||
add_post_filter()
|
||||
elseif filter_util.filters[this.value] then
|
||||
filter_parameter_input:Show()
|
||||
filter_parameter_input:SetFocus()
|
||||
else
|
||||
filter_input:SetFocus()
|
||||
end)
|
||||
end)
|
||||
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()
|
||||
elseif filter_util.filters[this.value] then
|
||||
filter_parameter_input:Show()
|
||||
filter_parameter_input:SetFocus()
|
||||
else
|
||||
filter_input:SetFocus()
|
||||
end
|
||||
end
|
||||
))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -339,9 +343,9 @@ function initialize_class_dropdown()
|
||||
update_form()
|
||||
end
|
||||
end
|
||||
UIDropDownMenu_AddButton(-object :text(ALL) :value(0) :func(on_click))
|
||||
UIDropDownMenu_AddButton(-object('text', ALL, 'value', 0, 'func', on_click))
|
||||
for i, class in temp-{GetAuctionItemClasses()} do
|
||||
UIDropDownMenu_AddButton(-object :text(class) :value(i) :func(on_click))
|
||||
UIDropDownMenu_AddButton(-object('text', class, 'value', i, 'func', on_click))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -356,9 +360,9 @@ function initialize_subclass_dropdown()
|
||||
end
|
||||
local class_index = UIDropDownMenu_GetSelectedValue(class_dropdown)
|
||||
if class_index and GetAuctionItemSubClasses(class_index) then
|
||||
UIDropDownMenu_AddButton(-object :text(ALL) :value(0) :func(on_click))
|
||||
UIDropDownMenu_AddButton(-object('text', ALL, 'value', 0, 'func', on_click))
|
||||
for i, subclass in temp-{GetAuctionItemSubClasses(class_index)} do
|
||||
UIDropDownMenu_AddButton(-object :text(subclass) :value(i) :func(on_click))
|
||||
UIDropDownMenu_AddButton(-object('text', subclass, 'value', i, 'func', on_click))
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -371,9 +375,9 @@ function initialize_slot_dropdown()
|
||||
local class_index = UIDropDownMenu_GetSelectedValue(class_dropdown)
|
||||
local subclass_index = UIDropDownMenu_GetSelectedValue(subclass_dropdown)
|
||||
if subclass_index and GetAuctionInvTypes(class_index, subclass_index) then
|
||||
UIDropDownMenu_AddButton(-object :text(ALL) :value '' :func(on_click))
|
||||
UIDropDownMenu_AddButton(-object('text', ALL, 'value', '', 'func', on_click))
|
||||
for _, slot in {GetAuctionInvTypes(class_index, subclass_index)} do
|
||||
UIDropDownMenu_AddButton(-object :text(_g[slot]) :value(slot) :func(on_click))
|
||||
UIDropDownMenu_AddButton(-object('text', _g[slot], 'value', slot, 'func', on_click))
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -383,8 +387,8 @@ function initialize_quality_dropdown()
|
||||
UIDropDownMenu_SetSelectedValue(quality_dropdown, this.value)
|
||||
update_form()
|
||||
end
|
||||
UIDropDownMenu_AddButton(-object :text(ALL) :value(-1) :func(on_click))
|
||||
UIDropDownMenu_AddButton(-object('text', ALL, 'value', -1, 'func', on_click))
|
||||
for i=0,4 do
|
||||
UIDropDownMenu_AddButton(-object :text(_g['ITEM_QUALITY'..i..'_DESC']) :value(i) :func(on_click))
|
||||
UIDropDownMenu_AddButton(-object('text', _g['ITEM_QUALITY'..i..'_DESC'], 'value', i, 'func', on_click))
|
||||
end
|
||||
end
|
||||
|
||||
+12
-11
@@ -563,20 +563,21 @@ end
|
||||
|
||||
function public.query_builder()
|
||||
local filter
|
||||
return -object
|
||||
:appended(function(part)
|
||||
return -object(
|
||||
'appended', function(part)
|
||||
return query_builder(not filter and part or filter..'/'..part)
|
||||
end)
|
||||
:prepended(function(part)
|
||||
end,
|
||||
'prepended', function(part)
|
||||
return query_builder(not filter and part or part..'/'..filter)
|
||||
end)
|
||||
:append(function(part)
|
||||
end,
|
||||
'append', function(part)
|
||||
filter = not filter and part or filter..'/'..part
|
||||
end)
|
||||
:prepend(function(part)
|
||||
end,
|
||||
'prepend', function(part)
|
||||
filter = not filter and part or part..'/'..filter
|
||||
end)
|
||||
:get(function()
|
||||
end,
|
||||
'get', function()
|
||||
return filter or ''
|
||||
end)
|
||||
end
|
||||
)
|
||||
end
|
||||
+1
-4
@@ -71,10 +71,7 @@ function public.find(auction_record, status_bar, on_abort, on_failure, on_succes
|
||||
end
|
||||
|
||||
function public.item_query(item_id, first_page, last_page)
|
||||
|
||||
local item_info = info.item(item_id)
|
||||
|
||||
if item_info then
|
||||
for item_info in present(info.item(item_id)) do
|
||||
local query = filter_util.query(item_info.name..'/exact')
|
||||
query.blizzard_query.first_page = first_page
|
||||
query.blizzard_query.last_page = last_page
|
||||
|
||||
Reference in New Issue
Block a user