--- /dev/null
+-- Healthstone.lua
+local _;
+local frame = CreateFrame("Frame", "OmaHStone", UIParent);
+local UnitHealth, UnitHealthMax = UnitHealth, UnitHealthMax;
+
+local function healthstone()
+ frame:SetPoint("TOP");
+ frame:SetWidth(110);
+ frame:SetHeight(110);
+ frame.base = frame:CreateTexture(nil, "BACKGROUND");
+ frame.base:SetAllPoints();
+ frame.base:SetColorTexture(0, 0, 0, 0.5);
+ frame.stone = frame:CreateTexture(nil, "BORDER");
+ frame.stone:SetPoint("TOPLEFT", frame.base, "TOPLEFT", 1, -1);
+ frame.stone:SetPoint("BOTTOMRIGHT", frame.base, "BOTTOMRIGHT", -1, 1);
+ frame.stone:SetTexCoord(0.07, 0.93, 0.07, 0.93);
+ frame.stone:SetTexture(538745); -- "Interface\\ICONS\\Warlock_ Healthstone"
+ 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
+ end
+ end);
+ frame:UnregisterAllEvents();
+ frame:RegisterUnitEvent("UNIT_HEALTH", "player");
+ frame:RegisterUnitEvent("UNIT_HEALTH_FREQUENT", "player");
+end
+
+frame:RegisterEvent("PLAYER_LOGIN");
+frame:SetScript("OnEvent", function(self, event)
+ if event == "PLAYER_LOGIN" then
+ return healthstone();
+ end
+end);