Skip to content

Add class filtering and alphabetical sorting for loadout profiles#105

Draft
Copilot wants to merge 4 commits into
masterfrom
copilot/add-sorting-filtering-loadouts
Draft

Add class filtering and alphabetical sorting for loadout profiles#105
Copilot wants to merge 4 commits into
masterfrom
copilot/add-sorting-filtering-loadouts

Conversation

Copilot AI commented Jan 17, 2026

Copy link
Copy Markdown
Contributor

Users with many loadouts across multiple classes/specs need better organization. Added profile filtering by current class and alphabetical sorting.

Changes

  • Class metadata extraction: Parse and store class from export text (# CLASS: Warrior) when profiles are saved
  • Filter checkbox: Show only profiles matching current character's class via UnitClass("player")
  • Sort checkbox: Alphabetically sort visible profiles by name
  • Settings persistence: Both options stored in MyslotSettings and persist across sessions
  • Backward compatibility: Profiles without class metadata are always shown and have class extracted lazily

Implementation

Modified gui.lua only (~100 lines):

-- Extract class from export comment
local function ExtractClassFromExport(exportText)
    local _, _, className = string.find(exportText, "#%s*[Cc][Ll][Aa][Ss][Ss]%s*:%s*([^\n\r]+)")
    return className and strtrim(className) or nil
end

-- Filter and sort in dropdown initialization
for i, txt in pairs(exports) do
    if not txt.class and txt.value then
        txt.class = ExtractClassFromExport(txt.value)
    end
    
    local shouldShow = true
    if MyslotSettings.filterCurrentClass and txt.class then
        shouldShow = (txt.class == UnitClass("player"))
    end
    
    if shouldShow then
        table.insert(profilesToShow, {index = i, name = txt.name})
    end
end

if MyslotSettings.sortAlphabetically then
    table.sort(profilesToShow, function(a, b) return a.name < b.name end)
end

UI: Two checkboxes below profile management buttons trigger immediate dropdown refresh.

Original prompt

This section details on the original issue you should resolve

<issue_title>Request: Sorting and Filtering</issue_title>
<issue_description>For those of us who play lots of classes and specs, we end up with dozens of loadouts. To help with that, I request two features:

  • A way to filter loadouts based on the class we are logged into, and
  • A way to sort or group the shown loadout.

Even something as simple as an alphabetical sort would greatly improve the user experience.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits January 17, 2026 13:00
- Extract class information from exported profiles
- Store class metadata when saving profiles
- Add "Filter: Current Class Only" checkbox
- Add "Sort Alphabetically" checkbox
- Implement filtering and sorting logic in dropdown
- Backward compatible with existing profiles

Co-authored-by: tg123 <170430+tg123@users.noreply.github.com>
Make it explicit that profiles without class information
will always be shown when filtering is enabled

Co-authored-by: tg123 <170430+tg123@users.noreply.github.com>
- Move settings initialization before helper function for clarity
- Add comment explaining case-insensitive pattern matching
- Add comments explaining localization behavior

Co-authored-by: tg123 <170430+tg123@users.noreply.github.com>
Copilot AI changed the title [WIP] Add sorting and filtering for loadouts based on class Add class filtering and alphabetical sorting for loadout profiles Jan 17, 2026
Copilot AI requested a review from tg123 January 17, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Request: Sorting and Filtering

2 participants