-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Core.lua
50 lines (45 loc) · 1.71 KB
/
Core.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
PFR_Core = PFR:NewModule("PFR_Core")
function PFR_Core:OnEnable()
function PFR:Update(self)
if self:IsForbidden() then return end
if InCombatLockdown() then return end
local name = self:GetName()
if name and name:match("^CompactPartyFrameMember") then
self:SetWidth(PFR_DB.width)
self:SetHeight(PFR_DB.height)
self.statusText:ClearAllPoints()
self.statusText:SetPoint("CENTER", self, "CENTER")
self.centerStatusIcon:ClearAllPoints()
self.centerStatusIcon:SetPoint("CENTER", self, "CENTER")
elseif name and name:match("^CompactPartyFramePet") then
self:SetWidth(PFR_DB.width)
end
end
local eventFrame = CreateFrame("Frame")
eventFrame:RegisterEvent("PLAYER_REGEN_DISABLED")
eventFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
eventFrame:SetScript("OnEvent", function(_, event)
local partyFrames = {
CompactPartyFrameMember1,
CompactPartyFrameMember2,
CompactPartyFrameMember3,
CompactPartyFrameMember4,
CompactPartyFrameMember5
}
if event == "PLAYER_REGEN_DISABLED" then
CompactPartyFrame:UnregisterEvent("GROUP_ROSTER_UPDATE")
for i = 1, #partyFrames do
partyFrames[i]:UnregisterEvent("UNIT_PET")
end
else
CompactPartyFrame:RegisterEvent("GROUP_ROSTER_UPDATE")
for i = 1, #partyFrames do
partyFrames[i]:RegisterEvent("UNIT_PET")
PFR:Update(partyFrames[i])
end
end
end)
hooksecurefunc("CompactUnitFrame_UpdateAll", function(self)
PFR:Update(self)
end)
end