Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------------------------------------
- -- Показывает % проценты около фрейма игрока, его таргета и т д.
- ---------------------------------------------
- -- do
- local t_hpFrame = CreateFrame("Frame", "TargetPercent", TargetFrameHealthBar)
- t_hpFrame:SetPoint("LEFT", TargetFrameHealthBar, "LEFT", -46, 0)
- t_hpFrame:SetWidth(45)
- t_hpFrame:SetHeight(20)
- t_hpFrame.text = t_hpFrame:CreateFontString("TargetPercentText", "OVERLAY")
- t_hpFrame.text:SetAllPoints(t_hpFrame)
- t_hpFrame.text:SetFontObject(TextStatusBarText)
- t_hpFrame.text:SetJustifyH("RIGHT")
- t_hpFrame:RegisterEvent("PLAYER_TARGET_CHANGED")
- t_hpFrame:RegisterEvent("UNIT_HEALTH")
- t_hpFrame:SetScript("OnEvent", function(frame, _, unit)
- if unit and not UnitIsUnit(unit, "target") then return end
- local hp = UnitHealth("target")
- if hp > 0 then
- hp = hp / UnitHealthMax("target") * 100
- frame.text:SetFormattedText("%.1f%%", hp)
- else
- frame.text:SetText("0%")
- end
- end)
- local f_hpFrame = CreateFrame("Frame", "FocusPercent", FocusFrameHealthBar)
- f_hpFrame:SetPoint("LEFT", FocusFrameHealthBar, "LEFT", -46, -20)
- f_hpFrame:SetWidth(45)
- f_hpFrame:SetHeight(20)
- f_hpFrame.text = f_hpFrame:CreateFontString("FocusPercentText", "OVERLAY")
- f_hpFrame.text:SetAllPoints(f_hpFrame)
- f_hpFrame.text:SetFontObject(TextStatusBarText)
- f_hpFrame.text:SetJustifyH("RIGHT")
- f_hpFrame:RegisterEvent("PLAYER_FOCUS_CHANGED")
- f_hpFrame:SetScript("OnShow", function() f_hpFrame:RegisterEvent("UNIT_HEALTH") end)
- f_hpFrame:SetScript("OnHide", function() f_hpFrame:UnregisterEvent("UNIT_HEALTH") end)
- f_hpFrame:SetScript("OnEvent", function(frame, _, unit)
- if unit and not UnitIsUnit(unit, "focus") then return end
- local hp = UnitHealth("focus")
- if hp > 0 then
- hp = hp / UnitHealthMax("focus") * 100
- frame.text:SetFormattedText("%.1f%%", hp)
- else
- frame.text:SetText("0%")
- end
- end)
- local p_hpFrame = CreateFrame("Frame", "PlayerPercent", PlayerFrameHealthBar)
- p_hpFrame:SetPoint("RIGHT", PlayerFrameHealthBar, "RIGHT", 40, -20)
- p_hpFrame:SetWidth(45)
- p_hpFrame:SetHeight(20)
- p_hpFrame.text = p_hpFrame:CreateFontString("PlayerPercentText", "OVERLAY")
- p_hpFrame.text:SetAllPoints(p_hpFrame)
- p_hpFrame.text:SetFontObject(TextStatusBarText)
- p_hpFrame.text:SetJustifyH("RIGHT")
- p_hpFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
- p_hpFrame:RegisterEvent("UNIT_HEALTH")
- p_hpFrame:SetScript("OnShow", function() p_hpFrame:RegisterEvent("UNIT_HEALTH") end)
- p_hpFrame:SetScript("OnHide", function() p_hpFrame:UnregisterEvent("UNIT_HEALTH") end)
- p_hpFrame:SetScript("OnEvent", function(frame, _, unit)
- if unit and not UnitIsUnit(unit, "player") then return end
- local hp = UnitHealth("player")
- if hp > 0 then
- hp = hp / UnitHealthMax("player") * 100
- frame.text:SetFormattedText("%.1f%%", hp)
- else
- frame.text:SetText("0%")
- end
- end)
- local partymf_hpFrame = CreateFrame("Frame", "PartyPercent", PartyMemberFrame1HealthBar)
- partymf_hpFrame:SetPoint("RIGHT", PartyMemberFrame1HealthBar, "RIGHT", 40, -28)
- partymf_hpFrame:SetWidth(45)
- partymf_hpFrame:SetHeight(20)
- partymf_hpFrame.text = partymf_hpFrame:CreateFontString("PartyPercentText", "OVERLAY")
- partymf_hpFrame.text:SetAllPoints(partymf_hpFrame)
- partymf_hpFrame.text:SetFontObject(TextStatusBarText)
- partymf_hpFrame.text:SetJustifyH("RIGHT")
- partymf_hpFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
- partymf_hpFrame:RegisterEvent("UNIT_HEALTH")
- partymf_hpFrame:SetScript("OnShow", function() partymf_hpFrame:RegisterEvent("UNIT_HEALTH") end)
- partymf_hpFrame:SetScript("OnHide", function() partymf_hpFrame:UnregisterEvent("UNIT_HEALTH") end)
- partymf_hpFrame:SetScript("OnEvent", function(frame, _, unit)
- if unit and not UnitIsUnit(unit, "party1") then return end
- local hp = UnitHealth("party1")
- if hp > 0 then
- hp = hp / UnitHealthMax("party1") * 100
- frame.text:SetFormattedText("%.1f%%", hp)
- else
- frame.text:SetText("0%")
- end
- end)
- -- end;
Add Comment
Please, Sign In to add comment