Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ScriptPCH.h"
- #include "Chathandler.cpp"
- uint32 ITEM_ID = 44728;
- uint8 MAX_LVL = 255;
- class item_level : public ItemScript
- {
- public:
- item_level() : ItemScript("item_level") { }
- bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/)
- {
- if(player->IsInCombat() || player->IsInFlight())
- {
- player->GetSession()->SendNotification("You Cant Use This Right Now!");
- return false;
- }
- if(player->getLevel() >= MAX_LVL)
- {
- player->GetSession()->SendNotification("You are already max level.");
- return false;
- }
- int32 oldlevel = player->getLevel();
- int32 newLevel = oldlevel + 1;
- player->GiveLevel(newLevel);
- player->InitTalentForLevel();
- player->SetUInt32Value(PLAYER_XP, 0);
- player->DestroyItemCount(ITEM_ID, 1, true);
- player->GetSession()->SendNotification("You have used one level token. Thanks for supporting our server");
- return true;
- }
- };
- void AddSC_item_level()
- {
- new item_level();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement