API calls to get talent string and apply talent string
TimothyLuke opened this issue · 7 comments
Hi All,
I have an unusual request. I develop a mod that creates advanced macros. For retail I store which talents have been selected etc but for Classic I want to do this but currently don’t. Rather than reinventing the wheel want to use Talented as an optional requirement.
What I would like to be able to do is query talented by an API call to get the currently applied talents as a talented string and then another call to talented to import and it apply a supplied talent string.
eg is there something like the following that I can do in Lua.
local Talented = Talented
If Talented then
TalentString = Talented.getCurrentTalentString()
end
Sorry that I never got back to you on this. Talented now does this via calling spellIDs, which you could hopefully also do. Will close, as this is more relevant to the TBC version
Aha! Yes you did, but I got to it myself in my round of edits last night 😅.
Anyway, a quick function that may work would look something like:
local L = LibStub("AceLocale-3.0"):GetLocale("Talented")
local primary_or_secondary_spec = 1 --or 2
local current_spec = Talented.alternates[primary_or_secondary_spec]
return Talented.exporters[L["Wowhead Talent Calculator"]](Talented, current_spec)
To return a wowhead string of the current spec. I haven't tested this though.
Ok found a Race condition. If the Talented window is never opened, then Talented.alternates[] is never populated and is nil. Is there an init/setup function I can call to get this to populate?
Also got the following missing L[] entry:
1x AceLocale-3.0-6: Talented: Missing entry for 'https://www.wowhead.com/wotlk/talent-calc/%s/%s'
[string "@Talented\wowhead.lua"]:66: in function `?'
[string "=[C]"]: in function `RunScript'
[string "@FrameXML\ChatFrame.lua"]:2196: in function `?'
[string "@FrameXML\ChatFrame.lua"]:4933: in function `ChatEdit_ParseText'
[string "@FrameXML\ChatFrame.lua"]:4596: in function `ChatEdit_SendText'
[string "@FrameXML\ChatFrame.lua"]:4632: in function <FrameXML\ChatFrame.lua:4628>
[string "=[C]"]: in function `ChatEdit_OnEnterPressed'
[string "*:OnEnterPressed"]:1: in function <[string "*:OnEnterPressed"]:1>
You're welcome - for what little I did. I'm sorry that I didn't help very much - I'm afraid I was a bit swamped with tasks to get this up and running for Wrath, for what little time I had to develop.
I understand that totally.
If you are curious this was the result: TimothyLuke/GSE-Advanced-Macro-Compiler#1156 TimothyLuke/GSE-Advanced-Macro-Compiler@7701434