PHP код:
do
local hp = 10000
local cap = 10
local w,num, select,ipairs = WorldFrame,0, select,ipairs
local function divide(s,max)
local w,ww = (s:GetWidth()/max)*hp,0
local n = max/hp
if n > cap then return end
for i = 1, n do
local a = s.d[i]
if not a then
a = s:CreateTexture(nil,"OVERLAY")
a:SetTexture('Interface\\MainMenuBar\\UI-ExhaustionTickNormal')
local size = s:GetHeight()+12
a.s = size/2
a:SetWidth(size)
a:SetHeight(size)
a:SetAlpha(.6)
tinsert(s.d,a)
end
ww = ww + w
a:SetPoint('topleft',ww-a.s,6)
a:Show()
end
end
local function re(s)
s.d = {}
divide(s,(select(2,s:GetMinMaxValues())))
s:HookScript("OnShow",function(s) divide(s,select(2,s:GetMinMaxValues())) end)
s:HookScript("OnHide",function(s) for _,v in ipairs(s.d) do v:Hide() end end)
s:HookScript("OnValueChanged",function(s,v)
if not s:GetParent():IsShown() then return end
local _,max = s:GetMinMaxValues()
if s.max ~= max then s.max = max divide(s,max) end
end)
end
CreateFrame("frame"):SetScript("OnUpdate",function()
local n = w:GetNumChildren()
if num == n then return end
for i = num + 1, n do
local f = select(i, w:GetChildren())
if not f:GetName() then
local a = f:GetRegions()
if a and a.GetTexture and a:GetTexture() == "Interface\\TargetingFrame\\UI-TargetingFrame-Flash" then
re(f:GetChildren())
end
end
num = n
end
end)
end