Quantcast

- Fix some positioning issues

starlon [08-01-08 - 11:01]
- Fix some positioning issues
- Add percentages to Health and Mana lines
Filename
Modules/Position.lua
Modules/Text.lua
diff --git a/Modules/Position.lua b/Modules/Position.lua
index 2046f39..7436b34 100644
--- a/Modules/Position.lua
+++ b/Modules/Position.lua
@@ -250,14 +250,12 @@ end

 function mod:OnEnable()
 	self:RegisterEvent("REGEN_DISABLED")
-	self:RegisterEvent("REGEN_ENABLED")
 	self:SecureHook("GameTooltip_SetDefaultAnchor")
 	StarTip:SetOptionsDisabled(options, false)
 end

 function mod:OnDisable()
 	self:UnregisterEvent("REGEN_DISABLED")
-	self:UnregisterEvent("REGEN_ENABLED")
 	self:Unhook("GameTooltip_SetDefaultAnchor")
 	StarTip:SetOptionsDisabled(options, true)
 end
@@ -271,7 +269,7 @@ local oldX, oldY
 local currentAnchor
 local xoffset, yoffset
 local positionTooltip = function()
-	if self.inCombat and self.db.profile.inCombat ~= 1 then
+	if InCombatLockdown() and self.db.profile.inCombat ~= 1 then
 		local anchor = anchors[self.db.profile.inCombat]
 		if anchor:find("^CURSOR_") then
 			anchor = anchor:sub(8)
@@ -292,7 +290,7 @@ end
 local getIndex = function(owner)
 	local index
 	if UnitExists("mouseover") then
-		if self.inCombat then
+		if InCombatLockdown() then
 			index = self.db.profile.inCombat
 		elseif owner == UIParent then
 			index = self.db.profile.anchor
@@ -308,7 +306,7 @@ end
 local setOffsets = function(owner)
 	if owner == UIParent then
 		if UnitExists("mouseover") then
-			if self.inCombat then
+			if InCombatLockdown() then
 				xoffset = self.db.profile.inCombatXOffset
 				yoffset = self.db.profile.inCombatYOffset
 			else
@@ -348,23 +346,13 @@ function mod:GameTooltip_SetDefaultAnchor(this, owner)
 	end
 end

-local checkHide = function()
+function mod:REGEN_DISABLED()
 	local index = getIndex(GameTooltip:GetOwner())
 	if index == #selections then
 		GameTooltip:Hide()
 	end
 end

-function mod:REGEN_DISABLED()
-	self.inCombat = true
-	checkHide()
-end
-
-function mod:REGEN_ENABLED()
-	self.inCombat = false
-	checkHide()
-end
-
 function mod:OnHide()
 	updateFrame:SetScript("OnUpdate", nil)
 end
diff --git a/Modules/Text.lua b/Modules/Text.lua
index fa17181..f011004 100644
--- a/Modules/Text.lua
+++ b/Modules/Text.lua
@@ -391,7 +391,7 @@ local lines = setmetatable({
 			if maxHealth == 100 then
 				value = health .. "%"
 			elseif maxHealth ~= 0 then
-				value = format("%s/%s", short(health), short(maxHealth))
+				value = format("%s/%s (%%%d)", short(health), short(maxHealth), health/maxHealth*100)
 			end
 			return value
 		end,
@@ -411,7 +411,7 @@ local lines = setmetatable({
 			if maxMana == 100 then
 				value = mana
 			elseif maxMana ~= 0 then
-				value = format("%s/%s", short(mana), short(maxMana))
+				value = format("%s/%s (%%%d)", short(mana), short(maxMana), mana/maxMana*100)
 			end
 			return value
 		end,