diff --git a/MyAddon.lua b/MyAddon.lua index db62af9..e89a48d 100755 --- a/MyAddon.lua +++ b/MyAddon.lua @@ -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",