Thread Tools Display Modes
07-25-13, 04:15 AM   #1
AnrDaemon
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 156
Is it possible to obtain quest title by questID ?

Is it possible to obtain quest title by questID ?
I'm digging through API, but with no result so far.

To clarify: Arbitrary questID. I have no idea, if character have the quest, or if it is even available to character.
  Reply With Quote
07-25-13, 12:21 PM   #2
ckaotik
A Fallenroot Satyr
 
ckaotik's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 29
Unhappy

I have been wondering the same thing for quite a while and couldn't find anything either
Even addons like DataStore save the quest title to their database when accepting/completing quests or from the player's quest log.

Same goes for QuestIsDaily and QuestIsWeekly (both only available on quest dialogs) and GetQuestLink (quest log based). Would love to have a GetQuestInfo(questID) function, but so far no luck.
__________________
It all starts to make a creepy kind of sense. Avatar
  Reply With Quote
07-25-13, 01:06 PM   #3
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
How about using this on a hidden tooltip object and reading the first line of the tooltip? http://wowprogramming.com/docs/widge...p/SetHyperlink
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
07-25-13, 01:47 PM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
This is a perfect use-case for a metatable and tooltip scanning:

Code:
local MyScanningTooltip = CreateFrame("GameTooltip", "MyScanningTooltip", UIParent, "GameTooltipTemplate")

local QuestTitleFromID = setmetatable({}, { __index = function(t, id)
	MyScanningTooltip:SetOwner(UIParent, "ANCHOR_NONE")
	MyScanningTooltip:SetHyperlink("quest:"..id)
	local title = MyScanningTooltipTextLeft1:GetText()
	MyScanningTooltip:Hide()
	if title and title ~= RETRIEVING_DATA then
		t[id] = title
		return title
	end
end })
Put that at/near the top of your file, and then just do a simple table lookup with the ID to get the name:

Code:
print(QuestTitleFromID[30318])
-- prints "Chasing the Chicken"
If the ID is invalid, or your game client doesn't have the info yet and has to query the server (not sure if this can even happen for quests), you will get nil instead of the quest name; if you're sure your ID was valid, you can just look it up again and your client should have the data by then.

You can use the same technique to get the localized name of anything else where there is no relevant API (eg. if you want item or spell names, just use GetItemInfo or GetSpellInfo). For example, there was recently a thread demonstrating this technique for getting localized NPC names from their mobIDs.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
07-25-13, 02:28 PM   #5
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
When you set the tooltip to a quest ID it has to request the information from the server if it hasn't been cached yet, it's similar to getting item information.

You can use OnTooltipSetQuest which triggers when the tooltip actually receives new information.

Note that the event can fire multiple times for the same quest because the tooltip may contain the name of items in the "Requirements" section and each item name requires another server request.

I had written a more complicated example that retrieved the entire quest text but there probably isn't any point in posting it.

Last edited by semlar : 07-25-13 at 02:35 PM.
  Reply With Quote
07-25-13, 10:37 PM   #6
AnrDaemon
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 156
Does that mean that I can do something like

Lua Code:
  1. local frame = CreateFrame("GameTooltip", "MyPrivateStuff_QuestInfoTooltipFrame", UIParent, "GameTooltipTemplate")
  2.  
  3. function frame:GetQuestTitle()
  4.   local title = MyPrivateStuff_QuestInfoTooltipFrameTextLeft1:GetText()
  5.   DEFAULT_CHAT_FRAME:AddMessage(self["message"]:format(title))
  6.   self:SetScript("OnTooltipSetQuest", nil)
  7. end
  8.  
  9. -- Add some slashes sausage
  10. local function commandHandler(msg, self)
  11.   local argv = { strsplit(" ", strtrim(msg)) }
  12.   if argv[1] == "quest" then
  13.     if IsQuestFlaggedCompleted(argv[2]) then
  14.       frame["message"] = ("Quest |cffffff00|Hquest:%d|h[%%s]|h|r flagged as completed."):format(argv[2])
  15.     else
  16.       frame["message"] = ("Quest |cffffff00|Hquest:%d|h[%%s]|h|r is not completed or not available to character."):format(argv[2])
  17.     end
  18.     frame:SetScript("OnTooltipSetQuest", frame.GetQuestTitle)
  19.     frame:SetOwner(UIParent, "ANCHOR_NONE")
  20.     frame:SetHyperlink("quest:" .. argv[2])
  21.   end
  22. end
  23.  
  24. SlashCmdList["MYPRIVATESTUFF"] = commandHandler
  25. SLASH_MYPRIVATESTUFF1 = '/my'
? Anyone see anything apparently wrong with such logic? Or I can go for field testing?

Last edited by AnrDaemon : 07-25-13 at 11:20 PM.
  Reply With Quote
