Ejemplo n.º 1
0
        private void RecalculateXP()
        {
            GamePlayer worldOwner                        = GameUtils.GetWorldOwner();
            Inventory  inventory                         = worldOwner.Inventory;
            int        num                               = -worldOwner.CurrentXPAmount;
            NodeList <BuildingNode> nodeList             = Service.EntityController.GetNodeList <BuildingNode>();
            StaticDataController    staticDataController = Service.StaticDataController;

            for (BuildingNode buildingNode = nodeList.Head; buildingNode != null; buildingNode = buildingNode.Next)
            {
                BuildingTypeVO buildingType = buildingNode.BuildingComp.BuildingType;
                if (!ContractUtils.IsBuildingConstructing((SmartEntity)buildingNode.Entity))
                {
                    num += buildingType.Xp;
                }
            }
            foreach (TroopTypeVO current in staticDataController.GetAll <TroopTypeVO>())
            {
                if (current.PlayerFacing)
                {
                    if (worldOwner.UnlockedLevels.Troops.GetLevel(current.UpgradeGroup) == current.Lvl)
                    {
                        if (worldOwner.Faction == current.Faction)
                        {
                            if (this.unlockController.IsTroopUnlocked(worldOwner, current))
                            {
                                num += current.Xp;
                            }
                        }
                    }
                }
            }
            foreach (SpecialAttackTypeVO current2 in staticDataController.GetAll <SpecialAttackTypeVO>())
            {
                if (current2.PlayerFacing)
                {
                    if (worldOwner.UnlockedLevels.Starships.GetLevel(current2.UpgradeGroup) == current2.Lvl)
                    {
                        if (worldOwner.Faction == current2.Faction)
                        {
                            if (this.unlockController.IsSpecialAttackUnlocked(worldOwner, current2))
                            {
                                num += current2.Xp;
                            }
                        }
                    }
                }
            }
            inventory.ModifyXP(num);
        }
Ejemplo n.º 2
0
        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>();
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        public bool IsContrabandUnlocked()
        {
            StaticDataController staticDataController = Service.StaticDataController;

            foreach (BuildingTypeVO current in staticDataController.GetAll <BuildingTypeVO>())
            {
                if (current.Type == BuildingType.Storage && current.Currency == CurrencyType.Contraband && current.Lvl == 1 && this.HasConstructedBuilding(current))
                {
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 5
0
        public List <PerkVO> GetPerksUnlockedAtSquadLevel(int level)
        {
            List <PerkVO>        list = new List <PerkVO>();
            StaticDataController staticDataController = Service.StaticDataController;

            foreach (PerkVO current in staticDataController.GetAll <PerkVO>())
            {
                if (current.SquadLevelUnlock == level)
                {
                    list.Add(current);
                }
            }
            return(list);
        }
Ejemplo n.º 6
0
        private static TournamentVO GetLiveTournamentForBonus(uint timeToCheck)
        {
            string planetId = Service.CurrentPlayer.PlanetId;
            StaticDataController staticDataController = Service.StaticDataController;

            foreach (TournamentVO current in staticDataController.GetAll <TournamentVO>())
            {
                if (TournamentController.IsPlanetaryConflict(current) && current.PlanetId == planetId && TimedEventUtils.IsTimedEventLive(current, timeToCheck))
                {
                    return(current);
                }
            }
            return(null);
        }
Ejemplo n.º 7
0
        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;
                StaticDataController staticDataController = Service.StaticDataController;
                foreach (TournamentTierVO current in staticDataController.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);
            }
        }
Ejemplo n.º 8
0
        public int GetTotalStarsEarned()
        {
            StaticDataController staticDataController = Service.StaticDataController;
            int num = 0;

            foreach (CampaignVO current in staticDataController.GetAll <CampaignVO>())
            {
                if (!current.Timed && current.Faction == this.player.Faction)
                {
                    num += this.progress.GetTotalCampaignStarsEarned(current);
                }
            }
            return(num);
        }
Ejemplo n.º 9
0
        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>();
            StaticDataController staticDataController = Service.StaticDataController;

            Dictionary <string, AchievementVO> .ValueCollection all = staticDataController.GetAll <AchievementVO>();
            string value = string.Empty;

            foreach (AchievementVO current in all)
            {
                value = current.GoogleAchievementId;
                if (current.AchievementType == AchievementType.BuildingLevel)
                {
                    this.rebelBuildingLevelAchievements.Add(current.RebelData, value);
                    this.empireBuildingLevelAchievements.Add(current.EmpireData, value);
                }
                else
                {
                    int key = Convert.ToInt32(current.RebelData);
                    switch (current.AchievementType)
                    {
                    case AchievementType.PveStars:
                        this.pveStarsAchievements.Add(key, value);
                        break;

                    case AchievementType.LootCreditsPvp:
                        this.lootCreditsAchievements.Add(key, value);
                        break;

                    case AchievementType.LootAlloyPvp:
                        this.lootAlloyAchievements.Add(key, value);
                        break;

                    case AchievementType.LootContrabandPvp:
                        this.lootContrabandAchievements.Add(key, value);
                        break;

                    case AchievementType.PvpWon:
                        this.pvpBattlesWonAchievements.Add(key, value);
                        break;
                    }
                }
            }
        }
