From 8f128867f5829320f74ba0465a4ec6af6eedc414 Mon Sep 17 00:00:00 2001 From: Alex Shubert Date: Fri, 17 Oct 2014 01:23:26 +0400 Subject: [PATCH] tracked quests level in watch frame fixed --- AutoTurnIn.lua | 2 +- QuestLevel.lua | 34 +++++++++++++++++----------------- ui/main_options.lua | 3 ++- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/AutoTurnIn.lua b/AutoTurnIn.lua index b90e3b5..7a9d17a 100644 --- a/AutoTurnIn.lua +++ b/AutoTurnIn.lua @@ -96,8 +96,8 @@ function AutoTurnIn:OnEnable() if self.TOC < 60000 then hooksecurefunc("QuestLog_Update", AutoTurnIn.ShowQuestLevelInLog) hooksecurefunc(QuestLogScrollFrame, "update", AutoTurnIn.ShowQuestLevelInLog) - hooksecurefunc("WatchFrame_Update", AutoTurnIn.ShowQuestLevelInWatchFrame) end + hooksecurefunc("ObjectiveTracker_Update", AutoTurnIn.ShowQuestLevelInWatchFrame) end function AutoTurnIn:OnDisable() diff --git a/QuestLevel.lua b/QuestLevel.lua index 2ee4653..d7e7eb7 100644 --- a/QuestLevel.lua +++ b/QuestLevel.lua @@ -44,24 +44,24 @@ function AutoTurnIn:ShowQuestLevelInWatchFrame() if not AutoTurnInCharacterDB.watchlevel then return end - - for i = 1, #WATCHFRAME_LINKBUTTONS do - local button = WATCHFRAME_LINKBUTTONS[i] - if( button.type == "QUEST" ) then - local questIndex = GetQuestIndexForWatch(button.index) - if questIndex then - local textLine = button.lines[button.startLine] - if textLine.text:GetText() and (not string.find("", "^%[.*%].*")) then - local title, level, _, _, _, _, _, isDaily = GetQuestLogTitle(questIndex) - local questTypeIndex = GetQuestLogQuestType(questIndex) - local tagString = AutoTurnIn.QuestTypesIndex[questTypeIndex] - if (not tagString) then - --AutoTurnIn:Print("Please, inform addon author unknown QT for: " ..title) - tagString = "" - end - textLine.text:SetText(AutoTurnIn.WatchFrameLevelFormat:format(level, tagString, isDaily and "\*" or "", title)) - end + local tracker = ObjectiveTrackerFrame + if ( not tracker.initialized )then + return + end + + for i = 1, #tracker.MODULES do + for id,block in pairs( tracker.MODULES[i].Header.module.usedBlocks) do + local text = block.HeaderText:GetText() + if text and (not string.find(text, "^%[.*%].*")) then + local title, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, questID, + startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(block.questLogIndex) + + local questTypeIndex = GetQuestLogQuestType(block.questLogIndex) + local tagString = AutoTurnIn.QuestTypesIndex[questTypeIndex] or "" + local dailyMod = (frequency == LE_QUEST_FREQUENCY_DAILY or frequency == LE_QUEST_FREQUENCY_WEEKLY) and "\*" or "" + + block.HeaderText:SetText(AutoTurnIn.WatchFrameLevelFormat:format(level, tagString, dailyMod, title)) end end end diff --git a/ui/main_options.lua b/ui/main_options.lua index f09f03b..862999c 100644 --- a/ui/main_options.lua +++ b/ui/main_options.lua @@ -155,9 +155,10 @@ end OptionsPanel.okay = function() AutoTurnInCharacterDB = CopyTable(ptable.TempConfig) AutoTurnIn:SetEnabled(AutoTurnInCharacterDB.enabled) + + ObjectiveTracker_Update(OBJECTIVE_TRACKER_UPDATE_ALL) if AutoTurnIn.TOC < 60000 then QuestLog_Update() - WatchFrame_Update(WatchFrame) end end -- 1.7.9.5