public List <ActivatedPerkData> GetPerksAppliedToBuilding(BuildingTypeVO vo) { List <ActivatedPerkData> list = new List <ActivatedPerkData>(); StaticDataController staticDataController = Service.StaticDataController; List <ActivatedPerkData> playerActivatedPerks = this.GetPlayerActivatedPerks(); int i = 0; int count = playerActivatedPerks.Count; while (i < count) { ActivatedPerkData activatedPerkData = playerActivatedPerks[i]; PerkVO perkVO = staticDataController.Get <PerkVO>(activatedPerkData.PerkId); if (activatedPerkData.EndTime > ServerTime.Time) { int j = 0; int num = perkVO.PerkEffects.Length; while (j < num) { PerkEffectVO perkEffectVO = staticDataController.Get <PerkEffectVO>(perkVO.PerkEffects[j]); bool flag = this.IsPerkEffectAppliedToBuilding(perkEffectVO, vo); if (flag) { list.Add(activatedPerkData); break; } j++; } } i++; } return(list); }
public bool PlayMostRecentStoryAction() { StaticDataController staticDataController = Service.StaticDataController; EpisodeProgressInfo episodeProgressInfo = Service.CurrentPlayer.EpisodeProgressInfo; EpisodeDataVO episodeDataVO = staticDataController.Get <EpisodeDataVO>(episodeProgressInfo.uid); string text = string.Empty; if (episodeProgressInfo.grindInfo.Started > 0) { text = staticDataController.Get <EpisodeTaskVO>(episodeDataVO.GrindTask).StoryID; } if (string.IsNullOrEmpty(text)) { int num = Math.Min(episodeProgressInfo.currentTaskIndex, episodeDataVO.Tasks.Length - 1); for (int i = num; i >= 0; i--) { EpisodeTaskVO optional = staticDataController.GetOptional <EpisodeTaskVO>(episodeDataVO.Tasks[i]); if (optional != null && !string.IsNullOrEmpty(optional.StoryID)) { text = optional.StoryID; break; } } } if (string.IsNullOrEmpty(text)) { Service.Logger.Error("EpisodeInfoScreen: Could not determine most recent story ID"); } return(this.PlayTaskStoryAction(text)); }
public static void AddEquipmentBuffs(List <string> attackerEquipment, List <string> defenderEquipment) { BuffController buffController = Service.BuffController; buffController.ClearEquipmentBuffs(); StaticDataController staticDataController = Service.StaticDataController; if (attackerEquipment != null) { int i = 0; int count = attackerEquipment.Count; while (i < count) { EquipmentVO equipmentVO = staticDataController.Get <EquipmentVO>(attackerEquipment[i]); string[] effectUids = equipmentVO.EffectUids; if (effectUids != null) { int j = 0; int num = effectUids.Length; while (j < num) { EquipmentEffectVO effectVO = staticDataController.Get <EquipmentEffectVO>(effectUids[j]); buffController.AddAttackerEquipmentBuff(effectVO); j++; } } i++; } } if (defenderEquipment != null) { int k = 0; int count2 = defenderEquipment.Count; while (k < count2) { EquipmentVO equipmentVO2 = staticDataController.Get <EquipmentVO>(defenderEquipment[k]); string[] effectUids2 = equipmentVO2.EffectUids; if (effectUids2 != null) { int l = 0; int num2 = effectUids2.Length; while (l < num2) { EquipmentEffectVO effectVO2 = staticDataController.Get <EquipmentEffectVO>(effectUids2[l]); buffController.AddDefenderEquipmentBuff(effectVO2); l++; } } k++; } } }
private void CheckForTierChangeAfterBattle(TournamentRank oldRank, TournamentRank rank, string tournamentUID) { if (oldRank != null && !string.IsNullOrEmpty(oldRank.TierUid)) { StaticDataController staticDataController = Service.StaticDataController; TournamentTierVO tournamentTierVO = staticDataController.Get <TournamentTierVO>(oldRank.TierUid); TournamentTierVO tournamentTierVO2 = staticDataController.Get <TournamentTierVO>(rank.TierUid); if (tournamentTierVO2.Percentage < tournamentTierVO.Percentage) { Service.EventManager.RegisterObserver(this, EventId.WorldInTransitionComplete, EventPriority.Default); } } }
public bool IsShardDeployableReadyToUpgrade(string shardId) { CurrentPlayer currentPlayer = Service.CurrentPlayer; Dictionary <string, int> shards = currentPlayer.Shards; StaticDataController staticDataController = Service.StaticDataController; ShardVO shardVO = staticDataController.Get <ShardVO>(shardId); bool flag = shardVO.TargetType == "specialAttack"; int num = 0; if (shards.ContainsKey(shardId)) { num += shards[shardId]; } int upgradeLevelOfDeployable = this.GetUpgradeLevelOfDeployable(shardVO.TargetType, shardVO.TargetGroupId); IDeployableVO deployableVOForLevelInGroup; if (flag) { deployableVOForLevelInGroup = this.GetDeployableVOForLevelInGroup <SpecialAttackTypeVO>(upgradeLevelOfDeployable + 1, shardVO.TargetGroupId); } else { deployableVOForLevelInGroup = this.GetDeployableVOForLevelInGroup <TroopTypeVO>(upgradeLevelOfDeployable + 1, shardVO.TargetGroupId); } return(deployableVOForLevelInGroup != null && this.DoesUserHaveUpgradeShardRequirement(deployableVOForLevelInGroup)); }
public int GetAvailableSlotsCount(string guildLevelUid) { StaticDataController staticDataController = Service.StaticDataController; SquadLevelVO squadLevelVO = staticDataController.Get <SquadLevelVO>(guildLevelUid); return(squadLevelVO.Slots); }
private void AddBuffsOnSpawn(SmartEntity target) { if (target.TroopComp == null) { return; } string[] spawnApplyBuffs = target.TroopComp.TroopType.SpawnApplyBuffs; if (spawnApplyBuffs == null || spawnApplyBuffs.Length == 0) { return; } ArmorType armorType = GameUtils.DeduceArmorType(target); if (armorType == ArmorType.Invalid) { return; } StaticDataController staticDataController = Service.StaticDataController; int i = 0; int num = spawnApplyBuffs.Length; while (i < num) { BuffTypeVO buffTypeVO = staticDataController.Get <BuffTypeVO>(spawnApplyBuffs[i]); if (buffTypeVO.ApplyToSelf) { this.TryAddBuffStack(target, buffTypeVO, armorType, BuffVisualPriority.Default, target); } i++; } }
public void AddToPerkBadgeList(string perkId) { StaticDataController staticDataController = Service.StaticDataController; PerkVO perkVO = staticDataController.Get <PerkVO>(perkId); if (perkVO != null) { List <string> list = this.GetListOfBadgedPerkGroups(); if (list == null) { list = new List <string>(); } int count = list.Count; int num = GameConstants.SQUADPERK_MAX_PERK_CARD_BADGES - count; if (num <= 0) { this.TrimPerkBadgeList(ref list, Math.Abs(num) + 1); } string perkGroup = perkVO.PerkGroup; list.Add(perkGroup); this.SetPerkBadgeList(list); } else { Service.Logger.Error("PerkViewController.AddToPerkBadgeList Failed to find Perk Data for: " + perkId); } }
private void UpdateActiveArmoryLevel(EquipmentVO equipmentVO) { if (equipmentVO == null) { Service.Logger.Warn("Equipment is null"); return; } StaticDataController staticDataController = Service.StaticDataController; CurrentPlayer currentPlayer = Service.CurrentPlayer; List <string> equipment = currentPlayer.ActiveArmory.Equipment; int i = 0; int count = equipment.Count; while (i < count) { string text = equipment[i]; EquipmentVO equipmentVO2 = staticDataController.Get <EquipmentVO>(text); if (equipmentVO2.EquipmentID == equipmentVO.EquipmentID) { equipment.Remove(text); equipment.Add(equipmentVO.Uid); break; } i++; } }
public void PurchaseCooldownSkip(string perkId) { StaticDataController staticDataController = Service.StaticDataController; string perkGroup = staticDataController.Get <PerkVO>(perkId).PerkGroup; ActivatedPerkData playerPerkForGroup = this.GetPlayerPerkForGroup(perkGroup); if (this.IsPerkInCooldown(playerPerkForGroup)) { Dictionary <string, uint> playerPerkGroupCooldowns = this.GetPlayerPerkGroupCooldowns(); uint seconds = playerPerkGroupCooldowns[perkGroup] - ServerTime.Time; int crystals = GameUtils.SecondsToCrystalsForPerk((int)seconds); if (!GameUtils.SpendCrystals(crystals)) { return; } ProcessingScreen.Show(); PlayerPerkSkipCooldownRequest request = new PlayerPerkSkipCooldownRequest(playerPerkForGroup.PerkId); PlayerPerkSkipCooldownCommand command = new PlayerPerkSkipCooldownCommand(request); Service.ServerAPI.Sync(command); } else { Service.Logger.WarnFormat("Perk {0} is no longer in cooldown, skipping purchase", new object[] { playerPerkForGroup.PerkId }); } }
private void CleanupExpiredPlayerPerks() { StaticDataController staticDataController = Service.StaticDataController; List <ActivatedPerkData> playerActivatedPerks = this.GetPlayerActivatedPerks(); Dictionary <string, uint> playerPerkGroupCooldowns = this.GetPlayerPerkGroupCooldowns(); ResourceGenerationPerkUtils.ProcessResouceGenPerkEffectsIntoStorage(this.GetPlayerActivatedPerks()); List <ActivatedPerkData> list = new List <ActivatedPerkData>(); int i = 0; int count = playerActivatedPerks.Count; while (i < count) { ActivatedPerkData activatedPerkData = playerActivatedPerks[i]; if (this.IsPerkExpired(activatedPerkData.PerkId)) { PerkVO perkVO = staticDataController.Get <PerkVO>(activatedPerkData.PerkId); string perkGroup = perkVO.PerkGroup; if (playerPerkGroupCooldowns.ContainsKey(perkGroup)) { playerPerkGroupCooldowns.Remove(perkGroup); } list.Add(playerActivatedPerks[i]); } i++; } int j = 0; int count2 = list.Count; while (j < count2) { playerActivatedPerks.Remove(list[j]); j++; } }
private void AddSpecialAttackDamageBuff(SpecialAttack specialAttack, WarBuffVO warBuffVO) { StaticDataController staticDataController = Service.StaticDataController; BuffTypeVO buffVO = staticDataController.Get <BuffTypeVO>(warBuffVO.TroopBuffUid); specialAttack.AddAppliedBuff(buffVO, BuffVisualPriority.SquadWars); }
private void ApplySpecialAttackEquipmentBuffs(SpecialAttack specialAttack) { StaticDataController staticDataController = Service.StaticDataController; List <EquipmentEffectVO> equipmentBuffsForTeam = this.GetEquipmentBuffsForTeam(specialAttack.TeamType); int num = (equipmentBuffsForTeam == null) ? 0 : equipmentBuffsForTeam.Count; for (int i = 0; i < num; i++) { EquipmentEffectVO equipmentEffectVO = equipmentBuffsForTeam[i]; if (equipmentEffectVO.BuffUids != null && equipmentEffectVO.AffectedSpecialAttackIds != null) { int j = 0; int num2 = equipmentEffectVO.AffectedSpecialAttackIds.Length; while (j < num2) { if (equipmentEffectVO.AffectedSpecialAttackIds[j] == specialAttack.VO.SpecialAttackID) { int k = 0; int num3 = equipmentEffectVO.BuffUids.Length; while (k < num3) { BuffTypeVO buffVO = staticDataController.Get <BuffTypeVO>(equipmentEffectVO.BuffUids[k]); specialAttack.AddAppliedBuff(buffVO, BuffVisualPriority.Equipment); k++; } break; } j++; } } } }
public void DeploySquadTroops(IntPosition boardPos) { this.Reset(); this.spawnPosition = boardPos; StaticDataController staticDataController = Service.StaticDataController; this.spawnQueue = new List <TroopTypeVO>(); List <SquadDonatedTroop> troops = Service.SquadController.StateManager.Troops; if (troops != null) { int i = 0; int count = troops.Count; while (i < count) { TroopTypeVO item = staticDataController.Get <TroopTypeVO>(troops[i].TroopUid); int j = 0; int totalAmount = troops[i].GetTotalAmount(); while (j < totalAmount) { this.spawnQueue.Add(item); j++; } i++; } } this.OnDeploy(); }
private void ApplyBuffFromBullet(Bullet bullet) { SmartEntity target = bullet.Target; ProjectileTypeVO projectileType = bullet.ProjectileType; if (target == null || target.TeamComp == null || projectileType == null) { return; } if (target.HealthComp == null || target.HealthComp.IsDead()) { return; } string[] applyBuffs = projectileType.ApplyBuffs; if (applyBuffs == null || applyBuffs.Length == 0) { return; } ArmorType armorType = GameUtils.DeduceArmorType(target); if (armorType == ArmorType.Invalid) { return; } bool flag = bullet.Owner == target; bool flag2 = !flag && bullet.OwnerTeam == target.TeamComp.TeamType; StaticDataController staticDataController = Service.StaticDataController; int i = 0; int num = applyBuffs.Length; while (i < num) { BuffTypeVO buffTypeVO = staticDataController.Get <BuffTypeVO>(applyBuffs[i]); if (flag) { if (buffTypeVO.ApplyToSelf) { goto IL_FC; } } else if (flag2) { if (buffTypeVO.ApplyToAllies) { goto IL_FC; } } else if (buffTypeVO.ApplyToEnemies) { goto IL_FC; } IL_10D: i++; continue; IL_FC: this.TryAddBuffStack(target, buffTypeVO, armorType, BuffVisualPriority.Default, bullet.Owner); goto IL_10D; } }
private void HeroAbilityActivateActionCallback(uint id, object cookie) { HeroAbilityAction heroAbilityAction = cookie as HeroAbilityAction; StaticDataController staticDataController = Service.StaticDataController; TroopTypeVO troopTypeVO = staticDataController.Get <TroopTypeVO>(heroAbilityAction.TroopUid); Service.TroopAbilityController.ActivateHeroAbility(troopTypeVO.Uid); }
private CrateSupplyVO GrantSingleSupplyCrateReward(string crateSupplyId, int hqLevel) { StaticDataController staticDataController = Service.StaticDataController; CrateSupplyVO crateSupplyVO = staticDataController.Get <CrateSupplyVO>(crateSupplyId); this.GrantSingleSupplyCrateReward(crateSupplyVO, hqLevel); return(crateSupplyVO); }
private void TroopPlacedActionCallback(uint id, object cookie) { TroopPlacedAction troopPlacedAction = cookie as TroopPlacedAction; StaticDataController staticDataController = Service.StaticDataController; TroopTypeVO troopTypeVO = staticDataController.Get <TroopTypeVO>(troopPlacedAction.TroopId); IntPosition boardPosition = new IntPosition(troopPlacedAction.BoardX, troopPlacedAction.BoardZ); Service.TroopController.SpawnTroop(troopTypeVO, troopPlacedAction.TeamType, boardPosition, (troopPlacedAction.TeamType != TeamType.Defender) ? TroopSpawnMode.Unleashed : TroopSpawnMode.LeashedToBuilding, true); this.battleController.OnTroopDeployed(troopTypeVO.Uid, troopPlacedAction.TeamType, boardPosition); }
private void ChampionDeployedActionCallback(uint id, object cookie) { ChampionDeployedAction championDeployedAction = cookie as ChampionDeployedAction; StaticDataController staticDataController = Service.StaticDataController; TroopTypeVO troopTypeVO = staticDataController.Get <TroopTypeVO>(championDeployedAction.TroopUid); IntPosition boardPosition = new IntPosition(championDeployedAction.BoardX, championDeployedAction.BoardZ); Service.TroopController.SpawnChampion(troopTypeVO, championDeployedAction.TeamType, boardPosition); this.battleController.OnChampionDeployed(troopTypeVO.Uid, championDeployedAction.TeamType, boardPosition); }
private BuildingTypeVO GetRequiredBuilding(string reqUid) { if (string.IsNullOrEmpty(reqUid)) { return(null); } StaticDataController staticDataController = Service.StaticDataController; return(staticDataController.Get <BuildingTypeVO>(reqUid)); }
private void HeroDeployedActionCallback(uint id, object cookie) { HeroDeployedAction heroDeployedAction = cookie as HeroDeployedAction; StaticDataController staticDataController = Service.StaticDataController; TroopTypeVO troopTypeVO = staticDataController.Get <TroopTypeVO>(heroDeployedAction.TroopUid); IntPosition boardPosition = new IntPosition(heroDeployedAction.BoardX, heroDeployedAction.BoardZ); SmartEntity cookie2 = Service.TroopController.SpawnHero(troopTypeVO, heroDeployedAction.TeamType, boardPosition); Service.EventManager.SendEvent(EventId.AddDecalToTroop, cookie2); this.battleController.OnHeroDeployed(troopTypeVO.Uid, heroDeployedAction.TeamType, boardPosition); }
public void SetupStatGridForPerk(PerkVO targetPerkVO, UXGrid statGrid, string templateElement, string descriptionElement, string valueElement, bool useUpgrade) { Lang lang = Service.Lang; StaticDataController staticDataController = Service.StaticDataController; string[] array = null; string[] perkEffects = targetPerkVO.PerkEffects; int num = perkEffects.Length; statGrid.SetTemplateItem(templateElement); string perkGroup = targetPerkVO.PerkGroup; int perkTier = targetPerkVO.PerkTier; if (useUpgrade && perkTier > 1) { PerkVO perkByGroupAndTier = GameUtils.GetPerkByGroupAndTier(perkGroup, perkTier - 1); array = perkByGroupAndTier.PerkEffects; if (perkEffects.Length != num) { Service.Logger.Error("PerkEffects list not consistent between " + perkByGroupAndTier.Uid + " and " + targetPerkVO.Uid); } } statGrid.Clear(); for (int i = 0; i < num; i++) { PerkEffectVO perkEffectVO = staticDataController.Get <PerkEffectVO>(perkEffects[i]); PerkEffectVO prevVO = null; if (array != null) { prevVO = staticDataController.Get <PerkEffectVO>(array[i]); } string itemUid = perkEffectVO.Uid + i; UXElement item = statGrid.CloneTemplateItem(itemUid); UXLabel subElement = statGrid.GetSubElement <UXLabel>(itemUid, descriptionElement); UXLabel subElement2 = statGrid.GetSubElement <UXLabel>(itemUid, valueElement); subElement.Text = lang.Get(perkEffectVO.StatStringId, new object[0]); subElement2.Text = this.GetFormattedValueBasedOnEffectType(perkEffectVO, prevVO); statGrid.AddItem(item, i); } statGrid.RepositionItems(); }
private void SpecialAttackDeployedActionCallback(uint id, object cookie) { SpecialAttackDeployedAction specialAttackDeployedAction = cookie as SpecialAttackDeployedAction; StaticDataController staticDataController = Service.StaticDataController; SpecialAttackTypeVO specialAttackTypeVO = staticDataController.Get <SpecialAttackTypeVO>(specialAttackDeployedAction.SpecialAttackId); Vector3 vector = new Vector3(Units.BoardToWorldX(specialAttackDeployedAction.BoardX), 0f, Units.BoardToWorldZ(specialAttackDeployedAction.BoardZ)); Service.SpecialAttackController.DeploySpecialAttack(specialAttackTypeVO, specialAttackDeployedAction.TeamType, vector); IntPosition boardPosition = Units.WorldToBoardIntPosition(vector); this.battleController.OnSpecialAttackDeployed(specialAttackTypeVO.Uid, specialAttackDeployedAction.TeamType, boardPosition); }
private void AttemptToUpgradeUnitWithShards(string shardId, int level) { if (level <= 0) { return; } CurrentPlayer currentPlayer = Service.CurrentPlayer; Dictionary <string, int> shards = currentPlayer.Shards; StaticDataController staticDataController = Service.StaticDataController; ShardVO shardVO = staticDataController.Get <ShardVO>(shardId); string targetType = shardVO.TargetType; string targetGroupId = shardVO.TargetGroupId; bool flag = targetType == "specialAttack"; int num = 0; if (shards.ContainsKey(shardId)) { num += shards[shardId]; } int startLevel = level - 1; int numShardsForDeployableToReachLevelInGroup; if (flag) { numShardsForDeployableToReachLevelInGroup = this.GetNumShardsForDeployableToReachLevelInGroup <SpecialAttackTypeVO>(startLevel, level, targetGroupId); } else { numShardsForDeployableToReachLevelInGroup = this.GetNumShardsForDeployableToReachLevelInGroup <TroopTypeVO>(startLevel, level, targetGroupId); } if (num >= numShardsForDeployableToReachLevelInGroup) { UnlockedLevelData unlockedLevels = Service.CurrentPlayer.UnlockedLevels; IDeployableVO deployableVOForLevelInGroup; if (flag) { deployableVOForLevelInGroup = this.GetDeployableVOForLevelInGroup <SpecialAttackTypeVO>(1, targetGroupId); } else { deployableVOForLevelInGroup = this.GetDeployableVOForLevelInGroup <TroopTypeVO>(1, targetGroupId); } if (deployableVOForLevelInGroup == null) { return; } unlockedLevels.UpgradeTroopsOrStarships(deployableVOForLevelInGroup.Uid, flag); currentPlayer.ModifyShardAmount(shardId, num - numShardsForDeployableToReachLevelInGroup); Service.EventManager.SendEvent(EventId.ShardUnitUpgraded, deployableVOForLevelInGroup); } }
public void PreloadSpecialAttackMiscAssets() { this.UnloadPreloads(); StaticDataController staticDataController = Service.StaticDataController; Dictionary <string, int> allPlayerDeployableSpecialAttacks = Service.BattleController.GetAllPlayerDeployableSpecialAttacks(); if (allPlayerDeployableSpecialAttacks == null || allPlayerDeployableSpecialAttacks.Count == 0) { return; } HashSet <string> hashSet = new HashSet <string>(); foreach (string current in allPlayerDeployableSpecialAttacks.Keys) { SpecialAttackTypeVO specialAttackTypeVO = staticDataController.Get <SpecialAttackTypeVO>(current); string dropoffAttachedAssetName = specialAttackTypeVO.DropoffAttachedAssetName; if (!string.IsNullOrEmpty(dropoffAttachedAssetName)) { hashSet.Add(dropoffAttachedAssetName); } } if (hashSet.Count == 0) { return; } List <string> list = new List <string>(hashSet); hashSet.Clear(); hashSet = null; List <object> list2 = new List <object>(); List <AssetHandle> list3 = new List <AssetHandle>(); int i = 0; int count = list.Count; while (i < count) { list2.Add(list[i]); list3.Add(AssetHandle.Invalid); i++; } Service.AssetManager.MultiLoad(list3, list, new AssetSuccessDelegate(this.OnSpecialAttackPreloadsComplete), null, list2, null, null); int j = 0; int count2 = list.Count; while (j < count2) { this.preloadedAssets[list[j]] = list3[j]; j++; } }
private bool IsBuildingUnlockedByRequirement(BuildingTypeVO vo, int buildOrUpgrade, ref BuildingTypeVO req) { bool flag = true; if (buildOrUpgrade == 0) { vo = Service.BuildingUpgradeCatalog.GetMinLevel(vo); } BuildingLookupController buildingLookupController = Service.BuildingLookupController; StaticDataController staticDataController = Service.StaticDataController; if (!string.IsNullOrEmpty(vo.BuildingRequirement)) { req = staticDataController.Get <BuildingTypeVO>(vo.BuildingRequirement); flag = buildingLookupController.HasConstructedBuilding(req); } if (flag && !string.IsNullOrEmpty(vo.BuildingRequirement2)) { req = staticDataController.Get <BuildingTypeVO>(vo.BuildingRequirement2); flag = buildingLookupController.HasConstructedBuilding(req); } return(flag); }
public SkinTypeVO GetApplicableSkin(TroopTypeVO troop, List <string> equipmentList, out string equipmentUid) { equipmentUid = null; if (troop == null || equipmentList == null) { return(null); } StaticDataController staticDataController = Service.StaticDataController; int i = 0; int count = equipmentList.Count; while (i < count) { EquipmentVO equipmentVO = staticDataController.Get <EquipmentVO>(equipmentList[i]); if (equipmentVO != null) { string[] skins = equipmentVO.Skins; if (skins != null) { int j = 0; int num = skins.Length; while (j < num) { SkinTypeVO skinTypeVO = staticDataController.Get <SkinTypeVO>(skins[j]); if (troop.TroopID.Equals(skinTypeVO.UnitId)) { equipmentUid = equipmentList[i]; return(skinTypeVO); } j++; } } } i++; } return(null); }
public void DeployDropShipTroops(IntPosition spawnPosition, string troopUid, uint count, TeamType teamType) { int num = 0; StaticDataController staticDataController = Service.StaticDataController; TroopTypeVO troopVO = staticDataController.Get <TroopTypeVO>(troopUid); TroopController troopController = Service.TroopController; int num2 = 0; while ((long)num2 < (long)((ulong)count)) { troopController.DeployTroopWithOffset(troopVO, ref num, spawnPosition, true, teamType); num2++; } this.numHoveringInbound--; }
private void AddShieldRegenerationWarBuff(SmartEntity entity, WarBuffVO warBuffVO) { StaticDataController staticDataController = Service.StaticDataController; BuildingComponent buildingComp = entity.BuildingComp; ShieldGeneratorComponent shieldGeneratorComp = entity.ShieldGeneratorComp; TroopComponent troopComp = entity.TroopComp; TroopShieldHealthComponent troopShieldHealthComp = entity.TroopShieldHealthComp; BuffTypeVO buffType; if (buildingComp != null && shieldGeneratorComp != null) { buffType = staticDataController.Get <BuffTypeVO>(warBuffVO.BuildingBuffUid); } else { if (troopComp == null || troopShieldHealthComp == null) { return; } buffType = staticDataController.Get <BuffTypeVO>(warBuffVO.TroopBuffUid); } this.TryAddBuffStack(entity, buffType, ArmorType.Shield, BuffVisualPriority.SquadWars, entity); entity.BuffComp.SetBuildingLoadedEvent(EventId.ShieldStarted, new VisualReadyDelegate(this.BuildingShieldStarted)); }
public void InvestInPerk(int repToInvest, string targetPerkId, Dictionary <string, string> availablePerks, string guildLevelUid) { StaticDataController staticDataController = Service.StaticDataController; PerkVO perkVO = staticDataController.Get <PerkVO>(targetPerkId); if (this.IsPerkValidForInvestment(perkVO, availablePerks, guildLevelUid)) { GameUtils.SpendCurrency(0, 0, 0, repToInvest, 0, true); PlayerPerkInvestRequest request = new PlayerPerkInvestRequest(perkVO.Uid, repToInvest); PlayerPerkInvestCommand playerPerkInvestCommand = new PlayerPerkInvestCommand(request); playerPerkInvestCommand.AddFailureCallback(new AbstractCommand <PlayerPerkInvestRequest, PlayerPerkInvestResponse> .OnFailureCallback(this.OnInvestFailure)); playerPerkInvestCommand.Context = repToInvest; Service.ServerAPI.Sync(playerPerkInvestCommand); } }