Quantcast

Hide zero download pgress

Andrew Mordecai [07-15-16 - 13:05]
Hide zero download pgress
Filename
Addon.lua
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()