Mercurial > wow > buffalo2
comparison Modules/GuildInfo.lua @ 121:1f68c46bc4de
BuffFrame:
- Added interface framework for selectively hiding certain buff's auxiliary values.
author | Nenue |
---|---|
date | Mon, 17 Jul 2017 11:51:31 -0400 |
parents | a41f6b74709a |
children | ea2c616a3b4f |
comparison
equal
deleted
inserted
replaced
120:5f1ba488c395 | 121:1f68c46bc4de |
---|---|
1 | 1 |
2 local print = DEVIAN_WORKSPACE and function(...) print('VnRoster', ...) end or nop | 2 local print = DEVIAN_WORKSPACE and function(...) print('VnRoster', ...) end or nop |
3 | 3 |
4 VeneerRosterKunMixin = { | 4 VeneerRosterKunMixin = { |
5 addonTrigger = 'Blizzard_GuildUI', | 5 anchorFrame = 'LFGListFrame', |
6 | |
7 anchorFrame = 'GuildFrame', | |
8 anchorPoint = 'TOPLEFT', | 6 anchorPoint = 'TOPLEFT', |
7 | |
8 AchievementsDirty = true, | |
9 GuildInfoDirty = true, | |
10 blocks = {}, | |
9 } | 11 } |
10 | 12 |
11 | 13 |
12 local module = VeneerRosterKunMixin | 14 local module = VeneerRosterKunMixin |
13 | 15 |
14 function module:OnLoad() | 16 function module:OnLoad() |
15 Veneer:AddHandler(self, self.anchorPoint) | 17 Veneer:AddHandler(self, self.anchorPoint) |
16 self:RegisterEvent('GUILD_ROSTER_UPDATE') | 18 --self:RegisterEvent('GUILD_ROSTER_UPDATE') |
17 self:RegisterEvent('GUILD_TRADESKILL_UPDATE') | 19 --self:RegisterEvent('GUILD_TRADESKILL_UPDATE') |
18 | 20 |
19 self:RegisterEvent('LFG_LIST_SEARCH_RESULT_UPDATED') | 21 self:RegisterEvent('LFG_LIST_SEARCH_RESULT_UPDATED') |
20 self:RegisterEvent('LFG_LIST_SEARCH_RESULTS_RECEIVED') | 22 --self:RegisterEvent('LFG_LIST_SEARCH_RESULTS_RECEIVED') |
21 self:RegisterEvent('LFG_LIST_AVAILABILITY_UPDATE') | 23 --self:RegisterEvent('LFG_LIST_AVAILABILITY_UPDATE') |
22 self:RegisterEvent('LFG_LIST_LOCK_INFO_RECEIVED') | 24 --self:RegisterEvent('LFG_LIST_LOCK_INFO_RECEIVED') |
25 self:RegisterEvent('ADDON_LOADED') | |
26 | |
27 hooksecurefunc("LFGListSearchPanel_SelectResult", function(obj) | |
28 print('LFGListSearchPanel_SelectResult') | |
29 self.selectedID = obj.selectedResult | |
30 print('selected =', self.selectedID) | |
31 self:UpdateAchievementLinks() | |
32 end) | |
33 hooksecurefunc("LFGListSearchPanel_SignUp", function(obj) | |
34 print('LFGListSearchPanel_SignUp', obj.selectedResult) | |
35 | |
36 | |
37 self.selectedID = obj.selectedResult | |
38 print('selected =', self.selectedID) | |
39 self:UpdateAchievementLinks() | |
40 end) | |
23 end | 41 end |
24 | 42 |
25 function module:Setup() | 43 function module:Setup() |
26 VeneerHandlerMixin.Setup(self) | 44 VeneerHandlerMixin.Setup(self) |
27 self:SetParent(GuildFrame) | 45 self:SetParent(LFGListFrame) |
46 self:SetPoint('TOPLEFT', LFGListFrame,'TOPRIGHT') | |
28 self:SetShown(true) | 47 self:SetShown(true) |
29 end | 48 end |
30 | 49 |
31 function module:SetDirty() | 50 function module:SetDirty() |
32 if self:IsVisible() then | 51 if self:IsVisible() then |
33 self:Update() | 52 self:Update() |
34 else | 53 else |
35 self.GuildInfoDirty = true | 54 self.GuildInfoDirty = true |
36 end | 55 self.AchievementsDirty = true |
37 end | 56 end |
38 | 57 end |
58 local firstLoad = true | |
39 function module:OnShow() | 59 function module:OnShow() |
40 print('|cFF00FFFFOnShow()|r') | 60 print('|cFF00FFFFOnShow()|r') |
41 if self.GuildInfoDirty then | 61 self:Update(firstLoad) |
42 self:UpdateGuildInfo() | 62 firstLoad = nil |
43 end | |
44 end | 63 end |
45 | 64 |
46 function module:UpdateGuildInfo() | 65 function module:UpdateGuildInfo() |
47 local numMembers = GetNumGuildMembers() | 66 local numMembers = GetNumGuildMembers() |
48 print(numMembers) | 67 print(numMembers) |
49 for i = 1, numMembers do | 68 for i = 1, numMembers do |
50 print(GetGuildRosterInfo(i)) | 69 --print(GetGuildRosterInfo(i)) |
51 end | 70 end |
52 end | 71 self.GuildInfoDirty = nil |
53 | 72 end |
54 function module:Update() end | 73 |
55 | 74 -- cheevos to link |
75 local cheevos = { | |
76 -- Mythic Prog: Tomb | |
77 { | |
78 11781, -- kj | |
79 11780, -- avatar | |
80 11779, -- maiden | |
81 11776, -- mistress | |
82 11777, -- sisters | |
83 11778, -- host, | |
84 11775, -- harjatan, | |
85 11774, -- di, | |
86 11773, -- goroth | |
87 }, | |
88 -- Completion: Tomb | |
89 { | |
90 11875, -- CE KJ | |
91 11874, -- AotC KJ | |
92 11790 -- Deceiver's Fall, | |
93 | |
94 | |
95 }, | |
96 -- Mythic+ | |
97 { | |
98 11162, -- master | |
99 11185, -- conqueror | |
100 } | |
101 } | |
102 | |
103 local cheev = {} | |
104 | |
105 function cheev:OnClick() | |
106 local resultID = LFGListFrame.SearchPanel.selectedResult or self:GetParent().selectedID | |
107 print('current selection = ', resultID) | |
108 if ACTIVE_CHAT_EDIT_BOX then | |
109 ChatEdit_InsertLink(self.link) | |
110 elseif resultID then | |
111 local id, activityID, name, comment, voiceChat, iLvl, honorLevel, age, numBNetFriends, numCharFriends, numGuildMates, isDelisted, leaderName = C_LFGList.GetSearchResultInfo(resultID); | |
112 --print(name, comment, leaderName) | |
113 ChatFrame_OpenChat("/w "..leaderName.." "..self.link, DEFAULT_CHAT_FRAME) | |
114 end | |
115 end | |
116 | |
117 | |
118 function module:UpdateAchievementLinks() | |
119 print('UpdateAchievementLinks()') | |
120 | |
121 local resultID = LFGListFrame.SearchPanel.selectedResult or self.selectedID | |
122 self:Show() | |
123 | |
124 | |
125 local index = 0 | |
126 local lastBlock | |
127 local contentsHeight = 0 | |
128 for _, group in ipairs(cheevos) do | |
129 for _, id in ipairs(group) do | |
130 local _, name, points, completed, month, day, year, description, flags, icon = GetAchievementInfo(id) | |
131 if completed then | |
132 index = index + 1 | |
133 --print(index) | |
134 local block =self.blocks[index] | |
135 if not block then | |
136 block = CreateFrame('Button', 'VeneerRosterKunBlock'..index, self, 'VeneerRosterKunBlock') | |
137 block:SetScript('OnClick', cheev.OnClick) | |
138 block:SetID(index) | |
139 self.blocks[index] = block | |
140 end | |
141 | |
142 block.link = GetAchievementLink(id) | |
143 block.Icon:SetTexture(icon) | |
144 block.Label:SetText(name) | |
145 block:ClearAllPoints() | |
146 if lastBlock then | |
147 block:SetPoint('TOPLEFT', lastBlock, 'BOTTOMLEFT', 0, 0) | |
148 else | |
149 block:SetPoint('TOPLEFT') | |
150 end | |
151 --print(block:GetHeight(), block:GetPoint(1)) | |
152 block:Show() | |
153 | |
154 contentsHeight = contentsHeight + block:GetHeight() | |
155 | |
156 --print(index, name, icon) | |
157 lastBlock = block | |
158 break; | |
159 end | |
160 end | |
161 end | |
162 | |
163 --print(index, #self.blocks) | |
164 if index < #self.blocks then | |
165 for i = index+1, #self.blocks do | |
166 --print('hiding', i) | |
167 self.blocks[i]:Hide() | |
168 end | |
169 | |
170 end | |
171 | |
172 self:SetHeight(contentsHeight) | |
173 | |
174 end | |
175 | |
176 function module:Update(forced) | |
177 | |
178 | |
179 if self.GuildInfoDirty or forced then | |
180 self:UpdateGuildInfo() | |
181 end | |
182 if self.AchievementsDirty or forced then | |
183 self:UpdateAchievementLinks() | |
184 end | |
185 | |
186 end | |
187 function module:SetupGuildUI() | |
188 self:UnregisterEvent('ADDON_LOADED') | |
189 end | |
56 function module:OnEvent(event, ...) | 190 function module:OnEvent(event, ...) |
57 print('|cFFFF0088OnEvent()|r', event, ...) | 191 print('|cFFFF0088OnEvent()|r', event, ...) |
58 if event == 'LFG_LIST_SEARCH_RESULTS_RECEIVED' then | 192 if event == 'ADDON_LOADED' then |
193 local addon = ... | |
194 if addon == 'Blizzard_GuildUI' then | |
195 self:SetupGuildUI() | |
196 end | |
197 elseif event == 'LFG_LIST_SEARCH_RESULTS_RECEIVED' then | |
59 elseif event == 'LFG_LIST_SEARCH_RESULT_UPDATED' then | 198 elseif event == 'LFG_LIST_SEARCH_RESULT_UPDATED' then |
60 elseif event == 'GUILD_ROSTER_UPDATE' then | 199 end |
61 self:SetDirty() | 200 end |
62 end | |
63 end |