diff --git a/Compatibility/pfUI.lua b/Compatibility/pfUI.lua index 936c722..5f4b72e 100644 --- a/Compatibility/pfUI.lua +++ b/Compatibility/pfUI.lua @@ -301,6 +301,36 @@ function Extension.SyncComboDurationToPfUI(guid, spellID, duration) end end +-- Register action event handler for pfUI button updates +function Extension.RegisterPfUIActionEventHandler() + if not pfUI or Extension.actionHandlerRegistered then + return + end + + -- Register a handler that will be called whenever CleveRoids updates macro states + if CleveRoids.RegisterActionEventHandler then + CleveRoids.RegisterActionEventHandler(function(slot, event, ...) + -- Trigger pfUI's button update for this slot + -- pfUI exposes bars.update (the updatecache table) and bars.buttons + -- Mark the slot for update in pfUI's cache, which will be processed on next OnUpdate + + if pfUI.bars and pfUI.bars.update then + -- Mark slot for update in pfUI's update cache + pfUI.bars.update[slot] = true + end + + -- If there's a button at this slot, we can also directly update it + if pfUI.bars and pfUI.bars.buttons and pfUI.bars.buttons[slot] and pfUI.bars.ButtonFullUpdate then + -- Direct update the button for immediate visual feedback + pfUI.bars.ButtonFullUpdate(pfUI.bars.buttons[slot]) + end + end) + + Extension.actionHandlerRegistered = true + Extension.DLOG("Registered action event handler for pfUI button updates") + end +end + -- Main compatibility check and setup function Extension.SetupCompatibility() Extension.pfUILoaded = (pfUI ~= nil) @@ -312,6 +342,9 @@ function Extension.SetupCompatibility() -- Hook libdebuff for combo duration support Extension.HookPfUILibdebuff() + -- Register action event handler for button updates + Extension.RegisterPfUIActionEventHandler() + if Extension.macrotweakLoaded then Extension.DLOG("pfUI macrotweak module detected") diff --git a/Conditionals.lua b/Conditionals.lua index d2921d7..2069815 100644 --- a/Conditionals.lua +++ b/Conditionals.lua @@ -1191,7 +1191,6 @@ function CleveRoids.IsReactiveUsable(spellName) end -- Use Nampower's IsSpellUsable if available (more accurate) - -- Note: IsSpellUsable doesn't actually exist in Nampower, but keeping for future compatibility if IsSpellUsable then local usable, oom = IsSpellUsable(spellName) if usable == 1 and oom ~= 1 then diff --git a/Utility.lua b/Utility.lua index f056b07..36f8f45 100644 --- a/Utility.lua +++ b/Utility.lua @@ -2636,6 +2636,8 @@ function CleveRoids.HasReactiveProc(spellName) if now >= procData.expiry then -- Expired, clear it CleveRoids.reactiveProcs[spellName] = nil + -- Queue action update to refresh icon state + CleveRoids.QueueActionUpdate() return false end @@ -2664,8 +2666,16 @@ function CleveRoids.ParseReactiveCombatLog() -- Check each reactive ability's trigger patterns for spellName, config in pairs(reactivePatterns) do - -- Skip if player doesn't know this spell - if CleveRoids.GetSpell(spellName) then + -- Check if this is a known reactive spell and player has it + local hasSpell = false + if CleveRoids.reactiveSpells and CleveRoids.reactiveSpells[spellName] then + -- Check if player knows this spell (any rank) + hasSpell = (CleveRoids.GetSpell and CleveRoids.GetSpell(spellName)) or + (CleveRoids.Spells and CleveRoids.Spells[spellName]) or + false + end + + if hasSpell then for _, pattern in ipairs(config.patterns) do if strfind(message, pattern) then -- Found a trigger event (works in any stance) @@ -2714,11 +2724,13 @@ local reactiveFrame = CreateFrame("Frame", "CleveRoidsReactiveFrame") reactiveFrame:RegisterEvent("RAW_COMBATLOG") reactiveFrame:RegisterEvent("CHAT_MSG_COMBAT_SELF_HITS") reactiveFrame:RegisterEvent("CHAT_MSG_COMBAT_SELF_MISSES") +reactiveFrame:RegisterEvent("CHAT_MSG_COMBAT_CREATURE_VS_SELF_MISSES") reactiveFrame:RegisterEvent("CHAT_MSG_SPELL_SELF_DAMAGE") reactiveFrame:SetScript("OnEvent", function() if event == "RAW_COMBATLOG" or event == "CHAT_MSG_COMBAT_SELF_HITS" or event == "CHAT_MSG_COMBAT_SELF_MISSES" or + event == "CHAT_MSG_COMBAT_CREATURE_VS_SELF_MISSES" or event == "CHAT_MSG_SPELL_SELF_DAMAGE" then CleveRoids.ParseReactiveCombatLog() end