From d4b1b73dd2ba9fb115c52c799778adb86288b453 Mon Sep 17 00:00:00 2001 From: Salikh Gurgenidze Date: Sun, 28 Dec 2025 00:56:51 +0400 Subject: [PATCH] fix: item rows --- Core/Tooltip.lua | 14 +++++++++++++- Data/MailboxScanner.lua | 16 ++++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/Core/Tooltip.lua b/Core/Tooltip.lua index c5539ce..ba118f5 100644 --- a/Core/Tooltip.lua +++ b/Core/Tooltip.lua @@ -93,7 +93,19 @@ local function CountCurrentCharacterItems(itemID) for i = 1, numInboxItems do local _, _, _, _, _, _, _, hasItem = GetInboxHeaderInfo(i) if hasItem then - for j = 1, 12 do -- Turtle WoW supports up to 12 attachments + -- Turtle WoW supports up to 12 attachments per mail. + -- We use GetInboxNumAttachments if available to avoid over-scanning. + local numAttachments = 0 + if GetInboxNumAttachments then + numAttachments = GetInboxNumAttachments(i) or 0 + end + + -- Fallback: if we don't have the count but header says there's an item, assume at least 1. + if numAttachments == 0 and hasItem then + numAttachments = 1 + end + + for j = 1, numAttachments do -- Turtle WoW supports up to 12 attachments local name, _, count = GetInboxItem(i, j) if name then local itemLink = addon.Modules.Utils:GetInboxItemLink(i, j) diff --git a/Data/MailboxScanner.lua b/Data/MailboxScanner.lua index 7f70e3d..bcf2644 100644 --- a/Data/MailboxScanner.lua +++ b/Data/MailboxScanner.lua @@ -36,8 +36,20 @@ function MailboxScanner:ScanMailItemRows(index) local rows = {} if hasItem then - -- Turtle WoW supports up to 12 attachments per mail - for itemIndex = 1, 12 do + -- Turtle WoW supports up to 12 attachments per mail. + -- We use GetInboxNumAttachments if available to avoid over-scanning on servers + -- that might ignore the second argument of GetInboxItem. + local numAttachments = 0 + if GetInboxNumAttachments then + numAttachments = GetInboxNumAttachments(index) or 0 + end + + -- Fallback: if we don't have the count but header says there's an item, assume at least 1. + if numAttachments == 0 and hasItem then + numAttachments = 1 + end + + for itemIndex = 1, numAttachments do -- GetInboxItem(index, itemIndex) returns: name, texture, count, quality, canUse local name, texture, count, quality, canUse = GetInboxItem(index, itemIndex) if not name then break end