Fix stale trade skill indices in ATSW tooltips

This commit is contained in:
2026-10-02 19:50:38 +00:00
parent 51cc379ecf
commit 761a48fea4
+32 -6
View File
@@ -1401,11 +1401,33 @@ end
ATSW_TEST = 9000
function ATSW_TooltipSetSkill(Tooltip, Index)
if ATSW_TradeSkill() then
Tooltip:SetTradeSkillItem(Index)
else
Tooltip:SetCraftSpell(Index)
end
if not Tooltip or not Index then
return
end
Index = tonumber(Index)
if not Index or Index < 1 then
return
end
if ATSW_TradeSkill() then
local NumSkills = GetNumTradeSkills()
if Index > NumSkills then
return
end
local Name, SkillType = GetTradeSkillInfo(Index)
if not Name or SkillType == 'header' then
return
end
Tooltip:SetTradeSkillItem(Index)
else
Tooltip:SetCraftSpell(Index)
end
end
-- Main code section
@@ -5797,7 +5819,11 @@ function ATSW_ShowRecipeTooltip()
ATSWRecipeItemTooltip:SetOwner(this, 'ANCHOR_BOTTOMRIGHT')
ATSW_TooltipSetSkill(ATSWRecipeItemTooltip, this.Position)
local LivePosition = GetPositionFromGame(R.Name)
if LivePosition then
ATSW_TooltipSetSkill(ATSWRecipeItemTooltip, LivePosition)
end
ATSWRecipeItemTooltipTextLeft1:SetText(' ')
ATSWRecipeItemTooltip:Show()