-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathzonefilters.lua
114 lines (93 loc) · 3.06 KB
/
zonefilters.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
local Recount = _G.Recount
local revision = tonumber(string.sub("$Revision: 1445 $", 12, -3))
if Recount.Version < revision then
Recount.Version = revision
end
local C_Scenario = C_Scenario
local GetZonePVPInfo = GetZonePVPInfo
local IsInInstance = IsInInstance
local UnitIsGhost = UnitIsGhost
function Recount:SetZoneFilter(instanceType)
if not instanceType then
return
end
if Recount.db.profile.ZoneFilters[instanceType] then
if Recount.db.profile.HideCollect and not Recount.CurrentDataCollect and Recount.db.profile.GlobalDataCollect then
Recount.MainWindow:Show()
Recount:RefreshMainWindow()
end
Recount.CurrentDataCollect = true
else
if Recount.db.profile.HideCollect and (Recount.CurrentDataCollect or not Recount.db.profile.GlobalDataCollect) then
Recount.MainWindow:Hide()
end
Recount.CurrentDataCollect = false
end
end
-- Elsia: This handles filters for groupings
-- groupType: 1 solo, 2 party, 3 raid
function Recount:SetGroupFilter(groupType)
if Recount.db.profile.GroupFilters[groupType] then
if Recount.db.profile.HideCollect and not Recount.CurrentDataCollect and Recount.db.profile.GlobalDataCollect then
Recount.MainWindow:Show()
Recount:RefreshMainWindow()
end
Recount.CurrentDataCollect = true
else
if Recount.db.profile.HideCollect and (Recount.CurrentDataCollect or not Recount.db.profile.GlobalDataCollect) then
Recount.MainWindow:Hide()
end
Recount.CurrentDataCollect = false
end
end
-- Elsia: This handles the combined case of group/zone filtering
function Recount:SetZoneGroupFilter(instanceType, groupType)
if not instanceType or not groupType then
return
end
if Recount.db.profile.ZoneFilters[instanceType] and Recount.db.profile.GroupFilters[groupType] then
if Recount.db.profile.HideCollect and not Recount.MainWindow:IsShown() and Recount.db.profile.GlobalDataCollect then
Recount.MainWindow:Show()
Recount:RefreshMainWindow()
end
Recount.CurrentDataCollect = true
else
if Recount.db.profile.HideCollect and Recount.MainWindow:IsShown() or not Recount.db.profile.GlobalDataCollect then
Recount.MainWindow:Hide()
end
Recount.CurrentDataCollect = false
end
end
-- Elsia: Main entry, call this to update main window visibility based on collection filters
function Recount:UpdateZoneGroupFilter()
local groupType
if Recount.inRaid then
groupType = 3
elseif Recount.inGroup then
groupType = 2
else
groupType = 1
end
local _, instanceType = IsInInstance()
if not instanceType then
_, instanceType = C_Scenario.IsInScenario()
end
if instanceType == "none" then -- Check if we are in an open area combat zone (ala Wintergrasp)
local pvpType = GetZonePVPInfo()
if pvpType == "combat" then
instanceType = "pvp"
end
end
if not UnitIsGhost(Recount.PlayerName) then
Recount:SetZoneGroupFilter(instanceType, groupType)
end -- Use zone-based filters
end
function Recount:GetGroupState(groupType)
if groupType == 3 then
return Recount.inRaid
elseif groupType == 2 then
return not Recount.inRaid and Recount.inGroup
else
return not Recount.inRaid and not Recount.inGroup
end
end