Exemple #1
0
        public MatchesBase(IInternalService internalService, IWebsiteService website, IMatchesTabService matchesTab, GameMode matchGameMode, MatchesTab currentTab)
            : base(internalService)
        {
            Website           = website;
            MatchesTabService = matchesTab;
            MatchGameMode     = matchGameMode;
            CurrentTab        = currentTab;

            ShowMatchSummaryButtonEnabled = true;

            SeasonList.Add("Lifetime");
            SeasonList.AddRange(HeroesHelpers.Seasons.GetSeasonList());
            SelectedSeasonOption = SeasonList[0];

            GameTimeList           = HeroesHelpers.GameDates.GameTimeList;
            SelectedGameTimeOption = GameTimeList[0];

            GameDateList           = HeroesHelpers.GameDates.GameDateList;
            SelectedGameDateOption = GameDateList[0];

            MapsList.Add("Any");
            MapsList.AddRange(HeroesIcons.MapBackgrounds().GetMapsList());
            SelectedMapOption = MapsList[0];

            ReplayBuildsList.Add("Any");
            ReplayBuildsList.AddRange(HeroesHelpers.Builds.GetBuildsList(HeroesIcons));
            SelectedBuildOption = ReplayBuildsList[0];

            HeroesList.Add("Any");
            HeroesList.AddRange(HeroesIcons.Heroes().GetListOfHeroes(HeroesIcons.GetLatestHeroesBuild()));
            SelectedCharacter = HeroesList[0];

            Messenger.Default.Register <MatchesDataMessage>(this, (message) => ReceivedMatchSearchData(message));
            Messenger.Default.Register <NotificationMessage>(this, async(message) => await ReceivedMessageAsync(message));
        }
        public void HeroesTest()
        {
            HeroesIcons   heroesIcons    = new HeroesIcons(false);
            List <string> assertMessages = new List <string>();
            int           segment        = 4;

            foreach (int build in heroesIcons.GetListOfHeroesBuilds())
            {
                heroesIcons.LoadHeroesBuild(build);

                var heroes = heroesIcons.Heroes().GetListOfHeroes(build);

                foreach (var hero in heroes)
                {
                    string altName = heroesIcons.Heroes().GetAltNameFromRealHeroName(hero);

                    if (string.IsNullOrEmpty(altName))
                    {
                        Assert.Fail($"[{build}] alt name is null or emtpy for {hero}");
                    }

                    BitmapImage heroLeaderBoardPortrait = heroesIcons.Heroes().GetHeroLeaderboardPortrait(hero);
                    BitmapImage heroLoadingPortrait     = heroesIcons.Heroes().GetHeroLoadingPortrait(hero);
                    BitmapImage heroPortrait            = heroesIcons.Heroes().GetHeroPortrait(hero);

                    if (heroLeaderBoardPortrait.UriSource.Segments[segment].ToString() != $"storm_ui_ingame_hero_leaderboard_{GetUniqueHeroName(altName.ToLower())}.dds")
                    {
                        assertMessages.Add($"[{build}] Leaderboard portrait not found for {hero}");
                    }

                    if (heroLoadingPortrait.UriSource.Segments[segment].ToString() != $"storm_ui_ingame_hero_loadingscreen_{GetUniqueHeroName(altName.ToLower())}.dds")
                    {
                        assertMessages.Add($"[{build}] Loading portrait not found for {hero}");
                    }

                    if (heroPortrait.UriSource.Segments[segment].ToString() != $"storm_ui_ingame_heroselect_btn_{GetUniqueHeroName(altName.ToLower())}.dds")
                    {
                        assertMessages.Add($"[{build}] Hero portrait not found for {hero}");
                    }

                    if (heroesIcons.Heroes().GetHeroFranchise(hero) == HeroFranchise.Unknown)
                    {
                        assertMessages.Add($"[{build}] Unknown franchise for {hero}");
                    }

                    var heroRoles = heroesIcons.Heroes().GetHeroRoleList(hero);
                    if (heroRoles[0] == HeroRole.Unknown)
                    {
                        assertMessages.Add($"[{build}] Unknown hero role for {hero}");
                    }
                    if (heroRoles.Count > 1 && heroRoles[0] != HeroRole.Multiclass)
                    {
                        assertMessages.Add($"[{build}] Hero {hero} has multiple roles but first role is NOT Multiclass");
                    }
                }
            }

            AssertFailMessage(assertMessages);
        }
