Advertisement
Guest User

Chijje

a guest
Feb 10th, 2010
396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.66 KB | None | 0 0
  1. -- Created by Chijje
  2.  
  3. local NPC_ID = ID                   -- The ID of the NPC that the script is written for
  4. local currency = ID                 -- The ID of the Item that should be used as the betting currency
  5. local currencyname = "NAME"             -- The name of the Item that's being used as the currency
  6. local wheretoobtain = EntryID                   -- The Entry ID of the text (found in NPC_TEXT)
  7.  
  8.                         -- The arrays that holds the items that you can win
  9. local array5 = { 38679, 38768, 38766, 38767, 38770, 38771, 38773, 38775, 38777, 38780, 38772, 38787, 38790, 38782, 38785, 38784, 38793, 38792, 38798, 38794, 38796, 38799, 38803, 38769, 38774, 38778, 38776, 38779, 38781, 38788, 38789, 38791, 38783, 38786, 38795, 38797, 38802, 38801, 38800, 38804, 38806, 38805, 38807, 38808, 38809, 38810, 38811, 38812, 38815, 38813, 38814, 38817, 38816, 38818, 38819, 38876, 38820, 38821, 38822, 38824, 38823, 38825, 38826, 38829, 38827, 38828, 38830, 38831, 38832, 38833, 45628, 38837, 38835, 38834, 38836, 38841, 38839, 38840, 38844, 38842, 38843, 38845, 38846, 38849, 38847, 38848, 38851, 38850, 38852, 38852, 38858, 38861, 38838, 38853, 38856, 38864, 38866, 38860, 38859, 38868, 38896, 38881, 38867, 38880, 38879, 38869, 38863, 38854, 38857, 38872, 38875, 38874, 38938, 38882, 38855, 38865, 38929, 38895, 38891, 38892, 38893, 38894, 38888, 38887, 38889, 38886, 38890, 38885, 38873, 38878, 38871, 38884, 38883, 38877, 38870, 38908, 38897, 38937, 38931, 38940, 38914, 38934, 38904, 38898, 38911, 38909, 38899, 38928, 38900, 38939, 38905, 38945, 38915, 38949, 38901, 37603, 38933, 38906, 38918, 38917, 38913, 38930, 38998, 38947, 38912, 44456, 38919, 38902, 38941, 38942, 38936, 38946, 38921, 38920, 38922, 38944, 38943, 38935, 38932, 38907, 38927, 38926, 38903, 38999, 38910, 38923, 39000, 38948, 38925, 38924, 38973, 38959, 38982, 38969, 38950, 38956, 38977, 44457, 39003, 39001, 38978, 38993, 39004, 38989, 38955, 39002, 38975, 38962, 39005, 44465, 38971, 38968, 38997, 38987, 38984, 38980, 44815, 44470, 44947, 44453, 45060, 44497, 44493, 44946, 43987, 45056, 46026, 46098, 44455, 38991, 38992, 38995, 38963, 38954, 38965, 38972, 44463, 38981, 38988, 44467, 44466, 44449, 38966, 38986, 38974, 38961, 38976, 44469, 39006, 38979, 38960, 50816, 38964, 38985, 38951, 38953, 38967, 44458, 38990 }
  10. local array50 = { 38973, 38959, 38982, 38969, 38950, 38956, 38977, 44457, 39003, 39001, 38978, 38993, 39004, 38989, 38955, 39002, 38975, 38962, 39005, 44465, 38971, 38968, 38997, 38987, 38984, 38980, 44815, 44470, 44947, 44453, 45060, 44497, 44493, 44946, 43987, 45056, 46026, 46098, 44455, 38991, 38992, 38995, 38963, 38954, 38965, 38972, 44463, 38981, 38988, 44467, 44466, 44449, 38966, 38986, 38974, 38961, 38976, 44469, 39006, 38979, 38960, 50816, 38964, 38985, 38951, 38953, 38967, 44458, 38990 }
  11. local arrayback = { 38973, 38959, 38982, 38969, 38950, 38956, 38977, 44457, 39003, 39001, 38978, 38993, 39004 }
  12. local arraychest = { 38989, 38955, 39002, 38975, 38962, 39005, 44465 }
  13. local arraywrist = { 38971, 38968, 38997, 38987, 38984, 38980, 44815, 44470, 44947 }
  14. local arrayhand = { 38979, 38960, 50816, 38964, 38985, 38951, 38953, 38967, 44458, 38990 }
  15. local arrayfeet = { 44449, 38966, 38986, 38974, 38961, 38976, 44469, 39006 }
  16. local arrayweapon = { 44453, 45060, 44497, 44493, 44946, 43987, 45056, 46026, 46098, 44455, 38991, 38992, 38995, 38963, 38954, 38965, 38972, 44463, 38981, 38988, 44467, 44466 }
  17.  
  18.  
  19. function Dealer_On_Gossip(unit, event, player)
  20. if (player:IsPlayer() == true) then
  21.     unit:GossipCreateMenu(1, player, 0)
  22.     unit:GossipMenuAddItem(7, "How do I obtain these " .. currencyname .. "?", 1, 0)
  23.     unit:GossipMenuAddItem(1, "I want to bet 5 " .. currencyname .. " for a 50% chance to win a random Scroll of Enchant (ALL ENCHANTS)", 2, 0)
  24.     unit:GossipMenuAddItem(1, "I want to bet 50 " .. currencyname .. " for a 50% chance to win a random Scroll of Enchant (WOTLK)", 3, 0)
  25.     unit:GossipMenuAddItem(1, "I want to bet 80 " .. currencyname .. " for a 50% chance to win a random Scroll of Enchant (WOTLK) where I decide what kind of enchant I want to win (ex bracer-, chest- or weaponenchant)", 4, 0)
  26.     unit:GossipSendMenu(player)
  27.     end
  28. end
  29.  
  30. function Dealer_Gossip_Submenus(unit, event, player, id, intid, code)
  31. if(intid ==1) then
  32.     unit:GossipCreateMenu(wheretoobtain, player, 0)
  33.     unit:GossipSendMenu(player)
  34.     end
  35.  
  36. if(intid ==2) then                                                                         
  37.     if (player:GetItemCount(currency) < 5) then
  38.         player:SendAreaTriggerMessage("You don't have the required amount of " .. currencyname)
  39.         player:GossipComplete()
  40.     else
  41.         random0=math.random(1, 2)
  42.         if random0 == 1 then
  43.             player:SendAreaTriggerMessage("You've won!")
  44.             random = math.random(1, table.getn(array5))
  45.             player:AddItem(array5[random], 1)
  46.             player:RemoveItem(currency, 5)
  47.             player:GossipComplete()
  48.  
  49.             else
  50.                 player:SendAreaTriggerMessage("Too bad, you've lost. Better luck next time!")
  51.                 player:RemoveItem(currency, 5)
  52.                 player:GossipComplete()
  53.             end
  54.         end
  55.     end
  56.  
  57. if(intid == 3) then                
  58.     if(player:GetItemCount(currency) < 50) then
  59.         player:SendAreaTriggerMessage("You don't have the required amount of " .. currencyname)
  60.         player:GossipComplete()
  61.     else
  62.         random0=math.random(1, 2)
  63.         if random0 == 1 then
  64.             player:SendAreaTriggerMessage("You've won!")
  65.             random = math.random(1, table.getn(array50))
  66.             player:AddItem(array50[random], 1)
  67.             player:RemoveItem(currency, 50)
  68.             player:GossipComplete()
  69.  
  70.             else
  71.                 player:SendAreaTriggerMessage("Too bad, you've lost. Better luck next time!")
  72.                 player:RemoveItem(currency, 50)
  73.                 player:GossipComplete()
  74.             end
  75.         end
  76.     end
  77.  
  78. if(intid == 4) then                
  79.     if(player:GetItemCount(currency) < 80) then
  80.         player:SendAreaTriggerMessage("You don't have the required amount of " .. currencyname)
  81.         player:GossipComplete()
  82.     else
  83.         random0=math.random(1, 2)
  84.         if random0 == 1 then
  85.             player:SendAreaTriggerMessage("You've won, what type of enchant do you wish to have?")
  86.             unit:GossipCreateMenu(1, player, 0)
  87.             unit:GossipMenuAddItem(1, "Cloak enchant", 7, 0)
  88.             unit:GossipMenuAddItem(1, "Chest enchant", 8, 0)
  89.             unit:GossipMenuAddItem(1, "Bracers enchant", 9, 0)
  90.             unit:GossipMenuAddItem(1, "Gloves enchant", 10, 0)
  91.             unit:GossipMenuAddItem(1, "Boots enchant", 12, 0)
  92.             unit:GossipMenuAddItem(1, "Weapon & Shield enchant", 13, 0)
  93.             unit:GossipSendMenu(player)
  94.  
  95.             else
  96.                 player:SendAreaTriggerMessage("Too bad, you've lost. Better luck next time!")
  97.                 player:RemoveItem(currency, 80)
  98.                 player:GossipComplete()
  99.             end
  100.         end
  101.     end
  102.             if(intid == 7) then
  103.             random = math.random(1, table.getn(arrayback))
  104.             player:AddItem(arrayback[random], 1)
  105.             player:RemoveItem(currency, 80)
  106.             player:GossipComplete()
  107.             end
  108.             if(intid == 8) then
  109.             random = math.random(1, table.getn(arraychest))
  110.             player:AddItem(arraychest[random], 1)
  111.             player:RemoveItem(currency, 80)
  112.             player:GossipComplete()
  113.             end
  114.             if(intid == 9) then
  115.             random = math.random(1, table.getn(arraywrist))
  116.             player:AddItem(arraywrist[random], 1)
  117.             player:RemoveItem(currency, 80)
  118.             player:GossipComplete()
  119.             end
  120.             if(intid == 10) then
  121.             random = math.random(1, table.getn(arrayhand))
  122.             player:AddItem(arrayhand[random], 1)
  123.             player:RemoveItem(currency, 80)
  124.             player:GossipComplete()
  125.             end
  126.             if(intid == 12) then
  127.             random = math.random(1, table.getn(arrayfeet))
  128.             player:AddItem(arrayfeet[random], 1)
  129.             player:RemoveItem(currency, 80)
  130.             player:GossipComplete()
  131.             end
  132.             if(intid == 13) then
  133.             random = math.random(1, table.getn(arrayweapon))
  134.             player:AddItem(arrayweapon[random], 1)
  135.             player:RemoveItem(currency, 80)
  136.             player:GossipComplete()
  137. end
  138. end
  139. RegisterUnitGossipEvent(NPC_ID, 1, "Dealer_On_Gossip")
  140. RegisterUnitGossipEvent(NPC_ID, 2, "Dealer_Gossip_Submenus")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement