rendered paste bodyvoid BattleGroundMgr::SendToBattleGround(Player *pl, uint32 instanceId, uint32 team)
{
BattleGround *bg = GetBattleGround(instanceId);
if(bg)
{
uint32 mapid = bg->GetMapId();
float x, y, z, O;
if(team==0)
team = pl->GetTeam();
bg->GetTeamStartLoc(team, x, y, z, O);
sLog.outDetail("BATTLEGROUND: Sending %s to map %u, X %f, Y %f, Z %f, O %f", pl->GetName(), mapid, x, y, z, O);
pl->SetInstanceId(instanceId);
SaveInstance * inst = new SaveInstance;
inst->InstanceId = instanceId;
inst->MapId = mapid;
inst->ResetTime = 0;
pl->m_BoundInstances[mapid]=inst;
// teleport as gm command
pl->TeleportTo(mapid, x, y, z, O, true, true, false, true);
}
else
{
sLog.outError("player %u trying to port to non-existent bg instance %u",pl->GetGUIDLow(), instanceId);
}
}