annotate Modules/GuildInfo.lua @ 129:9f2cf5609420 v7.3.0-20171022

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