Mercurial > wow > buffalo2
comparison ObjectiveInfo.lua @ 14:ed642234f017
ObjectiveFrame
- implement proper tracker name text
- expanded tracker prototypes to cover "objective lines" formatting and accommodation of widget variables
- implement the progress bars for bonus objectives
ObjectiveStyle
- moved `UpdateWrapperStyle` over and renamed it to fit semantics
- change the formula for block.`height` to measure non-widget content only
- allows widgets to position relative to text
- size FontString `status` to match block.`height`
- full block height is acquired by adding block.`height` and block.`attachmentHeight` which is calculated during objective parsing
ObjectiveWidgets
- use string keys for generated widgets to deal with multiple objectives under the same questID, and maybe dungeon objectives
- wrapper buttons use a common code path
- specialized handlers for wheel scrolling moved over to fit semantics
author | Nenue |
---|---|
date | Mon, 04 Apr 2016 03:16:22 -0400 |
parents | 9455693fc290 |
children | 880828018bf4 |
comparison
equal
deleted
inserted
replaced
13:9455693fc290 | 14:ed642234f017 |
---|---|
1 local B = select(2,...).frame | 1 local B = select(2,...).frame |
2 local wipe, pairs, ipairs, min, max, unpack = table.wipe, pairs, ipairs, min, max, unpack | 2 local wipe, pairs, ipairs, min, max, unpack = table.wipe, pairs, ipairs, min, max, unpack |
3 local GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo = GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo | 3 local GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo = GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo |
4 local GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo = GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo | 4 local GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo = GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo |
5 local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') | 5 local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') |
6 local print = B.print('Objectives') | 6 local print = B.print('TrackerInfo') |
7 | 7 |
8 local Tracker, AutoQuest, Quest, Cheevs = mod.Tracker, mod.AutoQuest, mod.Quest, mod.Cheevs | 8 local Tracker, Bonus, AutoQuest, Quest, Cheevs = mod.Tracker, mod.Bonus, mod.AutoQuest, mod.Quest, mod.Cheevs |
9 -------------------------------------------------------------------- | 9 -------------------------------------------------------------------- |
10 --- Tracker-specific data retrieval functions | 10 --- Tracker-specific data retrieval functions |
11 -------------------------------------------------------------------- | 11 -------------------------------------------------------------------- |
12 | 12 |
13 | 13 |
14 ----------------------------- | 14 ----------------------------- |
15 --- AUTO_QUEST | 15 --- AUTO_QUEST |
16 AutoQuest.name = "Remote Quests" | |
17 AutoQuest.GetNumWatched = GetNumAutoQuestPopUps | 16 AutoQuest.GetNumWatched = GetNumAutoQuestPopUps |
18 AutoQuest.GetInfo = function(watchIndex) | 17 AutoQuest.GetInfo = function(watchIndex) |
19 return Quest.GetInfo(watchIndex) | 18 return Quest.GetInfo(watchIndex) |
20 end | 19 end |
21 | 20 |
22 ----------------------------- | 21 ----------------------------- |
22 --- BONUS OBJECTIVE | |
23 Bonus.TasksTable = {} | |
24 Bonus.TasksPOI = {} | |
25 Bonus.TaskScenario = {} | |
26 | |
27 local taskData = {} | |
28 Bonus.QuestBlock = {} | |
29 Bonus.GetNumWatched = function() | |
30 Bonus.TasksTable = GetTasksTable() | |
31 local numTasks = 0 | |
32 for i, questID in ipairs(Bonus.TasksTable) do | |
33 local isInArea, isOnMap, numObjectives = GetTaskInfo(questID) | |
34 if isInArea and isOnMap then | |
35 numTasks = numTasks + 1 | |
36 end | |
37 end | |
38 Bonus.numAll = #Bonus.TasksTable | |
39 Bonus.numWatched = numTasks | |
40 return GetNumQuestLogTasks() | |
41 end | |
42 Bonus.GetInfo = function(self, watchIndex) | |
43 local questID = Bonus.TasksTable[watchIndex] | |
44 if not questID then | |
45 print('|cFFFF4400no quest ID for row', watchIndex) | |
46 return | |
47 end | |
48 | |
49 | |
50 local t= {} | |
51 t.isInArea, t.isOnMap, t.numObjectives = GetTaskInfo(questID) | |
52 | |
53 print('isInArea', t.isInArea, 'isOnMap', t.isOnMap, 'numObj', t.numObjectives) | |
54 t.displayObjectives = false | |
55 t.isComplete = true | |
56 t.questID = questID | |
57 if t.numObjectives >= 1 then | |
58 print(t.numObjectives,'objective rows') | |
59 t.objectives = {} | |
60 for i = 1, t.numObjectives do | |
61 t.objectives[i] = {} | |
62 local o = t.objectives[i] | |
63 o.index = i | |
64 o.text, o.objectiveType, o.finished, o.displayAsObjective = GetQuestObjectiveInfo(questID, i, true) | |
65 | |
66 print(i, '==>', o.text, o.objectiveType, o.finished, o.displayAsObjective) | |
67 t.displayObjectives = t.displayObjectives or o.displayAsObjective | |
68 t.isComplete = t.isComplete and o.finished | |
69 | |
70 end | |
71 end | |
72 Bonus.TasksTable[questID] = t | |
73 | |
74 return t | |
75 end | |
76 | |
77 ----------------------------- | |
23 --- QUEST | 78 --- QUEST |
24 Quest.name = "Quests" | |
25 Quest.itemButtons = {} | 79 Quest.itemButtons = {} |
26 Quest.freeButtons = {} | 80 Quest.freeButtons = {} |
27 Quest.POI = {} | 81 Quest.POI = {} |
28 Quest.QuestBlock = {} | 82 Quest.QuestBlock = {} |
29 Quest.GetNumWatched = function() | 83 Quest.GetNumWatched = function() |
30 return GetNumQuestWatches () | 84 Quest.numAll = GetNumQuestLogEntries() |
85 Quest.numWatched = GetNumQuestWatches() | |
86 return Quest.numWatched | |
31 end | 87 end |
32 Quest.GetInfo = function (self, watchIndex) | 88 Quest.GetInfo = function (self, watchIndex) |
33 print('|cFF00DDFFQuest|r.|cFF0088FFGetInfo(|r'.. tostring(watchIndex)..'|r)') | 89 print('|cFF00DDFFQuest|r.|cFF0088FFGetInfo(|r'.. tostring(watchIndex)..'|r)') |
34 local questID, title, questIndex, numObjectives, requiredMoney, isComplete, | 90 local questID, title, questIndex, numObjectives, requiredMoney, isComplete, |
35 startEvent, isAutoComplete, failureTime, timeElapsed, questType, isTask, isStory, isOnMap, hasLocalPOI = GetQuestWatchInfo(watchIndex) | 91 startEvent, isAutoComplete, failureTime, timeElapsed, questType, isTask, isStory, isOnMap, hasLocalPOI = GetQuestWatchInfo(watchIndex) |
36 | 92 |
37 local _, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(questIndex) | 93 local _, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, _, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(questIndex) |
38 local questTagID, tagName = GetQuestTagInfo(questID); | 94 local questTagID, tagName = GetQuestTagInfo(questID); |
39 | 95 |
40 if not questID then | 96 if not questID then |
41 return | 97 return |
42 end | 98 end |
65 q.isDaily = ( frequency == LE_QUEST_FREQUENCY_DAILY and (not isComplete or isComplete == 0) ) | 121 q.isDaily = ( frequency == LE_QUEST_FREQUENCY_DAILY and (not isComplete or isComplete == 0) ) |
66 q.isWeekly = ( frequency == LE_QUEST_FREQUENCY_WEEKLY and (not isComplete or isComplete == 0) ) | 122 q.isWeekly = ( frequency == LE_QUEST_FREQUENCY_WEEKLY and (not isComplete or isComplete == 0) ) |
67 q.isComplete = isComplete | 123 q.isComplete = isComplete |
68 q.isStory = isStory | 124 q.isStory = isStory |
69 q.isTask = isTask | 125 q.isTask = isTask |
126 | |
127 if isTask then | |
128 --q.task = Bonus.GetInfo(questID) | |
129 end | |
130 | |
70 --q.isBreadCrumb = isBreadCrumb | 131 --q.isBreadCrumb = isBreadCrumb |
71 q.completionText= GetQuestLogCompletionText(questIndex) | 132 q.completionText= GetQuestLogCompletionText(questIndex) |
72 q.numObjectives = GetNumQuestLeaderBoards(questIndex) | 133 q.numObjectives = GetNumQuestLeaderBoards(questIndex) |
73 q.isWatched = IsQuestWatched(questIndex) | 134 q.isWatched = IsQuestWatched(questIndex) |
74 q.isHardWatched = IsQuestHardWatched(questIndex) | 135 q.isHardWatched = IsQuestHardWatched(questIndex) |
75 q.objectives = {} | 136 q.objectives = {} |
76 for i = 1, q.numObjectives do | 137 for i = 1, q.numObjectives do |
77 local text, type, finished = GetQuestLogLeaderBoard(i, questIndex) | 138 local text, type, finished = GetQuestLogLeaderBoard(i, questIndex) |
78 q.objectives[i] = { | 139 q.objectives[i] = { |
140 index = i, | |
79 type = type, | 141 type = type, |
80 text = text, | 142 text = text, |
81 finished = finished | 143 finished = finished |
82 } | 144 } |
83 if type == 'event' then | 145 if type == 'event' then |
154 c.numObjectives = GetAchievementNumCriteria(cheevID) | 216 c.numObjectives = GetAchievementNumCriteria(cheevID) |
155 c.objectives = {} | 217 c.objectives = {} |
156 for i = 1, c.numObjectives do | 218 for i = 1, c.numObjectives do |
157 local description, type, completed, quantity, requiredQuantity, characterName, flags, assetID, quantityString, criteriaID = GetAchievementCriteriaInfo(cheevID, i) | 219 local description, type, completed, quantity, requiredQuantity, characterName, flags, assetID, quantityString, criteriaID = GetAchievementCriteriaInfo(cheevID, i) |
158 c.objectives[i] = { | 220 c.objectives[i] = { |
221 index = i, | |
159 cheevID = cheevID, | 222 cheevID = cheevID, |
160 text = description, | 223 text = description, |
161 type = type, | 224 type = type, |
162 finished = completed, | 225 finished = completed, |
163 quantity = quantity, | 226 value = quantity, |
164 requiredQuantity = requiredQuantity, | 227 maxValue = requiredQuantity, |
165 characterName = characterName, | 228 characterName = characterName, |
166 flags = flags, | 229 flags = flags, |
167 assetID = assetID, | 230 assetID = assetID, |
168 quantityString = quantityString, | 231 quantityString = quantityString, |
169 criteriaID = criteriaID, | 232 criteriaID = criteriaID, |