Mercurial > wow > buffalo2
view Modules/LFGFrame.lua @ 138:6e2f20230190 tip
- 8.1 TOC
- disabled Currency and WorldState modules for lack of use
- BoD progress link buttons for group finder
author | Nenue |
---|---|
date | Fri, 22 Feb 2019 17:34:58 -0500 |
parents | 414e37af1b1b |
children |
line wrap: on
line source
local print = DEVIAN_WORKSPACE and function(...) print('LFGFrame', ...) end or nop VeneerRosterKunMixin = { anchorFrame = 'LFGListFrame', anchorPoint = 'TOPLEFT', InvasionsDirty = true, AchievementsDirty = true, GuildInfoDirty = true, blocks = {}, } local module = VeneerRosterKunMixin function module:OnLoad() Veneer:AddHandler(self, self.anchorPoint) self:RegisterEvent('ADDON_LOADED') hooksecurefunc("LFGListCategorySelection_StartFindGroup", function(panel, questID) print('LFGListCategorySelection_StartFindGroup', panel:GetParent(), questID) end) hooksecurefunc("LFGListCategorySelection_SelectCategory", function(panel, categoryID, filters) print('LFGListCategorySelection_SelectCategory', panel:GetParent(), categoryID, filters) print('\n',debugstack(3)) end) hooksecurefunc("LFGListSearchPanel_SetCategory", function(panel, categoryID, filters, baseFilters) print('LFGListSearchPanel_SetCategory', panel:GetParent(), categoryID, filters, baseFilters) end) end function module:Setup() VeneerHandlerMixin.Setup(self) self:SetParent(LFGListFrame) self:SetPoint('TOPLEFT', LFGListFrame,'TOPRIGHT') self:SetShown(true) end function module:SetDirty() if self:IsVisible() then self:Update() else self.GuildInfoDirty = true self.AchievementsDirty = true self.InvasionsDirty = true end end local firstLoad = true function module:OnShow() print('|cFF00FFFFOnShow()|r') self:Update(firstLoad) firstLoad = nil local locationName = GetRealZoneText() if not C_LFGList.GetActiveEntryInfo() and locationName and locationName:match('Invasion') and not InCombatLockdown() then PVEFrame_ShowFrame("GroupFinderFrame", LFGListPVEStub); local panel = LFGListFrame.CategorySelection LFGListCategorySelection_SelectCategory(panel, 6, 0); local bossName = locationName:match('Greater Invasion Point: (.+)') LFGListCategorySelection_StartFindGroup(panel, bossName or locationName); end end function module:UpdateGuildInfo() local numMembers = GetNumGuildMembers() print(numMembers) for i = 1, numMembers do --print(GetGuildRosterInfo(i)) end self.GuildInfoDirty = nil end -- cheevos to link local overlaps = { [11781] = 11875, [12002] = 12111, } local cheevos = { -- mythic prog { 13314, -- Mythic: Lady Jaina Proudmoore 13313, -- Mythic: Stormwall Blockade 13312, -- Mythic: Mekkatorque 13311, -- Mythic: King Rastakhan 13300, -- Mythic: Conclave of the Chosen 13299, -- Mythic: Opulence 13298, -- Mythic: Jadefire Masters (Alliance Only) 13295, -- Mythic: Jadefire Masters (Horde Only) 13293, -- Mythic: Grong 13292, -- Mythic: Champion of the Light 12533, -- Mythic: Ghuun 12532, -- Mythic: Mythrax 12531, -- Mythic: Zul 12530, -- Mythic: Fetid Devourer 12529, -- 12527, 12526, 12524, }, -- Completion BfA { 13323, -- Cutting Edge: Lady Jaina Proudmoore, 13322, -- Ahead of the Curve: Lady Jaina Proudmoore, 12535, -- Cutting Edge: Ghuun, 12536, -- Ahead of the Curve: Ghuun, } , -- Completion Legion { 12111, -- CE Argus, 11875, -- CE KJ 11790 -- Deceiver's Fall, }, -- Mythic+ { 13080, -- BfA Keystone Master 1 } } local invasion = {} local cheev = {} function cheev:OnClick() local resultID = LFGListFrame.SearchPanel.selectedResult or self:GetParent().selectedID print('current selection = ', resultID) if ACTIVE_CHAT_EDIT_BOX then ChatEdit_InsertLink(self.link) elseif resultID then local id, activityID, name, comment, voiceChat, iLvl, honorLevel, age, numBNetFriends, numCharFriends, numGuildMates, isDelisted, leaderName = C_LFGList.GetSearchResultInfo(resultID); --print(name, comment, leaderName) ChatFrame_OpenChat("/w "..leaderName.." "..self.link, DEFAULT_CHAT_FRAME) end end function invasion:OnClick() if not InCombatLockdown() then PVEFrame_ShowFrame("GroupFinderFrame", LFGListPVEStub); local panel = LFGListFrame.CategorySelection LFGListCategorySelection_SelectCategory(panel, 6, 0); LFGListCategorySelection_StartFindGroup(panel, self.searchText); end end local listed = {} function module:Update(forced) if self.GuildInfoDirty or forced then self:UpdateGuildInfo() end local numBlocks = 0 if self.AchievementsDirty or forced then numBlocks = self:UpdateAchievementLinks(numBlocks) end local lastBlock local contentsHeight = 0 for index, block in ipairs(self.blocks) do if index > numBlocks then block:Hide() else block:ClearAllPoints() if lastBlock then block:SetPoint('TOPLEFT', lastBlock, 'BOTTOMLEFT', 0, -2) else block:SetPoint('TOPLEFT', LFGListFrame, 'TOPRIGHT', 0, 0) end block:Show() lastBlock = block contentsHeight = contentsHeight + block:GetHeight() end end self:SetHeight(contentsHeight) end function module:GetBlock(index) local block =self.blocks[index] if not block then block = CreateFrame('Button', 'VeneerRosterKunBlock'..index, self, 'VeneerRosterKunBlock') block:SetID(index) self.blocks[index] = block end return block end function module:UpdateAchievementLinks(offset) print('UpdateAchievementLinks()') offset = offset or 0 local resultID = LFGListFrame.SearchPanel.selectedResult or self.selectedID self:Show() local contentsHeight = 0 for _, group in ipairs(cheevos) do for _, id in ipairs(group) do local _, name, points, completed, month, day, year, description, flags, icon = GetAchievementInfo(id) print('checking', id, name) if completed then -- if the highest mythic kill if listed[overlaps[id]] then break end offset = offset + 1 local block = self:GetBlock(offset) block:SetScript('OnClick', cheev.OnClick) --print(index) block.link = GetAchievementLink(id) block.Icon:SetTexture(icon) block.Label:SetText(name) block.buttonType = 'cheevo' contentsHeight = contentsHeight + block:GetHeight() --print(index, name, icon) listed[id] = true break; end end end self.lastAchievement = lastBlock return offset, contentsHeight --[[ --]] end function module:SetupGuildUI() self:UnregisterEvent('ADDON_LOADED') end function module:OnEvent(event, ...) print('|cFFFF0088OnEvent()|r', event, ...) if event == 'ADDON_LOADED' then local addon = ... if addon == 'Blizzard_GuildUI' then self:SetupGuildUI() end elseif event == 'LFG_LIST_SEARCH_RESULTS_RECEIVED' then elseif event == 'LFG_LIST_SEARCH_RESULT_UPDATED' then end end