Quantcast

Bug fix

Scott Sibley [09-17-10 - 04:14]
Bug fix
Filename
Modules/Text.lua
Modules/UnitTooltip.lua
StarTip.lua
diff --git a/Modules/Text.lua b/Modules/Text.lua
index 51d5cf4..a79a299 100644
--- a/Modules/Text.lua
+++ b/Modules/Text.lua
@@ -86,7 +86,7 @@ return format('Health: %.1f%%', health / max * 100)
 		color = [[
 if not UnitExists(unit) then return end
 local health, max = UnitHealth(unit), UnitHealthMax(unit)
-return HPColor(health, max)
+return ColorGradient(health / max)
 ]],
 		cols = 20,
 		update = 1000,
diff --git a/Modules/UnitTooltip.lua b/Modules/UnitTooltip.lua
index 2cd8e1e..2331e6f 100644
--- a/Modules/UnitTooltip.lua
+++ b/Modules/UnitTooltip.lua
@@ -1009,16 +1009,16 @@ function mod:SetUnit()
     elseif not text2:find("^"..LEVEL) then
         lastLine = lastLine + 1
     end
-    if not UnitPlayerControlled("mouseover") and not UnitIsPlayer("mouseover") then
+    if not UnitPlayerControlled(StarTip.unit) and not UnitIsPlayer(StarTip.unit) then
         local factionText = self.leftLines[lastLine + 1]:GetText()
         if factionText == PVP then
             factionText = nil
         end
-        if factionText and (factionList[factionText] or UnitFactionGroup("mouseover")) then
+        if factionText and (factionList[factionText] or UnitFactionGroup(StarTip.unit)) then
             lastLine = lastLine + 1
         end
     end
-    if not UnitIsConnected("mouseover") or not UnitIsVisible("mouseover") or UnitIsPVP("mouseover") then
+    if not UnitIsConnected(StarTip.unit) or not UnitIsVisible(StarTip.unit) or UnitIsPVP(StarTip.unit) then
         lastLine = lastLine + 1
     end

@@ -1060,6 +1060,15 @@ function mod:SetUnit()
 	end

 	self:RefixEndLines()
+
+	local hide = 1
+	for i = 1, GameTooltip:NumLines() do
+		if string.trim(self.leftLines[i]:GetText()) == "" and string.trim(self.rightLines[i]:GetText()) == "" then hide = hide + 1 end
+	end
+
+	if hide >= GameTooltip:NumLines() then
+		GameTooltip:Hide()
+	end
 end

 function mod:RefixEndLines()
diff --git a/StarTip.lua b/StarTip.lua
index 419c1b9..958636d 100644
--- a/StarTip.lua
+++ b/StarTip.lua
@@ -171,7 +171,7 @@ local defaults = {
 		unitFrameShow = 1,
 		otherFrameShow = 1,
 		errorLevel = 1,
-		throttleVal = 0.35
+		throttleVal = 0.4
 	}
 }

@@ -602,7 +602,7 @@ local lastTime = GetTime()
 function StarTip.OnTooltipSetUnit(...)

 	throttleTimer = throttleTimer or LibTimer:New("StarTip.Throttle", StarTip.db.profile.throttleVal, false, endThrottle, nil, StarTip.db.profile.errorLevel)
-	if GetTime() < lastTime + StarTip.db.profile.throttleVal then throttleTimer:Start(); GameTooltip:Hide() return end
+	if GetTime() < lastTime + StarTip.db.profile.throttleVal then throttleTimer:Start(); GameTooltip:Hide() return ... end
 	lastTime = GetTime()

 	StarTip.fading = false