Skip to content

Commit

Permalink
Add sorting guild members by note
Browse files Browse the repository at this point in the history
  • Loading branch information
Disparity committed Jun 30, 2016
1 parent 1e7e9b5 commit c094770
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions TitanSocial.lua
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ function _G.TitanPanelRightClickMenu_PrepareSocialMenu(frame, level, menuList)
addSortOption(L.MENU_GUILD_SORT_NAME, "GuildSortKey", "name", level)
addSortOption(L.MENU_GUILD_SORT_RANK, "GuildSortKey", "rank", level)
addSortOption(L.MENU_GUILD_SORT_CLASS, "GuildSortKey", "class", level)
addSortOption(L.MENU_GUILD_SORT_NOTE, "GuildSortKey", "note", level)
addSortOption(L.MENU_GUILD_SORT_LEVEL, "GuildSortKey", "level", level)
addSortOption(L.MENU_GUILD_SORT_ZONE, "GuildSortKey", "zone", level)
TitanPanelRightClickMenu_AddSpacer(level)
Expand Down Expand Up @@ -383,8 +384,8 @@ local function collectGuildRosterInfo(split, sortKey, sortAscending)

if sortKey then
local function sortFunc(a, b)
local aname, _, arankIndex, alevel, aclass, azone = GetGuildRosterInfo(a)
local bname, _, brankIndex, blevel, bclass, bzone = GetGuildRosterInfo(b)
local aname, _, arankIndex, alevel, aclass, azone, anote = GetGuildRosterInfo(a)
local bname, _, brankIndex, blevel, bclass, bzone, bnote = GetGuildRosterInfo(b)
if sortKey == "rank" and arankIndex ~= brankIndex then
-- rank indices are reversed from what you'd expect, so flip the meaning of ascending
return ternary(sortAscending, arankIndex > brankIndex, arankIndex < brankIndex)
Expand All @@ -398,6 +399,9 @@ local function collectGuildRosterInfo(split, sortKey, sortAscending)
if sortKey == "zone" and azone ~= bzone then
return ternary(sortAscending, azone < bzone, azone > bzone)
end
if sortKey == "note" and anote ~= bnote then
return ternary(sortAscending, anote < bnote, anote > bnote)
end
aname = string.lower(aname or "Unknown")
bname = string.lower(bname or "Unknown")
-- if name is the secondary sort, it's always ascending
Expand Down
1 change: 1 addition & 0 deletions localization.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ L.MENU_GUILD_SORT_DEFAULT = "Use Guild Roster Sort"
L.MENU_GUILD_SORT_NAME = "Name"
L.MENU_GUILD_SORT_RANK = "Rank"
L.MENU_GUILD_SORT_CLASS = "Class"
L.MENU_GUILD_SORT_NOTE = "Note"
L.MENU_GUILD_SORT_LEVEL = "Level"
L.MENU_GUILD_SORT_ZONE = "Zone"
L.MENU_GUILD_SORT_ASCENDING = "Ascending"
Expand Down

0 comments on commit c094770

Please sign in to comment.