From a501d6653d635243d6eaa6cccae41bba4c03b611 Mon Sep 17 00:00:00 2001 From: DJScias Date: Sat, 7 Sep 2024 22:55:10 +0200 Subject: [PATCH] Add reputation filter + show legacy reputation options --- CHANGELOG.md | 5 +++++ core.lua | 8 +------- modules/reputation.lua | 30 ++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43c2cd3..c7d75ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [6.2.0] - Unreleased +### Added +- Add two new options introduced to reputations in The War Within (also found in the upper right corner on the reputations panel): + - "Reputation Filter" lets you filter your reputations between All, Warband and your Character. + - "Show Legacy Reputation" toggles all the reputations prior to The War Within. + ### Changed - Rewrote the behavior of "Auto add to Recent Reputations list" and "Auto switch bar to last gained reputation". - Auto-add has no noticeable end-user changes that are worth mentioning. diff --git a/core.lua b/core.lua index f2bf633..4cc9afd 100644 --- a/core.lua +++ b/core.lua @@ -1125,24 +1125,18 @@ function Addon:OpenContextMenu(clickedModuleIndex) local splitOneOption = rootDescription:CreateRadio("Split into one", function() return self.db.char.NumSplits == 1; end, function() Addon:SetSplits(1); end); - splitOneOption:SetShouldRespondIfSubmenu(true); - splitOneOption:SetResponse(MenuResponse.CloseAll); local splitTwoOption = rootDescription:CreateRadio("Split into two", function() return self.db.char.NumSplits == 2; end, function() Addon:SetSplits(2); end); - splitTwoOption:SetShouldRespondIfSubmenu(true); - splitTwoOption:SetResponse(MenuResponse.CloseAll); if numTotalEnabled < 2 then splitTwoOption:SetEnabled(false); end local splitThreeOption = rootDescription:CreateRadio("Split into three", function() return self.db.char.NumSplits == 3; end, function() Addon:SetSplits(3); end); - splitThreeOption:SetShouldRespondIfSubmenu(true); - splitThreeOption:SetResponse(MenuResponse.CloseAll); splitThreeOption:SetTooltip(function(tooltip, elementDescription) GameTooltip_SetTitle(tooltip, MenuUtil.GetElementText(elementDescription)); - GameTooltip_AddNormalLine(tooltip, "When splitting into three the text is shortened and you can hover over the bar to view full text.|n|nYou will see a plus symbol (+) when some information is hidden."); + GameTooltip_AddNormalLine(tooltip, "When the bar is split into three, the text is truncated and you can hover over the bar to see the full text.|n|nYou will see a plus symbol (+) when some information is hidden."); end); if numTotalEnabled < 3 then splitThreeOption:SetEnabled(false); diff --git a/modules/reputation.lua b/modules/reputation.lua index b0102cd..b63e1a0 100644 --- a/modules/reputation.lua +++ b/modules/reputation.lua @@ -414,6 +414,36 @@ function module:GetOptionsMenu(currentMenu) currentMenu:CreateDivider(); + local reputationSortType = currentMenu:CreateButton("Reputation Filter"); + reputationSortType:CreateTitle("Reputation Filter"); + reputationSortType:SetTooltip(function(tooltip, elementDescription) + GameTooltip_SetTitle(tooltip, MenuUtil.GetElementText(elementDescription)); + GameTooltip_AddNormalLine(tooltip, "Filters your reputation list by chosen type.|n|n|cnWARNING_FONT_COLOR:Note: This option can also be found in the reputations panel in the upper right corner.|r"); + end); + local sortTypeAll = reputationSortType:CreateRadio("All", function() return C_Reputation.GetReputationSortType() == 0; end, function() + C_Reputation.SetReputationSortType(0) + end); + + local sortTypeWarband = reputationSortType:CreateRadio("Warband", function() return C_Reputation.GetReputationSortType() == 1; end, function() + C_Reputation.SetReputationSortType(1) + end); + + local sortTypeChar = reputationSortType:CreateRadio(UnitName("PLAYER"), function() return C_Reputation.GetReputationSortType() == 2; end, function() + C_Reputation.SetReputationSortType(2) + end); + + local legacyOption = currentMenu:CreateCheckbox("Show Legacy Reputations", function() return C_Reputation.AreLegacyReputationsShown(); end, function() + C_Reputation.SetLegacyReputationsShown(not C_Reputation.AreLegacyReputationsShown()); + module:RefreshText(); + end); + legacyOption:SetTooltip(function(tooltip, elementDescription) + GameTooltip_SetTitle(tooltip, MenuUtil.GetElementText(elementDescription)); + GameTooltip_AddNormalLine(tooltip, "This option will toggle all reputations prior to |cnWHITE_FONT_COLOR:The War Within|r.|n|n|cnWARNING_FONT_COLOR:Note: This option can also be found in the reputations panel in the upper right corner.|r"); + end); + legacyOption:SetResponse(MenuResponse.CloseAll); + + currentMenu:CreateDivider(); + currentMenu:CreateCheckbox("Show gained reputation", function() return self.db.global.ShowGainedRep; end, function() self.db.global.ShowGainedRep = not self.db.global.ShowGainedRep; module:RefreshText();