Error while linking talents in chat
akay opened this issue ยท 10 comments
I can't seem to be able to link talents in TBC pre-patch:
1x Talented\spell.lua:251: attempt to index field '?' (a nil value)
[string "@Talented\spell.lua"]:251: in function `GetTalentLink'
[string "@Talented\view-View.lua"]:342: in function `OnTalentClick'
[string "@Talented\ui\buttons.lua"]:24: in function <Talented\ui\buttons.lua:22>
Locals:
self = <table> {
CreateTemplateMenu = <function> defined @Talented\ui\menu.lua:104
defaults = <table> {
}
LoadAddOn = <function> defined @Talented\core.lua:74
OpenOptionsFrame = <function> defined @Talented\ui\menu.lua:26
MakeArrow = <function> defined @Talented\ui\arrows.lua:17
GetTalentPrereqs = <function> defined @Talented\spell.lua:234
spelldata = <table> {
}
UnregisterComm = <function> defined @LibSharedMedia-3.0\CallbackHandler-1.0\CallbackHandler-1.0.lua:153
HideTooltipInfo = <function> defined @Talented\tips.lua:134
DataAddonLoaded = <function> defined @Talented\talents.lua:151
GetDefaultMode = <function> defined @Talented\core.lua:285
SetDefaultModulePrototype = <function> defined @Prat-3.0_Libraries\AceAddon-3.0\AceAddon-3.0.lua:409
UpdateTemplateName = <function> defined @Talented\core.lua:123
GetMode = <function> defined @Talented\core.lua:54
SetTemplate = <function> defined @Talented\core.lua:264
SetMode = <function> defined @Talented\core.lua:58
RegisterMessage = <function> defined @LibSharedMedia-3.0\CallbackHandler-1.0\CallbackHandler-1.0.lua:90
UnregisterMessage = <function> defined @LibSharedMedia-3.0\CallbackHandler-1.0\CallbackHandler-1.0.lua:153
Update = <function> defined @Talented\core.lua:363
hooks = <table> {
}
SendCommMessage = <function> defined @WeakAuras\Libs\AceComm-3.0\AceComm-3.0.lua:87
db = <table> {
}
mode = "view"
UnregisterAllComm = <function> defined @LibSharedMedia-3.0\CallbackHandler-1.0\CallbackHandler-1.0.lua:174
SetEnabledState = <function> defined @Prat-3.0_Libraries\AceAddon-3.0\AceAddon-3.0.lua:424
Hook = <function> defined @Prat-3.0_Libraries\AceHook-3.0\AceHook-3.0.lua:274
OpenTemplate = <function> defined @Talented\core.lua:244
OnEnable = <function> defined @Talented\core.lua:289
GetTemplateStringClass = <function> defined @Talented\encode.lua:15
MakeButton = <function> defined @Talented\ui\buttons.lua:75
ImportTemplate = <function> defined @Talented\core.lua:209
Pool = <table> {
}
UnregisterAllEvents = <function> defined @LibSharedMedia-3.0\CallbackHandler-1.0\CallbackHandler-1.0.lua:174
optionsFrame = <unnamed> {
}
Deserialize = <function> defined @WeakAuras\Libs\AceSerializer-3.0\AceSerializer-3.0.lua:246
MakeActionMenu = <function> defined @Talented\ui\menu.lua:370
TalentView = <table> {
}
GetName = <function> defined @Prat-3.0_Libraries\AceAddon-3.0\AceAddon-3.0.lua:279
views = <table> {
}
name = "Talented"
UpdateView = <function> defined @Talented\viewmode.lua:90
GetTalentInfo = <function> defined @Talented\talents.lua:195
Disable = <function> defined @Prat-3.0_Libraries\AceAddon-3.0\AceAddon-3.0.lua:314
GetOption = <function> defined @Talented\options.lua:65
Unhook = <function> defined @Prat-3.0_Libraries\AceHook-3.0\AceHook-3.0.lua:418
Print = <function> defined @Talented\core.lua:7
UncompressSpellData = <function> defined @Talented\spell.lua:96
SetOption = <function> defined @Talented\options.lua:58
UpdateCurrentTemplate = <function> defined @Talented\viewmode.lua:44
Serialize = <function> defined @WeakAuras\Libs\AceSerializer-3.0\AceSerializer-3.0.lua:122
Debug = <function> defined @Talented\core.lua:15
EnableUI = <function> defined @Talented\ui\base.lua:363
MakeTalentFrame = <function> defined @Talented\ui\trees.lua:99
RegisterComm = <function> defined @WeakAuras\Libs
The problem is that that line of code comes from a version of the addon designed for a later edition of WoW. Ranks is a vector in that version, whereas here it's a scalar, which contains the number of ranks taht the talent has (returned by the WoW API). The fix here would be to use an API function to return a given rank of a given talent. But, as far as I can tell, no such API function exists, you can only return the currently available ranks from the API. If I could find such a function, I wouldn't need data to be exported and manually edited for the addon to function, and wouldn't have localisation issues.
TalentedClassic/Talented/spell.lua
Line 251 in 08c5e96
cant find the problem x-x
should be fixed with #49
Thanks. I haven't tried it ingame, but are you sure that doesn't work only on the current talents? I have a feeling it wouldn't work as expected on template (i.e. wouldn't return the correct rank).
yes, you are right. thats the problem - only works with the current active character talents.
the better version of GetTalentLink came with wotlk, not sure how to fix this...
I still need to hunt down whether the API lets you retrieve any rank of a talent. That'd be wonderful, because it'd mean not having to export data.
In the meantime, I may edit that pull request slightly to explicitly only work when the active view is the player's current talents.
Sorry to bother again, but...
looks like there is no way to obtain the TalentID in classic - so its not possible to craft the links. I think you have to add the TalentID to Talented_Data...? I cant even find the ID on wowhead.
Here is an example for Improved Heroic Strike:
|cff4e96f7|Htalent:124:-1|h[Improved Heroic Strike]|h|r
https://tbc.wowhead.com/spell=12664/improved-heroic-strike
Some old documentation:
|cff4e96f7|Htalent:1396:4|h[Unleashed Fury]|h|r Represents a talent.
The linkdata for a talent link follows the format: talentID:rank:
- talentID โA unique identifier for the talent; not used elsewhere in the API.
Yep. Isn't it extremely irritating? The only obvious way to get those TalentIDs is to HAVE that rank of the talent, or the one below, since Blizzard's UI can call those. You can see why that would be very irritating for a user to export. Since the gain -- linking talents -- is relatively minor, I'm not inclined to go through that monumental amount of effort and potential gold cost, if it has not been datamined by sites like WoWHead, as you say.
Ah... no need to learn every talent. You can truncate the links! If you want to build a TalentID database directly from wow, you can use something like this to extract the TalentID:
local link = GetTalentLink(tab,index)
printable = gsub(link, "\124", "\124\124");
print (printable) -- complete link
print (printable:match("talent:%d+")) -- only the talent id
...but, same problem as with my "fix", it only works for your current class. x-x'