refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-09-04 21:21:47 +02:00
parent e888efcf2a
commit 867505c1a8
23 changed files with 172 additions and 173 deletions
+4 -4
View File
@@ -273,7 +273,7 @@ function update_item_configuration()
historical_value_button:Hide()
hide_checkbox:Hide()
-- deposit:SetText('Deposit: '..money.to_string(0, nil, nil, nil, gui.inline_color.text.enabled))
-- deposit:SetText('Deposit: ' .. money.to_string(0, nil, nil, nil, gui.inline_color.text.enabled))
-- set_unit_start_price(0)
-- set_unit_buyout_price(0)
else
@@ -287,7 +287,7 @@ function update_item_configuration()
hide_checkbox:Show()
item.texture:SetTexture(selected_item.texture)
item.name:SetText('['..selected_item.name..']')
item.name:SetText('[' .. selected_item.name .. ']')
local color = ITEM_QUALITY_COLORS[selected_item.quality]
item.name:SetTextColor(color.r, color.g, color.b)
if selected_item.aux_quantity > 1 then
@@ -303,7 +303,7 @@ function update_item_configuration()
local deposit_factor = neutral_faction() and .25 or .05
local stack_size, stack_count = stack_size_slider:GetValue(), stack_count_slider:GetValue()
local amount = floor(selected_item.unit_vendor_price * deposit_factor * (selected_item.max_charges and 1 or stack_size)) * stack_count * UIDropDownMenu_GetSelectedValue(duration_dropdown) / 120
deposit:SetText('Deposit: '..aux.money.to_string(amount, nil, nil, nil, inline_color.text.enabled))
deposit:SetText('Deposit: ' .. aux.money.to_string(amount, nil, nil, nil, inline_color.text.enabled))
end
refresh_button:Enable()
@@ -438,7 +438,7 @@ end
function refresh_entries()
if selected_item then
local item_id, suffix_id = selected_item.item_id, selected_item.suffix_id
local item_key = item_id..':'..suffix_id
local item_key = item_id .. ':' .. suffix_id
existing_auctions[item_key] = nil
local query = scan_util.item_query(item_id)
status_bar:update_status(0,0)
+1 -1
View File
@@ -47,7 +47,7 @@ function create_frames()
set_item(this.item_record)
elseif arg1 == 'RightButton' then
tab = 1
search_tab.set_filter(strlower(info.item(this.item_record.item_id).name)..'/exact')
search_tab.set_filter(strlower(info.item(this.item_record.item_id).name) .. '/exact')
search_tab.execute(nil, false)
end
end,
+6 -6
View File
@@ -19,7 +19,7 @@ StaticPopupDialogs['AUX_SEARCH_AUTO_BUY'] = {
}
do
local function action()
_G.aux_auto_buy_filter = _G[this:GetParent():GetName()..'EditBox']:GetText()
_G.aux_auto_buy_filter = _G[this:GetParent():GetName() .. 'EditBox']:GetText()
update_auto_buy_filter()
end
@@ -29,7 +29,7 @@ do
button2 = 'Cancel',
hasEditBox = 1,
OnShow = function()
local edit_box = _G[this:GetName()..'EditBox']
local edit_box = _G[this:GetName() .. 'EditBox']
edit_box:SetMaxLetters(nil)
edit_box:SetFocus()
edit_box:HighlightText()
@@ -69,12 +69,12 @@ function CLOSE()
end
function CLICK_LINK(item_info)
set_filter(strlower(item_info.name)..'/exact')
set_filter(strlower(item_info.name) .. '/exact')
execute(nil, false)
end
function USE_ITEM(item_info)
set_filter(strlower(item_info.name)..'/exact')
set_filter(strlower(item_info.name) .. '/exact')
execute(nil, false)
end
@@ -107,10 +107,10 @@ function public.add_filter(filter_string)
old_filter_string = trim(old_filter_string)
if old_filter_string ~= '' then
old_filter_string = old_filter_string..';'
old_filter_string = old_filter_string .. ';'
end
search_box:SetText(old_filter_string..filter_string)
search_box:SetText(old_filter_string .. filter_string)
end
function blizzard_page_index(str)
+16 -16
View File
@@ -73,7 +73,7 @@ function update_form()
if blizzard_query.exact then
for key in temp-S('class', 'subclass', 'slot', 'quality') do
M[key..'_dropdown'].button:Disable()
M[key .. '_dropdown'].button:Disable()
end
else
class_dropdown.button:Enable()
@@ -81,9 +81,9 @@ function update_form()
end
for key in temp-S('min_level', 'max_level') do
if blizzard_query.exact then
M[key..'_input']:Disable()
M[key .. '_input']:Disable()
else
M[key..'_input']:Enable()
M[key .. '_input']:Enable()
end
end
if blizzard_query.exact then
@@ -104,7 +104,7 @@ function get_filter_builder_query()
local function add(part)
if part then
filter_string = filter_string and filter_string..'/'..part or part
filter_string = filter_string and filter_string .. '/' .. part or part
end
end
@@ -134,7 +134,7 @@ function get_filter_builder_query()
local quality = blizzard_query.quality
if quality and quality >= 0 then
add(strlower(_G['ITEM_QUALITY'..quality..'_DESC']))
add(strlower(_G['ITEM_QUALITY' .. quality .. '_DESC']))
end
local post_filter_string = filter_util.filter_string(post_filter)
@@ -193,11 +193,11 @@ function public.formatted_post_filter(components)
for i, component in components do
if no_line_break then
str = str..' '
str = str .. ' '
elseif i > 1 then
str = str..'</p><p>'
str = str .. '</p><p>'
for _=1,getn(stack) do
str = str..color.content.background('----')
str = str .. color.content.background('----')
end
end
no_line_break = component[1] == 'operator' and component[2] == 'not'
@@ -205,16 +205,16 @@ function public.formatted_post_filter(components)
local filter_color = (filter_builder_state.selected == i and color.orange or color.aux)
local component_text = filter_color(component[2])
if component[1] == 'operator' and component[2] ~= 'not' then
component_text = component_text..filter_color(tonumber(component[3]) or '')
component_text = component_text .. filter_color(tonumber(component[3]) or '')
tinsert(stack, component[3])
elseif component[1] == 'filter' then
for parameter in present(component[3]) do
if component[2] == 'item' then
parameter = aux.info.display_name(aux.cache.item_id(parameter)) or '['..parameter..']'
parameter = aux.info.display_name(aux.cache.item_id(parameter)) or '[' .. parameter .. ']'
elseif filter_util.filters[component[2]].input_type == 'money' then
parameter = aux.money.to_string(aux.money.from_string(parameter), nil, true)
end
component_text = component_text..filter_color(': ')..parameter
component_text = component_text .. filter_color(': ') .. parameter
end
while getn(stack) > 0 and stack[getn(stack)] do
local top = tremove(stack)
@@ -224,14 +224,14 @@ function public.formatted_post_filter(components)
end
end
end
str = str..data_link(i, component_text)
str = str .. data_link(i, component_text)
end
return '<html><body><p>'..str..'</p></body></html>'
return '<html><body><p>' .. str .. '</p></body></html>'
end
function data_link(id, str)
return '|H'..id..'|h'..str..'|h'
return '|H' .. id .. '|h' .. str .. '|h'
end
post_filter = t
@@ -266,7 +266,7 @@ function add_post_filter()
for str in present(filter_input:GetText()) do
for filter in present(filter_util.filters[str]) do
if filter.input_type ~= '' then
str = str..'/'..filter_parameter_input:GetText()
str = str .. '/' .. filter_parameter_input:GetText()
end
end
local components, error, suggestions = filter_util.parse_filter_string(str)
@@ -393,6 +393,6 @@ function initialize_quality_dropdown()
end
UIDropDownMenu_AddButton(T('text', ALL, 'value', -1, 'func', on_click))
for i = 0, 4 do
UIDropDownMenu_AddButton(T('text', _G['ITEM_QUALITY'..i..'_DESC'], 'value', i, 'func', on_click))
UIDropDownMenu_AddButton(T('text', _G['ITEM_QUALITY' .. i..'_DESC'], 'value', i, 'func', on_click))
end
end
+2 -2
View File
@@ -499,7 +499,7 @@ function create_frames()
dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, initialize_filter_dropdown)
end)
_G[dropdown:GetName()..'Text']:Hide()
_G[dropdown:GetName() .. 'Text']:Hide()
local label = gui.label(dropdown, gui.font_size.medium)
label:SetPoint('RIGHT', dropdown, 'LEFT', -15, 0)
label:SetText('Post Filter')
@@ -515,7 +515,7 @@ function create_frames()
input.change = function()
local text = this:GetText()
if filter_util.filters[text] and filter_util.filters[text].input_type ~= '' then
local _, _, suggestions = filter_util.parse_filter_string(text..'/')
local _, _, suggestions = filter_util.parse_filter_string(text .. '/')
filter_parameter_input:SetNumeric(filter_util.filters[text].input_type == 'number')
filter_parameter_input.complete = completion.complete(function() return suggestions or empty end)
filter_parameter_input:Show()