Guest User

Untitled

a guest
Jun 18th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.87 KB | None | 0 0
  1. #include "ScriptPCH.h"
  2.  
  3. class level_NPC : public CreatureScript
  4. {
  5. public:
  6.     level_NPC() : CreatureScript("level_NPC") { } // Script name for DB = level_NPC
  7.  
  8.     // Menu
  9.     bool OnGossipHello (Player* player, Creature* npc)
  10.     {
  11.         //                    Icon,             Text,                                     ID (has to be unique)
  12.         player->ADD_GOSSIP_ITEM(4, "I would like to gain level 70.", GOSSIP_SENDER_MAIN, 1339);
  13.         player->ADD_GOSSIP_ITEM(4, "I would like to gain level 80.", GOSSIP_SENDER_MAIN, 1340);
  14.         player->ADD_GOSSIP_ITEM(2, "Teleport menu, 70 malls.", GOSSIP_SENDER_MAIN, 1341);
  15.         player->ADD_GOSSIP_ITEM(0, "Close menu.", GOSSIP_SENDER_MAIN, 1343);
  16.         player->PlayerTalkClass->SendGossipMenu(907, npc->GetGUID()); // TextID = 907 (check DB "npc_text" table for editing)
  17.         return true;
  18.     }
  19.  
  20.  
  21.     // Handlers
  22.     bool OnGossipSelect(Player* player, Creature* npc, uint32 uiSender, uint32 uiAction)
  23.         {
  24.  
  25.         WorldSession * m_session = player->GetSession();
  26.        
  27.         player->PlayerTalkClass->ClearMenus();
  28.  
  29.         if (uiSender == GOSSIP_SENDER_MAIN)
  30.         {
  31.             switch(uiAction)
  32.             {
  33.  
  34.  
  35.             case 1339: // Level 70
  36.                 if (player->getLevel() < 70) // If player has lower level than 70, continue
  37.                 {
  38.                     player->CLOSE_GOSSIP_MENU(); // Close menu
  39.                     player->SetLevel(70); // Levelup
  40.                     player->InitStatsForLevel(true); // Update stats
  41.                     player->InitGlyphsForLevel(); // Update glyphs
  42.                     player->UpdateSkillsForLevel(); // Maxskills
  43.                     player->resetTalents(true); // Reset talents
  44.                     player->SendTalentsInfoData(false); // Show talentpoints for player
  45.                         Pet* pet = player->GetPet(); // Player pet
  46.                         Pet::resetTalentsForAllPetsOf(player, pet);
  47.                         if (pet)
  48.                         player->SendTalentsInfoData(true);
  49.                     player->SaveToDB(); // Save player
  50.                     npc->MonsterWhisper("You are now level 70.", player->GetGUID(), true);
  51.                     return true;
  52.                 }
  53.                 else // If player already is level 70 or above
  54.                     player->CLOSE_GOSSIP_MENU();
  55.                     npc->MonsterWhisper("You are already level 70 or above!", player->GetGUID());
  56.                     return false;
  57.                 break;
  58.  
  59.  
  60.             case 1340: // Level 80
  61.                 if (player->getLevel() < 80) // If player has lower level than 80, continue
  62.                 {
  63.                     player->CLOSE_GOSSIP_MENU(); // Close menu
  64.                     player->SetLevel(80); // Levelup
  65.                     player->InitStatsForLevel(true); // Update stats
  66.                     player->InitGlyphsForLevel(); // Update glyphs
  67.                     player->UpdateSkillsForLevel(); // Maxskills
  68.                     player->resetTalents(true); // Reset talents
  69.                     player->SendTalentsInfoData(false); // Show talentpoints for player
  70.                         Pet* pet = player->GetPet(); // Player pet
  71.                         Pet::resetTalentsForAllPetsOf(player, pet);
  72.                         if (pet)
  73.                         player->SendTalentsInfoData(true);
  74.                     player->SaveToDB(); // Save player
  75.                     npc->MonsterWhisper("You are now level 80.", player->GetGUID(), true);
  76.                     return true;
  77.                 }
  78.                 else // If player already is level 80 or above
  79.                     player->CLOSE_GOSSIP_MENU();
  80.                     npc->MonsterWhisper("You are already level 80!", player->GetGUID());
  81.                     return false;
  82.                 break;
  83.  
  84.  
  85.             case 1341: // Teleport menu
  86.                     player->ADD_GOSSIP_ITEM(2, "I would like to go to the lvl 70 mall.", GOSSIP_SENDER_MAIN, 1343);
  87.                     player->PlayerTalkClass->SendGossipMenu(907, npc->GetGUID()); // TextID = 907 (check DB "npc_text" table for editing)
  88.                     return true;
  89.  
  90.  
  91.             case 1342: // 70 mall (currently set to Shattrath, pull out coords from game_tele @ db to avoid any issues (could get them by .gps))
  92.                     player->CLOSE_GOSSIP_MENU();   
  93.                     player->TeleportTo(530, -1838,16f, 5301,79f, -12,428f, 5,9517f); // MapID, X float, Y float, Z float, O float
  94.                     return true;
  95.                     break;
  96.  
  97.                
  98.             case 1343: // Close menu
  99.                     player->CLOSE_GOSSIP_MENU();
  100.                     return true;
  101.                 break;
  102.             }
  103.         }
  104.     }
  105. };
  106.  
  107. void AddSC_level_NPC()
  108. {
  109.     new level_NPC();
  110. }
Add Comment
Please, Sign In to add comment