示例#1
0
        public IActionResult GetStats(StatCategory statCategory, string userId, bool?leagueMatchesOnly, long?startTime, long?endTime)
        {
            var games = GetGames(userId, startTime, endTime, leagueMatchesOnly);
            var calc  = new BowlingStatCalculator(games);

            return(Ok(calc.GetStats(statCategory)));
        }
示例#2
0
    public Stat(StatType type, StatCategory category, Func <float> getValue, Func <string> getTooltip)
    {
        this.type     = type;
        this.category = category;

        _getValue   = getValue;
        _getTooltip = getTooltip;
    }
示例#3
0
 public ItemStringBuilder WithItemStat(string statText, StatCategory statCategory)
 {
     this.ItemStats.Add(new ItemStat(statCategory)
     {
         Text = statText
     });
     return(this);
 }
示例#4
0
        public PlayModel()
        {
            Play            = new Play();
            Player1         = new Player();
            StatCategory    = new StatCategory();
            StatDescription = new StatDescription();

            BackgroundColor   = "Transparent";
            BackgroundOpacity = 1;
        }
示例#5
0
        public Statistic(StatCategory category, StatItems item, VarInt value = null !)
        {
            if (value == null !)
            {
                value = 0;
            }

            Category = (int)category;
            Id       = (int)item;
            Value    = value;
        }
        public void ParseShouldCallGetStatDataWithExpectedStatCategories(StatCategory statCategory)
        {
            string[] itemStringLines = this.itemStringBuilder
                                       .WithName("Titan Greaves")
                                       .WithItemLevel(75)
                                       .WithItemStat("Stat text with unknown category", statCategory)
                                       .BuildLines();

            this.itemStatsParser.Parse(itemStringLines, false);

            this.statsDataServiceMock.Verify(x => x.GetStatData(It.IsAny <string>(), It.IsAny <bool>(), StatCategory.Explicit.GetDisplayName()));
        }
        public void ParseShouldCallGetStatDataWithStatCategory(StatCategory statCategory, string statText)
        {
            string[] itemStringLines = this.itemStringBuilder
                                       .WithName("Titan Greaves")
                                       .WithItemLevel(75)
                                       .WithItemStat(statText, statCategory)
                                       .BuildLines();

            this.itemStatsParser.Parse(itemStringLines, false);

            this.statsDataServiceMock.Verify(x => x.GetStatData(It.IsAny <string>(), It.IsAny <bool>(), statCategory.GetDisplayName()));
        }
        public async Task GetStatDataShouldReturnCorrectStatDataForImplicitStat()
        {
            const StatCategory statCategory = StatCategory.Implicit;
            var implicitItemStat            = new ItemStat(statCategory)
            {
                Text = "3% increased Movement Speed"
            };
            var expected = new StatData {
                Id = "stat_12345678", Text = "#% increased Movement Speed", Type = statCategory.GetDisplayName().ToLower()
            };

            await this.GetStatDataShouldReturnCorrectStatData(implicitItemStat, expected);
        }
示例#9
0
 internal DestinyStatDefinition(StatAggregationType aggregationType, bool hasComputedBlock, bool interpolate, StatCategory statCategory,
                                DestinyDefinitionDisplayProperties displayProperties, bool blacklisted, uint hash, int index, bool redacted)
 {
     DisplayProperties = displayProperties;
     AggregationType   = aggregationType;
     HasComputedBlock  = hasComputedBlock;
     Interpolate       = interpolate;
     StatCategory      = statCategory;
     Blacklisted       = blacklisted;
     Hash     = hash;
     Index    = index;
     Redacted = redacted;
 }
        public async Task GetStatDataShouldReturnCorrectStatDataForMonsterStat()
        {
            const StatCategory statCategory = StatCategory.Monster;
            var monsterItemStat             = new ItemStat(statCategory)
            {
                Text = "Drops additional Currency Items"
            };

            var expected = new StatData {
                Id = "stat_2250533757", Text = "Drops additional Currency Items (×#)", Type = statCategory.GetDisplayName().ToLower()
            };

            await this.GetStatDataShouldReturnCorrectStatData(monsterItemStat, expected);
        }
        public async Task GetStatDataShouldReturnCorrectStatDataForEnchantedStat()
        {
            const StatCategory statCategory = StatCategory.Enchant;
            var craftedItemStat             = new ItemStat(statCategory)
            {
                Text = "10% increased Movement Speed"
            };

            var expected = new StatData {
                Id = "stat_1234", Text = "#% increased Movement Speed", Type = statCategory.GetDisplayName().ToLower()
            };

            await this.GetStatDataShouldReturnCorrectStatData(craftedItemStat, expected);
        }
        public async Task GetStatDataShouldReturnCorrectStatDataEvenIfTextWithPlaceholdersDoesNotFullyMatch()
        {
            const StatCategory statCategory = StatCategory.Implicit;
            var explicitItemStat            = new ItemStat(statCategory)
            {
                Text = "+10 to Maximum Mana per Green Socket"
            };

            var expected = new StatData {
                Id = "stat_2250533757", Text = "+# to Maximum Mana per Green Socket", Type = statCategory.GetDisplayName().ToLower()
            };

            await this.GetStatDataShouldReturnCorrectStatData(explicitItemStat, expected);
        }
示例#13
0
        /// <summary>
        /// Gets the effective transforms for the given stat that this character
        /// possesses.
        /// </summary>
        protected IEnumerable <StatValueTransform> GetStatTransforms(StatCategory statCategory)
        {
            var transforms = new List <StatValueTransform>();

            if (HasAbility)
            {
                transforms.AddRange(Ability.ActionContainer.StatValueTransforms[statCategory]);
            }

            if (HasItem)
            {
                transforms.AddRange(Item.ActionContainer.StatValueTransforms[statCategory]);
            }

            return(transforms);
        }
        public void ParseShouldParseStatText(StatCategory statCategory, string statText, string expected)
        {
            string[] itemStringLines = this.itemStringBuilder
                                       .WithName("Titan Greaves")
                                       .WithItemLevel(75)
                                       .WithItemStat(statText, statCategory)
                                       .BuildLines();

            this.statsDataServiceMock.Setup(x => x.GetStatData(It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <string[]>()))
            .Returns(new StatData());

            ItemStats result = this.itemStatsParser.Parse(itemStringLines, false);

            Assert.That(result.AllStats, Has.Count.EqualTo(1));

            ItemStat itemStat = result.AllStats.First();

            Assert.That(itemStat.Text, Is.EqualTo(expected));
        }
示例#15
0
 private static ItemWithStats CreateItemWithStats(StatCategory statCategory)
 {
     return(new EquippableItem(ItemRarity.Rare)
     {
         Stats = new ItemStats
         {
             AllStats =
             {
                 new ItemStat(statCategory)
                 {
                     Id = $"{statCategory}ItemStatId"
                 },
                 new ItemStat(statCategory)
                 {
                     Id = $"{statCategory}ItemStatId1"
                 },
             }
         }
     });
 }
示例#16
0
        public List <BowlingStat> GetStats(StatCategory category)
        {
            switch (category)
            {
            case StatCategory.Overall:
                return(GetOverallStats());

            case StatCategory.Count:
                return(GetCountStats());

            case StatCategory.Record:
                return(GetRecords());

            case StatCategory.Split:
                return(GetSplitStats());

            default:
                throw new NotImplementedException($"Category {category} is not supported.");
            }
        }
示例#17
0
        private bool TryGetItemStatForCategoryByMarker(string statText, StatCategory statCategory, out ItemStat itemStat)
        {
            itemStat = null;

            int statCategoryMarkerIndex = statText.IndexOf($"({statCategory.GetDisplayName()})", StringComparison.OrdinalIgnoreCase);

            if (statCategoryMarkerIndex >= 0)
            {
                statText = statText.Substring(0, statCategoryMarkerIndex).Trim();

                itemStat = new ItemStat(statCategory)
                {
                    Text = statText
                };

                return(true);
            }

            return(false);
        }
示例#18
0
        private void item_SaveStatsToDatabase(object sender, StatCategoryModel.SaveStatsEventArgs e)
        {
            StatCategory         stat     = sender as StatCategory;
            StatDescriptionModel statDesc = sender as StatDescriptionModel;

            if (stat != null)
            {
                PlayModel.Play.StatCategoryID                 = stat.StatCategoryID;
                PlayModel.StatCategory.StatCategoryName       = stat.StatCategoryName;
                PlayModel.StatDescription.StatDescriptionName = string.Empty;
            }
            else
            {
                PlayModel.Play.StatCategoryID           = e.StatCat.StatCategory.StatCategoryID;
                PlayModel.StatCategory.StatCategoryName = e.StatCat.StatCategory.StatCategoryName;

                if (statDesc != null)
                {
                    PlayModel.Play.StatDescriptionID = statDesc.StatDescription.StatDescriptionID;
                    PlayModel.StatDescription.StatDescriptionName = statDesc.StatDescription.StatDescriptionName;
                }
            }

            if ((PlayModel.StatDescription.StatDescriptionName == AppResources.ShotDetails) || (PlayModel.StatDescription.StatDescriptionName == AppResources.ForGoal))
            {
                (Application.Current.RootVisual as Frame).Navigate(new Uri("/Views/ShotDetails.xaml?playID=0&gameID= " + PlayModel.Play.GameID +
                                                                           "&playerID= " + PlayModel.Play.Player1ID + "&teamID=" + PlayModel.Play.TeamID +
                                                                           "&period= " + PlayModel.Play.Period + "&gameTime=" + PlayModel.Play.GameTime +
                                                                           "&GMPlayer1PositionID=" + PlayModel.Play.GMPlayer1PositionID + "&otherTeamGoalieID=" + PlayModel.Play.OtherTeamGoalieID +
                                                                           "&statcategoryID=" + PlayModel.Play.StatCategoryID +
                                                                           "&statdescriptionID=" + PlayModel.Play.StatDescriptionID, UriKind.Relative));
            }
            else
            {
                DAL.Instance().UpsertPlay(PlayModel.Play, "GM");
                (Application.Current.RootVisual as Frame).GoBack();
            }
        }
