Example #1
0
        private void AdjustOfferQuantities()
        {
            int count = this.CurrentShopData.ShardOffers.Count;

            for (int i = 0; i < count; i++)
            {
                ShardShopPoolVO pool                      = this.CurrentShopData.ActiveSeries.GetPool(i);
                string          shardSlotId               = GameUtils.GetShardSlotId(i);
                CrateSupplyVO   crateSupplyVO             = this.CurrentShopData.ShardOffers[shardSlotId];
                int             shardCountToReachMaxLevel = GameUtils.GetShardCountToReachMaxLevel(crateSupplyVO.RewardUid, crateSupplyVO.Type);
                int             spentShardCount           = GameUtils.GetSpentShardCount(crateSupplyVO.RewardUid, crateSupplyVO.Type);
                int             upgradeShardsOwned        = GameUtils.GetUpgradeShardsOwned(crateSupplyVO, Service.CurrentPlayer);
                int             val = shardCountToReachMaxLevel - (spentShardCount + upgradeShardsOwned);
                this.adjustedOfferQuantity[i] = Math.Min(val, pool.GetTotalQuantity());
            }
        }
Example #2
0
        public static CostVO CalculateCost(int slotIndex, int quantity, ShardShopData data)
        {
            Dictionary <string, int> dictionary = data.Purchases[slotIndex];
            ShardShopPoolVO          pool       = data.ActiveSeries.GetPool(slotIndex);
            int num = 0;

            foreach (int current in dictionary.Values)
            {
                num += current;
            }
            CostVO costVO = pool.GetCost(num);

            if (quantity > 1)
            {
                for (int i = 1; i < quantity; i++)
                {
                    CostVO cost = pool.GetCost(num + i);
                    costVO = CostUtils.Combine(costVO, cost);
                }
            }
            return(CostUtils.CombineCurrenciesForShards(costVO));
        }