Ejemplo n.º 10
0
        public bool IsPerkMaxTier(PerkVO perkToCheck)
        {
            StaticDataController staticDataController = Service.StaticDataController;
            string perkGroup = perkToCheck.PerkGroup;
            int    perkTier  = perkToCheck.PerkTier;

            foreach (PerkVO current in staticDataController.GetAll <PerkVO>())
            {
                if (perkGroup == current.PerkGroup && perkTier < current.PerkTier)
                {
                    return(false);
                }
            }
            return(true);
        }
Ejemplo n.º 11
0
        public int CalcNumShardsForDeployableToReachMaxLevelInGroup <T>(string groupId) where T : IDeployableVO
        {
            int num = 0;
            StaticDataController staticDataController = Service.StaticDataController;

            Dictionary <string, T> .ValueCollection all = staticDataController.GetAll <T>();
            foreach (T current in all)
            {
                if (current.UpgradeGroup == groupId)
                {
                    num += current.UpgradeShardCount;
                }
            }
            return(num);
        }
Ejemplo n.º 12
0
        private IDeployableVO GetDeployableVOForLevelInGroup <T>(int level, string groupId) where T : IDeployableVO
        {
            StaticDataController staticDataController = Service.StaticDataController;

            Dictionary <string, T> .ValueCollection all = staticDataController.GetAll <T>();
            foreach (T current in all)
            {
                int lvl = current.Lvl;
                if (current.UpgradeGroup == groupId && lvl == level)
                {
                    return(current);
                }
            }
            return(null);
        }
Ejemplo n.º 13
0
        public int GetNumShardsForDeployableToReachLevelInGroup <T>(int startLevel, int endLevel, string groupId) where T : IDeployableVO
        {
            int num = 0;
            StaticDataController staticDataController = Service.StaticDataController;

            Dictionary <string, T> .ValueCollection all = staticDataController.GetAll <T>();
            foreach (T current in all)
            {
                int lvl = current.Lvl;
                if (current.UpgradeGroup == groupId && lvl > startLevel && lvl <= endLevel)
                {
                    num += current.UpgradeShardCount;
                }
            }
            return(num);
        }
Ejemplo n.º 14
0
        private List <T> GetItemsUnlockedByBuilding <T>(string reqBuildingUid, GenericUpgradeCatalog <T> catalog) where T : IUpgradeableVO
        {
            List <T>             list = new List <T>();
            StaticDataController staticDataController = Service.StaticDataController;

            foreach (T current in staticDataController.GetAll <T>())
            {
                if (current.BuildingRequirement == reqBuildingUid)
                {
                    T minLevel = catalog.GetMinLevel(current);
                    if (minLevel.Lvl == current.Lvl)
                    {
                        list.Add(minLevel);
                    }
                }
            }
            return(list);
        }
Ejemplo n.º 15
0
        public static List <TournamentVO> GetTournamentVOs(TournamentFilter tournamentFilter)
        {
            List <TournamentVO>  list = new List <TournamentVO>();
            StaticDataController staticDataController = Service.StaticDataController;

            foreach (TournamentVO current in staticDataController.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_72;

                    default:
                        goto IL_72;
                    }
IL_7A:
                    if (flag)
                    {
                        list.Add(current);
                        continue;
                    }
                    continue;
IL_72:
                    flag = true;
                    goto IL_7A;
                }
            }
            return(list);
        }
Ejemplo n.º 16
0
        private void SortShuttleAssetDataByFactionAndLevel()
        {
            StaticDataController staticDataController = Service.StaticDataController;

            Dictionary <string, TransportTypeVO> .ValueCollection all = staticDataController.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);
                    }
                }
            }
        }
Ejemplo n.º 17
0
        public EquipmentVO GetNextEquipmentVOUpgrade(string equipmentID)
        {
            StaticDataController staticDataController = Service.StaticDataController;
            CurrentPlayer        currentPlayer        = Service.CurrentPlayer;
            int num = 0;

            if (currentPlayer.UnlockedLevels.Equipment.Levels.ContainsKey(equipmentID))
            {
                num = currentPlayer.UnlockedLevels.Equipment.Levels[equipmentID];
            }
            num++;
            foreach (EquipmentVO current in staticDataController.GetAll <EquipmentVO>())
            {
                if (current.EquipmentID == equipmentID && current.Lvl == num)
                {
                    return(current);
                }
            }
            return(null);
        }
Ejemplo n.º 18
0
        public static TournamentVO GetActiveTournamentOnPlanet(string planetId)
        {
            StaticDataController staticDataController = Service.StaticDataController;
            TournamentVO         result = null;

            foreach (TournamentVO current in staticDataController.GetAll <TournamentVO>())
            {
                if (!(current.PlanetId != planetId))
                {
                    if (TimedEventUtils.IsTimedEventActive(current))
                    {
                        TimedEventState state = TimedEventUtils.GetState(current);
                        if (state == TimedEventState.Live || state == TimedEventState.Closing)
                        {
                            return(current);
                        }
                        result = current;
                    }
                }
            }
            return(result);
        }
