Ejemplo n.º 1
0
        private bool GetEquipmentShardUIInfoForCurrentItem(out int currentShardAmount, out int increasedShardAmount, out int shardsNeededForLevel, out bool showLevel, out EquipmentVO equipmentVoToDisplay)
        {
            currentShardAmount   = 0;
            increasedShardAmount = 0;
            shardsNeededForLevel = 0;
            equipmentVoToDisplay = null;
            showLevel            = false;
            CrateSupplyVO crateSupply = this.currentCrateItem.CrateSupply;

            if (crateSupply.Type != SupplyType.Shard)
            {
                return(false);
            }
            EquipmentVO equipment = this.currentCrateItem.Equipment;

            if (equipment == null)
            {
                return(false);
            }
            EquipmentUpgradeCatalog equipmentUpgradeCatalog = Service.EquipmentUpgradeCatalog;
            string equipmentID = equipment.EquipmentID;
            int    num         = (!this.shardsOriginal.ContainsKey(equipmentID)) ? 0 : this.shardsOriginal[equipmentID];

            currentShardAmount = num;
            RewardVO reward         = Service.InventoryCrateRewardController.GenerateRewardFromSupply(crateSupply, this.hq);
            int      shardsRewarded = RewardUtils.GetShardsRewarded(reward);
            int      num2           = num + shardsRewarded;

            increasedShardAmount = num2;
            EquipmentVO equipmentVO = equipment;

            showLevel = true;
            if (this.equipmentOriginal.ContainsKey(equipmentID))
            {
                int num3  = this.equipmentOriginal[equipmentID];
                int level = Mathf.Min(num3 + 1, equipmentUpgradeCatalog.GetMaxLevel(equipmentID).Lvl);
                equipmentVoToDisplay = equipmentUpgradeCatalog.GetByLevel(equipment, num3);
                equipmentVO          = equipmentUpgradeCatalog.GetByLevel(equipmentVoToDisplay, level);
            }
            else
            {
                equipmentVoToDisplay = equipmentUpgradeCatalog.GetMinLevel(equipmentVO.EquipmentID);
                equipmentVO          = equipmentVoToDisplay;
                showLevel            = false;
            }
            shardsNeededForLevel = equipmentVO.UpgradeShards;
            return(true);
        }
Ejemplo n.º 2
0
        public static int GetNumEquipmentShardsToReachLevel(EquipmentUpgradeCatalog catalog, string equipmentID, int initialUnlockLevel, int maxLevel)
        {
            if (initialUnlockLevel >= maxLevel)
            {
                return(0);
            }
            int num = 0;

            for (int i = initialUnlockLevel + 1; i <= maxLevel; i++)
            {
                EquipmentVO byLevel = catalog.GetByLevel(equipmentID, i);
                num += byLevel.UpgradeShards;
            }
            return(num);
        }
Ejemplo n.º 3
0
        public static bool HasReachedMaxEquipmentShards(CurrentPlayer player, EquipmentUpgradeCatalog catalog, string equipmentID)
        {
            int         level    = player.UnlockedLevels.Equipment.GetLevel(equipmentID);
            EquipmentVO maxLevel = catalog.GetMaxLevel(equipmentID);
            int         num      = (maxLevel != null) ? maxLevel.Lvl : 0;

            if (level >= num)
            {
                return(true);
            }
            int num2 = 0;

            for (int i = level + 1; i <= num; i++)
            {
                EquipmentVO byLevel = catalog.GetByLevel(equipmentID, i);
                num2 += byLevel.UpgradeShards;
            }
            return(player.Shards.ContainsKey(equipmentID) && player.Shards[equipmentID] >= num2);
        }
Ejemplo n.º 4
0
 private void FindAllUpgradableEquipment(CurrentPlayer player, EquipmentUpgradeCatalog catalog)
 {
     this.equipmentToDisplay.Clear();
     foreach (string current in catalog.AllUpgradeGroups())
     {
         int         level       = player.UnlockedLevels.Equipment.GetLevel(current);
         EquipmentVO equipmentVO = catalog.GetByLevel(current, level);
         if (equipmentVO == null)
         {
             equipmentVO = catalog.GetMaxLevel(current);
         }
         if (equipmentVO.PlayerFacing)
         {
             if (equipmentVO.Faction == player.Faction)
             {
                 this.equipmentToDisplay.Add(equipmentVO);
             }
         }
     }
     this.equipmentToDisplay.Sort(new Comparison <EquipmentVO>(this.CompareBySortOrder));
 }
Ejemplo n.º 5
0
        private List <EquipmentVO> GenerateInactiveEquipmentList()
        {
            CurrentPlayer             currentPlayer           = Service.CurrentPlayer;
            IDictionary <string, int> levels                  = currentPlayer.UnlockedLevels.Equipment.Levels;
            EquipmentUpgradeCatalog   equipmentUpgradeCatalog = Service.EquipmentUpgradeCatalog;
            List <string>             iDCollection            = equipmentUpgradeCatalog.GetIDCollection();
            List <SortableEquipment>  list = new List <SortableEquipment>();
            EquipmentTab currentTab        = (EquipmentTab)this.equipmentTabs.CurrentTab;
            int          i     = 0;
            int          count = iDCollection.Count;

            while (i < count)
            {
                string text  = iDCollection[i];
                int    level = 1;
                if (levels.ContainsKey(text))
                {
                    level = levels[text];
                }
                EquipmentVO byLevel = equipmentUpgradeCatalog.GetByLevel(text, level);
                if (currentPlayer.Faction == byLevel.Faction && !currentPlayer.ActiveArmory.Equipment.Contains(byLevel.Uid))
                {
                    if (this.equipmentTabs.IsEquipmentValidForTab(byLevel, currentTab))
                    {
                        list.Add(new SortableEquipment(currentPlayer, byLevel));
                    }
                }
                i++;
            }
            ArmorySortUtils.SortWithPriorityList(list, new List <EquipmentSortMethod>
            {
                EquipmentSortMethod.UnlockedEquipment,
                EquipmentSortMethod.RequirementsMet,
                EquipmentSortMethod.Quality,
                EquipmentSortMethod.CurrentPlanet,
                EquipmentSortMethod.CapacitySize,
                EquipmentSortMethod.Alphabetical
            });
            return(ArmorySortUtils.RemoveWrapper(list));
        }
Ejemplo n.º 6
0
        public static EquipmentVO GetEquipmentDataByID(string equipmentID, int level)
        {
            EquipmentUpgradeCatalog equipmentUpgradeCatalog = Service.Get <EquipmentUpgradeCatalog>();

            return(equipmentUpgradeCatalog.GetByLevel(equipmentID, level));
        }