Advertisement
WrathClassic

Enchanter

Jun 25th, 2022
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.58 KB | None | 0 0
  1. local npcid = XXX -- ID for npc
  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. {"Ranged", 17}
  18.  
  19. },
  20. [0] = {
  21. -- Headpiece
  22. {"Arcanum of Burning Mysteries", 3820, false},
  23. {"Arcanum of Blissful Mending", 3819, false},
  24. {"Arcanum of the Stalward Protector", 3818, false},
  25. {"Arcanum of Torment", 3817, false},
  26. {"Arcanum of the Savage Gladiator", 3842, false},
  27. {"Arcanum of Triumph", 3795, false},
  28. {"Arcanum of Dominance", 3797, false}
  29. },
  30. [2] = {
  31. -- Shoulders
  32. {"Inscription of Triumph", 3793, false},
  33. {"Inscription of Dominance", 3794, false},
  34. {"Greater Inscription of the Gladiator", 3852, false},
  35. {"Greater Inscription of the Axe", 3808, false},
  36. {"Greater Inscription of the Crag", 3809, false},
  37. {"Greater Inscription of the Pinnacle", 3811, false},
  38. {"Greater Inscription of the Storm", 3810, false},
  39. {"Might of the Scourge", 2717, false},
  40. {"Power of the Scourge", 2721, false},
  41. {"Zandalar Signet of Might", 2606, false}
  42. },
  43. [4] = {
  44. -- Chest
  45. {"Enchant Chest - Powerful Stats", 3832, false},
  46. {"Enchant Chest - Super Health", 3297, false},
  47. {"Enchant Chest - Greater Mana Restoration", 2381, false},
  48. {"Enchant Chest - Exceptional Resilience", 3245, false},
  49. {"Enchant Chest - Greater Defense", 1953, false}
  50. },
  51. [6] = {
  52. -- Legs
  53. {"Earthen Leg Armor", 3853, false},
  54. {"Frosthide Leg Armor", 3822, false},
  55. {"Icescale Leg Armor", 3823, false},
  56. {"Brilliant Spellthread", 3719, false},
  57. {"Sapphire Spellthread", 3721, false}
  58. },
  59. [7] = {
  60. -- Boots
  61. {"Greater Assault", 1597, false},
  62. {"Tuskars Vitality", 3232, false},
  63. {"Superior Agility", 983, false},
  64. {"Greater Spirit", 1147, false},
  65. {"Greater Vitality", 3244, false},
  66. {"Icewalker", 3826, false},
  67. {"Greater Fortitude", 1075, false}
  68. },
  69. [8] = {
  70. -- Bracers
  71. {"Socket bracers test ", 3717, false},
  72. {"Major Stamina", 3850, false},
  73. {"Superior Spellpower", 2332, false},
  74. {"Greater Assault", 3845, false},
  75. {"Major Spirit", 1147, false},
  76. {"Expertise", 3231, false},
  77. {"Greater Stats", 2661, false},
  78. {"Exceptional Intellect", 1119, false}
  79.  
  80. },
  81. [9] = {
  82. -- Gloves
  83. {"Socket gloves", 3723, false},
  84. {"Riding SKill Increase", 930, false},
  85. {"Greater Blasting", 3249, false},
  86. {"Armsman", 3253, false},
  87. {"Crusher", 1603, false},
  88. {"Agility", 3222, false},
  89. {"Precision", 3234, false},
  90. {"Expertise", 3231, false},
  91. {"Exceptional Spellpower", 3246, false}
  92.  
  93. },
  94. [14] = {
  95. -- Cloak
  96. {"Shadow Armor", 3256, false},
  97. {"Wisdom", 3296, false},
  98. {"Titan Weave", 1951, false},
  99. {"Greater Speed", 3831, false},
  100. {"Mighty Armor", 3294, false},
  101. {"Major Agility", 1099, false},
  102. {"Spell Piercing", 1262, false}
  103. },
  104. [15] = {
  105. -- Main Hand
  106. {"Crusader", 1900, false},
  107. {"Titan Guard", 3851, false},
  108. {"Accuracy", 3788, false},
  109. {"Berserking", 3789, false},
  110. {"Black Magic", 3790, false},
  111. {"Mighty Spellpower", 3834, false},
  112. {"Superior Potency", 3833, false},
  113. {"Ice Breaker", 3239, false},
  114. {"Lifeward", 3241, false},
  115. {"Blood Draining", 3870, false},
  116. {"Blade Ward", 3869, false},
  117. {"Exceptional Agility", 1103, false},
  118. {"Exceptional Spirit", 3844, false},
  119. {"Executioner", 3225, false},
  120. {"Mongoose", 2673, false},
  121. -- Two-Handed
  122. {"Massacre", 3827, true},
  123. {"Scourgebane", 3247, true},
  124. {"Giant Slayer", 3251, true},
  125. {"Greater Spellpower", 3854, true}
  126.  
  127. },
  128. [16] = {
  129. -- Offhand
  130. {"Titan Guard", 3851, false},
  131. {"Accuracy", 3788, false},
  132. {"Berserking", 3789, false},
  133. {"Black Magic", 3790, false},
  134. {"Mighty Spellpower", 3834, false},
  135. {"Superior Potency", 3833, false},
  136. {"Ice Breaker", 3239, false},
  137. {"Lifeward", 3241, false},
  138. {"Blood Draining", 3870, false},
  139. {"Blade Ward", 3869, false},
  140. {"Exceptional Agility", 1103, false},
  141. {"Exceptional Spirit", 3844, false},
  142. {"Executioner", 3225, false},
  143. {"Mongoose", 2673, false},
  144. -- Shields
  145. {"Defense", 1952, true},
  146. {"Greater Intellect", 1128, true},
  147. {"Shield Block", 2655, true},
  148. {"Resilience", 3229, true},
  149. {"Major Stamina", 1071, true},
  150. {"Tough Shield", 2653, true},
  151.  
  152. },
  153. [17] = {
  154. --Ranged
  155. {"Diamond-cut Refractor Scope", 3843, false},
  156. {"Sun Scope", 3607, false},
  157. {"Heartseeker Scope", 3608, false}
  158. -- {"Khorium Scope", 2723, false}
  159.  
  160. }
  161. }
  162. local pVar = {}
  163.  
  164. function Enchanter(event, player, unit)
  165. pVar[player:GetName()] = nil
  166.  
  167. for _, v in ipairs(T["Menu"]) do
  168. player:GossipMenuAddItem(3, "|cFFffffff " .. v[1] .. ".|R", 0, v[2])
  169. end
  170. player:GossipSendMenu(1, unit)
  171. end
  172.  
  173. function EnchanterSelect(event, player, unit, sender, intid, code)
  174. if (intid < 500) then
  175. local ID = intid
  176. local f
  177. if (intid == 161 or intid == 151) then
  178. ID = math.floor(intid / 10)
  179. f = true
  180. end
  181. pVar[player:GetName()] = intid
  182. if (T[ID]) then
  183. for i, v in ipairs(T[ID]) do
  184. if ((not f and not v[3]) or (f and v[3])) then
  185. player:GossipMenuAddItem(3, "|cFFffffff " .. v[1] .. ".|R", 0, v[2])
  186. end
  187. end
  188. end
  189. player:GossipMenuAddItem(3, "[Back]", 0, 500)
  190. player:GossipSendMenu(1, unit)
  191. elseif (intid == 500) then
  192. Enchanter(event, player, unit)
  193. elseif (intid >= 900) then
  194. local ID = pVar[player:GetName()]
  195. if (ID == 161 or ID == 151) then
  196. ID = math.floor(ID / 10)
  197. end
  198. for k, v in pairs(T[ID]) do
  199. if v[2] == intid then
  200. local item = player:GetEquippedItemBySlot(ID)
  201. if item then
  202. if v[3] then
  203. local WType = item:GetSubClass()
  204. if pVar[player:GetName()] == 151 then
  205. if (WType == 1 or WType == 5 or WType == 6 or WType == 8 or WType == 10) then
  206. item:ClearEnchantment(0, 0)
  207. item:SetEnchantment(intid, 0, 0)
  208. else
  209. player:SendAreaTriggerMessage("You do not have a Two-Handed Weapon equipped!")
  210. end
  211. elseif pVar[player:GetName()] == 161 then
  212. if (WType == 6) then
  213. item:ClearEnchantment(0, 0)
  214. item:SetEnchantment(intid, 0, 0)
  215. else
  216. player:SendAreaTriggerMessage("You do not have a Shield equipped!")
  217. end
  218. elseif pVar[player:GetName()] == 17 then
  219. if (WType == 2 or WType == 3 or Wtype == 18) then
  220. item:ClearEnchantment(0, 0)
  221. item:SetEnchantment(intid, 0, 0)
  222. else
  223. player:SendAreaTriggerMessage("You do not have a Ranged equipped!")
  224. end
  225. end
  226. else
  227. item:ClearEnchantment(0, 0)
  228. item:SetEnchantment(intid, 0, 0)
  229. player:CastSpell(player, 36937)
  230. end
  231. else
  232. player:SendAreaTriggerMessage("You have no item to enchant in the selected slot!")
  233. end
  234. end
  235. end
  236. EnchanterSelect(event, player, unit, sender, pVar[player:GetName()], nil)
  237. end
  238. end
  239.  
  240. RegisterCreatureGossipEvent(npcid, 1, Enchanter)
  241. RegisterCreatureGossipEvent(npcid, 2, EnchanterSelect)
  242.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement