Пример #1
0
 /// <summary>
 /// Whether or not an item was purchased, on average, during the late stage of the game.
 /// </summary>
 public static bool IsLatePurchase(ItemPurchaseTrackerData tracker)
 {
     return
         !IsStartPurchase(tracker) &&
         !IsEarlyPurchase(tracker) &&
         !IsMidPurchase(tracker);
 }
Пример #2
0
        public ItemPurchaseTrackerData Clone()
        {
            var tracker = new ItemPurchaseTrackerData(this.ItemId);

            tracker.CopyFrom(this);
            return(tracker);
        }
Пример #3
0
 /// <summary>
 /// Gets the game stage a purchase took place in.
 /// </summary>
 public static GameStage GetGameStage(ItemPurchaseTrackerData tracker)
 {
     return
         IsStartPurchase(tracker) ? GameStage.Start :
         IsEarlyPurchase(tracker) ? GameStage.Early :
         IsMidPurchase(tracker) ? GameStage.Mid :
         GameStage.Late;
 }
Пример #4
0
        public ItemPurchaseStats(ItemPurchaseTrackerData tracker, long totalMatches) : base(tracker.ItemId)
        {
            CopyFrom(tracker);
            Percentage   = (float)this.Count / (float)totalMatches;
            TotalMatches = totalMatches;

            // Calculate build path percentages
            BuiltIntoPercentage      = BuiltInto.ToDictionary(kvp => kvp.Key, kvp => (float)kvp.Value / (this.Count));
            FinalBuildItemPercentage = FinalBuildItem.ToDictionary(kvp => kvp.Key, kvp => (float)kvp.Value / (this.Count));
        }
Пример #5
0
        public ItemPurchaseStats(ItemPurchaseTrackerData tracker, long totalMatches)
            : base(tracker.ItemId)
        {
            CopyFrom(tracker);
            Percentage = (float)this.Count / (float)totalMatches;
            TotalMatches = totalMatches;

            // Calculate build path percentages
            BuiltIntoPercentage = BuiltInto.ToDictionary(kvp => kvp.Key, kvp => (float)kvp.Value / (this.Count));
            FinalBuildItemPercentage = FinalBuildItem.ToDictionary(kvp => kvp.Key, kvp => (float)kvp.Value / (this.Count));
        }
Пример #6
0
        protected void CopyFrom(ItemPurchaseTrackerData other)
        {
            ItemId = other.ItemId;
            Number = other.Number;
            Count  = other.Count;
            AveragePurchaseTimeSeconds = other.AveragePurchaseTimeSeconds;
            Kills           = other.Kills;
            TowerKills      = other.TowerKills;
            InnerTowerKills = other.InnerTowerKills;
            BaseTowerKills  = other.BaseTowerKills;

            BuiltInto      = new Dictionary <ItemPurchaseKey, long>(other.BuiltInto);
            FinalBuildItem = new Dictionary <ItemPurchaseKey, long>(other.FinalBuildItem);
        }
Пример #7
0
        public void Combine(ItemPurchaseTrackerData other)
        {
            if (other.ItemId != ItemId ||
                other.Number != Number)
            {
                return;
            }

            double totalCount = Count + other.Count;

            AveragePurchaseTimeSeconds =
                (AveragePurchaseTimeSeconds * ((double)Count / totalCount)) +
                (other.AveragePurchaseTimeSeconds * ((double)other.Count / totalCount));

            Count += other.Count;

            Kills           += other.Kills;
            TowerKills      += other.TowerKills;
            InnerTowerKills += other.InnerTowerKills;
            BaseTowerKills  += other.BaseTowerKills;
        }
Пример #8
0
 public ItemPurchaseKey(ItemPurchaseTrackerData tracker)
 {
     ItemId = tracker.ItemId;
     Number = tracker.Number;
 }
Пример #9
0
        protected void CopyFrom(ItemPurchaseTrackerData other)
        {
            ItemId = other.ItemId;
            Number = other.Number;
            Count = other.Count;
            AveragePurchaseTimeSeconds = other.AveragePurchaseTimeSeconds;
            Kills = other.Kills;
            TowerKills = other.TowerKills;
            InnerTowerKills = other.InnerTowerKills;
            BaseTowerKills = other.BaseTowerKills;

            BuiltInto = new Dictionary<ItemPurchaseKey, long>(other.BuiltInto);
            FinalBuildItem = new Dictionary<ItemPurchaseKey, long>(other.FinalBuildItem);
        }
Пример #10
0
        public void Combine(ItemPurchaseTrackerData other)
        {
            if (other.ItemId != ItemId ||
                other.Number != Number)
                return;

            double totalCount = Count + other.Count;

            AveragePurchaseTimeSeconds =
                (AveragePurchaseTimeSeconds * ((double)Count / totalCount)) +
                (other.AveragePurchaseTimeSeconds * ((double)other.Count / totalCount));

            Count += other.Count;

            Kills += other.Kills;
            TowerKills += other.TowerKills;
            InnerTowerKills += other.InnerTowerKills;
            BaseTowerKills += other.BaseTowerKills;
        }
Пример #11
0
 public ItemPurchaseTrackerData Clone()
 {
     var tracker = new ItemPurchaseTrackerData(this.ItemId);
     tracker.CopyFrom(this);
     return tracker;
 }
Пример #12
0
 public ItemPurchaseKey(ItemPurchaseTrackerData tracker)
 {
     ItemId = tracker.ItemId;
     Number = tracker.Number;
 }
Пример #13
0
 /// <summary>
 /// Whether or not an item was purchased, on average, during the mid stage of the game.
 /// </summary>
 public static bool IsMidPurchase(ItemPurchaseTrackerData tracker)
 {
     return
         !IsStartPurchase(tracker) &&
         !IsEarlyPurchase(tracker) &&
         tracker.AverageInnerTowerKills < 2.5f && // Getting too close to 3 puts a lot of items into the mid-game bucket
         tracker.AverageBaseTowerKills < 1.0f;
 }
Пример #14
0
 /// <summary>
 /// Whether or not an item was purchased, on average, during the early stage of the game.
 /// </summary>
 public static bool IsEarlyPurchase(ItemPurchaseTrackerData tracker)
 {
     return
         !IsStartPurchase(tracker) &&
         tracker.AverageTowerKills < 1.0f;
 }
Пример #15
0
 /// <summary>
 /// Whether or not an item was purchased, on average, during the start of the game.
 /// </summary>
 public static bool IsStartPurchase(ItemPurchaseTrackerData tracker)
 {
     return
         tracker.AveragePurchaseTimeSeconds <= 90.0 &&
         tracker.AverageKills < 1.0f &&
         tracker.AverageTowerKills < 1.0;
 }