Mercurial > wow > buffalo2
comparison Modules/LFGFrame.lua @ 135:4979b5cca6de
- Fixed lua error from newly obtained artifacts
author | Nenue |
---|---|
date | Thu, 25 Jan 2018 20:58:10 -0500 |
parents | |
children | 414e37af1b1b |
comparison
equal
deleted
inserted
replaced
134:24dc16a49b15 | 135:4979b5cca6de |
---|---|
1 | |
2 local print = DEVIAN_WORKSPACE and function(...) print('LFGFrame', ...) end or nop | |
3 | |
4 VeneerRosterKunMixin = { | |
5 anchorFrame = 'LFGListFrame', | |
6 anchorPoint = 'TOPLEFT', | |
7 | |
8 InvasionsDirty = true, | |
9 AchievementsDirty = true, | |
10 GuildInfoDirty = true, | |
11 blocks = {}, | |
12 } | |
13 | |
14 | |
15 local module = VeneerRosterKunMixin | |
16 | |
17 function module:OnLoad() | |
18 Veneer:AddHandler(self, self.anchorPoint) | |
19 self:RegisterEvent('ADDON_LOADED') | |
20 | |
21 hooksecurefunc("LFGListCategorySelection_StartFindGroup", function(panel, questID) | |
22 print('LFGListCategorySelection_StartFindGroup', panel:GetParent(), questID) | |
23 end) | |
24 hooksecurefunc("LFGListCategorySelection_SelectCategory", function(panel, categoryID, filters) | |
25 print('LFGListCategorySelection_SelectCategory', panel:GetParent(), categoryID, filters) | |
26 print('\n',debugstack(3)) | |
27 end) | |
28 hooksecurefunc("LFGListSearchPanel_SetCategory", function(panel, categoryID, filters, baseFilters) | |
29 print('LFGListSearchPanel_SetCategory', panel:GetParent(), categoryID, filters, baseFilters) | |
30 end) | |
31 end | |
32 | |
33 function module:Setup() | |
34 VeneerHandlerMixin.Setup(self) | |
35 self:SetParent(LFGListFrame) | |
36 self:SetPoint('TOPLEFT', LFGListFrame,'TOPRIGHT') | |
37 self:SetShown(true) | |
38 end | |
39 | |
40 function module:SetDirty() | |
41 if self:IsVisible() then | |
42 self:Update() | |
43 else | |
44 self.GuildInfoDirty = true | |
45 self.AchievementsDirty = true | |
46 self.InvasionsDirty = true | |
47 end | |
48 end | |
49 local firstLoad = true | |
50 function module:OnShow() | |
51 print('|cFF00FFFFOnShow()|r') | |
52 self:Update(firstLoad) | |
53 firstLoad = nil | |
54 | |
55 local locationName = GetRealZoneText() | |
56 | |
57 if not C_LFGList.GetActiveEntryInfo() and locationName and locationName:match('Invasion') and not InCombatLockdown() then | |
58 PVEFrame_ShowFrame("GroupFinderFrame", LFGListPVEStub); | |
59 local panel = LFGListFrame.CategorySelection | |
60 LFGListCategorySelection_SelectCategory(panel, 6, 0); | |
61 LFGListCategorySelection_StartFindGroup(panel, locationName); | |
62 end | |
63 end | |
64 | |
65 function module:UpdateGuildInfo() | |
66 local numMembers = GetNumGuildMembers() | |
67 print(numMembers) | |
68 for i = 1, numMembers do | |
69 --print(GetGuildRosterInfo(i)) | |
70 end | |
71 self.GuildInfoDirty = nil | |
72 end | |
73 | |
74 -- cheevos to link | |
75 local overlaps = { | |
76 [11781] = 11875, | |
77 [12002] = 12111, | |
78 } | |
79 local cheevos = { | |
80 -- Mythic Prog | |
81 { | |
82 -- Antorus | |
83 12002, -- argus | |
84 12001, -- aggramar | |
85 12000, -- coven | |
86 11999, -- barry | |
87 11998, -- kin'garoth | |
88 11997, -- imonar | |
89 11996, -- eonar | |
90 11995, -- portal keeper | |
91 11994, -- high command | |
92 11993, -- doggos | |
93 11992, -- worldbreaker | |
94 | |
95 -- Tomb of Sargeras | |
96 11781, -- kj | |
97 11780, -- avatar | |
98 11779, -- maiden | |
99 11776, -- mistress | |
100 11778, -- host, | |
101 11777, -- sisters | |
102 11775, -- harjatan, | |
103 11774, -- di, | |
104 11773, -- goroth | |
105 }, | |
106 -- Completion | |
107 { | |
108 12111, -- CE Argus, | |
109 12110, -- AotC Argus, | |
110 11875, -- CE KJ | |
111 11874, -- AotC KJ | |
112 11790 -- Deceiver's Fall, | |
113 | |
114 | |
115 }, | |
116 -- Mythic+ | |
117 { | |
118 11162, -- master | |
119 11185, -- conqueror | |
120 } | |
121 } | |
122 | |
123 local invasion = {} | |
124 local cheev = {} | |
125 | |
126 function cheev:OnClick() | |
127 local resultID = LFGListFrame.SearchPanel.selectedResult or self:GetParent().selectedID | |
128 print('current selection = ', resultID) | |
129 if ACTIVE_CHAT_EDIT_BOX then | |
130 ChatEdit_InsertLink(self.link) | |
131 elseif resultID then | |
132 local id, activityID, name, comment, voiceChat, iLvl, honorLevel, age, numBNetFriends, numCharFriends, numGuildMates, isDelisted, leaderName = C_LFGList.GetSearchResultInfo(resultID); | |
133 --print(name, comment, leaderName) | |
134 ChatFrame_OpenChat("/w "..leaderName.." "..self.link, DEFAULT_CHAT_FRAME) | |
135 end | |
136 end | |
137 | |
138 function invasion:OnClick() | |
139 if not InCombatLockdown() then | |
140 PVEFrame_ShowFrame("GroupFinderFrame", LFGListPVEStub); | |
141 local panel = LFGListFrame.CategorySelection | |
142 LFGListCategorySelection_SelectCategory(panel, 6, 0); | |
143 LFGListCategorySelection_StartFindGroup(panel, self.searchText); | |
144 end | |
145 | |
146 end | |
147 | |
148 local listed = {} | |
149 | |
150 | |
151 function module:Update(forced) | |
152 if self.GuildInfoDirty or forced then | |
153 self:UpdateGuildInfo() | |
154 end | |
155 local numBlocks = 0 | |
156 if self.AchievementsDirty or forced then | |
157 numBlocks = self:UpdateAchievementLinks(numBlocks) | |
158 end | |
159 | |
160 if self.InvasionsDirty or forced then | |
161 numBlocks = self:UpdateInvasionButtons(numBlocks) | |
162 end | |
163 | |
164 local lastBlock | |
165 local contentsHeight = 0 | |
166 for index, block in ipairs(self.blocks) do | |
167 if index > numBlocks then | |
168 block:Hide() | |
169 else | |
170 block:ClearAllPoints() | |
171 if lastBlock then | |
172 block:SetPoint('TOPLEFT', lastBlock, 'BOTTOMLEFT', 0, -2) | |
173 else | |
174 block:SetPoint('TOPLEFT', LFGListFrame, 'TOPRIGHT', 0, 0) | |
175 end | |
176 block:Show() | |
177 lastBlock = block | |
178 | |
179 contentsHeight = contentsHeight + block:GetHeight() | |
180 end | |
181 end | |
182 self:SetHeight(contentsHeight) | |
183 end | |
184 | |
185 | |
186 function module:GetBlock(index) | |
187 | |
188 local block =self.blocks[index] | |
189 if not block then | |
190 block = CreateFrame('Button', 'VeneerRosterKunBlock'..index, self, 'VeneerRosterKunBlock') | |
191 | |
192 block:SetID(index) | |
193 self.blocks[index] = block | |
194 end | |
195 return block | |
196 end | |
197 | |
198 function module:UpdateInvasionButtons(offset) | |
199 print('UpdateInvasionButtons()') | |
200 offset = offset or 0 | |
201 local lastBlock = self.lastAchievement | |
202 | |
203 local contentsHeight = 0 | |
204 local areaPOIs = C_WorldMap.GetAreaPOIForMap(GetCurrentMapAreaID(), 1); | |
205 if areaPOIs then | |
206 | |
207 | |
208 for i, areaPoiID in ipairs(areaPOIs) do | |
209 local poiInfo = C_WorldMap.GetAreaPOIInfo(GetCurrentMapAreaID(), areaPoiID, 1); | |
210 | |
211 offset = offset + 1 | |
212 --print(index) | |
213 local block = self:GetBlock(offset) | |
214 block:SetScript('OnClick', invasion.OnClick) | |
215 block.Label:SetText(poiInfo.description) | |
216 block.Icon:SetAtlas(poiInfo.atlasName) | |
217 block.searchText = poiInfo.description | |
218 block.buttonType = 'group-poi' | |
219 end | |
220 end | |
221 return offset, contentsHeight | |
222 end | |
223 | |
224 function module:UpdateAchievementLinks(offset) | |
225 print('UpdateAchievementLinks()') | |
226 offset = offset or 0 | |
227 local resultID = LFGListFrame.SearchPanel.selectedResult or self.selectedID | |
228 self:Show() | |
229 | |
230 | |
231 local contentsHeight = 0 | |
232 for _, group in ipairs(cheevos) do | |
233 for _, id in ipairs(group) do | |
234 local _, name, points, completed, month, day, year, description, flags, icon = GetAchievementInfo(id) | |
235 if completed then | |
236 -- if the highest mythic kill | |
237 if listed[overlaps[id]] then | |
238 break | |
239 end | |
240 offset = offset + 1 | |
241 local block = self:GetBlock(offset) | |
242 block:SetScript('OnClick', cheev.OnClick) | |
243 --print(index) | |
244 | |
245 block.link = GetAchievementLink(id) | |
246 block.Icon:SetTexture(icon) | |
247 block.Label:SetText(name) | |
248 block.buttonType = 'cheevo' | |
249 | |
250 contentsHeight = contentsHeight + block:GetHeight() | |
251 | |
252 --print(index, name, icon) | |
253 listed[id] = true | |
254 break; | |
255 end | |
256 end | |
257 end | |
258 | |
259 self.lastAchievement = lastBlock | |
260 | |
261 return offset, contentsHeight | |
262 | |
263 --[[ | |
264 --]] | |
265 | |
266 | |
267 end | |
268 | |
269 function module:SetupGuildUI() | |
270 self:UnregisterEvent('ADDON_LOADED') | |
271 end | |
272 function module:OnEvent(event, ...) | |
273 print('|cFFFF0088OnEvent()|r', event, ...) | |
274 if event == 'ADDON_LOADED' then | |
275 local addon = ... | |
276 if addon == 'Blizzard_GuildUI' then | |
277 self:SetupGuildUI() | |
278 end | |
279 elseif event == 'LFG_LIST_SEARCH_RESULTS_RECEIVED' then | |
280 elseif event == 'LFG_LIST_SEARCH_RESULT_UPDATED' then | |
281 end | |
282 end |