From 5313d9942025be4f3f058303cb49e0fcc478babd Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Fri, 19 Dec 2014 09:38:04 +0100 Subject: [PATCH] Fix the quest level scanning and get rid of the spam filter as it should no longer be needed --- QuickQuest.lua | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/QuickQuest.lua b/QuickQuest.lua index a99059b..7f473da 100644 --- a/QuickQuest.lua +++ b/QuickQuest.lua @@ -324,12 +324,15 @@ QuickQuest:Register('MODIFIER_STATE_CHANGED', function(key, state) end end, true) -local questTip = CreateFrame('GameTooltip', 'QuickQuestTip', UIParent) -local questLevel = string.gsub(ITEM_MIN_LEVEL, '%%d', '(%%d+)') +local questTip = CreateFrame('GameTooltip', 'QuickQuestTip', UIParent, 'GameTooltipTemplate') +local questString = string.gsub(ITEM_MIN_LEVEL, '%%d', '(%%d+)') + +local function GetContainerItemQuestLevel(bag, slot) + questTip:SetOwner(UIParent, 'ANCHOR_NONE') + questTip:SetBagItem(bag, slot) -local function GetQuestItemLevel() for index = 1, questTip:NumLines() do - local level = tonumber(string.match(_G['QuickQuestTipTextLeft' .. index]:GetText(), questLevel)) + local level = tonumber(string.match(_G['QuickQuestTipTextLeft' .. index]:GetText(), questString)) if(level) then return level end @@ -343,11 +346,8 @@ local function BagUpdate(bag) for slot = 1, GetContainerNumSlots(bag) do local _, id, active = GetContainerItemQuestInfo(bag, slot) if(id and not active and not IsQuestFlaggedCompleted(id) and not QuickQuestDB.itemBlacklist[id]) then - questTip:SetBagItem(bag, slot) - questTip:Show() - - local level = GetQuestItemLevel() - if(not level or level >= UnitLevel('player')) then + local level = GetContainerItemQuestLevel(bag, slot) + if(level <= UnitLevel('player')) then UseContainerItem(bag, slot) end end @@ -361,13 +361,3 @@ QuickQuest:Register('PLAYER_LOGIN', function() QuickQuest:QUEST_AUTOCOMPLETE() end end) - -local errors = { - [ERR_QUEST_ALREADY_DONE] = true, - [ERR_QUEST_FAILED_LOW_LEVEL] = true, - [ERR_QUEST_NEED_PREREQS] = true, -} - -ChatFrame_AddMessageEventFilter('CHAT_MSG_SYSTEM', function(self, event, message) - return errors[message] -end) -- 1.7.9.5