Advertisement
Clotic

[Eluna] Enchanter

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