init
This commit is contained in:
@@ -0,0 +1,315 @@
|
||||
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
|
||||
|
||||
--Lua functions
|
||||
local _G = _G
|
||||
local setmetatable, getfenv, setfenv = setmetatable, getfenv, setfenv
|
||||
local type, unpack, select, pairs = type, unpack, select, pairs
|
||||
local min, random = math.min, math.random
|
||||
local find, format = string.find, string.format
|
||||
--WoW API / Variables
|
||||
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 attributeBlacklist = {["showRaid"] = true, ["showParty"] = true, ["showSolo"] = true}
|
||||
local configEnv
|
||||
local originalEnvs = {}
|
||||
local overrideFuncs = {}
|
||||
|
||||
local function createConfigEnv()
|
||||
if configEnv then return end
|
||||
configEnv = setmetatable({
|
||||
UnitPower = function (unit, displayType)
|
||||
if find(unit, "target") or find(unit, "focus") then
|
||||
return UnitPower(unit, displayType)
|
||||
end
|
||||
|
||||
return random(1, UnitPowerMax(unit, displayType) or 1)
|
||||
end,
|
||||
UnitHealth = function(unit)
|
||||
if find(unit, "target") or find(unit, "focus") then
|
||||
return UnitHealth(unit)
|
||||
end
|
||||
|
||||
return random(1, UnitHealthMax(unit))
|
||||
end,
|
||||
UnitName = function(unit)
|
||||
if find(unit, "target") or find(unit, "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 find(unit, "target") or find(unit, "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"]
|
||||
|
||||
overrideFuncs["energycolor"] = ElvUF.Tags.Methods["energycolor"]
|
||||
overrideFuncs["energy:current"] = ElvUF.Tags.Methods["energy:current"]
|
||||
overrideFuncs["energy:deficit"] = ElvUF.Tags.Methods["energy:deficit"]
|
||||
overrideFuncs["energy:current-percent"] = ElvUF.Tags.Methods["energy:current-percent"]
|
||||
overrideFuncs["energy:current-max"] = ElvUF.Tags.Methods["energy:current-max"]
|
||||
overrideFuncs["energy:current-max-percent"] = ElvUF.Tags.Methods["energy:current-max-percent"]
|
||||
overrideFuncs["energy:max"] = ElvUF.Tags.Methods["energy:max"]
|
||||
overrideFuncs["energy:percent"] = ElvUF.Tags.Methods["energy:percent"]
|
||||
|
||||
overrideFuncs["ragecolor"] = ElvUF.Tags.Methods["ragecolor"]
|
||||
overrideFuncs["rage:current"] = ElvUF.Tags.Methods["rage:current"]
|
||||
overrideFuncs["rage:deficit"] = ElvUF.Tags.Methods["rage:deficit"]
|
||||
overrideFuncs["rage:current-percent"] = ElvUF.Tags.Methods["rage:current-percent"]
|
||||
overrideFuncs["rage:current-max"] = ElvUF.Tags.Methods["rage:current-max"]
|
||||
overrideFuncs["rage:current-max-percent"] = ElvUF.Tags.Methods["rage:current-max-percent"]
|
||||
overrideFuncs["rage:max"] = ElvUF.Tags.Methods["rage:max"]
|
||||
overrideFuncs["rage:percent"] = ElvUF.Tags.Methods["rage: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: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)
|
||||
|
||||
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:RegisterForClicks(nil)
|
||||
frame:SetID(i)
|
||||
self:ForceShow(frame)
|
||||
end
|
||||
end
|
||||
|
||||
function UF:UnshowChildUnits(header, ...)
|
||||
header.isForced = nil
|
||||
|
||||
for i = 1, select("#", ...) do
|
||||
local frame = select(i, ...)
|
||||
frame:RegisterForClicks(self.db.targetOnMouseDown and "AnyDown" or "AnyUp")
|
||||
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
|
||||
if self["arena"..i] and self["arena"..i].isForced then
|
||||
self:UnforceShow(self["arena"..i])
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, 4 do
|
||||
if self["boss"..i] and self["boss"..i].isForced then
|
||||
self:UnforceShow(self["boss"..i])
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, 4 do
|
||||
if self["party"..i] and self["party"..i].isForced then
|
||||
self:UnforceShow(self["party"..i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
UF:RegisterEvent("PLAYER_REGEN_DISABLED")
|
||||
@@ -0,0 +1,280 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
local tostring, select = tostring, select
|
||||
local format, strmatch, strsplit = string.format, strmatch, strsplit
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
local IsShiftKeyDown = IsShiftKeyDown
|
||||
local IsAltKeyDown = IsAltKeyDown
|
||||
local IsControlKeyDown = IsControlKeyDown
|
||||
local UnitIsFriend = UnitIsFriend
|
||||
local UnitIsUnit = UnitIsUnit
|
||||
local UnitCanAttack = UnitCanAttack
|
||||
|
||||
local function OnClick(self)
|
||||
local mod = E.db.unitframe.auraBlacklistModifier
|
||||
if mod == "NONE" or not ((mod == "SHIFT" and IsShiftKeyDown()) or (mod == "ALT" and IsAltKeyDown()) or (mod == "CTRL" and IsControlKeyDown())) then return end
|
||||
local auraName = self:GetParent().aura.name
|
||||
|
||||
if auraName then
|
||||
E:Print(format(L["The spell '%s' has been added to the Blacklist unitframe aura filter."], auraName))
|
||||
E.global.unitframe.aurafilters.Blacklist.spells[auraName] = {enable = true, priority = 0}
|
||||
UF:Update_AllFrames()
|
||||
end
|
||||
end
|
||||
|
||||
function UF:Construct_AuraBars()
|
||||
local bar = self.statusBar
|
||||
|
||||
self:SetTemplate(nil, nil, nil, UF.thinBorders, true)
|
||||
local inset = UF.thinBorders and E.mult or nil
|
||||
bar:SetInside(self, inset, inset)
|
||||
UF.statusbars[bar] = true
|
||||
UF:Update_StatusBar(bar)
|
||||
|
||||
UF:Configure_FontString(bar.spelltime)
|
||||
UF:Configure_FontString(bar.spellname)
|
||||
UF:Update_FontString(bar.spelltime)
|
||||
UF:Update_FontString(bar.spellname)
|
||||
|
||||
bar.spellname:ClearAllPoints()
|
||||
bar.spellname:Point("LEFT", bar, "LEFT", 2, 0)
|
||||
bar.spellname:Point("RIGHT", bar.spelltime, "LEFT", -4, 0)
|
||||
bar.spellname:SetWordWrap(false)
|
||||
|
||||
bar.iconHolder:SetTemplate(nil, nil, nil, UF.thinBorders, true)
|
||||
bar.icon:SetInside(bar.iconHolder, inset, inset)
|
||||
bar.icon:SetDrawLayer("OVERLAY")
|
||||
|
||||
bar.bg = bar:CreateTexture(nil, "BORDER")
|
||||
bar.bg:Show()
|
||||
|
||||
bar.iconHolder:RegisterForClicks("RightButtonUp")
|
||||
bar.iconHolder:SetScript("OnClick", OnClick)
|
||||
end
|
||||
|
||||
function UF:Construct_AuraBarHeader(frame)
|
||||
local auraBar = CreateFrame("Frame", nil, frame)
|
||||
auraBar:SetFrameLevel(frame.RaisedElementParent:GetFrameLevel() + 10) --Make them appear above any text element
|
||||
auraBar.PostCreateBar = UF.Construct_AuraBars
|
||||
auraBar.gap = (-frame.BORDER + frame.SPACING*3)
|
||||
auraBar.spacing = (-frame.BORDER + frame.SPACING*3)
|
||||
auraBar.spark = true
|
||||
auraBar.filter = UF.AuraBarFilter
|
||||
auraBar.PostUpdate = UF.ColorizeAuraBars
|
||||
|
||||
return auraBar
|
||||
end
|
||||
|
||||
function UF:Configure_AuraBars(frame)
|
||||
if not frame.VARIABLES_SET then return end
|
||||
|
||||
local auraBars = frame.AuraBars
|
||||
local db = frame.db
|
||||
if db.aurabar.enable then
|
||||
if not frame:IsElementEnabled("AuraBars") then
|
||||
frame:EnableElement("AuraBars")
|
||||
end
|
||||
auraBars:Show()
|
||||
auraBars.friendlyAuraType = db.aurabar.friendlyAuraType
|
||||
auraBars.enemyAuraType = db.aurabar.enemyAuraType
|
||||
auraBars.scaleTime = db.aurabar.uniformThreshold
|
||||
|
||||
local buffColor = self.db.colors.auraBarBuff
|
||||
local debuffColor = self.db.colors.auraBarDebuff
|
||||
local attachTo = frame
|
||||
|
||||
if db.aurabar.attachTo == "BUFFS" then
|
||||
attachTo = frame.Buffs
|
||||
elseif db.aurabar.attachTo == "DEBUFFS" then
|
||||
attachTo = frame.Debuffs
|
||||
elseif db.aurabar.attachTo == "PLAYER_AURABARS" and ElvUF_Player then
|
||||
attachTo = ElvUF_Player.AuraBars
|
||||
end
|
||||
|
||||
local anchorPoint, anchorTo = "BOTTOM", "TOP"
|
||||
if db.aurabar.anchorPoint == "BELOW" then
|
||||
anchorPoint, anchorTo = "TOP", "BOTTOM"
|
||||
end
|
||||
|
||||
local yOffset
|
||||
local spacing = (((db.aurabar.attachTo == "FRAME" and 3) or (db.aurabar.attachTo == "PLAYER_AURABARS" and 4) or 2) * frame.SPACING)
|
||||
local border = (((db.aurabar.attachTo == "FRAME" or db.aurabar.attachTo == "PLAYER_AURABARS") and 2 or 1) * frame.BORDER)
|
||||
|
||||
if db.aurabar.anchorPoint == "BELOW" then
|
||||
yOffset = -spacing + border - (not db.aurabar.yOffset and 0 or db.aurabar.yOffset)
|
||||
else
|
||||
yOffset = spacing - border + (not db.aurabar.yOffset and 0 or db.aurabar.yOffset)
|
||||
end
|
||||
|
||||
local xOffset = (db.aurabar.attachTo == "FRAME" and frame.SPACING or 0)
|
||||
local offsetLeft = xOffset + ((db.aurabar.attachTo == "FRAME" and ((anchorTo == "TOP" and frame.ORIENTATION ~= "LEFT") or (anchorTo == "BOTTOM" and frame.ORIENTATION == "LEFT"))) and frame.POWERBAR_OFFSET or 0)
|
||||
local offsetRight = -xOffset - ((db.aurabar.attachTo == "FRAME" and ((anchorTo == "TOP" and frame.ORIENTATION ~= "RIGHT") or (anchorTo == "BOTTOM" and frame.ORIENTATION == "RIGHT"))) and frame.POWERBAR_OFFSET or 0)
|
||||
|
||||
auraBars.auraBarHeight = db.aurabar.height
|
||||
auraBars:ClearAllPoints()
|
||||
auraBars:Point(anchorPoint.."LEFT", attachTo, anchorTo.."LEFT", offsetLeft, yOffset)
|
||||
auraBars:Point(anchorPoint.."RIGHT", attachTo, anchorTo.."RIGHT", offsetRight, yOffset)
|
||||
auraBars.buffColor = {buffColor.r, buffColor.g, buffColor.b}
|
||||
if UF.db.colors.auraBarByType then
|
||||
auraBars.debuffColor = nil
|
||||
auraBars.defaultDebuffColor = {debuffColor.r, debuffColor.g, debuffColor.b}
|
||||
else
|
||||
auraBars.debuffColor = {debuffColor.r, debuffColor.g, debuffColor.b}
|
||||
auraBars.defaultDebuffColor = nil
|
||||
end
|
||||
auraBars.down = db.aurabar.anchorPoint == "BELOW"
|
||||
|
||||
if db.aurabar.sort == "TIME_REMAINING" then
|
||||
auraBars.sort = true --default function
|
||||
elseif db.aurabar.sort == "TIME_REMAINING_REVERSE" then
|
||||
auraBars.sort = self.SortAuraBarReverse
|
||||
elseif db.aurabar.sort == "TIME_DURATION" then
|
||||
auraBars.sort = self.SortAuraBarDuration
|
||||
elseif db.aurabar.sort == "TIME_DURATION_REVERSE" then
|
||||
auraBars.sort = self.SortAuraBarDurationReverse
|
||||
elseif db.aurabar.sort == "NAME" then
|
||||
auraBars.sort = self.SortAuraBarName
|
||||
else
|
||||
auraBars.sort = nil
|
||||
end
|
||||
|
||||
auraBars.maxBars = db.aurabar.maxBars
|
||||
auraBars.forceShow = frame.forceShowAuras
|
||||
auraBars.spacing = ((-frame.BORDER + frame.SPACING*3) + db.aurabar.spacing)
|
||||
auraBars:SetAnchors()
|
||||
else
|
||||
if frame:IsElementEnabled("AuraBars") then
|
||||
frame:DisableElement("AuraBars")
|
||||
auraBars:Hide()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local huge = math.huge
|
||||
function UF.SortAuraBarReverse(a, b)
|
||||
local compa, compb = a.noTime and huge or a.expirationTime, b.noTime and huge or b.expirationTime
|
||||
return compa < compb
|
||||
end
|
||||
|
||||
function UF.SortAuraBarDuration(a, b)
|
||||
local compa, compb = a.noTime and huge or a.duration, b.noTime and huge or b.duration
|
||||
return compa > compb
|
||||
end
|
||||
|
||||
function UF.SortAuraBarDurationReverse(a, b)
|
||||
local compa, compb = a.noTime and huge or a.duration, b.noTime and huge or b.duration
|
||||
return compa < compb
|
||||
end
|
||||
|
||||
function UF.SortAuraBarName(a, b)
|
||||
return a.name > b.name
|
||||
end
|
||||
|
||||
function UF:CheckFilter(name, caster, spellID, isFriend, isPlayer, isUnit, allowDuration, noDuration, canDispell, ...)
|
||||
for i = 1, select("#", ...) do
|
||||
local filterName = select(i, ...)
|
||||
local friendCheck = (isFriend and strmatch(filterName, "^Friendly:([^,]*)")) or (not isFriend and strmatch(filterName, "^Enemy:([^,]*)")) or nil
|
||||
if friendCheck ~= false then
|
||||
if friendCheck ~= nil and (G.unitframe.specialFilters[friendCheck] or E.global.unitframe.aurafilters[friendCheck]) then
|
||||
filterName = friendCheck -- this is for our filters to handle Friendly and Enemy
|
||||
end
|
||||
local filter = E.global.unitframe.aurafilters[filterName]
|
||||
if filter then
|
||||
local filterType = filter.type
|
||||
local spellList = filter.spells
|
||||
local spell = spellList and (spellList[spellID] or spellList[name])
|
||||
|
||||
if filterType and (filterType == "Whitelist") and (spell and spell.enable) and allowDuration then
|
||||
return true, spell.priority -- this is the only difference from auarbars code
|
||||
elseif filterType and (filterType == "Blacklist") and (spell and spell.enable) then
|
||||
return false
|
||||
end
|
||||
elseif filterName == "Personal" and isPlayer and allowDuration then
|
||||
return true
|
||||
elseif filterName == "nonPersonal" and (not isPlayer) and allowDuration then
|
||||
return true
|
||||
elseif filterName == "CastByUnit" and (caster and isUnit) and allowDuration then
|
||||
return true
|
||||
elseif filterName == "notCastByUnit" and (caster and not isUnit) and allowDuration then
|
||||
return true
|
||||
elseif filterName == "Dispellable" and canDispell and allowDuration then
|
||||
return true
|
||||
elseif filterName == "notDispellable" and (not canDispell) and allowDuration then
|
||||
return true
|
||||
elseif filterName == "blockNoDuration" and noDuration then
|
||||
return false
|
||||
elseif filterName == "blockNonPersonal" and (not isPlayer) then
|
||||
return false
|
||||
elseif filterName == "blockDispellable" and canDispell then
|
||||
return false
|
||||
elseif filterName == "blockNotDispellable" and (not canDispell) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function UF:AuraBarFilter(unit, name, _, _, _, debuffType, duration, _, unitCaster, isStealable, _, spellID)
|
||||
if not self.db then return end
|
||||
local db = self.db.aurabar
|
||||
|
||||
if not name then return nil end
|
||||
local filterCheck, isUnit, isFriend, isPlayer, canDispell, allowDuration, noDuration
|
||||
|
||||
if db.priority ~= "" then
|
||||
noDuration = (not duration or duration == 0)
|
||||
isFriend = unit and UnitIsFriend("player", unit) and not UnitCanAttack("player", unit)
|
||||
isPlayer = (unitCaster == "player" or unitCaster == "vehicle")
|
||||
isUnit = unit and unitCaster and UnitIsUnit(unit, unitCaster)
|
||||
canDispell = (self.type == "Buffs" and isStealable) or (self.type == "Debuffs" and debuffType)
|
||||
allowDuration = noDuration or (duration and (duration > 0) and (db.maxDuration == 0 or duration <= db.maxDuration) and (db.minDuration == 0 or duration >= db.minDuration))
|
||||
filterCheck = UF:CheckFilter(name, unitCaster, spellID, isFriend, isPlayer, isUnit, allowDuration, noDuration, canDispell, strsplit(",", db.priority))
|
||||
else
|
||||
filterCheck = true -- Allow all auras to be shown when the filter list is empty
|
||||
end
|
||||
|
||||
return filterCheck
|
||||
end
|
||||
|
||||
function UF:ColorizeAuraBars()
|
||||
local bars = self.bars
|
||||
for index = 1, #bars do
|
||||
local frame = bars[index]
|
||||
if not frame:IsVisible() then break end
|
||||
|
||||
local sb = frame.statusBar
|
||||
local spellName = sb.aura.name
|
||||
local spellID = sb.aura.spellID
|
||||
local colors = E.global.unitframe.AuraBarColors[spellID] or E.global.unitframe.AuraBarColors[tostring(spellID)] or E.global.unitframe.AuraBarColors[spellName]
|
||||
|
||||
sb.custom_backdrop = UF.db.colors.customaurabarbackdrop and UF.db.colors.aurabar_backdrop
|
||||
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 then
|
||||
colors = E.db.unitframe.colors.auraBarTurtleColor
|
||||
end
|
||||
|
||||
if sb.bg then
|
||||
if (UF.db.colors.transparentAurabars and not sb.isTransparent) or (sb.isTransparent and (not UF.db.colors.transparentAurabars or sb.invertColors ~= UF.db.colors.invertAurabars)) then
|
||||
UF:ToggleTransparentStatusBar(UF.db.colors.transparentAurabars, sb, sb.bg, nil, UF.db.colors.invertAurabars)
|
||||
else
|
||||
local sbTexture = sb:GetStatusBarTexture()
|
||||
if not sb.bg:GetTexture() then UF:Update_StatusBar(sb.bg, sbTexture:GetTexture()) end
|
||||
|
||||
UF:SetStatusBarBackdropPoints(sb, sbTexture, sb.bg)
|
||||
end
|
||||
end
|
||||
|
||||
if colors then
|
||||
sb:SetStatusBarColor(colors.r, colors.g, colors.b)
|
||||
|
||||
if not sb.hookedColor then
|
||||
UF.UpdateBackdropTextureColor(sb, colors.r, colors.g, colors.b)
|
||||
end
|
||||
else
|
||||
local r, g, b = sb:GetStatusBarColor()
|
||||
UF.UpdateBackdropTextureColor(sb, r, g, b)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,529 @@
|
||||
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
|
||||
|
||||
--Lua functions
|
||||
local unpack = unpack
|
||||
local ceil = math.ceil
|
||||
local find, format, split = string.find, string.format, string.split
|
||||
local sort = table.sort
|
||||
--WoW API / Variables
|
||||
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", frame:GetName().."Buffs", frame)
|
||||
buffs.spacing = E.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", frame:GetName().."Debuffs", frame)
|
||||
debuffs.spacing = E.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
|
||||
|
||||
local function OnClick(btn)
|
||||
local mod = E.db.unitframe.auraBlacklistModifier
|
||||
if mod == "NONE" or not ((mod == "SHIFT" and IsShiftKeyDown()) or (mod == "ALT" and IsAltKeyDown()) or (mod == "CTRL" and IsControlKeyDown())) then return end
|
||||
local auraName = btn.name
|
||||
|
||||
if auraName then
|
||||
E:Print(format(L["The spell '%s' has been added to the Blacklist unitframe aura filter."], auraName))
|
||||
E.global.unitframe.aurafilters.Blacklist.spells[btn.spellID] = {enable = true, priority = 0}
|
||||
|
||||
UF:Update_AllFrames()
|
||||
end
|
||||
end
|
||||
|
||||
function UF:Construct_AuraIcon(button)
|
||||
local offset = UF.thinBorders and E.mult or E.Border
|
||||
button:SetTemplate(nil, nil, nil, UF.thinBorders, true)
|
||||
|
||||
button.cd.noOCC = true
|
||||
button.cd.noCooldownCount = true
|
||||
button.cd:SetReverse(true)
|
||||
button.cd:SetInside(button, offset, offset)
|
||||
|
||||
button.icon:SetInside(button, offset, offset)
|
||||
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", 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
|
||||
else
|
||||
if frame:IsElementEnabled("Auras") then
|
||||
frame:DisableElement("Auras")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function ReverseUpdate(frame)
|
||||
UF:Configure_Auras(frame, "Debuffs")
|
||||
UF:Configure_Auras(frame, "Buffs")
|
||||
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 = find(point, "BOTTOM"), find(point, "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_Auras(frame, auraType)
|
||||
if not frame.VARIABLES_SET then return end
|
||||
|
||||
local db = frame.db
|
||||
local auras = frame[auraType]
|
||||
auraType = string.lower(auraType)
|
||||
auras.db = db[auraType]
|
||||
|
||||
local rows = auras.db.numrows
|
||||
auras.forceShow = frame.forceShowAuras
|
||||
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.disableMouse = auras.db.clickThrough
|
||||
|
||||
if auras.db.sizeOverride and auras.db.sizeOverride > 0 then
|
||||
auras:Width(auras.db.perrow * auras.db.sizeOverride)
|
||||
else
|
||||
local totalWidth = frame.UNIT_WIDTH - frame.SPACING*2
|
||||
if frame.USE_POWERBAR_OFFSET then
|
||||
if not (auras.db.attachTo == "POWER" and frame.ORIENTATION == "MIDDLE") then
|
||||
local powerOffset = ((frame.ORIENTATION == "MIDDLE" and 2 or 1) * frame.POWERBAR_OFFSET)
|
||||
totalWidth = totalWidth - powerOffset
|
||||
end
|
||||
end
|
||||
auras:Width(totalWidth)
|
||||
end
|
||||
|
||||
local index = 1
|
||||
while auras[index] do
|
||||
local button = auras[index]
|
||||
if button then
|
||||
button.db = auras.db
|
||||
UF:UpdateAuraSettings(auras, button)
|
||||
end
|
||||
|
||||
index = index + 1
|
||||
end
|
||||
|
||||
local attachTo = self:GetAuraAnchorFrame(frame, auras.db.attachTo, db.debuffs.attachTo == "BUFFS" and db.buffs.attachTo == "DEBUFFS")
|
||||
local x, y = E:GetXYOffset(auras.db.anchorPoint, frame.SPACING) --Use frame.SPACING override since it may be different from E.Spacing due to forced thin borders
|
||||
|
||||
if auras.db.attachTo == "FRAME" then
|
||||
y = 0
|
||||
elseif auras.db.attachTo == "HEALTH" or auras.db.attachTo == "POWER" then
|
||||
local newX = E:GetXYOffset(auras.db.anchorPoint, -frame.BORDER)
|
||||
local _, newY = E:GetXYOffset(auras.db.anchorPoint, (frame.BORDER + frame.SPACING))
|
||||
x = newX
|
||||
y = newY
|
||||
else
|
||||
x = 0
|
||||
end
|
||||
|
||||
if (auraType == "buffs" and frame.Debuffs.attachTo and frame.Debuffs.attachTo == frame.Buffs and auras.db.attachTo == "DEBUFFS") then
|
||||
--Update Debuffs first, as we would otherwise get conflicting anchor points
|
||||
--This is usually only an issue on profile change
|
||||
ReverseUpdate(frame)
|
||||
return
|
||||
end
|
||||
|
||||
auras:ClearAllPoints()
|
||||
auras:Point(E.InversePoints[auras.db.anchorPoint], attachTo, auras.db.anchorPoint, x + auras.db.xOffset, y + auras.db.yOffset)
|
||||
auras:Height(auras.size * rows)
|
||||
auras["growth-y"] = find(auras.db.anchorPoint, "TOP") and "UP" or "DOWN"
|
||||
auras["growth-x"] = auras.db.anchorPoint == "LEFT" and "LEFT" or auras.db.anchorPoint == "RIGHT" and "RIGHT" or (find(auras.db.anchorPoint, "LEFT") and "RIGHT" or "LEFT")
|
||||
auras.initialAnchor = E.InversePoints[auras.db.anchorPoint]
|
||||
|
||||
--These are needed for SmartAuraPosition
|
||||
auras.attachTo = attachTo
|
||||
auras.point = E.InversePoints[auras.db.anchorPoint]
|
||||
auras.anchorPoint = auras.db.anchorPoint
|
||||
auras.xOffset = x + auras.db.xOffset
|
||||
auras.yOffset = y + auras.db.yOffset
|
||||
|
||||
if auras.db.enable then
|
||||
auras:Show()
|
||||
else
|
||||
auras:Hide()
|
||||
end
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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.expiration or -1
|
||||
local bTime = 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.duration or -1
|
||||
local bTime = 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
|
||||
|
||||
local unstableAffliction = GetSpellInfo(30108)
|
||||
local vampiricTouch = GetSpellInfo(34914)
|
||||
function UF:PostUpdateAura(unit, button)
|
||||
if button.isDebuff then
|
||||
if not button.isFriend and not button.isPlayer then --[[and (not E.isDebuffWhiteList[name])]]
|
||||
button:SetBackdropBorderColor(0.9, 0.1, 0.1)
|
||||
button.icon:SetDesaturated((unit and not find(unit, "arena%d")) and true or false)
|
||||
else
|
||||
local color = (button.dtype and DebuffTypeColor[button.dtype]) or DebuffTypeColor.none
|
||||
if button.name and (button.name == unstableAffliction or button.name == vampiricTouch) then
|
||||
button:SetBackdropBorderColor(0.05, 0.85, 0.94)
|
||||
else
|
||||
button:SetBackdropBorderColor(color.r * 0.6, color.g * 0.6, color.b * 0.6)
|
||||
end
|
||||
button.icon:SetDesaturated(false)
|
||||
end
|
||||
else
|
||||
if button.isStealable and not button.isFriend then
|
||||
button:SetBackdropBorderColor(0.93, 0.91, 0.55, 1.0)
|
||||
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:AuraFilter(unit, button, name, _, _, _, debuffType, duration, expiration, caster, isStealable, _, spellID)
|
||||
if not name then return end -- checking for an aura that is not there, pass nil to break while loop
|
||||
|
||||
local parent = self:GetParent()
|
||||
local db = parent.db and parent.db[self.type]
|
||||
if not db then return true end
|
||||
|
||||
local isPlayer = (caster == "player" or caster == "vehicle")
|
||||
local isFriend = unit and UnitIsFriend("player", unit) and not UnitCanAttack("player", unit)
|
||||
|
||||
button.isPlayer = isPlayer
|
||||
button.isFriend = isFriend
|
||||
button.isStealable = isStealable
|
||||
button.dtype = debuffType
|
||||
button.duration = duration
|
||||
button.expiration = expiration
|
||||
button.name = name
|
||||
button.spellID = spellID
|
||||
button.owner = caster --what uses this?
|
||||
button.spell = name --what uses this? (SortAurasByName?)
|
||||
button.priority = 0
|
||||
|
||||
local noDuration = (not duration or duration == 0)
|
||||
local allowDuration = noDuration or (duration and (duration > 0) and (db.maxDuration == 0 or duration <= db.maxDuration) and (db.minDuration == 0 or duration >= db.minDuration))
|
||||
local filterCheck, spellPriority
|
||||
|
||||
if db.priority ~= "" then
|
||||
local isUnit = unit and caster and UnitIsUnit(unit, caster)
|
||||
local canDispell = (self.type == "buffs" and isStealable) or (self.type == "debuffs" and debuffType)
|
||||
filterCheck, spellPriority = UF:CheckFilter(name, caster, spellID, isFriend, isPlayer, isUnit, allowDuration, noDuration, canDispell, split(",", db.priority))
|
||||
if spellPriority then button.priority = spellPriority end -- this is the only difference from auarbars code
|
||||
else
|
||||
filterCheck = allowDuration and true -- Allow all auras to be shown when the filter list is empty, while obeying duration sliders
|
||||
end
|
||||
|
||||
return filterCheck
|
||||
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.point, debuffs.attachTo, debuffs.anchorPoint, debuffs.xOffset, debuffs.yOffset)
|
||||
else
|
||||
buffs:ClearAllPoints()
|
||||
buffs:Point(buffs.point, 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.point, buffs.attachTo, buffs.anchorPoint, buffs.xOffset, buffs.yOffset)
|
||||
else
|
||||
debuffs:ClearAllPoints()
|
||||
debuffs:Point(debuffs.point, 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.point, debuffs.attachTo, debuffs.anchorPoint, debuffs.xOffset, debuffs.yOffset)
|
||||
else
|
||||
buffs:ClearAllPoints()
|
||||
buffs:Point(buffs.point, 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.point, buffs.attachTo, buffs.anchorPoint, buffs.xOffset, buffs.yOffset)
|
||||
else
|
||||
debuffs:ClearAllPoints()
|
||||
debuffs:Point(debuffs.point, 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
|
||||
@@ -0,0 +1,241 @@
|
||||
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
|
||||
|
||||
--Lua functions
|
||||
local assert, select, pairs, unpack = assert, select, pairs, unpack
|
||||
local tinsert, wipe = tinsert, wipe
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
local GetSpellInfo = GetSpellInfo
|
||||
|
||||
function UF:Construct_AuraWatch(frame)
|
||||
local auras = CreateFrame("Frame", nil, frame)
|
||||
auras:SetFrameLevel(frame.RaisedElementParent:GetFrameLevel() + 10)
|
||||
auras:SetInside(frame.Health)
|
||||
auras.presentAlpha = 1
|
||||
auras.missingAlpha = 0
|
||||
auras.strictMatching = false
|
||||
auras.icons = {}
|
||||
|
||||
return auras
|
||||
end
|
||||
|
||||
local counterOffsets = {
|
||||
["TOPLEFT"] = {6, 1},
|
||||
["TOPRIGHT"] = {-6, 1},
|
||||
["BOTTOMLEFT"] = {6, 1},
|
||||
["BOTTOMRIGHT"] = {-6, 1},
|
||||
["LEFT"] = {6, 1},
|
||||
["RIGHT"] = {-6, 1},
|
||||
["TOP"] = {0, 0},
|
||||
["BOTTOM"] = {0, 0}
|
||||
}
|
||||
|
||||
local textCounterOffsets = {
|
||||
["TOPLEFT"] = {"LEFT", "RIGHT", -2, 0},
|
||||
["TOPRIGHT"] = {"RIGHT", "LEFT", 2, 0},
|
||||
["BOTTOMLEFT"] = {"LEFT", "RIGHT", -2, 0},
|
||||
["BOTTOMRIGHT"] = {"RIGHT", "LEFT", 2, 0},
|
||||
["LEFT"] = {"LEFT", "RIGHT", -2, 0},
|
||||
["RIGHT"] = {"RIGHT", "LEFT", 2, 0},
|
||||
["TOP"] = {"RIGHT", "LEFT", 2, 0},
|
||||
["BOTTOM"] = {"RIGHT", "LEFT", 2, 0}
|
||||
}
|
||||
|
||||
function UF:UpdateAuraWatchFromHeader(group, petOverride)
|
||||
assert(self[group], "Invalid group specified.")
|
||||
group = self[group]
|
||||
for i = 1, group:GetNumChildren() do
|
||||
local frame = select(i, group:GetChildren())
|
||||
if frame and frame.Health then
|
||||
UF:UpdateAuraWatch(frame, petOverride, group.db)
|
||||
elseif frame then
|
||||
for n = 1, frame:GetNumChildren() do
|
||||
local child = select(n, frame:GetChildren())
|
||||
if child and child.Health then
|
||||
UF:UpdateAuraWatch(child, petOverride, group.db)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local buffs = {}
|
||||
function UF:UpdateAuraWatch(frame, petOverride, db)
|
||||
wipe(buffs)
|
||||
local auras = frame.AuraWatch
|
||||
db = db and db.buffIndicator or frame.db.buffIndicator
|
||||
|
||||
if not db.enable then
|
||||
auras:Hide()
|
||||
return
|
||||
else
|
||||
auras:Show()
|
||||
end
|
||||
|
||||
if frame.unit == "pet" and not petOverride then
|
||||
local petWatch = E.global.unitframe.buffwatch.PET or {}
|
||||
for _, value in pairs(petWatch) do
|
||||
tinsert(buffs, value)
|
||||
end
|
||||
else
|
||||
local buffWatch = not db.profileSpecific and (E.global.unitframe.buffwatch[E.myclass] or {}) or (E.db.unitframe.filters.buffwatch or {})
|
||||
for _, value in pairs(buffWatch) do
|
||||
tinsert(buffs, value)
|
||||
end
|
||||
end
|
||||
|
||||
--CLEAR CACHE
|
||||
if auras.icons then
|
||||
for i = 1, #auras.icons do
|
||||
local matchFound = false
|
||||
for j = 1, #buffs do
|
||||
if buffs[j].id and buffs[j].id == auras.icons[i] then
|
||||
matchFound = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if not matchFound then
|
||||
auras.icons[i]:Hide()
|
||||
auras.icons[i] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local unitframeFont = LSM:Fetch("font", E.db.unitframe.font)
|
||||
|
||||
for i = 1, #buffs do
|
||||
if buffs[i].id then
|
||||
local name, _, image = GetSpellInfo(buffs[i].id)
|
||||
if name then
|
||||
local icon
|
||||
if not auras.icons[buffs[i].id] then
|
||||
icon = CreateFrame("Frame", nil, auras)
|
||||
else
|
||||
icon = auras.icons[buffs[i].id]
|
||||
end
|
||||
icon.name = name
|
||||
icon.image = image
|
||||
icon.spellID = buffs[i].id
|
||||
icon.anyUnit = buffs[i].anyUnit
|
||||
icon.style = buffs[i].style
|
||||
icon.onlyShowMissing = buffs[i].onlyShowMissing
|
||||
icon.presentAlpha = icon.onlyShowMissing and 0 or 1
|
||||
icon.missingAlpha = icon.onlyShowMissing and 1 or 0
|
||||
icon.textThreshold = buffs[i].textThreshold or -1
|
||||
icon.displayText = buffs[i].displayText
|
||||
icon.decimalThreshold = buffs[i].decimalThreshold
|
||||
icon.size = (buffs[i].sizeOverride ~= nil and buffs[i].sizeOverride > 0 and buffs[i].sizeOverride or db.size)
|
||||
|
||||
icon:Width(icon.size)
|
||||
icon:Height(icon.size)
|
||||
--Protect against missing .point value
|
||||
if not buffs[i].point then buffs[i].point = "TOPLEFT" end
|
||||
|
||||
icon:ClearAllPoints()
|
||||
icon:Point(buffs[i].point or "TOPLEFT", frame.Health, buffs[i].point or "TOPLEFT", buffs[i].xOffset, buffs[i].yOffset)
|
||||
|
||||
if not icon.icon then
|
||||
icon.icon = icon:CreateTexture(nil, "BORDER")
|
||||
icon.icon:SetAllPoints(icon)
|
||||
end
|
||||
|
||||
if not icon.text then
|
||||
local f = CreateFrame("Frame", nil, icon)
|
||||
f:SetFrameLevel(icon:GetFrameLevel() + 50)
|
||||
icon.text = f:CreateFontString(nil, "BORDER")
|
||||
end
|
||||
|
||||
if not icon.border then
|
||||
icon.border = icon:CreateTexture(nil, "BACKGROUND")
|
||||
icon.border:Point("TOPLEFT", -E.mult, E.mult)
|
||||
icon.border:Point("BOTTOMRIGHT", E.mult, -E.mult)
|
||||
icon.border:SetTexture(E.media.blankTex)
|
||||
icon.border:SetVertexColor(0, 0, 0)
|
||||
end
|
||||
|
||||
if not icon.cd then
|
||||
icon.cd = CreateFrame("Cooldown", nil, icon, "CooldownFrameTemplate")
|
||||
icon.cd:SetAllPoints(icon)
|
||||
icon.cd.noOCC = true
|
||||
icon.cd.noCooldownCount = true
|
||||
icon.cd:SetReverse(true)
|
||||
icon.cd:SetFrameLevel(icon:GetFrameLevel())
|
||||
end
|
||||
|
||||
if icon.style == "coloredIcon" then
|
||||
icon.icon:SetTexture(E.media.blankTex)
|
||||
|
||||
if buffs[i].color then
|
||||
icon.icon:SetVertexColor(buffs[i].color.r, buffs[i].color.g, buffs[i].color.b)
|
||||
else
|
||||
icon.icon:SetVertexColor(0.8, 0.8, 0.8)
|
||||
end
|
||||
icon.icon:Show()
|
||||
icon.border:Show()
|
||||
icon.cd:SetAlpha(1)
|
||||
elseif icon.style == "texturedIcon" then
|
||||
icon.icon:SetVertexColor(1, 1, 1)
|
||||
--icon.icon:SetTexCoord(.18, .82, .18, .82)
|
||||
icon.icon:SetTexCoord(unpack(E.TexCoords))
|
||||
icon.icon:SetTexture(icon.image)
|
||||
icon.icon:Show()
|
||||
icon.border:Show()
|
||||
icon.cd:SetAlpha(1)
|
||||
else
|
||||
icon.border:Hide()
|
||||
icon.icon:Hide()
|
||||
icon.cd:SetAlpha(0)
|
||||
end
|
||||
|
||||
if icon.displayText then
|
||||
icon.text:Show()
|
||||
local r, g, b = 1, 1, 1
|
||||
if buffs[i].textColor then
|
||||
r, g, b = buffs[i].textColor.r, buffs[i].textColor.g, buffs[i].textColor.b
|
||||
end
|
||||
|
||||
icon.text:SetTextColor(r, g, b)
|
||||
else
|
||||
icon.text:Hide()
|
||||
end
|
||||
|
||||
if not icon.count then
|
||||
icon.count = icon:CreateFontString(nil, "OVERLAY")
|
||||
end
|
||||
|
||||
icon.count:ClearAllPoints()
|
||||
if icon.displayText then
|
||||
local point, anchorPoint, x, y = unpack(textCounterOffsets[buffs[i].point])
|
||||
icon.count:Point(point, icon.text, anchorPoint, x, y)
|
||||
else
|
||||
icon.count:Point("CENTER", unpack(counterOffsets[buffs[i].point]))
|
||||
end
|
||||
|
||||
icon.count:FontTemplate(unitframeFont, db.fontSize, E.db.unitframe.fontOutline)
|
||||
icon.text:FontTemplate(unitframeFont, db.fontSize, E.db.unitframe.fontOutline)
|
||||
icon.text:ClearAllPoints()
|
||||
icon.text:Point(buffs[i].point, icon, buffs[i].point)
|
||||
|
||||
if buffs[i].enabled then
|
||||
auras.icons[buffs[i].id] = icon
|
||||
if auras.watched then
|
||||
auras.watched[buffs[i].id] = icon
|
||||
end
|
||||
else
|
||||
auras.icons[buffs[i].id] = nil
|
||||
if auras.watched then
|
||||
auras.watched[buffs[i].id] = nil
|
||||
end
|
||||
icon:Hide()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if frame.AuraWatch.Update then
|
||||
frame.AuraWatch.Update(frame)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,423 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
local unpack = unpack
|
||||
local abs, min = math.abs, math.min
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
local UnitIsPlayer = UnitIsPlayer
|
||||
local UnitReaction = UnitReaction
|
||||
local UnitCanAttack = UnitCanAttack
|
||||
|
||||
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", nil, frame)
|
||||
castbar:SetFrameLevel(frame.RaisedElementParent:GetFrameLevel() + 30) --Make it appear above everything else
|
||||
self.statusbars[castbar] = true
|
||||
castbar.CustomDelayText = self.CustomCastDelayText
|
||||
castbar.CustomTimeText = self.CustomTimeText
|
||||
castbar.PostCastStart = self.PostCastStart
|
||||
castbar.PostCastStop = self.PostCastStop
|
||||
castbar.PostCastInterruptible = self.PostCastInterruptible
|
||||
castbar:SetClampedToScreen(true)
|
||||
castbar:CreateBackdrop(nil, nil, nil, self.thinBorders, true)
|
||||
|
||||
castbar.Time = castbar:CreateFontString(nil, "OVERLAY")
|
||||
self:Configure_FontString(castbar.Time)
|
||||
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")
|
||||
self:Configure_FontString(castbar.Text)
|
||||
castbar.Text:Point("LEFT", castbar, "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)
|
||||
local holder = CreateFrame("Frame", nil, castbar)
|
||||
button:SetTemplate(nil, nil, nil, self.thinBorders, true)
|
||||
|
||||
castbar.Holder = holder
|
||||
--these are placeholder so the mover can be created.. it will be changed.
|
||||
castbar.Holder:Point("TOPLEFT", frame, "BOTTOMLEFT", 0, -(frame.BORDER - frame.SPACING))
|
||||
castbar:Point("BOTTOMLEFT", castbar.Holder, "BOTTOMLEFT", frame.BORDER, frame.BORDER)
|
||||
button:Point("RIGHT", castbar, "LEFT", -E.Spacing*3, 0)
|
||||
|
||||
if moverName then
|
||||
local name = frame:GetName()
|
||||
local configName = string.lower(string.gsub(name, "^ElvUF_", ""))
|
||||
E:CreateMover(castbar.Holder, name.."CastbarMover", moverName, nil, -6, nil, "ALL,SOLO", nil, "unitframe,"..configName..",castbar")
|
||||
end
|
||||
|
||||
local icon = button:CreateTexture(nil, "ARTWORK")
|
||||
local offset = frame.BORDER --use frame.BORDER since it may be different from E.Border due to forced thin borders
|
||||
icon:SetInside(nil, offset, offset)
|
||||
icon.bg = button
|
||||
|
||||
--Set to castbar.Icon
|
||||
castbar.ButtonIcon = icon
|
||||
|
||||
return castbar
|
||||
end
|
||||
|
||||
function UF:Configure_Castbar(frame)
|
||||
if not frame.VARIABLES_SET then return end
|
||||
local castbar = frame.Castbar
|
||||
local db = frame.db
|
||||
|
||||
if db.castbar.enable then
|
||||
if not frame:IsElementEnabled("Castbar") then
|
||||
frame:EnableElement("Castbar")
|
||||
end
|
||||
|
||||
castbar:Width(db.castbar.width - ((frame.BORDER+frame.SPACING)*2))
|
||||
castbar:Height(db.castbar.height - ((frame.BORDER+frame.SPACING)*2))
|
||||
castbar.Holder:Width(db.castbar.width)
|
||||
castbar.Holder:Height(db.castbar.height)
|
||||
|
||||
local color = E.db.unitframe.colors.borderColor
|
||||
castbar.ButtonIcon.bg:SetBackdropBorderColor(color.r, color.g, color.b)
|
||||
|
||||
local oSC = castbar.Holder:GetScript("OnSizeChanged")
|
||||
if oSC then oSC(castbar.Holder) end
|
||||
|
||||
if db.castbar.strataAndLevel and db.castbar.strataAndLevel.useCustomStrata then
|
||||
castbar:SetFrameStrata(db.castbar.strataAndLevel.frameStrata)
|
||||
end
|
||||
|
||||
if db.castbar.strataAndLevel and db.castbar.strataAndLevel.useCustomLevel then
|
||||
castbar:SetFrameLevel(db.castbar.strataAndLevel.frameLevel)
|
||||
end
|
||||
|
||||
castbar.timeToHold = db.castbar.timeToHold
|
||||
|
||||
--Latency
|
||||
if db.castbar.latency then
|
||||
castbar.SafeZone = castbar.LatencyTexture
|
||||
castbar.LatencyTexture:Show()
|
||||
else
|
||||
castbar.SafeZone = nil
|
||||
castbar.LatencyTexture:Hide()
|
||||
end
|
||||
|
||||
--Icon
|
||||
if db.castbar.icon then
|
||||
castbar.Icon = castbar.ButtonIcon
|
||||
castbar.Icon:SetTexCoord(unpack(E.TexCoords))
|
||||
|
||||
if not db.castbar.iconAttached then
|
||||
castbar.Icon.bg:Size(db.castbar.iconSize)
|
||||
else
|
||||
if db.castbar.insideInfoPanel and frame.USE_INFO_PANEL then
|
||||
castbar.Icon.bg:Size(db.infoPanel.height - frame.SPACING*2)
|
||||
else
|
||||
castbar.Icon.bg:Size(db.castbar.height - frame.SPACING*2)
|
||||
end
|
||||
|
||||
castbar:Width(db.castbar.width - castbar.Icon.bg:GetWidth() - (frame.BORDER + frame.SPACING*5))
|
||||
end
|
||||
|
||||
castbar.Icon.bg:Show()
|
||||
else
|
||||
castbar.ButtonIcon.bg:Hide()
|
||||
castbar.Icon = nil
|
||||
end
|
||||
|
||||
if db.castbar.spark then
|
||||
castbar.Spark = castbar.Spark_
|
||||
castbar.Spark:Point("CENTER", castbar:GetStatusBarTexture(), "RIGHT", 0, 0)
|
||||
castbar.Spark:Height(db.castbar.height * 2)
|
||||
elseif castbar.Spark then
|
||||
castbar.Spark:Hide()
|
||||
castbar.Spark = nil
|
||||
end
|
||||
|
||||
castbar:ClearAllPoints()
|
||||
if db.castbar.insideInfoPanel and frame.USE_INFO_PANEL then
|
||||
if not db.castbar.iconAttached then
|
||||
castbar:SetInside(frame.InfoPanel, 0, 0)
|
||||
else
|
||||
local iconWidth = db.castbar.icon and (castbar.Icon.bg:GetWidth() - frame.BORDER) or 0
|
||||
if frame.ORIENTATION == "RIGHT" then
|
||||
castbar:Point("TOPLEFT", frame.InfoPanel, "TOPLEFT")
|
||||
castbar:Point("BOTTOMRIGHT", frame.InfoPanel, "BOTTOMRIGHT", -iconWidth - frame.SPACING*3, 0)
|
||||
else
|
||||
castbar:Point("TOPLEFT", frame.InfoPanel, "TOPLEFT", iconWidth + frame.SPACING*3, 0)
|
||||
castbar:Point("BOTTOMRIGHT", frame.InfoPanel, "BOTTOMRIGHT")
|
||||
end
|
||||
end
|
||||
|
||||
if db.castbar.spark then
|
||||
castbar.Spark:Height(db.infoPanel and db.infoPanel.height * 2) -- Grab the height from the infopanel.
|
||||
end
|
||||
|
||||
if castbar.Holder.mover then
|
||||
E:DisableMover(castbar.Holder.mover:GetName())
|
||||
end
|
||||
else
|
||||
local isMoved = E:HasMoverBeenMoved(frame:GetName().."CastbarMover") or not castbar.Holder.mover
|
||||
if not isMoved then
|
||||
castbar.Holder.mover:ClearAllPoints()
|
||||
end
|
||||
|
||||
castbar:ClearAllPoints()
|
||||
if frame.ORIENTATION ~= "RIGHT" then
|
||||
castbar:Point("BOTTOMRIGHT", castbar.Holder, "BOTTOMRIGHT", -(frame.BORDER+frame.SPACING), frame.BORDER+frame.SPACING)
|
||||
if not isMoved then
|
||||
castbar.Holder.mover:Point("TOPRIGHT", frame, "BOTTOMRIGHT", 0, -(frame.BORDER - frame.SPACING))
|
||||
end
|
||||
else
|
||||
castbar:Point("BOTTOMLEFT", castbar.Holder, "BOTTOMLEFT", frame.BORDER+frame.SPACING, frame.BORDER+frame.SPACING)
|
||||
if not isMoved then
|
||||
castbar.Holder.mover:Point("TOPLEFT", frame, "BOTTOMLEFT", 0, -(frame.BORDER - frame.SPACING))
|
||||
end
|
||||
end
|
||||
|
||||
if castbar.Holder.mover then
|
||||
E:EnableMover(castbar.Holder.mover:GetName())
|
||||
end
|
||||
end
|
||||
|
||||
if not db.castbar.iconAttached and db.castbar.icon then
|
||||
local attachPoint = db.castbar.iconAttachedTo == "Frame" and frame or frame.Castbar
|
||||
local anchorPoint = db.castbar.iconPosition
|
||||
castbar.Icon.bg:ClearAllPoints()
|
||||
castbar.Icon.bg:Point(INVERT_ANCHORPOINT[anchorPoint], attachPoint, anchorPoint, db.castbar.iconXOffset, db.castbar.iconYOffset)
|
||||
elseif db.castbar.icon then
|
||||
castbar.Icon.bg:ClearAllPoints()
|
||||
if frame.ORIENTATION == "RIGHT" then
|
||||
castbar.Icon.bg:Point("LEFT", castbar, "RIGHT", frame.SPACING*3, 0)
|
||||
else
|
||||
castbar.Icon.bg:Point("RIGHT", castbar, "LEFT", -frame.SPACING*3, 0)
|
||||
end
|
||||
end
|
||||
|
||||
--Adjust tick heights
|
||||
castbar.tickHeight = castbar:GetHeight()
|
||||
|
||||
if db.castbar.ticks then --Only player unitframe has this
|
||||
--Set tick width and color
|
||||
castbar.tickWidth = db.castbar.tickWidth
|
||||
castbar.tickColor = db.castbar.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
|
||||
|
||||
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)
|
||||
else
|
||||
if not db.castbar.enable and frame:IsElementEnabled("Castbar") then
|
||||
frame:DisableElement("Castbar")
|
||||
|
||||
if castbar.Holder.mover then
|
||||
E:DisableMover(castbar.Holder.mover:GetName())
|
||||
end
|
||||
end
|
||||
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%.2f|r", abs(duration - self.max), self.delay)
|
||||
elseif db == "CURRENTMAX" then
|
||||
self.Time:SetFormattedText("%.1f / %.2f |cffaf5050%.2f|r", abs(duration - self.max), self.max, self.delay)
|
||||
elseif db == "REMAINING" then
|
||||
self.Time:SetFormattedText("%.1f |cffaf5050%.2f|r", duration, self.delay)
|
||||
elseif db == "REMAININGMAX" then
|
||||
self.Time:SetFormattedText("%.1f / %.2f |cffaf5050%.2f|r", duration, self.max, self.delay)
|
||||
end
|
||||
else
|
||||
if db == "CURRENT" then
|
||||
self.Time:SetFormattedText("%.1f |cffaf5050%s %.2f|r", duration, "+", self.delay)
|
||||
elseif db == "CURRENTMAX" then
|
||||
self.Time:SetFormattedText("%.1f / %.2f |cffaf5050%s %.2f|r", duration, self.max, "+", self.delay)
|
||||
elseif db == "REMAINING" then
|
||||
self.Time:SetFormattedText("%.1f |cffaf5050%s %.2f|r", abs(duration - self.max), "+", self.delay)
|
||||
elseif db == "REMAININGMAX" then
|
||||
self.Time:SetFormattedText("%.1f / %.2f |cffaf5050%s %.2f|r", abs(duration - self.max), self.max, "+", self.delay)
|
||||
end
|
||||
end
|
||||
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 / %.2f", abs(duration - self.max), self.max)
|
||||
elseif db == "REMAINING" then
|
||||
self.Time:SetFormattedText("%.1f", duration)
|
||||
elseif db == "REMAININGMAX" then
|
||||
self.Time:SetFormattedText("%.1f / %.2f", duration, self.max)
|
||||
end
|
||||
else
|
||||
if db == "CURRENT" then
|
||||
self.Time:SetFormattedText("%.1f", duration)
|
||||
elseif db == "CURRENTMAX" then
|
||||
self.Time:SetFormattedText("%.1f / %.2f", duration, self.max)
|
||||
elseif db == "REMAINING" then
|
||||
self.Time:SetFormattedText("%.1f", abs(duration - self.max))
|
||||
elseif db == "REMAININGMAX" then
|
||||
self.Time:SetFormattedText("%.1f / %.2f", abs(duration - self.max), self.max)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function UF:HideTicks()
|
||||
for i = 1, #ticks do
|
||||
ticks[i]:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
function UF:SetCastTicks(frame, numTicks)
|
||||
UF:HideTicks()
|
||||
if numTicks and numTicks <= 0 then return end
|
||||
local w = frame:GetWidth()
|
||||
local d = w / numTicks
|
||||
|
||||
for i = 1, numTicks do
|
||||
if not ticks[i] then
|
||||
ticks[i] = frame:CreateTexture(nil, "OVERLAY")
|
||||
ticks[i]:SetTexture(E.media.normTex)
|
||||
E:RegisterStatusBar(ticks[i])
|
||||
ticks[i]:SetVertexColor(frame.tickColor.r, frame.tickColor.g, frame.tickColor.b, frame.tickColor.a)
|
||||
ticks[i]:Width(frame.tickWidth)
|
||||
end
|
||||
|
||||
ticks[i]:Height(frame.tickHeight)
|
||||
ticks[i]:ClearAllPoints()
|
||||
ticks[i]:Point("RIGHT", frame, "LEFT", d * i, 0)
|
||||
ticks[i]:Show()
|
||||
end
|
||||
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
|
||||
|
||||
if db.castbar.displayTarget and self.curTarget then
|
||||
self.Text:SetText(self.spellName.." > "..self.curTarget)
|
||||
end
|
||||
|
||||
-- Get length of Time, then calculate available length for Text
|
||||
local timeWidth = self.Time:GetStringWidth()
|
||||
local textWidth = self:GetWidth() - timeWidth - 10
|
||||
local textStringWidth = self.Text:GetStringWidth()
|
||||
|
||||
if timeWidth == 0 or textStringWidth == 0 then
|
||||
E:Delay(0.05, function() -- Delay may need tweaking
|
||||
textWidth = self:GetWidth() - self.Time:GetStringWidth() - 10
|
||||
textStringWidth = self.Text:GetStringWidth()
|
||||
if textWidth > 0 then self.Text:Width(min(textWidth, textStringWidth)) end
|
||||
end)
|
||||
else
|
||||
self.Text:Width(min(textWidth, textStringWidth))
|
||||
end
|
||||
|
||||
self.unit = unit
|
||||
|
||||
if self.channeling and db.castbar.ticks and unit == "player" then
|
||||
local unitframe = E.global.unitframe
|
||||
local baseTicks = unitframe.ChannelTicks[self.spellName]
|
||||
|
||||
if baseTicks then
|
||||
UF:SetCastTicks(self, baseTicks)
|
||||
self.hadTicks = true
|
||||
else
|
||||
UF:HideTicks()
|
||||
end
|
||||
end
|
||||
|
||||
local colors = ElvUF.colors
|
||||
local r, g, b = colors.castColor[1], colors.castColor[2], colors.castColor[3]
|
||||
|
||||
if (self.notInterruptible and unit ~= "player") and UnitCanAttack("player", unit) then
|
||||
r, g, b = colors.castNoInterrupt[1], colors.castNoInterrupt[2], colors.castNoInterrupt[3]
|
||||
elseif UF.db.colors.castClassColor and UnitIsPlayer(unit) then
|
||||
local t = E.media.herocolor
|
||||
if t then r, g, b = t[1], t[2], t[3] end
|
||||
elseif UF.db.colors.castReactionColor then
|
||||
local Reaction = UnitReaction(unit, "player")
|
||||
local t = Reaction and ElvUF.colors.reaction[Reaction]
|
||||
if t then r, g, b = t[1], t[2], t[3] end
|
||||
end
|
||||
|
||||
self:SetStatusBarColor(r, g, b)
|
||||
end
|
||||
|
||||
function UF:PostCastStop(unit)
|
||||
if self.hadTicks and unit == "player" then
|
||||
UF:HideTicks()
|
||||
self.hadTicks = false
|
||||
end
|
||||
end
|
||||
|
||||
function UF:PostCastInterruptible(unit)
|
||||
if unit == "vehicle" or unit == "player" then return end
|
||||
|
||||
local colors = ElvUF.colors
|
||||
local r, g, b = colors.castColor[1], colors.castColor[2], colors.castColor[3]
|
||||
|
||||
if self.notInterruptible and UnitCanAttack("player", unit) then
|
||||
r, g, b = colors.castNoInterrupt[1], colors.castNoInterrupt[2], colors.castNoInterrupt[3]
|
||||
elseif UF.db.colors.castClassColor and UnitIsPlayer(unit) then
|
||||
local t = E.media.herocolor
|
||||
if t then r, g, b = t[1], t[2], t[3] end
|
||||
elseif UF.db.colors.castReactionColor then
|
||||
local Reaction = UnitReaction(unit, "player")
|
||||
local t = Reaction and ElvUF.colors.reaction[Reaction]
|
||||
if t then r, g, b = t[1], t[2], t[3] end
|
||||
end
|
||||
|
||||
self:SetStatusBarColor(r, g, b)
|
||||
end
|
||||
@@ -0,0 +1,411 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
local select = select
|
||||
local strfind, strsub, gsub = strfind, strsub, gsub
|
||||
local floor, max = floor, max
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
|
||||
local _, ns = ...
|
||||
local ElvUF = ns.oUF
|
||||
assert(ElvUF, "ElvUI was unable to locate oUF.")
|
||||
|
||||
function UF:Configure_ClassBar(frame)
|
||||
if not frame.VARIABLES_SET then return end
|
||||
local bars = frame[frame.ClassBar]
|
||||
if not bars then return end
|
||||
|
||||
local db = frame.db
|
||||
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 self.thinBorders and not E.PixelMode) 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
|
||||
UF.ToggleResourceBar(bars) --Trigger update to health if needed
|
||||
elseif (self.thinBorders or E.PixelMode) 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
|
||||
UF.ToggleResourceBar(bars) --Trigger update to health if needed
|
||||
elseif (not frame.CLASSBAR_DETACHED and frame.CLASSBAR_HEIGHT > 30) then
|
||||
frame.CLASSBAR_HEIGHT = 10
|
||||
if db.classbar then db.classbar.height = 10 end
|
||||
--Override visibility if Classbar is Additional Power in order to fix a bug when Auto Hide is enabled, height is higher than 30 and it goes from detached to not detached
|
||||
local overrideVisibility = frame.ClassBar == "AdditionalPower"
|
||||
UF.ToggleResourceBar(bars, overrideVisibility) --Trigger update to health if needed
|
||||
end
|
||||
|
||||
--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
|
||||
|
||||
if frame.USE_MINI_CLASSBAR and not frame.CLASSBAR_DETACHED then
|
||||
if frame.MAX_CLASS_BAR == 1 or frame.ClassBar == "AdditionalPower" 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
|
||||
CLASSBAR_WIDTH = db.classbar.detachedWidth - ((frame.BORDER + frame.SPACING) * 2)
|
||||
end
|
||||
|
||||
bars:Width(CLASSBAR_WIDTH)
|
||||
bars:Height(frame.CLASSBAR_HEIGHT - ((frame.BORDER + frame.SPACING) * 2))
|
||||
|
||||
local color = E.db.unitframe.colors.borderColor
|
||||
bars.backdrop:SetBackdropBorderColor(color.r, color.g, color.b)
|
||||
|
||||
if frame.ClassBar == "Runes" then
|
||||
if (not frame.USE_MINI_CLASSBAR) and frame.USE_CLASSBAR then
|
||||
bars.backdrop:Show()
|
||||
else
|
||||
bars.backdrop:Hide()
|
||||
end
|
||||
local maxClassBarButtons = max(UF.classMaxResourceBar[E.myclass] or 0)
|
||||
for i = 1, maxClassBarButtons do
|
||||
bars[i]:Hide()
|
||||
|
||||
if i <= frame.MAX_CLASS_BAR then
|
||||
bars[i].backdrop:SetBackdropBorderColor(color.r, color.g, color.b)
|
||||
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 + (frame.BORDER * 2 + frame.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) * (frame.BORDER-frame.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 + frame.BORDER * 2 + frame.SPACING * 2))
|
||||
elseif frame.CLASSBAR_DETACHED and db.classbar.orientation == "HORIZONTAL" then
|
||||
bars[i]:Point("LEFT", bars[i - 1], "RIGHT", (db.classbar.spacing + frame.BORDER * 2 + frame.SPACING * 2), 0) --5px spacing between borders of each button(replaced with Detached Spacing option)
|
||||
else
|
||||
bars[i]:Point("LEFT", bars[i - 1], "RIGHT", (5 + frame.BORDER * 2 + frame.SPACING * 2), 0) --5px spacing between borders of each button
|
||||
end
|
||||
elseif i == frame.MAX_CLASS_BAR then
|
||||
bars[i]:Point("LEFT", bars[i - 1], "RIGHT", frame.BORDER-frame.SPACING, 0)
|
||||
bars[i]:Point("RIGHT", bars)
|
||||
else
|
||||
bars[i]:Point("LEFT", bars[i - 1], "RIGHT", frame.BORDER-frame.SPACING, 0)
|
||||
end
|
||||
end
|
||||
|
||||
if frame.CLASSBAR_DETACHED and db.classbar.verticalOrientation then
|
||||
bars[i]:SetOrientation("VERTICAL")
|
||||
else
|
||||
bars[i]:SetOrientation("HORIZONTAL")
|
||||
end
|
||||
|
||||
bars[i]:Show()
|
||||
end
|
||||
end
|
||||
elseif frame.ClassBar == "AdditionalPower" 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:SetParent(frame)
|
||||
bars:SetFrameLevel(50) --RaisedElementParent uses 100, we want it lower than this
|
||||
|
||||
if bars.Holder and bars.Holder.mover then
|
||||
bars.Holder.mover:SetScale(0.0001)
|
||||
bars.Holder.mover:SetAlpha(0)
|
||||
end
|
||||
elseif frame.CLASSBAR_DETACHED then
|
||||
if frame.USE_MINI_CLASSBAR and not (frame.MAX_CLASS_BAR == 1 or frame.ClassBar == "AdditionalPower") then
|
||||
local widthMult = UF.classMaxResourceBar[E.myclass] - 1
|
||||
if db.classbar.orientation == "HORIZONTAL" then
|
||||
bars.Holder:Size(db.classbar.detachedWidth + (db.classbar.spacing * widthMult) - (widthMult * 5), db.classbar.height)
|
||||
else
|
||||
bars.Holder:Size(db.classbar.detachedWidth, (db.classbar.height * UF.classMaxResourceBar[E.myclass]) + (db.classbar.spacing * widthMult))
|
||||
end
|
||||
else
|
||||
bars.Holder:Size(db.classbar.detachedWidth, db.classbar.height)
|
||||
end
|
||||
|
||||
if not bars.Holder.mover then
|
||||
bars:ClearAllPoints()
|
||||
bars:Point("BOTTOMLEFT", bars.Holder, "BOTTOMLEFT", frame.BORDER + frame.SPACING, frame.BORDER + frame.SPACING)
|
||||
E:CreateMover(bars.Holder, "ClassBarMover", L["Classbar"], nil, nil, nil, "ALL,SOLO", nil, "unitframe,player,classbar")
|
||||
else
|
||||
bars:ClearAllPoints()
|
||||
bars:Point("BOTTOMLEFT", bars.Holder, "BOTTOMLEFT", frame.BORDER + frame.SPACING, frame.BORDER + frame.SPACING)
|
||||
bars.Holder.mover:SetScale(1)
|
||||
bars.Holder.mover:SetAlpha(1)
|
||||
end
|
||||
|
||||
if db.classbar.parent == "UIPARENT" then
|
||||
bars:SetParent(E.UIParent)
|
||||
else
|
||||
bars:SetParent(frame)
|
||||
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", -frame.BORDER, frame.SPACING*3)
|
||||
else
|
||||
bars:Point("BOTTOMLEFT", frame.Health.backdrop, "TOPLEFT", frame.BORDER, frame.SPACING*3)
|
||||
end
|
||||
|
||||
bars:SetParent(frame)
|
||||
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
|
||||
bars.Holder.mover:SetScale(0.0001)
|
||||
bars.Holder.mover:SetAlpha(0)
|
||||
end
|
||||
end
|
||||
|
||||
if frame.USE_CLASSBAR then
|
||||
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
|
||||
else
|
||||
if frame.AdditionalPower and frame:IsElementEnabled("AdditionalPower") then
|
||||
frame:DisableElement("AdditionalPower")
|
||||
end
|
||||
if frame.Runes and frame:IsElementEnabled("Runes") then
|
||||
frame:DisableElement("Runes")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function ToggleResourceBar(bars, overrideVisibility)
|
||||
local frame = bars.origParent or bars:GetParent()
|
||||
local db = frame.db
|
||||
if not db then return end
|
||||
|
||||
frame.CLASSBAR_SHOWN = (not not overrideVisibility) or bars:IsShown()
|
||||
|
||||
local height
|
||||
if db.classbar then
|
||||
height = db.classbar.height
|
||||
elseif db.combobar then
|
||||
height = db.combobar.height
|
||||
elseif frame.AlternativePower then
|
||||
height = db.power.height
|
||||
end
|
||||
|
||||
if bars.text then
|
||||
if frame.CLASSBAR_SHOWN then
|
||||
bars.text:SetAlpha(1)
|
||||
else
|
||||
bars.text:SetAlpha(0)
|
||||
end
|
||||
end
|
||||
|
||||
frame.CLASSBAR_HEIGHT = (frame.USE_CLASSBAR and (frame.CLASSBAR_SHOWN and 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 ((frame.SPACING+(frame.CLASSBAR_HEIGHT/2))) or (frame.CLASSBAR_HEIGHT - (frame.BORDER-frame.SPACING)))
|
||||
|
||||
if not frame.CLASSBAR_DETACHED then --Only update when necessary
|
||||
UF:Configure_HealthBar(frame)
|
||||
UF:Configure_Portrait(frame, true) --running :Hide on portrait makes the frame all funky
|
||||
UF:Configure_Threat(frame)
|
||||
end
|
||||
end
|
||||
UF.ToggleResourceBar = ToggleResourceBar --Make available to combobar
|
||||
|
||||
-------------------------------------------------------------
|
||||
-- DEATHKNIGHT
|
||||
-------------------------------------------------------------
|
||||
function UF:Construct_DeathKnightResourceBar(frame)
|
||||
local runes = CreateFrame("Frame", nil, frame)
|
||||
runes:CreateBackdrop(nil, nil, nil, self.thinBorders, true)
|
||||
|
||||
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, self.thinBorders, true)
|
||||
runes[i].backdrop:SetParent(runes)
|
||||
runes[i].backdrop:SetFrameLevel(runes[i]:GetFrameLevel() - 1)
|
||||
|
||||
runes[i].bg = runes[i]:CreateTexture(nil, "BORDER")
|
||||
runes[i].bg:SetAllPoints()
|
||||
runes[i].bg:SetTexture(E.media.blankTex)
|
||||
runes[i].bg:SetParent(runes[i].backdrop)
|
||||
runes[i].bg.multiplier = 0.35
|
||||
end
|
||||
|
||||
runes.PostUpdateType = UF.PostUpdateRuneType
|
||||
runes.PostUpdateVisibility = UF.PostVisibilityRunes
|
||||
|
||||
runes:SetScript("OnShow", ToggleResourceBar)
|
||||
runes:SetScript("OnHide", ToggleResourceBar)
|
||||
|
||||
return runes
|
||||
end
|
||||
|
||||
function UF:PostUpdateRuneType(rune)
|
||||
local custom_backdrop = UF.db.colors.customclasspowerbackdrop and UF.db.colors.classpower_backdrop
|
||||
|
||||
if custom_backdrop then
|
||||
rune.bg:SetVertexColor(custom_backdrop.r, custom_backdrop.g, custom_backdrop.b)
|
||||
end
|
||||
end
|
||||
|
||||
function UF:PostVisibilityRunes(enabled, stateChanged)
|
||||
local frame = self.origParent or self:GetParent()
|
||||
|
||||
if enabled then
|
||||
frame.MAX_CLASS_BAR = #self
|
||||
end
|
||||
|
||||
if stateChanged then
|
||||
ToggleResourceBar(frame[frame.ClassBar])
|
||||
UF:Configure_ClassBar(frame)
|
||||
UF:Configure_HealthBar(frame)
|
||||
UF:Configure_Power(frame)
|
||||
UF:Configure_InfoPanel(frame, true) --2nd argument is to prevent it from setting template, which removes threat border
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------
|
||||
-- DRUID
|
||||
-------------------------------------------------------------
|
||||
function UF:Construct_AdditionalPowerBar(frame)
|
||||
local additionalPower = CreateFrame("StatusBar", "AdditionalPowerBar", frame)
|
||||
additionalPower:SetStatusBarTexture(E.media.blankTex)
|
||||
UF.statusbars[additionalPower] = true
|
||||
|
||||
additionalPower.colorPower = true
|
||||
|
||||
additionalPower:CreateBackdrop(nil, nil, nil, self.thinBorders, true)
|
||||
|
||||
additionalPower.BG = additionalPower:CreateTexture(nil, "BORDER")
|
||||
additionalPower.BG:SetAllPoints(additionalPower)
|
||||
additionalPower.BG:SetTexture(E.media.blankTex)
|
||||
|
||||
additionalPower.text = additionalPower:CreateFontString(nil, "OVERLAY")
|
||||
UF:Configure_FontString(additionalPower.text)
|
||||
|
||||
additionalPower.PostUpdate = UF.PostUpdateAdditionalPower
|
||||
additionalPower.PostUpdateVisibility = UF.PostVisibilityAdditionalPower
|
||||
|
||||
additionalPower:SetScript("OnShow", ToggleResourceBar)
|
||||
additionalPower:SetScript("OnHide", ToggleResourceBar)
|
||||
|
||||
return additionalPower
|
||||
end
|
||||
|
||||
function UF:PostUpdateAdditionalPower(_, MIN, MAX, event)
|
||||
local frame = self.origParent or self:GetParent()
|
||||
local db = frame.db
|
||||
|
||||
if frame.USE_CLASSBAR and ((MIN ~= MAX or (not db.classbar.autoHide)) and (event ~= "ElementDisable")) then
|
||||
if db.classbar.additionalPowerText then
|
||||
local powerValue = frame.Power.value
|
||||
local powerValueText = powerValue:GetText()
|
||||
local powerValueParent = powerValue:GetParent()
|
||||
local powerTextPosition = db.power.position
|
||||
local color = ElvUF.colors.power.MANA
|
||||
color = E:RGBToHex(color[1], color[2], color[3])
|
||||
|
||||
--Attempt to remove |cFFXXXXXX color codes in order to determine if power text is really empty
|
||||
if powerValueText then
|
||||
local _, endIndex = strfind(powerValueText, "|cff")
|
||||
if endIndex then
|
||||
endIndex = endIndex + 7 --Add hex code
|
||||
powerValueText = strsub(powerValueText, endIndex)
|
||||
powerValueText = gsub(powerValueText, "%s+", "")
|
||||
end
|
||||
end
|
||||
|
||||
self.text:ClearAllPoints()
|
||||
if not frame.CLASSBAR_DETACHED then
|
||||
self.text:SetParent(powerValueParent)
|
||||
if powerValueText and (powerValueText ~= "" and powerValueText ~= " ") then
|
||||
if strfind(powerTextPosition, "RIGHT") then
|
||||
self.text:Point("RIGHT", powerValue, "LEFT", 3, 0)
|
||||
self.text:SetFormattedText(color.."%d%%|r |cffD7BEA5- |r", floor(MIN / MAX * 100))
|
||||
elseif strfind(powerTextPosition, "LEFT") then
|
||||
self.text:Point("LEFT", powerValue, "RIGHT", -3, 0)
|
||||
self.text:SetFormattedText("|cffD7BEA5 -|r"..color.." %d%%|r", floor(MIN / MAX * 100))
|
||||
else
|
||||
if select(4, powerValue:GetPoint()) <= 0 then
|
||||
self.text:Point("LEFT", powerValue, "RIGHT", -3, 0)
|
||||
self.text:SetFormattedText(" |cffD7BEA5-|r"..color.." %d%%|r", floor(MIN / MAX * 100))
|
||||
else
|
||||
self.text:Point("RIGHT", powerValue, "LEFT", 3, 0)
|
||||
self.text:SetFormattedText(color.."%d%%|r |cffD7BEA5- |r", floor(MIN / MAX * 100))
|
||||
end
|
||||
end
|
||||
else
|
||||
self.text:Point(powerValue:GetPoint())
|
||||
self.text:SetFormattedText(color.."%d%%|r", floor(MIN / MAX * 100))
|
||||
end
|
||||
else
|
||||
self.text:SetParent(frame.RaisedElementParent) -- needs to be 'frame.RaisedElementParent' otherwise the new PowerPrediction Bar will overlap
|
||||
self.text:Point("CENTER", self, 0, 1)
|
||||
self.text:SetFormattedText(color.."%d%%|r", floor(MIN / MAX * 100))
|
||||
end
|
||||
else --Text disabled
|
||||
self.text:SetText("")
|
||||
end
|
||||
|
||||
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)
|
||||
else
|
||||
local r, g, b = self:GetStatusBarColor()
|
||||
self.BG:SetVertexColor(r * 0.35, g * 0.35, b * 0.35)
|
||||
end
|
||||
|
||||
self:Show()
|
||||
else --Bar disabled
|
||||
self.text:SetText("")
|
||||
self:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
function UF:PostVisibilityAdditionalPower(enabled, stateChanged)
|
||||
local frame = self.origParent or self:GetParent()
|
||||
|
||||
if stateChanged then
|
||||
ToggleResourceBar(frame[frame.ClassBar])
|
||||
UF:Configure_ClassBar(frame)
|
||||
UF:Configure_HealthBar(frame)
|
||||
UF:Configure_Power(frame)
|
||||
UF:Configure_InfoPanel(frame, true) --2nd argument is to prevent it from setting template, which removes threat border
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,54 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
--WoW API / Variables
|
||||
|
||||
local CombatTextures = {
|
||||
["COMBAT"] = E.Media.Textures.Combat,
|
||||
["DEFAULT"] = [[Interface\CharacterFrame\UI-StateIcon]],
|
||||
["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
|
||||
|
||||
function UF:Configure_CombatIndicator(frame)
|
||||
if not frame.VARIABLES_SET then return end
|
||||
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
|
||||
@@ -0,0 +1,293 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
local GetComboPoints = GetComboPoints
|
||||
local GetShapeshiftForm = GetShapeshiftForm
|
||||
local UnitHasVehicleUI = UnitHasVehicleUI
|
||||
local MAX_COMBO_POINTS = MAX_COMBO_POINTS
|
||||
|
||||
local CombobarDetached
|
||||
function UF:CombobarDetachedUpdate()
|
||||
if ElvUF_Target.CLASSBAR_DETACHED and UF.db.units.target.combobar.parent == "UIPARENT" then
|
||||
if not CombobarDetached then
|
||||
CombobarDetached = CreateFrame("Frame", nil, UIParent)
|
||||
|
||||
CombobarDetached:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
CombobarDetached:RegisterEvent("UNIT_ENTERED_VEHICLE")
|
||||
CombobarDetached:RegisterEvent("UNIT_EXITING_VEHICLE")
|
||||
CombobarDetached:RegisterEvent("UPDATE_SHAPESHIFT_FORM")
|
||||
|
||||
CombobarDetached:SetScript("OnEvent", function(self, event, unit)
|
||||
if (event == "UNIT_ENTERED_VEHICLE" or event == "UNIT_EXITING_VEHICLE") and unit ~= "player" then return end
|
||||
|
||||
if event == "PLAYER_ENTERING_WORLD" then
|
||||
E:ShapeshiftDelayedUpdate(ElvUF_Target.ComboPoints.Override, ElvUF_Target)
|
||||
end
|
||||
|
||||
ElvUF_Target.ComboPoints.Override(ElvUF_Target, event, unit)
|
||||
end)
|
||||
end
|
||||
|
||||
CombobarDetached:Show()
|
||||
elseif CombobarDetached then
|
||||
CombobarDetached:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
function UF:Construct_Combobar(frame)
|
||||
local ComboPoints = CreateFrame("Frame", nil, frame)
|
||||
ComboPoints:CreateBackdrop("Default", nil, nil, UF.thinBorders, true)
|
||||
ComboPoints.backdrop:Hide()
|
||||
|
||||
for i = 1, MAX_COMBO_POINTS do
|
||||
ComboPoints[i] = CreateFrame("StatusBar", frame:GetName().."ComboBarButton"..i, ComboPoints)
|
||||
ComboPoints[i]:SetStatusBarTexture(E.media.blankTex)
|
||||
UF.statusbars[ComboPoints[i]] = true
|
||||
ComboPoints[i]:CreateBackdrop("Default", nil, nil, UF.thinBorders, true)
|
||||
ComboPoints[i].backdrop:SetParent(ComboPoints)
|
||||
|
||||
ComboPoints[i].bg = ComboPoints[i]:CreateTexture(nil, "BORDER")
|
||||
ComboPoints[i].bg:SetAllPoints()
|
||||
ComboPoints[i].bg:SetTexture(E.media.blankTex)
|
||||
ComboPoints[i].bg:SetParent(ComboPoints[i].backdrop)
|
||||
end
|
||||
|
||||
frame:RegisterEvent("UNIT_ENTERED_VEHICLE", UF.UpdateComboDisplay)
|
||||
frame:RegisterEvent("UNIT_EXITING_VEHICLE", UF.UpdateComboDisplay)
|
||||
|
||||
-- Do combo points change when you change forms on ascension?
|
||||
frame:RegisterEvent("UPDATE_SHAPESHIFT_FORM", UF.UpdateComboDisplay)
|
||||
|
||||
frame:RegisterEvent("PLAYER_ENTERING_WORLD", function()
|
||||
E:ShapeshiftDelayedUpdate(ElvUF_Target.ComboPoints.Override, ElvUF_Target)
|
||||
end)
|
||||
|
||||
self:CombobarDetachedUpdate()
|
||||
|
||||
ComboPoints.Override = UF.UpdateComboDisplay
|
||||
ComboPoints:SetScript("OnShow", UF.ToggleResourceBar)
|
||||
ComboPoints:SetScript("OnHide", UF.ToggleResourceBar)
|
||||
|
||||
return ComboPoints
|
||||
end
|
||||
|
||||
function UF:Configure_ComboPoints(frame)
|
||||
if not frame.VARIABLES_SET then return end
|
||||
local ComboPoints = frame.ComboPoints
|
||||
if not ComboPoints then return end
|
||||
|
||||
local db = frame.db
|
||||
ComboPoints.Holder = frame.ComboPointsHolder
|
||||
ComboPoints.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 self.thinBorders and not E.PixelMode) 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.combobar then db.combobar.height = 7 end
|
||||
UF.ToggleResourceBar(ComboPoints) --Trigger update to health if needed
|
||||
elseif (self.thinBorders or E.PixelMode) 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.combobar then db.combobar.height = 3 end
|
||||
UF.ToggleResourceBar(ComboPoints) --Trigger update to health if needed
|
||||
elseif (not frame.CLASSBAR_DETACHED and frame.CLASSBAR_HEIGHT > 30) then
|
||||
frame.CLASSBAR_HEIGHT = 10
|
||||
if db.combobar then db.combobar.height = 10 end
|
||||
UF.ToggleResourceBar(ComboPoints) --Trigger update to health if needed
|
||||
end
|
||||
|
||||
--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
|
||||
|
||||
if frame.USE_MINI_CLASSBAR and not frame.CLASSBAR_DETACHED then
|
||||
CLASSBAR_WIDTH = CLASSBAR_WIDTH * (frame.MAX_CLASS_BAR - 1) / frame.MAX_CLASS_BAR
|
||||
elseif frame.CLASSBAR_DETACHED then
|
||||
CLASSBAR_WIDTH = db.combobar.detachedWidth - ((frame.BORDER + frame.SPACING) * 2)
|
||||
end
|
||||
|
||||
ComboPoints:Width(CLASSBAR_WIDTH)
|
||||
ComboPoints:Height(frame.CLASSBAR_HEIGHT - ((frame.BORDER + frame.SPACING) * 2))
|
||||
local color = E.db.unitframe.colors.borderColor
|
||||
ComboPoints.backdrop:SetBackdropColor(color.r, color.g, color.b)
|
||||
|
||||
if not frame.USE_MINI_CLASSBAR then
|
||||
ComboPoints.backdrop:Show()
|
||||
else
|
||||
ComboPoints.backdrop:Hide()
|
||||
end
|
||||
|
||||
for i = 1, frame.MAX_CLASS_BAR do
|
||||
ComboPoints[i]:Hide()
|
||||
ComboPoints[i]:SetStatusBarColor(unpack(ElvUF.colors.ComboPoints[i]))
|
||||
ComboPoints[i].backdrop:SetBackdropBorderColor(color.r, color.g, color.b)
|
||||
ComboPoints[i]:Height(ComboPoints:GetHeight())
|
||||
|
||||
if frame.USE_MINI_CLASSBAR then
|
||||
if frame.CLASSBAR_DETACHED and db.combobar.orientation == "VERTICAL" then
|
||||
ComboPoints[i]:Width(CLASSBAR_WIDTH)
|
||||
else
|
||||
ComboPoints[i]:Width((CLASSBAR_WIDTH - ((5 + (frame.BORDER * 2 + frame.SPACING * 2)) * (frame.MAX_CLASS_BAR - 1))) / frame.MAX_CLASS_BAR) --Width accounts for 5px spacing between each button, excluding borders
|
||||
end
|
||||
elseif i ~= MAX_COMBO_POINTS then
|
||||
ComboPoints[i]:Width((CLASSBAR_WIDTH - ((frame.MAX_CLASS_BAR - 1) * (frame.BORDER-frame.SPACING))) / frame.MAX_CLASS_BAR) --combobar width minus total width of dividers between each button, divided by number of buttons
|
||||
end
|
||||
|
||||
ComboPoints[i]:GetStatusBarTexture():SetHorizTile(false)
|
||||
ComboPoints[i]:ClearAllPoints()
|
||||
|
||||
if i == 1 then
|
||||
ComboPoints[i]:Point("LEFT", ComboPoints)
|
||||
else
|
||||
if frame.USE_MINI_CLASSBAR then
|
||||
if frame.CLASSBAR_DETACHED and db.combobar.orientation == "VERTICAL" then
|
||||
ComboPoints[i]:Point("BOTTOM", ComboPoints[i - 1], "TOP", 0, (db.combobar.spacing + frame.BORDER * 2 + frame.SPACING * 2))
|
||||
elseif frame.CLASSBAR_DETACHED and db.combobar.orientation == "HORIZONTAL" then
|
||||
ComboPoints[i]:Point("LEFT", ComboPoints[i - 1], "RIGHT", (db.combobar.spacing + frame.BORDER * 2 + frame.SPACING * 2), 0) --5px spacing between borders of each button(replaced with Detached Spacing option)
|
||||
else
|
||||
ComboPoints[i]:Point("LEFT", ComboPoints[i - 1], "RIGHT", (5 + frame.BORDER * 2 + frame.SPACING * 2), 0) --5px spacing between borders of each button
|
||||
end
|
||||
elseif i == frame.MAX_CLASS_BAR then
|
||||
ComboPoints[i]:Point("LEFT", ComboPoints[i - 1], "RIGHT", frame.BORDER - frame.SPACING, 0)
|
||||
ComboPoints[i]:Point("RIGHT", ComboPoints)
|
||||
else
|
||||
ComboPoints[i]:Point("LEFT", ComboPoints[i - 1], "RIGHT", frame.BORDER - frame.SPACING, 0)
|
||||
end
|
||||
end
|
||||
|
||||
ComboPoints[i]:SetOrientation("HORIZONTAL")
|
||||
ComboPoints[i]:Show()
|
||||
end
|
||||
|
||||
if frame.USE_MINI_CLASSBAR and not frame.CLASSBAR_DETACHED then
|
||||
ComboPoints:ClearAllPoints()
|
||||
ComboPoints:Point("CENTER", frame.Health.backdrop, "TOP", 0, 0)
|
||||
|
||||
ComboPoints:SetParent(frame)
|
||||
ComboPoints:SetFrameLevel(50) --RaisedElementParent uses 100, we want it lower than this
|
||||
|
||||
if ComboPoints.Holder and ComboPoints.Holder.mover then
|
||||
ComboPoints.Holder.mover:SetScale(0.0001)
|
||||
ComboPoints.Holder.mover:SetAlpha(0)
|
||||
end
|
||||
elseif frame.CLASSBAR_DETACHED then
|
||||
if frame.USE_MINI_CLASSBAR then
|
||||
if db.combobar.orientation == "HORIZONTAL" then
|
||||
ComboPoints.Holder:Size(db.combobar.detachedWidth + (db.combobar.spacing * 4) - 20, db.combobar.height)
|
||||
else
|
||||
ComboPoints.Holder:Size(db.combobar.detachedWidth, (db.combobar.height * 5) + (db.combobar.spacing * 4))
|
||||
end
|
||||
else
|
||||
ComboPoints.Holder:Size(db.combobar.detachedWidth, db.combobar.height)
|
||||
end
|
||||
|
||||
|
||||
if not ComboPoints.Holder.mover then
|
||||
ComboPoints:ClearAllPoints()
|
||||
ComboPoints:Point("BOTTOMLEFT", ComboPoints.Holder, "BOTTOMLEFT", frame.BORDER + frame.SPACING, frame.BORDER + frame.SPACING)
|
||||
E:CreateMover(ComboPoints.Holder, "ComboBarMover", L["Combobar"], nil, nil, nil, "ALL,SOLO", nil, "unitframe,target,combobar")
|
||||
else
|
||||
ComboPoints:ClearAllPoints()
|
||||
ComboPoints:Point("BOTTOMLEFT", ComboPoints.Holder, "BOTTOMLEFT", frame.BORDER + frame.SPACING, frame.BORDER + frame.SPACING)
|
||||
ComboPoints.Holder.mover:SetScale(1)
|
||||
ComboPoints.Holder.mover:SetAlpha(1)
|
||||
end
|
||||
|
||||
if db.combobar.parent == "UIPARENT" then
|
||||
ComboPoints:SetParent(E.UIParent)
|
||||
else
|
||||
ComboPoints:SetParent(frame)
|
||||
end
|
||||
|
||||
if not db.combobar.strataAndLevel.useCustomStrata then
|
||||
ComboPoints:SetFrameStrata("LOW")
|
||||
else
|
||||
ComboPoints:SetFrameStrata(db.combobar.strataAndLevel.frameStrata)
|
||||
end
|
||||
|
||||
if not db.combobar.strataAndLevel.useCustomLevel then
|
||||
ComboPoints:SetFrameLevel(frame:GetFrameLevel() + 10) --Health uses 10, Power uses (Health + 5) when attached
|
||||
else
|
||||
ComboPoints:SetFrameLevel(db.combobar.strataAndLevel.frameLevel)
|
||||
end
|
||||
else
|
||||
ComboPoints:ClearAllPoints()
|
||||
|
||||
if frame.ORIENTATION == "RIGHT" then
|
||||
ComboPoints:Point("BOTTOMRIGHT", frame.Health.backdrop, "TOPRIGHT", -frame.BORDER, frame.SPACING*3)
|
||||
else
|
||||
ComboPoints:Point("BOTTOMLEFT", frame.Health.backdrop, "TOPLEFT", frame.BORDER, frame.SPACING*3)
|
||||
end
|
||||
|
||||
ComboPoints:SetParent(frame)
|
||||
ComboPoints:SetFrameStrata("LOW")
|
||||
ComboPoints:SetFrameLevel(frame:GetFrameLevel() + 10) --Health uses 10, Power uses (Health + 5) when attached
|
||||
|
||||
if ComboPoints.Holder and ComboPoints.Holder.mover then
|
||||
ComboPoints.Holder.mover:SetScale(0.0001)
|
||||
ComboPoints.Holder.mover:SetAlpha(0)
|
||||
end
|
||||
end
|
||||
|
||||
self:CombobarDetachedUpdate()
|
||||
|
||||
if frame.USE_CLASSBAR and not frame:IsElementEnabled("ComboPoints") then
|
||||
frame:EnableElement("ComboPoints")
|
||||
ComboPoints:Show()
|
||||
elseif not frame.USE_CLASSBAR and frame:IsElementEnabled("ComboPoints") then
|
||||
frame:DisableElement("ComboPoints")
|
||||
ComboPoints:Hide()
|
||||
end
|
||||
|
||||
if not frame:IsShown() then
|
||||
ComboPoints:ForceUpdate()
|
||||
end
|
||||
end
|
||||
|
||||
function UF:UpdateComboDisplay(event, unit)
|
||||
if unit == "pet" then return end
|
||||
if unit ~= "player" and (event == "UNIT_ENTERED_VEHICLE" or event == "UNIT_EXITING_VEHICLE") then return end
|
||||
|
||||
local db = self.db
|
||||
if not db then return end
|
||||
|
||||
local element = self.ComboPoints
|
||||
|
||||
if db.combobar.enable then
|
||||
local inVehicle = UnitHasVehicleUI("player") or UnitHasVehicleUI("vehicle")
|
||||
|
||||
local cp
|
||||
if inVehicle then
|
||||
cp = GetComboPoints("vehicle", "target")
|
||||
else
|
||||
cp = GetComboPoints("player", "target")
|
||||
end
|
||||
|
||||
local custom_backdrop = UF.db.colors.customclasspowerbackdrop and UF.db.colors.classpower_backdrop
|
||||
if cp == 0 and db.combobar.autoHide then
|
||||
element:Hide()
|
||||
UF.ToggleResourceBar(element)
|
||||
else
|
||||
element:Show()
|
||||
for i = 1, MAX_COMBO_POINTS do
|
||||
if i <= cp then
|
||||
element[i]:Show()
|
||||
else
|
||||
element[i]:Hide()
|
||||
end
|
||||
|
||||
if custom_backdrop then
|
||||
element[i].bg:SetVertexColor(custom_backdrop.r, custom_backdrop.g, custom_backdrop.b)
|
||||
else
|
||||
local r, g, b = element[i]:GetStatusBarColor()
|
||||
element[i].bg:SetVertexColor(r * 0.35, g * 0.35, b * 0.35)
|
||||
end
|
||||
end
|
||||
UF.ToggleResourceBar(element)
|
||||
end
|
||||
else
|
||||
element:Hide()
|
||||
UF.ToggleResourceBar(element)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,52 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
local pairs = pairs
|
||||
--WoW API / Variables
|
||||
|
||||
function UF:Configure_CustomTexts(frame)
|
||||
local db = frame.db
|
||||
|
||||
--Make sure CustomTexts are hidden if they don't exist in current profile
|
||||
for objectName, object in pairs(frame.customTexts) do
|
||||
if (not db.customTexts) or (db.customTexts and not db.customTexts[objectName]) then
|
||||
object:Hide()
|
||||
frame.customTexts[objectName] = nil
|
||||
end
|
||||
end
|
||||
|
||||
if db.customTexts then
|
||||
local customFont = UF.LSM:Fetch("font", UF.db.font)
|
||||
for objectName, _ in pairs(db.customTexts) do
|
||||
if not frame.customTexts[objectName] then
|
||||
frame.customTexts[objectName] = frame.RaisedElementParent:CreateFontString(nil, "OVERLAY")
|
||||
end
|
||||
|
||||
local objectDB = db.customTexts[objectName]
|
||||
|
||||
if objectDB.font then
|
||||
customFont = UF.LSM:Fetch("font", objectDB.font)
|
||||
end
|
||||
|
||||
local attachPoint = self:GetObjectAnchorPoint(frame, objectDB.attachTextTo)
|
||||
frame.customTexts[objectName]:FontTemplate(customFont, objectDB.size or UF.db.fontSize, objectDB.fontOutline or UF.db.fontOutline)
|
||||
frame.customTexts[objectName]:SetJustifyH(objectDB.justifyH or "CENTER")
|
||||
frame.customTexts[objectName]:ClearAllPoints()
|
||||
frame.customTexts[objectName]:Point(objectDB.justifyH or "CENTER", attachPoint, objectDB.justifyH or "CENTER", objectDB.xOffset, objectDB.yOffset)
|
||||
|
||||
--This takes care of custom texts that were added before the enable option was added.
|
||||
if objectDB.enable == nil then
|
||||
objectDB.enable = true
|
||||
end
|
||||
|
||||
if objectDB.enable then
|
||||
frame:Tag(frame.customTexts[objectName], objectDB.text_format or "")
|
||||
frame.customTexts[objectName]:Show()
|
||||
else
|
||||
frame:Untag(frame.customTexts[objectName])
|
||||
frame.customTexts[objectName]:Hide()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,87 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)) --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
--WoW API / Variables
|
||||
|
||||
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:SetPoint("TOPLEFT", powerTexture, "TOPRIGHT")
|
||||
cutawayPower:SetPoint("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:SetPoint("TOPLEFT", healthTexture, "TOPRIGHT")
|
||||
cutawayHealth:SetPoint("BOTTOMLEFT", healthTexture, "BOTTOMRIGHT")
|
||||
cutawayHealth:SetTexture(E.media.blankTex)
|
||||
cutaway.Health = cutawayHealth
|
||||
|
||||
return cutaway
|
||||
end
|
||||
|
||||
local cutawayPoints = {
|
||||
[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 index
|
||||
if db and db.orientation == "VERTICAL" then
|
||||
index = VERT_INDEX
|
||||
else
|
||||
index = DEFAULT_INDEX
|
||||
end
|
||||
|
||||
return cutawayPoints[index], cutawayPoints[index + 1]
|
||||
end
|
||||
|
||||
function UF:Configure_Cutaway(frame)
|
||||
local db = frame.db and frame.db.cutaway
|
||||
local healthDB, powerDB = db and db.health, db and db.power
|
||||
local healthEnabled = healthDB and healthDB.enabled
|
||||
local powerEnabled = powerDB and powerDB.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:SetPoint(point1[1], barTexture, point1[2])
|
||||
health:SetPoint(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:SetPoint(point1[1], barTexture, point1[2])
|
||||
power:SetPoint(point2[1], barTexture, point2[2])
|
||||
|
||||
frame.Power:PostUpdateColor()
|
||||
end
|
||||
elseif frame:IsElementEnabled("Cutaway") then
|
||||
frame:DisableElement("Cutaway")
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,65 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
--WoW API / Variables
|
||||
|
||||
function UF:Construct_DebuffHighlight(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")
|
||||
|
||||
frame.DebuffHighlightAlpha = 0.45
|
||||
frame.DebuffHighlightFilterTable = E.global.unitframe.DebuffHighlightColors
|
||||
|
||||
frame:CreateShadow()
|
||||
local x = frame.shadow
|
||||
frame.shadow = nil
|
||||
x:Hide()
|
||||
|
||||
frame.DBHGlow = x
|
||||
|
||||
if frame.Health then
|
||||
dbh:SetParent(frame.Health)
|
||||
frame.DBHGlow:SetParent(frame.Health)
|
||||
end
|
||||
|
||||
dbh.PostUpdate = UF.PostUpdate_DebuffHighlight
|
||||
|
||||
return dbh
|
||||
end
|
||||
|
||||
function UF:Configure_DebuffHighlight(frame)
|
||||
if E.db.unitframe.debuffHighlighting ~= "NONE" then
|
||||
frame:EnableElement("DebuffHighlight")
|
||||
|
||||
frame.DebuffHighlight:SetBlendMode(UF.db.colors.debuffHighlight.blendMode)
|
||||
frame.DebuffHighlightFilterTable = E.global.unitframe.DebuffHighlightColors
|
||||
|
||||
if E.db.unitframe.debuffHighlighting == "GLOW" then
|
||||
frame.DebuffHighlightBackdrop = true
|
||||
if frame.ThreatIndicator then
|
||||
frame.DBHGlow:SetAllPoints(frame.ThreatIndicator.glow)
|
||||
elseif frame.TargetGlow then
|
||||
frame.DBHGlow:SetAllPoints(frame.TargetGlow)
|
||||
end
|
||||
else
|
||||
frame.DebuffHighlightBackdrop = false
|
||||
end
|
||||
else
|
||||
frame:DisableElement("DebuffHighlight")
|
||||
end
|
||||
end
|
||||
|
||||
function UF:PostUpdate_DebuffHighlight(object, debuffType, texture, wasFiltered, style)
|
||||
if debuffType and not wasFiltered then
|
||||
local color = UF.db.colors.debuffHighlight[debuffType]
|
||||
if object.DebuffHighlightBackdrop and object.DBHGlow then
|
||||
object.DBHGlow:SetBackdropBorderColor(color.r, color.g, color.b, color.a)
|
||||
else
|
||||
object.DebuffHighlight:SetVertexColor(color.r, color.g, color.b, color.a)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,431 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
local _G = _G
|
||||
local pairs = pairs
|
||||
local select = select
|
||||
local assert = assert
|
||||
local tinsert = tinsert
|
||||
--WoW API / Variables
|
||||
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_Position(frame)
|
||||
UF:FrameGlow_CheckMouseover(frame)
|
||||
else
|
||||
UF:FrameGlow_PositionGlow(frame, glow, glow.powerGlow)
|
||||
end
|
||||
|
||||
if which == "targetGlow" then
|
||||
UF:FrameGlow_CheckTarget(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
|
||||
|
||||
if not fromScript then
|
||||
UF:FrameGlow_HookPowerBar(frame, power, powerName, glow, offset)
|
||||
end
|
||||
|
||||
local portrait = (frame.USE_PORTRAIT and not frame.USE_PORTRAIT_OVERLAY) and (frame.Portrait and frame.Portrait.backdrop)
|
||||
|
||||
if powerName == "HappinessIndicator" and (power and power.backdrop and power:IsVisible()) then
|
||||
if frame.ORIENTATION == "RIGHT" then
|
||||
glow:Point("TOPLEFT", power.backdrop, -offset, offset)
|
||||
glow:Point("TOPRIGHT", portrait or frame.Health.backdrop, offset, offset)
|
||||
else
|
||||
glow:Point("TOPLEFT", portrait or frame.Health.backdrop, -offset, offset)
|
||||
glow:Point("TOPRIGHT", power.backdrop, offset, offset)
|
||||
end
|
||||
else
|
||||
if (power and power.backdrop and power:IsVisible()) and (not (frame.CLASSBAR_DETACHED or frame.USE_MINI_CLASSBAR)) then
|
||||
glow:Point("TOPLEFT", (frame.ORIENTATION == "LEFT" and portrait) or power.backdrop, -offset, offset)
|
||||
glow:Point("TOPRIGHT", (frame.ORIENTATION == "RIGHT" and portrait) or power.backdrop, offset, offset)
|
||||
elseif frame.Health and frame.Health.backdrop then
|
||||
glow:Point("TOPLEFT", (frame.ORIENTATION == "LEFT" and portrait) or frame.Health.backdrop, -offset, offset)
|
||||
glow:Point("TOPRIGHT", (frame.ORIENTATION == "RIGHT" and portrait) or frame.Health.backdrop, offset, offset)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function UF:FrameGlow_PositionGlow(frame, mainGlow, powerGlow)
|
||||
if not (frame and frame.VARIABLES_SET) then return end
|
||||
|
||||
local additionalPower = frame.AdditionalPower
|
||||
local runes = frame.Runes
|
||||
local comboPoints = frame.ComboPoints
|
||||
local happiness = frame.HappinessIndicator
|
||||
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 = (E.PixelMode and 3) or 4 -- edgeSize is 3
|
||||
|
||||
mainGlow:ClearAllPoints()
|
||||
mainGlow:Point("TOPLEFT", (frame.ORIENTATION == "LEFT" and portrait) or health, -offset, offset)
|
||||
mainGlow:Point("TOPRIGHT", (frame.ORIENTATION == "RIGHT" and portrait) or health, offset, offset)
|
||||
|
||||
if frame.USE_POWERBAR_OFFSET or frame.USE_MINI_POWERBAR then
|
||||
mainGlow:Point("BOTTOMLEFT", health, -offset, -offset)
|
||||
mainGlow:Point("BOTTOMRIGHT", health, offset, -offset)
|
||||
else
|
||||
--offset is set because its one pixel off for some reason
|
||||
mainGlow:Point("BOTTOMLEFT", frame, -offset, -(E.PixelMode and offset or offset-1))
|
||||
mainGlow:Point("BOTTOMRIGHT", frame, offset, -(E.PixelMode and offset or offset-1))
|
||||
end
|
||||
|
||||
if powerGlow then
|
||||
powerGlow:ClearAllPoints()
|
||||
powerGlow:Point("TOPLEFT", power, -offset, offset)
|
||||
powerGlow:Point("TOPRIGHT", power, offset, offset)
|
||||
powerGlow:Point("BOTTOMLEFT", power, -offset, -offset)
|
||||
powerGlow:Point("BOTTOMRIGHT", power, offset, -offset)
|
||||
end
|
||||
|
||||
if additionalPower then
|
||||
UF:FrameGlow_ClassGlowPosition(frame, "AdditionalPower", mainGlow, offset)
|
||||
elseif runes then
|
||||
UF:FrameGlow_ClassGlowPosition(frame, "Runes", mainGlow, offset)
|
||||
elseif comboPoints then
|
||||
UF:FrameGlow_ClassGlowPosition(frame, "ComboPoints", mainGlow, offset)
|
||||
elseif happiness then
|
||||
UF:FrameGlow_ClassGlowPosition(frame, "HappinessIndicator", mainGlow, offset)
|
||||
end
|
||||
end
|
||||
|
||||
function UF:FrameGlow_CreateGlow(frame, mouse)
|
||||
-- Main Glow to wrap the health frame to it's best ability
|
||||
frame:CreateShadow()
|
||||
local mainGlow = frame.shadow
|
||||
mainGlow:SetFrameStrata("BACKGROUND")
|
||||
mainGlow:Hide()
|
||||
frame.shadow = nil
|
||||
|
||||
-- Secondary Glow for power frame when using power offset or mini power
|
||||
frame:CreateShadow()
|
||||
local powerGlow = frame.shadow
|
||||
powerGlow:SetFrameStrata("BACKGROUND")
|
||||
powerGlow:Hide()
|
||||
frame.shadow = nil
|
||||
|
||||
if mouse then
|
||||
mainGlow:SetFrameLevel(4)
|
||||
powerGlow:SetFrameLevel(4)
|
||||
else
|
||||
mainGlow:SetFrameLevel(3)
|
||||
powerGlow:SetFrameLevel(3)
|
||||
end
|
||||
|
||||
-- Eventing Frame
|
||||
if not frame.FrameGlow then
|
||||
frame.FrameGlow = CreateFrame("Frame", nil, frame)
|
||||
frame.FrameGlow:Hide()
|
||||
frame.FrameGlow:HookScript("OnEvent", function(_, event)
|
||||
if event == "UPDATE_MOUSEOVER_UNIT" then
|
||||
UF:FrameGlow_CheckMouseover(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.media.herocolor
|
||||
if color then
|
||||
r, g, b = color.r, color.g, color.b
|
||||
end
|
||||
end
|
||||
elseif reaction then
|
||||
local color = 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
|
||||
end
|
||||
|
||||
function UF:FrameGlow_CheckTarget(frame, setColor)
|
||||
if not (frame and frame.TargetGlow and frame:IsVisible()) then return end
|
||||
|
||||
local unit = frame.unit or (frame.isForced and "player")
|
||||
if E.db.unitframe.colors.frameGlow.targetGlow.enable and (unit and UnitIsUnit(unit, "target")) and not (frame.db and frame.db.disableTargetGlow) then
|
||||
if setColor then
|
||||
UF:FrameGlow_SetGlowColor(frame.TargetGlow, unit, "targetGlow")
|
||||
end
|
||||
if frame.TargetGlow.powerGlow then
|
||||
if frame.USE_POWERBAR_OFFSET or frame.USE_MINI_POWERBAR then
|
||||
frame.TargetGlow.powerGlow:Show()
|
||||
elseif frame.TargetGlow.powerGlow:IsShown() then
|
||||
frame.TargetGlow.powerGlow:Hide()
|
||||
end
|
||||
end
|
||||
frame.TargetGlow:Show()
|
||||
else
|
||||
UF:FrameGlow_HideGlow(frame.TargetGlow)
|
||||
end
|
||||
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_Position(frame)
|
||||
if frame.FrameGlow and frame.FrameGlow.texture then
|
||||
frame.FrameGlow.texture:ClearAllPoints()
|
||||
frame.FrameGlow.texture:Point("TOPLEFT", frame.Health, "TOPLEFT")
|
||||
frame.FrameGlow.texture:Point("BOTTOMRIGHT", frame.Health:GetStatusBarTexture(), "BOTTOMRIGHT")
|
||||
end
|
||||
end
|
||||
|
||||
function UF:Configure_FrameGlow(frame)
|
||||
if frame.FrameGlow and frame.FrameGlow.texture then
|
||||
local dbTexture = UF.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:HookScript("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("$parentHighlight", "OVERLAY")
|
||||
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, true)
|
||||
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)
|
||||
UF:FrameGlow_ElementHook(frame, targetGlow, "targetGlow")
|
||||
frame.FrameGlow:RegisterEvent("PLAYER_TARGET_CHANGED")
|
||||
|
||||
return targetGlow
|
||||
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 = UF.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
|
||||
@@ -0,0 +1,42 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
|
||||
function UF:Construct_GPS(frame)
|
||||
local gps = CreateFrame("Frame", nil, frame)
|
||||
gps:SetFrameLevel(frame:GetFrameLevel() + 50)
|
||||
gps:Hide()
|
||||
|
||||
gps.Texture = gps:CreateTexture("OVERLAY")
|
||||
gps.Texture:SetTexture(E.Media.Textures.Arrow)
|
||||
gps.Texture:SetBlendMode("BLEND")
|
||||
gps.Texture:SetVertexColor(214/255, 41/255, 41/255)
|
||||
gps.Texture:SetAllPoints()
|
||||
|
||||
return gps
|
||||
end
|
||||
|
||||
function UF:Configure_GPS(frame)
|
||||
local GPS = frame.GPS
|
||||
|
||||
if frame.db.GPSArrow.enable then
|
||||
if not frame:IsElementEnabled("GPS") then
|
||||
frame:EnableElement("GPS")
|
||||
end
|
||||
|
||||
GPS:Size(frame.db.GPSArrow.size)
|
||||
GPS.onMouseOver = frame.db.GPSArrow.onMouseOver
|
||||
GPS.outOfRange = frame.db.GPSArrow.outOfRange
|
||||
|
||||
GPS:Point("CENTER", frame, "CENTER", frame.db.GPSArrow.xOffset, frame.db.GPSArrow.yOffset)
|
||||
|
||||
GPS.UpdateState(frame)
|
||||
else
|
||||
if frame:IsElementEnabled("GPS") then
|
||||
frame:DisableElement("GPS")
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,127 @@
|
||||
local E, L, V, P, G = unpack(ElvUI)
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
--WoW API / Variables
|
||||
|
||||
function UF:Construct_Happiness(frame)
|
||||
local HappinessIndicator = CreateFrame("Statusbar", nil, frame)
|
||||
|
||||
HappinessIndicator.backdrop = CreateFrame("Frame", nil, HappinessIndicator)
|
||||
UF.statusbars[HappinessIndicator] = true
|
||||
HappinessIndicator.backdrop:SetTemplate("Default", nil, nil, self.thinBorders, true)
|
||||
HappinessIndicator.backdrop:SetFrameLevel(HappinessIndicator:GetFrameLevel() - 1)
|
||||
HappinessIndicator:SetInside(HappinessIndicator.backdrop)
|
||||
HappinessIndicator:SetOrientation("VERTICAL")
|
||||
HappinessIndicator:SetMinMaxValues(0, 100)
|
||||
HappinessIndicator:SetFrameLevel(50)
|
||||
|
||||
HappinessIndicator.bg = HappinessIndicator:CreateTexture(nil, "BORDER")
|
||||
HappinessIndicator.bg:SetAllPoints(HappinessIndicator)
|
||||
HappinessIndicator.bg:SetTexture(E.media.blankTex)
|
||||
HappinessIndicator.bg.multiplier = 0.3
|
||||
|
||||
HappinessIndicator.Override = UF.HappinessOverride
|
||||
|
||||
return HappinessIndicator
|
||||
end
|
||||
|
||||
function UF:Configure_Happiness(frame)
|
||||
if not frame.VARIABLES_SET then return end
|
||||
|
||||
local HappinessIndicator = frame.HappinessIndicator
|
||||
local db = frame.db
|
||||
|
||||
frame.HAPPINESS_WIDTH = HappinessIndicator and frame.HAPPINESS_SHOWN and (db.happiness.width + (frame.BORDER*3)) or 0
|
||||
|
||||
if db.happiness.enable then
|
||||
if not frame:IsElementEnabled("HappinessIndicator") then
|
||||
frame:EnableElement("HappinessIndicator")
|
||||
end
|
||||
|
||||
HappinessIndicator.backdrop:ClearAllPoints()
|
||||
if db.power.enable and not frame.USE_MINI_POWERBAR and not frame.USE_INSET_POWERBAR and not frame.POWERBAR_DETACHED and not frame.USE_POWERBAR_OFFSET then
|
||||
if frame.ORIENTATION == "RIGHT" then
|
||||
HappinessIndicator.backdrop:Point("BOTTOMRIGHT", frame.Power, "BOTTOMLEFT", -frame.BORDER + (frame.BORDER - frame.SPACING*3), -frame.BORDER)
|
||||
HappinessIndicator.backdrop:Point("TOPLEFT", frame.Health, "TOPLEFT", -frame.HAPPINESS_WIDTH, frame.BORDER)
|
||||
else
|
||||
HappinessIndicator.backdrop:Point("BOTTOMLEFT", frame.Power, "BOTTOMRIGHT", frame.BORDER + (-frame.BORDER + frame.SPACING*3), -frame.BORDER)
|
||||
HappinessIndicator.backdrop:Point("TOPRIGHT", frame.Health, "TOPRIGHT", frame.HAPPINESS_WIDTH, frame.BORDER)
|
||||
end
|
||||
else
|
||||
if frame.ORIENTATION == "RIGHT" then
|
||||
HappinessIndicator.backdrop:Point("BOTTOMRIGHT", frame.Health, "BOTTOMLEFT", -frame.BORDER + (frame.BORDER - frame.SPACING*3), -frame.BORDER)
|
||||
HappinessIndicator.backdrop:Point("TOPLEFT", frame.Health, "TOPLEFT", -frame.HAPPINESS_WIDTH, frame.BORDER)
|
||||
else
|
||||
HappinessIndicator.backdrop:Point("BOTTOMLEFT", frame.Health, "BOTTOMRIGHT", frame.BORDER + (-frame.BORDER + frame.SPACING*3), -frame.BORDER)
|
||||
HappinessIndicator.backdrop:Point("TOPRIGHT", frame.Health, "TOPRIGHT", frame.HAPPINESS_WIDTH, frame.BORDER)
|
||||
end
|
||||
end
|
||||
else
|
||||
if frame:IsElementEnabled("HappinessIndicator") then
|
||||
frame:DisableElement("HappinessIndicator")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function UF:HappinessOverride(event, unit)
|
||||
if not unit or self.unit ~= unit then return end
|
||||
|
||||
local db = self.db
|
||||
if not db then return end
|
||||
|
||||
local element = self.HappinessIndicator
|
||||
|
||||
if element.PreUpdate then
|
||||
element:PreUpdate()
|
||||
end
|
||||
|
||||
local _, hunterPet = HasPetUI()
|
||||
local happiness, damagePercentage = GetPetHappiness()
|
||||
local value, r, g, b
|
||||
|
||||
if hunterPet and happiness then
|
||||
if damagePercentage == 75 then
|
||||
value = 33
|
||||
r, g, b = 0.8, 0.2, 0.1
|
||||
elseif damagePercentage == 100 then
|
||||
value = 66
|
||||
r, g, b = 1, 1, 0
|
||||
elseif damagePercentage == 125 then
|
||||
value = 100
|
||||
r, g, b = 0, 0.8, 0
|
||||
end
|
||||
|
||||
element:SetValue(value)
|
||||
element:SetStatusBarColor(r, g, b)
|
||||
element.bg:SetVertexColor(r, g, b, 0.15)
|
||||
|
||||
if damagePercentage == 125 and db.happiness.autoHide then
|
||||
element:Hide()
|
||||
else
|
||||
element:Show()
|
||||
end
|
||||
else
|
||||
return element:Hide()
|
||||
end
|
||||
|
||||
local isShown = element:IsShown()
|
||||
local stateChanged
|
||||
|
||||
if (self.HAPPINESS_SHOWN and not isShown) or (not self.HAPPINESS_SHOWN and isShown) then
|
||||
stateChanged = true
|
||||
end
|
||||
|
||||
self.HAPPINESS_SHOWN = isShown
|
||||
|
||||
if stateChanged then
|
||||
UF:Configure_Happiness(self)
|
||||
UF:Configure_HealthBar(self)
|
||||
UF:Configure_Power(self)
|
||||
UF:Configure_InfoPanel(self, true)
|
||||
end
|
||||
|
||||
if element.PostUpdate then
|
||||
return element:PostUpdate(unit, happiness, damagePercentage)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,167 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
|
||||
function UF.HealthClipFrame_HealComm(frame)
|
||||
local pred = frame.HealCommBar
|
||||
if pred then
|
||||
UF:SetAlpha_HealComm(pred, true)
|
||||
UF:SetVisibility_HealComm(pred)
|
||||
end
|
||||
end
|
||||
|
||||
function UF:SetAlpha_HealComm(obj, show)
|
||||
obj.myBar:SetAlpha(show and 1 or 0)
|
||||
obj.otherBar:SetAlpha(show and 1 or 0)
|
||||
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)
|
||||
else
|
||||
obj.myBar:SetParent(obj.parent)
|
||||
obj.otherBar: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)
|
||||
|
||||
myBar:SetFrameLevel(11)
|
||||
otherBar:SetFrameLevel(11)
|
||||
|
||||
UF.statusbars[myBar] = true
|
||||
UF.statusbars[otherBar] = true
|
||||
|
||||
local texture = (not health.isTransparent and health:GetStatusBarTexture()) or E.media.blankTex
|
||||
UF:Update_StatusBar(myBar, texture)
|
||||
UF:Update_StatusBar(otherBar, texture)
|
||||
|
||||
local healPrediction = {
|
||||
myBar = myBar,
|
||||
otherBar = otherBar,
|
||||
PostUpdate = UF.UpdateHealComm,
|
||||
maxOverflow = 1,
|
||||
health = health,
|
||||
parent = parent,
|
||||
frame = frame
|
||||
}
|
||||
|
||||
UF:SetAlpha_HealComm(healPrediction)
|
||||
|
||||
return healPrediction
|
||||
end
|
||||
|
||||
function UF:Configure_HealComm(frame)
|
||||
if frame.db.healPrediction and frame.db.healPrediction.enable then
|
||||
local healPrediction = frame.HealCommBar
|
||||
local myBar = healPrediction.myBar
|
||||
local otherBar = healPrediction.otherBar
|
||||
local c = self.db.colors.healPrediction
|
||||
healPrediction.maxOverflow = 1 + (c.maxOverflow or 0)
|
||||
|
||||
if healPrediction.allowClippingUpdate then
|
||||
UF:SetVisibility_HealComm(healPrediction)
|
||||
end
|
||||
|
||||
if not frame:IsElementEnabled("HealComm4") then
|
||||
frame:EnableElement("HealComm4")
|
||||
end
|
||||
|
||||
if frame.db.health then
|
||||
local health = frame.Health
|
||||
local orientation = frame.db.health.orientation or health:GetOrientation()
|
||||
|
||||
myBar:SetOrientation(orientation)
|
||||
otherBar:SetOrientation(orientation)
|
||||
|
||||
if orientation == "HORIZONTAL" then
|
||||
local width = health:GetWidth()
|
||||
width = (width > 0 and width) or health.WIDTH
|
||||
local healthTexture = health:GetStatusBarTexture()
|
||||
|
||||
myBar:Size(width, 0)
|
||||
myBar:ClearAllPoints()
|
||||
myBar:Point("TOP", health, "TOP")
|
||||
myBar:Point("BOTTOM", health, "BOTTOM")
|
||||
myBar:Point("LEFT", healthTexture, "RIGHT")
|
||||
|
||||
otherBar:Size(width, 0)
|
||||
otherBar:ClearAllPoints()
|
||||
otherBar:Point("TOP", health, "TOP")
|
||||
otherBar:Point("BOTTOM", health, "BOTTOM")
|
||||
otherBar:Point("LEFT", myBar:GetStatusBarTexture(), "RIGHT")
|
||||
else
|
||||
local height = health:GetHeight()
|
||||
height = (height > 0 and height) or health.HEIGHT
|
||||
local healthTexture = health:GetStatusBarTexture()
|
||||
|
||||
myBar:Size(0, height)
|
||||
myBar:ClearAllPoints()
|
||||
myBar:Point("LEFT", health, "LEFT")
|
||||
myBar:Point("RIGHT", health, "RIGHT")
|
||||
myBar:Point("BOTTOM", healthTexture, "TOP")
|
||||
|
||||
otherBar:Size(0, height)
|
||||
otherBar:ClearAllPoints()
|
||||
otherBar:Point("LEFT", health, "LEFT")
|
||||
otherBar:Point("RIGHT", health, "RIGHT")
|
||||
otherBar:Point("BOTTOM", myBar:GetStatusBarTexture(), "TOP")
|
||||
end
|
||||
end
|
||||
|
||||
myBar:SetStatusBarColor(c.personal.r, c.personal.g, c.personal.b, c.personal.a)
|
||||
otherBar:SetStatusBarColor(c.others.r, c.others.g, c.others.b, c.others.a)
|
||||
elseif frame:IsElementEnabled("HealComm4") then
|
||||
frame:DisableElement("HealComm4")
|
||||
end
|
||||
end
|
||||
|
||||
local function UpdateFillBar(frame, previousTexture, bar, amount)
|
||||
if amount == 0 then
|
||||
bar:Hide()
|
||||
return previousTexture
|
||||
end
|
||||
|
||||
local orientation = frame:GetOrientation()
|
||||
bar:ClearAllPoints()
|
||||
if orientation == "HORIZONTAL" then
|
||||
bar:SetPoint("TOPLEFT", previousTexture, "TOPRIGHT")
|
||||
bar:SetPoint("BOTTOMLEFT", previousTexture, "BOTTOMRIGHT")
|
||||
else
|
||||
bar:SetPoint("BOTTOMRIGHT", previousTexture, "TOPRIGHT")
|
||||
bar:SetPoint("BOTTOMLEFT", previousTexture, "TOPLEFT")
|
||||
end
|
||||
|
||||
local totalWidth, totalHeight = frame:GetSize()
|
||||
if orientation == "HORIZONTAL" then
|
||||
bar:Width(totalWidth)
|
||||
else
|
||||
bar:Height(totalHeight)
|
||||
end
|
||||
|
||||
return bar:GetStatusBarTexture()
|
||||
end
|
||||
|
||||
function UF:UpdateHealComm(_, myIncomingHeal, allIncomingHeal)
|
||||
local health = self.health
|
||||
local previousTexture = health:GetStatusBarTexture()
|
||||
|
||||
previousTexture = UpdateFillBar(health, previousTexture, self.myBar, myIncomingHeal)
|
||||
UpdateFillBar(health, previousTexture, self.otherBar, allIncomingHeal)
|
||||
end
|
||||
@@ -0,0 +1,419 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
local random = random
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
local UnitIsTapped = UnitIsTapped
|
||||
local UnitIsTappedByPlayer = UnitIsTappedByPlayer
|
||||
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", nil, 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.25
|
||||
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, self.thinBorders, true)
|
||||
|
||||
local clipFrame = CreateFrame("Frame", nil, health)
|
||||
clipFrame:SetScript("OnUpdate", UF.HealthClipFrame_OnUpdate)
|
||||
clipFrame:SetAllPoints()
|
||||
clipFrame:EnableMouse(false)
|
||||
clipFrame.__frame = frame
|
||||
health.ClipFrame = clipFrame
|
||||
|
||||
return health
|
||||
end
|
||||
|
||||
function UF:Configure_HealthBar(frame)
|
||||
if not frame.VARIABLES_SET then return end
|
||||
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
|
||||
|
||||
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.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",
|
||||
-frame.BORDER - frame.SPACING - (frame.HAPPINESS_WIDTH or 0),
|
||||
-frame.BORDER - frame.SPACING - frame.CLASSBAR_YOFFSET
|
||||
)
|
||||
|
||||
if frame.USE_POWERBAR_OFFSET or frame.USE_ENERGYBAR_OFFSET or frame.USE_RAGEBAR_OFFSET then
|
||||
local totalOffset = 0
|
||||
if frame.USE_POWERBAR and frame.USE_POWERBAR_OFFSET then
|
||||
totalOffset = totalOffset + frame.POWERBAR_OFFSET
|
||||
end
|
||||
if frame.USE_ENERGYBAR and frame.USE_ENERGYBAR_OFFSET then
|
||||
totalOffset = totalOffset + frame.ENERGYBAR_OFFSET
|
||||
end
|
||||
if frame.USE_RAGEBAR and frame.USE_RAGEBAR_OFFSET then
|
||||
totalOffset = totalOffset + frame.RAGEBAR_OFFSET
|
||||
end
|
||||
|
||||
health:Point("TOPRIGHT", frame, "TOPRIGHT",
|
||||
-frame.BORDER - frame.SPACING - totalOffset - (frame.HAPPINESS_WIDTH or 0),
|
||||
-frame.BORDER - frame.SPACING - frame.CLASSBAR_YOFFSET
|
||||
)
|
||||
health:Point("BOTTOMLEFT", frame, "BOTTOMLEFT",
|
||||
frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING,
|
||||
frame.BORDER + frame.SPACING + totalOffset
|
||||
)
|
||||
|
||||
health.WIDTH = health.WIDTH - (frame.BORDER + frame.SPACING + totalOffset + (frame.HAPPINESS_WIDTH or 0)) - (frame.BORDER + frame.SPACING + frame.PORTRAIT_WIDTH)
|
||||
health.HEIGHT = health.HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.BORDER + frame.SPACING + totalOffset)
|
||||
elseif frame.POWERBAR_DETACHED or not frame.USE_POWERBAR or frame.USE_INSET_POWERBAR then
|
||||
health:Point("BOTTOMLEFT", frame, "BOTTOMLEFT", frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING, frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET)
|
||||
|
||||
health.WIDTH = health.WIDTH - (frame.BORDER + frame.SPACING + (frame.HAPPINESS_WIDTH or 0)) - (frame.BORDER + frame.SPACING + frame.PORTRAIT_WIDTH)
|
||||
health.HEIGHT = health.HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET)
|
||||
elseif frame.USE_MINI_POWERBAR or frame.USE_MINI_ENERGYBAR or frame.USE_MINI_RAGEBAR then
|
||||
local totalHeight = 0
|
||||
if frame.USE_POWERBAR and frame.USE_MINI_POWERBAR then
|
||||
totalHeight = totalHeight + (frame.POWERBAR_HEIGHT - frame.BORDER)
|
||||
end
|
||||
if frame.USE_ENERGYBAR and frame.USE_MINI_ENERGYBAR then
|
||||
totalHeight = totalHeight + (frame.ENERGYBAR_HEIGHT - frame.BORDER)
|
||||
end
|
||||
if frame.USE_RAGEBAR and frame.USE_MINI_RAGEBAR then
|
||||
totalHeight = totalHeight + (frame.RAGEBAR_HEIGHT - frame.BORDER)
|
||||
end
|
||||
health:Point("BOTTOMLEFT", frame, "BOTTOMLEFT",
|
||||
frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING,
|
||||
frame.SPACING + (totalHeight / 2)
|
||||
)
|
||||
|
||||
health.WIDTH = health.WIDTH - (frame.BORDER + frame.SPACING + (frame.HAPPINESS_WIDTH or 0)) - (frame.BORDER + frame.SPACING + frame.PORTRAIT_WIDTH)
|
||||
health.HEIGHT = health.HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.SPACING + totalHeight / 2)
|
||||
else
|
||||
health:Point("BOTTOMLEFT", frame, "BOTTOMLEFT",
|
||||
frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING,
|
||||
frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET
|
||||
)
|
||||
|
||||
health.WIDTH = health.WIDTH - (frame.BORDER + frame.SPACING + (frame.HAPPINESS_WIDTH or 0)) - (frame.BORDER + frame.SPACING + frame.PORTRAIT_WIDTH)
|
||||
health.HEIGHT = health.HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET)
|
||||
end
|
||||
elseif frame.ORIENTATION == "RIGHT" then
|
||||
health:Point("TOPLEFT", frame, "TOPLEFT", frame.BORDER + frame.SPACING + (frame.HAPPINESS_WIDTH or 0), -frame.BORDER - frame.SPACING - frame.CLASSBAR_YOFFSET)
|
||||
|
||||
if frame.USE_POWERBAR_OFFSET or frame.USE_ENERGYBAR_OFFSET or frame.USE_RAGEBAR_OFFSET then
|
||||
local totalOffset = 0
|
||||
if frame.USE_POWERBAR and frame.USE_POWERBAR_OFFSET then
|
||||
totalOffset = totalOffset + frame.POWERBAR_OFFSET
|
||||
end
|
||||
if frame.USE_ENERGYBAR and frame.USE_ENERGYBAR_OFFSET then
|
||||
totalOffset = totalOffset + frame.ENERGYBAR_OFFSET
|
||||
end
|
||||
if frame.USE_RAGEBAR and frame.USE_RAGEBAR_OFFSET then
|
||||
totalOffset = totalOffset + frame.RAGEBAR_OFFSET
|
||||
end
|
||||
|
||||
health:Point("TOPLEFT", frame, "TOPLEFT",
|
||||
frame.BORDER + frame.SPACING + totalOffset + (frame.HAPPINESS_WIDTH or 0),
|
||||
-frame.BORDER - frame.SPACING - frame.CLASSBAR_YOFFSET
|
||||
)
|
||||
health:Point("BOTTOMRIGHT", frame, "BOTTOMRIGHT",
|
||||
-frame.PORTRAIT_WIDTH - frame.BORDER - frame.SPACING,
|
||||
frame.BORDER + frame.SPACING + totalOffset
|
||||
)
|
||||
|
||||
health.WIDTH = health.WIDTH - (frame.BORDER + frame.SPACING + totalOffset + (frame.HAPPINESS_WIDTH or 0)) - (frame.BORDER + frame.SPACING + frame.PORTRAIT_WIDTH)
|
||||
health.HEIGHT = health.HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.BORDER + frame.SPACING + totalOffset)
|
||||
elseif frame.POWERBAR_DETACHED or not frame.USE_POWERBAR or frame.USE_INSET_POWERBAR then
|
||||
health:Point("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -frame.PORTRAIT_WIDTH - frame.BORDER - frame.SPACING, frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET)
|
||||
|
||||
health.WIDTH = health.WIDTH - (frame.BORDER + frame.SPACING + (frame.HAPPINESS_WIDTH or 0)) - (frame.BORDER + frame.SPACING + frame.PORTRAIT_WIDTH)
|
||||
health.HEIGHT = health.HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET)
|
||||
elseif frame.USE_MINI_POWERBAR or frame.USE_MINI_ENERGYBAR or frame.USE_MINI_RAGEBAR then
|
||||
local totalHeight = 0
|
||||
if frame.USE_POWERBAR and frame.USE_MINI_POWERBAR then
|
||||
totalHeight = totalHeight + (frame.POWERBAR_HEIGHT - frame.BORDER)
|
||||
end
|
||||
if frame.USE_ENERGYBAR and frame.USE_MINI_ENERGYBAR then
|
||||
totalHeight = totalHeight + (frame.ENERGYBAR_HEIGHT - frame.BORDER)
|
||||
end
|
||||
if frame.USE_RAGEBAR and frame.USE_MINI_RAGEBAR then
|
||||
totalHeight = totalHeight + (frame.RAGEBAR_HEIGHT - frame.BORDER)
|
||||
end
|
||||
health:Point("BOTTOMRIGHT", frame, "BOTTOMRIGHT",
|
||||
-frame.PORTRAIT_WIDTH - frame.BORDER - frame.SPACING,
|
||||
frame.SPACING + (totalHeight / 2)
|
||||
)
|
||||
|
||||
health.WIDTH = health.WIDTH - (frame.BORDER + frame.SPACING + (frame.HAPPINESS_WIDTH or 0)) - (frame.BORDER + frame.SPACING + frame.PORTRAIT_WIDTH)
|
||||
health.HEIGHT = health.HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.SPACING + totalHeight / 2)
|
||||
else
|
||||
health:Point("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -frame.PORTRAIT_WIDTH - frame.BORDER - frame.SPACING, frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET)
|
||||
|
||||
health.WIDTH = health.WIDTH - (frame.BORDER + frame.SPACING + (frame.HAPPINESS_WIDTH or 0)) - (frame.BORDER + frame.SPACING + frame.PORTRAIT_WIDTH)
|
||||
health.HEIGHT = health.HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET)
|
||||
end
|
||||
elseif frame.ORIENTATION == "MIDDLE" then
|
||||
health:Point("TOPRIGHT", frame, "TOPRIGHT", -frame.BORDER - frame.SPACING - (frame.HAPPINESS_WIDTH or 0), -frame.BORDER - frame.SPACING - frame.CLASSBAR_YOFFSET)
|
||||
|
||||
if frame.USE_POWERBAR_OFFSET or frame.USE_ENERGYBAR_OFFSET or frame.USE_RAGEBAR_OFFSET then
|
||||
local totalOffset = 0
|
||||
if frame.USE_POWERBAR and frame.USE_POWERBAR_OFFSET then
|
||||
totalOffset = totalOffset + frame.POWERBAR_OFFSET
|
||||
end
|
||||
if frame.USE_ENERGYBAR and frame.USE_ENERGYBAR_OFFSET then
|
||||
totalOffset = totalOffset + frame.ENERGYBAR_OFFSET
|
||||
end
|
||||
if frame.USE_RAGEBAR and frame.USE_RAGEBAR_OFFSET then
|
||||
totalOffset = totalOffset + frame.RAGEBAR_OFFSET
|
||||
end
|
||||
|
||||
health:Point("TOPRIGHT", frame, "TOPRIGHT",
|
||||
-frame.BORDER - frame.SPACING - totalOffset,
|
||||
-frame.BORDER - frame.SPACING - frame.CLASSBAR_YOFFSET
|
||||
)
|
||||
health:Point("BOTTOMLEFT", frame, "BOTTOMLEFT",
|
||||
frame.BORDER + frame.SPACING + totalOffset,
|
||||
frame.BORDER + frame.SPACING + totalOffset
|
||||
)
|
||||
|
||||
health.WIDTH = health.WIDTH - (frame.BORDER + frame.SPACING + totalOffset) - (frame.BORDER + frame.SPACING + totalOffset)
|
||||
health.HEIGHT = health.HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.BORDER + frame.SPACING + totalOffset)
|
||||
elseif frame.POWERBAR_DETACHED or not frame.USE_POWERBAR or frame.USE_INSET_POWERBAR then
|
||||
health:Point("BOTTOMLEFT", frame, "BOTTOMLEFT", frame.BORDER + frame.SPACING, frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET)
|
||||
|
||||
health.WIDTH = health.WIDTH - (frame.BORDER + frame.SPACING + (frame.HAPPINESS_WIDTH or 0)) - (frame.BORDER + frame.SPACING)
|
||||
health.HEIGHT = health.HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET)
|
||||
elseif frame.USE_MINI_POWERBAR then
|
||||
local totalHeight = 0
|
||||
if frame.USE_POWERBAR and frame.USE_MINI_POWERBAR then
|
||||
totalHeight = totalHeight + (frame.POWERBAR_HEIGHT - frame.BORDER)
|
||||
end
|
||||
if frame.USE_ENERGYBAR and frame.USE_MINI_ENERGYBAR then
|
||||
totalHeight = totalHeight + (frame.ENERGYBAR_HEIGHT - frame.BORDER)
|
||||
end
|
||||
if frame.USE_RAGEBAR and frame.USE_MINI_RAGEBAR then
|
||||
totalHeight = totalHeight + (frame.RAGEBAR_HEIGHT - frame.BORDER)
|
||||
end
|
||||
health:Point("BOTTOMLEFT", frame, "BOTTOMLEFT",
|
||||
frame.BORDER + frame.SPACING,
|
||||
frame.SPACING + (totalHeight / 2)
|
||||
)
|
||||
|
||||
health.WIDTH = health.WIDTH - (frame.BORDER + frame.SPACING + (frame.HAPPINESS_WIDTH or 0)) - (frame.BORDER + frame.SPACING)
|
||||
health.HEIGHT = health.HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.SPACING + totalHeight / 2)
|
||||
else
|
||||
health:Point("BOTTOMLEFT", frame, "BOTTOMLEFT", frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING, frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET)
|
||||
|
||||
health.WIDTH = health.WIDTH - (frame.BORDER + frame.SPACING + (frame.HAPPINESS_WIDTH or 0)) - (frame.BORDER + frame.SPACING + frame.PORTRAIT_WIDTH)
|
||||
health.HEIGHT = health.HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.BORDER + frame.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
|
||||
|
||||
--Party/Raid Frames can toggle frequent updates
|
||||
if db.health.frequentUpdates == nil then
|
||||
db.health.frequentUpdates = true
|
||||
end
|
||||
|
||||
--health:SetFrequentUpdates(db.health.frequentUpdates)
|
||||
end
|
||||
|
||||
--Transparency Settings
|
||||
UF:ToggleTransparentStatusBar(UF.db.colors.transparentHealth, frame.Health, frame.Health.bg, true, nil)
|
||||
|
||||
--Prediction Texture; keep under ToggleTransparentStatusBar
|
||||
UF:UpdatePredictionStatusBar(frame.HealthPrediction, frame.Health)
|
||||
|
||||
--Highlight Texture
|
||||
UF:Configure_FrameGlow(frame)
|
||||
|
||||
if frame:IsElementEnabled("Health") then
|
||||
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 - (frame.BORDER-frame.SPACING)
|
||||
end
|
||||
if frame.USE_ENERGYBAR and not frame.ENERGYBAR_DETACHED and not frame.USE_INSET_ENERGYBAR then
|
||||
bottomOffset = bottomOffset + frame.ENERGYBAR_HEIGHT - (frame.BORDER-frame.SPACING)
|
||||
end
|
||||
if frame.USE_RAGEBAR and not frame.RAGEBAR_DETACHED and not frame.USE_INSET_RAGEBAR then
|
||||
bottomOffset = bottomOffset + frame.RAGEBAR_HEIGHT - (frame.BORDER-frame.SPACING)
|
||||
end
|
||||
if frame.USE_INFO_PANEL then
|
||||
bottomOffset = bottomOffset + frame.INFO_PANEL_HEIGHT - (frame.BORDER - frame.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) or colors.colorhealthbyvalue_threshold) and not (UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit))) then
|
||||
local cur, max = self.cur or 1, self.max or 100
|
||||
if parent.isForced then
|
||||
cur = parent.forcedHealth or cur
|
||||
max = (cur > max and cur * 2) or max
|
||||
end
|
||||
if colors.colorhealthbyvalue then
|
||||
newr, newg, newb = ElvUF:ColorGradient(cur, max, 1, 0, 0, 1, 1, 0, r, g, b)
|
||||
elseif colors.colorhealthbyvalue_threshold then
|
||||
local perc = cur / max
|
||||
if perc > 0.75 then
|
||||
if colors.colorhealthbyvalue_thresholdgradient then
|
||||
newr, newg, newb = ElvUF:ColorGradient(perc, 1, r, g, b, colors.threshold_75.r, colors.threshold_75.g, colors.threshold_75.b, r, g, b)
|
||||
else
|
||||
newr, newg, newb = r, g, b
|
||||
end
|
||||
elseif perc > 0.5 then
|
||||
if colors.colorhealthbyvalue_thresholdgradient then
|
||||
newr, newg, newb = ElvUF:ColorGradient(((perc / .5) + 1), 2.5, r, g, b, colors.threshold_50.r, colors.threshold_50.g, colors.threshold_50.b, colors.threshold_75.r, colors.threshold_75.g, colors.threshold_75.b)
|
||||
else
|
||||
newr, newg, newb = colors.threshold_75.r, colors.threshold_75.g, colors.threshold_75.b
|
||||
end
|
||||
elseif perc > 0.35 then
|
||||
if colors.colorhealthbyvalue_thresholdgradient then
|
||||
newr, newg, newb = ElvUF:ColorGradient(((perc / .35) + 1), 2.43, r, g, b, colors.threshold_35.r, colors.threshold_35.g, colors.threshold_35.b, colors.threshold_50.r, colors.threshold_50.g, colors.threshold_50.b)
|
||||
else
|
||||
newr, newg, newb = colors.threshold_50.r, colors.threshold_50.g, colors.threshold_50.b
|
||||
end
|
||||
elseif perc > 0.2 then
|
||||
if colors.colorhealthbyvalue_thresholdgradient then
|
||||
newr, newg, newb = ElvUF:ColorGradient(((perc / .2) + 1), 2.75, r, g, b, colors.threshold_20.r, colors.threshold_20.g, colors.threshold_20.b, colors.threshold_35.r, colors.threshold_35.g, colors.threshold_35.b)
|
||||
else
|
||||
newr, newg, newb = colors.threshold_35.r, colors.threshold_35.g, colors.threshold_35.b
|
||||
end
|
||||
else
|
||||
newr, newg, newb = colors.threshold_20.r, colors.threshold_20.g, colors.threshold_20.b
|
||||
end
|
||||
end
|
||||
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(_, _, max)
|
||||
local parent = self:GetParent()
|
||||
if parent.isForced then
|
||||
local cur = random(1, max or 100)
|
||||
parent.forcedHealth = cur
|
||||
self:SetValue(cur)
|
||||
else
|
||||
if parent.forcedHealth then
|
||||
parent.forcedHealth = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,61 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
|
||||
function UF:Construct_InfoPanel(frame)
|
||||
local infoPanel = CreateFrame("Frame", nil, frame)
|
||||
|
||||
infoPanel:SetFrameLevel(7) --Health is 10 and filled power is 5 by default
|
||||
local thinBorders = self.thinBorders
|
||||
infoPanel:CreateBackdrop(nil, true, nil, thinBorders, true)
|
||||
|
||||
return infoPanel
|
||||
end
|
||||
|
||||
function UF:Configure_InfoPanel(frame, noTemplateChange)
|
||||
if not frame.VARIABLES_SET then return end
|
||||
local db = frame.db
|
||||
|
||||
if frame.USE_INFO_PANEL then
|
||||
frame.InfoPanel:Show()
|
||||
frame.InfoPanel:ClearAllPoints()
|
||||
|
||||
if frame.ORIENTATION == "RIGHT" and frame.unitframeType ~= "arena" then
|
||||
frame.InfoPanel:Point("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -frame.BORDER - frame.SPACING, frame.BORDER + frame.SPACING)
|
||||
if frame.USE_RAGEBAR and not frame.USE_INSET_RAGEBAR and not frame.RAGEBAR_DETACHED then
|
||||
frame.InfoPanel:Point("TOPLEFT", frame.Rage.backdrop, "BOTTOMLEFT", frame.BORDER, -(frame.SPACING*3))
|
||||
elseif frame.USE_ENERGYBAR and not frame.USE_INSET_ENERGYBAR and not frame.ENERGYBAR_DETACHED then
|
||||
frame.InfoPanel:Point("TOPLEFT", frame.Energy.backdrop, "BOTTOMLEFT", frame.BORDER, -(frame.SPACING*3))
|
||||
elseif frame.USE_POWERBAR and not frame.USE_INSET_POWERBAR and not frame.POWERBAR_DETACHED then
|
||||
frame.InfoPanel:Point("TOPLEFT", frame.Power.backdrop, "BOTTOMLEFT", frame.BORDER, -(frame.SPACING*3))
|
||||
else
|
||||
frame.InfoPanel:Point("TOPLEFT", frame.Health.backdrop, "BOTTOMLEFT", frame.BORDER, -(frame.SPACING*3))
|
||||
end
|
||||
else
|
||||
frame.InfoPanel:Point("BOTTOMLEFT", frame, "BOTTOMLEFT", frame.BORDER + frame.SPACING, frame.BORDER + frame.SPACING)
|
||||
if frame.USE_RAGEBAR and not frame.USE_INSET_RAGEBAR and not frame.RAGEBAR_DETACHED then
|
||||
frame.InfoPanel:Point("TOPRIGHT", frame.Rage.backdrop, "BOTTOMRIGHT", -frame.BORDER, -(frame.SPACING*3))
|
||||
elseif frame.USE_ENERGYBAR and not frame.USE_INSET_ENERGYBAR and not frame.ENERGYBAR_DETACHED then
|
||||
frame.InfoPanel:Point("TOPRIGHT", frame.Energy.backdrop, "BOTTOMRIGHT", -frame.BORDER, -(frame.SPACING*3))
|
||||
elseif frame.USE_POWERBAR and not frame.USE_INSET_POWERBAR and not frame.POWERBAR_DETACHED then
|
||||
frame.InfoPanel:Point("TOPRIGHT", frame.Power.backdrop, "BOTTOMRIGHT", -frame.BORDER, -(frame.SPACING*3))
|
||||
else
|
||||
frame.InfoPanel:Point("TOPRIGHT", frame.Health.backdrop, "BOTTOMRIGHT", -frame.BORDER, -(frame.SPACING*3))
|
||||
end
|
||||
end
|
||||
|
||||
if (not noTemplateChange) then
|
||||
local thinBorders = self.thinBorders
|
||||
if db.infoPanel.transparent then
|
||||
frame.InfoPanel.backdrop:SetTemplate("Transparent", nil, nil, thinBorders, true)
|
||||
else
|
||||
frame.InfoPanel.backdrop:SetTemplate(nil, true, nil, thinBorders, true)
|
||||
end
|
||||
end
|
||||
else
|
||||
frame.InfoPanel:Hide()
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,35 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/">
|
||||
<Script file="AuraBars.lua"/>
|
||||
<Script file="Auras.lua"/>
|
||||
<Script file="BuffIndicator.lua"/>
|
||||
<Script file="CastBar.lua"/>
|
||||
<Script file="ClassBars.lua"/>
|
||||
<Script file="CombatIndicator.lua"/>
|
||||
<Script file="ComboPoints.lua"/>
|
||||
<Script file="CustomText.lua"/>
|
||||
<Script file="Cutaway.lua"/>
|
||||
<Script file="DebuffHighlight.lua"/>
|
||||
<Script file="FrameGlow.lua"/>
|
||||
<Script file="GPS.lua"/>
|
||||
<Script file="Happiness.lua"/>
|
||||
<Script file="HealComm.lua"/>
|
||||
<Script file="Health.lua"/>
|
||||
<Script file="InfoPanel.lua"/>
|
||||
<Script file="Name.lua"/>
|
||||
<Script file="Portrait.lua"/>
|
||||
<Script file="Power.lua"/>
|
||||
<Script file="PowerRage.lua"/>
|
||||
<Script file="PowerEnergy.lua"/>
|
||||
<Script file="PvPIcon.lua"/>
|
||||
<Script file="PvPIndicator.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="RoleIcons.lua"/>
|
||||
<Script file="Threat.lua"/>
|
||||
<Script file="Trinket.lua"/>
|
||||
</Ui>
|
||||
@@ -0,0 +1,50 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
--WoW API / Variables
|
||||
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, childType)
|
||||
local db = frame.db
|
||||
if childType == "pet" then
|
||||
db = frame.db.petsGroup
|
||||
elseif childType == "target" then
|
||||
db = frame.db.targetsGroup
|
||||
end
|
||||
|
||||
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
|
||||
@@ -0,0 +1,139 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
|
||||
function UF:Construct_Portrait(frame, type)
|
||||
local portrait
|
||||
|
||||
if type == "texture" then
|
||||
local backdrop = CreateFrame("Frame", nil, frame)
|
||||
portrait = frame:CreateTexture(nil, "OVERLAY")
|
||||
portrait:SetTexCoord(0.15, 0.85, 0.15, 0.85)
|
||||
backdrop:SetOutside(portrait)
|
||||
backdrop:SetFrameLevel(frame:GetFrameLevel())
|
||||
backdrop:SetTemplate("Default")
|
||||
portrait.backdrop = backdrop
|
||||
else
|
||||
portrait = CreateFrame("PlayerModel", nil, frame)
|
||||
portrait:CreateBackdrop("Default", nil, nil, self.thinBorders, true)
|
||||
end
|
||||
|
||||
portrait.PostUpdate = self.PortraitUpdate
|
||||
|
||||
return portrait
|
||||
end
|
||||
|
||||
function UF:Configure_Portrait(frame, dontHide)
|
||||
if not frame.VARIABLES_SET then return end
|
||||
local db = frame.db
|
||||
|
||||
if frame.Portrait and not dontHide then
|
||||
frame.Portrait:Hide()
|
||||
frame.Portrait:ClearAllPoints()
|
||||
frame.Portrait.backdrop:Hide()
|
||||
end
|
||||
frame.Portrait = db.portrait.style == "2D" and frame.Portrait2D or frame.Portrait3D
|
||||
|
||||
local portrait = frame.Portrait
|
||||
if frame.USE_PORTRAIT then
|
||||
if not frame:IsElementEnabled("Portrait") then
|
||||
frame:EnableElement("Portrait")
|
||||
end
|
||||
|
||||
local color = E.db.unitframe.colors.borderColor
|
||||
portrait.backdrop:SetBackdropBorderColor(color.r, color.g, color.b)
|
||||
|
||||
portrait:ClearAllPoints()
|
||||
portrait.backdrop:ClearAllPoints()
|
||||
if frame.USE_PORTRAIT_OVERLAY then
|
||||
if db.portrait.style == "3D" then
|
||||
portrait:SetFrameLevel(frame.Health:GetFrameLevel() + 1)
|
||||
else
|
||||
portrait:SetParent(frame.Health)
|
||||
end
|
||||
|
||||
portrait:SetAlpha(db.portrait.overlayAlpha)
|
||||
if not dontHide then
|
||||
portrait:Show()
|
||||
end
|
||||
portrait.backdrop:Hide()
|
||||
|
||||
portrait:ClearAllPoints()
|
||||
if db.portrait.fullOverlay then
|
||||
portrait:SetAllPoints(frame.Health)
|
||||
else
|
||||
local statusBarTex = frame.Health:GetStatusBarTexture()
|
||||
if frame.Health:GetOrientation() == "VERTICAL" then
|
||||
portrait:SetPoint("BOTTOMLEFT", frame.Health)
|
||||
portrait:SetPoint("TOPRIGHT", statusBarTex, "TOPRIGHT")
|
||||
else
|
||||
portrait:SetPoint("TOPLEFT", frame.Health)
|
||||
portrait:SetPoint("BOTTOMRIGHT", statusBarTex, "BOTTOMRIGHT")
|
||||
end
|
||||
end
|
||||
else
|
||||
portrait:ClearAllPoints()
|
||||
portrait:SetAllPoints()
|
||||
portrait:SetAlpha(1)
|
||||
if not dontHide then
|
||||
portrait:Show()
|
||||
end
|
||||
portrait.backdrop:Show()
|
||||
if db.portrait.style == "3D" then
|
||||
portrait:SetFrameLevel(frame.Health:GetFrameLevel() -4) --Make sure portrait is behind Health and Power
|
||||
else
|
||||
portrait:SetParent(frame)
|
||||
end
|
||||
|
||||
if frame.ORIENTATION == "LEFT" then
|
||||
portrait.backdrop:Point("TOPLEFT", frame, "TOPLEFT", frame.SPACING, frame.USE_MINI_CLASSBAR and -(frame.CLASSBAR_YOFFSET+frame.SPACING) or -frame.SPACING)
|
||||
|
||||
if frame.USE_RAGEBAR and not frame.USE_INSET_RAGEBAR and not frame.RAGEBAR_DETACHED and not frame.USE_MINI_RAGEBAR and not frame.USE_RAGEBAR_OFFSET then
|
||||
portrait.backdrop:Point("BOTTOMRIGHT", frame.Rage.backdrop, "BOTTOMLEFT", frame.BORDER - frame.SPACING*3, 0)
|
||||
elseif frame.USE_ENERGYBAR and not frame.USE_INSET_ENERGYBAR and not frame.ENERGYBAR_DETACHED and not frame.USE_MINI_ENERGYBAR and not frame.USE_ENERGYBAR_OFFSET then
|
||||
portrait.backdrop:Point("BOTTOMRIGHT", frame.Energy.backdrop, "BOTTOMLEFT", frame.BORDER - frame.SPACING*3, 0)
|
||||
elseif frame.USE_POWERBAR and not frame.USE_INSET_POWERBAR and not frame.POWERBAR_DETACHED and not frame.USE_MINI_POWERBAR and not frame.USE_POWERBAR_OFFSET then
|
||||
portrait.backdrop:Point("BOTTOMRIGHT", frame.Power.backdrop, "BOTTOMLEFT", frame.BORDER - frame.SPACING*3, 0)
|
||||
else
|
||||
portrait.backdrop:Point("BOTTOMRIGHT", frame.Health.backdrop, "BOTTOMLEFT", frame.BORDER - frame.SPACING*3, 0)
|
||||
end
|
||||
elseif frame.ORIENTATION == "RIGHT" then
|
||||
portrait.backdrop:Point("TOPRIGHT", frame, "TOPRIGHT", -frame.SPACING, frame.USE_MINI_CLASSBAR and -(frame.CLASSBAR_YOFFSET+frame.SPACING) or -frame.SPACING)
|
||||
|
||||
if frame.USE_RAGEBAR and not frame.USE_INSET_RAGEBAR and not frame.RAGEBAR_DETACHED and not frame.USE_MINI_RAGEBAR and not frame.USE_RAGEBAR_OFFSET then
|
||||
portrait.backdrop:Point("BOTTOMLEFT", frame.Rage.backdrop, "BOTTOMRIGHT", -frame.BORDER + frame.SPACING*3, 0)
|
||||
elseif frame.USE_ENERGYBAR and not frame.USE_INSET_ENERGYBAR and not frame.ENERGYBAR_DETACHED and not frame.USE_MINI_ENERGYBAR and not frame.USE_ENERGYBAR_OFFSET then
|
||||
portrait.backdrop:Point("BOTTOMLEFT", frame.Energy.backdrop, "BOTTOMRIGHT", -frame.BORDER + frame.SPACING*3, 0)
|
||||
elseif frame.USE_POWERBAR and not frame.USE_INSET_POWERBAR and not frame.POWERBAR_DETACHED and not frame.USE_MINI_POWERBAR and not frame.USE_POWERBAR_OFFSET then
|
||||
portrait.backdrop:Point("BOTTOMLEFT", frame.Power.backdrop, "BOTTOMRIGHT", -frame.BORDER + frame.SPACING*3, 0)
|
||||
else
|
||||
portrait.backdrop:Point("BOTTOMLEFT", frame.Health.backdrop, "BOTTOMRIGHT", -frame.BORDER + frame.SPACING*3, 0)
|
||||
end
|
||||
end
|
||||
|
||||
portrait:SetInside(portrait.backdrop, frame.BORDER)
|
||||
end
|
||||
else
|
||||
if frame:IsElementEnabled("Portrait") then
|
||||
frame:DisableElement("Portrait")
|
||||
portrait:Hide()
|
||||
portrait.backdrop:Hide()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function UF:PortraitUpdate()
|
||||
local db = self:GetParent().db
|
||||
if not db then return end
|
||||
|
||||
local portrait = db.portrait
|
||||
if portrait.enable and self:GetParent().USE_PORTRAIT_OVERLAY then
|
||||
self:SetAlpha(0)
|
||||
self:SetAlpha(db.portrait.overlayAlpha)
|
||||
else
|
||||
self:SetAlpha(1)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,345 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
local random = random
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
|
||||
local _, ns = ...
|
||||
local ElvUF = ns.oUF
|
||||
assert(ElvUF, "ElvUI was unable to locate oUF.")
|
||||
|
||||
function UF:Construct_PowerBar(frame, bg, text, textPos)
|
||||
local power = CreateFrame("StatusBar", nil, frame)
|
||||
UF.statusbars[power] = true
|
||||
|
||||
power.RaisedElementParent = CreateFrame("Frame", nil, power)
|
||||
power.RaisedElementParent:SetFrameLevel(power:GetFrameLevel() + 100)
|
||||
power.RaisedElementParent:SetAllPoints()
|
||||
|
||||
power.PostUpdate = self.PostUpdatePower
|
||||
power.PostUpdateColor = self.PostUpdatePowerColor
|
||||
|
||||
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)
|
||||
|
||||
power.value.frequentUpdates = true
|
||||
end
|
||||
|
||||
power.colorDisconnected = false
|
||||
power.colorTapping = false
|
||||
power:CreateBackdrop("Default", nil, nil, self.thinBorders, true)
|
||||
|
||||
local clipFrame = CreateFrame('Frame', nil, power)
|
||||
clipFrame:SetAllPoints()
|
||||
clipFrame:EnableMouse(false)
|
||||
clipFrame.__frame = frame
|
||||
power.ClipFrame = clipFrame
|
||||
|
||||
return power
|
||||
end
|
||||
|
||||
function UF:Configure_Power(frame)
|
||||
if not frame.VARIABLES_SET then return end
|
||||
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")
|
||||
power:Show()
|
||||
end
|
||||
|
||||
E:SetSmoothing(power, self.db.smoothbars)
|
||||
|
||||
--Text
|
||||
local attachPoint = self: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
|
||||
|
||||
--Colors
|
||||
power.colorClass = nil
|
||||
power.colorReaction = nil
|
||||
power.colorPower = nil
|
||||
|
||||
if 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 self.thinBorders and not E.PixelMode) 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
|
||||
if db.power then db.power.height = 7 end
|
||||
heightChanged = true
|
||||
elseif (self.thinBorders or E.PixelMode) 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
|
||||
if db.power then db.power.height = 3 end
|
||||
heightChanged = true
|
||||
end
|
||||
if heightChanged then
|
||||
--Update health size
|
||||
frame.BOTTOM_OFFSET = UF:GetHealthBottomOffset(frame)
|
||||
UF:Configure_HealthBar(frame)
|
||||
end
|
||||
|
||||
--Position
|
||||
power:ClearAllPoints()
|
||||
if frame.POWERBAR_DETACHED then
|
||||
power:Width(frame.POWERBAR_WIDTH - ((frame.BORDER + frame.SPACING)*2))
|
||||
power:Height(frame.POWERBAR_HEIGHT - ((frame.BORDER + frame.SPACING)*2))
|
||||
if not power.Holder or (power.Holder and not power.Holder.mover) then
|
||||
power.Holder = CreateFrame("Frame", nil, power)
|
||||
power.Holder:Size(frame.POWERBAR_WIDTH, frame.POWERBAR_HEIGHT)
|
||||
power.Holder:Point("BOTTOM", frame, "BOTTOM", 0, -20)
|
||||
power:ClearAllPoints()
|
||||
power:Point("BOTTOMLEFT", power.Holder, "BOTTOMLEFT", frame.BORDER+frame.SPACING, frame.BORDER+frame.SPACING)
|
||||
--Currently only Player and Target can detach power bars, so doing it this way is okay for now
|
||||
if frame.unitframeType and frame.unitframeType == "player" then
|
||||
E:CreateMover(power.Holder, "PlayerPowerBarMover", L["Player Powerbar"], nil, nil, nil, "ALL,SOLO", nil, "unitframe,player,power")
|
||||
elseif frame.unitframeType and frame.unitframeType == "target" then
|
||||
E:CreateMover(power.Holder, "TargetPowerBarMover", L["Target Powerbar"], nil, nil, nil, "ALL,SOLO", nil, "unitframe,target,power")
|
||||
end
|
||||
else
|
||||
power.Holder:Size(frame.POWERBAR_WIDTH, frame.POWERBAR_HEIGHT)
|
||||
power:ClearAllPoints()
|
||||
power:Point("BOTTOMLEFT", power.Holder, "BOTTOMLEFT", frame.BORDER+frame.SPACING, frame.BORDER+frame.SPACING)
|
||||
power.Holder.mover:SetScale(1)
|
||||
power.Holder.mover:SetAlpha(1)
|
||||
end
|
||||
|
||||
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.HAPPINESS_WIDTH or 0),
|
||||
-frame.POWERBAR_OFFSET
|
||||
)
|
||||
power:Point("BOTTOMLEFT", frame.Health, "BOTTOMLEFT",
|
||||
frame.POWERBAR_OFFSET,
|
||||
-frame.POWERBAR_OFFSET
|
||||
)
|
||||
elseif frame.ORIENTATION == "MIDDLE" then
|
||||
local totalOffset = 0
|
||||
if frame.USE_ENERGYBAR and frame.USE_ENERGYBAR_OFFSET then
|
||||
totalOffset = totalOffset + frame.ENERGYBAR_OFFSET
|
||||
end
|
||||
if frame.USE_RAGEBAR and frame.USE_RAGEBAR_OFFSET then
|
||||
totalOffset = totalOffset + frame.RAGEBAR_OFFSET
|
||||
end
|
||||
|
||||
power:Point("TOPLEFT", frame, "TOPLEFT",
|
||||
frame.BORDER + frame.SPACING + totalOffset,
|
||||
-(frame.POWERBAR_OFFSET + frame.CLASSBAR_YOFFSET) --+ frame.BORDER - frame.SPACING)
|
||||
)
|
||||
power:Point("BOTTOMRIGHT", frame, "BOTTOMRIGHT",
|
||||
-(frame.BORDER + frame.SPACING + totalOffset),
|
||||
frame.BORDER + frame.SPACING + totalOffset
|
||||
)
|
||||
|
||||
--power.WIDTH = power.WIDTH - (frame.BORDER + frame.SPACING + totalOffset) - (frame.BORDER + frame.SPACING + totalOffset)
|
||||
--power.HEIGHT = power.HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.BORDER + frame.SPACING + totalOffset)
|
||||
|
||||
--[[local totalOffset = 0
|
||||
if frame.USE_ENERGYBAR_OFFSET then
|
||||
totalOffset = totalOffset + frame.ENERGYBAR_OFFSET
|
||||
end
|
||||
if frame.USE_RAGEBAR_OFFSET then
|
||||
totalOffset = totalOffset + frame.RAGEBAR_OFFSET
|
||||
end
|
||||
power:Point("TOPLEFT", frame, "TOPLEFT",
|
||||
frame.BORDER + frame.SPACING,
|
||||
-frame.POWERBAR_OFFSET - frame.CLASSBAR_YOFFSET
|
||||
)
|
||||
power:Point("BOTTOMRIGHT", frame, "BOTTOMRIGHT",
|
||||
-frame.BORDER - frame.SPACING,
|
||||
frame.BORDER
|
||||
)]]
|
||||
else
|
||||
power:Point("TOPLEFT", frame.Health, "TOPLEFT",
|
||||
-frame.POWERBAR_OFFSET - (frame.HAPPINESS_WIDTH or 0),
|
||||
-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
|
||||
if frame.USE_INSET_ENERGYBAR and frame.USE_ENERGYBAR then
|
||||
power:Point("BOTTOMLEFT", frame.Energy, "TOPLEFT",
|
||||
0,
|
||||
frame.BORDER * 2
|
||||
)
|
||||
power:Point("BOTTOMRIGHT", frame.Energy, "TOPRIGHT",
|
||||
0,
|
||||
frame.BORDER * 2
|
||||
)
|
||||
else
|
||||
if frame.USE_INSET_RAGEBAR and frame.USE_RAGEBAR then
|
||||
power:Point("BOTTOMLEFT", frame.Rage, "TOPLEFT",
|
||||
0,
|
||||
frame.BORDER * 2
|
||||
)
|
||||
power:Point("BOTTOMRIGHT", frame.Rage, "TOPRIGHT",
|
||||
0,
|
||||
frame.BORDER * 2
|
||||
)
|
||||
else
|
||||
power:Point("BOTTOMLEFT", frame.Health, "BOTTOMLEFT",
|
||||
frame.BORDER + frame.BORDER * 2,
|
||||
frame.BORDER + frame.BORDER * 2
|
||||
)
|
||||
power:Point("BOTTOMRIGHT", frame.Health, "BOTTOMRIGHT",
|
||||
-(frame.BORDER + frame.BORDER * 2),
|
||||
frame.BORDER + frame.BORDER * 2
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
power:Height(frame.POWERBAR_HEIGHT - (frame.BORDER + frame.SPACING) * 2)
|
||||
power:SetFrameLevel(50)
|
||||
elseif frame.USE_MINI_POWERBAR then
|
||||
local totalHeight = frame.POWERBAR_HEIGHT - frame.BORDER
|
||||
if frame.USE_ENERGYBAR and frame.USE_MINI_ENERGYBAR then
|
||||
totalHeight = totalHeight + (frame.ENERGYBAR_HEIGHT - frame.BORDER)
|
||||
end
|
||||
if frame.USE_RAGEBAR and frame.USE_MINI_RAGEBAR then
|
||||
totalHeight = totalHeight + (frame.RAGEBAR_HEIGHT - frame.BORDER)
|
||||
end
|
||||
local yPos = totalHeight / 2
|
||||
|
||||
if frame.ORIENTATION == "LEFT" then
|
||||
power:Width(frame.POWERBAR_WIDTH - frame.BORDER * 2)
|
||||
power:Point("TOPRIGHT", frame.Health, "BOTTOMRIGHT",
|
||||
-(frame.BORDER * 2 + 4) - (frame.HAPPINESS_WIDTH or 0),
|
||||
yPos
|
||||
)
|
||||
elseif frame.ORIENTATION == "RIGHT" then
|
||||
power:Width(frame.POWERBAR_WIDTH - frame.BORDER * 2)
|
||||
power:Point("TOPLEFT", frame.Health, "BOTTOMLEFT",
|
||||
frame.BORDER * 2 + 4 + (frame.HAPPINESS_WIDTH or 0),
|
||||
yPos
|
||||
)
|
||||
else
|
||||
power:Point("TOPLEFT", frame.Health, "BOTTOMLEFT",
|
||||
frame.BORDER * 2 + 4,
|
||||
yPos
|
||||
)
|
||||
power:Point("TOPRIGHT", frame.Health, "BOTTOMRIGHT",
|
||||
-(frame.BORDER * 2 + 4) - (frame.HAPPINESS_WIDTH or 0),
|
||||
yPos
|
||||
)
|
||||
end
|
||||
|
||||
power:Height(frame.POWERBAR_HEIGHT - (frame.BORDER + frame.SPACING) * 2)
|
||||
power:SetFrameLevel(50)
|
||||
else -- Filled
|
||||
power:Point("TOPRIGHT", frame.Health.backdrop, "BOTTOMRIGHT",
|
||||
-frame.BORDER,
|
||||
-frame.SPACING * 3
|
||||
)
|
||||
power:Point("TOPLEFT", frame.Health.backdrop, "BOTTOMLEFT",
|
||||
frame.BORDER,
|
||||
-frame.SPACING * 3
|
||||
)
|
||||
power:Height(frame.POWERBAR_HEIGHT - (frame.BORDER + frame.SPACING) * 2)
|
||||
|
||||
power:SetFrameLevel(frame.Health:GetFrameLevel() - 5)
|
||||
end
|
||||
|
||||
--Hide mover until we detach again
|
||||
if not frame.POWERBAR_DETACHED then
|
||||
if power.Holder and power.Holder.mover then
|
||||
power.Holder.mover:SetScale(0.0001)
|
||||
power.Holder.mover:SetAlpha(0)
|
||||
end
|
||||
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)
|
||||
power.backdrop:SetFrameLevel(power:GetFrameLevel() - 1)
|
||||
end
|
||||
|
||||
if frame.POWERBAR_DETACHED and db.power.parent == "UIPARENT" then
|
||||
power:SetParent(E.UIParent)
|
||||
else
|
||||
power:SetParent(frame)
|
||||
end
|
||||
elseif frame:IsElementEnabled("Power") then
|
||||
frame:DisableElement("Power")
|
||||
power:Hide()
|
||||
frame:Tag(power.value, "")
|
||||
end
|
||||
|
||||
power.custom_backdrop = UF.db.colors.custompowerbackdrop and UF.db.colors.power_backdrop
|
||||
|
||||
--Transparency Settings
|
||||
UF:ToggleTransparentStatusBar(UF.db.colors.transparentPower, power, power.BG, nil, UF.db.colors.invertPower)
|
||||
end
|
||||
|
||||
local tokens = {[0] = "MANA", "RAGE", "FOCUS", "ENERGY", "RUNIC_POWER"}
|
||||
function UF:PostUpdatePowerColor()
|
||||
local parent = self.origParent or self:GetParent()
|
||||
|
||||
if parent.isForced then
|
||||
local color = ElvUF.colors.power[tokens[random(0, 4)]]
|
||||
self:SetValue(random(1, self.max))
|
||||
|
||||
if not self.colorClass then
|
||||
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
|
||||
end
|
||||
|
||||
function UF:PostUpdatePower(unit)
|
||||
local parent = self.origParent or self:GetParent()
|
||||
if parent.isForced then
|
||||
self:SetValue(random(1, self.max))
|
||||
end
|
||||
|
||||
if parent.db and parent.db.power and parent.db.power.hideonnpc then
|
||||
UF:PostNamePosition(parent, unit)
|
||||
end
|
||||
|
||||
--Force update to AdditionalPower in order to reposition text if necessary
|
||||
if parent:IsElementEnabled("AdditionalPower") then
|
||||
E:Delay(0.01, parent.AdditionalPower.ForceUpdate, parent.AdditionalPower) --Delay it slightly so Power text has a chance to clear itself first
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,311 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
local random = random
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
|
||||
local _, ns = ...
|
||||
local ElvUF = ns.oUF
|
||||
assert(ElvUF, "ElvUI was unable to locate oUF.")
|
||||
|
||||
function UF:Construct_EnergyBar(frame, bg, text, textPos)
|
||||
local energy = CreateFrame("StatusBar", nil, frame)
|
||||
UF.statusbars[energy] = true
|
||||
|
||||
energy.RaisedElementParent = CreateFrame("Frame", nil, energy)
|
||||
energy.RaisedElementParent:SetFrameLevel(energy:GetFrameLevel() + 100)
|
||||
energy.RaisedElementParent:SetAllPoints()
|
||||
|
||||
energy.PostUpdate = self.PostUpdateEnergy
|
||||
energy.PostUpdateColor = self.PostUpdateEnergyColor
|
||||
|
||||
if bg then
|
||||
energy.BG = energy:CreateTexture(nil, "BORDER")
|
||||
energy.BG:SetAllPoints()
|
||||
energy.BG:SetTexture(E.media.blankTex)
|
||||
end
|
||||
|
||||
if text then
|
||||
energy.value = frame.RaisedElementParent:CreateFontString(nil, "OVERLAY")
|
||||
UF:Configure_FontString(energy.value)
|
||||
|
||||
local x = -2
|
||||
if textPos == "LEFT" then
|
||||
x = 2
|
||||
end
|
||||
|
||||
energy.value:Point(textPos, frame.Health, textPos, x, 0)
|
||||
|
||||
energy.value.frequentUpdates = true
|
||||
end
|
||||
|
||||
energy.colorDisconnected = false
|
||||
energy.colorTapping = false
|
||||
energy:CreateBackdrop("Default", nil, nil, self.thinBorders, true)
|
||||
|
||||
local clipFrame = CreateFrame('Frame', nil, energy)
|
||||
clipFrame:SetAllPoints()
|
||||
clipFrame:EnableMouse(false)
|
||||
clipFrame.__frame = frame
|
||||
energy.ClipFrame = clipFrame
|
||||
|
||||
return energy
|
||||
end
|
||||
|
||||
function UF:Configure_Energy(frame)
|
||||
if not frame.VARIABLES_SET then return end
|
||||
local db = frame.db
|
||||
local energy = frame.Energy
|
||||
energy.origParent = frame
|
||||
|
||||
if frame.USE_ENERGYBAR then
|
||||
if not frame:IsElementEnabled("Energy") then
|
||||
frame:EnableElement("Energy")
|
||||
energy:Show()
|
||||
end
|
||||
|
||||
E:SetSmoothing(energy, self.db.smoothbars)
|
||||
|
||||
--Text
|
||||
local attachPoint = self:GetObjectAnchorPoint(frame, db.energy.attachTextTo)
|
||||
energy.value:ClearAllPoints()
|
||||
energy.value:Point(db.energy.position, attachPoint, db.energy.position, db.energy.xOffset, db.energy.yOffset)
|
||||
frame:Tag(energy.value, db.energy.text_format)
|
||||
|
||||
if db.energy.attachTextTo == "Energy" then
|
||||
energy.value:SetParent(energy.RaisedElementParent)
|
||||
else
|
||||
energy.value:SetParent(frame.RaisedElementParent)
|
||||
end
|
||||
|
||||
--Colors
|
||||
energy.colorClass = nil
|
||||
energy.colorReaction = nil
|
||||
energy.colorEnergy = nil
|
||||
|
||||
if self.db.colors.energyclass then
|
||||
energy.colorClass = true
|
||||
energy.colorReaction = true
|
||||
else
|
||||
energy.colorEnergy = true
|
||||
end
|
||||
|
||||
--Fix height in case it is lower than the theme allows
|
||||
local heightChanged = false
|
||||
if (not self.thinBorders and not E.PixelMode) and frame.ENERGYBAR_HEIGHT < 7 then --A height of 7 means 6px for borders and just 1px for the actual energy statusbar
|
||||
frame.ENERGYBAR_HEIGHT = 7
|
||||
if db.energy then db.energy.height = 7 end
|
||||
heightChanged = true
|
||||
elseif (self.thinBorders or E.PixelMode) and frame.ENERGYBAR_HEIGHT < 3 then --A height of 3 means 2px for borders and just 1px for the actual energy statusbar
|
||||
frame.ENERGYBAR_HEIGHT = 3
|
||||
if db.energy then db.energy.height = 3 end
|
||||
heightChanged = true
|
||||
end
|
||||
if heightChanged then
|
||||
--Update health size
|
||||
frame.BOTTOM_OFFSET = UF:GetHealthBottomOffset(frame)
|
||||
UF:Configure_HealthBar(frame)
|
||||
end
|
||||
|
||||
--Position
|
||||
energy:ClearAllPoints()
|
||||
if frame.ENERGYBAR_DETACHED then
|
||||
energy:Width(frame.ENERGYBAR_WIDTH - ((frame.BORDER + frame.SPACING)*2))
|
||||
energy:Height(frame.ENERGYBAR_HEIGHT - ((frame.BORDER + frame.SPACING)*2))
|
||||
if not energy.Holder or (energy.Holder and not energy.Holder.mover) then
|
||||
energy.Holder = CreateFrame("Frame", nil, energy)
|
||||
energy.Holder:Size(frame.ENERGYBAR_WIDTH, frame.ENERGYBAR_HEIGHT)
|
||||
energy.Holder:Point("BOTTOM", frame, "BOTTOM", 0, -20)
|
||||
energy:ClearAllPoints()
|
||||
energy:Point("BOTTOMLEFT", energy.Holder, "BOTTOMLEFT", frame.BORDER+frame.SPACING, frame.BORDER+frame.SPACING)
|
||||
--Currently only Player and Target can detach energy bars, so doing it this way is okay for now
|
||||
if frame.unitframeType and frame.unitframeType == "player" then
|
||||
E:CreateMover(energy.Holder, "PlayerEnergyBarMover", L["Player Energybar"], nil, nil, nil, "ALL,SOLO", nil, "unitframe,player,energy")
|
||||
elseif frame.unitframeType and frame.unitframeType == "target" then
|
||||
E:CreateMover(energy.Holder, "TargetEnergyBarMover", L["Target Energybar"], nil, nil, nil, "ALL,SOLO", nil, "unitframe,target,energy")
|
||||
end
|
||||
else
|
||||
energy.Holder:Size(frame.ENERGYBAR_WIDTH, frame.ENERGYBAR_HEIGHT)
|
||||
energy:ClearAllPoints()
|
||||
energy:Point("BOTTOMLEFT", energy.Holder, "BOTTOMLEFT", frame.BORDER+frame.SPACING, frame.BORDER+frame.SPACING)
|
||||
energy.Holder.mover:SetScale(1)
|
||||
energy.Holder.mover:SetAlpha(1)
|
||||
end
|
||||
|
||||
energy:SetFrameLevel(50) --RaisedElementParent uses 100, we want lower value to allow certain icons and texts to appear above energy
|
||||
elseif frame.USE_ENERGYBAR_OFFSET then
|
||||
local anchor = frame.Health
|
||||
if frame.USE_POWERBAR and frame.USE_POWERBAR_OFFSET then
|
||||
anchor = frame.Power
|
||||
end
|
||||
if frame.ORIENTATION == "LEFT" then
|
||||
energy:Point("TOPRIGHT", anchor, "TOPRIGHT", frame.ENERGYBAR_OFFSET + (frame.HAPPINESS_WIDTH or 0), -frame.ENERGYBAR_OFFSET)
|
||||
energy:Point("BOTTOMLEFT", anchor, "BOTTOMLEFT", frame.ENERGYBAR_OFFSET, -frame.ENERGYBAR_OFFSET)
|
||||
elseif frame.ORIENTATION == "MIDDLE" then
|
||||
local preOffset = 0
|
||||
if frame.USE_POWERBAR and frame.USE_POWERBAR_OFFSET then
|
||||
preOffset = preOffset + frame.POWERBAR_OFFSET
|
||||
end
|
||||
local postOffset = 0
|
||||
if frame.USE_RAGEBAR and frame.USE_RAGEBAR_OFFSET then
|
||||
postOffset = postOffset + frame.RAGEBAR_OFFSET
|
||||
end
|
||||
|
||||
energy:Point("TOPLEFT", frame, "TOPLEFT",
|
||||
frame.BORDER + frame.SPACING + postOffset,
|
||||
-(preOffset + frame.ENERGYBAR_OFFSET + frame.CLASSBAR_YOFFSET) --+ frame.BORDER - frame.SPACING)
|
||||
)
|
||||
energy:Point("BOTTOMRIGHT", frame, "BOTTOMRIGHT",
|
||||
-(frame.BORDER + frame.SPACING + postOffset),
|
||||
frame.BORDER + frame.SPACING + postOffset
|
||||
)
|
||||
else
|
||||
energy:Point("TOPLEFT", anchor, "TOPLEFT", -frame.ENERGYBAR_OFFSET - (frame.HAPPINESS_WIDTH or 0), -frame.ENERGYBAR_OFFSET)
|
||||
energy:Point("BOTTOMRIGHT", anchor, "BOTTOMRIGHT", -frame.ENERGYBAR_OFFSET, -frame.ENERGYBAR_OFFSET)
|
||||
end
|
||||
energy:SetFrameLevel(frame.Health:GetFrameLevel() - 6) --Health uses 10
|
||||
elseif frame.USE_INSET_ENERGYBAR then
|
||||
if frame.USE_INSET_RAGEBAR and frame.USE_RAGEBAR then
|
||||
energy:Point("BOTTOMLEFT", frame.Rage, "TOPLEFT",
|
||||
0,
|
||||
frame.BORDER * 2
|
||||
)
|
||||
energy:Point("BOTTOMRIGHT", frame.Rage, "TOPRIGHT",
|
||||
0,
|
||||
frame.BORDER * 2
|
||||
)
|
||||
else
|
||||
energy:Point("BOTTOMLEFT", frame.Health, "BOTTOMLEFT",
|
||||
frame.BORDER + frame.BORDER * 2,
|
||||
frame.BORDER + frame.BORDER * 2
|
||||
)
|
||||
energy:Point("BOTTOMRIGHT", frame.Health, "BOTTOMRIGHT",
|
||||
-(frame.BORDER + frame.BORDER * 2),
|
||||
frame.BORDER + frame.BORDER * 2
|
||||
)
|
||||
end
|
||||
|
||||
energy:Height(frame.ENERGYBAR_HEIGHT - (frame.BORDER + frame.SPACING) * 2)
|
||||
energy:SetFrameLevel(50)
|
||||
elseif frame.USE_MINI_ENERGYBAR then
|
||||
local totalHeight = frame.ENERGYBAR_HEIGHT - frame.BORDER
|
||||
if frame.USE_POWERBAR and frame.USE_MINI_POWERBAR then
|
||||
totalHeight = totalHeight + (frame.POWERBAR_HEIGHT - frame.BORDER)
|
||||
end
|
||||
if frame.USE_RAGEBAR and frame.USE_MINI_RAGEBAR then
|
||||
totalHeight = totalHeight + (frame.RAGEBAR_HEIGHT - frame.BORDER)
|
||||
end
|
||||
local yPos = (totalHeight / 2) - (frame.POWERBAR_HEIGHT - frame.BORDER)
|
||||
|
||||
if frame.ORIENTATION == "LEFT" then
|
||||
energy:Width(frame.ENERGYBAR_WIDTH - frame.BORDER * 2)
|
||||
energy:Point("TOPRIGHT", frame.Health, "BOTTOMRIGHT",
|
||||
-(frame.BORDER * 2 + 4) - (frame.HAPPINESS_WIDTH or 0),
|
||||
yPos
|
||||
)
|
||||
elseif frame.ORIENTATION == "RIGHT" then
|
||||
energy:Width(frame.ENERGYBAR_WIDTH - frame.BORDER*2)
|
||||
energy:Point("TOPLEFT", frame.Health, "BOTTOMLEFT",
|
||||
frame.BORDER * 2 + 4 + (frame.HAPPINESS_WIDTH or 0),
|
||||
yPos
|
||||
)
|
||||
else
|
||||
energy:Point("TOPLEFT", frame.Health, "BOTTOMLEFT",
|
||||
frame.BORDER * 2 + 4,
|
||||
yPos
|
||||
)
|
||||
energy:Point("TOPRIGHT", frame.Health, "BOTTOMRIGHT",
|
||||
-(frame.BORDER * 2 + 4) - (frame.HAPPINESS_WIDTH or 0),
|
||||
yPos
|
||||
)
|
||||
end
|
||||
|
||||
energy:Height(frame.ENERGYBAR_HEIGHT - (frame.BORDER + frame.SPACING) * 2)
|
||||
energy:SetFrameLevel(50)
|
||||
else -- Filled
|
||||
local anchor = frame.Power.backdrop
|
||||
if not frame.USE_POWERBAR or frame.USE_POWERBAR_DETACHED or frame.USE_INSET_POWERBAR or frame.USE_MINI_POWERBAR then
|
||||
anchor = frame.Health.backdrop
|
||||
end
|
||||
energy:Point("TOPLEFT", anchor, "BOTTOMLEFT",
|
||||
frame.BORDER,
|
||||
-frame.SPACING * 3
|
||||
)
|
||||
energy:Point("TOPRIGHT", anchor, "BOTTOMRIGHT",
|
||||
-frame.BORDER,
|
||||
-frame.SPACING * 3
|
||||
)
|
||||
energy:Height(frame.ENERGYBAR_HEIGHT - (frame.BORDER + frame.SPACING) * 2)
|
||||
energy:SetFrameLevel(frame.Health:GetFrameLevel() - 5)
|
||||
end
|
||||
|
||||
--Hide mover until we detach again
|
||||
if not frame.ENERGYBAR_DETACHED then
|
||||
if energy.Holder and energy.Holder.mover then
|
||||
energy.Holder.mover:SetScale(0.0001)
|
||||
energy.Holder.mover:SetAlpha(0)
|
||||
end
|
||||
end
|
||||
|
||||
if db.energy.strataAndLevel and db.energy.strataAndLevel.useCustomStrata then
|
||||
energy:SetFrameStrata(db.energy.strataAndLevel.frameStrata)
|
||||
else
|
||||
energy:SetFrameStrata("LOW")
|
||||
end
|
||||
if db.energy.strataAndLevel and db.energy.strataAndLevel.useCustomLevel then
|
||||
energy:SetFrameLevel(db.energy.strataAndLevel.frameLevel)
|
||||
energy.backdrop:SetFrameLevel(energy:GetFrameLevel() - 1)
|
||||
end
|
||||
|
||||
if frame.ENERGYBAR_DETACHED and db.energy.parent == "UIPARENT" then
|
||||
energy:SetParent(E.UIParent)
|
||||
else
|
||||
energy:SetParent(frame)
|
||||
end
|
||||
elseif frame:IsElementEnabled("Energy") then
|
||||
frame:DisableElement("Energy")
|
||||
energy:Hide()
|
||||
frame:Tag(energy.value, "")
|
||||
end
|
||||
|
||||
energy.custom_backdrop = UF.db.colors.customenergybackdrop and UF.db.colors.energy_backdrop
|
||||
|
||||
--Transparency Settings
|
||||
UF:ToggleTransparentStatusBar(UF.db.colors.transparentEnergy, energy, energy.BG, nil, UF.db.colors.invertEnergy)
|
||||
end
|
||||
|
||||
local tokens = {[0] = "MANA", "RAGE", "FOCUS", "ENERGY", "RUNIC_POWER"}
|
||||
function UF:PostUpdateEnergyColor()
|
||||
local parent = self.origParent or self:GetParent()
|
||||
|
||||
if parent.isForced then
|
||||
local color = ElvUF.colors.energy[tokens[random(0, 4)]]
|
||||
self:SetValue(random(1, self.max))
|
||||
|
||||
if not self.colorClass then
|
||||
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
|
||||
end
|
||||
|
||||
function UF:PostUpdateEnergy(unit)
|
||||
local parent = self.origParent or self:GetParent()
|
||||
if parent.isForced then
|
||||
self:SetValue(random(1, self.max))
|
||||
end
|
||||
|
||||
if parent.db and parent.db.energy and parent.db.energy.hideonnpc then
|
||||
UF:PostNamePosition(parent, unit)
|
||||
end
|
||||
|
||||
--Force update to AdditionalPower in order to reposition text if necessary
|
||||
if parent:IsElementEnabled("AdditionalPower") then
|
||||
E:Delay(0.01, parent.AdditionalPower.ForceUpdate, parent.AdditionalPower) --Delay it slightly so Power text has a chance to clear itself first
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,298 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
local random = random
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
|
||||
local _, ns = ...
|
||||
local ElvUF = ns.oUF
|
||||
assert(ElvUF, "ElvUI was unable to locate oUF.")
|
||||
|
||||
function UF:Construct_RageBar(frame, bg, text, textPos)
|
||||
local rage = CreateFrame("StatusBar", nil, frame)
|
||||
UF.statusbars[rage] = true
|
||||
|
||||
rage.RaisedElementParent = CreateFrame("Frame", nil, rage)
|
||||
rage.RaisedElementParent:SetFrameLevel(rage:GetFrameLevel() + 100)
|
||||
rage.RaisedElementParent:SetAllPoints()
|
||||
|
||||
rage.PostUpdate = self.PostUpdateRage
|
||||
rage.PostUpdateColor = self.PostUpdateRageColor
|
||||
|
||||
if bg then
|
||||
rage.BG = rage:CreateTexture(nil, "BORDER")
|
||||
rage.BG:SetAllPoints()
|
||||
rage.BG:SetTexture(E.media.blankTex)
|
||||
end
|
||||
|
||||
if text then
|
||||
rage.value = frame.RaisedElementParent:CreateFontString(nil, "OVERLAY")
|
||||
UF:Configure_FontString(rage.value)
|
||||
|
||||
local x = -2
|
||||
if textPos == "LEFT" then
|
||||
x = 2
|
||||
end
|
||||
|
||||
rage.value:Point(textPos, frame.Health, textPos, x, 0)
|
||||
|
||||
rage.value.frequentUpdates = true
|
||||
end
|
||||
|
||||
rage.colorDisconnected = false
|
||||
rage.colorTapping = false
|
||||
rage:CreateBackdrop("Default", nil, nil, self.thinBorders, true)
|
||||
|
||||
local clipFrame = CreateFrame('Frame', nil, rage)
|
||||
clipFrame:SetAllPoints()
|
||||
clipFrame:EnableMouse(false)
|
||||
clipFrame.__frame = frame
|
||||
rage.ClipFrame = clipFrame
|
||||
|
||||
return rage
|
||||
end
|
||||
|
||||
function UF:Configure_Rage(frame)
|
||||
if not frame.VARIABLES_SET then return end
|
||||
local db = frame.db
|
||||
local rage = frame.Rage
|
||||
rage.origParent = frame
|
||||
|
||||
if frame.USE_RAGEBAR then
|
||||
if not frame:IsElementEnabled("Rage") then
|
||||
frame:EnableElement("Rage")
|
||||
rage:Show()
|
||||
end
|
||||
|
||||
E:SetSmoothing(rage, self.db.smoothbars)
|
||||
|
||||
--Text
|
||||
local attachPoint = self:GetObjectAnchorPoint(frame, db.rage.attachTextTo)
|
||||
rage.value:ClearAllPoints()
|
||||
rage.value:Point(db.rage.position, attachPoint, db.rage.position, db.rage.xOffset, db.rage.yOffset)
|
||||
frame:Tag(rage.value, db.rage.text_format)
|
||||
|
||||
if db.rage.attachTextTo == "Rage" then
|
||||
rage.value:SetParent(rage.RaisedElementParent)
|
||||
else
|
||||
rage.value:SetParent(frame.RaisedElementParent)
|
||||
end
|
||||
|
||||
--Colors
|
||||
rage.colorClass = nil
|
||||
rage.colorReaction = nil
|
||||
rage.colorRage = nil
|
||||
|
||||
if self.db.colors.rageclass then
|
||||
rage.colorClass = true
|
||||
rage.colorReaction = true
|
||||
else
|
||||
rage.colorRage = true
|
||||
end
|
||||
|
||||
--Fix height in case it is lower than the theme allows
|
||||
local heightChanged = false
|
||||
if (not self.thinBorders and not E.PixelMode) and frame.RAGEBAR_HEIGHT < 7 then --A height of 7 means 6px for borders and just 1px for the actual rage statusbar
|
||||
frame.RAGEBAR_HEIGHT = 7
|
||||
if db.rage then db.rage.height = 7 end
|
||||
heightChanged = true
|
||||
elseif (self.thinBorders or E.PixelMode) and frame.RAGEBAR_HEIGHT < 3 then --A height of 3 means 2px for borders and just 1px for the actual rage statusbar
|
||||
frame.RAGEBAR_HEIGHT = 3
|
||||
if db.rage then db.rage.height = 3 end
|
||||
heightChanged = true
|
||||
end
|
||||
if heightChanged then
|
||||
--Update health size
|
||||
frame.BOTTOM_OFFSET = UF:GetHealthBottomOffset(frame)
|
||||
UF:Configure_HealthBar(frame)
|
||||
end
|
||||
|
||||
--Position
|
||||
rage:ClearAllPoints()
|
||||
if frame.RAGEBAR_DETACHED then
|
||||
rage:Width(frame.RAGEBAR_WIDTH - ((frame.BORDER + frame.SPACING)*2))
|
||||
rage:Height(frame.RAGEBAR_HEIGHT - ((frame.BORDER + frame.SPACING)*2))
|
||||
if not rage.Holder or (rage.Holder and not rage.Holder.mover) then
|
||||
rage.Holder = CreateFrame("Frame", nil, rage)
|
||||
rage.Holder:Size(frame.RAGEBAR_WIDTH, frame.RAGEBAR_HEIGHT)
|
||||
rage.Holder:Point("BOTTOM", frame, "BOTTOM", 0, -20)
|
||||
rage:ClearAllPoints()
|
||||
rage:Point("BOTTOMLEFT", rage.Holder, "BOTTOMLEFT", frame.BORDER+frame.SPACING, frame.BORDER+frame.SPACING)
|
||||
--Currently only Player and Target can detach rage bars, so doing it this way is okay for now
|
||||
if frame.unitframeType and frame.unitframeType == "player" then
|
||||
E:CreateMover(rage.Holder, "PlayerRageBarMover", L["Player Ragebar"], nil, nil, nil, "ALL,SOLO", nil, "unitframe,player,rage")
|
||||
elseif frame.unitframeType and frame.unitframeType == "target" then
|
||||
E:CreateMover(rage.Holder, "TargetRageBarMover", L["Target Ragebar"], nil, nil, nil, "ALL,SOLO", nil, "unitframe,target,rage")
|
||||
end
|
||||
else
|
||||
rage.Holder:Size(frame.RAGEBAR_WIDTH, frame.RAGEBAR_HEIGHT)
|
||||
rage:ClearAllPoints()
|
||||
rage:Point("BOTTOMLEFT", rage.Holder, "BOTTOMLEFT", frame.BORDER+frame.SPACING, frame.BORDER+frame.SPACING)
|
||||
rage.Holder.mover:SetScale(1)
|
||||
rage.Holder.mover:SetAlpha(1)
|
||||
end
|
||||
|
||||
rage:SetFrameLevel(50) --RaisedElementParent uses 100, we want lower value to allow certain icons and texts to appear above rage
|
||||
elseif frame.USE_RAGEBAR_OFFSET then
|
||||
local anchor = frame.Health
|
||||
if frame.USE_POWERBAR and frame.USE_POWERBAR_OFFSET then
|
||||
anchor = frame.Power
|
||||
end
|
||||
if frame.USE_ENERGYBAR and frame.USE_ENERGYBAR_OFFSET then
|
||||
anchor = frame.Energy
|
||||
end
|
||||
if frame.ORIENTATION == "LEFT" then
|
||||
rage:Point("TOPRIGHT", anchor, "TOPRIGHT", frame.RAGEBAR_OFFSET + (frame.HAPPINESS_WIDTH or 0), -frame.RAGEBAR_OFFSET)
|
||||
rage:Point("BOTTOMLEFT", anchor, "BOTTOMLEFT", frame.RAGEBAR_OFFSET, -frame.RAGEBAR_OFFSET)
|
||||
elseif frame.ORIENTATION == "MIDDLE" then
|
||||
local preOffset = 0
|
||||
if frame.USE_POWERBAR and frame.USE_POWERBAR_OFFSET then
|
||||
preOffset = preOffset + frame.POWERBAR_OFFSET
|
||||
end
|
||||
if frame.USE_ENERGYBAR and frame.USE_ENERGYBAR_OFFSET then
|
||||
preOffset = preOffset + frame.ENERGYBAR_OFFSET
|
||||
end
|
||||
|
||||
rage:Point("TOPLEFT", frame, "TOPLEFT",
|
||||
frame.BORDER + frame.SPACING,
|
||||
-(preOffset + frame.RAGEBAR_OFFSET + frame.CLASSBAR_YOFFSET) --+ frame.BORDER - frame.SPACING)
|
||||
)
|
||||
rage:Point("BOTTOMRIGHT", frame, "BOTTOMRIGHT",
|
||||
-(frame.BORDER + frame.SPACING),
|
||||
frame.BORDER + frame.SPACING
|
||||
)
|
||||
else
|
||||
rage:Point("TOPLEFT", anchor, "TOPLEFT", -frame.RAGEBAR_OFFSET - (frame.HAPPINESS_WIDTH or 0), -frame.RAGEBAR_OFFSET)
|
||||
rage:Point("BOTTOMRIGHT", anchor, "BOTTOMRIGHT", -frame.RAGEBAR_OFFSET, -frame.RAGEBAR_OFFSET)
|
||||
end
|
||||
rage:SetFrameLevel(frame.Health:GetFrameLevel() - 7) --Health uses 10
|
||||
elseif frame.USE_INSET_RAGEBAR then
|
||||
rage:Height(frame.RAGEBAR_HEIGHT - (frame.BORDER + frame.SPACING) * 2)
|
||||
rage:Point("BOTTOMLEFT", frame.Health, "BOTTOMLEFT", frame.BORDER + frame.BORDER * 2, frame.BORDER + frame.BORDER * 2)
|
||||
rage:Point("BOTTOMRIGHT", frame.Health, "BOTTOMRIGHT", -(frame.BORDER + frame.BORDER * 2), frame.BORDER + frame.BORDER * 2)
|
||||
rage:SetFrameLevel(50)
|
||||
elseif frame.USE_MINI_RAGEBAR then
|
||||
local totalHeight = frame.RAGEBAR_HEIGHT - frame.BORDER
|
||||
if frame.USE_POWERBAR and frame.USE_MINI_POWERBAR then
|
||||
totalHeight = totalHeight + (frame.POWERBAR_HEIGHT - frame.BORDER)
|
||||
end
|
||||
if frame.USE_ENERGYBAR and frame.USE_MINI_ENERGYBAR then
|
||||
totalHeight = totalHeight + (frame.ENERGYBAR_HEIGHT - frame.BORDER)
|
||||
end
|
||||
local yPos = -(totalHeight / 2) + (frame.RAGEBAR_HEIGHT - frame.BORDER)
|
||||
|
||||
if frame.ORIENTATION == "LEFT" then
|
||||
rage:Width(frame.RAGEBAR_WIDTH - frame.BORDER * 2)
|
||||
rage:Point("TOPRIGHT", frame.Health, "BOTTOMRIGHT",
|
||||
-(frame.BORDER * 2 + 4) - (frame.HAPPINESS_WIDTH or 0),
|
||||
yPos
|
||||
)
|
||||
elseif frame.ORIENTATION == "RIGHT" then
|
||||
rage:Width(frame.RAGEBAR_WIDTH - frame.BORDER*2)
|
||||
rage:Point("TOPLEFT", frame.Health, "BOTTOMLEFT",
|
||||
frame.BORDER * 2 + 4 + (frame.HAPPINESS_WIDTH or 0),
|
||||
yPos
|
||||
)
|
||||
else
|
||||
rage:Point("TOPLEFT", frame.Health, "BOTTOMLEFT",
|
||||
frame.BORDER * 2 + 4,
|
||||
yPos
|
||||
)
|
||||
rage:Point("TOPRIGHT", frame.Health, "BOTTOMRIGHT",
|
||||
-(frame.BORDER * 2 + 4) - (frame.HAPPINESS_WIDTH or 0),
|
||||
yPos
|
||||
)
|
||||
end
|
||||
|
||||
rage:Height(frame.RAGEBAR_HEIGHT - (frame.BORDER + frame.SPACING) * 2)
|
||||
rage:SetFrameLevel(50)
|
||||
else -- Filled
|
||||
local anchor = frame.Energy.backdrop
|
||||
if not frame.USE_ENERGYBAR or frame.USE_ENERGYBAR_DETACHED or frame.USE_INSET_ENERGYBAR or frame.USE_MINI_ENERGYBAR then
|
||||
if not frame.USE_POWERBAR or frame.USE_POWERBAR_DETACHED or frame.USE_INSET_POWERBAR or frame.USE_MINI_POWERBAR then
|
||||
anchor = frame.Health.backdrop
|
||||
else anchor = frame.Power.backdrop end
|
||||
end
|
||||
rage:Point("TOPRIGHT", anchor, "BOTTOMRIGHT",
|
||||
-frame.BORDER,
|
||||
-frame.SPACING * 3
|
||||
)
|
||||
rage:Point("TOPLEFT", anchor, "BOTTOMLEFT",
|
||||
frame.BORDER,
|
||||
-frame.SPACING * 3
|
||||
)
|
||||
rage:Height(frame.RAGEBAR_HEIGHT - (frame.BORDER + frame.SPACING) * 2)
|
||||
|
||||
rage:SetFrameLevel(frame.Health:GetFrameLevel() - 5)
|
||||
end
|
||||
|
||||
--Hide mover until we detach again
|
||||
if not frame.RAGEBAR_DETACHED then
|
||||
if rage.Holder and rage.Holder.mover then
|
||||
rage.Holder.mover:SetScale(0.0001)
|
||||
rage.Holder.mover:SetAlpha(0)
|
||||
end
|
||||
end
|
||||
|
||||
if db.rage.strataAndLevel and db.rage.strataAndLevel.useCustomStrata then
|
||||
rage:SetFrameStrata(db.rage.strataAndLevel.frameStrata)
|
||||
else
|
||||
rage:SetFrameStrata("LOW")
|
||||
end
|
||||
if db.rage.strataAndLevel and db.rage.strataAndLevel.useCustomLevel then
|
||||
rage:SetFrameLevel(db.rage.strataAndLevel.frameLevel)
|
||||
rage.backdrop:SetFrameLevel(rage:GetFrameLevel() - 1)
|
||||
end
|
||||
|
||||
if frame.RAGEBAR_DETACHED and db.rage.parent == "UIPARENT" then
|
||||
rage:SetParent(E.UIParent)
|
||||
else
|
||||
rage:SetParent(frame)
|
||||
end
|
||||
elseif frame:IsElementEnabled("Rage") then
|
||||
frame:DisableElement("Rage")
|
||||
rage:Hide()
|
||||
frame:Tag(rage.value, "")
|
||||
end
|
||||
|
||||
rage.custom_backdrop = UF.db.colors.customragebackdrop and UF.db.colors.rage_backdrop
|
||||
|
||||
--Transparency Settings
|
||||
UF:ToggleTransparentStatusBar(UF.db.colors.transparentRage, rage, rage.BG, nil, UF.db.colors.invertRage)
|
||||
end
|
||||
|
||||
local tokens = {[0] = "MANA", "RAGE", "FOCUS", "ENERGY", "RUNIC_POWER"}
|
||||
function UF:PostUpdateRageColor()
|
||||
local parent = self.origParent or self:GetParent()
|
||||
|
||||
if parent.isForced then
|
||||
local color = ElvUF.colors.rage[tokens[random(0, 4)]]
|
||||
self:SetValue(random(1, self.max))
|
||||
|
||||
if not self.colorClass then
|
||||
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
|
||||
end
|
||||
|
||||
function UF:PostUpdateRage(unit)
|
||||
local parent = self.origParent or self:GetParent()
|
||||
if parent.isForced then
|
||||
self:SetValue(random(1, self.max))
|
||||
end
|
||||
|
||||
if parent.db and parent.db.rage and parent.db.rage.hideonnpc then
|
||||
UF:PostNamePosition(parent, unit)
|
||||
end
|
||||
|
||||
--Force update to AdditionalPower in order to reposition text if necessary
|
||||
if parent:IsElementEnabled("AdditionalPower") then
|
||||
E:Delay(0.01, parent.AdditionalPower.ForceUpdate, parent.AdditionalPower) --Delay it slightly so Power text has a chance to clear itself first
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,70 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
--WoW API / Variables
|
||||
|
||||
function UF:Construct_PvPIcon(frame)
|
||||
local PvPIndicator = frame.RaisedElementParent.TextureParent:CreateTexture(nil, "ARTWORK")
|
||||
PvPIndicator:Size(30, 30)
|
||||
PvPIndicator:Point("CENTER", frame, "CENTER")
|
||||
|
||||
PvPIndicator.Override = UF.UpdateOverridePvP
|
||||
|
||||
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)
|
||||
|
||||
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
|
||||
|
||||
function UF:UpdateOverridePvP(event, unit)
|
||||
if not unit or self.unit ~= unit then return end
|
||||
|
||||
local element = self.PvPIndicator
|
||||
|
||||
if element.PreUpdate then
|
||||
element:PreUpdate()
|
||||
end
|
||||
|
||||
local status
|
||||
local factionGroup = UnitFactionGroup(unit)
|
||||
|
||||
if UnitIsPVPFreeForAll(unit) then
|
||||
element:SetTexture("Interface\\TargetingFrame\\UI-PVP-FFA")
|
||||
element:SetTexCoord(0, 0.65625, 0, 0.65625)
|
||||
|
||||
status = "ffa"
|
||||
elseif factionGroup and UnitIsPVP(unit) then
|
||||
element:SetTexture(E.Media.Textures.PvPIcons)
|
||||
|
||||
if factionGroup == "Alliance" then
|
||||
element:SetTexCoord(0.545, 0.935, 0.070, 0.940)
|
||||
else
|
||||
element:SetTexCoord(0.100, 0.475, 0.070, 0.940)
|
||||
end
|
||||
|
||||
status = factionGroup
|
||||
end
|
||||
|
||||
if status then
|
||||
element:Show()
|
||||
else
|
||||
element:Hide()
|
||||
end
|
||||
|
||||
if element.PostUpdate then
|
||||
return element:PostUpdate(unit, status)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,21 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
--WoW API / Variables
|
||||
|
||||
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
|
||||
@@ -0,0 +1,65 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
local unpack = unpack
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
|
||||
function UF:Construct_RaidDebuffs(frame)
|
||||
local rdebuff = CreateFrame("Frame", nil, frame.RaisedElementParent)
|
||||
rdebuff:SetTemplate(nil, nil, nil, UF.thinBorders, true)
|
||||
rdebuff:SetFrameLevel(frame.RaisedElementParent:GetFrameLevel() + 20) --Make them appear above regular buffs or debuffs
|
||||
|
||||
local offset = UF.thinBorders and E.mult or E.Border
|
||||
rdebuff.icon = rdebuff:CreateTexture(nil, "OVERLAY")
|
||||
rdebuff.icon:SetInside(rdebuff, offset, offset)
|
||||
|
||||
rdebuff.count = rdebuff:CreateFontString(nil, "OVERLAY")
|
||||
rdebuff.count:FontTemplate(nil, 10, "OUTLINE")
|
||||
rdebuff.count:Point("BOTTOMRIGHT", 0, 2)
|
||||
rdebuff.count:SetTextColor(1, .9, 0)
|
||||
|
||||
rdebuff.time = rdebuff:CreateFontString(nil, "OVERLAY")
|
||||
rdebuff.time:FontTemplate(nil, 10, "OUTLINE")
|
||||
rdebuff.time:Point("CENTER")
|
||||
rdebuff.time:SetTextColor(1, .9, 0)
|
||||
|
||||
return rdebuff
|
||||
end
|
||||
|
||||
function UF:Configure_RaidDebuffs(frame)
|
||||
if not frame.VARIABLES_SET then return end
|
||||
local db = frame.db
|
||||
local rdebuffs = frame.RaidDebuffs
|
||||
|
||||
if db.rdebuffs.enable then
|
||||
local stackColor = db.rdebuffs.stack.color
|
||||
local durationColor = db.rdebuffs.duration.color
|
||||
local rdebuffsFont = UF.LSM:Fetch("font", db.rdebuffs.font)
|
||||
if not frame:IsElementEnabled("RaidDebuffs") then
|
||||
frame:EnableElement("RaidDebuffs")
|
||||
end
|
||||
|
||||
rdebuffs.showDispellableDebuff = db.rdebuffs.showDispellableDebuff
|
||||
rdebuffs.onlyMatchSpellID = db.rdebuffs.onlyMatchSpellID
|
||||
rdebuffs.forceShow = frame.forceShowAuras
|
||||
rdebuffs:Size(db.rdebuffs.size)
|
||||
rdebuffs:Point("BOTTOM", frame, "BOTTOM", db.rdebuffs.xOffset, db.rdebuffs.yOffset + frame.SPACING)
|
||||
|
||||
rdebuffs.icon:SetTexCoord(unpack(E.TexCoords))
|
||||
|
||||
rdebuffs.count:FontTemplate(rdebuffsFont, db.rdebuffs.fontSize, db.rdebuffs.fontOutline)
|
||||
rdebuffs.count:ClearAllPoints()
|
||||
rdebuffs.count:Point(db.rdebuffs.stack.position, db.rdebuffs.stack.xOffset, db.rdebuffs.stack.yOffset)
|
||||
rdebuffs.count:SetTextColor(stackColor.r, stackColor.g, stackColor.b, stackColor.a)
|
||||
|
||||
rdebuffs.time:FontTemplate(rdebuffsFont, db.rdebuffs.fontSize, db.rdebuffs.fontOutline)
|
||||
rdebuffs.time:ClearAllPoints()
|
||||
rdebuffs.time:Point(db.rdebuffs.duration.position, db.rdebuffs.duration.xOffset, db.rdebuffs.duration.yOffset)
|
||||
rdebuffs.time:SetTextColor(durationColor.r, durationColor.g, durationColor.b, durationColor.a)
|
||||
elseif frame:IsElementEnabled("RaidDebuffs") then
|
||||
frame:DisableElement("RaidDebuffs")
|
||||
rdebuffs:Hide()
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,33 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
--WoW API / Variables
|
||||
|
||||
function UF:Construct_RaidIcon(frame)
|
||||
local tex = frame.RaisedElementParent.TextureParent:CreateTexture(nil, "OVERLAY")
|
||||
tex:SetTexture(E.Media.Textures.RaidIcons)
|
||||
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
|
||||
@@ -0,0 +1,131 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
local match = string.match
|
||||
local select, tonumber = select, tonumber
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
local GetNumRaidMembers = GetNumRaidMembers
|
||||
local GetRaidRosterInfo = GetRaidRosterInfo
|
||||
local IsPartyLeader = IsPartyLeader
|
||||
local UnitInParty = UnitInParty
|
||||
local UnitInRaid = UnitInRaid
|
||||
|
||||
local function CheckLeader(unit)
|
||||
if unit == "player" then
|
||||
return IsPartyLeader()
|
||||
elseif unit ~= "player" and (UnitInParty(unit) or UnitInRaid(unit)) then
|
||||
local gtype, index = match(unit, "(%D+)(%d+)")
|
||||
index = tonumber(index)
|
||||
if gtype == "party" and GetNumRaidMembers() == 0 then
|
||||
return GetPartyLeaderIndex() == index
|
||||
elseif gtype == "raid" and GetNumRaidMembers() > 0 then
|
||||
return select(2, GetRaidRosterInfo(index)) == 2
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function UpdateOverride(self)
|
||||
local element = self.LeaderIndicator
|
||||
|
||||
if element.PreUpdate then
|
||||
element:PreUpdate()
|
||||
end
|
||||
|
||||
local isLeader = CheckLeader(self.unit)
|
||||
|
||||
if isLeader then
|
||||
element:Show()
|
||||
else
|
||||
element:Hide()
|
||||
end
|
||||
|
||||
if element.PostUpdate then
|
||||
return element:PostUpdate(isLeader)
|
||||
end
|
||||
end
|
||||
|
||||
function UF:Construct_RaidRoleFrames(frame)
|
||||
local anchor = CreateFrame("Frame", nil, frame.RaisedElementParent)
|
||||
frame.LeaderIndicator = anchor:CreateTexture(nil, "OVERLAY")
|
||||
frame.AssistantIndicator = anchor:CreateTexture(nil, "OVERLAY")
|
||||
frame.MasterLooterIndicator = anchor:CreateTexture(nil, "OVERLAY")
|
||||
|
||||
anchor:Size(24, 12)
|
||||
frame.LeaderIndicator:Size(12)
|
||||
frame.AssistantIndicator:Size(12)
|
||||
frame.MasterLooterIndicator:Size(11)
|
||||
|
||||
frame.LeaderIndicator.Override = UpdateOverride
|
||||
|
||||
frame.LeaderIndicator.PostUpdate = UF.RaidRoleUpdate
|
||||
frame.AssistantIndicator.PostUpdate = UF.RaidRoleUpdate
|
||||
frame.MasterLooterIndicator.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("MasterLooterIndicator")
|
||||
frame:EnableElement("AssistantIndicator")
|
||||
end
|
||||
|
||||
raidRoleFrameAnchor:ClearAllPoints()
|
||||
if frame.db.raidRoleIcons.position == "TOPLEFT" then
|
||||
raidRoleFrameAnchor:Point("LEFT", frame.Health, "TOPLEFT", 2, 0)
|
||||
else
|
||||
raidRoleFrameAnchor:Point("RIGHT", frame, "TOPRIGHT", -2, 0)
|
||||
end
|
||||
elseif frame:IsElementEnabled("LeaderIndicator") then
|
||||
raidRoleFrameAnchor:Hide()
|
||||
frame:DisableElement("LeaderIndicator")
|
||||
frame:DisableElement("MasterLooterIndicator")
|
||||
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
|
||||
local masterLooter = frame.MasterLooterIndicator
|
||||
|
||||
if not leader or not masterLooter or not assistant then return; end
|
||||
|
||||
local db = frame.db
|
||||
local isLeader = leader:IsShown()
|
||||
local isMasterLooter = masterLooter:IsShown()
|
||||
local isAssist = assistant:IsShown()
|
||||
|
||||
leader:ClearAllPoints()
|
||||
assistant:ClearAllPoints()
|
||||
masterLooter:ClearAllPoints()
|
||||
|
||||
if db and db.raidRoleIcons then
|
||||
if isLeader and db.raidRoleIcons.position == "TOPLEFT" then
|
||||
leader:Point("LEFT", anchor, "LEFT")
|
||||
masterLooter:Point("RIGHT", anchor, "RIGHT")
|
||||
elseif isLeader and db.raidRoleIcons.position == "TOPRIGHT" then
|
||||
leader:Point("RIGHT", anchor, "RIGHT")
|
||||
masterLooter:Point("LEFT", anchor, "LEFT")
|
||||
elseif isAssist and db.raidRoleIcons.position == "TOPLEFT" then
|
||||
assistant:Point("LEFT", anchor, "LEFT")
|
||||
masterLooter:Point("RIGHT", anchor, "RIGHT")
|
||||
elseif isAssist and db.raidRoleIcons.position == "TOPRIGHT" then
|
||||
assistant:Point("RIGHT", anchor, "RIGHT")
|
||||
masterLooter:Point("LEFT", anchor, "LEFT")
|
||||
elseif isMasterLooter and db.raidRoleIcons.position == "TOPLEFT" then
|
||||
masterLooter:Point("LEFT", anchor, "LEFT")
|
||||
else
|
||||
masterLooter:Point("RIGHT", anchor, "RIGHT")
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,177 @@
|
||||
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
|
||||
|
||||
--Lua functions
|
||||
local pairs, ipairs = pairs, ipairs
|
||||
local find = string.find
|
||||
--WoW API / Variables
|
||||
local CheckInteractDistance = CheckInteractDistance
|
||||
local UnitCanAttack = UnitCanAttack
|
||||
local UnitInParty = UnitInParty
|
||||
local UnitInRaid = UnitInRaid
|
||||
local UnitInRange = UnitInRange
|
||||
local UnitIsConnected = UnitIsConnected
|
||||
local UnitIsDeadOrGhost = UnitIsDeadOrGhost
|
||||
local UnitIsUnit = UnitIsUnit
|
||||
|
||||
local SRT = {}
|
||||
local function AddTable(tbl)
|
||||
SRT[E.myclass][tbl] = {}
|
||||
end
|
||||
|
||||
local function AddSpell(tbl, spellID)
|
||||
SRT[E.myclass][tbl][#SRT[E.myclass][tbl] + 1] = spellID
|
||||
end
|
||||
|
||||
function UF:UpdateRangeCheckSpells()
|
||||
if not SRT[E.myclass] then SRT[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 find(unit, "party") or not find(unit, "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
|
||||
|
||||
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
|
||||
|
||||
if SRT[E.myclass] then
|
||||
if SRT[E.myclass].resSpells and UnitIsDeadOrGhost(unit) and (#SRT[E.myclass].resSpells > 0) then -- dead with rez spells
|
||||
for _, spellID in ipairs(SRT[E.myclass].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 SRT[E.myclass].friendlySpells and (#SRT[E.myclass].friendlySpells > 0) then -- you have some healy spell
|
||||
for _, spellID in ipairs(SRT[E.myclass].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
|
||||
|
||||
if SRT[E.myclass] then
|
||||
if SRT[E.myclass].friendlySpells and (#SRT[E.myclass].friendlySpells > 0) then -- you have some healy spell
|
||||
for _, spellID in ipairs(SRT[E.myclass].friendlySpells) do
|
||||
if SpellRange.IsSpellInRange(spellID, unit) == 1 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if SRT[E.myclass].petSpells and (#SRT[E.myclass].petSpells > 0) then -- you have some pet spell
|
||||
for _, spellID in ipairs(SRT[E.myclass].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
|
||||
|
||||
if SRT[E.myclass] then
|
||||
if SRT[E.myclass].enemySpells and (#SRT[E.myclass].enemySpells > 0) then -- you have some damage spell
|
||||
for _, spellID in ipairs(SRT[E.myclass].enemySpells) 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 enemyIsInLongRange(unit)
|
||||
if SRT[E.myclass] then
|
||||
if SRT[E.myclass].longEnemySpells and (#SRT[E.myclass].longEnemySpells > 0) then -- you have some 30+ range damage spell
|
||||
for _, spellID in ipairs(SRT[E.myclass].longEnemySpells) do
|
||||
if SpellRange.IsSpellInRange(spellID, unit) == 1 then
|
||||
return true
|
||||
end
|
||||
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
|
||||
@@ -0,0 +1,31 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
--WoW API / Variables
|
||||
|
||||
function UF:Construct_ReadyCheckIcon(frame)
|
||||
local tex = frame.RaisedElementParent.TextureParent:CreateTexture(nil, "OVERLAY")
|
||||
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
|
||||
@@ -0,0 +1,57 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
--WoW API / Variables
|
||||
|
||||
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
|
||||
|
||||
function UF:Configure_RestingIndicator(frame)
|
||||
if not frame.VARIABLES_SET then return end
|
||||
|
||||
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
|
||||
@@ -0,0 +1,35 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
--WoW API / Variables
|
||||
|
||||
function UF:Construct_ResurrectionIcon(frame)
|
||||
local tex = frame.RaisedElementParent.TextureParent:CreateTexture(nil, "OVERLAY")
|
||||
tex:SetTexture([[Interface\AddOns\ElvUI\media\textures\Raid-Icon-Rez]])
|
||||
tex:Point("CENTER", frame.Health, "CENTER")
|
||||
tex:Size(30)
|
||||
tex:Hide()
|
||||
|
||||
return tex
|
||||
end
|
||||
|
||||
function UF:Configure_ResurrectionIcon(frame)
|
||||
local RI = frame.ResurrectIndicator
|
||||
local db = frame.db
|
||||
|
||||
if db.resurrectIcon.enable then
|
||||
if not frame:IsElementEnabled("ResurrectIndicator") then
|
||||
frame:EnableElement("ResurrectIndicator")
|
||||
end
|
||||
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
|
||||
if frame:IsElementEnabled("ResurrectIndicator") then
|
||||
frame:DisableElement("ResurrectIndicator")
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,83 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
local random = math.random
|
||||
--WoW API / Variables
|
||||
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
|
||||
|
||||
local 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 (db and not db.enable) then
|
||||
lfdrole:Hide()
|
||||
return
|
||||
end
|
||||
|
||||
local isTank, isHealer, isDamage = UnitGroupRolesAssigned(self.unit)
|
||||
local role = isTank and "TANK" or isHealer and "HEALER" or isDamage and "DAMAGER" or "NONE"
|
||||
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(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
|
||||
@@ -0,0 +1,162 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
local unpack = unpack
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
|
||||
function UF:Construct_Threat(frame)
|
||||
local threat = CreateFrame("Frame", nil, frame)
|
||||
|
||||
--Main ThreatGlow
|
||||
frame:CreateShadow()
|
||||
threat.glow = frame.shadow
|
||||
threat.glow:SetParent(frame)
|
||||
threat.glow:Hide()
|
||||
frame.shadow = nil
|
||||
|
||||
--Secondary ThreatGlow, for power frame when using power offset
|
||||
frame:CreateShadow()
|
||||
threat.powerGlow = frame.shadow
|
||||
threat.powerGlow:SetParent(frame)
|
||||
threat.powerGlow:SetFrameStrata("BACKGROUND")
|
||||
threat.powerGlow:Hide()
|
||||
frame.shadow = nil
|
||||
|
||||
threat.texIcon = threat:CreateTexture(nil, "OVERLAY")
|
||||
threat.texIcon:Size(8)
|
||||
threat.texIcon:SetTexture(E.media.blankTex)
|
||||
threat.texIcon:Hide()
|
||||
|
||||
threat.PostUpdate = self.UpdateThreat
|
||||
return threat
|
||||
end
|
||||
|
||||
function UF:Configure_Threat(frame)
|
||||
if not (frame.VARIABLES_SET and frame.ThreatIndicator) then return end
|
||||
|
||||
local threat = frame.ThreatIndicator
|
||||
local db = frame.db
|
||||
|
||||
if db.threatStyle ~= "NONE" and db.threatStyle ~= nil then
|
||||
if not frame:IsElementEnabled("ThreatIndicator") then
|
||||
frame:EnableElement("ThreatIndicator")
|
||||
end
|
||||
|
||||
if db.threatStyle == "GLOW" then
|
||||
threat:SetFrameStrata("BACKGROUND")
|
||||
threat.glow:SetFrameStrata("BACKGROUND")
|
||||
threat.glow:ClearAllPoints()
|
||||
if frame.USE_POWERBAR_OFFSET then
|
||||
if frame.ORIENTATION == "RIGHT" then
|
||||
threat.glow:Point("TOPLEFT", frame.Health.backdrop, "TOPLEFT", -frame.SHADOW_SPACING - frame.SPACING - (frame.HAPPINESS_WIDTH or 0), frame.SHADOW_SPACING + frame.SPACING + (frame.USE_CLASSBAR and (frame.USE_MINI_CLASSBAR and 0 or frame.CLASSBAR_HEIGHT) or 0))
|
||||
threat.glow:Point("BOTTOMRIGHT", frame.Health.backdrop, "BOTTOMRIGHT", frame.SHADOW_SPACING + frame.SPACING, -frame.SHADOW_SPACING - frame.SPACING)
|
||||
else
|
||||
threat.glow:Point("TOPLEFT", frame.Health.backdrop, "TOPLEFT", -frame.SHADOW_SPACING - frame.SPACING, frame.SHADOW_SPACING + frame.SPACING + (frame.USE_CLASSBAR and (frame.USE_MINI_CLASSBAR and 0 or frame.CLASSBAR_HEIGHT) or 0))
|
||||
threat.glow:Point("BOTTOMRIGHT", frame.Health.backdrop, "BOTTOMRIGHT", frame.SHADOW_SPACING + frame.SPACING + (frame.HAPPINESS_WIDTH or 0), -frame.SHADOW_SPACING - frame.SPACING)
|
||||
end
|
||||
|
||||
threat.powerGlow:ClearAllPoints()
|
||||
threat.powerGlow:Point("TOPLEFT", frame.Power.backdrop, "TOPLEFT", -frame.SHADOW_SPACING - frame.SPACING, frame.SHADOW_SPACING + frame.SPACING)
|
||||
threat.powerGlow:Point("BOTTOMRIGHT", frame.Power.backdrop, "BOTTOMRIGHT", frame.SHADOW_SPACING + frame.SPACING, -frame.SHADOW_SPACING - frame.SPACING)
|
||||
else
|
||||
threat.glow:Point("TOPLEFT", -frame.SHADOW_SPACING, frame.SHADOW_SPACING-(frame.USE_MINI_CLASSBAR and frame.CLASSBAR_YOFFSET or 0))
|
||||
|
||||
if frame.USE_MINI_POWERBAR then
|
||||
threat.glow:Point("BOTTOMLEFT", -frame.SHADOW_SPACING, -frame.SHADOW_SPACING + (frame.POWERBAR_HEIGHT/2))
|
||||
threat.glow:Point("BOTTOMRIGHT", frame.SHADOW_SPACING, -frame.SHADOW_SPACING + (frame.POWERBAR_HEIGHT/2))
|
||||
else
|
||||
threat.glow:Point("BOTTOMLEFT", -frame.SHADOW_SPACING, -frame.SHADOW_SPACING)
|
||||
threat.glow:Point("BOTTOMRIGHT", frame.SHADOW_SPACING, -frame.SHADOW_SPACING)
|
||||
end
|
||||
end
|
||||
elseif db.threatStyle == "ICONTOPLEFT" or db.threatStyle == "ICONTOPRIGHT" or db.threatStyle == "ICONBOTTOMLEFT" or db.threatStyle == "ICONBOTTOMRIGHT" or db.threatStyle == "ICONTOP" or db.threatStyle == "ICONBOTTOM" or db.threatStyle == "ICONLEFT" or db.threatStyle == "ICONRIGHT" then
|
||||
threat:SetFrameStrata("LOW")
|
||||
threat:SetFrameLevel(75) --Inset power uses 50, we want it to appear above that
|
||||
local point = db.threatStyle
|
||||
point = string.gsub(point, "ICON", "")
|
||||
|
||||
threat.texIcon:ClearAllPoints()
|
||||
threat.texIcon:Point(point, frame.Health, point)
|
||||
elseif db.threatStyle == "HEALTHBORDER" then
|
||||
if frame.InfoPanel then
|
||||
frame.InfoPanel:SetFrameLevel(frame.Health:GetFrameLevel() - 3)
|
||||
end
|
||||
elseif db.threatStyle == "INFOPANELBORDER" then
|
||||
if frame.InfoPanel then
|
||||
frame.InfoPanel:SetFrameLevel(frame.Health:GetFrameLevel() + 3)
|
||||
end
|
||||
end
|
||||
elseif frame:IsElementEnabled("ThreatIndicator") then
|
||||
frame:DisableElement("ThreatIndicator")
|
||||
end
|
||||
end
|
||||
|
||||
function UF:UpdateThreat(unit, status, r, g, b)
|
||||
local parent = self:GetParent()
|
||||
|
||||
if (parent.unit ~= unit) or not unit then return end
|
||||
|
||||
local db = parent.db
|
||||
if not db then return end
|
||||
|
||||
if status and status > 1 then
|
||||
if db.threatStyle == "GLOW" then
|
||||
self.glow:Show()
|
||||
self.glow:SetBackdropBorderColor(r, g, b)
|
||||
|
||||
if parent.USE_POWERBAR_OFFSET then
|
||||
self.powerGlow:Show()
|
||||
self.powerGlow:SetBackdropBorderColor(r, g, b)
|
||||
end
|
||||
elseif db.threatStyle == "BORDERS" then
|
||||
parent.Health.backdrop:SetBackdropBorderColor(r, g, b)
|
||||
|
||||
if parent.Power and parent.Power.backdrop then
|
||||
parent.Power.backdrop:SetBackdropBorderColor(r, g, b)
|
||||
end
|
||||
|
||||
if parent.ClassBar and parent[parent.ClassBar] and parent[parent.ClassBar].backdrop then
|
||||
parent[parent.ClassBar].backdrop:SetBackdropBorderColor(r, g, b)
|
||||
end
|
||||
|
||||
if parent.InfoPanel and parent.InfoPanel.backdrop then
|
||||
parent.InfoPanel.backdrop:SetBackdropBorderColor(r, g, b)
|
||||
end
|
||||
elseif db.threatStyle == "HEALTHBORDER" then
|
||||
parent.Health.backdrop:SetBackdropBorderColor(r, g, b)
|
||||
elseif db.threatStyle == "INFOPANELBORDER" then
|
||||
parent.InfoPanel.backdrop:SetBackdropBorderColor(r, g, b)
|
||||
elseif db.threatStyle ~= "NONE" and self.texIcon then
|
||||
self.texIcon:Show()
|
||||
self.texIcon:SetVertexColor(r, g, b)
|
||||
end
|
||||
else
|
||||
r, g, b = unpack(E.media.unitframeBorderColor)
|
||||
if db.threatStyle == "GLOW" then
|
||||
self.glow:Hide()
|
||||
self.powerGlow:Hide()
|
||||
elseif db.threatStyle == "BORDERS" then
|
||||
parent.Health.backdrop:SetBackdropBorderColor(r, g, b)
|
||||
|
||||
if parent.Power and parent.Power.backdrop then
|
||||
parent.Power.backdrop:SetBackdropBorderColor(r, g, b)
|
||||
end
|
||||
|
||||
if parent.ClassBar and parent[parent.ClassBar] and parent[parent.ClassBar].backdrop then
|
||||
parent[parent.ClassBar].backdrop:SetBackdropBorderColor(r, g, b)
|
||||
end
|
||||
|
||||
if parent.InfoPanel and parent.InfoPanel.backdrop then
|
||||
parent.InfoPanel.backdrop:SetBackdropBorderColor(r, g, b)
|
||||
end
|
||||
elseif db.threatStyle == "HEALTHBORDER" then
|
||||
parent.Health.backdrop:SetBackdropBorderColor(r, g, b)
|
||||
elseif db.threatStyle == "INFOPANELBORDER" then
|
||||
parent.InfoPanel.backdrop:SetBackdropBorderColor(r, g, b)
|
||||
elseif db.threatStyle ~= "NONE" and self.texIcon then
|
||||
self.texIcon:Hide()
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,36 @@
|
||||
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local UF = E:GetModule("UnitFrames")
|
||||
|
||||
--Lua functions
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
|
||||
function UF:Construct_Trinket(frame)
|
||||
local trinket = CreateFrame("Frame", nil, frame)
|
||||
trinket.bg = CreateFrame("Frame", nil, trinket)
|
||||
trinket.bg:SetTemplate(nil, nil, nil, self.thinBorders, true)
|
||||
trinket.bg:SetFrameLevel(trinket:GetFrameLevel() - 1)
|
||||
trinket:SetInside(trinket.bg)
|
||||
|
||||
return trinket
|
||||
end
|
||||
|
||||
function UF:Configure_Trinket(frame)
|
||||
if not frame.VARIABLES_SET then return end
|
||||
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
|
||||
@@ -0,0 +1,152 @@
|
||||
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.")
|
||||
|
||||
--Lua functions
|
||||
local _G = _G
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
|
||||
local ArenaHeader = CreateFrame("Frame", "ArenaHeader", UIParent)
|
||||
ArenaHeader:SetFrameStrata("LOW")
|
||||
|
||||
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 = self:Construct_HealthBar(frame, true, true, "RIGHT")
|
||||
frame.Name = self:Construct_NameText(frame)
|
||||
|
||||
frame.Power = self:Construct_PowerBar(frame, true, true, "LEFT")
|
||||
|
||||
frame.Portrait3D = self:Construct_Portrait(frame, "model")
|
||||
frame.Portrait2D = self:Construct_Portrait(frame, "texture")
|
||||
frame.Buffs = self:Construct_Buffs(frame)
|
||||
frame.Debuffs = self:Construct_Debuffs(frame)
|
||||
frame.Castbar = self:Construct_Castbar(frame)
|
||||
frame.HealCommBar = self:Construct_HealComm(frame)
|
||||
frame.MouseGlow = self:Construct_MouseGlow(frame)
|
||||
frame.TargetGlow = self:Construct_TargetGlow(frame)
|
||||
frame.Trinket = self:Construct_Trinket(frame)
|
||||
frame.Fader = self:Construct_Fader()
|
||||
frame.Cutaway = self:Construct_Cutaway(frame)
|
||||
frame:SetAttribute("type2", "focus")
|
||||
|
||||
frame.customTexts = {}
|
||||
frame.InfoPanel = self:Construct_InfoPanel(frame)
|
||||
frame.unitframeType = "arena"
|
||||
|
||||
ArenaHeader:Point("BOTTOMRIGHT", E.UIParent, "RIGHT", -105, -165)
|
||||
E:CreateMover(ArenaHeader, ArenaHeader:GetName().."Mover", L["Arena Frames"], nil, nil, nil, "ALL,ARENA", nil, "unitframe,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.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 - (frame.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((frame.BORDER+frame.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.VARIABLES_SET = true
|
||||
end
|
||||
|
||||
frame.colors = ElvUF.colors
|
||||
frame.Portrait = frame.Portrait or (db.portrait.style == "2D" and frame.Portrait2D or frame.Portrait3D)
|
||||
frame:RegisterForClicks(self.db.targetOnMouseDown and "AnyDown" or "AnyUp")
|
||||
frame:Size(frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
|
||||
|
||||
UF:Configure_InfoPanel(frame)
|
||||
|
||||
--Health
|
||||
UF:Configure_HealthBar(frame)
|
||||
|
||||
--Name
|
||||
UF:UpdateNameSettings(frame)
|
||||
|
||||
--Power
|
||||
UF:Configure_Power(frame)
|
||||
--Portrait
|
||||
UF:Configure_Portrait(frame)
|
||||
--Auras
|
||||
UF:EnableDisable_Auras(frame)
|
||||
UF:Configure_Auras(frame, "Buffs")
|
||||
UF:Configure_Auras(frame, "Debuffs")
|
||||
--Castbar
|
||||
UF:Configure_Castbar(frame)
|
||||
--Trinket
|
||||
UF:Configure_Trinket(frame)
|
||||
|
||||
--Fader
|
||||
UF:Configure_Fader(frame)
|
||||
|
||||
--Cutaway
|
||||
UF:Configure_Cutaway(frame)
|
||||
|
||||
--Heal Prediction
|
||||
UF:Configure_HealComm(frame)
|
||||
|
||||
--CustomTexts
|
||||
UF:Configure_CustomTexts(frame)
|
||||
|
||||
frame:ClearAllPoints()
|
||||
if frame.index == 1 then
|
||||
local ArenaHeaderMover = 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("ForceUpdate")
|
||||
end
|
||||
|
||||
UF.unitgroupstoload.arena = {5}
|
||||
@@ -0,0 +1,189 @@
|
||||
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.")
|
||||
|
||||
--Lua functions
|
||||
local max = math.max
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
local InCombatLockdown = InCombatLockdown
|
||||
local RegisterStateDriver = RegisterStateDriver
|
||||
|
||||
function UF:Construct_AssistFrames()
|
||||
self:SetScript("OnEnter", UnitFrame_OnEnter)
|
||||
self:SetScript("OnLeave", 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.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.DebuffHighlight = UF:Construct_DebuffHighlight(self)
|
||||
|
||||
self.unitframeType = "assist"
|
||||
else
|
||||
self.unitframeType = "assisttarget"
|
||||
end
|
||||
|
||||
self.originalParent = self:GetParent()
|
||||
|
||||
UF:Update_StatusBars()
|
||||
UF:Update_FontStrings()
|
||||
|
||||
self.db = UF.db.units.assist
|
||||
self.PostCreate = UF.Update_AssistFrames
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function UF:Update_AssistHeader(header, db)
|
||||
header:Hide()
|
||||
header.db = db
|
||||
|
||||
RegisterStateDriver(header, "visibility", "show")
|
||||
RegisterStateDriver(header, "visibility", "[@raid1,exists] show;hide")
|
||||
|
||||
local width, height = header:GetSize()
|
||||
header.dirtyWidth, header.dirtyHeight = width, max(height, db.height)
|
||||
|
||||
if not header.positioned then
|
||||
header:ClearAllPoints()
|
||||
header:Point("TOPLEFT", E.UIParent, "TOPLEFT", 4, -248)
|
||||
E:CreateMover(header, header:GetName().."Mover", L["MA Frames"], nil, nil, nil, "ALL,RAID", nil, "unitframe,assist,generalGroup")
|
||||
header.mover.positionOverride = "TOPLEFT"
|
||||
header:SetAttribute("minHeight", header.dirtyHeight)
|
||||
header:SetAttribute("minWidth", header.dirtyWidth)
|
||||
header.positioned = true
|
||||
end
|
||||
end
|
||||
|
||||
function UF:Update_AssistFrames(frame, db)
|
||||
if not db then
|
||||
db = frame.db
|
||||
else
|
||||
frame.db = db
|
||||
end
|
||||
|
||||
frame.colors = ElvUF.colors
|
||||
frame:RegisterForClicks(self.db.targetOnMouseDown and "AnyDown" or "AnyUp")
|
||||
|
||||
do
|
||||
frame.ORIENTATION = db.orientation --allow this value to change when unitframes position changes on screen?
|
||||
if self.thinBorders then
|
||||
frame.SPACING = 0
|
||||
frame.BORDER = E.mult
|
||||
else
|
||||
frame.BORDER = E.Border
|
||||
frame.SPACING = E.Spacing
|
||||
end
|
||||
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
|
||||
|
||||
frame.VARIABLES_SET = true
|
||||
end
|
||||
|
||||
if frame.isChild and frame.originalParent then
|
||||
local childDB = db.targetsGroup
|
||||
frame.db = db.targetsGroup
|
||||
if not frame.originalParent.childList then
|
||||
frame.originalParent.childList = {}
|
||||
end
|
||||
frame.originalParent.childList[frame] = true
|
||||
|
||||
if not InCombatLockdown() then
|
||||
if childDB.enable then
|
||||
frame:SetParent(frame.originalParent)
|
||||
RegisterUnitWatch(frame)
|
||||
frame:Size(childDB.width, childDB.height)
|
||||
frame:ClearAllPoints()
|
||||
frame:Point(E.InversePoints[childDB.anchorPoint], frame.originalParent, childDB.anchorPoint, childDB.xOffset, childDB.yOffset)
|
||||
else
|
||||
UnregisterUnitWatch(frame)
|
||||
frame:SetParent(E.HiddenFrame)
|
||||
end
|
||||
else
|
||||
if childDB.enable then
|
||||
frame:SetAttribute("initial-anchor", format("%s,%s,%d,%d", E.InversePoints[childDB.anchorPoint], childDB.anchorPoint, childDB.xOffset, childDB.yOffset))
|
||||
frame:SetAttribute("initial-width", frame.UNIT_WIDTH)
|
||||
frame:SetAttribute("initial-height", frame.UNIT_HEIGHT)
|
||||
end
|
||||
end
|
||||
else
|
||||
if not InCombatLockdown() then
|
||||
frame:Size(frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
|
||||
else
|
||||
frame:SetAttribute("initial-width", frame.UNIT_WIDTH)
|
||||
frame:SetAttribute("initial-height", frame.UNIT_HEIGHT)
|
||||
end
|
||||
end
|
||||
|
||||
--Health
|
||||
UF:Configure_HealthBar(frame)
|
||||
|
||||
--Threat
|
||||
UF:Configure_Threat(frame)
|
||||
|
||||
--Name
|
||||
UF:UpdateNameSettings(frame)
|
||||
|
||||
--Fader
|
||||
UF:Configure_Fader(frame)
|
||||
|
||||
--Cutaway
|
||||
UF:Configure_Cutaway(frame)
|
||||
|
||||
UF:Configure_RaidIcon(frame)
|
||||
|
||||
if not frame.isChild then
|
||||
--Auras
|
||||
UF:EnableDisable_Auras(frame)
|
||||
UF:Configure_Auras(frame, "Buffs")
|
||||
UF:Configure_Auras(frame, "Debuffs")
|
||||
|
||||
--RaidDebuffs
|
||||
UF:Configure_RaidDebuffs(frame)
|
||||
|
||||
--Debuff Highlight
|
||||
UF:Configure_DebuffHighlight(frame)
|
||||
|
||||
--Buff Indicator
|
||||
UF:UpdateAuraWatch(frame)
|
||||
end
|
||||
|
||||
frame:UpdateAllElements("ForceUpdate")
|
||||
end
|
||||
|
||||
UF.headerstoload.assist = {"MAINASSIST", "ELVUI_UNITTARGET"}
|
||||
@@ -0,0 +1,152 @@
|
||||
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.")
|
||||
|
||||
--Lua functions
|
||||
local _G = _G
|
||||
--WoW API / Variables
|
||||
local MAX_BOSS_FRAMES = MAX_BOSS_FRAMES
|
||||
|
||||
local BossHeader = CreateFrame("Frame", "BossHeader", UIParent)
|
||||
BossHeader:SetFrameStrata("LOW")
|
||||
|
||||
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 = self:Construct_HealthBar(frame, true, true, "RIGHT")
|
||||
|
||||
frame.Power = self:Construct_PowerBar(frame, true, true, "LEFT")
|
||||
|
||||
frame.Name = self:Construct_NameText(frame)
|
||||
|
||||
frame.Portrait3D = self:Construct_Portrait(frame, "model")
|
||||
frame.Portrait2D = self:Construct_Portrait(frame, "texture")
|
||||
frame.InfoPanel = self:Construct_InfoPanel(frame)
|
||||
frame.Buffs = self:Construct_Buffs(frame)
|
||||
|
||||
frame.Debuffs = self:Construct_Debuffs(frame)
|
||||
frame.DebuffHighlight = self:Construct_DebuffHighlight(frame)
|
||||
|
||||
frame.Castbar = self:Construct_Castbar(frame)
|
||||
frame.RaidTargetIndicator = self:Construct_RaidIcon(frame)
|
||||
frame.Fader = self:Construct_Fader()
|
||||
frame.Cutaway = self:Construct_Cutaway(frame)
|
||||
frame.MouseGlow = self:Construct_MouseGlow(frame)
|
||||
frame.TargetGlow = self:Construct_TargetGlow(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,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.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 - (frame.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((frame.BORDER+frame.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)
|
||||
|
||||
frame.VARIABLES_SET = true
|
||||
end
|
||||
|
||||
frame.colors = ElvUF.colors
|
||||
frame.Portrait = frame.Portrait or (db.portrait.style == "2D" and frame.Portrait2D or frame.Portrait3D)
|
||||
frame:RegisterForClicks(self.db.targetOnMouseDown and "AnyDown" or "AnyUp")
|
||||
frame:Size(frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
|
||||
UF:Configure_InfoPanel(frame)
|
||||
--Health
|
||||
UF:Configure_HealthBar(frame)
|
||||
|
||||
--Name
|
||||
UF:UpdateNameSettings(frame)
|
||||
|
||||
--Power
|
||||
UF:Configure_Power(frame)
|
||||
|
||||
--Portrait
|
||||
UF:Configure_Portrait(frame)
|
||||
|
||||
--Auras
|
||||
UF:EnableDisable_Auras(frame)
|
||||
UF:Configure_Auras(frame, "Buffs")
|
||||
UF:Configure_Auras(frame, "Debuffs")
|
||||
|
||||
--Castbar
|
||||
UF:Configure_Castbar(frame)
|
||||
|
||||
--Raid Icon
|
||||
UF:Configure_RaidIcon(frame)
|
||||
|
||||
UF:Configure_DebuffHighlight(frame)
|
||||
|
||||
UF:Configure_CustomTexts(frame)
|
||||
|
||||
--Fader
|
||||
UF:Configure_Fader(frame)
|
||||
|
||||
--Cutaway
|
||||
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("ForceUpdate")
|
||||
end
|
||||
|
||||
UF.unitgroupstoload.boss = {MAX_BOSS_FRAMES}
|
||||
@@ -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="RaidPets.lua"/>
|
||||
<Script file="Assist.lua"/>
|
||||
</Ui>
|
||||
@@ -0,0 +1,290 @@
|
||||
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.")
|
||||
|
||||
--Lua functions
|
||||
local _G = _G
|
||||
local format = string.format
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
local GetInstanceInfo = GetInstanceInfo
|
||||
local InCombatLockdown = InCombatLockdown
|
||||
local RegisterStateDriver = RegisterStateDriver
|
||||
local UnregisterStateDriver = UnregisterStateDriver
|
||||
|
||||
function UF:Construct_PartyFrames()
|
||||
self:SetScript("OnEnter", UnitFrame_OnEnter)
|
||||
self:SetScript("OnLeave", UnitFrame_OnLeave)
|
||||
|
||||
self.RaisedElementParent = CreateFrame("Frame", nil, self)
|
||||
self.RaisedElementParent.TextureParent = CreateFrame("Frame", nil, self.RaisedElementParent)
|
||||
self.RaisedElementParent:SetFrameLevel(self:GetFrameLevel() + 100)
|
||||
self.BORDER = E.Border
|
||||
self.SPACING = E.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.Name = UF:Construct_NameText(self)
|
||||
self.RaidTargetIndicator = UF:Construct_RaidIcon(self)
|
||||
|
||||
self.originalParent = self:GetParent()
|
||||
|
||||
self.childType = "pet"
|
||||
if self == _G[self.originalParent:GetName().."Target"] then
|
||||
self.childType = "target"
|
||||
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.Power.frequentUpdates = false
|
||||
|
||||
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.DebuffHighlight = UF:Construct_DebuffHighlight(self)
|
||||
self.ResurrectIndicator = UF:Construct_ResurrectionIcon(self)
|
||||
self.GroupRoleIndicator = UF:Construct_RoleIcon(self)
|
||||
self.RaidRoleFramesAnchor = UF:Construct_RaidRoleFrames(self)
|
||||
self.MouseGlow = UF:Construct_MouseGlow(self)
|
||||
self.TargetGlow = UF:Construct_TargetGlow(self)
|
||||
self.ThreatIndicator = UF:Construct_Threat(self)
|
||||
self.RaidTargetIndicator = UF:Construct_RaidIcon(self)
|
||||
self.ReadyCheckIndicator = UF:Construct_ReadyCheckIcon(self)
|
||||
self.HealCommBar = UF:Construct_HealComm(self)
|
||||
self.GPS = UF:Construct_GPS(self)
|
||||
self.customTexts = {}
|
||||
|
||||
self.Castbar = UF:Construct_Castbar(self)
|
||||
|
||||
self.unitframeType = "party"
|
||||
end
|
||||
|
||||
self.Fader = UF:Construct_Fader()
|
||||
self.Cutaway = UF:Construct_Cutaway(self)
|
||||
|
||||
UF:Update_StatusBars()
|
||||
UF:Update_FontStrings()
|
||||
|
||||
self.db = UF.db.units.party
|
||||
self.PostCreate = UF.Update_PartyFrames
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function UF:Update_PartyHeader(header, db)
|
||||
header.db = db
|
||||
|
||||
local headerHolder = header:GetParent()
|
||||
headerHolder.db = db
|
||||
|
||||
if not headerHolder.positioned then
|
||||
headerHolder:ClearAllPoints()
|
||||
headerHolder:Point("BOTTOMLEFT", E.UIParent, "BOTTOMLEFT", 4, 195)
|
||||
|
||||
E:CreateMover(headerHolder, headerHolder:GetName().."Mover", L["Party Frames"], nil, nil, nil, "ALL,PARTY,ARENA", nil, "unitframe,party,generalGroup")
|
||||
headerHolder.positioned = true
|
||||
|
||||
headerHolder:RegisterEvent("PLAYER_LOGIN")
|
||||
headerHolder:RegisterEvent("ZONE_CHANGED_NEW_AREA")
|
||||
headerHolder:SetScript("OnEvent", UF.PartySmartVisibility)
|
||||
end
|
||||
|
||||
UF.PartySmartVisibility(headerHolder)
|
||||
end
|
||||
|
||||
function UF:PartySmartVisibility(event)
|
||||
if not self.db or (self.db and not self.db.enable) or (UF.db and not UF.db.smartRaidFilter) or self.isForced then
|
||||
self.blockVisibilityChanges = false
|
||||
return
|
||||
end
|
||||
|
||||
if event == "PLAYER_REGEN_ENABLED" then
|
||||
self:UnregisterEvent("PLAYER_REGEN_ENABLED")
|
||||
end
|
||||
|
||||
if not InCombatLockdown() then
|
||||
local _, instanceType = GetInstanceInfo()
|
||||
if instanceType == "raid" or instanceType == "pvp" then
|
||||
UnregisterStateDriver(self, "visibility")
|
||||
self.blockVisibilityChanges = true
|
||||
self:Hide()
|
||||
elseif self.db.visibility then
|
||||
RegisterStateDriver(self, "visibility", self.db.visibility)
|
||||
self.blockVisibilityChanges = false
|
||||
end
|
||||
else
|
||||
self:RegisterEvent("PLAYER_REGEN_ENABLED")
|
||||
end
|
||||
end
|
||||
|
||||
function UF:Update_PartyFrames(frame, db)
|
||||
if not db then
|
||||
db = frame.db
|
||||
else
|
||||
frame.db = db
|
||||
end
|
||||
|
||||
frame.Portrait = frame.Portrait or (db.portrait.style == "2D" and frame.Portrait2D or frame.Portrait3D)
|
||||
frame.colors = ElvUF.colors
|
||||
frame:RegisterForClicks(self.db.targetOnMouseDown and "AnyDown" or "AnyUp")
|
||||
|
||||
do
|
||||
if self.thinBorders then
|
||||
frame.SPACING = 0
|
||||
frame.BORDER = E.mult
|
||||
else
|
||||
frame.BORDER = E.Border
|
||||
frame.SPACING = E.Spacing
|
||||
end
|
||||
|
||||
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.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 - (frame.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((frame.BORDER+frame.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.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.VARIABLES_SET = true
|
||||
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
|
||||
|
||||
local childDB = db.petsGroup
|
||||
if frame.childType == "target" then
|
||||
childDB = db.targetsGroup
|
||||
end
|
||||
|
||||
frame.UNIT_WIDTH = childDB.width
|
||||
frame.UNIT_HEIGHT = childDB.height
|
||||
|
||||
if not frame.originalParent.childList then
|
||||
frame.originalParent.childList = {}
|
||||
end
|
||||
frame.originalParent.childList[frame] = true
|
||||
|
||||
if not InCombatLockdown() then
|
||||
if childDB.enable then
|
||||
frame:SetParent(frame.originalParent)
|
||||
RegisterUnitWatch(frame)
|
||||
frame:Size(childDB.width, childDB.height)
|
||||
frame:ClearAllPoints()
|
||||
frame:Point(E.InversePoints[childDB.anchorPoint], frame.originalParent, childDB.anchorPoint, childDB.xOffset, childDB.yOffset)
|
||||
else
|
||||
UnregisterUnitWatch(frame)
|
||||
frame:SetParent(E.HiddenFrame)
|
||||
end
|
||||
else
|
||||
if childDB.enable then
|
||||
frame:SetAttribute("initial-anchor", format("%s,%s,%d,%d", E.InversePoints[childDB.anchorPoint], childDB.anchorPoint, childDB.xOffset, childDB.yOffset))
|
||||
frame:SetAttribute("initial-width", frame.UNIT_WIDTH)
|
||||
frame:SetAttribute("initial-height", frame.UNIT_HEIGHT)
|
||||
end
|
||||
end
|
||||
|
||||
--Health
|
||||
UF:Configure_HealthBar(frame)
|
||||
|
||||
UF:Configure_RaidIcon(frame)
|
||||
|
||||
--Name
|
||||
UF:UpdateNameSettings(frame, frame.childType)
|
||||
else
|
||||
if not InCombatLockdown() then
|
||||
frame:Size(frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
|
||||
else
|
||||
frame:SetAttribute("initial-width", frame.UNIT_WIDTH)
|
||||
frame:SetAttribute("initial-height", frame.UNIT_HEIGHT)
|
||||
end
|
||||
|
||||
UF:Configure_InfoPanel(frame)
|
||||
UF:Configure_HealthBar(frame)
|
||||
|
||||
UF:UpdateNameSettings(frame)
|
||||
|
||||
UF:Configure_Power(frame)
|
||||
|
||||
UF:Configure_Portrait(frame)
|
||||
|
||||
UF:Configure_Threat(frame)
|
||||
|
||||
UF:EnableDisable_Auras(frame)
|
||||
UF:Configure_Auras(frame, "Buffs")
|
||||
UF:Configure_Auras(frame, "Debuffs")
|
||||
|
||||
UF:Configure_RaidDebuffs(frame)
|
||||
|
||||
UF:Configure_Castbar(frame)
|
||||
|
||||
UF:Configure_RaidIcon(frame)
|
||||
|
||||
UF:Configure_DebuffHighlight(frame)
|
||||
|
||||
UF:Configure_ResurrectionIcon(frame)
|
||||
|
||||
UF:Configure_RoleIcon(frame)
|
||||
|
||||
UF:Configure_HealComm(frame)
|
||||
|
||||
UF:Configure_GPS(frame)
|
||||
|
||||
UF:Configure_RaidRoleIcons(frame)
|
||||
|
||||
UF:UpdateAuraWatch(frame)
|
||||
|
||||
UF:Configure_ReadyCheckIcon(frame)
|
||||
|
||||
UF:Configure_CustomTexts(frame)
|
||||
end
|
||||
|
||||
--Fader
|
||||
UF:Configure_Fader(frame)
|
||||
|
||||
--Cutaway
|
||||
UF:Configure_Cutaway(frame)
|
||||
|
||||
frame:UpdateAllElements("ForceUpdate")
|
||||
end
|
||||
|
||||
UF.headerstoload.party = {nil, "ELVUI_UNITPET, ELVUI_UNITTARGET"}
|
||||
@@ -0,0 +1,243 @@
|
||||
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.")
|
||||
|
||||
--Lua functions
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
local GetInstanceInfo = GetInstanceInfo
|
||||
local InCombatLockdown = InCombatLockdown
|
||||
local RegisterStateDriver = RegisterStateDriver
|
||||
local UnregisterStateDriver = UnregisterStateDriver
|
||||
|
||||
function UF:Construct_RaidFrames()
|
||||
self:SetScript("OnEnter", UnitFrame_OnEnter)
|
||||
self:SetScript("OnLeave", 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.Power.frequentUpdates = false
|
||||
|
||||
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.DebuffHighlight = UF:Construct_DebuffHighlight(self)
|
||||
self.ResurrectIndicator = UF:Construct_ResurrectionIcon(self)
|
||||
self.RaidRoleFramesAnchor = UF:Construct_RaidRoleFrames(self)
|
||||
self.MouseGlow = UF:Construct_MouseGlow(self)
|
||||
self.TargetGlow = UF:Construct_TargetGlow(self)
|
||||
|
||||
self.ThreatIndicator = UF:Construct_Threat(self)
|
||||
self.RaidTargetIndicator = UF:Construct_RaidIcon(self)
|
||||
self.ReadyCheckIndicator = UF:Construct_ReadyCheckIcon(self)
|
||||
self.HealCommBar = UF:Construct_HealComm(self)
|
||||
self.GPS = UF:Construct_GPS(self)
|
||||
self.Fader = UF:Construct_Fader()
|
||||
self.Cutaway = UF:Construct_Cutaway(self)
|
||||
|
||||
self.customTexts = {}
|
||||
self.InfoPanel = UF:Construct_InfoPanel(self)
|
||||
|
||||
self.unitframeType = "raid"
|
||||
UF:Update_StatusBars()
|
||||
UF:Update_FontStrings()
|
||||
|
||||
self.db = UF.db.units.raid
|
||||
self.PostCreate = UF.Update_RaidFrames
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function UF:RaidSmartVisibility(event)
|
||||
if not self.db or (self.db and not self.db.enable) or (UF.db and not UF.db.smartRaidFilter) or self.isForced then
|
||||
self.blockVisibilityChanges = false
|
||||
return
|
||||
end
|
||||
|
||||
if event == "PLAYER_REGEN_ENABLED" then self:UnregisterEvent("PLAYER_REGEN_ENABLED") end
|
||||
|
||||
if not InCombatLockdown() then
|
||||
self.isInstanceForced = nil
|
||||
local _, instanceType, _, _, maxPlayers = GetInstanceInfo()
|
||||
if instanceType == "raid" or instanceType == "pvp" then
|
||||
local mapID = GetCurrentMapAreaID()
|
||||
if UF.instanceMapIDs[mapID] then
|
||||
maxPlayers = UF.instanceMapIDs[mapID]
|
||||
end
|
||||
|
||||
UnregisterStateDriver(self, "visibility")
|
||||
|
||||
if maxPlayers < 40 then
|
||||
self:Show()
|
||||
self.isInstanceForced = true
|
||||
self.blockVisibilityChanges = false
|
||||
if ElvUF_Raid.numGroups ~= E:Round(maxPlayers/5) and event then
|
||||
UF:CreateAndUpdateHeaderGroup("raid")
|
||||
end
|
||||
else
|
||||
self.blockVisibilityChanges = true
|
||||
self:Hide()
|
||||
end
|
||||
elseif self.db.visibility then
|
||||
RegisterStateDriver(self, "visibility", self.db.visibility)
|
||||
self.blockVisibilityChanges = false
|
||||
if ElvUF_Raid.numGroups ~= self.db.numGroups then
|
||||
UF:CreateAndUpdateHeaderGroup("raid")
|
||||
end
|
||||
end
|
||||
else
|
||||
self:RegisterEvent("PLAYER_REGEN_ENABLED")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
function UF:Update_RaidHeader(header, db)
|
||||
header.db = db
|
||||
|
||||
local headerHolder = header:GetParent()
|
||||
headerHolder.db = db
|
||||
|
||||
if not headerHolder.positioned then
|
||||
headerHolder:ClearAllPoints()
|
||||
headerHolder:Point("BOTTOMLEFT", E.UIParent, "BOTTOMLEFT", 4, 195)
|
||||
|
||||
E:CreateMover(headerHolder, headerHolder:GetName().."Mover", L["Raid Frames"], nil, nil, nil, "ALL,RAID", nil, "unitframe,raid,generalGroup")
|
||||
|
||||
headerHolder:RegisterEvent("PLAYER_LOGIN")
|
||||
headerHolder:RegisterEvent("ZONE_CHANGED_NEW_AREA")
|
||||
headerHolder:SetScript("OnEvent", UF.RaidSmartVisibility)
|
||||
headerHolder.positioned = true
|
||||
end
|
||||
|
||||
UF.RaidSmartVisibility(headerHolder)
|
||||
end
|
||||
|
||||
function UF:Update_RaidFrames(frame, db)
|
||||
if not db then
|
||||
db = frame.db
|
||||
else
|
||||
frame.db = db
|
||||
end
|
||||
|
||||
frame.Portrait = frame.Portrait or (db.portrait.style == "2D" and frame.Portrait2D or frame.Portrait3D)
|
||||
frame.colors = ElvUF.colors
|
||||
frame:RegisterForClicks(self.db.targetOnMouseDown and "AnyDown" or "AnyUp")
|
||||
|
||||
do
|
||||
if self.thinBorders then
|
||||
frame.SPACING = 0
|
||||
frame.BORDER = E.mult
|
||||
else
|
||||
frame.BORDER = E.Border
|
||||
frame.SPACING = E.Spacing
|
||||
end
|
||||
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 = 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.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 - (frame.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((frame.BORDER+frame.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.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.VARIABLES_SET = true
|
||||
end
|
||||
|
||||
if not InCombatLockdown() then
|
||||
frame:Size(frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
|
||||
else
|
||||
frame:SetAttribute("initial-width", frame.UNIT_WIDTH)
|
||||
frame:SetAttribute("initial-height", frame.UNIT_HEIGHT)
|
||||
end
|
||||
|
||||
UF:Configure_InfoPanel(frame)
|
||||
--Health
|
||||
UF:Configure_HealthBar(frame)
|
||||
|
||||
--Name
|
||||
UF:UpdateNameSettings(frame)
|
||||
|
||||
--Power
|
||||
UF:Configure_Power(frame)
|
||||
|
||||
--Portrait
|
||||
UF:Configure_Portrait(frame)
|
||||
|
||||
--Threat
|
||||
UF:Configure_Threat(frame)
|
||||
|
||||
--Auras
|
||||
UF:EnableDisable_Auras(frame)
|
||||
UF:Configure_Auras(frame, "Buffs")
|
||||
UF:Configure_Auras(frame, "Debuffs")
|
||||
|
||||
--RaidDebuffs
|
||||
UF:Configure_RaidDebuffs(frame)
|
||||
|
||||
--Raid Icon
|
||||
UF:Configure_RaidIcon(frame)
|
||||
|
||||
--Resurrect Icon
|
||||
UF:Configure_ResurrectionIcon(frame)
|
||||
|
||||
--Debuff Highlight
|
||||
UF:Configure_DebuffHighlight(frame)
|
||||
|
||||
--OverHealing
|
||||
UF:Configure_HealComm(frame)
|
||||
|
||||
--GPS Arrow
|
||||
UF:Configure_GPS(frame)
|
||||
|
||||
--Raid Roles
|
||||
UF:Configure_RaidRoleIcons(frame)
|
||||
|
||||
--Fader
|
||||
UF:Configure_Fader(frame)
|
||||
|
||||
--Cutaway
|
||||
UF:Configure_Cutaway(frame)
|
||||
|
||||
--Buff Indicators
|
||||
UF:UpdateAuraWatch(frame)
|
||||
|
||||
--ReadyCheck
|
||||
UF:Configure_ReadyCheckIcon(frame)
|
||||
|
||||
--CustomTexts
|
||||
UF:Configure_CustomTexts(frame)
|
||||
|
||||
frame:UpdateAllElements("ForceUpdate")
|
||||
end
|
||||
|
||||
UF.headerstoload.raid = true
|
||||
@@ -0,0 +1,247 @@
|
||||
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.")
|
||||
|
||||
--Lua functions
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
local GetInstanceInfo = GetInstanceInfo
|
||||
local InCombatLockdown = InCombatLockdown
|
||||
local RegisterStateDriver = RegisterStateDriver
|
||||
local UnregisterStateDriver = UnregisterStateDriver
|
||||
|
||||
function UF:Construct_Raid40Frames()
|
||||
self:SetScript("OnEnter", UnitFrame_OnEnter)
|
||||
self:SetScript("OnLeave", 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.Power.frequentUpdates = false
|
||||
|
||||
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.DebuffHighlight = UF:Construct_DebuffHighlight(self)
|
||||
self.ResurrectIndicator = UF:Construct_ResurrectionIcon(self)
|
||||
self.RaidRoleFramesAnchor = UF:Construct_RaidRoleFrames(self)
|
||||
self.MouseGlow = UF:Construct_MouseGlow(self)
|
||||
self.TargetGlow = UF:Construct_TargetGlow(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.HealCommBar = UF:Construct_HealComm(self)
|
||||
self.GPS = UF:Construct_GPS(self)
|
||||
self.Fader = UF:Construct_Fader()
|
||||
self.Cutaway = UF:Construct_Cutaway(self)
|
||||
self.customTexts = {}
|
||||
|
||||
self.unitframeType = "raid40"
|
||||
|
||||
UF:Update_StatusBars()
|
||||
UF:Update_FontStrings()
|
||||
|
||||
self.db = UF.db.units.raid40
|
||||
self.PostCreate = UF.Update_Raid40Frames
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function UF:Raid40SmartVisibility(event)
|
||||
if not self.db or (self.db and not self.db.enable) or (UF.db and not UF.db.smartRaidFilter) or self.isForced then
|
||||
self.blockVisibilityChanges = false
|
||||
return
|
||||
end
|
||||
|
||||
if event == "PLAYER_REGEN_ENABLED" then
|
||||
self:UnregisterEvent("PLAYER_REGEN_ENABLED")
|
||||
end
|
||||
|
||||
if not InCombatLockdown() then
|
||||
self.isInstanceForced = nil
|
||||
local _, instanceType, _, _, maxPlayers = GetInstanceInfo()
|
||||
if instanceType == "raid" or instanceType == "pvp" then
|
||||
local mapID = GetCurrentMapAreaID()
|
||||
if UF.instanceMapIDs[mapID] then
|
||||
maxPlayers = UF.instanceMapIDs[mapID]
|
||||
end
|
||||
|
||||
UnregisterStateDriver(self, "visibility")
|
||||
|
||||
if maxPlayers == 40 then
|
||||
self.isInstanceForced = true
|
||||
self.blockVisibilityChanges = false
|
||||
self:Show()
|
||||
|
||||
if ElvUF_Raid40.numGroups ~= E:Round(maxPlayers/5) and event then
|
||||
UF:CreateAndUpdateHeaderGroup("raid40")
|
||||
end
|
||||
else
|
||||
self.blockVisibilityChanges = true
|
||||
self:Hide()
|
||||
end
|
||||
elseif self.db.visibility then
|
||||
RegisterStateDriver(self, "visibility", self.db.visibility)
|
||||
self.blockVisibilityChanges = false
|
||||
|
||||
if ElvUF_Raid40.numGroups ~= self.db.numGroups then
|
||||
UF:CreateAndUpdateHeaderGroup("raid40")
|
||||
end
|
||||
end
|
||||
else
|
||||
self:RegisterEvent("PLAYER_REGEN_ENABLED")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
function UF:Update_Raid40Header(header, db)
|
||||
header:GetParent().db = db
|
||||
|
||||
local headerHolder = header:GetParent()
|
||||
headerHolder.db = db
|
||||
|
||||
if not headerHolder.positioned then
|
||||
headerHolder:ClearAllPoints()
|
||||
headerHolder:Point("BOTTOMLEFT", E.UIParent, "BOTTOMLEFT", 4, 195)
|
||||
|
||||
E:CreateMover(headerHolder, headerHolder:GetName().."Mover", L["Raid-40 Frames"], nil, nil, nil, "ALL,RAID", nil, "unitframe,raid40,generalGroup")
|
||||
|
||||
headerHolder:RegisterEvent("PLAYER_LOGIN")
|
||||
headerHolder:RegisterEvent("ZONE_CHANGED_NEW_AREA")
|
||||
headerHolder:SetScript("OnEvent", UF.Raid40SmartVisibility)
|
||||
headerHolder.positioned = true
|
||||
end
|
||||
|
||||
UF.Raid40SmartVisibility(headerHolder)
|
||||
end
|
||||
|
||||
function UF:Update_Raid40Frames(frame, db)
|
||||
if not db then
|
||||
db = frame.db
|
||||
else
|
||||
frame.db = db
|
||||
end
|
||||
|
||||
frame.Portrait = frame.Portrait or (db.portrait.style == "2D" and frame.Portrait2D or frame.Portrait3D)
|
||||
frame.colors = ElvUF.colors
|
||||
frame:RegisterForClicks(self.db.targetOnMouseDown and "AnyDown" or "AnyUp")
|
||||
|
||||
do
|
||||
if self.thinBorders then
|
||||
frame.SPACING = 0
|
||||
frame.BORDER = E.mult
|
||||
else
|
||||
frame.BORDER = E.Border
|
||||
frame.SPACING = E.Spacing
|
||||
end
|
||||
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 = 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.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 - (frame.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((frame.BORDER+frame.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.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.VARIABLES_SET = true
|
||||
end
|
||||
|
||||
if not InCombatLockdown() then
|
||||
frame:Size(frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
|
||||
else
|
||||
frame:SetAttribute("initial-width", frame.UNIT_WIDTH)
|
||||
frame:SetAttribute("initial-height", frame.UNIT_HEIGHT)
|
||||
end
|
||||
|
||||
UF:Configure_InfoPanel(frame)
|
||||
--Health
|
||||
UF:Configure_HealthBar(frame)
|
||||
|
||||
--Name
|
||||
UF:UpdateNameSettings(frame)
|
||||
|
||||
--Power
|
||||
UF:Configure_Power(frame)
|
||||
|
||||
--Portrait
|
||||
UF:Configure_Portrait(frame)
|
||||
|
||||
--Threat
|
||||
UF:Configure_Threat(frame)
|
||||
|
||||
--Auras
|
||||
UF:EnableDisable_Auras(frame)
|
||||
UF:Configure_Auras(frame, "Buffs")
|
||||
UF:Configure_Auras(frame, "Debuffs")
|
||||
|
||||
--RaidDebuffs
|
||||
UF:Configure_RaidDebuffs(frame)
|
||||
|
||||
--Raid Icon
|
||||
UF:Configure_RaidIcon(frame)
|
||||
|
||||
--Debuff Highlight
|
||||
UF:Configure_DebuffHighlight(frame)
|
||||
|
||||
--Resurrect Highlight
|
||||
UF:Configure_ResurrectionIcon(frame)
|
||||
|
||||
--OverHealing
|
||||
UF:Configure_HealComm(frame)
|
||||
|
||||
--GPS Arrow
|
||||
UF:Configure_GPS(frame)
|
||||
|
||||
--Raid Roles
|
||||
UF:Configure_RaidRoleIcons(frame)
|
||||
|
||||
--Fader
|
||||
UF:Configure_Fader(frame)
|
||||
|
||||
--Cutaway
|
||||
UF:Configure_Cutaway(frame)
|
||||
|
||||
--Buff Indicators
|
||||
UF:UpdateAuraWatch(frame)
|
||||
|
||||
--ReadyCheck
|
||||
UF:Configure_ReadyCheckIcon(frame)
|
||||
|
||||
--CustomTexts
|
||||
UF:Configure_CustomTexts(frame)
|
||||
|
||||
frame:UpdateAllElements("ForceUpdate")
|
||||
end
|
||||
|
||||
UF.headerstoload.raid40 = true
|
||||
@@ -0,0 +1,189 @@
|
||||
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.")
|
||||
|
||||
--Lua functions
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
local GetInstanceInfo = GetInstanceInfo
|
||||
local InCombatLockdown = InCombatLockdown
|
||||
local RegisterStateDriver = RegisterStateDriver
|
||||
local UnregisterStateDriver = UnregisterStateDriver
|
||||
|
||||
function UF:Construct_RaidpetFrames()
|
||||
self:SetScript("OnEnter", UnitFrame_OnEnter)
|
||||
self:SetScript("OnLeave", 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.DebuffHighlight = UF:Construct_DebuffHighlight(self)
|
||||
self.TargetGlow = UF:Construct_TargetGlow(self)
|
||||
self.MouseGlow = UF:Construct_MouseGlow(self)
|
||||
self.ThreatIndicator = UF:Construct_Threat(self)
|
||||
self.RaidTargetIndicator = UF:Construct_RaidIcon(self)
|
||||
self.HealCommBar = UF:Construct_HealComm(self)
|
||||
self.Fader = UF:Construct_Fader()
|
||||
self.Cutaway = UF:Construct_Cutaway(self)
|
||||
self.customTexts = {}
|
||||
|
||||
self.unitframeType = "raidpet"
|
||||
|
||||
UF:Update_StatusBars()
|
||||
UF:Update_FontStrings()
|
||||
|
||||
self.db = UF.db.units.raidpet
|
||||
self.PostCreate = UF.Update_RaidpetFrames
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
--I don"t know if this function is needed or not? But the error I pm'ed you about was because of the missing OnEvent so I just added it.
|
||||
function UF:RaidPetsSmartVisibility(event)
|
||||
if not self.db or (self.db and not self.db.enable) or (UF.db and not UF.db.smartRaidFilter) or self.isForced then return end
|
||||
if event == "PLAYER_REGEN_ENABLED" then self:UnregisterEvent("PLAYER_REGEN_ENABLED") end
|
||||
|
||||
if not InCombatLockdown() then
|
||||
local _, instanceType = GetInstanceInfo()
|
||||
if instanceType == "raid" then
|
||||
UnregisterStateDriver(self, "visibility")
|
||||
self:Show()
|
||||
elseif self.db.visibility then
|
||||
RegisterStateDriver(self, "visibility", self.db.visibility)
|
||||
end
|
||||
else
|
||||
self:RegisterEvent("PLAYER_REGEN_ENABLED")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
function UF:Update_RaidpetHeader(header, db)
|
||||
header.db = db
|
||||
|
||||
local headerHolder = header:GetParent()
|
||||
headerHolder.db = db
|
||||
|
||||
if not headerHolder.positioned then
|
||||
headerHolder:ClearAllPoints()
|
||||
headerHolder:Point("BOTTOMLEFT", E.UIParent, "BOTTOMLEFT", 4, 574)
|
||||
|
||||
E:CreateMover(headerHolder, headerHolder:GetName().."Mover", L["Raid Pet Frames"], nil, nil, nil, "ALL,RAID10,RAID25,RAID40", nil, "unitframe,raidpet,generalGroup")
|
||||
headerHolder.positioned = true
|
||||
|
||||
headerHolder:RegisterEvent("PLAYER_LOGIN")
|
||||
headerHolder:RegisterEvent("ZONE_CHANGED_NEW_AREA")
|
||||
headerHolder:SetScript("OnEvent", UF.RaidPetsSmartVisibility)
|
||||
end
|
||||
|
||||
UF.RaidPetsSmartVisibility(headerHolder)
|
||||
end
|
||||
|
||||
function UF:Update_RaidpetFrames(frame, db)
|
||||
if not db then
|
||||
db = frame.db
|
||||
else
|
||||
frame.db = db
|
||||
end
|
||||
|
||||
frame.Portrait = frame.Portrait or (db.portrait.style == "2D" and frame.Portrait2D or frame.Portrait3D)
|
||||
frame.colors = ElvUF.colors
|
||||
frame:RegisterForClicks(self.db.targetOnMouseDown and "AnyDown" or "AnyUp")
|
||||
|
||||
do
|
||||
if self.thinBorders then
|
||||
frame.SPACING = 0
|
||||
frame.BORDER = E.mult
|
||||
else
|
||||
frame.BORDER = E.Border
|
||||
frame.SPACING = E.Spacing
|
||||
end
|
||||
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
|
||||
|
||||
frame.VARIABLES_SET = true
|
||||
end
|
||||
|
||||
if not InCombatLockdown() then
|
||||
frame:Size(frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
|
||||
else
|
||||
frame:SetAttribute("initial-width", frame.UNIT_WIDTH)
|
||||
frame:SetAttribute("initial-height", frame.UNIT_HEIGHT)
|
||||
end
|
||||
|
||||
--Health
|
||||
UF:Configure_HealthBar(frame)
|
||||
|
||||
--Name
|
||||
UF:UpdateNameSettings(frame)
|
||||
|
||||
--Portrait
|
||||
UF:Configure_Portrait(frame)
|
||||
|
||||
--Threat
|
||||
UF:Configure_Threat(frame)
|
||||
|
||||
--Auras
|
||||
UF:EnableDisable_Auras(frame)
|
||||
UF:Configure_Auras(frame, "Buffs")
|
||||
UF:Configure_Auras(frame, "Debuffs")
|
||||
|
||||
--RaidDebuffs
|
||||
UF:Configure_RaidDebuffs(frame)
|
||||
|
||||
--Raid Icon
|
||||
UF:Configure_RaidIcon(frame)
|
||||
|
||||
--Debuff Highlight
|
||||
UF:Configure_DebuffHighlight(frame)
|
||||
|
||||
--OverHealing
|
||||
UF:Configure_HealComm(frame)
|
||||
|
||||
--Fader
|
||||
UF:Configure_Fader(frame)
|
||||
|
||||
--Cutaway
|
||||
UF:Configure_Cutaway(frame)
|
||||
|
||||
--BuffIndicator
|
||||
UF:UpdateAuraWatch(frame, true) --2nd argument is the petOverride
|
||||
|
||||
--CustomTexts
|
||||
UF:Configure_CustomTexts(frame)
|
||||
|
||||
frame:UpdateAllElements("ForceUpdate")
|
||||
end
|
||||
|
||||
--Added an additional argument at the end, specifying the header Template we want to use
|
||||
UF.headerstoload.raidpet = {nil, nil, "SecureGroupPetHeaderTemplate"}
|
||||
@@ -0,0 +1,189 @@
|
||||
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.")
|
||||
|
||||
--Lua functions
|
||||
local max = math.max
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
local InCombatLockdown = InCombatLockdown
|
||||
local RegisterStateDriver = RegisterStateDriver
|
||||
|
||||
function UF:Construct_TankFrames()
|
||||
self:SetScript("OnEnter", UnitFrame_OnEnter)
|
||||
self:SetScript("OnLeave", 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.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.DebuffHighlight = UF:Construct_DebuffHighlight(self)
|
||||
|
||||
self.unitframeType = "tank"
|
||||
else
|
||||
self.unitframeType = "tanktarget"
|
||||
end
|
||||
|
||||
UF:Update_StatusBars()
|
||||
UF:Update_FontStrings()
|
||||
|
||||
self.originalParent = self:GetParent()
|
||||
|
||||
self.db = UF.db.units.tank
|
||||
self.PostCreate = UF.Update_TankFrames
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function UF:Update_TankHeader(header, db)
|
||||
header:Hide()
|
||||
header.db = db
|
||||
|
||||
RegisterStateDriver(header, "visibility", "show")
|
||||
RegisterStateDriver(header, "visibility", "[@raid1,exists] show;hide")
|
||||
|
||||
local width, height = header:GetSize()
|
||||
header.dirtyWidth, header.dirtyHeight = width, max(height, db.height)
|
||||
|
||||
if not header.positioned then
|
||||
header:ClearAllPoints()
|
||||
header:Point("TOPLEFT", E.UIParent, "TOPLEFT", 4, -186)
|
||||
E:CreateMover(header, header:GetName().."Mover", L["MT Frames"], nil, nil, nil, "ALL,RAID", nil, "unitframe,tank,generalGroup")
|
||||
header.mover.positionOverride = "TOPLEFT"
|
||||
header:SetAttribute("minHeight", header.dirtyHeight)
|
||||
header:SetAttribute("minWidth", header.dirtyWidth)
|
||||
header.positioned = true
|
||||
end
|
||||
end
|
||||
|
||||
function UF:Update_TankFrames(frame, db)
|
||||
if not db then
|
||||
db = frame.db
|
||||
else
|
||||
frame.db = db
|
||||
end
|
||||
|
||||
frame.colors = ElvUF.colors
|
||||
frame:RegisterForClicks(self.db.targetOnMouseDown and "AnyDown" or "AnyUp")
|
||||
|
||||
do
|
||||
frame.ORIENTATION = db.orientation --allow this value to change when unitframes position changes on screen?
|
||||
if self.thinBorders then
|
||||
frame.SPACING = 0
|
||||
frame.BORDER = E.mult
|
||||
else
|
||||
frame.BORDER = E.Border
|
||||
frame.SPACING = E.Spacing
|
||||
end
|
||||
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
|
||||
|
||||
frame.VARIABLES_SET = true
|
||||
end
|
||||
|
||||
if frame.isChild and frame.originalParent then
|
||||
local childDB = db.targetsGroup
|
||||
frame.db = db.targetsGroup
|
||||
if not frame.originalParent.childList then
|
||||
frame.originalParent.childList = {}
|
||||
end
|
||||
frame.originalParent.childList[frame] = true
|
||||
|
||||
if not InCombatLockdown() then
|
||||
if childDB.enable then
|
||||
frame:SetParent(frame.originalParent)
|
||||
RegisterUnitWatch(frame)
|
||||
frame:Size(childDB.width, childDB.height)
|
||||
frame:ClearAllPoints()
|
||||
frame:Point(E.InversePoints[childDB.anchorPoint], frame.originalParent, childDB.anchorPoint, childDB.xOffset, childDB.yOffset)
|
||||
else
|
||||
UnregisterUnitWatch(frame)
|
||||
frame:SetParent(E.HiddenFrame)
|
||||
end
|
||||
else
|
||||
if childDB.enable then
|
||||
frame:SetAttribute("initial-anchor", format("%s,%s,%d,%d", E.InversePoints[childDB.anchorPoint], childDB.anchorPoint, childDB.xOffset, childDB.yOffset))
|
||||
frame:SetAttribute("initial-width", frame.UNIT_WIDTH)
|
||||
frame:SetAttribute("initial-height", frame.UNIT_HEIGHT)
|
||||
end
|
||||
end
|
||||
else
|
||||
if not InCombatLockdown() then
|
||||
frame:Size(frame.UNIT_WIDTH, frame.UNIT_HEIGHT)
|
||||
else
|
||||
frame:SetAttribute("initial-width", frame.UNIT_WIDTH)
|
||||
frame:SetAttribute("initial-height", frame.UNIT_HEIGHT)
|
||||
end
|
||||
end
|
||||
|
||||
--Health
|
||||
UF:Configure_HealthBar(frame)
|
||||
|
||||
--Name
|
||||
UF:UpdateNameSettings(frame)
|
||||
|
||||
--Threat
|
||||
UF:Configure_Threat(frame)
|
||||
|
||||
--Fader
|
||||
UF:Configure_Fader(frame)
|
||||
|
||||
--Cutaway
|
||||
UF:Configure_Cutaway(frame)
|
||||
|
||||
UF:Configure_RaidIcon(frame)
|
||||
|
||||
if not frame.isChild then
|
||||
--Auras
|
||||
UF:EnableDisable_Auras(frame)
|
||||
UF:Configure_Auras(frame, "Buffs")
|
||||
UF:Configure_Auras(frame, "Debuffs")
|
||||
|
||||
--RaidDebuffs
|
||||
UF:Configure_RaidDebuffs(frame)
|
||||
|
||||
--Debuff Highlight
|
||||
UF:Configure_DebuffHighlight(frame)
|
||||
|
||||
--Buff Indicator
|
||||
UF:UpdateAuraWatch(frame)
|
||||
end
|
||||
|
||||
frame:UpdateAllElements("ForceUpdate")
|
||||
end
|
||||
|
||||
UF.headerstoload.tank = {"MAINTANK", "ELVUI_UNITTARGET"}
|
||||
@@ -0,0 +1,33 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/">
|
||||
<Button name="ELVUI_UNITTARGET" inherits="SecureUnitButtonTemplate" virtual="true">
|
||||
<Frames>
|
||||
<Button name="$parentTarget" inherits="SecureUnitButtonTemplate">
|
||||
<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" virtual="true">
|
||||
<Frames>
|
||||
<Button name="$parentPet" inherits="SecureUnitButtonTemplate">
|
||||
<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
@@ -0,0 +1,137 @@
|
||||
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.")
|
||||
|
||||
--Lua functions
|
||||
local _G = _G
|
||||
local tinsert = tinsert
|
||||
--WoW API / Variables
|
||||
|
||||
function UF:Construct_FocusFrame(frame)
|
||||
frame.Health = self:Construct_HealthBar(frame, true, true, "RIGHT")
|
||||
frame.Health.frequentUpdates = true
|
||||
|
||||
frame.Power = self:Construct_PowerBar(frame, true, true, "LEFT")
|
||||
|
||||
frame.Name = self:Construct_NameText(frame)
|
||||
|
||||
frame.Portrait3D = self:Construct_Portrait(frame, "model")
|
||||
frame.Portrait2D = self:Construct_Portrait(frame, "texture")
|
||||
|
||||
frame.Buffs = self:Construct_Buffs(frame)
|
||||
frame.Castbar = self:Construct_Castbar(frame, L["Focus Castbar"])
|
||||
frame.Castbar.SafeZone = nil
|
||||
frame.Castbar.LatencyTexture:Hide()
|
||||
frame.RaidTargetIndicator = self:Construct_RaidIcon(frame)
|
||||
frame.Debuffs = self:Construct_Debuffs(frame)
|
||||
frame.HealCommBar = self:Construct_HealComm(frame)
|
||||
frame.AuraBars = self:Construct_AuraBarHeader(frame)
|
||||
frame.ThreatIndicator = self:Construct_Threat(frame)
|
||||
frame.GPS = self:Construct_GPS(frame)
|
||||
frame.MouseGlow = self:Construct_MouseGlow(frame)
|
||||
frame.TargetGlow = self:Construct_TargetGlow(frame)
|
||||
frame.InfoPanel = self:Construct_InfoPanel(frame)
|
||||
frame.DebuffHighlight = self:Construct_DebuffHighlight(frame)
|
||||
frame.Fader = self:Construct_Fader()
|
||||
frame.Cutaway = self:Construct_Cutaway(frame)
|
||||
|
||||
frame.customTexts = {}
|
||||
frame:Point("BOTTOMRIGHT", ElvUF_Target, "TOPRIGHT", 0, 220)
|
||||
E:CreateMover(frame, frame:GetName().."Mover", L["Focus Frame"], nil, nil, nil, "ALL,SOLO", nil, "unitframe,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.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 - (frame.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((frame.BORDER+frame.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)
|
||||
|
||||
frame.VARIABLES_SET = true
|
||||
end
|
||||
|
||||
frame.Portrait = frame.Portrait or (db.portrait.style == "2D" and frame.Portrait2D or frame.Portrait3D)
|
||||
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())
|
||||
|
||||
frame:SetAttribute("type3", "macro")
|
||||
frame:SetAttribute("macrotext", "/clearfocus")
|
||||
|
||||
UF:Configure_InfoPanel(frame)
|
||||
--Health
|
||||
UF:Configure_HealthBar(frame)
|
||||
|
||||
--Name
|
||||
UF:UpdateNameSettings(frame)
|
||||
|
||||
--Power
|
||||
UF:Configure_Power(frame)
|
||||
|
||||
--Portrait
|
||||
UF:Configure_Portrait(frame)
|
||||
|
||||
--Threat
|
||||
UF:Configure_Threat(frame)
|
||||
|
||||
--Auras
|
||||
UF:EnableDisable_Auras(frame)
|
||||
UF:Configure_Auras(frame, "Buffs")
|
||||
UF:Configure_Auras(frame, "Debuffs")
|
||||
|
||||
--Castbar
|
||||
UF:Configure_Castbar(frame)
|
||||
|
||||
--Fader
|
||||
UF:Configure_Fader(frame)
|
||||
|
||||
--Cutaway
|
||||
UF:Configure_Cutaway(frame)
|
||||
|
||||
--OverHealing
|
||||
UF:Configure_HealComm(frame)
|
||||
|
||||
--GPS
|
||||
UF:Configure_GPS(frame)
|
||||
|
||||
--Raid Icon
|
||||
UF:Configure_RaidIcon(frame)
|
||||
|
||||
--AuraBars
|
||||
UF:Configure_AuraBars(frame)
|
||||
|
||||
--CustomTexts
|
||||
UF:Configure_CustomTexts(frame)
|
||||
|
||||
--Debuff Highlight
|
||||
UF:Configure_DebuffHighlight(frame)
|
||||
|
||||
frame:UpdateAllElements("ForceUpdate")
|
||||
end
|
||||
|
||||
tinsert(UF.unitstoload, "focus")
|
||||
@@ -0,0 +1,109 @@
|
||||
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.")
|
||||
|
||||
--Lua functions
|
||||
local _G = _G
|
||||
local tinsert = table.insert
|
||||
--WoW API / Variables
|
||||
|
||||
function UF:Construct_FocusTargetFrame(frame)
|
||||
frame.Health = self:Construct_HealthBar(frame, true, true, "RIGHT")
|
||||
|
||||
frame.Power = self:Construct_PowerBar(frame, true, true, "LEFT")
|
||||
frame.Name = self:Construct_NameText(frame)
|
||||
|
||||
frame.Portrait3D = self:Construct_Portrait(frame, "model")
|
||||
frame.Portrait2D = self:Construct_Portrait(frame, "texture")
|
||||
|
||||
frame.Buffs = self:Construct_Buffs(frame)
|
||||
frame.RaidTargetIndicator = self:Construct_RaidIcon(frame)
|
||||
frame.Debuffs = self:Construct_Debuffs(frame)
|
||||
frame.ThreatIndicator = self:Construct_Threat(frame)
|
||||
frame.MouseGlow = self:Construct_MouseGlow(frame)
|
||||
frame.TargetGlow = self:Construct_TargetGlow(frame)
|
||||
frame.InfoPanel = self:Construct_InfoPanel(frame)
|
||||
frame.Fader = self:Construct_Fader()
|
||||
frame.Cutaway = self:Construct_Cutaway(frame)
|
||||
|
||||
frame.customTexts = {}
|
||||
frame:Point("BOTTOM", ElvUF_Focus, "TOP", 0, 7) --Set to default position
|
||||
E:CreateMover(frame, frame:GetName().."Mover", L["FocusTarget Frame"], nil, -7, nil, "ALL,SOLO", nil, "unitframe,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.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 - (frame.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((frame.BORDER+frame.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)
|
||||
|
||||
frame.VARIABLES_SET = true
|
||||
end
|
||||
|
||||
frame.Portrait = frame.Portrait or (db.portrait.style == "2D" and frame.Portrait2D or frame.Portrait3D)
|
||||
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)
|
||||
|
||||
--Portrait
|
||||
UF:Configure_Portrait(frame)
|
||||
|
||||
--Threat
|
||||
UF:Configure_Threat(frame)
|
||||
|
||||
--Auras
|
||||
UF:EnableDisable_Auras(frame)
|
||||
UF:Configure_Auras(frame, "Buffs")
|
||||
UF:Configure_Auras(frame, "Debuffs")
|
||||
|
||||
--Fader
|
||||
UF:Configure_Fader(frame)
|
||||
|
||||
--Cutaway
|
||||
UF:Configure_Cutaway(frame)
|
||||
|
||||
--Raid Icon
|
||||
UF:Configure_RaidIcon(frame)
|
||||
|
||||
--CustomTexts
|
||||
UF:Configure_CustomTexts(frame)
|
||||
|
||||
frame:UpdateAllElements("ForceUpdate")
|
||||
end
|
||||
|
||||
tinsert(UF.unitstoload, "focustarget")
|
||||
@@ -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>
|
||||
@@ -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 _, ns = ...
|
||||
local ElvUF = ns.oUF
|
||||
assert(ElvUF, "ElvUI was unable to locate oUF.")
|
||||
|
||||
--Lua functions
|
||||
local _G = _G
|
||||
local tinsert = tinsert
|
||||
--WoW API / Variables
|
||||
|
||||
function UF:Construct_PetFrame(frame)
|
||||
frame.Health = self:Construct_HealthBar(frame, true, true, "RIGHT")
|
||||
frame.Health.frequentUpdates = true
|
||||
frame.Power = self:Construct_PowerBar(frame, true, true, "LEFT")
|
||||
frame.Name = self:Construct_NameText(frame)
|
||||
frame.Portrait3D = self:Construct_Portrait(frame, "model")
|
||||
frame.Portrait2D = self:Construct_Portrait(frame, "texture")
|
||||
frame.Buffs = self:Construct_Buffs(frame)
|
||||
frame.Debuffs = self:Construct_Debuffs(frame)
|
||||
frame.Castbar = self:Construct_Castbar(frame, L["Pet Castbar"])
|
||||
frame.Castbar.SafeZone = nil
|
||||
frame.Castbar.LatencyTexture:Hide()
|
||||
frame.ThreatIndicator = self:Construct_Threat(frame)
|
||||
frame.HealCommBar = self:Construct_HealComm(frame)
|
||||
frame.AuraWatch = self:Construct_AuraWatch(frame)
|
||||
frame.AuraBars = self:Construct_AuraBarHeader(frame)
|
||||
frame.HappinessIndicator = self:Construct_Happiness(frame)
|
||||
frame.InfoPanel = self:Construct_InfoPanel(frame)
|
||||
frame.MouseGlow = self:Construct_MouseGlow(frame)
|
||||
frame.TargetGlow = self:Construct_TargetGlow(frame)
|
||||
frame.Fader = self:Construct_Fader()
|
||||
frame.Cutaway = self:Construct_Cutaway(frame)
|
||||
frame.customTexts = {}
|
||||
|
||||
frame:Point("BOTTOM", E.UIParent, "BOTTOM", 0, 118)
|
||||
E:CreateMover(frame, frame:GetName().."Mover", L["Pet Frame"], nil, nil, nil, "ALL,SOLO", nil, "unitframe,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.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 - (frame.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((frame.BORDER+frame.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.HAPPINESS_SHOWN = (db.happiness and db.happiness.enable) and frame.HappinessIndicator and frame.HappinessIndicator:IsShown()
|
||||
frame.HAPPINESS_WIDTH = frame.HAPPINESS_SHOWN and (db.happiness.width + (frame.BORDER*2)) or 0
|
||||
|
||||
frame.BOTTOM_OFFSET = UF:GetHealthBottomOffset(frame)
|
||||
|
||||
frame.VARIABLES_SET = true
|
||||
end
|
||||
|
||||
frame.colors = ElvUF.colors
|
||||
frame.Portrait = frame.Portrait or (db.portrait.style == "2D" and frame.Portrait2D or frame.Portrait3D)
|
||||
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)
|
||||
|
||||
--Health
|
||||
UF:Configure_HealthBar(frame)
|
||||
|
||||
--Name
|
||||
UF:UpdateNameSettings(frame)
|
||||
|
||||
--Power
|
||||
UF:Configure_Power(frame)
|
||||
|
||||
--Portrait
|
||||
UF:Configure_Portrait(frame)
|
||||
|
||||
--Threat
|
||||
UF:Configure_Threat(frame)
|
||||
|
||||
--Auras
|
||||
UF:EnableDisable_Auras(frame)
|
||||
UF:Configure_Auras(frame, "Buffs")
|
||||
UF:Configure_Auras(frame, "Debuffs")
|
||||
|
||||
--Fader
|
||||
UF:Configure_Fader(frame)
|
||||
|
||||
--Cutaway
|
||||
UF:Configure_Cutaway(frame)
|
||||
|
||||
--Castbar
|
||||
UF:Configure_Castbar(frame)
|
||||
|
||||
--OverHealing
|
||||
UF:Configure_HealComm(frame)
|
||||
|
||||
--AuraBars
|
||||
UF:Configure_AuraBars(frame)
|
||||
|
||||
UF:Configure_Happiness(frame)
|
||||
|
||||
--CustomTexts
|
||||
UF:Configure_CustomTexts(frame)
|
||||
|
||||
UF:UpdateAuraWatch(frame)
|
||||
frame:UpdateAllElements("ForceUpdate")
|
||||
end
|
||||
|
||||
tinsert(UF.unitstoload, "pet")
|
||||
@@ -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.")
|
||||
|
||||
--Lua functions
|
||||
local _G = _G
|
||||
local tinsert = tinsert
|
||||
--WoW API / Variables
|
||||
|
||||
function UF:Construct_PetTargetFrame(frame)
|
||||
frame.Health = self:Construct_HealthBar(frame, true, true, "RIGHT")
|
||||
frame.Power = self:Construct_PowerBar(frame, true, true, "LEFT")
|
||||
frame.Name = self:Construct_NameText(frame)
|
||||
frame.Portrait3D = self:Construct_Portrait(frame, "model")
|
||||
frame.Portrait2D = self:Construct_Portrait(frame, "texture")
|
||||
frame.InfoPanel = self:Construct_InfoPanel(frame)
|
||||
frame.Buffs = self:Construct_Buffs(frame)
|
||||
frame.ThreatIndicator = self:Construct_Threat(frame)
|
||||
frame.Debuffs = self:Construct_Debuffs(frame)
|
||||
frame.MouseGlow = self:Construct_MouseGlow(frame)
|
||||
frame.TargetGlow = self:Construct_TargetGlow(frame)
|
||||
frame.Fader = self:Construct_Fader()
|
||||
frame.Cutaway = self: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,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.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 - (frame.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((frame.BORDER+frame.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)
|
||||
|
||||
frame.VARIABLES_SET = true
|
||||
end
|
||||
|
||||
frame.colors = ElvUF.colors
|
||||
frame.Portrait = frame.Portrait or (db.portrait.style == "2D" and frame.Portrait2D or frame.Portrait3D)
|
||||
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)
|
||||
|
||||
--Health
|
||||
UF:Configure_HealthBar(frame)
|
||||
|
||||
--Name
|
||||
UF:UpdateNameSettings(frame)
|
||||
|
||||
--Power
|
||||
UF:Configure_Power(frame)
|
||||
|
||||
--Portrait
|
||||
UF:Configure_Portrait(frame)
|
||||
|
||||
--Threat
|
||||
UF:Configure_Threat(frame)
|
||||
|
||||
--Auras
|
||||
UF:EnableDisable_Auras(frame)
|
||||
UF:Configure_Auras(frame, "Buffs")
|
||||
UF:Configure_Auras(frame, "Debuffs")
|
||||
|
||||
--Fader
|
||||
UF:Configure_Fader(frame)
|
||||
|
||||
--Cutaway
|
||||
UF:Configure_Cutaway(frame)
|
||||
|
||||
--CustomTexts
|
||||
UF:Configure_CustomTexts(frame)
|
||||
|
||||
frame:UpdateAllElements("ForceUpdate")
|
||||
end
|
||||
|
||||
tinsert(UF.unitstoload, "pettarget")
|
||||
@@ -0,0 +1,237 @@
|
||||
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.")
|
||||
|
||||
--Lua functions
|
||||
local _G = _G
|
||||
local tinsert = tinsert
|
||||
--WoW API / Variables
|
||||
local CreateFrame = CreateFrame
|
||||
local CastingBarFrame_OnLoad = CastingBarFrame_OnLoad
|
||||
local CastingBarFrame_SetUnit = CastingBarFrame_SetUnit
|
||||
|
||||
function UF:Construct_PlayerFrame(frame)
|
||||
frame.ThreatIndicator = self:Construct_Threat(frame)
|
||||
frame.Health = self:Construct_HealthBar(frame, true, true, "RIGHT")
|
||||
frame.Health.frequentUpdates = true
|
||||
frame.Power = self:Construct_PowerBar(frame, true, true, "LEFT")
|
||||
frame.Power.frequentUpdates = true
|
||||
frame.Energy = self:Construct_EnergyBar(frame, true, true, "LEFT")
|
||||
frame.Rage = self:Construct_RageBar(frame, true, true, "LEFT")
|
||||
frame.Name = self:Construct_NameText(frame)
|
||||
frame.Portrait3D = self:Construct_Portrait(frame, "model")
|
||||
frame.Portrait2D = self:Construct_Portrait(frame, "texture")
|
||||
frame.Buffs = self:Construct_Buffs(frame)
|
||||
frame.Debuffs = self:Construct_Debuffs(frame)
|
||||
frame.Castbar = self: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)
|
||||
|
||||
frame.AdditionalPower = self:Construct_AdditionalPowerBar(frame, nil, UF.UpdateClassBar)
|
||||
frame.ClassBar = "AdditionalPower"
|
||||
|
||||
--frame.Runes = self:Construct_DeathKnightResourceBar(frame)
|
||||
--frame.ClassBar = "Runes"
|
||||
|
||||
frame.MouseGlow = self:Construct_MouseGlow(frame)
|
||||
frame.TargetGlow = self:Construct_TargetGlow(frame)
|
||||
frame.RaidTargetIndicator = self:Construct_RaidIcon(frame)
|
||||
frame.RaidRoleFramesAnchor = self:Construct_RaidRoleFrames(frame)
|
||||
frame.RestingIndicator = self:Construct_RestingIndicator(frame)
|
||||
frame.CombatIndicator = self:Construct_CombatIndicator(frame)
|
||||
frame.PvPText = self:Construct_PvPIndicator(frame)
|
||||
frame.DebuffHighlight = self:Construct_DebuffHighlight(frame)
|
||||
frame.HealCommBar = self:Construct_HealComm(frame)
|
||||
frame.AuraBars = self:Construct_AuraBarHeader(frame)
|
||||
frame.InfoPanel = self:Construct_InfoPanel(frame)
|
||||
frame.PvPIndicator = self:Construct_PvPIcon(frame)
|
||||
frame.Fader = self:Construct_Fader()
|
||||
frame.Cutaway = self:Construct_Cutaway(frame)
|
||||
frame.customTexts = {}
|
||||
|
||||
frame:Point("BOTTOMLEFT", E.UIParent, "BOTTOM", -413, 68) --Set to default position
|
||||
E:CreateMover(frame, frame:GetName().."Mover", L["Player Frame"], nil, nil, nil, "ALL,SOLO", nil, "unitframe,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
|
||||
|
||||
-- Power
|
||||
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.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 - (frame.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((frame.BORDER+frame.SPACING)*2)))
|
||||
|
||||
-- Energy
|
||||
frame.USE_ENERGYBAR = db.energy.enable
|
||||
frame.ENERGYBAR_DETACHED = db.energy.detachFromFrame
|
||||
frame.USE_INSET_ENERGYBAR = not frame.ENERGYBAR_DETACHED and db.energy.width == "inset" and frame.USE_ENERGYBAR
|
||||
frame.USE_MINI_ENERGYBAR = (not frame.ENERGYBAR_DETACHED and db.energy.width == "spaced" and frame.USE_ENERGYBAR)
|
||||
frame.USE_ENERGYBAR_OFFSET = db.energy.offset ~= 0 and frame.USE_ENERGYBAR and not frame.ENERGYBAR_DETACHED
|
||||
frame.ENERGYBAR_OFFSET = frame.USE_ENERGYBAR_OFFSET and db.energy.offset or 0
|
||||
|
||||
frame.ENERGYBAR_HEIGHT = not frame.USE_ENERGYBAR and 0 or db.energy.height
|
||||
frame.ENERGYBAR_WIDTH = frame.USE_MINI_ENERGYBAR and (frame.UNIT_WIDTH - (frame.BORDER*2))/2 or (frame.ENERGYBAR_DETACHED and db.energy.detachedWidth or (frame.UNIT_WIDTH - ((frame.BORDER+frame.SPACING)*2)))
|
||||
|
||||
-- Rage
|
||||
frame.USE_RAGEBAR = db.rage.enable
|
||||
frame.RAGEBAR_DETACHED = db.rage.detachFromFrame
|
||||
frame.USE_INSET_RAGEBAR = not frame.RAGEBAR_DETACHED and db.rage.width == "inset" and frame.USE_RAGEBAR
|
||||
frame.USE_MINI_RAGEBAR = (not frame.RAGEBAR_DETACHED and db.rage.width == "spaced" and frame.USE_RAGEBAR)
|
||||
frame.USE_RAGEBAR_OFFSET = db.rage.offset ~= 0 and frame.USE_RAGEBAR and not frame.RAGEBAR_DETACHED
|
||||
frame.RAGEBAR_OFFSET = frame.USE_RAGEBAR_OFFSET and db.rage.offset or 0
|
||||
|
||||
frame.RAGEBAR_HEIGHT = not frame.USE_RAGEBAR and 0 or db.rage.height
|
||||
frame.RAGEBAR_WIDTH = frame.USE_MINI_RAGEBAR and (frame.UNIT_WIDTH - (frame.BORDER*2))/2 or (frame.RAGEBAR_DETACHED and db.rage.detachedWidth or (frame.UNIT_WIDTH - ((frame.BORDER+frame.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.MAX_CLASS_BAR = frame.MAX_CLASS_BAR or UF.classMaxResourceBar[E.myclass] or 0
|
||||
frame.USE_CLASSBAR = db.classbar.enable
|
||||
frame.CLASSBAR_SHOWN = 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.BORDER+frame.SPACING)*2) - 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 (frame.SPACING+(frame.CLASSBAR_HEIGHT/2)) or (frame.CLASSBAR_HEIGHT - (frame.BORDER-frame.SPACING)))
|
||||
|
||||
frame.USE_INFO_PANEL = not frame.USE_MINI_POWERBAR and not frame.USE_POWERBAR_OFFSET and not frame.USE_MINI_RAGEBAR and not frame.USE_RAGEBAR_OFFSET and not frame.USE_MINI_ENERGYBAR and not frame.USE_ENERGYBAR_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.VARIABLES_SET = true
|
||||
end
|
||||
|
||||
frame.colors = ElvUF.colors
|
||||
frame.Portrait = frame.Portrait or (db.portrait.style == "2D" and frame.Portrait2D or frame.Portrait3D)
|
||||
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)
|
||||
|
||||
--Threat
|
||||
UF:Configure_Threat(frame)
|
||||
|
||||
--Rest Icon
|
||||
UF:Configure_RestingIndicator(frame)
|
||||
|
||||
--Combat Icon
|
||||
UF:Configure_CombatIndicator(frame)
|
||||
|
||||
--Resource Bars
|
||||
UF:Configure_ClassBar(frame)
|
||||
|
||||
--Health
|
||||
UF:Configure_HealthBar(frame)
|
||||
|
||||
--Name
|
||||
UF:UpdateNameSettings(frame)
|
||||
|
||||
--PvP
|
||||
UF:Configure_PVPIndicator(frame)
|
||||
|
||||
--Power
|
||||
UF:Configure_Power(frame)
|
||||
|
||||
--Energy
|
||||
UF:Configure_Energy(frame)
|
||||
|
||||
--Rage
|
||||
UF:Configure_Rage(frame)
|
||||
|
||||
--Portrait
|
||||
UF:Configure_Portrait(frame)
|
||||
|
||||
--Auras
|
||||
UF:EnableDisable_Auras(frame)
|
||||
UF:Configure_Auras(frame, "Buffs")
|
||||
UF:Configure_Auras(frame, "Debuffs")
|
||||
|
||||
--Castbar
|
||||
frame:DisableElement("Castbar")
|
||||
UF:Configure_Castbar(frame)
|
||||
|
||||
if (not db.enable and not E.private.unitframe.disabledBlizzardFrames.player) then
|
||||
CastingBarFrame_OnLoad(CastingBarFrame, "player", true, false)
|
||||
CastingBarFrame_SetUnit(CastingBarFrame, "player", true, false)
|
||||
PetCastingBarFrame_OnLoad(PetCastingBarFrame)
|
||||
CastingBarFrame_SetUnit(PetCastingBarFrame, "pet", false, false)
|
||||
elseif not db.enable and E.private.unitframe.disabledBlizzardFrames.player or (db.enable and not db.castbar.enable) then
|
||||
CastingBarFrame_SetUnit(CastingBarFrame, nil)
|
||||
CastingBarFrame_SetUnit(PetCastingBarFrame, nil)
|
||||
end
|
||||
|
||||
--Fader
|
||||
UF:Configure_Fader(frame)
|
||||
|
||||
--Cutaway
|
||||
UF:Configure_Cutaway(frame)
|
||||
|
||||
--Debuff Highlight
|
||||
UF:Configure_DebuffHighlight(frame)
|
||||
|
||||
--Raid Icon
|
||||
UF:Configure_RaidIcon(frame)
|
||||
|
||||
--OverHealing
|
||||
UF:Configure_HealComm(frame)
|
||||
|
||||
--AuraBars
|
||||
UF:Configure_AuraBars(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 ElvUF_Target then
|
||||
UF:Configure_AuraBars(ElvUF_Target)
|
||||
end
|
||||
|
||||
--PvP
|
||||
UF:Configure_PVPIcon(frame)
|
||||
|
||||
UF:Configure_RaidRoleIcons(frame)
|
||||
|
||||
--CustomTexts
|
||||
UF:Configure_CustomTexts(frame)
|
||||
|
||||
E:SetMoverSnapOffset(frame:GetName().."Mover", -(12 + db.castbar.height))
|
||||
frame:UpdateAllElements("ForceUpdate")
|
||||
end
|
||||
|
||||
tinsert(UF.unitstoload, "player")
|
||||
|
||||
local function UpdateClassBar()
|
||||
local frame = _G.ElvUF_Player
|
||||
if frame and frame.ClassBar then
|
||||
frame:UpdateElement(frame.ClassBar)
|
||||
UF.ToggleResourceBar(frame[frame.ClassBar])
|
||||
end
|
||||
end
|
||||
|
||||
local f = CreateFrame("Frame")
|
||||
f:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
f:SetScript("OnEvent", function(self, event)
|
||||
self:UnregisterEvent(event)
|
||||
if not E.db.unitframe.units.player.enable then return end
|
||||
UpdateClassBar()
|
||||
end)
|
||||
@@ -0,0 +1,163 @@
|
||||
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.")
|
||||
|
||||
--Lua functions
|
||||
local _G = _G
|
||||
local tinsert = tinsert
|
||||
--WoW API / Variables
|
||||
local IsAddOnLoaded = IsAddOnLoaded
|
||||
|
||||
function UF:Construct_TargetFrame(frame)
|
||||
frame.Health = self:Construct_HealthBar(frame, true, true, "RIGHT")
|
||||
frame.Health.frequentUpdates = true
|
||||
frame.Power = self:Construct_PowerBar(frame, true, true, "LEFT")
|
||||
frame.Power.frequentUpdates = true
|
||||
frame.Name = self:Construct_NameText(frame)
|
||||
frame.Portrait3D = self:Construct_Portrait(frame, "model")
|
||||
frame.Portrait2D = self:Construct_Portrait(frame, "texture")
|
||||
frame.Buffs = self:Construct_Buffs(frame)
|
||||
frame.Debuffs = self:Construct_Debuffs(frame)
|
||||
frame.ThreatIndicator = self:Construct_Threat(frame)
|
||||
frame.Castbar = self:Construct_Castbar(frame, L["Target Castbar"])
|
||||
frame.Castbar.SafeZone = nil
|
||||
frame.Castbar.LatencyTexture:Hide()
|
||||
frame.RaidTargetIndicator = self:Construct_RaidIcon(frame)
|
||||
|
||||
frame.ComboPointsHolder = CreateFrame("Frame", nil, frame)
|
||||
frame.ComboPointsHolder:Point("BOTTOM", E.UIParent, "BOTTOM", 0, 200)
|
||||
frame.ComboPoints = self:Construct_Combobar(frame)
|
||||
|
||||
frame.HealCommBar = self:Construct_HealComm(frame)
|
||||
frame.DebuffHighlight = self:Construct_DebuffHighlight(frame)
|
||||
frame.InfoPanel = self:Construct_InfoPanel(frame)
|
||||
frame.MouseGlow = self:Construct_MouseGlow(frame)
|
||||
frame.TargetGlow = self:Construct_TargetGlow(frame)
|
||||
frame.AuraBars = self:Construct_AuraBarHeader(frame)
|
||||
frame.GPS = self:Construct_GPS(frame)
|
||||
frame.PvPIndicator = self:Construct_PvPIcon(frame)
|
||||
frame.Fader = self:Construct_Fader()
|
||||
frame.Cutaway = self:Construct_Cutaway(frame)
|
||||
frame.customTexts = {}
|
||||
frame:Point("BOTTOMRIGHT", E.UIParent, "BOTTOM", 413, 68)
|
||||
E:CreateMover(frame, frame:GetName().."Mover", L["Target Frame"], nil, nil, nil, "ALL,SOLO", nil, "unitframe,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.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 - (frame.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((frame.BORDER+frame.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 = db.combobar.enable
|
||||
frame.MAX_CLASS_BAR = MAX_COMBO_POINTS
|
||||
frame.USE_CLASSBAR = db.combobar.enable
|
||||
frame.CLASSBAR_SHOWN = frame.CAN_HAVE_CLASSBAR and frame.ComboPoints:IsShown()
|
||||
frame.CLASSBAR_DETACHED = db.combobar.detachFromFrame
|
||||
frame.USE_MINI_CLASSBAR = db.combobar.fill == "spaced" and frame.USE_CLASSBAR
|
||||
frame.CLASSBAR_HEIGHT = frame.USE_CLASSBAR and db.combobar.height or 0
|
||||
frame.CLASSBAR_WIDTH = frame.UNIT_WIDTH - ((frame.BORDER+frame.SPACING)*2) - frame.PORTRAIT_WIDTH - 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 (frame.SPACING+(frame.CLASSBAR_HEIGHT/2)) or (frame.CLASSBAR_HEIGHT + frame.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)
|
||||
|
||||
frame.VARIABLES_SET = true
|
||||
end
|
||||
|
||||
frame.colors = ElvUF.colors
|
||||
frame.Portrait = frame.Portrait or (db.portrait.style == "2D" and frame.Portrait2D or frame.Portrait3D)
|
||||
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)
|
||||
|
||||
--Health
|
||||
UF:Configure_HealthBar(frame)
|
||||
|
||||
--Name
|
||||
UF:UpdateNameSettings(frame)
|
||||
|
||||
--Power
|
||||
UF:Configure_Power(frame)
|
||||
|
||||
--Portrait
|
||||
UF:Configure_Portrait(frame)
|
||||
|
||||
--Threat
|
||||
UF:Configure_Threat(frame)
|
||||
|
||||
--Auras
|
||||
UF:EnableDisable_Auras(frame)
|
||||
UF:Configure_Auras(frame, "Buffs")
|
||||
UF:Configure_Auras(frame, "Debuffs")
|
||||
|
||||
--Castbar
|
||||
UF:Configure_Castbar(frame)
|
||||
|
||||
--ComboBar
|
||||
UF:Configure_ComboPoints(frame)
|
||||
|
||||
--Fader
|
||||
UF:Configure_Fader(frame)
|
||||
|
||||
--Cutaway
|
||||
UF:Configure_Cutaway(frame)
|
||||
|
||||
--Debuff Highlight
|
||||
UF:Configure_DebuffHighlight(frame)
|
||||
|
||||
--OverHealing
|
||||
UF:Configure_HealComm(frame)
|
||||
|
||||
--Raid Icon
|
||||
UF:Configure_RaidIcon(frame)
|
||||
|
||||
--AuraBars
|
||||
UF:Configure_AuraBars(frame)
|
||||
|
||||
--GPS
|
||||
UF:Configure_GPS(frame)
|
||||
|
||||
--PvP
|
||||
UF:Configure_PVPIcon(frame)
|
||||
|
||||
--CustomTexts
|
||||
UF:Configure_CustomTexts(frame)
|
||||
|
||||
E:SetMoverSnapOffset(frame:GetName().."Mover", -(12 + db.castbar.height))
|
||||
frame:UpdateAllElements("ForceUpdate")
|
||||
end
|
||||
|
||||
tinsert(UF.unitstoload, "target")
|
||||
@@ -0,0 +1,109 @@
|
||||
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.")
|
||||
|
||||
--Lua functions
|
||||
local _G = _G
|
||||
local tinsert = tinsert
|
||||
--WoW API / Variables
|
||||
|
||||
function UF:Construct_TargetTargetFrame(frame)
|
||||
frame.Health = self:Construct_HealthBar(frame, true, true, "RIGHT")
|
||||
frame.Power = self:Construct_PowerBar(frame, true, true, "LEFT")
|
||||
frame.Name = self:Construct_NameText(frame)
|
||||
frame.Portrait3D = self:Construct_Portrait(frame, "model")
|
||||
frame.Portrait2D = self:Construct_Portrait(frame, "texture")
|
||||
frame.Buffs = self:Construct_Buffs(frame)
|
||||
frame.RaidTargetIndicator = self:Construct_RaidIcon(frame)
|
||||
frame.Debuffs = self:Construct_Debuffs(frame)
|
||||
frame.ThreatIndicator = self:Construct_Threat(frame)
|
||||
frame.InfoPanel = self:Construct_InfoPanel(frame)
|
||||
frame.MouseGlow = self:Construct_MouseGlow(frame)
|
||||
frame.TargetGlow = self:Construct_TargetGlow(frame)
|
||||
frame.Fader = self:Construct_Fader()
|
||||
frame.Cutaway = self:Construct_Cutaway(frame)
|
||||
frame.customTexts = {}
|
||||
|
||||
frame:Point("BOTTOM", E.UIParent, "BOTTOM", 0, 75) --Set to default position
|
||||
E:CreateMover(frame, frame:GetName().."Mover", L["TargetTarget Frame"], nil, nil, nil, "ALL,SOLO", nil, "unitframe,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.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 - (frame.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((frame.BORDER+frame.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)
|
||||
|
||||
frame.VARIABLES_SET = true
|
||||
end
|
||||
|
||||
frame.colors = ElvUF.colors
|
||||
frame.Portrait = frame.Portrait or (db.portrait.style == "2D" and frame.Portrait2D or frame.Portrait3D)
|
||||
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)
|
||||
|
||||
--Health
|
||||
UF:Configure_HealthBar(frame)
|
||||
|
||||
--Name
|
||||
UF:UpdateNameSettings(frame)
|
||||
|
||||
--Power
|
||||
UF:Configure_Power(frame)
|
||||
|
||||
--Portrait
|
||||
UF:Configure_Portrait(frame)
|
||||
|
||||
--Threat
|
||||
UF:Configure_Threat(frame)
|
||||
|
||||
--Auras
|
||||
UF:EnableDisable_Auras(frame)
|
||||
UF:Configure_Auras(frame, "Buffs")
|
||||
UF:Configure_Auras(frame, "Debuffs")
|
||||
|
||||
--Fader
|
||||
UF:Configure_Fader(frame)
|
||||
|
||||
--Cutaway
|
||||
UF:Configure_Cutaway(frame)
|
||||
|
||||
--Raid Icon
|
||||
UF:Configure_RaidIcon(frame)
|
||||
|
||||
--CustomTexts
|
||||
UF:Configure_CustomTexts(frame)
|
||||
|
||||
E:SetMoverSnapOffset(frame:GetName().."Mover", -(12 + self.db.units.player.castbar.height))
|
||||
frame:UpdateAllElements("ForceUpdate")
|
||||
end
|
||||
|
||||
tinsert(UF.unitstoload, "targettarget")
|
||||
@@ -0,0 +1,106 @@
|
||||
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.")
|
||||
|
||||
--Lua functions
|
||||
local _G = _G
|
||||
local tinsert = tinsert
|
||||
--WoW API / Variables
|
||||
|
||||
function UF:Construct_TargetTargetTargetFrame(frame)
|
||||
frame.Health = self:Construct_HealthBar(frame, true, true, "RIGHT")
|
||||
frame.Power = self:Construct_PowerBar(frame, true, true, "LEFT")
|
||||
frame.Name = self:Construct_NameText(frame)
|
||||
frame.Portrait3D = self:Construct_Portrait(frame, "model")
|
||||
frame.Portrait2D = self:Construct_Portrait(frame, "texture")
|
||||
frame.Buffs = self:Construct_Buffs(frame)
|
||||
frame.RaidTargetIndicator = self:Construct_RaidIcon(frame)
|
||||
frame.Debuffs = self:Construct_Debuffs(frame)
|
||||
frame.ThreatIndicator = self:Construct_Threat(frame)
|
||||
frame.InfoPanel = self:Construct_InfoPanel(frame)
|
||||
frame.MouseGlow = self:Construct_MouseGlow(frame)
|
||||
frame.TargetGlow = self:Construct_TargetGlow(frame)
|
||||
frame.Fader = self:Construct_Fader()
|
||||
frame.Cutaway = self: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,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.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 - (frame.BORDER*2))/2 or (frame.POWERBAR_DETACHED and db.power.detachedWidth or (frame.UNIT_WIDTH - ((frame.BORDER+frame.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)
|
||||
|
||||
frame.VARIABLES_SET = true
|
||||
end
|
||||
|
||||
frame.colors = ElvUF.colors
|
||||
frame.Portrait = frame.Portrait or (db.portrait.style == "2D" and frame.Portrait2D or frame.Portrait3D)
|
||||
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)
|
||||
--Health
|
||||
UF:Configure_HealthBar(frame)
|
||||
|
||||
--Name
|
||||
UF:UpdateNameSettings(frame)
|
||||
|
||||
--Power
|
||||
UF:Configure_Power(frame)
|
||||
|
||||
--Portrait
|
||||
UF:Configure_Portrait(frame)
|
||||
|
||||
--Threat
|
||||
UF:Configure_Threat(frame)
|
||||
|
||||
--Auras
|
||||
UF:EnableDisable_Auras(frame)
|
||||
UF:Configure_Auras(frame, "Buffs")
|
||||
UF:Configure_Auras(frame, "Debuffs")
|
||||
|
||||
--Fader
|
||||
UF:Configure_Fader(frame)
|
||||
|
||||
--Cutaway
|
||||
UF:Configure_Cutaway(frame)
|
||||
|
||||
--Raid Icon
|
||||
UF:Configure_RaidIcon(frame)
|
||||
|
||||
UF:Configure_CustomTexts(frame)
|
||||
|
||||
E:SetMoverSnapOffset(frame:GetName().."Mover", -(12 + self.db.units.player.castbar.height))
|
||||
frame:UpdateAllElements("ForceUpdate")
|
||||
end
|
||||
|
||||
tinsert(UF.unitstoload, "targettargettarget")
|
||||
Reference in New Issue
Block a user