Announce all taunts in chat frame (#2)

This commit is contained in:
Andrew Tomaka 2021-01-13 02:37:01 +00:00 committed by Gitea
parent 028f546427
commit 52303b3484

View file

@ -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",