Skip to content

Commit

Permalink
Fix talent load condition with automatically granted talents
Browse files Browse the repository at this point in the history
  • Loading branch information
Snakybo committed Dec 13, 2022
1 parent 7617067 commit 063c8b3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The format of this changelog is based on [Keep a Changelog](https://keepachangel

* Fix talent selection input on non-English locales [#146]
* Fix a Lua error when selecting spell from the spellbook
* Fix talent known condition not working with talents granted automatically
* Improve performance when switching specializations or talent loadouts

## [1.10.1] - 2022-11-28
Expand Down
33 changes: 25 additions & 8 deletions Clicked/Core/BindingProcessor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -801,14 +801,31 @@ function Addon:CanBindingLoad(binding)
for _, nodeId in ipairs(nodes) do
local nodeInfo = C_Traits.GetNodeInfo(configId, nodeId)

if nodeInfo.ID ~= 0 and nodeInfo.currentRank > 0 then
local entryId = nodeInfo.activeEntry ~= nil and nodeInfo.activeEntry.entryID
local entryInfo = entryId ~= nil and C_Traits.GetEntryInfo(configId, entryId)
local definitionInfo = entryInfo ~= nil and C_Traits.GetDefinitionInfo(entryInfo.definitionID)

if definitionInfo ~= nil then
local name = StripColorCodes(TalentUtil.GetTalentNameFromInfo(definitionInfo))
talents[name] = true
if nodeInfo.ID ~= 0 then
-- check if the node was manually selected by the player, the easy way
local isValid = nodeInfo.currentRank > 0

-- check if the node was granted to the player automatically
if not isValid then
for _, conditionId in ipairs(nodeInfo.conditionIDs) do
local conditionInfo = C_Traits.GetConditionInfo(configId, conditionId)

if conditionInfo.isMet and conditionInfo.ranksGranted ~= nil and conditionInfo.ranksGranted > 0 then
isValid = true
break
end
end
end

if isValid then
local entryId = nodeInfo.activeEntry ~= nil and nodeInfo.activeEntry.entryID or 0
local entryInfo = entryId ~= nil and C_Traits.GetEntryInfo(configId, entryId) or nil
local definitionInfo = entryInfo ~= nil and C_Traits.GetDefinitionInfo(entryInfo.definitionID) or nil

if definitionInfo ~= nil then
local name = StripColorCodes(TalentUtil.GetTalentNameFromInfo(definitionInfo))
talents[name] = true
end
end
end
end
Expand Down

0 comments on commit 063c8b3

Please sign in to comment.