Quantcast

Possible bug fix

Scott Sibley [10-07-10 - 13:16]
Possible bug fix
Filename
Modules/Icons/Icons.lua
StarTip.lua
diff --git a/Modules/Icons/Icons.lua b/Modules/Icons/Icons.lua
index b50af06..2c2e538 100644
--- a/Modules/Icons/Icons.lua
+++ b/Modules/Icons/Icons.lua
@@ -11,7 +11,113 @@ local _G = _G
 local GameTooltip = _G.GameTooltip
 local StarTip = _G.StarTip
 local UIParent = _G.UIParent
-local textures = {[0] = "Interface\\Addons\\StarTip\\Media\\black.blp", [1] = "Interface\\Addons\\StarTip\\Media\\white.blp"}
+local textures = {}
+local textures = {
+[0] = "Interface\\Addons\\StarTip\\Media\\black.blp",
+[1] = "Interface\\Addons\\StarTip\\Media\\white.blp",
+[2] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-0.blp',
+[3] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-1.blp',
+[4] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-2.blp',
+[5] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-3.blp',
+[6] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-4.blp',
+[7] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-5.blp',
+[8] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-6.blp',
+[9] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-7.blp',
+[10] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-8.blp',
+[11] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-9.blp',
+[12] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-10.blp',
+[13] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-11.blp',
+[14] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-12.blp',
+[15] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-13.blp',
+[16] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-14.blp',
+[17] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-15.blp',
+[18] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-16.blp',
+[19] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-17.blp',
+[20] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-18.blp',
+[21] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-19.blp',
+[22] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-20.blp',
+[23] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-21.blp',
+[24] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-22.blp',
+[25] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-23.blp',
+[26] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-24.blp',
+[27] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-25.blp',
+[28] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-26.blp',
+[29] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-27.blp',
+[30] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-28.blp',
+[31] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-29.blp',
+[32] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-30.blp',
+[33] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-31.blp',
+[34] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-32.blp',
+[35] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-33.blp',
+[36] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-34.blp',
+[37] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-35.blp',
+[38] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-36.blp',
+[39] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-37.blp',
+[40] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-38.blp',
+[41] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-39.blp',
+[42] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-40.blp',
+[43] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-41.blp',
+[44] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-42.blp',
+[45] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-43.blp',
+[46] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-44.blp',
+[47] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-45.blp',
+[48] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-46.blp',
+[49] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-47.blp',
+[50] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-48.blp',
+[51] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-49.blp',
+[52] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-50.blp',
+[53] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-51.blp',
+[54] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-52.blp',
+[55] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-53.blp',
+[56] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-54.blp',
+[57] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-55.blp',
+[58] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-56.blp',
+[59] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-57.blp',
+[60] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-58.blp',
+[61] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-59.blp',
+[62] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-60.blp',
+[63] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-61.blp',
+[64] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-62.blp',
+[65] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-63.blp',
+[66] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-64.blp',
+[67] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-65.blp',
+[68] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-66.blp',
+[69] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-67.blp',
+[70] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-68.blp',
+[71] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-69.blp',
+[72] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-70.blp',
+[73] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-71.blp',
+[74] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-72.blp',
+[75] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-73.blp',
+[76] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-74.blp',
+[77] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-75.blp',
+[78] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-76.blp',
+[79] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-77.blp',
+[80] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-78.blp',
+[81] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-79.blp',
+[82] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-80.blp',
+[83] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-81.blp',
+[84] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-82.blp',
+[85] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-83.blp',
+[86] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-84.blp',
+[87] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-85.blp',
+[88] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-86.blp',
+[89] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-87.blp',
+[90] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-88.blp',
+[91] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-89.blp',
+[92] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-90.blp',
+[93] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-91.blp',
+[94] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-92.blp',
+[95] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-93.blp',
+[96] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-94.blp',
+[97] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-95.blp',
+[98] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-96.blp',
+[99] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-97.blp',
+[100] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-98.blp',
+[101] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-99.blp',
+[102] = 'Interface\\Addons\\StarTip\\Media\\gradient\\gradient-100.blp',
+}
+
 local environment = {}
 local update

@@ -160,6 +266,9 @@ return MaxHealth(unit)
 				["min"] = [[
 return 0
 ]],
+				["fg_color"] = [[
+return MaxHealth(unit) / Health(unit)
+]],
 				["row"] = 0,
 				["col"] = 0
 			},
@@ -186,6 +295,9 @@ return MaxPower(unit)
 				["min"] = [[
 return 0
 ]],
+				["fg_color"] = [[
+return MaxPower(unit) / Power(unit)
+]],
 				["row"] = 0,
 				["col"] = 1
 			},
@@ -343,9 +455,17 @@ function draw(widget)
 			--local n = (row + y) * lcd.LCOLS * lcd.XRES + col + x
 			mask = bit.rshift(mask, 1)
 			if bit.band(chr[y + 1], mask) == 0 then
-				mod.buffer.buffer[n] = 0
+				if widget.bg_color then
+					mod.buffer.buffer[n] = floor(widget.bg.r * 100) + 2
+				else
+					mod.buffer.buffer[n] = 0
+				end
 			else
-				mod.buffer.buffer[n] = 1
+				if widget.fg_color then
+					mod.buffer.buffer[n] = floor(widget.fg.r * 100) + 2
+				else
+					mod.buffer.buffer[n] = 1
+				end
 			end
 		end
 	end
@@ -364,7 +484,7 @@ function update()
 					local n = (row * lcd.YRES + y) * lcd.LCOLS * lcd.XRES + col * lcd.XRES + x
 					--local n = (row + y) * lcd.LCOLS * lcd.XRES + col + x
 					local color = mod.buffer.buffer[n] or 0
-					local text = format('|T%s:%d|t', textures[color], mod.db.profile.size or 10)
+					local text = format('|T%s:%d|t', textures[color] or textures[0], mod.db.profile.size or 10)
 					if not buffers[row * lcd.YRES + y] then
 						buffers[row * lcd.YRES + y] = LibBuffer:New("tmp.icon", lcd.LCOLS * lcd.XRES, text1)
 					end
diff --git a/StarTip.lua b/StarTip.lua
index 550012a..7dc3ffb 100644
--- a/StarTip.lua
+++ b/StarTip.lua
@@ -609,7 +609,7 @@ end

 local hideTimer
 local function hideTooltip()
-	if StarTip.unit ~= "mouseover" and GetMouseFocus() == WorldFrame then StarTip.unit = nil; return end
+	if StarTip.unit ~= "mouseover" and GetMouseFocus() == WorldFrame then StarTip.unit = "mouseover"; return end
 	hideTimer:Start()
 end

@@ -625,6 +625,8 @@ function StarTip.OnTooltipSetUnit(...)

 	local _, unit = GameTooltip:GetUnit()

+	if not unit then return end
+
 	hideTimer = hideTimer or LibTimer:New("StarTip.Hide", 100, false, hideTooltip, nil, StarTip.db.profile.errorLevel)
 	hideTimer:Start()