remove temp folder structure

This commit is contained in:
Crum
2018-02-19 21:03:21 -06:00
parent 85a2a5bcf7
commit 611f11aff9
408 changed files with 0 additions and 0 deletions
@@ -0,0 +1,297 @@
local E, L, V, P, G = unpack(ElvUI)
local UF = E:GetModule("UnitFrames");
local ns = oUF
local ElvUF = ns.oUF
local _G = _G;
local setmetatable, getfenv, setfenv = setmetatable, getfenv, setfenv;
local type, unpack, select, pairs = type, unpack, select, pairs;
local min, random = math.min, math.random;
local format = string.format;
local UnitMana = UnitMana;
local UnitManaMax = UnitManaMax;
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({
UnitMana = function (unit, displayType)
if(unit:find("target") or unit:find("focus")) then
return UnitMana(unit, displayType);
end
return random(1, UnitManaMax(unit, displayType) or 1);
end,
UnitHealth = function(unit)
if(unit:find("target") or unit:find("focus")) then
return UnitHealth(unit);
end
return random(1, UnitHealthMax(unit));
end,
UnitName = function(unit)
if(unit:find("target") or unit:find("focus")) then
return UnitName(unit);
end
if(E.CreditsList) then
local max = #E.CreditsList;
return E.CreditsList[random(1, max)];
end
return "Test Name";
end,
UnitClass = function(unit)
if(unit:find("target") or unit:find("focus")) then
return UnitClass(unit);
end
local classToken = CLASS_SORT_ORDER[random(1, #(CLASS_SORT_ORDER))];
return LOCALIZED_CLASS_NAMES_MALE[classToken], classToken;
end,
Hex = function(r, g, b)
if(type(r) == "table") then
if(r.r) then r, g, b = r.r, r.g, r.b; else r, g, b = unpack(r); end
end
return format("|cff%02x%02x%02x", r*255, g*255, b*255);
end,
ColorGradient = ElvUF.ColorGradient,
}, {
__index = _G,
__newindex = function(_, key, value) _G[key] = value end,
})
overrideFuncs["namecolor"] = ElvUF.Tags.Methods["namecolor"]
overrideFuncs["name:veryshort"] = ElvUF.Tags.Methods["name:veryshort"]
overrideFuncs["name:short"] = ElvUF.Tags.Methods["name:short"]
overrideFuncs["name:medium"] = ElvUF.Tags.Methods["name:medium"]
overrideFuncs["name:long"] = ElvUF.Tags.Methods["name:long"]
overrideFuncs["healthcolor"] = ElvUF.Tags.Methods["healthcolor"]
overrideFuncs["health:current"] = ElvUF.Tags.Methods["health:current"]
overrideFuncs["health:deficit"] = ElvUF.Tags.Methods["health:deficit"]
overrideFuncs["health:current-percent"] = ElvUF.Tags.Methods["health:current-percent"]
overrideFuncs["health:current-max"] = ElvUF.Tags.Methods["health:current-max"]
overrideFuncs["health:current-max-percent"] = ElvUF.Tags.Methods["health:current-max-percent"]
overrideFuncs["health:max"] = ElvUF.Tags.Methods["health:max"]
overrideFuncs["health:percent"] = ElvUF.Tags.Methods["health:percent"]
overrideFuncs["powercolor"] = ElvUF.Tags.Methods["powercolor"]
overrideFuncs["power:current"] = ElvUF.Tags.Methods["power:current"]
overrideFuncs["power:deficit"] = ElvUF.Tags.Methods["power:deficit"]
overrideFuncs["power:current-percent"] = ElvUF.Tags.Methods["power:current-percent"]
overrideFuncs["power:current-max"] = ElvUF.Tags.Methods["power:current-max"]
overrideFuncs["power:current-max-percent"] = ElvUF.Tags.Methods["power:current-max-percent"]
overrideFuncs["power:max"] = ElvUF.Tags.Methods["power:max"]
overrideFuncs["power:percent"] = ElvUF.Tags.Methods["power:percent"]
end
function UF:ForceShow(frame)
if InCombatLockdown() then return; end
if not frame.isForced then
frame.oldUnit = frame.unit
frame.unit = "player"
frame.isForced = true;
frame.oldOnUpdate = frame:GetScript("OnUpdate")
end
frame:SetScript("OnUpdate", nil)
frame.forceShowAuras = true
UnregisterUnitWatch(frame)
RegisterUnitWatch(frame, true)
frame: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)
frame.TargetGlow:SetAlpha(0)
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")
frame.TargetGlow:SetAlpha(1)
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,26 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule("UnitFrames");
--Cache global variables
--Lua functions
--WoW API / Variables
function UF:Construct_CombatIndicator(frame)
local combat = frame.RaisedElementParent.TextureParent:CreateTexture(nil, "OVERLAY")
combat:SetWidth(19)
combat:SetHeight(19)
combat:SetPoint("CENTER", frame.Health, "CENTER", 0, 6)
combat:SetVertexColor(0.69, 0.31, 0.31)
return combat
end
function UF:Configure_CombatIndicator(frame)
if frame.db.combatIcon and not frame:IsElementEnabled('CombatIndicator') then
frame:EnableElement("CombatIndicator")
elseif not frame.db.combatIcon and frame:IsElementEnabled('CombatIndicator') then
frame:DisableElement("CombatIndicator")
frame.CombatIndicator:Hide()
end
end
@@ -0,0 +1,238 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule("UnitFrames");
--Cache global variables
--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 = oUF
local ElvUF = ns.oUF
assert(ElvUF, "ElvUI was unable to locate oUF.")
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
CreateStatusBarTexturePointer(health)
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:SetPoint(textPos, health, textPos, x, 0)
end
health.colorTapping = true
health.colorDisconnected = true
E:CreateBackdrop(health, "Default", nil, nil, self.thinBorders, true)
return health
end
function UF:Configure_HealthBar(frame)
if not frame.VARIABLES_SET then return end
local db = frame.db
local health = frame.Health
health.Smooth = self.db.smoothbars
health.SmoothSpeed = self.db.smoothSpeed * 10
--Text
if db.health and health.value then
local attachPoint = self:GetObjectAnchorPoint(frame, db.health.attachTextTo)
health.value:ClearAllPoints()
health.value:SetPoint(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 == true then
health.colorSmooth = true
else
health.colorHealth = true
end
else
if self.db.colors.healthclass ~= true then
if self.db.colors.colorhealthbyvalue == true 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()
if frame.ORIENTATION == "LEFT" then
health:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -frame.BORDER - frame.SPACING, -frame.BORDER - frame.SPACING - frame.CLASSBAR_YOFFSET)
if frame.USE_POWERBAR_OFFSET then
health:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -frame.BORDER - frame.SPACING - frame.POWERBAR_OFFSET, -frame.BORDER - frame.SPACING - frame.CLASSBAR_YOFFSET)
health:SetWidth(frame.UNIT_WIDTH - (frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING + frame.POWERBAR_OFFSET))
health:SetHeight(frame.UNIT_HEIGHT - (frame.BORDER + frame.SPACING + frame.POWERBAR_OFFSET) - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET))
elseif frame.POWERBAR_DETACHED or not frame.USE_POWERBAR or frame.USE_INSET_POWERBAR then
health:SetWidth(frame.UNIT_WIDTH - (frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING))
health:SetHeight(frame.UNIT_HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET))
elseif frame.USE_MINI_POWERBAR then
health:SetWidth(frame.UNIT_WIDTH - (frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING))
health:SetHeight(frame.UNIT_HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.SPACING + (frame.POWERBAR_HEIGHT/2)))
else
health:SetWidth(frame.UNIT_WIDTH - (frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING))
health:SetHeight(frame.UNIT_HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET))
end
elseif frame.ORIENTATION == "RIGHT" then
health:SetPoint("TOPLEFT", frame, "TOPLEFT", frame.BORDER + frame.SPACING, -frame.BORDER - frame.SPACING - frame.CLASSBAR_YOFFSET)
if frame.USE_POWERBAR_OFFSET then
health:SetPoint("TOPLEFT", frame, "TOPLEFT", frame.BORDER + frame.SPACING + frame.POWERBAR_OFFSET, -frame.BORDER - frame.SPACING - frame.CLASSBAR_YOFFSET)
health:SetWidth(frame.UNIT_WIDTH - (frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING + frame.POWERBAR_OFFSET))
health:SetHeight(frame.UNIT_HEIGHT - (frame.BORDER + frame.SPACING + frame.POWERBAR_OFFSET) - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET))
elseif frame.POWERBAR_DETACHED or not frame.USE_POWERBAR or frame.USE_INSET_POWERBAR then
health:SetWidth(frame.UNIT_WIDTH - (frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING))
health:SetHeight(frame.UNIT_HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET))
elseif frame.USE_MINI_POWERBAR then
health:SetWidth(frame.UNIT_WIDTH - (frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING))
health:SetHeight(frame.UNIT_HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.SPACING + (frame.POWERBAR_HEIGHT/2)))
else
health:SetWidth(frame.UNIT_WIDTH - (frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING))
health:SetHeight(frame.UNIT_HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET))
end
elseif frame.ORIENTATION == "MIDDLE" then
health:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -frame.BORDER - frame.SPACING, -frame.BORDER - frame.SPACING - frame.CLASSBAR_YOFFSET)
if frame.USE_POWERBAR_OFFSET then
health:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -frame.BORDER - frame.SPACING - frame.POWERBAR_OFFSET, -frame.BORDER - frame.SPACING - frame.CLASSBAR_YOFFSET)
health:SetWidth(frame.UNIT_WIDTH - (frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING + (frame.POWERBAR_OFFSET*2)))
health:SetHeight(frame.UNIT_HEIGHT - (frame.BORDER + frame.SPACING + frame.POWERBAR_OFFSET) - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET))
elseif frame.POWERBAR_DETACHED or not frame.USE_POWERBAR or frame.USE_INSET_POWERBAR then
health:SetWidth(frame.UNIT_WIDTH - (frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING))
health:SetHeight(frame.UNIT_HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET))
elseif frame.USE_MINI_POWERBAR then
health:SetWidth(frame.UNIT_WIDTH - (frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING))
health:SetHeight(frame.UNIT_HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.SPACING + (frame.POWERBAR_HEIGHT/2)))
else
health:SetWidth(frame.UNIT_WIDTH - (frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING))
health:SetHeight(frame.UNIT_HEIGHT - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET) - (frame.BORDER + frame.SPACING + frame.BOTTOM_OFFSET))
end
end
health.bg:ClearAllPoints()
if not frame.USE_PORTRAIT_OVERLAY then
health.bg:SetParent(health)
health.bg:SetAllPoints()
else
health.bg:SetPoint("BOTTOMLEFT", health.texturePointer, "BOTTOMRIGHT")
health.bg:SetPoint("TOPRIGHT", health)
health.bg:SetParent(frame.Portrait.overlay)
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 then
health.frequentUpdates = db.health.frequentUpdates
end
end
--Transparency Settings
UF:ToggleTransparentStatusBar(UF.db.colors.transparentHealth, frame.Health, frame.Health.bg, (frame.USE_PORTRAIT and frame.USE_PORTRAIT_OVERLAY) ~= true)
frame:UpdateElement("Health")
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_INFO_PANEL then
bottomOffset = bottomOffset + frame.INFO_PANEL_HEIGHT - (frame.BORDER-frame.SPACING)
end
return bottomOffset
end
function UF:PostUpdateHealth(unit, min, max)
local parent = self:GetParent()
if parent.isForced then
min = random(1, max)
self:SetValue(min)
end
local r, g, b = self:GetStatusBarColor()
local colors = E.db["unitframe"]["colors"]
if ((colors.healthclass == true and colors.colorhealthbyvalue == true) or (colors.colorhealthbyvalue and parent.isForced)) and not (UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit)) then
local newr, newg, newb = ElvUF.ColorGradient(min, max, 1, 0, 0, 1, 1, 0, r, g, b)
self:SetStatusBarColor(newr, newg, newb)
if self.bg and self.bg.multiplier then
local mu = self.bg.multiplier
self.bg:SetVertexColor(newr * mu, newg * mu, newb * mu)
end
end
if colors.classbackdrop then
local reaction = UnitReaction(unit, "player")
local t
if UnitIsPlayer(unit) then
local _, class = UnitClass(unit)
t = parent.colors.class[class]
elseif(reaction) then
t = parent.colors.reaction[reaction]
end
if t then
self.bg:SetVertexColor(t[1], t[2], t[3])
end
end
--Backdrop
if colors.customhealthbackdrop then
local backdrop = colors.health_backdrop
self.bg:SetVertexColor(backdrop.r, backdrop.g, backdrop.b)
end
if colors.useDeadBackdrop and UnitIsDeadOrGhost(unit) then
local backdrop = colors.health_backdrop_dead
self.bg:SetVertexColor(backdrop.r, backdrop.g, backdrop.b)
end
end
@@ -0,0 +1,49 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule("UnitFrames");
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
E:CreateBackdrop(infoPanel, "Default", 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" then
frame.InfoPanel:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -frame.BORDER - frame.SPACING, frame.BORDER + frame.SPACING)
if frame.USE_POWERBAR and not frame.USE_INSET_POWERBAR and not frame.POWERBAR_DETACHED then
frame.InfoPanel:SetPoint("TOPLEFT", frame.Power.backdrop, "BOTTOMLEFT", frame.BORDER, -(frame.SPACING*3))
else
frame.InfoPanel:SetPoint("TOPLEFT", frame.Health.backdrop, "BOTTOMLEFT", frame.BORDER, -(frame.SPACING*3))
end
else
frame.InfoPanel:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", frame.BORDER + frame.SPACING, frame.BORDER + frame.SPACING)
if frame.USE_POWERBAR and not frame.USE_INSET_POWERBAR and not frame.POWERBAR_DETACHED then
frame.InfoPanel:SetPoint("TOPRIGHT", frame.Power.backdrop, "BOTTOMRIGHT", -frame.BORDER, -(frame.SPACING*3))
else
frame.InfoPanel:SetPoint("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
E:SetTemplate(frame.InfoPanel.backdrop, "Transparent", nil, nil, thinBorders, true)
else
E:SetTemplate(frame.InfoPanel.backdrop, "Default", true, nil, thinBorders, true)
end
end
else
frame.InfoPanel:Hide()
end
end
@@ -0,0 +1,11 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="CombatIndicator.lua"/>
<Script file="Health.lua"/>
<Script file="Name.lua"/>
<Script file="Portrait.lua"/>
<Script file="Power.lua"/>
<Script file="InfoPanel.lua"/>
<Script file="RaidIcon.lua"/>
<Script file="RaidRoleIcons.lua"/>
<Script file="RestingIndicator.lua"/>
</Ui>
@@ -0,0 +1,48 @@
local E, L, V, P, G = unpack(ElvUI);
local UF = E:GetModule("UnitFrames");
local UnitIsPlayer = UnitIsPlayer
function UF:Construct_NameText(frame)
local name = frame.RaisedElementParent:CreateFontString(nil, "OVERLAY")
UF:Configure_FontString(name)
name:SetPoint("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:SetPoint(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:SetPoint(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:SetPoint(frame.Power.value:GetPoint())
end
end
@@ -0,0 +1,119 @@
local E, L, V, P, G = unpack(ElvUI);
local UF = E:GetModule("UnitFrames");
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);
E:SetOutside(backdrop, portrait);
backdrop:SetFrameLevel(frame:GetFrameLevel());
E:SetTemplate(backdrop, "Default");
portrait.backdrop = backdrop;
else
portrait = CreateFrame("PlayerModel", nil, frame);
E:CreateBackdrop(portrait, "Default", nil, nil, self.thinBorders, true)
end
portrait.PostUpdate = self.PortraitUpdate;
portrait.overlay = CreateFrame("Frame", nil, frame);
portrait.overlay:SetFrameLevel(frame.Health:GetFrameLevel() + 5);
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", frame.unit);
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:SetAllPoints(frame.Health);
portrait:SetPoint("TOPLEFT", frame.Health, "TOPLEFT", - frame.BORDER - frame.SPACING, -(frame.BORDER + frame.SPACING))
portrait:SetPoint("BOTTOMLEFT", frame.Health, "BOTTOMLEFT", - frame.BORDER - frame.SPACING, -(frame.BORDER + frame.SPACING))
portrait:SetAlpha(0.35);
if(not dontHide) then
portrait:Show();
end
portrait.backdrop:Hide();
else
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);
else
portrait:SetParent(frame.Health);
end
if(frame.ORIENTATION == "LEFT") then
portrait.backdrop:SetPoint("TOPLEFT", frame, "TOPLEFT", frame.SPACING, frame.USE_MINI_CLASSBAR and -(frame.CLASSBAR_YOFFSET+frame.SPACING) or -frame.SPACING);
if(frame.USE_MINI_POWERBAR or frame.USE_POWERBAR_OFFSET or not frame.USE_POWERBAR or frame.USE_INSET_POWERBAR or frame.POWERBAR_DETACHED) then
portrait.backdrop:SetPoint("BOTTOMRIGHT", frame.Health.backdrop, "BOTTOMLEFT", frame.BORDER - frame.SPACING*3, 0);
else
portrait.backdrop:SetPoint("BOTTOMRIGHT", frame.Power.backdrop, "BOTTOMLEFT", frame.BORDER - frame.SPACING*3, 0);
end
elseif(frame.ORIENTATION == "RIGHT") then
portrait.backdrop:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -frame.SPACING, frame.USE_MINI_CLASSBAR and -(frame.CLASSBAR_YOFFSET+frame.SPACING) or -frame.SPACING);
if(frame.USE_MINI_POWERBAR or frame.USE_POWERBAR_OFFSET or not frame.USE_POWERBAR or frame.USE_INSET_POWERBAR or frame.POWERBAR_DETACHED) then
portrait.backdrop:SetPoint("BOTTOMLEFT", frame.Health.backdrop, "BOTTOMRIGHT", -frame.BORDER + frame.SPACING*3, 0);
else
portrait.backdrop:SetPoint("BOTTOMLEFT", frame.Power.backdrop, "BOTTOMRIGHT", -frame.BORDER + frame.SPACING*3, 0);
end
end
E:SetInside(portrait, 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(0.35);
else
self:SetAlpha(1)
end
end
+244
View File
@@ -0,0 +1,244 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule("UnitFrames");
--Cache global variables
--Lua functions
local random = random
--WoW API / Variables
local CreateFrame = CreateFrame
local ns = oUF
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.PostUpdate = self.PostUpdatePower
CreateStatusBarTexturePointer(power)
if bg then
power.bg = power:CreateTexture(nil, "BORDER")
power.bg:SetAllPoints()
power.bg:SetTexture(E["media"].blankTex)
power.bg.multiplier = 0.2
end
if text then
power.value = frame.RaisedElementParent:CreateFontString(nil, "OVERLAY")
power.value.frequentUpdates = true
UF:Configure_FontString(power.value)
local x = -2
if textPos == "LEFT" then
x = 2
end
power.value:SetPoint(textPos, frame.Health, textPos, x, 0)
end
power.colorDisconnected = false
power.colorTapping = false
E:CreateBackdrop(power, "Default", nil, nil, self.thinBorders)
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
power.Smooth = self.db.smoothbars
power.SmoothSpeed = self.db.smoothSpeed * 10
--Text
local attachPoint = self:GetObjectAnchorPoint(frame, db.power.attachTextTo)
power.value:ClearAllPoints()
power.value:SetPoint(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)
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
power:ClearAllPoints()
if frame.POWERBAR_DETACHED then
power:SetWidth(frame.POWERBAR_WIDTH - ((frame.BORDER + frame.SPACING)*2))
power:SetHeight(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:SetWidth(frame.POWERBAR_WIDTH)
power.Holder:SetHeight(frame.POWERBAR_HEIGHT)
power.Holder:SetPoint("BOTTOM", frame, "BOTTOM", 0, -20)
power:ClearAllPoints()
power:SetPoint("BOTTOMLEFT", power.Holder, "BOTTOMLEFT", frame.BORDER+frame.SPACING, frame.BORDER+frame.SPACING)
if(frame.unitframeType and frame.unitframeType == "player") then
E:CreateMover(power.Holder, "PlayerPowerBarMover", L["Player Powerbar"], nil, nil, nil, "ALL,SOLO")
elseif(frame.unitframeType and frame.unitframeType == "target") then
E:CreateMover(power.Holder, "TargetPowerBarMover", L["Target Powerbar"], nil, nil, nil, "ALL,SOLO")
end
else
power.Holder:SetWidth(frame.POWERBAR_WIDTH)
power.Holder:SetHeight(frame.POWERBAR_HEIGHT)
power:ClearAllPoints()
power:SetPoint("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
power.backdrop:SetFrameLevel(49)
elseif frame.USE_POWERBAR_OFFSET then
if frame.ORIENTATION == "LEFT" then
power:SetPoint("TOPRIGHT", frame.Health, "TOPRIGHT", frame.POWERBAR_OFFSET, -frame.POWERBAR_OFFSET)
power:SetWidth(frame.UNIT_WIDTH - (frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING + frame.POWERBAR_OFFSET))
power:SetHeight(frame.UNIT_HEIGHT - (frame.BORDER + frame.SPACING + frame.POWERBAR_OFFSET) - (frame.BORDER + frame.SPACING + frame.CLASSBAR_YOFFSET))
elseif frame.ORIENTATION == "MIDDLE" then
power:SetWidth(frame.UNIT_WIDTH - frame.PORTRAIT_WIDTH - ((frame.BORDER + frame.SPACING) * 2))
power:SetHeight(frame.UNIT_HEIGHT - (frame.POWERBAR_OFFSET + frame.CLASSBAR_YOFFSET) - frame.BORDER)
power:SetPoint("TOPLEFT", frame, "TOPLEFT", frame.BORDER + frame.SPACING, -frame.POWERBAR_OFFSET -frame.CLASSBAR_YOFFSET)
else
power:SetWidth(frame.UNIT_WIDTH - frame.PORTRAIT_WIDTH - frame.POWERBAR_OFFSET)
power:SetHeight(frame.UNIT_HEIGHT - frame.POWERBAR_OFFSET)
power:SetPoint("TOPLEFT", frame.Health, "TOPLEFT", -frame.POWERBAR_OFFSET, -frame.POWERBAR_OFFSET)
end
power:SetFrameLevel(frame.Health:GetFrameLevel() -5) --Health uses 10
power.backdrop:SetFrameLevel(frame.Health:GetFrameLevel() - 6)
elseif frame.USE_INSET_POWERBAR then
power:SetWidth(frame.UNIT_WIDTH - frame.PORTRAIT_WIDTH - ((frame.BORDER + (frame.BORDER*2)) * 2) - ((frame.BORDER + frame.SPACING) * 2))
power:SetHeight(frame.POWERBAR_HEIGHT - ((frame.BORDER + frame.SPACING)*2))
power:SetPoint("BOTTOMLEFT", frame.Health, "BOTTOMLEFT", frame.BORDER + (frame.BORDER*2), frame.BORDER + (frame.BORDER*2))
power:SetFrameLevel(50)
power.backdrop:SetFrameLevel(49)
elseif frame.USE_MINI_POWERBAR then
power:SetHeight(frame.POWERBAR_HEIGHT - ((frame.BORDER + frame.SPACING)*2))
if frame.ORIENTATION == "LEFT" then
power:SetWidth(frame.POWERBAR_WIDTH - frame.BORDER*2)
power:SetPoint("RIGHT", frame, "BOTTOMRIGHT", -(frame.BORDER*2 + 4), ((frame.POWERBAR_HEIGHT-frame.BORDER)/2))
elseif frame.ORIENTATION == "RIGHT" then
power:SetWidth(frame.POWERBAR_WIDTH - frame.BORDER*2)
power:SetPoint("LEFT", frame, "BOTTOMLEFT", (frame.BORDER*2 + 4), ((frame.POWERBAR_HEIGHT-frame.BORDER)/2))
else
power:SetWidth(frame.UNIT_WIDTH - ((frame.BORDER*2 + 4) * 2))
power:SetHeight(frame.POWERBAR_HEIGHT - frame.BORDER*2)
power:SetPoint("LEFT", frame, "BOTTOMLEFT", (frame.BORDER*2 + 4), ((frame.POWERBAR_HEIGHT-frame.BORDER)/2))
end
power:SetFrameLevel(50)
power.backdrop:SetFrameLevel(49)
else
power:SetPoint("TOPLEFT", frame.Health.backdrop, "BOTTOMLEFT", frame.BORDER, -frame.SPACING*3)
power:SetWidth(frame.UNIT_WIDTH - (frame.PORTRAIT_WIDTH + frame.BORDER + frame.SPACING) - (frame.BORDER + frame.SPACING))
power:SetHeight(frame.POWERBAR_HEIGHT - ((frame.BORDER + frame.SPACING)*2))
power:SetFrameLevel(frame.Health:GetFrameLevel() - 5)
power.backdrop:SetFrameLevel(frame.Health:GetFrameLevel() - 6)
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
if frame.DruidAltMana then
if db.power.druidMana then
frame:EnableElement("DruidAltMana")
else
frame:DisableElement("DruidAltMana")
frame.DruidAltMana:Hide()
end
end
--Transparency Settings
UF:ToggleTransparentStatusBar(UF.db.colors.transparentPower, frame.Power, frame.Power.bg)
end
function UF:PostUpdatePower(unit, cur, max)
local parent = self:GetParent()
if parent.isForced then
local pType = random(0, 3)
local color = ElvUF["colors"].power[pType]
cur = random(1, max)
self:SetValue(cur)
if not self.colorClass then
self:SetStatusBarColor(color[1], color[2], color[3])
local mu = self.bg.multiplier or 1
self.bg:SetVertexColor(color[1] * mu, color[2] * mu, color[3] * mu)
end
end
local db = parent.db
if db and db.power and db.power.hideonnpc then
UF:PostNamePosition(parent, unit)
end
end
@@ -0,0 +1,32 @@
local E, L, V, P, G = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule("UnitFrames");
function UF:Construct_RaidIcon(frame)
local tex = frame.RaisedElementParent.TextureParent:CreateTexture(nil, "OVERLAY")
tex:SetTexture([[Interface\AddOns\ElvUI\media\textures\raidicons]])
tex:SetWidth(18)
tex:SetHeight(18)
tex:SetPoint("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:SetWidth(db.raidicon.size)
RI:SetHeight(db.raidicon.size)
local attachPoint = self:GetObjectAnchorPoint(frame, db.raidicon.attachToObject)
RI:ClearAllPoints()
RI:SetPoint(db.raidicon.attachTo, attachPoint, db.raidicon.attachTo, db.raidicon.xOffset, db.raidicon.yOffset)
else
frame:DisableElement("RaidTargetIndicator")
RI:Hide()
end
end
@@ -0,0 +1,94 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule("UnitFrames");
--Cache global variables
--Lua functions
--WoW API / Variables
local CreateFrame = CreateFrame
function UF:Construct_RaidRoleFrames(frame)
local anchor = CreateFrame("Frame", nil, frame.RaisedElementParent)
frame.LeaderIndicator = anchor:CreateTexture(nil, "OVERLAY")
frame.AssistantIndicator = anchor:CreateTexture(nil, "OVERLAY")
frame.MasterLooterIndicator = anchor:CreateTexture(nil, "OVERLAY")
anchor:SetWidth(24)
anchor:SetHeight(12)
frame.LeaderIndicator:SetWidth(12)
frame.LeaderIndicator:SetHeight(12)
frame.AssistantIndicator:SetWidth(12)
frame.AssistantIndicator:SetHeight(12)
frame.MasterLooterIndicator:SetWidth(11)
frame.MasterLooterIndicator:SetHeight(11)
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:SetPoint("LEFT", frame.Health, "TOPLEFT", 2, 0)
else
raidRoleFrameAnchor:SetPoint("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:SetPoint("LEFT", anchor, "LEFT")
masterLooter:SetPoint("RIGHT", anchor, "RIGHT")
elseif isLeader and db.raidRoleIcons.position == "TOPRIGHT" then
leader:SetPoint("RIGHT", anchor, "RIGHT")
masterLooter:SetPoint("LEFT", anchor, "LEFT")
elseif isAssist and db.raidRoleIcons.position == "TOPLEFT" then
assistant:SetPoint("LEFT", anchor, "LEFT")
masterLooter:SetPoint("RIGHT", anchor, "RIGHT")
elseif isAssist and db.raidRoleIcons.position == "TOPRIGHT" then
assistant:SetPoint("RIGHT", anchor, "RIGHT")
masterLooter:SetPoint("LEFT", anchor, "LEFT")
elseif isMasterLooter and db.raidRoleIcons.position == "TOPLEFT" then
masterLooter:SetPoint("LEFT", anchor, "LEFT")
else
masterLooter:SetPoint("RIGHT", anchor, "RIGHT")
end
end
end
@@ -0,0 +1,40 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule("UnitFrames");
--Cache global variables
--Lua functions
--WoW API / Variables
function UF:Construct_RestingIndicator(frame)
local resting = frame.RaisedElementParent.TextureParent:CreateTexture(nil, "OVERLAY")
resting:SetWidth(22)
resting:SetHeight(22)
return resting
end
function UF:Configure_RestingIndicator(frame)
if not frame.VARIABLES_SET then return end
local rIcon = frame.RestingIndicator
local db = frame.db
if db.restIcon then
if not frame:IsElementEnabled("RestingIndicator") then
frame:EnableElement("RestingIndicator")
end
rIcon:ClearAllPoints()
if frame.ORIENTATION == "RIGHT" then
rIcon:SetPoint("CENTER", frame.Health, "TOPLEFT", -3, 6)
else
if frame.USE_PORTRAIT and not frame.USE_PORTRAIT_OVERLAY then
rIcon:SetPoint("CENTER", frame.Portrait, "TOPLEFT", -3, 6)
else
rIcon:SetPoint("CENTER", frame.Health, "TOPLEFT", -3, 6)
end
end
elseif frame:IsElementEnabled("RestingIndicator") then
frame:DisableElement("RestingIndicator")
rIcon:Hide()
end
end
@@ -0,0 +1,4 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="Party.lua"/>
<Script file="Raid.lua"/>
</Ui>
+122
View File
@@ -0,0 +1,122 @@
local E, L, V, P, G = unpack(ElvUI)
local UF = E:GetModule("UnitFrames")
local _G = _G
local tinsert = table.insert
local CreateFrame = CreateFrame
local InCombatLockdown = InCombatLockdown
local UnregisterStateDriver = UnregisterStateDriver
local RegisterStateDriver = RegisterStateDriver
local IsInInstance = IsInInstance
local ns = oUF
local ElvUF = ns.oUF
assert(ElvUF, "ElvUI was unable to locate oUF.")
function UF:Construct_PartyFrames()
self:SetScript("OnEnter", UnitFrame_OnEnter)
self:SetScript("OnLeave", UnitFrame_OnLeave)
self.RaisedElementParent = CreateFrame("Frame", nil, self)
self.RaisedElementParent:SetFrameLevel(self:GetFrameLevel() + 100)
self.RaisedElementParent.TextureParent = CreateFrame("Frame", nil, self.RaisedElementParent)
self.RaisedElementParent.TextureParent:SetFrameLevel(self.RaisedElementParent:GetFrameLevel() + 1)
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.RaidRoleFramesAnchor = UF:Construct_RaidRoleFrames(self)
self.RaidTargetIndicator = UF:Construct_RaidIcon(self)
self.unitframeType = "party"
UF:Update_StatusBars()
UF:Update_FontStrings()
UF:Update_PartyFrames(self, UF.db["units"]["party"])
return self;
end
function UF:Update_PartyHeader(header)
if not header.positioned then
header:ClearAllPoints()
header:SetPoint("BOTTOMLEFT", E.UIParent, "BOTTOMLEFT", 4, 195)
E:CreateMover(header, header:GetName().."Mover", L["Party Frames"], nil, nil, nil, "ALL,PARTY,ARENA")
header.positioned = true
end
end
function UF:Update_PartyFrames(frame, db)
frame.db = db
frame.Portrait = db.portrait.style == "2D" and frame.Portrait2D or frame.Portrait3D
frame.colors = ElvUF.colors
frame:RegisterForClicks(self.db.targetOnMouseDown and "LeftButtonDown" or "LeftButtonUp", self.db.targetOnMouseDown and "RightButtonDown" or "RightButtonUp")
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
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_WIDTH = 0
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:SetWidth(frame.UNIT_WIDTH)
frame:SetHeight(frame.UNIT_HEIGHT)
UF:Configure_InfoPanel(frame)
UF:Configure_HealthBar(frame)
UF:UpdateNameSettings(frame)
UF:Configure_Power(frame)
UF:Configure_Portrait(frame)
UF:Configure_RaidIcon(frame)
UF:Configure_RaidRoleIcons(frame)
frame:UpdateAllElements("ElvUI_UpdateAllElements")
end
UF["headerstoload"]["party"] = true
+122
View File
@@ -0,0 +1,122 @@
local E, L, V, P, G = unpack(ElvUI)
local UF = E:GetModule("UnitFrames")
local tinsert = table.insert
local CreateFrame = CreateFrame
local InCombatLockdown = InCombatLockdown
local IsInInstance = IsInInstance
local GetInstanceInfo = GetInstanceInfo
local UnregisterStateDriver = UnregisterStateDriver
local RegisterStateDriver = RegisterStateDriver
local ns = oUF
local ElvUF = ns.oUF
assert(ElvUF, "ElvUI was unable to locate oUF.")
function UF:Construct_RaidFrames()
self:SetScript("OnEnter", UnitFrame_OnEnter)
self:SetScript("OnLeave", UnitFrame_OnLeave)
self.RaisedElementParent = CreateFrame("Frame", nil, self)
self.RaisedElementParent:SetFrameLevel(self:GetFrameLevel() + 100)
self.RaisedElementParent.TextureParent = CreateFrame("Frame", nil, self.RaisedElementParent)
self.RaisedElementParent.TextureParent:SetFrameLevel(self.RaisedElementParent:GetFrameLevel() + 1)
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.RaidRoleFramesAnchor = UF:Construct_RaidRoleFrames(self)
self.RaidTargetIndicator = UF:Construct_RaidIcon(self);
self.InfoPanel = UF:Construct_InfoPanel(self)
UF:Update_StatusBars()
UF:Update_FontStrings()
self.unitframeType = "raid"
UF:Update_RaidFrames(self, UF.db["units"]["raid"])
return self
end
function UF:Update_RaidHeader(header)
if not header.positioned then
header:ClearAllPoints()
header:SetPoint("BOTTOMLEFT", E.UIParent, "BOTTOMLEFT", 4, 195)
E:CreateMover(header, header:GetName().."Mover", L["Raid Frames"], nil, nil, nil, "ALL,RAID")
header.positioned = true
end
end
function UF:Update_RaidFrames(frame, db)
frame.db = db
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 "LeftButtonDown" or "LeftButtonUp", self.db.targetOnMouseDown and "RightButtonDown" or "RightButtonUp")
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
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_WIDTH = 0
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:SetWidth(frame.UNIT_WIDTH)
frame:SetHeight(frame.UNIT_HEIGHT)
UF:Configure_InfoPanel(frame)
UF:Configure_HealthBar(frame)
UF:UpdateNameSettings(frame)
UF:Configure_Power(frame)
UF:Configure_Portrait(frame)
UF:Configure_RaidIcon(frame)
UF:Configure_RaidRoleIcons(frame)
frame:UpdateAllElements("ElvUI_UpdateAllElements")
end
UF["headerstoload"]["raid"] = true
@@ -0,0 +1,7 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script file="UnitFrames.lua"/>
<Script file="Tags.lua"/>
<Include file="Elements\Load_Elements.xml"/>
<Include file="Units\Load_Units.xml"/>
<Include file="Groups\Load_Groups.xml"/>
</Ui>
+552
View File
@@ -0,0 +1,552 @@
local E, L, V, P, G = unpack(ElvUI)
local _G = _G;
local floor = math.floor;
local format = string.format;
local GetPVPTimer = GetPVPTimer;
local GetTime = GetTime;
local UnitClass = UnitClass;
local UnitClassification = UnitClassification;
local UnitGUID = UnitGUID;
local UnitIsAFK = UnitIsAFK;
local UnitIsConnected = UnitIsConnected;
local UnitIsDND = UnitIsDND;
local UnitIsDead = UnitIsDead;
local UnitIsDeadOrGhost = UnitIsDeadOrGhost;
local UnitIsGhost = UnitIsGhost;
local UnitIsPVP = UnitIsPVP;
local UnitIsPVPFreeForAll = UnitIsPVPFreeForAll;
local UnitIsPlayer = UnitIsPlayer;
local UnitLevel = UnitLevel;
local UnitMana = UnitMana;
local UnitManaMax = UnitManaMax;
local UnitPowerType = UnitPowerType;
local UnitReaction = UnitReaction;
local DEFAULT_AFK_MESSAGE = DEFAULT_AFK_MESSAGE;
local PVP = PVP;
------------------------------------------------------------------------
-- Tags
------------------------------------------------------------------------
ElvUF.Tags.Events["afk"] = "PLAYER_FLAGS_CHANGED"
ElvUF.Tags.Methods["afk"] = function(unit)
local isAFK = UnitIsAFK(unit)
if isAFK then
return ("|cffFFFFFF[|r|cffFF0000%s|r|cFFFFFFFF]|r"):format(DEFAULT_AFK_MESSAGE)
else
return ""
end
end
ElvUF.Tags.Events["healthcolor"] = "UNIT_HEALTH UNIT_CONNECTION PLAYER_FLAGS_CHANGED"
ElvUF.Tags.Methods["healthcolor"] = function(unit)
if UnitIsDeadOrGhost(unit) or not UnitIsConnected(unit) then
return Hex(0.84, 0.75, 0.65)
else
local r, g, b = ElvUF.ColorGradient(UnitHealth(unit), UnitHealthMax(unit), 0.69, 0.31, 0.31, 0.65, 0.63, 0.35, 0.33, 0.59, 0.33)
return Hex(r, g, b)
end
end
ElvUF.Tags.Events["health:current"] = "UNIT_HEALTH UNIT_MAXHEALTH UNIT_CONNECTION PLAYER_FLAGS_CHANGED"
ElvUF.Tags.Methods["health:current"] = function(unit)
local status = UnitIsDead(unit) and L["Dead"] or UnitIsGhost(unit) and L["Ghost"] or not UnitIsConnected(unit) and L["Offline"]
if (status) then
return status
else
return E:GetFormattedText("CURRENT", UnitHealth(unit), UnitHealthMax(unit))
end
end
ElvUF.Tags.Events["health:deficit"] = "UNIT_HEALTH UNIT_MAXHEALTH UNIT_CONNECTION PLAYER_FLAGS_CHANGED"
ElvUF.Tags.Methods["health:deficit"] = function(unit)
local status = UnitIsDead(unit) and L["Dead"] or UnitIsGhost(unit) and L["Ghost"] or not UnitIsConnected(unit) and L["Offline"]
if (status) then
return status
else
return E:GetFormattedText("DEFICIT", UnitHealth(unit), UnitHealthMax(unit))
end
end
ElvUF.Tags.Events["health:current-percent"] = "UNIT_HEALTH UNIT_MAXHEALTH UNIT_CONNECTION PLAYER_FLAGS_CHANGED"
ElvUF.Tags.Methods["health:current-percent"] = function(unit)
local status = UnitIsDead(unit) and L["Dead"] or UnitIsGhost(unit) and L["Ghost"] or not UnitIsConnected(unit) and L["Offline"]
if (status) then
return status
else
return E:GetFormattedText("CURRENT_PERCENT", UnitHealth(unit), UnitHealthMax(unit))
end
end
ElvUF.Tags.Events["health:current-max"] = "UNIT_HEALTH UNIT_MAXHEALTH UNIT_CONNECTION PLAYER_FLAGS_CHANGED"
ElvUF.Tags.Methods["health:current-max"] = function(unit)
local status = UnitIsDead(unit) and L["Dead"] or UnitIsGhost(unit) and L["Ghost"] or not UnitIsConnected(unit) and L["Offline"]
if (status) then
return status
else
return E:GetFormattedText("CURRENT_MAX", UnitHealth(unit), UnitHealthMax(unit))
end
end
ElvUF.Tags.Events["health:current-max-percent"] = "UNIT_HEALTH UNIT_MAXHEALTH UNIT_CONNECTION PLAYER_FLAGS_CHANGED"
ElvUF.Tags.Methods["health:current-max-percent"] = function(unit)
local status = UnitIsDead(unit) and L["Dead"] or UnitIsGhost(unit) and L["Ghost"] or not UnitIsConnected(unit) and L["Offline"]
if (status) then
return status
else
return E:GetFormattedText("CURRENT_MAX_PERCENT", UnitHealth(unit), UnitHealthMax(unit))
end
end
ElvUF.Tags.Events["health:max"] = "UNIT_MAXHEALTH"
ElvUF.Tags.Methods["health:max"] = function(unit)
local max = UnitHealthMax(unit)
return E:GetFormattedText("CURRENT", max, max)
end
ElvUF.Tags.Events["health:percent"] = "UNIT_HEALTH UNIT_MAXHEALTH UNIT_CONNECTION PLAYER_FLAGS_CHANGED"
ElvUF.Tags.Methods["health:percent"] = function(unit)
local status = UnitIsDead(unit) and L["Dead"] or UnitIsGhost(unit) and L["Ghost"] or not UnitIsConnected(unit) and L["Offline"]
if (status) then
return status
else
return E:GetFormattedText("PERCENT", UnitHealth(unit), UnitHealthMax(unit))
end
end
ElvUF.Tags.Events["health:current-nostatus"] = "UNIT_HEALTH UNIT_MAXHEALTH";
ElvUF.Tags.Methods["health:current-nostatus"] = function(unit)
return E:GetFormattedText("CURRENT", UnitHealth(unit), UnitHealthMax(unit));
end
ElvUF.Tags.Events["health:deficit-nostatus"] = "UNIT_HEALTH UNIT_MAXHEALTH";
ElvUF.Tags.Methods["health:deficit-nostatus"] = function(unit)
return E:GetFormattedText("DEFICIT", UnitHealth(unit), UnitHealthMax(unit));
end
ElvUF.Tags.Events["health:current-percent-nostatus"] = "UNIT_HEALTH UNIT_MAXHEALTH";
ElvUF.Tags.Methods["health:current-percent-nostatus"] = function(unit)
return E:GetFormattedText("CURRENT_PERCENT", UnitHealth(unit), UnitHealthMax(unit));
end
ElvUF.Tags.Events["health:current-max-nostatus"] = "UNIT_HEALTH UNIT_MAXHEALTH";
ElvUF.Tags.Methods["health:current-max-nostatus"] = function(unit)
return E:GetFormattedText("CURRENT_MAX", UnitHealth(unit), UnitHealthMax(unit));
end
ElvUF.Tags.Events["health:current-max-percent-nostatus"] = "UNIT_HEALTH UNIT_MAXHEALTH";
ElvUF.Tags.Methods["health:current-max-percent-nostatus"] = function(unit)
return E:GetFormattedText("CURRENT_MAX_PERCENT", UnitHealth(unit), UnitHealthMax(unit));
end
ElvUF.Tags.Events["health:percent-nostatus"] = "UNIT_HEALTH UNIT_MAXHEALTH";
ElvUF.Tags.Methods["health:percent-nostatus"] = function(unit)
return E:GetFormattedText("PERCENT", UnitHealth(unit), UnitHealthMax(unit));
end
ElvUF.Tags.Events["health:deficit-percent:name"] = "UNIT_HEALTH UNIT_MAXHEALTH";
ElvUF.Tags.Methods["health:deficit-percent:name"] = function(unit)
local currentHealth = UnitHealth(unit)
local deficit = UnitHealthMax(unit) - currentHealth;
if (deficit > 0 and currentHealth > 0) then
return _TAGS["health:percent-nostatus"](unit);
else
return _TAGS["name"](unit);
end
end
ElvUF.Tags.Events["health:deficit-percent:name-long"] = "UNIT_HEALTH UNIT_MAXHEALTH"
ElvUF.Tags.Methods["health:deficit-percent:name-long"] = function(unit)
local currentHealth = UnitHealth(unit)
local deficit = UnitHealthMax(unit) - currentHealth
if (deficit > 0 and currentHealth > 0) then
return _TAGS["health:percent-nostatus"](unit)
else
return _TAGS["name:long"](unit)
end
end
ElvUF.Tags.Events["health:deficit-percent:name-medium"] = "UNIT_HEALTH UNIT_MAXHEALTH"
ElvUF.Tags.Methods["health:deficit-percent:name-medium"] = function(unit)
local currentHealth = UnitHealth(unit)
local deficit = UnitHealthMax(unit) - currentHealth
if (deficit > 0 and currentHealth > 0) then
return _TAGS["health:percent-nostatus"](unit)
else
return _TAGS["name:medium"](unit)
end
end
ElvUF.Tags.Events["health:deficit-percent:name-short"] = "UNIT_HEALTH UNIT_MAXHEALTH"
ElvUF.Tags.Methods["health:deficit-percent:name-short"] = function(unit)
local currentHealth = UnitHealth(unit)
local deficit = UnitHealthMax(unit) - currentHealth
if (deficit > 0 and currentHealth > 0) then
return _TAGS["health:percent-nostatus"](unit)
else
return _TAGS["name:short"](unit)
end
end
ElvUF.Tags.Events["health:deficit-percent:name-veryshort"] = "UNIT_HEALTH UNIT_MAXHEALTH"
ElvUF.Tags.Methods["health:deficit-percent:name-veryshort"] = function(unit)
local currentHealth = UnitHealth(unit)
local deficit = UnitHealthMax(unit) - currentHealth
if (deficit > 0 and currentHealth > 0) then
return _TAGS["health:percent-nostatus"](unit)
else
return _TAGS["name:veryshort"](unit)
end
end
ElvUF.Tags.Events["powercolor"] = "UNIT_ENERGY UNIT_FOCUS UNIT_MANA UNIT_RAGE UNIT_RUNIC_POWER UNIT_MAXPOWER"
ElvUF.Tags.Methods["powercolor"] = function(unit)
local color = ElvUF["colors"].power[UnitPowerType(unit)]
if color then
return Hex(color[1], color[2], color[3])
else
return Hex(unpack(ElvUF["colors"].power[0]))
end
end
ElvUF.Tags.Events["power:current"] = "UNIT_ENERGY UNIT_FOCUS UNIT_MANA UNIT_RAGE UNIT_RUNIC_POWER UNIT_MAXPOWER"
ElvUF.Tags.Methods["power:current"] = function(unit)
local min = UnitMana(unit)
return min == 0 and " " or E:GetFormattedText("CURRENT", min, UnitManaMax(unit))
end
ElvUF.Tags.Events["power:current-max"] = "UNIT_ENERGY UNIT_FOCUS UNIT_MANA UNIT_RAGE UNIT_RUNIC_POWER UNIT_MAXPOWER"
ElvUF.Tags.Methods["power:current-max"] = function(unit)
local min = UnitMana(unit)
return min == 0 and " " or E:GetFormattedText("CURRENT_MAX", min, UnitManaMax(unit))
end
ElvUF.Tags.Events["power:current-percent"] = "UNIT_ENERGY UNIT_FOCUS UNIT_MANA UNIT_RAGE UNIT_RUNIC_POWER UNIT_MAXPOWER"
ElvUF.Tags.Methods["power:current-percent"] = function(unit)
local min = UnitMana(unit)
return min == 0 and " " or E:GetFormattedText("CURRENT_PERCENT", min, UnitManaMax(unit))
end
ElvUF.Tags.Events["power:current-max-percent"] = "UNIT_ENERGY UNIT_FOCUS UNIT_MANA UNIT_RAGE UNIT_RUNIC_POWER UNIT_MAXPOWER"
ElvUF.Tags.Methods["power:current-max-percent"] = function(unit)
local min = UnitMana(unit)
return min == 0 and " " or E:GetFormattedText("CURRENT_MAX_PERCENT", min, UnitManaMax(unit))
end
ElvUF.Tags.Events["power:percent"] = "UNIT_ENERGY UNIT_FOCUS UNIT_MANA UNIT_RAGE UNIT_RUNIC_POWER UNIT_MAXPOWER"
ElvUF.Tags.Methods["power:percent"] = function(unit)
local min = UnitMana(unit)
return min == 0 and " " or E:GetFormattedText("PERCENT", min, UnitManaMax(unit))
end
ElvUF.Tags.Events["power:deficit"] = "UNIT_ENERGY UNIT_FOCUS UNIT_MANA UNIT_RAGE UNIT_RUNIC_POWER UNIT_MAXPOWER"
ElvUF.Tags.Methods["power:deficit"] = function(unit)
return E:GetFormattedText("DEFICIT", UnitMana(unit), UnitManaMax(unit))
end
ElvUF.Tags.Events["power:max"] = "UNIT_MAXENERGY UNIT_MAXFOCUS UNIT_MAXMANA UNIT_MAXRAGE UNIT_MAXRUNIC_POWER"
ElvUF.Tags.Methods["power:max"] = function(unit)
local max = UnitManaMax(unit)
return E:GetFormattedText("CURRENT", max, max)
end
ElvUF.Tags.Methods["manacolor"] = function()
local altR, altG, altB = PowerBarColor["MANA"].r, PowerBarColor["MANA"].g, PowerBarColor["MANA"].b
local color = ElvUF["colors"].power["MANA"]
if color then
return Hex(color[1], color[2], color[3])
else
return Hex(altR, altG, altB)
end
end
ElvUF.Tags.Events["mana:current"] = "UNIT_MANA UNIT_MAXMANA"
ElvUF.Tags.Methods["mana:current"] = function(unit)
local min = UnitMana(unit)
return min == 0 and " " or E:GetFormattedText("CURRENT", min, UnitManaMax(unit))
end
ElvUF.Tags.Events["mana:current-max"] = "UNIT_MANA UNIT_MAXMANA"
ElvUF.Tags.Methods["mana:current-max"] = function(unit)
local min = UnitMana(unit)
return min == 0 and " " or E:GetFormattedText("CURRENT_MAX", min, UnitManaMax(unit))
end
ElvUF.Tags.Events["mana:current-percent"] = "UNIT_MANA UNIT_MAXMANA"
ElvUF.Tags.Methods["mana:current-percent"] = function(unit)
local min = UnitMana(unit)
return min == 0 and " " or E:GetFormattedText("CURRENT_PERCENT", min, UnitManaMax(unit))
end
ElvUF.Tags.Events["mana:current-max-percent"] = "UNIT_MANA UNIT_MAXMANA"
ElvUF.Tags.Methods["mana:current-max-percent"] = function(unit)
local min = UnitMana(unit)
return min == 0 and " " or E:GetFormattedText("CURRENT_MAX_PERCENT", min, UnitManaMax(unit))
end
ElvUF.Tags.Events["mana:percent"] = "UNIT_MANA UNIT_MAXMANA"
ElvUF.Tags.Methods["mana:percent"] = function(unit)
local min = UnitMana(unit)
return min == 0 and " " or E:GetFormattedText("PERCENT", min, UnitManaMax(unit))
end
ElvUF.Tags.Events["mana:deficit"] = "UNIT_MANA UNIT_MAXMANA"
ElvUF.Tags.Methods["mana:deficit"] = function(unit)
return E:GetFormattedText("DEFICIT", UnitMana(unit), UnitManaMax(unit))
end
ElvUF.Tags.Events["mana:max"] = "UNIT_MAXMANA"
ElvUF.Tags.Methods["mana:max"] = function(unit)
local max = UnitManaMax(unit)
return E:GetFormattedText("CURRENT", max, max)
end
ElvUF.Tags.Events["difficultycolor"] = "UNIT_LEVEL PLAYER_LEVEL_UP"
ElvUF.Tags.Methods["difficultycolor"] = function(unit)
local r, g, b = 0.69, 0.31, 0.31
local level = UnitLevel(unit)
if (level > 1) then
local DiffColor = UnitLevel(unit) - UnitLevel("player")
if (DiffColor >= 5) then
r, g, b = 0.69, 0.31, 0.31
elseif (DiffColor >= 3) then
r, g, b = 0.71, 0.43, 0.27
elseif (DiffColor >= -2) then
r, g, b = 0.84, 0.75, 0.65
elseif (-DiffColor <= GetQuestGreenRange()) then
r, g, b = 0.33, 0.59, 0.33
else
r, g, b = 0.55, 0.57, 0.61
end
end
return Hex(r, g, b)
end
ElvUF.Tags.Events["namecolor"] = "UNIT_NAME_UPDATE"
ElvUF.Tags.Methods["namecolor"] = function(unit)
local unitReaction = UnitReaction(unit, "player")
local _, unitClass = UnitClass(unit)
if (UnitIsPlayer(unit)) then
local class = ElvUF.colors.class[unitClass]
if not class then return "" end
return Hex(class[1], class[2], class[3])
elseif (unitReaction) then
local reaction = ElvUF["colors"].reaction[unitReaction]
return Hex(reaction[1], reaction[2], reaction[3])
else
return "|cFFC2C2C2"
end
end
ElvUF.Tags.Events["smartlevel"] = "UNIT_LEVEL PLAYER_LEVEL_UP"
ElvUF.Tags.Methods["smartlevel"] = function(unit)
local level = UnitLevel(unit)
if level == UnitLevel("player") then
return ""
elseif(level > 0) then
return level
else
return "??"
end
end
ElvUF.Tags.Events["name:veryshort"] = "UNIT_NAME_UPDATE"
ElvUF.Tags.Methods["name:veryshort"] = function(unit)
local name = UnitName(unit)
return name ~= nil and E:ShortenString(name, 5) or ""
end
ElvUF.Tags.Events["name:short"] = "UNIT_NAME_UPDATE"
ElvUF.Tags.Methods["name:short"] = function(unit)
local name = UnitName(unit)
return name ~= nil and E:ShortenString(name, 10) or ""
end
ElvUF.Tags.Events["name:medium"] = "UNIT_NAME_UPDATE"
ElvUF.Tags.Methods["name:medium"] = function(unit)
local name = UnitName(unit)
return name ~= nil and E:ShortenString(name, 15) or ""
end
ElvUF.Tags.Events["name:long"] = "UNIT_NAME_UPDATE"
ElvUF.Tags.Methods["name:long"] = function(unit)
local name = UnitName(unit)
return name ~= nil and E:ShortenString(name, 20) or ""
end
ElvUF.Tags.Events["name:veryshort:status"] = "UNIT_NAME_UPDATE UNIT_CONNECTION PLAYER_FLAGS_CHANGED UNIT_HEALTH"
ElvUF.Tags.Methods["name:veryshort:status"] = function(unit)
local status = UnitIsDead(unit) and L["Dead"] or UnitIsGhost(unit) and L["Ghost"] or not UnitIsConnected(unit) and L["Offline"]
local name = UnitName(unit)
if (status) then
return status
else
return name ~= nil and E:ShortenString(name, 5) or ""
end
end
ElvUF.Tags.Events["name:short:status"] = "UNIT_NAME_UPDATE UNIT_CONNECTION PLAYER_FLAGS_CHANGED UNIT_HEALTH"
ElvUF.Tags.Methods["name:short:status"] = function(unit)
local status = UnitIsDead(unit) and L["Dead"] or UnitIsGhost(unit) and L["Ghost"] or not UnitIsConnected(unit) and L["Offline"]
local name = UnitName(unit)
if (status) then
return status
else
return name ~= nil and E:ShortenString(name, 10) or ""
end
end
ElvUF.Tags.Events["name:medium:status"] = "UNIT_NAME_UPDATE UNIT_CONNECTION PLAYER_FLAGS_CHANGED UNIT_HEALTH"
ElvUF.Tags.Methods["name:medium:status"] = function(unit)
local status = UnitIsDead(unit) and L["Dead"] or UnitIsGhost(unit) and L["Ghost"] or not UnitIsConnected(unit) and L["Offline"]
local name = UnitName(unit)
if (status) then
return status
else
return name ~= nil and E:ShortenString(name, 15) or ""
end
end
ElvUF.Tags.Events["name:long:status"] = "UNIT_NAME_UPDATE UNIT_CONNECTION PLAYER_FLAGS_CHANGED UNIT_HEALTH"
ElvUF.Tags.Methods["name:long:status"] = function(unit)
local status = UnitIsDead(unit) and L["Dead"] or UnitIsGhost(unit) and L["Ghost"] or not UnitIsConnected(unit) and L["Offline"]
local name = UnitName(unit)
if (status) then
return status
else
return name ~= nil and E:ShortenString(name, 20) or ""
end
end
local unitStatus = {}
ElvUF.Tags.OnUpdateThrottle["statustimer"] = 1
ElvUF.Tags.Methods["statustimer"] = function(unit)
if not UnitIsPlayer(unit) then return; end
local guid = UnitGUID(unit)
if (UnitIsAFK(unit)) then
if not unitStatus[guid] or unitStatus[guid] and unitStatus[guid][1] ~= "AFK" then
unitStatus[guid] = {"AFK", GetTime()}
end
elseif(UnitIsDND(unit)) then
if not unitStatus[guid] or unitStatus[guid] and unitStatus[guid][1] ~= "DND" then
unitStatus[guid] = {"DND", GetTime()}
end
elseif(UnitIsDead(unit)) or (UnitIsGhost(unit))then
if not unitStatus[guid] or unitStatus[guid] and unitStatus[guid][1] ~= "Dead" then
unitStatus[guid] = {"Dead", GetTime()}
end
elseif(not UnitIsConnected(unit)) then
if not unitStatus[guid] or unitStatus[guid] and unitStatus[guid][1] ~= "Offline" then
unitStatus[guid] = {"Offline", GetTime()}
end
else
unitStatus[guid] = nil
end
if unitStatus[guid] ~= nil then
local status = unitStatus[guid][1]
local timer = GetTime() - unitStatus[guid][2]
local mins = floor(timer / 60)
local secs = floor(timer - (mins * 60))
return ("%s (%01.f:%02.f)"):format(status, mins, secs)
else
return ""
end
end
ElvUF.Tags.OnUpdateThrottle["pvptimer"] = 1
ElvUF.Tags.Methods["pvptimer"] = function(unit)
if (UnitIsPVPFreeForAll(unit) or UnitIsPVP(unit)) then
local timer = GetPVPTimer()
if timer ~= 301000 and timer ~= -1 then
local mins = floor((timer / 1000) / 60)
local secs = floor((timer / 1000) - (mins * 60))
return ("%s (%01.f:%02.f)"):format(PVP, mins, secs)
else
return PVP
end
else
return ""
end
end
ElvUF.Tags.Events["classificationcolor"] = "UNIT_CLASSIFICATION_CHANGED";
ElvUF.Tags.Methods["classificationcolor"] = function(unit)
local c = UnitClassification(unit);
if(c == "rare" or c == "elite") then
return Hex(1, 0.5, 0.25); -- Orange
elseif(c == "rareelite" or c == "worldboss") then
return Hex(1, 0, 0); -- Red
end
end
ElvUF.Tags.Events["guild"] = "PLAYER_GUILD_UPDATE"
ElvUF.Tags.Methods["guild"] = function(unit)
local guildName = GetGuildInfo(unit)
return guildName or ""
end
ElvUF.Tags.Events["guild:brackets"] = "PLAYER_GUILD_UPDATE"
ElvUF.Tags.Methods["guild:brackets"] = function(unit)
local guildName = GetGuildInfo(unit)
return guildName and format("<%s>", guildName) or ""
end
ElvUF.Tags.Events["target:veryshort"] = "UNIT_TARGET"
ElvUF.Tags.Methods["target:veryshort"] = function(unit)
local targetName = UnitName(unit.."target")
return targetName ~= nil and E:ShortenString(targetName, 5) or ""
end
ElvUF.Tags.Events["target:short"] = "UNIT_TARGET"
ElvUF.Tags.Methods["target:short"] = function(unit)
local targetName = UnitName(unit.."target")
return targetName ~= nil and E:ShortenString(targetName, 10) or ""
end
ElvUF.Tags.Events["target:medium"] = "UNIT_TARGET"
ElvUF.Tags.Methods["target:medium"] = function(unit)
local targetName = UnitName(unit.."target")
return targetName ~= nil and E:ShortenString(targetName, 15) or ""
end
ElvUF.Tags.Events["target:long"] = "UNIT_TARGET"
ElvUF.Tags.Methods["target:long"] = function(unit)
local targetName = UnitName(unit.."target")
return targetName ~= nil and E:ShortenString(targetName, 20) or ""
end
ElvUF.Tags.Events["target"] = "UNIT_TARGET"
ElvUF.Tags.Methods["target"] = function(unit)
local targetName = UnitName(unit.."target")
return targetName or ""
end
File diff suppressed because it is too large Load Diff
@@ -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>
+106
View File
@@ -0,0 +1,106 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule("UnitFrames");
--Cache global variables
--Lua functions
local _G = _G
local ns = oUF
local ElvUF = ns.oUF
assert(ElvUF, "ElvUI was unable to locate oUF.")
local CAN_HAVE_CLASSBAR = E.myclass == "DRUID"
function UF:Construct_PlayerFrame(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.RaidTargetIndicator = UF:Construct_RaidIcon(frame)
frame.RestingIndicator = self:Construct_RestingIndicator(frame)
frame.CombatIndicator = self:Construct_CombatIndicator(frame)
frame.InfoPanel = self:Construct_InfoPanel(frame)
frame:SetPoint("BOTTOMLEFT", E.UIParent, "BOTTOM", -413, 68)
E:CreateMover(frame, frame:GetName().."Mover", L["Player Frame"], nil, nil, nil, "ALL,SOLO")
frame.unitframeType = "player"
end
function UF:Update_PlayerFrame(frame, db)
frame.db = db
do
frame.ORIENTATION = db.orientation
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 = CAN_HAVE_CLASSBAR
frame.MAX_CLASS_BAR = frame.MAX_CLASS_BAR or UF.classMaxResourceBar[E.myclass] or 0
frame.USE_CLASSBAR = db.classbar.enable and frame.CAN_HAVE_CLASSBAR
frame.CLASSBAR_SHOWN = frame.CAN_HAVE_CLASSBAR and frame[frame.ClassBar]:IsShown()
frame.CLASSBAR_DETACHED = db.classbar.detachFromFrame
frame.USE_MINI_CLASSBAR = db.classbar.fill == "spaced" and frame.USE_CLASSBAR
frame.CLASSBAR_HEIGHT = frame.USE_CLASSBAR and db.classbar.height or 0
frame.CLASSBAR_WIDTH = frame.UNIT_WIDTH - ((frame.BORDER+frame.SPACING)*2) - frame.PORTRAIT_WIDTH -(frame.ORIENTATION == "MIDDLE" and (frame.POWERBAR_OFFSET*2) or frame.POWERBAR_OFFSET)
frame.CLASSBAR_YOFFSET = (not frame.USE_CLASSBAR or not frame.CLASSBAR_SHOWN or frame.CLASSBAR_DETACHED) and 0 or (frame.USE_MINI_CLASSBAR and (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 db.infoPanel.enable
frame.INFO_PANEL_HEIGHT = frame.USE_INFO_PANEL and db.infoPanel.height or 0
frame.HAPPINESS_WIDTH = 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 "LeftButtonDown" or "LeftButtonUp", self.db.targetOnMouseDown and "RightButtonDown" or "RightButtonUp")
frame:SetWidth(frame.UNIT_WIDTH)
frame:SetHeight(frame.UNIT_HEIGHT)
_G[frame:GetName().."Mover"]:SetWidth(frame:GetWidth())
_G[frame:GetName().."Mover"]:SetHeight(frame:GetHeight())
UF:Configure_InfoPanel(frame)
UF:Configure_RestingIndicator(frame)
UF:Configure_CombatIndicator(frame)
UF:Configure_HealthBar(frame)
UF:UpdateNameSettings(frame)
UF:Configure_Power(frame)
UF:Configure_Portrait(frame)
UF:Configure_RaidIcon(frame)
E:SetMoverSnapOffset(frame:GetName().."Mover", -(12 + db.castbar.height))
frame:UpdateAllElements("ElvUI_UpdateAllElements")
end
tinsert(UF["unitstoload"], "player")
+96
View File
@@ -0,0 +1,96 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule("UnitFrames");
--Cache global variables
--Lua functions
local _G = _G
local ns = oUF
local ElvUF = ns.oUF
assert(ElvUF, "ElvUI was unable to locate oUF.")
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.RaidTargetIndicator = UF:Construct_RaidIcon(frame)
frame.InfoPanel = self:Construct_InfoPanel(frame)
frame:SetPoint("BOTTOMRIGHT", E.UIParent, "BOTTOM", 413, 68)
E:CreateMover(frame, frame:GetName().."Mover", L["Target Frame"], nil, nil, nil, "ALL,SOLO")
frame.unitframeType = "target"
end
function UF:Update_TargetFrame(frame, db)
frame.db = db
do
frame.ORIENTATION = db.orientation
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 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 "LeftButtonDown" or "LeftButtonUp", self.db.targetOnMouseDown and "RightButtonDown" or "RightButtonUp")
frame:SetWidth(frame.UNIT_WIDTH)
frame:SetHeight(frame.UNIT_HEIGHT)
_G[frame:GetName().."Mover"]:SetWidth(frame:GetWidth())
_G[frame:GetName().."Mover"]:SetHeight(frame:GetHeight())
UF:Configure_InfoPanel(frame)
UF:Configure_HealthBar(frame)
UF:UpdateNameSettings(frame)
UF:Configure_Power(frame)
UF:Configure_Portrait(frame)
UF:Configure_RaidIcon(frame)
E:SetMoverSnapOffset(frame:GetName().."Mover", -(12 + db.castbar.height))
frame:UpdateAllElements("ElvUI_UpdateAllElements")
end
tinsert(UF["unitstoload"], "target")
@@ -0,0 +1,81 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule("UnitFrames");
--Cache global variables
--Lua functions
local _G = _G
local ns = oUF
local ElvUF = ns.oUF
assert(ElvUF, "ElvUI was unable to locate oUF.")
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.RaidTargetIndicator = UF:Construct_RaidIcon(frame)
frame.InfoPanel = self:Construct_InfoPanel(frame)
frame:SetPoint("BOTTOM", E.UIParent, "BOTTOM", 0, 75)
E:CreateMover(frame, frame:GetName().."Mover", L["TargetTarget Frame"], nil, nil, nil, "ALL,SOLO")
frame.unitframeType = "targettarget";
end
function UF:Update_TargetTargetFrame(frame, db)
frame.db = db
do
frame.ORIENTATION = db.orientation
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 "LeftButtonDown" or "LeftButtonUp", self.db.targetOnMouseDown and "RightButtonDown" or "RightButtonUp")
frame:RegisterForClicks("LeftButtonUp", "RightButtonUp")
frame:SetWidth(frame.UNIT_WIDTH)
frame:SetHeight(frame.UNIT_HEIGHT)
_G[frame:GetName().."Mover"]:SetWidth(frame:GetWidth())
_G[frame:GetName().."Mover"]:SetHeight(frame:GetHeight())
UF:Configure_InfoPanel(frame)
UF:Configure_HealthBar(frame)
UF:UpdateNameSettings(frame)
UF:Configure_Power(frame)
UF:Configure_Portrait(frame)
UF:Configure_RaidIcon(frame)
E:SetMoverSnapOffset(frame:GetName().."Mover", -(12 + self.db["units"].player.castbar.height))
frame:UpdateAllElements("ElvUI_UpdateAllElements")
end
tinsert(UF["unitstoload"], "targettarget")