04-27-20, 09:46 AM   #7
Nikita S. Doroshenko
A Cyclonian
 
Nikita S. Doroshenko's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2015
Posts: 45
Maybe someone knows if it's possible somehow to obtain localized string on different installed languages for quest titles, descriptions, unit titles.
I think it's possible to do with Blizzard API https://develop.battle.net/documenta...game-data-apis
But I wonder if it's possible for example GET quest Title, Description for es_ES, and de_DE ingame?

I have an idea of making an addon that will help players to learn a foreign language, but I'm not sure what will be the best way to get multiple localization data at the same time. And make addon easy to maintain in case of new content and updates.
  Reply With Quote
04-27-20, 10:21 AM   #8
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
Originally Posted by Nikita S. Doroshenko View Post
But I wonder if it's possible for example GET quest Title, Description for es_ES, and de_DE ingame?

I don't think that's possible in-game. You'd only get the info for your current locale
  Reply With Quote
07-03-18, 12:50 AM   #9
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
Code:
frame:SetScript("OnTooltipSetQuest", function(self)
	if not self.message then return end
	local title = MyPrivateStuff_QuestInfoTooltipFrameTextLeft1:GetText()
	self:Hide()
	DEFAULT_CHAT_FRAME:AddMessage(format(self.message, self.linkID, title))
	self.message, self.linkID = nil, nil
end)
Phanx left off the final ) after the last end.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 07-03-18 at 01:51 AM.
  Reply With Quote
07-03-18, 11:04 PM   #10
McRoell
A Defias Bandit
Join Date: Jul 2018
Posts: 2
Originally Posted by Fizzlemizz View Post
[code]Phanx left off the final ) after the last end.
Thank you.
I slightly guessed it but had an other issue with that code - usage - which was spoiling my efforts. Thanks to your confirmation I'm all-clear now.

McRoell
  Reply With Quote
07-03-18, 05:52 AM   #11
AnrDaemon
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 156
I strongly suggest an editor capable of structure highlighting, not just keywords.
  Reply With Quote
04-28-20, 11:50 AM   #12
AnrDaemon
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 156
Installed != Loaded.

WoW will only load one resource pack, so there's nothing different to retrieve.
  Reply With Quote
04-28-20, 01:42 PM   #13
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,928
Unless I am missing something fundamental I think there is really only one possible way and that is as follows:

First create an addon that generates and account wide saved variable file that you copy and paste into another account wide saved variable file that can be read in by a second addon that uses that file to browse the quest titles, pick a language and display that languages version.

The processes involved would amount roughly to the following

1. You ( not the user ) starts wow with language 1
2. Addon1 processes a list of specific quest IDs to get access to the locale specific titles.
3. Addon1 then writes these questID, languageID, questTitle block into the wtf file
4. Repeat 1,2,3 for each language you want to include.
5. Outside of wow edit the wtf created by Addon1 and change the table name to match the one that would be used by Addon2. For each changed version of that wtf file ( when you change information stored, languages added etc ) you will have to instruct the users of Addon2 where they need to place that file, otherwise it will get replaced with an empty file.
6. The user starts wow with their chosen language
7. Addon2 validates if it supports the chosen language and suggests relaying language requirement to the developer ( you )
8. Assuming the language is supported Addon2 can then access the table to extract language specific versions of the quest title to do what you want it to do.. such as pick the language that this quest text is from ? Pick the French equivalent of this quest title ( shown in the users chosen language) etc.


The down side is you are reliant that the user knows where to put the wtf file. Also, that wtf file could grow very big due to the number of quests available and the number of languages available. There will also be a lot of preparation time due to the separate game sessions you will have to use to get access to that data.

Technically it is feasible .. but practically it may not be worth the effort unless it is for your own personal use as you could then simply use a single addon to do both and work at your own pace and add languages as you go.

Definitely a challenge and could be a good learning curve for you, but for a language buff like me .. not something I would do myself, even for myself.
__________________


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
  Reply With Quote
04-28-20, 02:39 PM   #14
AnrDaemon
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 156
Yes, that could be an interesting programming and technical task. I.e. split languages into their own addons to reduce overhead.

However, I see a potential legal issue with such an addon, 'cause it would have to distribute original Blizzard texts.

Last edited by AnrDaemon : 04-28-20 at 02:42 PM.
  Reply With Quote
04-28-20, 05:55 PM   #15
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,928
Originally Posted by AnrDaemon View Post
Yes, that could be an interesting programming and technical task. I.e. split languages into their own addons to reduce overhead.

However, I see a potential legal issue with such an addon, 'cause it would have to distribute original Blizzard texts.

Oh yes, there is that .. clear forgot that it would be classed as distribution rather than just display. Yep, forget that idea..
__________________


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
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Is it possible to obtain quest title by questID ?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off