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) ? 0 : maxLevel.Lvl; if (level >= num) { return(true); } int numEquipmentShardsToReachLevel = ArmoryUtils.GetNumEquipmentShardsToReachLevel(catalog, equipmentID, level, num); return(player.Shards.ContainsKey(equipmentID) && player.Shards[equipmentID] >= numEquipmentShardsToReachLevel); }
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); }
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); }
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)); }
public static bool IsAtMaxLevel(EquipmentUpgradeCatalog equipmentUpgradeCatalog, EquipmentVO equipmentVO) { EquipmentVO maxLevel = equipmentUpgradeCatalog.GetMaxLevel(equipmentVO.EquipmentID); return(maxLevel.Lvl == equipmentVO.Lvl); }