git
/
wowui.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
20f8c5a
)
9c6a1a5 - Don't show healthstone warning if you are dead
author
Aleksi Blinnikka <aleksi.blinnikka@gmail.com>
Sun, 29 Apr 2018 16:49:31 +0000
committer
Aleksi Blinnikka <aleksi.blinnikka@gmail.com>
Sun, 29 Apr 2018 16:49:31 +0000
OmaTMW/Healthstone.lua
patch
|
blob
|
history
diff --git
a/OmaTMW/Healthstone.lua
b/OmaTMW/Healthstone.lua
index
7a8398f
..
548d1ed
100644
(file)
--- a/
OmaTMW/Healthstone.lua
+++ b/
OmaTMW/Healthstone.lua
@@
-2,6
+2,7
@@
local _;
local frame = CreateFrame("Frame", "OmaHStone", UIParent);
local UnitHealth, UnitHealthMax = UnitHealth, UnitHealthMax;
local _;
local frame = CreateFrame("Frame", "OmaHStone", UIParent);
local UnitHealth, UnitHealthMax = UnitHealth, UnitHealthMax;
+local UnitIsDeadOrGhost = UnitIsDeadOrGhost;
local function healthstone()
frame:SetPoint("TOP");
local function healthstone()
frame:SetPoint("TOP");
@@
-18,12
+19,10
@@
local function healthstone()
frame:Hide();
frame:SetScript("OnEvent", function(self, event)
frame:Hide();
frame:SetScript("OnEvent", function(self, event)
- if event == "UNIT_HEALTH" or event == "UNIT_HEALTH_FREQUENT" then
- if UnitHealth("player")/UnitHealthMax("player") < 0.3 then
- frame:Show();
- else
- frame:Hide();
- end
+ if not UnitIsDeadOrGhost("player") and UnitHealth("player")/UnitHealthMax("player") < 0.3 then
+ frame:Show();
+ else
+ frame:Hide();
end
end);
frame:UnregisterAllEvents();
end
end);
frame:UnregisterAllEvents();
@@
-31,9
+30,5
@@
local function healthstone()
frame:RegisterUnitEvent("UNIT_HEALTH_FREQUENT", "player");
end
frame:RegisterUnitEvent("UNIT_HEALTH_FREQUENT", "player");
end
+frame:SetScript("OnEvent", healthstone);
frame:RegisterEvent("PLAYER_LOGIN");
frame:RegisterEvent("PLAYER_LOGIN");
-frame:SetScript("OnEvent", function(self, event)
- if event == "PLAYER_LOGIN" then
- return healthstone();
- end
-end);