View Single Post
08-30-18, 05:53 PM   #4
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
Originally Posted by MuffinManKen View Post
The Emissary quest itself is a normal (though hidden) quest in your log, so it should just be a matter of detecting when a quest has had all of its objectives completed and is ready to turn in. World Quests are just part of the objectives.
The following are Quest Complete events which hopefully one will flag up on all emissary world quests
QUEST_COMPLETE - you will need to identify which questID is complete via other means
QUEST_AUTOCOMPLETE questID of the quest autocompleted
WORLD_QUEST_COMPLETED_BY_SPELL questID of the world quest completed

I suspect the last one is the one you need to monitor and react on the questID returned

Using the information in this Blizzard code file ( which is the code behind the emissary bounty board ) I managed to rig up what I would initially do to gather a list of available quests in the world for a particular bounty. I put it in PLAYER_ENTERING_WORLD so test for arg1 being true to only run this when you first log in. However, it only produced the list after doing a reload of the UI until I made sure that the blizzard addons ( Blizzard_WorldMap and Blizzard_ObjectiveTracker) were loaded as soon as mine was. Although it doesn't seem consistent so it may take some investigation to find the right time to generate the list. Also, the bounty board faction names have 'Other' for one of them but you can get the correct factionID and name from the task info itself using this:

Lua Code:
  1. local isWorldQuest = QuestUtils_IsQuestWorldQuest(taskInfo.questId)
  2. local questTitle, factionID, capped = C_TaskQuest.GetQuestInfoByQuestID(taskInfo.questId)
  3. local factionName = factionID and GetFactionInfoByID(factionID) or "No Faction"
  4. local zoneTaskInfo =   {
  5.     ["Zone"] = zoneInfo.name,
  6.     ["QuestID"] = taskInfo.questId,
  7.     ["FactionID"] = factionID,
  8.     ["FactionName"] = factionName,
  9.     ["QuestTitle"] = questTitle,
  10.     ["Completed"] = IsQuestComplete(taskInfo.questId),
  11. }

https://www.townlong-yak.com/framexm...ountyBoard.lua

Feel free to utilise this code to get your addon idea working. It has definitely give me some ideas to look into at some point.


My code to ensure the information is available at PlayerEnteringWorld.
Lua Code:
  1. local function OnEvent(self,event,...)
  2.     local args = {...}
  3.     if event == "ADDON_LOADED" and args[1] == addonName then
  4.         if not IsAddOnLoaded("Blizzard_WorldMap") then
  5.             LoadAddOn("Blizzard_WorldMap")            
  6.         end
  7.         if not IsAddOnLoaded("Blizzard_ObjectiveTracker") then
  8.             LoadAddOn("Blizzard_ObjectiveTracker")
  9.         end
  10.        
  11.     elseif event == "PLAYER_ENTERING_WORLD" and args[1] == true then
  12.         UpdateBountyQuestList()
  13.        
  14.     end        
  15. end
  16.  
  17. local eventWatcher = CreateFrame("Frame")
  18. eventWatcher:RegisterEvent("ADDON_LOADED")
  19. eventWatcher:RegisterEvent("PLAYER_ENTERING_WORLD")
  20. eventWatcher:SetScript("OnEvent",OnEvent)

My code to generate a list of quests per zone along with their bounty related details
Lua Code:
  1. local mapInfo = {}
  2.     local getAncestor = true
  3.     local getDescendants = true
  4.     local cosmicMapID = 946
  5.     mapInfo.cosmicMapInfo = MapUtil.GetMapParentInfo(cosmicMapID, Enum.UIMapType.Cosmic, getAncestor)
  6.     mapInfo.Continents = C_Map.GetMapChildrenInfo(mapInfo.cosmicMapInfo.mapID, Enum.UIMapType.Continent, getDescendants)
  7.     for i,continentInfo in ipairs(mapInfo.Continents) do
  8.         continentInfo.Zones = C_Map.GetMapChildrenInfo(continentInfo.mapID, Enum.UIMapType.Zone, getDescendants)
  9.         for i,zoneInfo in ipairs(continentInfo.Zones) do
  10.             local bounties, displayLocation, lockedQuestID = GetQuestBountyInfoForMapID(zoneInfo.mapID);
  11.             local tasks = C_TaskQuest.GetQuestsForPlayerByMapID(zoneInfo.mapID)
  12.             -- bounties = { numObjectives, questID, icon, factionID }
  13.             -- tasks = { questId, questName, factionID }
  14.             for k,taskInfo in ipairs(tasks) do
  15.                 local isWorldQuest = QuestUtils_IsQuestWorldQuest(taskInfo.questId)
  16.                 local questTitle, factionID, capped = C_TaskQuest.GetQuestInfoByQuestID(taskInfo.questId)
  17.                 local factionName = factionID and GetFactionInfoByID(factionID) or "No Faction"
  18.                 if (taskInfo and isWorldQuest) then
  19.                     for j,bountyInfo in ipairs(bounties) do
  20.                         local isBountyQuest = IsQuestCriteriaForBounty(taskInfo.questId, bountyInfo.questID)
  21.                         local factionName = GetFactionInfoByID(bountyInfo.factionID)
  22.                         if isBountyQuest then
  23.                             print("Bounty Tasks: ", zoneInfo.name, bountyInfo.questID, bountyInfo.factionID, factionName, taskInfo.questId, questTitle, IsQuestComplete(taskInfo.questId))
  24.                         end
  25.                     end
  26.                 end
  27.             end
  28.         end
  29.     end

