Example #1
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);
                }
            }
        }
Example #2
0
        private void VerifyCurrentObjectivesAgainstMeta()
        {
            IDataController dataController = Service.Get <IDataController>();
            Dictionary <string, ObjectiveGroup> objectives = Service.Get <CurrentPlayer>().Objectives;

            foreach (KeyValuePair <string, ObjectiveGroup> current in objectives)
            {
                bool flag  = false;
                int  i     = 0;
                int  count = current.get_Value().ProgressObjects.Count;
                while (i < count)
                {
                    string objectiveUid = current.get_Value().ProgressObjects[i].ObjectiveUid;
                    if (dataController.GetOptional <ObjectiveVO>(objectiveUid) == null)
                    {
                        flag = true;
                        Service.Get <StaRTSLogger>().WarnFormat("Planet {0} has an invalid objective {1}", new object[]
                        {
                            current.get_Key(),
                            objectiveUid
                        });
                    }
                    i++;
                }
                if (flag)
                {
                    ForceObjectivesUpdateCommand command = new ForceObjectivesUpdateCommand(current.get_Key());
                    Service.Get <ServerAPI>().Sync(command);
                }
            }
        }