Skip to content

Commit

Permalink
Update talents to preview with unspent points
Browse files Browse the repository at this point in the history
  • Loading branch information
SabreValkyrn committed Sep 21, 2023
1 parent a72d3dd commit 506789e
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions Talents.lua
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ local function learnClassicTalent(payload)
local tab, talentIndex, name = unpack(payload)
if LearnTalent(tab, talentIndex) then
addon.comms.PrettyPrint("%s - %s", _G.TRADE_SKILLS_LEARNED_TAB, name)
-- else
-- else
-- addon.error(fmt("%s - %s", _G.ERR_TALENT_FAILED_UNKNOWN, name))
end
end
Expand Down Expand Up @@ -702,17 +702,24 @@ function addon.talents:DrawTalents()
end

local currentTab = PanelTemplates_GetSelectedTab(PlayerTalentFrame)
local remainingPoints, levelStep, talentIndex

if GetUnspentTalentPoints then
remainingPoints = GetUnspentTalentPoints() -
GetGroupPreviewTalentPointsSpent()
else
remainingPoints = UnitCharacterPoints("player")
end

local playerLevel = UnitLevel("player")
local advancedWarning = playerLevel +
addon.settings.profile.upcomingTalentCount
local levelStep, talentIndex

-- 44 - 30 - 10
wipe(talentTooltips.data)

for upcomingLevel = playerLevel + 1, advancedWarning do
for upcomingTalent = (playerLevel + 1 - remainingPoints), advancedWarning do

levelStep = guide.steps[upcomingLevel - guide.minLevel + 1]
levelStep = guide.steps[upcomingTalent - guide.minLevel + 1]

if not levelStep then return end

Expand All @@ -732,15 +739,15 @@ function addon.talents:DrawTalents()
addon.colors.tooltip,
_G.TRADE_SKILLS_LEARNED_TAB,
_G.LEVEL,
upcomingLevel)
upcomingTalent)

-- TODO Pre-seed tooltip to prevent delay

if talentTooltips.highlights[talentIndex] then
setHighlightColor(talentIndex,
upcomingLevel - playerLevel)
upcomingTalent - playerLevel)

DrawTalentLevel(talentIndex, playerLevel, upcomingLevel)
DrawTalentLevel(talentIndex, playerLevel, upcomingTalent)
talentTooltips.highlights[talentIndex]:Show()
else
local ht =
Expand All @@ -755,8 +762,8 @@ function addon.talents:DrawTalents()
talentTooltips.highlights[talentIndex] = ht

setHighlightColor(talentIndex,
upcomingLevel - playerLevel)
DrawTalentLevel(talentIndex, playerLevel, upcomingLevel)
upcomingTalent - playerLevel)
DrawTalentLevel(talentIndex, playerLevel, upcomingTalent)
end
else
-- Reset highlights on non-active tabs
Expand Down Expand Up @@ -958,6 +965,4 @@ function addon.talents:ProcessPetTalents(validate)

end

_G.RXPGuides.talents = {
RegisterGuide = addon.talents.RegisterGuide
}
_G.RXPGuides.talents = {RegisterGuide = addon.talents.RegisterGuide}

0 comments on commit 506789e

Please sign in to comment.