Writing this out to a saved variables file resulted in the following output
Code:
EmissaryQuestDetails = {
	[0] = {
		["completeCount"] = 0,
		["name"] = "Other",
		["Quests"] = {
			[790] = {
			},
			[630] = {
				{
					["Completed"] = false,
					["QuestID"] = 46126,
					["QuestTitle"] = "Fel-Corrupted Feathers",
					["Zone"] = "Azsuna",
				}, -- [1]
			},
			[646] = {
				{
					["Completed"] = false,
					["QuestID"] = 46111,
					["QuestTitle"] = "Illidari Masters: Sissix",
					["Zone"] = "Broken Shore",
				}, -- [1]
				{
					["Completed"] = false,
					["QuestID"] = 46201,
					["QuestTitle"] = "By Water Be Purged",
					["Zone"] = "Broken Shore",
				}, -- [2]
				{
					["Completed"] = false,
					["QuestID"] = 46126,
					["QuestTitle"] = "Fel-Corrupted Feathers",
					["Zone"] = "Broken Shore",
				}, -- [3]
				{
					["Completed"] = false,
					["QuestID"] = 45472,
					["QuestTitle"] = "Kraken Eggs",
					["Zone"] = "Broken Shore",
				}, -- [4]
				{
					["Completed"] = false,
					["QuestID"] = 46068,
					["QuestTitle"] = "Brute Wrangling",
					["Zone"] = "Broken Shore",
				}, -- [5]
				{
					["Completed"] = false,
					["QuestID"] = 46236,
					["QuestTitle"] = "Stonebound Soldiers",
					["Zone"] = "Broken Shore",
				}, -- [6]
			},
			[641] = {
			},
			[650] = {
			},
			[680] = {
			},
			[885] = {
			},
			[634] = {
			},
		},
	},
	[1883] = {
		["completeCount"] = 0,
		["name"] = "Dreamweavers",
		["Quests"] = {
			[790] = {
			},
			[630] = {
			},
			[646] = {
			},
			[641] = {
				{
					["Completed"] = false,
					["QuestID"] = 44895,
					["QuestTitle"] = "Sharptalon Swarm!",
					["Zone"] = "Val'sharah",
				}, -- [1]
				{
					["Completed"] = false,
					["QuestID"] = 43183,
					["QuestTitle"] = "Warden Tower Assault: Starstalker's Point",
					["Zone"] = "Val'sharah",
				}, -- [2]
				{
					["Completed"] = false,
					["QuestID"] = 42087,
					["QuestTitle"] = "Green Horror",
					["Zone"] = "Val'sharah",
				}, -- [3]
				{
					["Completed"] = false,
					["QuestID"] = 43457,
					["QuestTitle"] = "WANTED: Theryssia",
					["Zone"] = "Val'sharah",
				}, -- [4]
				{
					["Completed"] = false,
					["QuestID"] = 41961,
					["QuestTitle"] = "Black Rook Holdings",
					["Zone"] = "Val'sharah",
				}, -- [5]
				{
					["Completed"] = false,
					["QuestID"] = 42075,
					["QuestTitle"] = "Botanical Backlash",
					["Zone"] = "Val'sharah",
				}, -- [6]
				{
					["Completed"] = false,
					["QuestID"] = 44033,
					["QuestTitle"] = "Aw, Nuts!",
					["Zone"] = "Val'sharah",
				}, -- [7]
			},
			[650] = {
				{
					["Completed"] = false,
					["QuestID"] = 42087,
					["QuestTitle"] = "Green Horror",
					["Zone"] = "Highmountain",
				}, -- [1]
				{
					["Completed"] = false,
					["QuestID"] = 43457,
					["QuestTitle"] = "WANTED: Theryssia",
					["Zone"] = "Highmountain",
				}, -- [2]
				{
					["Completed"] = false,
					["QuestID"] = 44895,
					["QuestTitle"] = "Sharptalon Swarm!",
					["Zone"] = "Highmountain",
				}, -- [3]
				{
					["Completed"] = false,
					["QuestID"] = 41961,
					["QuestTitle"] = "Black Rook Holdings",
					["Zone"] = "Highmountain",
				}, -- [4]
				{
					["Completed"] = false,
					["QuestID"] = 42075,
					["QuestTitle"] = "Botanical Backlash",
					["Zone"] = "Highmountain",
				}, -- [5]
				{
					["Completed"] = false,
					["QuestID"] = 44033,
					["QuestTitle"] = "Aw, Nuts!",
					["Zone"] = "Highmountain",
				}, -- [6]
			},
			[680] = {
				{
					["Completed"] = false,
					["QuestID"] = 42087,
					["QuestTitle"] = "Green Horror",
					["Zone"] = "Suramar",
				}, -- [1]
				{
					["Completed"] = false,
					["QuestID"] = 42075,
					["QuestTitle"] = "Botanical Backlash",
					["Zone"] = "Suramar",
				}, -- [2]
				{
					["Completed"] = false,
					["QuestID"] = 44033,
					["QuestTitle"] = "Aw, Nuts!",
					["Zone"] = "Suramar",
				}, -- [3]
			},
			[885] = {
			},
			[634] = {
			},
		},
	},
	[1859] = {
		["completeCount"] = 0,
		["name"] = "The Nightfallen",
		["Quests"] = {
			[790] = {
			},
			[630] = {
				{
					["Completed"] = false,
					["QuestID"] = 42169,
					["QuestTitle"] = "Left for Dead",
					["Zone"] = "Azsuna",
				}, -- [1]
				{
					["Completed"] = false,
					["QuestID"] = 44799,
					["QuestTitle"] = "Safe Keeping",
					["Zone"] = "Azsuna",
				}, -- [2]
			},
			[646] = {
			},
			[641] = {
				{
					["Completed"] = false,
					["QuestID"] = 42082,
					["QuestTitle"] = "The Shattered Locus",
					["Zone"] = "Val'sharah",
				}, -- [1]
				{
					["Completed"] = false,
					["QuestID"] = 41280,
					["QuestTitle"] = "Huge Runescale Koi",
					["Zone"] = "Val'sharah",
				}, -- [2]
			},
			[650] = {
			},
			[680] = {
				{
					["Completed"] = false,
					["QuestID"] = 42169,
					["QuestTitle"] = "Left for Dead",
					["Zone"] = "Suramar",
				}, -- [1]
				{
					["Completed"] = false,
					["QuestID"] = 42082,
					["QuestTitle"] = "The Shattered Locus",
					["Zone"] = "Suramar",
				}, -- [2]
				{
					["Completed"] = false,
					["QuestID"] = 42799,
					["QuestTitle"] = "DANGER: Oglok the Furious",
					["Zone"] = "Suramar",
				}, -- [3]
				{
					["Completed"] = false,
					["QuestID"] = 44817,
					["QuestTitle"] = "Stirring the Swarm",
					["Zone"] = "Suramar",
				}, -- [4]
				{
					["Completed"] = false,
					["QuestID"] = 44799,
					["QuestTitle"] = "Safe Keeping",
					["Zone"] = "Suramar",
				}, -- [5]
				{
					["Completed"] = false,
					["QuestID"] = 41280,
					["QuestTitle"] = "Huge Runescale Koi",
					["Zone"] = "Suramar",
				}, -- [6]
			},
			[885] = {
			},
			[634] = {
				{
					["Completed"] = false,
					["QuestID"] = 42799,
					["QuestTitle"] = "DANGER: Oglok the Furious",
					["Zone"] = "Stormheim",
				}, -- [1]
				{
					["Completed"] = false,
					["QuestID"] = 44817,
					["QuestTitle"] = "Stirring the Swarm",
					["Zone"] = "Stormheim",
				}, -- [2]
				{
					["Completed"] = false,
					["QuestID"] = 41280,
					["QuestTitle"] = "Huge Runescale Koi",
					["Zone"] = "Stormheim",
				}, -- [3]
			},
		},
	},
}
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818

Last edited by Xrystal : 08-31-18 at 07:00 AM.
  Reply With Quote