示例#19
0
        public async Task LoadAsyncShouldSetStatFilterViewModels(StatCategory statCategory, GetFilterViewModels getFilterViewModelsDelegate)
        {
            ItemWithStats item      = CreateItemWithStats(statCategory);
            var           expected1 = new MinMaxStatFilterViewModel {
                Id = item.Stats.AllStats[0].Id
            };
            var expected2 = new MinMaxStatFilterViewModel {
                Id = item.Stats.AllStats[1].Id
            };

            this.statFilterViewModelFactoryMock.SetupSequence(x => x.Create(It.IsAny <ItemStat>(), It.IsAny <SearchQueryRequest>()))
            .Returns(expected1)
            .Returns(expected2);

            await this.advancedFiltersViewModel.LoadAsync(item, new SearchQueryRequest(), default);

            var filterViewModels = getFilterViewModelsDelegate(this.advancedFiltersViewModel);

            Assert.That(filterViewModels, Has.Count.EqualTo(2));

            Assert.That(filterViewModels[0], Is.EqualTo(expected1));
            Assert.That(filterViewModels[1], Is.EqualTo(expected2));
        }
示例#20
0
        public bool Equals(DestinyStatDefinition input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     DisplayProperties == input.DisplayProperties ||
                     (DisplayProperties != null && DisplayProperties.Equals(input.DisplayProperties))
                     ) &&
                 (
                     AggregationType == input.AggregationType ||
                     (AggregationType != null && AggregationType.Equals(input.AggregationType))
                 ) &&
                 (
                     HasComputedBlock == input.HasComputedBlock ||
                     (HasComputedBlock != null && HasComputedBlock.Equals(input.HasComputedBlock))
                 ) &&
                 (
                     StatCategory == input.StatCategory ||
                     (StatCategory != null && StatCategory.Equals(input.StatCategory))
                 ) &&
                 (
                     Hash == input.Hash ||
                     (Hash.Equals(input.Hash))
                 ) &&
                 (
                     Index == input.Index ||
                     (Index.Equals(input.Index))
                 ) &&
                 (
                     Redacted == input.Redacted ||
                     (Redacted != null && Redacted.Equals(input.Redacted))
                 ));
        }
 public SingleValueItemStat(StatCategory statCategory) : base(statCategory)
 {
 }
示例#22
0
 public StatCategoryModel()
 {
     StatCategory = new StatCategory();
     IsStatGray   = Visibility.Collapsed;
 }
 /// <summary>
 /// Adds the given target multiplier to the built buff.
 /// </summary>
 /// <param name="statCategory">The stat category.</param>
 /// <param name="fraction">The fraction, between 0 and 1.</param>
 public BuffActionBuilder WithTargetMultiplier(StatCategory statCategory, double fraction)
 {
     _buff.TargetMultipliers[statCategory] = fraction;
     return(this);
 }
        public void ParseShouldReturnItemStatWithoutValueIfTextDoesNotContainPlaceholders(StatCategory statCategory, string statText, string textWithPlaceholders)
        {
            string[] itemStringLines = this.itemStringBuilder
                                       .WithName("Titan Greaves")
                                       .WithItemLevel(75)
                                       .WithItemStat(statText, statCategory)
                                       .BuildLines();

            this.statsDataServiceMock.Setup(x => x.GetStatData(It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <string[]>()))
            .Returns(new StatData
            {
                Text = textWithPlaceholders
            });

            ItemStats result = this.itemStatsParser.Parse(itemStringLines, false);

            Assert.That(result.AllStats, Has.Count.EqualTo(1));

            ItemStat itemStat = result.AllStats.First();

            Assert.That(itemStat.GetType(), Is.EqualTo(typeof(ItemStat)));
        }
示例#25
0
        public async Task LoadAsyncShouldCallCreateOnStatFilterViewModelFactoryForItemStats(StatCategory statCategory)
        {
            ItemWithStats      item = CreateItemWithStats(statCategory);
            SearchQueryRequest searchQueryRequest = new SearchQueryRequest {
                League = "Heist"
            };

            await this.advancedFiltersViewModel.LoadAsync(item, searchQueryRequest, default);

            foreach (var itemStat in item.Stats.AllStats)
            {
                this.statFilterViewModelFactoryMock.Verify(x => x.Create(itemStat, searchQueryRequest));
            }
        }
示例#26
0
 public ItemStat(StatCategory statCategory)
 {
     this.StatCategory = statCategory;
 }
 public StatCategoryViewModel()
 {
     StatCategory = new StatCategory();
 }
 public StatCategoryViewModel(Action <StatCategoryViewModel> onDelete)
 {
     StatCategory = new StatCategory();
     OnDelete     = onDelete;
 }
示例#29
0
 public MinMaxValueItemStat(StatCategory statCategory) : base(statCategory)
 {
 }