From 4aa49f3a38a0fc5bf0ff35f8ad0c2a39ece2293a Mon Sep 17 00:00:00 2001 From: Dusk-92 Date: Thu, 3 Sep 2026 18:49:33 +0200 Subject: [PATCH] Harden ClassicAPI roll history binding --- mods/improved-roll-frames.lua | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/mods/improved-roll-frames.lua b/mods/improved-roll-frames.lua index a8534db..b1b6e87 100644 --- a/mods/improved-roll-frames.lua +++ b/mods/improved-roll-frames.lua @@ -61,7 +61,10 @@ module.enable = function(self) for i=1,(numPlayers or 0) do local name, class, rollType, roll, isWinner, isMe = API.GetLootHistoryPlayerInfo(itemIndex, i) - if name and not isMe and rollType == wantedType then + -- C_LootHistory may synthesize a winner row when its individual roll + -- packet never arrived. That row has roll=0; don't mislabel it as Pass. + if name and not isMe and not (isWinner and roll == 0) + and rollType == wantedType then table.insert(players, name) end end @@ -86,7 +89,7 @@ module.enable = function(self) -- The original chat parser deliberately ignored "You"; preserve that -- behavior by not counting the local player's own roll. - if name and not isMe then + if name and not isMe and not (isWinner and roll == 0) then if rollType == 1 then need = need + 1 elseif rollType == 2 then @@ -105,6 +108,19 @@ module.enable = function(self) local function BindVisibleFrames() local claimed = {} + -- FULL_UPDATE can also mean the history was cleared or the 128-entry ring + -- evicted an old row. Drop stale bindings before assigning new ones. + for i=1,ROLL_FRAME_COUNT do + local frame = ShaguTweaks.roll.frames[i] + if frame and frame.historyRollID + and not FindHistoryIndex(frame.historyRollID) then + frame.historyRollID = nil + frame.need.count:SetText("") + frame.greed.count:SetText("") + frame.pass.count:SetText("") + end + end + for i=1,ROLL_FRAME_COUNT do local frame = ShaguTweaks.roll.frames[i] if frame and frame.historyRollID then