From 22dda596b9aea05449feff27353fc777d7a37eea Mon Sep 17 00:00:00 2001 From: Dencer Date: Thu, 5 Sep 2024 00:56:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=82=B9=E5=87=BB=E9=9D=9E=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E5=A4=A9=E8=B5=8B=EF=BC=8C=E5=8F=AF=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E5=A4=A9=E8=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UI/CharacterGearFrame.lua | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/UI/CharacterGearFrame.lua b/UI/CharacterGearFrame.lua index 835d45c..ad3c67b 100644 --- a/UI/CharacterGearFrame.lua +++ b/UI/CharacterGearFrame.lua @@ -12,6 +12,12 @@ local CharacterGearFrame = ns.Addon:NewClass('UI.CharacterGearFrame', ns.UI.Gear function CharacterGearFrame:Constructor() self:SetScript('OnShow', self.OnShow) self:SetScript('OnHide', self.UnregisterAllEvents) + + self.Talent2:SetScript('OnClick', function(button) + if not InCombatLockdown() then + SetActiveTalentGroup(button.id) + end + end) end function CharacterGearFrame:OnShow() @@ -42,5 +48,35 @@ function CharacterGearFrame:Update() gear:SetItem(GetInventoryItemLink('player', id), false) end + self:UpdateTalents() + self:EndLayout() end + +function CharacterGearFrame:GetNumTalentGroups() + return GetNumTalentGroups() +end + +function CharacterGearFrame:GetActiveTalentGroup() + return GetActiveTalentGroup() +end + +function CharacterGearFrame:GetTalentInfo(group) + local maxPoint = 0 + local maxName = nil + local maxIcon + local maxBg + local counts = {} + for i = 1, GetNumTalentTabs() do + local name, icon, pointsSpent, bg = GetTalentTabInfo(i, nil, nil, group) + if pointsSpent > maxPoint then + maxPoint = pointsSpent + maxName = name + maxIcon = icon + maxBg = bg + end + + tinsert(counts, pointsSpent) + end + return maxName, maxIcon, maxBg, table.concat(counts, '/') +end