Skip to content

Commit

Permalink
feat: 点击非当前天赋,可切换天赋
Browse files Browse the repository at this point in the history
  • Loading branch information
DengSir committed Sep 4, 2024
1 parent 2a319b9 commit 22dda59
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions UI/CharacterGearFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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

0 comments on commit 22dda59

Please sign in to comment.