Advertisement
Mordred

Untitled

Nov 24th, 2011
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local Items = {
  2. [25]={12345,"chests",11291,15},
  3. [57]={23456,"boots",11291,10},
  4. [2734]={34567,"heads",11291,5}}
  5.  
  6. -- Structure:
  7. -- [intid]={itemid, classidtoenchant, itemidtocost, amount}
  8.  
  9. ...
  10. ... your code
  11. ...
  12.  
  13. if Items~=nil then
  14.     for k,l in pairs(Items) do
  15.         local name = WorldDBQuery("SELECT ´name1´ FROM ´items´ WHERE entry = "..Items[v][1]):GetColumn(0):GetString()
  16.         pUnit:GossipMenuAddItem(4, "Create a scroll to enchant your "..Items[l][2]..".      (Costs "..Items[l][4].." "..name..".)", Items[k], 0)
  17.     end
  18. end
  19.  
  20. ...
  21. ... your code
  22. ...
  23.  
  24. if Items~=nil then
  25.     for n,v in pairs(Items) do if intid==n then
  26.         if player:GetItemCount(Items[v][3]) >= Items[v][4] then
  27.             player:CastSpell(32990)
  28.             player:RemoveItem(Items[v][3], Items[v][4])
  29.             player:AddItem(Items[v][1], 1)
  30.         else
  31.             local name = WorldDBQuery("SELECT ´name1´ FROM ´items´ WHERE entry = "..Items[v][1]):GetColumn(0):GetString()
  32.             player:SendBroadcastMessage("You do not have enough "..name..".")
  33.         end
  34.     end end
  35. end
  36.  
  37.  
  38. So if I would now look at the gossip screen of the NPC, I would see 3 menu items I could pic:
  39.  
  40. Create a scroll to enchant your chests.      (Costs 15 Wood.)   --> adds item 12345
  41. Create a scroll to enchant your boots.      (Costs 10 Wood.)    --> adds item 23456
  42. Create a scroll to enchant your heads.      (Costs 5 Wood.) --> adds item 34567
  43.  
  44.  
  45.  
  46.  
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement