Example #1
0
void WorldSession::HandleArenaTeamPromoteOpcode(WorldPacket & recv_data)
{
	uint32 teamId;
	uint8 slot;
	string name;
	ArenaTeam * team;
	PlayerInfo * inf;
	recv_data >> teamId >> name;

	team = objmgr.GetArenaTeamById(teamId);
	if(!team)
	{
		GetPlayer()->SoftDisconnect();
		return;
	}

	slot = team->m_type;

	if( slot >= NUM_ARENA_TEAM_TYPES )
	{ 
		return;
	}

	if( (team = _player->m_arenaTeams[slot]) == NULL )
	{
		SystemMessage("You are not in an arena team of this type.");
		return;
	}

	if(team->m_leader != _player->GetLowGUID())
	{
		SystemMessage("You aren't the captain of this team.");
		return;
	}

	if( (inf = objmgr.GetPlayerInfoByName(name.c_str())) == NULL )
	{
		SystemMessage("That player cannot be found.");
		return;
	}

	if(!team->HasMember(inf->guid))
	{
		SystemMessage("That player is not a member of your arena team.");
		return;
	}

	team->SetLeader(inf);
}
Example #2
0
void WorldSession::HandleArenaTeamPromoteOpcode(WorldPacket & recv_data) 
{
	uint32 teamId;
	uint8 slot;
	string name;
	ArenaTeam * team;
	PlayerInfo * inf;
	recv_data >> teamId >> name;

	team = objmgr.GetArenaTeamById(teamId);
	if(!team)
	{
		SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_INTERNAL);
		return;
	}

	slot = team->m_type;

	if( slot >= NUM_ARENA_TEAM_TYPES )
		return;

	if( (team = _player->m_playerInfo->arenaTeam[slot]) == NULL )
	{
		SendNotInArenaTeamPacket(uint8(team->GetPlayersPerTeam()));
		return;
	}

	if(team->m_leader != _player->GetLowGUID())
	{
		SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_PERMISSIONS);
		return;
	}

	if( (inf = objmgr.GetPlayerInfoByName(name.c_str())) == NULL )
	{
		SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", name.c_str(), ERR_ARENA_TEAM_PLAYER_NOT_FOUND_S);
		return;
	}

	if(!team->HasMember(inf->guid))
	{
		SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, inf->name, team->m_name, ERR_ARENA_TEAM_PLAYER_NOT_IN_TEAM_SS);
		return;
	}

	team->SendArenaTeamEventPacket(ERR_ARENA_TEAM_LEADER_CHANGED, 3, _player->GetName(), inf->name, team->m_name);

	team->SetLeader(inf);
}