Beispiel #1
0
        public void RemoveMissingMissionData()
        {
            StaticDataController staticDataController = Service.StaticDataController;
            List <string>        list = new List <string>();

            foreach (string current in this.campaigns.Keys)
            {
                if (staticDataController.GetOptional <CampaignVO>(current) == null)
                {
                    list.Add(current);
                }
            }
            for (int i = 0; i < list.Count; i++)
            {
                this.campaigns.Remove(list[i]);
            }
            list.Clear();
            foreach (string current2 in this.missions.Keys)
            {
                if (staticDataController.GetOptional <CampaignMissionVO>(current2) == null)
                {
                    list.Add(current2);
                }
            }
            for (int j = 0; j < list.Count; j++)
            {
                this.missions.Remove(list[j]);
            }
            list.Clear();
        }
Beispiel #2
0
        public void CheckForNewMissions(ref bool newChapterMission)
        {
            StaticDataController staticDataController = Service.StaticDataController;

            foreach (string current in this.missions.Keys)
            {
                Mission mission = this.missions[current];
                if (mission.Status == MissionStatus.Default)
                {
                    CampaignMissionVO optional = staticDataController.GetOptional <CampaignMissionVO>(mission.Uid);
                    if (optional != null)
                    {
                        CampaignVO optional2 = staticDataController.GetOptional <CampaignVO>(optional.CampaignUid);
                        if (optional2 != null)
                        {
                            if (!optional2.Timed)
                            {
                                newChapterMission = true;
                            }
                            if (newChapterMission)
                            {
                                break;
                            }
                        }
                    }
                }
            }
        }
Beispiel #3
0
        public static bool CanCancelDeployableContract(Entity selectedBuilding)
        {
            if (!ContractUtils.IsArmyUpgrading(selectedBuilding))
            {
                return(false);
            }
            StaticDataController staticDataController = Service.StaticDataController;
            BuildingComponent    buildingComponent    = selectedBuilding.Get <BuildingComponent>();
            Contract             contract             = Service.ISupportController.FindCurrentContract(buildingComponent.BuildingTO.Key);
            string        productUid = contract.ProductUid;
            IDeployableVO optional   = staticDataController.GetOptional <TroopTypeVO>(productUid);
            string        value      = null;

            if (optional != null)
            {
                value = optional.UpgradeShardUid;
            }
            else
            {
                optional = staticDataController.GetOptional <SpecialAttackTypeVO>(productUid);
                if (optional != null)
                {
                    value = optional.UpgradeShardUid;
                }
                else
                {
                    Service.Logger.Error("CanCancelDeployableContract: Unsupported deployable type, not troop or special attack " + productUid);
                }
            }
            return(string.IsNullOrEmpty(value));
        }
Beispiel #4
0
        private string GetResearchDisplayName(string uid)
        {
            string result = string.Empty;

            if (!string.IsNullOrEmpty(uid))
            {
                StaticDataController staticDataController = Service.StaticDataController;
                TroopTypeVO          optional             = staticDataController.GetOptional <TroopTypeVO>(uid);
                if (optional != null)
                {
                    result = LangUtils.GetTroopDisplayName(optional);
                }
                else
                {
                    SpecialAttackTypeVO optional2 = staticDataController.GetOptional <SpecialAttackTypeVO>(uid);
                    if (optional2 != null)
                    {
                        result = LangUtils.GetStarshipDisplayName(optional2);
                    }
                    else
                    {
                        EquipmentVO optional3 = staticDataController.GetOptional <EquipmentVO>(uid);
                        if (optional3 != null)
                        {
                            result = LangUtils.GetEquipmentDisplayName(optional3);
                        }
                    }
                }
            }
            return(result);
        }
Beispiel #5
0
        public CrateInfoModalScreen(string crateUid, string planetID, int hqLevel, FactionType faction, bool playerHasArmory) : base("gui_modal_crateinfo")
        {
            StaticDataController staticDataController = Service.StaticDataController;

            this.targetCrateVO = staticDataController.Get <CrateVO>(crateUid);
            string text = null;

            if (faction != FactionType.Empire)
            {
                if (faction == FactionType.Rebel)
                {
                    text = this.targetCrateVO.RebelLEIUid;
                }
            }
            else
            {
                text = this.targetCrateVO.EmpireLEIUid;
            }
            if (!string.IsNullOrEmpty(text))
            {
                this.targetLEIVO = staticDataController.Get <LimitedEditionItemVO>(text);
            }
            this.planetVO            = staticDataController.GetOptional <PlanetVO>(planetID);
            this.playerHasArmory     = playerHasArmory;
            this.hqLevel             = hqLevel;
            this.filteredFlyoutItems = new List <CrateFlyoutItemVO>();
            string[] array = (faction != FactionType.Empire) ? this.targetCrateVO.FlyoutRebelItems : this.targetCrateVO.FlyoutEmpireItems;
            if (array != null)
            {
                int i   = 0;
                int num = array.Length;
                while (i < num)
                {
                    string            text2    = array[i];
                    CrateFlyoutItemVO optional = staticDataController.GetOptional <CrateFlyoutItemVO>(text2);
                    if (optional == null)
                    {
                        Service.Logger.ErrorFormat("CrateInfoModalScreen: FlyoutItemVO Uid {0} not found", new object[]
                        {
                            text2
                        });
                    }
                    else
                    {
                        bool flag  = UXUtils.IsValidRewardItem(optional, this.planetVO, hqLevel);
                        bool flag2 = UXUtils.ShouldDisplayCrateFlyoutItem(optional, CrateFlyoutDisplayType.Flyout);
                        if (flag && flag2 && this.filteredFlyoutItems.Count < 4)
                        {
                            this.filteredFlyoutItems.Add(optional);
                        }
                    }
                    i++;
                }
            }
        }
Beispiel #6
0
        protected override void OnScreenLoaded()
        {
            this.InitButtons();
            this.playerNameLabel       = base.GetElement <UXLabel>("LabelPlayerName");
            this.attacksRemainingLabel = base.GetElement <UXLabel>("LabelAttacksRemaining");
            this.uplinksAvailableLabel = base.GetElement <UXLabel>("LabelUplinksAvailable");
            this.factionSprite         = base.GetElement <UXSprite>("SpriteFactionIcon");
            this.factionDefaultSprite  = base.GetElement <UXSprite>("SpriteFactionIconZero");
            this.playerDetailTexture   = base.GetElement <UXTexture>("TexturePlayerDetails");
            StaticDataController staticDataController = Service.StaticDataController;
            TextureVO            optional             = staticDataController.GetOptional <TextureVO>("squadwars_playerdetails_bg");

            if (optional != null)
            {
                this.playerDetailTexture.LoadTexture(optional.AssetName);
            }
            for (int i = 1; i <= 3; i++)
            {
                this.requirements.Add(base.GetElement <UXLabel>(string.Format("LabelStarRequirement{0}", i)));
                this.uplinks.Add(base.GetElement <UXSprite>(string.Format("SpriteUplink{0}", i)));
                this.checks.Add(base.GetElement <UXSprite>(string.Format("SpriteCheck{0}", i)));
                this.stars.Add(base.GetElement <UXElement>(string.Format("DamageStars{0}", i)));
            }
            this.RefreshView();
        }
Beispiel #7
0
 private static void AddDeployableToList <T>(string uid, int amount, List <IAssetVO> assets, List <string> equipment, StaticDataController dc, SkinController skinController) where T : IValueObject
 {
     if (amount > 0)
     {
         IAssetVO assetVO = dc.GetOptional <T>(uid) as IAssetVO;
         if (assetVO != null)
         {
             if (assetVO is TroopTypeVO)
             {
                 TroopTypeVO troopTypeVO = (TroopTypeVO)assetVO;
                 MapDataLoaderUtils.AddSpawnEffect(troopTypeVO, assets, dc);
                 MapDataLoaderUtils.AddPlanetAttachments(troopTypeVO, assets, dc);
                 SkinTypeVO applicableSkin = skinController.GetApplicableSkin(troopTypeVO, equipment);
                 if (applicableSkin != null)
                 {
                     assetVO = applicableSkin;
                 }
             }
             for (int i = 0; i < amount; i++)
             {
                 assets.Add(assetVO);
             }
         }
     }
 }
Beispiel #8
0
        private string GetTaskCrateIcon()
        {
            StaticDataController staticDataController = Service.StaticDataController;
            EpisodeProgressInfo  episodeProgressInfo  = Service.CurrentPlayer.EpisodeProgressInfo;

            if (episodeProgressInfo == null)
            {
                Service.Logger.WarnFormat("GetTaskCrateIcon: No episode progress found", new object[0]);
                return("episode_hudicon_crate_ready_bronzium");
            }
            EpisodeTaskProgressInfo currentTask = episodeProgressInfo.currentTask;

            if (currentTask == null)
            {
                Service.Logger.WarnFormat("GetTaskCrateIcon: No current task found", new object[0]);
                return("episode_hudicon_crate_ready_bronzium");
            }
            EpisodeTaskVO optional = staticDataController.GetOptional <EpisodeTaskVO>(currentTask.uid);

            if (optional == null)
            {
                Service.Logger.WarnFormat("GetTaskCrateIcon: Missing task data for {0}", new object[]
                {
                    currentTask.uid
                });
                return("episode_hudicon_crate_ready_bronzium");
            }
            if (string.IsNullOrEmpty(optional.CrateIconAsset))
            {
                return("episode_hudicon_crate_ready_bronzium");
            }
            return(optional.CrateIconAsset);
        }
Beispiel #9
0
        private List <string> GetEffectNames(string planetaryFx)
        {
            if (string.IsNullOrEmpty(planetaryFx))
            {
                return(null);
            }
            List <string>        list = new List <string>();
            StaticDataController staticDataController = Service.StaticDataController;

            char[] separator = new char[]
            {
                '|'
            };
            string[] array = planetaryFx.Split(separator);
            int      i     = 0;
            int      num   = array.Length;

            while (i < num)
            {
                EffectsTypeVO optional = staticDataController.GetOptional <EffectsTypeVO>(array[i]);
                if (optional == null || string.IsNullOrEmpty(optional.AssetName))
                {
                    return(null);
                }
                list.Add(optional.AssetName);
                i++;
            }
            return(list);
        }
Beispiel #10
0
        private void OnPerkUpgraded(SquadMsg msg)
        {
            StaticDataController staticDataController = Service.StaticDataController;
            Squad currentSquad = Service.SquadController.StateManager.GetCurrentSquad();

            if (currentSquad == null)
            {
                Service.Logger.Error("SquadController.OnPerkUpgraded: Current Squad Null");
                return;
            }
            SquadPerks perks    = currentSquad.Perks;
            string     perkUId  = msg.PerkData.PerkUId;
            PerkVO     optional = staticDataController.GetOptional <PerkVO>(perkUId);

            if (optional == null)
            {
                Service.Logger.ErrorFormat("SquadController.OnPerkUpgraded: Given Perk is Null {0}", new object[]
                {
                    perkUId
                });
                return;
            }
            perks.UpdateUnlockedPerk(perkUId);
            Service.PerkViewController.AddToPerkBadgeList(perkUId);
            Service.EventManager.SendEvent(EventId.SquadPerkUpdated, null);
            Service.EventManager.SendEvent(EventId.PerkUpgraded, optional);
        }
