refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-08-24 00:00:37 +02:00
parent 9fb468c84e
commit bf557e9c98
6 changed files with 74 additions and 72 deletions
+13 -11
View File
@@ -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
View File
@@ -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