From ea024199ef33ea8d6b4959a15f9b63b9cb8ca5bf Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Fri, 26 Dec 2014 23:25:55 +0100 Subject: [PATCH] Give the target a special name tag --- elements/tags.lua | 22 ++++++++++++++++++++++ oUF_P3lim.lua | 11 +++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/elements/tags.lua b/elements/tags.lua index 6330866..64b5a66 100644 --- a/elements/tags.lua +++ b/elements/tags.lua @@ -53,6 +53,7 @@ local events = { anticipation = 'UNIT_AURA', maelstrom = 'UNIT_AURA', spell = 'UNIT_SPELLCAST_START UNIT_SPELLCAST_STOP UNIT_SPELLCAST_CHANNEL_START UNIT_SPELLCAST_CHANNEL_STOP', + name = 'UNIT_SPELLCAST_START UNIT_SPELLCAST_STOP UNIT_SPELLCAST_CHANNEL_START UNIT_SPELLCAST_CHANNEL_STOP UNIT_NAME_UPDATE UNIT_REACTION UNIT_FACTION UNIT_CLASSIFICATION_CHANGED', color = 'UNIT_REACTION UNIT_FACTION', status = 'UNIT_CONNECTION UNIT_HEALTH' } @@ -135,6 +136,27 @@ for tag, func in next, { spell = function(unit) return UnitCastingInfo(unit) or UnitChannelInfo(unit) end, + name = function(unit) + local name, _, _, _, _, _, _, _, notInterruptible = UnitCastingInfo(unit) + if(name) then + local color = notInterruptible and 'ff9000' or 'ff0000' + return format('|cff%s%s|r', color, name) + end + + name, _, _, _, _, _, _, notInterruptible = UnitChannelInfo(unit) + if(name) then + local color = notInterruptible and 'ff9000' or 'ff0000' + return format('|cff%s%s|r', color, name) + end + + name = UnitName(unit) + + local color = _TAGS['p3lim:color'](unit) + name = color and format('%s%s|r', color, name) or name + + local rare = _TAGS['rare'](unit) + return rare and format('%s |cff0090ff%s|r', name, rare) or name + end, combo = function(unit) if(not UnitExists('target')) then return end diff --git a/oUF_P3lim.lua b/oUF_P3lim.lua index d5afc6e..1a99397 100644 --- a/oUF_P3lim.lua +++ b/oUF_P3lim.lua @@ -342,6 +342,13 @@ local UnitSpecific = { self:SetWidth(230) end, target = function(self) + local Name = self.Health:CreateFontString(nil, 'OVERLAY') + Name:SetPoint('LEFT', 2, 0) + Name:SetPoint('RIGHT', self.HealthValue, 'LEFT') + Name:SetFont(FONT, 8, 'OUTLINEMONOCHROME') + Name:SetJustifyH('LEFT') + self:Tag(Name, '[p3lim:name]') + local Buffs = CreateFrame('Frame', nil, self) Buffs:SetPoint('TOPLEFT', self, 'TOPRIGHT', 4, 0) Buffs:SetSize(236, 44) @@ -500,13 +507,13 @@ local function Shared(self, unit) Health:SetPoint('TOPLEFT') end - if(unit == 'target' or unit == 'focus' or unit == 'targettarget' or unit == 'boss') then + if(unit == 'focus' or unit == 'targettarget' or unit == 'boss') then local Name = Health:CreateFontString(nil, 'OVERLAY') Name:SetPoint('LEFT', 2, 0) Name:SetPoint('RIGHT', HealthValue, 'LEFT') Name:SetFont(FONT, 8, 'OUTLINEMONOCHROME') Name:SetJustifyH('LEFT') - self:Tag(Name, '[p3lim:color][name][ |cff0090ff>rare<|r]') + self:Tag(Name, '[p3lim:color][name]') elseif(unit ~= 'arena') then local Threat = CreateFrame('Frame', nil, self) Threat:SetPoint('TOPRIGHT', 3, 3) -- 1.7.9.5