Advertisement
julienanid

[Trinity] Buffer Item Don't Buff

Nov 3rd, 2013
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.21 KB | None | 0 0
  1. #include "ScriptPCH.h"
  2. #include "Chat.h"
  3. #include "GroupMgr.h"
  4. #include "Group.h"
  5.  
  6. uint32 auras[] = { 48074, 47440, 53307, 132, 48170, 23737, 48470, 43002, 26393, 48162 };
  7.  
  8. class Buffer_VIP : public ItemScript
  9. {
  10. public:
  11.     Buffer_VIP() : ItemScript("Buffer_VIP") { }
  12.  
  13.     bool OnUse(Player * player, Item * /*item*/, SpellCastTargets const& /*targets*/)
  14.     {
  15.         if (player->IsInFlight())
  16.         {
  17.             player->GetSession()->SendNotification("You cannot use this in Flight!");
  18.             return true;
  19.         }
  20.  
  21.         if(player->IsInCombat())
  22.         {
  23.             player->GetSession()->SendNotification("You can't use this buff while in combat!");
  24.             return false;
  25.         }
  26.  
  27.         if (player->HasStealthAura() || player->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH) || player->isDead())
  28.         {
  29.             player->GetSession()->SendNotification("You cannot use this,you are dead!");
  30.             return true;
  31.         }
  32.  
  33.         if (Group* playerGroup = player->GetGroup())
  34.         {
  35.             if (playerGroup->isRaidGroup())
  36.             {
  37.                 Player* GroupMember;
  38.                 const Group::MemberSlotList members = playerGroup->GetMemberSlots();
  39.                 for (Group::member_citerator itr = members.begin(); itr!= members.end(); ++itr)
  40.                 {
  41.                     GroupMember = (Unit::GetPlayer(*player, itr->guid));
  42.                     for(int i = 0; i < 10; i++)
  43.                     {
  44.                         GroupMember->AddAura(auras[i], GroupMember);
  45.                         player->GetSession()->SendNotification("|cffff0000You have been buffed yourself and your group!");
  46.                         player->DestroyItemCount(100004, 1, true);
  47.                         return false;
  48.                     }
  49.                 }
  50.             }
  51.         }
  52.         else
  53.         {
  54.             for(int i = 0; i < 10; i++)
  55.             {
  56.                 player->AddAura(auras[i], player);
  57.                 player->GetSession()->SendNotification("|cffff0000You have been buffed!");
  58.                 player->DestroyItemCount(100004, 1, true);
  59.                 return false;
  60.             }
  61.         }
  62.     }
  63. };
  64.  
  65. void AddSC_Buffer_VIP()
  66. {
  67.     new Buffer_VIP;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement