Mercurial > wow > buffalo2
view ObjectiveUI.lua @ 20:6bd2102d340b
ObjectiveCore
- sorting out oddball events
author | Nenue |
---|---|
date | Wed, 06 Apr 2016 07:54:19 -0400 |
parents | 605e8f0e46db |
children | d5ee940de273 |
line wrap: on
line source
--- ${PACKAGE_NAME} -- @file-author@ -- @project-revision@ @project-hash@ -- @file-revision@ @file-hash@ -- Created: 3/29/2016 7:07 PM local B = select(2,...).frame local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') local print = B.print('Objectives') local DefaultTracker, AutoQuest, Quest, Cheevs = mod.DefaultTracker, mod.AutoQuest, mod.Quest, mod.Cheevs local itemButtonSize, itemButtonSpacing = 36, 1 local tremove, tremovebyval = table.remove, table.removebyval -------------------------------------------------------------------- --- Functions responsible for: --- - UI interactions that propagate to the BlizzardUI (sending RemoveQuestWatch() on remove quest action) --- - -------------------------------------------------------------------- DefaultTracker.Select = function(self) end DefaultTracker.Open = function(self) end DefaultTracker.Remove = function(self) end DefaultTracker.Report = function(self) print('Stats:', self.numWatched,'items tracked,', self.numBlocks,'blocks assigned.') end DefaultTracker.OnMouseUp = function(self, button) print(self.handler.name, self.mainStyle, self.subStyle) if button == 'LeftButton' then if IsModifiedClick("CHATLINK") and ChatEdit_GetActiveWindow() then self:Link() elseif IsModifiedClick("QUESTWATCHTOGGLE") then self:Remove() else self:Select() end elseif button == 'RightButton' then self:Open() end self.initialButton = nil self.modChatLink = nil self.modQuestWatch = nil self:SetStyle('TrackerBlock', self.handler.name, self.mainStyle, self.subStyle) print('|cFFFF8800'..tostring(self:GetName())..':MouseUp()|r') end DefaultTracker.OnMouseDown = function(self, button) self:SetStyle('TrackerBlock', self.handler.name, 'MouseDown') print(IsModifiedClick("CHATLINK"), IsModifiedClick("QUESTWATCHTOGGLE")) print(self.info.title) end AutoQuest.Select = function(self) if self.info.popupType == 'OFFER' then ShowQuestOffer(self.info.questIndex) else ShowQuestComplete(self.info.questIndex) end RemoveAutoQuestPopUp(self.info.questID) end Quest.Select = function(self) if self.info.isAutoComplete and self.info.isComplete then ShowQuestComplete(self.info.questLogIndex) else SetSuperTrackedQuestID(self.info.questID) end end Quest.Link = function(self) local questLink = GetQuestLink(block.questLogIndex); if ( questLink ) then ChatEdit_InsertLink(questLink); end end Quest.Open = function(self) QuestMapFrame_OpenToQuestDetails(self.info.questID) end Quest.Remove = function(self) print('removing', self.info.questLogIndex, 'from watcher') RemoveQuestWatch(self.info.questLogIndex) end ----------------------------- --- CHEEVS Cheevs.Select = function(self) self:SetStyle('TrackerBlock', self.info.type, 'Normal') end Cheevs.Remove = function(self) RemoveTrackedAchievement(self.info.cheevID) end Cheevs.OnMouseUp = function(self, button) DefaultTracker.OnMouseUp(self, button) end Cheevs.Link = function(self) local achievementLink = GetAchievementLink(self.info.cheevID); if ( achievementLink ) then ChatEdit_InsertLink(achievementLink); end end Cheevs.Open = function(self) if ( not AchievementFrame ) then AchievementFrame_LoadUI(); end if ( not AchievementFrame:IsShown() ) then AchievementFrame_ToggleAchievementFrame(); end AchievementFrame_SelectAchievement(self.info.cheevID); end