diff --git a/TurnIn.lua b/TurnIn.lua index f36cbdb..056dd58 100755 --- a/TurnIn.lua +++ b/TurnIn.lua @@ -66,6 +66,49 @@ local TI_events = { "QUEST_FINISHED" }; +local TI_GossipIconNameToId = { + ["activequesticon"] = 132048, + ["availablequesticon"] = 132049, + ["banker"] = 132050, + ["battlemaster"] = 132051, + ["binder"] = 132052, + ["gossip"] = 132053, + ["healer"] = 132054, + ["petition"] = 132055, + ["tabard"] = 132056, + ["taxi"] = 132057, + ["trainer"] = 132058, + ["unlearn"] = 132059, + ["vendor"] = 132060, + ["incompletequest"] = 365195, + ["dailyquest"] = 368364, + ["dailyactivequest"] = 368577, + ["auctioneer"] = 528409, + ["activelegendaryquest"] = 646979, + ["availablelegendaryquest"] = 646980, + ["chatbubble"] = 1019848, + ["workorder"] = 1130518, + ["transmogrify"] = 1673939, + ["campaignactivequest"] = 3532316, + ["campaignavailablequest"] = 3532317, + ["campaignincompletequest"] = 3532318, + ["campaigngossipicons"] = 3595324, +} + +local function TI_InvertDictionary(input) + local s={} + for k,v in pairs(input) do + s[v]=k + end + return s +end + +local TI_GossipIconIdToName = TI_InvertDictionary(TI_GossipIconNameToId) + +local function TI_TranslateIconToType(iconId) + return TI_GossipIconIdToName[iconId] +end + TI_TempNPCList = {}; function TI_message(...) @@ -433,6 +476,7 @@ function TI_HandleGossipWindow(gorq) x.gorq = gorq; x.args = i; x.type = v.type; + x.icon = v.icon; x.state = false; table.insert(ListEntry, x); end @@ -440,7 +484,6 @@ function TI_HandleGossipWindow(gorq) local TotalOptions = #AvailableQuests+#ActiveQuests+#GossipOptions; - --if(TI_activenumber > ActiveQuests.getn()) TI_activenumber = 1; if(TotalOptions < 1) then return; end @@ -489,7 +532,7 @@ function TI_HandleGossipWindow(gorq) for i2,v2 in ipairs(AvailableQuests) do if (v2.name == current.name) then TI_debug(i1.."-Available Match Found: "..current.name); - TI_FunctionList[current.gorq]["availquest"](i2); + SAvQ(v2.questID); return; end end @@ -497,7 +540,7 @@ function TI_HandleGossipWindow(gorq) for i2,v2 in ipairs(ActiveQuests) do if (v2.name == current.name) then TI_debug(i1.."-Active Match Found: "..current.name..", "..current.type); - TI_FunctionList[current.gorq]["activequest"](i2); + SAcQ(v2.questID); return; end end @@ -505,7 +548,7 @@ function TI_HandleGossipWindow(gorq) for i2,v2 in ipairs(GossipOptions) do if (v2.name == current.name) then TI_debug(i1.."-Gossip Match Found: "..current.name..", "..current.type); - TI_FunctionList.g.default(i2); + TI_FunctionList.g.gossip(i2); return; end end @@ -528,28 +571,27 @@ function TI_HandleGossipWindow(gorq) for i,current in ipairs(TI_status.options) do if(current.state) then if(current.type == "availquest" and #AvailableQuests > 0 and TI_availnumber <= #AvailableQuests) then - TI_availnumber = TI_availnumber + 1; - SAvQ(TI_availnumber-1); - TI_debug("Selecting Available Quest ".. TI_availnumber-1); + 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 - TI_activenumber = TI_activenumber + 1; - if ActiveQuests[TI_activenumber-1].isComplete then - TI_debug("Selecting Active Quest ".. TI_activenumber-1 .. " " .. ActiveQuests[TI_activenumber-1].name ); - SAcQ(TI_activenumber-1); + if ActiveQuests[TI_activenumber].isComplete then + TI_debug("Selecting Active Quest ".. TI_activenumber .. " " .. ActiveQuests[TI_activenumber].name ); + SAcQ(ActiveQuests[TI_activenumber].questID); TI_ResetPointers(); return; else - TI_debug("Active Quest ".. TI_activenumber-1 .. " " .. ActiveQuests[TI_activenumber-1].name .. " is not complete") + TI_debug("Active Quest ".. TI_activenumber .. " " .. ActiveQuests[TI_activenumber].name .. " is not complete") + TI_activenumber = TI_activenumber + 1; end end elseif(#GossipOptions > 0) then for j,val in ipairs(GossipOptions) do if(val.type == current.type) then TI_ResetPointers(); - TI_FunctionList.g.default(j); + TI_FunctionList.g.gossip(j); return; end end @@ -641,9 +683,14 @@ function TI_TabulateGossipQuestUIInfo_Retail(gquis) local temp = {}; temp.name = gqui.title; - temp.icon = QuestUtil.GetQuestIconActive(gqui.isComplete, gqui.isLegendary, - gqui.frequency, gqui.isRepeatable, gqui.isCampaign, gqui.isCovenantCalling); - + temp.icon = QuestUtil.GetQuestIconOffer( + gqui.isLegendary, + gqui.frequency, + gqui.isRepeatable, + false, + false + ); + temp.questID = gqui.questID; temp.isComplete = gqui.isComplete; table.insert(x, temp); @@ -657,10 +704,14 @@ function TI_TabulateGossipUIInfo_Retail(guis) for i,gui in ipairs(guis) do local temp = {}; temp.name = gui.name; - if gui.type == "chatbubble" then - gui.type = "gossip" + local gossipType = TI_TranslateIconToType(gui.icon) + if gossipType == "chatbubble" then + gossipType = "gossip" end - temp.type = gui.type; + temp.type = gossipType; + temp.icon = gui.icon; + temp.gossipOptionID = gui.gossipOptionID + temp.orderIndex = gui.orderIndex table.insert(x, temp); end return x; @@ -724,7 +775,7 @@ if (TI_IsRetail()) then g = { availquest = C_GossipInfo.SelectAvailableQuest, activequest = C_GossipInfo.SelectActiveQuest, - default = C_GossipInfo.SelectOption, + gossip = SelectGossipOption, getavailquests = C_GossipInfo.GetAvailableQuests, getactivequests = C_GossipInfo.GetActiveQuests, getoptions = C_GossipInfo.GetOptions, @@ -733,8 +784,8 @@ if (TI_IsRetail()) then tabulateOptions = TI_TabulateGossipUIInfo_Retail, }, q = { - activequest = C_GossipInfo.SelectActiveQuest, - availquest = C_GossipInfo.SelectAvailableQuest, + activequest = SelectActiveQuest, + availquest = SelectAvailableQuest, } }; else @@ -742,7 +793,7 @@ else g = { availquest = SelectGossipAvailableQuest, activequest = SelectGossipActiveQuest, - default = SelectGossipOption, + gossip = SelectGossipOption, getavailquests = GetGossipAvailableQuests, getactivequests = GetGossipActiveQuests, getoptions = GetGossipOptions, diff --git a/TurnIn.toc b/TurnIn.toc index 02263f2..c86b8f5 100755 --- a/TurnIn.toc +++ b/TurnIn.toc @@ -1,5 +1,5 @@ -## Interface: 90207 -## X-Compatible-With: 90207 +## Interface: 100000 +## X-Compatible-With: 100000 ## Title: Turn In ## Notes: Automates the selection of quest and gossip options. ## SavedVariables: TI_status, TI_NPCDB, TI_NPCIndex diff --git a/TurnIn.xml b/TurnIn.xml old mode 100644 new mode 100755 index eaed253..4157c22 --- a/TurnIn.xml +++ b/TurnIn.xml @@ -1,4 +1,5 @@ - +