private void RecalculateXP() { GamePlayer worldOwner = GameUtils.GetWorldOwner(); Inventory inventory = worldOwner.Inventory; int num = -worldOwner.CurrentXPAmount; NodeList <BuildingNode> nodeList = Service.Get <EntityController>().GetNodeList <BuildingNode>(); IDataController dataController = Service.Get <IDataController>(); for (BuildingNode buildingNode = nodeList.Head; buildingNode != null; buildingNode = buildingNode.Next) { BuildingTypeVO buildingType = buildingNode.BuildingComp.BuildingType; if (!ContractUtils.IsBuildingConstructing(buildingNode.Entity)) { num += buildingType.Xp; } } foreach (TroopTypeVO current in dataController.GetAll <TroopTypeVO>()) { if (current.PlayerFacing && worldOwner.UnlockedLevels.Troops.GetLevel(current.UpgradeGroup) == current.Lvl && worldOwner.Faction == current.Faction && this.unlockController.IsTroopUnlocked(worldOwner, current)) { num += current.Xp; } } foreach (SpecialAttackTypeVO current2 in dataController.GetAll <SpecialAttackTypeVO>()) { if (current2.PlayerFacing && worldOwner.UnlockedLevels.Starships.GetLevel(current2.UpgradeGroup) == current2.Lvl && worldOwner.Faction == current2.Faction && this.unlockController.IsSpecialAttackUnlocked(worldOwner, current2)) { num += current2.Xp; } } inventory.ModifyXP(num); }
private void CacheHQBuildingIds() { if (this.HaveCachedBuildingIds()) { return; } IDataController dataController = Service.Get <IDataController>(); foreach (BuildingTypeVO current in dataController.GetAll <BuildingTypeVO>()) { if (this.HaveCachedBuildingIds()) { break; } if (current.Type == BuildingType.HQ && current.BuildingRequirement != null) { if (current.Faction == FactionType.Empire) { this.empireHQId = current.BuildingID; } else if (current.Faction == FactionType.Rebel) { this.rebelHQId = current.BuildingID; } else if (current.Faction == FactionType.Smuggler) { this.smugglerHQId = current.BuildingID; } } } }
public void InitTransmissionsTest(List <TransmissionVO> testTransmissions) { CurrentPlayer currentPlayer = Service.Get <CurrentPlayer>(); IDataController dataController = Service.Get <IDataController>(); this.incomingTransmissions.Clear(); if (testTransmissions != null) { foreach (TransmissionVO current in testTransmissions) { if (current.Faction == currentPlayer.Faction) { this.incomingTransmissions.Add(current); } } } foreach (TransmissionVO current2 in dataController.GetAll <TransmissionVO>()) { if (current2.Faction == currentPlayer.Faction) { this.incomingTransmissions.Add(current2); } } HolonetController holonetController = Service.Get <HolonetController>(); holonetController.SetTabCount(this, this.incomingTransmissions.Count); }
public GameShaders(AssetsCompleteDelegate onCompleteCallback, object onCompleteCookie) { this.shaders = new Dictionary <string, Shader>(); List <string> list = new List <string>(); IDataController dataController = Service.Get <IDataController>(); Dictionary <string, ShaderTypeVO> .ValueCollection all = dataController.GetAll <ShaderTypeVO>(); foreach (ShaderTypeVO current in all) { list.Add(current.AssetName); } dataController.Unload <ShaderTypeVO>(); 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.Get <AssetManager>().MultiLoad(list3, list, new AssetSuccessDelegate(this.LoadSuccess), null, list2, onCompleteCallback, onCompleteCookie); }
public void PrepareContent(int lastTimeViewed) { int num = 0; this.DevNotes.Clear(); int serverTime = (int)Service.Get <ServerAPI>().ServerTime; IDataController dataController = Service.Get <IDataController>(); this.DevNotes = new List <DevNoteEntryVO>(); foreach (DevNoteEntryVO current in dataController.GetAll <DevNoteEntryVO>()) { if (current.StartTime <= serverTime && serverTime < current.EndTime) { this.DevNotes.Add(current); if (current.StartTime > lastTimeViewed) { num++; } } } HolonetController holonetController = Service.Get <HolonetController>(); this.DevNotes.Sort(new Comparison <DevNoteEntryVO>(holonetController.CompareTimestamps)); holonetController.ContentPrepared(this, Math.Min(num, 3)); }
public ProfanityController() { Service.Set <ProfanityController>(this); this.profaneWordsLoose = new List <string>(); this.profaneWordsStrict = new List <string>(); this.reservedWords = new List <string>(); string text = Service.Get <Lang>().ExtractLanguageFromLocale(); IDataController dataController = Service.Get <IDataController>(); foreach (ProfanityVO current in dataController.GetAll <ProfanityVO>()) { string[] words = current.Words; if (current.Uid == "reserved") { this.reservedWords.AddRange(words); } else if (current.Uid == text || 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(); } dataController.Unload <ProfanityVO>(); }
public static SaleTypeVO GetCurrentActiveSale() { IDataController dataController = Service.Get <IDataController>(); foreach (SaleTypeVO current in dataController.GetAll <SaleTypeVO>()) { if (TimedEventUtils.IsTimedEventActive(current)) { return(current); } } return(null); }
public static bool HasVisibleCrateStoreItems() { IDataController dataController = Service.Get <IDataController>(); foreach (CrateVO current in dataController.GetAll <CrateVO>()) { if (CrateUtils.IsVisibleInStore(current)) { return(true); } } return(false); }
public static TournamentVO GetActiveTournamentOnPlanet(string planetId) { IDataController dataController = Service.Get <IDataController>(); foreach (TournamentVO current in dataController.GetAll <TournamentVO>()) { if (current.PlanetId == planetId && TimedEventUtils.IsTimedEventActive(current)) { return(current); } } return(null); }
public int GetTotalStarsEarned() { IDataController dataController = Service.Get <IDataController>(); int num = 0; foreach (CampaignVO current in dataController.GetAll <CampaignVO>()) { if (!current.Timed && current.Faction == this.player.Faction) { num += this.progress.GetTotalCampaignStarsEarned(current); } } return(num); }
public static List <SaleItemTypeVO> GetSaleItems(string[] saleItemUids) { List <SaleItemTypeVO> list = new List <SaleItemTypeVO>(); IDataController dataController = Service.Get <IDataController>(); foreach (SaleItemTypeVO current in dataController.GetAll <SaleItemTypeVO>()) { if (Array.IndexOf <string>(saleItemUids, current.Uid) >= 0) { list.Add(current); } } return(list); }
public static Dictionary <string, TournamentRewardsVO> GetTierRewardMap(string rewardGroupId) { Dictionary <string, TournamentRewardsVO> dictionary = new Dictionary <string, TournamentRewardsVO>(); IDataController dataController = Service.Get <IDataController>(); foreach (TournamentRewardsVO current in dataController.GetAll <TournamentRewardsVO>()) { if (current.TournamentRewardsId == rewardGroupId) { dictionary.Add(current.TournamentTier, current); } } return(dictionary); }
public static List <PlanetVO> GetAllPlayerFacingPlanets() { List <PlanetVO> list = new List <PlanetVO>(); IDataController dataController = Service.Get <IDataController>(); foreach (PlanetVO current in dataController.GetAll <PlanetVO>()) { if (current.PlayerFacing) { list.Add(current); } } return(list); }
protected override void InitService() { FactionType faction = Service.Get <CurrentPlayer>().Faction; IDataController dataController = Service.Get <IDataController>(); foreach (SpecialAttackTypeVO current in dataController.GetAll <SpecialAttackTypeVO>()) { if (current.PlayerFacing && current.Faction == faction && current.DPS > this.MaxSpecialAttackDps) { this.MaxSpecialAttackDps = current.DPS; } } Service.Set <StarshipUpgradeCatalog>(this); }
private void OnGetTournamentRank(TournamentRankResponse rankResponse, object cookie) { TournamentRank tournamentRank = rankResponse.Rank; TournamentRank oldRank = null; Tournament tournament = null; Dictionary <string, object> dictionary = (Dictionary <string, object>)cookie; string text = (string)dictionary["tournamentId"]; TournamentController.PlayerRankUpdatedCallback playerRankUpdatedCallback = (TournamentController.PlayerRankUpdatedCallback)dictionary["callback"]; if (!string.IsNullOrEmpty(text)) { tournament = this.currentPlayer.TournamentProgress.GetTournament(text); oldRank = tournament.CurrentRank; tournament.CurrentRank = tournamentRank; tournament.Sync(rankResponse.TournamentData); } if (tournamentRank == null) { tournamentRank = new TournamentRank(); if (tournament != null) { tournament.CurrentRank = tournamentRank; } } if (string.IsNullOrEmpty(tournamentRank.TierUid)) { TournamentTierVO tournamentTierVO = null; IDataController dataController = Service.Get <IDataController>(); foreach (TournamentTierVO current in dataController.GetAll <TournamentTierVO>()) { if (tournamentTierVO == null || current.Percentage > tournamentTierVO.Percentage) { tournamentTierVO = current; tournamentRank.TierUid = tournamentTierVO.Uid; } } if (tournamentTierVO != null) { tournamentRank.Percentile = (double)tournamentTierVO.Percentage; } else { tournamentRank.Percentile = 100.0; } } if (playerRankUpdatedCallback != null) { playerRankUpdatedCallback(oldRank, tournamentRank, text); } }
private static TournamentVO GetLiveTournamentForBonus(uint timeToCheck) { string planetId = Service.Get <CurrentPlayer>().PlanetId; IDataController dataController = Service.Get <IDataController>(); foreach (TournamentVO current in dataController.GetAll <TournamentVO>()) { if (TournamentController.IsPlanetaryConflict(current) && current.PlanetId == planetId && TimedEventUtils.IsTimedEventLive(current, timeToCheck)) { return(current); } } return(null); }
private void SetupTroopItemGrid() { base.InitGrid(); IDataController dataController = Service.Get <IDataController>(); foreach (SpecialAttackTypeVO current in dataController.GetAll <SpecialAttackTypeVO>()) { int worldOwnerSpecialAttackCount = GameUtils.GetWorldOwnerSpecialAttackCount(current.Uid); if (worldOwnerSpecialAttackCount > 0) { base.AddTroopItem(current, worldOwnerSpecialAttackCount, null); } } base.RepositionGridItems(); }
private IDeployableVO GetDeployableVOForLevelInGroup <T>(int level, string groupId) where T : IDeployableVO { IDataController dataController = Service.Get <IDataController>(); Dictionary <string, T> .ValueCollection all = dataController.GetAll <T>(); foreach (T current in all) { int lvl = current.Lvl; if (current.UpgradeGroup == groupId && lvl == level) { return(current); } } return(null); }
private void BuildAchievementLists() { this.rebelBuildingLevelAchievements = new Dictionary <string, string>(); this.empireBuildingLevelAchievements = new Dictionary <string, string>(); this.pveStarsAchievements = new Dictionary <int, string>(); this.lootCreditsAchievements = new Dictionary <int, string>(); this.lootAlloyAchievements = new Dictionary <int, string>(); this.lootContrabandAchievements = new Dictionary <int, string>(); this.pvpBattlesWonAchievements = new Dictionary <int, string>(); IDataController dataController = Service.Get <IDataController>(); Dictionary <string, AchievementVO> .ValueCollection all = dataController.GetAll <AchievementVO>(); foreach (AchievementVO current in all) { string iosAchievementId = current.IosAchievementId; if (current.AchievementType == AchievementType.BuildingLevel) { this.rebelBuildingLevelAchievements.Add(current.RebelData, iosAchievementId); this.empireBuildingLevelAchievements.Add(current.EmpireData, iosAchievementId); } else { int key = Convert.ToInt32(current.RebelData, CultureInfo.InvariantCulture); switch (current.AchievementType) { case AchievementType.PveStars: this.pveStarsAchievements.Add(key, iosAchievementId); break; case AchievementType.LootCreditsPvp: this.lootCreditsAchievements.Add(key, iosAchievementId); break; case AchievementType.LootAlloyPvp: this.lootAlloyAchievements.Add(key, iosAchievementId); break; case AchievementType.LootContrabandPvp: this.lootContrabandAchievements.Add(key, iosAchievementId); break; case AchievementType.PvpWon: this.pvpBattlesWonAchievements.Add(key, iosAchievementId); break; } } } }
public int GetNumShardsForDeployableToReachLevelInGroup <T>(int startLevel, int endLevel, string groupId) where T : IDeployableVO { int num = 0; IDataController dataController = Service.Get <IDataController>(); Dictionary <string, T> .ValueCollection all = dataController.GetAll <T>(); foreach (T current in all) { int lvl = current.Lvl; if (current.UpgradeGroup == groupId && lvl > startLevel && lvl <= endLevel) { num += current.UpgradeShardCount; } } return(num); }
private Dictionary <string, InAppPurchaseTypeVO> GetAllIAPTypesByProductID() { IDataController dataController = Service.Get <IDataController>(); Dictionary <string, InAppPurchaseTypeVO> .ValueCollection all = dataController.GetAll <InAppPurchaseTypeVO>(); Dictionary <string, InAppPurchaseTypeVO> dictionary = new Dictionary <string, InAppPurchaseTypeVO>(); foreach (InAppPurchaseTypeVO current in all) { if (this.IsIAPForCurrentPlatform(current)) { dictionary.Add(current.ProductId, current); } } return(dictionary); }
private string GetTierIdForPercentage(double percentile) { TournamentTierVO tournamentTierVO = null; IDataController dataController = Service.Get <IDataController>(); foreach (TournamentTierVO current in dataController.GetAll <TournamentTierVO>()) { if (percentile <= (double)current.Percentage && (tournamentTierVO == null || tournamentTierVO.Percentage > current.Percentage)) { tournamentTierVO = current; } } if (tournamentTierVO != null) { return(tournamentTierVO.Uid); } return(null); }
public static string GetHolonetTransmissionCharacterName(TransmissionVO vo) { Lang lang = Service.Get <Lang>(); string characterID = vo.CharacterID; IDataController dataController = Service.Get <IDataController>(); foreach (TransmissionCharacterVO current in dataController.GetAll <TransmissionCharacterVO>()) { if (current.CharacterId == characterID) { return(lang.Get("hn_character_name_title", new object[] { lang.Get(current.CharacterName, new object[0]) })); } } return(""); }
public static List <TournamentVO> GetTournamentVOs(TournamentFilter tournamentFilter) { List <TournamentVO> list = new List <TournamentVO>(); IDataController dataController = Service.Get <IDataController>(); foreach (TournamentVO current in dataController.GetAll <TournamentVO>()) { if (TournamentController.IsPlanetaryConflict(current)) { bool flag; switch (tournamentFilter) { case TournamentFilter.Live: flag = TimedEventUtils.IsTimedEventLive(current); break; case TournamentFilter.LiveOrClosing: flag = TimedEventUtils.IsTimedEventLiveOrClosing(current); break; case TournamentFilter.Active: flag = TimedEventUtils.IsTimedEventActive(current); break; case TournamentFilter.All: goto IL_60; default: goto IL_60; } IL_63: if (flag) { list.Add(current); continue; } continue; IL_60: flag = true; goto IL_63; } } return(list); }
private void SortShuttleAssetDataByFactionAndLevel() { IDataController dataController = Service.Get <IDataController>(); Dictionary <string, TransportTypeVO> .ValueCollection all = dataController.GetAll <TransportTypeVO>(); foreach (TransportTypeVO current in all) { if (current.TransportType == TransportType.Troop) { if (current.Faction == FactionType.Rebel) { this.rebelShuttles.Add(current.Level, current.AssetName); } if (current.Faction == FactionType.Empire) { this.empireShuttles.Add(current.Level, current.AssetName); } } } }
public EquipmentVO GetNextEquipmentVOUpgrade(string equipmentID) { IDataController dataController = Service.Get <IDataController>(); CurrentPlayer currentPlayer = Service.Get <CurrentPlayer>(); int num = 0; if (currentPlayer.UnlockedLevels.Equipment.Levels.ContainsKey(equipmentID)) { num = currentPlayer.UnlockedLevels.Equipment.Levels.get_Item(equipmentID); } num++; foreach (EquipmentVO current in dataController.GetAll <EquipmentVO>()) { if (current.EquipmentID == equipmentID && current.Lvl == num) { return(current); } } return(null); }
public bool IsMiniCampaign() { if (this.miniCampaignAlreadyCalculated) { return(this.miniCampaign); } IDataController dataController = Service.Get <IDataController>(); this.miniCampaign = true; foreach (CampaignMissionVO current in dataController.GetAll <CampaignMissionVO>()) { if (current.CampaignUid == this.Uid && current.UnlockOrder > 1) { this.miniCampaign = false; break; } } this.miniCampaignAlreadyCalculated = true; return(this.miniCampaign); }
public void ReadRow(Row row) { this.Uid = row.Uid; this.TroopID = row.TryGetString(TroopUniqueAbilityDescVO.COLUMN_unitID); this.AbilityTitle1 = row.TryGetString(TroopUniqueAbilityDescVO.COLUMN_abilityTitle1); this.AbilityDesc1 = row.TryGetString(TroopUniqueAbilityDescVO.COLUMN_abilityDesc1); this.AbilityTitle2 = row.TryGetString(TroopUniqueAbilityDescVO.COLUMN_abilityTitle2); this.AbilityDesc2 = row.TryGetString(TroopUniqueAbilityDescVO.COLUMN_abilityDesc2); if (!string.IsNullOrEmpty(this.TroopID)) { IDataController dataController = Service.Get <IDataController>(); Dictionary <string, TroopTypeVO> .ValueCollection all = dataController.GetAll <TroopTypeVO>(); foreach (TroopTypeVO current in all) { if (current.TroopID == this.TroopID) { current.UniqueAbilityDescVO = this; } } } }
protected override void InitService() { FactionType faction = Service.Get <CurrentPlayer>().Faction; IDataController dataController = Service.Get <IDataController>(); foreach (TroopTypeVO current in dataController.GetAll <TroopTypeVO>()) { if (current.PlayerFacing && current.Faction == faction) { if (current.DPS > this.MaxTroopDps) { this.MaxTroopDps = current.DPS; } if (current.Health > this.MaxTroopHealth) { this.MaxTroopHealth = current.Health; } } } Service.Set <TroopUpgradeCatalog>(this); }
public void UpdateValidLEIs() { this.ValidLEIs.Clear(); IDataController dataController = Service.Get <IDataController>(); CurrentPlayer player = Service.Get <CurrentPlayer>(); int serverTime = (int)Service.Get <ServerAPI>().ServerTime; Dictionary <string, LimitedEditionItemVO> .ValueCollection all = dataController.GetAll <LimitedEditionItemVO>(); int num = -1; foreach (LimitedEditionItemVO current in all) { int num2 = current.EndTime - serverTime; if (num2 >= 0) { if (num == -1 || num2 < num) { num = num2; } int num3 = current.StartTime - serverTime; if (num3 > 0) { if (num == -1 || num3 < num) { num = num3; } } else if (LimitedEditionItemController.IsValidForPlayer(current, player)) { this.ValidLEIs.Add(current); } } } if (num != -1 && (long)num < 432000L) { this.nextUpdateTimer = Service.Get <ViewTimerManager>().CreateViewTimer((float)num, false, new TimerDelegate(this.UpdateValidLEIs), null); } }