Beispiel #11
0
        protected override void VerifyCurrentGoalsAgainstMeta()
        {
            StaticDataController staticDataController      = Service.StaticDataController;
            Dictionary <string, ObjectiveGroup> objectives = Service.CurrentPlayer.Objectives;

            foreach (KeyValuePair <string, ObjectiveGroup> current in objectives)
            {
                bool flag  = false;
                int  i     = 0;
                int  count = current.Value.ProgressObjects.Count;
                while (i < count)
                {
                    string objectiveUid = current.Value.ProgressObjects[i].ObjectiveUid;
                    if (staticDataController.GetOptional <ObjectiveVO>(objectiveUid) == null)
                    {
                        flag = true;
                        Service.Logger.WarnFormat("Planet {0} has an invalid objective {1}", new object[]
                        {
                            current.Key,
                            objectiveUid
                        });
                    }
                    i++;
                }
                if (flag)
                {
                    ForceObjectivesUpdateCommand command = new ForceObjectivesUpdateCommand(current.Key);
                    Service.ServerAPI.Sync(command);
                }
            }
        }
Beispiel #12
0
        private void LogReceivedLocalNotifications()
        {
            string text = this.notificationHandler.Call <string>("GetReceivedLocalNotifications", new object[0]);

            Service.Logger.Debug("Received Notification Data: " + text);
            Dictionary <string, object> dictionary = new JsonParser(text).Parse() as Dictionary <string, object>;

            if (!dictionary.ContainsKey("receivedLocalNotifs"))
            {
                return;
            }
            StaticDataController staticDataController = Service.StaticDataController;
            DateTime             now = DateTime.Now;

            now.AddMinutes(-5.0);
            List <object> list  = dictionary["receivedLocalNotifs"] as List <object>;
            int           count = list.Count;

            for (int i = 0; i < count; i++)
            {
                IDictionary <string, object> dictionary2 = list[i] as Dictionary <string, object>;
                string text2 = dictionary2["notifId"] as string;
                long   num   = Convert.ToInt64(dictionary2["date"] as string);
                Service.Logger.Debug(string.Concat(new object[]
                {
                    "notifId: ",
                    text2,
                    " date: ",
                    num
                }));
                if (!string.IsNullOrEmpty(text2))
                {
                    NotificationTypeVO optional = staticDataController.GetOptional <NotificationTypeVO>(text2);
                    if (optional != null)
                    {
                        DateTime      t             = DateUtils.DateFromMillis(num);
                        StringBuilder stringBuilder = new StringBuilder();
                        stringBuilder.Append(text2);
                        stringBuilder.Append("|");
                        stringBuilder.Append("none");
                        stringBuilder.Append("|");
                        stringBuilder.Append(optional.SoundName);
                        int num2 = DateTime.Compare(t, now);
                        if (num2 >= 0)
                        {
                            Service.DMOAnalyticsController.LogNotificationReengage(text2, true, optional.Desc, stringBuilder.ToString());
                        }
                        else
                        {
                            Service.DMOAnalyticsController.LogNotificationImpression(text2, true, optional.Desc, stringBuilder.ToString());
                        }
                    }
                }
            }
        }
Beispiel #13
0
        private void SetupTargetedOfferElements()
        {
            StaticDataController staticDataController = Service.StaticDataController;

            this.characterSprite1 = base.GetElement <UXSprite>("SpriteCharacter1");
            this.characterSprite2 = base.GetElement <UXSprite>("SpriteCharacter2");
            TextureVO optional = staticDataController.GetOptional <TextureVO>("gui_textures_promotional");

            if (optional != null)
            {
                UXTexture element = base.GetElement <UXTexture>("TexturePromoArt");
                element.LoadTexture(optional.AssetName);
            }
            optional = staticDataController.GetOptional <TextureVO>("targeted_bundle_entry");
            if (optional != null)
            {
                UXTexture element2 = base.GetElement <UXTexture>("TextureEnvironmentEntry");
                element2.LoadTexture(optional.AssetName);
            }
            optional = staticDataController.GetOptional <TextureVO>("targeted_bundle_treads");
            if (optional != null)
            {
                UXTexture element3 = base.GetElement <UXTexture>("TextureEnvironmentRight");
                element3.LoadTexture(optional.AssetName);
            }
            optional = staticDataController.GetOptional <TextureVO>("targeted_bundle_treads");
            if (optional != null)
            {
                UXTexture element4 = base.GetElement <UXTexture>("TextureEnvironmentLeft");
                element4.LoadTexture(optional.AssetName);
            }
            optional = staticDataController.GetOptional <TextureVO>("targeted_bundle_dust");
            if (optional != null)
            {
                UXTexture element5 = base.GetElement <UXTexture>("TextureEnvironmentDustRight");
                element5.LoadTexture(optional.AssetName);
                element5 = base.GetElement <UXTexture>("TextureEnvironmentDustLeft");
                element5.LoadTexture(optional.AssetName);
            }
            UXUtils.SetupAnimatedCharacter(this.characterSprite1, this.CurrentOffer.Character1Image, ref this.charGeometry1);
            UXUtils.SetupAnimatedCharacter(this.characterSprite2, this.CurrentOffer.Character2Image, ref this.charGeometry2);
        }
Beispiel #14
0
        public static int GetReputationReqForSquadLevel(int currLevel)
        {
            int result = -1;
            StaticDataController staticDataController = Service.StaticDataController;
            string       squadLevelUIDFromLevel       = GameUtils.GetSquadLevelUIDFromLevel(currLevel);
            SquadLevelVO optional = staticDataController.GetOptional <SquadLevelVO>(squadLevelUIDFromLevel);

            if (optional != null)
            {
                result = optional.RepThreshold;
            }
            return(result);
        }
