Пример #1
0
        public void SetPlayerInfo(bool isAutoSelect, Dictionary <int, PartyIconColor> playerPartyIcons, Dictionary <long, string> matchAwardDictionary)
        {
            var playerInfo = Database.ReplaysDb().HotsPlayer.ReadRecordFromPlayerId(Player.PlayerId);

            Hero hero = HeroesIcons.HeroBuilds().GetHeroInfo(Player.Character);

            LeaderboardPortrait = Player.Character != "None" ? hero.GetLeaderboardPortrait() : null;
            Silenced            = Player.IsSilenced;
            CharacterName       = hero.Name;
            PlayerName          = Database.SettingsDb().UserSettings.IsBattleTagHidden ? HeroesHelpers.BattleTags.GetNameFromBattleTagName(playerInfo.BattleTagName) : playerInfo.BattleTagName;
            PlayerBattleTagName = playerInfo.BattleTagName;
            PlayerRegion        = (Region)playerInfo.BattleNetRegionId;
            IsUserPlayer        = (playerInfo.PlayerId == UserProfile.PlayerId && playerInfo.BattleNetRegionId == UserProfile.RegionId) ? true : false;

            if (Player.Team == 4)
            {
                CharacterLevel = "Observer";
            }
            else
            {
                CharacterLevel = isAutoSelect ? "Auto Select" : Player.CharacterLevel.ToString();
            }

            PlayerTag = new PlayerTag
            {
                PlayerName        = PlayerName,
                AccountLevel      = Player.AccountLevel > 0 ? Player.AccountLevel.ToString() : "N/A",
                TotalSeen         = playerInfo.Seen,
                LastSeenBefore    = playerInfo.LastSeenBefore.HasValue ? playerInfo.LastSeenBefore.Value.ToString() : "Never",
                FormerPlayerNames = Database.ReplaysDb().RenamedPlayer.ReadPlayersFromPlayerId(playerInfo.PlayerId),
                Notes             = playerInfo.Notes ?? string.Empty,
            };

            HeroDescription = new HeroDescription
            {
                HeroName    = hero.Name,
                Description = hero.Description,
                Franchise   = HeroesIcons.GetFranchiseIcon(hero.Franchise),
                Type        = hero.Type,
                Difficulty  = hero.Difficulty,
                Roles       = hero.Roles,
            };

            if (playerPartyIcons.ContainsKey(Player.PlayerNumber))
            {
                SetPartyIcon(playerPartyIcons[Player.PlayerNumber]);
            }

            if (matchAwardDictionary.ContainsKey(Player.PlayerId))
            {
                SetMVPAward(matchAwardDictionary[Player.PlayerId]);
            }
        }
        public void GetFranchiseIconTests()
        {
            List <string> assertMessages = new List <string>();

            foreach (HeroFranchise icon in Enum.GetValues(typeof(HeroFranchise)))
            {
                if (HeroesIcons.GetFranchiseIcon(icon) == null)
                {
                    assertMessages.Add($"Franchise icon {icon} is null");
                }
            }

            AssertFailMessage(assertMessages);
        }