PHP код:
local select = select;
local string_format = string.format;
local math_ceil = math.ceil;
local Core = CreateFrame("Frame");
local function isValidFrame(Object)
local OverlayRegion = select(2, Object:GetRegions());
if Object:GetName() then return; end;
return OverlayRegion and OverlayRegion:GetObjectType() == "Texture" and OverlayRegion:GetTexture() == [=[Interface\Tooltips\Nameplate-Border]=];
end;
local Update = 0;
Core:SetScript("OnUpdate", function(self, elapsed)
Update = Update + elapsed;
if Update > 0.1 then
for index = 1, select('#', WorldFrame:GetChildren()) do
local Frame = select(index, WorldFrame:GetChildren());
if isValidFrame(Frame) then
Frame.HB = select(1, Frame:GetChildren());
if Frame.HB then
if not Frame.HB.Value then
Frame.HB.Value = Frame.HB:CreateFontString(nil, "ARTWORK");
Frame.HB.Value:SetPoint("CENTER", Frame.HB, "CENTER");
Frame.HB.Value:SetFont("Fonts\\FRIZQT__.TTF", 8, 'OUTLINE');
else
local _, maxValue = Frame.HB:GetMinMaxValues();
local Value = Frame.HB:GetValue();
Frame.HB.Value:SetText(string_format("%d%%", math_ceil((Value/maxValue)*100)));
end;
end;
end;
end;
Update = 0;
end;
end)