Beispiel #15
0
 private static void AddBattleProjectileAssets(Map map, BattleTypeVO battle, BattleDeploymentData defensiveWaveData, List <string> attackerWarBuffs, List <string> defenderWarBuffs, List <string> attackerEquipment, List <string> defenderEquipment, List <IAssetVO> assets, StaticDataController dc)
 {
     if (battle != null)
     {
         ProjectileUtils.AddTroopProjectileAssets(battle.TroopData, assets, dc);
         ProjectileUtils.AddSpecialAttackProjectileAssets(battle.SpecialAttackData, assets, dc);
         ProjectileUtils.AddTroopProjectileAssets(battle.HeroData, assets, dc);
         ProjectileUtils.AddTroopProjectileAssets(battle.ChampionData, assets, dc);
         if (!string.IsNullOrEmpty(battle.EncounterProfile))
         {
             EncounterProfileVO optional = dc.GetOptional <EncounterProfileVO>(battle.EncounterProfile);
             if (optional != null && !string.IsNullOrEmpty(optional.GroupString))
             {
                 string[] array = optional.GroupString.Split(new char[]
                 {
                     '|'
                 });
                 int i   = 0;
                 int num = array.Length;
                 while (i < num)
                 {
                     if (!string.IsNullOrEmpty(array[i]))
                     {
                         string[] array2 = array[i].Split(new char[]
                         {
                             ','
                         });
                         if (array2.Length > 2)
                         {
                             ProjectileUtils.AddTroopProjectileAssets(array2[2], assets, dc);
                         }
                     }
                     i++;
                 }
             }
         }
     }
     if (defensiveWaveData != null)
     {
         ProjectileUtils.AddTroopProjectileAssets(defensiveWaveData.TroopData, assets, dc);
         ProjectileUtils.AddSpecialAttackProjectileAssets(defensiveWaveData.SpecialAttackData, assets, dc);
         ProjectileUtils.AddTroopProjectileAssets(defensiveWaveData.HeroData, assets, dc);
         ProjectileUtils.AddTroopProjectileAssets(defensiveWaveData.ChampionData, assets, dc);
         ProjectileUtils.AddTroopProjectileAssets(defensiveWaveData.SquadData, assets, dc);
     }
     ProjectileUtils.AddWarBuffAssets(attackerWarBuffs, assets, dc);
     ProjectileUtils.AddWarBuffAssets(defenderWarBuffs, assets, dc);
     ProjectileUtils.AddEquipmentAssets(attackerEquipment, assets, dc);
     ProjectileUtils.AddEquipmentAssets(defenderEquipment, assets, dc);
     ProjectileUtils.AddBuildingProjectileAssets(map, assets, dc);
 }
Beispiel #16
0
 public EatResponse OnEvent(EventId id, object cookie)
 {
     if (id == EventId.TroopRecruited)
     {
         ContractEventData    contractEventData    = cookie as ContractEventData;
         StaticDataController staticDataController = Service.StaticDataController;
         TroopTypeVO          optional             = staticDataController.GetOptional <TroopTypeVO>(contractEventData.Contract.ProductUid);
         if (optional != null)
         {
             this.parent.Progress(this, optional.Size);
         }
     }
     return(EatResponse.NotEaten);
 }
Beispiel #17
0
 private void ClaimReward(string limitedTimeRewardUid, string contextUid)
 {
     if (!string.IsNullOrEmpty(contextUid))
     {
         StaticDataController staticDataController = Service.StaticDataController;
         LimitedTimeRewardVO  optional             = staticDataController.GetOptional <LimitedTimeRewardVO>(limitedTimeRewardUid);
         if (optional == null)
         {
             Service.Logger.WarnFormat("No LimitedTimeReward data found for uid: {0}", new object[]
             {
                 limitedTimeRewardUid
             });
             return;
         }
         RewardVO optional2 = staticDataController.GetOptional <RewardVO>(optional.RewardUid);
         if (optional2 == null)
         {
             Service.Logger.WarnFormat("LimitedTimeReward {0} points to reward {1} but it was not found", new object[]
             {
                 limitedTimeRewardUid,
                 optional.RewardUid
             });
             return;
         }
         HolonetClaimRewardRequest request = new HolonetClaimRewardRequest(limitedTimeRewardUid, contextUid);
         HolonetClaimRewardCommand command = new HolonetClaimRewardCommand(request);
         Service.ServerAPI.Sync(command);
         GameUtils.AddRewardToInventory(optional2);
         Service.CurrentPlayer.AddHolonetReward(limitedTimeRewardUid);
         Lang   lang = Service.Lang;
         string text = lang.Get(optional.Title, new object[0]);
         AlertScreen.ShowModal(false, lang.Get("hn_reward_redeemed", new object[0]), lang.Get("hn_reward_claimed_desc", new object[]
         {
             text
         }), null, null);
     }
 }
Beispiel #18
0
        public DefenseWave(string defenseEncounter, float delay)
        {
            this.Delay = delay;
            StaticDataController staticDataController = Service.StaticDataController;

            this.Encounter = staticDataController.GetOptional <DefenseEncounterVO>(defenseEncounter);
            this.Troops    = new List <Entity>();
            if (this.Encounter == null)
            {
                Service.Logger.ErrorFormat("Defense Encounter {0} not found", new object[]
                {
                    defenseEncounter
                });
            }
        }
Beispiel #19
0
        public int GetSquadStorageCapacity()
        {
            StaticDataController staticDataController = Service.StaticDataController;
            int i     = 0;
            int count = this.Buildings.Count;

            while (i < count)
            {
                BuildingTypeVO optional = staticDataController.GetOptional <BuildingTypeVO>(this.Buildings[i].Uid);
                if (optional != null && optional.Type == BuildingType.Squad)
                {
                    return(optional.Storage);
                }
                i++;
            }
            return(0);
        }
Beispiel #20
0
        public void RemoveMissingTournamentData()
        {
            StaticDataController staticDataController = Service.StaticDataController;
            List <string>        list = new List <string>();

            foreach (string current in this.tournaments.Keys)
            {
                if (staticDataController.GetOptional <TournamentVO>(current) == null)
                {
                    list.Add(current);
                }
            }
            for (int i = 0; i < list.Count; i++)
            {
                this.tournaments.Remove(list[i]);
            }
        }
