public static bool IsArmoryFull(CurrentPlayer currentPlayer) { int currentActiveEquipmentCapacity = ArmoryUtils.GetCurrentActiveEquipmentCapacity(currentPlayer.ActiveArmory); int maxCapacity = currentPlayer.ActiveArmory.MaxCapacity; return(currentActiveEquipmentCapacity >= maxCapacity); }
private static bool ConditionMet(string condition) { if (string.IsNullOrEmpty(condition)) { return(false); } if (condition != null) { if (condition == "ownsArmory") { return(ArmoryUtils.PlayerHasArmory()); } if (condition == "hasAvailableEquipment") { return(CrateUtils.PlayerHasEquipmentAvailable()); } } if (condition.StartsWith("hq")) { string value = condition.Substring("hq".Length); int level = Convert.ToInt32(value); return(CrateUtils.PlayerHasAtLeastHqLevel(level)); } return(false); }
public static List <string> GetValidEquipment(CurrentPlayer player, IDataController dc, string planetId) { List <string> list = null; List <string> equipment = player.ActiveArmory.Equipment; if (equipment != null) { int i = 0; int count = equipment.Count; while (i < count) { EquipmentVO equipmentVO = dc.Get <EquipmentVO>(equipment[i]); if (ArmoryUtils.IsEquipmentValidForPlanet(equipmentVO, planetId)) { if (list == null) { list = new List <string>(); } list.Add(equipmentVO.Uid); } i++; } } return(list); }
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 static bool PlayerHasEquipmentAvailable() { CurrentPlayer currentPlayer = Service.CurrentPlayer; EquipmentUpgradeCatalog equipmentUpgradeCatalog = Service.EquipmentUpgradeCatalog; foreach (string current in equipmentUpgradeCatalog.AllUpgradeGroups()) { if (!ArmoryUtils.HasReachedMaxEquipmentShards(currentPlayer, equipmentUpgradeCatalog, current)) { return(true); } } return(false); }
private static int SortByRequirementsMet(SortableEquipment a, SortableEquipment b) { bool flag = ArmoryUtils.IsBuildingRequirementMet(a.Equipment); bool flag2 = ArmoryUtils.IsBuildingRequirementMet(b.Equipment); if (flag && !flag2) { return(-1); } if (flag2 && !flag) { return(1); } return(0); }
private static int SortByCurrentPlanet(SortableEquipment a, SortableEquipment b) { bool flag = ArmoryUtils.IsEquipmentOnValidPlanet(a.Player, a.Equipment); bool flag2 = ArmoryUtils.IsEquipmentOnValidPlanet(b.Player, b.Equipment); if (flag && !flag2) { return(-1); } if (flag2 && !flag) { return(1); } return(0); }
public static int GetShardsRequiredForNextUpgrade(CurrentPlayer currentPlayer, EquipmentUpgradeCatalog equipmentCatalog, EquipmentVO equipmentVO) { if (!ArmoryUtils.IsEquipmentOwned(currentPlayer, equipmentVO)) { EquipmentVO minLevel = equipmentCatalog.GetMinLevel(equipmentVO.EquipmentID); return(minLevel.UpgradeShards); } EquipmentVO nextLevel = equipmentCatalog.GetNextLevel(equipmentVO); if (nextLevel == null) { return(-1); } return(nextLevel.UpgradeShards); }
public static void HandleCrateSupplyRewardClicked(CrateSupplyVO crateSupply) { IDataController dataController = Service.Get <IDataController>(); DeployableShardUnlockController deployableShardUnlockController = Service.Get <DeployableShardUnlockController>(); IDeployableVO deployableVO = null; EquipmentVO equipmentVO = null; switch (crateSupply.Type) { case SupplyType.Shard: equipmentVO = ArmoryUtils.GetCurrentEquipmentDataByID(crateSupply.RewardUid); break; case SupplyType.Troop: case SupplyType.Hero: deployableVO = dataController.Get <TroopTypeVO>(crateSupply.RewardUid); break; case SupplyType.SpecialAttack: deployableVO = dataController.Get <SpecialAttackTypeVO>(crateSupply.RewardUid); break; case SupplyType.ShardTroop: case SupplyType.ShardSpecialAttack: { ShardVO shard = dataController.Get <ShardVO>(crateSupply.RewardUid); deployableVO = deployableShardUnlockController.GetDeployableVOFromShard(shard); break; } } Entity availableTroopResearchLab = Service.Get <BuildingLookupController>().GetAvailableTroopResearchLab(); if (deployableVO != null) { Service.Get <EventManager>().SendEvent(EventId.LootTableUnitInfoTapped, deployableVO.Uid); TroopUpgradeTag troopUpgradeTag = new TroopUpgradeTag(deployableVO, true); bool showUpgradeControls = !string.IsNullOrEmpty(troopUpgradeTag.Troop.UpgradeShardUid); DeployableInfoScreen screen = new DeployableInfoScreen(troopUpgradeTag, null, showUpgradeControls, availableTroopResearchLab); Service.Get <ScreenController>().AddScreen(screen); return; } if (equipmentVO != null) { EquipmentInfoScreen screen2 = new EquipmentInfoScreen(equipmentVO, null, availableTroopResearchLab, true); Service.Get <ScreenController>().AddScreen(screen2); } }
public unsafe static long $Invoke15(long instance, long *args) { return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.IsEquipmentOwned((CurrentPlayer)GCHandledObjects.GCHandleToObject(*args), (EquipmentVO)GCHandledObjects.GCHandleToObject(args[1])))); }
public unsafe static long $Invoke12(long instance, long *args) { return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.IsBuildingRequirementMet((EquipmentVO)GCHandledObjects.GCHandleToObject(*args)))); }
public unsafe static long $Invoke11(long instance, long *args) { return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.IsAtMaxLevel((EquipmentUpgradeCatalog)GCHandledObjects.GCHandleToObject(*args), (EquipmentVO)GCHandledObjects.GCHandleToObject(args[1])))); }
public unsafe static long $Invoke10(long instance, long *args) { return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.IsArmoryFull((CurrentPlayer)GCHandledObjects.GCHandleToObject(*args)))); }
public static string GetEquipmentDisplayNameById(string equipmentId) { EquipmentVO currentEquipmentDataByID = ArmoryUtils.GetCurrentEquipmentDataByID(equipmentId); return(LangUtils.GetEquipmentDisplayName(currentEquipmentDataByID)); }
public static EquipmentVO GetCurrentEquipmentDataByID(string equipmentId) { int level = Service.Get <CurrentPlayer>().UnlockedLevels.Equipment.GetLevel(equipmentId); return(ArmoryUtils.GetEquipmentDataByID(equipmentId, level)); }
public unsafe static long $Invoke4(long instance, long *args) { return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.GetShardsRequiredForNextUpgrade((CurrentPlayer)GCHandledObjects.GCHandleToObject(*args), (EquipmentUpgradeCatalog)GCHandledObjects.GCHandleToObject(args[1]), (EquipmentVO)GCHandledObjects.GCHandleToObject(args[2])))); }
public unsafe static long $Invoke3(long instance, long *args) { return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.GetEquipmentDataByID(Marshal.PtrToStringUni(*(IntPtr *)args), *(int *)(args + 1)))); }
public unsafe static long $Invoke1(long instance, long *args) { return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.GetCurrentActiveEquipmentCapacity((ActiveArmory)GCHandledObjects.GCHandleToObject(*args)))); }
public static bool IsArmoryEmpty(CurrentPlayer currentPlayer) { int currentActiveEquipmentCapacity = ArmoryUtils.GetCurrentActiveEquipmentCapacity(currentPlayer.ActiveArmory); return(currentActiveEquipmentCapacity == 0); }
public unsafe static long $Invoke16(long instance, long *args) { return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.IsEquipmentValidForPlanet((EquipmentVO)GCHandledObjects.GCHandleToObject(*args), Marshal.PtrToStringUni(*(IntPtr *)(args + 1))))); }
public unsafe static long $Invoke6(long instance, long *args) { return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.HasEnoughCapacityToActivateEquipment((ActiveArmory)GCHandledObjects.GCHandleToObject(*args), (EquipmentVO)GCHandledObjects.GCHandleToObject(args[1])))); }
public unsafe static long $Invoke17(long instance, long *args) { return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.PlayerHasArmory())); }
public unsafe static long $Invoke7(long instance, long *args) { return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.HasReachedMaxEquipmentShards((CurrentPlayer)GCHandledObjects.GCHandleToObject(*args), (EquipmentUpgradeCatalog)GCHandledObjects.GCHandleToObject(args[1]), Marshal.PtrToStringUni(*(IntPtr *)(args + 2))))); }
public static bool HasEnoughCapacityToActivateEquipment(ActiveArmory armory, EquipmentVO equipment) { return(ArmoryUtils.GetCurrentActiveEquipmentCapacity(armory) + equipment.Size <= armory.MaxCapacity); }
public unsafe static long $Invoke8(long instance, long *args) { return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.IsAnyEquipmentActive((ActiveArmory)GCHandledObjects.GCHandleToObject(*args)))); }
public unsafe static long $Invoke5(long instance, long *args) { return(GCHandledObjects.ObjectToGCHandle(ArmoryUtils.GetValidEquipment((CurrentPlayer)GCHandledObjects.GCHandleToObject(*args), (IDataController)GCHandledObjects.GCHandleToObject(args[1]), Marshal.PtrToStringUni(*(IntPtr *)(args + 2))))); }
public static bool IsAnyEquipmentActive(ActiveArmory armory) { return(ArmoryUtils.GetCurrentActiveEquipmentCapacity(armory) > 0); }