Mercurial > wow > buffalo2
view ObjectiveTracker/ObjectiveUI.lua @ 23:e837384ac363
Separating objective tracker module
author | Nenue |
---|---|
date | Sun, 10 Apr 2016 04:35:32 -0400 |
parents | ObjectiveUI.lua@9b3fa734abff |
children | 4b3da1b221de |
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 Default, AutoQuest, Quest, Cheevs = mod.DefaultHandler, 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) --- - -------------------------------------------------------------------- Default.Select = function(self) end Default.Open = function(self) end Default.Remove = function(self) end Default.Report = function(self) print('Stats:', self.numWatched,'items tracked,', self.numBlocks,'blocks assigned.') end Default.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 mod:Update(self.handler.updateReasonModule) print('|cFFFF8800'..tostring(self:GetName())..':MouseUp()|r') end Default.OnMouseDown = function(self, button) 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) --mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT) end Cheevs.Remove = function(self) RemoveTrackedAchievement(self.info.cheevID) end Cheevs.OnMouseUp = function(self, button) Default.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 local Bonus = mod.Bonus Bonus.Select = function(self, questID) Bonus:OnTurnIn(self.info.questID, 0, 30800) end Bonus.Remove = function(self, questID) end