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 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 CrateVO GetCrateVOFromTargetedOffer(TargetedBundleVO offerVO) { StaticDataController staticDataController = Service.StaticDataController; if (offerVO == null) { return(null); } if (offerVO.RewardUIDs == null || offerVO.RewardUIDs.Count < 1) { return(null); } int i = 0; int count = offerVO.RewardUIDs.Count; while (i < count) { RewardVO optional = Service.StaticDataController.GetOptional <RewardVO>(offerVO.RewardUIDs[i]); if (optional != null) { string crateReward = optional.CrateReward; if (!string.IsNullOrEmpty(crateReward)) { return(staticDataController.GetOptional <CrateVO>(crateReward)); } } i++; } return(null); }
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 bool FindAvailableIAP(TargetedBundleVO offerVO, out string currentIapId, out string offerCost) { bool result = false; StaticDataController staticDataController = Service.StaticDataController; currentIapId = string.Empty; offerCost = string.Empty; if (offerVO == null) { return(result); } InAppPurchaseController inAppPurchaseController = Service.InAppPurchaseController; int i = 0; int count = offerVO.LinkedIAPs.Count; while (i < count) { string uid = offerVO.LinkedIAPs[i]; InAppPurchaseTypeVO optional = staticDataController.GetOptional <InAppPurchaseTypeVO>(uid); if (optional != null) { InAppPurchaseProductInfo iAPProduct = inAppPurchaseController.GetIAPProduct(optional.ProductId); if (iAPProduct != null) { currentIapId = optional.ProductId; offerCost = iAPProduct.FormattedRealCost; result = true; break; } } i++; } return(result); }
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 CampaignController() { Service.CampaignController = this; this.player = Service.CurrentPlayer; this.progress = this.player.CampaignProgress; this.server = Service.ServerAPI; this.sdc = Service.StaticDataController; this.rm = Service.RewardManager; this.hud = Service.UXController.HUD; this.activeMissionConductors = new List <MissionConductor>(); this.progress.RemoveMissingMissionData(); List <CampaignMissionVO> allMissionsInProgress = this.progress.GetAllMissionsInProgress(); int i = 0; int count = allMissionsInProgress.Count; while (i < count) { this.ResumeMission(allMissionsInProgress[i]); i++; } this.progress.CheckForNewMissions(ref this.newChapterMissionFlag); ServerPlayerPrefs serverPlayerPrefs = Service.ServerPlayerPrefs; if (Convert.ToInt32(serverPlayerPrefs.GetPref(ServerPref.ChapterMissionViewed)) > 0) { this.newChapterMissionFlag = false; } }
public UnlockController() { Service.UnlockController = this; this.currentPlayer = Service.CurrentPlayer; this.dataController = Service.StaticDataController; this.eventManager = Service.EventManager; }
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 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 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++; } }
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 ProfanityController() { Service.ProfanityController = this; this.profaneWordsLoose = new List <string>(); this.profaneWordsStrict = new List <string>(); this.reservedWords = new List <string>(); string b = Service.Lang.ExtractLanguageFromLocale(); StaticDataController staticDataController = Service.StaticDataController; foreach (ProfanityVO current in staticDataController.GetAll <ProfanityVO>()) { string[] words = current.Words; if (current.Uid == "reserved") { this.reservedWords.AddRange(words); } else if (current.Uid == b || current.Uid == "en") { this.profaneWordsLoose.AddRange(words); } else { this.profaneWordsStrict.AddRange(words); } } for (int i = 0; i < this.profaneWordsLoose.Count; i++) { this.profaneWordsLoose[i] = this.profaneWordsLoose[i].ToLower(); } for (int j = 0; j < this.profaneWordsStrict.Count; j++) { this.profaneWordsStrict[j] = this.profaneWordsStrict[j].ToLower(); } staticDataController.Unload <ProfanityVO>(); }
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); } }
public Dictionary <BuildingTypeVO, int> GetBuildingsUnlockedBy(BuildingTypeVO reqBuilding) { Dictionary <BuildingTypeVO, int> dictionary = new Dictionary <BuildingTypeVO, int>(); StaticDataController staticDataController = Service.StaticDataController; BuildingUpgradeCatalog buildingUpgradeCatalog = Service.BuildingUpgradeCatalog; foreach (BuildingTypeVO current in staticDataController.GetAll <BuildingTypeVO>()) { if (current.BuildingRequirement == reqBuilding.Uid || current.BuildingRequirement2 == reqBuilding.Uid) { BuildingTypeVO minLevel = buildingUpgradeCatalog.GetMinLevel(current); BuildingTypeVO buildingTypeVO = (current.Lvl <= minLevel.Lvl) ? null : buildingUpgradeCatalog.GetByLevel(current, current.Lvl - 1); int num = (buildingTypeVO != null) ? buildingTypeVO.MaxQuantity : 0; int num2 = current.MaxQuantity - num; if (num2 > 0) { if (dictionary.ContainsKey(minLevel)) { Dictionary <BuildingTypeVO, int> dictionary2; BuildingTypeVO key; (dictionary2 = dictionary)[key = minLevel] = dictionary2[key] + num2; } else { dictionary.Add(minLevel, num2); } } } } return(dictionary); }
public static void GrantInstantSpecialAttackUpgrade(string rewardString) { StaticDataController staticDataController = Service.StaticDataController; UnlockedLevelData unlockedLevels = Service.CurrentPlayer.UnlockedLevels; string[] array = RewardUtils.ParsePairedStrings(rewardString, ':'); string uid = array[0]; int level = Convert.ToInt32(array[1]); SpecialAttackTypeVO optional = staticDataController.GetOptional <SpecialAttackTypeVO>(uid); if (optional != null) { StarshipUpgradeCatalog starshipUpgradeCatalog = Service.StarshipUpgradeCatalog; SpecialAttackTypeVO byLevel = starshipUpgradeCatalog.GetByLevel(optional, level); if (byLevel != null) { unlockedLevels.Starships.SetLevel(byLevel); } } else { Service.Logger.WarnFormat("Instant spec Attack upgrade {0} does not exist", new object[] { rewardString }); } }
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++; } }
public int GetAvailableSlotsCount(string guildLevelUid) { StaticDataController staticDataController = Service.StaticDataController; SquadLevelVO squadLevelVO = staticDataController.Get <SquadLevelVO>(guildLevelUid); return(squadLevelVO.Slots); }
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 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); }
public RewardManager() { Service.RewardManager = this; this.rewardTags = new Dictionary <int, RewardTag>(); this.cp = Service.CurrentPlayer; this.sdc = Service.StaticDataController; this.lang = Service.Lang; }
public DefensiveBattleController() { Service.DefensiveBattleController = this; this.sdc = Service.StaticDataController; this.timerManager = Service.SimTimerManager; this.timers = new List <uint>(); this.cameraEvents = new List <DefensiveBattleController.CameraEventData>(); this.numTimesEntityHit = new Dictionary <uint, int>(); }
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 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 BuildingTypeVO GetRequiredBuilding(string reqUid) { if (string.IsNullOrEmpty(reqUid)) { return(null); } StaticDataController staticDataController = Service.StaticDataController; return(staticDataController.Get <BuildingTypeVO>(reqUid)); }
public bool IsUIDForAShardUpgradableDeployable(string uid) { StaticDataController staticDataController = Service.StaticDataController; IDeployableVO optional = staticDataController.GetOptional <TroopTypeVO>(uid); if (optional == null) { optional = staticDataController.GetOptional <SpecialAttackTypeVO>(uid); } return(optional != null && !string.IsNullOrEmpty(optional.UpgradeShardUid)); }
private void LoadCurrentTargetedOffer(string offerId, uint triggeredTime) { StaticDataController staticDataController = Service.StaticDataController; this.CurrentTargetedOffer = staticDataController.GetOptional <TargetedBundleVO>(offerId); if (this.CurrentTargetedOffer != null) { this.OfferExpiresAt = triggeredTime + (uint)this.CurrentTargetedOffer.Duration; } Service.EventManager.SendEvent(EventId.TargetedBundleContentPrepared, null); }
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); }