From c094770c7de2d892cf8340e939a6efb109f0a5e8 Mon Sep 17 00:00:00 2001 From: Disparity Date: Thu, 30 Jun 2016 15:51:34 +0600 Subject: [PATCH] Add sorting guild members by note --- TitanSocial.lua | 8 ++++++-- localization.lua | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/TitanSocial.lua b/TitanSocial.lua index 6d15e6a..cf5782d 100644 --- a/TitanSocial.lua +++ b/TitanSocial.lua @@ -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) @@ -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) @@ -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 diff --git a/localization.lua b/localization.lua index 2048dfb..77d280c 100644 --- a/localization.lua +++ b/localization.lua @@ -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"