['SPELL'] = {}, |
} |
local last = f |
local units = {} |
units[#units+1] = CreateFrame("Button",name..'player',f, "SecureUnitButtonTemplate") |
units[#units]:SetAttribute("unit","playertarget") |
for a = 1,4 do |
unit = "party"..a.."target" |
local b = CreateFrame("Button",name..unit,f, "SecureUnitButtonTemplate") |
b:SetAttribute("unit",unit) |
units[#units+1] = b |
end |
|
local a = 0 |
local w = 40 |
local healers = {} |
local function updateHealth(self, event, unit) |
if(event=="UNIT_TARGET") then |
unit = unit.."target" |
end |
if(UnitIsUnit(self:GetAttribute("unit"), unit)) then |
local h = UnitHealth(unit) |
local m = UnitHealthMax(unit) |
local p = h / (m/100) |
self['text']:SetText(addon['colorize'](format("%.0f%%",p),healers[UnitName(unit)] and "00ff00" or "ffffff")) |
end |
end |
for _, u in pairs(units) do |
u:SetWidth(w) |
u:SetHeight(20) |
u:ClearAllPoints() |
u:SetPoint("BOTTOMLEFT",f,"TOPLEFT",a,0) |
u:SetBackdrop({ |
bgFile = "Interface/Tooltips/UI-Tooltip-Background", |
tile = true, |
tileSize = 1, |
edgeSize = 4, |
insets = { left = 0, right = 0, top = 0, 0 } |
}) |
u:SetBackdropBorderColor(1,1,1,1) |
u:SetBackdropColor(0,0,0,.5) |
u:RegisterEvent("UNIT_HEALTH") |
u:RegisterEvent("UNIT_TARGET") |
u:HookScript("OnEvent", updateHealth) |
local c = u:CreateFontString(nil,"OVERLAY","CombatLogFont") |
c:ClearAllPoints() |
c:SetAllPoints(u) |
c:SetJustifyH("CENTER") |
c:SetText("100") |
u['text'] = c |
ClickCastFrames = ClickCastFrames or {} |
ClickCastFrames[u] = true |
RegisterUnitWatch(u) |
a = a + w |
end |
local function valchange(self) |
local a = tonumber(self:GetValue())==0 and self:Hide() or self:Show() |
end |
local c = 1 |
for k,v in pairs(bars) do |
for a,b in pairs(v) do |
b:SetStatusBarTexture("Interface\\TargetingFrame\\UI-StatusBar") |