Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ScriptPCH.h"
- class level_NPC : public CreatureScript
- {
- public:
- level_NPC() : CreatureScript("level_NPC") { } // Script name for DB = level_NPC
- // Menu
- bool OnGossipHello (Player* player, Creature* npc)
- {
- // Icon, Text, ID (has to be unique)
- player->ADD_GOSSIP_ITEM(4, "I would like to gain level 70.", GOSSIP_SENDER_MAIN, 1339);
- player->ADD_GOSSIP_ITEM(4, "I would like to gain level 80.", GOSSIP_SENDER_MAIN, 1340);
- player->ADD_GOSSIP_ITEM(2, "Teleport menu, 70 malls.", GOSSIP_SENDER_MAIN, 1341);
- player->ADD_GOSSIP_ITEM(0, "Close menu.", GOSSIP_SENDER_MAIN, 1343);
- player->PlayerTalkClass->SendGossipMenu(907, npc->GetGUID()); // TextID = 907 (check DB "npc_text" table for editing)
- return true;
- }
- // Handlers
- bool OnGossipSelect(Player* player, Creature* npc, uint32 uiSender, uint32 uiAction)
- {
- WorldSession * m_session = player->GetSession();
- player->PlayerTalkClass->ClearMenus();
- if (uiSender == GOSSIP_SENDER_MAIN)
- {
- switch(uiAction)
- {
- case 1339: // Level 70
- if (player->getLevel() < 70) // If player has lower level than 70, continue
- {
- player->CLOSE_GOSSIP_MENU(); // Close menu
- player->SetLevel(70); // Levelup
- player->InitStatsForLevel(true); // Update stats
- player->InitGlyphsForLevel(); // Update glyphs
- player->UpdateSkillsForLevel(); // Maxskills
- player->resetTalents(true); // Reset talents
- player->SendTalentsInfoData(false); // Show talentpoints for player
- Pet* pet = player->GetPet(); // Player pet
- Pet::resetTalentsForAllPetsOf(player, pet);
- if (pet)
- player->SendTalentsInfoData(true);
- player->SaveToDB(); // Save player
- npc->MonsterWhisper("You are now level 70.", player->GetGUID(), true);
- return true;
- }
- else // If player already is level 70 or above
- player->CLOSE_GOSSIP_MENU();
- npc->MonsterWhisper("You are already level 70 or above!", player->GetGUID());
- return false;
- break;
- case 1340: // Level 80
- if (player->getLevel() < 80) // If player has lower level than 80, continue
- {
- player->CLOSE_GOSSIP_MENU(); // Close menu
- player->SetLevel(80); // Levelup
- player->InitStatsForLevel(true); // Update stats
- player->InitGlyphsForLevel(); // Update glyphs
- player->UpdateSkillsForLevel(); // Maxskills
- player->resetTalents(true); // Reset talents
- player->SendTalentsInfoData(false); // Show talentpoints for player
- Pet* pet = player->GetPet(); // Player pet
- Pet::resetTalentsForAllPetsOf(player, pet);
- if (pet)
- player->SendTalentsInfoData(true);
- player->SaveToDB(); // Save player
- npc->MonsterWhisper("You are now level 80.", player->GetGUID(), true);
- return true;
- }
- else // If player already is level 80 or above
- player->CLOSE_GOSSIP_MENU();
- npc->MonsterWhisper("You are already level 80!", player->GetGUID());
- return false;
- break;
- case 1341: // Teleport menu
- player->ADD_GOSSIP_ITEM(2, "I would like to go to the lvl 70 mall.", GOSSIP_SENDER_MAIN, 1343);
- player->PlayerTalkClass->SendGossipMenu(907, npc->GetGUID()); // TextID = 907 (check DB "npc_text" table for editing)
- return true;
- case 1342: // 70 mall (currently set to Shattrath, pull out coords from game_tele @ db to avoid any issues (could get them by .gps))
- player->CLOSE_GOSSIP_MENU();
- player->TeleportTo(530, -1838,16f, 5301,79f, -12,428f, 5,9517f); // MapID, X float, Y float, Z float, O float
- return true;
- break;
- case 1343: // Close menu
- player->CLOSE_GOSSIP_MENU();
- return true;
- break;
- }
- }
- }
- };
- void AddSC_level_NPC()
- {
- new level_NPC();
- }
Add Comment
Please, Sign In to add comment