天赋修改更直接展示预览时天赋变更信息

世界地图揭示迷雾全修复
This commit is contained in:
rucky
2026-03-23 18:13:03 +08:00
parent ec9e3c29d6
commit 40d37dc8c4
7 changed files with 1504 additions and 1348 deletions

View File

@@ -800,36 +800,9 @@ function SFrames.TalentTree:BuildTrees()
btn.maxRank = maxRank
btn.talentName = tName
local cachedDesc = nil
if not IsViewingOwnClass(self) then
local cd = GetCache()[self.viewingClass]
if cd and cd[t] and cd[t].talents[i] then
cachedDesc = cd[t].talents[i].desc
end
end
btn.cachedDesc = cachedDesc
if IsViewingOwnClass(self) then
btn:SetScript("OnEnter", function()
GameTooltip_SetDefaultAnchor(GameTooltip, this)
GameTooltip:SetTalent(this.tab, this.index)
GameTooltip:Show()
end)
else
btn:SetScript("OnEnter", function()
GameTooltip:SetOwner(this, "ANCHOR_RIGHT")
GameTooltip:AddLine(this.talentName or "?", 1, 1, 1)
local vr = SFrames.TalentTree:GetVirtualRank(this.tab, this.index)
GameTooltip:AddLine("等级 " .. vr .. "/" .. (this.maxRank or "?"), 0.7, 0.7, 0.7)
if this.cachedDesc then
GameTooltip:AddLine(" ")
for _, line in ipairs(this.cachedDesc) do
GameTooltip:AddLine(line, 1, 0.82, 0, 1)
end
end
GameTooltip:Show()
end)
end
btn:SetScript("OnEnter", function()
SFrames.TalentTree:ShowTalentTooltip(this)
end)
btn:SetScript("OnLeave", function() GameTooltip:Hide() end)
btn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
@@ -964,6 +937,62 @@ function SFrames.TalentTree:HookVanillaUI()
end
end
--------------------------------------------------------------------------------
-- Talent tooltip (shared by OnEnter and post-click refresh)
--------------------------------------------------------------------------------
function SFrames.TalentTree:ShowTalentTooltip(btn)
if IsViewingOwnClass(self) and not self.simMode then
GameTooltip_SetDefaultAnchor(GameTooltip, btn)
GameTooltip:SetTalent(btn.tab, btn.index)
GameTooltip:Show()
return
end
GameTooltip:SetOwner(btn, "ANCHOR_RIGHT")
GameTooltip:AddLine(btn.talentName or "?", 1, 1, 1)
local vr = self:GetVirtualRank(btn.tab, btn.index)
local mr = btn.maxRank or 1
GameTooltip:AddLine("等级 " .. vr .. "/" .. mr, 0.7, 0.7, 0.7)
local desc = nil
local classKey = self.viewingClass or self.playerClass
if NanamiTalentDefaultDB and NanamiTalentDefaultDB[classKey] then
local tabData = NanamiTalentDefaultDB[classKey][btn.tab]
if tabData and tabData.talents and tabData.talents[btn.index] then
desc = tabData.talents[btn.index].desc
end
end
if not desc then
local cd = GetCache()[classKey]
if cd and cd[btn.tab] and cd[btn.tab].talents[btn.index] then
desc = cd[btn.tab].talents[btn.index].desc
end
end
if desc then
local n = table.getn(desc)
if n == mr and desc[1] then
GameTooltip:AddLine(" ")
if vr == 0 then
GameTooltip:AddLine(desc[1], 1, 0.82, 0, 1)
else
GameTooltip:AddLine(desc[vr], 1, 0.82, 0, 1)
if vr < mr and desc[vr + 1] then
GameTooltip:AddLine(" ")
GameTooltip:AddLine("下一级:", 0, 1, 0)
GameTooltip:AddLine(desc[vr + 1], 1, 0.82, 0, 1)
end
end
else
GameTooltip:AddLine(" ")
for _, line in ipairs(desc) do
GameTooltip:AddLine(line, 1, 0.82, 0, 1)
end
end
end
GameTooltip:Show()
end
--------------------------------------------------------------------------------
-- Virtual point helpers
--------------------------------------------------------------------------------
@@ -1090,6 +1119,9 @@ function SFrames.TalentTree:OnTalentClick(btn, buttonType)
end
self:Update()
if GameTooltip:IsVisible() then
self:ShowTalentTooltip(btn)
end
end
function SFrames.TalentTree:ResetVirtualPoints()