From 87377d95c2938460e8cfd6f9971c52af8ea3540d Mon Sep 17 00:00:00 2001 From: Mark W Date: Sat, 8 Jun 2024 17:32:07 +0200 Subject: [PATCH] Fixed support for TWW version of TalentTreeViewer --- TalentTreeTweaks.toc | 1 + core.lua | 2 +- modules/alwaysShowGates.lua | 8 ++++++++ modules/changeBackground.lua | 2 +- modules/clickableExportStringsInChat.lua | 6 +++++- modules/copyTalentButtonInfo.lua | 2 +- modules/importIntoCurrentLoadout.lua | 2 +- modules/inspectDiff.lua | 3 ++- modules/scaleTalentFrame.lua | 2 +- modules/searchForIds.lua | 2 +- 10 files changed, 22 insertions(+), 8 deletions(-) diff --git a/TalentTreeTweaks.toc b/TalentTreeTweaks.toc index bb6e5d9..005b3f8 100644 --- a/TalentTreeTweaks.toc +++ b/TalentTreeTweaks.toc @@ -6,6 +6,7 @@ ## Version: @project-version@ ## X-Curse-Project-ID: 678792 ## SavedVariables: TalentTreeTweaksDB +## OptionalDeps: TalentTreeViewer_Loader TaintLess.xml libs\embeds.xml diff --git a/core.lua b/core.lua index 997b4a1..ab2fc1e 100644 --- a/core.lua +++ b/core.lua @@ -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 diff --git a/modules/alwaysShowGates.lua b/modules/alwaysShowGates.lua index cb4776c..ac3bcc4 100644 --- a/modules/alwaysShowGates.lua +++ b/modules/alwaysShowGates.lua @@ -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 @@ -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) diff --git a/modules/changeBackground.lua b/modules/changeBackground.lua index f1d6f35..9daa4b8 100644 --- a/modules/changeBackground.lua +++ b/modules/changeBackground.lua @@ -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 diff --git a/modules/clickableExportStringsInChat.lua b/modules/clickableExportStringsInChat.lua index adf7978..603958b 100644 --- a/modules/clickableExportStringsInChat.lua +++ b/modules/clickableExportStringsInChat.lua @@ -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.']); diff --git a/modules/copyTalentButtonInfo.lua b/modules/copyTalentButtonInfo.lua index 33dc50d..b0983d8 100644 --- a/modules/copyTalentButtonInfo.lua +++ b/modules/copyTalentButtonInfo.lua @@ -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); diff --git a/modules/importIntoCurrentLoadout.lua b/modules/importIntoCurrentLoadout.lua index 7b9a7b4..ad28903 100644 --- a/modules/importIntoCurrentLoadout.lua +++ b/modules/importIntoCurrentLoadout.lua @@ -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 diff --git a/modules/inspectDiff.lua b/modules/inspectDiff.lua index 6c1ab8f..81d6d5b 100644 --- a/modules/inspectDiff.lua +++ b/modules/inspectDiff.lua @@ -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 @@ -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()); diff --git a/modules/scaleTalentFrame.lua b/modules/scaleTalentFrame.lua index 3124654..00fc5a8 100644 --- a/modules/scaleTalentFrame.lua +++ b/modules/scaleTalentFrame.lua @@ -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() diff --git a/modules/searchForIds.lua b/modules/searchForIds.lua index 6e246b0..100fa1d 100644 --- a/modules/searchForIds.lua +++ b/modules/searchForIds.lua @@ -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