Skip to content

Instantly share code, notes, and snippets.

@Konctantin
Created January 25, 2016 08:28
Show Gist options
  • Select an option

  • Save Konctantin/7278b3155f5514a7dfe7 to your computer and use it in GitHub Desktop.

Select an option

Save Konctantin/7278b3155f5514a7dfe7 to your computer and use it in GitHub Desktop.
GOSSIP_EVENTS = { }
m_frame = CreateFrame("Frame");
m_frame.list = { }
local list = {
["test_guid"] = {
[1] = { count = 0, complite = 0, menu = {} },
[2] = { count = 0, complite = 0, menu = {} },
[3] = { count = 0, complite = 0, menu = {
[1] = { count = 0, complite = 0, menu = {} },
[2] = { count = 0, complite = 0, menu = {} },
[3] = { count = 0, complite = 0, menu = {
[1] = { count = 0, complite = 0, menu = {} }
} },
[4] = { count = 0, complite = 0, menu = {} },
[5] = { count = 0, complite = 0, menu = {} },
} },
[4] = { count = 0, complite = 0, menu = {} },
}
};
--[[
CloseGossip()
numgossip = GetNumGossipOptions()
SelectGossipOption(index)
text = GetGossipText()
text, gossipType = GetGossipOptions()
]]
function GOSSIP_EVENTS.GOSSIP_CLOSED(self)
local guid = UnitGUID("target");
print("GOSSIP_CLOSED", guid)
end
function GOSSIP_EVENTS.GOSSIP_CONFIRM(self, index, msg, cost)
print("GOSSIP_CONFIRM(", index, msg, cost, ")")
end
function GOSSIP_EVENTS.GOSSIP_SHOW(self)
local guid = UnitGUID("target");
print("GOSSIP_SHOW", guid, GetGossipText())
local options = { GetGossipOptions() };
for i = 1, #options, 2 do
local text = options[i];
local type = options[i+1];
print(">>", type, text);
end
end
function m_frame_OnUpdate(self, elapsed)
-- empty
end
function m_frame_OnEvent(self, event, ...)
if type(GOSSIP_EVENTS[event]) == "function" then
GOSSIP_EVENTS[event](self, ...);
end
end
m_frame:SetScript("OnUpdate", m_frame_OnUpdate);
m_frame:SetScript("OnEvent", m_frame_OnEvent);
m_frame:RegisterEvent("GOSSIP_CLOSED");
m_frame:RegisterEvent("GOSSIP_CONFIRM");
m_frame:RegisterEvent("GOSSIP_SHOW");
m_frame:Show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment