From ebc845ff051b17430503bbe6524cb8719cb04f71 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Mon, 11 Jan 2021 22:30:58 -0500 Subject: [PATCH] Announce taunts in default chat frame --- MyAddon.lua | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/MyAddon.lua b/MyAddon.lua index 7418bff..434fff4 100755 --- a/MyAddon.lua +++ b/MyAddon.lua @@ -10,6 +10,18 @@ StaticPopupDialogs["REPAIR_ALERT"] = { } MyAddon.keyItemID = 180653 +MyAddon.taunts = { + [56222] = true, -- Dark Command + [51399] = true, -- Death Grip + [185245] = true, -- Torment + [6795] = true, -- Growl + [115546] = true, -- Provke + [612124] = true, -- Hand of Reckoning + [355] = true, -- Taunt + + [1161] = true, -- Challenging Shout + [204079] = true -- Final Stand +} function MyAddon.OnEvent(self, event, ...) events[event](self, ...) @@ -27,9 +39,8 @@ function events:CHAT_MSG_PARTY(message, ...) end end -function events:PLAYER_LOGIN(...) - -- found from some forums - local b=ActionButton8 _MH=_MH or(b:SetAttribute("*type5","macro")or SecureHandlerWrapScript(b,"PreClick",b,'Z=IsAltKeyDown()and 0 or(Z or 0)%8+1 self:SetAttribute("macrotext5","/wm [nomod]"..Z)'))or 1 +function events:COMBAT_LOG_EVENT_UNFILTERED(...) + MyAddon.announceTaunts(...) end function events:MERCHANT_SHOW(...) @@ -43,15 +54,20 @@ function events:MERCHANT_SHOW(...) end end -function events:PLAYER_UPDATE_RESTING(...) - -- Notify that we should repair - if MyAddon.needsRepair() then StaticPopup_Show("REPAIR_ALERT") end +function events:PLAYER_LOGIN(...) + -- found from some forums + local b=ActionButton8 _MH=_MH or(b:SetAttribute("*type5","macro")or SecureHandlerWrapScript(b,"PreClick",b,'Z=IsAltKeyDown()and 0 or(Z or 0)%8+1 self:SetAttribute("macrotext5","/wm [nomod]"..Z)'))or 1 end function events:PLAYER_ROLES_ASSIGNED(...) if MyAddon.amTankInParty() then MyAddon.markSelfSquare() end end +function events:PLAYER_UPDATE_RESTING(...) + -- Notify that we should repair + if MyAddon.needsRepair() then StaticPopup_Show("REPAIR_ALERT") end +end + function MyAddon.announceKey() for bag = 0, NUM_BAG_SLOTS do for slot = 1, GetContainerNumSlots(bag)do @@ -66,6 +82,19 @@ function MyAddon.announceKey() end end +function MyAddon.announceTaunts(_, _, event, _, _, srcName, _, _, _, dstName, _, _, spellId, spellName, ...) + if event != 'SPELL_CAST_SUCESS' || !MyAddon.taunts[spellId] then + return + end + + message = format("TAUNT: %s used %s", srcName, spellName) + if dstName != nil then + message = format("%s on %s", message, dstName) + end + + DEFAULT_CHAT_FRAME:AddMessage(message) +end + function MyAddon.needsRepair() local slots = { "HeadSlot", "ShoulderSlot", "ChestSlot", "WristSlot", "HandsSlot",