Advertisement
Guest User

Untitled

a guest
Jun 11th, 2019
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.98 KB | None | 0 0
  1. /// By XxTryXx
  2.  
  3. #include "Chat.h"
  4. #include "Item.h"
  5. #include "Player.h"
  6. #include "ScriptMgr.h"
  7.  
  8. class item_level_up : public ItemScript
  9. {
  10.     public:
  11.         item_level_up() : ItemScript("item_level_up") { }
  12.    
  13.         bool OnUse(Player* p_Player, Item* p_Item, SpellCastTargets const& /*p_Targets*/) override
  14.         {
  15.             /// Check if player is already too high level for this item
  16.             if (p_Player->getLevel() >= 80)
  17.             {
  18.                 ChatHandler(p_Player->GetSession()).SendSysMessage("You are too high level to use this item!");
  19.                 return true;
  20.             }
  21.            
  22.             /// Destroy item actually clicked
  23.             p_Player->DestroyItem(p_Item->GetBagSlot(), p_Item->GetSlot(), true);
  24.  
  25.             /// We actually need to use GiveLevel so talent infos and etc update.
  26.             p_Player->GiveLevel(80);
  27.    
  28.             return true;
  29.         }
  30. };
  31.  
  32. void AddSC_item_level_up()
  33. {
  34.     new item_level_up();
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement