Automatically activate NW goliath (#11)

(fixes #10)
This commit is contained in:
Andrew Tomaka 2021-02-21 00:56:02 +00:00 committed by Gitea
parent db718b925c
commit f779f20a52

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,13 @@ function MyAddon.OnEvent(self, event, ...)
events[event](self, ...)
end
function events:GOSSIP_SHOW()
local isNecroticWake = GetZoneText() == 'The Necrotic Wake'
local isSteward = GetUnitName('npc') == 'Steward'
if isNecroticWake and isSteward then MyAddon.activateGoliath() end
end
function events:CHAT_MSG_PARTY_LEADER(message, ...)
if message == '!keys' then
MyAddon.announceKey()
@ -102,6 +121,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",