Advertisement
Guest User

Buy Experience NPC

a guest
Jun 5th, 2011
730
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.70 KB | None | 0 0
  1. -- Buy Experience NPC v2 --
  2. -- Scripted by Furball   --
  3. -- Idea by QQrofl        --
  4. -- www.ac-web.org        --
  5.  
  6. --NPC CONFIG--
  7. local EntryID = 50000          -- The entry ID of the npc. Used for spawning the experience npc. [DEFAULT: 50000]
  8.  
  9. --SPAWN CONFIG--
  10. local SpawnCommand = "#buy xp" -- When typed in-game, the Buy Experience NPC will spawn. [DEFAULT: "#buy xp"] [DO NOT REMOVE THE QUOTES]
  11. local TimeNPC = 30             -- Time, in seconds, that the NPC will be spawned for. It will despawn after the timer runs out. [DEFAULT: 30]
  12.  
  13. --SERVER CONFIG--
  14. local LevelCap = 80            -- The maximum level you can obtain on your realm. [DEFAULT: 80]
  15. local SrvrName = "ExampleWoW"  -- The name of your server.
  16.  
  17. --PRICE CONFIG--
  18. local Gold1k = 1               -- Amount of gold you need to buy 1,000 experience [DEFAULT: 1]
  19. local Gold10k = 10             -- Amount of gold you need to buy 10,000 experience [DEFAULT: 10]
  20. local Gold100k = 100           -- Amount of gold you need to buy 100,000 experience [DEFAULT: 100]
  21. local Gold500k = 500           -- Amount of gold you need to buy 500,000 experience [DEFAULT: 500]
  22. local Gold1m = 1000            -- Amount of gold you need to buy 1,000,000 experience [DEFAULT: 1000]
  23. local Gold5m = 5000            -- Amount of gold you need to buy 5,000,000 experience [DEFAULT: 5000]
  24.  
  25. --[[GOLD AND TIME CONVERSIONS - DO NOT EDIT]]--
  26. local DontModify = TimeNPC * 600
  27. local DontModify2 = Gold1k * 10000
  28. local DontModify3 = Gold10k * 10000
  29. local DontModify4 = Gold100k * 10000
  30. local DontModify5 = Gold500k * 10000
  31. local DontModify6 = Gold1m * 10000
  32. local DontModify7 = Gold5m * 10000
  33. -----------------------------------------------
  34. function Spawn_OnChat(event, player, message, type, language)
  35.     local Mess = message:lower()
  36.         if (Mess:find(SpawnCommand) == 1) then
  37.             if (player:GetPlayerLevel() == LevelCap) then
  38.                 player:SendBroadcastMessage("You are already level "..LevelCap.."!")
  39.                 return 0
  40.             else
  41.                 player:SpawnCreature(EntryID, player:GetX(), player:GetY(), player:GetZ(), player:GetO(), 35, DontModify, player:GetPhase())
  42.                 player:SendBroadcastMessage("Success! The experience vendor will despawn in "..TimeNPC.." seconds.")
  43.                 return 0
  44.             end
  45.         end
  46. end
  47.  
  48. function XPGossip(Unit, event, player)
  49.     if (player:GetPlayerLevel() == LevelCap) then
  50.         Unit:SendChatMessageToPlayer(15, 0, "You are already level "..LevelCap.."!", player) -- Whispering the player.
  51.         player:GossipComplete()
  52.     else
  53.     Unit:GossipCreateMenu(100, player, 0)
  54.     Unit:GossipMenuAddItem(9, "1,000 XP ["..Gold1k.."g]", 1, 0)
  55.     Unit:GossipMenuAddItem(9, "10,000 XP ["..Gold10k.."g]", 2, 0)
  56.     Unit:GossipMenuAddItem(9, "100,000 XP ["..Gold100k.."g]", 3, 0)
  57.     Unit:GossipMenuAddItem(9, "500,000 XP ["..Gold500k.."g]", 4, 0)
  58.     Unit:GossipMenuAddItem(9, "1,000,000 XP ["..Gold1m.."g]", 5, 0)
  59.     Unit:GossipMenuAddItem(9, "5,000,000 XP ["..Gold5m.."g]", 6, 0)
  60.     Unit:GossipMenuAddItem(9, "[Nevermind]", 999, 0)
  61.     Unit:GossipSendMenu(player)
  62.     end
  63. end
  64.  
  65. function XPGossip_OnSelect(Unit, event, player, code, intid, id)
  66.     if(intid == 998) then -- [Back]
  67.         Unit:GossipCreateMenu(100, player, 0)
  68.         Unit:GossipMenuAddItem(9, "1,000 XP ["..Gold1k.."g]", 1, 0)
  69.         Unit:GossipMenuAddItem(9, "10,000 XP ["..Gold10k.."g]", 2, 0)
  70.         Unit:GossipMenuAddItem(9, "100,000 XP ["..Gold100k.."g]", 3, 0)
  71.         Unit:GossipMenuAddItem(9, "500,000 XP ["..Gold500k.."g]", 4, 0)
  72.         Unit:GossipMenuAddItem(9, "1,000,000 XP ["..Gold1m.."g]", 5, 0)
  73.         Unit:GossipMenuAddItem(9, "5,000,000 XP ["..Gold5m.."g]", 6, 0)
  74.         Unit:GossipMenuAddItem(9, "[Nevermind]", 999, 0)
  75.         Unit:GossipSendMenu(player)
  76.     end
  77.    
  78.     if(intid == 999) then -- [Nevermind]
  79.         Unit:SendChatMessage(14, 0, "Goodbye! Don't forget to vote for "..SrvrName.."!") -- Whispering to player
  80.         player:GossipComplete()
  81.     end
  82.    
  83.     if(intid == 1) then -- 1,000 Experience
  84.         if(player:GetCoinage() <= DontModify2) then
  85.             Unit:SendChatMessage(14, 0, "You don't have "..Gold1k.." gold.")
  86.             Unit:GossipCreateMenu(100, player, 0)
  87.             Unit:GossipMenuAddItem(9, "[Back]", 998, 0)
  88.             Unit:GossipSendMenu(player)
  89.         else
  90.         player:DealGoldCost(DontModify2)
  91.         player:GiveXp(1000) -- Giving 1,000 XP
  92.         Unit:SendChatMessage(14, 0, "Success! You've bought 1,000 experience for "..Gold1k.." gold.")
  93.             Unit:GossipCreateMenu(100, player, 0)
  94.             Unit:GossipMenuAddItem(9, "[Back]", 998, 0)
  95.             Unit:GossipSendMenu(player)
  96.     end
  97.         end
  98.    
  99.     if(intid == 2) then -- 10,000 Experience
  100.         if(player:GetCoinage() <= DontModify3) then
  101.             Unit:SendChatMessage(14, 0, "You don't have "..Gold10k.." gold.")
  102.             Unit:GossipCreateMenu(100, player, 0)
  103.             Unit:GossipMenuAddItem(9, "[Back]", 998, 0)
  104.             Unit:GossipSendMenu(player)
  105.         else
  106.         player:DealGoldCost(DontModify3)
  107.         player:GiveXp(10000)
  108.         Unit:SendChatMessage(14, 0, "Success! You've bought 10,000 experience for "..Gold10k.." gold.")
  109.             Unit:GossipCreateMenu(100, player, 0)
  110.             Unit:GossipMenuAddItem(9, "[Back]", 998, 0)
  111.             Unit:GossipSendMenu(player)
  112.     end
  113.         end
  114.    
  115.     if(intid == 3) then -- 100,000 Experience
  116.         if(player:GetCoinage() <= DontModify4) then
  117.             Unit:SendChatMessage(14, 0, "You don't have "..Gold100k.." gold.")
  118.             Unit:GossipCreateMenu(100, player, 0)
  119.             Unit:GossipMenuAddItem(9, "[Back]", 998, 0)
  120.             Unit:GossipSendMenu(player)
  121.         else
  122.         player:DealGoldCost(DontModify4)
  123.         player:GiveXp(100000)
  124.         Unit:SendChatMessage(14, 0, "Success! You've bought 100,000 experience for "..Gold100k.." gold.")
  125.             Unit:GossipCreateMenu(100, player, 0)
  126.             Unit:GossipMenuAddItem(9, "[Back]", 998, 0)
  127.             Unit:GossipSendMenu(player)
  128.         end
  129.     end
  130.    
  131.     if(intid == 4) then -- 500,000 Experience
  132.         if(player:GetCoinage() <= DontModify5) then
  133.             Unit:SendChatMessage(14, 0, "You don't have "..Gold500k.." gold.")
  134.             Unit:GossipCreateMenu(100, player, 0)
  135.             Unit:GossipMenuAddItem(9, "[Back]", 998, 0)
  136.             Unit:GossipSendMenu(player)
  137.         else
  138.         player:DealGoldCost(DontModify5)
  139.         player:GiveXp(500000)
  140.         Unit:SendChatMessage(14, 0, "Success! You've bought 500,000 experience for "..Gold500k.." gold.")
  141.             Unit:GossipCreateMenu(100, player, 0)
  142.             Unit:GossipMenuAddItem(9, "[Back]", 998, 0)
  143.             Unit:GossipSendMenu(player)
  144.         end
  145.     end
  146.    
  147.     if(intid == 5) then -- 1,000,000 Experience
  148.         if(player:GetCoinage() <= DontModify6) then
  149.             Unit:SendChatMessage(14, 0, "You don't have "..Gold1m.." gold.")
  150.             Unit:GossipCreateMenu(100, player, 0)
  151.             Unit:GossipMenuAddItem(9, "[Back]", 998, 0)
  152.             Unit:GossipSendMenu(player)
  153.         else
  154.         player:DealGoldCost(DontModify6)
  155.         player:GiveXp(1000000)
  156.         Unit:SendChatMessage(14, 0, "Success! You've bought 1,000,000 experience for "..Gold1m.." gold.")
  157.             Unit:GossipCreateMenu(100, player, 0)
  158.             Unit:GossipMenuAddItem(9, "[Back]", 998, 0)
  159.             Unit:GossipSendMenu(player)
  160.         end
  161.     end
  162.    
  163.     if(intid == 6) then -- 5,000,000 Experience
  164.         if(player:GetCoinage() <= DontModify7) then
  165.             Unit:SendChatMessage(14, 0, "You don't have "..Gold5m.." gold.")
  166.             Unit:GossipCreateMenu(100, player, 0)
  167.             Unit:GossipMenuAddItem(9, "[Back]", 998, 0)
  168.             Unit:GossipSendMenu(player)
  169.         else
  170.         player:DealGoldCost(DontModify7)
  171.         player:GiveXp(5000000)
  172.         Unit:SendChatMessage(14, 0, "Success! You've bought 5,000,000 experience for "..Gold5m.." gold.")
  173.             Unit:GossipCreateMenu(100, player, 0)
  174.             Unit:GossipMenuAddItem(9, "[Back]", 998, 0)
  175.             Unit:GossipSendMenu(player)
  176.         end
  177.     end
  178. end
  179. RegisterServerHook(16, "Spawn_OnChat")
  180. RegisterUnitGossipEvent(EntryID, 1, "XPGossip")
  181. RegisterUnitGossipEvent(EntryID, 2, "XPGossip_OnSelect")
  182.  
  183. --[[ PREMADE NPC SQL[Tested on ArcEmu r4005] [RUN THIS SCRIPT INTO THE WORLD DATABASE FOR YOUR SERVER]
  184. insert into `creature_names` (`entry`, `name`, `subname`, `info_str`, `Flags1`, `type`, `family`, `rank`, `killcredit1`, `killcredit2`, `male_displayid`, `female_displayid`, `male_displayid2`, `female_displayid2`, `unknown_float1`, `unknown_float2`, `leader`)
  185. values ('50000', "The XP Master", "Buy Experience Here!", '', '0', '7', '0', '1', '0', '0', '28213', '0', '0', '0', '1', '1', '0');
  186.  
  187. insert into `creature_proto` (`entry`, `minlevel`, `maxlevel`, `faction`, `minhealth`, `maxhealth`, `mana`, `scale`, `npcflags`, `attacktime`, `attacktype`, `mindamage`, `maxdamage`, `can_ranged`, `rangedattacktime`, `rangedmindamage`, `rangedmaxdamage`, `respawntime`, `armor`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `combat_reach`, `bounding_radius`, `auras`, `boss`, `money`, `invisibility_type`, `walk_speed`, `run_speed`, `fly_speed`, `extra_a9_flags`, `spell1`, `spell2`, `spell3`, `spell4`, `spell_flags`, `modImmunities`, `summonguard`)
  188. values ('50000', '80', '80', '35', '10000', '80000', '87906', '2', '1', '2000', '0', '5000', '15000', '0', '0', '0', '0', '30000', '5000', '0', '0', '0', '0', '0', '0', '0', '0', "0", '0', '0', '0', '2.50', '8.00', '14.00', '0', '0', '0', '0', '0', '0', '0', '0');
  189. ]]--
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement