initial commit

This commit is contained in:
Gitea
2020-11-13 14:27:50 -05:00
commit e2015fd9bb
581 changed files with 101308 additions and 0 deletions

View File

@@ -0,0 +1,298 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
local _, ns = ...
local ElvUF = ns.oUF
local _G = _G
local setmetatable, getfenv, setfenv = setmetatable, getfenv, setfenv
local type, unpack, select, pairs = type, unpack, select, pairs
local min, random, format = min, random, format
local UnitPower = UnitPower
local UnitPowerMax = UnitPowerMax
local UnitHealth = UnitHealth
local UnitHealthMax = UnitHealthMax
local UnitName = UnitName
local UnitClass = UnitClass
local InCombatLockdown = InCombatLockdown
local UnregisterUnitWatch = UnregisterUnitWatch
local RegisterUnitWatch = RegisterUnitWatch
local RegisterStateDriver = RegisterStateDriver
local LOCALIZED_CLASS_NAMES_MALE = LOCALIZED_CLASS_NAMES_MALE
local CLASS_SORT_ORDER = CLASS_SORT_ORDER
local MAX_RAID_MEMBERS = MAX_RAID_MEMBERS
local configEnv
local originalEnvs = {}
local overrideFuncs = {}
local attributeBlacklist = {
showRaid = true,
showParty = true,
showSolo = true
}
local function createConfigEnv()
if configEnv then return end
configEnv = setmetatable({
UnitPower = function (unit, displayType)
if unit:find('target') or unit:find('focus') then
return UnitPower(unit, displayType)
end
return random(1, UnitPowerMax(unit, displayType) or 1)
end,
UnitHealth = function(unit)
if unit:find('target') or unit:find('focus') then
return UnitHealth(unit)
end
return random(1, UnitHealthMax(unit))
end,
UnitName = function(unit)
if unit:find('target') or unit:find('focus') then
return UnitName(unit)
end
if E.CreditsList then
local max = #E.CreditsList
return E.CreditsList[random(1, max)]
end
return 'Test Name'
end,
UnitClass = function(unit)
if unit:find('target') or unit:find('focus') then
return UnitClass(unit)
end
local classToken = CLASS_SORT_ORDER[random(1, #(CLASS_SORT_ORDER))]
return LOCALIZED_CLASS_NAMES_MALE[classToken], classToken
end,
Hex = function(r, g, b)
if type(r) == 'table' then
if r.r then r, g, b = r.r, r.g, r.b else r, g, b = unpack(r) end
end
return format('|cff%02x%02x%02x', r*255, g*255, b*255)
end,
ColorGradient = ElvUF.ColorGradient,
_COLORS = ElvUF.colors
}, {
__index = _G,
__newindex = function(_, key, value) _G[key] = value end,
})
overrideFuncs['namecolor'] = ElvUF.Tags.Methods['namecolor']
overrideFuncs['name:veryshort'] = ElvUF.Tags.Methods['name:veryshort']
overrideFuncs['name:short'] = ElvUF.Tags.Methods['name:short']
overrideFuncs['name:medium'] = ElvUF.Tags.Methods['name:medium']
overrideFuncs['name:long'] = ElvUF.Tags.Methods['name:long']
overrideFuncs['healthcolor'] = ElvUF.Tags.Methods['healthcolor']
overrideFuncs['health:current'] = ElvUF.Tags.Methods['health:current']
overrideFuncs['health:deficit'] = ElvUF.Tags.Methods['health:deficit']
overrideFuncs['health:current-percent'] = ElvUF.Tags.Methods['health:current-percent']
overrideFuncs['health:current-max'] = ElvUF.Tags.Methods['health:current-max']
overrideFuncs['health:current-max-percent'] = ElvUF.Tags.Methods['health:current-max-percent']
overrideFuncs['health:max'] = ElvUF.Tags.Methods['health:max']
overrideFuncs['health:percent'] = ElvUF.Tags.Methods['health:percent']
overrideFuncs['powercolor'] = ElvUF.Tags.Methods['powercolor']
overrideFuncs['power:current'] = ElvUF.Tags.Methods['power:current']
overrideFuncs['power:deficit'] = ElvUF.Tags.Methods['power:deficit']
overrideFuncs['power:current-percent'] = ElvUF.Tags.Methods['power:current-percent']
overrideFuncs['power:current-max'] = ElvUF.Tags.Methods['power:current-max']
overrideFuncs['power:current-max-percent'] = ElvUF.Tags.Methods['power:current-max-percent']
overrideFuncs['power:max'] = ElvUF.Tags.Methods['power:max']
overrideFuncs['power:percent'] = ElvUF.Tags.Methods['power:percent']
end
function UF:ForceShow(frame)
if InCombatLockdown() then return; end
if not frame.isForced then
frame.oldUnit = frame.unit
frame.unit = 'player'
frame.isForced = true;
frame.oldOnUpdate = frame:GetScript('OnUpdate')
end
frame:SetScript('OnUpdate', nil)
frame.forceShowAuras = true
UnregisterUnitWatch(frame)
RegisterUnitWatch(frame, true)
frame:EnableMouse(false)
frame:Show()
if frame:IsVisible() and frame.Update then
frame:Update()
end
if _G[frame:GetName()..'Target'] then
self:ForceShow(_G[frame:GetName()..'Target'])
end
if _G[frame:GetName()..'Pet'] then
self:ForceShow(_G[frame:GetName()..'Pet'])
end
end
function UF:UnforceShow(frame)
if InCombatLockdown() then return; end
if not frame.isForced then
return
end
frame.forceShowAuras = nil
frame.isForced = nil
-- Ask the SecureStateDriver to show/hide the frame for us
UnregisterUnitWatch(frame)
RegisterUnitWatch(frame)
frame:EnableMouse(true)
if frame.oldOnUpdate then
frame:SetScript('OnUpdate', frame.oldOnUpdate)
frame.oldOnUpdate = nil
end
frame.unit = frame.oldUnit or frame.unit
-- If we're visible force an update so everything is properly in a
-- non-config mode state
if frame:IsVisible() and frame.Update then
frame:Update()
end
if _G[frame:GetName()..'Target'] then
self:UnforceShow(_G[frame:GetName()..'Target'])
end
if _G[frame:GetName()..'Pet'] then
self:UnforceShow(_G[frame:GetName()..'Pet'])
end
end
function UF:ShowChildUnits(header, ...)
header.isForced = true
for i=1, select('#', ...) do
local frame = select(i, ...)
frame:SetID(i)
self:ForceShow(frame)
end
end
function UF:UnshowChildUnits(header, ...)
header.isForced = nil
for i=1, select('#', ...) do
local frame = select(i, ...)
self:UnforceShow(frame)
end
end
local function OnAttributeChanged(self)
if not self:GetParent().forceShow and not self.forceShow then return; end
if not self:IsShown() then return end
local db = self.db or self:GetParent().db
local maxUnits = MAX_RAID_MEMBERS
local startingIndex = db.raidWideSorting and -(min(db.numGroups * (db.groupsPerRowCol * 5), maxUnits) + 1) or -4
if self:GetAttribute('startingIndex') ~= startingIndex then
self:SetAttribute('startingIndex', startingIndex)
UF:ShowChildUnits(self, self:GetChildren())
end
end
function UF:HeaderConfig(header, configMode)
if InCombatLockdown() then return; end
createConfigEnv()
header.forceShow = configMode
header.forceShowAuras = configMode
header.isForced = configMode
if configMode then
for _, func in pairs(overrideFuncs) do
if type(func) == 'function' then
if not originalEnvs[func] then
originalEnvs[func] = getfenv(func)
setfenv(func, configEnv)
end
end
end
RegisterStateDriver(header, 'visibility', 'show')
else
for func, env in pairs(originalEnvs) do
setfenv(func, env)
originalEnvs[func] = nil
end
RegisterStateDriver(header, 'visibility', header.db.visibility)
if header:GetScript('OnEvent') then
header:GetScript('OnEvent')(header, 'PLAYER_ENTERING_WORLD')
end
end
for i=1, #header.groups do
local group = header.groups[i]
if group:IsShown() then
group.forceShow = header.forceShow
group.forceShowAuras = header.forceShowAuras
group:HookScript('OnAttributeChanged', OnAttributeChanged)
if configMode then
for key in pairs(attributeBlacklist) do
group:SetAttribute(key, nil)
end
OnAttributeChanged(group)
group:Update()
else
for key in pairs(attributeBlacklist) do
group:SetAttribute(key, true)
end
UF:UnshowChildUnits(group, group:GetChildren())
group:SetAttribute('startingIndex', 1)
group:Update()
end
end
end
UF.headerFunctions[header.groupName]:AdjustVisibility(header)
end
function UF:PLAYER_REGEN_DISABLED()
for _, header in pairs(UF.headers) do
if header.forceShow then
self:HeaderConfig(header)
end
end
for _, unit in pairs(UF.units) do
local frame = self[unit]
if frame and frame.forceShow then
self:UnforceShow(frame)
end
end
for i=1, 5 do
local arena = self['arena'..i]
if arena and arena.isForced then
self:UnforceShow(arena)
end
if i < 5 then
local boss = self['boss'..i]
if boss and boss.isForced then
self:UnforceShow(boss)
end
end
end
end
UF:RegisterEvent('PLAYER_REGEN_DISABLED')

View File

@@ -0,0 +1,4 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local _, ns = ...
local ElvUF = ns.oUF
assert(ElvUF, 'ElvUI was unable to locate oUF.')

View File

@@ -0,0 +1,54 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
local CreateFrame = CreateFrame
function UF:Construct_AltPowerBar(frame)
local altpower = CreateFrame('StatusBar', '$parent_AlternativePower', frame)
altpower:SetStatusBarTexture(E.media.blankTex)
altpower:SetStatusBarColor(.7, .7, .6)
altpower:GetStatusBarTexture():SetHorizTile(false)
UF.statusbars[altpower] = true
altpower:CreateBackdrop(nil, nil, nil, nil, true)
altpower.BG = altpower:CreateTexture(nil, 'BORDER')
altpower.BG:SetAllPoints()
altpower.BG:SetTexture(E.media.blankTex)
altpower.RaisedElementParent = CreateFrame('Frame', nil, altpower)
altpower.RaisedElementParent:SetFrameLevel(altpower:GetFrameLevel() + 100)
altpower.RaisedElementParent:SetAllPoints()
altpower.value = altpower.RaisedElementParent:CreateFontString(nil, 'OVERLAY')
altpower.value:Point('CENTER')
altpower.value:SetJustifyH('CENTER')
UF:Configure_FontString(altpower.value)
altpower:SetScript('OnShow', UF.ToggleResourceBar)
altpower:SetScript('OnHide', UF.ToggleResourceBar)
altpower:Hide()
return altpower
end
function UF:Configure_AltPowerBar(frame)
local db = frame.db.classbar
if db.enable then
if not frame:IsElementEnabled('AlternativePower') then
frame:EnableElement('AlternativePower')
frame.AlternativePower:Show()
end
frame:Tag(frame.AlternativePower.value, db.altPowerTextFormat)
UF:ToggleTransparentStatusBar(false, frame.AlternativePower, frame.AlternativePower.BG)
local color = db.altPowerColor
frame.AlternativePower:SetStatusBarColor(color.r, color.g, color.b)
E:SetSmoothing(frame.AlternativePower, UF.db.smoothbars)
elseif frame:IsElementEnabled('AlternativePower') then
frame:DisableElement('AlternativePower')
frame.AlternativePower:Hide()
end
end

View File

@@ -0,0 +1,239 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
local _G = _G
local unpack = unpack
local CreateFrame = CreateFrame
function UF:Construct_AuraBars(statusBar)
statusBar:CreateBackdrop(nil, nil, nil, nil, true)
statusBar:SetScript('OnMouseDown', UF.Aura_OnClick)
statusBar:Point('LEFT')
statusBar:Point('RIGHT')
statusBar.icon:CreateBackdrop(nil, nil, nil, nil, true)
UF.statusbars[statusBar] = true
UF:Update_StatusBar(statusBar)
UF:Configure_FontString(statusBar.timeText)
UF:Configure_FontString(statusBar.nameText)
UF:Update_FontString(statusBar.timeText)
UF:Update_FontString(statusBar.nameText)
statusBar.nameText:SetJustifyH('LEFT')
statusBar.nameText:SetJustifyV('MIDDLE')
statusBar.nameText:Point('RIGHT', statusBar.timeText, 'LEFT', -4, 0)
statusBar.nameText:SetWordWrap(false)
statusBar.bg = statusBar:CreateTexture(nil, 'BORDER')
statusBar.bg:Show()
local frame = statusBar:GetParent()
statusBar.db = frame.db and frame.db.aurabar
end
function UF:AuraBars_SetPosition(from, to)
local anchor = self.initialAnchor
local growth = (self.growth == 'BELOW' and -1) or 1
local SPACING = UF.thinBorders and 1 or 5
for i = from, to do
local button = self[i]
if not button then break end
button:ClearAllPoints()
button:Point(anchor, self, anchor, SPACING, (i == 1 and 0) or (growth * ((i - 1) * (self.height + self.spacing))))
button.icon:ClearAllPoints()
button.icon:Point('RIGHT', button, 'LEFT', -SPACING, 0)
end
end
function UF:Construct_AuraBarHeader(frame)
local auraBar = CreateFrame('Frame', '$parent_AuraBars', frame)
auraBar:SetFrameLevel(frame.RaisedElementParent:GetFrameLevel() + 10)
auraBar:Height(1)
auraBar.PreSetPosition = UF.SortAuras
auraBar.PostCreateBar = UF.Construct_AuraBars
auraBar.PostUpdateBar = UF.PostUpdateBar_AuraBars
auraBar.CustomFilter = UF.AuraFilter
auraBar.SetPosition = UF.AuraBars_SetPosition
auraBar.sparkEnabled = true
auraBar.initialAnchor = 'BOTTOMRIGHT'
auraBar.type = 'aurabar'
return auraBar
end
function UF:Configure_AuraBars(frame)
local auraBars = frame.AuraBars
local db = frame.db
auraBars.db = db.aurabar
if db.aurabar.enable then
if not frame:IsElementEnabled('AuraBars') then
frame:EnableElement('AuraBars')
end
auraBars.height = db.aurabar.height
auraBars.growth = db.aurabar.anchorPoint
auraBars.maxBars = db.aurabar.maxBars
auraBars.spacing = db.aurabar.spacing
auraBars.friendlyAuraType = db.aurabar.friendlyAuraType
auraBars.enemyAuraType = db.aurabar.enemyAuraType
local index = 1
while auraBars[index] do
local button = auraBars[index]
if button then
button.db = auraBars.db
end
index = index + 1
end
local colors = UF.db.colors.auraBarBuff
if E:CheckClassColor(colors.r, colors.g, colors.b) then
local classColor = E:ClassColor(E.myclass, true)
colors.r, colors.g, colors.b = classColor.r, classColor.g, classColor.b
end
colors = UF.db.colors.auraBarDebuff
if E:CheckClassColor(colors.r, colors.g, colors.b) then
local classColor = E:ClassColor(E.myclass, true)
colors.r, colors.g, colors.b = classColor.r, classColor.g, classColor.b
end
if not auraBars.Holder then
local holder = CreateFrame('Frame', nil, auraBars)
holder:Point('BOTTOM', frame, 'TOP', 0, 0)
auraBars.Holder = holder
if frame.unitframeType == 'player' then
E:CreateMover(holder, 'ElvUF_PlayerAuraMover', 'Player Aura Bars', nil, nil, nil, 'ALL,SOLO', nil, 'unitframe,individualUnits,player,aurabar')
elseif frame.unitframeType == 'target' then
E:CreateMover(holder, 'ElvUF_TargetAuraMover', 'Target Aura Bars', nil, nil, nil, 'ALL,SOLO', nil, 'unitframe,individualUnits,target,aurabar')
elseif frame.unitframeType == 'pet' then
E:CreateMover(holder, 'ElvUF_PetAuraMover', 'Pet Aura Bars', nil, nil, nil, 'ALL,SOLO', nil, 'unitframe,individualUnits,pet,aurabar')
elseif frame.unitframeType == 'focus' then
E:CreateMover(holder, 'ElvUF_FocusAuraMover', 'Focus Aura Bars', nil, nil, nil, 'ALL,SOLO', nil, 'unitframe,individualUnits,focus,aurabar')
end
end
local attachTo = frame
local BORDER, SPACING, xOffset, yOffset = UF.BORDER + UF.SPACING
if db.aurabar.attachTo == 'BUFFS' then
attachTo = frame.Buffs
elseif db.aurabar.attachTo == 'DEBUFFS' then
attachTo = frame.Debuffs
elseif db.aurabar.attachTo == 'DETACHED' then
attachTo = auraBars.Holder
elseif db.aurabar.attachTo == 'PLAYER_AURABARS' and _G.ElvUF_Player then
attachTo = _G.ElvUF_Player.AuraBars
xOffset = 0
end
local anchorPoint, anchorTo = 'BOTTOM', 'TOP'
if db.aurabar.anchorPoint == 'BELOW' then
anchorPoint, anchorTo = 'TOP', 'BOTTOM'
end
if db.aurabar.attachTo == 'DETACHED' then
E:EnableMover(auraBars.Holder.mover:GetName())
SPACING = UF.thinBorders and 1 or 5
auraBars.Holder:Size(db.aurabar.detachedWidth, db.aurabar.height + (BORDER * 2))
if db.aurabar.anchorPoint == 'BELOW' then
yOffset = BORDER + (UF.BORDER - UF.SPACING)
else
yOffset = -(db.aurabar.height + BORDER)
end
else
E:DisableMover(auraBars.Holder.mover:GetName())
SPACING = UF.thinBorders and 1 or 4
local offset = db.aurabar.yOffset + (UF.thinBorders and 0 or 2)
if db.aurabar.anchorPoint == 'BELOW' then
yOffset = -(db.aurabar.height + offset)
else
yOffset = offset + 1 -- 1 is connecting pixel
end
end
local POWER_OFFSET = 0
if db.aurabar.attachTo ~= 'DETACHED' and db.aurabar.attachTo ~= 'FRAME' then
POWER_OFFSET = frame.POWERBAR_OFFSET
if frame.ORIENTATION == 'MIDDLE' then
POWER_OFFSET = POWER_OFFSET * 2
end
end
auraBars:ClearAllPoints()
auraBars:Point(anchorPoint..'LEFT', attachTo, anchorTo..'LEFT', xOffset or -SPACING, yOffset)
auraBars:Point(anchorPoint..'RIGHT', attachTo, anchorTo..'RIGHT', xOffset or -(SPACING + BORDER), yOffset)
auraBars.width = E:Scale((db.aurabar.attachTo == 'DETACHED' and db.aurabar.detachedWidth or frame.UNIT_WIDTH) - (BORDER * 4) - auraBars.height - POWER_OFFSET + 1) -- 1 is connecting pixel
auraBars:Show()
elseif frame:IsElementEnabled('AuraBars') then
frame:DisableElement('AuraBars')
auraBars:Hide()
end
end
local GOTAK_ID = 86659
local GOTAK = GetSpellInfo(GOTAK_ID)
function UF:PostUpdateBar_AuraBars(_, statusBar, _, _, _, _, debuffType) -- unit, statusBar, index, position, duration, expiration, debuffType, isStealable
local spellID = statusBar.spellID
local spellName = statusBar.spell
statusBar.db = self.db
statusBar.icon:SetTexCoord(unpack(E.TexCoords))
local colors = E.global.unitframe.AuraBarColors[spellID] and E.global.unitframe.AuraBarColors[spellID].enable and E.global.unitframe.AuraBarColors[spellID].color
if E.db.unitframe.colors.auraBarTurtle and (E.global.unitframe.aurafilters.TurtleBuffs.spells[spellID] or E.global.unitframe.aurafilters.TurtleBuffs.spells[spellName]) and not colors and (spellName ~= GOTAK or (spellName == GOTAK and spellID == GOTAK_ID)) then
colors = E.db.unitframe.colors.auraBarTurtleColor
end
if not colors then
if UF.db.colors.auraBarByType and statusBar.filter == 'HARMFUL' then
if not debuffType or (debuffType == '' or debuffType == 'none') then
colors = UF.db.colors.auraBarDebuff
else
colors = _G.DebuffTypeColor[debuffType]
end
elseif statusBar.filter == 'HARMFUL' then
colors = UF.db.colors.auraBarDebuff
else
colors = UF.db.colors.auraBarBuff
end
end
statusBar.custom_backdrop = UF.db.colors.customaurabarbackdrop and UF.db.colors.aurabar_backdrop
if statusBar.bg then
if (UF.db.colors.transparentAurabars and not statusBar.isTransparent) or (statusBar.isTransparent and (not UF.db.colors.transparentAurabars or statusBar.invertColors ~= UF.db.colors.invertAurabars)) then
UF:ToggleTransparentStatusBar(UF.db.colors.transparentAurabars, statusBar, statusBar.bg, nil, UF.db.colors.invertAurabars)
else
local sbTexture = statusBar:GetStatusBarTexture()
if not statusBar.bg:GetTexture() then UF:Update_StatusBar(statusBar.bg, sbTexture:GetTexture()) end
UF:SetStatusBarBackdropPoints(statusBar, sbTexture, statusBar.bg)
end
end
if colors then
statusBar:SetStatusBarColor(colors.r, colors.g, colors.b)
if not statusBar.hookedColor then
UF.UpdateBackdropTextureColor(statusBar, colors.r, colors.g, colors.b)
end
else
local r, g, b = statusBar:GetStatusBarColor()
UF.UpdateBackdropTextureColor(statusBar, r, g, b)
end
end

View File

@@ -0,0 +1,59 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
function UF:Construct_AuraHighlight(frame)
local dbh = frame:CreateTexture(nil, 'OVERLAY')
dbh:SetInside(frame.Health.backdrop)
dbh:SetTexture(E.media.blankTex)
dbh:SetVertexColor(0, 0, 0, 0)
dbh:SetBlendMode('ADD')
dbh.PostUpdate = UF.PostUpdate_AuraHighlight
local glow = frame:CreateShadow(nil, true)
glow:Hide()
frame.AuraHightlightGlow = glow
frame.AuraHighlightFilter = true
frame.AuraHighlightFilterTable = E.global.unitframe.AuraHighlightColors
if frame.Health then
dbh:SetParent(frame.Health)
glow:SetParent(frame.Health)
end
return dbh
end
function UF:Configure_AuraHighlight(frame)
if E.db.unitframe.debuffHighlighting ~= 'NONE' then
frame:EnableElement('AuraHighlight')
frame.AuraHighlight:SetBlendMode(UF.db.colors.debuffHighlight.blendMode)
frame.AuraHighlight:SetAllPoints(frame.Health:GetStatusBarTexture())
frame.AuraHighlightFilterTable = E.global.unitframe.AuraHighlightColors
if E.db.unitframe.debuffHighlighting == 'GLOW' then
frame.AuraHighlightBackdrop = true
if frame.ThreatIndicator then
frame.AuraHightlightGlow:SetAllPoints(frame.ThreatIndicator.MainGlow)
elseif frame.TargetGlow then
frame.AuraHightlightGlow:SetAllPoints(frame.TargetGlow)
end
else
frame.AuraHighlightBackdrop = false
end
else
frame:DisableElement('AuraHighlight')
end
end
function UF:PostUpdate_AuraHighlight(object, debuffType, _, wasFiltered)
if debuffType and not wasFiltered then
local color = UF.db.colors.debuffHighlight[debuffType]
if object.AuraHighlightBackdrop and object.AuraHightlightGlow then
object.AuraHightlightGlow:SetBackdropBorderColor(color.r, color.g, color.b, color.a)
else
object.AuraHighlight:SetVertexColor(color.r, color.g, color.b, color.a)
end
end
end

View File

@@ -0,0 +1,597 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames')
local LSM = E.Libs.LSM
local _G = _G
local sort, ceil, huge = sort, ceil, math.huge
local select, unpack, next, format = select, unpack, next, format
local strfind, strsplit, strmatch = strfind, strsplit, strmatch
local CreateFrame = CreateFrame
local IsShiftKeyDown = IsShiftKeyDown
local IsAltKeyDown = IsAltKeyDown
local IsControlKeyDown = IsControlKeyDown
local UnitCanAttack = UnitCanAttack
local UnitIsFriend = UnitIsFriend
local UnitIsUnit = UnitIsUnit
function UF:Construct_Buffs(frame)
local buffs = CreateFrame('Frame', '$parentBuffs', frame)
buffs.spacing = UF.SPACING
buffs.PreSetPosition = (not frame:GetScript('OnUpdate')) and self.SortAuras or nil
buffs.PostCreateIcon = self.Construct_AuraIcon
buffs.PostUpdateIcon = self.PostUpdateAura
buffs.CustomFilter = self.AuraFilter
buffs:SetFrameLevel(frame.RaisedElementParent:GetFrameLevel() + 10) --Make them appear above any text element
buffs.type = 'buffs'
--Set initial width to prevent division by zero. This value doesn't matter, as it will be updated later
buffs:Width(100)
return buffs
end
function UF:Construct_Debuffs(frame)
local debuffs = CreateFrame('Frame', '$parentDebuffs', frame)
debuffs.spacing = UF.SPACING
debuffs.PreSetPosition = (not frame:GetScript('OnUpdate')) and self.SortAuras or nil
debuffs.PostCreateIcon = self.Construct_AuraIcon
debuffs.PostUpdateIcon = self.PostUpdateAura
debuffs.CustomFilter = self.AuraFilter
debuffs.type = 'debuffs'
debuffs:SetFrameLevel(frame.RaisedElementParent:GetFrameLevel() + 10) --Make them appear above any text element
--Set initial width to prevent division by zero. This value doesn't matter, as it will be updated later
debuffs:Width(100)
return debuffs
end
function UF:Aura_OnClick()
local keyDown = IsShiftKeyDown() and 'SHIFT' or IsAltKeyDown() and 'ALT' or IsControlKeyDown() and 'CTRL'
if not keyDown then return end
local spellName, spellID = self.name, self.spellID
local listName = UF.db.modifiers[keyDown]
if spellName and spellID and listName ~= 'NONE' then
if not E.global.unitframe.aurafilters[listName].spells[spellID] then
E:Print(format(L["The spell '%s' has been added to the '%s' unitframe aura filter."], spellName, listName))
E.global.unitframe.aurafilters[listName].spells[spellID] = { enable = true, priority = 0 }
else
E.global.unitframe.aurafilters[listName].spells[spellID].enable = true
end
UF:Update_AllFrames()
end
end
function UF:Construct_AuraIcon(button)
button:SetTemplate(nil, nil, nil, nil, true)
button.cd:SetReverse(true)
button.cd:SetDrawEdge(false)
button.cd:SetInside(button, UF.BORDER, UF.BORDER)
button.icon:SetInside(button, UF.BORDER, UF.BORDER)
button.icon:SetDrawLayer('ARTWORK')
button.count:ClearAllPoints()
button.count:Point('BOTTOMRIGHT', 1, 1)
button.count:SetJustifyH('RIGHT')
button.overlay:SetTexture()
button.stealable:SetTexture()
button:RegisterForClicks('RightButtonUp')
button:SetScript('OnClick', UF.Aura_OnClick)
button.cd.CooldownOverride = 'unitframe'
E:RegisterCooldown(button.cd)
local auras = button:GetParent()
local frame = auras:GetParent()
button.db = frame.db and frame.db[auras.type]
UF:UpdateAuraSettings(auras, button)
end
function UF:UpdateAuraSettings(auras, button)
if button.db then
button.count:FontTemplate(LSM:Fetch('font', button.db.countFont), button.db.countFontSize, button.db.countFontOutline)
end
if button.icon then
button.icon:SetTexCoord(unpack(E.TexCoords))
end
button:Size((auras and auras.size) or 30)
button.needsUpdateCooldownPosition = true
end
function UF:EnableDisable_Auras(frame)
if frame.db.debuffs.enable or frame.db.buffs.enable then
if not frame:IsElementEnabled('Auras') then
frame:EnableElement('Auras')
end
frame:SetAuraUpdateMethod(E.global.unitframe.effectiveAura)
frame:SetAuraUpdateSpeed(E.global.unitframe.effectiveAuraSpeed)
else
if frame:IsElementEnabled('Auras') then
frame:DisableElement('Auras')
end
end
end
function UF:UpdateAuraCooldownPosition(button)
button.cd.timer.text:ClearAllPoints()
local point = (button.db and button.db.durationPosition) or 'CENTER'
if point == 'CENTER' then
button.cd.timer.text:Point(point, 1, 0)
else
local bottom, right = point:find('BOTTOM'), point:find('RIGHT')
button.cd.timer.text:Point(point, right and -1 or 1, bottom and 1 or -1)
end
button.needsUpdateCooldownPosition = nil
end
function UF:Configure_AllAuras(frame)
if frame.Buffs then frame.Buffs:ClearAllPoints() end
if frame.Debuffs then frame.Debuffs:ClearAllPoints() end
UF:Configure_Auras(frame, 'Buffs')
UF:Configure_Auras(frame, 'Debuffs')
end
function UF:Configure_Auras(frame, which)
local db = frame.db
local auras = frame[which]
local auraType = which:lower()
auras.db = db[auraType]
local position = db.smartAuraPosition
if position == 'BUFFS_ON_DEBUFFS' then
if db.debuffs.attachTo == 'BUFFS' then
E:Print(format(L["This setting caused a conflicting anchor point, where '%s' would be attached to itself. Please check your anchor points. Setting '%s' to be attached to '%s'."], L["Buffs"], L["Debuffs"], L["Frame"]))
db.debuffs.attachTo = 'FRAME'
frame.Debuffs.attachTo = frame
frame.Debuffs:ClearAllPoints()
frame.Debuffs:Point(frame.Debuffs.initialAnchor, frame.Debuffs.attachTo, frame.Debuffs.anchorPoint, frame.Debuffs.xOffset, frame.Debuffs.yOffset)
end
db.buffs.attachTo = 'DEBUFFS'
frame.Buffs.attachTo = frame.Debuffs
frame.Buffs.PostUpdate = nil
frame.Debuffs.PostUpdate = UF.UpdateBuffsHeaderPosition
elseif position == 'DEBUFFS_ON_BUFFS' then
if db.buffs.attachTo == 'DEBUFFS' then
E:Print(format(L["This setting caused a conflicting anchor point, where '%s' would be attached to itself. Please check your anchor points. Setting '%s' to be attached to '%s'."], L["Debuffs"], L["Buffs"], L["Frame"]))
db.buffs.attachTo = 'FRAME'
frame.Buffs.attachTo = frame
frame.Buffs:ClearAllPoints()
frame.Buffs:Point(frame.Buffs.initialAnchor, frame.Buffs.attachTo, frame.Buffs.anchorPoint, frame.Buffs.xOffset, frame.Buffs.yOffset)
end
db.debuffs.attachTo = 'BUFFS'
frame.Debuffs.attachTo = frame.Buffs
frame.Buffs.PostUpdate = UF.UpdateDebuffsHeaderPosition
frame.Debuffs.PostUpdate = nil
elseif position == 'FLUID_BUFFS_ON_DEBUFFS' then
if db.debuffs.attachTo == 'BUFFS' then
E:Print(format(L["This setting caused a conflicting anchor point, where '%s' would be attached to itself. Please check your anchor points. Setting '%s' to be attached to '%s'."], L["Buffs"], L["Debuffs"], L["Frame"]))
db.debuffs.attachTo = 'FRAME'
frame.Debuffs.attachTo = frame
frame.Debuffs:ClearAllPoints()
frame.Debuffs:Point(frame.Debuffs.initialAnchor, frame.Debuffs.attachTo, frame.Debuffs.anchorPoint, frame.Debuffs.xOffset, frame.Debuffs.yOffset)
end
db.buffs.attachTo = 'DEBUFFS'
frame.Buffs.attachTo = frame.Debuffs
frame.Buffs.PostUpdate = UF.UpdateBuffsHeight
frame.Debuffs.PostUpdate = UF.UpdateBuffsPositionAndDebuffHeight
elseif position == 'FLUID_DEBUFFS_ON_BUFFS' then
if db.buffs.attachTo == 'DEBUFFS' then
E:Print(format(L["This setting caused a conflicting anchor point, where '%s' would be attached to itself. Please check your anchor points. Setting '%s' to be attached to '%s'."], L["Debuffs"], L["Buffs"], L["Frame"]))
db.buffs.attachTo = 'FRAME'
frame.Buffs.attachTo = frame
frame.Buffs:ClearAllPoints()
frame.Buffs:Point(frame.Buffs.initialAnchor, frame.Buffs.attachTo, frame.Buffs.anchorPoint, frame.Buffs.xOffset, frame.Buffs.yOffset)
end
db.debuffs.attachTo = 'BUFFS'
frame.Debuffs.attachTo = frame.Buffs
frame.Buffs.PostUpdate = UF.UpdateDebuffsPositionAndBuffHeight
frame.Debuffs.PostUpdate = UF.UpdateDebuffsHeight
else
frame.Buffs.PostUpdate = nil
frame.Debuffs.PostUpdate = nil
end
if db.debuffs.attachTo == 'BUFFS' and db.buffs.attachTo == 'DEBUFFS' then
E:Print(format(L["%s frame has a conflicting anchor point. Forcing the Buffs to be attached to the main unitframe."], E:StringTitle(frame:GetName())))
db.buffs.attachTo = 'FRAME'
end
local rows = auras.db.numrows
auras.spacing = auras.db.spacing
auras.attachTo = self:GetAuraAnchorFrame(frame, auras.db.attachTo)
if auras.db.sizeOverride and auras.db.sizeOverride > 0 then
auras:Width(auras.db.perrow * auras.db.sizeOverride + ((auras.db.perrow - 1) * auras.spacing))
else
local xOffset = 0
if frame.USE_POWERBAR_OFFSET then
if frame.ORIENTATION == 'MIDDLE' then
if auras.db.attachTo ~= 'POWER' then
xOffset = frame.POWERBAR_OFFSET * 2
end -- if its middle and power we dont want an offset.
else
xOffset = frame.POWERBAR_OFFSET
end
end
auras:Width((frame.UNIT_WIDTH - UF.SPACING*2) - xOffset)
end
auras.num = auras.db.perrow * rows
auras.size = auras.db.sizeOverride ~= 0 and auras.db.sizeOverride or ((((auras:GetWidth() - (auras.spacing*(auras.num/rows - 1))) / auras.num)) * rows)
auras.forceShow = frame.forceShowAuras
auras.disableMouse = auras.db.clickThrough
auras.anchorPoint = auras.db.anchorPoint
auras.initialAnchor = E.InversePoints[auras.anchorPoint]
auras['growth-y'] = strfind(auras.anchorPoint, 'TOP') and 'UP' or 'DOWN'
auras['growth-x'] = auras.anchorPoint == 'LEFT' and 'LEFT' or auras.anchorPoint == 'RIGHT' and 'RIGHT' or (strfind(auras.anchorPoint, 'LEFT') and 'RIGHT' or 'LEFT')
local x, y
if auras.db.attachTo == 'HEALTH' or auras.db.attachTo == 'POWER' then
x, y = E:GetXYOffset(auras.anchorPoint, -UF.BORDER, UF.BORDER)
elseif auras.db.attachTo == 'FRAME' then
x, y = E:GetXYOffset(auras.anchorPoint, UF.SPACING, 0)
else
x, y = E:GetXYOffset(auras.anchorPoint, 0, UF.SPACING)
end
auras.xOffset = x + auras.db.xOffset + (auras.db.attachTo == 'FRAME' and frame.ORIENTATION ~= 'LEFT' and frame.POWERBAR_OFFSET or 0)
auras.yOffset = y + auras.db.yOffset
local index = 1
while auras[index] do
local button = auras[index]
if button then
button.db = auras.db
UF:UpdateAuraSettings(auras, button)
button:SetBackdropBorderColor(unpack(E.media.unitframeBorderColor))
end
index = index + 1
end
auras:ClearAllPoints()
auras:Point(auras.initialAnchor, auras.attachTo, auras.anchorPoint, auras.xOffset, auras.yOffset)
auras:Height(auras.size * rows)
if auras.db.enable then
auras:Show()
else
auras:Hide()
end
end
local function SortAurasByTime(a, b)
if a and b and a:GetParent().db then
if a:IsShown() and b:IsShown() then
local sortDirection = a:GetParent().db.sortDirection
local aTime = a.noTime and huge or a.expiration or -1
local bTime = b.noTime and huge or b.expiration or -1
if aTime and bTime then
if sortDirection == 'DESCENDING' then
return aTime < bTime
else
return aTime > bTime
end
end
elseif a:IsShown() then
return true
end
end
end
local function SortAurasByName(a, b)
if a and b and a:GetParent().db then
if a:IsShown() and b:IsShown() then
local sortDirection = a:GetParent().db.sortDirection
local aName = a.spell or ''
local bName = b.spell or ''
if aName and bName then
if sortDirection == 'DESCENDING' then
return aName < bName
else
return aName > bName
end
end
elseif a:IsShown() then
return true
end
end
end
local function SortAurasByDuration(a, b)
if a and b and a:GetParent().db then
if a:IsShown() and b:IsShown() then
local sortDirection = a:GetParent().db.sortDirection
local aTime = a.noTime and huge or a.duration or -1
local bTime = b.noTime and huge or b.duration or -1
if aTime and bTime then
if sortDirection == 'DESCENDING' then
return aTime < bTime
else
return aTime > bTime
end
end
elseif a:IsShown() then
return true
end
end
end
local function SortAurasByCaster(a, b)
if a and b and a:GetParent().db then
if a:IsShown() and b:IsShown() then
local sortDirection = a:GetParent().db.sortDirection
local aPlayer = a.isPlayer or false
local bPlayer = b.isPlayer or false
if sortDirection == 'DESCENDING' then
return (aPlayer and not bPlayer)
else
return (not aPlayer and bPlayer)
end
elseif a:IsShown() then
return true
end
end
end
function UF:SortAuras()
if not self.db then return end
--Sorting by Index is Default
if self.db.sortMethod == 'TIME_REMAINING' then
sort(self, SortAurasByTime)
elseif self.db.sortMethod == 'NAME' then
sort(self, SortAurasByName)
elseif self.db.sortMethod == 'DURATION' then
sort(self, SortAurasByDuration)
elseif self.db.sortMethod == 'PLAYER' then
sort(self, SortAurasByCaster)
end
--Look into possibly applying filter priorities for auras here.
return 1, #self --from/to range needed for the :SetPosition call in oUF aura element. Without this aura icon position gets all whacky when not sorted by index
end
function UF:PostUpdateAura(_, button)
if button.isDebuff then
if not button.isFriend and not button.isPlayer then --[[and (not E.isDebuffWhiteList[name])]]
if UF.db.colors.auraByType then
button:SetBackdropBorderColor(.9, .1, .1)
end
button.icon:SetDesaturated(button.canDesaturate)
else
if UF.db.colors.auraByType then
if E.BadDispels[button.spellID] and button.dtype and E:IsDispellableByMe(button.dtype) then
button:SetBackdropBorderColor(.05, .85, .94)
else
local color = (button.dtype and _G.DebuffTypeColor[button.dtype]) or _G.DebuffTypeColor.none
button:SetBackdropBorderColor(color.r * 0.6, color.g * 0.6, color.b * 0.6)
end
end
button.icon:SetDesaturated(false)
end
else
if UF.db.colors.auraByType and button.isStealable and not button.isFriend then
button:SetBackdropBorderColor(.93, .91, .55)
else
button:SetBackdropBorderColor(unpack(E.media.unitframeBorderColor))
end
end
if button.needsUpdateCooldownPosition and (button.cd and button.cd.timer and button.cd.timer.text) then
UF:UpdateAuraCooldownPosition(button)
end
end
function UF:CheckFilter(caster, spellName, spellID, canDispell, isFriend, isPlayer, unitIsCaster, myPet, otherPet, isBossDebuff, allowDuration, noDuration, casterIsPlayer, nameplateShowSelf, nameplateShowAll, ...)
local special, filters = G.unitframe.specialFilters, E.global.unitframe.aurafilters
for i = 1, select('#', ...) do
local name = select(i, ...)
local check = (isFriend and strmatch(name, '^Friendly:([^,]*)')) or (not isFriend and strmatch(name, '^Enemy:([^,]*)')) or nil
if check ~= false then
if check ~= nil and (special[check] or filters[check]) then
name = check -- this is for our filters to handle Friendly and Enemy
end
-- Custom Filters
local filter = filters[name]
if filter then
local which, list = filter.type, filter.spells
if which and list and next(list) then
local spell = list[spellID] or list[spellName]
if spell and spell.enable then
if which == 'Blacklist' then
return false
elseif allowDuration then
return true, spell.priority
end
end
end
-- Special Filters
else
-- Whitelists
local found = (allowDuration and ((name == 'Personal' and isPlayer)
or (name == 'nonPersonal' and not isPlayer)
or (name == 'Boss' and isBossDebuff)
or (name == 'MyPet' and myPet)
or (name == 'OtherPet' and otherPet)
or (name == 'CastByUnit' and caster and unitIsCaster)
or (name == 'notCastByUnit' and caster and not unitIsCaster)
or (name == 'Dispellable' and canDispell)
or (name == 'notDispellable' and not canDispell)
or (name == 'CastByNPC' and not casterIsPlayer)
or (name == 'CastByPlayers' and casterIsPlayer)
or (name == 'BlizzardNameplate' and (nameplateShowAll or (nameplateShowSelf and (isPlayer or myPet))))))
-- Blacklists
or ((name == 'blockCastByPlayers' and casterIsPlayer)
or (name == 'blockNoDuration' and noDuration)
or (name == 'blockNonPersonal' and not isPlayer)
or (name == 'blockDispellable' and canDispell)
or (name == 'blockNotDispellable' and not canDispell)) and 0
if found then
return found ~= 0
end
end
end
end
end
function UF:AuraFilter(unit, button, name, _, count, debuffType, duration, expiration, caster, isStealable, nameplateShowSelf, spellID, _, isBossDebuff, casterIsPlayer, nameplateShowAll)
if not name then return end -- checking for an aura that is not there, pass nil to break while loop
local db = button.db or self.db
if not db then return true end
button.canDesaturate = db.desaturate
button.myPet = caster == 'pet'
button.isPlayer = caster == 'player' or caster == 'vehicle'
button.otherPet = caster and not UnitIsUnit('pet', caster) and strmatch(caster, 'pet%d+')
button.isFriend = unit and UnitIsFriend('player', unit) and not UnitCanAttack('player', unit)
button.unitIsCaster = unit and caster and UnitIsUnit(unit, caster)
button.canDispell = (self.type == 'buffs' and isStealable) or (self.type == 'debuffs' and debuffType and E:IsDispellableByMe(debuffType))
button.isStealable = isStealable
button.dtype = debuffType
button.duration = duration
button.expiration = expiration
button.noTime = duration == 0 and expiration == 0
button.stackCount = count
button.name = name
button.spellID = spellID
button.owner = caster
button.spell = name
button.priority = 0
local noDuration = (not duration or duration == 0)
local allowDuration = noDuration or (duration and duration > 0 and (not db.maxDuration or db.maxDuration == 0 or duration <= db.maxDuration) and (not db.minDuration or db.minDuration == 0 or duration >= db.minDuration))
if db.priority and db.priority ~= '' then
local filterCheck, spellPriority = UF:CheckFilter(caster, name, spellID, button.canDispell, button.isFriend, button.isPlayer, button.unitIsCaster, button.myPet, button.otherPet, isBossDebuff, allowDuration, noDuration, casterIsPlayer, nameplateShowSelf, nameplateShowAll, strsplit(',', db.priority))
if spellPriority then button.priority = spellPriority end -- this is the only difference from auarbars code
return filterCheck
else
return allowDuration -- Allow all auras to be shown when the filter list is empty, while obeying duration sliders
end
end
function UF:UpdateBuffsHeaderPosition()
local parent = self:GetParent()
local buffs = parent.Buffs
local debuffs = parent.Debuffs
local numDebuffs = self.visibleDebuffs
if numDebuffs == 0 then
buffs:ClearAllPoints()
buffs:Point(debuffs.initialAnchor, debuffs.attachTo, debuffs.anchorPoint, debuffs.xOffset, debuffs.yOffset)
else
buffs:ClearAllPoints()
buffs:Point(buffs.initialAnchor, buffs.attachTo, buffs.anchorPoint, buffs.xOffset, buffs.yOffset)
end
end
function UF:UpdateDebuffsHeaderPosition()
local parent = self:GetParent()
local debuffs = parent.Debuffs
local buffs = parent.Buffs
local numBuffs = self.visibleBuffs
if numBuffs == 0 then
debuffs:ClearAllPoints()
debuffs:Point(buffs.initialAnchor, buffs.attachTo, buffs.anchorPoint, buffs.xOffset, buffs.yOffset)
else
debuffs:ClearAllPoints()
debuffs:Point(debuffs.initialAnchor, debuffs.attachTo, debuffs.anchorPoint, debuffs.xOffset, debuffs.yOffset)
end
end
function UF:UpdateBuffsPositionAndDebuffHeight()
local parent = self:GetParent()
local db = parent.db
local buffs = parent.Buffs
local debuffs = parent.Debuffs
local numDebuffs = self.visibleDebuffs
if numDebuffs == 0 then
buffs:ClearAllPoints()
buffs:Point(debuffs.initialAnchor, debuffs.attachTo, debuffs.anchorPoint, debuffs.xOffset, debuffs.yOffset)
else
buffs:ClearAllPoints()
buffs:Point(buffs.initialAnchor, buffs.attachTo, buffs.anchorPoint, buffs.xOffset, buffs.yOffset)
end
if numDebuffs > 0 then
local numRows = ceil(numDebuffs/db.debuffs.perrow)
debuffs:Height(debuffs.size * (numRows > db.debuffs.numrows and db.debuffs.numrows or numRows))
else
debuffs:Height(debuffs.size)
end
end
function UF:UpdateDebuffsPositionAndBuffHeight()
local parent = self:GetParent()
local db = parent.db
local debuffs = parent.Debuffs
local buffs = parent.Buffs
local numBuffs = self.visibleBuffs
if numBuffs == 0 then
debuffs:ClearAllPoints()
debuffs:Point(buffs.initialAnchor, buffs.attachTo, buffs.anchorPoint, buffs.xOffset, buffs.yOffset)
else
debuffs:ClearAllPoints()
debuffs:Point(debuffs.initialAnchor, debuffs.attachTo, debuffs.anchorPoint, debuffs.xOffset, debuffs.yOffset)
end
if numBuffs > 0 then
local numRows = ceil(numBuffs/db.buffs.perrow)
buffs:Height(buffs.size * (numRows > db.buffs.numrows and db.buffs.numrows or numRows))
else
buffs:Height(buffs.size)
end
end
function UF:UpdateBuffsHeight()
local parent = self:GetParent()
local db = parent.db
local buffs = parent.Buffs
local numBuffs = self.visibleBuffs
if numBuffs > 0 then
local numRows = ceil(numBuffs/db.buffs.perrow)
buffs:Height(buffs.size * (numRows > db.buffs.numrows and db.buffs.numrows or numRows))
else
buffs:Height(buffs.size)
-- Any way to get rid of the last row as well?
-- Using buffs:Height(0) makes frames anchored to this one disappear
end
end
function UF:UpdateDebuffsHeight()
local parent = self:GetParent()
local db = parent.db
local debuffs = parent.Debuffs
local numDebuffs = self.visibleDebuffs
if numDebuffs > 0 then
local numRows = ceil(numDebuffs/db.debuffs.perrow)
debuffs:Height(debuffs.size * (numRows > db.debuffs.numrows and db.debuffs.numrows or numRows))
else
debuffs:Height(debuffs.size)
-- Any way to get rid of the last row as well?
-- Using debuffs:Height(0) makes frames anchored to this one disappear
end
end

View File

@@ -0,0 +1,127 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
local unpack = unpack
local CreateFrame = CreateFrame
function UF:Construct_AuraWatch(frame)
local auras = CreateFrame('Frame', frame:GetName() .. 'AuraWatch', frame)
auras:SetFrameLevel(frame.RaisedElementParent:GetFrameLevel() + 10)
auras:SetInside(frame.Health)
auras.presentAlpha = 1
auras.missingAlpha = 0
auras.strictMatching = true;
auras.PostCreateIcon = UF.BuffIndicator_PostCreateIcon
auras.PostUpdateIcon = UF.BuffIndicator_PostUpdateIcon
return auras
end
function UF:Configure_AuraWatch(frame, isPet)
local db = frame.db.buffIndicator
if db and db.enable then
if not frame:IsElementEnabled('AuraWatch') then
frame:EnableElement('AuraWatch')
end
frame.AuraWatch.size = db.size
if frame.unit == 'pet' or isPet then
frame.AuraWatch:SetNewTable(E.global.unitframe.aurawatch.PET)
else
local auraTable
if db.profileSpecific then
auraTable = E.db.unitframe.filters.aurawatch
else
auraTable = E:CopyTable({}, E.global.unitframe.aurawatch[E.myclass])
E:CopyTable(auraTable, E.global.unitframe.aurawatch.GLOBAL)
end
frame.AuraWatch:SetNewTable(auraTable)
end
elseif frame:IsElementEnabled('AuraWatch') then
frame:DisableElement('AuraWatch')
end
end
function UF:BuffIndicator_PostCreateIcon(button)
button.cd.CooldownOverride = 'unitframe'
button.cd.skipScale = true
E:RegisterCooldown(button.cd)
local blizzCooldownText = button.cd:GetRegions()
if blizzCooldownText:IsObjectType('FontString') then
button.cd.blizzText = blizzCooldownText
end
button.overlay:Hide()
button.icon.border = button:CreateTexture(nil, 'BACKGROUND');
button.icon.border:SetOutside(button.icon, 1, 1)
button.icon.border:SetTexture(E.media.blankTex)
button.icon.border:SetVertexColor(0, 0, 0)
UF:Configure_FontString(button.count)
UF:Update_FontString(button.count)
button.count:ClearAllPoints()
button.count:Point('BOTTOMRIGHT', 1, 1)
button.count:SetJustifyH('RIGHT')
end
function UF:BuffIndicator_PostUpdateIcon(_, button)
local settings = self.watched[button.spellID]
if settings then -- This should never fail.
local onlyText = settings.style == 'timerOnly'
local colorIcon = settings.style == 'coloredIcon'
local textureIcon = settings.style == 'texturedIcon'
if (colorIcon or textureIcon) and not button.icon:IsShown() then
button.icon:Show()
button.icon.border:Show()
button.cd:SetDrawSwipe(true)
elseif onlyText and button.icon:IsShown() then
button.icon:Hide()
button.icon.border:Hide()
button.cd:SetDrawSwipe(false)
end
if not E.db.cooldown.enable then -- cooldown module is off, handle blizzards cooldowns
if onlyText then
button.cd:SetHideCountdownNumbers(false)
if button.cd.blizzText then
button.cd.blizzText:SetTextColor(settings.color.r, settings.color.g, settings.color.b)
end
else
button.cd:SetHideCountdownNumbers(not settings.displayText)
if button.cd.blizzText then
button.cd.blizzText:SetTextColor(1, 1, 1)
end
end
elseif button.cd.timer then
button.cd.textThreshold = settings.textThreshold ~= -1 and settings.textThreshold
button.cd.hideText = (not onlyText and not settings.displayText) or nil
button.cd.timer.skipTextColor = onlyText or nil
if button.cd.timer.text then
button.cd.timer.text:SetTextColor(settings.color.r, settings.color.g, settings.color.b)
end
end
if colorIcon then
button.icon:SetTexture(E.media.blankTex)
button.icon:SetVertexColor(settings.color.r, settings.color.g, settings.color.b)
elseif textureIcon then
button.icon:SetVertexColor(1, 1, 1)
button.icon:SetTexCoord(unpack(E.TexCoords))
end
if textureIcon and button.filter == 'HARMFUL' then
button.icon.border:SetVertexColor(1, 0, 0)
else
button.icon.border:SetVertexColor(0, 0, 0)
end
end
end

View File

@@ -0,0 +1,505 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
local LSM = E.Libs.LSM
local unpack, tonumber, abs = unpack, tonumber, abs
local CreateFrame = CreateFrame
local UnitSpellHaste = UnitSpellHaste
local UnitIsPlayer = UnitIsPlayer
local UnitClass = UnitClass
local UnitReaction = UnitReaction
local UnitCanAttack = UnitCanAttack
local GetTalentInfo = GetTalentInfo
local _, ns = ...
local ElvUF = ns.oUF
assert(ElvUF, 'ElvUI was unable to locate oUF.')
local INVERT_ANCHORPOINT = {
TOPLEFT = 'BOTTOMRIGHT',
LEFT = 'RIGHT',
BOTTOMLEFT = 'TOPRIGHT',
RIGHT = 'LEFT',
TOPRIGHT = 'BOTTOMLEFT',
BOTTOMRIGHT = 'TOPLEFT',
CENTER = 'CENTER',
TOP = 'BOTTOM',
BOTTOM = 'TOP',
}
local ticks = {}
function UF:Construct_Castbar(frame, moverName)
local castbar = CreateFrame('StatusBar', '$parent_CastBar', frame, 'BackdropTemplate')
castbar:SetFrameLevel(frame.RaisedElementParent:GetFrameLevel() + 30) --Make it appear above everything else
UF.statusbars[castbar] = true
castbar.CustomDelayText = UF.CustomCastDelayText
castbar.CustomTimeText = UF.CustomTimeText
castbar.PostCastStart = UF.PostCastStart
castbar.PostCastStop = UF.PostCastStop
castbar.PostCastInterruptible = UF.PostCastInterruptible
castbar.PostCastFail = UF.PostCastFail
castbar:SetClampedToScreen(true)
castbar:CreateBackdrop(nil, nil, nil, nil, true)
castbar.Time = castbar:CreateFontString(nil, 'OVERLAY')
castbar.Time:Point('RIGHT', castbar, 'RIGHT', -4, 0)
castbar.Time:SetTextColor(0.84, 0.75, 0.65)
castbar.Time:SetJustifyH('RIGHT')
castbar.Text = castbar:CreateFontString(nil, 'OVERLAY')
castbar.Text:Point('LEFT', castbar, 'LEFT', 4, 0)
castbar.Text:Point('RIGHT', castbar.Time, 'LEFT', -4, 0)
castbar.Text:SetTextColor(0.84, 0.75, 0.65)
castbar.Text:SetJustifyH('LEFT')
castbar.Text:SetWordWrap(false)
castbar.Spark_ = castbar:CreateTexture(nil, 'OVERLAY')
castbar.Spark_:SetTexture([[Interface\CastingBar\UI-CastingBar-Spark]])
castbar.Spark_:SetBlendMode('ADD')
castbar.Spark_:SetVertexColor(1, 1, 1)
castbar.Spark_:Size(20, 40)
--Set to castbar.SafeZone
castbar.LatencyTexture = castbar:CreateTexture(nil, 'OVERLAY')
castbar.LatencyTexture:SetTexture(E.media.blankTex)
castbar.LatencyTexture:SetVertexColor(0.69, 0.31, 0.31, 0.75)
castbar.bg = castbar:CreateTexture(nil, 'BORDER')
castbar.bg:SetAllPoints()
castbar.bg:SetTexture(E.media.blankTex)
castbar.bg:Show()
local button = CreateFrame('Frame', nil, castbar, 'BackdropTemplate')
local holder = CreateFrame('Frame', nil, castbar)
button:SetTemplate(nil, nil, nil, nil, true)
castbar.Holder = holder
--these are placeholder so the mover can be created.. it will be changed.
castbar.Holder:Point('TOPLEFT', frame, 'BOTTOMLEFT', 0, -(UF.BORDER - UF.SPACING))
castbar:Point('BOTTOMLEFT', castbar.Holder, 'BOTTOMLEFT', UF.BORDER, UF.BORDER)
button:Point('RIGHT', castbar, 'LEFT', -UF.SPACING*3, 0)
if moverName then
local name = frame:GetName()
local configName = name:gsub('^ElvUF_', ''):lower()
E:CreateMover(castbar.Holder, name..'CastbarMover', moverName, nil, -6, nil, 'ALL,SOLO', nil, 'unitframe,individualUnits,'..configName..',castbar')
end
local icon = button:CreateTexture(nil, 'ARTWORK')
icon:SetInside(nil, UF.BORDER, UF.BORDER)
icon.bg = button
--Set to castbar.Icon
castbar.ButtonIcon = icon
return castbar
end
function UF:Configure_Castbar(frame)
local castbar = frame.Castbar
local db = frame.db.castbar
castbar:Width(db.width - ((UF.BORDER+UF.SPACING)*2))
castbar:Height(db.height - ((UF.BORDER+UF.SPACING)*2))
castbar.Holder:Size(db.width, db.height)
local oSC = castbar.Holder:GetScript('OnSizeChanged')
if oSC then oSC(castbar.Holder) end
if db.strataAndLevel and db.strataAndLevel.useCustomStrata then
castbar:SetFrameStrata(db.strataAndLevel.frameStrata)
end
if db.strataAndLevel and db.strataAndLevel.useCustomLevel then
castbar:SetFrameLevel(db.strataAndLevel.frameLevel)
end
castbar.timeToHold = db.timeToHold
castbar:SetReverseFill(db.reverse)
--Latency
if frame.unit == 'player' and db.latency then
castbar.SafeZone = castbar.LatencyTexture
castbar.LatencyTexture:Show()
else
castbar.SafeZone = nil
castbar.LatencyTexture:Hide()
end
--Font Options
local customFont = db.customTextFont
if customFont.enable then
castbar.Text:FontTemplate(LSM:Fetch('font', customFont.font), customFont.fontSize, customFont.fontStyle)
else
UF:Update_FontString(castbar.Text)
end
customFont = db.customTimeFont
if customFont.enable then
castbar.Time:FontTemplate(LSM:Fetch('font', customFont.font), customFont.fontSize, customFont.fontStyle)
else
UF:Update_FontString(castbar.Time)
end
local textColor = db.textColor
castbar.Text:SetTextColor(textColor.r, textColor.g, textColor.b)
castbar.Time:SetTextColor(textColor.r, textColor.g, textColor.b)
castbar.Text:Point('LEFT', castbar, 'LEFT', db.xOffsetText, db.yOffsetText)
castbar.Time:Point('RIGHT', castbar, 'RIGHT', db.xOffsetTime, db.yOffsetTime)
castbar.Text:Width(castbar.Text:GetStringWidth())
castbar.Time:Width(castbar.Time:GetStringWidth())
--Icon
if db.icon then
castbar.Icon = castbar.ButtonIcon
castbar.Icon:SetTexCoord(unpack(E.TexCoords))
if not db.iconAttached then
castbar.Icon.bg:Size(db.iconSize)
else
castbar.Icon.bg:Size(db.height-UF.SPACING*2)
castbar:Width(db.width - castbar.Icon.bg:GetWidth() - (UF.BORDER + UF.SPACING*5))
end
castbar.Icon.bg:Show()
else
castbar.ButtonIcon.bg:Hide()
castbar.Icon = nil
end
if db.spark then
castbar.Spark = castbar.Spark_
castbar.Spark:Point('CENTER', castbar:GetStatusBarTexture(), db.reverse and 'LEFT' or 'RIGHT', 0, 0)
castbar.Spark:Height(db.height * 2)
elseif castbar.Spark then
castbar.Spark:Hide()
castbar.Spark = nil
end
if db.hidetext then
castbar.Text:SetAlpha(0)
castbar.Time:SetAlpha(0)
else
castbar.Text:SetAlpha(1)
castbar.Time:SetAlpha(1)
end
castbar:ClearAllPoints()
if db.overlayOnFrame ~= 'None' then
local anchor = frame[db.overlayOnFrame]
if not db.iconAttached then
castbar:SetInside(anchor, 0, 0)
else
if castbar.Icon then
castbar.Icon.bg:Size(anchor:GetHeight() - UF.SPACING*2)
end
local iconWidth = db.icon and (castbar.Icon.bg:GetWidth() - UF.BORDER) or 0
if frame.ORIENTATION == 'RIGHT' then
castbar:Point('TOPLEFT', anchor, 'TOPLEFT')
castbar:Point('BOTTOMRIGHT', anchor, 'BOTTOMRIGHT', -iconWidth - UF.SPACING*3, 0)
else
castbar:Point('TOPLEFT', anchor, 'TOPLEFT', iconWidth + UF.SPACING*3, 0)
castbar:Point('BOTTOMRIGHT', anchor, 'BOTTOMRIGHT')
end
end
if db.spark then
castbar.Spark:Height(anchor:GetHeight() * 2)
end
else
if db.positionsGroup then
castbar.Holder:ClearAllPoints()
castbar.Holder:Point(INVERT_ANCHORPOINT[db.positionsGroup.anchorPoint], frame, db.positionsGroup.anchorPoint, db.positionsGroup.xOffset, db.positionsGroup.yOffset)
end
if frame.ORIENTATION ~= 'RIGHT' then
castbar:Point('BOTTOMRIGHT', castbar.Holder, 'BOTTOMRIGHT', -(UF.BORDER+UF.SPACING), UF.BORDER+UF.SPACING)
else
castbar:Point('BOTTOMLEFT', castbar.Holder, 'BOTTOMLEFT', UF.BORDER+UF.SPACING, UF.BORDER+UF.SPACING)
end
end
if not db.iconAttached and db.icon then
local attachPoint = db.iconAttachedTo == 'Frame' and frame or frame.Castbar
local anchorPoint = db.iconPosition
castbar.Icon.bg:ClearAllPoints()
castbar.Icon.bg:Point(INVERT_ANCHORPOINT[anchorPoint], attachPoint, anchorPoint, db.iconXOffset, db.iconYOffset)
elseif db.icon then
castbar.Icon.bg:ClearAllPoints()
if frame.ORIENTATION == 'RIGHT' then
castbar.Icon.bg:Point('LEFT', castbar, 'RIGHT', UF.SPACING*3, 0)
else
castbar.Icon.bg:Point('RIGHT', castbar, 'LEFT', -UF.SPACING*3, 0)
end
end
--Adjust tick heights
castbar.tickHeight = castbar:GetHeight()
if db.ticks then --Only player unitframe has this
--Set tick width and color
castbar.tickWidth = db.tickWidth
castbar.tickColor = db.tickColor
for i = 1, #ticks do
ticks[i]:SetVertexColor(castbar.tickColor.r, castbar.tickColor.g, castbar.tickColor.b, castbar.tickColor.a)
ticks[i]:Width(castbar.tickWidth)
end
end
if db.customColor and db.customColor.enable then
castbar.custom_backdrop = db.customColor.useCustomBackdrop and db.customColor.colorBackdrop
UF:ToggleTransparentStatusBar(db.customColor.transparent, castbar, castbar.bg, nil, db.customColor.invertColors)
else
castbar.custom_backdrop = UF.db.colors.customcastbarbackdrop and UF.db.colors.castbar_backdrop
UF:ToggleTransparentStatusBar(UF.db.colors.transparentCastbar, castbar, castbar.bg, nil, UF.db.colors.invertCastbar)
end
if castbar.Holder.mover then
if db.overlayOnFrame ~= 'None' or not db.enable then
E:DisableMover(castbar.Holder.mover:GetName())
else
E:EnableMover(castbar.Holder.mover:GetName())
end
end
if db.enable and not frame:IsElementEnabled('Castbar') then
frame:EnableElement('Castbar')
elseif not db.enable and frame:IsElementEnabled('Castbar') then
frame:DisableElement('Castbar')
end
end
function UF:CustomCastDelayText(duration)
local db = self:GetParent().db
if not (db and db.castbar) then return end
db = db.castbar.format
if self.channeling then
if db == 'CURRENT' then
self.Time:SetFormattedText('%.1f |cffaf5050%.1f|r', abs(duration - self.max), self.delay)
elseif db == 'CURRENTMAX' then
self.Time:SetFormattedText('%.1f / %.1f |cffaf5050%.1f|r', duration, self.max, self.delay)
elseif db == 'REMAINING' then
self.Time:SetFormattedText('%.1f |cffaf5050%.1f|r', duration, self.delay)
elseif db == 'REMAININGMAX' then
self.Time:SetFormattedText('%.1f / %.1f |cffaf5050%.1f|r', abs(duration - self.max), self.max, self.delay)
end
else
if db == 'CURRENT' then
self.Time:SetFormattedText('%.1f |cffaf5050%s %.1f|r', duration, '+', self.delay)
elseif db == 'CURRENTMAX' then
self.Time:SetFormattedText('%.1f / %.1f |cffaf5050%s %.1f|r', duration, self.max, '+', self.delay)
elseif db == 'REMAINING' then
self.Time:SetFormattedText('%.1f |cffaf5050%s %.1f|r', abs(duration - self.max), '+', self.delay)
elseif db == 'REMAININGMAX' then
self.Time:SetFormattedText('%.1f / %.1f |cffaf5050%s %.1f|r', abs(duration - self.max), self.max, '+', self.delay)
end
end
self.Time:Width(self.Time:GetStringWidth())
end
function UF:CustomTimeText(duration)
local db = self:GetParent().db
if not (db and db.castbar) then return end
db = db.castbar.format
if self.channeling then
if db == 'CURRENT' then
self.Time:SetFormattedText('%.1f', abs(duration - self.max))
elseif db == 'CURRENTMAX' then
self.Time:SetFormattedText('%.1f / %.1f', abs(duration - self.max), self.max)
elseif db == 'REMAINING' then
self.Time:SetFormattedText('%.1f', duration)
elseif db == 'REMAININGMAX' then
self.Time:SetFormattedText('%.1f / %.1f', duration, self.max)
end
else
if db == 'CURRENT' then
self.Time:SetFormattedText('%.1f', duration)
elseif db == 'CURRENTMAX' then
self.Time:SetFormattedText('%.1f / %.1f', duration, self.max)
elseif db == 'REMAINING' then
self.Time:SetFormattedText('%.1f', abs(duration - self.max))
elseif db == 'REMAININGMAX' then
self.Time:SetFormattedText('%.1f / %.1f', abs(duration - self.max), self.max)
end
end
self.Time:Width(self.Time:GetStringWidth())
end
function UF:HideTicks()
for i=1, #ticks do
ticks[i]:Hide()
end
end
function UF:SetCastTicks(frame, numTicks, extraTickRatio)
extraTickRatio = extraTickRatio or 0
UF:HideTicks()
if numTicks and numTicks <= 0 then return end
local w = frame:GetWidth()
local d = w / (numTicks + extraTickRatio)
for i = 1, numTicks - 1 do
if not ticks[i] then
ticks[i] = frame:CreateTexture(nil, 'OVERLAY')
ticks[i]:SetTexture(E.media.normTex)
ticks[i]:SetVertexColor(frame.tickColor.r, frame.tickColor.g, frame.tickColor.b, frame.tickColor.a)
ticks[i]:Width(frame.tickWidth)
end
ticks[i]:ClearAllPoints()
ticks[i]:Point('RIGHT', frame, 'LEFT', d * i, 0)
ticks[i]:Height(frame.tickHeight)
ticks[i]:Show()
end
end
function UF:GetTalentTicks(info)
local _, _, _, selected = GetTalentInfo(info.tier, info.column, 1)
return selected and info.ticks
end
function UF:GetInterruptColor(db, unit)
local colors = ElvUF.colors
local customColor = db and db.castbar and db.castbar.customColor
local custom, r, g, b = customColor and customColor.enable and customColor
if custom then
r, g, b = customColor.color.r, customColor.color.g, customColor.color.b
else
r, g, b = colors.castColor[1], colors.castColor[2], colors.castColor[3]
end
if self.notInterruptible and unit ~= 'player' and UnitCanAttack('player', unit) then
if custom and custom.colorNoInterrupt then
r, g, b = custom.colorNoInterrupt.r, custom.colorNoInterrupt.g, custom.colorNoInterrupt.b
else
r, g, b = colors.castNoInterrupt[1], colors.castNoInterrupt[2], colors.castNoInterrupt[3]
end
elseif ((custom and custom.useClassColor) or (not custom and UF.db.colors.castClassColor)) and UnitIsPlayer(unit) then
local _, Class = UnitClass(unit)
local t = Class and colors.class[Class]
if t then r, g, b = t[1], t[2], t[3] end
elseif (custom and custom.useReactionColor) or (not custom and UF.db.colors.castReactionColor) then
local Reaction = UnitReaction(unit, 'player')
local t = Reaction and colors.reaction[Reaction]
if t then r, g, b = t[1], t[2], t[3] end
end
return r, g, b
end
function UF:PostCastStart(unit)
local db = self:GetParent().db
if not db or not db.castbar then return end
if unit == 'vehicle' then unit = 'player' end
self.unit = unit
if db.castbar.displayTarget and self.curTarget then
self.Text:SetText(self.spellName..' > '..self.curTarget)
end
if self.channeling and db.castbar.ticks and unit == 'player' then
local unitframe = E.global.unitframe
local baseTicks = unitframe.ChannelTicks[self.spellID]
local ticksSize = baseTicks and unitframe.ChannelTicksSize[self.spellID]
local hasteTicks = ticksSize and unitframe.HastedChannelTicks[self.spellID]
local talentTicks = baseTicks and unitframe.TalentChannelTicks[self.spellID]
-- Separate group, so they can be effected by haste or size if needed
if talentTicks then
local selectedTicks = UF:GetTalentTicks(talentTicks)
if selectedTicks then
baseTicks = selectedTicks
end
end
-- hasteTicks require a tickSize
if hasteTicks then
local tickIncRate = 1 / baseTicks
local curHaste = UnitSpellHaste('player') * 0.01
local firstTickInc = tickIncRate / 2
local bonusTicks = 0
if curHaste >= firstTickInc then
bonusTicks = bonusTicks + 1
end
local x = tonumber(E:Round(firstTickInc + tickIncRate, 2))
while curHaste >= x do
x = tonumber(E:Round(firstTickInc + (tickIncRate * bonusTicks), 2))
if curHaste >= x then
bonusTicks = bonusTicks + 1
end
end
local baseTickSize = ticksSize
local hastedTickSize = baseTickSize / (1 + curHaste)
local extraTick = self.max - hastedTickSize * (baseTicks + bonusTicks)
local extraTickRatio = extraTick / hastedTickSize
UF:SetCastTicks(self, baseTicks + bonusTicks, extraTickRatio)
self.hadTicks = true
elseif ticksSize then
local curHaste = UnitSpellHaste('player') * 0.01
local baseTickSize = ticksSize
local hastedTickSize = baseTickSize / (1 + curHaste)
local extraTick = self.max - hastedTickSize * (baseTicks)
local extraTickRatio = extraTick / hastedTickSize
UF:SetCastTicks(self, baseTicks, extraTickRatio)
self.hadTicks = true
elseif baseTicks then
UF:SetCastTicks(self, baseTicks)
self.hadTicks = true
else
UF:HideTicks()
end
end
if self.SafeZone then
self.SafeZone:Show()
end
self:SetStatusBarColor(UF.GetInterruptColor(self, db, unit))
end
function UF:PostCastStop(unit)
if self.hadTicks and unit == 'player' then
UF:HideTicks()
self.hadTicks = false
end
end
function UF:PostCastFail()
local db = self:GetParent().db
local customColor = db and db.castbar and db.castbar.customColor
local color = (customColor and customColor.enable and customColor.colorInterrupted) or UF.db.colors.castInterruptedColor
self:SetStatusBarColor(color.r, color.g, color.b)
if self.SafeZone then
self.SafeZone:Hide()
end
end
function UF:PostCastInterruptible(unit)
if unit == 'vehicle' or unit == 'player' then return end
local db = self:GetParent().db
if not db or not db.castbar then return end
self:SetStatusBarColor(UF.GetInterruptColor(self, db, unit))
end

View File

@@ -0,0 +1,513 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
local max = max
local unpack = unpack
local CreateFrame = CreateFrame
local UnitHasVehicleUI = UnitHasVehicleUI
local MAX_COMBO_POINTS = MAX_COMBO_POINTS
-- GLOBALS: ElvUF_Player
local _, ns = ...
local ElvUF = ns.oUF
assert(ElvUF, 'ElvUI was unable to locate oUF.')
function UF:PostVisibility_ClassBars(frame)
if not (frame and frame.db) then return end
UF:Configure_ClassBar(frame)
UF:Configure_Power(frame)
UF:Configure_InfoPanel(frame)
end
function UF:Configure_ClassBar(frame)
local db = frame.db
if not db then return end
local bars = frame[frame.ClassBar]
if not bars then return end
bars.Holder = frame.ClassBarHolder
bars.origParent = frame
--Fix height in case it is lower than the theme allows, or in case it's higher than 30px when not detached
if not UF.thinBorders and (frame.CLASSBAR_HEIGHT > 0 and frame.CLASSBAR_HEIGHT < 7) then --A height of 7 means 6px for borders and just 1px for the actual power statusbar
frame.CLASSBAR_HEIGHT = 7
if db.classbar then db.classbar.height = 7 end
elseif UF.thinBorders and (frame.CLASSBAR_HEIGHT > 0 and frame.CLASSBAR_HEIGHT < 3) then --A height of 3 means 2px for borders and just 1px for the actual power statusbar
frame.CLASSBAR_HEIGHT = 3
if db.classbar then db.classbar.height = 3 end
elseif not frame.CLASSBAR_DETACHED and frame.CLASSBAR_HEIGHT > 30 then
frame.CLASSBAR_HEIGHT = 10
if db.classbar then db.classbar.height = 10 end
end
-- keep after classbar height update
UF.ToggleResourceBar(bars)
--We don't want to modify the original frame.CLASSBAR_WIDTH value, as it bugs out when the classbar gains more buttons
local CLASSBAR_WIDTH = frame.CLASSBAR_WIDTH
local SPACING = (UF.BORDER + UF.SPACING)*2
local color = E.db.unitframe.colors.borderColor
if not bars.backdrop.forcedBorderColors then
bars.backdrop:SetBackdropBorderColor(color.r, color.g, color.b)
end
if frame.USE_MINI_CLASSBAR and not frame.CLASSBAR_DETACHED then
if frame.MAX_CLASS_BAR == 1 or frame.ClassBar == 'AdditionalPower' or frame.ClassBar == 'Stagger' or frame.ClassBar == 'AlternativePower' then
CLASSBAR_WIDTH = CLASSBAR_WIDTH * 2/3
else
CLASSBAR_WIDTH = CLASSBAR_WIDTH * (frame.MAX_CLASS_BAR - 1) / frame.MAX_CLASS_BAR
end
elseif frame.CLASSBAR_DETACHED then --Detached
CLASSBAR_WIDTH = db.classbar.detachedWidth
end
bars:Width(CLASSBAR_WIDTH - SPACING)
bars:Height(frame.CLASSBAR_HEIGHT - SPACING)
if frame.ClassBar == 'ClassPower' or frame.ClassBar == 'Runes' then
if E.myclass == 'DEATHKNIGHT' and frame.ClassBar == 'Runes' then
bars.sortOrder = (db.classbar.sortDirection ~= 'NONE') and db.classbar.sortDirection
end
local maxClassBarButtons = max(UF.classMaxResourceBar[E.myclass] or 0, MAX_COMBO_POINTS)
for i = 1, maxClassBarButtons do
bars[i].backdrop:Hide()
if i <= frame.MAX_CLASS_BAR then
if not bars[i].backdrop.forcedBorderColors then
bars[i].backdrop:SetBackdropBorderColor(color.r, color.g, color.b)
end
bars[i]:Height(bars:GetHeight())
if frame.MAX_CLASS_BAR == 1 then
bars[i]:Width(CLASSBAR_WIDTH)
elseif frame.USE_MINI_CLASSBAR then
if frame.CLASSBAR_DETACHED and db.classbar.orientation == 'VERTICAL' then
bars[i]:Width(CLASSBAR_WIDTH)
else
bars[i]:Width((CLASSBAR_WIDTH - ((5 + (UF.BORDER*2 + UF.SPACING*2))*(frame.MAX_CLASS_BAR - 1)))/frame.MAX_CLASS_BAR) --Width accounts for 5px spacing between each button, excluding borders
end
elseif i ~= frame.MAX_CLASS_BAR then
bars[i]:Width((CLASSBAR_WIDTH - ((frame.MAX_CLASS_BAR-1)*(UF.BORDER*2-UF.SPACING))) / frame.MAX_CLASS_BAR) --classbar width minus total width of dividers between each button, divided by number of buttons
end
bars[i]:GetStatusBarTexture():SetHorizTile(false)
bars[i]:ClearAllPoints()
if i == 1 then
bars[i]:Point('LEFT', bars)
else
if frame.USE_MINI_CLASSBAR then
if frame.CLASSBAR_DETACHED and db.classbar.orientation == 'VERTICAL' then
bars[i]:Point('BOTTOM', bars[i-1], 'TOP', 0, (db.classbar.spacing + UF.BORDER*2 + UF.SPACING*2))
else
bars[i]:Point('LEFT', bars[i-1], 'RIGHT', (db.classbar.spacing + UF.BORDER*2 + UF.SPACING*2), 0) --5px spacing between borders of each button(replaced with Detached Spacing option)
end
elseif i == frame.MAX_CLASS_BAR then
bars[i]:Point('LEFT', bars[i-1], 'RIGHT', UF.BORDER-UF.SPACING, 0)
bars[i]:Point('RIGHT', bars)
else
bars[i]:Point('LEFT', bars[i-1], 'RIGHT', UF.BORDER-UF.SPACING, 0)
end
end
if not frame.USE_MINI_CLASSBAR then
bars[i].backdrop:Hide()
else
bars[i].backdrop:Show()
end
if E.myclass == 'MONK' then
bars[i]:SetStatusBarColor(unpack(ElvUF.colors.ClassBars[E.myclass][i]))
elseif E.myclass == 'PALADIN' or E.myclass == 'MAGE' or E.myclass == 'WARLOCK' then
bars[i]:SetStatusBarColor(unpack(ElvUF.colors.ClassBars[E.myclass]))
elseif E.myclass == 'DEATHKNIGHT' and frame.ClassBar == 'Runes' then
local r, g, b = unpack(ElvUF.colors.ClassBars.DEATHKNIGHT)
bars[i]:SetStatusBarColor(r, g, b)
if bars[i].bg then
local mu = bars[i].bg.multiplier or 1
bars[i].bg:SetVertexColor(r * mu, g * mu, b * mu)
end
else -- Combo Points for everyone else
local r1, g1, b1 = unpack(ElvUF.colors.ComboPoints[1])
local r2, g2, b2 = unpack(ElvUF.colors.ComboPoints[2])
local r3, g3, b3 = unpack(ElvUF.colors.ComboPoints[3])
local maxComboPoints = ((frame.MAX_CLASS_BAR == 10 and 10) or (frame.MAX_CLASS_BAR > 5 and 6 or 5))
bars[i]:SetStatusBarColor(ElvUF:ColorGradient(i, maxComboPoints, r1, g1, b1, r2, g2, b2, r3, g3, b3))
end
if frame.CLASSBAR_DETACHED and db.classbar.verticalOrientation then
bars[i]:SetOrientation('VERTICAL')
else
bars[i]:SetOrientation('HORIZONTAL')
end
--Fix missing backdrop colors on Combo Points when using Spaced style
if frame.ClassBar == 'ClassPower' then
if frame.USE_MINI_CLASSBAR then
bars[i].bg:SetParent(bars[i].backdrop)
else
bars[i].bg:SetParent(bars)
end
end
end
end
if (not frame.USE_MINI_CLASSBAR) and frame.USE_CLASSBAR then
bars.backdrop:Show()
else
bars.backdrop:Hide()
end
elseif frame.ClassBar == 'AdditionalPower' or frame.ClassBar == 'Stagger' or frame.ClassBar == 'AlternativePower' then
if frame.CLASSBAR_DETACHED and db.classbar.verticalOrientation then
bars:SetOrientation('VERTICAL')
else
bars:SetOrientation('HORIZONTAL')
end
end
if frame.USE_MINI_CLASSBAR and not frame.CLASSBAR_DETACHED then
bars:ClearAllPoints()
bars:Point('CENTER', frame.Health.backdrop, 'TOP', 0, 0)
bars:SetFrameLevel(50) --RaisedElementParent uses 100, we want it lower than this
if bars.Holder and bars.Holder.mover then
E:DisableMover(bars.Holder.mover:GetName())
end
elseif frame.CLASSBAR_DETACHED then
bars.Holder:Size(db.classbar.detachedWidth, db.classbar.height)
bars:ClearAllPoints()
bars:Point('BOTTOMLEFT', bars.Holder, 'BOTTOMLEFT', UF.BORDER + UF.SPACING, UF.BORDER + UF.SPACING)
if not bars.Holder.mover then
E:CreateMover(bars.Holder, 'ClassBarMover', L["Classbar"], nil, nil, nil, 'ALL,SOLO', nil, 'unitframe,individualUnits,player,classbar')
else
E:EnableMover(bars.Holder.mover:GetName())
end
if not db.classbar.strataAndLevel.useCustomStrata then
bars:SetFrameStrata('LOW')
else
bars:SetFrameStrata(db.classbar.strataAndLevel.frameStrata)
end
if not db.classbar.strataAndLevel.useCustomLevel then
bars:SetFrameLevel(frame.Health:GetFrameLevel() + 10) --Health uses 10, Power uses (Health + 5) when attached
else
bars:SetFrameLevel(db.classbar.strataAndLevel.frameLevel)
end
else
bars:ClearAllPoints()
if frame.ORIENTATION == 'RIGHT' then
bars:Point('BOTTOMRIGHT', frame.Health.backdrop, 'TOPRIGHT', -UF.BORDER, UF.SPACING*3)
else
bars:Point('BOTTOMLEFT', frame.Health.backdrop, 'TOPLEFT', UF.BORDER, UF.SPACING*3)
end
bars:SetFrameStrata('LOW')
bars:SetFrameLevel(frame.Health:GetFrameLevel() + 10) --Health uses 10, Power uses (Health + 5) when attached
if bars.Holder and bars.Holder.mover then
E:DisableMover(bars.Holder.mover:GetName())
end
end
if frame.CLASSBAR_DETACHED and db.classbar.parent == 'UIPARENT' then
E.FrameLocks[bars] = true
bars:SetParent(E.UIParent)
else
E.FrameLocks[bars] = nil
bars:SetParent(frame)
end
if frame.USE_CLASSBAR then
if frame.ClassPower and not frame:IsElementEnabled('ClassPower') then
frame:EnableElement('ClassPower')
end
if frame.AdditionalPower and not frame:IsElementEnabled('AdditionalPower') then
frame:EnableElement('AdditionalPower')
end
if frame.Runes and not frame:IsElementEnabled('Runes') then
frame:EnableElement('Runes')
end
if frame.Stagger and not frame:IsElementEnabled('Stagger') then
frame:EnableElement('Stagger')
end
if frame.AlternativePower and not frame:IsElementEnabled('AlternativePower') then
frame:EnableElement('AlternativePower')
end
else
if frame.ClassPower and frame:IsElementEnabled('ClassPower') then
frame:DisableElement('ClassPower')
end
if frame.AdditionalPower and frame:IsElementEnabled('AdditionalPower') then
frame:DisableElement('AdditionalPower')
end
if frame.Runes and frame:IsElementEnabled('Runes') then
frame:DisableElement('Runes')
end
if frame.Stagger and frame:IsElementEnabled('Stagger') then
frame:DisableElement('Stagger')
end
if frame.AlternativePower and frame:IsElementEnabled('AlternativePower') then
frame:DisableElement('AlternativePower')
end
end
end
local function ToggleResourceBar(bars)
local frame = bars.origParent or bars:GetParent()
local db = frame.db
if not db then return end
frame.CLASSBAR_SHOWN = frame[frame.ClassBar]:IsShown()
if bars.text then bars.text:SetAlpha(frame.CLASSBAR_SHOWN and 1 or 0) end
frame.CLASSBAR_HEIGHT = frame.USE_CLASSBAR and ((db.classbar and db.classbar.height) or (frame.AlternativePower and db.power.height)) or 0
frame.CLASSBAR_YOFFSET = (not frame.USE_CLASSBAR or not frame.CLASSBAR_SHOWN or frame.CLASSBAR_DETACHED) and 0 or (frame.USE_MINI_CLASSBAR and ((UF.SPACING+(frame.CLASSBAR_HEIGHT/2))) or (frame.CLASSBAR_HEIGHT - (UF.BORDER-UF.SPACING)))
UF:Configure_CustomTexts(frame)
UF:Configure_HealthBar(frame)
UF:Configure_Portrait(frame)
-- keep this after the configure_healtbar, we need the one updated before we match the healpred size to -1
if frame.HealthPrediction then
UF:SetSize_HealComm(frame)
end
end
UF.ToggleResourceBar = ToggleResourceBar --Make available to combobar
-------------------------------------------------------------
-- MONK, PALADIN, WARLOCK, MAGE, and COMBOS
-------------------------------------------------------------
function UF:Construct_ClassBar(frame)
local bars = CreateFrame('Frame', '$parent_ClassBar', frame, 'BackdropTemplate')
bars:CreateBackdrop(nil, nil, nil, nil, true)
bars:Hide()
local maxBars = max(UF.classMaxResourceBar[E.myclass] or 0, MAX_COMBO_POINTS)
for i = 1, maxBars do
bars[i] = CreateFrame('StatusBar', frame:GetName()..'ClassIconButton'..i, bars)
bars[i]:SetStatusBarTexture(E.media.blankTex) --Dummy really, this needs to be set so we can change the color
bars[i]:GetStatusBarTexture():SetHorizTile(false)
UF.statusbars[bars[i]] = true
bars[i]:CreateBackdrop(nil, nil, nil, nil, true)
bars[i].backdrop:SetParent(bars)
bars[i].bg = bars:CreateTexture(nil, 'BORDER')
bars[i].bg:SetAllPoints(bars[i])
bars[i].bg:SetTexture(E.media.blankTex)
end
bars.PostVisibility = UF.PostVisibilityClassBar
bars.PostUpdate = UF.UpdateClassBar
bars.UpdateColor = E.noop --We handle colors on our own in Configure_ClassBar
bars.UpdateTexture = E.noop --We don't use textures but statusbars, so prevent errors
bars:SetScript('OnShow', ToggleResourceBar)
bars:SetScript('OnHide', ToggleResourceBar)
return bars
end
function UF:PostVisibilityClassBar()
UF:PostVisibility_ClassBars(self.origParent or self:GetParent())
end
function UF:UpdateClassBar(current, maxBars, hasMaxChanged)
local frame = self.origParent or self:GetParent()
local db = frame.db
if not db then return end
local isShown = self:IsShown()
local stateChanged
if not frame.USE_CLASSBAR or (current == 0 and db.classbar.autoHide) or maxBars == nil then
self:Hide()
if isShown then
stateChanged = true
end
else
self:Show()
if not isShown then
stateChanged = true
end
end
if hasMaxChanged then
frame.MAX_CLASS_BAR = maxBars
UF:Configure_ClassBar(frame, current)
elseif stateChanged then
UF:Configure_ClassBar(frame, current)
end
local custom_backdrop = UF.db.colors.customclasspowerbackdrop and UF.db.colors.classpower_backdrop
for i=1, #self do
if custom_backdrop then
self[i].bg:SetVertexColor(custom_backdrop.r, custom_backdrop.g, custom_backdrop.b)
else
local r, g, b = self[i]:GetStatusBarColor()
self[i].bg:SetVertexColor(r * .35, g * .35, b * .35)
end
if maxBars and (i <= maxBars) then
self[i].bg:Show()
else
self[i].bg:Hide()
end
end
end
-------------------------------------------------------------
-- DEATHKNIGHT
-------------------------------------------------------------
local function PostUpdateRunes(self)
local useRunes = not UnitHasVehicleUI('player')
if useRunes then
self:Show()
else
self:Hide()
end
local custom_backdrop = UF.db.colors.customclasspowerbackdrop and UF.db.colors.classpower_backdrop
for i=1, #self do
if custom_backdrop then
self[i].bg:SetVertexColor(custom_backdrop.r, custom_backdrop.g, custom_backdrop.b)
else
local r, g, b = self[i]:GetStatusBarColor()
self[i].bg:SetVertexColor(r * .35, g * .35, b * .35)
end
end
end
function UF:Construct_DeathKnightResourceBar(frame)
local runes = CreateFrame('Frame', '$parent_Runes', frame)
runes:CreateBackdrop(nil, nil, nil, nil, true)
runes.backdrop:Hide()
for i = 1, UF.classMaxResourceBar[E.myclass] do
runes[i] = CreateFrame('StatusBar', frame:GetName()..'RuneButton'..i, runes)
runes[i]:SetStatusBarTexture(E.media.blankTex)
runes[i]:GetStatusBarTexture():SetHorizTile(false)
UF.statusbars[runes[i]] = true
runes[i]:CreateBackdrop(nil, nil, nil, nil, true)
runes[i].backdrop:SetParent(runes)
runes[i].bg = runes[i]:CreateTexture(nil, 'BORDER')
runes[i].bg:SetAllPoints()
runes[i].bg:SetTexture(E.media.blankTex)
runes[i].bg.multiplier = 0.35
end
runes.PostUpdate = PostUpdateRunes
runes.UpdateColor = E.noop --We handle colors on our own in Configure_ClassBar
runes:SetScript('OnShow', ToggleResourceBar)
runes:SetScript('OnHide', ToggleResourceBar)
return runes
end
-------------------------------------------------------------
-- ALTERNATIVE MANA BAR
-------------------------------------------------------------
function UF:Construct_AdditionalPowerBar(frame)
local additionalPower = CreateFrame('StatusBar', '$parent_AdditionalPowerBar', frame)
additionalPower.colorPower = true
additionalPower.frequentUpdates = true
additionalPower.PostUpdate = UF.PostUpdateAdditionalPower
additionalPower.PostUpdateColor = UF.PostColorAdditionalPower
additionalPower.PostVisibility = UF.PostVisibilityAdditionalPower
additionalPower:CreateBackdrop(nil, nil, nil, nil, true)
additionalPower:SetStatusBarTexture(E.media.blankTex)
UF.statusbars[additionalPower] = true
additionalPower.RaisedElementParent = CreateFrame('Frame', nil, additionalPower)
additionalPower.RaisedElementParent:SetFrameLevel(additionalPower:GetFrameLevel() + 100)
additionalPower.RaisedElementParent:SetAllPoints()
additionalPower.text = additionalPower.RaisedElementParent:CreateFontString(nil, 'OVERLAY')
UF:Configure_FontString(additionalPower.text)
additionalPower.bg = additionalPower:CreateTexture(nil, 'BORDER')
additionalPower.bg:SetAllPoints(additionalPower)
additionalPower.bg:SetTexture(E.media.blankTex)
additionalPower.bg.multiplier = 0.35
additionalPower:SetScript('OnShow', ToggleResourceBar)
additionalPower:SetScript('OnHide', ToggleResourceBar)
return additionalPower
end
function UF:PostColorAdditionalPower()
local frame = self.origParent or self:GetParent()
if frame.USE_CLASSBAR then
local custom_backdrop = UF.db.colors.customclasspowerbackdrop and UF.db.colors.classpower_backdrop
if custom_backdrop then
self.bg:SetVertexColor(custom_backdrop.r, custom_backdrop.g, custom_backdrop.b)
end
end
end
function UF:PostUpdateAdditionalPower(CUR, MAX, event)
local frame = self.origParent or self:GetParent()
local db = frame.db
if frame.USE_CLASSBAR and event ~= 'ElementDisable' and (CUR ~= MAX or not db.classbar.autoHide) then
self:Show()
else
self:Hide()
end
end
function UF:PostVisibilityAdditionalPower(enabled)
local frame = self.origParent or self:GetParent()
frame.ClassBar = (enabled and 'AdditionalPower') or 'ClassPower'
UF:PostVisibility_ClassBars(frame)
end
-----------------------------------------------------------
-- Stagger Bar
-----------------------------------------------------------
function UF:Construct_Stagger(frame)
local stagger = CreateFrame('Statusbar', '$parent_Stagger', frame)
stagger:CreateBackdrop(nil,nil, nil, nil, true)
stagger.PostUpdate = UF.PostUpdateStagger
stagger.PostVisibility = UF.PostUpdateVisibilityStagger
UF.statusbars[stagger] = true
stagger:SetScript('OnShow', ToggleResourceBar)
stagger:SetScript('OnHide', ToggleResourceBar)
return stagger
end
function UF:PostUpdateStagger(stagger)
local frame = self.origParent or self:GetParent()
local db = frame.db
if not frame.USE_CLASSBAR or (stagger == 0 and db.classbar.autoHide) then
self:Hide()
else
self:Show()
end
end
function UF:PostUpdateVisibilityStagger(_, _, isShown, stateChanged)
self.ClassBar = (isShown and 'Stagger') or 'ClassPower'
if stateChanged then
UF:PostVisibility_ClassBars(self)
end
end

View File

@@ -0,0 +1,81 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
local C_Timer_NewTimer = C_Timer.NewTimer
local UnitAffectingCombat = UnitAffectingCombat
local CombatTextures = {
COMBAT = E.Media.Textures.Combat,
DEFAULT = [[Interface\CharacterFrame\UI-StateIcon]],
PLATINUM = [[Interface\Challenges\ChallengeMode_Medal_Platinum]],
ATTACK = [[Interface\CURSOR\Attack]],
ALERT = [[Interface\DialogFrame\UI-Dialog-Icon-AlertNew]],
ALERT2 = [[Interface\OptionsFrame\UI-OptionsFrame-NewFeatureIcon]],
ARTHAS = [[Interface\LFGFRAME\UI-LFR-PORTRAIT]],
SKULL = [[Interface\LootFrame\LootPanel-Icon]],
}
function UF:Construct_CombatIndicator(frame)
return frame.RaisedElementParent.TextureParent:CreateTexture(nil, 'OVERLAY')
end
local TestingTimer
local TestingFrame
local function TestingFunc()
local inCombat = UnitAffectingCombat('player')
if TestingFrame and not inCombat then
TestingFrame:Hide()
end
end
function UF:TestingDisplay_CombatIndicator(frame)
local Icon = frame.CombatIndicator
local db = frame.db.CombatIcon
if TestingTimer then
TestingTimer:Cancel()
end
if not db.enable then
Icon:Hide()
return
end
Icon:Show()
TestingFrame = Icon
TestingTimer = C_Timer_NewTimer(10, TestingFunc)
end
function UF:Configure_CombatIndicator(frame)
local Icon = frame.CombatIndicator
local db = frame.db.CombatIcon
Icon:ClearAllPoints()
Icon:Point('CENTER', frame.Health, db.anchorPoint, db.xOffset, db.yOffset)
Icon:Size(db.size)
if db.defaultColor then
Icon:SetVertexColor(1, 1, 1, 1)
Icon:SetDesaturated(false)
else
Icon:SetVertexColor(db.color.r, db.color.g, db.color.b, db.color.a)
Icon:SetDesaturated(true)
end
if db.texture == 'CUSTOM' and db.customTexture then
Icon:SetTexture(db.customTexture)
Icon:SetTexCoord(0, 1, 0, 1)
elseif db.texture ~= 'DEFAULT' and CombatTextures[db.texture] then
Icon:SetTexture(CombatTextures[db.texture])
Icon:SetTexCoord(0, 1, 0, 1)
else
Icon:SetTexture(CombatTextures.DEFAULT)
Icon:SetTexCoord(.5, 1, 0, .49)
end
if db.enable and not frame:IsElementEnabled('CombatIndicator') then
frame:EnableElement('CombatIndicator')
elseif not db.enable and frame:IsElementEnabled('CombatIndicator') then
frame:DisableElement('CombatIndicator')
end
end

View File

@@ -0,0 +1,64 @@
local E, L, V, P, G = unpack(select(2, ...)) --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames')
local LSM = E.Libs.LSM
local pairs = pairs
function UF:Configure_CustomTexts(frame)
local frameDB = frame.db
--Make sure CustomTexts are hidden if they don't exist in current profile
if frame.customTexts then
for name, object in pairs(frame.customTexts) do
if not frameDB.customTexts or not frameDB.customTexts[name] then
object:Hide()
end
end
end
if frameDB.customTexts then
local font = LSM:Fetch('font', UF.db.font)
for name in pairs(frameDB.customTexts) do
local object = frame.customTexts[name]
if not object then
object = frame:CreateFontString(nil, 'OVERLAY')
end
local db, tagFont = frameDB.customTexts[name]
if db.font then
tagFont = LSM:Fetch('font', db.font)
end
local attachPoint = self:GetObjectAnchorPoint(frame, db.attachTextTo)
object:FontTemplate(tagFont or font, db.size or UF.db.fontSize, db.fontOutline or UF.db.fontOutline)
object:SetJustifyH(db.justifyH or 'CENTER')
object:ClearAllPoints()
object:Point(db.justifyH or 'CENTER', attachPoint, db.justifyH or 'CENTER', db.xOffset, db.yOffset)
if db.attachTextTo == 'Power' and frame.Power then
object:SetParent(frame.Power.RaisedElementParent)
elseif db.attachTextTo == 'AdditionalPower' and frame.AdditionalPower then
object:SetParent(frame.AdditionalPower.RaisedElementParent)
else
object:SetParent(frame.RaisedElementParent)
end
--This takes care of custom texts that were added before the enable option was added.
if db.enable == nil then
db.enable = true
end
if db.enable then
frame:Tag(object, db.text_format or '')
object:Show()
else
frame:Untag(object)
object:Hide()
end
if not frame.customTexts[name] then
frame.customTexts[name] = object
end
end
end
end

View File

@@ -0,0 +1,87 @@
local E, L, V, P, G = unpack(select(2, ...)) --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames')
function UF:Construct_Cutaway(frame)
local cutaway = {}
local frameName = frame:GetName()
if frame.Power then
local powerTexture = frame.Power:GetStatusBarTexture()
local cutawayPower = frame.Power.ClipFrame:CreateTexture(frameName .. 'CutawayPower')
cutawayPower:Point('TOPLEFT', powerTexture, 'TOPRIGHT')
cutawayPower:Point('BOTTOMLEFT', powerTexture, 'BOTTOMRIGHT')
cutawayPower:SetTexture(E.media.blankTex)
cutaway.Power = cutawayPower
end
local healthTexture = frame.Health:GetStatusBarTexture()
local cutawayHealth = frame.Health.ClipFrame:CreateTexture(frameName .. 'CutawayHealth')
cutawayHealth:Point('TOPLEFT', healthTexture, 'TOPRIGHT')
cutawayHealth:Point('BOTTOMLEFT', healthTexture, 'BOTTOMRIGHT')
cutawayHealth:SetTexture(E.media.blankTex)
cutaway.Health = cutawayHealth
return cutaway
end
local cutawayPoints = {
[-4] = {'TOPLEFT', 'BOTTOMLEFT'},
[-3] = {'TOPRIGHT', 'BOTTOMRIGHT'},
[-2] = {'TOPRIGHT', 'TOPLEFT'},
[-1] = {'BOTTOMRIGHT', 'BOTTOMLEFT'},
[1] = {'TOPLEFT', 'TOPRIGHT'},
[2] = {'BOTTOMLEFT', 'BOTTOMRIGHT'},
[3] = {'BOTTOMLEFT', 'TOPLEFT'},
[4] = {'BOTTOMRIGHT', 'TOPRIGHT'}
}
local DEFAULT_INDEX, VERT_INDEX = 1, 3
function UF:GetPoints_Cutaway(db)
local vertical = db and db.orientation == 'VERTICAL'
local reversed = db and db.reverseFill
local index = (vertical and VERT_INDEX) or DEFAULT_INDEX
local p1 = (reversed and -index) or index
local p2 = p1 + ((reversed and -1) or 1)
return cutawayPoints[p1], cutawayPoints[p2]
end
function UF:Configure_Cutaway(frame)
local db = frame.db.cutaway
local healthEnabled = db and db.health and db.health.enabled
local powerEnabled = db and db.power and db.power.enabled
if healthEnabled or powerEnabled then
if not frame:IsElementEnabled('Cutaway') then
frame:EnableElement('Cutaway')
end
frame.Cutaway:UpdateConfigurationValues(db)
local health = frame.Cutaway.Health
if health and healthEnabled then
local point1, point2 = UF:GetPoints_Cutaway(frame.db.health)
local barTexture = frame.Health:GetStatusBarTexture()
health:ClearAllPoints()
health:Point(point1[1], barTexture, point1[2])
health:Point(point2[1], barTexture, point2[2])
frame.Health:PostUpdateColor(frame.unit)
end
local power = frame.Cutaway.Power
local powerUsable = powerEnabled and frame.USE_POWERBAR
if power and powerUsable then
local point1, point2 = UF:GetPoints_Cutaway(frame.db.power)
local barTexture = frame.Power:GetStatusBarTexture()
power:ClearAllPoints()
power:Point(point1[1], barTexture, point1[2])
power:Point(point2[1], barTexture, point2[2])
frame.Power:PostUpdateColor()
end
elseif frame:IsElementEnabled('Cutaway') then
frame:DisableElement('Cutaway')
end
end

View File

@@ -0,0 +1,457 @@
local E, L, V, P, G = unpack(select(2, ...)) --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames')
local LSM = E.Libs.LSM
local _G = _G
local pairs = pairs
local select = select
local assert = assert
local tinsert = tinsert
local strsub = strsub
local CreateFrame = CreateFrame
local UnitClass = UnitClass
local UnitExists = UnitExists
local UnitIsPlayer = UnitIsPlayer
local UnitIsUnit = UnitIsUnit
local UnitReaction = UnitReaction
function UF:FrameGlow_MouseOnUnit(frame)
if frame and frame:IsVisible() and UnitExists('mouseover') then
local unit = frame.unit or (frame.isForced and 'player')
return unit and UnitIsUnit('mouseover', unit)
end
return false
end
function UF:FrameGlow_ElementHook(frame, glow, which)
if not (frame and frame.__elements) then return end
tinsert(frame.__elements, function()
local unit = frame.unit or (frame.isForced and 'player')
if unit then
UF:FrameGlow_SetGlowColor(glow, unit, which)
end
if which == 'mouseoverGlow' then
UF:FrameGlow_PositionTexture(frame)
UF:FrameGlow_CheckMouseover(frame)
else
UF:FrameGlow_PositionGlow(frame, glow, glow.powerGlow)
end
if which == 'targetGlow' then
UF:FrameGlow_CheckTarget(frame)
end
if which == 'focusGlow' then
UF:FrameGlow_CheckFocus(frame)
end
end)
end
function UF:FrameGlow_HookPowerBar(frame, power, powerName, glow, offset)
if (frame and power and powerName and glow and offset) and not glow[powerName..'Hooked'] then
glow[powerName..'Hooked'] = true
local func = function() UF:FrameGlow_ClassGlowPosition(frame, powerName, glow, offset, true) end
power:HookScript('OnShow', func)
power:HookScript('OnHide', func)
end
end
function UF:FrameGlow_ClassGlowPosition(frame, powerName, glow, offset, fromScript)
if not (frame and glow and offset) then return end
local power = powerName and frame[powerName]
if not power then return end
-- check for Additional Power to hook scripts on
local useBonusPower, bonus
if powerName == 'ClassPower' then
local bonusName = (frame.AdditionalPower and 'AdditionalPower') or (frame.Stagger and 'Stagger') or (frame.Runes and 'Runes')
bonus = bonusName and frame[bonusName]
if bonus then
if not fromScript then
UF:FrameGlow_HookPowerBar(frame, bonus, bonusName, glow, offset)
end
useBonusPower = bonus:IsVisible()
end
end
if not fromScript then
UF:FrameGlow_HookPowerBar(frame, power, powerName, glow, offset)
end
if useBonusPower then
power = bonus
end
local portrait = (frame.USE_PORTRAIT and not frame.USE_PORTRAIT_OVERLAY) and (frame.Portrait and frame.Portrait.backdrop)
if (power and power.backdrop and power:IsVisible()) and ((power == frame.AlternativePower and not frame.USE_MINI_CLASSBAR) or not (frame.CLASSBAR_DETACHED or frame.USE_MINI_CLASSBAR)) then
glow:SetPoint('TOPLEFT', (frame.ORIENTATION == 'LEFT' and portrait) or power.backdrop, -offset, offset)
glow:SetPoint('TOPRIGHT', (frame.ORIENTATION == 'RIGHT' and portrait) or power.backdrop, offset, offset)
elseif frame.Health and frame.Health.backdrop then
glow:SetPoint('TOPLEFT', (frame.ORIENTATION == 'LEFT' and portrait) or frame.Health.backdrop, -offset, offset)
glow:SetPoint('TOPRIGHT', (frame.ORIENTATION == 'RIGHT' and portrait) or frame.Health.backdrop, offset, offset)
end
end
function UF:FrameGlow_PositionGlow(frame, mainGlow, powerGlow)
if not frame then return end
local infoPanel = frame.InfoPanel
local classPower = frame.ClassPower
local altPower = frame.AlternativePower
local pvpSpec = frame.PVPSpecIcon
local power = frame.Power and frame.Power.backdrop
local health = frame.Health and frame.Health.backdrop
local portrait = (frame.USE_PORTRAIT and not frame.USE_PORTRAIT_OVERLAY) and (frame.Portrait and frame.Portrait.backdrop)
local offset = (UF.thinBorders and 4) or 5 -- edgeSize is 3
mainGlow:ClearAllPoints()
mainGlow:SetPoint('TOPLEFT', (frame.ORIENTATION == 'LEFT' and portrait) or health, -offset, offset)
mainGlow:SetPoint('TOPRIGHT', (frame.ORIENTATION == 'RIGHT' and portrait) or health, offset, offset)
if frame.USE_POWERBAR_OFFSET or frame.USE_MINI_POWERBAR then
mainGlow:SetPoint('BOTTOMLEFT', health, -offset, -offset)
mainGlow:SetPoint('BOTTOMRIGHT', health, offset, -offset)
else
--offset is set because its one pixel off for some reason
mainGlow:SetPoint('BOTTOMLEFT', frame, -offset, -(UF.thinBorders and offset or offset-1))
mainGlow:SetPoint('BOTTOMRIGHT', frame, offset, -(UF.thinBorders and offset or offset-1))
end
if powerGlow then
powerGlow:ClearAllPoints()
powerGlow:SetPoint('TOPLEFT', power, -offset, offset)
powerGlow:SetPoint('TOPRIGHT', power, offset, offset)
powerGlow:SetPoint('BOTTOMLEFT', power, -offset, -offset)
powerGlow:SetPoint('BOTTOMRIGHT', power, offset, -offset)
end
if classPower then
UF:FrameGlow_ClassGlowPosition(frame, 'ClassPower', mainGlow, offset)
elseif altPower then
UF:FrameGlow_ClassGlowPosition(frame, 'AlternativePower', mainGlow, offset)
elseif pvpSpec and pvpSpec:IsShown() then
local shownPanel = (infoPanel and infoPanel:IsShown() and infoPanel.backdrop)
mainGlow:SetPoint('TOPLEFT', pvpSpec.bg, -offset, offset)
mainGlow:SetPoint('BOTTOMLEFT', shownPanel or pvpSpec.bg, -offset, -offset)
end
end
function UF:FrameGlow_CreateGlow(frame, which)
-- Main Glow to wrap the health frame to it's best ability
local mainGlow = frame:CreateShadow(4, true)
mainGlow:SetFrameStrata('BACKGROUND')
mainGlow:Hide()
-- Secondary Glow for power frame when using power offset or mini power
local powerGlow = frame:CreateShadow(4, true)
powerGlow:SetFrameStrata('BACKGROUND')
powerGlow:Hide()
local level = (which == 'mouse' and 5) or (which == 'target' and 4) or 3
mainGlow:SetFrameLevel(level)
powerGlow:SetFrameLevel(level)
-- Eventing Frame
if not frame.FrameGlow then
frame.FrameGlow = CreateFrame('Frame', nil, frame)
frame.FrameGlow:Hide()
frame.FrameGlow:SetScript('OnEvent', function(_, event)
if event == 'UPDATE_MOUSEOVER_UNIT' then
UF:FrameGlow_CheckMouseover(frame)
elseif event == 'PLAYER_FOCUS_CHANGED' then
UF:FrameGlow_CheckFocus(frame)
elseif event == 'PLAYER_TARGET_CHANGED' then
UF:FrameGlow_CheckTarget(frame)
end
end)
end
mainGlow.powerGlow = powerGlow
return mainGlow
end
function UF:FrameGlow_SetGlowColor(glow, unit, which)
if not glow then return end
local option = E.db.unitframe.colors.frameGlow[which]
local r, g, b, a = 1, 1, 1, 1
if option.color then
local color = option.color
r, g, b, a = color.r, color.g, color.b, color.a
end
if option.class then
local isPlayer = unit and UnitIsPlayer(unit)
local reaction = unit and UnitReaction(unit, 'player')
if isPlayer then
local _, class = UnitClass(unit)
if class then
local color = E:ClassColor(class)
if color then
r, g, b = color.r, color.g, color.b
end
end
elseif reaction then
local color = _G.FACTION_BAR_COLORS[reaction]
if color then
r, g, b = color.r, color.g, color.b
end
end
end
if which == 'mouseoverGlow' then
glow:SetVertexColor(r, g, b, a)
else
glow:SetBackdropBorderColor(r, g, b, a)
if glow.powerGlow then
glow.powerGlow:SetBackdropBorderColor(r, g, b, a)
end
end
end
function UF:FrameGlow_HideGlow(glow)
if not glow then return end
if glow:IsShown() then glow:Hide() end
if glow.powerGlow and glow.powerGlow:IsShown() then
glow.powerGlow:Hide()
end
end
function UF:FrameGlow_ConfigureGlow(frame, unit, dbTexture)
if not frame then return end
if not unit then
unit = frame.unit or (frame.isForced and 'player')
end
local shouldHide
if frame.FrameGlow and frame.FrameGlow.texture then
if E.db.unitframe.colors.frameGlow.mouseoverGlow.enable and not (frame.db and frame.db.disableMouseoverGlow) then
frame.FrameGlow.texture:SetTexture(dbTexture)
UF:FrameGlow_SetGlowColor(frame.FrameGlow.texture, unit, 'mouseoverGlow')
else
shouldHide = 'texture'
end
end
if frame.MouseGlow then
if E.db.unitframe.colors.frameGlow.mainGlow.enable and not (frame.db and frame.db.disableMouseoverGlow) then
UF:FrameGlow_SetGlowColor(frame.MouseGlow, unit, 'mainGlow')
else
UF:FrameGlow_HideGlow(frame.MouseGlow)
if shouldHide then
shouldHide = 'both'
end
end
end
if shouldHide then
if shouldHide == 'both' and frame.FrameGlow:IsShown() then
frame.FrameGlow:Hide()
elseif shouldHide == 'texture' then
frame.FrameGlow.texture:Hide()
end
end
if frame.TargetGlow then
UF:FrameGlow_CheckTarget(frame, true)
end
if frame.FocusGlow then
UF:FrameGlow_CheckFocus(frame, true)
end
end
function UF:FrameGlow_CheckUnit(frame, element, setting, color, glowEnabled, frameDisabled)
if not (element and frame:IsVisible()) then return end
local unit = frame.unit or (frame.isForced and 'player')
if (glowEnabled and not frameDisabled) and unit and UnitIsUnit(unit, strsub(setting, 0, -5)) then
if color then
UF:FrameGlow_SetGlowColor(element, unit, setting)
end
if element.powerGlow then
if frame.USE_POWERBAR_OFFSET or frame.USE_MINI_POWERBAR then
element.powerGlow:Show()
elseif element.powerGlow:IsShown() then
element.powerGlow:Hide()
end
end
element:Show()
else
UF:FrameGlow_HideGlow(element)
end
end
function UF:FrameGlow_CheckTarget(frame, color)
UF:FrameGlow_CheckUnit(frame, frame.TargetGlow, 'targetGlow', color, E.db.unitframe.colors.frameGlow.targetGlow.enable, frame.db and frame.db.disableTargetGlow)
end
function UF:FrameGlow_CheckFocus(frame, color)
UF:FrameGlow_CheckUnit(frame, frame.FocusGlow, 'focusGlow', color, E.db.unitframe.colors.frameGlow.focusGlow.enable, frame.db and frame.db.disableFocusGlow)
end
function UF:FrameGlow_CheckMouseover(frame)
if not (frame and frame.MouseGlow and frame:IsVisible()) then return end
local shouldShow
if UF:FrameGlow_MouseOnUnit(frame) then
if E.db.unitframe.colors.frameGlow.mainGlow.enable and not (frame.db and frame.db.disableMouseoverGlow) then
shouldShow = 'frame'
end
if E.db.unitframe.colors.frameGlow.mouseoverGlow.enable and not (frame.db and frame.db.disableMouseoverGlow) then
shouldShow = (shouldShow and 'both') or 'texture'
end
end
if shouldShow then
if frame.FrameGlow and not frame.FrameGlow:IsShown() then
frame.FrameGlow:Show()
end
if shouldShow == 'both' or shouldShow == 'frame' then
if frame.MouseGlow.powerGlow then
if frame.USE_POWERBAR_OFFSET or frame.USE_MINI_POWERBAR then
frame.MouseGlow.powerGlow:Show()
elseif frame.MouseGlow.powerGlow:IsShown() then
frame.MouseGlow.powerGlow:Hide()
end
end
frame.MouseGlow:Show()
if shouldShow == 'frame' and frame.FrameGlow.texture and frame.FrameGlow.texture:IsShown() then
frame.FrameGlow.texture:Hide()
end
end
if (shouldShow == 'both' or shouldShow == 'texture') and frame.FrameGlow.texture and not frame.FrameGlow.texture:IsShown() then
frame.FrameGlow.texture:Show()
end
elseif frame.FrameGlow and frame.FrameGlow:IsShown() then
frame.FrameGlow:Hide()
end
end
function UF:FrameGlow_PositionTexture(frame)
if frame.FrameGlow and frame.FrameGlow.texture then
frame.FrameGlow.texture:ClearAllPoints()
frame.FrameGlow.texture:SetPoint('TOPLEFT', frame.Health, 'TOPLEFT')
frame.FrameGlow.texture:SetPoint('BOTTOMRIGHT', frame.Health:GetStatusBarTexture(), 'BOTTOMRIGHT')
end
end
function UF:Configure_FrameGlow(frame)
if frame.FrameGlow and frame.FrameGlow.texture then
local dbTexture = LSM:Fetch('statusbar', E.db.unitframe.colors.frameGlow.mouseoverGlow.texture)
frame.FrameGlow.texture:SetTexture(dbTexture)
end
end
function UF:Construct_FrameGlow(frame, glow)
if frame.Health and frame.FrameGlow then
frame.FrameGlow:SetScript('OnHide', function(watcher)
UF:FrameGlow_HideGlow(glow)
if watcher.texture and watcher.texture:IsShown() then
watcher.texture:Hide()
end
end)
frame.FrameGlow:SetScript('OnUpdate', function(watcher, elapsed)
if watcher.elapsed and watcher.elapsed > 0.1 then
if not UF:FrameGlow_MouseOnUnit(frame) then
watcher:Hide()
end
watcher.elapsed = 0
else
watcher.elapsed = (watcher.elapsed or 0) + elapsed
end
end)
frame.FrameGlow.texture = frame.Health:CreateTexture('$parentFrameGlow', 'ARTWORK', nil, 1)
frame.FrameGlow.texture:Hide()
UF:FrameGlow_ElementHook(frame, frame.FrameGlow.texture, 'mouseoverGlow')
end
end
function UF:Construct_MouseGlow(frame)
local mainGlow = UF:FrameGlow_CreateGlow(frame, 'mouse')
UF:FrameGlow_ElementHook(frame, mainGlow, 'mainGlow')
UF:Construct_FrameGlow(frame, mainGlow)
frame.FrameGlow:RegisterEvent('UPDATE_MOUSEOVER_UNIT')
return mainGlow
end
function UF:Construct_TargetGlow(frame)
local targetGlow = UF:FrameGlow_CreateGlow(frame, 'target')
UF:FrameGlow_ElementHook(frame, targetGlow, 'targetGlow')
frame.FrameGlow:RegisterEvent('PLAYER_TARGET_CHANGED')
return targetGlow
end
function UF:Construct_FocusGlow(frame)
local focusGlow = UF:FrameGlow_CreateGlow(frame, 'focus')
UF:FrameGlow_ElementHook(frame, focusGlow, 'focusGlow')
frame.FrameGlow:RegisterEvent('PLAYER_FOCUS_CHANGED')
return focusGlow
end
function UF:FrameGlow_CheckChildren(frame, dbTexture)
if frame.GetName then
local pet = _G[frame:GetName()..'Pet']
if pet then
UF:FrameGlow_ConfigureGlow(pet, pet.unit, dbTexture)
end
local target = _G[frame:GetName()..'Target']
if target then
UF:FrameGlow_ConfigureGlow(target, target.unit, dbTexture)
end
end
end
function UF:FrameGlow_UpdateFrames()
local dbTexture = LSM:Fetch('statusbar', E.db.unitframe.colors.frameGlow.mouseoverGlow.texture)
-- focus, focustarget, pet, pettarget, player, target, targettarget, targettargettarget
for unit in pairs(self.units) do
UF:FrameGlow_ConfigureGlow(self[unit], unit, dbTexture)
end
-- arena{1-5}, boss{1-5}
for unit in pairs(self.groupunits) do
UF:FrameGlow_ConfigureGlow(self[unit], unit, dbTexture)
end
-- assist, tank, party, raid, raid40, raidpet
for groupName in pairs(self.headers) do
assert(self[groupName], 'UF FrameGlow: Invalid group specified.')
local group = self[groupName]
if group.GetNumChildren then
for i=1, group:GetNumChildren() do
local frame = select(i, group:GetChildren())
if frame and frame.Health then
UF:FrameGlow_ConfigureGlow(frame, frame.unit, dbTexture)
UF:FrameGlow_CheckChildren(frame, dbTexture)
elseif frame then
for n = 1, frame:GetNumChildren() do
local child = select(n, frame:GetChildren())
if child and child.Health then
UF:FrameGlow_ConfigureGlow(child, child.unit, dbTexture)
UF:FrameGlow_CheckChildren(child, dbTexture)
end
end
end
end
end
end
end

View File

@@ -0,0 +1,300 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
local CreateFrame = CreateFrame
function UF.HealthClipFrame_HealComm(frame)
if frame.HealthPrediction then
UF:SetAlpha_HealComm(frame.HealthPrediction, 1)
UF:SetVisibility_HealComm(frame.HealthPrediction)
end
end
function UF:SetAlpha_HealComm(obj, alpha)
obj.myBar:SetAlpha(alpha)
obj.otherBar:SetAlpha(alpha)
obj.absorbBar:SetAlpha(alpha)
obj.healAbsorbBar:SetAlpha(alpha)
end
function UF:SetTexture_HealComm(obj, texture)
obj.myBar:SetStatusBarTexture(texture)
obj.otherBar:SetStatusBarTexture(texture)
obj.absorbBar:SetStatusBarTexture(texture)
obj.healAbsorbBar:SetStatusBarTexture(texture)
end
function UF:SetVisibility_HealComm(obj)
-- the first update is from `HealthClipFrame_HealComm`
-- we set this variable to allow `Configure_HealComm` to
-- update the elements overflow lock later on by option
if not obj.allowClippingUpdate then
obj.allowClippingUpdate = true
end
if obj.maxOverflow > 1 then
obj.myBar:SetParent(obj.health)
obj.otherBar:SetParent(obj.health)
obj.healAbsorbBar:SetParent(obj.health)
else
obj.myBar:SetParent(obj.parent)
obj.otherBar:SetParent(obj.parent)
obj.healAbsorbBar:SetParent(obj.parent)
end
end
function UF:Construct_HealComm(frame)
local health = frame.Health
local parent = health.ClipFrame
local myBar = CreateFrame('StatusBar', nil, parent)
local otherBar = CreateFrame('StatusBar', nil, parent)
local absorbBar = CreateFrame('StatusBar', nil, parent)
local healAbsorbBar = CreateFrame('StatusBar', nil, parent)
myBar:SetFrameLevel(11)
otherBar:SetFrameLevel(11)
absorbBar:SetFrameLevel(11)
healAbsorbBar:SetFrameLevel(11)
local prediction = {
myBar = myBar,
otherBar = otherBar,
absorbBar = absorbBar,
healAbsorbBar = healAbsorbBar,
PostUpdate = UF.UpdateHealComm,
maxOverflow = 1,
health = health,
parent = parent,
frame = frame
}
UF:SetAlpha_HealComm(prediction, 0)
UF:SetTexture_HealComm(prediction, E.media.blankTex)
return prediction
end
function UF:SetSize_HealComm(frame)
local health = frame.Health
local pred = frame.HealthPrediction
local orientation = health:GetOrientation()
local db = frame.db.healPrediction
local width, height = health:GetSize()
if orientation == 'HORIZONTAL' then
local barHeight = db.height
if barHeight == -1 or barHeight > height then barHeight = height end
pred.myBar:Size(width, barHeight)
pred.otherBar:Size(width, barHeight)
pred.healAbsorbBar:Size(width, barHeight)
pred.absorbBar:Size(width, barHeight)
else
local barWidth = db.height -- this is really width now not height
if barWidth == -1 or barWidth > width then barWidth = width end
pred.myBar:Size(barWidth, height)
pred.otherBar:Size(barWidth, height)
pred.healAbsorbBar:Size(barWidth, height)
pred.absorbBar:Size(barWidth, height)
end
end
function UF:Configure_HealComm(frame)
local db = frame.db.healPrediction
if db and db.enable then
local pred = frame.HealthPrediction
local myBar = pred.myBar
local otherBar = pred.otherBar
local absorbBar = pred.absorbBar
local healAbsorbBar = pred.healAbsorbBar
pred.needsSizeUpdated = true
local colors = self.db.colors.healPrediction
pred.maxOverflow = 1 + (colors.maxOverflow or 0)
if pred.allowClippingUpdate then
UF:SetVisibility_HealComm(pred)
end
if not frame:IsElementEnabled('HealthPrediction') then
frame:EnableElement('HealthPrediction')
end
local health = frame.Health
local orientation = health:GetOrientation()
local reverseFill = health:GetReverseFill()
local healthBarTexture = health:GetStatusBarTexture()
pred.reverseFill = reverseFill
pred.healthBarTexture = healthBarTexture
pred.myBarTexture = myBar:GetStatusBarTexture()
pred.otherBarTexture = otherBar:GetStatusBarTexture()
UF:SetTexture_HealComm(pred, UF.db.colors.transparentHealth and E.media.blankTex or healthBarTexture:GetTexture())
myBar:SetReverseFill(reverseFill)
otherBar:SetReverseFill(reverseFill)
healAbsorbBar:SetReverseFill(not reverseFill)
if db.absorbStyle == 'REVERSED' then
absorbBar:SetReverseFill(not reverseFill)
else
absorbBar:SetReverseFill(reverseFill)
end
myBar:SetStatusBarColor(colors.personal.r, colors.personal.g, colors.personal.b, colors.personal.a)
otherBar:SetStatusBarColor(colors.others.r, colors.others.g, colors.others.b, colors.others.a)
absorbBar:SetStatusBarColor(colors.absorbs.r, colors.absorbs.g, colors.absorbs.b, colors.absorbs.a)
healAbsorbBar:SetStatusBarColor(colors.healAbsorbs.r, colors.healAbsorbs.g, colors.healAbsorbs.b, colors.healAbsorbs.a)
myBar:SetOrientation(orientation)
otherBar:SetOrientation(orientation)
absorbBar:SetOrientation(orientation)
healAbsorbBar:SetOrientation(orientation)
if orientation == 'HORIZONTAL' then
local p1 = reverseFill and 'RIGHT' or 'LEFT'
local p2 = reverseFill and 'LEFT' or 'RIGHT'
local anchor = db.anchorPoint
pred.anchor, pred.anchor1, pred.anchor2 = anchor, p1, p2
myBar:ClearAllPoints()
myBar:Point(anchor, health)
myBar:Point(p1, healthBarTexture, p2)
otherBar:ClearAllPoints()
otherBar:Point(anchor, health)
otherBar:Point(p1, pred.myBarTexture, p2)
healAbsorbBar:ClearAllPoints()
healAbsorbBar:Point(anchor, health)
absorbBar:ClearAllPoints()
absorbBar:Point(anchor, health)
if db.absorbStyle == 'REVERSED' then
absorbBar:Point(p2, health, p2)
else
absorbBar:Point(p1, pred.otherBarTexture, p2)
end
else
local p1 = reverseFill and 'TOP' or 'BOTTOM'
local p2 = reverseFill and 'BOTTOM' or 'TOP'
local anchor = (db.anchorPoint == 'BOTTOM' and 'RIGHT') or (db.anchorPoint == 'TOP' and 'LEFT') or db.anchorPoint -- convert this for vertical too
pred.anchor, pred.anchor1, pred.anchor2 = anchor, p1, p2
myBar:ClearAllPoints()
myBar:Point(anchor, health)
myBar:Point(p1, healthBarTexture, p2)
otherBar:ClearAllPoints()
otherBar:Point(anchor, health)
otherBar:Point(p1, pred.myBarTexture, p2)
healAbsorbBar:ClearAllPoints()
healAbsorbBar:Point(anchor, health)
absorbBar:ClearAllPoints()
absorbBar:Point(anchor, health)
if db.absorbStyle == 'REVERSED' then
absorbBar:Point(p2, health, p2)
else
absorbBar:Point(p1, pred.otherBarTexture, p2)
end
end
elseif frame:IsElementEnabled('HealthPrediction') then
frame:DisableElement('HealthPrediction')
end
end
function UF:UpdateHealComm(_, _, _, absorb, _, hasOverAbsorb, hasOverHealAbsorb, health, maxHealth)
local frame = self.frame
local db = frame and frame.db and frame.db.healPrediction
if not db or not db.absorbStyle then return end
local pred = frame.HealthPrediction
local healAbsorbBar = pred.healAbsorbBar
local absorbBar = pred.absorbBar
if pred.needsSizeUpdated then
UF:SetSize_HealComm(frame)
pred.needsSizeUpdated = nil
end
-- absorbs is set to none so hide both and kill code execution
if db.absorbStyle == 'NONE' then
healAbsorbBar:Hide()
absorbBar:Hide()
return
end
local colors = UF.db.colors.healPrediction
local maxOverflow = colors.maxOverflow or 0
-- handle over heal absorbs
healAbsorbBar:ClearAllPoints()
healAbsorbBar:Point(pred.anchor, frame.Health)
if hasOverHealAbsorb then -- forward fill it when its greater than health so that you can still see this is being stolen
healAbsorbBar:SetReverseFill(pred.reverseFill)
healAbsorbBar:Point(pred.anchor1, pred.healthBarTexture, pred.anchor2)
healAbsorbBar:SetStatusBarColor(colors.overhealabsorbs.r, colors.overhealabsorbs.g, colors.overhealabsorbs.b, colors.overhealabsorbs.a)
else -- otherwise just let it backfill so that we know how much is being stolen
healAbsorbBar:SetReverseFill(not pred.reverseFill)
healAbsorbBar:Point(pred.anchor2, pred.healthBarTexture, pred.anchor2)
healAbsorbBar:SetStatusBarColor(colors.healAbsorbs.r, colors.healAbsorbs.g, colors.healAbsorbs.b, colors.healAbsorbs.a)
end
-- color absorb bar if in over state
if hasOverAbsorb then
absorbBar:SetStatusBarColor(colors.overabsorbs.r, colors.overabsorbs.g, colors.overabsorbs.b, colors.overabsorbs.a)
else
absorbBar:SetStatusBarColor(colors.absorbs.r, colors.absorbs.g, colors.absorbs.b, colors.absorbs.a)
end
-- if we are in normal mode and overflowing happens we should let a bit show, like blizzard does
if db.absorbStyle == 'NORMAL' then
if hasOverAbsorb and health == maxHealth then
absorbBar:SetValue(1.5)
absorbBar:SetMinMaxValues(0, 100)
absorbBar:SetParent(pred.health) -- lets overflow happen
else
absorbBar:SetParent(pred.parent) -- prevents overflow
end
else
if maxOverflow > 0 then
absorbBar:SetParent(pred.health)
else
absorbBar:SetParent(pred.parent)
end
if hasOverAbsorb then -- non normal mode overflowing
if db.absorbStyle == 'WRAPPED' then -- engage backfilling
absorbBar:SetReverseFill(not pred.reverseFill)
absorbBar:ClearAllPoints()
absorbBar:Point(pred.anchor, pred.health)
absorbBar:Point(pred.anchor2, pred.health, pred.anchor2)
elseif db.absorbStyle == 'OVERFLOW' then -- we need to display the overflow but adjusting the values
local overflowAbsorb = absorb * maxOverflow
if health == maxHealth then
absorbBar:SetValue(overflowAbsorb)
else -- fill the inner part along with the overflow amount so it smoothly transitions
absorbBar:SetValue((maxHealth - health) + overflowAbsorb)
end
end
elseif db.absorbStyle == 'WRAPPED' then -- restore wrapped to its forward filling state
absorbBar:SetReverseFill(pred.reverseFill)
absorbBar:ClearAllPoints()
absorbBar:Point(pred.anchor, pred.health)
absorbBar:Point(pred.anchor1, pred.otherBarTexture, pred.anchor2)
end
end
end

View File

@@ -0,0 +1,274 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
local random = random
local CreateFrame = CreateFrame
local UnitIsTapDenied = UnitIsTapDenied
local UnitReaction = UnitReaction
local UnitIsPlayer = UnitIsPlayer
local UnitClass = UnitClass
local UnitIsDeadOrGhost = UnitIsDeadOrGhost
local _, ns = ...
local ElvUF = ns.oUF
assert(ElvUF, 'ElvUI was unable to locate oUF.')
function UF.HealthClipFrame_OnUpdate(clipFrame)
UF.HealthClipFrame_HealComm(clipFrame.__frame)
clipFrame:SetScript('OnUpdate', nil)
end
function UF:Construct_HealthBar(frame, bg, text, textPos)
local health = CreateFrame('StatusBar', '$parent_HealthBar', frame)
UF.statusbars[health] = true
health:SetFrameLevel(10) --Make room for Portrait and Power which should be lower by default
health.PostUpdate = self.PostUpdateHealth
health.PostUpdateColor = self.PostUpdateHealthColor
if bg then
health.bg = health:CreateTexture(nil, 'BORDER')
health.bg:SetAllPoints()
health.bg:SetTexture(E.media.blankTex)
health.bg.multiplier = 0.35
end
if text then
health.value = frame.RaisedElementParent:CreateFontString(nil, 'OVERLAY')
UF:Configure_FontString(health.value)
local x = -2
if textPos == 'LEFT' then
x = 2
end
health.value:Point(textPos, health, textPos, x, 0)
end
health.colorTapping = true
health.colorDisconnected = true
health:CreateBackdrop(nil, nil, nil, nil, true)
local clipFrame = CreateFrame('Frame', nil, health)
clipFrame:SetScript('OnUpdate', UF.HealthClipFrame_OnUpdate)
clipFrame:SetClipsChildren(true)
clipFrame:SetAllPoints()
clipFrame:EnableMouse(false)
clipFrame.__frame = frame
health.ClipFrame = clipFrame
return health
end
function UF:Configure_HealthBar(frame)
local db = frame.db
local health = frame.Health
E:SetSmoothing(health, self.db.smoothbars)
--Text
if db.health and health.value then
local attachPoint = self:GetObjectAnchorPoint(frame, db.health.attachTextTo)
health.value:ClearAllPoints()
health.value:Point(db.health.position, attachPoint, db.health.position, db.health.xOffset, db.health.yOffset)
frame:Tag(health.value, db.health.text_format)
end
--Colors
health.colorSmooth = nil
health.colorHealth = nil
health.colorClass = nil
health.colorReaction = nil
health.colorSelection = nil
if db.colorOverride and db.colorOverride == 'FORCE_ON' then
health.colorClass = true
health.colorReaction = true
elseif db.colorOverride and db.colorOverride == 'FORCE_OFF' then
if self.db.colors.colorhealthbyvalue then
health.colorSmooth = true
else
health.colorHealth = true
end
else
if self.db.colors.healthselection then
health.colorSelection = true
--[[elseif self.db.colors.healththreat then
health.colorThreat = true]]
elseif self.db.colors.healthclass ~= true then
if self.db.colors.colorhealthbyvalue then
health.colorSmooth = true
else
health.colorHealth = true
end
else
health.colorClass = (not self.db.colors.forcehealthreaction)
health.colorReaction = true
end
end
--Position
health:ClearAllPoints()
health.WIDTH = db.width
health.HEIGHT = db.height
if frame.ORIENTATION == 'LEFT' then
health:Point('TOPRIGHT', frame, 'TOPRIGHT', -UF.BORDER - UF.SPACING - (frame.PVPINFO_WIDTH or 0), -UF.BORDER - UF.SPACING - frame.CLASSBAR_YOFFSET)
if frame.USE_POWERBAR_OFFSET then
health:Point('TOPRIGHT', frame, 'TOPRIGHT', -UF.BORDER - UF.SPACING - frame.POWERBAR_OFFSET, -UF.BORDER - UF.SPACING - frame.CLASSBAR_YOFFSET)
health:Point('BOTTOMLEFT', frame, 'BOTTOMLEFT', frame.PORTRAIT_WIDTH + UF.BORDER + UF.SPACING, UF.BORDER + UF.SPACING + frame.POWERBAR_OFFSET)
health.WIDTH = health.WIDTH - (UF.BORDER + UF.SPACING + frame.POWERBAR_OFFSET) - (UF.BORDER + UF.SPACING + frame.PORTRAIT_WIDTH)
health.HEIGHT = health.HEIGHT - (UF.BORDER + UF.SPACING + frame.CLASSBAR_YOFFSET) - (UF.BORDER + UF.SPACING + frame.POWERBAR_OFFSET)
elseif frame.POWERBAR_DETACHED or not frame.USE_POWERBAR or frame.USE_INSET_POWERBAR then
health:Point('BOTTOMLEFT', frame, 'BOTTOMLEFT', frame.PORTRAIT_WIDTH + UF.BORDER + UF.SPACING, UF.BORDER + UF.SPACING + frame.BOTTOM_OFFSET)
health.WIDTH = health.WIDTH - (UF.BORDER + UF.SPACING + (frame.PVPINFO_WIDTH or 0)) - (UF.BORDER + UF.SPACING + frame.PORTRAIT_WIDTH)
health.HEIGHT = health.HEIGHT - (UF.BORDER + UF.SPACING + frame.CLASSBAR_YOFFSET) - (UF.BORDER + UF.SPACING + frame.BOTTOM_OFFSET)
elseif frame.USE_MINI_POWERBAR then
health:Point('BOTTOMLEFT', frame, 'BOTTOMLEFT', frame.PORTRAIT_WIDTH + UF.BORDER + UF.SPACING, UF.SPACING + (frame.POWERBAR_HEIGHT/2))
health.WIDTH = health.WIDTH - (UF.BORDER + UF.SPACING + (frame.PVPINFO_WIDTH or 0)) - (UF.BORDER + UF.SPACING + frame.PORTRAIT_WIDTH)
health.HEIGHT = health.HEIGHT - (UF.BORDER + UF.SPACING + frame.CLASSBAR_YOFFSET) - (UF.SPACING + frame.POWERBAR_HEIGHT / 2)
else
health:Point('BOTTOMLEFT', frame, 'BOTTOMLEFT', frame.PORTRAIT_WIDTH + UF.BORDER + UF.SPACING, UF.BORDER + UF.SPACING + frame.BOTTOM_OFFSET)
health.WIDTH = health.WIDTH - (UF.BORDER + UF.SPACING + (frame.PVPINFO_WIDTH or 0)) - (UF.BORDER + UF.SPACING + frame.PORTRAIT_WIDTH)
health.HEIGHT = health.HEIGHT - (UF.BORDER + UF.SPACING + frame.CLASSBAR_YOFFSET) - (UF.BORDER + UF.SPACING + frame.BOTTOM_OFFSET)
end
elseif frame.ORIENTATION == 'RIGHT' then
health:Point('TOPLEFT', frame, 'TOPLEFT', UF.BORDER + UF.SPACING + (frame.PVPINFO_WIDTH or 0), -UF.BORDER - UF.SPACING - frame.CLASSBAR_YOFFSET)
if frame.USE_POWERBAR_OFFSET then
health:Point('TOPLEFT', frame, 'TOPLEFT', UF.BORDER + UF.SPACING + frame.POWERBAR_OFFSET, -UF.BORDER - UF.SPACING - frame.CLASSBAR_YOFFSET)
health:Point('BOTTOMRIGHT', frame, 'BOTTOMRIGHT', -frame.PORTRAIT_WIDTH - UF.BORDER - UF.SPACING, UF.BORDER + UF.SPACING + frame.POWERBAR_OFFSET)
health.WIDTH = health.WIDTH - (UF.BORDER + UF.SPACING + frame.POWERBAR_OFFSET) - (UF.BORDER + UF.SPACING + frame.PORTRAIT_WIDTH)
health.HEIGHT = health.HEIGHT - (UF.BORDER + UF.SPACING + frame.CLASSBAR_YOFFSET) - (UF.BORDER + UF.SPACING + frame.POWERBAR_OFFSET)
elseif frame.POWERBAR_DETACHED or not frame.USE_POWERBAR or frame.USE_INSET_POWERBAR then
health:Point('BOTTOMRIGHT', frame, 'BOTTOMRIGHT', -frame.PORTRAIT_WIDTH - UF.BORDER - UF.SPACING, UF.BORDER + UF.SPACING + frame.BOTTOM_OFFSET)
health.WIDTH = health.WIDTH - (UF.BORDER + UF.SPACING + (frame.PVPINFO_WIDTH or 0)) - (UF.BORDER + UF.SPACING + frame.PORTRAIT_WIDTH)
health.HEIGHT = health.HEIGHT - (UF.BORDER + UF.SPACING + frame.CLASSBAR_YOFFSET) - (UF.BORDER + UF.SPACING + frame.BOTTOM_OFFSET)
elseif frame.USE_MINI_POWERBAR then
health:Point('BOTTOMRIGHT', frame, 'BOTTOMRIGHT', -frame.PORTRAIT_WIDTH - UF.BORDER - UF.SPACING, UF.SPACING + (frame.POWERBAR_HEIGHT/2))
health.WIDTH = health.WIDTH - (UF.BORDER + UF.SPACING + (frame.PVPINFO_WIDTH or 0)) - (UF.BORDER + UF.SPACING + frame.PORTRAIT_WIDTH)
health.HEIGHT = health.HEIGHT - (UF.BORDER + UF.SPACING + frame.CLASSBAR_YOFFSET) - (UF.SPACING + frame.POWERBAR_HEIGHT / 2)
else
health:Point('BOTTOMRIGHT', frame, 'BOTTOMRIGHT', -frame.PORTRAIT_WIDTH - UF.BORDER - UF.SPACING, UF.BORDER + UF.SPACING + frame.BOTTOM_OFFSET)
health.WIDTH = health.WIDTH - (UF.BORDER + UF.SPACING + (frame.PVPINFO_WIDTH or 0)) - (UF.BORDER + UF.SPACING + frame.PORTRAIT_WIDTH)
health.HEIGHT = health.HEIGHT - (UF.BORDER + UF.SPACING + frame.CLASSBAR_YOFFSET) - (UF.BORDER + UF.SPACING + frame.BOTTOM_OFFSET)
end
elseif frame.ORIENTATION == 'MIDDLE' then
health:Point('TOPRIGHT', frame, 'TOPRIGHT', -UF.BORDER - UF.SPACING - (frame.PVPINFO_WIDTH or 0), -UF.BORDER - UF.SPACING - frame.CLASSBAR_YOFFSET)
if frame.USE_POWERBAR_OFFSET then
health:Point('TOPRIGHT', frame, 'TOPRIGHT', -UF.BORDER - UF.SPACING - frame.POWERBAR_OFFSET, -UF.BORDER - UF.SPACING - frame.CLASSBAR_YOFFSET)
health:Point('BOTTOMLEFT', frame, 'BOTTOMLEFT', UF.BORDER + UF.SPACING + frame.POWERBAR_OFFSET, UF.BORDER + UF.SPACING + frame.POWERBAR_OFFSET)
health.WIDTH = health.WIDTH - (UF.BORDER + UF.SPACING + frame.POWERBAR_OFFSET) - (UF.BORDER + UF.SPACING + frame.POWERBAR_OFFSET)
health.HEIGHT = health.HEIGHT - (UF.BORDER + UF.SPACING + frame.CLASSBAR_YOFFSET) - (UF.BORDER + UF.SPACING + frame.POWERBAR_OFFSET)
elseif frame.POWERBAR_DETACHED or not frame.USE_POWERBAR or frame.USE_INSET_POWERBAR then
health:Point('BOTTOMLEFT', frame, 'BOTTOMLEFT', UF.BORDER + UF.SPACING, UF.BORDER + UF.SPACING + frame.BOTTOM_OFFSET)
health.WIDTH = health.WIDTH - (UF.BORDER + UF.SPACING + (frame.PVPINFO_WIDTH or 0)) - (UF.BORDER + UF.SPACING)
health.HEIGHT = health.HEIGHT - (UF.BORDER + UF.SPACING + frame.CLASSBAR_YOFFSET) - (UF.BORDER + UF.SPACING + frame.BOTTOM_OFFSET)
elseif frame.USE_MINI_POWERBAR then
health:Point('BOTTOMLEFT', frame, 'BOTTOMLEFT', UF.BORDER + UF.SPACING, UF.SPACING + (frame.POWERBAR_HEIGHT/2))
health.WIDTH = health.WIDTH - (UF.BORDER + UF.SPACING + (frame.PVPINFO_WIDTH or 0)) - (UF.BORDER + UF.SPACING)
health.HEIGHT = health.HEIGHT - (UF.BORDER + UF.SPACING + frame.CLASSBAR_YOFFSET) - (UF.SPACING + frame.POWERBAR_HEIGHT / 2)
else
health:Point('BOTTOMLEFT', frame, 'BOTTOMLEFT', frame.PORTRAIT_WIDTH + UF.BORDER + UF.SPACING, UF.BORDER + UF.SPACING + frame.BOTTOM_OFFSET)
health.WIDTH = health.WIDTH - (UF.BORDER + UF.SPACING + (frame.PVPINFO_WIDTH or 0)) - (UF.BORDER + UF.SPACING + frame.PORTRAIT_WIDTH)
health.HEIGHT = health.HEIGHT - (UF.BORDER + UF.SPACING + frame.CLASSBAR_YOFFSET) - (UF.BORDER + UF.SPACING + frame.BOTTOM_OFFSET)
end
end
if db.health then
--Party/Raid Frames allow to change statusbar orientation
if db.health.orientation then
health:SetOrientation(db.health.orientation)
end
health:SetReverseFill(db.health.reverseFill)
end
UF:ToggleTransparentStatusBar(UF.db.colors.transparentHealth, frame.Health, frame.Health.bg, true, nil, db.health and db.health.reverseFill)
UF:Configure_FrameGlow(frame)
if frame:IsElementEnabled('Health') then
frame:SetHealthUpdateMethod(E.global.unitframe.effectiveHealth)
frame:SetHealthUpdateSpeed(E.global.unitframe.effectiveHealthSpeed)
frame.Health:ForceUpdate()
end
end
function UF:GetHealthBottomOffset(frame)
local bottomOffset = 0
if frame.USE_POWERBAR and not frame.POWERBAR_DETACHED and not frame.USE_INSET_POWERBAR then
bottomOffset = bottomOffset + frame.POWERBAR_HEIGHT - (UF.BORDER-UF.SPACING)
end
if frame.USE_INFO_PANEL then
bottomOffset = bottomOffset + frame.INFO_PANEL_HEIGHT - (UF.BORDER-UF.SPACING)
end
return bottomOffset
end
function UF:PostUpdateHealthColor(unit, r, g, b)
local parent = self:GetParent()
local colors = E.db.unitframe.colors
local newr, newg, newb -- fallback for bg if custom settings arent used
if not b then r, g, b = colors.health.r, colors.health.g, colors.health.b end
if (((colors.healthclass and colors.colorhealthbyvalue) or (colors.colorhealthbyvalue and parent.isForced)) and not UnitIsTapDenied(unit)) then
newr, newg, newb = ElvUF:ColorGradient(self.cur, self.max, 1, 0, 0, 1, 1, 0, r, g, b)
self:SetStatusBarColor(newr, newg, newb)
end
if self.bg then
self.bg.multiplier = (colors.healthMultiplier > 0 and colors.healthMultiplier) or 0.35
if colors.useDeadBackdrop and UnitIsDeadOrGhost(unit) then
self.bg:SetVertexColor(colors.health_backdrop_dead.r, colors.health_backdrop_dead.g, colors.health_backdrop_dead.b)
elseif colors.customhealthbackdrop then
self.bg:SetVertexColor(colors.health_backdrop.r, colors.health_backdrop.g, colors.health_backdrop.b)
elseif colors.classbackdrop then
local reaction, color = (UnitReaction(unit, 'player'))
if UnitIsPlayer(unit) then
local _, Class = UnitClass(unit)
color = parent.colors.class[Class]
elseif reaction then
color = parent.colors.reaction[reaction]
end
if color then
self.bg:SetVertexColor(color[1] * self.bg.multiplier, color[2] * self.bg.multiplier, color[3] * self.bg.multiplier)
end
elseif newb then
self.bg:SetVertexColor(newr * self.bg.multiplier, newg * self.bg.multiplier, newb * self.bg.multiplier)
else
self.bg:SetVertexColor(r * self.bg.multiplier, g * self.bg.multiplier, b * self.bg.multiplier)
end
end
end
function UF:PostUpdateHealth(_, cur)
local parent = self:GetParent()
if parent.isForced then
self.cur = random(1, 100)
self.max = 100
self:SetMinMaxValues(0, self.max)
self:SetValue(self.cur)
elseif parent.ResurrectIndicator then
parent.ResurrectIndicator:SetAlpha(cur == 0 and 1 or 0)
end
end

View File

@@ -0,0 +1,45 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
local CreateFrame = CreateFrame
function UF:Construct_InfoPanel(frame)
local infoPanel = CreateFrame('Frame', '$parent_InfoPanel', frame)
infoPanel:SetFrameLevel(7) --Health is 10 and filled power is 5 by default
infoPanel:CreateBackdrop(nil, true, nil, nil, true)
return infoPanel
end
function UF:Configure_InfoPanel(frame)
local db = frame.db
if frame.USE_INFO_PANEL then
frame.InfoPanel:Show()
frame.InfoPanel:ClearAllPoints()
if frame.ORIENTATION == 'RIGHT' and not (frame.unitframeType == 'arena') then
frame.InfoPanel:Point('BOTTOMRIGHT', frame, 'BOTTOMRIGHT', -UF.BORDER - UF.SPACING, UF.BORDER + UF.SPACING)
if frame.USE_POWERBAR and not frame.USE_INSET_POWERBAR and not frame.POWERBAR_DETACHED then
frame.InfoPanel:Point('TOPLEFT', frame.Power.backdrop, 'BOTTOMLEFT', UF.BORDER, -(UF.SPACING*3))
else
frame.InfoPanel:Point('TOPLEFT', frame.Health.backdrop, 'BOTTOMLEFT', UF.BORDER, -(UF.SPACING*3))
end
else
frame.InfoPanel:Point('BOTTOMLEFT', frame, 'BOTTOMLEFT', UF.BORDER + UF.SPACING, UF.BORDER + UF.SPACING)
if frame.USE_POWERBAR and not frame.USE_INSET_POWERBAR and not frame.POWERBAR_DETACHED then
frame.InfoPanel:Point('TOPRIGHT', frame.Power.backdrop, 'BOTTOMRIGHT', -UF.BORDER, -(UF.SPACING*3))
else
frame.InfoPanel:Point('TOPRIGHT', frame.Health.backdrop, 'BOTTOMRIGHT', -UF.BORDER, -(UF.SPACING*3))
end
end
if db.infoPanel.transparent then
frame.InfoPanel.backdrop:SetTemplate('Transparent', nil, nil, nil, true)
else
frame.InfoPanel.backdrop:SetTemplate(nil, true, nil, nil, true)
end
else
frame.InfoPanel:Hide()
end
end

View File

@@ -0,0 +1,37 @@
<Ui xmlns='http://www.blizzard.com/wow/ui/'>
<Script file='AltPower.lua'/>
<Script file='AuraBars.lua'/>
<Script file='Auras.lua'/>
<Script file='AuraHighlight.lua'/>
<Script file='BuffIndicator.lua'/>
<Script file='CastBar.lua'/>
<Script file='ClassBars.lua'/>
<Script file='CombatIndicator.lua'/>
<Script file='CustomText.lua'/>
<Script file='Cutaway.lua'/>
<Script file='HealPrediction.lua'/>
<Script file='Health.lua'/>
<Script file='InfoPanel.lua'/>
<Script file='Name.lua'/>
<Script file='PhaseIndicator.lua'/>
<Script file='PartyIndicator.lua'/>
<Script file='Portrait.lua'/>
<Script file='Power.lua'/>
<Script file='PowerPrediction.lua'/>
<Script file='PVPIcon.lua'/>
<Script file='PVPClassificationIndicator.lua'/>
<Script file='PVPIndicator.lua'/>
<Script file='PVPSpecIcon.lua'/>
<Script file='RaidDebuffs.lua'/>
<Script file='RaidIcon.lua'/>
<Script file='RaidRoleIcons.lua'/>
<Script file='Range.lua'/>
<Script file='ReadyCheckIcon.lua'/>
<Script file='RestingIndicator.lua'/>
<Script file='ResurrectionIcon.lua'/>
<Script file='SummonIndicator.lua'/>
<Script file='RoleIcons.lua'/>
<Script file='FrameGlow.lua'/>
<Script file='Threat.lua'/>
<Script file='Trinket.lua'/>
</Ui>

View File

@@ -0,0 +1,44 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
local UnitIsPlayer = UnitIsPlayer
function UF:Construct_NameText(frame)
local name = frame.RaisedElementParent:CreateFontString(nil, 'OVERLAY')
UF:Configure_FontString(name)
name:Point('CENTER', frame.Health)
return name
end
function UF:UpdateNameSettings(frame)
local db = frame.db
local name = frame.Name
if not db.power or not db.power.enable or not db.power.hideonnpc then
local attachPoint = self:GetObjectAnchorPoint(frame, db.name.attachTextTo)
name:ClearAllPoints()
name:Point(db.name.position, attachPoint, db.name.position, db.name.xOffset, db.name.yOffset)
end
frame:Tag(name, db.name.text_format)
end
function UF:PostNamePosition(frame, unit)
if not frame.Power.value:IsShown() then return end
local db = frame.db
if UnitIsPlayer(unit) or (db.power and not db.power.enable) then
local position = db.name.position
local attachPoint = self:GetObjectAnchorPoint(frame, db.name.attachTextTo)
frame.Power.value:SetAlpha(1)
frame.Name:ClearAllPoints()
frame.Name:Point(position, attachPoint, position, db.name.xOffset, db.name.yOffset)
else
frame.Power.value:SetAlpha(db.power.hideonnpc and 0 or 1)
frame.Name:ClearAllPoints()
frame.Name:Point(frame.Power.value:GetPoint())
end
end

View File

@@ -0,0 +1,23 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
function UF:Construct_PvPClassificationIndicator(frame)
local PvPClassificationIndicator = frame.RaisedElementParent.TextureParent:CreateTexture(nil, 'OVERLAY')
return PvPClassificationIndicator
end
function UF:Configure_PvPClassificationIndicator(frame)
local PvPClassificationIndicator = frame.PvPClassificationIndicator
local db = frame.db
PvPClassificationIndicator:Size(db.pvpclassificationindicator.size)
PvPClassificationIndicator:ClearAllPoints()
PvPClassificationIndicator:Point(E.InversePoints[db.pvpclassificationindicator.position], frame, db.pvpclassificationindicator.position, db.pvpclassificationindicator.xOffset, db.pvpclassificationindicator.yOffset)
if frame.db.pvpclassificationindicator.enable and not frame:IsElementEnabled('PvPClassificationIndicator') then
frame:EnableElement('PvPClassificationIndicator')
elseif not frame.db.pvpclassificationindicator.enable and frame:IsElementEnabled('PvPClassificationIndicator') then
frame:DisableElement('PvPClassificationIndicator')
end
end

View File

@@ -0,0 +1,32 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
function UF:Construct_PvPIcon(frame)
local PvPIndicator = frame.RaisedElementParent.TextureParent:CreateTexture(nil, 'ARTWORK', nil, 1)
PvPIndicator:Size(30, 30)
PvPIndicator:Point('CENTER', frame, 'CENTER')
local Badge = frame.RaisedElementParent.TextureParent:CreateTexture(nil, 'ARTWORK')
Badge:Size(50, 52)
Badge:Point('CENTER', PvPIndicator, 'CENTER')
PvPIndicator.Badge = Badge
return PvPIndicator
end
function UF:Configure_PVPIcon(frame)
local PvPIndicator = frame.PvPIndicator
PvPIndicator:ClearAllPoints()
PvPIndicator:Point(frame.db.pvpIcon.anchorPoint, frame.Health, frame.db.pvpIcon.anchorPoint, frame.db.pvpIcon.xOffset, frame.db.pvpIcon.yOffset)
local scale = frame.db.pvpIcon.scale or 1
PvPIndicator:Size(30 * scale)
PvPIndicator.Badge:Size(50 * scale, 52 * scale)
if frame.db.pvpIcon.enable and not frame:IsElementEnabled('PvPIndicator') then
frame:EnableElement('PvPIndicator')
elseif not frame.db.pvpIcon.enable and frame:IsElementEnabled('PvPIndicator') then
frame:DisableElement('PvPIndicator')
end
end

View File

@@ -0,0 +1,18 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
function UF:Construct_PvPIndicator(frame)
local pvp = frame.RaisedElementParent:CreateFontString(nil, 'OVERLAY')
UF:Configure_FontString(pvp)
return pvp
end
function UF:Configure_PVPIndicator(frame)
local pvp = frame.PvPText
local x, y = self:GetPositionOffset(frame.db.pvp.position)
pvp:ClearAllPoints()
pvp:Point(frame.db.pvp.position, frame.Health, frame.db.pvp.position, x, y)
frame:Tag(pvp, frame.db.pvp.text_format)
end

View File

@@ -0,0 +1,40 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
local CreateFrame = CreateFrame
function UF:Construct_PVPSpecIcon(frame)
local specIcon = CreateFrame('Frame', nil, frame)
specIcon.bg = CreateFrame('Frame', nil, specIcon, 'BackdropTemplate')
specIcon.bg:SetTemplate(nil, nil, nil, nil, true)
specIcon.bg:SetFrameLevel(specIcon:GetFrameLevel() - 1)
specIcon:SetInside(specIcon.bg)
return specIcon
end
function UF:Configure_PVPSpecIcon(frame)
local specIcon = frame.PVPSpecIcon
specIcon.bg:ClearAllPoints()
if frame.ORIENTATION == 'LEFT' then
specIcon.bg:Point('TOPRIGHT', frame, 'TOPRIGHT', -UF.SPACING, -UF.SPACING)
if frame.USE_MINI_POWERBAR or frame.USE_POWERBAR_OFFSET or frame.USE_INSET_POWERBAR then
specIcon.bg:Point('BOTTOMLEFT', frame.Health.backdrop, 'BOTTOMRIGHT', (-UF.BORDER + UF.SPACING*3) + frame.PORTRAIT_WIDTH, 0)
else
specIcon.bg:Point('BOTTOMLEFT', frame.Power.backdrop, 'BOTTOMRIGHT', (-UF.BORDER + UF.SPACING*3) + frame.PORTRAIT_WIDTH, 0)
end
else
specIcon.bg:Point('TOPLEFT', frame, 'TOPLEFT', UF.SPACING, -UF.SPACING)
if frame.USE_MINI_POWERBAR or frame.USE_POWERBAR_OFFSET or frame.USE_INSET_POWERBAR then
specIcon.bg:Point('BOTTOMRIGHT', frame.Health.backdrop, 'BOTTOMLEFT', (UF.BORDER - UF.SPACING*3) - frame.PORTRAIT_WIDTH, 0)
else
specIcon.bg:Point('BOTTOMRIGHT', frame.Power.backdrop, 'BOTTOMLEFT', (UF.BORDER - UF.SPACING*3) - frame.PORTRAIT_WIDTH, 0)
end
end
if frame.db.pvpSpecIcon and not frame:IsElementEnabled('PVPSpecIcon') then
frame:EnableElement('PVPSpecIcon')
elseif not frame.db.pvpSpecIcon and frame:IsElementEnabled('PVPSpecIcon') then
frame:DisableElement('PVPSpecIcon')
end
end

View File

@@ -0,0 +1,35 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames')
function UF:Construct_PartyIndicator(frame)
local PartyIndicator = CreateFrame('Frame', nil, frame.RaisedElementParent)
local HomeIcon = PartyIndicator:CreateTexture(nil, 'OVERLAY', nil, 0)
HomeIcon:Point('CENTER', 4, 4)
HomeIcon:Size(26)
local InstanceIcon = PartyIndicator:CreateTexture(nil, 'OVERLAY', nil, 1)
InstanceIcon:Point('CENTER', 0, 0)
InstanceIcon:Size(26)
PartyIndicator.HomeIcon = HomeIcon
PartyIndicator.InstanceIcon = InstanceIcon
return PartyIndicator
end
function UF:Configure_PartyIndicator(frame)
local db = frame and frame.db and frame.db.partyIndicator
if not db then return end
local PartyIndicator = frame.PartyIndicator
PartyIndicator:ClearAllPoints()
PartyIndicator:Point(db.anchorPoint, frame.Health, db.anchorPoint, db.xOffset, db.yOffset)
PartyIndicator:Size(20 * (db.scale or 1))
if frame.db.partyIndicator.enable and not frame:IsElementEnabled('PartyIndicator') then
frame:EnableElement('PartyIndicator')
elseif not frame.db.partyIndicator.enable and frame:IsElementEnabled('PartyIndicator') then
frame:DisableElement('PartyIndicator')
end
end

View File

@@ -0,0 +1,53 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames')
function UF:PostUpdate_PhaseIcon(hidden, phaseReason)
if phaseReason == 3 then -- chromie, gold
self.Center:SetVertexColor(1, 0.9, 0.5)
elseif phaseReason == 2 then -- warmode, red
self.Center:SetVertexColor(1, 0.3, 0.3)
elseif phaseReason == 1 then -- sharding, green
self.Center:SetVertexColor(0.5, 1, 0.3)
else -- phasing, blue
self.Center:SetVertexColor(0.3, 0.5, 1)
end
self.Center:SetShown(not hidden)
end
function UF:Construct_PhaseIcon(frame)
local PhaseIndicator = frame.RaisedElementParent.TextureParent:CreateTexture(nil, 'OVERLAY', nil, 6)
PhaseIndicator:SetTexture(E.Media.Textures.PhaseBorder)
PhaseIndicator:Point('CENTER', frame.Health)
PhaseIndicator:Size(32)
local Center = frame.RaisedElementParent.TextureParent:CreateTexture(nil, 'OVERLAY', nil, 7)
Center:SetTexture(E.Media.Textures.PhaseCenter)
Center:Point('CENTER', frame.Health)
Center:Size(32)
Center:Hide()
PhaseIndicator.Center = Center
PhaseIndicator.PostUpdate = UF.PostUpdate_PhaseIcon
return PhaseIndicator
end
function UF:Configure_PhaseIcon(frame)
local PhaseIndicator = frame.PhaseIndicator
PhaseIndicator:ClearAllPoints()
PhaseIndicator:Point(frame.db.phaseIndicator.anchorPoint, frame.Health, frame.db.phaseIndicator.anchorPoint, frame.db.phaseIndicator.xOffset, frame.db.phaseIndicator.yOffset)
local size = 32 * (frame.db.phaseIndicator.scale or 1)
PhaseIndicator:Size(size)
PhaseIndicator.Center:Size(size)
PhaseIndicator.Center:ClearAllPoints()
PhaseIndicator.Center:SetAllPoints(PhaseIndicator)
if frame.db.phaseIndicator.enable and not frame:IsElementEnabled('PhaseIndicator') then
frame:EnableElement('PhaseIndicator')
elseif not frame.db.phaseIndicator.enable and frame:IsElementEnabled('PhaseIndicator') then
frame:DisableElement('PhaseIndicator')
PhaseIndicator.Center:Hide()
end
end

View File

@@ -0,0 +1,138 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
local rad = rad
local unpack = unpack
local select = select
local UnitClass = UnitClass
local CreateFrame = CreateFrame
local CLASS_ICON_TCOORDS = CLASS_ICON_TCOORDS
local classIcon = [[Interface\WorldStateFrame\Icons-Classes]]
function UF:Construct_Portrait(frame, type)
local portrait
if type == 'texture' then
local backdrop = CreateFrame('Frame', nil, frame, 'BackdropTemplate')
portrait = frame:CreateTexture(nil, 'OVERLAY')
portrait:SetTexCoord(0.15, 0.85, 0.15, 0.85)
backdrop:SetOutside(portrait)
backdrop:SetFrameLevel(frame:GetFrameLevel())
backdrop:SetTemplate()
portrait.backdrop = backdrop
else
portrait = CreateFrame('PlayerModel', nil, frame)
portrait:CreateBackdrop(nil, nil, nil, nil, true)
end
portrait.PostUpdate = self.PortraitUpdate
return portrait
end
function UF:Configure_Portrait(frame)
local last = frame.Portrait
if last then
last:Hide()
last.backdrop:Hide()
end
local db = frame.db
local portrait = (db.portrait.style == '3D' and frame.Portrait3D) or frame.Portrait2D
portrait.db = db.portrait
frame.Portrait = portrait
if portrait.db.style == 'Class' then
portrait:SetTexture(classIcon)
portrait.customTexture = classIcon
elseif portrait.db.style == '2D' then
portrait:SetTexCoord(0.15, 0.85, 0.15, 0.85)
portrait.customTexture = nil
end
if frame.USE_PORTRAIT then
if not frame:IsElementEnabled('Portrait') then
frame:EnableElement('Portrait')
end
portrait:Show()
portrait:ClearAllPoints()
portrait.backdrop:ClearAllPoints()
if portrait.db.style == '3D' then
portrait:SetFrameLevel(frame.Health:GetFrameLevel())
else
portrait:SetParent(frame.USE_PORTRAIT_OVERLAY and frame.Health or frame)
end
if frame.USE_PORTRAIT_OVERLAY then
portrait:SetAlpha(portrait.db.overlayAlpha)
portrait.backdrop:Hide()
if portrait.db.fullOverlay then
portrait:SetAllPoints(frame.Health)
else
local healthTex = frame.Health:GetStatusBarTexture()
if db.health.reverseFill then
portrait:Point('TOPLEFT', healthTex, 'TOPLEFT')
portrait:Point('BOTTOMLEFT', healthTex, 'BOTTOMLEFT')
portrait:Point('BOTTOMRIGHT', frame.Health, 'BOTTOMRIGHT')
else
portrait:Point('TOPLEFT', frame.Health, 'TOPLEFT')
portrait:Point('BOTTOMRIGHT', healthTex, 'BOTTOMRIGHT')
portrait:Point('BOTTOMLEFT', healthTex, 'BOTTOMLEFT')
end
end
else
portrait:SetAlpha(1)
portrait.backdrop:Show()
portrait:SetInside(portrait.backdrop, UF.BORDER)
if frame.ORIENTATION == 'LEFT' then
portrait.backdrop:Point('TOPLEFT', frame, 'TOPLEFT', UF.SPACING, frame.USE_MINI_CLASSBAR and -(frame.CLASSBAR_YOFFSET+UF.SPACING) or -UF.SPACING)
if frame.USE_MINI_POWERBAR or frame.USE_POWERBAR_OFFSET or not frame.USE_POWERBAR or frame.USE_INSET_POWERBAR or frame.POWERBAR_DETACHED then
portrait.backdrop:Point('BOTTOMRIGHT', frame.Health.backdrop, 'BOTTOMLEFT', UF.BORDER - UF.SPACING*3, 0)
else
portrait.backdrop:Point('BOTTOMRIGHT', frame.Power.backdrop, 'BOTTOMLEFT', UF.BORDER - UF.SPACING*3, 0)
end
elseif frame.ORIENTATION == 'RIGHT' then
portrait.backdrop:Point('TOPRIGHT', frame, 'TOPRIGHT', -UF.SPACING, frame.USE_MINI_CLASSBAR and -(frame.CLASSBAR_YOFFSET+UF.SPACING) or -UF.SPACING)
if frame.USE_MINI_POWERBAR or frame.USE_POWERBAR_OFFSET or not frame.USE_POWERBAR or frame.USE_INSET_POWERBAR or frame.POWERBAR_DETACHED then
portrait.backdrop:Point('BOTTOMLEFT', frame.Health.backdrop, 'BOTTOMRIGHT', -UF.BORDER + UF.SPACING*3, 0)
else
portrait.backdrop:Point('BOTTOMLEFT', frame.Power.backdrop, 'BOTTOMRIGHT', -UF.BORDER + UF.SPACING*3, 0)
end
end
end
else
if frame:IsElementEnabled('Portrait') then
frame:DisableElement('Portrait')
end
portrait.backdrop:Hide()
portrait:Hide()
end
end
function UF:PortraitUpdate(unit, event)
if self.stateChanged or event == 'ElvUI_UpdateAllElements' then
local db = self.db
if not db then return end
if self.playerModel then
if self.state then
self:SetCamDistanceScale(db.camDistanceScale)
self:SetViewTranslation(db.xOffset * 100, db.yOffset * 100)
self:SetRotation(rad(db.rotation))
end
self:SetDesaturation(db.desaturation)
self:SetPaused(db.paused)
elseif db.style == 'Class' then
local Class = select(2, UnitClass(unit))
self:SetTexCoord(unpack(CLASS_ICON_TCOORDS[Class]))
end
end
end

View File

@@ -0,0 +1,284 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
local _, ns = ...
local ElvUF = ns.oUF
assert(ElvUF, 'ElvUI was unable to locate oUF.')
local random = random
local CreateFrame = CreateFrame
local UnitPowerType = UnitPowerType
local hooksecurefunc = hooksecurefunc
local GetUnitPowerBarInfo = GetUnitPowerBarInfo
local ALTERNATE_POWER_INDEX = Enum.PowerType.Alternate or 10
function UF:Construct_PowerBar(frame, bg, text, textPos)
local power = CreateFrame('StatusBar', '$parent_PowerBar', frame)
UF.statusbars[power] = true
hooksecurefunc(power, 'SetStatusBarColor', function(_, r, g, b)
if frame and frame.PowerPrediction and frame.PowerPrediction.mainBar then
if UF and UF.db and UF.db.colors and UF.db.colors.powerPrediction and UF.db.colors.powerPrediction.enable then
local color = UF.db.colors.powerPrediction.color
frame.PowerPrediction.mainBar:SetStatusBarColor(color.r, color.g, color.b, color.a)
else
frame.PowerPrediction.mainBar:SetStatusBarColor(r * 1.25, g * 1.25, b * 1.25)
end
end
end)
power.RaisedElementParent = CreateFrame('Frame', nil, power)
power.RaisedElementParent:SetFrameLevel(power:GetFrameLevel() + 100)
power.RaisedElementParent:SetAllPoints()
power.PostUpdate = self.PostUpdatePower
power.PostUpdateColor = self.PostUpdatePowerColor
power.GetDisplayPower = self.GetDisplayPower
if bg then
power.BG = power:CreateTexture(nil, 'BORDER')
power.BG:SetAllPoints()
power.BG:SetTexture(E.media.blankTex)
end
if text then
power.value = frame.RaisedElementParent:CreateFontString(nil, 'OVERLAY')
UF:Configure_FontString(power.value)
local x = -2
if textPos == 'LEFT' then
x = 2
end
power.value:Point(textPos, frame.Health, textPos, x, 0)
end
power.useAtlas = false
power.colorDisconnected = false
power.colorTapping = false
power:CreateBackdrop(nil, nil, nil, nil, true)
local clipFrame = CreateFrame('Frame', nil, power)
clipFrame:SetClipsChildren(true)
clipFrame:SetAllPoints()
clipFrame:EnableMouse(false)
clipFrame.__frame = frame
power.ClipFrame = clipFrame
return power
end
function UF:Configure_Power(frame)
local db = frame.db
local power = frame.Power
power.origParent = frame
if frame.USE_POWERBAR then
if not frame:IsElementEnabled('Power') then
frame:EnableElement('Power')
end
--Show the power here so that attached texts can be displayed correctly.
power:Show() --Since it is updated in the PostUpdatePower, so it's fine!
E:SetSmoothing(power, self.db.smoothbars)
frame:SetPowerUpdateMethod(E.global.unitframe.effectivePower)
frame:SetPowerUpdateSpeed(E.global.unitframe.effectivePowerSpeed)
--Text
local attachPoint = UF:GetObjectAnchorPoint(frame, db.power.attachTextTo)
power.value:ClearAllPoints()
power.value:Point(db.power.position, attachPoint, db.power.position, db.power.xOffset, db.power.yOffset)
frame:Tag(power.value, db.power.text_format)
if db.power.attachTextTo == 'Power' then
power.value:SetParent(power.RaisedElementParent)
else
power.value:SetParent(frame.RaisedElementParent)
end
if db.power.reverseFill then
power:SetReverseFill(true)
else
power:SetReverseFill(false)
end
--Colors
power.colorClass = nil
power.colorReaction = nil
power.colorPower = nil
power.colorSelection = nil
power.displayAltPower = db.power.displayAltPower
if self.db.colors.powerselection then
power.colorSelection = true
--[[elseif self.db.colors.powerthreat then
power.colorThreat = true]]
elseif self.db.colors.powerclass then
power.colorClass = true
power.colorReaction = true
else
power.colorPower = true
end
--Fix height in case it is lower than the theme allows
local heightChanged = false
if not UF.thinBorders and frame.POWERBAR_HEIGHT < 7 then --A height of 7 means 6px for borders and just 1px for the actual power statusbar
frame.POWERBAR_HEIGHT = 7
db.power.height = 7
heightChanged = true
elseif UF.thinBorders and frame.POWERBAR_HEIGHT < 3 then --A height of 3 means 2px for borders and just 1px for the actual power statusbar
frame.POWERBAR_HEIGHT = 3
db.power.height = 3
heightChanged = true
end
if heightChanged then
--Update health size
frame.BOTTOM_OFFSET = UF:GetHealthBottomOffset(frame)
UF:Configure_HealthBar(frame)
end
--Position
power:ClearAllPoints()
local OFFSET = (UF.BORDER + UF.SPACING)*2
if frame.POWERBAR_DETACHED then
if power.Holder and power.Holder.mover then
E:EnableMover(power.Holder.mover:GetName())
else
power.Holder = CreateFrame('Frame', nil, power)
power.Holder:Point('BOTTOM', frame, 'BOTTOM', 0, -20)
if frame.unitframeType then
local key = frame.unitframeType:gsub('t(arget)','T%1'):gsub('p(layer)','P%1'):gsub('f(ocus)','F%1'):gsub('p(et)','P%1')
E:CreateMover(power.Holder, key..'PowerBarMover', L[key.." Powerbar"], nil, nil, nil, 'ALL,SOLO', nil, 'unitframe,individualUnits,'..frame.unitframeType..',power')
end
end
power.Holder:Size(frame.POWERBAR_WIDTH, frame.POWERBAR_HEIGHT)
power:Point('BOTTOMLEFT', power.Holder, 'BOTTOMLEFT', UF.BORDER+UF.SPACING, UF.BORDER+UF.SPACING)
power:Size(frame.POWERBAR_WIDTH - OFFSET, frame.POWERBAR_HEIGHT - OFFSET)
power:SetFrameLevel(50) --RaisedElementParent uses 100, we want lower value to allow certain icons and texts to appear above power
elseif frame.USE_POWERBAR_OFFSET then
if frame.ORIENTATION == 'LEFT' then
power:Point('TOPRIGHT', frame.Health, 'TOPRIGHT', frame.POWERBAR_OFFSET, -frame.POWERBAR_OFFSET)
power:Point('BOTTOMLEFT', frame.Health, 'BOTTOMLEFT', frame.POWERBAR_OFFSET, -frame.POWERBAR_OFFSET)
elseif frame.ORIENTATION == 'MIDDLE' then
power:Point('TOPLEFT', frame, 'TOPLEFT', UF.BORDER + UF.SPACING, -frame.POWERBAR_OFFSET -frame.CLASSBAR_YOFFSET)
power:Point('BOTTOMRIGHT', frame, 'BOTTOMRIGHT', -UF.BORDER - UF.SPACING, UF.BORDER)
else
power:Point('TOPLEFT', frame.Health, 'TOPLEFT', -frame.POWERBAR_OFFSET, -frame.POWERBAR_OFFSET)
power:Point('BOTTOMRIGHT', frame.Health, 'BOTTOMRIGHT', -frame.POWERBAR_OFFSET, -frame.POWERBAR_OFFSET)
end
power:SetFrameLevel(frame.Health:GetFrameLevel() - 5) --Health uses 10
elseif frame.USE_INSET_POWERBAR then
power:Height(frame.POWERBAR_HEIGHT - OFFSET)
power:Point('BOTTOMLEFT', frame.Health, 'BOTTOMLEFT', UF.BORDER + (UF.BORDER*2), UF.BORDER + (UF.BORDER*2))
power:Point('BOTTOMRIGHT', frame.Health, 'BOTTOMRIGHT', -(UF.BORDER + (UF.BORDER*2)), UF.BORDER + (UF.BORDER*2))
power:SetFrameLevel(50)
elseif frame.USE_MINI_POWERBAR then
power:Height(frame.POWERBAR_HEIGHT - OFFSET)
if frame.ORIENTATION == 'LEFT' then
power:Width(frame.POWERBAR_WIDTH - UF.BORDER*2)
power:Point('RIGHT', frame, 'BOTTOMRIGHT', -(UF.BORDER*2 + 4), ((frame.POWERBAR_HEIGHT-UF.BORDER)/2))
elseif frame.ORIENTATION == 'RIGHT' then
power:Width(frame.POWERBAR_WIDTH - UF.BORDER*2)
power:Point('LEFT', frame, 'BOTTOMLEFT', (UF.BORDER*2 + 4), ((frame.POWERBAR_HEIGHT-UF.BORDER)/2))
else
power:Point('LEFT', frame, 'BOTTOMLEFT', (UF.BORDER*2 + 4), ((frame.POWERBAR_HEIGHT-UF.BORDER)/2))
power:Point('RIGHT', frame, 'BOTTOMRIGHT', -(UF.BORDER*2 + 4 + (frame.PVPINFO_WIDTH or 0)), ((frame.POWERBAR_HEIGHT-UF.BORDER)/2))
end
power:SetFrameLevel(50)
else
power:Point('TOPRIGHT', frame.Health.backdrop, 'BOTTOMRIGHT', -UF.BORDER, -UF.SPACING*3)
power:Point('TOPLEFT', frame.Health.backdrop, 'BOTTOMLEFT', UF.BORDER, -UF.SPACING*3)
power:Height(frame.POWERBAR_HEIGHT - OFFSET)
power:SetFrameLevel(frame.Health:GetFrameLevel() + 5) --Health uses 10
end
--Hide mover until we detach again
if not frame.POWERBAR_DETACHED and power.Holder and power.Holder.mover then
E:DisableMover(power.Holder.mover:GetName())
end
if db.power.strataAndLevel and db.power.strataAndLevel.useCustomStrata then
power:SetFrameStrata(db.power.strataAndLevel.frameStrata)
else
power:SetFrameStrata('LOW')
end
if db.power.strataAndLevel and db.power.strataAndLevel.useCustomLevel then
power:SetFrameLevel(db.power.strataAndLevel.frameLevel)
end
power.backdrop:SetFrameLevel(power:GetFrameLevel() - 1)
if frame.POWERBAR_DETACHED and db.power.parent == 'UIPARENT' then
E.FrameLocks[power] = true
power:SetParent(E.UIParent)
else
E.FrameLocks[power] = nil
power:SetParent(frame)
end
elseif frame:IsElementEnabled('Power') then
frame:DisableElement('Power')
power:Hide()
frame:Tag(power.value, '')
end
frame.Power.custom_backdrop = UF.db.colors.custompowerbackdrop and UF.db.colors.power_backdrop
UF:ToggleTransparentStatusBar(UF.db.colors.transparentPower, frame.Power, frame.Power.BG, nil, UF.db.colors.invertPower, db.power.reverseFill)
end
function UF:GetDisplayPower()
local barInfo = GetUnitPowerBarInfo(self.__owner.unit)
if barInfo then
return ALTERNATE_POWER_INDEX, barInfo.minPower
end
end
local tokens = {[0]='MANA','RAGE','FOCUS','ENERGY','RUNIC_POWER'}
function UF:PostUpdatePowerColor()
local parent = self.origParent or self:GetParent()
if parent.isForced and not self.colorClass then
local color = ElvUF.colors.power[tokens[random(0,4)]]
self:SetStatusBarColor(color[1], color[2], color[3])
if self.BG then
UF:UpdateBackdropTextureColor(self.BG, color[1], color[2], color[3])
end
end
end
local powerTypesFull = {MANA = true, FOCUS = true, ENERGY = true}
function UF:PostUpdatePower(unit, cur, min, max)
local parent = self.origParent or self:GetParent()
if parent.isForced then
self.cur = random(1, 100)
self.max = 100
self:SetMinMaxValues(0, self.max)
self:SetValue(self.cur)
end
local db = parent.db and parent.db.power
if not db then return end
if (unit == 'player' or unit == 'target') and db.autoHide and parent.POWERBAR_DETACHED then
local _, powerType = UnitPowerType(unit)
if (powerTypesFull[powerType] and cur == max) or cur == min then
self:Hide()
else
self:Show()
end
elseif not self:IsShown() then
self:Show()
end
if db.hideonnpc then
UF:PostNamePosition(parent, unit)
end
end

View File

@@ -0,0 +1,128 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
local CreateFrame = CreateFrame
local hooksecurefunc = hooksecurefunc
function UF:SetSize_PowerPrediction(frame)
local pred = frame.PowerPrediction
local width, height = frame.Power:GetSize()
if frame.Power:GetOrientation() == 'HORIZONTAL' then
pred.mainBar:Size(width, 0)
else
pred.mainBar:Size(0, height)
end
local altBar = pred.altBar
if altBar then
local altWidth, altHeight = frame.AdditionalPower:GetSize()
if altBar:GetOrientation() == 'HORIZONTAL' then
altBar:Size(altWidth, 0)
else
altBar:Size(0, altHeight)
end
end
end
function UF:PostUpdate_PowerPrediction()
local frame = self.parent
local pred = frame.PowerPrediction
if pred.needsSizeUpdated then
UF:SetSize_PowerPrediction(frame)
pred.needsSizeUpdated = nil
end
end
function UF:Construct_PowerPrediction(frame)
local mainBar = CreateFrame('StatusBar', nil, frame.Power)
mainBar:SetStatusBarTexture(E.media.blankTex)
mainBar.parent = frame.Power
mainBar:Hide()
local prediction = {
parent = frame,
mainBar = mainBar,
PostUpdate = UF.PostUpdate_PowerPrediction
}
if frame.AdditionalPower then
prediction.altBar = CreateFrame('StatusBar', nil, frame.AdditionalPower)
prediction.altBar:SetStatusBarTexture(E.media.blankTex)
prediction.altBar:Hide()
hooksecurefunc(frame.AdditionalPower, 'SetStatusBarColor', function(_, r, g, b)
local bar = frame and frame.PowerPrediction and frame.PowerPrediction.altBar
if bar then
local pred = UF.db.colors and UF.db.colors.powerPrediction
if pred and pred.enable then
local color = pred.additional
bar:SetStatusBarColor(color.r, color.g, color.b, color.a)
else
bar:SetStatusBarColor(r * 1.25, g * 1.25, b * 1.25)
end
end
end)
end
return prediction
end
function UF:Configure_PowerPrediction(frame)
if frame.db.power.powerPrediction then
if not frame:IsElementEnabled('PowerPrediction') then
frame:EnableElement('PowerPrediction')
end
local pred = frame.PowerPrediction
local mainBar = pred.mainBar
local altBar = pred.altBar
local power = frame.Power
pred.needsSizeUpdated = true
local powerBarTexture = power:GetStatusBarTexture()
local orientation = power:GetOrientation()
local reverseFill = power:GetReverseFill()
mainBar:ClearAllPoints()
mainBar:SetReverseFill(not reverseFill)
mainBar:SetStatusBarTexture(UF.db.colors.transparentPower and E.media.blankTex or powerBarTexture:GetTexture())
if orientation == 'HORIZONTAL' then
local point = reverseFill and 'LEFT' or 'RIGHT'
mainBar:Point('TOP')
mainBar:Point('BOTTOM')
mainBar:Point(point, powerBarTexture, point)
else
local point = reverseFill and 'BOTTOM' or 'TOP'
mainBar:Point('LEFT')
mainBar:Point('RIGHT')
mainBar:Point(point, powerBarTexture, point)
end
if altBar then
local altPower = frame.AdditionalPower
local altPowerBarTexture = altPower:GetStatusBarTexture()
local altPowerOrientation = altPower:GetOrientation()
altBar:ClearAllPoints()
altBar:SetReverseFill(true)
altBar:SetStatusBarTexture(UF.db.colors.transparentPower and E.media.blankTex or altPowerBarTexture:GetTexture())
altBar:SetOrientation(altPowerOrientation)
if altPowerOrientation == 'HORIZONTAL' then
altBar:Point('TOP')
altBar:Point('BOTTOM')
altBar:Point('RIGHT', altPowerBarTexture, 'RIGHT')
else
altBar:Point('LEFT')
altBar:Point('RIGHT')
altBar:Point('TOP', altPowerBarTexture, 'TOP')
end
end
elseif frame:IsElementEnabled('PowerPrediction') then
frame:DisableElement('PowerPrediction')
end
end

View File

@@ -0,0 +1,60 @@
local E, L, V, P, G = unpack(select(2, ...)) --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames')
local LSM = E.Libs.LSM
local unpack = unpack
local CreateFrame = CreateFrame
function UF:Construct_RaidDebuffs(frame)
local debuff = CreateFrame('Frame', nil, frame.RaisedElementParent, 'BackdropTemplate')
debuff:SetTemplate(nil, nil, nil, nil, true)
debuff:SetFrameLevel(frame.RaisedElementParent:GetFrameLevel() + 20) --Make them appear above regular buffs or debuffs
debuff.icon = debuff:CreateTexture(nil, 'OVERLAY')
debuff.icon:SetInside(debuff, UF.BORDER, UF.BORDER)
debuff.count = debuff:CreateFontString(nil, 'OVERLAY')
debuff.count:FontTemplate(nil, 10, 'OUTLINE')
debuff.count:Point('BOTTOMRIGHT', 0, 2)
debuff.count:SetTextColor(1, .9, 0)
debuff.time = debuff:CreateFontString(nil, 'OVERLAY')
debuff.time:FontTemplate(nil, 10, 'OUTLINE')
debuff.time:Point('CENTER')
debuff.time:SetTextColor(1, .9, 0)
return debuff
end
function UF:Configure_RaidDebuffs(frame)
local debuff = frame.RaidDebuffs
local db = frame.db.rdebuffs
if db.enable then
if not frame:IsElementEnabled('RaidDebuffs') then
frame:EnableElement('RaidDebuffs')
end
debuff.showDispellableDebuff = db.showDispellableDebuff
debuff.onlyMatchSpellID = db.onlyMatchSpellID
debuff.forceShow = frame.forceShowAuras
debuff.icon:SetTexCoord(unpack(E.TexCoords))
debuff:Point('BOTTOM', frame, 'BOTTOM', db.xOffset, db.yOffset + UF.SPACING)
debuff:Size(db.size)
local font = LSM:Fetch('font', db.font)
local stackColor = db.stack.color
debuff.count:FontTemplate(font, db.fontSize, db.fontOutline)
debuff.count:ClearAllPoints()
debuff.count:Point(db.stack.position, db.stack.xOffset, db.stack.yOffset)
debuff.count:SetTextColor(stackColor.r, stackColor.g, stackColor.b, stackColor.a)
local durationColor = db.duration.color
debuff.time:FontTemplate(font, db.fontSize, db.fontOutline)
debuff.time:ClearAllPoints()
debuff.time:Point(db.duration.position, db.duration.xOffset, db.duration.yOffset)
debuff.time:SetTextColor(durationColor.r, durationColor.g, durationColor.b, durationColor.a)
elseif frame:IsElementEnabled('RaidDebuffs') then
frame:DisableElement('RaidDebuffs')
end
end

View File

@@ -0,0 +1,30 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
function UF:Construct_RaidIcon(frame)
local tex = frame.RaisedElementParent.TextureParent:CreateTexture(nil, 'OVERLAY')
tex:SetTexture([[Interface\TargetingFrame\UI-RaidTargetingIcons]])
tex:Size(18)
tex:Point('CENTER', frame.Health, 'TOP', 0, 2)
tex.SetTexture = E.noop
return tex
end
function UF:Configure_RaidIcon(frame)
local RI = frame.RaidTargetIndicator
local db = frame.db
if db.raidicon.enable then
frame:EnableElement('RaidTargetIndicator')
RI:Show()
RI:Size(db.raidicon.size)
local attachPoint = self:GetObjectAnchorPoint(frame, db.raidicon.attachToObject)
RI:ClearAllPoints()
RI:Point(db.raidicon.attachTo, attachPoint, db.raidicon.attachTo, db.raidicon.xOffset, db.raidicon.yOffset)
else
frame:DisableElement('RaidTargetIndicator')
RI:Hide()
end
end

View File

@@ -0,0 +1,70 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
local CreateFrame = CreateFrame
function UF:Construct_RaidRoleFrames(frame)
local anchor = CreateFrame('Frame', nil, frame.RaisedElementParent)
frame.LeaderIndicator = anchor:CreateTexture(nil, 'OVERLAY')
frame.AssistantIndicator = anchor:CreateTexture(nil, 'OVERLAY')
anchor:Size(24, 12)
frame.LeaderIndicator:Size(12)
frame.AssistantIndicator:Size(12)
frame.LeaderIndicator.PostUpdate = UF.RaidRoleUpdate
frame.AssistantIndicator.PostUpdate = UF.RaidRoleUpdate
return anchor
end
function UF:Configure_RaidRoleIcons(frame)
local raidRoleFrameAnchor = frame.RaidRoleFramesAnchor
if frame.db.raidRoleIcons.enable then
raidRoleFrameAnchor:Show()
if not frame:IsElementEnabled('LeaderIndicator') then
frame:EnableElement('LeaderIndicator')
frame:EnableElement('AssistantIndicator')
end
raidRoleFrameAnchor:ClearAllPoints()
if frame.db.raidRoleIcons.position == 'TOPLEFT' then
raidRoleFrameAnchor:Point('LEFT', frame, 'TOPLEFT', frame.db.raidRoleIcons.xOffset, frame.db.raidRoleIcons.yOffset)
else
raidRoleFrameAnchor:Point('RIGHT', frame, 'TOPRIGHT', -frame.db.raidRoleIcons.xOffset, frame.db.raidRoleIcons.yOffset)
end
elseif frame:IsElementEnabled('LeaderIndicator') then
raidRoleFrameAnchor:Hide()
frame:DisableElement('LeaderIndicator')
frame:DisableElement('AssistantIndicator')
end
end
function UF:RaidRoleUpdate()
local anchor = self:GetParent()
local frame = anchor:GetParent():GetParent()
local leader = frame.LeaderIndicator
local assistant = frame.AssistantIndicator
if not leader or not assistant then return; end
local db = frame.db
local isLeader = leader:IsShown()
local isAssist = assistant:IsShown()
leader:ClearAllPoints()
assistant:ClearAllPoints()
if db and db.raidRoleIcons then
if isLeader and db.raidRoleIcons.position == 'TOPLEFT' then
leader:Point('LEFT', anchor, 'LEFT', db.raidRoleIcons.xOffset, db.raidRoleIcons.yOffset)
elseif isLeader and db.raidRoleIcons.position == 'TOPRIGHT' then
leader:Point('RIGHT', anchor, 'RIGHT', -db.raidRoleIcons.xOffset, db.raidRoleIcons.yOffset)
elseif isAssist and db.raidRoleIcons.position == 'TOPLEFT' then
assistant:Point('LEFT', anchor, 'LEFT', db.raidRoleIcons.xOffset, db.raidRoleIcons.yOffset)
elseif isAssist and db.raidRoleIcons.position == 'TOPRIGHT' then
assistant:Point('RIGHT', anchor, 'RIGHT', -db.raidRoleIcons.xOffset, db.raidRoleIcons.yOffset)
end
end
end

View File

@@ -0,0 +1,180 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
local SpellRange = E.Libs.SpellRange
local pairs, ipairs = pairs, ipairs
local CheckInteractDistance = CheckInteractDistance
local UnitCanAttack = UnitCanAttack
local UnitInParty = UnitInParty
local UnitInRaid = UnitInRaid
local UnitInRange = UnitInRange
local UnitIsConnected = UnitIsConnected
local UnitIsDeadOrGhost = UnitIsDeadOrGhost
local UnitPhaseReason = UnitPhaseReason
local UnitIsPlayer = UnitIsPlayer
local UnitIsUnit = UnitIsUnit
local SR = {}
local function AddTable(tbl)
SR[E.myclass][tbl] = {}
end
local function AddSpell(tbl, spellID)
SR[E.myclass][tbl][#SR[E.myclass][tbl] + 1] = spellID
end
function UF:UpdateRangeCheckSpells()
if not SR[E.myclass] then SR[E.myclass] = {} end
for tbl, spells in pairs(E.global.unitframe.spellRangeCheck[E.myclass]) do
AddTable(tbl) --Create the table holding spells, even if it ends up being an empty table
for spellID in pairs(spells) do
local enabled = spells[spellID]
if enabled then --We will allow value to be false to disable this spell from being used
AddSpell(tbl, spellID, enabled)
end
end
end
end
local function getUnit(unit)
if not unit:find('party') or not unit:find('raid') then
for i=1, 4 do
if UnitIsUnit(unit, 'party'..i) then
return 'party'..i
end
end
for i=1, 40 do
if UnitIsUnit(unit, 'raid'..i) then
return 'raid'..i
end
end
else
return unit
end
end
local function friendlyIsInRange(unit)
if not UnitIsUnit(unit, 'player') and (UnitInParty(unit) or UnitInRaid(unit)) then
unit = getUnit(unit) -- swap the unit with `raid#` or `party#` when its NOT `player`, UnitIsUnit is true, and its not using `raid#` or `party#` already
end
if UnitIsPlayer(unit) and UnitPhaseReason(unit) then
return false -- is not in same phase
end
local inRange, checkedRange = UnitInRange(unit)
if checkedRange and not inRange then
return false -- blizz checked and said the unit is out of range
end
if CheckInteractDistance(unit, 1) then
return true -- within 28 yards (arg2 as 1 is Compare Achievements distance)
end
local object = SR[E.myclass]
if object then
if object.resSpells and (#object.resSpells > 0) and UnitIsDeadOrGhost(unit) then -- dead with rez spells
for _, spellID in ipairs(object.resSpells) do
if SpellRange.IsSpellInRange(spellID, unit) == 1 then
return true -- within rez range
end
end
return false -- dead but no spells are in range
end
if object.friendlySpells and (#object.friendlySpells > 0) then -- you have some healy spell
for _, spellID in ipairs(object.friendlySpells) do
if SpellRange.IsSpellInRange(spellID, unit) == 1 then
return true -- within healy spell range
end
end
end
end
return false -- not within 28 yards and no spells in range
end
local function petIsInRange(unit)
if CheckInteractDistance(unit, 2) then
return true -- within 8 yards (arg2 as 2 is Trade distance)
end
local object = SR[E.myclass]
if object then
if object.friendlySpells and (#object.friendlySpells > 0) then -- you have some healy spell
for _, spellID in ipairs(object.friendlySpells) do
if SpellRange.IsSpellInRange(spellID, unit) == 1 then
return true
end
end
end
if object.petSpells and (#object.petSpells > 0) then -- you have some pet spell
for _, spellID in ipairs(object.petSpells) do
if SpellRange.IsSpellInRange(spellID, unit) == 1 then
return true
end
end
end
end
return false -- not within 8 yards and no spells in range
end
local function enemyIsInRange(unit)
if CheckInteractDistance(unit, 2) then
return true -- within 8 yards (arg2 as 2 is Trade distance)
end
local object = SR[E.myclass]
if object and object.enemySpells and (#object.enemySpells > 0) then -- you have some damage spell
for _, spellID in ipairs(object.enemySpells) do
if SpellRange.IsSpellInRange(spellID, unit) == 1 then
return true
end
end
end
return false -- not within 8 yards and no spells in range
end
local function enemyIsInLongRange(unit)
local object = SR[E.myclass]
if object and object.longEnemySpells and (#object.longEnemySpells > 0) then -- you have some 30+ range damage spell
for _, spellID in ipairs(object.longEnemySpells) do
if SpellRange.IsSpellInRange(spellID, unit) == 1 then
return true
end
end
end
return false
end
function UF:UpdateRange(unit)
if not self.Fader then return end
local alpha
unit = unit or self.unit
if self.forceInRange or unit == 'player' then
alpha = self.Fader.MaxAlpha
elseif self.forceNotInRange then
alpha = self.Fader.MinAlpha
elseif unit then
if UnitCanAttack('player', unit) then
alpha = ((enemyIsInRange(unit) or enemyIsInLongRange(unit)) and self.Fader.MaxAlpha) or self.Fader.MinAlpha
elseif UnitIsUnit(unit, 'pet') then
alpha = (petIsInRange(unit) and self.Fader.MaxAlpha) or self.Fader.MinAlpha
else
alpha = (UnitIsConnected(unit) and friendlyIsInRange(unit) and self.Fader.MaxAlpha) or self.Fader.MinAlpha
end
else
alpha = self.Fader.MaxAlpha
end
self.Fader.RangeAlpha = alpha
end

View File

@@ -0,0 +1,28 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
function UF:Construct_ReadyCheckIcon(frame)
local tex = frame.RaisedElementParent.TextureParent:CreateTexture(nil, 'OVERLAY', nil, 7)
tex:Size(12)
tex:Point('BOTTOM', frame.Health, 'BOTTOM', 0, 2)
return tex
end
function UF:Configure_ReadyCheckIcon(frame)
local ReadyCheckIndicator = frame.ReadyCheckIndicator
local db = frame.db
if db.readycheckIcon.enable then
if not frame:IsElementEnabled('ReadyCheckIndicator') then
frame:EnableElement('ReadyCheckIndicator')
end
local attachPoint = self:GetObjectAnchorPoint(frame, db.readycheckIcon.attachTo)
ReadyCheckIndicator:ClearAllPoints()
ReadyCheckIndicator:Point(db.readycheckIcon.position, attachPoint, db.readycheckIcon.position, db.readycheckIcon.xOffset, db.readycheckIcon.yOffset)
ReadyCheckIndicator:Size(db.readycheckIcon.size)
else
frame:DisableElement('ReadyCheckIndicator')
end
end

View File

@@ -0,0 +1,82 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
local C_Timer_NewTimer = C_Timer.NewTimer
local IsResting = IsResting
local RestingTextures = {
DEFAULT = [[Interface\CharacterFrame\UI-StateIcon]],
RESTING = E.Media.Textures.Resting,
RESTING1 = E.Media.Textures.Resting1
}
function UF:Construct_RestingIndicator(frame)
return frame.RaisedElementParent.TextureParent:CreateTexture(nil, 'OVERLAY')
end
local TestingTimer
local TestingFrame
local function TestingFunc()
local isResting = IsResting()
if TestingFrame and not isResting then
TestingFrame:Hide()
end
end
function UF:TestingDisplay_RestingIndicator(frame)
local Icon = frame.RestingIndicator
local db = frame.db.RestIcon
if TestingTimer then
TestingTimer:Cancel()
end
if not db.enable then
Icon:Hide()
return
end
Icon:Show()
TestingFrame = Icon
TestingTimer = C_Timer_NewTimer(10, TestingFunc)
end
function UF:Configure_RestingIndicator(frame)
local Icon = frame.RestingIndicator
local db = frame.db.RestIcon
if db.enable then
if not frame:IsElementEnabled('RestingIndicator') then
frame:EnableElement('RestingIndicator')
end
if db.defaultColor then
Icon:SetVertexColor(1, 1, 1, 1)
Icon:SetDesaturated(false)
else
Icon:SetVertexColor(db.color.r, db.color.g, db.color.b, db.color.a)
Icon:SetDesaturated(true)
end
if db.texture == 'CUSTOM' and db.customTexture then
Icon:SetTexture(db.customTexture)
Icon:SetTexCoord(0, 1, 0, 1)
elseif db.texture ~= 'DEFAULT' and RestingTextures[db.texture] then
Icon:SetTexture(RestingTextures[db.texture])
Icon:SetTexCoord(0, 1, 0, 1)
else
Icon:SetTexture(RestingTextures.DEFAULT)
Icon:SetTexCoord(0, .5, 0, .421875)
end
Icon:Size(db.size)
Icon:ClearAllPoints()
if frame.ORIENTATION ~= 'RIGHT' and (frame.USE_PORTRAIT and not frame.USE_PORTRAIT_OVERLAY) then
Icon:Point('CENTER', frame.Portrait, db.anchorPoint, db.xOffset, db.yOffset)
else
Icon:Point('CENTER', frame.Health, db.anchorPoint, db.xOffset, db.yOffset)
end
elseif frame:IsElementEnabled('RestingIndicator') then
frame:DisableElement('RestingIndicator')
end
end

View File

@@ -0,0 +1,29 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
function UF:Construct_ResurrectionIcon(frame)
local tex = frame.RaisedElementParent.TextureParent:CreateTexture(nil, 'OVERLAY')
tex:Point('CENTER', frame.Health, 'CENTER')
tex:Size(30)
tex:SetDrawLayer('OVERLAY', 7)
return tex
end
function UF:Configure_ResurrectionIcon(frame)
local RI = frame.ResurrectIndicator
local db = frame.db
if db.resurrectIcon.enable then
frame:EnableElement('ResurrectIndicator')
RI:Show()
RI:Size(db.resurrectIcon.size)
local attachPoint = self:GetObjectAnchorPoint(frame, db.resurrectIcon.attachToObject)
RI:ClearAllPoints()
RI:Point(db.resurrectIcon.attachTo, attachPoint, db.resurrectIcon.attachTo, db.resurrectIcon.xOffset, db.resurrectIcon.yOffset)
else
frame:DisableElement('ResurrectIndicator')
RI:Hide()
end
end

View File

@@ -0,0 +1,80 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
local random = random
local UnitGroupRolesAssigned = UnitGroupRolesAssigned
local UnitIsConnected = UnitIsConnected
function UF:Construct_RoleIcon(frame)
local tex = frame.RaisedElementParent.TextureParent:CreateTexture(nil, 'ARTWORK')
tex:Size(17)
tex:Point('BOTTOM', frame.Health, 'BOTTOM', 0, 2)
tex.Override = UF.UpdateRoleIcon
frame:RegisterEvent('UNIT_CONNECTION', UF.UpdateRoleIcon)
return tex
end
UF.RoleIconTextures = {
TANK = E.Media.Textures.Tank,
HEALER = E.Media.Textures.Healer,
DAMAGER = E.Media.Textures.DPS
}
function UF:UpdateRoleIcon(event)
local lfdrole = self.GroupRoleIndicator
if not self.db then return; end
local db = self.db.roleIcon;
if not db or not db.enable then
lfdrole:Hide()
return
end
local role = UnitGroupRolesAssigned(self.unit)
if self.isForced and role == 'NONE' then
local rnd = random(1, 3)
role = rnd == 1 and 'TANK' or (rnd == 2 and 'HEALER' or (rnd == 3 and 'DAMAGER'))
end
local shouldHide = ((event == 'PLAYER_REGEN_DISABLED' and db.combatHide and true) or false)
if (self.isForced or UnitIsConnected(self.unit)) and ((role == 'DAMAGER' and db.damager) or (role == 'HEALER' and db.healer) or (role == 'TANK' and db.tank)) then
lfdrole:SetTexture(UF.RoleIconTextures[role])
if not shouldHide then
lfdrole:Show()
else
lfdrole:Hide()
end
else
lfdrole:Hide()
end
end
function UF:Configure_RoleIcon(frame)
local role = frame.GroupRoleIndicator
local db = frame.db
if db.roleIcon.enable then
frame:EnableElement('GroupRoleIndicator')
local attachPoint = self:GetObjectAnchorPoint(frame, db.roleIcon.attachTo)
role:ClearAllPoints()
role:Point(db.roleIcon.position, attachPoint, db.roleIcon.position, db.roleIcon.xOffset, db.roleIcon.yOffset)
role:Size(db.roleIcon.size)
if db.roleIcon.combatHide then
E:RegisterEventForObject('PLAYER_REGEN_ENABLED', frame, UF.UpdateRoleIcon)
E:RegisterEventForObject('PLAYER_REGEN_DISABLED', frame, UF.UpdateRoleIcon)
else
E:UnregisterEventForObject('PLAYER_REGEN_ENABLED', frame, UF.UpdateRoleIcon)
E:UnregisterEventForObject('PLAYER_REGEN_DISABLED', frame, UF.UpdateRoleIcon)
end
else
frame:DisableElement('GroupRoleIndicator')
role:Hide()
--Unregister combat hide events
E:UnregisterEventForObject('PLAYER_REGEN_ENABLED', frame, UF.UpdateRoleIcon)
E:UnregisterEventForObject('PLAYER_REGEN_DISABLED', frame, UF.UpdateRoleIcon)
end
end

View File

@@ -0,0 +1,29 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
function UF:Construct_SummonIcon(frame)
local tex = frame.RaisedElementParent.TextureParent:CreateTexture(nil, 'OVERLAY')
tex:Point('CENTER', frame.Health, 'CENTER')
tex:Size(30)
tex:SetDrawLayer('OVERLAY', 7)
return tex
end
function UF:Configure_SummonIcon(frame)
local SI = frame.SummonIndicator
local db = frame.db
if db.summonIcon.enable then
frame:EnableElement('SummonIndicator')
SI:Show()
SI:Size(db.summonIcon.size)
local attachPoint = self:GetObjectAnchorPoint(frame, db.summonIcon.attachToObject)
SI:ClearAllPoints()
SI:Point(db.summonIcon.attachTo, attachPoint, db.summonIcon.attachTo, db.summonIcon.xOffset, db.summonIcon.yOffset)
else
frame:DisableElement('SummonIndicator')
SI:Hide()
end
end

View File

@@ -0,0 +1,133 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
local unpack = unpack
local CreateFrame = CreateFrame
function UF:Construct_Threat(frame)
local threat = CreateFrame('Frame', nil, frame)
--Main ThreatGlow
threat.MainGlow = frame:CreateShadow(4, true)
threat.MainGlow:SetFrameStrata('BACKGROUND')
threat.MainGlow:SetParent(frame)
threat.MainGlow:Hide()
--Secondary ThreatGlow, for power frame when using power offset
threat.PowerGlow = frame:CreateShadow(4, true)
threat.PowerGlow:SetFrameStrata('BACKGROUND')
threat.PowerGlow:SetParent(frame)
threat.PowerGlow:Hide()
threat.TextureIcon = threat:CreateTexture(nil, 'OVERLAY')
threat.TextureIcon:Size(8)
threat.TextureIcon:SetTexture(E.media.blankTex)
threat.TextureIcon:Hide()
threat.PostUpdate = self.UpdateThreat
return threat
end
function UF:Configure_Threat(frame)
local threat = frame.ThreatIndicator
if not threat then return end
local threatStyle = frame.db and frame.db.threatStyle
if threatStyle and threatStyle ~= 'NONE' then
if not frame:IsElementEnabled('ThreatIndicator') then
frame:EnableElement('ThreatIndicator')
end
if threatStyle == 'GLOW' then
threat:SetFrameStrata('BACKGROUND')
threat.MainGlow:ClearAllPoints()
threat.MainGlow:SetAllPoints(frame.TargetGlow)
if frame.USE_POWERBAR_OFFSET then
threat.PowerGlow:ClearAllPoints()
threat.PowerGlow:SetAllPoints(frame.TargetGlow.powerGlow)
end
elseif threatStyle:match('^ICON') then
threat:SetFrameStrata('LOW')
threat:SetFrameLevel(75) --Inset power uses 50, we want it to appear above that
local point = threatStyle:gsub('ICON', '')
threat.TextureIcon:ClearAllPoints()
threat.TextureIcon:Point(point, frame.Health, point)
elseif threatStyle == 'HEALTHBORDER' and frame.InfoPanel then
frame.InfoPanel:SetFrameLevel(frame.Health:GetFrameLevel() - 3)
elseif threatStyle == 'INFOPANELBORDER' and frame.InfoPanel then
frame.InfoPanel:SetFrameLevel(frame.Health:GetFrameLevel() + 3)
end
elseif frame:IsElementEnabled('ThreatIndicator') then
frame:DisableElement('ThreatIndicator')
end
end
function UF:ThreatBorderColor(backdrop, lock, r, g, b)
backdrop.forcedBorderColors = lock and {r, g, b} or nil
backdrop:SetBackdropBorderColor(r, g, b)
end
do
local classPowers = {
MONK = 'Stagger',
DRUID = 'AdditionalPower',
PRIEST = 'AdditionalPower',
SHAMAN = 'AdditionalPower',
DEATHKNIGHT = 'Runes'
}
local myClassPower = classPowers[E.myclass]
function UF:ThreatClassBarBorderColor(parent, status, r, g, b)
local classPower = myClassPower and parent[myClassPower]
if classPower then UF:ThreatBorderColor(classPower.backdrop, status, r, g, b) end
if parent.ClassPower then UF:ThreatBorderColor(parent.ClassPower.backdrop, status, r, g, b) end
if parent.AlternativePower then UF:ThreatBorderColor(parent.AlternativePower.backdrop, status, r, g, b) end
end
end
function UF:ThreatHandler(threat, parent, threatStyle, status, r, g, b)
if threatStyle == 'GLOW' then
if status then
threat.MainGlow:Show()
threat.MainGlow:SetBackdropBorderColor(r, g, b)
if parent.USE_POWERBAR_OFFSET then
threat.PowerGlow:Show()
threat.PowerGlow:SetBackdropBorderColor(r, g, b)
end
else
threat.MainGlow:Hide()
threat.PowerGlow:Hide()
end
elseif threatStyle == 'BORDERS' then
if parent.InfoPanel then UF:ThreatBorderColor(parent.InfoPanel.backdrop, status, r, g, b) end
if parent.Power then UF:ThreatBorderColor(parent.Power.backdrop, status, r, g, b) end
UF:ThreatBorderColor(parent.Health.backdrop, status, r, g, b)
UF:ThreatClassBarBorderColor(parent, status, r, g, b)
elseif threatStyle == 'HEALTHBORDER' then
UF:ThreatBorderColor(parent.Health.backdrop, status, r, g, b)
elseif threatStyle == 'INFOPANELBORDER' then
if parent.InfoPanel then UF:ThreatBorderColor(parent.InfoPanel.backdrop, status, r, g, b) end
elseif threatStyle ~= 'NONE' and threat.TextureIcon then
if status then
threat.TextureIcon:Show()
threat.TextureIcon:SetVertexColor(r, g, b)
else
threat.TextureIcon:Hide()
end
end
end
function UF:UpdateThreat(unit, status, r, g, b)
local parent = self:GetParent()
local db = parent.db and parent.db.threatStyle
local badunit = not unit or parent.unit ~= unit
if not badunit and status and status > 1 then
UF:ThreatHandler(self, parent, db, status, r, g, b)
else
UF:ThreatHandler(self, parent, db, nil, unpack(E.media.unitframeBorderColor))
end
end

View File

@@ -0,0 +1,33 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
local CreateFrame = CreateFrame
function UF:Construct_Trinket(frame)
local trinket = CreateFrame('Frame', nil, frame)
trinket.bg = CreateFrame('Frame', nil, trinket, 'BackdropTemplate')
trinket.bg:SetTemplate(nil, nil, nil, nil, true)
trinket.bg:SetFrameLevel(trinket:GetFrameLevel() - 1)
trinket:SetInside(trinket.bg)
return trinket
end
function UF:Configure_Trinket(frame)
local db = frame.db
local trinket = frame.Trinket
trinket.bg:Size(db.pvpTrinket.size)
trinket.bg:ClearAllPoints()
if db.pvpTrinket.position == 'RIGHT' then
trinket.bg:Point('LEFT', frame, 'RIGHT', db.pvpTrinket.xOffset, db.pvpTrinket.yOffset)
else
trinket.bg:Point('RIGHT', frame, 'LEFT', db.pvpTrinket.xOffset, db.pvpTrinket.yOffset)
end
if db.pvpTrinket.enable and not frame:IsElementEnabled('Trinket') then
frame:EnableElement('Trinket')
elseif not db.pvpTrinket.enable and frame:IsElementEnabled('Trinket') then
frame:DisableElement('Trinket')
end
end

View File

@@ -0,0 +1,208 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames')
local _, ns = ...
local ElvUF = ns.oUF
assert(ElvUF, 'ElvUI was unable to locate oUF.')
local _G = _G
local unpack = unpack
local CreateFrame = CreateFrame
local IsAddOnLoaded = IsAddOnLoaded
local GetSpecializationInfoByID = GetSpecializationInfoByID
local LOCALIZED_CLASS_NAMES_MALE = LOCALIZED_CLASS_NAMES_MALE
local ArenaHeader = CreateFrame('Frame', 'ArenaHeader', E.UIParent)
function UF:ToggleArenaPreparationInfo(frame, show, specName, specTexture, specClass)
if not (frame and frame.ArenaPrepSpec and frame.ArenaPrepIcon) then return end
local specIcon = (frame.db and frame.db.pvpSpecIcon) and frame:IsElementEnabled('PVPSpecIcon')
frame.forceInRange = show -- used to force unitframe range
if show then -- during `PostUpdateArenaPreparation` this means spec class and name exist
frame.ArenaPrepSpec:SetText(specName..' - '..LOCALIZED_CLASS_NAMES_MALE[specClass])
frame.Health.value:Hide()
if specIcon then
frame.ArenaPrepIcon:SetTexture(specTexture or [[INTERFACE\ICONS\INV_MISC_QUESTIONMARK]])
frame.ArenaPrepIcon.bg:Show()
frame.ArenaPrepIcon:Show()
frame.PVPSpecIcon:Hide()
end
else -- mainly called from `PostUpdateArenaFrame` to hide them
frame.ArenaPrepSpec:SetText('')
frame.Health.value:Show()
if specIcon then
frame.ArenaPrepIcon.bg:Hide()
frame.ArenaPrepIcon:Hide()
frame.PVPSpecIcon:Show()
end
end
end
function UF:PostUpdateArenaFrame(event)
if self and event and (event ~= 'ARENA_PREP_OPPONENT_SPECIALIZATIONS' and event ~= 'PLAYER_ENTERING_WORLD') then
UF:ToggleArenaPreparationInfo(self)
end
end
function UF:PostUpdateArenaPreparation(_, specID)
local _, specName, specTexture, specClass
if specID and specID > 0 then
_, specName, _, specTexture, _, specClass = GetSpecializationInfoByID(specID)
end
UF:ToggleArenaPreparationInfo(self and self.__owner, specClass and specName, specName, specTexture, specClass)
end
function UF:Construct_ArenaFrames(frame)
frame.RaisedElementParent = CreateFrame('Frame', nil, frame)
frame.RaisedElementParent.TextureParent = CreateFrame('Frame', nil, frame.RaisedElementParent)
frame.RaisedElementParent:SetFrameLevel(frame:GetFrameLevel() + 100)
frame.Health = UF:Construct_HealthBar(frame, true, true, 'RIGHT')
frame.Name = UF:Construct_NameText(frame)
if not frame.isChild then
frame.Power = UF:Construct_PowerBar(frame, true, true, 'LEFT')
frame.PowerPrediction = UF:Construct_PowerPrediction(frame)
frame.Portrait3D = UF:Construct_Portrait(frame, 'model')
frame.Portrait2D = UF:Construct_Portrait(frame, 'texture')
frame.Buffs = UF:Construct_Buffs(frame)
frame.Debuffs = UF:Construct_Debuffs(frame)
frame.Castbar = UF:Construct_Castbar(frame)
frame.HealthPrediction = UF:Construct_HealComm(frame)
frame.MouseGlow = UF:Construct_MouseGlow(frame)
frame.TargetGlow = UF:Construct_TargetGlow(frame)
frame.FocusGlow = UF:Construct_FocusGlow(frame)
frame.Trinket = UF:Construct_Trinket(frame)
frame.PVPSpecIcon = UF:Construct_PVPSpecIcon(frame)
frame.PvPClassificationIndicator = UF:Construct_PvPClassificationIndicator(frame) -- Cart / Flag / Orb / Assassin Bounty
frame.Fader = UF:Construct_Fader()
frame:SetAttribute('type2', 'focus')
frame.customTexts = {}
frame.InfoPanel = UF:Construct_InfoPanel(frame)
frame.unitframeType = 'arena'
-- Arena Preparation
frame.ArenaPrepIcon = frame:CreateTexture(nil, 'OVERLAY')
frame.ArenaPrepIcon.bg = CreateFrame('Frame', nil, frame, 'BackdropTemplate')
frame.ArenaPrepIcon.bg:SetAllPoints(frame.PVPSpecIcon.bg)
frame.ArenaPrepIcon.bg:SetTemplate()
frame.ArenaPrepIcon:SetParent(frame.ArenaPrepIcon.bg)
frame.ArenaPrepIcon:SetTexCoord(unpack(E.TexCoords))
frame.ArenaPrepIcon:SetInside(frame.ArenaPrepIcon.bg)
frame.ArenaPrepIcon.bg:Hide()
frame.ArenaPrepIcon:Hide()
frame.ArenaPrepSpec = frame.Health:CreateFontString(nil, 'OVERLAY')
frame.ArenaPrepSpec:Point('CENTER')
UF:Configure_FontString(frame.ArenaPrepSpec)
frame.Health.PostUpdateArenaPreparation = self.PostUpdateArenaPreparation -- used to update arena prep info
frame.PostUpdate = self.PostUpdateArenaFrame -- used to hide arena prep info
end
frame.Cutaway = UF:Construct_Cutaway(frame)
ArenaHeader:Point('BOTTOMRIGHT', E.UIParent, 'RIGHT', -105, -165)
E:CreateMover(ArenaHeader, ArenaHeader:GetName()..'Mover', L["Arena Frames"], nil, nil, nil, 'ALL,ARENA', nil, 'unitframe,groupUnits,arena,generalGroup')
frame.mover = ArenaHeader.mover
end
function UF:Update_ArenaFrames(frame, db)
frame.db = db
do
frame.ORIENTATION = db.orientation --allow this value to change when unitframes position changes on screen?
frame.UNIT_WIDTH = db.width
frame.UNIT_HEIGHT = db.infoPanel.enable and (db.height + db.infoPanel.height) or db.height
frame.USE_POWERBAR = db.power.enable
frame.POWERBAR_DETACHED = db.power.detachFromFrame
frame.USE_INSET_POWERBAR = not frame.POWERBAR_DETACHED and db.power.width == 'inset' and frame.USE_POWERBAR
frame.USE_MINI_POWERBAR = (not frame.POWERBAR_DETACHED and db.power.width == 'spaced' and frame.USE_POWERBAR)
frame.USE_POWERBAR_OFFSET = (db.power.width == 'offset' and db.power.offset ~= 0) and frame.USE_POWERBAR and not frame.POWERBAR_DETACHED
frame.POWERBAR_OFFSET = frame.USE_POWERBAR_OFFSET and db.power.offset or 0
frame.POWERBAR_HEIGHT = not frame.USE_POWERBAR and 0 or db.power.height
frame.POWERBAR_WIDTH = frame.USE_MINI_POWERBAR and (frame.UNIT_WIDTH - (UF.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((UF.BORDER+UF.SPACING)*2)))
frame.USE_PORTRAIT = db.portrait and db.portrait.enable
frame.USE_PORTRAIT_OVERLAY = frame.USE_PORTRAIT
frame.PORTRAIT_WIDTH = (frame.USE_PORTRAIT_OVERLAY or not frame.USE_PORTRAIT) and 0 or db.portrait.width
frame.CLASSBAR_YOFFSET = 0
frame.USE_INFO_PANEL = not frame.USE_MINI_POWERBAR and not frame.USE_POWERBAR_OFFSET and db.infoPanel.enable
frame.INFO_PANEL_HEIGHT = frame.USE_INFO_PANEL and db.infoPanel.height or 0
frame.BOTTOM_OFFSET = UF:GetHealthBottomOffset(frame)
frame.PVPINFO_WIDTH = db.pvpSpecIcon and frame.UNIT_HEIGHT or 0
end
if not IsAddOnLoaded('Clique') then
if db.middleClickFocus then
frame:SetAttribute('type3', 'focus')
elseif frame:GetAttribute('type3') == 'focus' then
frame:SetAttribute('type3', nil)
end
end
frame.colors = ElvUF.colors
frame:RegisterForClicks(self.db.targetOnMouseDown and 'AnyDown' or 'AnyUp')
frame:Size(frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
UF:Configure_InfoPanel(frame)
UF:Configure_HealthBar(frame)
UF:UpdateNameSettings(frame)
UF:Configure_Power(frame)
UF:Configure_PowerPrediction(frame)
UF:Configure_Portrait(frame)
UF:EnableDisable_Auras(frame)
UF:Configure_AllAuras(frame)
UF:Configure_Castbar(frame)
UF:Configure_PVPSpecIcon(frame)
UF:Configure_Trinket(frame)
UF:Configure_Fader(frame)
UF:Configure_HealComm(frame)
UF:Configure_Cutaway(frame)
UF:Configure_CustomTexts(frame)
UF:Configure_PvPClassificationIndicator(frame)
frame:ClearAllPoints()
if frame.index == 1 then
local ArenaHeaderMover = _G.ArenaHeaderMover
if db.growthDirection == 'UP' then
frame:Point('BOTTOMRIGHT', ArenaHeaderMover, 'BOTTOMRIGHT')
elseif db.growthDirection == 'RIGHT' then
frame:Point('LEFT', ArenaHeaderMover, 'LEFT')
elseif db.growthDirection == 'LEFT' then
frame:Point('RIGHT', ArenaHeaderMover, 'RIGHT')
else --Down
frame:Point('TOPRIGHT', ArenaHeaderMover, 'TOPRIGHT')
end
else
if db.growthDirection == 'UP' then
frame:Point('BOTTOMRIGHT', _G['ElvUF_Arena'..frame.index-1], 'TOPRIGHT', 0, db.spacing)
elseif db.growthDirection == 'RIGHT' then
frame:Point('LEFT', _G['ElvUF_Arena'..frame.index-1], 'RIGHT', db.spacing, 0)
elseif db.growthDirection == 'LEFT' then
frame:Point('RIGHT', _G['ElvUF_Arena'..frame.index-1], 'LEFT', -db.spacing, 0)
else --Down
frame:Point('TOPRIGHT', _G['ElvUF_Arena'..frame.index-1], 'BOTTOMRIGHT', 0, -db.spacing)
end
end
if db.growthDirection == 'UP' or db.growthDirection == 'DOWN' then
ArenaHeader:Width(frame.UNIT_WIDTH)
ArenaHeader:Height(frame.UNIT_HEIGHT + ((frame.UNIT_HEIGHT + db.spacing) * 4))
elseif db.growthDirection == 'LEFT' or db.growthDirection == 'RIGHT' then
ArenaHeader:Width(frame.UNIT_WIDTH + ((frame.UNIT_WIDTH + db.spacing) * 4))
ArenaHeader:Height(frame.UNIT_HEIGHT)
end
frame:UpdateAllElements('ElvUI_UpdateAllElements')
end
UF.unitgroupstoload.arena = {5, 'ELVUI_UNITTARGET'}

View File

@@ -0,0 +1,150 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames')
local _, ns = ...
local ElvUF = ns.oUF
assert(ElvUF, 'ElvUI was unable to locate oUF.')
local _G = _G
local max = max
local CreateFrame = CreateFrame
local IsAddOnLoaded = IsAddOnLoaded
local InCombatLockdown = InCombatLockdown
local RegisterAttributeDriver = RegisterAttributeDriver
function UF:Construct_AssistFrames()
self:SetScript('OnEnter', _G.UnitFrame_OnEnter)
self:SetScript('OnLeave', _G.UnitFrame_OnLeave)
self.RaisedElementParent = CreateFrame('Frame', nil, self)
self.RaisedElementParent.TextureParent = CreateFrame('Frame', nil, self.RaisedElementParent)
self.RaisedElementParent:SetFrameLevel(self:GetFrameLevel() + 100)
self.Health = UF:Construct_HealthBar(self, true)
self.Name = UF:Construct_NameText(self)
self.ThreatIndicator = UF:Construct_Threat(self)
self.RaidTargetIndicator = UF:Construct_RaidIcon(self)
self.MouseGlow = UF:Construct_MouseGlow(self)
self.TargetGlow = UF:Construct_TargetGlow(self)
self.FocusGlow = UF:Construct_FocusGlow(self)
self.Fader = UF:Construct_Fader()
self.Cutaway = UF:Construct_Cutaway(self)
if not self.isChild then
self.Buffs = UF:Construct_Buffs(self)
self.Debuffs = UF:Construct_Debuffs(self)
self.AuraWatch = UF:Construct_AuraWatch(self)
self.RaidDebuffs = UF:Construct_RaidDebuffs(self)
self.AuraHighlight = UF:Construct_AuraHighlight(self)
self.unitframeType = 'assist'
else
self.unitframeType = 'assisttarget'
end
self.originalParent = self:GetParent()
return self
end
function UF:Update_AssistHeader(header, db)
header:Hide()
header.db = db
UF:ClearChildPoints(header:GetChildren())
if not header.isForced and db.enable then
RegisterAttributeDriver(header, 'state-visibility', '[@raid1,exists] show;hide')
end
header:SetAttribute('point', 'BOTTOM')
header:SetAttribute('columnAnchorPoint', 'LEFT')
header:SetAttribute('yOffset', db.verticalSpacing)
if not header.positioned then
header:ClearAllPoints()
header:Point('TOPLEFT', E.UIParent, 'TOPLEFT', 4, -248)
local width, height = header:GetSize()
local minHeight = max(height, 2 * db.height + db.verticalSpacing)
header:SetAttribute('minHeight', minHeight)
header:SetAttribute('minWidth', width)
E:CreateMover(header, header:GetName()..'Mover', L["MA Frames"], nil, nil, nil, 'ALL,RAID', nil, 'unitframe,groupUnits,assist,generalGroup')
header.mover:SetSize(width, minHeight)
header.positioned = true
end
end
function UF:Update_AssistFrames(frame, db)
frame.db = db
frame.colors = ElvUF.colors
frame:RegisterForClicks(UF.db.targetOnMouseDown and 'AnyDown' or 'AnyUp')
do
frame.ORIENTATION = db.orientation --allow this value to change when unitframes position changes on screen?
frame.SHADOW_SPACING = 3
frame.UNIT_WIDTH = db.width
frame.UNIT_HEIGHT = db.height
frame.USE_POWERBAR = false
frame.POWERBAR_DETACHED = false
frame.USE_INSET_POWERBAR = false
frame.USE_MINI_POWERBAR = false
frame.USE_POWERBAR_OFFSET = false
frame.POWERBAR_OFFSET = 0
frame.POWERBAR_HEIGHT = 0
frame.POWERBAR_WIDTH = 0
frame.USE_PORTRAIT = false
frame.USE_PORTRAIT_OVERLAY = false
frame.PORTRAIT_WIDTH = 0
frame.CLASSBAR_YOFFSET = 0
frame.BOTTOM_OFFSET = 0
end
if frame.isChild then
local childDB = db.targetsGroup
frame.db = db.targetsGroup
frame:Size(childDB.width, childDB.height)
if not InCombatLockdown() then
if childDB.enable then
frame:Enable()
frame:ClearAllPoints()
frame:Point(E.InversePoints[childDB.anchorPoint], frame.originalParent, childDB.anchorPoint, childDB.xOffset, childDB.yOffset)
else
frame:Disable()
end
end
else
frame:Size(frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
end
UF:Configure_HealthBar(frame)
UF:Configure_Threat(frame)
UF:UpdateNameSettings(frame)
UF:Configure_Fader(frame)
UF:Configure_RaidIcon(frame)
UF:Configure_Cutaway(frame)
if not frame.isChild then
if not IsAddOnLoaded('Clique') then
if db.middleClickFocus then
frame:SetAttribute('type3', 'focus')
elseif frame:GetAttribute('type3') == 'focus' then
frame:SetAttribute('type3', nil)
end
end
UF:EnableDisable_Auras(frame)
UF:Configure_AllAuras(frame)
UF:Configure_RaidDebuffs(frame)
UF:Configure_AuraHighlight(frame)
UF:Configure_AuraWatch(frame)
end
frame:UpdateAllElements('ElvUI_UpdateAllElements')
end
UF.headerstoload.assist = {'MAINASSIST', 'ELVUI_UNITTARGET'}

View File

@@ -0,0 +1,131 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames')
local _, ns = ...
local ElvUF = ns.oUF
assert(ElvUF, 'ElvUI was unable to locate oUF.')
local _G = _G
local CreateFrame = CreateFrame
local IsAddOnLoaded = IsAddOnLoaded
local MAX_BOSS_FRAMES = MAX_BOSS_FRAMES
-- GLOBALS: BossHeaderMover
local BossHeader = CreateFrame('Frame', 'BossHeader', E.UIParent)
function UF:Construct_BossFrames(frame)
frame.RaisedElementParent = CreateFrame('Frame', nil, frame)
frame.RaisedElementParent.TextureParent = CreateFrame('Frame', nil, frame.RaisedElementParent)
frame.RaisedElementParent:SetFrameLevel(frame:GetFrameLevel() + 100)
frame.Health = UF:Construct_HealthBar(frame, true, true, 'RIGHT')
frame.Power = UF:Construct_PowerBar(frame, true, true, 'LEFT')
frame.Power.displayAltPower = true
frame.PowerPrediction = UF:Construct_PowerPrediction(frame)
frame.Name = UF:Construct_NameText(frame)
frame.Portrait3D = UF:Construct_Portrait(frame, 'model')
frame.Portrait2D = UF:Construct_Portrait(frame, 'texture')
frame.InfoPanel = UF:Construct_InfoPanel(frame)
frame.Buffs = UF:Construct_Buffs(frame)
frame.Debuffs = UF:Construct_Debuffs(frame)
frame.AuraHighlight = UF:Construct_AuraHighlight(frame)
frame.Castbar = UF:Construct_Castbar(frame)
frame.RaidTargetIndicator = UF:Construct_RaidIcon(frame)
frame.Fader = UF:Construct_Fader()
frame.Cutaway = UF:Construct_Cutaway(frame)
frame.MouseGlow = UF:Construct_MouseGlow(frame)
frame.TargetGlow = UF:Construct_TargetGlow(frame)
frame.FocusGlow = UF:Construct_FocusGlow(frame)
frame:SetAttribute('type2', 'focus')
frame.customTexts = {}
BossHeader:Point('BOTTOMRIGHT', E.UIParent, 'RIGHT', -105, -165)
E:CreateMover(BossHeader, BossHeader:GetName()..'Mover', L["Boss Frames"], nil, nil, nil, 'ALL,PARTY,RAID', nil, 'unitframe,groupUnits,boss,generalGroup')
frame.mover = BossHeader.mover
frame.unitframeType = 'boss'
end
function UF:Update_BossFrames(frame, db)
frame.db = db
do
frame.ORIENTATION = db.orientation --allow this value to change when unitframes position changes on screen?
frame.UNIT_WIDTH = db.width
frame.UNIT_HEIGHT = db.infoPanel.enable and (db.height + db.infoPanel.height) or db.height
frame.USE_POWERBAR = db.power.enable
frame.POWERBAR_DETACHED = db.power.detachFromFrame
frame.USE_INSET_POWERBAR = not frame.POWERBAR_DETACHED and db.power.width == 'inset' and frame.USE_POWERBAR
frame.USE_MINI_POWERBAR = (not frame.POWERBAR_DETACHED and db.power.width == 'spaced' and frame.USE_POWERBAR)
frame.USE_POWERBAR_OFFSET = (db.power.width == 'offset' and db.power.offset ~= 0) and frame.USE_POWERBAR and not frame.POWERBAR_DETACHED
frame.POWERBAR_OFFSET = frame.USE_POWERBAR_OFFSET and db.power.offset or 0
frame.POWERBAR_HEIGHT = not frame.USE_POWERBAR and 0 or db.power.height
frame.POWERBAR_WIDTH = frame.USE_MINI_POWERBAR and (frame.UNIT_WIDTH - (UF.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((UF.BORDER+UF.SPACING)*2)))
frame.USE_PORTRAIT = db.portrait and db.portrait.enable
frame.USE_PORTRAIT_OVERLAY = frame.USE_PORTRAIT and (db.portrait.overlay or frame.ORIENTATION == 'MIDDLE')
frame.PORTRAIT_WIDTH = (frame.USE_PORTRAIT_OVERLAY or not frame.USE_PORTRAIT) and 0 or db.portrait.width
frame.USE_INFO_PANEL = not frame.USE_MINI_POWERBAR and not frame.USE_POWERBAR_OFFSET and db.infoPanel.enable
frame.INFO_PANEL_HEIGHT = frame.USE_INFO_PANEL and db.infoPanel.height or 0
frame.BOTTOM_OFFSET = UF:GetHealthBottomOffset(frame)
end
if not IsAddOnLoaded('Clique') then
if db.middleClickFocus then
frame:SetAttribute('type3', 'focus')
elseif frame:GetAttribute('type3') == 'focus' then
frame:SetAttribute('type3', nil)
end
end
frame.colors = ElvUF.colors
frame:RegisterForClicks(self.db.targetOnMouseDown and 'AnyDown' or 'AnyUp')
frame:Size(frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
UF:Configure_InfoPanel(frame)
UF:Configure_HealthBar(frame)
UF:UpdateNameSettings(frame)
UF:Configure_Power(frame)
UF:Configure_PowerPrediction(frame)
UF:Configure_Portrait(frame)
UF:EnableDisable_Auras(frame)
UF:Configure_AllAuras(frame)
UF:Configure_Castbar(frame)
UF:Configure_RaidIcon(frame)
UF:Configure_AuraHighlight(frame)
UF:Configure_CustomTexts(frame)
UF:Configure_Fader(frame)
UF:Configure_Cutaway(frame)
frame:ClearAllPoints()
if frame.index == 1 then
if db.growthDirection == 'UP' then
frame:Point('BOTTOMRIGHT', BossHeaderMover, 'BOTTOMRIGHT')
elseif db.growthDirection == 'RIGHT' then
frame:Point('LEFT', BossHeaderMover, 'LEFT')
elseif db.growthDirection == 'LEFT' then
frame:Point('RIGHT', BossHeaderMover, 'RIGHT')
else --Down
frame:Point('TOPRIGHT', BossHeaderMover, 'TOPRIGHT')
end
else
if db.growthDirection == 'UP' then
frame:Point('BOTTOMRIGHT', _G['ElvUF_Boss'..frame.index-1], 'TOPRIGHT', 0, db.spacing)
elseif db.growthDirection == 'RIGHT' then
frame:Point('LEFT', _G['ElvUF_Boss'..frame.index-1], 'RIGHT', db.spacing, 0)
elseif db.growthDirection == 'LEFT' then
frame:Point('RIGHT', _G['ElvUF_Boss'..frame.index-1], 'LEFT', -db.spacing, 0)
else --Down
frame:Point('TOPRIGHT', _G['ElvUF_Boss'..frame.index-1], 'BOTTOMRIGHT', 0, -db.spacing)
end
end
if db.growthDirection == 'UP' or db.growthDirection == 'DOWN' then
BossHeader:Width(frame.UNIT_WIDTH)
BossHeader:Height(frame.UNIT_HEIGHT + ((frame.UNIT_HEIGHT + db.spacing) * (MAX_BOSS_FRAMES -1)))
elseif db.growthDirection == 'LEFT' or db.growthDirection == 'RIGHT' then
BossHeader:Width(frame.UNIT_WIDTH + ((frame.UNIT_WIDTH + db.spacing) * (MAX_BOSS_FRAMES -1)))
BossHeader:Height(frame.UNIT_HEIGHT)
end
frame:UpdateAllElements('ElvUI_UpdateAllElements')
end
UF.unitgroupstoload.boss = {MAX_BOSS_FRAMES}

View File

@@ -0,0 +1,10 @@
<Ui xmlns='http://www.blizzard.com/wow/ui/'>
<Script file='Party.lua'/>
<Script file='Raid.lua'/>
<Script file='Raid40.lua'/>
<Script file='Arena.lua'/>
<Script file='Boss.lua'/>
<Script file='Tank.lua'/>
<Script file='Assist.lua'/>
<Script file='RaidPets.lua'/>
</Ui>

View File

@@ -0,0 +1,202 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames')
local _, ns = ...
local ElvUF = ns.oUF
assert(ElvUF, 'ElvUI was unable to locate oUF.')
local _G = _G
local CreateFrame = CreateFrame
local InCombatLockdown = InCombatLockdown
function UF:Construct_PartyFrames()
self:SetScript('OnEnter', _G.UnitFrame_OnEnter)
self:SetScript('OnLeave', _G.UnitFrame_OnLeave)
self.RaisedElementParent = CreateFrame('Frame', nil, self)
self.RaisedElementParent.TextureParent = CreateFrame('Frame', nil, self.RaisedElementParent)
self.RaisedElementParent:SetFrameLevel(self:GetFrameLevel() + 100)
self.BORDER = UF.BORDER
self.SPACING = UF.SPACING
self.SHADOW_SPACING = 3
if self.isChild then
self.Health = UF:Construct_HealthBar(self, true)
self.MouseGlow = UF:Construct_MouseGlow(self)
self.TargetGlow = UF:Construct_TargetGlow(self)
self.FocusGlow = UF:Construct_FocusGlow(self)
self.Name = UF:Construct_NameText(self)
self.RaidTargetIndicator = UF:Construct_RaidIcon(self)
self.AuraHighlight = UF:Construct_AuraHighlight(self)
self.originalParent = self:GetParent()
self.childType = 'pet'
if self == _G[self.originalParent:GetName()..'Target'] then
self.childType = 'target'
end
if self.childType == 'pet' then
self.AuraWatch = UF:Construct_AuraWatch(self)
end
self.unitframeType = 'party'..self.childType
else
self.Health = UF:Construct_HealthBar(self, true, true, 'RIGHT')
self.Power = UF:Construct_PowerBar(self, true, true, 'LEFT')
self.PowerPrediction = UF:Construct_PowerPrediction(self)
self.Portrait3D = UF:Construct_Portrait(self, 'model')
self.Portrait2D = UF:Construct_Portrait(self, 'texture')
self.InfoPanel = UF:Construct_InfoPanel(self)
self.Name = UF:Construct_NameText(self)
self.Buffs = UF:Construct_Buffs(self)
self.Debuffs = UF:Construct_Debuffs(self)
self.AuraWatch = UF:Construct_AuraWatch(self)
self.RaidDebuffs = UF:Construct_RaidDebuffs(self)
self.AuraHighlight = UF:Construct_AuraHighlight(self)
self.ResurrectIndicator = UF:Construct_ResurrectionIcon(self)
self.SummonIndicator = UF:Construct_SummonIcon(self)
self.GroupRoleIndicator = UF:Construct_RoleIcon(self)
self.RaidRoleFramesAnchor = UF:Construct_RaidRoleFrames(self)
self.MouseGlow = UF:Construct_MouseGlow(self)
self.PhaseIndicator = UF:Construct_PhaseIcon(self)
self.TargetGlow = UF:Construct_TargetGlow(self)
self.FocusGlow = UF:Construct_FocusGlow(self)
self.ThreatIndicator = UF:Construct_Threat(self)
self.RaidTargetIndicator = UF:Construct_RaidIcon(self)
self.ReadyCheckIndicator = UF:Construct_ReadyCheckIcon(self)
self.HealthPrediction = UF:Construct_HealComm(self)
self.AlternativePower = UF:Construct_AltPowerBar(self)
self.ClassBar = 'AlternativePower'
self.customTexts = {}
self.Sparkle = CreateFrame('Frame', nil, self)
self.Sparkle:SetAllPoints(self.Health)
self.Castbar = UF:Construct_Castbar(self)
self.unitframeType = 'party'
end
self.Fader = UF:Construct_Fader()
self.Cutaway = UF:Construct_Cutaway(self)
return self
end
function UF:Update_PartyHeader(header, db)
local parent = header:GetParent()
parent.db = db
if not parent.positioned then
parent:ClearAllPoints()
parent:Point('BOTTOMLEFT', E.UIParent, 'BOTTOMLEFT', 4, 248)
E:CreateMover(parent, parent:GetName()..'Mover', L["Party Frames"], nil, nil, nil, 'ALL,PARTY,ARENA', nil, 'unitframe,groupUnits,party,generalGroup')
parent.positioned = true
end
end
function UF:Update_PartyFrames(frame, db)
frame.db = db
frame.colors = ElvUF.colors
frame:RegisterForClicks(UF.db.targetOnMouseDown and 'AnyDown' or 'AnyUp')
do
frame.ORIENTATION = db.orientation --allow this value to change when unitframes position changes on screen?
frame.UNIT_WIDTH = db.width
frame.UNIT_HEIGHT = db.infoPanel.enable and (db.height + db.infoPanel.height) or db.height
frame.USE_POWERBAR = db.power.enable
frame.POWERBAR_DETACHED = false
frame.USE_INSET_POWERBAR = not frame.POWERBAR_DETACHED and db.power.width == 'inset' and frame.USE_POWERBAR
frame.USE_MINI_POWERBAR = (not frame.POWERBAR_DETACHED and db.power.width == 'spaced' and frame.USE_POWERBAR)
frame.USE_POWERBAR_OFFSET = (db.power.width == 'offset' and db.power.offset ~= 0) and frame.USE_POWERBAR and not frame.POWERBAR_DETACHED
frame.POWERBAR_OFFSET = frame.USE_POWERBAR_OFFSET and db.power.offset or 0
frame.POWERBAR_HEIGHT = not frame.USE_POWERBAR and 0 or db.power.height
frame.POWERBAR_WIDTH = frame.USE_MINI_POWERBAR and (frame.UNIT_WIDTH - (UF.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((UF.BORDER+UF.SPACING)*2)))
frame.USE_PORTRAIT = db.portrait and db.portrait.enable
frame.USE_PORTRAIT_OVERLAY = frame.USE_PORTRAIT and (db.portrait.overlay or frame.ORIENTATION == 'MIDDLE')
frame.PORTRAIT_WIDTH = (frame.USE_PORTRAIT_OVERLAY or not frame.USE_PORTRAIT) and 0 or db.portrait.width
frame.CAN_HAVE_CLASSBAR = not frame.isChild
frame.MAX_CLASS_BAR = 1
frame.USE_CLASSBAR = db.classbar.enable and frame.CAN_HAVE_CLASSBAR
frame.CLASSBAR_SHOWN = frame.CAN_HAVE_CLASSBAR and frame[frame.ClassBar] and frame[frame.ClassBar]:IsShown()
frame.CLASSBAR_DETACHED = false
frame.USE_MINI_CLASSBAR = db.classbar.fill == 'spaced' and frame.USE_CLASSBAR
frame.CLASSBAR_HEIGHT = frame.USE_CLASSBAR and db.classbar.height or 0
frame.CLASSBAR_WIDTH = frame.UNIT_WIDTH - frame.PORTRAIT_WIDTH - (frame.ORIENTATION == 'MIDDLE' and (frame.POWERBAR_OFFSET*2) or frame.POWERBAR_OFFSET)
frame.CLASSBAR_YOFFSET = (not frame.USE_CLASSBAR or not frame.CLASSBAR_SHOWN or frame.CLASSBAR_DETACHED) and 0 or (frame.USE_MINI_CLASSBAR and (UF.SPACING+(frame.CLASSBAR_HEIGHT/2)) or (frame.CLASSBAR_HEIGHT - (UF.BORDER-UF.SPACING)))
frame.USE_INFO_PANEL = not frame.USE_MINI_POWERBAR and not frame.USE_POWERBAR_OFFSET and db.infoPanel.enable
frame.INFO_PANEL_HEIGHT = frame.USE_INFO_PANEL and db.infoPanel.height or 0
frame.BOTTOM_OFFSET = UF:GetHealthBottomOffset(frame)
end
if frame.isChild then
frame.USE_PORTAIT = false
frame.USE_PORTRAIT_OVERLAY = false
frame.PORTRAIT_WIDTH = 0
frame.USE_POWERBAR = false
frame.USE_INSET_POWERBAR = false
frame.USE_MINI_POWERBAR = false
frame.USE_POWERBAR_OFFSET = false
frame.POWERBAR_OFFSET = 0
frame.POWERBAR_HEIGHT = 0
frame.POWERBAR_WIDTH = 0
frame.BOTTOM_OFFSET = 0
frame.db = frame.childType == 'target' and db.targetsGroup or db.petsGroup
db = frame.db
frame:Size(db.width, db.height)
if not InCombatLockdown() then
if db.enable then
frame:Enable()
frame:ClearAllPoints()
frame:Point(E.InversePoints[db.anchorPoint], frame.originalParent, db.anchorPoint, db.xOffset, db.yOffset)
else
frame:Disable()
end
end
if frame.childType == 'pet' then
frame.Health.colorPetByUnitClass = db.colorPetByUnitClass
UF:Configure_AuraWatch(frame)
end
UF:Configure_HealthBar(frame)
else
frame:Size(frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
UF:EnableDisable_Auras(frame)
UF:Configure_AllAuras(frame)
UF:Configure_HealthBar(frame)
UF:Configure_InfoPanel(frame)
UF:Configure_PhaseIcon(frame)
UF:Configure_Power(frame)
UF:Configure_Portrait(frame)
UF:Configure_Threat(frame)
UF:Configure_RaidDebuffs(frame)
UF:Configure_Castbar(frame)
UF:Configure_ResurrectionIcon(frame)
UF:Configure_SummonIcon(frame)
UF:Configure_RoleIcon(frame)
UF:Configure_HealComm(frame)
UF:Configure_RaidRoleIcons(frame)
UF:Configure_AuraWatch(frame)
UF:Configure_ReadyCheckIcon(frame)
UF:Configure_ClassBar(frame)
UF:Configure_AltPowerBar(frame)
UF:Configure_CustomTexts(frame)
end
UF:UpdateNameSettings(frame)
UF:Configure_RaidIcon(frame)
UF:Configure_Fader(frame)
UF:Configure_Cutaway(frame)
UF:Configure_AuraHighlight(frame)
frame:UpdateAllElements('ElvUI_UpdateAllElements')
end
UF.headerstoload.party = {nil, 'ELVUI_UNITPET, ELVUI_UNITTARGET'}

View File

@@ -0,0 +1,140 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames')
local _, ns = ...
local ElvUF = ns.oUF
assert(ElvUF, 'ElvUI was unable to locate oUF.')
local _G = _G
local CreateFrame = CreateFrame
-- GLOBALS: ElvUF_Raid
function UF:Construct_RaidFrames()
self:SetScript('OnEnter', _G.UnitFrame_OnEnter)
self:SetScript('OnLeave', _G.UnitFrame_OnLeave)
self.RaisedElementParent = CreateFrame('Frame', nil, self)
self.RaisedElementParent.TextureParent = CreateFrame('Frame', nil, self.RaisedElementParent)
self.RaisedElementParent:SetFrameLevel(self:GetFrameLevel() + 100)
self.Health = UF:Construct_HealthBar(self, true, true, 'RIGHT')
self.Power = UF:Construct_PowerBar(self, true, true, 'LEFT')
self.PowerPrediction = UF:Construct_PowerPrediction(self)
self.Portrait3D = UF:Construct_Portrait(self, 'model')
self.Portrait2D = UF:Construct_Portrait(self, 'texture')
self.InfoPanel = UF:Construct_InfoPanel(self)
self.Name = UF:Construct_NameText(self)
self.Buffs = UF:Construct_Buffs(self)
self.Debuffs = UF:Construct_Debuffs(self)
self.AuraWatch = UF:Construct_AuraWatch(self)
self.RaidDebuffs = UF:Construct_RaidDebuffs(self)
self.AuraHighlight = UF:Construct_AuraHighlight(self)
self.ResurrectIndicator = UF:Construct_ResurrectionIcon(self)
self.SummonIndicator = UF:Construct_SummonIcon(self)
self.GroupRoleIndicator = UF:Construct_RoleIcon(self)
self.RaidRoleFramesAnchor = UF:Construct_RaidRoleFrames(self)
self.MouseGlow = UF:Construct_MouseGlow(self)
self.PhaseIndicator = UF:Construct_PhaseIcon(self)
self.TargetGlow = UF:Construct_TargetGlow(self)
self.FocusGlow = UF:Construct_FocusGlow(self)
self.ThreatIndicator = UF:Construct_Threat(self)
self.RaidTargetIndicator = UF:Construct_RaidIcon(self)
self.ReadyCheckIndicator = UF:Construct_ReadyCheckIcon(self)
self.HealthPrediction = UF:Construct_HealComm(self)
self.Fader = UF:Construct_Fader()
self.Cutaway = UF:Construct_Cutaway(self)
self.AlternativePower = UF:Construct_AltPowerBar(self)
self.ClassBar = 'AlternativePower'
self.customTexts = {}
self.unitframeType = 'raid'
return self
end
function UF:Update_RaidHeader(header, db)
local parent = header:GetParent()
parent.db = db
if not parent.positioned then
parent:ClearAllPoints()
parent:Point('BOTTOMLEFT', E.UIParent, 'BOTTOMLEFT', 4, 248)
E:CreateMover(parent, parent:GetName()..'Mover', L["Raid Frames"], nil, nil, nil, 'ALL,RAID', nil, 'unitframe,groupUnits,raid,generalGroup')
parent.positioned = true
end
end
function UF:Update_RaidFrames(frame, db)
frame.db = db
frame.colors = ElvUF.colors
frame:RegisterForClicks(self.db.targetOnMouseDown and 'AnyDown' or 'AnyUp')
do
frame.SHADOW_SPACING = 3
frame.ORIENTATION = db.orientation --allow this value to change when unitframes position changes on screen?
frame.UNIT_WIDTH = db.width
frame.UNIT_HEIGHT = db.infoPanel.enable and (db.height + db.infoPanel.height) or db.height
frame.USE_POWERBAR = db.power.enable
frame.POWERBAR_DETACHED = false
frame.USE_INSET_POWERBAR = not frame.POWERBAR_DETACHED and db.power.width == 'inset' and frame.USE_POWERBAR
frame.USE_MINI_POWERBAR = (not frame.POWERBAR_DETACHED and db.power.width == 'spaced' and frame.USE_POWERBAR)
frame.USE_POWERBAR_OFFSET = (db.power.width == 'offset' and db.power.offset ~= 0) and frame.USE_POWERBAR and not frame.POWERBAR_DETACHED
frame.POWERBAR_OFFSET = frame.USE_POWERBAR_OFFSET and db.power.offset or 0
frame.POWERBAR_HEIGHT = not frame.USE_POWERBAR and 0 or db.power.height
frame.POWERBAR_WIDTH = frame.USE_MINI_POWERBAR and (frame.UNIT_WIDTH - (UF.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((UF.BORDER+UF.SPACING)*2)))
frame.USE_PORTRAIT = db.portrait and db.portrait.enable
frame.USE_PORTRAIT_OVERLAY = frame.USE_PORTRAIT and (db.portrait.overlay or frame.ORIENTATION == 'MIDDLE')
frame.PORTRAIT_WIDTH = (frame.USE_PORTRAIT_OVERLAY or not frame.USE_PORTRAIT) and 0 or db.portrait.width
frame.CAN_HAVE_CLASSBAR = not frame.isChild
frame.MAX_CLASS_BAR = 1
frame.USE_CLASSBAR = db.classbar.enable and frame.CAN_HAVE_CLASSBAR
frame.CLASSBAR_SHOWN = frame.CAN_HAVE_CLASSBAR and frame[frame.ClassBar] and frame[frame.ClassBar]:IsShown()
frame.CLASSBAR_DETACHED = false
frame.USE_MINI_CLASSBAR = db.classbar.fill == 'spaced' and frame.USE_CLASSBAR
frame.CLASSBAR_HEIGHT = frame.USE_CLASSBAR and db.classbar.height or 0
frame.CLASSBAR_WIDTH = frame.UNIT_WIDTH - frame.PORTRAIT_WIDTH - (frame.ORIENTATION == 'MIDDLE' and (frame.POWERBAR_OFFSET*2) or frame.POWERBAR_OFFSET)
frame.CLASSBAR_YOFFSET = (not frame.USE_CLASSBAR or not frame.CLASSBAR_SHOWN or frame.CLASSBAR_DETACHED) and 0 or (frame.USE_MINI_CLASSBAR and (UF.SPACING+(frame.CLASSBAR_HEIGHT/2)) or (frame.CLASSBAR_HEIGHT - (UF.BORDER-UF.SPACING)))
frame.USE_INFO_PANEL = not frame.USE_MINI_POWERBAR and not frame.USE_POWERBAR_OFFSET and db.infoPanel.enable
frame.INFO_PANEL_HEIGHT = frame.USE_INFO_PANEL and db.infoPanel.height or 0
frame.BOTTOM_OFFSET = UF:GetHealthBottomOffset(frame)
end
if db.enable and not frame:IsEnabled() then
frame:Enable()
elseif not db.enable and frame:IsEnabled() then
frame:Disable()
end
frame:Size(frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
UF:EnableDisable_Auras(frame)
UF:Configure_AllAuras(frame)
UF:Configure_InfoPanel(frame)
UF:Configure_HealthBar(frame)
UF:Configure_Power(frame)
UF:Configure_PowerPrediction(frame)
UF:Configure_Portrait(frame)
UF:Configure_Threat(frame)
UF:Configure_RaidDebuffs(frame)
UF:Configure_RaidIcon(frame)
UF:Configure_ResurrectionIcon(frame)
UF:Configure_SummonIcon(frame)
UF:Configure_AuraHighlight(frame)
UF:Configure_RoleIcon(frame)
UF:Configure_HealComm(frame)
UF:Configure_RaidRoleIcons(frame)
UF:Configure_Fader(frame)
UF:Configure_AuraWatch(frame)
UF:Configure_ReadyCheckIcon(frame)
UF:Configure_CustomTexts(frame)
UF:Configure_PhaseIcon(frame)
UF:Configure_Cutaway(frame)
UF:Configure_ClassBar(frame)
UF:Configure_AltPowerBar(frame)
UF:UpdateNameSettings(frame)
frame:UpdateAllElements('ElvUI_UpdateAllElements')
end
UF.headerstoload.raid = true

View File

@@ -0,0 +1,140 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames')
local _, ns = ...
local ElvUF = ns.oUF
assert(ElvUF, 'ElvUI was unable to locate oUF.')
local _G = _G
local CreateFrame = CreateFrame
-- GLOBALS: ElvUF_Raid40
function UF:Construct_Raid40Frames()
self:SetScript('OnEnter', _G.UnitFrame_OnEnter)
self:SetScript('OnLeave', _G.UnitFrame_OnLeave)
self.RaisedElementParent = CreateFrame('Frame', nil, self)
self.RaisedElementParent.TextureParent = CreateFrame('Frame', nil, self.RaisedElementParent)
self.RaisedElementParent:SetFrameLevel(self:GetFrameLevel() + 100)
self.Health = UF:Construct_HealthBar(self, true, true, 'RIGHT')
self.Power = UF:Construct_PowerBar(self, true, true, 'LEFT')
self.PowerPrediction = UF:Construct_PowerPrediction(self)
self.Portrait3D = UF:Construct_Portrait(self, 'model')
self.Portrait2D = UF:Construct_Portrait(self, 'texture')
self.Name = UF:Construct_NameText(self)
self.Buffs = UF:Construct_Buffs(self)
self.Debuffs = UF:Construct_Debuffs(self)
self.AuraWatch = UF:Construct_AuraWatch(self)
self.RaidDebuffs = UF:Construct_RaidDebuffs(self)
self.AuraHighlight = UF:Construct_AuraHighlight(self)
self.ResurrectIndicator = UF:Construct_ResurrectionIcon(self)
self.SummonIndicator = UF:Construct_SummonIcon(self)
self.GroupRoleIndicator = UF:Construct_RoleIcon(self)
self.RaidRoleFramesAnchor = UF:Construct_RaidRoleFrames(self)
self.PhaseIndicator = UF:Construct_PhaseIcon(self)
self.MouseGlow = UF:Construct_MouseGlow(self)
self.TargetGlow = UF:Construct_TargetGlow(self)
self.FocusGlow = UF:Construct_FocusGlow(self)
self.InfoPanel = UF:Construct_InfoPanel(self)
self.ThreatIndicator = UF:Construct_Threat(self)
self.RaidTargetIndicator = UF:Construct_RaidIcon(self)
self.ReadyCheckIndicator = UF:Construct_ReadyCheckIcon(self)
self.HealthPrediction = UF:Construct_HealComm(self)
self.Fader = UF:Construct_Fader()
self.Cutaway = UF:Construct_Cutaway(self)
self.AlternativePower = UF:Construct_AltPowerBar(self)
self.ClassBar = 'AlternativePower'
self.customTexts = {}
self.unitframeType = 'raid40'
return self
end
function UF:Update_Raid40Header(header, db)
local parent = header:GetParent()
parent.db = db
if not parent.positioned then
parent:ClearAllPoints()
parent:Point('TOPLEFT', E.UIParent, 'BOTTOMLEFT', 4, 482)
E:CreateMover(parent, parent:GetName()..'Mover', L["Raid-40 Frames"], nil, nil, nil, 'ALL,RAID', nil, 'unitframe,groupUnits,raid40,generalGroup')
parent.positioned = true
end
end
function UF:Update_Raid40Frames(frame, db)
frame.db = db
frame.colors = ElvUF.colors
frame:RegisterForClicks(self.db.targetOnMouseDown and 'AnyDown' or 'AnyUp')
do
frame.SHADOW_SPACING = 3
frame.ORIENTATION = db.orientation --allow this value to change when unitframes position changes on screen?
frame.UNIT_WIDTH = db.width
frame.UNIT_HEIGHT = db.infoPanel.enable and (db.height + db.infoPanel.height) or db.height
frame.USE_POWERBAR = db.power.enable
frame.POWERBAR_DETACHED = false
frame.USE_INSET_POWERBAR = not frame.POWERBAR_DETACHED and db.power.width == 'inset' and frame.USE_POWERBAR
frame.USE_MINI_POWERBAR = (not frame.POWERBAR_DETACHED and db.power.width == 'spaced' and frame.USE_POWERBAR)
frame.USE_POWERBAR_OFFSET = (db.power.width == 'offset' and db.power.offset ~= 0) and frame.USE_POWERBAR and not frame.POWERBAR_DETACHED
frame.POWERBAR_OFFSET = frame.USE_POWERBAR_OFFSET and db.power.offset or 0
frame.POWERBAR_HEIGHT = not frame.USE_POWERBAR and 0 or db.power.height
frame.POWERBAR_WIDTH = frame.USE_MINI_POWERBAR and (frame.UNIT_WIDTH - (UF.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((UF.BORDER+UF.SPACING)*2)))
frame.USE_PORTRAIT = db.portrait and db.portrait.enable
frame.USE_PORTRAIT_OVERLAY = frame.USE_PORTRAIT and (db.portrait.overlay or frame.ORIENTATION == 'MIDDLE')
frame.PORTRAIT_WIDTH = (frame.USE_PORTRAIT_OVERLAY or not frame.USE_PORTRAIT) and 0 or db.portrait.width
frame.CAN_HAVE_CLASSBAR = not frame.isChild
frame.MAX_CLASS_BAR = 1
frame.USE_CLASSBAR = db.classbar.enable and frame.CAN_HAVE_CLASSBAR
frame.CLASSBAR_SHOWN = frame.CAN_HAVE_CLASSBAR and frame[frame.ClassBar] and frame[frame.ClassBar]:IsShown()
frame.CLASSBAR_DETACHED = false
frame.USE_MINI_CLASSBAR = db.classbar.fill == 'spaced' and frame.USE_CLASSBAR
frame.CLASSBAR_HEIGHT = frame.USE_CLASSBAR and db.classbar.height or 0
frame.CLASSBAR_WIDTH = frame.UNIT_WIDTH - frame.PORTRAIT_WIDTH - (frame.ORIENTATION == 'MIDDLE' and (frame.POWERBAR_OFFSET*2) or frame.POWERBAR_OFFSET)
frame.CLASSBAR_YOFFSET = (not frame.USE_CLASSBAR or not frame.CLASSBAR_SHOWN or frame.CLASSBAR_DETACHED) and 0 or (frame.USE_MINI_CLASSBAR and (UF.SPACING+(frame.CLASSBAR_HEIGHT/2)) or (frame.CLASSBAR_HEIGHT - (UF.BORDER-UF.SPACING)))
frame.USE_INFO_PANEL = not frame.USE_MINI_POWERBAR and not frame.USE_POWERBAR_OFFSET and db.infoPanel.enable
frame.INFO_PANEL_HEIGHT = frame.USE_INFO_PANEL and db.infoPanel.height or 0
frame.BOTTOM_OFFSET = UF:GetHealthBottomOffset(frame)
end
if db.enable and not frame:IsEnabled() then
frame:Enable()
elseif not db.enable and frame:IsEnabled() then
frame:Disable()
end
frame:Size(frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
UF:EnableDisable_Auras(frame)
UF:Configure_AllAuras(frame)
UF:Configure_InfoPanel(frame)
UF:Configure_HealthBar(frame)
UF:Configure_Power(frame)
UF:Configure_PowerPrediction(frame)
UF:Configure_Portrait(frame)
UF:Configure_Threat(frame)
UF:Configure_RaidDebuffs(frame)
UF:Configure_RaidIcon(frame)
UF:Configure_ResurrectionIcon(frame)
UF:Configure_SummonIcon(frame)
UF:Configure_AuraHighlight(frame)
UF:Configure_RoleIcon(frame)
UF:Configure_HealComm(frame)
UF:Configure_RaidRoleIcons(frame)
UF:Configure_Fader(frame)
UF:Configure_AuraWatch(frame)
UF:Configure_ReadyCheckIcon(frame)
UF:Configure_CustomTexts(frame)
UF:Configure_PhaseIcon(frame)
UF:Configure_Cutaway(frame)
UF:Configure_ClassBar(frame)
UF:Configure_AltPowerBar(frame)
UF:UpdateNameSettings(frame)
frame:UpdateAllElements('ElvUI_UpdateAllElements')
end
UF.headerstoload.raid40 = true

View File

@@ -0,0 +1,104 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames')
local _, ns = ...
local ElvUF = ns.oUF
assert(ElvUF, 'ElvUI was unable to locate oUF.')
local _G = _G
local CreateFrame = CreateFrame
function UF:Construct_RaidpetFrames()
self:SetScript('OnEnter', _G.UnitFrame_OnEnter)
self:SetScript('OnLeave', _G.UnitFrame_OnLeave)
self.RaisedElementParent = CreateFrame('Frame', nil, self)
self.RaisedElementParent.TextureParent = CreateFrame('Frame', nil, self.RaisedElementParent)
self.RaisedElementParent:SetFrameLevel(self:GetFrameLevel() + 100)
self.Health = UF:Construct_HealthBar(self, true, true, 'RIGHT')
self.Name = UF:Construct_NameText(self)
self.Portrait3D = UF:Construct_Portrait(self, 'model')
self.Portrait2D = UF:Construct_Portrait(self, 'texture')
self.Buffs = UF:Construct_Buffs(self)
self.Debuffs = UF:Construct_Debuffs(self)
self.AuraWatch = UF:Construct_AuraWatch(self)
self.RaidDebuffs = UF:Construct_RaidDebuffs(self)
self.AuraHighlight = UF:Construct_AuraHighlight(self)
self.TargetGlow = UF:Construct_TargetGlow(self)
self.FocusGlow = UF:Construct_FocusGlow(self)
self.MouseGlow = UF:Construct_MouseGlow(self)
self.ThreatIndicator = UF:Construct_Threat(self)
self.RaidTargetIndicator = UF:Construct_RaidIcon(self)
self.HealthPrediction = UF:Construct_HealComm(self)
self.Fader = UF:Construct_Fader()
self.Cutaway = UF:Construct_Cutaway(self)
self.customTexts = {}
self.unitframeType = 'raidpet'
return self
end
function UF:Update_RaidpetHeader(header, db)
local parent = header:GetParent()
parent.db = db
if not parent.positioned then
parent:ClearAllPoints()
parent:Point('TOPLEFT', E.UIParent, 'BOTTOMLEFT', 4, 737)
E:CreateMover(parent, parent:GetName()..'Mover', L["Raid Pet Frames"], nil, nil, nil, 'ALL,RAID', nil, 'unitframe,groupUnits,raidpet,generalGroup')
parent.positioned = true
end
end
function UF:Update_RaidpetFrames(frame, db)
frame.db = db
frame.colors = ElvUF.colors
frame:RegisterForClicks(UF.db.targetOnMouseDown and 'AnyDown' or 'AnyUp')
do
frame.SHADOW_SPACING = 3
frame.ORIENTATION = db.orientation --allow this value to change when unitframes position changes on screen?
frame.UNIT_WIDTH = db.width
frame.UNIT_HEIGHT = db.height
frame.USE_POWERBAR = false
frame.POWERBAR_DETACHED = false
frame.USE_INSET_POWERBAR = false
frame.USE_MINI_POWERBAR = false
frame.USE_POWERBAR_OFFSET = false
frame.POWERBAR_OFFSET = 0
frame.POWERBAR_HEIGHT = 0
frame.POWERBAR_WIDTH = 0
frame.USE_PORTRAIT = db.portrait and db.portrait.enable
frame.USE_PORTRAIT_OVERLAY = frame.USE_PORTRAIT and (db.portrait.overlay or frame.ORIENTATION == 'MIDDLE')
frame.PORTRAIT_WIDTH = (frame.USE_PORTRAIT_OVERLAY or not frame.USE_PORTRAIT) and 0 or db.portrait.width
frame.CLASSBAR_YOFFSET = 0
frame.BOTTOM_OFFSET = 0
end
frame.Health.colorPetByUnitClass = db.health.colorPetByUnitClass
frame:Size(frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
UF:Configure_HealthBar(frame)
UF:UpdateNameSettings(frame)
UF:Configure_Portrait(frame)
UF:Configure_Threat(frame)
UF:EnableDisable_Auras(frame)
UF:Configure_AllAuras(frame)
UF:Configure_RaidDebuffs(frame)
UF:Configure_RaidIcon(frame)
UF:Configure_AuraHighlight(frame)
UF:Configure_HealComm(frame)
UF:Configure_Fader(frame)
UF:Configure_AuraWatch(frame, true)
UF:Configure_Cutaway(frame)
UF:Configure_CustomTexts(frame)
frame:UpdateAllElements('ElvUI_UpdateAllElements')
end
--Added an additional argument at the end, specifying the header Template we want to use
UF.headerstoload.raidpet = {nil, nil, 'SecureGroupPetHeaderTemplate'}

View File

@@ -0,0 +1,150 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames')
local _, ns = ...
local ElvUF = ns.oUF
assert(ElvUF, 'ElvUI was unable to locate oUF.')
local _G = _G
local max = max
local CreateFrame = CreateFrame
local IsAddOnLoaded = IsAddOnLoaded
local InCombatLockdown = InCombatLockdown
local RegisterAttributeDriver = RegisterAttributeDriver
function UF:Construct_TankFrames()
self:SetScript('OnEnter', _G.UnitFrame_OnEnter)
self:SetScript('OnLeave', _G.UnitFrame_OnLeave)
self.RaisedElementParent = CreateFrame('Frame', nil, self)
self.RaisedElementParent.TextureParent = CreateFrame('Frame', nil, self.RaisedElementParent)
self.RaisedElementParent:SetFrameLevel(self:GetFrameLevel() + 100)
self.Health = UF:Construct_HealthBar(self, true)
self.Name = UF:Construct_NameText(self)
self.ThreatIndicator = UF:Construct_Threat(self)
self.RaidTargetIndicator = UF:Construct_RaidIcon(self)
self.MouseGlow = UF:Construct_MouseGlow(self)
self.TargetGlow = UF:Construct_TargetGlow(self)
self.FocusGlow = UF:Construct_FocusGlow(self)
self.Fader = UF:Construct_Fader()
self.Cutaway = UF:Construct_Cutaway(self)
if not self.isChild then
self.Buffs = UF:Construct_Buffs(self)
self.Debuffs = UF:Construct_Debuffs(self)
self.AuraWatch = UF:Construct_AuraWatch(self)
self.RaidDebuffs = UF:Construct_RaidDebuffs(self)
self.AuraHighlight = UF:Construct_AuraHighlight(self)
self.unitframeType = 'tank'
else
self.unitframeType = 'tanktarget'
end
self.originalParent = self:GetParent()
return self
end
function UF:Update_TankHeader(header, db)
header:Hide()
header.db = db
UF:ClearChildPoints(header:GetChildren())
if not header.isForced and db.enable then
RegisterAttributeDriver(header, 'state-visibility', '[@raid1,exists] show;hide')
end
header:SetAttribute('point', 'BOTTOM')
header:SetAttribute('columnAnchorPoint', 'LEFT')
header:SetAttribute('yOffset', db.verticalSpacing)
if not header.positioned then
header:ClearAllPoints()
header:Point('TOPLEFT', E.UIParent, 'TOPLEFT', 4, -186)
local width, height = header:GetSize()
local minHeight = max(height, 2*db.height + db.verticalSpacing)
header:SetAttribute('minHeight', minHeight)
header:SetAttribute('minWidth', width)
E:CreateMover(header, header:GetName()..'Mover', L["MT Frames"], nil, nil, nil, 'ALL,RAID', nil, 'unitframe,groupUnits,tank,generalGroup')
header.mover:SetSize(width, minHeight)
header.positioned = true
end
end
function UF:Update_TankFrames(frame, db)
frame.db = db
frame.colors = ElvUF.colors
frame:RegisterForClicks(UF.db.targetOnMouseDown and 'AnyDown' or 'AnyUp')
do
frame.ORIENTATION = db.orientation --allow this value to change when unitframes position changes on screen?
frame.SHADOW_SPACING = 3
frame.UNIT_WIDTH = db.width
frame.UNIT_HEIGHT = db.height
frame.USE_POWERBAR = false
frame.POWERBAR_DETACHED = false
frame.USE_INSET_POWERBAR = false
frame.USE_MINI_POWERBAR = false
frame.USE_POWERBAR_OFFSET = false
frame.POWERBAR_OFFSET = 0
frame.POWERBAR_HEIGHT = 0
frame.POWERBAR_WIDTH = 0
frame.USE_PORTRAIT = false
frame.USE_PORTRAIT_OVERLAY = false
frame.PORTRAIT_WIDTH = 0
frame.CLASSBAR_YOFFSET = 0
frame.BOTTOM_OFFSET = 0
end
if frame.isChild then
local childDB = db.targetsGroup
frame.db = db.targetsGroup
frame:Size(childDB.width, childDB.height)
if not InCombatLockdown() then
if childDB.enable then
frame:Enable()
frame:ClearAllPoints()
frame:Point(E.InversePoints[childDB.anchorPoint], frame.originalParent, childDB.anchorPoint, childDB.xOffset, childDB.yOffset)
else
frame:Disable()
end
end
else
frame:Size(frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
end
UF:Configure_HealthBar(frame)
UF:UpdateNameSettings(frame)
UF:Configure_Threat(frame)
UF:Configure_Fader(frame)
UF:Configure_Cutaway(frame)
UF:Configure_RaidIcon(frame)
if not frame.isChild then
if not IsAddOnLoaded('Clique') then
if db.middleClickFocus then
frame:SetAttribute('type3', 'focus')
elseif frame:GetAttribute('type3') == 'focus' then
frame:SetAttribute('type3', nil)
end
end
UF:EnableDisable_Auras(frame)
UF:Configure_AllAuras(frame)
UF:Configure_RaidDebuffs(frame)
UF:Configure_AuraHighlight(frame)
UF:Configure_AuraWatch(frame)
end
frame:UpdateAllElements('ElvUI_UpdateAllElements')
end
UF.headerstoload.tank = {'MAINTANK', 'ELVUI_UNITTARGET'}

View File

@@ -0,0 +1,47 @@
<Ui xmlns='http://www.blizzard.com/wow/ui/'>
<Button name='ELVUI_UNITTARGET' inherits='SecureUnitButtonTemplate' hidden='true' virtual='true'>
<Frames>
<Button name='$parentTarget' inherits='SecureUnitButtonTemplate'>
<Anchors>
<Anchor point='TOPLEFT' relativePoint='TOPRIGHT' relativeTo='$parent'>
<Offset>
<AbsDimension x='7' y='0'/>
</Offset>
</Anchor>
</Anchors>
<Attributes>
<Attribute name='unitsuffix' type='string' value='target'/>
<Attribute name='useparent-unit' type='boolean' value='true'/>
<Attribute name='type1' type='string' value='target'/>
<Attribute name='initial-unitWatch' type='boolean' value='true'/>
</Attributes>
</Button>
</Frames>
</Button>
<Button name='ELVUI_UNITPET' inherits='SecureUnitButtonTemplate' hidden='true' virtual='true'>
<Frames>
<Button name='$parentPet' inherits='SecureUnitButtonTemplate'>
<Anchors>
<Anchor point='BOTTOM' relativePoint='TOP' relativeTo='$parent'>
<Offset>
<AbsDimension x='0' y='1'/>
</Offset>
</Anchor>
</Anchors>
<Attributes>
<Attribute name='unitsuffix' type='string' value='pet'/>
<Attribute name='useparent-unit' type='boolean' value='true'/>
<Attribute name='type1' type='string' value='target'/>
<Attribute name='initial-unitWatch' type='boolean' value='true'/>
</Attributes>
</Button>
</Frames>
</Button>
<Script file='UnitFrames.lua'/>
<Script file='ConfigEnviroment.lua'/>
<Include file='Elements\Load_Elements.xml'/>
<Include file='Units\Load_Units.xml'/>
<Include file='Groups\Load_Groups.xml'/>
</Ui>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,103 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames')
local _, ns = ...
local ElvUF = ns.oUF
assert(ElvUF, 'ElvUI was unable to locate oUF.')
local _G = _G
local tinsert = tinsert
-- GLOBALS: ElvUF_Target
function UF:Construct_FocusFrame(frame)
frame.Health = UF:Construct_HealthBar(frame, true, true, 'RIGHT')
frame.Power = UF:Construct_PowerBar(frame, true, true, 'LEFT')
frame.Power.frequentUpdates = true
frame.PowerPrediction = UF:Construct_PowerPrediction(frame)
frame.Name = UF:Construct_NameText(frame)
frame.Portrait3D = UF:Construct_Portrait(frame, 'model')
frame.Portrait2D = UF:Construct_Portrait(frame, 'texture')
frame.Buffs = UF:Construct_Buffs(frame)
frame.Castbar = UF:Construct_Castbar(frame, L["Focus Castbar"])
frame.Castbar.SafeZone = nil
frame.Castbar.LatencyTexture:Hide()
frame.RaidTargetIndicator = UF:Construct_RaidIcon(frame)
frame.Debuffs = UF:Construct_Debuffs(frame)
frame.HealthPrediction = UF:Construct_HealComm(frame)
frame.AuraBars = UF:Construct_AuraBarHeader(frame)
frame.ThreatIndicator = UF:Construct_Threat(frame)
frame.MouseGlow = UF:Construct_MouseGlow(frame)
frame.TargetGlow = UF:Construct_TargetGlow(frame)
frame.FocusGlow = UF:Construct_FocusGlow(frame)
frame.InfoPanel = UF:Construct_InfoPanel(frame)
frame.AuraHighlight = UF:Construct_AuraHighlight(frame)
frame.Fader = UF:Construct_Fader()
frame.Cutaway = UF:Construct_Cutaway(frame)
frame.CombatIndicator = UF:Construct_CombatIndicator(frame)
frame.customTexts = {}
frame:Point('BOTTOM', E.UIParent, 'BOTTOM', 342, 59)
E:CreateMover(frame, frame:GetName()..'Mover', L["Focus Frame"], nil, nil, nil, 'ALL,SOLO', nil, 'unitframe,individualUnits,focus,generalGroup')
frame.unitframeType = 'focus'
end
function UF:Update_FocusFrame(frame, db)
frame.db = db
do
frame.ORIENTATION = db.orientation --allow this value to change when unitframes position changes on screen?
frame.UNIT_WIDTH = db.width
frame.UNIT_HEIGHT = db.infoPanel.enable and (db.height + db.infoPanel.height) or db.height
frame.USE_POWERBAR = db.power.enable
frame.POWERBAR_DETACHED = db.power.detachFromFrame
frame.USE_INSET_POWERBAR = not frame.POWERBAR_DETACHED and db.power.width == 'inset' and frame.USE_POWERBAR
frame.USE_MINI_POWERBAR = (not frame.POWERBAR_DETACHED and db.power.width == 'spaced' and frame.USE_POWERBAR)
frame.USE_POWERBAR_OFFSET = (db.power.width == 'offset' and db.power.offset ~= 0) and frame.USE_POWERBAR and not frame.POWERBAR_DETACHED
frame.POWERBAR_OFFSET = frame.USE_POWERBAR_OFFSET and db.power.offset or 0
frame.POWERBAR_HEIGHT = not frame.USE_POWERBAR and 0 or db.power.height
frame.POWERBAR_WIDTH = frame.USE_MINI_POWERBAR and (frame.UNIT_WIDTH - (UF.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((UF.BORDER+UF.SPACING)*2)))
frame.USE_PORTRAIT = db.portrait and db.portrait.enable
frame.USE_PORTRAIT_OVERLAY = frame.USE_PORTRAIT and (db.portrait.overlay or frame.ORIENTATION == 'MIDDLE')
frame.PORTRAIT_WIDTH = (frame.USE_PORTRAIT_OVERLAY or not frame.USE_PORTRAIT) and 0 or db.portrait.width
frame.USE_INFO_PANEL = not frame.USE_MINI_POWERBAR and not frame.USE_POWERBAR_OFFSET and db.infoPanel.enable
frame.INFO_PANEL_HEIGHT = frame.USE_INFO_PANEL and db.infoPanel.height or 0
frame.BOTTOM_OFFSET = UF:GetHealthBottomOffset(frame)
end
if db.strataAndLevel and db.strataAndLevel.useCustomStrata then
frame:SetFrameStrata(db.strataAndLevel.frameStrata)
end
if db.strataAndLevel and db.strataAndLevel.useCustomLevel then
frame:SetFrameLevel(db.strataAndLevel.frameLevel)
end
frame:RegisterForClicks(self.db.targetOnMouseDown and 'AnyDown' or 'AnyUp')
frame.colors = ElvUF.colors
frame:Size(frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
_G[frame:GetName()..'Mover']:Size(frame:GetSize())
UF:Configure_InfoPanel(frame)
UF:Configure_HealthBar(frame)
UF:UpdateNameSettings(frame)
UF:Configure_Power(frame)
UF:Configure_PowerPrediction(frame)
UF:Configure_Portrait(frame)
UF:Configure_Threat(frame)
UF:EnableDisable_Auras(frame)
UF:Configure_AllAuras(frame)
UF:Configure_Castbar(frame)
UF:Configure_Fader(frame)
UF:Configure_HealComm(frame)
UF:Configure_RaidIcon(frame)
UF:Configure_AuraBars(frame)
UF:Configure_Cutaway(frame)
UF:Configure_CustomTexts(frame)
UF:Configure_AuraHighlight(frame)
UF:Configure_CombatIndicator(frame)
frame:UpdateAllElements('ElvUI_UpdateAllElements')
end
tinsert(UF.unitstoload, 'focus')

View File

@@ -0,0 +1,110 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames')
local _, ns = ...
local ElvUF = ns.oUF
assert(ElvUF, 'ElvUI was unable to locate oUF.')
local _G = _G
local tinsert = tinsert
-- GLOBALS: ElvUF_Focus
function UF:Construct_FocusTargetFrame(frame)
frame.Health = UF:Construct_HealthBar(frame, true, true, 'RIGHT')
frame.Power = UF:Construct_PowerBar(frame, true, true, 'LEFT')
frame.PowerPrediction = UF:Construct_PowerPrediction(frame)
frame.Name = UF:Construct_NameText(frame)
frame.Portrait3D = UF:Construct_Portrait(frame, 'model')
frame.Portrait2D = UF:Construct_Portrait(frame, 'texture')
frame.Buffs = UF:Construct_Buffs(frame)
frame.RaidTargetIndicator = UF:Construct_RaidIcon(frame)
frame.Debuffs = UF:Construct_Debuffs(frame)
frame.ThreatIndicator = UF:Construct_Threat(frame)
frame.MouseGlow = UF:Construct_MouseGlow(frame)
frame.TargetGlow = UF:Construct_TargetGlow(frame)
frame.FocusGlow = UF:Construct_FocusGlow(frame)
frame.InfoPanel = UF:Construct_InfoPanel(frame)
frame.Fader = UF:Construct_Fader()
frame.Cutaway = UF:Construct_Cutaway(frame)
frame.customTexts = {}
frame:Point('BOTTOM', UF.focus, 'TOP', 0, 7) --Set to default position
E:CreateMover(frame, frame:GetName()..'Mover', L["FocusTarget Frame"], nil, -7, nil, 'ALL,SOLO', nil, 'unitframe,individualUnits,focustarget,generalGroup')
frame.unitframeType = 'focustarget'
end
function UF:Update_FocusTargetFrame(frame, db)
frame.db = db
do
frame.ORIENTATION = db.orientation --allow this value to change when unitframes position changes on screen?
frame.UNIT_WIDTH = db.width
frame.UNIT_HEIGHT = db.infoPanel.enable and (db.height + db.infoPanel.height) or db.height
frame.USE_POWERBAR = db.power.enable
frame.POWERBAR_DETACHED = db.power.detachFromFrame
frame.USE_INSET_POWERBAR = not frame.POWERBAR_DETACHED and db.power.width == 'inset' and frame.USE_POWERBAR
frame.USE_MINI_POWERBAR = (not frame.POWERBAR_DETACHED and db.power.width == 'spaced' and frame.USE_POWERBAR)
frame.USE_POWERBAR_OFFSET = (db.power.width == 'offset' and db.power.offset ~= 0) and frame.USE_POWERBAR and not frame.POWERBAR_DETACHED
frame.POWERBAR_OFFSET = frame.USE_POWERBAR_OFFSET and db.power.offset or 0
frame.POWERBAR_HEIGHT = not frame.USE_POWERBAR and 0 or db.power.height
frame.POWERBAR_WIDTH = frame.USE_MINI_POWERBAR and (frame.UNIT_WIDTH - (UF.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((UF.BORDER+UF.SPACING)*2)))
frame.USE_PORTRAIT = db.portrait and db.portrait.enable
frame.USE_PORTRAIT_OVERLAY = frame.USE_PORTRAIT and (db.portrait.overlay or frame.ORIENTATION == 'MIDDLE')
frame.PORTRAIT_WIDTH = (frame.USE_PORTRAIT_OVERLAY or not frame.USE_PORTRAIT) and 0 or db.portrait.width
frame.USE_INFO_PANEL = not frame.USE_MINI_POWERBAR and not frame.USE_POWERBAR_OFFSET and db.infoPanel.enable
frame.INFO_PANEL_HEIGHT = frame.USE_INFO_PANEL and db.infoPanel.height or 0
frame.BOTTOM_OFFSET = UF:GetHealthBottomOffset(frame)
end
if db.strataAndLevel and db.strataAndLevel.useCustomStrata then
frame:SetFrameStrata(db.strataAndLevel.frameStrata)
end
if db.strataAndLevel and db.strataAndLevel.useCustomLevel then
frame:SetFrameLevel(db.strataAndLevel.frameLevel)
end
frame:RegisterForClicks(self.db.targetOnMouseDown and 'AnyDown' or 'AnyUp')
frame.colors = ElvUF.colors
frame:Size(frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
_G[frame:GetName()..'Mover']:Size(frame:GetSize())
UF:Configure_InfoPanel(frame)
--Health
UF:Configure_HealthBar(frame)
--Name
UF:UpdateNameSettings(frame)
--Power
UF:Configure_Power(frame)
--Power Predicition
UF:Configure_PowerPrediction(frame)
--Portrait
UF:Configure_Portrait(frame)
--Threat
UF:Configure_Threat(frame)
--Auras
UF:EnableDisable_Auras(frame)
UF:Configure_AllAuras(frame)
--Fader
UF:Configure_Fader(frame)
--Raid Icon
UF:Configure_RaidIcon(frame)
--Cutaway
UF:Configure_Cutaway(frame)
--CustomTexts
UF:Configure_CustomTexts(frame)
frame:UpdateAllElements('ElvUI_UpdateAllElements')
end
tinsert(UF.unitstoload, 'focustarget')

View File

@@ -0,0 +1,10 @@
<Ui xmlns='http://www.blizzard.com/wow/ui/'>
<Script file='Player.lua'/>
<Script file='Target.lua'/>
<Script file='TargetTarget.lua'/>
<Script file='Focus.lua'/>
<Script file='FocusTarget.lua'/>
<Script file='Pet.lua'/>
<Script file='PetTarget.lua'/>
<Script file='TargetTargetTarget.lua'/>
</Ui>

View File

@@ -0,0 +1,99 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames')
local _, ns = ...
local ElvUF = ns.oUF
assert(ElvUF, 'ElvUI was unable to locate oUF.')
local _G = _G
local tinsert = tinsert
-- GLOBALS: ElvUF_Player
function UF:Construct_PetFrame(frame)
frame.Health = UF:Construct_HealthBar(frame, true, true, 'RIGHT')
frame.Power = UF:Construct_PowerBar(frame, true, true, 'LEFT')
frame.PowerPrediction = UF:Construct_PowerPrediction(frame)
frame.Name = UF:Construct_NameText(frame)
frame.Portrait3D = UF:Construct_Portrait(frame, 'model')
frame.Portrait2D = UF:Construct_Portrait(frame, 'texture')
frame.Buffs = UF:Construct_Buffs(frame)
frame.Debuffs = UF:Construct_Debuffs(frame)
frame.Castbar = UF:Construct_Castbar(frame, L["Pet Castbar"])
frame.Castbar.SafeZone = nil
frame.Castbar.LatencyTexture:Hide()
frame.ThreatIndicator = UF:Construct_Threat(frame)
frame.HealthPrediction = UF:Construct_HealComm(frame)
frame.AuraWatch = UF:Construct_AuraWatch(frame)
frame.AuraBars = UF:Construct_AuraBarHeader(frame)
frame.InfoPanel = UF:Construct_InfoPanel(frame)
frame.MouseGlow = UF:Construct_MouseGlow(frame)
frame.FocusGlow = UF:Construct_FocusGlow(frame)
frame.TargetGlow = UF:Construct_TargetGlow(frame)
frame.Fader = UF:Construct_Fader()
frame.Cutaway = UF:Construct_Cutaway(frame)
frame.customTexts = {}
frame:Point('BOTTOM', E.UIParent, 'BOTTOM', -342, 100)
E:CreateMover(frame, frame:GetName()..'Mover', L["Pet Frame"], nil, nil, nil, 'ALL,SOLO', nil, 'unitframe,individualUnits,pet,generalGroup')
frame.unitframeType = 'pet'
end
function UF:Update_PetFrame(frame, db)
frame.db = db
do
frame.ORIENTATION = db.orientation --allow this value to change when unitframes position changes on screen?
frame.UNIT_WIDTH = db.width
frame.UNIT_HEIGHT = db.infoPanel.enable and (db.height + db.infoPanel.height) or db.height
frame.USE_POWERBAR = db.power.enable
frame.POWERBAR_DETACHED = db.power.detachFromFrame
frame.USE_INSET_POWERBAR = not frame.POWERBAR_DETACHED and db.power.width == 'inset' and frame.USE_POWERBAR
frame.USE_MINI_POWERBAR = (not frame.POWERBAR_DETACHED and db.power.width == 'spaced' and frame.USE_POWERBAR)
frame.USE_POWERBAR_OFFSET = (db.power.width == 'offset' and db.power.offset ~= 0) and frame.USE_POWERBAR and not frame.POWERBAR_DETACHED
frame.POWERBAR_OFFSET = frame.USE_POWERBAR_OFFSET and db.power.offset or 0
frame.POWERBAR_HEIGHT = not frame.USE_POWERBAR and 0 or db.power.height
frame.POWERBAR_WIDTH = frame.USE_MINI_POWERBAR and (frame.UNIT_WIDTH - (UF.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((UF.BORDER+UF.SPACING)*2)))
frame.USE_PORTRAIT = db.portrait and db.portrait.enable
frame.USE_PORTRAIT_OVERLAY = frame.USE_PORTRAIT and (db.portrait.overlay or frame.ORIENTATION == 'MIDDLE')
frame.PORTRAIT_WIDTH = (frame.USE_PORTRAIT_OVERLAY or not frame.USE_PORTRAIT) and 0 or db.portrait.width
frame.USE_INFO_PANEL = not frame.USE_MINI_POWERBAR and not frame.USE_POWERBAR_OFFSET and db.infoPanel.enable
frame.INFO_PANEL_HEIGHT = frame.USE_INFO_PANEL and db.infoPanel.height or 0
frame.BOTTOM_OFFSET = UF:GetHealthBottomOffset(frame)
end
if db.strataAndLevel and db.strataAndLevel.useCustomStrata then
frame:SetFrameStrata(db.strataAndLevel.frameStrata)
end
if db.strataAndLevel and db.strataAndLevel.useCustomLevel then
frame:SetFrameLevel(db.strataAndLevel.frameLevel)
end
frame.Health.colorPetByUnitClass = db.health.colorPetByUnitClass
frame.colors = ElvUF.colors
frame:RegisterForClicks(self.db.targetOnMouseDown and 'AnyDown' or 'AnyUp')
frame:Size(frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
_G[frame:GetName()..'Mover']:Size(frame:GetSize())
UF:Configure_InfoPanel(frame)
UF:Configure_HealthBar(frame)
UF:UpdateNameSettings(frame)
UF:Configure_Power(frame)
UF:Configure_PowerPrediction(frame)
UF:Configure_Portrait(frame)
UF:Configure_Threat(frame)
UF:EnableDisable_Auras(frame)
UF:Configure_AllAuras(frame)
UF:Configure_Fader(frame)
UF:Configure_Castbar(frame)
UF:Configure_HealComm(frame)
UF:Configure_AuraBars(frame)
UF:Configure_Cutaway(frame)
UF:Configure_CustomTexts(frame)
UF:Configure_AuraWatch(frame, true)
frame:UpdateAllElements('ElvUI_UpdateAllElements')
end
tinsert(UF.unitstoload, 'pet')

View File

@@ -0,0 +1,88 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames')
local _, ns = ...
local ElvUF = ns.oUF
assert(ElvUF, 'ElvUI was unable to locate oUF.')
local _G = _G
local tinsert = tinsert
-- GLOBALS: ElvUF_Pet
function UF:Construct_PetTargetFrame(frame)
frame.Health = UF:Construct_HealthBar(frame, true, true, 'RIGHT')
frame.Power = UF:Construct_PowerBar(frame, true, true, 'LEFT')
frame.PowerPrediction = UF:Construct_PowerPrediction(frame)
frame.Name = UF:Construct_NameText(frame)
frame.Portrait3D = UF:Construct_Portrait(frame, 'model')
frame.Portrait2D = UF:Construct_Portrait(frame, 'texture')
frame.InfoPanel = UF:Construct_InfoPanel(frame)
frame.Buffs = UF:Construct_Buffs(frame)
frame.ThreatIndicator = UF:Construct_Threat(frame)
frame.Debuffs = UF:Construct_Debuffs(frame)
frame.MouseGlow = UF:Construct_MouseGlow(frame)
frame.TargetGlow = UF:Construct_TargetGlow(frame)
frame.FocusGlow = UF:Construct_FocusGlow(frame)
frame.Fader = UF:Construct_Fader()
frame.Cutaway = UF:Construct_Cutaway(frame)
frame.customTexts = {}
frame:Point('BOTTOM', ElvUF_Pet, 'TOP', 0, 7) --Set to default position
E:CreateMover(frame, frame:GetName()..'Mover', L["PetTarget Frame"], nil, -7, nil, 'ALL,SOLO', nil, 'unitframe,individualUnits,pettarget,generalGroup')
frame.unitframeType = 'pettarget'
end
function UF:Update_PetTargetFrame(frame, db)
frame.db = db
do
frame.ORIENTATION = db.orientation --allow this value to change when unitframes position changes on screen?
frame.UNIT_WIDTH = db.width
frame.UNIT_HEIGHT = db.infoPanel.enable and (db.height + db.infoPanel.height) or db.height
frame.USE_POWERBAR = db.power.enable
frame.POWERBAR_DETACHED = db.power.detachFromFrame
frame.USE_INSET_POWERBAR = not frame.POWERBAR_DETACHED and db.power.width == 'inset' and frame.USE_POWERBAR
frame.USE_MINI_POWERBAR = (not frame.POWERBAR_DETACHED and db.power.width == 'spaced' and frame.USE_POWERBAR)
frame.USE_POWERBAR_OFFSET = (db.power.width == 'offset' and db.power.offset ~= 0) and frame.USE_POWERBAR and not frame.POWERBAR_DETACHED
frame.POWERBAR_OFFSET = frame.USE_POWERBAR_OFFSET and db.power.offset or 0
frame.POWERBAR_HEIGHT = not frame.USE_POWERBAR and 0 or db.power.height
frame.POWERBAR_WIDTH = frame.USE_MINI_POWERBAR and (frame.UNIT_WIDTH - (UF.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((UF.BORDER+UF.SPACING)*2)))
frame.USE_PORTRAIT = db.portrait and db.portrait.enable
frame.USE_PORTRAIT_OVERLAY = frame.USE_PORTRAIT and (db.portrait.overlay or frame.ORIENTATION == 'MIDDLE')
frame.PORTRAIT_WIDTH = (frame.USE_PORTRAIT_OVERLAY or not frame.USE_PORTRAIT) and 0 or db.portrait.width
frame.USE_INFO_PANEL = not frame.USE_MINI_POWERBAR and not frame.USE_POWERBAR_OFFSET and db.infoPanel.enable
frame.INFO_PANEL_HEIGHT = frame.USE_INFO_PANEL and db.infoPanel.height or 0
frame.BOTTOM_OFFSET = UF:GetHealthBottomOffset(frame)
end
if db.strataAndLevel and db.strataAndLevel.useCustomStrata then
frame:SetFrameStrata(db.strataAndLevel.frameStrata)
end
if db.strataAndLevel and db.strataAndLevel.useCustomLevel then
frame:SetFrameLevel(db.strataAndLevel.frameLevel)
end
frame.colors = ElvUF.colors
frame:RegisterForClicks(self.db.targetOnMouseDown and 'AnyDown' or 'AnyUp')
frame:Size(frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
_G[frame:GetName()..'Mover']:Size(frame:GetSize())
UF:Configure_InfoPanel(frame)
UF:Configure_HealthBar(frame)
UF:UpdateNameSettings(frame)
UF:Configure_Power(frame)
UF:Configure_PowerPrediction(frame)
UF:Configure_Portrait(frame)
UF:Configure_Threat(frame)
UF:EnableDisable_Auras(frame)
UF:Configure_AllAuras(frame)
UF:Configure_Fader(frame)
UF:Configure_Cutaway(frame)
UF:Configure_CustomTexts(frame)
frame:UpdateAllElements('ElvUI_UpdateAllElements')
end
tinsert(UF.unitstoload, 'pettarget')

View File

@@ -0,0 +1,170 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames')
local _, ns = ...
local ElvUF = ns.oUF
assert(ElvUF, 'ElvUI was unable to locate oUF.')
local _G = _G
local max = max
local tinsert = tinsert
local CreateFrame = CreateFrame
local CastingBarFrame_OnLoad = CastingBarFrame_OnLoad
local CastingBarFrame_SetUnit = CastingBarFrame_SetUnit
local MAX_COMBO_POINTS = MAX_COMBO_POINTS
-- GLOBALS: ElvUF_Target
function UF:Construct_PlayerFrame(frame)
frame.ThreatIndicator = UF:Construct_Threat(frame)
frame.Health = UF:Construct_HealthBar(frame, true, true, 'RIGHT')
frame.Power = UF:Construct_PowerBar(frame, true, true, 'LEFT')
frame.Power.frequentUpdates = true
frame.Name = UF:Construct_NameText(frame)
frame.Portrait3D = UF:Construct_Portrait(frame, 'model')
frame.Portrait2D = UF:Construct_Portrait(frame, 'texture')
frame.Buffs = UF:Construct_Buffs(frame)
frame.Debuffs = UF:Construct_Debuffs(frame)
frame.Castbar = UF:Construct_Castbar(frame, L["Player Castbar"])
--Create a holder frame all 'classbars' can be positioned into
frame.ClassBarHolder = CreateFrame('Frame', nil, frame)
frame.ClassBarHolder:Point('BOTTOM', E.UIParent, 'BOTTOM', 0, 150)
--Combo points was moved to the ClassPower element, so all classes need to have a ClassBar now.
frame.ClassPower = UF:Construct_ClassBar(frame)
frame.ClassBar = 'ClassPower'
--Some classes need another set of different classbars.
if E.myclass == 'DEATHKNIGHT' then
frame.Runes = UF:Construct_DeathKnightResourceBar(frame)
frame.ClassBar = 'Runes'
elseif E.myclass == 'DRUID' then
frame.AdditionalPower = UF:Construct_AdditionalPowerBar(frame)
elseif E.myclass == 'MONK' then
frame.Stagger = UF:Construct_Stagger(frame)
elseif E.myclass == 'PRIEST' then
frame.AdditionalPower = UF:Construct_AdditionalPowerBar(frame)
elseif E.myclass == 'SHAMAN' then
frame.AdditionalPower = UF:Construct_AdditionalPowerBar(frame)
end
frame.PowerPrediction = UF:Construct_PowerPrediction(frame) -- must be AFTER Power & AdditionalPower
frame.MouseGlow = UF:Construct_MouseGlow(frame)
frame.TargetGlow = UF:Construct_TargetGlow(frame)
frame.FocusGlow = UF:Construct_FocusGlow(frame)
frame.RaidTargetIndicator = UF:Construct_RaidIcon(frame)
frame.RaidRoleFramesAnchor = UF:Construct_RaidRoleFrames(frame)
frame.RestingIndicator = UF:Construct_RestingIndicator(frame)
frame.ResurrectIndicator = UF:Construct_ResurrectionIcon(frame)
frame.CombatIndicator = UF:Construct_CombatIndicator(frame)
frame.PartyIndicator = UF:Construct_PartyIndicator(frame)
frame.PvPText = UF:Construct_PvPIndicator(frame)
frame.AuraHighlight = UF:Construct_AuraHighlight(frame)
frame.HealthPrediction = UF:Construct_HealComm(frame)
frame.AuraBars = UF:Construct_AuraBarHeader(frame)
frame.InfoPanel = UF:Construct_InfoPanel(frame)
frame.PvPIndicator = UF:Construct_PvPIcon(frame)
frame.Fader = UF:Construct_Fader()
frame.Cutaway = UF:Construct_Cutaway(frame)
frame.customTexts = {}
frame:Point('BOTTOM', E.UIParent, 'BOTTOM', -342, 139) --Set to default position
E:CreateMover(frame, frame:GetName()..'Mover', L["Player Frame"], nil, nil, nil, 'ALL,SOLO', nil, 'unitframe,individualUnits,player,generalGroup')
frame.unitframeType = 'player'
end
function UF:Update_PlayerFrame(frame, db)
frame.db = db
do
frame.ORIENTATION = db.orientation --allow this value to change when unitframes position changes on screen?
frame.UNIT_WIDTH = db.width
frame.UNIT_HEIGHT = db.infoPanel.enable and (db.height + db.infoPanel.height) or db.height
frame.USE_POWERBAR = db.power.enable
frame.POWERBAR_DETACHED = db.power.detachFromFrame
frame.USE_INSET_POWERBAR = not frame.POWERBAR_DETACHED and db.power.width == 'inset' and frame.USE_POWERBAR
frame.USE_MINI_POWERBAR = (not frame.POWERBAR_DETACHED and db.power.width == 'spaced' and frame.USE_POWERBAR)
frame.USE_POWERBAR_OFFSET = (db.power.width == 'offset' and db.power.offset ~= 0) and frame.USE_POWERBAR and not frame.POWERBAR_DETACHED
frame.POWERBAR_OFFSET = frame.USE_POWERBAR_OFFSET and db.power.offset or 0
frame.POWERBAR_HEIGHT = not frame.USE_POWERBAR and 0 or db.power.height
frame.POWERBAR_WIDTH = frame.USE_MINI_POWERBAR and (frame.UNIT_WIDTH - (UF.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((UF.BORDER+UF.SPACING)*2)))
frame.USE_PORTRAIT = db.portrait and db.portrait.enable
frame.USE_PORTRAIT_OVERLAY = frame.USE_PORTRAIT and (db.portrait.overlay or frame.ORIENTATION == 'MIDDLE')
frame.PORTRAIT_WIDTH = (frame.USE_PORTRAIT_OVERLAY or not frame.USE_PORTRAIT) and 0 or db.portrait.width
frame.CAN_HAVE_CLASSBAR = true --Combo points are in ClassPower now, so all classes need access to ClassBar
frame.MAX_CLASS_BAR = frame.MAX_CLASS_BAR or max(UF.classMaxResourceBar[E.myclass] or 0, MAX_COMBO_POINTS) --only set this initially
frame.USE_CLASSBAR = db.classbar.enable and frame.CAN_HAVE_CLASSBAR
frame.CLASSBAR_SHOWN = frame.CAN_HAVE_CLASSBAR and frame[frame.ClassBar]:IsShown()
frame.CLASSBAR_DETACHED = db.classbar.detachFromFrame
frame.USE_MINI_CLASSBAR = db.classbar.fill == 'spaced' and frame.USE_CLASSBAR
frame.CLASSBAR_HEIGHT = frame.USE_CLASSBAR and db.classbar.height or 0
frame.CLASSBAR_WIDTH = frame.UNIT_WIDTH - frame.PORTRAIT_WIDTH - (frame.ORIENTATION == 'MIDDLE' and (frame.POWERBAR_OFFSET*2) or frame.POWERBAR_OFFSET)
--If formula for frame.CLASSBAR_YOFFSET changes, then remember to update it in classbars.lua too
frame.CLASSBAR_YOFFSET = (not frame.USE_CLASSBAR or not frame.CLASSBAR_SHOWN or frame.CLASSBAR_DETACHED) and 0 or (frame.USE_MINI_CLASSBAR and (UF.SPACING+(frame.CLASSBAR_HEIGHT/2)) or (frame.CLASSBAR_HEIGHT - (UF.BORDER-UF.SPACING)))
frame.USE_INFO_PANEL = not frame.USE_MINI_POWERBAR and not frame.USE_POWERBAR_OFFSET and db.infoPanel.enable
frame.INFO_PANEL_HEIGHT = frame.USE_INFO_PANEL and db.infoPanel.height or 0
frame.BOTTOM_OFFSET = UF:GetHealthBottomOffset(frame)
end
if db.strataAndLevel and db.strataAndLevel.useCustomStrata then
frame:SetFrameStrata(db.strataAndLevel.frameStrata)
end
if db.strataAndLevel and db.strataAndLevel.useCustomLevel then
frame:SetFrameLevel(db.strataAndLevel.frameLevel)
end
frame.colors = ElvUF.colors
frame:RegisterForClicks(self.db.targetOnMouseDown and 'AnyDown' or 'AnyUp')
frame:Size(frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
_G[frame:GetName()..'Mover']:Size(frame:GetSize())
UF:Configure_InfoPanel(frame)
UF:Configure_Threat(frame)
UF:Configure_RestingIndicator(frame)
UF:Configure_CombatIndicator(frame)
UF:Configure_PartyIndicator(frame)
UF:Configure_ClassBar(frame)
UF:Configure_HealthBar(frame)
UF:UpdateNameSettings(frame)
UF:Configure_PVPIndicator(frame)
UF:Configure_Power(frame)
UF:Configure_PowerPrediction(frame)
UF:Configure_Portrait(frame)
UF:EnableDisable_Auras(frame)
UF:Configure_AllAuras(frame)
UF:Configure_ResurrectionIcon(frame)
frame:DisableElement('Castbar')
UF:Configure_Castbar(frame)
if not db.enable and not E.private.unitframe.disabledBlizzardFrames.player then
CastingBarFrame_OnLoad(_G.CastingBarFrame, 'player', true, false)
CastingBarFrame_OnLoad(_G.PetCastingBarFrame)
elseif not db.enable and E.private.unitframe.disabledBlizzardFrames.player or (db.enable and not db.castbar.enable) then
CastingBarFrame_SetUnit(_G.CastingBarFrame, nil)
CastingBarFrame_SetUnit(_G.PetCastingBarFrame, nil)
end
UF:Configure_Fader(frame)
UF:Configure_AuraHighlight(frame)
UF:Configure_RaidIcon(frame)
UF:Configure_HealComm(frame)
UF:Configure_AuraBars(frame)
UF:Configure_PVPIcon(frame)
UF:Configure_RaidRoleIcons(frame)
UF:Configure_Cutaway(frame)
UF:Configure_CustomTexts(frame)
--We need to update Target AuraBars if attached to Player AuraBars
--mainly because of issues when using power offset on player and switching to/from middle orientation
if E.db.unitframe.units.target.aurabar.attachTo == 'PLAYER_AURABARS' and UF.target then
UF:Configure_AuraBars(UF.target)
end
E:SetMoverSnapOffset(frame:GetName()..'Mover', -(12 + db.castbar.height))
frame:UpdateAllElements('ElvUI_UpdateAllElements')
end
tinsert(UF.unitstoload, 'player')

View File

@@ -0,0 +1,120 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames')
local _, ns = ...
local ElvUF = ns.oUF
assert(ElvUF, 'ElvUI was unable to locate oUF.')
local _G = _G
local tinsert = tinsert
local IsAddOnLoaded = IsAddOnLoaded
function UF:Construct_TargetFrame(frame)
frame.Health = UF:Construct_HealthBar(frame, true, true, 'RIGHT')
frame.Power = UF:Construct_PowerBar(frame, true, true, 'LEFT')
frame.Power.frequentUpdates = true
frame.PowerPrediction = UF:Construct_PowerPrediction(frame)
frame.Name = UF:Construct_NameText(frame)
frame.Portrait3D = UF:Construct_Portrait(frame, 'model')
frame.Portrait2D = UF:Construct_Portrait(frame, 'texture')
frame.Buffs = UF:Construct_Buffs(frame)
frame.Debuffs = UF:Construct_Debuffs(frame)
frame.ThreatIndicator = UF:Construct_Threat(frame)
frame.Castbar = UF:Construct_Castbar(frame, L["Target Castbar"])
frame.Castbar.SafeZone = nil
frame.Castbar.LatencyTexture:Hide()
frame.RaidTargetIndicator = UF:Construct_RaidIcon(frame)
frame.HealthPrediction = UF:Construct_HealComm(frame)
frame.AuraHighlight = UF:Construct_AuraHighlight(frame)
frame.InfoPanel = UF:Construct_InfoPanel(frame)
frame.MouseGlow = UF:Construct_MouseGlow(frame)
frame.TargetGlow = UF:Construct_TargetGlow(frame)
frame.FocusGlow = UF:Construct_FocusGlow(frame)
frame.AuraBars = UF:Construct_AuraBarHeader(frame)
frame.PhaseIndicator = UF:Construct_PhaseIcon(frame)
frame.ResurrectIndicator = UF:Construct_ResurrectionIcon(frame)
frame.RaidRoleFramesAnchor = UF:Construct_RaidRoleFrames(frame)
frame.PvPIndicator = UF:Construct_PvPIcon(frame)
frame.Fader = UF:Construct_Fader()
frame.Cutaway = UF:Construct_Cutaway(frame)
frame.CombatIndicator = UF:Construct_CombatIndicator(frame)
frame.customTexts = {}
frame:Point('BOTTOM', E.UIParent, 'BOTTOM', 342, 139)
E:CreateMover(frame, frame:GetName()..'Mover', L["Target Frame"], nil, nil, nil, 'ALL,SOLO', nil, 'unitframe,individualUnits,target,generalGroup')
frame.unitframeType = 'target'
end
function UF:Update_TargetFrame(frame, db)
frame.db = db
do
frame.ORIENTATION = db.orientation --allow this value to change when unitframes position changes on screen?
frame.UNIT_WIDTH = db.width
frame.UNIT_HEIGHT = db.infoPanel.enable and (db.height + db.infoPanel.height) or db.height
frame.USE_POWERBAR = db.power.enable
frame.POWERBAR_DETACHED = db.power.detachFromFrame
frame.USE_INSET_POWERBAR = not frame.POWERBAR_DETACHED and db.power.width == 'inset' and frame.USE_POWERBAR
frame.USE_MINI_POWERBAR = (not frame.POWERBAR_DETACHED and db.power.width == 'spaced' and frame.USE_POWERBAR)
frame.USE_POWERBAR_OFFSET = (db.power.width == 'offset' and db.power.offset ~= 0) and frame.USE_POWERBAR and not frame.POWERBAR_DETACHED
frame.POWERBAR_OFFSET = frame.USE_POWERBAR_OFFSET and db.power.offset or 0
frame.POWERBAR_HEIGHT = not frame.USE_POWERBAR and 0 or db.power.height
frame.POWERBAR_WIDTH = frame.USE_MINI_POWERBAR and (frame.UNIT_WIDTH - (UF.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((UF.BORDER+UF.SPACING)*2)))
frame.USE_PORTRAIT = db.portrait and db.portrait.enable
frame.USE_PORTRAIT_OVERLAY = frame.USE_PORTRAIT and (db.portrait.overlay or frame.ORIENTATION == 'MIDDLE')
frame.PORTRAIT_WIDTH = (frame.USE_PORTRAIT_OVERLAY or not frame.USE_PORTRAIT) and 0 or db.portrait.width
frame.USE_INFO_PANEL = not frame.USE_MINI_POWERBAR and not frame.USE_POWERBAR_OFFSET and db.infoPanel.enable
frame.INFO_PANEL_HEIGHT = frame.USE_INFO_PANEL and db.infoPanel.height or 0
frame.BOTTOM_OFFSET = UF:GetHealthBottomOffset(frame)
end
if db.strataAndLevel and db.strataAndLevel.useCustomStrata then
frame:SetFrameStrata(db.strataAndLevel.frameStrata)
end
if db.strataAndLevel and db.strataAndLevel.useCustomLevel then
frame:SetFrameLevel(db.strataAndLevel.frameLevel)
end
frame.colors = ElvUF.colors
frame:RegisterForClicks(self.db.targetOnMouseDown and 'AnyDown' or 'AnyUp')
frame:Size(frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
_G[frame:GetName()..'Mover']:Size(frame:GetSize())
if not IsAddOnLoaded('Clique') then
if db.middleClickFocus then
frame:SetAttribute('type3', 'focus')
elseif frame:GetAttribute('type3') == 'focus' then
frame:SetAttribute('type3', nil)
end
end
UF:Configure_InfoPanel(frame)
UF:Configure_HealthBar(frame)
UF:UpdateNameSettings(frame)
UF:Configure_Power(frame)
UF:Configure_PowerPrediction(frame)
UF:Configure_Portrait(frame)
UF:Configure_Threat(frame)
UF:EnableDisable_Auras(frame)
UF:Configure_AllAuras(frame)
UF:Configure_ResurrectionIcon(frame)
UF:Configure_RaidRoleIcons(frame)
UF:Configure_Castbar(frame)
UF:Configure_Fader(frame)
UF:Configure_AuraHighlight(frame)
UF:Configure_HealComm(frame)
UF:Configure_RaidIcon(frame)
UF:Configure_AuraBars(frame)
UF:Configure_PhaseIcon(frame)
UF:Configure_PVPIcon(frame)
UF:Configure_Cutaway(frame)
UF:Configure_CustomTexts(frame)
UF:Configure_CombatIndicator(frame)
E:SetMoverSnapOffset(frame:GetName()..'Mover', -(12 + db.castbar.height))
frame:UpdateAllElements('ElvUI_UpdateAllElements')
end
tinsert(UF.unitstoload, 'target')

View File

@@ -0,0 +1,90 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames')
local _, ns = ...
local ElvUF = ns.oUF
assert(ElvUF, 'ElvUI was unable to locate oUF.')
local _G = _G
local tinsert = tinsert
function UF:Construct_TargetTargetFrame(frame)
frame.Health = UF:Construct_HealthBar(frame, true, true, 'RIGHT')
frame.Power = UF:Construct_PowerBar(frame, true, true, 'LEFT')
frame.PowerPrediction = UF:Construct_PowerPrediction(frame)
frame.Name = UF:Construct_NameText(frame)
frame.Portrait3D = UF:Construct_Portrait(frame, 'model')
frame.Portrait2D = UF:Construct_Portrait(frame, 'texture')
frame.Buffs = UF:Construct_Buffs(frame)
frame.RaidTargetIndicator = UF:Construct_RaidIcon(frame)
frame.Debuffs = UF:Construct_Debuffs(frame)
frame.ThreatIndicator = UF:Construct_Threat(frame)
frame.InfoPanel = UF:Construct_InfoPanel(frame)
frame.MouseGlow = UF:Construct_MouseGlow(frame)
frame.TargetGlow = UF:Construct_TargetGlow(frame)
frame.FocusGlow = UF:Construct_FocusGlow(frame)
frame.Fader = UF:Construct_Fader()
frame.Cutaway = UF:Construct_Cutaway(frame)
frame.customTexts = {}
frame:Point('BOTTOM', E.UIParent, 'BOTTOM', 342, 100) --Set to default position
E:CreateMover(frame, frame:GetName()..'Mover', L["TargetTarget Frame"], nil, nil, nil, 'ALL,SOLO', nil, 'unitframe,individualUnits,targettarget,generalGroup')
frame.unitframeType = 'targettarget'
end
function UF:Update_TargetTargetFrame(frame, db)
frame.db = db
do
frame.ORIENTATION = db.orientation --allow this value to change when unitframes position changes on screen?
frame.UNIT_WIDTH = db.width
frame.UNIT_HEIGHT = db.infoPanel.enable and (db.height + db.infoPanel.height) or db.height
frame.USE_POWERBAR = db.power.enable
frame.POWERBAR_DETACHED = db.power.detachFromFrame
frame.USE_INSET_POWERBAR = not frame.POWERBAR_DETACHED and db.power.width == 'inset' and frame.USE_POWERBAR
frame.USE_MINI_POWERBAR = (not frame.POWERBAR_DETACHED and db.power.width == 'spaced' and frame.USE_POWERBAR)
frame.USE_POWERBAR_OFFSET = (db.power.width == 'offset' and db.power.offset ~= 0) and frame.USE_POWERBAR and not frame.POWERBAR_DETACHED
frame.POWERBAR_OFFSET = frame.USE_POWERBAR_OFFSET and db.power.offset or 0
frame.POWERBAR_HEIGHT = not frame.USE_POWERBAR and 0 or db.power.height
frame.POWERBAR_WIDTH = frame.USE_MINI_POWERBAR and (frame.UNIT_WIDTH - (UF.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((UF.BORDER+UF.SPACING)*2)))
frame.USE_PORTRAIT = db.portrait and db.portrait.enable
frame.USE_PORTRAIT_OVERLAY = frame.USE_PORTRAIT and (db.portrait.overlay or frame.ORIENTATION == 'MIDDLE')
frame.PORTRAIT_WIDTH = (frame.USE_PORTRAIT_OVERLAY or not frame.USE_PORTRAIT) and 0 or db.portrait.width
frame.USE_INFO_PANEL = not frame.USE_MINI_POWERBAR and not frame.USE_POWERBAR_OFFSET and db.infoPanel.enable
frame.INFO_PANEL_HEIGHT = frame.USE_INFO_PANEL and db.infoPanel.height or 0
frame.BOTTOM_OFFSET = UF:GetHealthBottomOffset(frame)
end
if db.strataAndLevel and db.strataAndLevel.useCustomStrata then
frame:SetFrameStrata(db.strataAndLevel.frameStrata)
end
if db.strataAndLevel and db.strataAndLevel.useCustomLevel then
frame:SetFrameLevel(db.strataAndLevel.frameLevel)
end
frame.colors = ElvUF.colors
frame:RegisterForClicks(self.db.targetOnMouseDown and 'AnyDown' or 'AnyUp')
frame:Size(frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
_G[frame:GetName()..'Mover']:Size(frame:GetSize())
UF:Configure_InfoPanel(frame)
UF:Configure_HealthBar(frame)
UF:UpdateNameSettings(frame)
UF:Configure_Power(frame)
UF:Configure_PowerPrediction(frame)
UF:Configure_Portrait(frame)
UF:Configure_Threat(frame)
UF:EnableDisable_Auras(frame)
UF:Configure_AllAuras(frame)
UF:Configure_Fader(frame)
UF:Configure_RaidIcon(frame)
UF:Configure_Cutaway(frame)
UF:Configure_CustomTexts(frame)
E:SetMoverSnapOffset(frame:GetName()..'Mover', -(12 + self.db.units.player.castbar.height))
frame:UpdateAllElements('ElvUI_UpdateAllElements')
end
tinsert(UF.unitstoload, 'targettarget')

View File

@@ -0,0 +1,90 @@
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames')
local _, ns = ...
local ElvUF = ns.oUF
assert(ElvUF, 'ElvUI was unable to locate oUF.')
local _G = _G
local tinsert = tinsert
function UF:Construct_TargetTargetTargetFrame(frame)
frame.Health = UF:Construct_HealthBar(frame, true, true, 'RIGHT')
frame.Power = UF:Construct_PowerBar(frame, true, true, 'LEFT')
frame.PowerPrediction = UF:Construct_PowerPrediction(frame)
frame.Name = UF:Construct_NameText(frame)
frame.Portrait3D = UF:Construct_Portrait(frame, 'model')
frame.Portrait2D = UF:Construct_Portrait(frame, 'texture')
frame.Buffs = UF:Construct_Buffs(frame)
frame.RaidTargetIndicator = UF:Construct_RaidIcon(frame)
frame.Debuffs = UF:Construct_Debuffs(frame)
frame.ThreatIndicator = UF:Construct_Threat(frame)
frame.InfoPanel = UF:Construct_InfoPanel(frame)
frame.MouseGlow = UF:Construct_MouseGlow(frame)
frame.TargetGlow = UF:Construct_TargetGlow(frame)
frame.FocusGlow = UF:Construct_FocusGlow(frame)
frame.Fader = UF:Construct_Fader()
frame.Cutaway = UF:Construct_Cutaway(frame)
frame.customTexts = {}
frame:Point('BOTTOM', E.UIParent, 'BOTTOM', 0, 160) --Set to default position
E:CreateMover(frame, frame:GetName()..'Mover', L["TargetTargetTarget Frame"], nil, nil, nil, 'ALL,SOLO', nil, 'unitframe,individualUnits,targettargettarget,generalGroup')
frame.unitframeType = 'targettargettarget'
end
function UF:Update_TargetTargetTargetFrame(frame, db)
frame.db = db
do
frame.ORIENTATION = db.orientation --allow this value to change when unitframes position changes on screen?
frame.UNIT_WIDTH = db.width
frame.UNIT_HEIGHT = db.infoPanel.enable and (db.height + db.infoPanel.height) or db.height
frame.USE_POWERBAR = db.power.enable
frame.POWERBAR_DETACHED = db.power.detachFromFrame
frame.USE_INSET_POWERBAR = not frame.POWERBAR_DETACHED and db.power.width == 'inset' and frame.USE_POWERBAR
frame.USE_MINI_POWERBAR = (not frame.POWERBAR_DETACHED and db.power.width == 'spaced' and frame.USE_POWERBAR)
frame.USE_POWERBAR_OFFSET = (db.power.width == 'offset' and db.power.offset ~= 0) and frame.USE_POWERBAR and not frame.POWERBAR_DETACHED
frame.POWERBAR_OFFSET = frame.USE_POWERBAR_OFFSET and db.power.offset or 0
frame.POWERBAR_HEIGHT = not frame.USE_POWERBAR and 0 or db.power.height
frame.POWERBAR_WIDTH = frame.USE_MINI_POWERBAR and (frame.UNIT_WIDTH - (UF.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((UF.BORDER+UF.SPACING)*2)))
frame.USE_PORTRAIT = db.portrait and db.portrait.enable
frame.USE_PORTRAIT_OVERLAY = frame.USE_PORTRAIT and (db.portrait.overlay or frame.ORIENTATION == 'MIDDLE')
frame.PORTRAIT_WIDTH = (frame.USE_PORTRAIT_OVERLAY or not frame.USE_PORTRAIT) and 0 or db.portrait.width
frame.USE_INFO_PANEL = not frame.USE_MINI_POWERBAR and not frame.USE_POWERBAR_OFFSET and db.infoPanel.enable
frame.INFO_PANEL_HEIGHT = frame.USE_INFO_PANEL and db.infoPanel.height or 0
frame.BOTTOM_OFFSET = UF:GetHealthBottomOffset(frame)
end
if db.strataAndLevel and db.strataAndLevel.useCustomStrata then
frame:SetFrameStrata(db.strataAndLevel.frameStrata)
end
if db.strataAndLevel and db.strataAndLevel.useCustomLevel then
frame:SetFrameLevel(db.strataAndLevel.frameLevel)
end
frame.colors = ElvUF.colors
frame:RegisterForClicks(self.db.targetOnMouseDown and 'AnyDown' or 'AnyUp')
frame:Size(frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
_G[frame:GetName()..'Mover']:Size(frame:GetSize())
UF:Configure_InfoPanel(frame)
UF:Configure_HealthBar(frame)
UF:UpdateNameSettings(frame)
UF:Configure_Power(frame)
UF:Configure_PowerPrediction(frame)
UF:Configure_Portrait(frame)
UF:Configure_Threat(frame)
UF:EnableDisable_Auras(frame)
UF:Configure_AllAuras(frame)
UF:Configure_Fader(frame)
UF:Configure_RaidIcon(frame)
UF:Configure_Cutaway(frame)
UF:Configure_CustomTexts(frame)
E:SetMoverSnapOffset(frame:GetName()..'Mover', -(12 + self.db.units.player.castbar.height))
frame:UpdateAllElements('ElvUI_UpdateAllElements')
end
tinsert(UF.unitstoload, 'targettargettarget')