Skip to content

Commit 82889ed

Browse files
committed
Added a warning when Zygor Guides' Talent Advisor is enabled, as it's known to cause game freezes
1 parent a225c80 commit 82889ed

File tree

4 files changed

+90
-44
lines changed

4 files changed

+90
-44
lines changed

core/TalentLoadoutManager.lua

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,7 @@ end
868868
--- @param levelingOrder TLM_LevelingBuildEntry_withLevel[]|nil # unordered list of entries
869869
--- @return number number of removed entries (due to successful purchases)
870870
function TLM:ResetAndPurchaseLoadoutEntries(configID, loadoutEntryInfo, levelingOrder)
871+
self:CheckForBadAddons(true);
871872
local totalEntriesRemoved = 0;
872873
C_Traits.ResetTree(configID, self:GetTreeID());
873874
local entriesByLevel = {};
@@ -1215,3 +1216,30 @@ function TLM:BuildSerializedSelectedNodesFromImportString(importText, expectedCl
12151216

12161217
return ImportExport:BuildSerializedSelectedNodesFromImportString(importText, expectedClassID, expectedSpecID);
12171218
end
1219+
1220+
local printedWarning = {};
1221+
--- @param printToChat boolean|nil # if true, a warning will be printed to chat if any bad addons are found
1222+
--- @return table<string, string> # [addonName] = warning text
1223+
function TLM:CheckForBadAddons(printToChat)
1224+
local badAddons = {};
1225+
-- zygor guides
1226+
if
1227+
ZygorGuidesViewer
1228+
and ZygorGuidesViewer.db
1229+
and ZygorGuidesViewer.db.profile
1230+
and ZygorGuidesViewer.db.profile.talenton
1231+
then
1232+
badAddons['ZygorGuidesViewer'] = 'Zygor Guides\' talent advisor is enabled. This is known to cause game freezes when changing loadouts. Disable this feature and report it to the author of Zygor Guides.';
1233+
end
1234+
1235+
if printToChat then
1236+
for addon, warningText in pairs(badAddons) do
1237+
if not printedWarning[addon] then
1238+
printedWarning[addon] = true;
1239+
self:Print(warningText);
1240+
end
1241+
end
1242+
end
1243+
1244+
return badAddons;
1245+
end

modules/DefaultUISidebar.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@ function Module:OnDisable()
4040
API:UnregisterCallback(API.Event.CustomLoadoutApplied, self);
4141
end
4242

43+
--- @return PlayerSpellsFrame_TalentsFrame
4344
function Module:GetTalentsTab()
44-
return ClassTalentFrame and ClassTalentFrame.TalentsTab or PlayerSpellsFrame.TalentsFrame;
45+
return PlayerSpellsFrame.TalentsFrame;
4546
end
4647

4748
function Module:SetupHook()

modules/SideBarMixin.lua

Lines changed: 59 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
local addonName, ns = ...;
22

3-
--- @class TLM_SideBarMixin
3+
--- @class TLM_SideBarMixin: AceModule, AceHook-3.0
44
local SideBarMixin = {};
55
ns.SideBarMixin = SideBarMixin;
66

@@ -15,6 +15,7 @@ local API = TalentLoadoutManagerAPI;
1515
local GlobalAPI = TalentLoadoutManagerAPI.GlobalAPI;
1616
local CharacterAPI = TalentLoadoutManagerAPI.CharacterAPI;
1717

18+
SideBarMixin.IntegrateWithBlizzMove = true;
1819
SideBarMixin.ImplementAutoApply = false;
1920
SideBarMixin.ShowAnimationOnImport = false;
2021
SideBarMixin.ImplementTTTMissingWarning = false;
@@ -169,6 +170,7 @@ function SideBarMixin:OnInitialize()
169170
end
170171

171172
function SideBarMixin:OnEnable()
173+
error('override in implementation');
172174
-- override in implementation: should SetupHook on relevant addonLoaded
173175
end
174176

@@ -194,9 +196,48 @@ function SideBarMixin:SetupHook()
194196
API:RegisterCallback(API.Event.LoadoutListUpdated, self.RefreshSideBarData, self);
195197
end
196198

197-
--- @return Frame
198-
function SideBarMixin:GetTalentsTab()
199-
-- override in implementation
199+
do
200+
--- @return PlayerSpellsFrame_TalentsFrame|TalentViewerUIMixinTWW
201+
function SideBarMixin:GetTalentsTab()
202+
error('override in implementation');
203+
end
204+
205+
--- @param name string
206+
function SideBarMixin:DoCreate(name)
207+
error('override in implementation');
208+
end
209+
210+
function SideBarMixin:GetLoadouts()
211+
error('override in implementation');
212+
end
213+
214+
function SideBarMixin:GetActiveLoadout(forceRefresh)
215+
error('override in implementation');
216+
end
217+
218+
function SideBarMixin:DoImport(importText, loadoutName, autoApply)
219+
error('override in implementation');
220+
end
221+
222+
function SideBarMixin:DoImportIntoCurrent(importText, autoApply)
223+
error('override in implementation');
224+
end
225+
226+
function SideBarMixin:GetDefaultActionText(elementData)
227+
error('override in implementation');
228+
end
229+
230+
function SideBarMixin:UpdateCustomLoadoutWithCurrentTalents(loadoutID)
231+
error('override in implementation');
232+
end
233+
234+
function SideBarMixin:DoLoad(loadoutID, autoApply)
235+
error('override in implementation');
236+
end
237+
238+
function SideBarMixin:GetBlizzMoveFrameTable()
239+
error('override in implementation');
240+
end
200241
end
201242

202243
function SideBarMixin:OnTalentsTabShow(frame)
@@ -534,33 +575,20 @@ function SideBarMixin:CreateSideBar()
534575
sideBar.ScrollBoxContainer:SetPoint("TOPLEFT", sideBar.SaveButton, "BOTTOMLEFT", 0, -10);
535576
sideBar.ScrollBoxContainer:SetPoint("BOTTOMRIGHT", sideBar, "BOTTOMRIGHT", -10, 10);
536577

537-
if self.ImplementTTTMissingWarning and not C_AddOns.IsAddOnLoaded('TalentTreeTweaks') then
538-
-- add a link to the addon
539-
sideBar.WarningLink = CreateFrame("Button", nil, sideBar, "UIPanelButtonTemplate, UIButtonTemplate");
540-
sideBar.WarningLink:SetSize(width - 50, 20);
541-
sideBar.WarningLink:SetText("Download TalentTreeTweaks");
542-
sideBar.WarningLink:SetPoint("BOTTOMLEFT", sideBar, "BOTTOMLEFT", 10, 10);
543-
sideBar.WarningLink:SetScript("OnClick", function()
544-
local url = "https://www.curseforge.com/wow/addons/talent-tree-tweaks";
545-
StaticPopup_Show(self.copyDialogName, nil, nil, url);
546-
end);
547-
548-
-- add a warning on the bottom of the sideBar
549-
sideBar.Warning = sideBar:CreateFontString(nil, "OVERLAY", "GameFontNormalHuge");
550-
sideBar.Warning:SetPoint("BOTTOMLEFT", sideBar.WarningLink, "TOPLEFT", 0, 0);
551-
sideBar.Warning:SetWidth(width - 50);
552-
sideBar.Warning:SetText("TalentTreeTweaks is not loaded. You might encounter serious bugs without it.");
553-
sideBar.Warning:SetTextColor(1, 0.5, 0.5);
554-
555-
local function onOptionChange(_, option, value)
556-
if option == 'disableTTTWarning' then
557-
sideBar.Warning:SetShown(not value);
558-
sideBar.WarningLink:SetShown(not value);
559-
end
578+
-- add a warning on the bottom of the sideBar
579+
sideBar.Warning = sideBar:CreateFontString(nil, "OVERLAY", "SystemFont_Shadow_Large");
580+
sideBar.Warning:SetPoint("BOTTOMLEFT", sideBar, "BOTTOMLEFT", 10, 10);
581+
sideBar.Warning:SetWidth(width - 50);
582+
sideBar.Warning:SetText('');
583+
sideBar.Warning:SetTextColor(1, 0.5, 0.5);
584+
sideBar.Warning:SetScript("OnShow", function()
585+
local badAddons = TLM:CheckForBadAddons(false);
586+
local text = "";
587+
for _, warning in pairs(badAddons) do
588+
text = text .. warning .. "\n";
560589
end
561-
Config:RegisterCallback(Config.Event.OptionValueChanged, onOptionChange);
562-
onOptionChange(nil, 'disableTTTWarning', Config:GetConfig('disableTTTWarning'));
563-
end
590+
sideBar.Warning:SetText(text);
591+
end);
564592

565593
return sideBar, dataProvider;
566594
end
@@ -750,10 +778,7 @@ function SideBarMixin:OpenDropDownMenu(dropDown, frame, elementData)
750778
openInTTV = {
751779
text = "Open in TalentTreeViewer",
752780
notCheckable = true,
753-
disabled = C_AddOns.GetAddOnEnableState(
754-
TalentViewerLoader and TalentViewerLoader:GetLodAddonName() or 'TalentTreeViewer',
755-
UnitName('player')
756-
) ~= 2,
781+
disabled = nil == TalentViewerLoader,
757782
func = function()
758783
self:OpenInTalentTreeViewer(elementData);
759784
end,
@@ -984,14 +1009,6 @@ function SideBarMixin:SortElements(dataProviderEntries)
9841009
end);
9851010
end
9861011

987-
function SideBarMixin:GetLoadouts()
988-
-- override in implementation
989-
end
990-
991-
function SideBarMixin:GetActiveLoadout(forceRefresh)
992-
-- override in implementation
993-
end
994-
9951012
function SideBarMixin:RefreshSideBarData()
9961013
local loadouts = self:GetLoadouts();
9971014

modules/TalentTreeViewerSidebar.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function Module:GetTalentTreeViewer()
3838
return TalentViewer;
3939
end
4040

41-
---@return TalentViewerUIMixin|TalentViewerUIMixinTWW
41+
---@return TalentViewerUIMixinTWW
4242
function Module:GetTalentsTab()
4343
return self:GetTalentTreeViewer():GetTalentFrame();
4444
end

0 commit comments

Comments
 (0)