From ebc845ff051b17430503bbe6524cb8719cb04f71 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Mon, 11 Jan 2021 22:30:58 -0500 Subject: [PATCH 1/5] 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", -- 2.45.2 From f94dd862c173d834c288fa792a223a583647da22 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Mon, 11 Jan 2021 22:50:54 -0500 Subject: [PATCH 2/5] Fix comparison operator --- MyAddon.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MyAddon.lua b/MyAddon.lua index 434fff4..640bd74 100755 --- a/MyAddon.lua +++ b/MyAddon.lua @@ -83,12 +83,13 @@ function MyAddon.announceKey() end function MyAddon.announceTaunts(_, _, event, _, _, srcName, _, _, _, dstName, _, _, spellId, spellName, ...) - if event != 'SPELL_CAST_SUCESS' || !MyAddon.taunts[spellId] then + if event ~= 'SPELL_CAST_SUCESS' or MyAddon.taunts[spellId] ~= true then return end + DEFAULT_CHAT_FRAME:AddMessage("LOOKING") message = format("TAUNT: %s used %s", srcName, spellName) - if dstName != nil then + if dstName ~= nil then message = format("%s on %s", message, dstName) end -- 2.45.2 From e78e0c0799cb33f1792d3ac1fb97016d8a148a6d Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 12 Jan 2021 20:21:32 -0500 Subject: [PATCH 3/5] Make it work --- MyAddon.lua | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/MyAddon.lua b/MyAddon.lua index 640bd74..9262c16 100755 --- a/MyAddon.lua +++ b/MyAddon.lua @@ -16,7 +16,7 @@ MyAddon.taunts = { [185245] = true, -- Torment [6795] = true, -- Growl [115546] = true, -- Provke - [612124] = true, -- Hand of Reckoning + [62124] = true, -- Hand of Reckoning [355] = true, -- Taunt [1161] = true, -- Challenging Shout @@ -40,7 +40,7 @@ function events:CHAT_MSG_PARTY(message, ...) end function events:COMBAT_LOG_EVENT_UNFILTERED(...) - MyAddon.announceTaunts(...) + MyAddon.announceTaunts(CombatLogGetCurrentEventInfo()) end function events:MERCHANT_SHOW(...) @@ -82,18 +82,24 @@ function MyAddon.announceKey() end end -function MyAddon.announceTaunts(_, _, event, _, _, srcName, _, _, _, dstName, _, _, spellId, spellName, ...) - if event ~= 'SPELL_CAST_SUCESS' or MyAddon.taunts[spellId] ~= true then +function MyAddon.announceTaunts(...) + event = select(2, ...) + spellId = select(12, ...) + + if event ~= 'SPELL_CAST_SUCCESS' or MyAddon.taunts[spellId] ~= true then return end - DEFAULT_CHAT_FRAME:AddMessage("LOOKING") - message = format("TAUNT: %s used %s", srcName, spellName) - if dstName ~= nil then - message = format("%s on %s", message, dstName) + 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 - DEFAULT_CHAT_FRAME:AddMessage(message) + print(message) end function MyAddon.needsRepair() -- 2.45.2 From 42a7a992fd6209571a455400540b8df1879cdd37 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 12 Jan 2021 20:21:47 -0500 Subject: [PATCH 4/5] Try something fancy --- MyAddon.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/MyAddon.lua b/MyAddon.lua index 9262c16..827398c 100755 --- a/MyAddon.lua +++ b/MyAddon.lua @@ -82,10 +82,21 @@ function MyAddon.announceKey() end end +local function multiSelect(table, ...) + result = {} + for i, val in ipairs(...) do + table.insert(result, table[val]) + end +end + function MyAddon.announceTaunts(...) event = select(2, ...) spellId = select(12, ...) + a, b = multiSelect(..., 2, 12) + print(a) + print(b) + if event ~= 'SPELL_CAST_SUCCESS' or MyAddon.taunts[spellId] ~= true then return end -- 2.45.2 From f709da599a6c36a8be1cb626b84f3b576326beeb Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 12 Jan 2021 21:32:49 -0500 Subject: [PATCH 5/5] Revert "Try something fancy" This reverts commit 42a7a992fd6209571a455400540b8df1879cdd37. --- MyAddon.lua | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/MyAddon.lua b/MyAddon.lua index 827398c..9262c16 100755 --- a/MyAddon.lua +++ b/MyAddon.lua @@ -82,21 +82,10 @@ function MyAddon.announceKey() end end -local function multiSelect(table, ...) - result = {} - for i, val in ipairs(...) do - table.insert(result, table[val]) - end -end - function MyAddon.announceTaunts(...) event = select(2, ...) spellId = select(12, ...) - a, b = multiSelect(..., 2, 12) - print(a) - print(b) - if event ~= 'SPELL_CAST_SUCCESS' or MyAddon.taunts[spellId] ~= true then return end -- 2.45.2