Skip to content
This repository has been archived by the owner on Jun 2, 2021. It is now read-only.

Update unitframes.lua #489

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions ElvUI/modules/unitframes/unitframes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -656,22 +656,20 @@ end

function UF:CreateAndUpdateHeaderGroup(group, groupFilter, template, headerUpdate, headerTemplate)
if InCombatLockdown() then self:RegisterEvent("PLAYER_REGEN_ENABLED") return end

local db = self.db.units[group]
local raidFilter = UF.db.smartRaidFilter
local numGroups = db.numGroups
if raidFilter and numGroups and (self[group] and not self[group].blockVisibilityChanges) then
local inInstance, instanceType = IsInInstance()
if inInstance and (instanceType == "raid" or instanceType == "pvp") then
local _, _, _, _, maxPlayers = GetInstanceInfo()
local _, instanceType, _, _, maxPlayers = GetInstanceInfo()
if instanceType == "raid" or instanceType == "pvp" then
local mapID = GetCurrentMapAreaID()

if UF.mapIDs[mapID] then
maxPlayers = UF.mapIDs[mapID]
end

if maxPlayers > 0 then
numGroups = E:Round(maxPlayers / 5)
numGroups = E:Round(maxPlayers/5)
end
end
end
Expand Down Expand Up @@ -714,24 +712,24 @@ function UF:CreateAndUpdateHeaderGroup(group, groupFilter, template, headerUpdat
end
end

UF.headerFunctions[group]:AdjustVisibility(self[group])
-- UF.headerFunctions[group]:AdjustVisibility(self[group])

if headerUpdate or not self[group].mover then
UF.headerFunctions[group]:Configure_Groups(self[group])
if not self[group].isForced and not self[group].blockVisibilityChanges then
RegisterStateDriver(self[group], "visibility", db.visibility)
end

--[[if not self[group].mover then
if not self[group].mover then
UF.headerFunctions[group]:Update(self[group])
UF.headerFunctions[group]:UpdateHeader(self[group])
end]]
end
else
UF.headerFunctions[group]:Configure_Groups(self[group])
UF.headerFunctions[group]:UpdateHeader(self[group])
UF.headerFunctions[group]:Update(self[group])
end

UF.headerFunctions[group]:AdjustVisibility(self[group])

if db.enable then
if self[group].mover then
E:EnableMover(self[group].mover:GetName())
Expand All @@ -749,7 +747,7 @@ function UF:CreateAndUpdateHeaderGroup(group, groupFilter, template, headerUpdat

if not UF.headerFunctions[group] then UF.headerFunctions[group] = {} end
UF.headerFunctions[group].Update = function()
local db = UF.db.units[group]
-- local db = UF.db.units[group]
if db.enable ~= true then
UnregisterStateDriver(UF[group], "visibility")
UF[group]:Hide()
Expand Down Expand Up @@ -1194,4 +1192,4 @@ local function InitializeCallback()
UF:Initialize()
end

E:RegisterInitialModule(UF:GetName(), InitializeCallback)
E:RegisterInitialModule(UF:GetName(), InitializeCallback)