Example #1
0
        public static LobbyTeamInfo FromServer(LobbyServerTeamInfo serverInfo, int maxPlayerLevel,
                                               MatchmakingQueueConfig queueConfig)
        {
            LobbyTeamInfo lobbyTeamInfo = null;

            if (serverInfo != null)
            {
                lobbyTeamInfo = new LobbyTeamInfo();
                if (serverInfo.TeamPlayerInfo != null)
                {
                    lobbyTeamInfo.TeamPlayerInfo = new List <LobbyPlayerInfo>();
                    foreach (LobbyServerPlayerInfo serverInfo2 in serverInfo.TeamPlayerInfo)
                    {
                        lobbyTeamInfo.TeamPlayerInfo.Add(LobbyPlayerInfo.FromServer(serverInfo2, maxPlayerLevel,
                                                                                    queueConfig));
                    }
                }
            }

            return(lobbyTeamInfo);
        }
Example #2
0
        public static LobbyPlayerInfo FromServer(LobbyServerPlayerInfo serverInfo, int maxPlayerLevel,
                                                 MatchmakingQueueConfig queueConfig)
        {
            LobbyPlayerInfo lobbyPlayerInfo = null;

            if (serverInfo != null)
            {
                List <LobbyCharacterInfo> list = null;
                if (serverInfo.RemoteCharacterInfos != null)
                {
                    list = new List <LobbyCharacterInfo>();
                    foreach (LobbyCharacterInfo lobbyCharacterInfo in serverInfo.RemoteCharacterInfos)
                    {
                        list.Add(lobbyCharacterInfo.Clone());
                    }
                }

                lobbyPlayerInfo = new LobbyPlayerInfo
                {
                    AccountId            = serverInfo.AccountId,
                    PlayerId             = serverInfo.PlayerId,
                    CustomGameVisualSlot = serverInfo.CustomGameVisualSlot,
                    Handle                 = serverInfo.Handle,
                    TitleID                = serverInfo.TitleID,
                    TitleLevel             = serverInfo.TitleLevel,
                    BannerID               = serverInfo.BannerID,
                    EmblemID               = serverInfo.EmblemID,
                    RibbonID               = serverInfo.RibbonID,
                    IsGameOwner            = serverInfo.IsGameOwner,
                    ReplacedWithBots       = serverInfo.ReplacedWithBots,
                    IsNPCBot               = serverInfo.IsNPCBot,
                    IsLoadTestBot          = serverInfo.IsLoadTestBot,
                    BotsMasqueradeAsHumans = (queueConfig != null && queueConfig.BotsMasqueradeAsHumans),
                    Difficulty             = serverInfo.Difficulty,
                    BotCanTaunt            = serverInfo.BotCanTaunt,
                    TeamId                 = serverInfo.TeamId,
                    CharacterInfo          = ((serverInfo.CharacterInfo == null) ? null : serverInfo.CharacterInfo.Clone()),
                    RemoteCharacterInfos   = list,
                    ReadyState             = serverInfo.ReadyState,
                    ControllingPlayerId    =
                        ((!serverInfo.IsRemoteControlled) ? 0 : serverInfo.ControllingPlayerInfo.PlayerId),
                    EffectiveClientAccessLevel = serverInfo.EffectiveClientAccessLevel
                };
                if (serverInfo.AccountLevel >= maxPlayerLevel)
                {
//                    lobbyPlayerInfo.DisplayedStat = LocalizationPayload.Create("TotalSeasonLevelStatNumber", "Global",
//                        new LocalizationArg[]
//                        {
//                            LocalizationArg_Int32.Create(serverInfo.TotalLevel)
//                        });
                }
                else
                {
//                    lobbyPlayerInfo.DisplayedStat = LocalizationPayload.Create("LevelStatNumber", "Global",
//                        new LocalizationArg[]
//                        {
//                            LocalizationArg_Int32.Create(serverInfo.AccountLevel)
//                        });
                }
            }

            return(lobbyPlayerInfo);
        }