Beispiel #21
0
 public EatResponse OnEvent(EventId id, object cookie)
 {
     if (id == EventId.StarshipMobilized)
     {
         if (this.IsEventValidForGoal())
         {
             ContractEventData    contractEventData    = (ContractEventData)cookie;
             StaticDataController staticDataController = Service.StaticDataController;
             SpecialAttackTypeVO  optional             = staticDataController.GetOptional <SpecialAttackTypeVO>(contractEventData.Contract.ProductUid);
             if (optional != null)
             {
                 this.parent.Progress(this, optional.Size);
             }
         }
     }
     return(EatResponse.NotEaten);
 }
Beispiel #22
0
        public bool ScoutTowerExists()
        {
            StaticDataController staticDataController = Service.StaticDataController;
            int i     = 0;
            int count = this.Buildings.Count;

            while (i < count)
            {
                BuildingTypeVO optional = staticDataController.GetOptional <BuildingTypeVO>(this.Buildings[i].Uid);
                if (optional != null && optional.Type == BuildingType.ScoutTower)
                {
                    return(true);
                }
                i++;
            }
            return(false);
        }
Beispiel #23
0
        public List <CampaignMissionVO> GetAllMissionsInProgress()
        {
            StaticDataController     staticDataController = Service.StaticDataController;
            List <CampaignMissionVO> list = new List <CampaignMissionVO>();

            foreach (Mission current in this.missions.Values)
            {
                CampaignMissionVO optional = staticDataController.GetOptional <CampaignMissionVO>(current.Uid);
                if (optional != null)
                {
                    if (this.IsMissionInProgress(optional) && !optional.IsCombatMission())
                    {
                        list.Add(optional);
                    }
                }
            }
            return(list);
        }
Beispiel #24
0
        public bool IsNewSpecOp(CampaignVO vo)
        {
            if (!this.HasCampaign(vo))
            {
                return(true);
            }
            StaticDataController staticDataController = Service.StaticDataController;

            foreach (Mission current in this.missions.Values)
            {
                CampaignMissionVO optional = staticDataController.GetOptional <CampaignMissionVO>(current.Uid);
                if (current.CampaignUid == vo.Uid && optional != null && optional.UnlockOrder == 1)
                {
                    return(false);
                }
            }
            return(true);
        }
Beispiel #25
0
        public int FindHighestHqLevel()
        {
            StaticDataController staticDataController = Service.StaticDataController;
            int num  = -1;
            int num2 = num;

            if (staticDataController == null || this.Buildings == null)
            {
                return(num2);
            }
            int i     = 0;
            int count = this.Buildings.Count;

            while (i < count)
            {
                BuildingTypeVO optional = staticDataController.GetOptional <BuildingTypeVO>(this.Buildings[i].Uid);
                if (optional != null && optional.Type == BuildingType.HQ && optional.Lvl >= num2)
                {
                    num2 = optional.Lvl;
                }
                i++;
            }
            return(num2);
        }
Beispiel #26
0
        public static void Initialize()
        {
            StaticDataController staticDataController = Service.StaticDataController;

            PropertyInfo[] properties = typeof(GameConstants).GetProperties(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetProperty);
            int            i          = 0;
            int            num        = properties.Length;

            while (i < num)
            {
                PropertyInfo    propertyInfo = properties[i];
                string          uid          = propertyInfo.Name.ToLower();
                GameConstantsVO optional     = staticDataController.GetOptional <GameConstantsVO>(uid);
                if (optional != null)
                {
                    string value = optional.Value;
                    propertyInfo.SetValue(null, Convert.ChangeType(value, propertyInfo.PropertyType), null);
                }
                i++;
            }
            staticDataController.Unload <GameConstantsVO>();
            GameConstants.InitRelocationCrystalsAndStarCost();
            GameConstants.InitWarBaseLevelMapping();
        }
