Skip to content

Commit

Permalink
Add an option to show specialization icons in the dungeon list (see #201
Browse files Browse the repository at this point in the history
)
  • Loading branch information
0xbs committed Aug 14, 2024
1 parent d2caa92 commit 2963f19
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 4 deletions.
1 change: 1 addition & 0 deletions Init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ C.SETTINGS_DEFAULT = {
classNamesInTooltip = true,
coloredGroupTexts = true,
ratingInfo = true,
specIcon = false,
classCircle = false,
classBar = false,
leaderCrown = false,
Expand Down
2 changes: 2 additions & 0 deletions Localization/deDE.lua
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,5 @@ L["settings.signupOnEnter.title"] = "Anmelden mit Eingabetaste"
L["settings.signupOnEnter.tooltip"] = "Fokussiert automatisch das Textfeld „Notiz für den Gruppenanführer“, wenn Ihr euch für eine neue Gruppe anmeldet, und bestätigt eure Anmeldung, indem Ihr die Eingabetaste drückt."
L["settings.skipSignUpDialog.title"] = "Anmelde-Dialog überspringen"
L["settings.skipSignUpDialog.tooltip"] = "Überspringt die Abfrage der Rolle und Notiz falls möglich und meldet euch sofort bei der Gruppe an. Haltet die Umschalttaste gedrückt, um den Dialog immer anzuzeigen."
L["settings.specIcon.title"] = "Spezialisierung anzeigen"
L["settings.specIcon.tooltip"] = "Zeigt ein Icon für die Klassenspezialisierung jedes Mitglieds bei organisierten Dungeongruppen."
2 changes: 2 additions & 0 deletions Localization/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,5 @@ L["settings.signupOnEnter.title"] = "Sign Up On Enter"
L["settings.signupOnEnter.tooltip"] = "Automatically focus the 'note to the group leader' text box when signing up for a new group and confirm your application by pressing enter."
L["settings.skipSignUpDialog.title"] = "Skip Sign Up Dialog"
L["settings.skipSignUpDialog.tooltip"] = "Skip the role and note prompt if possible and immediately sign up to the group. Hold shift to always show the dialog."
L["settings.specIcon.title"] = "Show specialization"
L["settings.specIcon.tooltip"] = "Shows an icon with the class specialization of each member in the premade group list."
3 changes: 2 additions & 1 deletion Modules/MemberInfo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ function PGF.GetSearchResultMemberInfoTable(resultID, numMembers)
end
end
-- sort reverse by role -> tank, heal, dps; then by class
local classOrder = PGF.Table_Invert(CLASS_SORT_ORDER)
table.sort(members, function(a, b)
if a.role ~= b.role then return b.role < a.role end
return a.class < b.class
return classOrder[a.class] < classOrder[b.class]
end)
return members
end
27 changes: 24 additions & 3 deletions Modules/RoleIndicators.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function PGF.GetOrCreateRoleIndicatorFrames(self, numIcons)
frame:SetPoint("RIGHT", self, "RIGHT", -13 - (numIcons - iconIndex) * 18, 0)

frame.ClassBar = frame:CreateTexture("$parentClassBar", "OVERLAY")
frame.ClassBar:SetSize(14, 3)
frame.ClassBar:SetSize(15, 3)
frame.ClassBar:SetPoint("CENTER")
frame.ClassBar:SetPoint("BOTTOM", 0, 3)

Expand All @@ -47,9 +47,20 @@ function PGF.GetOrCreateRoleIndicatorFrames(self, numIcons)
frame.LeaderCrown:SetPoint("TOP", 0, -5)
frame.LeaderCrown:SetAtlas("groupfinder-icon-leader", false, "LINEAR")

frame.ClassCircle = frame:CreateTexture("$parentClassCircle", "BACKGROUND")
-- ClassBorder is only used if the ClassCircle is used for roles
frame.ClassBorder = frame:CreateTexture("$parentClassCircleBorder", "BACKGROUND", nil, 1)
frame.ClassBorder:SetSize(18, 18)
frame.ClassBorder:SetPoint("CENTER", 1, -2)
frame.ClassBorderMask = frame:CreateMaskTexture()
frame.ClassBorderMask:SetSize(18, 18)
frame.ClassBorderMask:SetAllPoints(frame.ClassBorder)
frame.ClassBorderMask:SetTexture("Interface/CHARACTERFRAME/TempPortraitAlphaMask", "CLAMPTOBLACKADDITIVE", "CLAMPTOBLACKADDITIVE")
frame.ClassBorder:AddMaskTexture(frame.ClassBorderMask)

-- ClassCircle is also used for displaying roles
frame.ClassCircle = frame:CreateTexture("$parentClassCircle", "BACKGROUND", nil, 2)
frame.ClassCircle:SetSize(16, 16)
frame.ClassCircle:SetPoint("CENTER", 0, -1)
frame.ClassCircle:SetPoint("CENTER", 1, -2)
frame.ClassCircleMask = frame:CreateMaskTexture()
frame.ClassCircleMask:SetSize(18, 18)
frame.ClassCircleMask:SetAllPoints(frame.ClassCircle)
Expand All @@ -76,12 +87,14 @@ function PGF.AddRoleIndicators(self, searchResultInfo)
frames[i]:Hide()
frames[i].ClassBar:Hide()
frames[i].LeaderCrown:Hide()
frames[i].ClassBorder:Hide()
frames[i].ClassCircle:Hide()
frames[i].RoleIcon:Hide()
end

if not PremadeGroupsFilterSettings.classBar and
not PremadeGroupsFilterSettings.classCircle and
not PremadeGroupsFilterSettings.specIcon and
not PremadeGroupsFilterSettings.leaderCrown then
return -- stop if all features are disabled
end
Expand Down Expand Up @@ -112,6 +125,14 @@ function PGF.AddRoleIndicators(self, searchResultInfo)
frames[i].RoleIcon:SetDesaturated(searchResultInfo.isDelisted)
frames[i].RoleIcon:SetAlpha(searchResultInfo.isDelisted and 0.5 or 1.0)
end
if PremadeGroupsFilterSettings.specIcon then
frames[i].ClassBorder:Show()
frames[i].ClassBorder:SetColorTexture(color.r, color.g, color.b, 1)
frames[i].ClassCircle:Show()
frames[i].ClassCircle:SetTexture(members[i].specIcon)
frames[i].ClassCircle:SetDesaturated(searchResultInfo.isDelisted)
frames[i].ClassCircle:SetAlpha(searchResultInfo.isDelisted and 0.5 or 1.0)
end
if PremadeGroupsFilterSettings.leaderCrown and members[i].isLeader then
frames[i].LeaderCrown:Show()
frames[i].LeaderCrown:SetDesaturated(searchResultInfo.isDelisted)
Expand Down
8 changes: 8 additions & 0 deletions Modules/Util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ function PGF.Table_Median(tbl)
end
end

function PGF.Table_Invert(tbl)
local inverted = {}
for key, value in pairs(tbl) do
inverted[value] = key
end
return inverted
end

function PGF.IsMostLikelySameInstance(instanceName, activityName)
-- instanceName is just the dungeon's name used in the lockout and challenge mode APIs, e.g. 'The Emerald Nightmare'
local instanceNameLower = instanceName:lower()
Expand Down
7 changes: 7 additions & 0 deletions Settings/Settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ local PGFSettingsTable = {
tooltip = L["settings.ratingInfo.tooltip"],
visible = true,
},
{
key = "specIcon",
type = "checkbox",
title = L["settings.specIcon.title"],
tooltip = L["settings.specIcon.tooltip"],
visible = PGF.SupportsSpecializations(),
},
{
key = "classCircle",
type = "checkbox",
Expand Down

0 comments on commit 2963f19

Please sign in to comment.