Advertisement
Rochet2

Untitled

Aug 20th, 2012
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Original script by Ghostcrawler336
  2.  
  3. #include "ScriptPCH.h"
  4. #define TOKEN_ID   60007   // Replace 60007 to YOUR_TOKEN_ID
  5.  
  6. class Level_NPC : public CreatureScript
  7. {
  8. public:
  9.     Level_NPC() : CreatureScript("Level_NPC") {}
  10.  
  11.     bool OnGossipHello(Player* pPlayer, Creature* _creature)
  12.     {
  13.         pPlayer->ADD_GOSSIP_ITEM(7, "Welcome to the level NPC!", GOSSIP_SENDER_MAIN, 0);
  14.         pPlayer->ADD_GOSSIP_ITEM(10, "Level 10(10 Token)", GOSSIP_SENDER_MAIN, 1);
  15.         pPlayer->ADD_GOSSIP_ITEM(10, "Level 20(20 Tokens)", GOSSIP_SENDER_MAIN, 2);
  16.         pPlayer->ADD_GOSSIP_ITEM(10, "Level 30(30 Tokens)", GOSSIP_SENDER_MAIN, 3);
  17.         pPlayer->ADD_GOSSIP_ITEM(10, "Level 40(40 Tokens)", GOSSIP_SENDER_MAIN, 4);
  18.         pPlayer->ADD_GOSSIP_ITEM(10, "Level 50(50 Tokens)", GOSSIP_SENDER_MAIN, 5);
  19.         pPlayer->ADD_GOSSIP_ITEM(10, "Level 60(60 Tokens)", GOSSIP_SENDER_MAIN, 6);
  20.         pPlayer->ADD_GOSSIP_ITEM(10, "Level 70(70 Tokens)", GOSSIP_SENDER_MAIN, 7);
  21.         pPlayer->ADD_GOSSIP_ITEM(10, "Level 80(80 Tokens)", GOSSIP_SENDER_MAIN, 8);
  22.  
  23.         pPlayer->PlayerTalkClass->SendGossipMenu(907, _creature->GetGUID());
  24.         return true;
  25.     }
  26.  
  27.     bool OnGossipSelect(Player* pPlayer, Creature* _creature, uint32 uiSender, uint32 uiAction)
  28.     {
  29.         pPlayer->PlayerTalkClass->ClearMenus();
  30.         if(uiAction != 0)
  31.             if (pPlayer->HasItemCount(TOKEN_ID, uiAction*10, false))
  32.             {
  33.                 uint8 newlevel = pPlayer->getLevel()+uiAction*10;
  34.                 if(newlevel > 80)
  35.                     newlevel = 80;
  36.                 pPlayer->GiveLevel(newlevel);
  37.                 pPlayer->InitTalentForLevel();
  38.                 pPlayer->SetUInt32Value(PLAYER_XP, 0);
  39.                 pPlayer->DestroyItemCount(TOKEN_ID, uiAction*10, true);
  40.                 pPlayer->GetSession()->SendAreaTriggerMessage("You are now Level %u!", newlevel);
  41.                 pPlayer->PlayerTalkClass->SendCloseGossip();
  42.                 return true;
  43.             }
  44.             else
  45.                 pPlayer->GetSession()->SendNotification("You don't have the required token");
  46.         OnGossipHello(pPlayer, _creature);
  47.         return true;
  48.     }
  49. };
  50. void AddSC_Level_NPC()
  51. {
  52.     new Level_NPC();
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement