Skip to content

Commit

Permalink
Fixed support for TWW version of TalentTreeViewer
Browse files Browse the repository at this point in the history
  • Loading branch information
Numynum committed Jun 8, 2024
1 parent b7085a7 commit 87377d9
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 8 deletions.
1 change: 1 addition & 0 deletions TalentTreeTweaks.toc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
## Version: @project-version@
## X-Curse-Project-ID: 678792
## SavedVariables: TalentTreeTweaksDB
## OptionalDeps: TalentTreeViewer_Loader

TaintLess.xml
libs\embeds.xml
Expand Down
2 changes: 1 addition & 1 deletion core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -170,5 +170,5 @@ function Main:IsModuleEnabled(moduleName)
end

function Main:IsTalentTreeViewerEnabled()
return C_AddOns.GetAddOnEnableState('TalentTreeViewer', UnitName('player')) == 2;
return C_AddOns.GetAddOnEnableState(TalentViewerLoader and TalentViewerLoader:GetLodAddonName() or 'TalentTreeViewer', UnitName('player')) == 2;
end
8 changes: 8 additions & 0 deletions modules/alwaysShowGates.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ function Module:OnDisable()
local talentFrame = Util:GetTalentFrame();
if talentFrame then
talentFrame:RefreshGates();
if not Util.isDF and talentFrame.HeroTalentsContainer then
talentFrame.HeroTalentsContainer:SetPoint("TOP", talentFrame.ButtonsParent, 'TOP', -15, 0)
end
end
end

Expand Down Expand Up @@ -78,6 +81,11 @@ function Module:RefreshGates()
talentFrame:OnGateDisplayed(gate, firstButton, condInfo);
end
end

if not Util.isDF and talentFrame.HeroTalentsContainer then
-- shift the hero talents container to the left to make room for the longer gate text
talentFrame.HeroTalentsContainer:SetPoint("TOP", talentFrame.ButtonsParent, 'TOP', -80, 0)
end
end

function Module:EnrichConditionInfo(condInfo)
Expand Down
2 changes: 1 addition & 1 deletion modules/changeBackground.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function Module:OnEnable()
Util:OnTalentUILoad(function()
self:SetupDefaultUI();
end);
EventUtil.ContinueOnAddOnLoaded('TalentTreeViewer', function()
EventUtil.ContinueOnAddOnLoaded(TalentViewerLoader and TalentViewerLoader:GetLodAddonName() or 'TalentTreeViewer', function()
self:SetupTTVUI();
end);
end
Expand Down
6 changes: 5 additions & 1 deletion modules/clickableExportStringsInChat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,11 @@ function Module:SetItemRef(link, text, button)
end

function Module:OpenInTalentTreeViewer(level, exportString)
C_AddOns.LoadAddOn('TalentTreeViewer');
if TalentViewerLoader then
TalentViewerLoader:LoadTalentViewer();
else
C_AddOns.LoadAddOn('TalentTreeViewer');
end
if not TalentViewer or not TalentViewer.ImportLoadout then
self:OpenInDefaultUI(level, exportString);
print(L['Error opening in TalentTreeViewer. Showing default Blizzard inspect UI instead.']);
Expand Down
2 changes: 1 addition & 1 deletion modules/copyTalentButtonInfo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function Module:OnEnable()
EventUtil.ContinueOnAddOnLoaded('Blizzard_GenericTraitUI', function()
self:SetupHook(GenericTraitFrame);
end);
EventUtil.ContinueOnAddOnLoaded('TalentTreeViewer', function()
EventUtil.ContinueOnAddOnLoaded(TalentViewerLoader and TalentViewerLoader:GetLodAddonName() or 'TalentTreeViewer', function()
local talentsTab = TalentViewer and TalentViewer.GetTalentFrame and TalentViewer:GetTalentFrame();
if not talentsTab then return; end
self:SetupHook(talentsTab);
Expand Down
2 changes: 1 addition & 1 deletion modules/importIntoCurrentLoadout.lua
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ function Module:ConvertToImportLoadoutEntryInfo(treeID, loadoutContent)

if (indexInfo.isNodeSelected) then
local treeNode = C_Traits.GetNodeInfo(configID, treeNodeID);
local isChoiceNode = treeNode.type == Enum.TraitNodeType.Selection;
local isChoiceNode = treeNode.type == Enum.TraitNodeType.Selection or treeNode.type == Enum.TraitNodeType.SubTreeSelection;
local choiceNodeSelection = indexInfo.isChoiceNode and indexInfo.choiceNodeSelection or nil;
if indexInfo.isNodeSelected and isChoiceNode ~= indexInfo.isChoiceNode then
-- guard against corrupt import strings
Expand Down
3 changes: 2 additions & 1 deletion modules/inspectDiff.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function Module:OnEnable()
end);

self.viewerButtonTextures = self.viewerButtonTextures or {};
EventUtil.ContinueOnAddOnLoaded('TalentTreeViewer', function()
EventUtil.ContinueOnAddOnLoaded(TalentViewerLoader and TalentViewerLoader:GetLodAddonName() or 'TalentTreeViewer', function()
self:SetupViewerHook();
end);
end
Expand Down Expand Up @@ -158,6 +158,7 @@ end

function Module:SetupViewerHook()
local talentViewerFrame = TalentViewer:GetTalentFrame();
if not talentViewerFrame.GetClassID then return; end -- something went wrong loading the TTViewer addon
self:InitCheckbox(talentViewerFrame);
self:SecureHook(TalentViewer, 'SelectSpec', 'UpdateViewerSpec');
self:UpdateViewerSpec(TalentViewer, talentViewerFrame:GetClassID(), talentViewerFrame:GetSpecID());
Expand Down
2 changes: 1 addition & 1 deletion modules/scaleTalentFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ local L = TTT.L;
--- @class TalentTreeTweaks_ScaleTalentFrame: AceModule, AceHook-3.0
local Module = Main:NewModule('ScaleTalentFrame', 'AceHook-3.0');

local TALENT_TREE_VIEWER = 'TalentTreeViewer';
local TALENT_TREE_VIEWER = TalentViewerLoader and TalentViewerLoader:GetLodAddonName() or 'TalentTreeViewer';
local BLIZZARD_TALENT_UI = 2;

function Module:OnEnable()
Expand Down
2 changes: 1 addition & 1 deletion modules/searchForIds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function Module:OnEnable()
Util:OnTalentUILoad(function()
self:SetupHook(BLIZZARD_TALENT_UI);
end);
EventUtil.ContinueOnAddOnLoaded('TalentTreeViewer', function()
EventUtil.ContinueOnAddOnLoaded(TalentViewerLoader and TalentViewerLoader:GetLodAddonName() or 'TalentTreeViewer', function()
self:SetupHook(TALENT_TREE_VIEWER);
end)
end
Expand Down

0 comments on commit 87377d9

Please sign in to comment.