Beispiel #27
0
        private void UpdateElements()
        {
            StaticDataController     staticDataController     = Service.StaticDataController;
            TargetedBundleController targetedBundleController = Service.TargetedBundleController;

            this.currentOffer = targetedBundleController.CurrentTargetedOffer;
            if (this.currentOffer != null)
            {
                UXLabel element = base.GetElement <UXLabel>("LabelTitle");
                element.Text = this.lang.Get(this.currentOffer.Title, new object[0]);
                UXLabel element2 = base.GetElement <UXLabel>("LabelDescription");
                element2.Text = this.lang.Get(this.currentOffer.Description, new object[0]);
                TextureVO optional = staticDataController.GetOptional <TextureVO>("gui_textures_promotional");
                if (optional != null)
                {
                    UXTexture element3 = base.GetElement <UXTexture>("TexturePromoArt");
                    element3.LoadTexture(optional.AssetName);
                }
                optional = staticDataController.GetOptional <TextureVO>("targeted_bundle_entry");
                if (optional != null)
                {
                    UXTexture element4 = base.GetElement <UXTexture>("TextureEnvironmentEntry");
                    element4.LoadTexture(optional.AssetName);
                }
                optional = staticDataController.GetOptional <TextureVO>("targeted_bundle_treads");
                if (optional != null)
                {
                    UXTexture element5 = base.GetElement <UXTexture>("TextureEnvironmentRight");
                    element5.LoadTexture(optional.AssetName);
                }
                optional = staticDataController.GetOptional <TextureVO>("targeted_bundle_treads");
                if (optional != null)
                {
                    UXTexture element6 = base.GetElement <UXTexture>("TextureEnvironmentLeft");
                    element6.LoadTexture(optional.AssetName);
                }
                optional = staticDataController.GetOptional <TextureVO>("targeted_bundle_dust");
                if (optional != null)
                {
                    UXTexture element7 = base.GetElement <UXTexture>("TextureEnvironmentDustRight");
                    element7.LoadTexture(optional.AssetName);
                    element7 = base.GetElement <UXTexture>("TextureEnvironmentDustLeft");
                    element7.LoadTexture(optional.AssetName);
                }
                int i     = 0;
                int count = this.currentOffer.RewardUIDs.Count;
                while (i < count)
                {
                    RewardVO rewardVO = staticDataController.Get <RewardVO>(this.currentOffer.RewardUIDs[i]);
                    if (!RewardUtils.SetupTargetedOfferCrateRewardDisplay(rewardVO, this.itemLabels[i], this.itemSprites[i]))
                    {
                        List <RewardComponentTag> rewardComponents = RewardUtils.GetRewardComponents(rewardVO);
                        int j      = 0;
                        int count2 = rewardComponents.Count;
                        while (j < count2)
                        {
                            RewardComponentTag rewardComponentTag = rewardComponents[j];
                            this.itemLabels[i].Text = this.lang.Get("AMOUNT_AND_NAME", new object[]
                            {
                                rewardComponentTag.RewardName,
                                rewardComponentTag.Quantity
                            });
                            RewardUtils.SetRewardIcon(this.itemSprites[i], rewardComponentTag.RewardGeometryConfig, AnimationPreference.AnimationAlways);
                            j++;
                        }
                    }
                    i++;
                }
                if (targetedBundleController.IsCurrencyCostOffer(this.currentOffer))
                {
                    this.SetupCurrencyCostOffer(this.currentOffer);
                }
                else
                {
                    this.SetupIAPLinkedOffer(this.currentOffer);
                }
                UXUtils.SetupAnimatedCharacter(this.characterSprite1, this.currentOffer.Character1Image, ref this.charGeometry1);
                UXUtils.SetupAnimatedCharacter(this.characterSprite2, this.currentOffer.Character2Image, ref this.charGeometry2);
                uint serverTime = Service.ServerAPI.ServerTime;
                this.timeRemaining   = (int)(targetedBundleController.OfferExpiresAt - serverTime);
                this.timerLabel.Text = this.lang.Get("expires_in", new object[]
                {
                    GameUtils.GetTimeLabelFromSeconds(this.timeRemaining)
                });
                this.valueLabel.Text = this.lang.Get("PERCENTAGE", new object[]
                {
                    this.currentOffer.Discount.ToString()
                });
                this.value2Label.Text = this.lang.Get("TARGETED_BUNDLE_DISCOUNT", new object[]
                {
                    this.currentOffer.Discount.ToString()
                });
            }
            else
            {
                Service.Logger.Error("No current offer available for targeted bundle screen");
            }
        }
Beispiel #28
0
        public void SetWidgetData(EpisodeWidgetDataVO vo, DateTime endDate, bool isCurrentTaskProgressComplete, bool isCurrentTaskTimeGated, bool isTimeGateActive, bool isTaskTimeGateComplete, int currentTaskTimeGate, uint taskProgressInfoEndTime, bool isNewEpisode)
        {
            this.currentWidgetVO = vo;
            StaticDataController staticDataController = Service.StaticDataController;
            EpisodeWidgetStateVO optional             = staticDataController.GetOptional <EpisodeWidgetStateVO>(this.currentWidgetVO.StateId);

            if (optional == null)
            {
                Service.Logger.Warn("Could not find EpisodeWidgetState: " + this.currentWidgetVO.StateId + " for EpisodeWidget: " + this.currentWidgetVO.Uid);
                return;
            }
            this.expirationDate = endDate;
            FactionType faction = Service.CurrentPlayer.Faction;

            this.titleLabel.Visible      = true;
            this.titleLabel.Text         = this.lang.Get(optional.GetTitleString(faction), new object[0]);
            this.titleLabelComplete.Text = this.lang.Get(optional.GetTitleString(faction), new object[0]);
            string backgroundTextureId = optional.GetBackgroundTextureId(faction);

            if (!string.IsNullOrEmpty(backgroundTextureId))
            {
                Service.AssetManager.RegisterPreloadableAsset(backgroundTextureId);
                this.LoadTexture(this.bgTexture, backgroundTextureId);
            }
            string text = optional.GetIconTextureId(faction);

            if (this.noticeCC != null)
            {
                this.noticeCC.Destroy();
                this.noticeCC = null;
            }
            this.iconTexture.Visible       = false;
            this.noticeLabel.Visible       = false;
            this.widgetCircleTimer.Visible = false;
            string text2 = string.Empty;
            string text3 = string.Empty;
            string text4 = this.lang.Get("TIMEGATE_ENDED_COLLECT_REWARDS", new object[0]);

            this.HideTimerIcon();
            this.needToShowCTA = false;
            if (isCurrentTaskProgressComplete && isCurrentTaskTimeGated && !isTimeGateActive && !isTaskTimeGateComplete)
            {
                text3 = this.lang.Get("TIMEGATE_TASK_COMPLETE_START_RESEARCH", new object[0]);
                this.needToShowCTA = true;
            }
            else if (isCurrentTaskProgressComplete && isCurrentTaskTimeGated && isTimeGateActive && !isTaskTimeGateComplete)
            {
                this.timeGateEndTimestamp = taskProgressInfoEndTime;
                uint   time  = ServerTime.Time;
                int    num   = (int)(this.timeGateEndTimestamp - time);
                float  value = 1f * (float)(currentTaskTimeGate - num) / (float)currentTaskTimeGate;
                string text5 = this.lang.Get("RESEARCH_ENDS_IN", new object[0]);
                string timeLabelFromSeconds = GameUtils.GetTimeLabelFromSeconds(num);
                this.pBarCircleTimer.Value = value;
                text = null;
                this.widgetCircleTimer.Visible = true;
                this.noticeCC = new CountdownControl(this.pBarCircleTimer, this.noticeLabel, text5, (int)this.timeGateEndTimestamp, currentTaskTimeGate, text4);
                text2         = string.Format(text5, timeLabelFromSeconds);
                this.ShowTimerIcon();
                Service.ViewTimeEngine.RegisterClockTimeObserver(this, 1f);
            }
            else if ((isCurrentTaskProgressComplete && !isCurrentTaskTimeGated) || (isCurrentTaskProgressComplete && isCurrentTaskTimeGated && isTimeGateActive && isTaskTimeGateComplete))
            {
                text3 = text4;
                this.needToShowCTA = true;
                text = this.GetTaskCrateIcon();
                if (string.Compare(this.loadedIconTextureId, text) != 0)
                {
                    this.iconTexture.MainTexture = null;
                }
            }
            else if (optional.ShowTimer)
            {
                this.noticeLabel.Visible = true;
                this.noticeCC            = new CountdownControl(this.noticeLabel, this.lang.Get("ENDS_IN", new object[0]), DateUtils.GetSecondsFromEpoch(this.expirationDate));
            }
            else if (isNewEpisode)
            {
                text3 = this.lang.Get("EPISODE_NEW_EPISODE_CTA", new object[0]);
                this.needToShowCTA = true;
            }
            if (!string.IsNullOrEmpty(text2))
            {
                this.noticeLabel.Visible = true;
                this.noticeLabel.Text    = text2;
            }
            this.noticeLabelComplete.Text = text3;
            if (!string.IsNullOrEmpty(text))
            {
                this.iconTexture.Visible = true;
                Service.AssetManager.RegisterPreloadableAsset(text);
                this.LoadTexture(this.iconTexture, text);
                this.loadedIconTextureId = text;
                this.ReadjustAnchors(true);
            }
            else
            {
                this.ReadjustAnchors(false);
            }
            if (this.needToShowCTA)
            {
                if (!this.showingCTA)
                {
                    this.ShowCTA();
                }
            }
            else if (this.showingCTA)
            {
                bool flag = this.ResetAnims();
                this.showingCTA = !flag;
            }
        }
