thirdparty: update healcomm code for libpredict

* disable libpredict sender when healcomm should be used
* fix bug where solo-predictions where not parsed
This commit is contained in:
shagu
2020-11-27 15:26:53 +01:00
parent 80f5b9ef0d
commit 2071ff0b2a
+4 -4
View File
@@ -987,21 +987,21 @@ pfUI:RegisterModule("thirdparty-vanilla", "vanilla", function()
local EnableHealComm = function()
-- hook healcomm's addon message to parse single-player events
if AceLibrary and AceLibrary:HasInstance("HealComm-1.0") and pfUI.prediction then
if AceLibrary and AceLibrary:HasInstance("HealComm-1.0") and pfUI.api.libpredict then
local HealComm = AceLibrary("HealComm-1.0")
-- use pfUI frames to draw healComm predictions
local pfHookHealCommSendAddonMessage = HealComm.SendAddonMessage
function HealComm.SendAddonMessage(this, msg)
if not UnitInRaid("player") and GetNumPartyMembers() < 1 then
pfUI.prediction:ParseChatMessage(UnitName("player"), msg)
libpredict:ParseChatMessage(UnitName("player"), msg, "HealComm")
end
pfHookHealCommSendAddonMessage(this, msg)
end
-- disable pfUI predictions
pfUI.prediction.sender:UnregisterAllEvents()
pfUI.prediction.sender.enabled = nil
pfUI.api.libpredict.sender:UnregisterAllEvents()
pfUI.api.libpredict.sender.enabled = nil
end
end
HookAddonOrVariable("HealComm", EnableHealComm)