Announce taunts in default chat frame

This commit is contained in:
Andrew Tomaka 2021-01-11 22:30:58 -05:00
parent 028f546427
commit ebc845ff05
Signed by: atomaka
GPG key ID: 61209BF70A5B18BE

View file

@ -10,6 +10,18 @@ StaticPopupDialogs["REPAIR_ALERT"] = {
} }
MyAddon.keyItemID = 180653 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, ...) function MyAddon.OnEvent(self, event, ...)
events[event](self, ...) events[event](self, ...)
@ -27,9 +39,8 @@ function events:CHAT_MSG_PARTY(message, ...)
end end
end end
function events:PLAYER_LOGIN(...) function events:COMBAT_LOG_EVENT_UNFILTERED(...)
-- found from some forums MyAddon.announceTaunts(...)
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 end
function events:MERCHANT_SHOW(...) function events:MERCHANT_SHOW(...)
@ -43,15 +54,20 @@ function events:MERCHANT_SHOW(...)
end end
end end
function events:PLAYER_UPDATE_RESTING(...) function events:PLAYER_LOGIN(...)
-- Notify that we should repair -- found from some forums
if MyAddon.needsRepair() then StaticPopup_Show("REPAIR_ALERT") end 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 end
function events:PLAYER_ROLES_ASSIGNED(...) function events:PLAYER_ROLES_ASSIGNED(...)
if MyAddon.amTankInParty() then MyAddon.markSelfSquare() end if MyAddon.amTankInParty() then MyAddon.markSelfSquare() end
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() function MyAddon.announceKey()
for bag = 0, NUM_BAG_SLOTS do for bag = 0, NUM_BAG_SLOTS do
for slot = 1, GetContainerNumSlots(bag)do for slot = 1, GetContainerNumSlots(bag)do
@ -66,6 +82,19 @@ function MyAddon.announceKey()
end end
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() function MyAddon.needsRepair()
local slots = { local slots = {
"HeadSlot", "ShoulderSlot", "ChestSlot", "WristSlot", "HandsSlot", "HeadSlot", "ShoulderSlot", "ChestSlot", "WristSlot", "HandsSlot",