[Guide] ElvUI Custom Tag Guide
91[mention]xenostrigger[/mention] you can create a custom text for one of the tags - eg mana and place it on the right side of the power bar.
Code: Select all
function(unit)
local _, threat = UnitDetailedThreatSituation('player', unit);
local _, focus = UnitDetailedThreatSituation('focus', unit);
local tankColor = {
[0] = "fe2d2d", --Bad Threat Color
[1] = "ff8132", --Transition Color
[2] = "ff8132", --Tranistion Color
[3] = "32b400", --Good Color
[4] = "bb32ff" --Offtank
}
local dpsColor = {
[0] = "32b400", --Bad Threat Color
[1] = "ff8132", --Transition Color
[2] = "ff8132", --Tranistion Color
[3] = "fe2d2d" --Good Color
}
local role = UnitGroupRolesAssigned('player');
if role == 'TANK' and focus == 3 then
return '||cFF'..tankColor[4]
elseif role == 'HEALER' or role == 'DAMAGER' then
return '||cFF'..dpsColor[threat]
else
return '||cFF'..tankColor[threat]
end
end
Code: Select all
[namecolor][health:deficit-percent:name-veryshort]
Code: Select all
function(unit, target, player)
local _, threat = UnitDetailedThreatSituation('player', unit);
local _, focus = UnitDetailedThreatSituation('focus', unit);
local isTank = UnitGroupRolesAssigned('player') == "TANK";
local isDPS = UnitGroupRolesAssigned('player') == "DAMAGER";
local isHealer = UnitGroupRolesAssigned('player') == "HEALER";
local isNone = UnitGroupRolesAssigned('player') == "NONE";
local unitName = _TAGS['name'](unit);
local unitNameTarget = '['.._TAGS['name'](unit)..']';
local nameColor = _TAGS['namecolor'](unit);
local perHp = '||cFFFFFFFF '.._TAGS['perhp'](unit);
local isTarget = UnitIsUnit('playertarget', unit);
local isUnitCombat = UnitAffectingCombat(unit);
local isPlayerCombat = UnitAffectingCombat('player');
local isTapped = UnitIsTapDenied(unit);
--
local tankColor = {
[0] = "||cFFfe2d2d", --Bad Threat Color
[1] = "||cFFff8132", --Transition Color
[2] = "||cFFff8132", --Transition Color
[3] = "||cFF32b400", --Good Color
[4] = "||cFFbb32ff" --Offtank
}
local dpsColor = {
[0] = "||cFF32b400", --Bad Threat Color
[1] = "||cFFff8132", --Transition Color
[2] = "||cFFff8132", --Transition Color
[3] = "||cFFfe2d2d" --Good Color
}
local tappedColor = "||cFF999999"; --Tapped Color
--
if (isTarget and isTapped) then
return tappedColor..unitNameTarget..perHp;
elseif isTapped then
return tappedColor..unitName..perHp;
elseif (isTarget and isUnitCombat and isPlayerCombat and isTank and focus == 3) then
return tankColor[4]..unitNameTarget..perHp;
elseif (isTarget and isUnitCombat and isPlayerCombat and isTank) then
return tankColor[threat]..unitNameTarget..perHp;
elseif (isTarget and isUnitCombat and isPlayerCombat) and (isDPS or isHealer) then
return dpsColor[threat]..unitNameTarget..perHp;
elseif (isTarget and isUnitCombat and isPlayerCombat and isNone) then
return tankColor[threat]..unitNameTarget..perHp;
elseif (isUnitCombat and isPlayerCombat and isTank and focus == 3) then
return tankColor[4]..unitName..perHp;
elseif (isUnitCombat and isPlayerCombat and isTank) then
return tankColor[threat]..unitName..perHp;
elseif (isUnitCombat and isPlayerCombat) and (isDPS or isHealer) then
return dpsColor[threat]..unitName..perHp;
elseif (isUnitCombat and isPlayerCombat and isNone) then
return tankColor[threat]..unitName..perHp;
elseif isTarget then
return nameColor..'['..unitName..']'..perHp;
else
return nameColor .. unitName .. perHp;
end
end
Code: Select all
function(unit, target, player)
local unitName = _TAGS['name'](unit);
local unitNameTarget = '['.._TAGS['name'](unit)..']';
local nameColor = _TAGS['namecolor'](unit);
local perHp = '||cFFFFFFFF '.._TAGS['perhp'](unit);
local min, max = UnitHealth(unit), UnitHealthMax(unit)
local deficit = max - min
if UnitIsUnit("playertarget", unit) and not ((deficit <= 0) or (min == 0) or (UnitIsGhost(unit))) then
return nameColor..unitNameTarget..perHp;
elseif UnitIsUnit("playertarget", unit) and ((deficit <= 0) or (min == 0) or (UnitIsGhost(unit))) then
return nameColor..unitNameTarget;
end
--
if not UnitIsUnit("playertarget", unit) and not ((deficit <= 0) or (min == 0) or (UnitIsGhost(unit))) then
return nameColor..unitName..perHp;
elseif not UnitIsUnit("playertarget", unit) and ((deficit <= 0) or (min == 0) or (UnitIsGhost(unit))) then
return nameColor..unitName;
end
end
Code: Select all
UNIT_DISPLAYPOWER UNIT_POWER_FREQUENT
Code: Select all
function(unit)
local pType = UnitPowerType("player")
local min, max = UnitPower("player", pType), UnitPowerMax("player", pType)
--local deficit = max - min
--deficit = 1
local String
--if not (deficit <= 0) then
local playerClass, englishClass,classIndex = UnitClass("player")
local classcolor =Hex( _COLORS.class[englishClass])
if not(classIndex ==3) then
String = _VARS.E:GetFormattedText('CURRENT', min, max, true)
else
local halfshots=min/ 10
local s = string.rep("@", math.floor(halfshots/2))
if (halfshots/2-math.floor(halfshots/2) >= 0.5) then
s = s .. "*"
end
String = format("%s%s||r", classcolor, s)
end
--end
return String
end