@@ -194,31 +194,40 @@ function br.loader:new(spec, specName)
194194 -- Check Existing Talents
195195 local function CheckExistingTalents (talentID )
196196 local playerClass = select (2 , br ._G .UnitClass (' player' ))
197- local talentName = br .convertName (br ._G .GetSpellInfo (talentID ))
198- if br .lists .spells [playerClass ][" Shared" ] ~= nil and br .lists .spells [playerClass ][spec ] ~= nil then
199- local heroicTalents = br .lists .spells [playerClass ][" Shared" ][" talentsHeroic" ] and
200- br .lists .spells [playerClass ][" Shared" ][" talentsHeroic" ] or {}
201- local sharedTalents = br .lists .spells [playerClass ][" Shared" ][" talents" ]
202- local specTalents = br .lists .spells [playerClass ][spec ][" talents" ]
203- -- Check for missing entries
204- if sharedTalents [talentName ] == nil and specTalents [talentName ] == nil and heroicTalents [talentName ] == nil then
205- br ._G .print (" |cffff0000Talent: |r" ..
206- talentName ..
207- " |cffff0000 with ID: |r" ..
208- talentID .. " is not listed in the list of Talents Spell List." )
209- end
210- -- Check for incorrect IDs
211- if (specTalents [talentName ] ~= nil and specTalents [talentName ] ~= talentID )
212- or (sharedTalents [talentName ] ~= nil and sharedTalents [talentName ] ~= talentID )
213- or (heroicTalents [talentName ] ~= nil and heroicTalents [talentName ] ~= talentID )
214- then
215- local currentID = specTalents [talentName ] ~= nil and specTalents [talentName ] or
216- sharedTalents [talentName ]
217- br ._G .print (" |cffff0000Talent found in the Talent Spell List for |r" ..
218- talentName .. " |cffff0000 with ID: |r" ..
219- currentID ..
220- " |cffff0000 it should be changed to ID: |r" .. talentID .. " |cffff0000." )
197+ if br .lists .spells [playerClass ][" Shared" ] == nil or br .lists .spells [playerClass ][spec ] == nil then
198+ return
199+ end
200+
201+ local heroicTalents = br .lists .spells [playerClass ][" Shared" ][" talentsHeroic" ] or {}
202+ local sharedTalents = br .lists .spells [playerClass ][" Shared" ][" talents" ]
203+ local specTalents = br .lists .spells [playerClass ][spec ][" talents" ]
204+
205+ -- Helper function to find talent name by ID in a talent table
206+ local function findTalentNameByID (talentTable , searchID )
207+ for name , id in pairs (talentTable ) do
208+ if id == searchID then
209+ return name
210+ end
221211 end
212+ return nil
213+ end
214+
215+ -- Helper function to check if talent ID exists in any talent table
216+ local function talentIDExists (searchID )
217+ return findTalentNameByID (specTalents , searchID ) ~= nil or
218+ findTalentNameByID (sharedTalents , searchID ) ~= nil or
219+ findTalentNameByID (heroicTalents , searchID ) ~= nil
220+ end
221+
222+ -- Get the localized talent name for display purposes only
223+ local talentName = br ._G .GetSpellInfo (talentID ) or (" Unknown Spell " .. talentID )
224+
225+ -- Check for missing entries
226+ if not talentIDExists (talentID ) then
227+ br ._G .print (" |cffff0000Talent: |r" ..
228+ talentName ..
229+ " |cffff0000 with ID: |r" ..
230+ talentID .. " is not listed in the list of Talents Spell List." )
222231 end
223232 end
224233
0 commit comments