Skip to content

Commit

Permalink
Sort Specializations on the user's end.
Browse files Browse the repository at this point in the history
This should be a purely visual change.
  • Loading branch information
nullKomplex authored and InfusOnWoW committed Nov 1, 2024
1 parent 106010b commit 7f4b056
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
21 changes: 19 additions & 2 deletions WeakAuras/Prototypes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -685,12 +685,15 @@ Private.anim_presets = {
};

WeakAuras.class_ids = {}
WeakAuras.classes_sorted = {}
for classID = 1, 20 do -- GetNumClasses not supported by wow classic
local classInfo = C_CreatureInfo.GetClassInfo(classID)
if classInfo then
WeakAuras.class_ids[classInfo.classFile] = classInfo.classID
tinsert(WeakAuras.classes_sorted, classInfo.classFile)
end
end
table.sort(WeakAuras.classes_sorted)

if WeakAuras.IsClassicOrCata() then
---@param index integer
Expand Down Expand Up @@ -1415,7 +1418,9 @@ Private.load_prototype = {
init = WeakAuras.IsCataOrRetail() and "arg" or nil,
enable = WeakAuras.IsCataOrRetail(),
hidden = not WeakAuras.IsCataOrRetail(),
events = {"PLAYER_TALENT_UPDATE"}
events = {"PLAYER_TALENT_UPDATE"},
sorted = true,
sortOrder = Private.specs_sorted,
},
{
name = "talent",
Expand Down Expand Up @@ -2374,6 +2379,8 @@ Private.event_prototypes = {
return WeakAuras.IsCataOrRetail() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")
end,
desc = L["Requires syncing the specialization via LibSpecialization."],
sorted = true,
sortOrder = Private.specs_sorted,
},
{
name = "classification",
Expand Down Expand Up @@ -3358,6 +3365,8 @@ Private.event_prototypes = {
return WeakAuras.IsCataOrRetail() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")
end,
desc = L["Requires syncing the specialization via LibSpecialization."],
sorted = true,
sortOrder = Private.specs_sorted,
},
{
name = "role",
Expand Down Expand Up @@ -3926,6 +3935,8 @@ Private.event_prototypes = {
return WeakAuras.IsCataOrRetail() and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party")
end,
desc = L["Requires syncing the specialization via LibSpecialization."],
sorted = true,
sortOrder = Private.specs_sorted,
},
{
name = "role",
Expand Down Expand Up @@ -4222,6 +4233,8 @@ Private.event_prototypes = {
return trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party"
end,
desc = L["Requires syncing the specialization via LibSpecialization."],
sorted = true,
sortOrder = Private.specs_sorted,
},
{
name = "role",
Expand Down Expand Up @@ -7134,7 +7147,9 @@ Private.event_prototypes = {
type = "multiselect",
values = "spec_types_all",
store = "true",
conditionType = "select"
conditionType = "select",
sorted = true,
sortOrder = Private.specs_sorted,
},
{
hidden = true,
Expand Down Expand Up @@ -7184,6 +7199,8 @@ Private.event_prototypes = {
values = "spec_types_all",
conditionType = "select",
store = true,
sorted = true,
sortOrder = Private.specs_sorted,
},
{
name = "name",
Expand Down
5 changes: 4 additions & 1 deletion WeakAuras/Types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1810,8 +1810,10 @@ WeakAuras.spec_types_specific = {}

---@type table<number, string>
Private.spec_types_all = {}
Private.specs_sorted = {}
local function update_specs()
for classFileName, classID in pairs(WeakAuras.class_ids) do
for _, classFileName in pairs(WeakAuras.classes_sorted) do
local classID = WeakAuras.class_ids[classFileName]
WeakAuras.spec_types_specific[classFileName] = {}
local numSpecs = WeakAuras.IsCataClassic() and 3 or GetNumSpecializationsForClassID(classID) -- see https://github.com/Stanzilla/WoWUIBugs/issues/559
for i = 1, numSpecs do
Expand All @@ -1821,6 +1823,7 @@ local function update_specs()
local classColor = WA_GetClassColor(classFileName)
Private.spec_types_all[specId] = CreateAtlasMarkup(GetClassAtlas(classFileName:lower()))
.. "|T"..(icon or "error")..":0|t "..(WrapTextInColorCode(tabName, classColor) or "error");
tinsert(Private.specs_sorted, specId)
end
end
end
Expand Down

0 comments on commit 7f4b056

Please sign in to comment.