Advertisement
Rochet2

GhostCrawler's givelevel

Jul 12th, 2012
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.81 KB | None | 0 0
  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(1 Token)", GOSSIP_SENDER_MAIN, 1);
  15.         pPlayer->ADD_GOSSIP_ITEM(10, "Level 20(2 Tokens)", GOSSIP_SENDER_MAIN, 2);
  16.         pPlayer->ADD_GOSSIP_ITEM(10, "Level 30(3 Tokens)", GOSSIP_SENDER_MAIN, 3);
  17.         pPlayer->ADD_GOSSIP_ITEM(10, "Level 40(4 Tokens)", GOSSIP_SENDER_MAIN, 4);
  18.         pPlayer->ADD_GOSSIP_ITEM(10, "Level 50(5 Tokens)", GOSSIP_SENDER_MAIN, 5);
  19.         pPlayer->ADD_GOSSIP_ITEM(10, "Level 60(6 Tokens)", GOSSIP_SENDER_MAIN, 6);
  20.         pPlayer->ADD_GOSSIP_ITEM(10, "Level 70(7 Tokens)", GOSSIP_SENDER_MAIN, 7);
  21.         pPlayer->ADD_GOSSIP_ITEM(10, "Level 80(8 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, true))
  32.             {
  33.                 pPlayer->SetLevel(uiAction*10); // changed to setlevel, give level gives X amount of levels I think.
  34.                 pPlayer->DestroyItemCount(TOKEN_ID, uiAction, true);
  35.                 pPlayer->GetSession()->SendAreaTriggerMessage("You are now Level %u!", uiAction*10);
  36.                 pPlayer->PlayerTalkClass->SendCloseGossip();
  37.                 return true;
  38.             }
  39.             else
  40.                 pPlayer->GetSession()->SendNotification("You don't have the required token");
  41.         OnGossipHello(pPlayer, _creature);
  42.         return true;
  43.     }
  44. };
  45. void AddSC_Level_NPC()
  46. {
  47.     new Level_NPC();
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement