Add !keys command

This commit is contained in:
Andrew Tomaka 2020-12-19 20:39:26 -05:00
parent 09c2538b81
commit 904c5abc5a
Signed by: atomaka
GPG key ID: 61209BF70A5B18BE

View file

@ -9,10 +9,18 @@ StaticPopupDialogs["REPAIR_ALERT"] = {
preferredIndex = 3
}
MyAddon.keyItemID = 138019
function MyAddon.OnEvent(self, event, ...)
events[event](self, ...)
end
function events:CHAT_MSG_PARTY(message, ...)
if text == '!keys' then
MyAddon.announceKey()
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
@ -38,6 +46,19 @@ function events:PLAYER_ROLES_ASSIGNED(...)
if MyAddon.amTankInParty() then MyAddon.markSelfSquare() end
end
function MyAddon.announceKey()
for bag = 0, NUM_BAG_SLOTS do
for slot = 1, GetContainerNumSlots(bag)do
if GetContainerItemID(bag, slot) == MyAddon.keyItemID then
local link = GetContainerItemLink(bag, slot)
SendChatMessage(link, "PARTY")
return
end
end
end
end
function MyAddon.needsRepair()
local slots = {
"HeadSlot", "ShoulderSlot", "ChestSlot", "WristSlot", "HandsSlot",