Automatically activate NW goliath

(fixes #10)
This commit is contained in:
Andrew Tomaka 2021-02-20 19:11:18 -05:00
parent db718b925c
commit 35bcc5b220
Signed by: atomaka
GPG key ID: 61209BF70A5B18BE

View file

@ -9,6 +9,18 @@ StaticPopupDialogs["REPAIR_ALERT"] = {
preferredIndex = 3
}
StaticPopupDialogs["GOLIATH_MISSING"] = {
text = "Option to repair goliath not found; move closer",
button1 = "Ok",
OnAccept = function()
C_GossipInfo.CloseGossip()
end,
timeout = 5,
whileDead = false,
hideOnEscape = true,
preferredIndex = 3
}
MyAddon.keyItemID = 180653
MyAddon.taunts = {
[56222] = true, -- Dark Command
@ -27,6 +39,10 @@ function MyAddon.OnEvent(self, event, ...)
events[event](self, ...)
end
function events:GOSSIP_SHOW()
if GetZoneText() == 'The Necrotic Wake' then MyAddon.activateGoliath() end
end
function events:CHAT_MSG_PARTY_LEADER(message, ...)
if message == '!keys' then
MyAddon.announceKey()
@ -102,6 +118,21 @@ function MyAddon.announceTaunts(...)
print(message)
end
function MyAddon.activateGoliath()
options = C_GossipInfo.GetOptions()
found = false
for k, v in pairs(options) do
if v['name'] == 'Can you reactivate this goliath?' then
found = true
C_GossipInfo.SelectOption(k)
break
end
end
if not found then StaticPopup_Show("GOLIATH_MISSING") end
end
function MyAddon.needsRepair()
local slots = {
"HeadSlot", "ShoulderSlot", "ChestSlot", "WristSlot", "HandsSlot",