Skip to content

Instantly share code, notes, and snippets.

@dagochen
Created December 18, 2017 23:51
Show Gist options
  • Save dagochen/f5ab4ce2c59dce6e1f075e605da3e472 to your computer and use it in GitHub Desktop.
Save dagochen/f5ab4ce2c59dce6e1f075e605da3e472 to your computer and use it in GitHub Desktop.
item_scripts.cpp
/* This file is part of the ScriptDev2 Project. See AUTHORS file for Copyright information
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* ScriptData
SDName: Item_Scripts
SD%Complete: 0
SDComment: Empty
SDCategory: Items
EndScriptData */
/* ContentData
EndContentData */
#include "precompiled.h"
bool On_ItemUse_battleCom(Player* pPlayer, Item* pItem, SpellCastTargets const& targets)
{
if (!pPlayer)
return false;
uint32 bgs[] = { 489, 30, 529 };
for (uint32 i = 0; i < 3; ++i)
{
WorldPacket data;
data << pPlayer->GetObjectGuid(); // battlemaster guid
data << bgs[i];
data << 0; // instance id, 0 if First Available selected
data << 0; // join as group
pPlayer->GetSession()->HandleBattlemasterJoinOpcode(data);
}
pPlayer->UpdatePvP(true, true);
return true;
}
void AddSC_item_scripts()
{
Script* newScript = new Script;
newScript->Name = "item_Battle_Communicator";
newScript->pItemUse = &On_ItemUse_battleCom;
newScript->RegisterSelf();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment