-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathglyphMaster.lua
More file actions
75 lines (68 loc) · 2.78 KB
/
glyphMaster.lua
File metadata and controls
75 lines (68 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
local MODULE_NAME = "Eluna glyphMaster"
local MODULE_VERSION = '2.1.1'
local MODULE_AUTHOR = "Mpromptu Gaming"
print("["..MODULE_NAME.."]: Loaded, Version "..MODULE_VERSION.." Active")
local DisplayIDs = {
{class = 1, type = 1, id = 58842},
{class = 1, type = 2, id = 58843},
{class = 2, type = 1, id = 58832},
{class = 2, type = 2, id = 58833},
{class = 4, type = 1, id = 58829},
{class = 4, type = 2, id = 59343},
{class = 8, type = 1, id = 58836},
{class = 8, type = 2, id = 58837},
{class = 16, type = 1, id = 58834},
{class = 16, type = 2, id = 58835},
{class = 32, type = 1, id = 58825},
{class = 32, type = 2, id = 58826},
{class = 64, type = 1, id = 58839},
{class = 64, type = 2, id = 58838},
{class = 128, type = 1, id = 58830},
{class = 128, type = 2, id = 58831},
{class = 256, type = 1, id = 58841},
{class = 256, type = 2, id = 58840},
{class = 1024, type = 1, id = 58828},
{class = 1024, type = 2, id = 58827},
}
local GlyphMaster = {
entry = 667100
}
local function findDisplayID(class, type)
for i, v in ipairs(DisplayIDs) do
if v.class==class and v.type==type then
return v.id
end
end
end
function GlyphMaster.OnHello(event, player, unit)
player:GossipMenuAddItem(0, "I need a Major Glyph", 0, 1)
player:GossipMenuAddItem(0, "I'm looking for a Minor Glyph", 0, 2)
player:GossipMenuAddItem(0, "I wish to unlearn my Talents", 0, 3, false, "Do you wish to unlearn all of your Talents?")
player:GossipSetText("Greetings, "..player:GetClassAsString()..".\n\nWhat type of Glyph do you seek?")
player:GossipSendMenu(0x7FFFFFFF, unit)
end
function GlyphMaster.OnSelect(event, player, unit, sender, intid, code)
local class = player:GetClassMask()
if sender == 0 then
if intid == 3 then
player:PlayDirectSound(1435)
player:ResetTalents(true)
player:GossipComplete()
else
local displayID = findDisplayID(class, intid)
local Query = WorldDBQuery("SELECT `name`, `entry`, `RequiredLevel` FROM item_template WHERE `name` LIKE '%Glyph of%' AND `AllowableClass` = "..class.." AND displayid = "..displayID.." ORDER BY `name`;")
if Query then
repeat
player:GossipMenuAddItem(3, Query:GetString(0).. " (Lvl "..Query:GetString(2)..")", 1, Query:GetInt32(1))
until not Query:NextRow()
player:GossipSetText("Choose wisely...")
player:GossipSendMenu(0x7FFFFFFF, unit)
end
end
else
player:AddItem(intid)
player:GossipComplete()
end
end
RegisterCreatureGossipEvent(GlyphMaster.entry, 1, GlyphMaster.OnHello)
RegisterCreatureGossipEvent(GlyphMaster.entry, 2, GlyphMaster.OnSelect)