unitframes

This commit is contained in:
Bunny67
2017-12-23 15:49:26 +03:00
parent 0f0e96848d
commit 8091dfe7ed
16 changed files with 209 additions and 154 deletions
@@ -42,7 +42,7 @@ local function Update(self, event)
end end
local unit = self.unit local unit = self.unit
local isAssistant = UnitInRaid(unit) and UnitIsRaidOfficer(unit) and not UnitIsPartyLeader(unit) local isAssistant = UnitInRaid(unit) and not UnitIsPartyLeader(unit)
if(isAssistant) then if(isAssistant) then
element:Show() element:Show()
else else
@@ -68,7 +68,7 @@ local function Path(self, ...)
* event - the event triggering the update (string) * event - the event triggering the update (string)
* ... - the arguments accompanying the event (string) * ... - the arguments accompanying the event (string)
--]] --]]
return (self.AssistantIndicator.Override or Update) (self, ...) return (self.AssistantIndicator.Override or Update) (self, unpack(arg))
end end
local function ForceUpdate(element) local function ForceUpdate(element)
@@ -2,9 +2,9 @@
<Script file="power.lua"/> <Script file="power.lua"/>
<!--<Script file="auras.lua"/>--> <!--<Script file="auras.lua"/>-->
<Script file="health.lua"/> <Script file="health.lua"/>
<!--<Script file="raidtargetindicator.lua"/> <Script file="raidtargetindicator.lua"/>
<Script file="leaderindicator.lua"/> <Script file="leaderindicator.lua"/>
<Script file="combatindicator.lua"/> <!--<Script file="combatindicator.lua"/>
<Script file="restingindicator.lua"/> <Script file="restingindicator.lua"/>
<Script file="pvpindicator.lua"/>--> <Script file="pvpindicator.lua"/>-->
<Script file="portrait.lua"/> <Script file="portrait.lua"/>
@@ -12,9 +12,9 @@
<Script file="range.lua"/> <Script file="range.lua"/>
<Script file="castbar.lua"/>--> <Script file="castbar.lua"/>-->
<Script file="tags.lua"/> <Script file="tags.lua"/>
<!-- <Script file="masterlooterindicator.lua"/> <Script file="masterlooterindicator.lua"/>
<Script file="assistantindicator.lua"/> <Script file="assistantindicator.lua"/>
<Script file="readycheckindicator.lua"/> <!--<Script file="readycheckindicator.lua"/>
<Script file="combopoints.lua"/> <Script file="combopoints.lua"/>
<Script file="raidroleindicator.lua"/> <Script file="raidroleindicator.lua"/>
<Script file="happinessindicator.lua"/> <Script file="happinessindicator.lua"/>
@@ -68,7 +68,7 @@ local function Path(self, ...)
* event - the event triggering the update (string) * event - the event triggering the update (string)
* ... - the arguments accompanying the event * ... - the arguments accompanying the event
--]] --]]
return (self.LeaderIndicator.Override or Update) (self, ...) return (self.LeaderIndicator.Override or Update) (self, unpack(arg))
end end
local function ForceUpdate(element) local function ForceUpdate(element)
@@ -89,7 +89,7 @@ local function Path(self, ...)
* event - the event triggering the update (string) * event - the event triggering the update (string)
* ... - the arguments accompanying the event * ... - the arguments accompanying the event
--]] --]]
return (self.MasterLooterIndicator.Override or Update) (self, ...) return (self.MasterLooterIndicator.Override or Update) (self, unpack(arg))
end end
local function ForceUpdate(element) local function ForceUpdate(element)
@@ -66,7 +66,7 @@ local function Path(self, ...)
* self - the parent object * self - the parent object
* event - the event triggering the update (string) * event - the event triggering the update (string)
--]] --]]
return (self.RaidTargetIndicator.Override or Update) (self, ...) return (self.RaidTargetIndicator.Override or Update) (self, unpack(arg))
end end
local function ForceUpdate(element) local function ForceUpdate(element)
+5
View File
@@ -104,6 +104,9 @@ for k, v in next, {
* unit - unit to be passed to the element's Enable function. Defaults to the frame's unit (string?) * unit - unit to be passed to the element's Enable function. Defaults to the frame's unit (string?)
--]] --]]
EnableElement = function(self, name, unit) EnableElement = function(self, name, unit)
local unit = unit or self.unit
if not unit then return end
argcheck(name, 2, 'string') argcheck(name, 2, 'string')
argcheck(unit or self.unit, 3, 'string', 'nil') argcheck(unit or self.unit, 3, 'string', 'nil')
@@ -312,9 +315,11 @@ local function initObject(unit, style, styleFunc, header, ...)
else else
-- Used to update frames when they change position in a group. -- Used to update frames when they change position in a group.
object:RegisterEvent('RAID_ROSTER_UPDATE', object.UpdateAllElements) object:RegisterEvent('RAID_ROSTER_UPDATE', object.UpdateAllElements)
object:SetScript("OnClick", function() object:SetScript("OnClick", function()
TargetUnit(object.unit) TargetUnit(object.unit)
end) end)
if(num > 1) then if(num > 1) then
if(object:GetParent() == header) then if(object:GetParent() == header) then
object.hasChildren = true object.hasChildren = true
+8 -23
View File
@@ -96,11 +96,9 @@ end
-- Given a point return the opposite point and which axes the point -- Given a point return the opposite point and which axes the point
-- depends on. -- depends on.
local function getRelativePointAnchor(point) local function getRelativePointAnchor(point)
if not point then return end
point = strupper(point) point = strupper(point)
if point == "TOP" then if point == "TOP" then
return "BOTTOM", 0, -1; return "BOTTOM", 0, -1
elseif point == "BOTTOM" then elseif point == "BOTTOM" then
return "TOP", 0, 1 return "TOP", 0, 1
elseif point == "LEFT" then elseif point == "LEFT" then
@@ -121,20 +119,7 @@ local function getRelativePointAnchor( point )
end end
function ApplyUnitButtonConfiguration(frame) function ApplyUnitButtonConfiguration(frame)
-- for i = 1, getn(arg), 1 do RegisterUnitWatch(frame)
-- local frame = arg[i];
--if ( unitWatch ) then
-- if ( unitWatch == "state" ) then
-- RegisterUnitWatch(frame, true);
-- else
RegisterUnitWatch(frame);
-- end
--end
-- call this function recursively for the current frame's children
-- ApplyUnitButtonConfiguration(frame:GetChildren());
-- end
end end
local function ApplyConfig(header, newChild, defaultConfigFunction) local function ApplyConfig(header, newChild, defaultConfigFunction)
@@ -185,7 +170,7 @@ local function configureChildren(self)
local xMultiplier, yMultiplier = abs(xOffsetMult), abs(yOffsetMult) local xMultiplier, yMultiplier = abs(xOffsetMult), abs(yOffsetMult)
local xOffset = self:GetAttribute("xOffset") or 0 --default of 0 local xOffset = self:GetAttribute("xOffset") or 0 --default of 0
local yOffset = self:GetAttribute("yOffset") or 0 --default of 0 local yOffset = self:GetAttribute("yOffset") or 0 --default of 0
local sortDir = self:GetAttribute("sortDir") or "ASC"; --sort ascending by default local sortDir = self:GetAttribute("sortDir") or "ASC" --sort ascending by default
local columnSpacing = self:GetAttribute("columnSpacing") or 0 local columnSpacing = self:GetAttribute("columnSpacing") or 0
local startingIndex = self:GetAttribute("startingIndex") or 1 local startingIndex = self:GetAttribute("startingIndex") or 1
@@ -248,7 +233,7 @@ local function configureChildren(self)
columnNum = columnNum + 1 columnNum = columnNum + 1
end end
local unitButton = self:GetAttribute("child"..buttonNum); local unitButton = self:GetAttribute("child"..buttonNum)
unitButton:Hide() unitButton:Hide()
unitButton:ClearAllPoints() unitButton:ClearAllPoints()
if buttonNum == 1 then if buttonNum == 1 then
@@ -304,7 +289,7 @@ local function GetGroupHeaderType(self)
local nRaid = GetNumRaidMembers() local nRaid = GetNumRaidMembers()
local nParty = GetNumPartyMembers() local nParty = GetNumPartyMembers()
if nRaid > 0 and self:GetAttribute("showRaid") then if nRaid > 0 and self:GetAttribute("showRaid") then
type = "RAID"; type = "RAID"
elseif (nRaid > 0 or nParty > 0) and self:GetAttribute("showParty") then elseif (nRaid > 0 or nParty > 0) and self:GetAttribute("showParty") then
type = "PARTY" type = "PARTY"
elseif self:GetAttribute("showSolo") then elseif self:GetAttribute("showSolo") then
@@ -366,13 +351,13 @@ function SecureGroupHeader_Update(self)
end end
if not groupFilter and not nameList then if not groupFilter and not nameList then
groupFilter = "1,2,3,4,5,6,7,8"; groupFilter = "1,2,3,4,5,6,7,8"
end end
if groupFilter then if groupFilter then
-- filtering by a list of group numbers and/or classes -- filtering by a list of group numbers and/or classes
fillTable(tokenTable, strsplit(",", groupFilter)); fillTable(tokenTable, strsplit(",", groupFilter))
local strictFiltering = self:GetAttribute("strictFiltering"); -- non-strict by default local strictFiltering = self:GetAttribute("strictFiltering") -- non-strict by default
for i = start, stop, 1 do for i = start, stop, 1 do
local unit, name, subgroup, className = GetGroupRosterInfo(type, i) local unit, name, subgroup, className = GetGroupRosterInfo(type, i)
if name and ((not strictFiltering) and (tokenTable[subgroup] or tokenTable[className])) or (tokenTable[subgroup] and tokenTable[className]) then if name and ((not strictFiltering) and (tokenTable[subgroup] or tokenTable[className])) or (tokenTable[subgroup] and tokenTable[className]) then
+9 -9
View File
@@ -1,12 +1,12 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local B = E:GetModule("Bags"); local B = E:GetModule("Bags");
local Search = LibStub("LibItemSearch-1.2"); local Search = LibStub("LibItemSearch-1.2", true);
--Cache global variables --Cache global variables
--Lua functions --Lua functions
local ipairs, pairs, tonumber, select, unpack = ipairs, pairs, tonumber, select, unpack local ipairs, pairs, tonumber, select, unpack = ipairs, pairs, tonumber, select, unpack
local tinsert, tremove, tsort, twipe = table.insert, table.remove, table.sort, table.wipe local tinsert, tremove, tsort, twipe = table.insert, table.remove, table.sort, table.wipe
local floor = math.floor local floor, mod = math.floor, math.mod
local band = bit.band local band = bit.band
local match, gmatch, find = string.match, string.gmatch, string.find local match, gmatch, find = string.match, string.gmatch, string.find
--WoW API / Variables --WoW API / Variables
@@ -371,7 +371,7 @@ function B:Encode_BagSlot(bag, slot)
end end
function B:Decode_BagSlot(int) function B:Decode_BagSlot(int)
return floor(int/100), int % 100 return floor(int/100), mod(int, 100)
end end
function B:IsPartial(bag, slot) function B:IsPartial(bag, slot)
@@ -385,7 +385,7 @@ end
function B:DecodeMove(move) function B:DecodeMove(move)
local s = floor(move/10000) local s = floor(move/10000)
local t = move%10000 local t = mod(move,10000)
s = (t>9000) and (s+1) or s s = (t>9000) and (s+1) or s
t = (t>9000) and (t-10000) or t t = (t>9000) and (t-10000) or t
return s, t return s, t
@@ -444,8 +444,8 @@ function B:CanItemGoInBag(bag, slot, targetBag)
end end
function B.Compress(...) function B.Compress(...)
for i=1, select("#", ...) do for i=1, getn(arg) do
local bags = select(i, ...) local bags = arg[i]
B.Stack(bags, bags, B.IsPartial) B.Stack(bags, bags, B.IsPartial)
end end
end end
@@ -495,7 +495,7 @@ local blackList = {}
local blackListQueries = {} local blackListQueries = {}
local function buildBlacklist(...) local function buildBlacklist(...)
for entry in pairs(...) do for entry in pairs(arg) do
local itemName = GetItemInfo(entry) local itemName = GetItemInfo(entry)
if(itemName) then if(itemName) then
blackList[itemName] = true blackList[itemName] = true
@@ -625,8 +625,8 @@ function B.Fill(sourceBags, targetBags, reverse, canMove)
end end
function B.SortBags(...) function B.SortBags(...)
for i=1, select("#", ...) do for i=1, getn(arg) do
local bags = select(i, ...) local bags = arg[i]
for _, slotNum in ipairs(bags) do for _, slotNum in ipairs(bags) do
local bagType = B:IsSpecialtyBag(slotNum) local bagType = B:IsSpecialtyBag(slotNum)
if bagType == false then bagType = "Normal" end if bagType == false then bagType = "Normal" end
@@ -4,4 +4,6 @@
<Script file="Portrait.lua"/> <Script file="Portrait.lua"/>
<Script file="Power.lua"/> <Script file="Power.lua"/>
<Script file="InfoPanel.lua"/> <Script file="InfoPanel.lua"/>
<Script file="RaidIcon.lua"/>
<Script file="RaidRoleIcons.lua"/>
</Ui> </Ui>
@@ -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\TargetingFrame\UI-RaidTargetingIcons]])
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
@@ -4,11 +4,11 @@ local UF = E:GetModule("UnitFrames")
local _G = _G local _G = _G
local tinsert = table.insert local tinsert = table.insert
local CreateFrame = CreateFrame; local CreateFrame = CreateFrame
local InCombatLockdown = InCombatLockdown; local InCombatLockdown = InCombatLockdown
local UnregisterStateDriver = UnregisterStateDriver; local UnregisterStateDriver = UnregisterStateDriver
local RegisterStateDriver = RegisterStateDriver; local RegisterStateDriver = RegisterStateDriver
local IsInInstance = IsInInstance; local IsInInstance = IsInInstance
local ns = oUF local ns = oUF
local ElvUF = ns.oUF local ElvUF = ns.oUF
@@ -21,17 +21,16 @@ function UF:Construct_PartyFrames()
self.RaisedElementParent = CreateFrame("Frame", nil, self) self.RaisedElementParent = CreateFrame("Frame", nil, self)
self.RaisedElementParent.TextureParent = CreateFrame("Frame", nil, self.RaisedElementParent) self.RaisedElementParent.TextureParent = CreateFrame("Frame", nil, self.RaisedElementParent)
self.RaisedElementParent:SetFrameLevel(self:GetFrameLevel() + 100) self.RaisedElementParent:SetFrameLevel(self:GetFrameLevel() + 100)
self.BORDER = E.Border
self.SPACING = E.Spacing
self.SHADOW_SPACING = 3
self.Health = UF:Construct_HealthBar(self, true, true, "RIGHT"); self.Health = UF:Construct_HealthBar(self, true, true, "RIGHT")
self.Power = UF:Construct_PowerBar(self, true, true, "LEFT"); self.Power = UF:Construct_PowerBar(self, true, true, "LEFT")
self.Power.frequentUpdates = false; self.Power.frequentUpdates = false
self.Portrait3D = UF:Construct_Portrait(self, "model"); self.Portrait3D = UF:Construct_Portrait(self, "model")
self.Portrait2D = UF:Construct_Portrait(self, "texture"); self.Portrait2D = UF:Construct_Portrait(self, "texture")
self.InfoPanel = UF:Construct_InfoPanel(self); self.InfoPanel = UF:Construct_InfoPanel(self)
self.Name = UF:Construct_NameText(self); self.Name = UF:Construct_NameText(self)
self.RaidRoleFramesAnchor = UF:Construct_RaidRoleFrames(self)
self.RaidTargetIndicator = UF:Construct_RaidIcon(self)
self.unitframeType = "party" self.unitframeType = "party"
@@ -52,37 +51,9 @@ function UF:Update_PartyHeader(header, db)
E:CreateMover(header, header:GetName().."Mover", L["Party Frames"], nil, nil, nil, "ALL,PARTY,ARENA") E:CreateMover(header, header:GetName().."Mover", L["Party Frames"], nil, nil, nil, "ALL,PARTY,ARENA")
header.positioned = true header.positioned = true
end
header:RegisterEvent("PLAYER_LOGIN")
header:RegisterEvent("ZONE_CHANGED_NEW_AREA")
header:SetScript("OnEvent", UF["PartySmartVisibility"])
end end
UF.PartySmartVisibility(header)
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
--self.blockVisibilityChanges = true;
--if(not InCombatLockdown()) then
-- local inInstance, instanceType = IsInInstance();
-- if(inInstance and (instanceType == "raid" or instanceType == "pvp")) then
-- UnregisterStateDriver(self, "visibility");
-- self:Hide();
-- self.blockVisibilityChanges = true;
-- 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) function UF:Update_PartyFrames(frame, db)
frame.db = db frame.db = db
@@ -142,8 +113,11 @@ function UF:Update_PartyFrames(frame, db)
UF:Configure_Portrait(frame) UF:Configure_Portrait(frame)
UF:Configure_RaidIcon(frame)
frame:UpdateAllElements("ElvUI_UpdateAllElements"); UF:Configure_RaidRoleIcons(frame)
frame:UpdateAllElements("ElvUI_UpdateAllElements")
end end
UF["headerstoload"]["party"] = true UF["headerstoload"]["party"] = true
@@ -1,7 +1,7 @@
local E, L, V, P, G = unpack(ElvUI) local E, L, V, P, G = unpack(ElvUI)
local UF = E:GetModule("UnitFrames") local UF = E:GetModule("UnitFrames")
local tinsert = table.insert; local tinsert = table.insert
local CreateFrame = CreateFrame local CreateFrame = CreateFrame
local InCombatLockdown = InCombatLockdown local InCombatLockdown = InCombatLockdown
@@ -22,83 +22,36 @@ function UF:Construct_RaidFrames()
self.RaisedElementParent.TextureParent = CreateFrame("Frame", nil, self.RaisedElementParent) self.RaisedElementParent.TextureParent = CreateFrame("Frame", nil, self.RaisedElementParent)
self.RaisedElementParent:SetFrameLevel(self:GetFrameLevel() + 100) self.RaisedElementParent:SetFrameLevel(self:GetFrameLevel() + 100)
self.Health = UF:Construct_HealthBar(self, true, true, "RIGHT"); self.Health = UF:Construct_HealthBar(self, true, true, "RIGHT")
self.Power = UF:Construct_PowerBar(self, true, true, "LEFT"); self.Power = UF:Construct_PowerBar(self, true, true, "LEFT")
self.Power.frequentUpdates = false; self.Power.frequentUpdates = false
self.Portrait3D = UF:Construct_Portrait(self, "model"); self.Portrait3D = UF:Construct_Portrait(self, "model")
self.Portrait2D = UF:Construct_Portrait(self, "texture"); self.Portrait2D = UF:Construct_Portrait(self, "texture")
self.Name = UF:Construct_NameText(self); self.Name = UF:Construct_NameText(self)
self.RaidRoleFramesAnchor = UF:Construct_RaidRoleFrames(self)
self.RaidTargetIndicator = UF:Construct_RaidIcon(self);
self.InfoPanel = UF:Construct_InfoPanel(self); self.InfoPanel = UF:Construct_InfoPanel(self)
UF:Update_StatusBars(); UF:Update_StatusBars()
UF:Update_FontStrings(); UF:Update_FontStrings()
self.unitframeType = "raid"; self.unitframeType = "raid"
UF:Update_RaidFrames(self, UF.db["units"]["raid"]); UF:Update_RaidFrames(self, UF.db["units"]["raid"])
return self; 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 inInstance, instanceType = IsInInstance();
if(inInstance and (instanceType == "raid" or instanceType == "pvp")) then
local _, _, _, _, maxPlayers = GetInstanceInfo();
local mapID = GetCurrentMapAreaID();
if(UF.mapIDs[mapID]) then
maxPlayers = UF.mapIDs[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:Hide();
self.blockVisibilityChanges = true;
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 end
function UF:Update_RaidHeader(header, db) function UF:Update_RaidHeader(header, db)
header.db = db; header.db = db
if not header.positioned then if not header.positioned then
header:ClearAllPoints() header:ClearAllPoints()
header:SetPoint("BOTTOMLEFT", E.UIParent, "BOTTOMLEFT", 4, 195) header:SetPoint("BOTTOMLEFT", E.UIParent, "BOTTOMLEFT", 4, 195)
E:CreateMover(header, header:GetName().."Mover", L["Raid Frames"], nil, nil, nil, "ALL,RAID") E:CreateMover(header, header:GetName().."Mover", L["Raid Frames"], nil, nil, nil, "ALL,RAID")
-- header:RegisterEvent("PLAYER_LOGIN")
-- header:RegisterEvent("ZONE_CHANGED_NEW_AREA")
-- header:SetScript("OnEvent", UF["RaidSmartVisibility"])
header.positioned = true header.positioned = true
end end
--UF.RaidSmartVisibility(header)
end end
function UF:Update_RaidFrames(frame, db) function UF:Update_RaidFrames(frame, db)
@@ -161,6 +114,10 @@ function UF:Update_RaidFrames(frame, db)
UF:Configure_Portrait(frame) UF:Configure_Portrait(frame)
UF:Configure_RaidIcon(frame)
UF:Configure_RaidRoleIcons(frame)
frame:UpdateAllElements("ElvUI_UpdateAllElements") frame:UpdateAllElements("ElvUI_UpdateAllElements")
end end
@@ -22,7 +22,7 @@ function UF:Construct_PlayerFrame(frame)
frame.Portrait3D = self:Construct_Portrait(frame, "model") frame.Portrait3D = self:Construct_Portrait(frame, "model")
frame.Portrait2D = self:Construct_Portrait(frame, "texture") frame.Portrait2D = self:Construct_Portrait(frame, "texture")
frame.RaidTargetIndicator = UF:Construct_RaidIcon(frame)
frame.InfoPanel = self:Construct_InfoPanel(frame) frame.InfoPanel = self:Construct_InfoPanel(frame)
frame:SetPoint("BOTTOMLEFT", E.UIParent, "BOTTOM", -413, 68) frame:SetPoint("BOTTOMLEFT", E.UIParent, "BOTTOM", -413, 68)
@@ -91,6 +91,8 @@ function UF:Update_PlayerFrame(frame, db)
UF:Configure_Portrait(frame) UF:Configure_Portrait(frame)
UF:Configure_RaidIcon(frame)
E:SetMoverSnapOffset(frame:GetName().."Mover", -(12 + db.castbar.height)) E:SetMoverSnapOffset(frame:GetName().."Mover", -(12 + db.castbar.height))
frame:UpdateAllElements("ElvUI_UpdateAllElements") frame:UpdateAllElements("ElvUI_UpdateAllElements")
end end
@@ -20,7 +20,7 @@ function UF:Construct_TargetFrame(frame)
frame.Portrait3D = self:Construct_Portrait(frame, "model") frame.Portrait3D = self:Construct_Portrait(frame, "model")
frame.Portrait2D = self:Construct_Portrait(frame, "texture") frame.Portrait2D = self:Construct_Portrait(frame, "texture")
frame.RaidTargetIndicator = UF:Construct_RaidIcon(frame)
frame.InfoPanel = self:Construct_InfoPanel(frame) frame.InfoPanel = self:Construct_InfoPanel(frame)
frame:SetPoint("BOTTOMRIGHT", E.UIParent, "BOTTOM", 413, 68) frame:SetPoint("BOTTOMRIGHT", E.UIParent, "BOTTOM", 413, 68)
@@ -87,6 +87,8 @@ function UF:Update_TargetFrame(frame, db)
UF:Configure_Portrait(frame) UF:Configure_Portrait(frame)
UF:Configure_RaidIcon(frame)
E:SetMoverSnapOffset(frame:GetName().."Mover", -(12 + db.castbar.height)) E:SetMoverSnapOffset(frame:GetName().."Mover", -(12 + db.castbar.height))
frame:UpdateAllElements("ElvUI_UpdateAllElements") frame:UpdateAllElements("ElvUI_UpdateAllElements")
end end
@@ -15,7 +15,7 @@ function UF:Construct_TargetTargetFrame(frame)
frame.Name = self:Construct_NameText(frame) frame.Name = self:Construct_NameText(frame)
frame.Portrait3D = self:Construct_Portrait(frame, "model") frame.Portrait3D = self:Construct_Portrait(frame, "model")
frame.Portrait2D = self:Construct_Portrait(frame, "texture") frame.Portrait2D = self:Construct_Portrait(frame, "texture")
frame.RaidTargetIndicator = UF:Construct_RaidIcon(frame)
frame.InfoPanel = self:Construct_InfoPanel(frame) frame.InfoPanel = self:Construct_InfoPanel(frame)
frame:SetPoint("BOTTOM", E.UIParent, "BOTTOM", 0, 75) frame:SetPoint("BOTTOM", E.UIParent, "BOTTOM", 0, 75)
@@ -72,6 +72,8 @@ function UF:Update_TargetTargetFrame(frame, db)
UF:Configure_Portrait(frame) UF:Configure_Portrait(frame)
UF:Configure_RaidIcon(frame)
E:SetMoverSnapOffset(frame:GetName().."Mover", -(12 + self.db["units"].player.castbar.height)) E:SetMoverSnapOffset(frame:GetName().."Mover", -(12 + self.db["units"].player.castbar.height))
frame:UpdateAllElements("ElvUI_UpdateAllElements") frame:UpdateAllElements("ElvUI_UpdateAllElements")
end end