SHOW:
|
|
- or go back to the newest paste.
| 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 | - | if(pPlayer->getLevel() >= 80) |
| 33 | + | uint8 newlevel = pPlayer->getLevel()+uiAction*10; |
| 34 | - | {
|
| 34 | + | if(newlevel > 80) |
| 35 | - | pPlayer->GetSession()->SendNotification("You are already level 80!");
|
| 35 | + | newlevel = 80; |
| 36 | - | } |
| 36 | + | pPlayer->GiveLevel(newlevel); |
| 37 | - | else |
| 37 | + | pPlayer->InitTalentForLevel(); |
| 38 | - | {
|
| 38 | + | pPlayer->SetUInt32Value(PLAYER_XP, 0); |
| 39 | - | uint8 newlevel = pPlayer->getLevel()+uiAction*10; |
| 39 | + | pPlayer->DestroyItemCount(TOKEN_ID, uiAction*10, true); |
| 40 | - | if(newlevel > 80) |
| 40 | + | pPlayer->GetSession()->SendAreaTriggerMessage("You are now Level %u!", newlevel);
|
| 41 | - | newlevel = 80; |
| 41 | + | pPlayer->PlayerTalkClass->SendCloseGossip(); |
| 42 | - | pPlayer->GiveLevel(newlevel); |
| 42 | + | return true; |
| 43 | - | pPlayer->InitTalentForLevel(); |
| 43 | + | |
| 44 | - | pPlayer->SetUInt32Value(PLAYER_XP, 0); |
| 44 | + | |
| 45 | - | pPlayer->DestroyItemCount(TOKEN_ID, uiAction*10, true); |
| 45 | + | |
| 46 | - | pPlayer->GetSession()->SendAreaTriggerMessage("You are now Level %u!", uint32(pPlayer->getLevel()));
|
| 46 | + | |
| 47 | - | pPlayer->PlayerTalkClass->SendCloseGossip(); |
| 47 | + | |
| 48 | - | return true; |
| 48 | + | |
| 49 | - | } |
| 49 | + | |
| 50 | void AddSC_Level_NPC() | |
| 51 | {
| |
| 52 | new Level_NPC(); | |
| 53 | } |