From 2578433a142f4e514964715203d3fe20c0e2cc18 Mon Sep 17 00:00:00 2001 From: Andrew Mordecai Date: Fri, 15 Jul 2016 06:05:23 -0700 Subject: [PATCH] Hide zero download pgress --- Addon.lua | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Addon.lua b/Addon.lua index caed711..de7aa5d 100644 --- a/Addon.lua +++ b/Addon.lua @@ -6,13 +6,13 @@ local ICON = "Interface\\AddOns\\Broker_Systatus\\Icon" -local SysInfo = LibStub("LibDataBroker-1.1"):NewDataObject("Systatus", { +local Plugin = LibStub("LibDataBroker-1.1"):NewDataObject("Systatus", { type = "data source", icon = ICON.."Medium", text = "???", }) -local function GetLatencyState(value) +local function GetLatencyState(latency) if latency > PERFORMANCEBAR_MEDIUM_LATENCY then return "|cffff0000", ICON.."High" elseif latency > PERFORMANCEBAR_LOW_LATENCY then @@ -29,8 +29,8 @@ end local function Update() local latency = max(GetNetStats()) local color, icon = GetLatencyState(latency) - SysInfo.text = string.format("%s%dms", color, latency) - SysInfo.icon = icon + Plugin.text = string.format("%s%dms", color, latency) + Plugin.icon = icon C_Timer.After(5, Update) end @@ -48,14 +48,14 @@ local function UpdateTooltip(self) GameTooltip:ClearLines() GameTooltip:AddLine("System Info") - GameTooltip:AddDoubleLine("Bandwidth", string.format("%s Mbps", GetAvailableBandwidth())) + GameTooltip:AddDoubleLine("Bandwidth", string.format("|cffffffff%s|r Mbps", GetAvailableBandwidth())) local dl = floor(GetDownloadedPercentage() * 100 + 0.5) - if dl < 100 then - GameTooltip:AddDoubleLine("Download", string.format("%d%%", dl)) + if dl > 0 and dl < 100 then + GameTooltip:AddDoubleLine("Download", string.format("|cffffffff%d|r%%", dl)) end - GameTooltip:AddDoubleLine("Framerate", string.format("%s FPS", GetFramerate())) + GameTooltip:AddDoubleLine("Framerate", string.format("|cffffffff%d|r FPS", GetFramerate())) local _, _, home, world = GetNetStats() GameTooltip:AddDoubleLine("Latency (World)", string.format("%s%d", GetLatencyState(world), world)) @@ -68,7 +68,7 @@ local TooltipUpdater = CreateFrame("Frame") TooltipUpdater:Hide() TooltipUpdater:SetScript("OnUpdate", UpdateTooltip) -function SysInfo:OnEnter() +function Plugin:OnEnter() GameTooltip:SetOwner(self, "ANCHOR_NONE") GameTooltip:ClearAllPoints() @@ -83,7 +83,7 @@ function SysInfo:OnEnter() TooltipUpdater:Show() end -function SysInfo:OnLeave() +function Plugin:OnLeave() TooltipUpdater:Hide() TooltipUpdater.owner = nil GameTooltip:Hide() -- 1.7.9.5