-
-
Save obble/c4d5509f869251acf9f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local frames = { DUF_PlayerFrame, -- table of frames you want to show/hide | |
UnitExists'target' and DUF_TargetFrame, | |
UnitExists'pet' and DUF_PetFrame, | |
UnitExists'targettarget' and DUF_TOTFrame, } -- etc. | |
local d = CreateFrame'Frame' | |
d:RegisterEvent'PLAYER_ENTERING_WORLD' | |
d:RegisterEvent'UNIT_HEALTH' d:RegisterEvent'UNIT_MANA' | |
d:SetScript('OnEvent', function() | |
if event =='PLAYER_ENTERING_WORLD' then | |
for _, v in pairs (frames) do v:Hide() end | |
d:UnregisterEvent'PLAYER_ENTERING_WORLD' | |
end | |
if arg1 ~= 'player' then return end | |
local hv = UnitHealth'player' local pv = UnitMana'player' | |
local hmax = UnitHealthMax'player' local pmax = UnitManaMax'player' | |
if UnitAffectingCombat'player' or (hv ~= hmax or pv ~= pmax) then | |
for _, v in pairs (frames) do v:Show() end | |
elseif hv == hmax and pv == pmax then | |
for _, v in pairs (frames) do v:Hide() end | |
end | |
end) | |
-- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment