forked from 0xbs/premade-groups-filter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInit.lua
More file actions
172 lines (156 loc) · 4.01 KB
/
Init.lua
File metadata and controls
172 lines (156 loc) · 4.01 KB
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
-------------------------------------------------------------------------------
-- Premade Groups Filter
-------------------------------------------------------------------------------
-- Copyright (C) 2015 Elotheon-Arthas-EU
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License along
-- with this program; if not, write to the Free Software Foundation, Inc.,
-- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-------------------------------------------------------------------------------
PremadeGroupsFilter = {}
PremadeGroupsFilterState = PremadeGroupsFilterState or {}
local PGFAddonName = select(1, ...)
local PGF = select(2, ...)
PremadeGroupsFilter.Debug = PGF
PGF.L = {}
PGF.C = {}
local L = PGF.L
local C = PGF.C
C.NORMAL = 1
C.HEROIC = 2
C.MYTHIC = 3
C.MYTHICPLUS = 4
-- corresponds to the third parameter of C_LFGList.GetActivityInfo()
C.TYPE_QUESTING = 1
C.TYPE_DUNGEON = 2
C.TYPE_RAID = 3
C.TYPE_ARENA = 4
C.TYPE_SCENARIO = 5
C.TYPE_CUSTOM = 6
C.TYPE_SKIRMISH = 7
C.TYPE_BG = 8
C.TYPE_RBG = 9
C.TYPE_ASHRAN = 10
C.DIFFICULTY_STRING = {
[1] = "normal",
[2] = "heroic",
[3] = "mythic",
[4] = "mythicplus",
}
C.COLOR_ENTRY_NEW = { R = 0.3, G = 1.0, B = 0.3 } -- green
C.COLOR_LOCKOUT_PARTIAL = { R = 1.0, G = 0.5, B = 0.1 } -- orange
C.COLOR_LOCKOUT_FULL = { R = 0.5, G = 0.1, B = 0.1 } -- red
C.COLOR_LOCKOUT_MATCH = { R = 1.0, G = 1.0, B = 1.0 } -- white
C.FONTSIZE_TEXTBOX = 12
C.SEARCH_ENTRY_RESET_WAIT = 2 -- wait at least 2 seconds between two resets of known premade groups
C.ROLE_PREFIX = {
["DAMAGER"] = "dps",
["HEALER"] = "heal",
["TANK"] = "tank",
}
C.ROLE_SUFFIX = {
["DAMAGER"] = "dps",
["HEALER"] = "heals",
["TANK"] = "tanks",
}
C.MODEL_DEFAULT = {
enabled = true,
expression = "",
difficulty = {
act = false,
val = 3,
},
ilvl = {
act = false,
min = "",
max = "",
},
noilvl = {
act = false
},
members = {
act = false,
min = "",
max = "",
},
tanks = {
act = false,
min = "",
max = "",
},
heals = {
act = false,
min = "",
max = "",
},
dps = {
act = false,
min = "",
max = "",
},
defeated = {
act = false,
min = "",
max = "",
},
ad = {
act = false,
},
fh = {
act = false,
},
kr = {
act = false,
},
sob = {
act = false,
},
sots = {
act = false,
},
td = {
act = false,
},
tml = {
act = false,
},
tosl = {
act = false,
},
tur = {
act = false,
},
wm = {
act = false,
},
}
function PGF.OnAddonLoaded(name)
if name == PGFAddonName then
-- check if migration from 1.10 to 1.11 is necessary
if PremadeGroupsFilterState.enabled ~= nil then
local stateV110 = PremadeGroupsFilterState
PremadeGroupsFilterState = {}
PremadeGroupsFilterState.v110 = stateV110
end
-- update all state tables with the current set of defaults
for _, v in pairs(PremadeGroupsFilterState) do
PGF.Table_UpdateWithDefaults(v, PGF.C.MODEL_DEFAULT)
end
end
end
function PGF.OnEvent(self, event, ...)
if event == "ADDON_LOADED" then PGF.OnAddonLoaded(...) end
end
local frame = CreateFrame("Frame", "PremadeGroupsFilterEventFrame")
frame:RegisterEvent("ADDON_LOADED")
frame:SetScript("OnEvent", PGF.OnEvent)