Example #1
0
        public static bool PreTimeTravel1(InteractionInstance ths, ITravelWith travelWith, List <Sim> travelers)
        {
            Sim actor = ths.InstanceActor as Sim;

            if (!UIUtils.IsOkayToStartModalDialog())
            {
                return(false);
            }

            if (GameUtils.IsFutureWorld())
            {
                foreach (Sim sim in actor.Household.Sims)
                {
                    if (sim != actor)
                    {
                        GreyedOutTooltipCallback callback = null;
                        if (TravelerSpace.Helpers.TravelUtilEx.CanSimTriggerTravelToFutureWorld(sim, true, ref callback))
                        {
                            Lazy.Add <List <Sim>, Sim>(ref travelers, sim);
                        }
                    }
                }
            }
            else
            {
                travelers.AddRange(ths.GetSelectedObjectsAsSims());
            }

            if (travelers.Count == 0)
            {
                return(false);
            }

            if ((actor.OpportunityManager != null) && actor.OpportunityManager.HasOpportunity(OpportunityNames.EP11_HelpingTheTimeTraveler01))
            {
                return(false);
            }

            string portal;

            TravelUtil.PlayerMadeTravelRequest = true;
            Dictionary <Sim, OpportunityNames> dictionary = CheckOpportunities(actor, travelers);

            if (GameUtils.IsFutureWorld())
            {
                portal = TimePortal.LocalizeString("ConfirmReturnWith", new object[0x0]);
            }
            else if (dictionary.Count > 0x0)
            {
                portal = TimePortal.LocalizeString("ConfirmTravelWith", new object[0x0]) + TimePortal.LocalizeString("ConfirmWarningTravelWith", new object[0x0]);
            }
            else
            {
                portal = TimePortal.LocalizeString("ConfirmTravelWith", new object[0x0]);
            }

            if (!TwoButtonDialog.Show(portal, Localization.LocalizeString("Ui/Caption/Global:Accept", new object[0x0]), Localization.LocalizeString("Ui/Caption/Global:Cancel", new object[0x0])))
            {
                return(false);
            }

            ths.CancellableByPlayer = false;
            //Sims3.Gameplay.Gameflow.Singleton.DisableSave(this, "Ui/Caption/HUD/DisasterSaveError:Traveling");
            if (dictionary.Count > 0x0)
            {
                foreach (Sim sim2 in dictionary.Keys)
                {
                    if (sim2.OpportunityManager != null)
                    {
                        sim2.OpportunityManager.CancelOpportunity(dictionary[sim2]);
                    }
                }
            }

            if ((GameUtils.IsFutureWorld() && (actor.OpportunityManager != null)) && actor.OpportunityManager.HasOpportunity(OpportunityNames.EP11_RecalibrateDefenseGrid))
            {
                actor.OpportunityManager.CancelOpportunity(OpportunityNames.EP11_RecalibrateDefenseGrid);
            }

            foreach (Sim sim3 in travelers)
            {
                travelWith.AddFollower(sim3);
            }

            return(true);
        }