Skip to content

Commit 221fd28

Browse files
committed
Fix /tv reset breaking in certain situations
1 parent 97da806 commit 221fd28

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

TalentTreeViewer_Loader/TalentTreeViewer_Loader.lua

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
local name, _ = ...;
2+
local displayName = 'Talent Tree Viewer';
23

3-
if LE_EXPANSION_LEVEL_CURRENT <= LE_EXPANSION_SHADOWLANDS then print(name, 'only works on Dragonflight and later') return; end
4+
if LE_EXPANSION_LEVEL_CURRENT <= LE_EXPANSION_SHADOWLANDS then print(displayName, 'only works on Dragonflight and later') return; end
45

56
--- @class TalentViewerLoader
67
local TVLoader = {};
@@ -41,42 +42,42 @@ function TVLoader:OnInitialize()
4142
end
4243

4344
local dataObject = LibStub('LibDataBroker-1.1'):NewDataObject(
44-
name,
45+
displayName,
4546
{
4647
type = 'launcher',
47-
text = 'Talent Tree Viewer',
48+
text = displayName,
4849
icon = 'interface/icons/inv_inscription_talenttome01.blp',
4950
OnClick = function()
5051
if IsShiftKeyDown() then
5152
self.db.ldbOptions.hide = true;
52-
LibDBIcon:Hide(name);
53+
LibDBIcon:Hide(displayName);
5354
print(L['Minimap button hidden. Use |cffeda55f/tv reset|r to restore.']);
5455

5556
return;
5657
end
5758
self:ToggleTalentView();
5859
end,
5960
OnTooltipShow = function(tooltip)
60-
tooltip:AddLine('Talent Tree Viewer');
61+
tooltip:AddLine(displayName);
6162
tooltip:AddLine(L['|cffeda55fClick|r to view the talents for any spec.']);
6263
tooltip:AddLine(L['|cffeda55fShift-Click|r to hide this button. (|cffeda55f/tv reset|r to restore)']);
6364
end,
6465
}
6566
);
66-
LibDBIcon:Register(name, dataObject, self.db.ldbOptions);
67-
LibDBIcon:AddButtonToCompartment(name);
67+
LibDBIcon:Register(displayName, dataObject, self.db.ldbOptions);
68+
LibDBIcon:AddButtonToCompartment(displayName);
6869

6970
SLASH_TALENT_VIEWER1 = '/tv';
7071
SLASH_TALENT_VIEWER2 = '/talentviewer';
7172
SLASH_TALENT_VIEWER3 = '/talenttreeviewer';
7273
SlashCmdList['TALENT_VIEWER'] = function(message)
7374
if message == 'reset' then
74-
wipe(TalentViewer.db.ldbOptions);
75-
TalentViewer.db.ldbOptions.hide = false;
76-
TalentViewer.db.lastSelected = nil;
75+
wipe(self.db.ldbOptions);
76+
self.db.ldbOptions.hide = false;
77+
self.db.lastSelected = nil;
7778

78-
LibDBIcon:Hide(name);
79-
LibDBIcon:Show(name);
79+
LibDBIcon:Hide(displayName);
80+
LibDBIcon:Show(displayName);
8081

8182
return;
8283
end

0 commit comments

Comments
 (0)