From 9ef89c863d50a7ed11dab35097338163f0b8acb4 Mon Sep 17 00:00:00 2001 From: Dusk-92 Date: Thu, 3 Sep 2026 18:48:05 +0200 Subject: [PATCH] Match roll history through ClassicAPI item IDs --- mods/improved-roll-frames.lua | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/mods/improved-roll-frames.lua b/mods/improved-roll-frames.lua index 1531888..a8534db 100644 --- a/mods/improved-roll-frames.lua +++ b/mods/improved-roll-frames.lua @@ -10,7 +10,10 @@ local module = ShaguTweaks:register({ }) module.enable = function(self) - if not API.loothistoryevents or not API.modifierkeys then return end + if not API.loothistoryevents or not API.modifierkeys + or not API.iteminfoinstant or not API.lootrollitemid then + return + end local _G = ShaguTweaks.GetGlobalEnv() local font_default, font_size = "Fonts\\skurri.TTF", 15 @@ -31,21 +34,19 @@ module.enable = function(self) end end - local function LinksMatch(nativeLink, historyLink) - if not nativeLink or not historyLink then return false end - if nativeLink == historyLink then return true end - return string.find(nativeLink, historyLink, 1, true) and true or false - end + local function FindUnclaimedHistory(itemID, claimed) + if not itemID then return end - local function FindUnclaimedHistory(nativeLink, claimed) local numItems = API.GetLootHistoryNumItems() -- New group rolls are appended to C_LootHistory. Search newest first so -- the frame opened by the current START_ROLL binds to that new entry. for i=numItems,1,-1 do local historyRollID, historyLink = API.GetLootHistoryItem(i) - if historyRollID and not claimed[historyRollID] - and LinksMatch(nativeLink, historyLink) then + local historyItemID = historyLink and API.GetItemInfoInstant(historyLink) + + if historyRollID and historyItemID == itemID + and not claimed[historyRollID] then return historyRollID, i end end @@ -115,9 +116,9 @@ module.enable = function(self) local frame = ShaguTweaks.roll.frames[i] if frame and frame:IsVisible() and frame.rollID and not frame.historyRollID then - local nativeLink = frame.historyLink or GetLootRollItemLink(frame.rollID) + local itemID = frame.itemID or API.GetLootRollItemID(frame.rollID) local historyRollID, itemIndex = - FindUnclaimedHistory(nativeLink, claimed) + FindUnclaimedHistory(itemID, claimed) if historyRollID then frame.historyRollID = historyRollID @@ -351,7 +352,7 @@ module.enable = function(self) frame:Hide() frame.rollID = nil frame.historyRollID = nil - frame.historyLink = nil + frame.itemID = nil frame.need.count:SetText("") frame.greed.count:SetText("") frame.pass.count:SetText("") @@ -397,7 +398,7 @@ module.enable = function(self) frame.rollID = id frame.rollTime = rollTime frame.historyRollID = nil - frame.historyLink = GetLootRollItemLink(id) + frame.itemID = API.GetLootRollItemID(id) ShaguTweaks.roll:UpdateLootRoll(available) end end