From 52303b348414afceaa972fed57964fd14202ef5f Mon Sep 17 00:00:00 2001 From: atomaka Date: Wed, 13 Jan 2021 02:37:01 +0000 Subject: [PATCH] Announce all taunts in chat frame (#2) --- MyAddon.lua | 48 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/MyAddon.lua b/MyAddon.lua index 7418bff..9262c16 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 + [62124] = 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(CombatLogGetCurrentEventInfo()) 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,26 @@ function MyAddon.announceKey() end end +function MyAddon.announceTaunts(...) + event = select(2, ...) + spellId = select(12, ...) + + if event ~= 'SPELL_CAST_SUCCESS' or MyAddon.taunts[spellId] ~= true then + return + end + + srcName = select(5, ...) + destName = select(9, ...) + spellName = select(13, ...) + + message = format("|cffFF0000TAUNT:|r %s used %s", srcName, spellName) + if destName ~= nil then + message = format("%s on %s", message, destName) + end + + print(message) +end + function MyAddon.needsRepair() local slots = { "HeadSlot", "ShoulderSlot", "ChestSlot", "WristSlot", "HandsSlot",