Skip to content

Commit 3898f35

Browse files
committed
Move wipe out of if-else as it always needs to happen
1 parent 391c843 commit 3898f35

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

Clicked/Core/BindingProcessor.lua

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -900,9 +900,9 @@ function Addon:UpdateTalentCache(callback, immediate)
900900
reloadTalentCacheDelayTicker = nil
901901
end
902902

903-
if Addon.EXPANSION_LEVEL >= Addon.Expansion.DF then
904-
wipe(talentCache)
903+
wipe(talentCache)
905904

905+
if Addon.EXPANSION_LEVEL >= Addon.Expansion.DF then
906906
local configId = C_ClassTalents.GetActiveConfigID()
907907
if configId == nil then
908908
Addon:UpdateTalentCache()
@@ -923,29 +923,29 @@ function Addon:UpdateTalentCache(callback, immediate)
923923

924924
if nodeInfo.ID ~= 0 then
925925
-- check if the node was manually selected by the player, the easy way
926-
local isValid = nodeInfo.currentRank > 0
926+
local isSelected = nodeInfo.currentRank > 0
927927

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

933933
if conditionInfo ~= nil and conditionInfo.isMet and conditionInfo.ranksGranted ~= nil and conditionInfo.ranksGranted > 0 then
934-
isValid = true
934+
isSelected = true
935935
break
936936
end
937937
end
938938
end
939939

940940
-- check if the node is part of a hero talent tree that is currently selected
941-
if isValid and nodeInfo.subTreeID then
941+
if isSelected and nodeInfo.subTreeID then
942942
local subTreeInfo = C_Traits.GetSubTreeInfo(configId, nodeInfo.subTreeID)
943943
if not subTreeInfo.isActive then
944-
isValid = false
944+
isSelected = false
945945
end
946946
end
947947

948-
if isValid then
948+
if isSelected then
949949
local entryId = nodeInfo.activeEntry ~= nil and nodeInfo.activeEntry.entryID or 0
950950
local entryInfo = entryId ~= nil and C_Traits.GetEntryInfo(configId, entryId) or nil
951951
local definitionInfo = entryInfo ~= nil and entryInfo.definitionID ~= nil and C_Traits.GetDefinitionInfo(entryInfo.definitionID) or nil
@@ -958,8 +958,6 @@ function Addon:UpdateTalentCache(callback, immediate)
958958
end
959959
end
960960
elseif Addon.EXPANSION_LEVEL >= Addon.Expansion.MOP then
961-
wipe(talentCache)
962-
963961
for i = 1, MAX_NUM_TALENTS do
964962
local info = C_SpecializationInfo.GetTalentInfo({
965963
tier = math.ceil(i / MAX_NUM_TALENTS),
@@ -971,8 +969,6 @@ function Addon:UpdateTalentCache(callback, immediate)
971969
end
972970
end
973971
else
974-
wipe(talentCache)
975-
976972
for tab = 1, GetNumTalentTabs() do
977973
for index = 1, GetNumTalents(tab) do
978974
local name, _, _, _, rank = GetTalentInfo(tab, index)

0 commit comments

Comments
 (0)