Mercurial > wow > buffalo2
comparison ObjectiveTracker/QuestData.lua @ 44:756e8aeb040b
- Default.lua
- simplified the response to SuperTrackedQuestID changes
- tag icons work again
author | Nenue |
---|---|
date | Mon, 25 Apr 2016 19:37:13 -0400 |
parents | 9480bd904f4c |
children | dd1ae565f559 |
comparison
equal
deleted
inserted
replaced
43:9480bd904f4c | 44:756e8aeb040b |
---|---|
52 print(' weekly', info.frequency) | 52 print(' weekly', info.frequency) |
53 block_schema = 'weekly' | 53 block_schema = 'weekly' |
54 end | 54 end |
55 local completionText | 55 local completionText |
56 if info.isComplete then | 56 if info.isComplete then |
57 if info.isAutoComplete then | 57 if T.Conf.ShowCompletionText then |
58 local questID, popupType = GetAutoQuestPopUp(info.logIndex) | 58 self:AddLine(block, info.completionText, nil, 'complete') |
59 if popupType == 'COMPLETE' then | 59 end |
60 print(' :: auto-complete quest :: set the message') | 60 if not T.Conf.ShowObjectivesWhenComplete then |
61 self:AddLine(block, T.strings.CLICK_TO_COMPLETE, nil, 'complete') | 61 displayObjectives = false |
62 end | 62 end |
63 else | |
64 if not completionText or info.completionText then | |
65 info.completionText = GetQuestLogCompletionText(info.logIndex) | |
66 end | |
67 end | |
68 self:AddLine(block, info.completionText, nil, 'complete') | |
69 displayObjectives = false | |
70 print('|cFF'..self.internalColor..' :: complete quest :: show instruction: "'.. tostring(info.completionText) .. '"') | 63 print('|cFF'..self.internalColor..' :: complete quest :: show instruction: "'.. tostring(info.completionText) .. '"') |
64 block_schema = 'complete' | |
71 end | 65 end |
72 | 66 |
73 Default.UpdateObjectives(self, block, block_schema, displayObjectives) | 67 Default.UpdateObjectives(self, block, block_schema, displayObjectives) |
74 return 0, block_schema | 68 return 0, block_schema |
75 end | 69 end |
113 inScenario = C_Scenario.IsInScenario(); | 107 inScenario = C_Scenario.IsInScenario(); |
114 showPOIs = GetCVarBool("questPOI"); | 108 showPOIs = GetCVarBool("questPOI"); |
115 local numAll = GetNumQuestLogEntries() | 109 local numAll = GetNumQuestLogEntries() |
116 local numWatched = GetNumQuestWatches() | 110 local numWatched = GetNumQuestWatches() |
117 local bottomIndex = 1 | 111 local bottomIndex = 1 |
118 print('GetNumWatched', self.name, numWatched, 'of', numAll) | |
119 local start, limit = 1, numAll | 112 local start, limit = 1, numAll |
120 | 113 |
121 if id and not added then | 114 if id and not added then |
122 -- if a particular id is supplied, add to checklist | 115 -- if a particular id is supplied, add to checklist |
123 if self.InfoBlock[id] then | 116 if self.InfoBlock[id] then |
124 blocksChecked[self.InfoBlock[id]] = self.InfoBlock[id] | 117 blocksChecked[self.InfoBlock[id]] = self.InfoBlock[id] |
125 end | 118 end |
126 end | 119 end |
127 | 120 |
128 numAnimating = 0 | 121 numAnimating = 0 |
122 local numEntries = 0 | |
129 for logIndex = start, limit do | 123 for logIndex = start, limit do |
130 local reason1, reason2 = '', '' | 124 local reason1, reason2 = '', '' |
131 local title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(logIndex) | 125 local title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(logIndex) |
132 local watchIndex = GetQuestWatchIndex(logIndex) | 126 local watchIndex = GetQuestWatchIndex(logIndex) |
133 | 127 |
159 end | 153 end |
160 --- end of crazy audit flagging | 154 --- end of crazy audit flagging |
161 | 155 |
162 -- add to watch index if: the questID is non-zero | 156 -- add to watch index if: the questID is non-zero |
163 if questID ~= 0 then | 157 if questID ~= 0 then |
164 self.Info[questID] = self:GetInfo(logIndex, watchIndex) | 158 self:GetInfo(logIndex, watchIndex) |
165 print('GetQuests', format('request info |cFF00FF00%2d|r |cFFFFFF00%6d|r |cFFFF4400%3s|r', logIndex, questID, tostring(watchIndex or ''))) | 159 print('GetQuests', format('request info |cFF00FF00%2d|r |cFFFFFF00%6d|r |cFFFF4400%3s|r |cFF00FFFF%3s|r', logIndex, questID, tostring(watchIndex or ''), numEntries)) |
166 end | 160 end |
167 end | 161 end |
162 | |
163 | |
168 | 164 |
169 --- After GetInfo pass, look for any non-conformant blocks and deal with them | 165 --- After GetInfo pass, look for any non-conformant blocks and deal with them |
170 for _, block in pairs(blocksChecked) do | 166 for index, block in ipairs(self.usedBlocks) do |
167 | |
171 local logIndex = GetQuestLogIndexByID(block.info.questID, 'player') | 168 local logIndex = GetQuestLogIndexByID(block.info.questID, 'player') |
169 print('GetNumWatched', '|cFFFF4400'.. index, (block and block:GetName() or '|cFFFF0000-|r'), logIndex or '|cFF444444-|r') | |
172 -- animating blocks have been evaluated | 170 -- animating blocks have been evaluated |
173 if not block.isAnimating then | 171 if not block.isAnimating then |
174 if not logIndex then | 172 if not logIndex then |
175 self:ClearBlock(block) | 173 self:ClearBlock(block) |
174 print('GetNumWatched', 'trim dropped quest', block:GetName()) | |
176 elseif not IsQuestWatched(block.info.logIndex) then | 175 elseif not IsQuestWatched(block.info.logIndex) then |
177 self:ClearBlock(block) | 176 self:ClearBlock(block) |
178 end | 177 print('GetNumWatched', 'trim untracked quest', block:GetName()) |
179 end | 178 end |
180 blocksChecked[block] = nil | 179 end |
181 end | 180 end |
182 | 181 |
183 self.numWatched = numWatched | 182 self.numWatched = numWatched |
184 self.numAll = numAll | 183 self.numAll = numAll |
185 | 184 |
185 print('GetNumWatched', 'RESULT', numWatched, 'of', numAll) | |
186 return numWatched, numAll, self.WatchList | 186 return numWatched, numAll, self.WatchList |
187 end | 187 end |
188 | 188 |
189 | 189 |
190 --- Returns an iterable table from which tracker blocks can be filled out. Data includes: | 190 --- Returns an iterable table from which tracker blocks can be filled out. Data includes: |
191 -- All entry-layer GetXInfo return values | 191 -- All entry-layer GetXInfo return values |
192 -- Manifest of line data to be displayed in relation to the tracked object | 192 -- Manifest of line data to be displayed in relation to the tracked object |
193 Quest.GetInfo = function (self, logIndex, watchIndex) | 193 Quest.GetInfo = function (self, logIndex, watchIndex) |
194 local print = iprint | 194 local print = iprint |
195 print('') | |
195 local title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(logIndex) | 196 local title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(logIndex) |
196 if ( not questID ) then | 197 if ( not questID ) then |
197 tprint('GetNumWatched', logIndex, watchIndex, '|cFFFF2299no data|r') | 198 tprint('GetNumWatched', logIndex, watchIndex, '|cFFFF2299no data|r') |
198 return | 199 return 0 |
199 end | 200 end |
200 | 201 |
201 Quest.Info[questID] = Quest.Info[questID] or {} | 202 Quest.Info[questID] = Quest.Info[questID] or {} |
203 local numEntries = 0 | |
202 local q = Quest.Info[questID] | 204 local q = Quest.Info[questID] |
203 q.questID = questID | 205 q.questID = questID |
204 q.id = questID | 206 q.id = questID |
205 q.logIndex = logIndex | 207 q.logIndex = logIndex |
206 q.watchIndex = watchIndex | 208 q.watchIndex = watchIndex |
207 | 209 |
208 local numObjectives, requiredMoney, isAutoComplete, failureTime, timeElapsed, questType | 210 local numObjectives, requiredMoney, isAutoComplete, failureTime, timeElapsed, questType |
209 = 0, 0, nil, false, false, 0 | 211 = 0, 0, nil, false, false, 0 |
210 if watchIndex then | 212 if watchIndex then |
213 self.print('WatchIndex', watchIndex) | |
211 local _ | 214 local _ |
212 _,_,_, numObjectives, requiredMoney, _, _, isAutoComplete, | 215 _, _, _, numObjectives, requiredMoney, _, _, isAutoComplete, |
213 failureTime, timeElapsed, questType = GetQuestWatchInfo(watchIndex) | 216 failureTime, timeElapsed, questType = GetQuestWatchInfo(watchIndex) |
214 | 217 self.WatchList[watchIndex] = q |
215 -- ensure that the entry being populated isn't animating | |
216 if self.WatchBlock[watchIndex] then | |
217 local checkIndex = watchIndex | |
218 while self.WatchBlock[checkIndex + numAnimating] and self.WatchBlock[checkIndex + numAnimating].isAnimating do | |
219 print(self.WatchBlock[checkIndex + numAnimating]:GetName(), 'is in an animation sequence') | |
220 numAnimating = numAnimating + 1 | |
221 end | |
222 end | |
223 | |
224 self.WatchList[watchIndex + numAnimating] = q | |
225 --tprint(' |cFF88FF00GetInfo:|r set watch entry', watchIndex) | 218 --tprint(' |cFF88FF00GetInfo:|r set watch entry', watchIndex) |
226 print('GetInfo:', logIndex, watchIndex, '|cFFFF2299'..title..'|r') | 219 self.print('WatchIndex', logIndex, watchIndex + numAnimating, '|cFFFF2299'..title..'|r') |
227 end | 220 end |
228 self.LogInfo[logIndex] = q | 221 self.LogInfo[logIndex] = q |
229 | 222 |
230 q.numObjectives = numObjectives | 223 q.numObjectives = numObjectives |
231 q.requiredMoney = requiredMoney | 224 q.requiredMoney = requiredMoney |
263 questFailed = false | 256 questFailed = false |
264 if ( requiredMoney == 0 ) then | 257 if ( requiredMoney == 0 ) then |
265 isBreadcrumb = true; | 258 isBreadcrumb = true; |
266 end | 259 end |
267 end | 260 end |
268 print('QuestFlags', (isComplete and 'isComplete' or ''), (questFailed and 'questFailed' or ''), (isBreadcrumb and 'isBreadcrumb' or '')) | 261 print('QuestFlags', (isComplete and 'isComplete' or ''), (questFailed and 'questFailed' or ''), (isBreadcrumb and 'isBreadcrumb' or ''), numObjectives) |
269 | 262 |
270 -- completion message? | 263 -- completion message? |
271 local isSequenced = IsQuestSequenced(questID) | 264 local isSequenced = IsQuestSequenced(questID) |
272 local temp_status = '' | 265 local temp_status = '' |
273 if ( isComplete ) then | 266 if ( isComplete ) then |
274 temp_status = 'COMPLETED_OBJECTIVES' | 267 temp_status = 'COMPLETED_OBJECTIVES' |
275 objectives = Quest.GetObjectives(questLogIndex, numObjectives, true, isSequenced, isStory) | 268 --objectives = Quest.GetObjectives(logIndex, numObjectives, true, isSequenced, isStory) |
269 q.objectives = objectives | |
276 if ( isAutoComplete ) then | 270 if ( isAutoComplete ) then |
277 temp_status = 'AUTOCOMPLETE_OBJECTIVES' | 271 temp_status = 'AUTOCOMPLETE_OBJECTIVES' |
278 completionText = _G.QUEST_WATCH_CLICK_TO_COMPLETE | 272 completionText = _G.QUEST_WATCH_CLICK_TO_COMPLETE |
279 else | 273 else |
280 if ( isBreadcrumb ) then | 274 if ( isBreadcrumb ) then |
281 temp_status = 'COMPLETE_BREADCRUMB' | 275 temp_status = 'COMPLETE_BREADCRUMB' |
282 completionText = GetQuestLogCompletionText(questLogIndex) | 276 completionText = GetQuestLogCompletionText(logIndex) |
283 else | 277 else |
284 temp_status = 'COMPLETE_READY_FOR_TURN_IN' | 278 temp_status = 'COMPLETE_READY_FOR_TURN_IN' |
285 completionText = _G.QUEST_WATCH_QUEST_READY | 279 completionText = _G.QUEST_WATCH_QUEST_READY |
286 end | 280 end |
287 end | 281 end |
329 } | 323 } |
330 tinsert(objectives, timerInfo) | 324 tinsert(objectives, timerInfo) |
331 end | 325 end |
332 end | 326 end |
333 end | 327 end |
334 q.objectives = objectives | |
335 q.moneyInfo = moneyInfo | 328 q.moneyInfo = moneyInfo |
336 q.timerInfo = timerInfo | 329 q.timerInfo = timerInfo |
337 q.completionText = completionText | 330 q.completionText = completionText |
338 | 331 |
339 -- POI data | 332 -- POI data |
384 isFaction = true | 377 isFaction = true |
385 else | 378 else |
386 tagID = QUEST_TAG_ACCOUNT | 379 tagID = QUEST_TAG_ACCOUNT |
387 isAccount = true | 380 isAccount = true |
388 end | 381 end |
389 tagInfo['typeTag'] = tagID | 382 tagInfo['type'] = QUEST_TAG_TCOORDS[tagID] |
390 tagCoords['typeTag'] = QUEST_TAG_TCOORDS[tagID] | |
391 elseif ( factionGroup) then | 383 elseif ( factionGroup) then |
392 tagID = "ALLIANCE" | 384 tagID = "ALLIANCE" |
393 if ( factionGroup == LE_QUEST_FACTION_HORDE ) then | 385 if ( factionGroup == LE_QUEST_FACTION_HORDE ) then |
394 tagID = "HORDE" | 386 tagID = "HORDE" |
395 end | 387 end |
396 isFaction = true | 388 isFaction = true |
397 tagInfo['typeTag'] = tagID | 389 tagInfo['type'] = QUEST_TAG_TCOORDS[tagID] |
398 tagCoords['typeTag'] = QUEST_TAG_TCOORDS[tagID] | |
399 end | 390 end |
400 | 391 |
401 if( frequency == LE_QUEST_FREQUENCY_DAILY and (not isComplete or isComplete == 0) ) then | 392 if( frequency == LE_QUEST_FREQUENCY_DAILY and (not isComplete or isComplete == 0) ) then |
402 tagID = 'DAILY' | 393 tagID = 'DAILY' |
403 tagInfo['frequencyTag'] = tagID | 394 tagInfo['frequency'] = QUEST_TAG_TCOORDS[tagID] |
404 tagCoords['frequencyTag'] = QUEST_TAG_TCOORDS[tagID] | |
405 isDaily = true | 395 isDaily = true |
406 schema = 'daily' | 396 schema = 'daily' |
407 elseif( frequency == LE_QUEST_FREQUENCY_WEEKLY and (not isComplete or isComplete == 0) )then | 397 elseif( frequency == LE_QUEST_FREQUENCY_WEEKLY and (not isComplete or isComplete == 0) )then |
408 tagID = 'WEEKLY' | 398 tagID = 'WEEKLY' |
409 tagInfo['frequencyTag'] = tagID | 399 tagInfo['frequency'] = QUEST_TAG_TCOORDS[tagID] |
410 tagCoords['frequencyTag'] = QUEST_TAG_TCOORDS[tagID] | |
411 isWeekly = true | 400 isWeekly = true |
412 schema = 'weekly' | 401 schema = 'weekly' |
413 elseif( questTagID ) then | 402 elseif( questTagID ) then |
414 tagID = questTagID | 403 tagID = questTagID |
415 end | 404 end |
416 | 405 |
417 if( isComplete ) then | 406 if( isComplete ) then |
418 tagInfo['completionTag'] = 'COMPLETED' | 407 tagInfo['completion'] = QUEST_TAG_TCOORDS['COMPLETED'] |
419 elseif ( questFailed ) then | 408 elseif ( questFailed ) then |
420 tagInfo['completionTag'] = 'FAILED' | 409 tagInfo['completion'] = QUEST_TAG_TCOORDS['FAILED'] |
421 end | 410 end |
422 tagCoords['completionTag'] = QUEST_TAG_TCOORDS[tagInfo['completionTag']] | |
423 | 411 |
424 q.tagInfo = tagInfo | 412 q.tagInfo = tagInfo |
425 q.tagCoords = tagCoords | 413 q.tagID = tagID -- defining primary tags for compact view |
426 -- establishes the primary block tag for view compacting | |
427 q.tagID = tagID | |
428 q.tagName = tagName | 414 q.tagName = tagName |
429 | 415 |
430 -- action button information | 416 -- action button information |
431 local link, icon, charges = GetQuestLogSpecialItemInfo(logIndex) | 417 local link, icon, charges = GetQuestLogSpecialItemInfo(logIndex) |
432 local start, duration, enable = GetQuestLogSpecialItemCooldown(logIndex) | 418 local start, duration, enable = GetQuestLogSpecialItemCooldown(logIndex) |
490 iprint('GetInfo', questID, kk, '=', v) | 476 iprint('GetInfo', questID, kk, '=', v) |
491 end | 477 end |
492 end | 478 end |
493 end | 479 end |
494 | 480 |
495 return q | 481 return numEntries |
496 end | 482 end |
497 | 483 |
498 Quest.GetObjectives = function(logIndex, numObjectives, isComplete, isSequenced, isStory) | 484 Quest.GetObjectives = function(logIndex, numObjectives, isComplete, isSequenced, isStory) |
499 local print = Quest.print | 485 local print = Quest.print |
500 local objectives = {} | 486 local objectives = {} |