Mercurial > wow > buffalo2
comparison ObjectiveInfo.lua @ 18:d1812fb10ae6
ObjectiveStyle
- move tag/template logic into the corresponding GetInfo
author | Nenue |
---|---|
date | Tue, 05 Apr 2016 02:38:01 -0400 |
parents | 880828018bf4 |
children | 605e8f0e46db |
comparison
equal
deleted
inserted
replaced
17:c33497b116d6 | 18:d1812fb10ae6 |
---|---|
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, format = table.wipe, pairs, ipairs, min, max, unpack, format |
3 local tinsert, tostring = tinsert, tostring | |
4 local GetQuestTagInfo, GetQuestLogTitle = GetQuestTagInfo, GetQuestLogTitle | |
5 local GetNumQuestLogEntries, GetNumQuestWatches, GetQuestLogCompletionText, IsQuestWatched, IsQuestHardWatched, GetQuestLogSpecialItemInfo, GetQuestLogSpecialItemCooldown = GetNumQuestLogEntries, GetNumQuestWatches, GetQuestLogCompletionText, IsQuestWatched, IsQuestHardWatched, GetQuestLogSpecialItemInfo, GetQuestLogSpecialItemCooldown | |
6 local GetNumAutoQuestPopUps, GetAutoQuestPopUp, GetTasksTable, GetNumQuestLogTasks, GetTaskInfo, GetQuestObjectiveInfo = GetNumAutoQuestPopUps, GetAutoQuestPopUp, GetTasksTable, GetNumQuestLogTasks, GetTaskInfo, GetQuestObjectiveInfo | |
7 local GetNumQuestLogRewardCurrencies, GetQuestLogRewardCurrencyInfo, GetNumQuestLogRewards, GetQuestLogRewardInfo, GetQuestLogRewardMoney, GetMoneyString = GetNumQuestLogRewardCurrencies, GetQuestLogRewardCurrencyInfo, GetNumQuestLogRewards, GetQuestLogRewardInfo, GetQuestLogRewardMoney, GetMoneyString | |
3 local GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo = GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo | 8 local GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo = GetNumQuestLeaderBoards, GetAchievementNumCriteria, GetQuestLogLeaderBoard, GetAchievementCriteriaInfo |
4 local GetQuestWatchIndex, GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo = GetQuestWatchIndex, GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo | 9 local GetQuestWatchIndex, GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo = GetQuestWatchIndex, GetQuestLogIndexByID, GetSuperTrackedQuestID, SetSuperTrackedQuestID, GetQuestWatchInfo |
10 local QuestHasPOIInfo, GetDistanceSqToQuest, GetQuestFactionGroup = QuestHasPOIInfo, GetDistanceSqToQuest, GetQuestFactionGroup | |
11 local GetTrackedAchievements, GetNumTrackedAchievements, GetAchievementInfo = GetTrackedAchievements, GetNumTrackedAchievements, GetAchievementInfo | |
5 local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') | 12 local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') |
6 local print = B.print('TrackerInfo') | 13 local print = B.print('TrackerInfo') |
14 local QUEST_TAG_DUNGEON = QUEST_TAG_DUNGEON | |
15 local QUEST_TAG_GROUP = QUEST_TAG_GROUP | |
16 local QUEST_TAG_ACCOUNT = QUEST_TAG_ACCOUNT | |
17 local QUEST_TAG_TCOORDS = QUEST_TAG_TCOORDS | |
18 local LE_QUEST_FREQUENCY_DAILY = LE_QUEST_FREQUENCY_DAILY | |
19 local LE_QUEST_FREQUENCY_WEEKLY = LE_QUEST_FREQUENCY_WEEKLY | |
20 local FACTION_ALLIANCE, LE_QUEST_FACTION_HORDE, FACTION_HORDE, LE_QUEST_FACTION_HORDE = FACTION_ALLIANCE, LE_QUEST_FACTION_HORDE, FACTION_HORDE, LE_QUEST_FACTION_HORDE | |
7 | 21 |
8 local Tracker, Bonus, AutoQuest, Quest, Cheevs = mod.Tracker, mod.Bonus, mod.AutoQuest, mod.Quest, mod.Cheevs | 22 local Tracker, Bonus, AutoQuest, Quest, Cheevs = mod.Tracker, mod.Bonus, mod.AutoQuest, mod.Quest, mod.Cheevs |
9 -------------------------------------------------------------------- | 23 -------------------------------------------------------------------- |
10 --- Tracker-specific data retrieval functions | 24 --- Tracker-specific data retrieval functions |
11 -------------------------------------------------------------------- | 25 -------------------------------------------------------------------- |
166 Quest.freeButtons = {} | 180 Quest.freeButtons = {} |
167 Quest.POI = {} | 181 Quest.POI = {} |
168 Quest.QuestBlock = {} | 182 Quest.QuestBlock = {} |
169 Quest.LogBlock = {} | 183 Quest.LogBlock = {} |
170 Quest.LogInfo = {} | 184 Quest.LogInfo = {} |
185 | |
171 Quest.GetNumWatched = function() | 186 Quest.GetNumWatched = function() |
172 Quest.numAll = GetNumQuestLogEntries() | 187 Quest.numAll = GetNumQuestLogEntries() |
173 Quest.numWatched = GetNumQuestWatches() | 188 Quest.numWatched = GetNumQuestWatches() |
174 return Quest.numWatched | 189 return Quest.numWatched |
175 end | 190 end |
177 print('|cFF00DDFFQuest|r.|cFF0088FFGetInfo(|r'.. tostring(watchIndex)..'|r)') | 192 print('|cFF00DDFFQuest|r.|cFF0088FFGetInfo(|r'.. tostring(watchIndex)..'|r)') |
178 local questID, title, questIndex, numObjectives, requiredMoney, isComplete, | 193 local questID, title, questIndex, numObjectives, requiredMoney, isComplete, |
179 startEvent, isAutoComplete, failureTime, timeElapsed, questType, isTask, isStory, isOnMap, hasLocalPOI = GetQuestWatchInfo(watchIndex) | 194 startEvent, isAutoComplete, failureTime, timeElapsed, questType, isTask, isStory, isOnMap, hasLocalPOI = GetQuestWatchInfo(watchIndex) |
180 | 195 |
181 local _, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, _, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(questIndex) | 196 local _, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, _, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(questIndex) |
182 local questTagID, tagName = GetQuestTagInfo(questID); | 197 |
183 | 198 |
184 if not questID then | 199 if not questID then |
185 return | 200 return |
186 end | 201 end |
187 Quest.Info[questID] = Quest.Info[questID] or {} | 202 Quest.Info[questID] = Quest.Info[questID] or {} |
190 q.watchIndex = watchIndex | 205 q.watchIndex = watchIndex |
191 q.type = 'Quest' | 206 q.type = 'Quest' |
192 q.questID = questID | 207 q.questID = questID |
193 q.title = title | 208 q.title = title |
194 q.level = level | 209 q.level = level |
210 q.displayQuestID = displayQuestID | |
211 q.suggestedGroup = suggestedGroup | |
195 q.questLogIndex = questIndex | 212 q.questLogIndex = questIndex |
196 q.numObjectives = numObjectives | 213 q.numObjectives = numObjectives |
197 q.requiredMoney = requiredMoney | 214 q.requiredMoney = requiredMoney |
198 q.isComplete = isComplete | 215 q.isComplete = isComplete |
199 q.startEvent = startEvent | 216 q.startEvent = startEvent |
203 q.questType = questType | 220 q.questType = questType |
204 q.isTask = isTask | 221 q.isTask = isTask |
205 q.isStory = isStory | 222 q.isStory = isStory |
206 q.isOnMap = isOnMap | 223 q.isOnMap = isOnMap |
207 q.hasLocalPOI = hasLocalPOI | 224 q.hasLocalPOI = hasLocalPOI |
208 | 225 q.frequency = frequency |
209 q.isDaily = ( frequency == LE_QUEST_FREQUENCY_DAILY and (not isComplete or isComplete == 0) ) | |
210 q.isWeekly = ( frequency == LE_QUEST_FREQUENCY_WEEKLY and (not isComplete or isComplete == 0) ) | |
211 q.isComplete = isComplete | 226 q.isComplete = isComplete |
212 q.isStory = isStory | 227 q.isStory = isStory |
213 q.isTask = isTask | 228 q.isTask = isTask |
214 | 229 |
215 if isTask then | 230 --- resolve icon type and template |
216 --q.task = Bonus.GetInfo(questID) | 231 local tagID, tagName = GetQuestTagInfo(questID) |
217 end | 232 if ( tagName ) then |
233 local factionGroup = GetQuestFactionGroup(questID); | |
234 -- Faction-specific account quests have additional info in the tooltip | |
235 if ( tagID == QUEST_TAG_ACCOUNT and factionGroup ) then | |
236 local factionString = FACTION_ALLIANCE; | |
237 if ( factionGroup == LE_QUEST_FACTION_HORDE ) then | |
238 factionString = FACTION_HORDE; | |
239 end | |
240 tagName = format("%s (%s)", tagName, factionString); | |
241 end | |
242 if ( QUEST_TAG_TCOORDS[tagID] ) then | |
243 local questTypeIcon; | |
244 if ( tagID == QUEST_TAG_ACCOUNT and factionGroup ) then | |
245 q.typeTag = QUEST_TAG_TCOORDS["ALLIANCE"]; | |
246 if ( factionGroup == LE_QUEST_FACTION_HORDE ) then | |
247 q.typeTag= QUEST_TAG_TCOORDS["HORDE"]; | |
248 end | |
249 else | |
250 q.typeTag = QUEST_TAG_TCOORDS[tagID]; | |
251 end | |
252 end | |
253 end | |
254 | |
255 if ( frequency == LE_QUEST_FREQUENCY_DAILY ) then | |
256 q.frequencyTag = QUEST_TAG_TCOORDS["DAILY"] | |
257 q.mainStyle = 'Daily' | |
258 elseif ( frequency == LE_QUEST_FREQUENCY_WEEKLY ) then | |
259 q.frequencyTag = QUEST_TAG_TCOORDS["WEEKLY"] | |
260 q.mainStyle = 'Daily' | |
261 end | |
262 if ( isComplete and isComplete < 0 ) then | |
263 q.completionTag = QUEST_TAG_TCOORDS["FAILED"] | |
264 q.subStyle = 'Failed' | |
265 elseif isComplete then | |
266 q.completionTag = QUEST_TAG_TCOORDS["COMPLETED"] | |
267 q.subStyle = 'Complete' | |
268 end | |
269 q.tagID = tagID | |
270 q.tagName = tagName | |
271 | |
272 | |
218 | 273 |
219 --q.isBreadCrumb = isBreadCrumb | 274 --q.isBreadCrumb = isBreadCrumb |
220 q.completionText= GetQuestLogCompletionText(questIndex) | 275 q.completionText= GetQuestLogCompletionText(questIndex) |
221 q.numObjectives = GetNumQuestLeaderBoards(questIndex) | 276 q.numObjectives = GetNumQuestLeaderBoards(questIndex) |
222 q.isWatched = IsQuestWatched(questIndex) | |
223 q.isHardWatched = IsQuestHardWatched(questIndex) | |
224 q.objectives = {} | 277 q.objectives = {} |
225 for i = 1, q.numObjectives do | 278 for i = 1, q.numObjectives do |
226 local text, type, finished = GetQuestLogLeaderBoard(i, questIndex) | 279 local text, type, finished = GetQuestLogLeaderBoard(i, questIndex) |
227 q.objectives[i] = { | 280 q.objectives[i] = { |
228 index = i, | 281 index = i, |
251 duration = duration, | 304 duration = duration, |
252 enable = enable, | 305 enable = enable, |
253 } | 306 } |
254 end | 307 end |
255 | 308 |
256 | |
257 if QuestHasPOIInfo(questID) then | 309 if QuestHasPOIInfo(questID) then |
258 local distance, onContinent = GetDistanceSqToQuest(questIndex) | 310 local distance, onContinent = GetDistanceSqToQuest(questIndex) |
259 if distance ~= nil and distance > 0 then | 311 if distance ~= nil and distance > 0 then |
260 self.POI[questIndex] = { | 312 self.POI[questIndex] = { |
261 questIndex = questIndex, | 313 questIndex = questIndex, |
264 onContinent = onContinent | 316 onContinent = onContinent |
265 } | 317 } |
266 end | 318 end |
267 end | 319 end |
268 | 320 |
269 q.superTracked = (questID == GetSuperTrackedQuestID()) -- call directly so artifact data doesn't become an issue | 321 |
322 q.selected = (questID == GetSuperTrackedQuestID()) -- call directly so artifact data doesn't become an issue | |
270 self.WatchInfo[watchIndex] = q | 323 self.WatchInfo[watchIndex] = q |
271 self.LogInfo[questIndex] = q | 324 self.LogInfo[questIndex] = q |
272 print('- logIndex =', questIndex, 'title =', title) | 325 print('- logIndex =', questIndex, 'title =', title) |
273 return q | 326 return q |
274 end | 327 end |