diff --git a/libs/module.lua b/libs/module.lua index 6048273..655111b 100644 --- a/libs/module.lua +++ b/libs/module.lua @@ -43,7 +43,7 @@ do function declarator_mt:__newindex(key, value) self=state[self] local name, event = self.declaration_name, nil if name then - event = EVENT[key] or declaration_error() + event = EVENT[key] or error(name) else name, event = key, type(value) == 'function' and CALL or INDEX end diff --git a/tabs/post/frame.lua b/tabs/post/frame.lua index f797e30..75e2b22 100644 --- a/tabs/post/frame.lua +++ b/tabs/post/frame.lua @@ -226,6 +226,7 @@ function create_frames() unit_buyout_price:SetFocus() end end) + editbox.colorizer = function(text) return gsub(text, '[gsc]', function(str) return str == 'g' and aux.money.GOLD_TEXT or str == 's' and aux.money.SILVER_TEXT or str == 'c' and aux.money.COPPER_TEXT end) end editbox.formatter = function() return money.to_string(get_unit_start_price(), true, nil, 3) end editbox.change = function() refresh = true end editbox.enter = function() this:ClearFocus() end @@ -233,13 +234,13 @@ function create_frames() this:SetText(money.to_string(get_unit_start_price(), true, nil, 3, nil, true)) end do - local label = gui.label(frame, gui.font_size.small) - label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1) + local label = gui.label(editbox, gui.font_size.small) + label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1) label:SetText('Unit Starting Price') end do - local label = gui.label(frame, 14) - label:SetPoint('LEFT', frame, 'RIGHT', 8, 0) + local label = gui.label(editbox, 14) + label:SetPoint('LEFT', editbox, 'RIGHT', 8, 0) label:SetWidth(50) label:SetJustifyH('CENTER') start_price_percentage = label @@ -260,6 +261,7 @@ function create_frames() stack_size_slider.editbox:SetFocus() end end) + editbox.colorizer = function(text) return gsub(text, '[gsc]', function(str) return str == 'g' and aux.money.GOLD_TEXT or str == 's' and aux.money.SILVER_TEXT or str == 'c' and aux.money.COPPER_TEXT end) end editbox.formatter = function() return money.to_string(get_unit_buyout_price(), true, nil, 3) end editbox.change = function() refresh = true end editbox.enter = function() this:ClearFocus() end @@ -267,13 +269,13 @@ function create_frames() this:SetText(money.to_string(get_unit_buyout_price(), true, nil, 3, nil, true)) end do - local label = gui.label(frame, gui.font_size.small) - label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1) + local label = gui.label(editbox, gui.font_size.small) + label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1) label:SetText('Unit Buyout Price') end do - local label = gui.label(frame, 14) - label:SetPoint('LEFT', frame, 'RIGHT', 8, 0) + local label = gui.label(editbox, 14) + label:SetPoint('LEFT', editbox, 'RIGHT', 8, 0) label:SetWidth(50) label:SetJustifyH('CENTER') buyout_price_percentage = label diff --git a/util/money.lua b/util/money.lua index 654e95b..ff94157 100644 --- a/util/money.lua +++ b/util/money.lua @@ -1,9 +1,12 @@ aux 'money' +public() GOLD_TEXT = '|cffffd70ag|r' SILVER_TEXT = '|cffc7c7cfs|r' COPPER_TEXT = '|cffeda55fc|r' - +private() +--a = nil +----log(a) COPPER_PER_SILVER = 100 COPPER_PER_GOLD = 10000