some ui improvements
This commit is contained in:
+12
-32
@@ -1,18 +1,5 @@
|
||||
local m, public, private = aux.module'util'
|
||||
|
||||
function public.pass()
|
||||
end
|
||||
|
||||
function public.id(x)
|
||||
return x
|
||||
end
|
||||
|
||||
function public.const(x)
|
||||
return function()
|
||||
return x
|
||||
end
|
||||
end
|
||||
|
||||
function public.size(t)
|
||||
local x = 0
|
||||
for _ in t do
|
||||
@@ -72,7 +59,11 @@ end
|
||||
function public.any(xs, p)
|
||||
local holds = false
|
||||
for _, x in xs do
|
||||
holds = holds or p(x)
|
||||
if p then
|
||||
holds = holds or p(x)
|
||||
else
|
||||
holds = holds or x
|
||||
end
|
||||
end
|
||||
return holds
|
||||
end
|
||||
@@ -80,7 +71,11 @@ end
|
||||
function public.all(xs, p)
|
||||
local holds = true
|
||||
for _, x in xs do
|
||||
holds = holds and p(x)
|
||||
if p then
|
||||
holds = holds and p(x)
|
||||
else
|
||||
holds = holds and x
|
||||
end
|
||||
end
|
||||
return holds
|
||||
end
|
||||
@@ -227,7 +222,6 @@ function public.bag_type(bag)
|
||||
if bag == 0 then
|
||||
return 1
|
||||
end
|
||||
|
||||
if GetInventoryItemLink('player', ContainerIDToInventoryID(bag)) then
|
||||
local item_id = aux.info.parse_hyperlink(GetInventoryItemLink('player', ContainerIDToInventoryID(bag)))
|
||||
local item_info = aux.info.item(item_id)
|
||||
@@ -251,22 +245,8 @@ function public.signal()
|
||||
end
|
||||
end
|
||||
|
||||
function public.without_errors(f)
|
||||
local orig = UIErrorsFrame.AddMessage
|
||||
UIErrorsFrame.AddMessage = m.pass
|
||||
f()
|
||||
UIErrorsFrame.AddMessage = orig
|
||||
end
|
||||
|
||||
function public.without_sound(f)
|
||||
local orig = GetCVar('MasterSoundEffects')
|
||||
SetCVar('MasterSoundEffects', 0)
|
||||
f()
|
||||
SetCVar('MasterSoundEffects', orig)
|
||||
end
|
||||
|
||||
function public.format_money(money, exact, color)
|
||||
color = color or '|r'
|
||||
color = color or FONT_COLOR_CODE_CLOSE
|
||||
|
||||
local TEXT_NONE = '0'
|
||||
|
||||
@@ -275,7 +255,7 @@ function public.format_money(money, exact, color)
|
||||
local GSC_COPPER = 'c8602c'
|
||||
local GSC_START = '|cff%s%d|r'
|
||||
local GSC_PART = color..'.|cff%s%02d|r'
|
||||
local GSC_NONE = '|cffa0a0a0'..TEXT_NONE..'|r'
|
||||
local GSC_NONE = '|cffa0a0a0'..TEXT_NONE..FONT_COLOR_CODE_CLOSE
|
||||
|
||||
if not exact and money >= 10000 then
|
||||
-- Round to nearest silver
|
||||
|
||||
+13
-13
@@ -543,12 +543,12 @@ function public.indented_post_query_string(components)
|
||||
|
||||
if component[1] == 'operator' and component[2] then
|
||||
no_line_break = component[2] == 'not'
|
||||
str = str..'|cffffff00'..component[2]..(tonumber(component[3]) or '')..'|r'
|
||||
str = str..'|cffffff00'..component[2]..(tonumber(component[3]) or '')..FONT_COLOR_CODE_CLOSE
|
||||
tinsert(stack, component[3] or '*')
|
||||
elseif component[1] == 'filter' then
|
||||
str = str..'|cffffff00'..component[2]..'|r'
|
||||
str = str..'|cffffff00'..component[2]..FONT_COLOR_CODE_CLOSE
|
||||
if component[3] then
|
||||
str = str..': '..'|cffff9218'..component[3]..'|r'
|
||||
str = str..': '..'|cffff9218'..component[3]..FONT_COLOR_CODE_CLOSE
|
||||
end
|
||||
while getn(stack) > 0 and stack[getn(stack)] ~= '*' do
|
||||
local top = tremove(stack)
|
||||
@@ -570,29 +570,29 @@ function private.prettified_query_string(components)
|
||||
for _, filter in components.blizzard do
|
||||
blizzard_filters[filter[1]] = filter[2] or true
|
||||
if filter[1] == 'exact' then
|
||||
prettified.prepend(aux.info.display_name(aux.cache.item_id(m.unquote(blizzard_filters.name))) or aux.gui.inline_color({216, 225, 211, 1})..'['..m.unquote(blizzard_filters.name)..']|r')
|
||||
prettified.prepend(aux.info.display_name(aux.cache.item_id(m.unquote(blizzard_filters.name))) or aux.gui.inline_color.label.enabled..'['..m.unquote(blizzard_filters.name)..']|r')
|
||||
elseif filter[1] ~= 'name' then
|
||||
prettified.append(aux.gui.inline_color({216, 225, 211, 1})..(filter[2] or filter[1])..'|r')
|
||||
prettified.append(aux.gui.inline_color.label.enabled..(filter[2] or filter[1])..FONT_COLOR_CODE_CLOSE)
|
||||
end
|
||||
end
|
||||
|
||||
if blizzard_filters.name and not blizzard_filters.exact then
|
||||
if m.unquote(blizzard_filters.name) == '' then
|
||||
prettified.prepend('|cffff0000'..'No Filter'..'|r')
|
||||
prettified.prepend(RED_FONT_COLOR_CODE..'No Filter'..FONT_COLOR_CODE_CLOSE)
|
||||
else
|
||||
prettified.prepend(aux.gui.inline_color({216, 225, 211, 1})..m.unquote(blizzard_filters.name)..'|r')
|
||||
prettified.prepend(aux.gui.inline_color.label.enabled..m.unquote(blizzard_filters.name)..FONT_COLOR_CODE_CLOSE)
|
||||
end
|
||||
end
|
||||
|
||||
for _, component in components.post do
|
||||
if component[1] == 'operator' then
|
||||
prettified.append('|cffffff00'..component[2]..(tonumber(component[3]) or '')..'|r')
|
||||
prettified.append('|cffffff00'..component[2]..(tonumber(component[3]) or '')..FONT_COLOR_CODE_CLOSE)
|
||||
elseif component[1] == 'filter' then
|
||||
if component[2] ~= 'tooltip' then
|
||||
prettified.append('|cffffff00'..component[2]..'|r')
|
||||
prettified.append('|cffffff00'..component[2]..FONT_COLOR_CODE_CLOSE)
|
||||
end
|
||||
if component[3] then
|
||||
prettified.append('|cffff9218'..component[3]..'|r')
|
||||
prettified.append('|cffff9218'..component[3]..FONT_COLOR_CODE_CLOSE)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -676,15 +676,15 @@ function private.validator(components)
|
||||
if name == 'not' then
|
||||
tinsert(stack, not args[1])
|
||||
elseif name == 'and' then
|
||||
tinsert(stack, aux.util.all(args, aux.util.id))
|
||||
tinsert(stack, aux.util.all(args))
|
||||
elseif name == 'or' then
|
||||
tinsert(stack, aux.util.any(args, aux.util.id))
|
||||
tinsert(stack, aux.util.any(args))
|
||||
end
|
||||
elseif type == 'filter' then
|
||||
tinsert(stack, validators[i](record) and true or false)
|
||||
end
|
||||
end
|
||||
return aux.util.all(stack, aux.util.id)
|
||||
return aux.util.all(stack)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
+2
-2
@@ -63,7 +63,7 @@ function public.to_string(money, pad, trim, decimal_points, color, no_color)
|
||||
|
||||
if is_negative then
|
||||
if color then
|
||||
text = color..'-|r'..text
|
||||
text = color..'-'..FONT_COLOR_CODE_CLOSE..text
|
||||
else
|
||||
text = '-'..text
|
||||
end
|
||||
@@ -99,7 +99,7 @@ function public.format_number(num, pad, decimal_padding, color)
|
||||
num = format('%0'..padding..'.0'..(decimal_padding or 0)..'f', num)
|
||||
|
||||
if color then
|
||||
return color..num..'|r'
|
||||
return color..num..FONT_COLOR_CODE_CLOSE
|
||||
else
|
||||
return num
|
||||
end
|
||||
|
||||
@@ -5,8 +5,8 @@ aux_datasets = {}
|
||||
do
|
||||
local realm, faction
|
||||
|
||||
function public.LOAD()
|
||||
aux.control.thread(aux.control.when, function() faction = UnitFactionGroup('player') return faction end, aux.util.pass)
|
||||
function m.LOAD()
|
||||
aux.control.thread(aux.control.when, function() faction = UnitFactionGroup('player') return faction end, function() end)
|
||||
realm = GetCVar('realmName')
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user