|
ShadowTheAge@0
|
1 CrossRealmAssist = LibStub("AceAddon-3.0"):NewAddon("CrossRealmAssist", "AceEvent-3.0", "AceConsole-3.0", "AceTimer-3.0")
|
|
ShadowTheAge@0
|
2 local addon = CrossRealmAssist;
|
|
ShadowTheAge@0
|
3 local wholib = LibStub:GetLibrary('LibWho-2.0'):Library()
|
|
ShadowTheAge@12
|
4 local ScrollingTable = LibStub("ScrollingTable");
|
|
ShadowTheAge@13
|
5 local ldb = LibStub("LibDataBroker-1.1")
|
|
ShadowTheAge@13
|
6 local minimapIcon = LibStub("LibDBIcon-1.0")
|
|
ShadowTheAge@13
|
7 local db
|
|
ShadowTheAge@0
|
8
|
|
ShadowTheAge@13
|
9 local homeRealm, realmSep, gui, btRefresh, btSettings, btQuick, btManual, lbRealm, lbStatus, playerName, lfgui, lfgTabSelected, lfgTable, lbThrottle, curLfgGroup, sheduledScan, wasInGroup, inInstance
|
|
ShadowTheAge@13
|
10 local settingsMenu
|
|
ShadowTheAge@13
|
11 local hintShown
|
|
ShadowTheAge@0
|
12
|
|
ShadowTheAge@12
|
13 local tabs = {}
|
|
ShadowTheAge@11
|
14 local curRealmStat
|
|
ShadowTheAge@0
|
15 local scanstate=0
|
|
ShadowTheAge@0
|
16 local recentRealms={}
|
|
ShadowTheAge@12
|
17 local recentgroups={}
|
|
ShadowTheAge@13
|
18 local autoScanGroups={}
|
|
ShadowTheAge@0
|
19 local active=false
|
|
ShadowTheAge@0
|
20
|
|
ShadowTheAge@0
|
21 local lfgGroups={
|
|
ShadowTheAge@0
|
22 6, -- Custom
|
|
ShadowTheAge@0
|
23 10, -- Ashran
|
|
ShadowTheAge@0
|
24 1, -- Quests
|
|
ShadowTheAge@13
|
25 3, -- Raids
|
|
ShadowTheAge@13
|
26 8 -- BGs
|
|
ShadowTheAge@0
|
27 }
|
|
ShadowTheAge@0
|
28
|
|
ShadowTheAge@12
|
29 local StatusTable = {
|
|
ShadowTheAge@12
|
30 ["invited"]="Invited",
|
|
ShadowTheAge@12
|
31 ["declined"]="Declined",
|
|
ShadowTheAge@12
|
32 ["timedout"]="Timed out",
|
|
ShadowTheAge@12
|
33 ["applied"]="Applied",
|
|
ShadowTheAge@12
|
34 ["cancelled"]="Join cancelled",
|
|
ShadowTheAge@12
|
35 ["inviteaccepted"]="Joined",
|
|
ShadowTheAge@13
|
36 ["_init"]="Join request",
|
|
ShadowTheAge@13
|
37 ["_skip"]="Skipped"
|
|
ShadowTheAge@12
|
38 }
|
|
ShadowTheAge@13
|
39 local DefaultWidgetPos = {x=0, y=200, to="CENTER"}
|
|
ShadowTheAge@13
|
40 local SettingsDefaults={
|
|
ShadowTheAge@13
|
41 global={
|
|
ShadowTheAge@13
|
42 minimap = {},
|
|
ShadowTheAge@13
|
43 widgetPos=DefaultWidgetPos,
|
|
ShadowTheAge@13
|
44 quickJoinHint = true,
|
|
ShadowTheAge@13
|
45 quickJoin={[6]=1,[10]=1}
|
|
ShadowTheAge@13
|
46 }
|
|
ShadowTheAge@13
|
47 }
|
|
ShadowTheAge@12
|
48
|
|
ShadowTheAge@12
|
49
|
|
ShadowTheAge@12
|
50 -- Utils functions
|
|
ShadowTheAge@12
|
51
|
|
ShadowTheAge@12
|
52 local function PlayerName(fullname)
|
|
ShadowTheAge@12
|
53 fullname = fullname or "???-???"
|
|
ShadowTheAge@12
|
54 local name, realm = strsplit(realmSep, fullname)
|
|
ShadowTheAge@12
|
55 realm = realm or homeRealm;
|
|
ShadowTheAge@12
|
56 return name, realm;
|
|
ShadowTheAge@12
|
57 end
|
|
ShadowTheAge@12
|
58
|
|
ShadowTheAge@12
|
59 local function canJoinGroup()
|
|
ShadowTheAge@12
|
60 return (not IsInGroup()) or (UnitIsGroupLeader('player') and not IsInRaid())
|
|
ShadowTheAge@12
|
61 end
|
|
ShadowTheAge@12
|
62
|
|
ShadowTheAge@12
|
63 local function sortByWeight(a,b)
|
|
ShadowTheAge@12
|
64 return b.weight < a.weight
|
|
ShadowTheAge@12
|
65 end
|
|
ShadowTheAge@12
|
66
|
|
ShadowTheAge@12
|
67
|
|
ShadowTheAge@12
|
68 -- UI functions
|
|
ShadowTheAge@12
|
69
|
|
ShadowTheAge@12
|
70 local function createIcon(owner, icon, id)
|
|
ShadowTheAge@12
|
71 local image = owner:CreateTexture(nil, "BACKGROUND")
|
|
ShadowTheAge@12
|
72 image:SetWidth(16)
|
|
ShadowTheAge@12
|
73 image:SetHeight(16)
|
|
ShadowTheAge@12
|
74 image:SetTexture(icon)
|
|
ShadowTheAge@12
|
75 image:SetPoint("TOPLEFT",owner,"TOPLEFT",id*16,0)
|
|
ShadowTheAge@12
|
76 return image
|
|
ShadowTheAge@12
|
77 end
|
|
ShadowTheAge@0
|
78
|
|
ShadowTheAge@11
|
79 local function setupWidget(widget, parameters, x, y)
|
|
ShadowTheAge@11
|
80 if parameters then
|
|
ShadowTheAge@11
|
81 for key,value in pairs(parameters) do widget[key](widget,value) end
|
|
ShadowTheAge@11
|
82 end
|
|
ShadowTheAge@11
|
83 if y then
|
|
ShadowTheAge@11
|
84 widget:SetPoint("TOPLEFT",widget:GetParent(),"TOPLEFT",x,-y)
|
|
ShadowTheAge@11
|
85 end
|
|
ShadowTheAge@11
|
86 return widget
|
|
ShadowTheAge@11
|
87 end
|
|
ShadowTheAge@11
|
88
|
|
ShadowTheAge@11
|
89 local function ShowTooltip(widget)
|
|
ShadowTheAge@11
|
90 GameTooltip:SetOwner(widget, widget.TooltipAnchor)
|
|
ShadowTheAge@11
|
91 GameTooltip:ClearLines()
|
|
ShadowTheAge@11
|
92 widget:TooltipFactory()
|
|
ShadowTheAge@11
|
93 GameTooltip:Show()
|
|
ShadowTheAge@11
|
94 end
|
|
ShadowTheAge@11
|
95
|
|
ShadowTheAge@11
|
96 local function HideTooltip(widget)
|
|
ShadowTheAge@11
|
97 GameTooltip:Hide()
|
|
ShadowTheAge@11
|
98 end
|
|
ShadowTheAge@11
|
99
|
|
ShadowTheAge@11
|
100 local function setupTooltip(widget, anchor, factory)
|
|
ShadowTheAge@11
|
101 widget.TooltipAnchor = anchor;
|
|
ShadowTheAge@11
|
102 widget.TooltipFactory = factory;
|
|
ShadowTheAge@11
|
103 widget:SetScript("OnEnter", ShowTooltip)
|
|
ShadowTheAge@11
|
104 widget:SetScript("OnLeave", HideTooltip)
|
|
ShadowTheAge@11
|
105 end
|
|
ShadowTheAge@11
|
106
|
|
ShadowTheAge@13
|
107 local function TabClick(tab)
|
|
ShadowTheAge@13
|
108 if tab == lfgTabSelected then return end
|
|
ShadowTheAge@13
|
109 addon.LfgScan(tab.searchID)
|
|
ShadowTheAge@13
|
110 end
|
|
ShadowTheAge@13
|
111
|
|
ShadowTheAge@13
|
112 local function changeTab(tab)
|
|
ShadowTheAge@12
|
113 PanelTemplates_DeselectTab(lfgTabSelected)
|
|
ShadowTheAge@12
|
114 lfgTabSelected = tab
|
|
ShadowTheAge@12
|
115 PanelTemplates_SelectTab(lfgTabSelected)
|
|
ShadowTheAge@12
|
116 end
|
|
ShadowTheAge@0
|
117
|
|
ShadowTheAge@12
|
118 local function realmToolip()
|
|
ShadowTheAge@12
|
119 if not curRealmStat then return end
|
|
ShadowTheAge@12
|
120 local players = curRealmStat.players;
|
|
ShadowTheAge@12
|
121 local threshold = curRealmStat.threshold
|
|
ShadowTheAge@12
|
122 GameTooltip:AddLine("Players in zone: "..players)
|
|
ShadowTheAge@12
|
123 if not curRealmStat.complete then
|
|
ShadowTheAge@12
|
124 GameTooltip:AppendText("+")
|
|
ShadowTheAge@12
|
125 end
|
|
ShadowTheAge@12
|
126 for i=1,curRealmStat.realms do
|
|
ShadowTheAge@12
|
127 local data = curRealmStat[i]
|
|
ShadowTheAge@12
|
128 local percent = math.ceil(100 * data.count / players - 0.5) .. "%";
|
|
ShadowTheAge@12
|
129 if data.count >= threshold then
|
|
ShadowTheAge@12
|
130 GameTooltip:AddDoubleLine(data.realm, percent, 0,1,0,0,1,0)
|
|
ShadowTheAge@12
|
131 else
|
|
ShadowTheAge@12
|
132 GameTooltip:AddDoubleLine(data.realm, percent, 0.5,0.5,0.5,0.5,0.5,0.5)
|
|
ShadowTheAge@12
|
133 end
|
|
ShadowTheAge@12
|
134 end
|
|
ShadowTheAge@0
|
135 end
|
|
ShadowTheAge@0
|
136
|
|
ShadowTheAge@13
|
137 local function ClearRealmHistory()
|
|
ShadowTheAge@13
|
138 recentRealms = {}
|
|
ShadowTheAge@13
|
139 addon:updateCurrentRealm()
|
|
ShadowTheAge@13
|
140 if lfgTable then lfgTable:Refresh() end
|
|
ShadowTheAge@13
|
141 end
|
|
ShadowTheAge@13
|
142
|
|
ShadowTheAge@12
|
143
|
|
ShadowTheAge@12
|
144
|
|
ShadowTheAge@12
|
145
|
|
ShadowTheAge@12
|
146
|
|
ShadowTheAge@12
|
147
|
|
ShadowTheAge@12
|
148
|
|
ShadowTheAge@12
|
149 -- LFG list data providers, filters and tooltips
|
|
ShadowTheAge@12
|
150
|
|
ShadowTheAge@12
|
151 local lfgScanInProgress=false
|
|
ShadowTheAge@12
|
152 local hasLfgListChanges=false
|
|
ShadowTheAge@12
|
153
|
|
ShadowTheAge@12
|
154 local function addTooltipLineIcon(predicat, text, icon, r, g, b, wrap)
|
|
ShadowTheAge@12
|
155 if predicat then
|
|
ShadowTheAge@12
|
156 GameTooltip:AddLine(text, r, g, b, wrap)
|
|
ShadowTheAge@12
|
157 if icon then GameTooltip:AddTexture(icon) end
|
|
ShadowTheAge@12
|
158 end
|
|
ShadowTheAge@12
|
159 end
|
|
ShadowTheAge@12
|
160
|
|
ShadowTheAge@12
|
161 local function WeightLfgItem(id, forAutoJoin)
|
|
ShadowTheAge@12
|
162 local _, action, caption, desc, voice, ilvl, time, bnetfr, charfr, guild, delisted, fullname, pcount, autoinv = C_LFGList.GetSearchResultInfo(id)
|
|
ShadowTheAge@12
|
163 if delisted then return 0 end
|
|
ShadowTheAge@12
|
164 local name,realm = PlayerName(fullname);
|
|
ShadowTheAge@12
|
165 if forAutoJoin then
|
|
ShadowTheAge@12
|
166 if not autoinv or pcount >= 35 or pcount <= 5 or recentgroups[fullname] then return 0 end
|
|
ShadowTheAge@12
|
167 end
|
|
ShadowTheAge@12
|
168
|
|
ShadowTheAge@12
|
169 local autoinvWeight = autoinv and 5 or 2
|
|
ShadowTheAge@12
|
170
|
|
ShadowTheAge@12
|
171 local visCoef = 1
|
|
ShadowTheAge@12
|
172 if recentgroups[fullname] then
|
|
ShadowTheAge@12
|
173 local ago = GetTime() - recentgroups[fullname].time;
|
|
ShadowTheAge@12
|
174 visCoef = math.min(1,ago/600)
|
|
ShadowTheAge@12
|
175 end
|
|
ShadowTheAge@12
|
176
|
|
ShadowTheAge@12
|
177 local leaderRealm = 3 -- recently visited realms
|
|
ShadowTheAge@13
|
178 local realmVis = recentRealms[realm]
|
|
ShadowTheAge@13
|
179 local leaderRealm = 3;
|
|
ShadowTheAge@13
|
180 if realmVis then
|
|
ShadowTheAge@13
|
181 local ago = GetTime() - realmVis
|
|
ShadowTheAge@13
|
182 leaderRealm = 1 + 2*math.min(1,ago/600);
|
|
ShadowTheAge@13
|
183 end
|
|
ShadowTheAge@12
|
184
|
|
ShadowTheAge@12
|
185 local countWeight = 4 -- count weight
|
|
ShadowTheAge@12
|
186 if pcount >= 39 or pcount <= 1 then countWeight = 1
|
|
ShadowTheAge@12
|
187 elseif pcount >= 35 or pcount <= 4 then countWeight = 2
|
|
ShadowTheAge@12
|
188 elseif pcount >= 30 or pcount <= 10 then countWeight = 3
|
|
ShadowTheAge@12
|
189 else countWeight = 4 end
|
|
ShadowTheAge@12
|
190
|
|
ShadowTheAge@12
|
191 local ageWeight = 2
|
|
ShadowTheAge@12
|
192 if time > 1200 then ageWeight = 4
|
|
ShadowTheAge@12
|
193 elseif time > 300 then ageWeight = 3 end
|
|
ShadowTheAge@12
|
194
|
|
ShadowTheAge@12
|
195 return leaderRealm * countWeight * visCoef * autoinvWeight * ageWeight;
|
|
ShadowTheAge@12
|
196 end
|
|
ShadowTheAge@12
|
197
|
|
ShadowTheAge@13
|
198 local function AddLfgGroupInfo(id, short)
|
|
ShadowTheAge@13
|
199 local _, action, caption, desc, voice, ilvl, time, bnetfr, charfr, guild, delisted, fullname, pcount, autoinv = C_LFGList.GetSearchResultInfo(id)
|
|
ShadowTheAge@12
|
200 local friends = bnetfr+charfr+guild
|
|
ShadowTheAge@12
|
201 GameTooltip:ClearLines()
|
|
ShadowTheAge@12
|
202 GameTooltip:AddLine(caption,1,1,1)
|
|
ShadowTheAge@12
|
203 addTooltipLineIcon(desc ~= "", desc, nil, 0.5, 0.5, 0.5, true)
|
|
ShadowTheAge@12
|
204 local name, realm = PlayerName(fullname)
|
|
ShadowTheAge@13
|
205 GameTooltip:AddDoubleLine("Players:",pcount)
|
|
ShadowTheAge@12
|
206 GameTooltip:AddDoubleLine("Leader:",name)
|
|
ShadowTheAge@12
|
207 GameTooltip:AddDoubleLine("Leader realm:",realm)
|
|
ShadowTheAge@13
|
208 if recentRealms[realm] then
|
|
ShadowTheAge@13
|
209 local ago = GetTime() - recentRealms[realm]
|
|
ShadowTheAge@13
|
210 GameTooltip:AddDoubleLine("Realm visited",SecondsToTime(ago, false, false, 1, false).." ago",1,0.5,0,1,0.5,0)
|
|
ShadowTheAge@13
|
211 else
|
|
ShadowTheAge@13
|
212 GameTooltip:AddDoubleLine(" ","Realm not visited!",0,0,0,0,1,0)
|
|
ShadowTheAge@13
|
213 end
|
|
ShadowTheAge@13
|
214 if not short then
|
|
ShadowTheAge@13
|
215 addTooltipLineIcon(ilvl > 0, "Min. ilvl: "..ilvl, READY_CHECK_WAITING_TEXTURE, 1, 1, 0)
|
|
ShadowTheAge@13
|
216 addTooltipLineIcon(voice ~= "", "Voice: "..voice, READY_CHECK_WAITING_TEXTURE, 1, 1, 0)
|
|
ShadowTheAge@13
|
217 addTooltipLineIcon(friends > 0, "Friends: "..friends, READY_CHECK_WAITING_TEXTURE, 1, 1, 0)
|
|
ShadowTheAge@13
|
218 addTooltipLineIcon(autoinv, "Autoinvite!", READY_CHECK_READY_TEXTURE, 0, 1, 0)
|
|
ShadowTheAge@13
|
219 local visitinfo = recentgroups[fullname]
|
|
ShadowTheAge@13
|
220 if visitinfo then
|
|
ShadowTheAge@13
|
221 local ago = GetTime() - visitinfo.time;
|
|
ShadowTheAge@13
|
222 GameTooltip:AddDoubleLine(StatusTable[visitinfo.status] or visitinfo.status,SecondsToTime(ago, false, false, 1, false).." ago",1,0,0,1,0,0)
|
|
ShadowTheAge@13
|
223 GameTooltip:AddTexture(READY_CHECK_NOT_READY_TEXTURE)
|
|
ShadowTheAge@13
|
224 end
|
|
ShadowTheAge@12
|
225 end
|
|
ShadowTheAge@12
|
226 GameTooltip:Show()
|
|
ShadowTheAge@12
|
227 end
|
|
ShadowTheAge@12
|
228
|
|
ShadowTheAge@13
|
229 local function ShowLfgInfo(rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...)
|
|
ShadowTheAge@13
|
230 if not realrow then return end
|
|
ShadowTheAge@13
|
231 local rowdata = scrollingTable:GetRow(realrow);
|
|
ShadowTheAge@13
|
232 GameTooltip:SetOwner(rowFrame, "ANCHOR_BOTTOMLEFT",-10,25)
|
|
ShadowTheAge@13
|
233 AddLfgGroupInfo(rowdata.id);
|
|
ShadowTheAge@13
|
234 end
|
|
ShadowTheAge@13
|
235
|
|
ShadowTheAge@12
|
236 local function updateTableData(rowFrame, cellFrame, data, cols, row, realrow, column, fShow, table, ...)
|
|
ShadowTheAge@12
|
237 if fShow then
|
|
ShadowTheAge@12
|
238 local rowdata = table:GetRow(realrow);
|
|
ShadowTheAge@12
|
239 local icons = cellFrame.icons
|
|
ShadowTheAge@12
|
240 local _, action, caption, desc, voice, ilvl, time, bnetfr, charfr, guild, delisted, fullname, pcount, autoinv = C_LFGList.GetSearchResultInfo(rowdata.id)
|
|
ShadowTheAge@12
|
241 if not icons then
|
|
ShadowTheAge@12
|
242 local miscdata = createIcon(cellFrame,READY_CHECK_WAITING_TEXTURE,0)
|
|
ShadowTheAge@12
|
243 local autoinv = createIcon(cellFrame,READY_CHECK_READY_TEXTURE, 1)
|
|
ShadowTheAge@12
|
244 local visited = createIcon(cellFrame,READY_CHECK_NOT_READY_TEXTURE, 2)
|
|
ShadowTheAge@12
|
245 icons = {misc=miscdata, autoinv=autoinv, visited=visited}
|
|
ShadowTheAge@12
|
246 cellFrame.icons = icons
|
|
ShadowTheAge@12
|
247 end
|
|
ShadowTheAge@12
|
248 icons.misc:SetShown(voice ~= "" or bnetfr > 0 or charfr > 0 or guild > 0 or ilvl > 0)
|
|
ShadowTheAge@12
|
249 icons.autoinv:SetShown(autoinv)
|
|
ShadowTheAge@12
|
250 icons.visited:SetShown(recentgroups[fullname])
|
|
ShadowTheAge@12
|
251 if GameTooltip:GetOwner() == rowFrame then ShowLfgInfo(rowFrame, cellFrame, data, cols, row, realrow, column, table) end
|
|
ShadowTheAge@12
|
252 end
|
|
ShadowTheAge@12
|
253 end
|
|
ShadowTheAge@12
|
254
|
|
ShadowTheAge@12
|
255 local function updateGroupName(id)
|
|
ShadowTheAge@12
|
256 return select(3, C_LFGList.GetSearchResultInfo(id))
|
|
ShadowTheAge@12
|
257 end
|
|
ShadowTheAge@12
|
258
|
|
ShadowTheAge@12
|
259 local function updateGroupCount(id)
|
|
ShadowTheAge@12
|
260 return select(13, C_LFGList.GetSearchResultInfo(id))
|
|
ShadowTheAge@12
|
261 end
|
|
ShadowTheAge@12
|
262
|
|
ShadowTheAge@12
|
263 local function updateGroupRealm(id)
|
|
ShadowTheAge@12
|
264 local name = select(12, C_LFGList.GetSearchResultInfo(id))
|
|
ShadowTheAge@12
|
265 local pname, realm = PlayerName(name);
|
|
ShadowTheAge@12
|
266 return realm
|
|
ShadowTheAge@12
|
267 end
|
|
ShadowTheAge@12
|
268
|
|
ShadowTheAge@13
|
269 local COLOR_YELLOW = {r=1,g=1,b=0,a=1}
|
|
ShadowTheAge@13
|
270 local COLOR_GREEN = {r=0,g=1,b=0,a=1}
|
|
ShadowTheAge@13
|
271 local function updateRealmColor(id)
|
|
ShadowTheAge@13
|
272 local name = select(12, C_LFGList.GetSearchResultInfo(id))
|
|
ShadowTheAge@13
|
273 local pname, realm = PlayerName(name);
|
|
ShadowTheAge@13
|
274 return recentRealms[realm] and COLOR_YELLOW or COLOR_GREEN;
|
|
ShadowTheAge@13
|
275 end
|
|
ShadowTheAge@13
|
276
|
|
ShadowTheAge@12
|
277 local function filterTable(self, row)
|
|
ShadowTheAge@12
|
278 local delisted = select(11, C_LFGList.GetSearchResultInfo(row.id))
|
|
ShadowTheAge@12
|
279 return not delisted;
|
|
ShadowTheAge@12
|
280 end
|
|
ShadowTheAge@12
|
281
|
|
ShadowTheAge@12
|
282 function addon:UpdateResponseData(event, result)
|
|
ShadowTheAge@13
|
283 if not lfgTable then return end
|
|
ShadowTheAge@12
|
284 if select(11, C_LFGList.GetSearchResultInfo(result)) then
|
|
ShadowTheAge@12
|
285 lfgTable:SetFilter(filterTable)
|
|
ShadowTheAge@12
|
286 end
|
|
ShadowTheAge@12
|
287 hasLfgListChanges = true
|
|
ShadowTheAge@12
|
288 end
|
|
ShadowTheAge@12
|
289
|
|
ShadowTheAge@12
|
290 local function refreshLFGList()
|
|
ShadowTheAge@12
|
291 if lfgScanInProgress or not lfgTable then return end
|
|
ShadowTheAge@12
|
292 local count, list = C_LFGList.GetSearchResults()
|
|
ShadowTheAge@12
|
293 local tableData = {}
|
|
ShadowTheAge@12
|
294 for i = 1,count do
|
|
ShadowTheAge@12
|
295 local rid = list[i];
|
|
ShadowTheAge@12
|
296 if not rid then break end
|
|
ShadowTheAge@12
|
297 local data = list[i];
|
|
ShadowTheAge@12
|
298 local cols = {}
|
|
ShadowTheAge@12
|
299 local row = {rid}
|
|
ShadowTheAge@12
|
300 cols[1] = {value=updateGroupName,args=row}
|
|
ShadowTheAge@12
|
301 cols[2] = {value=updateGroupCount,args=row}
|
|
ShadowTheAge@13
|
302 cols[3] = {value=updateGroupRealm,args=row,color=updateRealmColor,colorargs=row}
|
|
ShadowTheAge@12
|
303 cols[4] = {}
|
|
ShadowTheAge@12
|
304 table.insert(tableData, {cols=cols,id=rid,weight=WeightLfgItem(rid)})
|
|
ShadowTheAge@12
|
305 end
|
|
ShadowTheAge@12
|
306 table.sort(tableData, sortByWeight);
|
|
ShadowTheAge@12
|
307 lfgTable:SetData(tableData)
|
|
ShadowTheAge@12
|
308 end
|
|
ShadowTheAge@12
|
309
|
|
ShadowTheAge@13
|
310 local function JoinGroup(rid)
|
|
ShadowTheAge@13
|
311 local tank, heal, dd = C_LFGList.GetAvailableRoles()
|
|
ShadowTheAge@13
|
312 addon:SetGroupJoinStatus(rid, "_init")
|
|
ShadowTheAge@13
|
313 C_LFGList.ApplyToGroup(rid, "", tank, heal, dd)
|
|
ShadowTheAge@13
|
314 end
|
|
ShadowTheAge@13
|
315
|
|
ShadowTheAge@13
|
316 local function TableCellClick(rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...)
|
|
ShadowTheAge@12
|
317 if not realrow or not canJoinGroup() then return end
|
|
ShadowTheAge@12
|
318 local rowdata = scrollingTable:GetRow(realrow);
|
|
ShadowTheAge@13
|
319 JoinGroup(rowdata.id)
|
|
ShadowTheAge@12
|
320 end
|
|
ShadowTheAge@12
|
321
|
|
ShadowTheAge@12
|
322
|
|
ShadowTheAge@12
|
323
|
|
ShadowTheAge@12
|
324
|
|
ShadowTheAge@12
|
325
|
|
ShadowTheAge@12
|
326
|
|
ShadowTheAge@12
|
327 -- Addon functions and gui constructors
|
|
ShadowTheAge@12
|
328
|
|
ShadowTheAge@13
|
329 function addon.ShowMmTooltip(tooltip)
|
|
ShadowTheAge@13
|
330 tooltip:AddLine("Cross Realm Assist",1,1,1)
|
|
ShadowTheAge@13
|
331 tooltip:Show()
|
|
ShadowTheAge@13
|
332 end
|
|
ShadowTheAge@13
|
333
|
|
ShadowTheAge@13
|
334 --[[function addon.MmClick(self, button)
|
|
ShadowTheAge@13
|
335 if button == "RightButton" then
|
|
ShadowTheAge@13
|
336 addon.ShowSettings(self)
|
|
ShadowTheAge@13
|
337 else
|
|
ShadowTheAge@13
|
338 addon:Activate()
|
|
ShadowTheAge@13
|
339 end
|
|
ShadowTheAge@13
|
340 end]]
|
|
ShadowTheAge@13
|
341
|
|
ShadowTheAge@13
|
342 function addon:OnInitialize()
|
|
ShadowTheAge@13
|
343 db = LibStub("AceDB-3.0"):New("CrossRealmAssistDB", SettingsDefaults)
|
|
ShadowTheAge@13
|
344 local minimapData = ldb:NewDataObject("CrossRealmAssistMinimapIcon",{
|
|
ShadowTheAge@13
|
345 type = "data source",
|
|
ShadowTheAge@13
|
346 text = "Cross Realm Assist",
|
|
ShadowTheAge@13
|
347 icon = "Interface/Icons/INV_Misc_GroupNeedMore",
|
|
ShadowTheAge@13
|
348 OnClick = addon.Activate,
|
|
ShadowTheAge@13
|
349 OnTooltipShow = addon.ShowMmTooltip
|
|
ShadowTheAge@13
|
350 })
|
|
ShadowTheAge@13
|
351 minimapIcon:Register("CrossRealmAssistMinimapIcon", minimapData, db.global.minimap)
|
|
ShadowTheAge@13
|
352 end
|
|
ShadowTheAge@13
|
353
|
|
ShadowTheAge@0
|
354 function addon:OnEnable()
|
|
ShadowTheAge@0
|
355 realmSep = _G.REALM_SEPARATORS
|
|
ShadowTheAge@11
|
356 playerName = UnitName("player")
|
|
ShadowTheAge@0
|
357 homeRealm = GetRealmName()
|
|
ShadowTheAge@0
|
358 addon:RegisterChatCommand("cra", "Activate")
|
|
ShadowTheAge@0
|
359 addon:RegisterChatCommand("crossrealmassist", "Activate")
|
|
ShadowTheAge@0
|
360 end
|
|
ShadowTheAge@0
|
361
|
|
ShadowTheAge@0
|
362 function addon:OnDisable()
|
|
ShadowTheAge@0
|
363 addon:Deactivate()
|
|
ShadowTheAge@0
|
364 end
|
|
ShadowTheAge@0
|
365
|
|
ShadowTheAge@0
|
366 function addon:Activate()
|
|
ShadowTheAge@0
|
367 if active then return end
|
|
ShadowTheAge@0
|
368 active=true
|
|
ShadowTheAge@0
|
369 wasInGroup = IsInGroup()
|
|
ShadowTheAge@11
|
370 if not gui then addon:CreateUI() end
|
|
ShadowTheAge@11
|
371 addon:updateCurrentRealm();
|
|
ShadowTheAge@13
|
372 addon:RefreshZoneAndClearHistory();
|
|
ShadowTheAge@11
|
373 gui:Show()
|
|
ShadowTheAge@13
|
374 addon:RegisterEvent("ZONE_CHANGED_NEW_AREA", "RefreshZoneAndClearHistory")
|
|
ShadowTheAge@13
|
375 addon:RegisterEvent("SCENARIO_UPDATE", "RefreshZoneAndClearHistory")
|
|
ShadowTheAge@12
|
376 addon:RegisterEvent("LFG_LIST_SEARCH_RESULTS_RECEIVED", "LfgResponseData")
|
|
ShadowTheAge@12
|
377 addon:RegisterEvent("LFG_LIST_SEARCH_RESULT_UPDATED", "UpdateResponseData")
|
|
ShadowTheAge@12
|
378 addon:RegisterEvent("LFG_LIST_SEARCH_FAILED", "LfgScanFailed")
|
|
ShadowTheAge@12
|
379 addon:RegisterEvent("GROUP_ROSTER_UPDATE", "updatePartyInfo")
|
|
ShadowTheAge@12
|
380 addon:RegisterEvent("LFG_LIST_APPLICATION_STATUS_UPDATED", "updateAppStatus")
|
|
ShadowTheAge@13
|
381 addon.LfgScan(addon.GetNextAutoScanCategory() or 1)
|
|
ShadowTheAge@0
|
382 end
|
|
ShadowTheAge@0
|
383
|
|
ShadowTheAge@0
|
384 function addon:Deactivate()
|
|
ShadowTheAge@0
|
385 if not active then return end
|
|
ShadowTheAge@0
|
386 active = false
|
|
ShadowTheAge@12
|
387 gui:Hide()
|
|
ShadowTheAge@12
|
388 if lfgui then lfgui:Hide() end
|
|
ShadowTheAge@0
|
389 scanstate = 0
|
|
ShadowTheAge@0
|
390 lfgScanInProgress = false
|
|
ShadowTheAge@0
|
391 addon:UnregisterEvent("ZONE_CHANGED_NEW_AREA")
|
|
ShadowTheAge@0
|
392 addon:UnregisterEvent("PLAYER_REGEN_ENABLED")
|
|
ShadowTheAge@0
|
393 addon:UnregisterEvent("LFG_LIST_SEARCH_RESULTS_RECEIVED")
|
|
ShadowTheAge@12
|
394 addon:UnregisterEvent("LFG_LIST_SEARCH_RESULT_UPDATED")
|
|
ShadowTheAge@0
|
395 addon:UnregisterEvent("LFG_LIST_SEARCH_FAILED")
|
|
ShadowTheAge@0
|
396 addon:UnregisterEvent("GROUP_ROSTER_UPDATE")
|
|
ShadowTheAge@0
|
397 addon:UnregisterEvent("LFG_LIST_APPLICATION_STATUS_UPDATED")
|
|
ShadowTheAge@0
|
398 end
|
|
ShadowTheAge@0
|
399
|
|
ShadowTheAge@11
|
400 function addon:SetStatus(status)
|
|
ShadowTheAge@11
|
401 if status then
|
|
ShadowTheAge@11
|
402 lbStatus:SetText(status)
|
|
ShadowTheAge@11
|
403 else
|
|
ShadowTheAge@13
|
404 lbStatus:SetText("")
|
|
ShadowTheAge@11
|
405 end
|
|
ShadowTheAge@11
|
406 end
|
|
ShadowTheAge@11
|
407
|
|
ShadowTheAge@13
|
408 local function stopMovingWidget()
|
|
ShadowTheAge@13
|
409 gui:StopMovingOrSizing()
|
|
ShadowTheAge@13
|
410 local point,_,_,x,y = gui:GetPoint(1);
|
|
ShadowTheAge@13
|
411 db.global.widgetPos = {x=x,y=y,to=point}
|
|
ShadowTheAge@13
|
412 end
|
|
ShadowTheAge@13
|
413
|
|
ShadowTheAge@0
|
414 function addon:CreateUI()
|
|
ShadowTheAge@12
|
415 gui = setupWidget(CreateFrame("Frame","CrossRealmAssistMainUI",nil,"InsetFrameTemplate3"), {SetFrameStrata="LOW",SetWidth=208,SetHeight=60,EnableMouse=true,SetMovable=true})
|
|
ShadowTheAge@11
|
416 local title = setupWidget(CreateFrame("Frame",nil,gui), {SetWidth=190,SetHeight=18,EnableMouse=true,RegisterForDrag="LeftButton"}, 0, 6);
|
|
ShadowTheAge@11
|
417 title:SetScript("OnDragStart", function() gui:StartMoving() end)
|
|
ShadowTheAge@13
|
418 title:SetScript("OnDragStop", stopMovingWidget)
|
|
ShadowTheAge@11
|
419 gui:SetScript("OnHide", addon.Deactivate)
|
|
ShadowTheAge@12
|
420 setupTooltip(title, "ANCHOR_TOP", realmToolip)
|
|
ShadowTheAge@11
|
421
|
|
ShadowTheAge@11
|
422 lbRealm = setupWidget(gui:CreateFontString(nil,"BACKGROUND", "GameFontNormal"), {SetWidth=200,SetHeight=18}, 0, 6)
|
|
ShadowTheAge@11
|
423 lbStatus = setupWidget(gui:CreateFontString(nil,"BACKGROUND", "GameFontHighlightSmallLeft"), {SetWidth=200,SetHeight=10}, 6, 23)
|
|
ShadowTheAge@11
|
424
|
|
ShadowTheAge@12
|
425 btQuick = setupWidget(CreateFrame("Button",nil,gui,"UIMenuButtonStretchTemplate"),{SetWidth=90,SetHeight=20,SetText="Quick join"},4,36)
|
|
ShadowTheAge@13
|
426 btQuick:RegisterForClicks("RightButtonUp","LeftButtonUp")
|
|
ShadowTheAge@12
|
427 btQuick:SetScript("OnClick",addon.DoAutoAction)
|
|
ShadowTheAge@13
|
428 setupTooltip(btQuick, "ANCHOR_BOTTOM", addon.actionTooltip)
|
|
ShadowTheAge@12
|
429 btManual = setupWidget(CreateFrame("Button",nil,gui,"UIMenuButtonStretchTemplate"),{SetWidth=90,SetHeight=20,SetText="Manual join"},94,36)
|
|
ShadowTheAge@12
|
430 btManual:SetScript("OnClick",addon.ShowManualLfg)
|
|
ShadowTheAge@11
|
431 setupWidget(CreateFrame("Button",nil,gui,"UIPanelCloseButton"),{EnableMouse=true,SetWidth=20,SetHeight=20},188,0)
|
|
ShadowTheAge@11
|
432
|
|
ShadowTheAge@13
|
433 btRefresh = setupWidget(CreateFrame("Button",nil,gui,"UIPanelSquareButton"),{SetWidth=20,SetHeight=20},184,16)
|
|
ShadowTheAge@11
|
434 btRefresh.icon:SetTexture("Interface/BUTTONS/UI-RefreshButton")
|
|
ShadowTheAge@11
|
435 btRefresh.icon:SetTexCoord(0,1,0,1);
|
|
ShadowTheAge@11
|
436 btRefresh:SetScript("OnClick",addon.RefreshZone)
|
|
ShadowTheAge@11
|
437
|
|
ShadowTheAge@13
|
438 btSettings = setupWidget(CreateFrame("Button",nil,gui,"UIPanelSquareButton"),{SetWidth=20,SetHeight=20},184,36)
|
|
ShadowTheAge@13
|
439 btSettings.icon:SetTexture("Interface/Worldmap/Gear_64Grey")
|
|
ShadowTheAge@13
|
440 btSettings.icon:SetTexCoord(0.1,0.9,0.1,0.9);
|
|
ShadowTheAge@13
|
441 btSettings:SetScript("OnClick",addon.ShowSettings)
|
|
ShadowTheAge@13
|
442
|
|
ShadowTheAge@13
|
443 local savedPos = db.global.widgetPos
|
|
ShadowTheAge@13
|
444 gui:SetPoint(savedPos.to,savedPos.x,savedPos.y)
|
|
ShadowTheAge@12
|
445 addon:UpdateAutoButtonStatus()
|
|
ShadowTheAge@12
|
446 end
|
|
ShadowTheAge@11
|
447
|
|
ShadowTheAge@12
|
448 function addon:ShowManualLfg()
|
|
ShadowTheAge@12
|
449 if not lfgui then addon:CreateLFGUI() end
|
|
ShadowTheAge@12
|
450 lfgui:Show()
|
|
ShadowTheAge@12
|
451 end
|
|
ShadowTheAge@0
|
452
|
|
ShadowTheAge@12
|
453 function addon.lfgUpdate()
|
|
ShadowTheAge@12
|
454 if hasLfgListChanges then
|
|
ShadowTheAge@12
|
455 lfgTable:Refresh()
|
|
ShadowTheAge@12
|
456 hasLfgListChanges = false
|
|
ShadowTheAge@12
|
457 end
|
|
ShadowTheAge@12
|
458 end
|
|
ShadowTheAge@0
|
459
|
|
ShadowTheAge@12
|
460 function addon:CreateLFGUI()
|
|
ShadowTheAge@12
|
461 lfgui = setupWidget(CreateFrame("Frame","CrossRealmAssistJoinUI",nil,"UIPanelDialogTemplate"), {SetFrameStrata="DIALOG",SetWidth=405,SetHeight=300,EnableMouse=true,SetMovable=true})
|
|
ShadowTheAge@12
|
462 lfgui.title:SetText("Click to join group")
|
|
ShadowTheAge@12
|
463 lfgui:SetScript("OnUpdate",addon.lfgUpdate)
|
|
ShadowTheAge@12
|
464 local titlereg = lfgui:CreateTitleRegion()
|
|
ShadowTheAge@12
|
465 titlereg:SetAllPoints(lfgui.title)
|
|
ShadowTheAge@12
|
466 addon:CreateTabs()
|
|
ShadowTheAge@0
|
467
|
|
ShadowTheAge@12
|
468 lfgTable = ScrollingTable:CreateST({
|
|
ShadowTheAge@12
|
469 {name="Title",width=160},
|
|
ShadowTheAge@12
|
470 {name="#",width=30,align="CENTER"},
|
|
ShadowTheAge@12
|
471 {name="Realm",width=120,align="RIGHT"},
|
|
ShadowTheAge@12
|
472 {name="",width=50,DoCellUpdate=updateTableData}
|
|
ShadowTheAge@12
|
473 },15,16,nil,lfgui);
|
|
ShadowTheAge@0
|
474
|
|
ShadowTheAge@13
|
475 lfgTable:RegisterEvents({OnEnter=ShowLfgInfo,OnLeave=HideTooltip,OnClick=TableCellClick})
|
|
ShadowTheAge@0
|
476
|
|
ShadowTheAge@12
|
477 setupWidget(lfgTable.frame, nil, 10, 45);
|
|
ShadowTheAge@12
|
478 lfgTable.frame:SetBackdrop(nil)
|
|
ShadowTheAge@12
|
479 lfgui:SetPoint("CENTER",0,0)
|
|
ShadowTheAge@12
|
480 refreshLFGList()
|
|
ShadowTheAge@0
|
481
|
|
ShadowTheAge@12
|
482 lbThrottle = setupWidget(lfgui:CreateFontString(nil,"BACKGROUND", "GameFontHighlightSmall"), {SetWidth=300}, 50, 100)
|
|
ShadowTheAge@12
|
483 lbThrottle:Hide();
|
|
ShadowTheAge@0
|
484
|
|
ShadowTheAge@12
|
485 local btRefresh = setupWidget(CreateFrame("Button",nil,lfgui,"UIPanelSquareButton"),{SetWidth=22,SetHeight=22},379,27)
|
|
ShadowTheAge@12
|
486 btRefresh.icon:SetTexture("Interface/BUTTONS/UI-RefreshButton")
|
|
ShadowTheAge@12
|
487 btRefresh.icon:SetTexCoord(0,1,0,1);
|
|
ShadowTheAge@12
|
488 btRefresh:SetScript("OnClick",addon.refreshLfgCurrent)
|
|
ShadowTheAge@12
|
489 end
|
|
ShadowTheAge@0
|
490
|
|
ShadowTheAge@12
|
491 function addon:CreateTabs()
|
|
ShadowTheAge@12
|
492 local prevTab
|
|
ShadowTheAge@12
|
493 for i=1,#lfgGroups do
|
|
ShadowTheAge@12
|
494 local tab = CreateFrame("Button","$parentTab"..i,lfgui,"CharacterFrameTabButtonTemplate")
|
|
ShadowTheAge@12
|
495 tab:SetText((C_LFGList.GetCategoryInfo(lfgGroups[i])));
|
|
ShadowTheAge@13
|
496 tab.searchID = i;
|
|
ShadowTheAge@12
|
497 tab:SetID(i);
|
|
ShadowTheAge@12
|
498 PanelTemplates_TabResize(tab, 0)
|
|
ShadowTheAge@12
|
499 if i == 1 then
|
|
ShadowTheAge@12
|
500 tab:SetPoint("TOPLEFT", lfgui, "BOTTOMLEFT", 10, 7)
|
|
ShadowTheAge@12
|
501 lfgTabSelected = tab
|
|
ShadowTheAge@13
|
502 else
|
|
ShadowTheAge@13
|
503 tab:SetPoint("TOPLEFT", prevTab, "TOPRIGHT",-15,0)
|
|
ShadowTheAge@13
|
504 end
|
|
ShadowTheAge@13
|
505 if curLfgGroup == i then
|
|
ShadowTheAge@12
|
506 PanelTemplates_SelectTab(tab)
|
|
ShadowTheAge@12
|
507 else
|
|
ShadowTheAge@12
|
508 PanelTemplates_DeselectTab(tab)
|
|
ShadowTheAge@12
|
509 end
|
|
ShadowTheAge@13
|
510 tab:SetScript("OnClick", TabClick)
|
|
ShadowTheAge@12
|
511 tabs[i] = tab
|
|
ShadowTheAge@12
|
512 prevTab = tab
|
|
ShadowTheAge@12
|
513 end
|
|
ShadowTheAge@0
|
514 end
|
|
ShadowTheAge@0
|
515
|
|
ShadowTheAge@0
|
516 -- LFG scanning routine
|
|
ShadowTheAge@0
|
517
|
|
ShadowTheAge@12
|
518 function addon.refreshLfgCurrent()
|
|
ShadowTheAge@12
|
519 addon.LfgScan(curLfgGroup)
|
|
ShadowTheAge@0
|
520 end
|
|
ShadowTheAge@0
|
521
|
|
ShadowTheAge@13
|
522 function addon.GetNextAutoScanCategory()
|
|
ShadowTheAge@13
|
523 for i=1,#lfgGroups do
|
|
ShadowTheAge@13
|
524 if not autoScanGroups[i] and db.global.quickJoin[lfgGroups[i]] and i ~= curLfgGroup then return i end
|
|
ShadowTheAge@13
|
525 end
|
|
ShadowTheAge@13
|
526 return nil
|
|
ShadowTheAge@13
|
527 end
|
|
ShadowTheAge@13
|
528
|
|
ShadowTheAge@12
|
529 function addon.LfgScan(group)
|
|
ShadowTheAge@13
|
530 if lfgTable then
|
|
ShadowTheAge@13
|
531 lfgTable:SetData({})
|
|
ShadowTheAge@13
|
532 changeTab(tabs[group])
|
|
ShadowTheAge@13
|
533 end
|
|
ShadowTheAge@0
|
534 lfgScanInProgress = true
|
|
ShadowTheAge@12
|
535 curLfgGroup = group
|
|
ShadowTheAge@13
|
536 C_LFGList.Search(lfgGroups[curLfgGroup],"")
|
|
ShadowTheAge@0
|
537 end
|
|
ShadowTheAge@0
|
538
|
|
ShadowTheAge@0
|
539 function addon:LfgScanFailed(event, reason)
|
|
ShadowTheAge@0
|
540 if reason == "throttled" then
|
|
ShadowTheAge@12
|
541 addon:ScheduleTimer(addon.LfgScan, 2, curLfgGroup)
|
|
ShadowTheAge@0
|
542 end
|
|
ShadowTheAge@13
|
543 if lbThrottle then
|
|
ShadowTheAge@13
|
544 if reason == "throttled" then
|
|
ShadowTheAge@13
|
545 lbThrottle:SetText("LFG scan is delayed (throttled).\nThis page will update automatically...")
|
|
ShadowTheAge@13
|
546 else
|
|
ShadowTheAge@13
|
547 lbThrottle:SetText("Scan failed ("..reason..")")
|
|
ShadowTheAge@13
|
548 end
|
|
ShadowTheAge@13
|
549 lbThrottle:Show()
|
|
ShadowTheAge@13
|
550 end
|
|
ShadowTheAge@0
|
551 end
|
|
ShadowTheAge@0
|
552
|
|
ShadowTheAge@0
|
553 function addon:LfgResponseData()
|
|
ShadowTheAge@0
|
554 lfgScanInProgress = false;
|
|
ShadowTheAge@13
|
555 addon:UpdateAutoButtonStatus()
|
|
ShadowTheAge@12
|
556 if lbThrottle then lbThrottle:Hide() end
|
|
ShadowTheAge@12
|
557 refreshLFGList()
|
|
ShadowTheAge@0
|
558 end
|
|
ShadowTheAge@0
|
559
|
|
ShadowTheAge@0
|
560 function addon:updateAppStatus(event, id, status, oldstatus)
|
|
ShadowTheAge@0
|
561 if status == "invited" then
|
|
ShadowTheAge@0
|
562 LFGListInviteDialog_Accept(LFGListInviteDialog)
|
|
ShadowTheAge@0
|
563 end
|
|
ShadowTheAge@12
|
564 addon:UpdateAutoButtonStatus()
|
|
ShadowTheAge@12
|
565 addon:SetGroupJoinStatus(id, status)
|
|
ShadowTheAge@12
|
566 end
|
|
ShadowTheAge@12
|
567
|
|
ShadowTheAge@12
|
568 function addon:SetGroupJoinStatus(id, status)
|
|
ShadowTheAge@12
|
569 local name = select(12, C_LFGList.GetSearchResultInfo(id))
|
|
ShadowTheAge@13
|
570 if name then
|
|
ShadowTheAge@13
|
571 recentgroups[name] = {status=status, time=GetTime()}
|
|
ShadowTheAge@13
|
572 end
|
|
ShadowTheAge@13
|
573 end
|
|
ShadowTheAge@13
|
574
|
|
ShadowTheAge@13
|
575 function addon:RealmVisited(realm, head)
|
|
ShadowTheAge@13
|
576 recentRealms[realm] = GetTime()
|
|
ShadowTheAge@12
|
577 end
|
|
ShadowTheAge@12
|
578
|
|
ShadowTheAge@12
|
579 function addon:updatePartyInfo()
|
|
ShadowTheAge@12
|
580 local realms = {}
|
|
ShadowTheAge@12
|
581 local inGroup = IsInGroup()
|
|
ShadowTheAge@12
|
582 if inGroup then
|
|
ShadowTheAge@12
|
583 if IsInRaid() then
|
|
ShadowTheAge@12
|
584 for i=1, MAX_RAID_MEMBERS do
|
|
ShadowTheAge@12
|
585 addon:AddUnitIdStat("raid"..i, realms)
|
|
ShadowTheAge@12
|
586 end
|
|
ShadowTheAge@12
|
587 else
|
|
ShadowTheAge@12
|
588 for i=1, MAX_PARTY_MEMBERS do
|
|
ShadowTheAge@12
|
589 addon:AddUnitIdStat("party"..i, realms)
|
|
ShadowTheAge@12
|
590 end
|
|
ShadowTheAge@12
|
591 end
|
|
ShadowTheAge@12
|
592 end
|
|
ShadowTheAge@12
|
593 if inGroup ~= wasInGroup then
|
|
ShadowTheAge@13
|
594 addon:RefreshZone(true)
|
|
ShadowTheAge@12
|
595 wasInGroup = inGroup
|
|
ShadowTheAge@12
|
596 addon:UpdateAutoButtonStatus()
|
|
ShadowTheAge@12
|
597 end
|
|
ShadowTheAge@12
|
598 end
|
|
ShadowTheAge@12
|
599
|
|
ShadowTheAge@12
|
600
|
|
ShadowTheAge@12
|
601
|
|
ShadowTheAge@0
|
602
|
|
ShadowTheAge@0
|
603 -- Zone scanning routine
|
|
ShadowTheAge@0
|
604
|
|
ShadowTheAge@0
|
605 function addon:LeaveCombat()
|
|
ShadowTheAge@0
|
606 addon:UnregisterEvent("PLAYER_REGEN_ENABLED")
|
|
ShadowTheAge@0
|
607 scanstate = 0
|
|
ShadowTheAge@0
|
608 addon:ScanRealm();
|
|
ShadowTheAge@0
|
609 end
|
|
ShadowTheAge@0
|
610
|
|
ShadowTheAge@13
|
611 function addon:RefreshZoneAndClearHistory()
|
|
ShadowTheAge@13
|
612 ClearRealmHistory()
|
|
ShadowTheAge@11
|
613 addon:RefreshZone(true)
|
|
ShadowTheAge@11
|
614 end
|
|
ShadowTheAge@11
|
615
|
|
ShadowTheAge@11
|
616 function addon:RefreshZone(shedule)
|
|
ShadowTheAge@11
|
617 local inst, instType = IsInInstance()
|
|
ShadowTheAge@12
|
618 inInstance = (inst or instType ~= "none")
|
|
ShadowTheAge@12
|
619 if inInstance then
|
|
ShadowTheAge@11
|
620 lbRealm:SetText("Instanced zone")
|
|
ShadowTheAge@11
|
621 curRealmStat = nil
|
|
ShadowTheAge@12
|
622 inInstance = true
|
|
ShadowTheAge@11
|
623 else
|
|
ShadowTheAge@12
|
624 inInstance = false;
|
|
ShadowTheAge@11
|
625 if scanstate == 0 then
|
|
ShadowTheAge@11
|
626 addon:ScanRealm()
|
|
ShadowTheAge@11
|
627 elseif shedule == true and scanstate == 2 then
|
|
ShadowTheAge@11
|
628 addon:SetStatus("Rescan sheduled...")
|
|
ShadowTheAge@11
|
629 scanstate = 3
|
|
ShadowTheAge@11
|
630 end
|
|
ShadowTheAge@11
|
631 end
|
|
ShadowTheAge@12
|
632 addon:UpdateAutoButtonStatus()
|
|
ShadowTheAge@11
|
633 end
|
|
ShadowTheAge@11
|
634
|
|
ShadowTheAge@0
|
635 function addon:ScanRealm()
|
|
ShadowTheAge@0
|
636 if scanstate > 0 then return end
|
|
ShadowTheAge@0
|
637 if InCombatLockdown() then
|
|
ShadowTheAge@0
|
638 addon:RegisterEvent("PLAYER_REGEN_ENABLED","LeaveCombat")
|
|
ShadowTheAge@0
|
639 scanstate = 1
|
|
ShadowTheAge@11
|
640 addon:SetStatus("Scan sheduled after combat...");
|
|
ShadowTheAge@0
|
641 return
|
|
ShadowTheAge@0
|
642 end
|
|
ShadowTheAge@0
|
643 scanstate = 2
|
|
ShadowTheAge@11
|
644 addon:SetStatus("Scanning current realm...");
|
|
ShadowTheAge@0
|
645 local searchString = _G.WHO_TAG_ZONE .. '"' .. GetZoneText() .. '"';
|
|
ShadowTheAge@0
|
646 wholib:Who(searchString, {callback = "ScanResult", handler=addon})
|
|
ShadowTheAge@0
|
647 end
|
|
ShadowTheAge@0
|
648
|
|
ShadowTheAge@0
|
649 function addon:ScanResult(query, results, complete)
|
|
ShadowTheAge@0
|
650 local realms = {}
|
|
ShadowTheAge@0
|
651 for _, player in ipairs(results) do
|
|
ShadowTheAge@0
|
652 addon:AddRealmStat(player.Name, realms);
|
|
ShadowTheAge@0
|
653 end
|
|
ShadowTheAge@0
|
654 curRealmStat = addon:GetRealmStat(realms);
|
|
ShadowTheAge@11
|
655 curRealmStat.complete = complete
|
|
ShadowTheAge@0
|
656 addon:updateCurrentRealm();
|
|
ShadowTheAge@0
|
657 local rescan = scanstate == 3
|
|
ShadowTheAge@0
|
658 scanstate = 0;
|
|
ShadowTheAge@0
|
659 if rescan then addon:ScanRealm() end
|
|
ShadowTheAge@0
|
660 end
|
|
ShadowTheAge@0
|
661
|
|
ShadowTheAge@0
|
662 function addon:AddRealmStat(name, realms)
|
|
ShadowTheAge@11
|
663 if (name == playerName) then return end
|
|
ShadowTheAge@11
|
664 local _, realm = strsplit(realmSep, name)
|
|
ShadowTheAge@0
|
665 realm = realm or homeRealm
|
|
ShadowTheAge@0
|
666 realms[realm] = (realms[realm] or 0) + 1
|
|
ShadowTheAge@0
|
667 end
|
|
ShadowTheAge@0
|
668
|
|
ShadowTheAge@0
|
669 function addon:AddUnitIdStat(unitid, realms)
|
|
ShadowTheAge@0
|
670 local name, realm = UnitName(unitid);
|
|
ShadowTheAge@0
|
671 if not name then return end
|
|
ShadowTheAge@0
|
672 if realm == "" then realm = homeRealm end
|
|
ShadowTheAge@0
|
673 realm = realm or homeRealm
|
|
ShadowTheAge@0
|
674 realms[realm] = (realms[realm] or 0) + 1
|
|
ShadowTheAge@0
|
675 end
|
|
ShadowTheAge@0
|
676
|
|
ShadowTheAge@0
|
677 function addon:GetRealmStat(realms)
|
|
ShadowTheAge@0
|
678 local rcount = 0;
|
|
ShadowTheAge@0
|
679 local stat = {};
|
|
ShadowTheAge@0
|
680 local pcount = 0;
|
|
ShadowTheAge@0
|
681 for realm,count in pairs(realms) do
|
|
ShadowTheAge@0
|
682 table.insert(stat,{realm=realm,count=count})
|
|
ShadowTheAge@0
|
683 rcount = rcount + 1;
|
|
ShadowTheAge@0
|
684 pcount = pcount + count;
|
|
ShadowTheAge@0
|
685 end
|
|
ShadowTheAge@0
|
686 if rcount > 1 then
|
|
ShadowTheAge@0
|
687 table.sort(stat, function(a,b) return a.count > b.count end)
|
|
ShadowTheAge@0
|
688 stat.max = stat[1].count
|
|
ShadowTheAge@0
|
689 else stat.max = 0 end
|
|
ShadowTheAge@0
|
690 stat.players = pcount;
|
|
ShadowTheAge@0
|
691 stat.realms = rcount;
|
|
ShadowTheAge@0
|
692 return stat;
|
|
ShadowTheAge@0
|
693 end
|
|
ShadowTheAge@0
|
694
|
|
ShadowTheAge@0
|
695 function addon:updateCurrentRealm()
|
|
ShadowTheAge@11
|
696 addon:SetStatus();
|
|
ShadowTheAge@11
|
697 if not curRealmStat or curRealmStat.realms < 1 then
|
|
ShadowTheAge@11
|
698 lbRealm:SetText("Unknown realm (No players)")
|
|
ShadowTheAge@11
|
699 return;
|
|
ShadowTheAge@0
|
700 end
|
|
ShadowTheAge@11
|
701
|
|
ShadowTheAge@11
|
702 local bestRealm = curRealmStat[1]
|
|
ShadowTheAge@13
|
703 addon:RealmVisited(bestRealm.realm, true)
|
|
ShadowTheAge@12
|
704 local prevThreshold = math.min(bestRealm.count/3,10)
|
|
ShadowTheAge@11
|
705 local mixCount = 0
|
|
ShadowTheAge@11
|
706 for i=2,curRealmStat.realms do
|
|
ShadowTheAge@0
|
707 local data = curRealmStat[i]
|
|
ShadowTheAge@11
|
708 if data.count >= prevThreshold then
|
|
ShadowTheAge@11
|
709 mixCount = mixCount + 1
|
|
ShadowTheAge@13
|
710 addon:RealmVisited(data.realm)
|
|
ShadowTheAge@12
|
711 prevThreshold = math.min(data.count/3,10)
|
|
ShadowTheAge@0
|
712 end
|
|
ShadowTheAge@0
|
713 end
|
|
ShadowTheAge@11
|
714 curRealmStat.threshold = prevThreshold
|
|
ShadowTheAge@11
|
715
|
|
ShadowTheAge@11
|
716 if (mixCount > 0) then
|
|
ShadowTheAge@11
|
717 lbRealm:SetText("Mixed "..bestRealm.realm.." +"..mixCount)
|
|
ShadowTheAge@11
|
718 else
|
|
ShadowTheAge@11
|
719 lbRealm:SetText(bestRealm.realm)
|
|
ShadowTheAge@0
|
720 end
|
|
ShadowTheAge@0
|
721 end
|
|
ShadowTheAge@0
|
722
|
|
ShadowTheAge@12
|
723
|
|
ShadowTheAge@12
|
724
|
|
ShadowTheAge@12
|
725
|
|
ShadowTheAge@12
|
726
|
|
ShadowTheAge@12
|
727
|
|
ShadowTheAge@12
|
728 -- Auto action button
|
|
ShadowTheAge@12
|
729
|
|
ShadowTheAge@13
|
730 local action
|
|
ShadowTheAge@12
|
731
|
|
ShadowTheAge@13
|
732 local LeaveGroup = {
|
|
ShadowTheAge@13
|
733 func = LeaveParty;
|
|
ShadowTheAge@13
|
734 tooltip = "Leave current joined group",
|
|
ShadowTheAge@13
|
735 text = "Leave group"
|
|
ShadowTheAge@13
|
736 }
|
|
ShadowTheAge@13
|
737
|
|
ShadowTheAge@13
|
738 local CancelJoin = {
|
|
ShadowTheAge@13
|
739 func = function()
|
|
ShadowTheAge@13
|
740 local apps = C_LFGList.GetApplications();
|
|
ShadowTheAge@13
|
741 if apps[1] then
|
|
ShadowTheAge@13
|
742 C_LFGList.CancelApplication(apps[1])
|
|
ShadowTheAge@13
|
743 end
|
|
ShadowTheAge@13
|
744 end,
|
|
ShadowTheAge@13
|
745 tooltip = "Cancel your current join application",
|
|
ShadowTheAge@13
|
746 text = "Cancel join"
|
|
ShadowTheAge@13
|
747 }
|
|
ShadowTheAge@13
|
748
|
|
ShadowTheAge@13
|
749 local QuickJoin = {
|
|
ShadowTheAge@13
|
750 func = function(self, button)
|
|
ShadowTheAge@13
|
751 if button == "RightButton" then
|
|
ShadowTheAge@13
|
752 addon:SetGroupJoinStatus(self.groupToJoin, "_skip")
|
|
ShadowTheAge@13
|
753 else
|
|
ShadowTheAge@13
|
754 local delisted = select(11, C_LFGList.GetSearchResultInfo(self.groupToJoin))
|
|
ShadowTheAge@13
|
755 if delisted == false then
|
|
ShadowTheAge@13
|
756 JoinGroup(self.groupToJoin)
|
|
ShadowTheAge@13
|
757 else
|
|
ShadowTheAge@13
|
758 addon:SetStatus("Group just delisted")
|
|
ShadowTheAge@13
|
759 end
|
|
ShadowTheAge@13
|
760 end
|
|
ShadowTheAge@13
|
761 end,
|
|
ShadowTheAge@13
|
762 findGroup = function()
|
|
ShadowTheAge@13
|
763 local count, list = C_LFGList.GetSearchResults()
|
|
ShadowTheAge@13
|
764 local best
|
|
ShadowTheAge@13
|
765 local bestvalue = 0
|
|
ShadowTheAge@13
|
766 for i = 1,count do
|
|
ShadowTheAge@13
|
767 local rid = list[i];
|
|
ShadowTheAge@13
|
768 if not rid then break end
|
|
ShadowTheAge@13
|
769 local value = WeightLfgItem(rid, true);
|
|
ShadowTheAge@13
|
770 if value > bestvalue then
|
|
ShadowTheAge@13
|
771 best = rid
|
|
ShadowTheAge@13
|
772 bestvalue = value
|
|
ShadowTheAge@13
|
773 end
|
|
ShadowTheAge@13
|
774 end
|
|
ShadowTheAge@13
|
775 return best
|
|
ShadowTheAge@13
|
776 end,
|
|
ShadowTheAge@13
|
777 tooltip = function(self)
|
|
ShadowTheAge@13
|
778 AddLfgGroupInfo(self.groupToJoin, true)
|
|
ShadowTheAge@13
|
779 GameTooltip:AddLine(" ")
|
|
ShadowTheAge@13
|
780 GameTooltip:AddDoubleLine("Click to join","Right click to skip",0,1,0,1,0.5,0)
|
|
ShadowTheAge@13
|
781 end,
|
|
ShadowTheAge@13
|
782 text = "Quick join"
|
|
ShadowTheAge@13
|
783 }
|
|
ShadowTheAge@13
|
784
|
|
ShadowTheAge@13
|
785 local ScanNext = {
|
|
ShadowTheAge@13
|
786 func = function(self)
|
|
ShadowTheAge@13
|
787 autoScanGroups[curLfgGroup] = 1
|
|
ShadowTheAge@13
|
788 addon.LfgScan(self.category)
|
|
ShadowTheAge@13
|
789 end,
|
|
ShadowTheAge@13
|
790 tooltip = function(self)
|
|
ShadowTheAge@13
|
791 GameTooltip:AddLine("Scan "..(C_LFGList.GetCategoryInfo(lfgGroups[self.category])))
|
|
ShadowTheAge@13
|
792 end,
|
|
ShadowTheAge@13
|
793 text = "Scan more"
|
|
ShadowTheAge@13
|
794 }
|
|
ShadowTheAge@13
|
795
|
|
ShadowTheAge@13
|
796 local NeedReset = {
|
|
ShadowTheAge@13
|
797 func = function()
|
|
ShadowTheAge@13
|
798 wipe(autoScanGroups);
|
|
ShadowTheAge@13
|
799 local categoryToScan = addon.GetNextAutoScanCategory()
|
|
ShadowTheAge@13
|
800 if categoryToScan then
|
|
ShadowTheAge@13
|
801 addon.LfgScan(categoryToScan)
|
|
ShadowTheAge@13
|
802 end
|
|
ShadowTheAge@13
|
803 end,
|
|
ShadowTheAge@13
|
804 tooltip = "Scan again",
|
|
ShadowTheAge@13
|
805 text = "Restart scan"
|
|
ShadowTheAge@13
|
806 }
|
|
ShadowTheAge@13
|
807
|
|
ShadowTheAge@13
|
808 local Wait = {
|
|
ShadowTheAge@13
|
809 tooltip = "Scan in progress",
|
|
ShadowTheAge@13
|
810 text = "Wait..."
|
|
ShadowTheAge@13
|
811 }
|
|
ShadowTheAge@13
|
812
|
|
ShadowTheAge@13
|
813 local ShowQuickHint = {
|
|
ShadowTheAge@13
|
814 tooltip = "Quick Join",
|
|
ShadowTheAge@13
|
815 text = "Quick Join",
|
|
ShadowTheAge@13
|
816 func = function()
|
|
ShadowTheAge@13
|
817 StaticPopupDialogs["CROSS_REALM_ASSIST"] = {
|
|
ShadowTheAge@13
|
818 text = "Quick Join button will automatically join you to a random group with autoinvite and medium number of players. You never join same group twice, you need to clear join history to do so. This message can be disabled in options.",
|
|
ShadowTheAge@13
|
819 button1 = OKAY,
|
|
ShadowTheAge@13
|
820 hideOnEscape = true,
|
|
ShadowTheAge@13
|
821 preferredIndex = 3,
|
|
ShadowTheAge@13
|
822 }
|
|
ShadowTheAge@13
|
823 StaticPopup_Show("CROSS_REALM_ASSIST")
|
|
ShadowTheAge@13
|
824 hintShown = true;
|
|
ShadowTheAge@13
|
825 end
|
|
ShadowTheAge@13
|
826 }
|
|
ShadowTheAge@13
|
827
|
|
ShadowTheAge@13
|
828 function addon.DoAutoAction(widget, button)
|
|
ShadowTheAge@13
|
829 addon:SetStatus()
|
|
ShadowTheAge@13
|
830 if action and action.func then
|
|
ShadowTheAge@13
|
831 action:func(button)
|
|
ShadowTheAge@13
|
832 end
|
|
ShadowTheAge@13
|
833 addon:UpdateAutoButtonStatus()
|
|
ShadowTheAge@13
|
834 end
|
|
ShadowTheAge@13
|
835
|
|
ShadowTheAge@13
|
836 function addon.actionTooltip()
|
|
ShadowTheAge@13
|
837 local tooltip = action.tooltip
|
|
ShadowTheAge@13
|
838 if type(tooltip) == 'function' then
|
|
ShadowTheAge@13
|
839 tooltip(action)
|
|
ShadowTheAge@13
|
840 else
|
|
ShadowTheAge@13
|
841 GameTooltip:AddLine(tooltip)
|
|
ShadowTheAge@11
|
842 end
|
|
ShadowTheAge@11
|
843 end
|
|
ShadowTheAge@11
|
844
|
|
ShadowTheAge@13
|
845 function addon:UpdateAutoButtonStatus()
|
|
ShadowTheAge@13
|
846 if not btQuick then return end
|
|
ShadowTheAge@13
|
847 btQuick:Enable()
|
|
ShadowTheAge@13
|
848 if not hintShown and db.global.quickJoinHint then
|
|
ShadowTheAge@13
|
849 action = ShowQuickHint;
|
|
ShadowTheAge@13
|
850 elseif IsInGroup() then
|
|
ShadowTheAge@13
|
851 action = LeaveGroup;
|
|
ShadowTheAge@13
|
852 elseif C_LFGList.GetNumApplications() > 0 then
|
|
ShadowTheAge@13
|
853 action = CancelJoin;
|
|
ShadowTheAge@13
|
854 elseif lfgScanInProgress then
|
|
ShadowTheAge@13
|
855 action = Wait
|
|
ShadowTheAge@13
|
856 else
|
|
ShadowTheAge@13
|
857 local group = QuickJoin.findGroup();
|
|
ShadowTheAge@13
|
858 if group then
|
|
ShadowTheAge@13
|
859 action = QuickJoin;
|
|
ShadowTheAge@13
|
860 QuickJoin.groupToJoin = group
|
|
ShadowTheAge@13
|
861 else
|
|
ShadowTheAge@13
|
862 local categoryToScan = addon.GetNextAutoScanCategory()
|
|
ShadowTheAge@13
|
863 if (categoryToScan) then
|
|
ShadowTheAge@13
|
864 action = ScanNext;
|
|
ShadowTheAge@13
|
865 ScanNext.category = categoryToScan
|
|
ShadowTheAge@13
|
866 else
|
|
ShadowTheAge@13
|
867 action = NeedReset;
|
|
ShadowTheAge@13
|
868 end
|
|
ShadowTheAge@13
|
869 end
|
|
ShadowTheAge@13
|
870 end
|
|
ShadowTheAge@13
|
871 btQuick:SetText(action.text)
|
|
ShadowTheAge@13
|
872 if GameTooltip:GetOwner() == btQuick then
|
|
ShadowTheAge@13
|
873 ShowTooltip(btQuick)
|
|
ShadowTheAge@0
|
874 end
|
|
ShadowTheAge@0
|
875 end
|
|
ShadowTheAge@0
|
876
|
|
ShadowTheAge@12
|
877
|
|
ShadowTheAge@13
|
878
|
|
ShadowTheAge@13
|
879
|
|
ShadowTheAge@13
|
880
|
|
ShadowTheAge@13
|
881
|
|
ShadowTheAge@13
|
882 -- Settings
|
|
ShadowTheAge@13
|
883
|
|
ShadowTheAge@13
|
884 local function toggleMinimapIcon(btn, arg1, arg2, checked)
|
|
ShadowTheAge@13
|
885 local hidden = not checked;
|
|
ShadowTheAge@13
|
886 db.global.minimap.hide = hidden;
|
|
ShadowTheAge@13
|
887 if hidden then
|
|
ShadowTheAge@13
|
888 DEFAULT_CHAT_FRAME:AddMessage("|cffff0000Type |cffffffff/cra |cffff0000in chat to open Cross Realm Assist without minimap button");
|
|
ShadowTheAge@13
|
889 minimapIcon:Hide("CrossRealmAssistMinimapIcon")
|
|
ShadowTheAge@13
|
890 else
|
|
ShadowTheAge@13
|
891 minimapIcon:Show("CrossRealmAssistMinimapIcon")
|
|
ShadowTheAge@13
|
892 end
|
|
ShadowTheAge@0
|
893 end
|
|
ShadowTheAge@0
|
894
|
|
ShadowTheAge@13
|
895 local function toggleQuickJoinHint(btn, arg1, arg2, checked)
|
|
ShadowTheAge@13
|
896 db.global.quickJoinHint = checked
|
|
ShadowTheAge@0
|
897 end
|
|
ShadowTheAge@0
|
898
|
|
ShadowTheAge@13
|
899 local function toggleQuickJoin(btn, arg1, arg2, checked)
|
|
ShadowTheAge@13
|
900 db.global.quickJoin[arg1] = checked
|
|
ShadowTheAge@13
|
901 end
|
|
ShadowTheAge@13
|
902
|
|
ShadowTheAge@13
|
903 local function ClearJoinHistory()
|
|
ShadowTheAge@13
|
904 recentgroups = {}
|
|
ShadowTheAge@13
|
905 addon:UpdateAutoButtonStatus()
|
|
ShadowTheAge@13
|
906 if lfgTable then lfgTable:Refresh() end
|
|
ShadowTheAge@13
|
907 end
|
|
ShadowTheAge@13
|
908
|
|
ShadowTheAge@13
|
909 --[[local function resetPos()
|
|
ShadowTheAge@13
|
910 db.global.widgetPos = DefaultWidgetPos
|
|
ShadowTheAge@13
|
911 if gui then
|
|
ShadowTheAge@13
|
912 gui:ClearAllPoints()
|
|
ShadowTheAge@13
|
913 gui:SetPoint(DefaultWidgetPos.to,DefaultWidgetPos.x,DefaultWidgetPos.y)
|
|
ShadowTheAge@0
|
914 end
|
|
ShadowTheAge@13
|
915 end]]
|
|
ShadowTheAge@13
|
916
|
|
ShadowTheAge@13
|
917 local function initMenu(self, level)
|
|
ShadowTheAge@13
|
918 if not level then return end
|
|
ShadowTheAge@13
|
919 if level == 1 then
|
|
ShadowTheAge@13
|
920 UIDropDownMenu_AddButton({text="Clear realm history",notCheckable=1,func=ClearRealmHistory}, level)
|
|
ShadowTheAge@13
|
921 UIDropDownMenu_AddButton({text="Clear join history",notCheckable=1,func=ClearJoinHistory}, level)
|
|
ShadowTheAge@13
|
922 UIDropDownMenu_AddButton({disabled=1,notCheckable=1}, level)
|
|
ShadowTheAge@13
|
923 UIDropDownMenu_AddButton({isTitle=1,text="Settings",notCheckable=1}, level)
|
|
ShadowTheAge@13
|
924 UIDropDownMenu_AddButton({text="Show Minimap Button",checked=not db.global.minimap.hide, func=toggleMinimapIcon,keepShownOnClick=true,isNotRadio=true}, level)
|
|
ShadowTheAge@13
|
925 UIDropDownMenu_AddButton({text="Show Quick Join Hint",checked=db.global.quickJoinHint, func=toggleQuickJoinHint,keepShownOnClick=true,isNotRadio=true}, level)
|
|
ShadowTheAge@13
|
926 UIDropDownMenu_AddButton({text="Quick join categories",notCheckable=1,hasArrow=1,value="qjc",keepShownOnClick=true}, level)
|
|
ShadowTheAge@13
|
927 elseif level == 2 then
|
|
ShadowTheAge@13
|
928 if UIDROPDOWNMENU_MENU_VALUE == "qjc" then
|
|
ShadowTheAge@13
|
929 for i=1,#lfgGroups do
|
|
ShadowTheAge@13
|
930 local groupId = lfgGroups[i]
|
|
ShadowTheAge@13
|
931 UIDropDownMenu_AddButton({text=(C_LFGList.GetCategoryInfo(groupId)),checked=db.global.quickJoin[groupId],arg1=groupId,func=toggleQuickJoin,keepShownOnClick=true,isNotRadio=true}, level)
|
|
ShadowTheAge@13
|
932 end
|
|
ShadowTheAge@13
|
933 end
|
|
ShadowTheAge@13
|
934 end
|
|
ShadowTheAge@13
|
935 end
|
|
ShadowTheAge@13
|
936
|
|
ShadowTheAge@13
|
937 function addon.ShowSettings(frame)
|
|
ShadowTheAge@13
|
938 if not settingsMenu then
|
|
ShadowTheAge@13
|
939 settingsMenu = CreateFrame("Frame", "CrossRealmAssistMenu")
|
|
ShadowTheAge@13
|
940 settingsMenu.displayMode = "MENU"
|
|
ShadowTheAge@13
|
941 settingsMenu.initialize = initMenu
|
|
ShadowTheAge@13
|
942 end
|
|
ShadowTheAge@13
|
943 ToggleDropDownMenu(1, nil, settingsMenu, frame, 10, 0)
|
|
ShadowTheAge@12
|
944 end |