Skip to content

Commit f8d58e6

Browse files
committed
fix: remove classes unused by game version
`GetNumClasses` returns the the id for the highest valid class in that game client. For any intermediate id's that are not valid for the current game client, `GetClassInfo` will return `nil`.
1 parent 68ca676 commit f8d58e6

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

ClassColors.lua

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,19 @@ end
6363

6464
------------------------------------------------------------------------
6565

66+
local validClasses = { }
67+
for i = 1, GetNumClasses() do
68+
local info = C_CreatureInfo.GetClassInfo(i)
69+
if info and info.classFile then -- returs nil for classes not in game version
70+
validClasses[info.classFile] = true
71+
end
72+
end
73+
6674
local classes = {}
6775
for class in pairs(RAID_CLASS_COLORS) do
68-
tinsert(classes, class)
76+
if validClasses[class] then
77+
tinsert(classes, class)
78+
end
6979
end
7080
sort(classes)
7181

0 commit comments

Comments
 (0)