From 761a48fea4d6d0909da1cf46ae0b3f44b55fa26f Mon Sep 17 00:00:00 2001 From: praxis <889+praxis@noreply.octowow.st> Date: Fri, 2 Oct 2026 19:50:38 +0000 Subject: [PATCH] Fix stale trade skill indices in ATSW tooltips --- AdvancedTradeSkillWindow2.lua | 38 +++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/AdvancedTradeSkillWindow2.lua b/AdvancedTradeSkillWindow2.lua index 8baf577..30b2b4f 100644 --- a/AdvancedTradeSkillWindow2.lua +++ b/AdvancedTradeSkillWindow2.lua @@ -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()