From d970ccae45ffd3e7ebcea51bad220e3d770803c7 Mon Sep 17 00:00:00 2001 From: shaga <14+shaga@noreply.octowow.st> Date: Thu, 15 Oct 2026 03:57:41 +0000 Subject: [PATCH] Stop heal prediction erroring on vanilla clients with ClassicAPI libpredict registered the tbc spellcast and combat log events on every client and relied on vanilla never firing them. A vanilla client with an API backport such as ClassicAPI fires UNIT_SPELLCAST_START as well, without UnitCastingInfo, so every cast raised "attempt to call global 'UnitCastingInfo'". Register those events on the tbc client only; vanilla keeps using its own SPELLCAST events. --- libs/libpredict.lua | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/libs/libpredict.lua b/libs/libpredict.lua index cbe585f..d54bed6 100644 --- a/libs/libpredict.lua +++ b/libs/libpredict.lua @@ -338,13 +338,16 @@ libpredict.sender.SendResCommMsg = function(self, msg) SendAddonMessage("CTRA", msg, "BATTLEGROUND") end --- tbc -libpredict.sender:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") -libpredict.sender:RegisterEvent("UNIT_SPELLCAST_START") -libpredict.sender:RegisterEvent("UNIT_SPELLCAST_STOP") -libpredict.sender:RegisterEvent("UNIT_SPELLCAST_FAILED") -libpredict.sender:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED") -libpredict.sender:RegisterEvent("UNIT_SPELLCAST_SENT") +-- tbc (a vanilla client with an API backport such as ClassicAPI fires these +-- too, next to the vanilla events, without UnitCastingInfo: only tbc listens) +if GetExpansion() ~= "vanilla" then + libpredict.sender:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") + libpredict.sender:RegisterEvent("UNIT_SPELLCAST_START") + libpredict.sender:RegisterEvent("UNIT_SPELLCAST_STOP") + libpredict.sender:RegisterEvent("UNIT_SPELLCAST_FAILED") + libpredict.sender:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED") + libpredict.sender:RegisterEvent("UNIT_SPELLCAST_SENT") +end -- vanilla libpredict.sender:RegisterEvent("CHAT_MSG_SPELL_SELF_BUFF")