/// <summary>
        /// Возвращает игрока и его данные по идентификатору
        /// </summary>
        public PlayerWithData GetWithData(long accountId, bool needFromDb = true)
        {
            var player = API.getAllPlayers().FirstOrDefault(e => e.hasData(ID_KEY) && accountId == (long)e.getData(ID_KEY));

            if (PlayerHelper.PlayerCorrect(player, true))
            {
                return(new PlayerWithData {
                    Player = player, PlayerInfo = GetInfo(player)
                });
            }
            PlayerInfo playerInfo = null;

            if (needFromDb)
            {
                playerInfo          = _playersProvider.GetInfo(accountId);
                playerInfo.Vehicles = _vehiclesProvider.GetVehicles(accountId).ToDictionary(e => e.Id);
            }
            return(new PlayerWithData {
                Player = null, PlayerInfo = playerInfo
            });
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Возвращает транспорт игрока
        /// </summary>
        public List <VehicleInfo> GetPlayerVehicles(long accountId)
        {
            var vehicles = _vehiclesProvider.GetVehicles(accountId);

            return(vehicles.ToList());
        }