SHOW:
|
|
- or go back to the newest paste.
1 | local npcid = x | |
2 | ||
3 | local T = { | |
4 | ["Menu"] = { | |
5 | {"Headpiece", 0}, | |
6 | {"Shoulders", 2}, | |
7 | {"Chest", 4}, | |
8 | {"Legs", 6}, | |
9 | {"Boots", 7}, | |
10 | {"Bracers", 8}, | |
11 | {"Gloves", 9}, | |
12 | {"Cloak", 14}, | |
13 | {"Main-Hand Weapons", 15}, | |
14 | {"Two-Handed Weapons", 151}, | |
15 | {"Off-Hand Weapons", 16}, | |
16 | {"Shields", 161}; | |
17 | }, | |
18 | ||
19 | [0] = { -- Headpiece | |
20 | {"Arcanum of Burning Mysteries", 3820, false}, | |
21 | {"Arcanum of Blissful Mending", 3819, false}, | |
22 | {"Arcanum of the Stalward Protector", 3818, false}, | |
23 | {"Arcanum of Torment", 3817, false}, | |
24 | {"Arcanum of the Savage Gladiator", 3842, false}, | |
25 | {"Arcanum of Triumph", 3795, false}, | |
26 | {"Arcanum of Dominance", 3797, false}; | |
27 | }, | |
28 | ||
29 | [2] = { -- Shoulders | |
30 | {"Inscription of Triumph", 3793, false}, | |
31 | {"Inscription of Dominance", 3794, false}, | |
32 | {"Greater Inscription of the Gladiator", 3852, false}, | |
33 | {"Greater Inscription of the Axe", 3808, false}, | |
34 | {"Greater Inscription of the Crag", 3809, false}, | |
35 | {"Greater Inscription of the Pinnacle", 3811, false}, | |
36 | {"Greater Inscription of the Storm", 3810, false}; | |
37 | }, | |
38 | ||
39 | [4] = { -- Chest | |
40 | {"Enchant Chest - Powerful Stats", 3832, false}, | |
41 | {"Enchant Chest - Super Health", 3297, false}, | |
42 | {"Enchant Chest - Greater Mana Restoration", 2381, false}, | |
43 | {"Enchant Chest - Exceptional Resilience", 3245, false}, | |
44 | {"Enchant Chest - Greater Defense", 1953, false}; | |
45 | }, | |
46 | ||
47 | [6] = { -- Legs | |
48 | {"Earthen Leg Armor", 3853, false}, | |
49 | {"Frosthide Leg Armor", 3822, false}, | |
50 | {"Icescale Leg Armor", 3823, false}, | |
51 | {"Brilliant Spellthread", 3719, false}, | |
52 | {"Sapphire Spellthread", 3721, false}; | |
53 | }, | |
54 | ||
55 | [7] = { -- Boots | |
56 | {"Enchant Boots - Greater Assault", 1597, false}, | |
57 | {"Enchant Boots - Tuskars Vitality", 3232, false}, | |
58 | {"Enchant Boots - Superior Agility", 983, false}, | |
59 | {"Enchant Boots - Greater Spirit", 1147, false}, | |
60 | {"Enchant Boots - Greater Vitality", 3244, false}, | |
61 | {"Enchant Boots - Icewalker", 3826, false}, | |
62 | {"Enchant Boots - Greater Fortitude", 1075, false}; | |
63 | }, | |
64 | ||
65 | [8] = { -- Bracers | |
66 | {"Enchant Bracers - Major Stamina", 3850, false}, | |
67 | {"Enchant Bracers - Superior Spellpower", 2332, false}, | |
68 | {"Enchant Bracers - Greater Assault", 3845, false}, | |
69 | {"Enchant Bracers - Major Spirit", 1147, false}, | |
70 | {"Enchant Bracers - Expertise", 3231, false}, | |
71 | {"Enchant Bracers - Greater Stats", 2661, false}, | |
72 | {"Enchant Bracers - Exceptional Intellect", 1119, false}; | |
73 | }, | |
74 | ||
75 | [9] = { -- Gloves | |
76 | {"Enchant Gloves - Greater Blasting", 3249, false}, | |
77 | {"Enchant Gloves - Armsman", 3253, false}, | |
78 | {"Enchant Gloves - Crusher", 1603, false}, | |
79 | {"Enchant Gloves - Agility", 3222, false}, | |
80 | {"Enchant Gloves - Precision", 3234, false}, | |
81 | {"Enchant Gloves - Expertise", 3231, false}, | |
82 | {"Enchant Gloves - Exceptional Spellpower", 3246, false}; | |
83 | }, | |
84 | ||
85 | [14] = { -- Cloak | |
86 | {"Enchant Cloak - Shadow Armor", 3256, false}, | |
87 | {"Enchant Cloak - Wisdom", 3296, false}, | |
88 | {"Enchant Cloak - Titan Weave", 1951, false}, | |
89 | {"Enchant Cloak - Greater Speed", 3831, false}, | |
90 | {"Enchant Cloak - Mighty Armor", 3294, false}, | |
91 | {"Enchant Cloak - Major Agility", 1099, false}, | |
92 | {"Enchant Cloak - Spell Piercing", 1262, false}; | |
93 | }, | |
94 | ||
95 | [15] = { | |
96 | -- Main Hand | |
97 | {"Enchant Weapon - Titan Guard", 3851, false}, | |
98 | {"Enchant Weapon - Accuracy", 3788, false}, | |
99 | {"Enchant Weapon - Berserking", 3789, false}, | |
100 | {"Enchant Weapon - Black Magic", 3790, false}, | |
101 | {"Enchant Weapon - Mighty Spellpower", 3834, false}, | |
102 | {"Enchant Weapon - Superior Potency", 3833, false}, | |
103 | {"Enchant Weapon - Ice Breaker", 3239, false}, | |
104 | {"Enchant Weapon - Lifeward", 3241, false}, | |
105 | {"Enchant Weapon - Blood Draining", 3870, false}, | |
106 | {"Enchant Weapon - Blade Ward", 3869, false}, | |
107 | {"Enchant Weapon - Exceptional Agility", 1103, false}, | |
108 | {"Enchant Weapon - Exceptional Spirit", 3844, false}, | |
109 | {"Enchant Weapon - Executioner", 3225, false}, | |
110 | {"Enchant Weapon - Mongoose", 2673, false}, | |
111 | ||
112 | -- Two-Handed | |
113 | {"Enchant 2H Weapon - Massacre", 3827, true}, | |
114 | {"Enchant 2H Weapon - Scourgebane", 3247, true}, | |
115 | {"Enchant 2H Weapon - Giant Slayer", 3251, true}, | |
116 | {"Enchant 2H Weapon - Greater Spellpower", 3854, true}; | |
117 | }, | |
118 | ||
119 | [16] = { | |
120 | -- Offhand | |
121 | {"Enchant Weapon - Titan Guard", 3851, false}, | |
122 | {"Enchant Weapon - Accuracy", 3788, false}, | |
123 | {"Enchant Weapon - Berserking", 3789, false}, | |
124 | {"Enchant Weapon - Black Magic", 3790, false}, | |
125 | {"Enchant Weapon - Mighty Spellpower", 3834, false}, | |
126 | {"Enchant Weapon - Superior Potency", 3833, false}, | |
127 | {"Enchant Weapon - Ice Breaker", 3239, false}, | |
128 | {"Enchant Weapon - Lifeward", 3241, false}, | |
129 | {"Enchant Weapon - Blood Draining", 3870, false}, | |
130 | {"Enchant Weapon - Blade Ward", 3869, false}, | |
131 | {"Enchant Weapon - Exceptional Agility", 1103, false}, | |
132 | {"Enchant Weapon - Exceptional Spirit", 3844, false}, | |
133 | {"Enchant Weapon - Executioner", 3225, false}, | |
134 | {"Enchant Weapon - Mongoose", 2673, false}, | |
135 | ||
136 | -- Shields | |
137 | {"Enchant Shield - Defense", 1952, true}, | |
138 | {"Enchant Shield - Greater Intellect", 1128, true}, | |
139 | {"Enchant Shield - Shield Block", 2655, true}, | |
140 | {"Enchant Shield - Resilience", 3229, true}, | |
141 | {"Enchant Shield - Major Stamina", 1071, true}, | |
142 | {"Enchant Shield - Tough Shield", 2653, true}; | |
143 | }, | |
144 | }; | |
145 | local pVar = {}; | |
146 | ||
147 | function Enchanter(unit, _, plr) | |
148 | pVar[plr:GetName()] = nil; | |
149 | -- pVar[plr:GetName()] = {}; | |
150 | ||
151 | unit:GossipCreateMenu(301, plr, 0) | |
152 | for _, v in ipairs(T["Menu"]) do | |
153 | unit:GossipMenuAddItem(3, "|cFF008000Enchant "..v[1]..".|R", v[2], 0) | |
154 | end | |
155 | unit:GossipSendMenu(plr) | |
156 | end | |
157 | ||
158 | function EnchanterSelect(unit, _, plr, id, intid, code) | |
159 | if (intid < 500) then | |
160 | unit:GossipCreateMenu(301, plr, 0) | |
161 | local ID = intid | |
162 | local f | |
163 | if(intid == 161 or intid == 151) then | |
164 | ID = math.floor(intid/10) | |
165 | f = true | |
166 | end | |
167 | pVar[plr:GetName()] = intid; | |
168 | if(T[ID]) then | |
169 | for i, v in ipairs(T[ID]) do | |
170 | if((not f and not v[3]) or (f and v[3])) then | |
171 | unit:GossipMenuAddItem(3, "|cFF008000"..v[1]..".|R", v[2], 0) | |
172 | end | |
173 | end | |
174 | end | |
175 | unit:GossipMenuAddItem(3, "[Back]", 500, 0) | |
176 | unit:GossipSendMenu(plr) | |
177 | elseif (intid == 500) then | |
178 | Enchanter(unit, _, plr) | |
179 | elseif (intid >= 900) then | |
180 | local ID = pVar[plr:GetName()] | |
181 | if(ID == 161 or ID == 151) then | |
182 | ID = math.floor(ID/10) | |
183 | end | |
184 | for k, v in pairs(T[ID]) do | |
185 | if v[2] == intid then | |
186 | local item = plr:GetEquippedItemBySlot(ID) | |
187 | if item then | |
188 | if v[3] then | |
189 | local sql = "SELECT * FROM items WHERE entry = "..item:GetEntryId() | |
190 | local result = WorldDBQuery(sql) | |
191 | local WType = result:GetColumn(2):GetUShort() | |
192 | if pVar[plr:GetName()] == 151 then | |
193 | if(WType == 1 or WType == 5 or WType == 6 or WType == 8 or WType == 10) then | |
194 | item:RemoveEnchantment(0,0) | |
195 | item:AddEnchantment(intid, 0, 0) | |
196 | else | |
197 | plr:SendAreaTriggerMessage("You do not have a Two-Handed Weapon equipped!") | |
198 | end | |
199 | elseif pVar[plr:GetName()] == 161 then | |
200 | if(WType == 6) then | |
201 | item:RemoveEnchantment(0,0) | |
202 | item:AddEnchantment(intid, 0, 0) | |
203 | else | |
204 | plr:SendAreaTriggerMessage("You do not have a Shield equipped!") | |
205 | end | |
206 | end | |
207 | else | |
208 | item:RemoveEnchantment(0,0) | |
209 | item:AddEnchantment(intid, 0, 0) | |
210 | end | |
211 | else | |
212 | plr:SendAreaTriggerMessage("You have no item to enchant in the selected slot!") | |
213 | end | |
214 | end | |
215 | end | |
216 | EnchanterSelect(unit, nil, plr, id, pVar[plr:GetName()], nil) | |
217 | -- plr:GossipComplete() | |
218 | -- pVar[plr:GetName()] = nil; | |
219 | end | |
220 | end | |
221 | ||
222 | RegisterUnitGossipEvent(npcid, 1, Enchanter) | |
223 | RegisterUnitGossipEvent(npcid, 2, EnchanterSelect) |