Beispiel #29
0
        private void Refresh()
        {
            WarBuffVO         warBuffVO   = Service.StaticDataController.Get <WarBuffVO>(this.buffBaseData.BuffBaseId);
            SquadWarManager   warManager  = Service.SquadController.WarManager;
            SquadWarSquadData squadData   = warManager.GetSquadData(this.buffBaseData.OwnerId);
            FactionType       factionType = FactionType.Neutral;
            string            text        = this.buffBaseData.GetDisplayBaseLevel().ToString();

            if (squadData != null)
            {
                factionType = squadData.Faction;
            }
            string uid;
            string text2;

            if (factionType == FactionType.Empire)
            {
                uid   = warBuffVO.MasterEmpireBuildingUid;
                text2 = LangUtils.GetFactionName(factionType);
            }
            else if (factionType == FactionType.Rebel)
            {
                uid   = warBuffVO.MasterRebelBuildingUid;
                text2 = LangUtils.GetFactionName(factionType);
            }
            else
            {
                uid   = warBuffVO.MasterNeutralBuildingUid;
                text2 = this.lang.Get("BUFF_BASE_UNOWNED_FACTION_NAME", new object[0]);
            }
            this.spriteFactionIcon.SpriteName = UXUtils.GetIconNameFromFactionType(factionType);
            this.labelBuffBaseName.Text       = this.lang.Get("WAR_BOARD_BUFF_BASE_TITLE", new object[]
            {
                this.lang.Get(warBuffVO.BuffBaseName, new object[0]),
                LangUtils.GetPlanetDisplayName(warBuffVO.PlanetId)
            });
            this.labelBuffBaseLevel.Text = this.lang.Get("WAR_BOARD_BUFF_BASE_LEVEL", new object[]
            {
                text,
                text2
            });
            this.labelCaptureRequirement.Text = this.lang.Get("WAR_BOARD_BUFF_BASE_CAPTURE_REQUIREMENT", new object[0]);
            this.labelProduces.Text           = this.lang.Get("BUFF_BASE_PRODUCES", new object[0]);
            this.labelBuffDescription.Text    = this.lang.Get(warBuffVO.BuffStringDesc, new object[0]);
            this.labelLocked.Text             = this.lang.Get("PLANET_LOCKED_REQUIREMENT", new object[0]);
            this.labelLocked.Visible          = !Service.CurrentPlayer.IsPlanetUnlocked(warBuffVO.PlanetId);
            TextureVO            textureVO            = null;
            StaticDataController staticDataController = Service.StaticDataController;

            if (warBuffVO.PlanetId == GameConstants.TATOOINE_PLANET_UID)
            {
                textureVO = staticDataController.GetOptional <TextureVO>("squadwars_basedetails_tatooine");
            }
            else if (warBuffVO.PlanetId == GameConstants.YAVIN_PLANET_UID)
            {
                textureVO = staticDataController.GetOptional <TextureVO>("squadwars_basedetails_yavin");
            }
            else if (warBuffVO.PlanetId == GameConstants.DANDORAN_PLANET_UID)
            {
                textureVO = staticDataController.GetOptional <TextureVO>("squadwars_basedetails_dandoran");
            }
            else if (warBuffVO.PlanetId == GameConstants.ERKIT_PLANET_UID)
            {
                textureVO = staticDataController.GetOptional <TextureVO>("squadwars_basedetails_erkit");
            }
            else if (warBuffVO.PlanetId == GameConstants.TFA_PLANET_UID)
            {
                textureVO = staticDataController.GetOptional <TextureVO>("squadwars_basedetails_tfa");
            }
            else if (warBuffVO.PlanetId == GameConstants.HOTH_PLANET_UID)
            {
                textureVO = staticDataController.GetOptional <TextureVO>("squadwars_basedetails_hoth");
            }
            if (textureVO != null)
            {
                this.textureBaseDetail.LoadTexture(textureVO.AssetName);
            }
            BuildingTypeVO data = Service.StaticDataController.Get <BuildingTypeVO>(uid);

            UXUtils.SetupGeometryForIcon(this.spriteBuffBaseIcon, data);
            this.spriteBuffIcon.SpriteName = warBuffVO.BuffIcon;
            string empty = string.Empty;

            if (warManager.CanScoutBuffBase(this.buffBaseData, ref empty))
            {
                this.btnScout.VisuallyEnableButton();
                this.labelScout.TextColor = this.labelScout.OriginalTextColor;
            }
            else
            {
                this.btnScout.VisuallyDisableButton();
                this.labelScout.TextColor = UXUtils.COLOR_LABEL_DISABLED;
            }
        }
