diff --git a/gui.lua b/gui.lua index 83932a9..887a66b 100644 --- a/gui.lua +++ b/gui.lua @@ -9,8 +9,6 @@ public.config = { panel = {backdrop = {24, 24, 24, 1}, border = {255, 255, 255, .03}}, content = {backdrop = {42, 42, 42, 1}, border = {0, 0, 0, 0}}, state = {enabled = {70, 180, 70}, disabled = {190, 70, 70}}, - money1 = {gold = {255, 215, 10, 1}, silver = {252, 199, 207, 1}, copper = {237, 165, 95, 1}}, - money2 = {gold = {}, silver = {}, copper = {}}, }, edge_size = 1.5, font = [[Fonts\ARIALN.TTF]], @@ -95,9 +93,11 @@ function m.LOAD() if strfind(dropdown:GetName() or '', 'aux_frame') then DropDownList1Backdrop:SetBackdrop({}) DropDownList1Backdrop.border:Show() + DropDownList1Backdrop.backdrop:SetAllPoints() DropDownList1Backdrop.backdrop:Show() DropDownList1:SetWidth(dropdown:GetWidth() * 0.9) DropDownList1:SetHeight(DropDownList1:GetHeight() - 10) + DropDownList1:ClearAllPoints() DropDownList1:SetPoint('TOPLEFT', dropdown, 'BOTTOMLEFT', -2, -2) for i=1,UIDROPDOWNMENU_MAXBUTTONS do local button = getglobal('DropDownList1Button'..i) diff --git a/init.lua b/init.lua index 132ebe7..7d014c1 100644 --- a/init.lua +++ b/init.lua @@ -1,22 +1,28 @@ -local module = aux_module() -aux = tremove(module, 1) -local m, public, private = unpack(module) +local addon = aux_module() +aux = tremove(addon, 1) +local m, public, private = unpack(addon) public.version = '3.9.0' -local function initialize_module(private_declarator) - private_declarator.LOAD = nil -end -initialize_module(public) -private.modules = {aux=module} -function public.module(name) - if m.modules[name] then - return unpack(m.modules[name]) +private.modules = {} +function public.module(path) + if path == 'aux' then + return unpack(addon) + elseif m.modules[path] then + return unpack(m.modules[path]) else - local module = aux_module() - initialize_module(module[4]) - m.modules[name] = module - public[name] = tremove(module, 1) + local module, prefix + for name in string.gfind(path, '[%a_][%w_]*') do + local qualified_name = prefix and prefix..'.'..name or name + module = m.modules[qualified_name] + if not module then + module = aux_module() + module[4].LOAD = nil + (prefix and m.modules[prefix] or addon)[2][name] = tremove(module, 1) + m.modules[qualified_name] = module + end + prefix = qualified_name + end return unpack(module) end end diff --git a/tabs/post/core.lua b/tabs/post/core.lua index c3fcd94..b2f9858 100644 --- a/tabs/post/core.lua +++ b/tabs/post/core.lua @@ -70,7 +70,7 @@ end function private.get_unit_start_price() local money_text = m.unit_start_price:GetText() - return aux.money.from_string(money_text) or (tonumber(money_text) and tonumber(money_text) * 10000) or 0 + return aux.money.from_string(money_text) or 0 end function private.set_unit_start_price(amount) @@ -79,7 +79,7 @@ end function private.get_unit_buyout_price() local money_text = m.unit_buyout_price:GetText() - return aux.money.from_string(money_text) or (tonumber(money_text) and tonumber(money_text) * 10000) or 0 + return aux.money.from_string(money_text) or 0 end function private.set_unit_buyout_price(amount) diff --git a/util/filter.lua b/util/filter.lua index fbb9a19..aa0014c 100644 --- a/util/filter.lua +++ b/util/filter.lua @@ -1,5 +1,10 @@ local m, public, private = aux.module'filter' +private.OPERATOR_COLOR = '' +private.FILTER_COLOR = '' +private.PARAMETER_COLOR = '' + + function private.default_filter(str) return { input_type = '', diff --git a/util/money.lua b/util/money.lua index f43ce52..d6619dc 100644 --- a/util/money.lua +++ b/util/money.lua @@ -1,8 +1,8 @@ local m, public, private = aux.module'money' -local GOLD_TEXT = '|cffffd70ag|r' -local SILVER_TEXT = '|cffc7c7cfs|r' -local COPPER_TEXT = '|cffeda55fc|r' +private.GOLD_TEXT = '|cffffd70ag|r' +private.SILVER_TEXT = '|cffc7c7cfs|r' +private.COPPER_TEXT = '|cffeda55fc|r' do local COPPER_PER_SILVER = 100 @@ -21,7 +21,6 @@ do end function public.to_string(money, pad, trim, decimal_points, color, no_color) - local is_negative = money < 0 money = abs(money) local gold, silver, copper = m.to_GSC(money) @@ -35,7 +34,7 @@ function public.to_string(money, pad, trim, decimal_points, color, no_color) if no_color then gold_text, silver_text, copper_text = 'g', 's', 'c' else - gold_text, silver_text, copper_text = GOLD_TEXT, SILVER_TEXT, COPPER_TEXT + gold_text, silver_text, copper_text = m.GOLD_TEXT, m.SILVER_TEXT, m.COPPER_TEXT end local text @@ -73,10 +72,12 @@ function public.to_string(money, pad, trim, decimal_points, color, no_color) end function public.from_string(value) - value = strlower(value) + for _, number in {tonumber(value)} do + return number * COPPER_PER_GOLD + end -- remove any colors - value = gsub(gsub(value, '\124c([0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])', ''), '\124r', '') + value = gsub(gsub(strlower(value), '|c%x%x%x%x%x%x%x%x', ''), '|r', '') -- extract gold/silver/copper values local gold = tonumber(({strfind(value, '(%d*%.?%d+)g')})[3]) @@ -94,10 +95,8 @@ function public.from_string(value) end function public.format_number(num, pad, decimal_padding, color) - local padding = pad and 2 + (decimal_padding and decimal_padding + 1 or 0) or 0 num = format('%0'..padding..'.0'..(decimal_padding or 0)..'f', num) - if color then return color..num..FONT_COLOR_CODE_CLOSE else