PHP код:
function TargetFrame_UpdateAuras (self) local frame, frameName; local frameIcon, frameCount, frameCooldown; local name, rank, icon, count, debuffType, duration, expirationTime, caster, isStealable; local frameStealable; local numBuffs = 0; local playerIsTarget = UnitIsUnit(PlayerFrame.unit, self.unit); local selfName = self:GetName();
for i = 1, MAX_TARGET_BUFFS do name, rank, icon, count, debuffType, duration, expirationTime, caster, isStealable = UnitBuff(self.unit, i); frameName = selfName.."Buff"..i; frame = _G[frameName]; if ( not frame ) then if ( not icon ) then break; else frame = CreateFrame("Button", frameName, self, "TargetBuffFrameTemplate"); frame.unit = self.unit; end end if ( icon and ( not self.maxBuffs or i <= self.maxBuffs ) ) then frame:SetID(i);
-- set the icon frameIcon = _G[frameName.."Icon"]; frameIcon:SetTexture(icon);
-- set the count frameCount = _G[frameName.."Count"]; if ( count > 1 and self.showAuraCount ) then frameCount:SetText(count); frameCount:Show(); else frameCount:Hide(); end -- Handle cooldowns frameCooldown = _G[frameName.."Cooldown"]; if ( duration > 0 ) then frameCooldown:Show(); CooldownFrame_SetTimer(frameCooldown, expirationTime - duration, duration, 1); else frameCooldown:Hide(); end
-- Show stealable frame if the target is not a player and the buff is stealable. frameStealable = _G[frameName.."Stealable"]; if ( not playerIsTarget and isStealable ) then frameStealable:Show(); else frameStealable:Hide(); end
-- set the buff to be big if the target is not the player and the buff is cast by the player or his pet largeBuffList[i] = (not playerIsTarget and PLAYER_UNITS[caster]);
numBuffs = numBuffs + 1;
frame:ClearAllPoints(); frame:Show(); else frame:Hide(); end end
local color; local frameBorder; local numDebuffs = 0; local isEnemy = UnitCanAttack("player", self.unit); for i = 1, MAX_TARGET_DEBUFFS do name, rank, icon, count, debuffType, duration, expirationTime, caster = UnitDebuff(self.unit, i); frameName = selfName.."Debuff"..i; frame = _G[frameName]; if ( not frame ) then if ( not icon ) then break; else frame = CreateFrame("Button", frameName, self, "TargetDebuffFrameTemplate"); frame.unit = self.unit; end end if ( icon and ( not self.maxDebuffs or i <= self.maxDebuffs ) and ( SHOW_CASTABLE_DEBUFFS == "0" or not isEnemy or caster == "player" or caster == "vehicle") ) then frame:SetID(i);
-- set the icon frameIcon = _G[frameName.."Icon"]; frameIcon:SetTexture(icon);
-- set the count frameCount = _G[frameName.."Count"]; if ( count > 1 and self.showAuraCount ) then frameCount:SetText(count); frameCount:Show(); else frameCount:Hide(); end
-- Handle cooldowns frameCooldown = _G[frameName.."Cooldown"]; if ( duration > 0 ) then frameCooldown:Show(); CooldownFrame_SetTimer(frameCooldown, expirationTime - duration, duration, 1); else frameCooldown:Hide(); end
-- set debuff type color if ( debuffType ) then color = DebuffTypeColor[debuffType]; else color = DebuffTypeColor["none"]; end frameBorder = _G[frameName.."Border"]; frameBorder:SetVertexColor(color.r, color.g, color.b);
-- set the debuff to be big if the buff is cast by the player or his pet largeDebuffList[i] = (PLAYER_UNITS[caster]);
numDebuffs = numDebuffs + 1;
frame:ClearAllPoints(); frame:Show(); else frame:Hide(); end end self.auraRows = 0; local haveTargetofTarget; if ( self.totFrame ) then haveTargetofTarget = self.totFrame:IsShown(); end self.spellbarAnchor = nil; local maxRowWidth; -- update buff positions maxRowWidth = ( haveTargetofTarget and self.TOT_AURA_ROW_WIDTH ) or AURA_ROW_WIDTH; TargetFrame_UpdateAuraPositions(self, selfName.."Buff", numBuffs, numDebuffs, largeBuffList, TargetFrame_UpdateBuffAnchor, maxRowWidth, 3); -- update debuff positions maxRowWidth = ( haveTargetofTarget and self.auraRows < NUM_TOT_AURA_ROWS and self.TOT_AURA_ROW_WIDTH ) or AURA_ROW_WIDTH; TargetFrame_UpdateAuraPositions(self, selfName.."Debuff", numDebuffs, numBuffs, largeDebuffList, TargetFrame_UpdateDebuffAnchor, maxRowWidth, 4); -- update the spell bar position if ( self.spellbar ) then Target_Spellbar_AdjustPosition(self.spellbar); endend