Mercurial > wow > buffalo2
comparison 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 |
comparison
equal
deleted
inserted
replaced
22:9b3fa734abff | 23:e837384ac363 |
---|---|
1 --- ${PACKAGE_NAME} | |
2 -- @file-author@ | |
3 -- @project-revision@ @project-hash@ | |
4 -- @file-revision@ @file-hash@ | |
5 -- Created: 3/29/2016 7:07 PM | |
6 local B = select(2,...).frame | |
7 local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') | |
8 local print = B.print('Objectives') | |
9 local Default, AutoQuest, Quest, Cheevs = mod.DefaultHandler, mod.AutoQuest, mod.Quest, mod.Cheevs | |
10 local itemButtonSize, itemButtonSpacing = 36, 1 | |
11 local tremove, tremovebyval = table.remove, table.removebyval | |
12 | |
13 -------------------------------------------------------------------- | |
14 --- Functions responsible for: | |
15 --- - UI interactions that propagate to the BlizzardUI (sending RemoveQuestWatch() on remove quest action) | |
16 --- - | |
17 -------------------------------------------------------------------- | |
18 | |
19 Default.Select = function(self) end | |
20 Default.Open = function(self) end | |
21 Default.Remove = function(self) end | |
22 Default.Report = function(self) | |
23 print('Stats:', self.numWatched,'items tracked,', self.numBlocks,'blocks assigned.') | |
24 end | |
25 | |
26 Default.OnMouseUp = function(self, button) | |
27 print(self.handler.name, self.mainStyle, self.subStyle) | |
28 if button == 'LeftButton' then | |
29 if IsModifiedClick("CHATLINK") and ChatEdit_GetActiveWindow() then | |
30 self:Link() | |
31 elseif IsModifiedClick("QUESTWATCHTOGGLE") then | |
32 self:Remove() | |
33 else | |
34 self:Select() | |
35 end | |
36 elseif button == 'RightButton' then | |
37 self:Open() | |
38 end | |
39 self.initialButton = nil | |
40 self.modChatLink = nil | |
41 self.modQuestWatch = nil | |
42 mod:Update(self.handler.updateReasonModule) | |
43 print('|cFFFF8800'..tostring(self:GetName())..':MouseUp()|r') | |
44 end | |
45 | |
46 Default.OnMouseDown = function(self, button) | |
47 print(IsModifiedClick("CHATLINK"), IsModifiedClick("QUESTWATCHTOGGLE")) | |
48 print(self.info.title) | |
49 end | |
50 | |
51 | |
52 AutoQuest.Select = function(self) | |
53 if self.info.popupType == 'OFFER' then | |
54 ShowQuestOffer(self.info.questIndex) | |
55 else | |
56 ShowQuestComplete(self.info.questIndex) | |
57 end | |
58 RemoveAutoQuestPopUp(self.info.questID) | |
59 end | |
60 | |
61 Quest.Select = function(self) | |
62 if self.info.isAutoComplete and self.info.isComplete then | |
63 ShowQuestComplete(self.info.questLogIndex) | |
64 else | |
65 SetSuperTrackedQuestID(self.info.questID) | |
66 end | |
67 end | |
68 | |
69 Quest.Link = function(self) | |
70 local questLink = GetQuestLink(block.questLogIndex); | |
71 if ( questLink ) then | |
72 ChatEdit_InsertLink(questLink); | |
73 end | |
74 end | |
75 Quest.Open = function(self) | |
76 QuestMapFrame_OpenToQuestDetails(self.info.questID) | |
77 end | |
78 | |
79 Quest.Remove = function(self) | |
80 print('removing', self.info.questLogIndex, 'from watcher') | |
81 RemoveQuestWatch(self.info.questLogIndex) | |
82 end | |
83 | |
84 | |
85 ----------------------------- | |
86 --- CHEEVS | |
87 Cheevs.Select = function(self) | |
88 --mod:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_ACHIEVEMENT) | |
89 end | |
90 Cheevs.Remove = function(self) | |
91 RemoveTrackedAchievement(self.info.cheevID) | |
92 end | |
93 Cheevs.OnMouseUp = function(self, button) | |
94 Default.OnMouseUp(self, button) | |
95 end | |
96 Cheevs.Link = function(self) | |
97 local achievementLink = GetAchievementLink(self.info.cheevID); | |
98 if ( achievementLink ) then | |
99 ChatEdit_InsertLink(achievementLink); | |
100 end | |
101 end | |
102 | |
103 Cheevs.Open = function(self) | |
104 if ( not AchievementFrame ) then | |
105 AchievementFrame_LoadUI(); | |
106 end | |
107 if ( not AchievementFrame:IsShown() ) then | |
108 AchievementFrame_ToggleAchievementFrame(); | |
109 end | |
110 AchievementFrame_SelectAchievement(self.info.cheevID); | |
111 end | |
112 | |
113 local Bonus = mod.Bonus | |
114 Bonus.Select = function(self, questID) | |
115 Bonus:OnTurnIn(self.info.questID, 0, 30800) | |
116 end | |
117 Bonus.Remove = function(self, questID) | |
118 end |