Mercurial > wow > buffalo2
comparison ObjectiveTracker/QuestData.lua @ 58:f253baf6022d
ObjectiveTracker:
- Quest tracker now checks all of its allotted frames for data validity,
- it also uses GetQuestLogTitle to verify non-zero log indexes
| author | Nenue |
|---|---|
| date | Fri, 08 Jul 2016 18:01:49 -0400 |
| parents | aa693607b813 |
| children |
comparison
equal
deleted
inserted
replaced
| 57:3cecf50070ba | 58:f253baf6022d |
|---|---|
| 99 return block | 99 return block |
| 100 end | 100 end |
| 101 | 101 |
| 102 local GetQuestWatchIndex = GetQuestWatchIndex | 102 local GetQuestWatchIndex = GetQuestWatchIndex |
| 103 local numAnimating = 0 | 103 local numAnimating = 0 |
| 104 local blocksChecked = {} | |
| 105 | 104 |
| 106 --- Get a total of things to show, and straighten out the index while we're at it | 105 --- Get a total of things to show, and straighten out the index while we're at it |
| 107 --- Return the number shown, total in log, and the info table to parse | 106 --- Return the number shown, total in log, and the info table to parse |
| 108 Quest.GetNumWatched = function (self, id, added) | 107 Quest.GetNumWatched = function (self, id, added) |
| 109 local print = self.print | 108 local print = self.print |
| 116 local numAll = GetNumQuestLogEntries() | 115 local numAll = GetNumQuestLogEntries() |
| 117 local numWatched = GetNumQuestWatches() | 116 local numWatched = GetNumQuestWatches() |
| 118 local bottomIndex = 1 | 117 local bottomIndex = 1 |
| 119 local start, limit = 1, numAll | 118 local start, limit = 1, numAll |
| 120 | 119 |
| 121 if id and not added then | 120 |
| 122 -- if a particular id is supplied, add to checklist | 121 --- Update the index tables |
| 123 if self.InfoBlock[id] then | |
| 124 blocksChecked[self.InfoBlock[id]] = self.InfoBlock[id] | |
| 125 end | |
| 126 end | |
| 127 | |
| 128 numAnimating = 0 | 122 numAnimating = 0 |
| 129 local numEntries = 0 | 123 local numEntries = 0 |
| 130 for logIndex = start, limit do | 124 for logIndex = start, limit do |
| 131 local reason1, reason2 = '', '' | 125 local reason1, reason2 = '', '' |
| 132 local title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(logIndex) | 126 local title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(logIndex) |
| 133 local watchIndex = GetQuestWatchIndex(logIndex) | 127 local watchIndex = GetQuestWatchIndex(logIndex) |
| 134 | 128 |
| 135 --- Start of crazy audit flagging | 129 |
| 136 if watchIndex and watchIndex >= bottomIndex then | 130 if watchIndex and watchIndex >= bottomIndex then |
| 137 -- do watch data pointers match? | 131 -- do watch data pointers match? |
| 138 local watchInfo = self.WatchInfo[watchIndex] | 132 local watchInfo, watchBlock = self.WatchInfo[watchIndex], self.WatchBlock[watchIndex] |
| 139 local watchBlock = self.WatchBlock[watchIndex] | 133 |
| 140 if watchInfo and watchInfo.questID ~= questID then | 134 if watchInfo and watchInfo.questID ~= questID then |
| 141 print('GetNumWatched', 'trimming WatchInfo ['..watchIndex..'] =/=', questID) | 135 print('GetNumWatched', 'trimming WatchInfo ['..watchIndex..'] =/=', questID) |
| 142 self.WatchInfo[watchIndex] = nil | 136 self.WatchInfo[watchIndex] = nil |
| 143 end | 137 end |
| 144 if watchBlock and watchBlock.info.questID ~= questID then | 138 if watchBlock and watchBlock.info.questID ~= questID then |
| 145 print('GetNumWatched', 'trimming WatchBlock ['..watchIndex..'] =/=', watchBlock:GetName()) | 139 print('GetNumWatched', 'trimming WatchBlock ['..watchIndex..'] =/=', watchBlock:GetName()) |
| 146 self.WatchBlock[watchIndex] = nil | 140 self.WatchBlock[watchIndex] = nil |
| 147 blocksChecked[watchBlock] = watchBlock | |
| 148 end | 141 end |
| 149 end | 142 end |
| 150 | 143 |
| 151 -- check log-block pointer | 144 -- check log-block pointer |
| 152 local logBlock = self.LogBlock[logIndex] | 145 local logBlock = self.LogBlock[logIndex] |
| 153 if logBlock then | 146 if logBlock then |
| 154 -- check later that the block isn't for a dropped quest | 147 -- check later that the block isn't for a dropped quest |
| 155 if logBlock.info.questID ~= questID then | 148 if logBlock.info.questID ~= questID then |
| 156 print('GetQuests', 'replace info', logBlock.info.questID, '->', questID) | 149 print('GetQuests', 'replace info', logBlock.info.questID, '->', questID) |
| 157 self.LogBlock[logIndex] = nil | 150 self.LogBlock[logIndex] = nil |
| 158 blocksChecked[logBlock] = logBlock | |
| 159 end | 151 end |
| 160 end | 152 end |
| 161 --- end of crazy audit flagging | 153 --- end of crazy audit flagging |
| 162 | 154 |
| 163 -- add to watch index if: the questID is non-zero | 155 -- add to watch index if: the questID is non-zero |
| 167 end | 159 end |
| 168 end | 160 end |
| 169 | 161 |
| 170 | 162 |
| 171 | 163 |
| 172 --- After GetInfo pass, look for any non-conformant blocks and deal with them | 164 --- Clean up blocks that got cut off for some reason |
| 173 for index, block in ipairs(self.usedBlocks) do | 165 for index, block in ipairs(self.usedBlocks) do |
| 174 | |
| 175 local logIndex = GetQuestLogIndexByID(block.info.questID, 'player') | |
| 176 -- animating blocks have been evaluated | 166 -- animating blocks have been evaluated |
| 177 if not block.blockFadeOut:IsPlaying() then | 167 if not block.blockFadeOut:IsPlaying() then |
| 178 if not logIndex then | 168 |
| 169 local logIndex = GetQuestLogIndexByID(block.info.questID, 'player') | |
| 170 print('GetNumWatched', GetQuestLogTitle(logIndex)) | |
| 171 local questID = select(8,GetQuestLogTitle(logIndex)) | |
| 172 print('GetNumWatched', questID) | |
| 173 | |
| 174 if questID == 0 then | |
| 179 self:ClearBlock(block) | 175 self:ClearBlock(block) |
| 180 print('GetNumWatched', '|cFF44FF00'.. index, (block and block:GetName() or '|cFFFF0000-|r'), '(trim not active)') | 176 print('GetNumWatched', '|cFF44FF00'.. index, (block and block:GetName() or '|cFFFF0000-|r'), logIndex, questID, '(unresolved)', block.info.title) |
| 181 elseif not IsQuestWatched(block.info.logIndex) then | 177 elseif not IsQuestWatched(block.info.logIndex) then |
| 182 self:ClearBlock(block) | 178 self:ClearBlock(block) |
| 183 print('GetNumWatched', '|cFFFF4400'.. index, (block and block:GetName() or '|cFFFF0000-|r'), '(trim non-watched)') | 179 print('GetNumWatched', '|cFFFF4400'.. index, (block and block:GetName() or '|cFFFF0000-|r'), logIndex, questID, '(unwatched)', block.info.title) |
| 184 else | 180 else |
| 185 print('GetNumWatched', '|cFF0088FF'.. index, (block and block:GetName() or '|cFFFF0000-|r'), logIndex or '|cFF444444-|r') | 181 print('GetNumWatched', '|cFF0088FF'.. index, (block and block:GetName() or '|cFFFF0000-|r'), logIndex or '|cFF444444-|r', block.info.title) |
| 186 end | 182 end |
| 187 else | 183 else |
| 188 | 184 |
| 189 print('GetNumWatched', '|cFF00FFFF'.. index, (block and block:GetName() or '|cFFFF0000-|r'), ' (animating)') | 185 print('GetNumWatched', '|cFF00FFFF'.. index, (block and block:GetName() or '|cFFFF0000-|r'), ' (animating)') |
| 190 end | 186 end |
| 572 | 568 |
| 573 Quest.Remove = function(handler, block) | 569 Quest.Remove = function(handler, block) |
| 574 print('removing', block.info.logIndex, 'from watcher') | 570 print('removing', block.info.logIndex, 'from watcher') |
| 575 RemoveQuestWatch(block.info.logIndex) | 571 RemoveQuestWatch(block.info.logIndex) |
| 576 end | 572 end |
| 573 | |
| 574 Quest.OnRemoved = function(block) | |
| 575 print('OnRemoved', block:GetID()) | |
| 576 end |
