Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// By XxTryXx
- #include "Chat.h"
- #include "Item.h"
- #include "Player.h"
- #include "ScriptMgr.h"
- class item_level_up : public ItemScript
- {
- public:
- item_level_up() : ItemScript("item_level_up") { }
- bool OnUse(Player* p_Player, Item* p_Item, SpellCastTargets const& /*p_Targets*/) override
- {
- /// Check if player is already too high level for this item
- if (p_Player->getLevel() >= 80)
- {
- ChatHandler(p_Player->GetSession()).SendSysMessage("You are too high level to use this item!");
- return true;
- }
- /// Destroy item actually clicked
- p_Player->DestroyItem(p_Item->GetBagSlot(), p_Item->GetSlot(), true);
- /// We actually need to use GiveLevel so talent infos and etc update.
- p_Player->GiveLevel(80);
- return true;
- }
- };
- void AddSC_item_level_up()
- {
- new item_level_up();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement