Mercurial > wow > buffalo2
diff ObjectiveTracker/Quests.lua @ 38:1f8f9cc3d956
- module integration brought up to speed with current frame management structure
author | Nenue |
---|---|
date | Thu, 21 Apr 2016 11:36:41 -0400 |
parents | e84d645c8ab8 |
children | 92534dc793f2 |
line wrap: on
line diff
--- a/ObjectiveTracker/Quests.lua Mon Apr 18 07:56:23 2016 -0400 +++ b/ObjectiveTracker/Quests.lua Thu Apr 21 11:36:41 2016 -0400 @@ -14,9 +14,11 @@ local lprint, iprint, tprint = B.print('Line'), B.print('Info'), B.print('Tracker') local print = tprint + + local superTrackQuestID, playerMoney, inScenario, showPOIs Quest.Update = function(self, reason, ...) - local print = tprint + local print = self.print print('QuestTracker:Update() received') T.UpdateActionButtons() Default.Update(self, reason, ...) @@ -26,13 +28,14 @@ local usedButtons = T.Quest.itemButtons local freeButtons = T.Quest.freeButtons -Quest.UpdateObjectives = function(handler, block) +Quest.UpdateObjectives = function(self, block) local print = lprint - print('|cFF00FFFFUpdateObjectives()') + print('|cFF'..self.internalColor..'UpdateObjectives()') local info = block.info print((info.isAccount and 'isAccount' or ''), (info.isFaction and 'isFaction' or ''), (info.isDaily and 'isDaily' or ''), (info.isWeekly and 'isWeekly' or ''), info.tagID, info.tagName) + local displayObjectives = true local block_schema = 'default' if info.isAccount then if info.isFaction then @@ -55,22 +58,23 @@ local questID, popupType = GetAutoQuestPopUp(info.logIndex) if popupType == 'COMPLETE' then print(' :: auto-complete quest :: set the message') - info.completionText = T.strings.CLICK_TO_COMPLETE + self:AddLine(block, T.strings.CLICK_TO_COMPLETE, nil, 'complete') end else if not completionText or info.completionText then info.completionText = GetQuestLogCompletionText(info.logIndex) end end - print(' :: complete quest :: show instruction: "'.. tostring(info.completionText) .. '"') + self:AddLine(block, info.completionText, nil, 'complete') + displayObjectives = false + print('|cFF'..self.internalColor..' :: complete quest :: show instruction: "'.. tostring(info.completionText) .. '"') end - Default.UpdateObjectives(handler, block, block_schema) + Default.UpdateObjectives(self, block, block_schema, displayObjectives) return block_schema end -Quest.UpdateLine = function(handler, block, line, data) - local print = lprint +Quest.UpdateLine = function(handler, block, data) local objectiveType = data.type return data.text, nil, objectiveType end @@ -130,6 +134,7 @@ --- Get a total of things to show, and straighten out the index while we're at it --- Return the number shown, total in log, and the info table to parse Quest.GetNumWatched = function (self, id, added) + local print = self.print superTrackQuestID = GetSuperTrackedQuestID() playerMoney = GetMoney(); inScenario = C_Scenario.IsInScenario(); @@ -137,7 +142,7 @@ local numAll = GetNumQuestLogEntries() local numWatched = GetNumQuestWatches() local bottomIndex = 1 - print(' |cFF00FF88GetNumWatched:|r',self.name, numWatched, 'of', numAll) + print('GetNumWatched', self.name, numWatched, 'of', numAll) local start, limit = 1, numAll --- start a list of blocks affected by this function @@ -157,11 +162,11 @@ local watchInfo = self.WatchInfo[watchIndex] local watchBlock = self.WatchBlock[watchIndex] if watchInfo and watchInfo.questID ~= questID then - print(' |cFFBBFF00GetNumWatched: trimming WatchInfo ['..watchIndex..'] =/=', questID) + print('GetNumWatched', 'trimming WatchInfo ['..watchIndex..'] =/=', questID) self.WatchInfo[watchIndex] = nil end if watchBlock and watchBlock.info.questID ~= questID then - print(' |cFFBBFF00GetNumWatched: trimming WatchBlock ['..watchIndex..'] =/=', watchBlock:GetName()) + print('GetNumWatched', 'trimming WatchBlock ['..watchIndex..'] =/=', watchBlock:GetName()) self.WatchBlock[watchIndex] = nil tinsert(blocksChecked, watchBlock) end @@ -183,12 +188,12 @@ --- remove any orphaned blocks from view and, if possible, free it for re-use for i, block in ipairs(blocksChecked) do if not GetQuestLogIndexByID(block.info.questID, 'player') then - print(' |cFFBBFF00GetNumWatched:|r literating a block without an index |cFFBBFF00'.. block:GetName()..'|r') + print('GetNumWatched', 'iterating a block without an index |cFFBBFF00'.. block:GetName()..'|r') block:Hide() self:FreeBlock(block) end if not IsQuestWatched(block.info.logIndex) then - print(' |cFFBBFF00GetNumWatched:|r hiding untracked quest |cFFBBFF00'.. block:GetName()..'|r') + print('GetNumWatched', 'hiding untracked quest |cFFBBFF00'.. block:GetName()..'|r') block:Hide() end end @@ -207,7 +212,7 @@ local print = iprint local title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(logIndex) if ( not questID ) then - tprint(' |cFFFF0088GetInfo:|r', logIndex, watchIndex, '|cFFFF2299no data|r') + tprint('GetNumWatched', logIndex, watchIndex, '|cFFFF2299no data|r') return end @@ -226,7 +231,7 @@ failureTime, timeElapsed, questType = GetQuestWatchInfo(watchIndex) self.WatchList[watchIndex] = q --tprint(' |cFF88FF00GetInfo:|r set watch entry', watchIndex) - tprint(' |cFFFFBB00GetInfo:|r', logIndex, watchIndex, '|cFFFF2299'..title..'|r') + print('GetInfo:', logIndex, watchIndex, '|cFFFF2299'..title..'|r') end self.LogInfo[logIndex] = q @@ -268,7 +273,7 @@ isBreadcrumb = true; end end - print('|cFF0088FFflags:|r', (isComplete and 'isComplete' or ''), (questFailed and 'questFailed' or ''), (isBreadcrumb and 'isBreadcrumb' or '')) + print('QuestFlags', (isComplete and 'isComplete' or ''), (questFailed and 'questFailed' or ''), (isBreadcrumb and 'isBreadcrumb' or '')) -- completion message? local isSequenced = IsQuestSequenced(questID) @@ -474,9 +479,9 @@ q.schema = schema if Devian and Devian.InWorkspace() then - print('|cFF00DDFFstatus:|r', temp_status, '|cFF00FF00questLogIndex|r:', logIndex, title) + print('QuestStatus', temp_status, '|cFF00FF00questLogIndex|r:', logIndex, title) local temp ={} - local data_txt = '|cFFFF4400values:|r' + local data_txt = '|cFF'..self.internalColor..'values:|r' for k,v in pairs(q) do if type(v) =='number' then data_txt = data_txt .. ' |cFFFFFF00'..k..'|r: ' .. tostring(v) @@ -484,12 +489,12 @@ tinsert(temp, k) end end - print(data_txt) + print('DataStatus',data_txt) sort(temp, function(a,b) return a < b end) for i, k in ipairs(temp) do - print('|cFF00FF00'..k..'|r') + iprint('GetInfo', questID, ''..k..'|r') for kk,v in pairs(q[k]) do - print(' ', kk, '=', v) + iprint('GetInfo', questID, kk, '=', v) end end end @@ -498,10 +503,11 @@ end Quest.GetObjectives = function(logIndex, numObjectives, isComplete, isSequenced, isStory) + local print = Quest.print local objectives = {} for i = 1, numObjectives do local text, type, finished = GetQuestLogLeaderBoard(i, logIndex) - print(format(' |cFFFF4400GetObjectives:|r #%d %s %s %s', i, tostring(type), tostring(text), tostring(finished))) + print('GetObjectives', format('|cFF88FF88#%d %s %s %s', i, tostring(type), tostring(text), tostring(finished))) objectives[i] = { index = i, type = type,