Exemple #3
0
        public void SetPlayerInfo(bool isAutoSelect, Dictionary <int, PartyIconColor> playerPartyIcons, Dictionary <long, string> matchAwardDictionary)
        {
            var playerInfo = Database.ReplaysDb().HotsPlayer.ReadRecordFromPlayerId(Player.PlayerId);

            LeaderboardPortrait = Player.Character != "None" ? HeroesIcons.Heroes().GetHeroLeaderboardPortrait(Player.Character) : null;
            CharacterTooltip    = $"{Player.Character}{Environment.NewLine}{HeroesIcons.Heroes().GetHeroRoleList(Player.Character)[0]}";
            Silenced            = Player.IsSilenced;
            CharacterName       = Player.Character;

            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();
            }

            if (Player.AccountLevel > 0)
            {
                AccountLevel = Player.AccountLevel.ToString();
            }
            else
            {
                AccountLevel = "N/A";
            }

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

            if (matchAwardDictionary.ContainsKey(Player.PlayerId))
            {
                SetMVPAward(matchAwardDictionary[Player.PlayerId]);
            }

            string lastSeenBefore;

            if (playerInfo.LastSeenBefore.HasValue)
            {
                lastSeenBefore = playerInfo.LastSeenBefore.Value.ToString();
            }
            else
            {
                lastSeenBefore = "Never";
            }

            PlayerNameTooltip = $"{PlayerName}{Environment.NewLine}Account Level: {AccountLevel}{Environment.NewLine}Total Seen: {playerInfo.Seen}{Environment.NewLine}Last Seen Before: {lastSeenBefore}";
        }
 private bool IsHealingStatCharacter(string realHeroName)
 {
     if (HeroesIcons.Heroes().GetHeroRoleList(realHeroName)[0] == HeroRole.Support || HeroesIcons.IsNonSupportHeroWithHealingStat(realHeroName))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
        public StatsHeroesViewModel(IInternalService internalService, ILoadingOverlayWindowService loadingOverlayWindow)
            : base(internalService)
        {
            LoadingOverlayWindow = loadingOverlayWindow;

            IsTotalsAveragesChecked = true;
            IsTalentsChecked        = true;
            IsAwardsChecked         = true;

            SeasonList.Add(InitialSeasonListOption);
            SeasonList.Add("Lifetime");
            SeasonList.AddRange(HeroesHelpers.Seasons.GetSeasonList());
            SelectedSeason = SeasonList[0];

            HeroesList.Add(InitialHeroListOption);
            HeroesList.AddRange(HeroesIcons.Heroes().GetListOfHeroes(HeroesIcons.GetLatestHeroesBuild()));
            SelectedHero = HeroesList[0];

            GameModeList.AddRange(HeroesHelpers.GameModes.GetAllGameModeList());
            MapList.AddRange(HeroesIcons.MapBackgrounds().GetMapsList());

            StatsHeroesDataViewModel = new StatsHeroesDataViewModel(internalService, MapList);
        }
        public void HeroesBuildTest()
        {
            HeroesIcons   heroesIcons    = new HeroesIcons(false);
            List <string> assertMessages = new List <string>();
            int           segment        = 5;

            foreach (int build in heroesIcons.GetListOfHeroesBuilds())
            {
                heroesIcons.LoadHeroesBuild(build);

                var heroes = heroesIcons.Heroes().GetListOfHeroes(build);

                foreach (var hero in heroes)
                {
                    var talents = heroesIcons.HeroBuilds().GetAllTalentsForHero(hero);

                    if (talents == null)
                    {
                        assertMessages.Add($"[{build}] No talents found for {hero}");
                        continue;
                    }
                    if (talents[TalentTier.Level1] == null || talents[TalentTier.Level1].Count < 1)
                    {
                        assertMessages.Add($"[{build}] No Level 1 talents for {hero}");
                    }
                    if (talents[TalentTier.Level4] == null || talents[TalentTier.Level4].Count < 1)
                    {
                        assertMessages.Add($"[{build}] No Level 4 talents for {hero}");
                    }
                    if (talents[TalentTier.Level7] == null || talents[TalentTier.Level7].Count < 1)
                    {
                        assertMessages.Add($"[{build}] No Level 7 talents for {hero}");
                    }
                    if (talents[TalentTier.Level10] == null || talents[TalentTier.Level10].Count < 1)
                    {
                        assertMessages.Add($"[{build}] No Level 10 talents for {hero}");
                    }
                    if (talents[TalentTier.Level13] == null || talents[TalentTier.Level13].Count < 1)
                    {
                        assertMessages.Add($"[{build}] No Level 13 talents for {hero}");
                    }
                    if (talents[TalentTier.Level16] == null || talents[TalentTier.Level16].Count < 1)
                    {
                        assertMessages.Add($"[{build}] No Level 16 talents for {hero}");
                    }
                    if (talents[TalentTier.Level20] == null || talents[TalentTier.Level20].Count < 1)
                    {
                        assertMessages.Add($"[{build}] No Level 20 talents for {hero}");
                    }

                    // loop through each talent tier
                    foreach (var talentTier in talents)
                    {
                        if (talentTier.Key == TalentTier.Old)
                        {
                            continue;
                        }

                        // loop through each talent
                        foreach (var talent in talentTier.Value)
                        {
                            BitmapImage talentImage = heroesIcons.HeroBuilds().GetTalentIcon(talent);

                            if (talentImage.UriSource.Segments[segment].ToString() == HeroesBase.NoTalentIconPick || talentImage.UriSource.Segments[segment].ToString() == HeroesBase.NoTalentIconFound)
                            {
                                assertMessages.Add($"[{build}] Talent image not found for {talent} [{talentTier.Key.ToString()}]");
                            }

                            TalentTooltip talentTooltip = heroesIcons.HeroBuilds().GetTalentTooltips(talent);
                            if (string.IsNullOrEmpty(talentTooltip.Full))
                            {
                                assertMessages.Add($"[{build}] Full tooltip not found for {talent} [{talentTier.Key.ToString()}]");
                            }
                            else
                            {
                                string strippedText = TalentTooltipStripNonText(talentTooltip.Full);

                                if (NonValidCharsCheck(strippedText))
                                {
                                    assertMessages.Add($"[{build}] Invalid chars in FULL tooltip {talent} [{talentTier.Key.ToString()}]{Environment.NewLine}{strippedText}{Environment.NewLine}");
                                }
                            }

                            if (string.IsNullOrEmpty(talentTooltip.Short))
                            {
                                assertMessages.Add($"[{build}] Short tooltip not found for {talent} [{talentTier.Key.ToString()}]");
                            }
                            else
                            {
                                string strippedText = TalentTooltipStripNonText(talentTooltip.Short);

                                if (NonValidCharsCheck(strippedText))
                                {
                                    assertMessages.Add($"[{build}] Invalid chars in SHORT tooltip {talent} [{talentTier.Key.ToString()}]{Environment.NewLine}{strippedText}{Environment.NewLine}");
                                }
                            }

                            if (string.IsNullOrEmpty(heroesIcons.HeroBuilds().GetTrueTalentName(talent.Trim())))
                            {
                                assertMessages.Add($"[{build}] No true talent name for {talent} [{talentTier.Key.ToString()}]");
                            }
                        }
                    }
                }
            }

            AssertFailMessage(assertMessages);
        }