Add local fps for ldb
Add colored numbers instead of full string
This commit is contained in:
parent
8032532c51
commit
ef1fadf665
76
broker.lua
76
broker.lua
|
@ -114,24 +114,45 @@ end
|
||||||
local function toggleColor(col,col1,col2)
|
local function toggleColor(col,col1,col2)
|
||||||
return col == col1 and col2 or col1
|
return col == col1 and col2 or col1
|
||||||
end
|
end
|
||||||
local function computelatency()
|
local function compute_colorpick(name, val)
|
||||||
return select(3,GetNetStats())
|
local color = db[format('%scolor', name)]
|
||||||
|
if(db[format('%slow', name)] and tonumber(db[format('%slow', name)]) > 0 and val <= tonumber(db[format('%slow', name)])) then
|
||||||
|
color = db[format('%slowcolor', name)]
|
||||||
|
end
|
||||||
|
if(db[format('%smedium', name)] and tonumber(db[format('%smedium', name)]) > 0 and val >= tonumber(db[format('%smedium', name)])) then
|
||||||
|
color = db[format('%smediumcolor', name)]
|
||||||
|
end
|
||||||
|
if(db[format('%shigh', name)] and tonumber(db[format('%shigh', name)]) > 0 and val >= tonumber(db[format('%shigh', name)])) then
|
||||||
|
color = db[format('%shighcolor', name)]
|
||||||
|
end
|
||||||
|
return color
|
||||||
end
|
end
|
||||||
local function compute()
|
local function compute()
|
||||||
local c = date(db['clockstring'])
|
|
||||||
local d = date(db['datestring'])
|
local d = date(db['datestring'])
|
||||||
for k in pairs(replaces) do
|
for k in pairs(replaces) do
|
||||||
if(k ~= L[k]) then
|
if(k ~= L[k]) then
|
||||||
d = d:gsub(k, L[k])
|
d = d:gsub(k, L[k])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local h, w = computelatency()
|
local h, w = select(3,GetNetStats())
|
||||||
local l = db['latencystring']
|
local l = db['latencystring']
|
||||||
l = l:gsub("%%world", w)
|
l = l:gsub("%%world", w)
|
||||||
l = l:gsub("%%local", h)
|
l = l:gsub("%%local", h)
|
||||||
local f = db['fpsstring']
|
local f = db['fpsstring']
|
||||||
f = f:gsub("%%fps",floor(GetFramerate()))
|
local fr = floor(GetFramerate())
|
||||||
return c,d,l,f
|
f = f:gsub("%%fps", fr)
|
||||||
|
return {
|
||||||
|
['clockstring'] = date(db['clockstring']),
|
||||||
|
['datestring'] = d,
|
||||||
|
['latencystring'] = l,
|
||||||
|
['latencycolor'] = compute_colorpick('latency', w),
|
||||||
|
['latencyvalue'] = w,
|
||||||
|
['latencyhomevalue'] = h,
|
||||||
|
['latencyhomecolor'] = compute_colorpick('latency', h),
|
||||||
|
['fpscolor'] = compute_colorpick('fps', fr),
|
||||||
|
['fpsstring'] = f,
|
||||||
|
['fpsvalue'] = fr
|
||||||
|
}
|
||||||
end
|
end
|
||||||
local function sortTab(a,b)
|
local function sortTab(a,b)
|
||||||
return a['mem'] > b['mem']
|
return a['mem'] > b['mem']
|
||||||
|
@ -147,13 +168,13 @@ local function OnTooltipShow(tip)
|
||||||
child['lastainfo'] = GetTime() + ainfodelay
|
child['lastainfo'] = GetTime() + ainfodelay
|
||||||
end
|
end
|
||||||
local ainfo = child['ainfo']
|
local ainfo = child['ainfo']
|
||||||
local c,d,l,f = compute()
|
local com = compute()
|
||||||
tip:AddLine(childName)
|
tip:AddLine(childName)
|
||||||
local col = "00ff00"
|
local col = "00ff00"
|
||||||
if(db['expert']) then
|
if(db['expert']) then
|
||||||
tip:AddLine(child:colorize(d,col))
|
tip:AddLine(child:colorize(com['datestring'], col))
|
||||||
else
|
else
|
||||||
tip:AddLine(child:colorize(format("%s, %s.%s",L[date("%A")],date("%d"),L[date("%B")]),col))
|
tip:AddLine(child:colorize(format("%s, %s.%s",L[date("%A")],date("%d"),L[date("%B")]), col))
|
||||||
end
|
end
|
||||||
col = toggleColor(col,"ffffff","00ff00")
|
col = toggleColor(col,"ffffff","00ff00")
|
||||||
if(db["12-Hours"]) then
|
if(db["12-Hours"]) then
|
||||||
|
@ -162,9 +183,9 @@ local function OnTooltipShow(tip)
|
||||||
tip:AddDoubleLine(child:colorize(L['Time'],col),child:colorize(date("%H:%M:%S"),toggleColor(col,"ffffff","00ff00")))
|
tip:AddDoubleLine(child:colorize(L['Time'],col),child:colorize(date("%H:%M:%S"),toggleColor(col,"ffffff","00ff00")))
|
||||||
end
|
end
|
||||||
col = toggleColor(col,"ffffff","00ff00")
|
col = toggleColor(col,"ffffff","00ff00")
|
||||||
tip:AddDoubleLine(child:colorize(L['Latency'],col),child:colorize(format("%s ms",select(3,GetNetStats())),toggleColor(col,"ffffff","00ff00")))
|
tip:AddDoubleLine(child:colorize(L['Latency'],col),child:colorize(format("%s ms", com['latencyvalue']), toggleColor(col,"ffffff","00ff00")))
|
||||||
col = toggleColor(col,"ffffff","00ff00")
|
col = toggleColor(col,"ffffff","00ff00")
|
||||||
tip:AddDoubleLine(child:colorize(L['FPS'],col),child:colorize(format("%i fps",floor(GetFramerate())),toggleColor(col,"ffffff","00ff00")))
|
tip:AddDoubleLine(child:colorize(L['FPS'],col),child:colorize(format("%i fps",com['fpsvalue']),toggleColor(col,"ffffff","00ff00")))
|
||||||
col = toggleColor(col,"ffffff","00ff00")
|
col = toggleColor(col,"ffffff","00ff00")
|
||||||
tip:AddDoubleLine(child:colorize(L['AddOn Memory'],col),child:colorize(format("%i MB",floor(collectgarbage('count')/1024)),toggleColor(col,"ffffff","00ff00")))
|
tip:AddDoubleLine(child:colorize(L['AddOn Memory'],col),child:colorize(format("%i MB",floor(collectgarbage('count')/1024)),toggleColor(col,"ffffff","00ff00")))
|
||||||
tip:AddLine(" ")
|
tip:AddLine(" ")
|
||||||
|
@ -203,34 +224,13 @@ end
|
||||||
local function OnDataUpdate()
|
local function OnDataUpdate()
|
||||||
local line = childName
|
local line = childName
|
||||||
if(db['expert']) then
|
if(db['expert']) then
|
||||||
local c,d,l,f = compute()
|
local com = compute()
|
||||||
line = db['ldbstring']
|
line = db['ldbstring']
|
||||||
line = line:gsub("%%clock", child:colorize(c,db['clockcolor']))
|
line = line:gsub("%%clock", child:colorize(com['clockstring'], db['clockcolor']))
|
||||||
line = line:gsub("%%date", child:colorize(d,db['datecolor']))
|
line = line:gsub("%%date", child:colorize(com['datestring'], db['datecolor']))
|
||||||
local fpscolor = db['fpscolor']
|
line = line:gsub("%%fps", child:colorize(com['fpsvalue'], com['fpscolor']))
|
||||||
local fr = floor(GetFramerate())
|
line = line:gsub("%%latency", child:colorize(com['latencyvalue'], com['latencycolor']))
|
||||||
if(db['fpslow'] and tonumber(db['fpslow']) > 0 and tonumber(fr) <= tonumber(db['fpslow'])) then
|
line = line:gsub("%%home", child:colorize(com['latencyhomevalue'], com['latencyhomecolor']))
|
||||||
fpscolor = db['fpslowcolor']
|
|
||||||
end
|
|
||||||
if(db['fpsmedium'] and tonumber(db['fpsmedium']) > 0 and tonumber(fr) >= tonumber(db['fpsmedium'])) then
|
|
||||||
fpscolor = db['fpsmediumcolor']
|
|
||||||
end
|
|
||||||
if(db['fpshigh'] and tonumber(db['fpshigh']) > 0 and tonumber(fr) >= tonumber(db['fpshigh'])) then
|
|
||||||
fpscolor = db['fpshighcolor']
|
|
||||||
end
|
|
||||||
line = line:gsub("%%fps", child:colorize(f,fpscolor))
|
|
||||||
local latencycolor = db['latencycolor']
|
|
||||||
local h, w = computelatency()
|
|
||||||
if(db['latencylow'] and tonumber(db['latencylow']) > 0 and tonumber(w) <= tonumber(db['latencylow'])) then
|
|
||||||
latencycolor = db['latencylowcolor']
|
|
||||||
end
|
|
||||||
if(db['latencymedium'] and tonumber(db['latencymedium']) > 0 and tonumber(w) >= tonumber(db['latencymedium'])) then
|
|
||||||
latencycolor = db['latencymediumcolor']
|
|
||||||
end
|
|
||||||
if(db['latencyhigh'] and tonumber(db['latencyhigh']) > 0 and tonumber(w) >= tonumber(db['latencyhigh'])) then
|
|
||||||
latencyscolor = db['latencyhighcolor']
|
|
||||||
end
|
|
||||||
line = line:gsub("%%latency", child:colorize(l,latencycolor))
|
|
||||||
else
|
else
|
||||||
line = ''
|
line = ''
|
||||||
if(db["showClock"]) then
|
if(db["showClock"]) then
|
||||||
|
|
|
@ -75,7 +75,7 @@ if L then
|
||||||
%% is replaced by %.]=]
|
%% is replaced by %.]=]
|
||||||
L["Latencystring"] = "%world %local"
|
L["Latencystring"] = "%world %local"
|
||||||
L['fpsstring'] = "%fps"
|
L['fpsstring'] = "%fps"
|
||||||
L['ldbstring'] = "%clock %date %fps %latency"
|
L['ldbstring'] = "%clock %date %fps %latency %home"
|
||||||
L["%i kB"] = "%i kB"
|
L["%i kB"] = "%i kB"
|
||||||
L["%i ms"] = "%i ms"
|
L["%i ms"] = "%i ms"
|
||||||
L["AddOns"] = "AddOns"
|
L["AddOns"] = "AddOns"
|
||||||
|
|
|
@ -75,7 +75,7 @@ if L then
|
||||||
%% is replaced by %.]=]
|
%% is replaced by %.]=]
|
||||||
L["Latencystring"] = "%world %local"
|
L["Latencystring"] = "%world %local"
|
||||||
L['fpsstring'] = "%fps"
|
L['fpsstring'] = "%fps"
|
||||||
L['ldbstring'] = "%clock %date %fps %latency"
|
L['ldbstring'] = "%clock %date %fps %latency %home"
|
||||||
L["%i kB"] = "%i kB"
|
L["%i kB"] = "%i kB"
|
||||||
L["%i ms"] = "%i ms"
|
L["%i ms"] = "%i ms"
|
||||||
L["AddOns"] = "AddOns"
|
L["AddOns"] = "AddOns"
|
||||||
|
|
Loading…
Reference in New Issue