diff --git a/TurnIn.lua b/TurnIn.lua index 8b99363..dfed718 100755 --- a/TurnIn.lua +++ b/TurnIn.lua @@ -202,6 +202,7 @@ function TI_LoadEvents() end function TI_ResetPointers() + TI_debug("resetting pointers") TI_activenumber = 1; TI_availnumber = 1; TI_specnum = 0; @@ -318,7 +319,7 @@ function TI_OnEvent(self, event, ...) TI_LoadEvents(); end end - if(TI_status.state and not IsShiftKeyDown()) then + if(TI_status.state and not IsShiftKeyDown()) then if(event == "QUEST_GREETING") then TI_debug("Quest Greeting"); TI_lastquestframe = "greeting"; @@ -420,6 +421,7 @@ function TI_CompleteQuest() TI_ResetPointers(); else TI_debug("quest is not completable, declining"); + TI_availnumber = TI_availnumber + 1; QuestDetailDeclineButton_OnClick(); end end @@ -526,6 +528,7 @@ function TI_HandleGossipWindow(gorq) end if(TI_availnumber > TotalOptions or TI_activenumber > TotalOptions) then + TI_debug("Out of available/active quests, giving up "); TI_ResetPointers(); return; end @@ -585,7 +588,6 @@ function TI_HandleGossipWindow(gorq) if(current.type == "availquest" and #AvailableQuests > 0 and TI_availnumber <= #AvailableQuests) then SAvQ(AvailableQuests[TI_availnumber].questID); TI_debug("Selecting Available Quest ".. TI_availnumber); - TI_ResetPointers(); return; elseif(current.type == "activequest" and #ActiveQuests > 0 and TI_activenumber <= #ActiveQuests) then while TI_activenumber <= #ActiveQuests do @@ -729,58 +731,46 @@ function TI_TabulateGossipUIInfo_Retail(guis) return x; end -function TI_TabulateGossipAvailableQuests_Classic(...) +function TI_TabulateGossipAvailableQuests_Classic(gquis) local x = {}; - local idx = 1; - for i=1, select("#", ...), 7 do + for i,gqui in ipairs(gquis) do local temp = {}; - temp.name = select(i, ...); + temp.name = gqui.title; - local isTrivial = select(i+2, ...); - local isDaily = select(i+3, ...); - local isRepeatable = select(i+4, ...); - local isLegendary = select(i+5, ...); - local isIgnored = select(i+6, ...); - if ( isDaily ) then + if ( gqui.repeatable ) then temp.icon = "Interface\\GossipFrame\\DailyQuestIcon"; - elseif ( isRepeatable ) then - temp.icon = "Interface\\GossipFrame\\DailyActiveQuestIcon"; - elseif ( isLegendary ) then + elseif ( gqui.isLegendary ) then temp.icon = "Interface\\GossipFrame\\AvailableLegendaryQuestIcon"; else temp.icon = "Interface\\GossipFrame\\AvailableQuestIcon"; end - temp.questID = idx; + temp.questID = gqui.questID; + temp.isComplete = gqui.isComplete; + table.insert(x, temp); - idx = idx + 1; end return x; end -function TI_TabulateGossipActiveQuests_Classic(...) +function TI_TabulateGossipActiveQuests_Classic(gquis) local x = {}; - local idx = 1; - for i=1, select("#", ...), 6 do + for i,gqui in ipairs(gquis) do local temp = {}; - temp.name = select(i, ...); + temp.name = gqui.title; - local isComplete = select(i+3, ...); - temp.isComplete = isComplete; - local isLegendary = select(i+4, ...); - if(isComplete) then - if(isLegendary) then - temp.icon = "Interface\\GossipFrame\\ActiveLegendaryQuestIcon"; - else - temp.icon = "Interface\\GossipFrame\\ActiveQuestIcon"; - end + if ( gqui.repeatable ) then + temp.icon = "Interface\\GossipFrame\\DailyQuestIcon"; + elseif ( gqui.isLegendary ) then + temp.icon = "Interface\\GossipFrame\\AvailableLegendaryQuestIcon"; else - temp.icon = "Interface\\GossipFrame\\IncompleteQuestIcon"; + temp.icon = "Interface\\GossipFrame\\AvailableQuestIcon"; end - temp.questID = idx; + temp.questID = gqui.questID; + temp.isComplete = gqui.isComplete; + table.insert(x, temp); - idx = idx + 1; end return x; end @@ -813,8 +803,8 @@ else getavailquests = C_GossipInfo.GetAvailableQuests, getactivequests = C_GossipInfo.GetActiveQuests, getoptions = C_GossipInfo.GetOptions, - tabulateAvailable = TI_TabulateGossipQuestUIInfo_Retail, - tabulateActive = TI_TabulateGossipQuestUIInfo_Retail, + tabulateAvailable = TI_TabulateGossipAvailableQuests_Classic, + tabulateActive = TI_TabulateGossipActiveQuests_Classic, tabulateOptions = TI_TabulateGossipUIInfo_Retail, }, q = {