public override bool Run() { try { if (Responder.Instance.TutorialModel.IsTutorialRunning()) { if (!Target.CancelTutorial()) { return(false); } Responder.Instance.TutorialModel.ForceExitTutorial(); } List <Sim> lazyList = new List <Sim>(); if (!PreTimeTravel1(this, this, lazyList)) { return(false); } foreach (Sim sim4 in lazyList) { if (!sim4.SimDescription.Baby) { TimePortal.GatherAround entry = TimePortal.GatherAround.Singleton.CreateInstance(Target, sim4, GetPriority(), Autonomous, CancellableByPlayer) as TimePortal.GatherAround; entry.mMasterInteraction = this; sim4.InteractionQueue.AddNext(entry); } } int num; if (!Actor.RouteToSlotListAndCheckInUse(Target, TimePortal.kRoutingSlots, out num)) { CancelFollowers(lazyList); return(false); } if (Actor.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached))) { CancelFollowers(lazyList); return(false); } if (!PreTimeTravel2(this, lazyList)) { return(false); } EnterStateMachine("timeportal", "Enter", "x", "portal"); AddPersistentScriptEventHandler(0xc9, CameraShakeEvent); AnimateSim("Call Over"); Skill futureSkill = Actor.SkillManager.AddElement(SkillNames.Future); if (futureSkill.SkillLevel >= 0x3) { AnimateSim("Jump In"); } else { AnimateSim("Apprehensive"); } bool succeeded = true; if (!GameUtils.IsFutureWorld()) { // Custom succeeded = TimePortalEx.TravelToFuture(Target, Actor, new List <Sim>(mFollowerGroup), new List <ulong>(mFollowerGroupIDs)); } if (succeeded) { foreach (Sim sim7 in lazyList) { futureSkill = sim7.SkillManager.GetElement(SkillNames.Future); if (futureSkill != null) { futureSkill.AddPoints(kFollowerFutureSkillPointGain, true, false); } } } else { CancelFollowers(lazyList); SpeedTrap.Sleep(0x3c); AnimateSim("Spit Out"); Target.SwitchActiveState(); } AnimateSim("Exit"); EndCommodityUpdates(succeeded); StandardExit(); if (GameUtils.IsFutureWorld()) { Target.StopActiveFX(); // Custom GameStatesEx.UpdateTelemetryAndTriggerTravelBackToHomeWorld(); SendEventForActorAndFollowers(Actor, lazyList, EventTypeId.kTravelToPresent); } return(true); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); } finally { TravelUtil.PlayerMadeTravelRequest = false; //Sims3.Gameplay.Gameflow.Singleton.EnableSave(this); } return(false); }
public override bool Run() { try { string str; mTimeTravelDef = InteractionDefinition as Definition; if (!Target.RouteToMachine(Actor, false, null)) { return(false); } if (!TimePortalTravelEx.PreTimeTravel1(this)) { return(false); } if (!TimePortalTravelEx.PreTimeTravel2(this)) { return(false); } Actor.SimDescription.Contactable = false; EnterStateMachine("TimeMachine", "Enter", "x"); SetActor("timeMachine", Target); SetParameter("isFuture", mTimeTravelDef.TimePeriod == TimeMachine.TravelTimePeriod.Future); AddOneShotScriptEventHandler(0x3ee, OnEnterAnimationEvent); AddOneShotScriptEventHandler(0x66, ToggleHiddenAnimationEvent); AnimateSim("GetIn"); Target.EnableRoutingFootprint(Actor); mTimeTravelAlarm = AlarmManager.Global.AddAlarmRepeating(RandomUtil.GetFloat(TimeMachine.kMinutesBetweenAdventureTNSMin, TimeMachine.kMinutesBetweenAdventureTNSMax), TimeUnit.Minutes, new AlarmTimerCallback(TimeTravelCallback), RandomUtil.GetFloat(TimeMachine.kMinutesBetweenAdventureTNSMin, TimeMachine.kMinutesBetweenAdventureTNSMax), TimeUnit.Minutes, "Time Travel Alarm For:" + Actor.SimDescription.FullName, AlarmType.AlwaysPersisted, Actor); Target.SetMaterial("InUse"); bool succeeded = true; if (!GameUtils.IsFutureWorld()) { // Custom succeeded = TimePortalEx.TravelToFuture(null, Actor, new List <Sim>(), new List <ulong>()); } succeeded = DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)); EndCommodityUpdates(succeeded); Target.PickExitStateAndSound(mTimeTravelDef.TimePeriod, out str, out mExitSound); AddOneShotScriptEventHandler(0x3e9, OnExitAnimationEvent); AddOneShotScriptEventHandler(0x3ef, OnExitAnimationEvent); AddOneShotScriptEventHandler(0x67, ToggleHiddenAnimationEvent); AnimateSim(str); if (!TimePortalTravelEx.PostTimeTravel1(this, succeeded)) { return(false); } Target.SetMaterial("default"); AnimateSim("Exit"); if (!string.IsNullOrEmpty(mTravelSummary)) { Actor.ShowTNSIfSelectable(mTravelSummary, StyledNotification.NotificationStyle.kGameMessagePositive, Target.ObjectId, Actor.ObjectId); } StandardExit(); Target.Repairable.UpdateBreakage(Actor); InventingSkill skill = Actor.SkillManager.GetSkill <InventingSkill>(SkillNames.Inventing); if (succeeded && (skill != null)) { skill.RegisterTimeTravelDone(); } if (GameUtils.IsFutureWorld()) { EventTracker.SendEvent(EventTypeId.kTravelToPresent, Actor); // Custom GameStatesEx.UpdateTelemetryAndTriggerTravelBackToHomeWorld(); } return(succeeded); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } finally { TravelUtil.PlayerMadeTravelRequest = false; } }
public override bool Run() { try { if (Responder.Instance.TutorialModel.IsTutorialRunning()) { if (!Target.CancelTutorial()) { return(false); } Responder.Instance.TutorialModel.ForceExitTutorial(); } if (Target.IsBroken) { return(false); } if (!PreTimeTravel1(this)) { return(false); } int num; if (!Actor.RouteToSlotListAndCheckInUse(Target, TimePortal.kRoutingSlots, out num)) { return(false); } if (Actor.HasExitReason(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached))) { return(false); } if (!PreTimeTravel2(this)) { return(false); } EnterStateMachine("timeportal", "Enter", "x", "portal"); AddPersistentScriptEventHandler(0xc9, CameraShakeEvent); Skill futureSkill = Actor.SkillManager.AddElement(SkillNames.Future); if (futureSkill.SkillLevel >= 0x3) { AnimateSim("Jump In"); } else { AnimateSim("Apprehensive"); } bool succeeded = true; if (!GameUtils.IsFutureWorld()) { // Custom succeeded = TimePortalEx.TravelToFuture(Target, Actor, new List <Sim>(), new List <ulong>()); if (!succeeded) { SpeedTrap.Sleep(0x3c); AnimateSim("Spit Out"); Target.SwitchActiveState(); } } if (!PostTimeTravel1(this, succeeded)) { return(false); } AnimateSim("Exit"); EndCommodityUpdates(succeeded); StandardExit(); if (GameUtils.IsFutureWorld()) { EventTracker.SendEvent(EventTypeId.kTravelToPresent, Actor); Target.StopActiveFX(); // Custom GameStatesEx.UpdateTelemetryAndTriggerTravelBackToHomeWorld(); } return(true); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); } finally { TravelUtil.PlayerMadeTravelRequest = false; //Sims3.Gameplay.Gameflow.Singleton.EnableSave(this); } return(false); }
public override bool Run() { try { Target.mRoutingSims.Add(Actor); if (!Target.RouteToPortal(Actor)) { Actor.AddExitReason(ExitReason.RouteFailed); Target.mRoutingSims.Remove(Actor); return(false); } Target.mRoutingSims.Remove(Actor); List <Sim> lazyList = new List <Sim>(); if (!TimePortalTravelWithEx.PreTimeTravel1(this, this, lazyList)) { return(false); } mTargetPortal = Target; mTargetPortal.AddToUseList(Actor); if (!TimePortalTravelWithEx.PreTimeTravel2(this, lazyList)) { return(false); } mTargetPortal.EnableFootprint(FootprintPlacementHash); mTargetPortal.PushSimsFromFootprint(FootprintPlacementHash, Actor, null, false); EnterStateMachine("AncientPortal", "Enter", "x", "portal"); AddOneShotScriptEventHandler(0x65, HideSim); AddOneShotScriptEventHandler(0x66, ShowSim); AnimateSim("InsidePortal"); SetActor("portal", mTargetPortal); bool succeeded = true; if (!GameUtils.IsFutureWorld()) { // Custom succeeded = TimePortalEx.TravelToFuture(null, Actor, new List <Sim>(mFollowerGroup), new List <ulong>(mFollowerGroupIDs)); } if (succeeded) { foreach (Sim sim7 in lazyList) { Skill futureSkill = sim7.SkillManager.GetElement(SkillNames.Future); if (futureSkill != null) { futureSkill.AddPoints(TimePortalTravelWithEx.kFollowerFutureSkillPointGain, true, false); } } } Slot slotName = mTargetPortal.GetRoutingSlots()[0x0]; Vector3 positionOfSlot = mTargetPortal.GetPositionOfSlot(slotName); Vector3 forwardOfSlot = mTargetPortal.GetForwardOfSlot(slotName); Actor.SetPosition(positionOfSlot); Actor.SetForward(forwardOfSlot); mTargetPortal.DisableFootprint(FootprintPlacementHash); AnimateSim("Exit"); for (int i = 0x0; i < kPotentialTravelBuffs.Length; i++) { if (RandomUtil.RandomChance(kChanceForEachBuff)) { Actor.BuffManager.AddElement(kPotentialTravelBuffs[i], Origin.FromAncientPortal); } } EndCommodityUpdates(succeeded); StandardExit(); mTargetPortal.RemoveFromUseList(Actor); Actor.Wander(1f, 2f, false, RouteDistancePreference.PreferNearestToRouteOrigin, false); if (GameUtils.IsFutureWorld()) { // Custom GameStatesEx.UpdateTelemetryAndTriggerTravelBackToHomeWorld(); TimePortalTravelWithEx.SendEventForActorAndFollowers(Actor, lazyList, EventTypeId.kTravelToPresent); } return(succeeded); } catch (ResetException) { throw; } catch (Exception e) { Common.Exception(Actor, Target, e); return(false); } finally { TravelUtil.PlayerMadeTravelRequest = false; } }