Пример #1
0
        public static void DoTravelActions(StoryProgressionService ths, float yearsGone, List<SimDescription> dyingSims)
        {
            Common.StringBuilder msg = new Common.StringBuilder("DoTravelActions");

            msg += Common.NewLine + "DyingSims: " + dyingSims.Count;
            msg += Common.NewLine + "YearsGone: " + yearsGone;

            GenerateOffspringEx.PossiblyGenerateOffspring(dyingSims, yearsGone);

            int maxActions = StoryProgressionService.kTravellingMaxActions;
            if (!CrossWorldControl.sRetention.mPerformTravelActions)
            {
                maxActions = 0;
            }

            foreach (SimDescription description in dyingSims)
            {
                try
                {
                    msg += Common.NewLine + "Sim: " + description.FullName;

                    KillSim.KillSimExecute(description, SimDescription.DeathType.OldAge);
                }
                catch (Exception e)
                {
                    Common.Exception(description, e);
                }
            }

            if (GameUtils.GetCurrentWorldType() == WorldType.Vacation)
            {
                bool alter = true;

                WorldName currentWorld = GameUtils.GetCurrentWorld();

                switch(currentWorld)
                {
                    case WorldName.China:
                    case WorldName.Egypt:
                    case WorldName.France:
                        alter = false;
                        break;
                }

                if (alter)
                {
                    //maxActions = 5;

                    GameUtils.CheatOverrideCurrentWorld = WorldName.France;

                    try
                    {
                        StoryProgressionService.StaticShutdown();
                        StoryProgressionService.StaticInitialize();

                        ths = StoryProgressionService.sService;
                    }
                    finally
                    {
                        GameUtils.CheatOverrideCurrentWorld = currentWorld;
                    }
                }
            }

            int count = 0;

            float maxValue = float.MaxValue;
            for (int i = 0x0; (maxValue > StoryProgressionService.kTravellingTargetError) && (i < maxActions); i++)
            {
                try
                {
                    maxValue = ths.TryOneAction(true);

                    count++;
                }
                catch (Exception e)
                {
                    Common.DebugException("TryOneAction", e);
                }
            }

            msg += Common.NewLine + "Actions: " + count;

            Common.DebugWriteLog(msg);
        }