Skip to content

Commit 1545ec2

Browse files
committed
Loadout names: all characters before the first | character are no longer displayed, this allows using a prefix to sort loadouts, without the displayed name changing (e.g. 1|Ulgrax will show before 2|Bloodbound Horror, but you'll still only see Ulgrax and Bloodbound Horror on the list)
1 parent 47c1958 commit 1545ec2

File tree

3 files changed

+145
-65
lines changed

3 files changed

+145
-65
lines changed

core/TalentLoadoutManager.lua

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ TLM._ns = ns;
77

88
_G.TalentLoadoutManager = TLM;
99

10+
local BLIZZ_ATLAS = CreateAtlasMarkup("gmchat-icon-blizz", 16, 16);
11+
local XP_ATLAS = CreateAtlasMarkup("GarrMission_CurrencyIcon-Xp", 16, 16);
12+
1013
ns.SERIALIZATION_NODE_SEPARATOR = "\n";
1114
--- format: nodeID_entryID_spellIDOrSubTreeID_rank
1215
ns.SERIALIZATION_VALUE_SEPARATOR = "_";
@@ -225,7 +228,7 @@ function TLM:RebuildLoadoutByIDCache()
225228
for specID, playerList in pairs(specList) do
226229
for playerName, loadoutList in pairs(playerList) do
227230
for configID, loadoutInfo in pairs(loadoutList) do
228-
local displayName = CreateAtlasMarkup("gmchat-icon-blizz", 16, 16) .. loadoutInfo.name;
231+
local displayName = BLIZZ_ATLAS .. (loadoutInfo.name):gsub('.-||', '', 1);
229232
if playerName ~= self.playerName then
230233
displayName = displayName .. " (" .. playerName .. ")";
231234
end
@@ -249,10 +252,10 @@ function TLM:RebuildLoadoutByIDCache()
249252
for classID, specList in pairs(self.db.customLoadouts) do
250253
for specID, loadoutList in pairs(specList) do
251254
for loadoutID, loadoutInfo in pairs(loadoutList) do
252-
local namePrefix = loadoutInfo.levelingOrder and CreateAtlasMarkup("GarrMission_CurrencyIcon-Xp", 16, 16) or "";
255+
local namePrefix = loadoutInfo.levelingOrder and XP_ATLAS or "";
253256
local displayInfo = {
254257
id = loadoutID,
255-
displayName = namePrefix .. loadoutInfo.name,
258+
displayName = namePrefix .. (loadoutInfo.name):gsub('.-||', '', 1),
256259
loadoutInfo = loadoutInfo,
257260
owner = nil,
258261
playerIsOwner = true,
@@ -442,7 +445,7 @@ function TLM:UpdateBlizzardLoadout(configID, specID)
442445
id = configID,
443446
};
444447
self.db.blizzardLoadouts[classID][specID][self.playerName][configID] = loadoutInfo;
445-
local displayName = CreateAtlasMarkup("gmchat-icon-blizz", 16, 16) .. loadoutInfo.name;
448+
local displayName = BLIZZ_ATLAS .. (loadoutInfo.name):gsub('.-||', '', 1);
446449
local displayInfo = {
447450
id = configID,
448451
displayName = displayName,
@@ -476,10 +479,10 @@ function TLM:UpdateCustomLoadout(customLoadoutID, selectedNodes, levelingOrder,
476479
loadoutInfo.selectedNodes = selectedNodes;
477480
loadoutInfo.levelingOrder = levelingOrder;
478481

479-
local namePrefix = loadoutInfo.levelingOrder and CreateAtlasMarkup("GarrMission_CurrencyIcon-Xp", 16, 16) or "";
482+
local namePrefix = loadoutInfo.levelingOrder and XP_ATLAS or "";
480483
local displayInfo = {
481484
id = customLoadoutID,
482-
displayName = namePrefix .. loadoutInfo.name,
485+
displayName = namePrefix .. (loadoutInfo.name):gsub('.-||', '', 1),
483486
loadoutInfo = loadoutInfo,
484487
owner = nil,
485488
playerIsOwner = true,
@@ -846,10 +849,10 @@ function TLM:ApplyCustomLoadout(loadoutInfo, autoApply)
846849
end
847850

848851
self.charDb.selectedCustomLoadoutID[self.playerSpecID] = loadoutInfo.id;
849-
local namePrefix = loadoutInfo.levelingOrder and CreateAtlasMarkup("GarrMission_CurrencyIcon-Xp", 16, 16) or "";
852+
local namePrefix = loadoutInfo.levelingOrder and XP_ATLAS or "";
850853
local displayInfo = {
851854
id = loadoutInfo.id,
852-
displayName = namePrefix .. loadoutInfo.name,
855+
displayName = namePrefix .. (loadoutInfo.name):gsub('.-||', '', 1),
853856
loadoutInfo = loadoutInfo,
854857
owner = nil,
855858
playerIsOwner = true,
@@ -1016,11 +1019,11 @@ function TLM:CreateCustomLoadoutFromLoadoutData(loadoutInfo, classIDOrNil, specI
10161019
newLoadoutInfo.parentMapping[self.playerName] = self:GetActiveBlizzardLoadoutConfigID();
10171020
end
10181021
self.db.customLoadouts[classID][specID][id] = newLoadoutInfo;
1019-
local namePrefix = newLoadoutInfo.levelingOrder and CreateAtlasMarkup("GarrMission_CurrencyIcon-Xp", 16, 16) or "";
1022+
local namePrefix = newLoadoutInfo.levelingOrder and XP_ATLAS or "";
10201023
--- @type TLM_LoadoutDisplayInfo
10211024
local displayInfo = {
10221025
id = id,
1023-
displayName = namePrefix .. newLoadoutInfo.name,
1026+
displayName = namePrefix .. (newLoadoutInfo.name):gsub('.-||', '', 1),
10241027
loadoutInfo = newLoadoutInfo,
10251028
owner = nil,
10261029
playerIsOwner = true,
@@ -1086,10 +1089,10 @@ function TLM:RenameCustomLoadout(classIDOrNil, specIDOrNil, loadoutID, newName)
10861089
local loadoutInfo = self.db.customLoadouts[classID][specID][loadoutID];
10871090
loadoutInfo.name = newName;
10881091

1089-
local namePrefix = loadoutInfo.levelingOrder and CreateAtlasMarkup("GarrMission_CurrencyIcon-Xp", 16, 16) or "";
1092+
local namePrefix = loadoutInfo.levelingOrder and XP_ATLAS or "";
10901093
local displayInfo = {
10911094
id = loadoutID,
1092-
displayName = namePrefix .. loadoutInfo.name,
1095+
displayName = namePrefix .. (loadoutInfo.name):gsub('.-||', '', 1),
10931096
loadoutInfo = loadoutInfo,
10941097
owner = nil,
10951098
playerIsOwner = true,

0 commit comments

Comments
 (0)