/
end, |
changeUnit = function(frame,unit) |
if frame.unit == unit then |
if unit then |
local guid = UnitGUID(unit); |
if guid then |
frame.role = phPlayerRoles[guid]; |
else |
frame.role = nil; |
end; |
end; |
if frame.unit == unit then |
return; |
end; |
if unit == "target" then |
frame:RegisterEvent("PLAYER_TARGET_CHANGED"); |
else |
for i,button in pairs(frame.debuffs) do |
button:SetAttribute ("unit",unit); |
end; |
local guid = UnitGUID(unit); |
if guid then |
frame.role = phPlayerRoles[guid]; |
end; |
end, |
createAuraButtons = function(frame,bconfig,list) |
for i=1,bconfig.max do |
local button = list[i]; |
if not button then |
button = CreateFrame("Button",nil,frame,"SecureUnitButtonTemplate"); |
if i <= 2 then |
button = CreateFrame("Button",nil,frame,"SecureUnitButtonTemplate"); |
button.isSecure = true; |
else |
button = CreateFrame("Button",nil,frame); |
end; |
button.frame = frame; |
button.createTooltip = phUnitFrame.createTooltip; |
button.type = nil; |
end |
phUnitFrame.createButtonAttributes(button,bconfig.spells[i]); |
if button.isSecure then |
phUnitFrame.createButtonAttributes(button,bconfig.spells[i]); |
end; |
lastbutton = button; |
end |
update = function(frame,event) |
local unit = frame.unit; |
if not frame.mouseover then |
frame:SetAlpha(frame.alpha); |
end; |
if not unit or not UnitExists(unit) then |
frame.text:SetTextColor(1,1,1); |
phUnitFrame.updateSimple(frame,unit); |
return; |
end |
local role = frame.role; |
if not role then |
local r = UnitGroupRolesAssigned(unit); |
if not r then role = 0; |
if not r then role = 2; |
elseif r == "TANK" then role = 1; |
elseif r == "DAMAGER" then role = 2; |
elseif r == "HEALER" then role = 3; |
else role = 0; |
else role = 2; |
end; |
end; |
frame.disp_role = role; |
local _,className = UnitClass(unit); |
local c = RAID_CLASS_COLORS[className]; |
if not c then |
c = { r=1,g=1,b=1 }; |
end; |
frame.text:SetTextColor(c.r,c.g,c.b); |
if frame.config.showrole and role > 0 then |
frame.icon:SetTexture("Interface\\LFGFrame\\UI-LFG-ICON-PORTRAITROLES"); |
if role == 1 then |
frame.alpha = 0.9; |
end |
if not frame.mouseover then |
frame:SetAlpha(frame.alpha); |
end; |
if UnitIsAFK(unit) then |
frame.icon:SetTexture("Interface\\FriendsFrame\\StatusIcon-Away"); |
frame.icon:SetTexCoord(0, 1, 0, 1); |
frame.icon:Show(); |
end |
frame.name = UnitName(unit); |
local _,className = UnitClass(unit); |
local c = RAID_CLASS_COLORS[className]; |
if not c then |
c = { r=1,g=1,b=1 }; |
end; |
frame.text:SetTextColor(c.r,c.g,c.b); |
frame.text:SetText(frame.name); |
frame.order = PHCLASS_ORDER[className]; |
updateSimple = function(frame,msg) |
frame.alpha = 0.5; |
if not frame.mouseover then |
frame:SetAlpha(frame.alpha); |
end; |
frame.text:SetText(msg); |
frame.bar:SetStatusBarColor(0.5,0.5,0.5); |
frame.bar:SetMinMaxValues(0, 100); |
if not list[i] then |
list[i] = {}; |
end; |
if not count or count == 0 then |
count = 1; |
end; |
list[i].index = i; |
list[i].type = debuffType; |
list[i].icon = icon; |
list[i].count = count; |
list[i].caster = unitCaster; |
list[i].duration = duration; |
list[i].expirationTime = expirationTime; |
list[i].spellId = spellId; |
end; |
for i=1,table.getn(buttons) do |
buttons[i]:SetAlpha(0); |
local button = buttons[i]; |
if button.isSecure then |
button:SetAlpha(0); |
else |
button:Hide(); |
end; |
end; |
local b; |
b = i; |
break; |
end; |
local found; |
local count = 0; |
local found; |
for j=1,auraCount do |
local aura = list[j]; |
if aura.type == button.type or (aura.type == nil and button.type == "None") then |
found = j; |
break; |
found = aura; |
count = count + aura.count; |
aura.count = -1; |
end; |
end; |
if found then |
phUnitFrame.updateAura(button,bconfig.filter,list[found]); |
list[found].count = -1; |
phUnitFrame.updateAura(button,bconfig.filter,found,count); |
end; |
end |
end; |
for i=1,table.getn(order) do |
if not buttons[b] then |
return; |
end; |
local count = 0; |
local found; |
local spellId = order[i]; |
for j=1,auraCount do |
local aura = list[j]; |
if aura.count >= 0 then |
if aura.spellId == spellId then |
phUnitFrame.updateAura(buttons[b],bconfig.filter,aura); |
b = b + 1; |
if not buttons[b] then |
return; |
end; |
break; |
if aura.count > 0 and aura.spellId == spellId then |
count = count + aura.count; |
if not found or aura.caster == "player" then |
found = aura; |
end; |
end; |
end; |
if found then |
phUnitFrame.updateAura(buttons[b],bconfig.filter,found,count); |
b = b + 1; |
end; |
end; |
--[[ |
--]] |
end, |
updateAura = function(button,filter,aura) |
updateAura = function(button,filter,aura,count) |
button.filter = filter; |
button.auraIndex = aura.index; |
if (aura.count > 1) then |
button.count:SetText(aura.count); |
if (count > 1) then |
button.count:SetText(count); |
else |
button.count:SetText(nil); |
end |
buff.cooldown:SetAlpha(0); |
end; |
button.icon:SetTexture(aura.icon); |
button:SetAlpha(1); |
if button.isSecure then |
button:SetAlpha(1); |
else |
button:Show(); |
end; |
end, |
} |
{ text = 150, checked = (config.width==150), arg1 = frame, arg2 = 150, func = phUnitFrames.changeWidth }, |
{ text = 175, checked = (config.width==175), arg1 = frame, arg2 = 175, func = phUnitFrames.changeWidth }, |
{ text = 200, checked = (config.width==200), arg1 = frame, arg2 = 200, func = phUnitFrames.changeWidth }, |
{ text = 225, checked = (config.width==225), arg1 = frame, arg2 = 225, func = phUnitFrames.changeWidth }, |
{ text = 250, checked = (config.width==250), arg1 = frame, arg2 = 250, func = phUnitFrames.changeWidth }, |
} |
}, |
{ text = "Hauteur", notCheckable = true, hasArrow = true, menuList = { |
{ text = 16, checked = (config.height==16), arg1 = frame, arg2 = 16, func = phUnitFrames.changeHeight }, |
{ text = 18, checked = (config.height==18), arg1 = frame, arg2 = 18, func = phUnitFrames.changeHeight }, |
{ text = 20, checked = (config.height==20), arg1 = frame, arg2 = 20, func = phUnitFrames.changeHeight }, |
{ text = 22, checked = (config.height==22), arg1 = frame, arg2 = 22, func = phUnitFrames.changeHeight }, |
{ text = 24, checked = (config.height==24), arg1 = frame, arg2 = 24, func = phUnitFrames.changeHeight }, |
} |
}, |
{ text = "Modele", notCheckable = true, hasArrow = true, menuList = configMenu }, |
child:ClearAllPoints(); |
local y = 0; |
if not lastrole or lastrole ~= child.disp_role then |
y = -2; |
y = -4; |
end; |
child:SetPoint("TOP",lastframe,"BOTTOM",0,y); |
lastframe = child; |
}, |
}, |
debuffs = { |
max = 5, |
max = 3, |
filter = "HARMFUL", |
left = "LEFT", |
right = "RIGHT", |