Beispiel #30
0
        public TransmissionsHolonetTab(HolonetScreen holoScreen, HolonetControllerType holonetControllerType) : base(holoScreen, holonetControllerType)
        {
            base.InitializeTab("TransmissionsLogTab", "hn_transmissions_tab");
            List <TransmissionVO> transmissions = Service.HolonetController.TransmissionsController.Transmissions;
            int count = transmissions.Count;

            this.table = holoScreen.GetElement <UXTable>("TransmissionsLogTable");
            this.table.SetTemplateItem("TransmissionsLogItem");
            string title = string.Empty;
            string body  = string.Empty;

            for (int i = 0; i < count; i++)
            {
                bool           flag           = false;
                TransmissionVO transmissionVO = transmissions[i];
                switch (transmissionVO.Type)
                {
                case TransmissionType.Research:
                    title = this.lang.Get("hn_transmission_research_title", new object[]
                    {
                        this.GetResearchDisplayName(transmissionVO.TransData)
                    });
                    body = this.lang.Get("hn_transmission_research_body", new object[]
                    {
                        this.GetResearchDisplayName(transmissionVO.TransData),
                        transmissionVO.Btn1Data
                    });
                    flag = true;
                    break;

                case TransmissionType.HqUpgrade:
                    title = this.lang.Get("hn_transmission_hqupgrade_title", new object[0]);
                    body  = this.lang.Get("hn_transmission_hqupgrade_body", new object[]
                    {
                        transmissionVO.Btn1Data
                    });
                    flag = true;
                    break;

                case TransmissionType.NavigationCenterUpgrade:
                    title = this.lang.Get("hn_transmission_pcupgrade_title", new object[0]);
                    body  = this.lang.Get("hn_transmission_pcupgrade_body", new object[]
                    {
                        transmissionVO.Btn1Data
                    });
                    flag = true;
                    break;

                case TransmissionType.Conflict:
                {
                    string text  = string.Empty;
                    string text2 = string.Empty;
                    StaticDataController staticDataController = Service.StaticDataController;
                    TournamentVO         optional             = staticDataController.GetOptional <TournamentVO>(transmissionVO.TransData);
                    TournamentTierVO     optional2            = staticDataController.GetOptional <TournamentTierVO>(transmissionVO.Btn1Data);
                    if (optional != null && optional2 != null)
                    {
                        text  = LangUtils.GetPlanetDisplayName(optional.PlanetId);
                        text2 = this.lang.Get(optional2.RankName, new object[0]) + " " + this.lang.Get(optional2.Division, new object[0]);
                    }
                    title = this.lang.Get("hn_transmission_conflict_title", new object[0]);
                    body  = this.lang.Get("hn_transmission_conflict_body", new object[]
                        {
                            text,
                            text2
                        });
                    flag = true;
                    break;
                }

                case TransmissionType.WarPreparation:
                    title = this.lang.Get(LangUtils.AppendPlayerFactionToKey("transm_war_prep_title"), new object[0]);
                    body  = this.lang.Get(LangUtils.AppendPlayerFactionToKey("transm_war_prep_body"), new object[0]);
                    flag  = true;
                    break;

                case TransmissionType.WarStart:
                    title = this.lang.Get(LangUtils.AppendPlayerFactionToKey("transm_war_start_title"), new object[0]);
                    body  = this.lang.Get(LangUtils.AppendPlayerFactionToKey("transm_war_start_body"), new object[0]);
                    flag  = true;
                    break;

                case TransmissionType.WarEnded:
                    title = this.lang.Get(LangUtils.AppendPlayerFactionToKey("transm_war_end_title"), new object[0]);
                    body  = this.lang.Get(LangUtils.AppendPlayerFactionToKey("transm_war_end_body"), new object[0]);
                    flag  = true;
                    break;

                case TransmissionType.SquadChange:
                {
                    object[] array = (transmissionVO.TransData ?? string.Empty).Split(new char[]
                        {
                            '\\'
                        });
                    if (array.Length > 1)
                    {
                        title = this.lang.Get("hn_squad_application_accepted_title", new object[]
                            {
                                array[1]
                            });
                        body = this.lang.Get("hn_squad_application_accepted_body", array);
                    }
                    flag = true;
                    break;
                }

                case TransmissionType.GuildLevelUp:
                    title = this.lang.Get("hn_perks_squad_level_up_title", new object[0]);
                    body  = this.lang.Get("hn_perks_squad_level_up_body", new object[]
                    {
                        transmissionVO.SquadLevel
                    });
                    flag = true;
                    break;

                case TransmissionType.DailyCrateReward:
                {
                    title = this.lang.Get("hn_daily_crate_reward_title", new object[0]);
                    CrateVO crateVO = Service.StaticDataController.Get <CrateVO>(transmissionVO.CrateId);
                    body = this.lang.Get("hn_daily_crate_reward_body", new object[]
                        {
                            LangUtils.GetCrateDisplayName(crateVO)
                        });
                    flag = true;
                    break;
                }
                }
                if (flag)
                {
                    this.AddCustomTransmission(transmissionVO, title, body, i);
                }
                else
                {
                    this.AddGenericTransmission(transmissionVO, i);
                }
            }
        }