if C_CVar.GetCVar("portal") ~= "test" then return end -- PTR/Beta -- One-button learning all profession specializations do local L = {} setmetatable(L, { __index = function(self, key) return key end }) local locale = GetLocale() if locale == "zhCN" then L["Learn All Specialization"] = "学习全部专精" end local function PurchaseRank(configID, nodeID) local nodeInfo = C_Traits.GetNodeInfo(configID, nodeID) if nodeInfo then for i = nodeInfo.ranksPurchased, nodeInfo.maxRanks do C_Traits.PurchaseRank(configID, nodeID) end for _, edgeInfo in ipairs(nodeInfo.visibleEdges) do PurchaseRank(configID, edgeInfo.targetNode) end end end local function OnClick(self) local specPage = self:GetParent() local professionID = specPage:GetProfessionID() local configID = C_ProfSpecs.GetConfigIDForSkillLine(professionID) local treeIDs = C_ProfSpecs.GetSpecTabIDsForSkillLine(professionID) for _, treeID in ipairs(treeIDs) do local tabInfo = C_ProfSpecs.GetTabInfo(treeID) if tabInfo then PurchaseRank(configID, tabInfo.rootNodeID) end end specPage.TreePreview:Hide() end EventUtil.ContinueOnAddOnLoaded("Blizzard_Professions", function() local button = CreateFrame("Button", nil, _G.ProfessionsFrame.SpecPage, "MagicButtonTemplate") button:SetSize(160, 36) button:SetPoint("TOPRIGHT", -10, -40) button:SetText(L["Learn All Specialization"]) button:SetScript("OnClick", OnClick) if _G.NDui then _G.NDui[1].Reskin(button) end if _G.ElvUI then _G.ElvUI[1]:GetModule("Skins"):HandleButton(button) end end) end