From 0b46d6bd3c68d177fbae8af2fca331aae781454f Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Sun, 5 Feb 2012 15:50:47 +0100 Subject: [PATCH] Query completed quests from the server instead of keeping a database --- Monomyth.lua | 22 +++++++++++++++------- Monomyth.toc | 1 - 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Monomyth.lua b/Monomyth.lua index 6a8555a..e8abdfe 100644 --- a/Monomyth.lua +++ b/Monomyth.lua @@ -142,19 +142,27 @@ Monomyth:Register('BANKFRAME_CLOSED', function() atBank = false end) +local completedQuests = {} +Monomyth:Register('QUEST_QUERY_COMPLETE', function() + GetQuestsCompleted(completedQuests) + + for index = 0, 4 do + Monomyth.BAG_UPDATE(index) + end +end) + Monomyth:Register('BAG_UPDATE', function(bag) if(bag < 0) then return end if(atBank) then return end - QuestCompletedDB = QuestCompletedDB or {} - for slot = 1, GetContainerNumSlots(bag) do local _, id, active = GetContainerItemQuestInfo(bag, slot) - if(id and not active and not QuestCompletedDB[id]) then - UseContainerItem(bag, slot) - - -- This is a temporary solution to the spam and bugs with some items - QuestCompletedDB[id] = true + if(id and not active) then + if(not next(completedQuests)) then + QueryQuestsCompleted() + elseif(not completedQuests[id]) then + UseContainerItem(bag, slot) + end end end end) diff --git a/Monomyth.toc b/Monomyth.toc index fdc9241..9993454 100644 --- a/Monomyth.toc +++ b/Monomyth.toc @@ -3,6 +3,5 @@ ## Version: Alpha ## Title: Monomyth ## Notes: Questing enhancements -## SavedVariablesPerCharacter: QuestCompletedDB Monomyth.lua -- 1.7.9.5