Advertisement
Guest User

SpellVendor.lua

a guest
Aug 18th, 2019
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.51 KB | None | 0 0
  1. local SMSG_NPC_TEXT_UPDATE = 384
  2. local MAX_GOSSIP_TEXT_OPTIONS = 8
  3.  
  4. function Player:GossipSetText(text, textID)
  5. local data = CreatePacket(SMSG_NPC_TEXT_UPDATE, 100);
  6. data:WriteULong(textID or 0x7FFFFFFF)
  7. for i = 1, MAX_GOSSIP_TEXT_OPTIONS do
  8. data:WriteFloat(0) -- Probability
  9. data:WriteString(text) -- Text
  10. data:WriteString(text) -- Text
  11. data:WriteULong(0) -- language
  12. data:WriteULong(0) -- emote
  13. data:WriteULong(0) -- emote
  14. data:WriteULong(0) -- emote
  15. data:WriteULong(0) -- emote
  16. data:WriteULong(0) -- emote
  17. data:WriteULong(0) -- emote
  18. end
  19. self:SendPacket(data)
  20. end
  21.  
  22. local nEntry = 85000;
  23.  
  24. local GossipCat = {
  25. {"|TInterface\\icons\\Ability_warrior_offensivestance:30:30:-20|t|cFFFF0000 Guerrier|r", 100},
  26. }
  27.  
  28. local GossipTP = {
  29. -- E, M, X, Y, Z, O, NAME, ID
  30. {100, 13, 28.164017, -10.482026, -144.708603, 2.785897, "|TInterface\\icons\\Ability_warrior_titansgrip:30:30:-20|t|cFFFF0000 Poigne du titan|r", 101},
  31. {100, 0, 0, 0, 0, 0, "|TInterface\\icons\\Achievement_bg_returnxflags_def_wsg:30:30:-20|t|cFFFFFFE0 Retour|r", 0},
  32. --
  33. }
  34.  
  35. local function onGossipHello(event, player, object)
  36. for i=1, #GossipCat do
  37. player:GossipMenuAddItem(9, GossipCat[i][1], 0, GossipCat[i][2])
  38. end
  39. player:GossipSetText(" |cFF556B2F [ |cFFFF0000Enchanté |cFF556B2F"..player:GetName().."|cFFFF0000, que puis-je faire pour toi ? |cFF556B2F]")
  40. player:GossipSendMenu(0x7FFFFFFF, object)
  41. end
  42. RegisterCreatureGossipEvent(nEntry, 1, onGossipHello)
  43.  
  44. local function onGossipSelect(event, player, object, sender, intid, code)
  45. for i=1, #GossipCat do
  46. if intid == GossipCat[i][2] then
  47. for j=1, #GossipTP do
  48. if GossipCat[i][2] == GossipTP[j][1] then
  49. player:GossipMenuAddItem(9, GossipTP[j][7], 0, GossipTP[j][8])
  50. end
  51. end
  52. player:GossipSetText(" ")
  53. player:GossipSendMenu(0x7FFFFFFF, object)
  54. end
  55. end
  56. for j=1, #GossipTP do
  57. if intid == GossipTP[j][8] and GossipTP[j][8] == 0 then
  58. onGossipHello(event, player, object)
  59. elseif intid == GossipTP[j][8] then
  60. player:Teleport(GossipTP[j][2], GossipTP[j][3], GossipTP[j][4], GossipTP[j][5], GossipTP[j][6])
  61. end
  62. end
  63. end
  64. RegisterCreatureGossipEvent(nEntry, 2, onGossipSelect)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement