Quantcast

Fix for disappearing castbars and non updating healthbar while in vehicle

Darthpred [11-02-12 - 15:22]
Fix for disappearing castbars and non updating healthbar while in vehicle

Who the hell could think it was because of damn OnUpdate script
Filename
ElvUI_SLE/modules/unitframes/units/player.lua
diff --git a/ElvUI_SLE/modules/unitframes/units/player.lua b/ElvUI_SLE/modules/unitframes/units/player.lua
index ae1aa30..7aca9e2 100644
--- a/ElvUI_SLE/modules/unitframes/units/player.lua
+++ b/ElvUI_SLE/modules/unitframes/units/player.lua
@@ -1,23 +1,24 @@
 local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore
 if not E.private.unitframe.enable then return end
 local UF = E:GetModule('UnitFrames');
+local SLE = E:GetModule('SLE');
 local LSM = LibStub("LibSharedMedia-3.0");

+
 --Setting the variable for using classbar. Elv's function.
 local CAN_HAVE_CLASSBAR = (E.myclass == "PALADIN" or E.myclass == "DRUID" or E.myclass == "DEATHKNIGHT" or E.myclass == "WARLOCK" or E.myclass == "PRIEST" or E.myclass == "MONK" or E.myclass == 'MAGE')

-ElvUF_Player:SetScript("OnUpdate", function()
-	if not E.db.sle.combatico.enable then
-		ElvUF_Player.Combat:Hide()
-	end
-end)
 --Function to move damn combat indicator to topright part of the frame. Maybe i should create an option to make it placeble everywhere.
 function UF:Update_CombatIndicator()
 	local CombatText = ElvUF_Player.Combat
-
-	local x, y = self:GetPositionOffset(E.db.sle.combatico.pos)
-	CombatText:ClearAllPoints()
-	CombatText:Point(E.db.sle.combatico.pos, ElvUF_Player.Health, E.db.sle.combatico.pos, x, x)
+	if E.db.sle.combatico.pos == "NONE" then
+		CombatText:ClearAllPoints()
+	else
+		local x, y = UF:GetPositionOffset(E.db.sle.combatico.pos)
+		CombatText:ClearAllPoints()
+		CombatText:Point(E.db.sle.combatico.pos, ElvUF_Player.Health, E.db.sle.combatico.pos, x, x)
+	end
+	SLE:UnregisterEvent("PLAYER_REGEN_DISABLED")
 end

 UF.Update_PlayerFrameSLE = UF.Update_PlayerFrame