Ejemplo n.º 19
0
        public EpisodePointScaleVO GetCurrentEpisodePointScaleVO()
        {
            if (this.CurrentEpisodeData == null)
            {
                return(null);
            }
            StaticDataController          staticDataController = Service.StaticDataController;
            EpisodePointScaleVO           result = staticDataController.Get <EpisodePointScaleVO>(this.CurrentEpisodeData.PointScale);
            List <EpisodePointScheduleVO> list   = new List <EpisodePointScheduleVO>();

            foreach (EpisodePointScheduleVO current in staticDataController.GetAll <EpisodePointScheduleVO>())
            {
                EpisodePointScheduleVO episodePointScheduleVO = current;
                if ((long)episodePointScheduleVO.EndTimeEpochSecs > (long)((ulong)ServerTime.Time))
                {
                    if ((long)episodePointScheduleVO.StartTimeEpochSecs <= (long)((ulong)ServerTime.Time))
                    {
                        list.Add(episodePointScheduleVO);
                    }
                }
            }
            if (list.Count > 0)
            {
                List <EpisodePointScheduleVO> arg_C9_0 = list;
                if (EpisodeController.< > f__mg$cache0 == null)
                {
                    EpisodeController.< > f__mg$cache0 = new Comparison <EpisodePointScheduleVO>(EpisodeController.CompareSchedules);
                }
                arg_C9_0.Sort(EpisodeController.< > f__mg$cache0);
                EpisodePointScaleVO optional = staticDataController.GetOptional <EpisodePointScaleVO>(list[0].ScaleId);
                if (optional != null)
                {
                    return(optional);
                }
            }
            return(result);
        }
Ejemplo n.º 20
0
        private Dictionary <string, T> .ValueCollection GetAllItems <T>() where T : ILimitedEditionItemVO
        {
            StaticDataController staticDataController = Service.StaticDataController;

            return(staticDataController.GetAll <T>());
        }
Ejemplo n.º 21
0
        public void HandleUnableToCollect(CurrencyType currencyType)
        {
            BuildingLookupController buildingLookupController = Service.BuildingLookupController;
            StaticDataController     staticDataController     = Service.StaticDataController;
            CurrentPlayer            currentPlayer            = Service.CurrentPlayer;
            BuildingTypeVO           buildingTypeVO           = null;

            foreach (BuildingTypeVO current in staticDataController.GetAll <BuildingTypeVO>())
            {
                if (current.Faction == currentPlayer.Faction && current.Type == BuildingType.Storage && current.Currency == currencyType)
                {
                    buildingTypeVO = current;
                    break;
                }
            }
            int num = 0;

            if (buildingTypeVO != null)
            {
                num = buildingLookupController.GetBuildingMaxPurchaseQuantity(buildingTypeVO, 0);
            }
            int num2           = 0;
            int num3           = 0;
            int highestLevelHQ = buildingLookupController.GetHighestLevelHQ();

            for (StorageNode storageNode = buildingLookupController.StorageNodeList.Head; storageNode != null; storageNode = storageNode.Next)
            {
                if (storageNode.BuildingComp.BuildingType.Currency == currencyType)
                {
                    num2++;
                    if (storageNode.BuildingComp.BuildingType.Lvl == highestLevelHQ)
                    {
                        num3++;
                    }
                }
            }
            bool   flag         = num2 < num;
            string instructions = string.Empty;

            if (currencyType != CurrencyType.Credits)
            {
                if (currencyType != CurrencyType.Materials)
                {
                    if (currencyType == CurrencyType.Contraband)
                    {
                        if (flag)
                        {
                            instructions = Service.Lang.Get("BUILD_MORE_CONTRABAND_STORAGE", new object[0]);
                        }
                        else if (num3 == num2)
                        {
                            instructions = Service.Lang.Get("FULL_CONTRABAND_STORAGE", new object[0]);
                        }
                        else
                        {
                            instructions = Service.Lang.Get("UPGRADE_CONTRABAND_STORAGE", new object[0]);
                        }
                    }
                }
                else if (flag)
                {
                    instructions = Service.Lang.Get("BUILD_MORE_MATERIAL_STORAGE", new object[0]);
                }
                else if (num3 == num2)
                {
                    instructions = Service.Lang.Get("FULL_MATERIAL_STORAGE", new object[0]);
                }
                else
                {
                    instructions = Service.Lang.Get("UPGRADE_MATERIAL_STORAGE", new object[0]);
                }
            }
            else if (flag)
            {
                instructions = Service.Lang.Get("BUILD_MORE_CREDIT_STORAGE", new object[0]);
            }
            else if (num3 == num2)
            {
                instructions = Service.Lang.Get("FULL_CREDIT_STORAGE", new object[0]);
            }
            else
            {
                instructions = Service.Lang.Get("UPGRADE_CREDIT_STORAGE", new object[0]);
            }
            Service.UXController.MiscElementsManager.ShowPlayerInstructions(instructions);
        }